akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for(int (i)=0;(i)<(n);(i)++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
bool custom1 (pair<int, int> a, pair<int, int> b) {
  return (a.first < b.first);
}
bool custom2(pair<int, int> a, pair<int, int> b) {
  return (a.second < b.second);
}

const int MAX = 200005;
const long long MOD = 1000000007;
const long long MODMOD = 998244353;
const double PI = acos(-1);

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
struct UnionFind {
  vector<int> p;
  vector<int> s;
  void init(int n) {
    p.resize(n, -1);
    s.resize(n, 1);
  }
  int find(int n) {
    if(p[n] == -1) return n;
    else return find(p[n]);
  }
  int size(int n) {
    return s[find(n)];
  }
  void unite(int n, int m) {
    int pn = find(n);
    int pm = find(m);
    if(pn == pm) return;
    if(s[pn] > s[pm]) {
      s[pn] = s[pn] + s[pm];
      p[pm]= pn;
    } else {
      s[pm] = s[pm] + s[pn];
      p[pn] = pm;
    }
  }
};

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

int main() {
  long long a, b, c;
  cin >> a >> b >> c;
  if(c >= a + b && 4LL * a * b < (c - a - b) * (c - a - b)) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
N = int(input())
A = [int(a) for a in input().split()]

s = 0
c1 = 0
for i in range(N):
    s += A[i]
    if i % 2:
        ns = min(s, -1)
        c1 += s - ns
        s += ns - s
    else:
        ns = max(s, 1)
        c1 += ns - s
        s += ns - s

s = 0
c2 = 0
for i in range(N):
    s += A[i]
    if i % 2:
        ns = max(s, 1)
        c2 += ns - s
        s += ns - s
    else:
        ns = min(s, -1)
        c2 += s - ns
        s += ns - s

print(min(c1, c2))

Measured memory_bytes: 14504
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<locale.h>
#include<math.h>
#include<set>
#include<stack>
#include<queue>
using namespace std;

int n,m;
bool pth[10][10];
int perm[10];
int ans=0;
int main()
{
 scanf("%d %d",&n,&m);
 for(int i=0;i<m;i++)
 {
	int a,b;
	scanf("%d %d",&a,&b);
	pth[a][b]=pth[b][a]=true;
 }
 for(int i=0;i<n;i++)
 {
	perm[i]=i+1;
 }

 do{
	bool flg=true;
	for(int i=0;i<(n-1);i++)
	{
	 if(!pth[perm[i]][perm[i+1]]){flg=false;break;}
	}
	if(flg){ans++;}
 }while(next_permutation(perm+1,perm+n));
 printf("%d",ans);
}

Measured memory_bytes: 3824
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;
// a>=0, b>=0, x*a+y*b=gcd>=0, a>0,b>0=>abs(y)<=a,abs(x)<=b
LL gcdex(LL a,LL b,LL& x, LL& y){
	LL ax=1,ay=0;
	LL bx=0,by=1;
	while(b){
		LL r=a/b;
		LL t=a-r*b; a=b; b=t;
		LL tx=ax-r*bx; ax=bx; bx=tx;
		LL ty=ay-r*by; ay=by; by=ty;
	}
	x=ax;
	y=ay;
	return a;
}
LL modinv(LL a, LL m){
	LL x,y;
	gcdex(a,m,x,y);
	if(x<0){
		x+=m;
	} else if(x>=m){
		x-=m;
	}
	return x;
}
const int M=1e9+7;
LL cm[1001][1001];
LL dp[1001][1001];
LL rev[1001];
int main() {
	for(int i=0;i<1001;i++){
		cm[i][0]=1;
		for(int j=1;j<=i;j++){
			cm[i][j]=(cm[i-1][j-1]+cm[i-1][j])%M;
		}
	}
	for(int i=1;i<1001;i++){
		rev[i]=modinv(i,M);
	}

	int N,A,B,C,D;
	scanf("%d%d%d%d%d",&N,&A,&B,&C,&D);
	dp[0][A-1]=1;
	for(int i=0;i<=N;i++){
		for(int j=A;j<=B;j++){
			dp[i][j]+=dp[i][j-1];
			LL c=1;
			LL r=i;
			for(int k=1;k<=D;k++){
				c*=cm[r][j]*rev[k]%M;
				c%=M;
				r-=j;
				if(r<0)break;
				if(C<=k){
					dp[i][j]+=c*dp[r][j-1]%M;
					dp[i][j]%=M;
				}
			}
		}
	}
	printf("%lld\n",dp[N][B]);

	return 0;
}



Measured memory_bytes: 15872
h,w = list(map(int,input().split(' ')))

kisuu = (w+1)//2
guusuu = w//2
tate_kisuu = (h+1)//2
tate_guusuu = h//2


res = kisuu*tate_kisuu+guusuu*tate_guusuu

if(h==1)or(w==1):
    res = 1


print(res)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int x,y;
  cin >> x >> y;
  bool judge=false;
  for(int i=0;i<=x;i++){
    if(2*i+4*(x-i)==y){
      judge=true;
    }
  }
  if(judge){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
using namespace std;

const ll mod = 1e9 + 7;
const int MXN = 3005;
char a[MXN][MXN];
ll dp[MXN][MXN];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    dp[n - 1][m - 1] = 1;
    for(int i = n - 1; i >= 0; i--) {
        for(int j = m - 1; j >= 0; j--) {
            if(a[i][j] == '#') continue;
            if(i + 1 < n && a[i + 1][j] != '#') dp[i][j] = (dp[i][j] + dp[i + 1][j]) % mod;
            if(j + 1 < m && a[i][j + 1] != '#') dp[i][j] = (dp[i][j] + dp[i][j + 1]) % mod;
        }
    }
    cout << dp[0][0] << endl;
    return 0;
}

Measured memory_bytes: 18404
import copy
n,l = map(int,input().split())
taste = []
for i in range(0,n):
    taste.append(l + i + 1 -1)

all_t = sum(taste)

save = copy.copy(taste)
azi = []

for i in range(0,n):
    del taste[i]
    azi.append(abs(all_t - sum(taste)))
    taste  = copy.copy(save)

a = azi.index(min(azi))
del taste[a]
print(sum(taste))




Measured memory_bytes: 3444
import queue
from itertools import product

H, W = map(int, input().split())
S= [input() for i in range(H)]

ans=-1

def bfs(start):
    distance=[[-1]*H for j in range(W)]
    li_x=[1,-1,0,0]
    li_y=[0,0,1,-1]
    q = queue.Queue()
    q.put(start)
    distance[start[0]][start[1]]=0

    while not q.empty():
        hoge=q.get()
        x=hoge[0]
        y=hoge[1]
        dis=distance[x][y]

        for i in range(4):
            x1=x+li_x[i]
            y1=y+li_y[i]
            if (0 <=x1 < W and 0 <= y1 < H):
                if distance[x1][y1] == -1:
                    if S[y1][x1]=='.':
                        q.put([x1,y1])
                        distance[x1][y1]=dis+1
    m=[]
    for i in range(W):
        m.extend(distance[i])
    return max(m)

for sx,sy in product(range(W),range(H)):

                if S[sy][sx]=='.':
                    re=bfs([sx,sy])
                    if re > ans:
                        ans=re

print(ans)


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

int main() {
  	string str;
	cin >> str;
  	
  	int count = 0;
  	for (int i = 0 ; i < str.size(); i++) {
    	if (str.at(i) == '1') {
        	count += 1;
        }
    }
  	cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
  string t;
  string r;
  string s;
  cin >> t;
  int l=t.size()/2;
  for(int i = 0; i < l; i++){
    s+="hi";
  }
  if(s==t)
    r="Yes";
  else
    r="No";
  
  cout << r << endl;
  return 0;
}


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

int main() {
long long n,a,b;
cin>>n>>a>>b;
if(abs(b-a)%2==0) cout<<abs(b-a)/2<<endl;
else {
if(a==1||b==n)cout<<abs(a-b)/2+1;
else cout<<abs(a-b)/2+min(a-1,n-b)+1;
}
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using vi32 = vector<i32>;
using vu32 = vector<u32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf64 = vector<f64>;
using vstr = vector<string>;
using vvi32 = vector<vi32>;
using vvu32 = vector<vu32>;
using vvi64 = vector<vi64>;
using vvu64 = vector<vu64>;
using vvf64 = vector<vf64>;

template<typename T, typename S> bool amax(T &x, S y) { if (x < y) { x = y; return 1; } return 0; }
template<typename T, typename S> bool amin(T &x, S y) { if (y < x) { x = y; return 1; } return 0; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  string s;
  cin >> s;
  int n = s.size();
  if (s[0] == s[n - 1]) {
    if (n % 2 == 0) {
      cout << "First" << endl;
    } else {
      cout << "Second" << endl;
    }
  } else {
    if (n % 2 == 1) {
      cout << "First" << endl;
    } else {
      cout << "Second" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
 
int main() {
  int X, Y, pos = 0;
  char S[20];
  scanf("%d %d %s", &X, &Y, S);
  for (int i = 0; S[i] != '\0'; i++) {
    (S[i] == '-') ? pos += i + 1 : pos += 0;
  }
  pos == X + 1 ? printf("Yes") : printf("No");
  return 0;
}


Measured memory_bytes: 1700
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
  int a,b;
  cin>>a>>b;
  int ans=-1;
  if(a<=9&&b<=9) ans=a*b;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
 
using namespace std;
const int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
 
int main(void) {
    int w,h;
    while(cin >> w >> h && w && h) {
        vector< vector<int> > data(h+2,vector<int>(w+2,0));
        for (int i = 1; i <= h; ++i) {
            for (int j = 1; j <= w; ++j) {
                cin >> data[i][j];
            }
        }
 
        int nx,ny;
        int count = 0;
        for (int i = 1; i <= h; ++i) {
            for (int j = 1; j <= w; ++j) {
                if (data[i][j] == 1) {
                    nx = j;
                    ny = i;
                    data[i][j] = 0;
                    queue<int> fx,fy;
                    fx.push(nx);
                    fy.push(ny);
                    ++count;
 
                    while (!fx.empty()) {
                        nx = fx.front();
                        ny = fy.front();
                        fx.pop();
                        fy.pop();
                        for (int d = 0; d < 8; ++d) {
                            if (data[ny+dy[d]][nx+dx[d]] == 1) {
                                fx.push(nx+dx[d]);
                                fy.push(ny+dy[d]);
                                data[ny+dy[d]][nx+dx[d]] = 0;
                            }
                        }
                    }
                }
            }
        }
        cout << count << endl;
    }
    return 0;
}

Measured memory_bytes: 3080
from collections import Counter
from itertools import combinations

N = int(input())
if N == 0:
    print(0)
else:
    L = [int(s) for s in input().split()]

    set_L = Counter(L)

    uniq_L = set_L.keys()

    res = 0
    if len(uniq_L) < 3:
        print(res)
    else:
        for Li, Lj, Lk in combinations(uniq_L, 3):
            if Li + Lj > Lk and Li + Lk > Lj and Lj + Lk > Li:
                res += set_L[Li] * set_L[Lj] * set_L[Lk]

        print(res)

Measured memory_bytes: 9488
#include <iostream>
#include <string>

using namespace std;

int a[12]={1,3,5,7,9,11,15,17,19,21,23,25};

string affine(string x){
	string tmp=x;
	for(int i=0; i<12; i++){
		int A=0;
		
		while(a[i]*A%26!=1)A++;
		for(int b=0; b<26; b++){
			if(tmp.find("this")==-1&&tmp.find("that")==-1){
				for(int s=0; s<x.size(); s++){
					if(isalpha(x[s]))tmp[s]=((A*(x[s]-'a')+26-b)%26)+'a';
				}
			}
		else return tmp;
		}
	}
	return tmp;
}


int main(){
	int n;
	string str;
	cin>>n;
	cin.ignore();
	while(n--){
		getline(cin, str);
		cout<<affine(str)<<endl;	
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

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

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

  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  int ans = 1e9;
  for(int i = -100; i <= 100; i++) {
    int tmp = 0;
    rep(j, n) {
      tmp += (a[j]-i)*(a[j]-i);
    }
    ans = min(ans, tmp);
  }

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define llu unsigned long long
#define ld double
#define llu unsigned long long
#define rep(i,x,y)  for(ll i=x;i<y;++i)
#define For(i,x,y)  for(ll i=x;i<=y;++i)
#define FOr(i,x,y)  for(ll i=x;i>=y;--i)
#define pi acos(-1)
#define mk make_pair<ll,ll>
#define pa pair<ll,ll>
#define lf else if
#define min(x,y)    ((x)<(y)?(x):(y))
#define sqr(x)      ((x)*(x))
#define abs(x)      ((x)>0?(x):-(x))
#define Mul(x,y)    (x=(x)*(y)%mod)
#define Mul1(x,y)   (x=(x)*(y)%mod1)
#define Add(x,y)    (x=(x+(y))%mod)
#define Add1(x,y)	(x=(x+(y))%mod1)
#define E(x)        return writeln(x),0
#define p(x)        printf("~%d~\n",x)
#define pp(x,y)     printf("~~%d %d~~\n",x,y)
#define ppp(x,y,z)  printf("~~~%d %d %d~~~\n",x,y,z)
#define pppp(x,y,z,a)  printf("~~~%d %d %d %d~~~\n",x,y,z,a)
#define f_in(x)     freopen(x".in","r",stdin)
#define f_out(x)    freopen(x".out","w",stdout)
#define open(x)     f_in(x),f_out(x)
#define fi first
#define se second
typedef complex<double> E;
namespace SHENZHEBEI{
#ifdef LOCAL
    struct _{_(){freopen("cf.in","r",stdin);}}_;
#endif
#define NEG 1
    inline char gc(){   return getchar();   }
#if NEG
    inline ll read(){    ll x=0,f=1; char ch=gc();   for (;!isdigit(ch);ch=gc()) if (ch=='-') f=-1;  for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x*f; }
    inline void write(ll x){    if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#else
    inline ll read(){    ll x=0; char ch=gc();   for (;!isdigit(ch);ch=gc());    for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x;   }
    inline void write(ll x){    if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#endif
    inline char readchar(){ char ch=gc();   for(;isspace(ch);ch=gc());  return ch;  }
    inline ll readstr(char *s){ char ch=gc();   int cur=0;  for(;isspace(ch);ch=gc());      for(;!isspace(ch);ch=gc())  s[cur++]=ch;    s[cur]='\0';    return cur; }
    inline void writeln(ll x){  write(x);   puts("");   }
    inline ld getreal(){    static ld lbc;  scanf("%lf",&lbc);  return lbc; }
}using namespace SHENZHEBEI;
const ll N=1000;
ll A,B,C,D;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
void work(){
	A=read(),B=read(),C=read(),D=read();
	if ((B>D)||(A<B))return puts("No"),void(0);
	ll d=gcd(B,D);
//	writeln(C-(d-A%d)%d);
//	A=C-(d-A%d)%d+gcd(B,D);
	if (A>=C)	A-=(A-C)/d*d;
	if (A<C)	A+=(C-A)/d*d;
	for(;A>C;A-=d);
	for(;A<=C;A+=d);
	if (A<B)puts("No");
	else	puts("Yes");
}
int main(){
	for(ll T=read();T--;)work();
}
/*
1

<=C
的%10=1的最大的数
%10	=	1
%10	=	1
%10	=	1
for(;A>C;A-=gcd(B,D));

5-
10-
d=3
A=100 (3-1)
C=99
min()
刚开始可以构造出的最小值<=C+gcd(B,D)-B 
*/

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

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

    int n;
    cin >> n;
    set<int> a;
    REP(i, n) {
        int tmp;
        cin >> tmp;
        a.insert(tmp);
    }

    if (a.size() == n) cout << "YES" << '\n';
    else cout << "NO" << '\n';
    return 0;
}


Measured memory_bytes: 9600
import java.util.*;

public class Main {
    public static int n = 0;
    public static int[] data = new int[20];
    public static int q = 0;
    public static int[] target = new int[200];

    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        n = num.nextInt();

        for(int i = 0; i < n; i++) {
            data[i] = num.nextInt();
        }

        q = num.nextInt();

        for(int i = 0; i < q; i++) {
            target[i] = num.nextInt();
        }

        if(num != null) {
            num.close();
        }

        for(int i = 0; i < q; i++) {
            if(calc(0, target[i])) {
                System.out.println("yes");
            } else {
                System.out.println("no");
            }
        }
    }

    public static boolean calc(int sum, int m) {
        if(m == 0) {
            return true;
        }
        if(sum >= n) {
            return false;
        }
        return calc(sum + 1, m) || calc(sum + 1, m - data[sum]);
    }
}


Measured memory_bytes: 26852
from bisect import bisect_left
import sys
sys.setrecursionlimit(10 ** 7)

def solve(G, a, lis, pre, p, ans):
    target = a[p]
    idx = bisect_left(lis, target)
    frm = lis[idx]
    to = target
    lis[idx] = to
    ans[p] = bisect_left(lis, float("inf"))
    for v in G[p]:
        if v == pre:
            continue
        solve(G, a, lis, p, v, ans)
    lis[idx] = frm

def main():
    n = int(input())
    a = list(map(int, input().split()))
    G = [[] for _ in range(n)]
    for _ in range(n-1):
        u, v = map(int, input().split())
        u, v = u-1, v-1
        G[u].append(v)
        G[v].append(u)
    lis = [float("inf")]*(n+1)
    ans = [None]*n
    solve(G, a, lis, -1, 0, ans)
    for v in ans:
        print(v)

if __name__ == "__main__":
    main()

Measured memory_bytes: 229612
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

ULL mpow(ULL a,ULL i,ULL M){
 if(i==0) return 1;
 ULL r=mpow(a*a%M,i/2,M);
 if(i&1) r=r*a%M;
 return r;
}

void NTT(vector<ULL>& A,ULL M,ULL g){
 int N=A.size();
 for(int i=0,j=0; j<N; j++){
  if(i<j) swap(A[i],A[j]);
  for(int k=N>>1; k>(i^=k); k>>=1);
 }
 for(int i=1; i<N; i<<=1){
  ULL q=mpow(g,(M-1)/i/2,M), qj=1;
  rep(j,i){
   for(int k=j; k<N; k+=i*2){
    ULL l=A[k], r=A[k+i]*qj%M;
    A[k]=l+r; if(A[k]>=M) A[k]-=M;
    A[k+i]=l+M-r; if(A[k+i]>=M) A[k+i]-=M;
   }
   qj=qj*q%M;
  }
 }
}

struct Fuse{ ULL M,G; };
vector<ULL> TNT(const vector<ULL>& A,const vector<ULL>& B,Fuse F){
 int Z=1; while(Z<A.size()+B.size()) Z<<=1;
 vector<ULL> Ax(Z),Bx(Z);
 ULL iZ=mpow(Z,F.M-2,F.M);
 rep(i,Z) Ax[i]=Bx[i]=0;
 rep(i,A.size()) Ax[i]=A[i];
 rep(i,B.size()) Bx[i]=B[i];
 NTT(Ax,F.M,F.G);
 NTT(Bx,F.M,F.G);
 rep(i,Z) Ax[i]=Ax[i]*Bx[i]%F.M;
 NTT(Ax,F.M,mpow(F.G,F.M-2,F.M));
 rep(i,Z) Ax[i]=Ax[i]*iZ%F.M;
 return move(Ax);
}

const Fuse fuse = {998244353,3};

int zA,zB;
vector<ULL> A,B;
vector<ULL> ans;

int main(){
 scanf("%d%d",&zA,&zB);
 A.resize(zA); B.resize(zB);
 rep(i,zA) scanf("%llu",&A[i]);
 rep(i,zB) scanf("%llu",&B[i]);
 ans = TNT(A,B,fuse);
 rep(i,zA+zB-1){
  if(i) printf(" ");
  printf("%llu",ans[i]);
 }printf("\n");
 return 0;
}


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

int main(){
	int N;
	cin >> N;
	vector<int> L(N);
	for(int i = 0; i < N; i++) cin >> L[i];
	int sum = 0;
	sort(L.begin(), L.end());
	reverse(L.begin(), L.end());
	for(int i = 1; i < N; i++) sum += L[i];
	
	if(L[0] < sum) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <cstdint>
#include <iostream>

namespace null_null {

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using usize = std::size_t;

} // namespace null_null

#include <vector>

namespace null_null {

void main_() {
  usize N;
  std::cin>>N;
  std::vector<u32>d(N);
  for(usize i=0;i<N;i++){
    std::cin>>d[i];
  }

  u32 ans=0;
  for(usize i=0;i<N;i++){
    for(usize j=i+1;j<N;j++){
      ans+=d[i]*d[j];
    }
  }

  std::cout<<ans<<std::endl;
}

} // namespace null_null

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  null_null::main_();
  return 0;
}

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

int main(int argc, char const *argv[]) {
    int n, m;
    cin >> n >> m;
    vector<vector<int> > rules(m, vector<int>(n));
    for (size_t i = 0; i < m; i++) {
        int k;
        cin >> k;
        for (size_t j = 0; j < k; j++) {
            int s;
            cin >> s;
            rules[i][s-1] = 1;
        }
    }
    vector<int> p(m);
    for (size_t i = 0; i < m; i++) cin >> p[i];

    int ans = 0;
    for (int i = 0; i < (1<<n); i++) {
        bool ok = true;
        for (int j = 0; j < m; j++) {
            int temp = 0;
            for (int k = 0; k < n; k++) {
                if ((i & (1<<k)) && rules[j][k]) temp++;
            }
            if (temp%2 != p[j]) ok = false;
        }
        if (ok) ans++;
    }

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


Measured memory_bytes: 3632
#include <functional>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int main() {
    int n;
    int m;
 
   cin >> n >> m;
  
   cout << n-m+1 << endl;
  // cout << m << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int D;
  cin >> D;
  vector<int> c(26);
  REP(i, 26) cin >> c[i];
  vector<vector<int>> s(D, vector<int>(26));
  REP(i, D) REP(j, 26) cin >> s[i][j];

  REP(i, D) {
    cout << (i%26)+1 << "\n";
  }
}

Measured memory_bytes: 3712
#include<stdio.h>
int main(void)
{
	int A, P;
	scanf("%d%d", &A, &P);
	int a=0;
	for (int i = 0; i < A; i++) {
		a += 3;
	}
	printf("%d", (a + P) / 2);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
#define rep(i,n) for(int i=0; i<n; i++)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてから使う
#define INF 2147483647
#define LLINF 9223372036854775807LL

int main() {
  int n,k,q; cin>>n>>k>>q;
  vector<int>A(q);
  rep(i,q) cin>>A[i];
  vector<int>Point(n);
  rep(i,q) Point[A[i]-1]++;
  rep(i,n){
    if (Point[i] >= q-k+1) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}



Measured memory_bytes: 3932
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(int i=0; i<n; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  int H, W; cin >> H >> W;
  vector<vector<char>> S(H, vector<char>(W));
  rep(x, H) {
    rep(y, W) {
      cin >> S.at(x).at(y);
    }
  }
  bool ans = true;
  rep(x, H) {
    rep(y, W) {
      if(S.at(x).at(y) == '#') {
        if(x-1 >= 0) {
          if(S[x-1][y] == '#') continue;
        }
        if(x+1 < H) {
          if(S[x+1][y] == '#') continue;
        }
        if(y-1 >= 0) {
          if(S[x][y-1] == '#') continue;
        }
        if(y+1 < W) {
          if(S[x][y+1] == '#') continue;
        }
        ans = false;
        goto end;
      }
    }
  }
  end:
  printf(ans ? "Yes\n" : "No\n");
}

Measured memory_bytes: 256
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    static final Scanner     sc = new Scanner(System.in);
    static final PrintStream so = System.out;

    static long[] fib = new long[45];
    
    public static void main(String[] args) {
        fib[0] = fib[1] = 1;
        for (int i = 2; i < 45; i++) {
            fib[i] = fib[i-1] + fib[i-2];
        }
        
        int m = nint();
        so.println(fib[m]);
    }

    private static long nlong() {
        return sc.nextLong();
    }

    private static int nint() {
        return sc.nextInt();
    }

    private static String nstr() {
        return sc.next();
    }

    private static char[] nsToChars() {
        return sc.next().toCharArray();
    }

    private static long[] nlongs(int n) {
        return nlongs(n, 0, 0);
    }

    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static long[] nlongs(int n, int padL, int padR) {
        long[] a = new long[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nlong();
        return a;
    }

    private static String[] nstrs(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = nstr();
        return a;
    }

    private static char[][] nsToChars2D(int h, int w) {
        return nsToChars2D(h, w, 0);
    }

    private static char[][] nsToChars2D(int h, int w, int pad) {
        char[][] a2 = new char[h + pad * 2][w + pad * 2];
        for (int i = 0; i < h; i++)
            System.arraycopy(nsToChars(), 0, a2[pad + i], pad, w);
        return a2;
    }
}



Measured memory_bytes: 26216
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e4 + 5;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int n, k;
char Min, Max, ans[MAXN], s[MAXN];
void check(char *s, int k) {
	static char t[MAXN];
	int now = n, len = 0;
	while (now >= 1 && s[now] == Min) now--, len++;
	assert(len != 0);
	while (k != 0 && len < n) len *= 2, k--;
	if (len >= n) {
		for (int i = 1; i <= n; i++)
			ans[i] = Min;
		printf("%s\n", ans + 1);
		exit(0);
	}
	for (int i = 1; i <= len; i++)
		t[i] = Min;
	for (int i = len + 1; i <= n; i++)
		t[i] = s[now--];
	for (int i = 1; i <= n; i++)
		if (t[i] < ans[i]) {
			for (int j = 1; j <= n; j++)
				ans[j] = t[j];
			return;
		} else if (t[i] > ans[i]) return;
}
int main() {
	read(n), read(k);
	scanf("%s", s + 1);
	Min = 'z', Max = 'a';
	for (int i = 1; i <= n; i++) {
		chkmin(Min, s[i]);
		chkmax(Max, s[i]);
		s[2 * n - i + 1] = s[i];
		ans[i] = 'z';
	}
	if (Min == Max) {
		printf("%s\n", s + 1);
		return 0;
	}
	if (s[n] == Min) check(s, k);
	for (int i = n; i <= 2 * n; i++)
		if (s[i] == Min) check(s + i - n, k - 1);
	printf("%s\n", ans + 1);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string.h>
using namespace std;
const long long mod = 1e9 + 7;
long long mat[63][51][51];
int main() {
	int N; long long K; cin >> N >> K;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			cin >> mat[0][i][j];
		}
	}
	for (int i = 1; i < 63; i++) {
		for (int j = 1; j <= N; j++) {
			for (int k = 1; k <= N; k++) {
				for (int l = 1; l <= N; l++) {
					mat[i][j][k] = (mat[i][j][k] + mat[i - 1][j][l] * mat[i - 1][l][k] % mod) % mod;
				}
			}
		}
	}
	long long res[2][51][51];
	memset(res, 0, sizeof(res));
	for (int i = 1; i <= N; i++) res[0][i][i] = 1;
	for (int i = 62; i >= 0; i--) {
		if (K >> i & 1LL) {
			for (int j = 1; j <= N; j++) {
				for (int k = 1; k <= N; k++) {
					for (int l = 1; l <= N; l++) {
						res[1][j][k] = (res[1][j][k] + res[0][j][l] * mat[i][l][k] % mod) % mod;
					}
				}
			}
			for (int j = 1; j <= N; j++) {
				for (int k = 1; k <= N; k++) {
					res[0][j][k] = res[1][j][k];
					res[1][j][k] = 0;
				}
			}
		}
	}
	long long total = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			total = (total + res[0][i][j]) % mod;
		}
	}
	cout << total << endl;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long N;
    cin >> N;
    long long x;
    long long y;
    int flag=0;
    long long sum=N/1+1;
    for(int i=1; i<=N; i++){
        if(N%i==0 && sum>(N/i+i)){
            sum=N/i+i;
            x=i;
            y=N/i;
            flag=1;
        }
        if(N/i<i){
            break;
        }
    }
    if(flag==1){
    cout << x+y-2 << endl;
    }
    else{
        cout << N-1 << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){

  int H,W;

  cin>>H>>W;

  int cnt=0;
  
  char mp[101][101];

  for(int i=0;i<H;i++){
    cnt=0;
    for(int j=0;j<W;j++){
      cin>>mp[i][j];

      if(mp[i][j]=='.'){
	cnt++;
      }
    }

    if(cnt==W){
      for(int j=0;j<W;j++){
	mp[i][j]='*';
      }
    }
  }
  
  for(int i=0;i<W;i++){
    cnt=0;
    for(int j=0;j<H;j++){
      if(mp[j][i]=='.'||mp[j][i]=='*'){
	cnt++;
      }
    }
    if(cnt==H){
      for(int j=0;j<H;j++){
	mp[j][i]='*';
      }
    }
  }
  

  bool judge=0;
  
  for(int i=0;i<H;i++){
    judge=0;
    for(int j=0;j<W;j++){
      if(mp[i][j]!='*'){
	cout<<mp[i][j];
	judge=1;
      }
    }
    if(judge)
      cout<<endl;
  }

  
  return 0;
}


Measured memory_bytes: 256
#![allow(unused)]

use std::{cell, cmp, collections, convert, fmt, io, iter, ops, str};

use cell::{Cell, RefCell};
use cmp::Ordering::{Equal, Greater, Less};
use collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use io::{Read, Write};

#[cfg(feature = "debug")]
macro_rules! debug {
    ($($args: tt)*) => { eprint!($($args)*) };
}

#[cfg(feature = "debug")]
macro_rules! debugln {
    ($($args: tt)*) => { eprintln!($($args)*) };
}

#[cfg(not(feature = "debug"))]
macro_rules! debug {
    ($($args:tt)*) => {};
}

#[cfg(not(feature = "debug"))]
macro_rules! debugln {
    ($($args:tt)*) => {};
}

macro_rules! vmax {
    ($x: expr, $y: expr) => { cmp::max($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::max($x, vmax!($($args),*)) };
}

macro_rules! vmin {
    ($x: expr, $y: expr) => { cmp::min($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::min($x, vmin!($($args),*)) };
}

fn main() {
    let (a, b) = {
        let ab = parse_vec::<i32>();
        (ab[0], ab[1])
    };

    let diff = b - a;
    let heights = (1..diff).fold(0, |acc, h| acc + h);

    println!("{}", heights - a);
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        //
    }
}

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_owned()
}

fn read_word() -> String {
    const CAPACITY: usize = 16;

    let mut stdin = io::stdin();
    let mut byte: [u8; 1] = [0];

    loop {
        let mut buf = Vec::with_capacity(CAPACITY);

        loop {
            let res = stdin.read(&mut byte);

            if res.unwrap_or(0) == 0 || byte[0] <= b' ' {
                break;
            } else {
                buf.push(byte[0]);
            }
        }

        if !buf.is_empty() {
            return String::from_utf8(buf).unwrap();
        }
    }
}

fn parse_line<T: str::FromStr>() -> T {
    read_line().parse().ok().unwrap()
}

fn parse_word<T: str::FromStr>() -> T {
    read_word().parse().ok().unwrap()
}

fn parse_vec<T: str::FromStr>() -> Vec<T> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn flush() {
    io::stdout().flush();
}

fn next_prime(x: i32) -> i32 {
    for i in (x + 1).. {
        if is_prime(i) {
            return i;
        }
    }

    panic!("attempt to add with overflow");
}

fn is_prime(x: i32) -> bool {
    let ceil = f64::from(x).sqrt().ceil() as i32;
    x == 2 || (2..(ceil + 1)).all(|i| x % i != 0)
}

fn bit_high(bits: u64, pos: u64) -> bool {
    bits & (1 << pos) != 0
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<math.h>

void gcd(double []);//最大公約数

int main(void)
{
   double number[3];
   scanf("%lf %lf",&number[0],&number[1]);
   
   gcd(number);
   return 0;
}


void gcd(double number[])
{
   double i,gcd,a;
   
   if(number[0]<number[1]){/*「大÷小」にするため入れ替える*/
      number[2]=number[0];
      number[0]=number[1];
      number[1]=number[2];
   }
   while(fmod(number[0],number[1])!=0){
      number[0]=fmod(number[0],number[1]);
      number[2]=number[0];//並び替え//
      number[0]=number[1];
      number[1]=number[2];
   }
   printf("%.0f\n",number[1]);
}

Measured memory_bytes: 644
n, k = map(int, input().split())
d_lis = []
person_lis = []
ans_lis = []
ans = []

for i in range(k):
    d_lis.append(int(input()))
    person_lis.append(list(map(int, input().split())))

#print(person_lis)
for people in person_lis:
    for person in people:
        if person in ans_lis:
            pass
        else:
            ans_lis.append(person)
#print(ans_lis)
for i in range(1, n+1):
    if i in ans_lis:
        pass
    else:
        ans.append(i)
print(len(ans))

Measured memory_bytes: 9208
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let mut a: Vec<usize> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    a.sort();
    let mut memo = vec![false; 1000010];
    let mut cnt = vec![0; 1000010];
    for i in 0..n {
        cnt[a[i]] += 1;
    }
    let mut ans = 0;
    for i in 0..n {
        if !memo[a[i]] {
            let mut j = a[i];
            while j <= 1000005 {
                memo[j] = true;
                j += a[i];
            }
            if cnt[a[i]] == 1 {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 9652
#include <bits/stdc++.h>
#define fin ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 2 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
const int  M = 201;
int main(){
    //freopen("in","r",stdin);
    //freopen("out","w",stdout);
    int r,g,b;
    cin >> r >> g >> b;
    r = r * 10 + g;
    r = r * 10 + b;
    cout << (r % 4 == 0?"YES":"NO") << '\n';
    return 0;
}   

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define k 1046527
char a[100];
char b[100];
char H[k][14];
int zhengshu(char a){
if(a=='A')return 1;
else if(a=='C')return 2;
else if(a=='G')return 3;
else if(a=='T')return 4;
else return 0;
}
long long zhuanhuan(char b[]){
long long sum=0;
long long p=1,i;
for(int i=0;i<strlen(b);i++){
 sum+=p*(zhengshu(b[i]));
 p=p*5;
}
return sum;
}
int s1(int key){return key%k;}
int s2(int key){return 1+(key%(k-1));}
int chazhao(char b[]){
long long key,i,h;
key=zhuanhuan(b);
for(int i=0;;i++){
    h=(s1(key)+i*s2(key))%k;
    if(strcmp(H[h],b)==0)return 1;
    else if(strlen(H[h])==0)return 0;
}
return 0;
}
int insert(char b[]){
long long key,i,h;
key=zhuanhuan(b);
for(int i=0;;i++){
    h=(s1(key)+i*s2(key))%k;
    if(strcmp(H[h],b)==0)return 1;
    else if(strlen(H[h])==0){
        strcpy(H[h],b);
        return 0;
    }
}
return 0;
}
int main(){
int n;
for(int i=0;i<k;i++){
    H[i][0]='\0';
}
scanf("%d",&n);
for(int i=0;i<n;i++){
    scanf("%s %s",a,b);
    if(a[0]=='i'){
        insert(b);
    }
else {
    if(chazhao(b)){
        printf("yes\n");
    }
    else printf("no\n");
}
}
return 0;
}

Measured memory_bytes: 16968
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
const ll MOD = 1000000007;

int main() {
	int N, L = 0;
	cin >> N;
	vector<int> A(N);
	for (int i = 0;i < N;i++) {
		cin >> A[i];
		L ^= A[i];
	}
	for (int i = 0;i < N;i++) {
		cout << (A[i] ^ L);
		if (i == N - 1)cout << endl;
		else cout << " ";
	}
}


Measured memory_bytes: 4056
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if ((a <= c && c <= b) || (b <= c && c <= a)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

priority_queue<LL> _left;
priority_queue<LL, vector<LL>, greater<LL> > _right;

void solve() {
  int q;
  cin >> q;

  LL res = 0;
  LL mid;
  REP(i, q) {
    int k;
    cin >> k;
    if (k == 2) {
      cout << mid << " " << res << endl;
      continue;
    }

    LL a, b;
    cin >> a >> b;
    res += b;
    if(i==0) {
      mid = a;
      continue;
    }
    if(mid <= a) {
      _right.push(a);
      res += a-mid;
    } else {
      _left.push(a);
      res += mid-a;
    }
    if (SZ(_left)+2 == SZ(_right)) {
      LL next_mid = _right.top();
      LL diff = next_mid - mid;

      res -= diff*SZ(_right);
      _right.pop();

      _left.push(mid);
      res += diff*SZ(_left);

      mid = next_mid;
    } else if (SZ(_left) > SZ(_right)) {
      LL next_mid = _left.top();
      LL diff = mid - next_mid;

      res -= diff*SZ(_left);
      _left.pop();

      _right.push(mid);
      res += diff*SZ(_right);

      mid = next_mid;
    }
  }
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 3828
/*
 * main.c
 *
 *  Created on: 2019/04/20
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
    int N, K;
    char S[11] = {0};
    int i = 0;
    scanf("%d", &N);
    scanf("%s",S);
    scanf("%d", &K);
    for(i = 0; i < N; i++) {
        char s = S[K-1];
        if(s == S[i]) {
            printf("%c",s);
        } else {
            printf("*");
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cassert>
#include <cmath>
#include <sstream>
#include <complex>
#include <stack>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<unsigned, unsigned> uu;
typedef pair<ll, ll> l4;


#define pb push_back
#define mp make_pair

ll a, b, c, d, n;

int main()
{
    cin >> a >> b >> c >> d >> n;
    c = min(c, min(2*b, 4*a));
    d = min(d, 2*c);
    cout << (n>>1)*d+(n&1)*c << '\n';
}


Measured memory_bytes: 256
main :: IO ()
main = do
  n <- readLn
  if n == 0
    then return ()
    else do
      ls <- getLine
      let ls' = map (read :: String -> Int) (words ls)
          l = concat (repeat ls')
      game 32 l
      main

game :: Int -> [Int] -> IO ()
game i l = do
  let n1 = i - (mod (i - 1) 5)
      n2 = max (n1 - (head l)) 0
  putStrLn $ show n1
  putStrLn $ show n2
  if n2 == 0
    then return ()
    else game n2 (tail l)

Measured memory_bytes: 3920
#include <bits/stdc++.h>
    using namespace std;
 
    #define EPS (1e-9)
    #define ll long long int
    #define ull unsigned long long
    #define pi (acos(-1.0))
    #define endl "\n"
    #define all(v) v.begin(),v.end()
    #define printa(a,L,R) for(int i=L;i<R;i++) cout<<a[i]<<(i==R-1?'\n':' ')
    #define precise(n) cout << fixed << setprecision(n)
    #define show(a) cout << (#a) << " is " << (a) << endl;
    #define pcase cout<<"Case "<<++cs<<": "
    #define FAST ios_base::sync_with_stdio(0); cin.tie(0);
    const int mod=1e9+5;
    const int mx=1e5+10;
    const ll inf=1e15;
    typedef pair< int,int > pii;
    ll binpow(ll base, ll exp){ll res = 1;while(1){ if(exp&1) res*=base;exp>>=1;if(!exp)break;base*=base;}return res;}
    bool cmp(const pii a,const pii b)
    {
        if(a.second==b.second) return a.first<b.first;
 
        return a.second>b.second;
    }
    	int n,k;
        vector<pii> v;
    void min_self(ll& a, ll b) {
    a = min(a, b);
}
    int main(int argc, char const *argv[])
    {
    	FAST
    	cin >> n >> k;
        ll total_v=0;
        for (int i = 0; i < n; ++i)
        {
            int a,b;

            cin >> a >> b;
            v.emplace_back(a,b);
            total_v+=b;

        }
        //show(total_v);
        std::vector<ll> dp(total_v+1,inf);
        dp[0]=0;
        /*for(int item = 0; item < n; ++item) {
            show(item);
        for(int i = total_v - v[item].second; i >= 0; --i) {
        //~ for(int weight_already = 0; weight_already <= W - weight; ++weight_already) {
            int weight=v[item].first;
            int value=v[item].second;
            cout << "weight = " << v[item].first << " , value = "<< v[item].second << endl;
            show(i);
            show(i+value);
            show(dp[i+value]);
            show(dp[i] + weight);

            min_self(dp[i+v[item].second], dp[i] + v[item].first);
            cout <<"after change dp["<<i+value <<"]= "<< dp[i+value]<< endl;
        }
        }*/
        for (int item = 0; item < n; ++item)
        {
            int weight=v[item].first ,value=v[item].second;
            for (int i = total_v-value; i >=0; i--)
            {
                min_self(dp[i+value],dp[i]+weight);
            }
        }
    	
      ll answer = 0;
    for(int i = 0; i <= total_v; ++i) {
        if(dp[i] <= k) {
            answer = max(answer, (ll) i);
        }
        //~ min_self(answer, dp[i]);
    }
        cout << answer<< endl;
 
    	
    	
 
    	return 0;
            }

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define rep(n) for (int i = 0; i < (n); ++i)
int main()
{
    int n;
    cin>>n;
    vector<int> d(n);
    rep(n) cin>>d[i];
    int s=0;
    rep(n){
        for(int j=i+1;j<n;++j){
            s+=d[i]*d[j];
        }
    }
    cout<<s;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace abc166_c
{
  class Program
  {
    static void Main(string[] args)
    {
      var N = CIn.ReadInt();
      var M = CIn.ReadInt();
      var H = CIn.ReadIntArray(N);

      var p = new HashSet<int>[N];

      for (int i = 0; i < N; i++)
      {
        p[i] = new HashSet<int>();
      }

      for (int i = 0; i < M; i++)
      {
        var A = CIn.ReadInt() - 1;
        var B = CIn.ReadInt() - 1;

        if (H[A] <= H[B]) p[A].Add(B);
        if (H[A] >= H[B]) p[B].Add(A);
      }

      var ans = p.Count(e => e.Count == 0);

      Console.WriteLine(ans);
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


Measured memory_bytes: 68608
N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
# print(f"N:{N} K:{K} A:{A}", file=sys.stderr)

zero_index = 0
for i in range(len(A)):
    if A[i] == 1:
        zero_index = i
        break

count = 0
### 1の右側を全部1にする回数を求める
### 右側から数えて K個, K-1個, ... K-1個 でzero_index に届く回数を確かめる
zero_left_index = len(A)

zero_left_index -= K
count += 1
while zero_left_index > zero_index:
    zero_left_index -= (K - 1)
    count += 1

# print(f"zero_index:{zero_index} count:{count} zero_left_index:{zero_left_index}", file=sys.stderr)

### zero_left_index(全部1になっている列の一番左) を全部1にする回数を求める
if zero_index != 1 and zero_left_index > 1:
    # zero_left_index -= K
    # count += 1
    while zero_left_index > 1:
        zero_left_index -= (K - 1)
        count += 1
print(count)

Measured memory_bytes: 13812
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int ll
#define tests int t;cin>>t;while(t--)
void start()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
}
void solve()
{
	string s;
	cin>>s;
	cout<<(s.substr(0,3))<<"\n";
}
signed main()
{
	start();
	solve();
	return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>

int main(void)

{


          int a,b,c;


          scanf("%d %d %d",&a,&b,&c);


          if(a<b&&b<c)


          {


               printf("Yes\n");


          }


          else


          {


               printf("No\n");


          }


         return 0;


}

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

using namespace std;
using Graph = vector<vector<int>>;
using Grid= vector<vector<char>>;
using vin= vector<int>;
using ll=long long;
using vll= vector<ll>;
using vbl=vector<bool>;
using vch=vector<char>;
using pinin=pair<int ,int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define sort(x) sort(x.begin(), x.end());
#define rese(x) reverse(x.begin(), x.end());

int main() {
  int d,t,s;
  cin>>d>>t>>s;
  if(d<=t*s){
      cout<<"Yes"<<endl;
  }
  else{
      cout<<"No"<<endl;
  }

}


Measured memory_bytes: 3620