akhauriyash/Code-Regression huggingface dataset:
#pragma region include
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstdio>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define MOD 1000000007
#define INF 1000000000
#define LLINF 4000000000000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#pragma endregion

//#define __DEBUG__
#ifdef  __DEBUG__
#define dump(x) cerr << #x << " = " << (x) << " [" << __LINE__ << ":" << __FUNCTION__ << "] " << endl;
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    REP(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
// pair出力
template<typename T, typename U>
ostream& operator << (ostream& os, pair<T, U>& p) {
    return os << "(" << p.first << ", " << p.second << ")";
}
// map出力
template<typename T, typename U>
ostream& operator << (ostream& os, map<T, U>& map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set 出力
template<typename T>
ostream& operator << (ostream& os, set<T>& set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
#endif

//pow
template<typename T>
T pow(T k, T n) {
    T x = 1;
    while (n > 0) {
        if (n & 1) {
            x *= k;
        }
        k *= k;
        n >>= 1;
    }
    return x;
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N, K; cin >> N >> K;
    double ans = 0;
    int m = 0;
    for (int i = N; i >= 1; i--) {
        while (pow(0.5, (double)m) > (double)i / K) {
            m++;
        }
        ans += pow(0.5, (double)m) / N;
    }
    printf("%.12f\n", ans);
    getchar(); getchar();
}

Measured memory_bytes: 256
#include<stdio.h>
 
int prime[200000]={},num[250000]={};
int main(void){
    int i,j,k=0,N,count;
    prime[k++]=2;
    prime[k++]=3;
 
    for(i=5;i<250000;i+=2){
        int flag=0;
        for(j=0;i>=prime[j]*prime[j];j++){
            if(i%prime[j]==0){
                flag=1;
                break;
            }
        }
        if(flag==0){prime[k++]=i;}
    }
 
     
     
    for(i=0;i<k;i++){
        num[prime[i]]=1;
    }
 
     
        while(1){
        scanf("%d",&N);
        if(N==0){break;}
        count=0;
        for(i=N+1;i<=2*N;i++){
            count+=num[i];
        }
 
        printf("%d\n",count);
 
    }
    return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
const ll MAX = 1001001;
const ll MOD = 1000000007;
int main()
{
    string s, t;
    cin >> s >> t;
    ll n = s.size();
    rep(i, n)
    {
        if (s.substr(0, i) == t.substr(n - i, i))
        {
            if (s.substr(i, n - i) == t.substr(0, n - i))
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>

#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,index=0;
    cin>>n;
    ll a[n],b[n],c[n],ans[2][n],sum,maki=0;
    for(int i=0;i<2;i++){
        for(int j=0;j<n;j++){
            ans[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++){
        cin>>c[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    sort(c,c+n);
    for(ll i=0;i+maki<n;i++){
        while(a[i+index]<b[i] && i+index<n){
            index++;
            ans[0][i]++;
        }
        index--;
        if(index>0){
            maki=index;
        }
        else{
            maki=0;
        }
    }
    for(ll i=1;i<n;i++){
        ans[0][i]+=ans[0][i-1];
    }
    index=0;
    maki=0;
    for(ll i=0;i+maki<n;i++){
        while(b[i+index]<c[i] && i+index<n){
            
            ans[1][i]+=ans[0][i+index];
            index++;
        }
        index--;
        if(index>0){
            maki=index;
        }
        else{
            maki=0;
        }
    }
    sum=ans[1][0];
    for(ll i=1;i<n;i++){
        ans[1][i]+=ans[1][i-1];
        sum+=ans[1][i];
    }
    cout << sum<<endl;
    return 0;
}



Measured memory_bytes: 4224
#include<iostream>

using namespace std;

int main () {

        int H,W;
        cin >> H >> W;
        while (H || W) {
                for (int i = 0; i < H; i++) {
                        for (int j = 0; j < W; j++) {
                                cout << "#";
                        }
                        if (W > 0) {
                                cout << endl;
                        }
                }
                cout << endl;
                cin >> H >> W;
        }

        return 0;

}

Measured memory_bytes: 1156
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

}

signed main() {
	ll h, w;

	cin >> h >> w;

	vector<string> a(h, "");
	vector<vector<ll>> dp(h + 1, vector<ll>(w + 1, 0));

	REP(i, h) {
		cin >> a[i];
	}

	dp[1][1] = 1;

	FOR(i, 1, h + 1) {
		FOR(j, 1, w + 1) {
			if (a[i - 1][j - 1] == '#') {
				continue;
			}
			dp[i][j] = max(dp[i][j], dp[i - 1][j] + dp[i][j - 1]) % MOD;
		}
	}

	cout << dp[h][w] % MOD << endl;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

int main(){
	int n,a[100000]; cin>>n;
	rep(i,n) cin>>a[i];

	lint dp[100000][2];
	dp[0][0]=a[0];
	dp[0][1]=-a[0];
	rep(i,n-1){
		dp[i+1][0]=max(dp[i][0]+a[i+1],dp[i][1]-a[i+1]);
		dp[i+1][1]=max(dp[i][0]-a[i+1],dp[i][1]+a[i+1]);
	}
	cout<<dp[n-1][0]<<endl;

	return 0;
}


Measured memory_bytes: 2176
H = int(input())
def maxHeapify(A, i):
    l = 2 * i + 1
    r = 2 * i + 2
    if l < H and A[l] > A[i]:
        largest = l
    else:
        largest = i
    if r < H and A[r] > A[largest]:
        largest = r
    if largest != i:
        A[i], A[largest] = A[largest], A[i]
        maxHeapify(A, largest)

def buildMaxHeap(A):
    for i in range(H//2 + 1, -1, -1):
        maxHeapify(A, i)

A = [int(i) for i in input().split()]
buildMaxHeap(A)
print(' ' + ' '.join(map(str,A)))

Measured memory_bytes: 65648
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<vector>
#include<map>
#include<queue>
 
#define N 200005
#define M 8000005
 
#define ls (t<<1)
#define rs ((t<<1)|1)
#define mid ((l+r)>>1)
 
#define mk make_pair
#define pb push_back
#define fi first
#define se second
 
#define Mo 1000000007
 
using namespace std;
 
int i,j,m,n,p,k,s[N],q,l,r,g[N];
 
vector<int>v[N];
 
int f[N],tree[N*4];
 
int ask(int ll,int l,int r,int t)
{
		if (l==r) return tree[t];
		else 
		{
				if (ll<=mid) return min(tree[t],ask(ll,l,mid,ls));
				else return min(tree[t],ask(ll,mid+1,r,rs));
		}
}
 
void insert(int ll,int rr,int c,int l,int r,int t)
{
		if (ll<=l&&r<=rr) tree[t]=min(tree[t],c);
		else 
		{
				if (ll<=mid) insert(ll,rr,c,l,mid,ls);
				if (rr>mid)  insert(ll,rr,c,mid+1,r,rs);
		}
}
 
 
void build_tree(int l,int r,int t)
{
		tree[t]=(int)1e9;
		if  (l==r) return;
		build_tree(l,mid,ls);
		build_tree(mid+1,r,rs);
}
 
int main()
{
		scanf("%d",&n);
		for (i=1;i<=n;++i) scanf("%d",&s[i]),s[i]+=s[i-1];
		scanf("%d",&q);
		for (i=1;i<=q;++i) 
			scanf("%d%d",&l,&r),v[r].pb(l);
		memset(f,60,sizeof(f));
		memset(g,60,sizeof(g));
		f[0]=0; g[0]=0;
		build_tree(0,n,1);
		for (i=1;i<=n;++i)
		{
				g[i]=g[i-1]+(s[i]-s[i-1]==1);
				int G;
				for (int j: v[i])
					G=min(g[j-1]-(j-1-s[j-1]),ask(j-1,0,n,1)),
					insert(j,i,G,0,n,1),
					g[i]=min(g[i],G+(i-s[i]));
		}
		printf("%d\n",g[n]);
}

Measured memory_bytes: 15232
# -*- coding: utf-8 -*-

n = int(input())
a = [input() for i in range(n)]
count = 0

for i in range(n - 1):
    if a[i][-1] != a[i+1][0]:
        count += 1

import collections
b = collections.Counter(a)

if b.most_common(1)[0][1] >= 2:
    count += 1

if count == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

const int maxN = 1e6;
bool notPrime[maxN + 1];
vector<lli> primes;

list<lli> getPrimeFactors(lli num)
{
  list<lli> primeFactors;
  for (lli i: primes)
  {
    if (i > num) break;
    if (num % i == 0)
    {
      primeFactors.push_back(i);
      while (num % i == 0) num /= i;
    }
  }
  if (num != 1)
    primeFactors.push_back(num);
  return primeFactors;
}

int main()
{
  notPrime[0] = notPrime[1] = true;
  for (int i = 2; i <= maxN; i ++)
  {
    if (!notPrime[i]) primes.push_back(i);
    for (int j = 0; i*primes[j] <= maxN; j ++)
    {
      notPrime[i*primes[j]] = true;
      if (i % primes[j] == 0) break;
    }
  }
  // for (int i = 2; i <= maxN; i ++)
  //   for (int j = 2; i*j <= maxN; j ++)
  //     notPrime[i*j] = true;
  // for (int i = 2; i <= maxN; i ++)
  //   if (!notPrime[i])
  //     primes.push_back(i);

  lli a, b; scanf("%lld %lld", &a, &b);
  list<lli> primeFactors = getPrimeFactors(__gcd(a, b));
  printf("%d\n", (int) primeFactors.size() + 1);

  return 0;
}

Measured memory_bytes: 2424
X, N = map(int, input().split())
*P, = map(int, input().split())
l = set(range(-200, 200)) - set(P)
m = 10 ** 7
ans = 0
for i in l:
    if abs(i - X) < m:
        ans = i
        m = abs(i - X)
print(ans)


Measured memory_bytes: 9220
#include <bits/stdc++.h>

using namespace std;

const int Nmax = 303;

int n, m, i, st, dr, mid, a[Nmax][Nmax], ap[Nmax], p[Nmax], j;
bool sel[Nmax];

bool verif(int x)
{
    int i, id;
    for(i=1; i<=m; ++i) sel[i] = 1, ap[i] = 0;
    for(i=1; i<=n; ++i) p[i] = 1, ++ap[a[i][1]];

    while(true)
    {
        id = 0;
        for(i=1; i<=m; ++i)
            if(ap[i] > ap[id]) id = i;

        if(ap[id] <= x) return 1;
        sel[id] = 0; ap[id] = 0;

        for(i=1; i<=n; ++i)
        if(a[i][p[i]] == id)
        {
            while(!sel[a[i][p[i]]] && p[i] <= m) ++p[i];
            if(p[i] == m+1) return 0;
            ++ap[a[i][p[i]]];
        }
    }
}

int main()
{
    cin >> n >> m;
    for(i=1; i<=n; ++i)
        for(j=1; j<=m; ++j) cin >> a[i][j];

    st = 1; dr = n;
    while(st<=dr)
    {
        mid = (st+dr)/2;
        if(verif(mid)) dr = mid-1;
            else st = mid+1;
    }

    cout << st << '\n';

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1,-1, 0, 0};
int dy[4] = {0, 0, 1,-1};
signed main() {
    string S;
    cin >> S;
    S+="Z";
    int cnt = 0;
    int ans = 0;
    for(int i = 0; i < S.size()-1; i++) {
        if(S[i] == 'A') {
            cnt++;
        }
        else if(S[i] == 'B' && S[i+1] == 'C') {
            ans+=cnt;
            i++;
        }
        else {
            cnt = 0;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3700
///
// File:  2165.cpp
// Author: ymiyamoto
//
// Created on Tue Nov 28 22:51:14 2017
//

#include <cmath>
#include <cstdint>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

#define EPS 1e-9
#define M 256

uint32_t R(uint32_t i, uint32_t S, uint32_t A, uint32_t C)
{
  if (i == 0)
    return S;
  else
    return (A * R(i - 1, S, A, C) + C) % M;
}

double H(vector<uint32_t> O)
{
  double h = 0.0;
  uint32_t N = O.size();
  map<uint32_t, uint32_t> nums;
  for (uint32_t i = 0; i < O.size(); i++) {
    if (nums.count(O[i]) == 0) {
      nums[O[i]] = 1;
    } else {
      nums[O[i]] += 1;
    }
  }

  for (auto iter = nums.begin(); iter != nums.end(); iter++) {
    h += (double)iter->second * log((double)iter->second / (double)N);
  }

  return -h;
}

int32_t main()
{
  while (true) {
    uint32_t N;
    cin >> N;
    if (N == 0) break;

    vector<uint32_t> I(N + 1, 0);
    for (uint32_t i = 1; i <= N; i++) {
      cin >> I[i];
    }

    double min_O = 1e6;
    uint32_t max_S, max_A, max_C;
    for (uint32_t S = 0; S <= 15; S++) {
      for (uint32_t A = 0; A <= 15; A++) {
        for (uint32_t C = 0; C <= 15; C++) {
          vector<uint32_t> O;
          for (uint32_t i = 1; i <= N; i++) {
            O.push_back((I[i] + R(i, S, A, C)) % M);
          }
          double o = H(O);
          if (o + EPS < min_O) {
            min_O = o;
            max_S = S;
            max_A = A;
            max_C = C;
          }
        }
      }
    }
    cout << max_S << " " << max_A << " " << max_C << endl;
  }

  return 0;
}

Measured memory_bytes: 3384
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(X) ((int)(X).size())
#define all(X) (X).begin(),(X).end()
#define ll long long
#define pi pair<int,int>
const int N=3e5+5,MOD=1e9+7;
 
using namespace std;
int n;
ll memo[105][26][26][26];

bool ok(string a){
	string bad = "agc";
	if(a.find(bad)!=std::string::npos)return false;
	for(int i=0;i<sz(a)-1;i++){
		swap(a[i],a[i+1]);
		if(a.find(bad)!=std::string::npos)return false;
		swap(a[i],a[i+1]);
	}
	return true;
}
ll solve(int indx,char c1,char c2,char c3){
	if(indx==n)return 1;
	string a = "";
	a+=c1;
	a+=c2;
	a+=c3;
	//cout<<a<<endl;
	ll &ret = memo[indx][c1-'a'][c2-'a'][c3-'a'];
	if(~ret)return ret;
	ret=0;
	for(auto x: {'a','g','c','t'}){
		a.pb(x);
		if(ok(a)){
			ret+=solve(indx+1,c2,c3,x);
			ret%=MOD;
		}
		a.pop_back();
	}
	return ret;
}
int main()
{
	//freopen("tst.txt","r",stdin);
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin>>n;
	memset(memo,-1,sizeof(memo));
	cout<<solve(0,'t','t','t');	
}
//AGC is the problem

Measured memory_bytes: 14720
#include <bits/stdc++.h>

#define ll long long int
#define all(x) (x).begin(), (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mp pke_pair
#define inputv(a) forall(i,0,a.size()) cin>>a[i]
#define outputv(a) for(auto i:a) cout<<i<<" ";br;
#define fs first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define minv(a) *min_element(all(a))
#define pxv(a) *px_element(all(a))
#define br cout<<"\n"
using namespace std;



int dr[]={1,-1,0,0};
int dc[]={0,0,1,-1};
ll mod=1000000007;

ll ceil(ll x,ll y)
{
    if(x%y==0)
        return x/y;
    else
        return(x/y)+1;
}
ll binomialCoeff(int n, int k)
{
    ll res = 1;
    if (k > n - k)
        k = n - k;

    for (int i = 0; i < k; ++i) {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}
ll sm(ll n) {
	ll res = 0;
	while (n > 0) {
		res += n % 10;
		n /= 10;
	}
	return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   ll a,b,c,d;
   cin>>a>>b>>c>>d;
   ll e=b*d;
   ll f=a*c;
   ll g=a*d;
   ll h=b*c;
   cout<<max({e,f,g,h});

	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int left, right;
  left = A + B;
  right = C + D;
  
  if(left > right) {
  	cout << "Left" << endl;
  }
  else if (left < right){
  	cout << "Right" << endl;
  }
  else {
  	cout << "Balanced" << endl;
  }

}

Measured memory_bytes: 3548
#include <iostream>
#define INF 1e+18
#define int long long
using namespace std;

int dp[20001][256];

signed main(){
	int n,m,c[16];
	while(cin >> n >> m,n){
		for(int i = 0;i <= n;i++){
			for(int j = 0;j < 256;j++) {
				if(i == 0 && j == 128) dp[i][j] = 0;
				else dp[i][j] = INF;
			}
		}
		for(int i = 0;i < m;i++) cin >> c[i];
		for(int i = 0;i < n;i++){
			int x;
			cin >> x;
			for(int j = 0;j < 256;j++){
				for(int k = 0;k < m;k++){
					int d = j + c[k];
					if(d < 0) d = 0;
					else if(d > 255) d = 255;
					dp[i + 1][d] = min(dp[i + 1][d],dp[i][j] + (x - d) * (x - d));
				}
			}
		}
		int mi = INF;
		for(int i = 0;i < 256;i++) mi = min(mi,dp[n][i]);
		cout << mi << endl;
	}
	return 0;
}

Measured memory_bytes: 43004
#include<iostream>
using namespace std;

int main(){

   int i,j,H,W;

   while(1){

	cin >> H >> W;

	if((H == 0)&&(W == 0)) break;

	for(i=0;i<H;i++){

		for(j=0;j<W;j++){

			if((i+j)%2 == 0){
				cout << "#";
			}else{
				cout << ".";
			}

		}

		cout << endl;

	}

	cout << endl;

   }

   return 0;
}

Measured memory_bytes: 1152
def main():
    H, W = map(int, input().split())
    S = [list(input()) for _ in range(H)]
    dx_dy = [[1, 0], [-1, 0], [0, 1], [0, -1], [1, -1], [1, 1], [-1, -1], [-1, 1]]
    ans = []
    for nx in range(H):
        l = ''
        for ny in range(W):
            if S[nx][ny] == '.':
                cnt = 0
                for i in range(8):
                    x, y = nx + dx_dy[i][0], ny + dx_dy[i][1]
                    if 0  <= x < H and 0 <= y < W:
                        if S[x][y] == '#':
                            cnt += 1
                l += str(cnt)
            else:
                l += '#'
        ans.append(l)
    for a in ans:
        print(a)
                            
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <stdio.h>

int main(){
	int R;
	int G;
	int B;
	int N;
	scanf("%d",&R);
	scanf("%d",&G);
	scanf("%d",&B);
	scanf("%d",&N);
	int i;
	int j;
	int c;
	c=0;
	for(i=0;i<=N;i++){
		for(j=0;j<=N;j++){
			if((N-i*R-j*G)%B==0&&N-i*R-j*G>=0){
				c=c+1;
			}
		}
	}
	printf("%d",c);
}

Measured memory_bytes: 128
N, M = map(int,input().split())
l_list = []
r_list = []
for _ in range(M):
    l, r = map(int,input().split())
    l_list.append(l)
    r_list.append(r)

l_max = max(l_list)
r_min = min(r_list)
ans = max(0,r_min-l_max+1)
print(ans)

Measured memory_bytes: 11028
#include "bits/stdc++.h"

#define REP(i,num) for(ll i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

template<typename T>
bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>
bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int K=in();
	string S=in<string>();
	int N=S.size();
	if(N<=K) out(S);
	else{
		string T=S.substr(0,K);
		REP(i,3) T.push_back('.');
		out(T);
	}
	return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>

using namespace std;

const int maxn = 2e5 + 5 , mod = 1e9 + 7;

typedef long long ll;

ll sum[maxn] , a[maxn];

int main() {
	int n;
	ios::sync_with_stdio(0);
	cin >> n;
	for(int i = 1 ; i <= n ; i++)cin >> a[i];
	sum[n] = a[n] % mod;
	for(int i = n - 1 ; i >= 1 ; i--) {
		sum[i] = ( sum[i + 1] + a[i] ) % mod;
	}
	ll ans = 0;
	for(int i = 1 ; i < n ; i++) {
		ans = ( ans +  ( a[i] % mod ) * ( sum[i + 1] % mod) ) % mod;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 6740
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int N;
  cin >> N;
  int AC = 0;
  int WA = 0;
  int TLE = 0;
  int RE = 0;
  rep(i, N) {
    string s;
    cin >> s;
    if (s == "AC")
      AC++;
    else if (s == "WA")
      WA++;
    else if (s == "TLE")
      TLE++;
    else if (s == "RE")
      RE++;
  }
  cout << "AC x " << AC << endl;
  cout << "WA x " << WA << endl;
  cout << "TLE x " << TLE << endl;
  cout << "RE x " << RE << endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int main()
{
    int n,m,d;
    cin >>n >>m >>d;
    vector<string> s(n);
    rep(i,n) cin >>s[i];

    int ans = 0;

    // ???
    rep(i,n-d+1)rep(j,m)
    {
        int ct=0;
        rep(y,d) ct+=(s[i+y][j]=='#');
        ans += (ct==0);
    }

    // ?¨?
    rep(i,n)rep(j,m-d+1)
    {
        int ct=0;
        rep(x,d) ct+=(s[i][j+x]=='#');
        ans += (ct==0);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3236
N,M=map(int,input().split());L=[[]for _ in range(N+1)]
for _ in range(M):a,b=map(int,input().split());L[a]+=[b];L[b]+=[a]
def s(n,v):
 if n in v:return 0
 if len(v)==N-1:return 1
 return sum(s(i,v|{n})for i in L[n])
print(s(1,set()))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  if (S=="SUN") cout << 7;
  if (S=="MON") cout << 6;
  if (S=="TUE") cout << 5;
  if (S=="WED") cout << 4;
  if (S=="THU") cout << 3;
  if (S=="FRI") cout << 2;
  if (S=="SAT") cout << 1;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int n;
	cin >> n;

	int answer = 0;
	for (int i = 1; i <= n; i += 2) {
		int cnt = 0;
		for (int j = 1; j*j <= i; j++) {
			if (i%j) continue;
			cnt += (j*j == i)? 1 : 2;
		}
		if (cnt == 8) answer++;
	}
	printf("%d\n", answer);
}


Measured memory_bytes: 256
'use strict';
(function(stdin) {
  var lines  = stdin.toString().split('\n');
  var result = (function(data) {
    var Calc = {
        '+':function(a,b){return a + b;}
        ,'-':function(a,b){return a - b;}
        ,'*':function(a,b){return a * b;}
        ,'/':function(a,b){return ~~(a / b);}
    };
    var result = [];
    var tmp;
    var index = 0;
    while (true) {
        tmp = data[index++].split(' ');
        if (tmp[1] === '?') break;
        result.push(Calc[tmp[1]](parseInt(tmp[0],10),parseInt(tmp[2],10)));
    }
    return result.join('\n');
  }(lines
  ));
  console.log(result);
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 7908
#include<iostream>

using namespace std;
int main()
{
    int h,w;
  cin >> h >> w;
  while(h!=0){
    int i,j;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
            if(i%2==0&&j%2==0||i%2==1&&j%2==1)
	cout << "#";
	else cout<<".";
      }
      cout << endl;
    }
    cout << endl;
    cin >> h >> w;
  }
    return 0;
}



Measured memory_bytes: 3092
use std::fmt::Debug;
use std::io;
use std::io::{Read, Stdin};
use std::str;
use std::str::FromStr;
use std::usize;
use std::cmp;
use std::collections::vec_deque::VecDeque;
use std::i64::MAX;

fn main() {
    let mut sc = Scanner::new();
    let n = sc.parse::<usize>();
    let l = sc.parse::<i64>();
    let t = sc.parse::<i64>();

    let mut x: Vec<i64> = vec![0; n];
    let mut w: Vec<usize> = vec![0; n];

    for i in 0..n {
        x[i] = sc.parse::<i64>();
        w[i] = sc.parse::<usize>();
    }

    let cross_count = (0..n)
        .map(|i| {
            let w0 = w[0];
            let wi = w[i];
            if w0 == wi {
                return 0;
            }

            let interval;
            if w0 == 1 {
                interval = x[i] - x[0];
            } else {
                interval = x[0] + l - x[i];
            }

            if interval > t * 2 {
                return 0;
            }

            let time = t * 2 - interval;
            let count;
            if time % l == 0 && w[0] == 1 {
                count = time / l;
            } else {
                count = time / l + 1;
            }
            return count;
        })
        .collect::<Vec<i64>>();

    let count_sum: i64 = cross_count.iter().sum::<i64>() % (n as i64);
    let position;
    let num;
    if w[0] == 1 {
        position = (x[0] + t) % l;
        num = count_sum;

    } else {
        position = (x[0] - (t % l) + l) % l;
        num = (n as i64) - count_sum;
    }

    let mut positions: Vec<i64> = Vec::new();
    for i in 0..n {
        let p;
        if w[i] == 1 {
            p = (x[i] + t) % l;
        } else {
            p = (x[i] - (t % l) + l) % l;
        }
        positions.push(p);
    }

    positions.sort();

    let mut a = 0;
    for i in 0..n {
        if positions[i] == position {
            a = i;
            break;
        }
    }

    let mut ans: Vec<i64> = vec![0;n];
    for i in 0..n {
        let idx = (i + num as usize) % n;
        let p = (a + i as usize) % n;
        ans[idx] = positions[p];
    }

    for a in &ans {
        println!("{}", a);
    }

}

struct Scanner {
    stdin: Stdin,
    buf: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            buf: Vec::with_capacity(256),
        }
    }

    fn parse<T: FromStr>(&mut self) -> T
        where <T as FromStr>::Err: Debug
    {
        self.buf.clear();
        let mut it = self.stdin.lock().bytes();
        let mut c = it.next().unwrap().unwrap();
        while c == ' ' as u8 || c == '\n' as u8 {
            c = it.next().unwrap().unwrap();
        }
        while !(c == ' ' as u8 || c == '\n' as u8) {
            self.buf.push(c);
            c = it.next().unwrap().unwrap();
        }
        str::from_utf8(&self.buf).unwrap().parse::<T>().unwrap()
    }
}

Measured memory_bytes: 11388
#include <bits/stdc++.h>
using namespace std;

#define DEBUG

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;

const int MOD = 1000000007;
const double PI=acos(-1.0);

// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;

// 繰り返し
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep_(i,n) for(int i=0;i<(int)(n-1);i++)
#define rep__(i,n) for(int i=n-1;i>=0;i--)

// メモリ関連
#define SZ(x) ((int)(x).size())
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define MEMSET(v,h) memset((v),h,sizeof(h)

// 最大値と最小値を更新する
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

// 素数判定
bool isPrime(int n){if(n<2)return false;else if(n==2)return true;else if(n%2==0)return false;double sqrtNum=sqrt(n);for(int i=3;i<=sqrtNum;i+=2)if(n%i==0)return false;return true;}

// ソート
template<class T>vector<T>sortVector(vector<T>v,bool b=true){if(b)sort(v.begin(),v.end());else sort(v.begin(),v.end(),greater<T>());return v;}

// Z-Algorithm O(|S|)
vector<ulint>z_algorithm(string s){vector<ulint>a(s.length());a[0]=s.size();for(ulint i=1,j=0,k;i<s.size();){while(i+j<s.size()&&s[j]==s[i+j])++j;a[i]=j;k=!!j;while(i+k<s.size()&&k+a[k]<j)a[i+k]=a[k],++k;i+=k+!j;j-=k;}return a;}

int main(void) {
    int n;
    int a[3][3];
    bool at[3][3] = {false};
    vector<int> b(10);
    bool ans = false;
    
    rep(i, 3) rep(j, 3) cin >> a[i][j];
    cin >> n;
    rep(i, n) cin >> b[i];
    
    rep(i, n) rep(j, 3) rep(k, 3) if(a[j][k] == b[i]) at[j][k] = true;
    
    rep(i, 3) if(at[i][0] && at[i][1] && at[i][2]) ans = true;
    rep(i, 3) if(at[0][i] && at[1][i] && at[2][i]) ans = true;
    if(at[0][0] && at[1][1] && at[2][2]) ans = true;
    if(at[0][2] && at[1][1] && at[2][0]) ans = true;
    
    if(ans) cout << "Yes";
    else cout << "No";
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define vi vector<ll>
#define vb vector<bool>
#define pii pair<ll,ll>
#define mod 1000000007
#define pll pair<ll,ll>
#define rep(i,n) for(ll i=0;i<n;i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define per1(i,n) for(ll i=n;i>0;i--)
#define prll(a,n) for(ll i=0;i<n;i++){ cout<<a[i]<<" "; }
#define ain(a) for(auto &i:a) cin>>i
#define mms(a) memset(a,0,sizeof(a))
// cout << fixed << setprecision(0) << pi <<" "<<npi<<endl; 


ll max_ll(ll a,ll b,ll c){
	return max(a,max(b,c));
}

ll min_ll(ll a,ll b,ll c){
	return min(a,min(b,c));
}


bool sortBySec(pair<ll,ll> a,pair<ll,ll> b){
    if(a.second==b.second)
		return a.first<b.first;
    return (a.second < b.second); 
}

long long binexpmod(long long a, long long b){
    long long res =1;
    while(b>0){
        if(b&1){
            res = res * a % mod;
        }
        a = a * a % mod;
        b>>=1;
    }
    return(res);
}


ll lcm(ll a,ll b){
	ll x=__gcd(a,b);
	a/=x;
	b/=x;
	ll sum=a*b*x;
	return sum;
}

void solve(){
    // ll n,res=0;
	// cin>>n;
    string s,t;
    cin>>s;
    cin>>t;
    vector<vector<pair<ll,pll>>> dp(s.length()+1,vector<pair<ll,pll>>(t.length()+1,{-1,{0,0}}));
    dp[0][0]={0,{0,0}};
    rep(i,s.length()){
        rep(j,t.length()){
            if(s[i]==t[j]){
                dp[i+1][j+1] = max(dp[i+1][j+1],{dp[i][j].first+1,{i,j}});
            }
            else{
                dp[i+1][j] = max(dp[i+1][j],{dp[i][j].first,{i,j}});
                dp[i][j+1] = max(dp[i][j+1],{dp[i][j].first,{i,j}});
            }
        }
    }
    pair<ll,pll> ans={0,{0,0}};
    rep(i,s.length()+1){
        rep(j,t.length()+1){
            ans = max(ans,{dp[i][j].first,{i,j}});
        }
    }
    pll prev = ans.second;
    // cout<<s[prev.first]<<"....\n";
    string risi;
    // risi.push_back(s[prev.first]);
    while(!(prev.first==0 ||  prev.second==0) ){
        pll tp = dp[prev.first][prev.second].second;
        if(tp==make_pair(prev.first-1,prev.second-1)){
            risi.push_back(t[prev.second-1]);
        }
        prev = tp;
    }
    reverse(risi.begin(),risi.end());
    cout<<risi<<endl;
	return;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 211456
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << fixed << setprecision(17) << (w * h) / 2. << ' ';
  if (2 * x == w && 2 * y == h) {
    cout << 1 << '\n';
  } else {
    cout << 0 << '\n';
  }
  return 0;
}


Measured memory_bytes: 3796
#include<stdio.h>
unsigned long long dp[50][50][50];
bool vis[50][50][50];
bool lj[50][50];
unsigned long long sol(int left,int mid,int right)
{
	if(vis[left][mid][right])
	{
		return dp[left][mid][right];
	}
	if(left==mid&&mid==right)
	{
		return 1;
	}
	unsigned long long ans=0;
	for(int i=left;i<mid;i++)
	{
		for(int j=mid+1;j<=right;j++)
		{
			if(!lj[i][j])
			{
				continue;
			}
			for(int l=i;l<mid;l++)
			{
				for(int r=mid;r<j;r++)
				{
					ans+=sol(left,i,l)*sol(l+1,mid,r)*sol(r+1,j,right);
				}
			}
		}
	}
	vis[left][mid][right]=true;
	dp[left][mid][right]=ans;
	return ans;
}
int main()
{
	int n;
	scanf("%d",&n);
	n<<=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			char c=getchar();
			while(c<'0'||c>'1')
			{
				c=getchar();
			}
			if(c=='1')
			{
				lj[i][j]=true;
			}
		}
	}
	unsigned long long ans=0;
	for(int i=2;i<=n;i++)
	{
		if(lj[1][i])
		{
			ans+=sol(2,i,n);
		}
	}
	printf("%llu\n",ans);
	return 0;
}

Measured memory_bytes: 768
object Main{
  def main(args: Array[String]){
    val input=io.Source.stdin.getLines().mkString("\n")
    println(solve(input).trim())
  }

  def solve(input:String):String={
    val Array(x,y,z)=input.split(" ").map(_.toInt)
    ((x-z)/(y+z)).toString
  }
}


Measured memory_bytes: 27192
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i = 0; i < n; i++)

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int x, y;
	cin >> x >> y;
	for (int kame = 0; kame <= x; kame++) {
		int turu = x - kame;
		int asi = 4 * kame + 2 * turu;
		if (asi == y) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
 	return 0;
}


Measured memory_bytes: 3620
# coding: utf-8
import heapq


def solve(*args: str) -> str:
    n, m = map(int, args[0].split())
    A = list(map(lambda _: -int(_), args[1].split()))
    heapq.heapify(A)

    for _ in range(m):
        a = heapq.heappop(A)
        heapq.heappush(A, int(a/2))

    return str(-sum(A))


if __name__ == "__main__":
    print(solve(*[input() for _ in range(2)]))


Measured memory_bytes: 76064
#include<iostream>
#include<stdio.h>//printf("%.*f\n",*********);
#include<vector>//s.erase(n),vector
#include<algorithm>//next_permutation
#include<set>
#include<string>//char('a'=32+'A')
                //to_string,string,substr
#include<sstream>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>//min,max
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)//start==1
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)//end==1
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define Yay(ans) if(ans)cout<<"Yay!"<<rt;else cout<<":("<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(a,n) rep(i,n)cin>>a[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//昇順
#define reve(s) reverse(s.begin(),s.end())//反転
#define please return
#define AC 0
#define rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626//pi
#define nine 1000000000//10^9

using namespace std;
typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int KETA(int n) { //Sum of Each Digit
	int sum = 0;
	while (n > 0) {
		sum += n % 10; n /= 10;
	}
	return sum;
}

unsigned ND(unsigned num) {//Number of Digits
	return std::to_string(num).length();//outmax=10
}

bool KIBN(string s) {
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1 - i])return false;
	}
	return true;
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */


int main(void) {
	rapid_pleaseAC_fast;

	int h, w;
	cin >> h >> w;
	vvstr a(h, vstr(w));
	string ans;
	int x = 0;
	rep(i, h) {
		rep(j, w) {
			cin >> a[i][j];
			if (a[i][j] == "snuke") {
				ans += char(j + 'A');
				x = i;
			}
		}
	}
	cout << ans << x+1 << rt;

	please AC;
}
//参考：---

Measured memory_bytes: 256
//#define _GRIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion

#define int long long

signed main()
{
    int n;
    int M = 300005;
    while(cin>>n, n!=1) {
        cout << n << ":";
        bool is_primes[M];
        fill(is_primes, is_primes+M, true);
        for(int i=2; i<=n; ++i) {
            if(i%7!=1&&i%7!=6) continue;
            if(is_primes[i]) {
                if(n%i==0) cout << " " << i;
                for(int j=i*i; j<=n; j+=i) is_primes[j] = false;
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3284
# -*- coding:utf-8 -*-
import sys
W, H, N = map(int,input().split())
xya = []
W1, W2, H3, H4 = (0, W, 0, H)

for tmp in range(0, N):
    xya.append(list(map(int,input().split())))

for y in range(0, N):

    if xya[y][2] == 1:
        W1 = max(W1, xya[y][0])
    elif xya[y][2] == 2:
        W2 = min(W2, xya[y][0])
    elif xya[y][2] == 3:
        H3 = max(H3, xya[y][1])
    else:
        H4 = min(H4, xya[y][1])

    if W1 >= W2 or H3 >= H4:
        print(0)
        sys.exit()

print((W2 - W1)*(H4 - H3))

Measured memory_bytes: 3064
#include <iostream>
#include<math.h>
#include <vector>
#include <numeric>

using namespace std;

int main() {

    int A, B;
    cin >> A >> B;

    if (A * B % 2 == 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    };
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int test_cases = 1;
        Solver s = new Solver();
        for (int i = 1; i <= test_cases; i++) {
            s.solve(i, in, out);
        }
        out.close();
    }
}

class Solver {
    void solve(int test_number, InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        int[] pp = new int[(int) (2 * 1e5)];
        for (int i = 0; i < n ; i++) {
            pp[in.nextInt()]++;
            pp[in.nextInt() + 1]--;
        }
        for (int i = 1; i < pp.length; i++) pp[i] += pp[i - 1];
        int c = 0;
        for (int i = 1; i < pp.length; i++) if (pp[i] > 0) c++;
        out.println(c);
    }
}


class InputReader {
    BufferedReader br;
    StringTokenizer st;

    public InputReader()
    {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }

    String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try
            {
                st = new StringTokenizer(br.readLine());
            }
            catch (IOException  e)
            {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt()
    {
        return Integer.parseInt(next());
    }

    long nextLong()
    {
        return Long.parseLong(next());
    }

    double nextDouble()
    {
        return Double.parseDouble(next());
    }

    String nextLine()
    {
        String str = "";
        try
        {
            str = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
 
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, long long m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }
 
const int N=1e5+5;
const int M=5005;
 
int n, k, white=0, black=0;
int x[N], y[N];
char c[N];
int sz[M][M], sz2[M][M];
 
int rsum1(int x1, int y1, int x2, int y2)
{
	int ans=sz[x2][y2];
	if(x1>0)
		ans-=sz[x1-1][y2];
	if(y1>0)
		ans-=sz[x2][y1-1];
	if(x1>0&&y1>0)
		ans+=sz[x1-1][y1-1];
	return ans;
}
 
int rsum2(int x1, int y1, int x2, int y2)
{
	int ans=sz2[x2][y2];
	if(x1>0)
		ans-=sz2[x1-1][y2];
	if(y1>0)
		ans-=sz2[x2][y1-1];
	if(x1>0&&y1>0)
		ans+=sz2[x1-1][y1-1];
	return ans;
}
 
int calc(int i, int j)
{
	int w=white;
	w-=rsum1(i, 0, i+k-1, 2*k-1);
	w-=rsum1(0, j, 2*k-1, j+k-1);
	w+=2*rsum1(i, j, i+k-1, j+k-1);
	int b=0;
	b+=rsum2(i, 0, i+k-1, 2*k-1);
	b+=rsum2(0, j, 2*k-1, j+k-1);
	b-=2*rsum2(i, j, i+k-1, j+k-1);
	return (w+b);
}
 
int32_t main()
{
    IOS;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
    	cin>>x[i]>>y[i]>>c[i];
    	int xd=x[i]%(2*k);
    	int yd=y[i]%(2*k);
    	if(c[i]=='W')
    	{
    		white++;
    		sz[xd][yd]++;
    	}
    	else
    	{
    		sz2[xd][yd]++;
    		black++;
    	}
    }
    for(int i=0;i<=2*k;i++)
    {
    	for(int j=1;j<=2*k;j++)
    	{
    		sz[i][j]+=sz[i][j-1];
    		sz2[i][j]+=sz2[i][j-1];
    	}
    }
    for(int j=0;j<=2*k;j++)
    {
    	for(int i=1;i<=2*k;i++)
    	{
    		sz[i][j]+=sz[i-1][j];
    		sz2[i][j]+=sz2[i-1][j];
    	}
    }
    int ans=0;
    for(int i=0;i<=k;i++)
    {
    	for(int j=0;j<=k;j++)
    	{
                int h=calc(i,j);
    		ans=max(ans,max(h,n-h));

    	}
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 160640
#include <iostream>
using namespace std;

int main() {
  int n;
  while (cin >> n) {
    bool f = false;
    for (int i = 0; i < 10; i++) {
      if (n & (1 << i)) {
        if (f) cout << " ";
        cout << (1 << i);
        f = true;
      }
    }
    cout << endl;
  }
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main()
{
    int N,K;
    cin >> N >> K;
    vector<int>p(N);
    rep(i,N)cin >> p[i];
    int sum = 0,ans = 0;
    rep(i,N){
        if(i<K){
            sum+=p[i];
            ans=sum;
        }
        else{
            sum+=(p[i]-p[i-K]);
            ans=max(ans,sum);
        }
    }

    cout << setprecision(10) << (double)(K+ans)*0.5 << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
	ll N,K;
	cin >> N>>K;
	ll ans =0;
	if(K%2==0){
		ll tmp=N;
		tmp/=K;
		ans=tmp*tmp*tmp;
		tmp=(N/(K/2)-N/K);
		tmp=tmp*tmp*tmp;
		ans+=tmp;
	}
	else{
		N/=K;
		ans=N*N*N;
	}
	cout<<ans<<endl;
	
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

struct mint {
    const int mod = 1e9 + 7;
    long long x;
    
    mint (long long x = 0) : x((x % mod + mod) % mod) {
        
    }
    
    mint& operator=(const long long a) {
        x = a % mod;
        return *this;
    }
    
    mint& operator=(const mint a) {
        x = a.x % mod;
        return *this;
    }
    
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    
    mint& operator-=(const mint a) {
        if ((x += (mod - a.x)) >= mod) x -= mod;
        return *this;
    }
    
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    
    mint inv() const {
        return pow(mod - 2);
    }
    
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, m;
    cin >> n >> m;
    vector<ll> s(n), t(m);
    rep(i, n) cin >> s[i];
    rep(i, m) cin >> t[i];
    vector<vector<mint>> dp(n + 1, vector<mint>(m + 1, 0));
    rep(i, m + 1) dp[0][i] = 1;
    rep(i, n + 1) dp[i][0] = 1;
    rep(i, n) {
        rep(j, m) {
            dp[i + 1][j + 1] += dp[i + 1][j] + dp[i][j + 1] - dp[i][j];
            if (s[i] == t[j]) dp[i + 1][j + 1] += dp[i][j];
        }
    }
    cout << dp[n][m].x << endl;
    // rep(i, n + 1) rep(j, m + 1) printf("%lld%s", dp[i][j].x, (j == m) ? "\n" : " ");
    return 0;
}


Measured memory_bytes: 62976