akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
const long long llinf=LLONG_MAX;
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
using namespace std;
string s,tmp,tmp1;
int i,n,ans;
int main()
{
    //freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>s;
    for(i=0;i<s.size();i++)if(s[i]!='x')tmp+=s[i];
    tmp1=tmp;
    reverse(tmp.begin(),tmp.end());
    if(tmp1!=tmp)rc(-1);
    n=s.size()-1;
	for(i=0;i<s.size();i++)
	{
		if(s[i]=='x' && s[n-i]!='x')s.in(n-i+1,"x"),n++,ans++;
		else if(s[n-i]=='x' && s[i]!='x')s.in(i,"x"),n++,ans++;
	}
	rc(ans);
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;


int main(){
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n,0);
    vector<ll> asum(n+1,0);
    ll ans = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        asum[i+1] = asum[i] + a[i];
    }
    map<ll,ll> mp;
    for(int i = 0; i < n+1; i++){
        mp[asum[i]%m] += 1;
    }
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        ans += (itr->second)*(itr->second-1)/2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

int main(){
   int n;
   string s;
   cin >> n >> s;
   if(s.size()%2==0){
      if(s.substr(0, s.size()/2)==s.substr(s.size()/2, s.size()/2)){
         cout << "Yes";
      }else cout  << "No";
   }else cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <math.h>

using namespace std;

// Sieve of Eratosthenes
vector<int> eratosthenes (int n)
{
    vector<int> res;
    vector<bool> is_prime(n + 1, true);
    for(int p = 2; p <= n; ++p){
        if(!is_prime[p]){
            continue;
        }
        else {
            for (int k = 2 * p; k <= n; k += p){
                is_prime[k] = false;
            }
        }
        res.push_back(p);
    }
    return res;
}

void factorize(int n){
    int m = n;
    bool b = true;
    const int N = 50000;
    if(n >= N){
        for(int p=2; p<(int)(sqrt(N)+1); ++p){
            if(m % p == 0){
                b = false;
                break;
            }
        }
    }
    else {
        b = false;
    }
    cout << n << ":";
    if(b){
        cout << " " << m << endl;
        return;
    }
    vector<int> prime;
    prime = eratosthenes(N);
    int l = prime.size();
    for(int i=0; i<l; ++i){
        while(m >= 2 && m % prime[i] == 0){
            cout << " " << prime[i];
            m = m / prime[i];
        }
        if(m <= 1){
            break;
        }
    }
    cout << endl;
    return;
}
int main()
{
    int n;
    cin >> n;
    factorize(n);
    return 0;
}


Measured memory_bytes: 3228
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        boolean ac[] = new boolean[n];
        int wanum[] = new int[n];
        for(int i = 0;i<n;i++){
            ac[i] = false;
            wanum[i] = 0;
        }for(int i = 0;i<m;i++){
            int p = sc.nextInt();
            String s = sc.next();
            if(s.equals("AC")){
                ac[p-1] = true;
            }else if(s.equals("WA") && ac[p-1] == false){
                wanum[p-1]++;
            }
        }
        int acResult = 0;
        int waResult = 0;
        for(int i = 0;i<n;i++){
            if(ac[i]){
                acResult++;
                waResult += wanum[i];
            }
        }
        System.out.print(acResult + " ");
        System.out.println(waResult);
        sc.close();
    }

}

Measured memory_bytes: 64992
from collections import Counter
import itertools


def main():
    N, K = (int(x) for x in input().split())
    A = []
    for i in range(K):
        d = int(input())
        A.append([int(x) for x in input().split()])
    A = itertools.chain.from_iterable(A)
    p = Counter(A)
    print(N-len(p))


if __name__ == "__main__":
    main()


Measured memory_bytes: 9468
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A, B, C;
  cin >> A >> B >> C;
  bool ok = false;
  rep(i, B+1) {
    if(A*i % B == C) ok = true;
  }
  cout << (ok ? "YES" : "NO") << "\n";
  return 0;
}


Measured memory_bytes: 3584
/**
 * @author yuichirw
 *
 */
import java.util.*;
import static java.lang.Math.*;

public class Main {
	static int W, N, C;
	static int[] v, w;
	static Scanner sc = new Scanner(System.in);
	
	static boolean read() {
		W = sc.nextInt();
		if(W == 0) return false;
		
		N = sc.nextInt();
		v = new int[N]; w = new int[N];
		String[] tmp = null;
		for(int i = 0; i < N; i++) {
			tmp = sc.next().split(",");
			v[i] = Integer.parseInt(tmp[0]); w[i] = Integer.parseInt(tmp[1]);
		}
		return true;
	}
	
	static void solve() {
		int[][] dp = new int[N+1][W+1], weight = new int[N+1][W+1];
		for(int i = 1; i <= N; i++) {
			for(int j = 1; j <= W; j++) {
				if(j < w[i-1]) {
					dp[i][j] = dp[i-1][j];
					weight[i][j] = weight[i-1][j];
				} else {
					if(dp[i-1][j] <= (dp[i-1][j - w[i-1]] + v[i-1])) {
						dp[i][j] = dp[i-1][j - w[i-1]] + v[i-1];
						weight[i][j] = weight[i-1][j - w[i-1]] + w[i-1];
					} else {
						dp[i][j] = dp[i-1][j];
						weight[i][j] = weight[i-1][j];
					}
				}
			}
		}
		System.out.println("Case " + (C++) + ":");
		System.out.println(dp[N][W]);
		System.out.println(weight[N][W]);
		
	}
	
	public static void main(String[] args) {
		C = 1;
		while(read()) {
			solve();
		}
	}

}

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


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



Measured memory_bytes: 3080
import sys
input=sys.stdin.readline
s=input().rstrip()
ans=1000
for i in range(26):
    x=chr(97+i)
    temp=0
    pre=list(s)
    while True:
        check=True
        for j in pre:
            if j!=x:
                check=False
        if check:
            ans=min(ans,temp)
            break
        temp+=1

        post=[]
        for j in range(len(pre)-1):
            if pre[j]==x or pre[j+1]==x:
                post.append(x)
            else:
                post.append('!')
        pre=post

print(ans)

Measured memory_bytes: 73472
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception{
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String s = bf.readLine();
        String[] arr = {"Sunny", "Cloudy", "Rainy"};
        for(int i=0; i<arr.length; i++) {
            if(s.equals(arr[i])) {
                int printIdx = i+1;
                if(printIdx == 3) {
                    printIdx = 0;
                }
                System.out.println(arr[printIdx]);
                return;
            }
        }
    }
}

Measured memory_bytes: 20820
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    vector<int>num(31);
    int n;
    for(int i = 1; i <= 28; i++){
        cin >> n;
        num[n] = 1;
        /*cin >> num[i];
        num[i] = 1;*/
    }

    for(int i = 1; i <= 30; i++){
        if(!num[i]) cout << i << endl;
    }
}




Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

int main(){
    for(ll i = 0; ; ++i){
        ll x;
        cin >> x;
        if(x == 0){ break; }
        cout << "Case " << i + 1 << ": " << x << endl;
    }
    return 0;
}



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

const int MAXN = 2005;
int val[MAXN][MAXN];
char mp[MAXN][MAXN];
int n, m;

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			cin >> mp[i][j];
	for (int i = 0; i < n; i++) {
		int ls = -1;
		for (int j = 0; j < m; j++) {
			if (mp[i][j] == '#')
				ls = j;
			val[i][j] += j - ls - 1;
		}
		ls = m;
		for (int j = m - 1; j >= 0; j--) {
			if (mp[i][j] == '#')
				ls = j;
			val[i][j] += ls - j - 1;
		}
	}
	for (int i = 0; i < m; i++) {
		int ls = -1;
		for (int j = 0; j < n; j++) {
			if (mp[j][i] == '#')
				ls = j;
			val[j][i] += j - ls - 1;
		}
		ls = n;
		for (int j = n - 1; j >= 0; j--) {
			if (mp[j][i] == '#')
				ls = j;
			val[j][i] += ls - j - 1;
		}
	}
	int ans = 0;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			if (mp[i][j] != '#')
				ans = max(ans, val[i][j]);
	cout << ans + 1;
}

Measured memory_bytes: 19840
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_C&lang=jp
sample_input = list(range(4))
sample_input[0] = '''6
insert AAA
insert AAC
find AAA
find CCC
insert CCC
find CCC'''
sample_input[1] = '''13
insert AAA
insert AAC
insert AGA
insert AGG
insert TTT
find AAA
find CCC
find CCC
insert CCC
find CCC
insert T
find TTT
find T'''
sample_input[2] = '''20
find CTT
find TAG
insert AA
insert CTC
find G
insert TGT
find AAC
find TTG
insert AA
insert TTG
insert G
insert A
insert GG
insert C
insert TT
find T
insert C
find GG
find G
insert CG'''
sample_input[3]='''15
insert AAA
insert AAC
insert AGA
insert AGG
insert TTT
find AAA
find CCC
find CCC
insert CCC
find CCC
find CC
insert T
find TTT
find T
find A'''
give_sample_input = None
if give_sample_input is not None:
    sample_input_list = sample_input[give_sample_input].split('\n')
    def input():
        return sample_input_list.pop(0)
        
# main

class ACGTDictNode (object):
    
    def __init__(self):
        self.A = None    # None | ACGTDictNode
        self.C = None
        self.G = None
        self.T = None
        self.has_end = False
    
    
    def add_if_none(self, acgt):
        if acgt == 'A':
            if self.A is not None:
                return self.A
            else:
                self.A = ACGTDictNode()
                return self.A
        elif acgt == 'C':
            if self.C is not None:
                return self.C
            else:
                self.C = ACGTDictNode()
                return self.C
        elif acgt == 'G':
            if self.G is not None:
                return self.G
            else:
                self.G = ACGTDictNode()
                return self.G
        elif acgt == 'T':
            if self.T is not None:
                return self.T
            else:
                self.T = ACGTDictNode()
                return self.T
        else:
            assert False
            
            
    def get(self, acgt):
        if acgt == 'A':
            return self.A
        elif acgt == 'C':
            return self.C
        elif acgt == 'G':
            return self.G
        elif acgt == 'T':
            return self.T
        else:
            assert False
            
    
    def add_end(self):
        self.has_end = True

        

class ACGTDict (object):
    
    def __init__(self):
        self.tree = ACGTDictNode()
        
        
    def insert(self, string):
        node = self.tree
        for c in string:
            node = node.add_if_none(c)
        node.add_end()
            
    
    def find(self, string):
        node = self.tree
        for c in string:
            node = node.get(c)
            if node is None:
                return False
        return node.has_end
        
        

dict = ACGTDict()
num_of_commands = int(input())
for n in range(num_of_commands):
    input_str = input()
    command, data = input_str.split(' ')
    if command == 'insert':
        dict.insert(data)
    else:
        if dict.find(data):
            print('yes')
        else:
            print('no')
            

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

int main() {
	const int MAX=10000;
	int n, m, a[MAX], b, cnt=0;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	cin >> m;
	for(int i=0; i<m; i++){
		cin >> b;
		for(int j=0; j<n; j++){
			if(b==a[j]) {
				cnt++;
				break;
			}
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3116
#include<stdio.h>
#include<string.h>
int main()
{
    char s[51],s1[51],t[51],ans[51];
    scanf("%s",s1);
    scanf("%s",t);
    int L1=strlen(s1),L2=strlen(t),i,j,flag=1,k,count=0;
    strcpy(ans,s1);
    for(i=0; i<L1; i++)
        if(ans[i]=='?')
            ans[i]='z';
    for(i=0; i<L1; i++)
    {
        strcpy(s,s1);
        int count1=0;
        for(j=0; j<L2; j++)
            if((s1[i+j]=='?')||(s1[i+j]==t[j]))
                count1++;
        if(count1==L2)
        {
            for(k=0; k<L1; k++)
            {
                if((k<i)||(k>=i+L2))
                {
                    if(s[k]=='?')
                        s[k]='a';
                }
                else
                    s[k]=t[k-i];
            }
            strcpy(ans,s);
        }
        else
            count++;
    }
    if(count==L1)
        printf("UNRESTORABLE");
    else
        printf("%s",ans);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;++i)
#define For(i,a,b) for(int i=(a),i##_end=(b);i<i##_end;++i)
#define per(i,a,b) for(int i=(b),i##_st=(a);i>=i##_st;--i)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define dbg(x) cerr<<#x" = "<<x<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define Es(x,i) for(Edge*i=G[x];i;i=i->nxt)
typedef long long ll;
typedef pair<int,int> pii;
const int inf=~0u>>1,MOD=1e9+7;
inline int rd() {
    int x,c,f=1;while(!isdigit(c=getchar()))f=c!='-';x=c-'0';
    while(isdigit(c=getchar()))x=x*10+c-'0';return f?x:-x;
}
const int N=100011,M=N<<1;
struct Edge{
	int v,w;
	Edge*nxt;
}pl[M<<1],*cur=pl,*G[N];
inline void ins(int u,int v,int w){
	*cur=(Edge){v,w,G[u]},G[u]=cur++; 
}
int n,m,S,T;
ll f[N];
int U[M],V[M],W[M];
char inq[N];
queue<int> q;
inline void spfa(){
	rep(i,1,n)f[i]=LONG_LONG_MAX>>2;
	f[S]=0;
	q.push(S);
	while(!q.empty()){
		int x=q.front();q.pop();
		inq[x]=0;
		Es(x,i)if(f[i->v]>f[x]+i->w){
			f[i->v]=f[x]+i->w;
			if(!inq[i->v]){
				inq[i->v]=1;
				q.push(i->v);
			}
		}
	}
}
ll g[N];
inline void spfa2(){
	rep(i,1,n)g[i]=LONG_LONG_MAX>>2;
	g[T]=0;
	q.push(T);
	while(!q.empty()){
		int x=q.front();q.pop();
		inq[x]=0;
		Es(x,i)if(g[i->v]>g[x]+i->w){
			g[i->v]=g[x]+i->w;
			if(!inq[i->v]){
				inq[i->v]=1;
				q.push(i->v);
			}
		}
	}
}
int d[N];
ll dp1[N],dp2[N];
int main(){
#ifdef flukehn
	freopen("test.txt","r",stdin);
#endif
	n=rd(),m=rd();
	S=rd(),T=rd();
	rep(i,1,m){
		int u=U[i]=rd(),v=V[i]=rd(),w=W[i]=rd();
		ins(u,v,w),ins(v,u,w);
	}
	spfa(),spfa2();
	{
		dp1[S]=1;
		rep(i,1,n){
			Es(i,j)if(f[j->v]==f[i]+j->w)++d[j->v];
		}
		q.push(S);
		while(!q.empty()){
			int x=q.front();q.pop();
			Es(x,i)if(f[i->v]==f[x]+i->w){
				dp1[i->v]+=dp1[x];
				dp1[i->v]%=MOD;
				if(!--d[i->v])q.push(i->v);
			}
		}
	}
	memset(d,0,sizeof d);
	{
		dp2[T]=1;
		rep(i,1,n){
			Es(i,j)if(g[j->v]==g[i]+j->w)++d[j->v];
		}
		q.push(T);
		while(!q.empty()){
			int x=q.front();q.pop();
			Es(x,i)if(g[i->v]==g[x]+i->w){
				dp2[i->v]+=dp2[x];
				dp2[i->v]%=MOD;
				if(!--d[i->v])q.push(i->v);
			}
		}
	}
	ll ans=(ll)dp1[T]*dp2[S]%MOD,tmp=f[T];
	//cout<<ans<<endl;
	rep(i,1,n){
		if(f[i]==g[i]&&f[i]+g[i]==tmp){
			//cout<<i<<" "<<f[i]<<endl;
			ans-=(ll)dp1[i]*dp1[i]%MOD*dp2[i]%MOD*dp2[i]%MOD;
		}
	}
	rep(i,1,m){
		int u=U[i],v=V[i],w=W[i];
		if(f[u]>f[v])swap(u,v);
		if(f[u]+g[v]+w==tmp&&2*f[u]<tmp&&2*f[v]>tmp){
			ans-=(ll)dp1[u]*dp2[v]%MOD*dp1[u]%MOD*dp2[v]%MOD;
		}
	}
	ans=(ans%MOD+MOD)%MOD;
	cout<<ans<<endl;
}

Measured memory_bytes: 13592
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val h = sc.nextInt()
    val w = sc.nextInt()
    val t = (1..h).map { sc.next().toCharArray().map { if (it == '.') '0' else it }.toMutableList() }
    val dx = arrayOf(-1, 0, 1, -1, 1, -1, 0, 1)
    val dy = arrayOf(-1, -1, -1, 0, 0, 1, 1, 1)
    repeat(h) {i->
        repeat(w) {j->
            if (t[i][j] == '#') {
                for (k in dx.indices) {
                    val nx = j + dx[k]
                    val ny = i + dy[k]
                    if ((nx in 0 until w) && (ny in 0 until h) && t[ny][nx] != '#') {
                        t[ny][nx]++
                    }
                }
            }
        }
    }

    repeat(h) {
        println(t[it].joinToString(""))
    }
}

Measured memory_bytes: 36332
#include <stdio.h>

int main(){
  int A,B;
  scanf("%d %d",&A,&B);
  if(A>9){
   printf("-1\n");
  }else if(B>9){
   printf("-1\n");
  }else{
    printf("%d\n",A*B);
  }
  return 0;
}

Measured memory_bytes: 1648
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const int MOD[2] = {int(1e9+7), 998244353};
const int C[2] = {129381, 109239};

int mult(int a, int b, int mod)
{
	return (a*1LL*b)%mod;
}

int add(int a, int b, int mod)
{
	a+=b;
	while(a>=mod) a-=mod;
	return a;
}

int exlen[1111111];

ll make(int a, int b)
{
	return (a*1LL*(MOD[0]+10)+b);
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	vector<string> vec;
	set<int> L;
	vector<ll> hashes(n);
	for(int i=0;i<n;i++)
	{
		string s; cin>>s;
		vec.pb(s); L.insert(int(s.length()));
		exlen[int(s.length())-1]=1;
	}
	//unordered_map<ll,int> dp[26]; 
	vector<pair<ll,int> > badbits;
	for(int i=0;i<n;i++)
	{
		string s = vec[i];
		int ct[26] = {};
		int len = s.length();
		int bit = 0;
		for(int j=0;j<len;j++)
		{
			ct[s[j]-'a']++;
			bit|=(1<<(s[j]-'a'));
		}
		int hsh[2] = {0,0};
		if(exlen[0])
		{
			badbits.pb({0,bit});
		}
		/*
		for(int k=0;k<26;k++)
		{
			if(bit&(1<<k)) dp[k][0]++;
		}
		*/
		if(len==1)
		{
			hashes[i] = 0;
		}
		for(int j=len-1;j>=0;j--)
		{
			ct[s[j]-'a']--;
			if(ct[s[j]-'a']==0) 
			{
				bit^=(1<<(s[j]-'a'));
			}
			for(int z=0;z<2;z++)
			{
				hsh[z]=mult(hsh[z],C[z],MOD[z]);
				hsh[z]=add(hsh[z],s[j],MOD[z]);
			}
			if(exlen[len-j])
			{
				badbits.pb({make(hsh[0],hsh[1]),bit});
				/*
				for(int k=0;k<26;k++)
				{
					if(bit&(1<<k)) dp[k][make(hsh[0],hsh[1])]++;
				}
				*/
			}
			if(j==1)
			{
				hashes[i] = make(hsh[0],hsh[1]);
			}
		}
	}
	//all strings distinct
	ll ans = 0;
	vector<ll> dhashes;
	for(auto X:badbits) dhashes.pb(X.fi);
	for(int i=0;i<n;i++) dhashes.pb(hashes[i]);
	sort(dhashes.begin(),dhashes.end()); dhashes.erase(unique(dhashes.begin(),dhashes.end()));
	vector<int> dp[26];
	for(int i=0;i<26;i++) dp[i].resize(dhashes.size()+1,0);
	for(int i=0;i<n;i++)
	{
		//suppose i am smaller
		ll tmp = hashes[i];
		int id = lower_bound(dhashes.begin(),dhashes.end(),tmp)-dhashes.begin();
		int ch = vec[i][0]-'a';
		dp[ch][id]++;
		//ans+=dp[ch][tmp]-1;
	}
	for(auto X:badbits)
	{
		X.fi = lower_bound(dhashes.begin(),dhashes.end(),X.fi)-dhashes.begin();
		for(int i=0;i<26;i++)
		{
			if(X.se&(1<<i))
			{
				ans+=dp[i][X.fi];
			}
		}
	}
	ans-=n;
	cout<<ans<<'\n';
}


Measured memory_bytes: 172272
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,t;
    int c,a;
    int mn=10000;
    cin>>n>>t;
    for(int i=0;i<n;i++){
        cin>>c>>a;
        if(t>=a){
            mn=min(mn,c);
        }
    }
    if(mn==10000) cout<<"TLE"<<endl;
    else cout<<mn<<endl;
    return 0;
}



Measured memory_bytes: 256
X, Y = map(int, input().split())
S = 0
R = [300000, 200000, 100000]
for i in range(max(X, Y)):
  R.append(0)

if X == 1 and Y == 1:
  print(R[X-1] + R[X-1] + 400000)
else:
  print(R[X-1] + R[Y-1])

Measured memory_bytes: 3060
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll n,k;
    cin >> n >> k;
    if(n%k != 0) cout << 1;
    else cout << 0;
    cout <<endl;


    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


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

int main(void)
{
  vector<int> A(3);
  cin >> A[0] >> A[1] >> A[2];
  sort(A.rbegin(), A.rend());
  cout << A[0]*10+A[1]+A[2] << endl; 
}



Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


void Main(){
    int N;
    cin >> N;
    N++;
    cout << N/2 << el;
}



Measured memory_bytes: 256
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 200005;
const int mod = 1000000007;

int a[maxn],b[maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++)cin>>b[i];
  sort(b,b+n, greater<int>());
  int l = -1, r = -1;
  for(int i=0;i<n;i++){
    if(a[i]==b[i]){
      r = i;
      if(l==-1)l = i;
    }
  }
  if(l!=-1){
    int cur = l;
    for(int i=0;i<n;i++){
      if(i>=l&&i<=r)continue;
      if(cur>r)break;
      if(a[i]!=a[l]&&b[i]!=a[l]){
        swap(b[i], b[cur]);
        cur++;
      }
    }
    if(cur<=r){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  for(int i=0;i<n;i++){
    cout<<b[i]<<(i==n-1?'\n':' ');
  }
  return 0;
}


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



vector<int> find_all(const string str, const string subStr) {
    vector<int> result;
 
    int subStrSize = subStr.size();
    int pos = str.find(subStr);
 
    while (pos != string::npos) {
        result.push_back(pos);
        pos = str.find(subStr, pos + subStrSize);
    }
 
    return result;
}


int main(){
    int N;

    cin >> N;
    string s[N];
    int count[N];
    int lastA = 0;
    int firstB = 0;
    int bothAB = 0;
    int ans = 0;

    for(int i = 0; i < N; i++) {
        cin >> s[i];

        count[i] = find_all(s[i], "AB").size();
        if(*(s[i].end()-1) == 'A' && *s[i].begin() == 'B'){
            bothAB++;
        }else if(*(s[i].end()-1) == 'A'){
            lastA++;
        }else if(*s[i].begin() == 'B'){
            firstB++;
        }

        ans += count[i];
    }
    if(lastA != 0 || firstB != 0){
        ans += bothAB;
        ans += min(lastA, firstB);

    }else if(bothAB == 0){
        
    }else{
        ans += bothAB - 1;
    }

    
    cout << ans << endl;
    

    // for(int i = 0; i < N; i++) {
    //     cout << count[i] << endl;
    // }
    // cout << bothAB << endl;
    // cout << lastA << endl;
    // cout << firstB << endl;


    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
 
#define jyldam ios_base::sync_with_stdio;cin.tie(NULL);cout.tie(NULL);

#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define sz size()
#define fi first
#define se second
 
#define cmp_all(x) (x).begin(), (x).end(), cmp
#define batr ONLINE_JUDGE
#define all(x) (x).begin(),(x).end()
#define skip continue
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
const int N = 1e6 + 17, maxN = 4 * N, darr = 1e3 + 17, mod = 1e9 + 7;

int n, k;
ll a[N];
ll sum;
ll ct;

int main () {
	jyldam;
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	if (sum < k) {
		cout << n - 1;
		return 0;
	}
	if (sum > k) {
		sort(a + 1, a + n + 1);
		for (int i = 1; i <= n; i++) {
			if (k < a[i]) {
				break;
			}
			k -= a[i];
			ct++;
		}
		cout << ct;
		return 0;
	}
	cout << n;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int debt = 100000;
		for(int i=0;i<n;i++) {
			debt += debt/20;
			debt = ((debt-1)/1000+1)*1000;
		}
		System.out.println(debt);
	}

}

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

int main() {
    string s;
    cin >> s;
    int cnt = 0, ans = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'A' || s[i] == 'T' || s[i] == 'C' || s[i] == 'G')
            cnt++;
        else {
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    cout << max(ans, cnt) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    if(n%2 == 0){
        if(n/2 >= k){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }else{
        if(n/2+1 >= k){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
}


Measured memory_bytes: 256
/*
 ALLAH is Almighty....
*/
#include <bits/stdc++.h>

#define ll  long long
using namespace std;

const ll mx = 10e5 + 9;
ll n, k;
ll ar[ mx ];
ll dp[ mx ];

void solve( )
{
    cin >> n >> k;
    for ( ll i = 0; i < n; ++i ) {
        dp[ i ] = 1e12;
        cin >> ar[ i ];
    }

    dp[ 0 ] = 0;
    for ( ll i = 1; i < n; ++i )
        for ( ll j = i - 1; j >= 0 && j >= i - k; --j )
            dp[ i ] = min( dp[ j ] + abs( ar[ i ] - ar[ j ] ), dp[ i ] );

    cout << dp[ n - 1 ] << "\n";
}

int main()         // Md. Inzamam-ul Haque
{
    solve();
}



Measured memory_bytes: 5120
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const int mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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


// ll memo[2020][2020];
// int pascal_triangle(){
//   for(int i = 0; i < 2020; i++){
//     for(int j = 0; j < i+1; j++){
//       if(j == 0 || j == i) memo[i][j] = 1;
//       else{
// 	memo[i][j] = (memo[i-1][j-1]+memo[i-1][j]);
//       }
//     }
//   }
//   return 0;
// }


int factorial(int n){
  if(n == 0) return 1;
  return n*factorial(n-1);
}

int divisor(int a){
  int cnt = 0;
  for(int i=1; i <= a; i++) if(a%i == 0) cnt++;
  return cnt;
}

int comb(int n, int k){
  return factorial(n) / (factorial(n-k)*factorial(k));
}

int answer(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



int main(){
  int N;
  cin >> N;
  char c;
  int n = N / 1000;
  c = 'C' + n;
  string s = "AB";
  s += c;
  cout << s << endl;
  return 0;
}







Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <bitset>
using namespace std;
typedef long long ll;
const ll INF    = 1000000000000000000;
const int MAX_N = 400 + 2;
ll dp[MAX_N][MAX_N];
ll a[MAX_N];

ll rec (int l, int r) {

  if (l == r)  return 0;
  if (dp[l][r] != 0) return dp[l][r];

  ll res = INF;
  for (int i = l; i < r; i++) {
    res = min(res, rec(l, i) + rec(i + 1, r));
  }

  res += a[r];
  if (l > 0) res -= a[l - 1];

  dp[l][r] = res;
  return dp[l][r];
}

int main() {

  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    if (i > 0) a[i] += a[i - 1];
  }

  memset(dp, 0, sizeof(dp));

  ll ans = rec(0, N - 1);
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 4476
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
#define INF 0x3f3f3f3f
#define MAX_NODE 110

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    printf("%d\n", (n - 1)*(m - 1));
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(int argc, char const *argv[]) {

    int a,b,i,j;

    while(1){

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

        if(a == 0 && b == 0){
            break;
        }

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

            if(i % 2 == 0){

                for(j = 0; j < b; j++){
                    if(j % 2 == 0){
                        printf("#");
                    }else{
                        printf(".");
                    }

                }
                printf("\n");

            }else{

                for(j = 0; j < b; j++){
                    if(j % 2 == 0){
                        printf(".");
                    }else{
                        printf("#");
                    }
                }
                printf("\n");

            }

        }
        printf("\n");

    }
    return 0;
}



Measured memory_bytes: 2040
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e10;
const int MOD = 1e9+7;

template <typename T>
class segment_tree{
    private:
        static int calc_size(int n){
            int m = 1;
            while(m < n){
                m *= 2;
            }
            return m;
        }

        T query(int s, int t, int i, int l, int r) const {
            if(r <= s || t <= l){
                return init;
            }

            if(s <= l && r <= t){
                return node[i];
            }

            int m = l + (r - l) / 2;
            T vl = query(s, t, i * 2 + 1, l, m);
            T vr = query(s, t, i * 2 + 2, m, r);
            return f(vl, vr);
        }

    public:
        int n;
        vector<T> node;
        T init;
        function<T(T, T)> f;

        segment_tree(int n, T init, function<T(T, T)> f)
            : n(calc_size(n)), node(calc_size(n) * 2, init), init(init), f(f){}

        void update(int i, const T& x){
            i += (n - 1);
            node[i] = x;
            while(i > 0){
                i = (i - 1) / 2;
                node[i] = f(node[2*i+1], node[2*i+2]);
            }
        }

        //[s, t)
        T query(int s, int t) const {
            return query(s, t, 0, 0, n);
        }
};

signed main(){
    int n;
    cin >> n;

    vector<int> b(n+1), w(n+1);
    rep(i, n * 2){
        char c;
        int a;
        cin >> c >> a;
        if(c == 'W'){
            w[a] = i;
            continue;
        }
        b[a] = i;
    }

    vector<vector<int>> costb(n+1, vector<int>(n+1));
    vector<vector<int>> costw(n+1, vector<int>(n+1));

    segment_tree<int> bst(2*n+1, 0, [](int a, int b){return a+b;});
    for(int i = n; i > 0; i--){
        bst.update(b[i], 1);

        int ww = 0;
        for(int j = n; j >= 0; j--){
            costb[i-1][j] = ww + bst.query(0, b[i]);
            if(w[j] < b[i]){
                ww++;
            }
        }
    }

    segment_tree<int> wst(2*n+1, 0, [](int a, int b){return a+b;});
    for(int j = n; j > 0; j--){
        wst.update(w[j], 1);

        int bb = 0;
        for(int i = n; i >= 0; i--){
            costw[i][j-1] = bb + wst.query(0, w[j]);
            if(b[i] < w[j]){
                bb++;
            }
        }
    }

    vector<vector<int>> dp(n+1, vector<int>(n+1, INF));
    dp[0][0] = 0;
    rep(i, n+1){
        rep(j, n+1){
            if(i < n){
                dp[i+1][j] = min(dp[i+1][j], dp[i][j] + costb[i][j]);
            }
            if(j < n){
                dp[i][j+1] = min(dp[i][j+1], dp[i][j] + costw[i][j]);
            }
        }
    }

    cout << dp[n][n] << endl;

    return 0;
}


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

int main(){
	int n, tem, ans, num;
	cin >> n >> tem >> ans;
	vector<double> vec(n), ondo(n), copy(n);
	for (int i=0; i<n; i++){
		cin >> vec.at(i);
	}
	for (int i=0; i<n; i++){
		ondo.at(i)=1000*tem-6*vec.at(i)-1000*ans;
		if(ondo.at(i)<ans) ondo.at(i)=-ondo.at(i);
	}
	for (int i=0; i<n; i++){
		copy.at(i) = ondo.at(i);
	}
	sort(copy.begin(), copy.end());
	for (int i=0; i<n; i++){
		if(copy.at(0)==ondo.at(i)) break;
		num ++;
	}
	cout << num+1 << endl;
}


Measured memory_bytes: 3828
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

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

    int sum = 0;
    rep(i, n) sum += w[i];

    int ans = INF;
    int tmp = 0;
    for(int i = 0; i < n - 1; i++){
        tmp += w[i];

        ans = min(ans, abs(sum - tmp - tmp));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a);  a = (a * a);  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 4;
ll i,a,b;
ll d[N];
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    rep(i,0,N - 1){
        cin>>a>>b;
        d[a - 1] += 1;
        d[b - 1] += 1;
    }
    a = b = 0;
    rep(i,0,N){
        if(d[i] == 1) a += 1;
        if(d[i] == 2) b += 1;
    }
    cout<<((a == 2 && b == 2) ? "YES" : "NO");
    return 0;
}

Measured memory_bytes: 256
lines = $stdin.read.lines.map(&:chomp)
N = lines.shift.to_i
a = lines.shift.split(' ').map(&:to_i)

a.sort! {|a0, a1| a1 <=> a0 }
a.pop
s = a.shift
0.upto(a.size - 1) {|i|
	n = (i / 2.0).floor
	s += a[n]
}
puts s


Measured memory_bytes: 30712
#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
char map[150][150]; char bb;
int n,m;int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};  
void dfs(int x,int y)
{   if(x<0||x>=n||y<0||y>=m) return ;  
    if(map[x][y]!=bb) return ;  
    map[x][y]='.';  
    for(int i=0;i<4;i++) {  
        dfs(x+dx[i],y+dy[i]);  
    }  
}
int main()
{    int i,j,sum; 
     while(scanf("%d%d",&n,&m)!=EOF&&(n!=0||m!=0))
     {
	 
     for(i=0;i<n;i++)
     scanf("%s",map[i]);
     sum=0;
     for(i=0;i<n;i++)
     for(j=0;j<m;j++)
     {  if(map[i][j]=='.') continue;
         bb=map[i][j];
         dfs(i,j);
         sum++;
	 }
	 printf("%d\n",sum);}
	 return 0;
}


Measured memory_bytes: 3528
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	string s;
	cin >> s;

	for (int i = 0; i < s.size(); i++) {
		for (int j = i; j < s.size(); j++) {
			string t = s.substr(0, i) + s.substr(j);
			if (t == "keyence") {
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,c;
	scanf("%d %d", &a, &b);
	c=a*b;
	if(a+b>c)
	c=a+b;
	if(a-b>c)
	c=a-b;
	printf("%d\n", c);
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <vector>
#include <string.h>
#include <stdio.h>
using namespace std;
typedef long long ll;

ll euclid(ll a, ll b)
{
    int nr = 0;
    while (b != 0)
    {
        int c = b;
        b = a % b;
        a = c;
        nr++;
    }
    return nr;
}


int main()
{
    int n, l;
    cin >> n >> l;
    vector<int> v(n);
    int sum = 0;
    int minim = 99999;
    int index = -1;
    for (int i = 0; i < n; i++)
    {
        v[i] = l + i;
        if (minim > abs(v[i]))
        {
            minim = abs(v[i]);
            index = i;
        }
        sum += v[i];
    }
    cout << sum - v[index];
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>

using namespace std;

#define debug(x) cout << #x << "==" << x << endl;
#define INF INT_MAX / 2

typedef long long ll;

int main() {
  ios::sync_with_stdio(false);

  string s;
  cin >> s;
  s[5] = ' ';
  s[13] = ' ';
  cout << s;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  ll n;
  cin >>n ;
  ll a[n];
  for(int i=0;i<n;i++)cin >> a[i];
  sort(a,a+n);
  reverse(a,a+n);
  ll s=0;
  s=a[0];
  ll b=0;
  ll c=1;
  while(b<n-2){
    s+=a[c];
    b++;
    if(b==n-2)break;
    s+=a[c];
    b++;
    c++;
  }

  cout << s << endl;


}

Measured memory_bytes: 5196
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long int;
using ULL = unsigned long long;

int main() {
    vector<int> v(5);
    rep(i, 5) {
        cin >> v[i];
    }
    int k;
    cin >> k;
    rep(i, 4) {
        loop(j, 1, 5) {
            if (abs(v[i] - v[j]) > k){
                cout << ":("  << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
    return 0;
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

int main() {
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> b(n);
    rep(i, n) b[i] = a[i]-i-1ll;
    debug(b);
    sort(all(b));
    ll median = b[n/2];
    ll ans = 0ll;
    rep(i, n) ans += abs(a[i]-(median+i+1ll));
    cout << ans << endl;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+5;
struct edge{
    int u,v,next;
}E[maxn];
int tot=0,head[maxn];
void addedge(int u,int v){
    E[++tot].v=v;
    E[tot].u=u;
    E[tot].next=head[u];
    head[u]=tot;
}
int p;
int c[maxn],value[maxn];
void dfs(int u){
//    printf("u=%d\n",u);
    value[u]=c[p--];
    for(int i=head[u];i;i=E[i].next){
        int v=E[i].v;
        if(!value[v]){
            dfs(v);
        }
    }
}
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n-1;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        addedge(u,v);
        addedge(v,u);
    }
    for(int i=1;i<=n;i++){
        scanf("%d",&c[i]);
    }
    sort(c+1,c+1+n);
    p=n;
    dfs(1);
    ll ans=0;
    for(int i=1;i<=n-1;i++){
        int u=E[i<<1].u;
        int v=E[i<<1].v;
        ans=ans+min(value[u],value[v]);
    }
    printf("%lld\n",ans);
    for(int i=1;i<=n;i++){
        printf("%d ",value[i]);
    }
}


Measured memory_bytes: 6656
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  int n  = 0;
  cin >> s ;
  if(s[0] == 'S' && s[1] == 'S' && s[2] == 'S'){
    n = 0;
    cout << n << endl;
  }else{
  for(int i = 0; i < 2; i++){
    if(s[i] == 'R' && s[i+ 1] == 'R'){
    n++;
    }
  } 
  cout << n + 1 << endl;
  }
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int used[100];
int n1, n2, n3, n4;
int main() {
    ios_base::sync_with_stdio(false);
    cin >> n1 >> n2 >> n3 >> n4;
    used[n1] = 1;
    used[n2] = 1;
    used[n3] = 1;
    used[n4] = 1;
    if (used[1] + used[9] + used[7] + used[4] == 4) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    };
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll                long long int
#define ld                long double
#define F                 first
#define S                 second
#define C                 continue
#define G                 goto done
#define pb                push_back
#define pf                push_front
#define ppb               pop_back
#define ppf               pop_front
#define sz                size()
#define pi                acos(-1.0)
#define mod               1000000007
#define maxe              *max_element
#define mine              *min_element
#define min3(a,b,c)       min(a,min(b,c))
#define max3(a,b,c)       max(a,max(b,c))
#define min4(a,b,c,d)     min(a,min(b,min(c,d)))
#define max4(a,b,c,d)     max(a,max(b,max(c,d)))
#define mem(a,b)          memset(a,b,sizeof(a))
#define all(a)            (a).begin(),(a).end()
#define gcd(a,b)          __gcd(a,b)
#define lcm(a,b)          ((a)*((b)/gcd(a,b)))
#define case(a)           cout<<"Case "<<(a)<<": "
#define point(a)          fixed<<setprecision(a)
#define get(a)            for(auto &x:a) cin>>x;
#define print(a)          for(auto x:a) cout<<x<<" "; cout<<endl;
#define uniq(a)           sort(all(a)); (a).erase(unique((a).begin(),(a).end()),(a).end())
#define big(a)            transform((a).begin(),(a).end(),(a).begin(),::toupper)
#define small(a)          transform((a).begin(),(a).end(),(a).begin(),::tolower)
#define ischar(a)         (('a'<=a&&a<='z')('A'<=a&&a<='Z'))
#define isvowel(a)        (a=='a'||a=='e'||a=='i'||a=='o'||a=='u'||a=='A'||a=='E'||a=='I'||a=='O'||a=='U')
#define fast              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define tc                int test; cin>>test; while(test--)
using namespace std;
int main()
{
    ll n; cin>>n; ll a[n]; get(a);
    ll g=a[0],f=0;
    for(ll i=1;i<n;i++) g=gcd(g,a[i]);
    map<ll,ll>mp;
    for(ll i=0;i<n;i++)
    {
        ll k=a[i];
        for(ll j=1;j*j<=k;j++)
        {
            if(k%j==0)
            {
                ll x=j;
                ll y=k/j;
                if((mp[x]==1 && x!=1) || (mp[y]==1 && y!=1))
                {
                    f=1; break;
                }
                mp[x]=1; mp[y]=1;
            }
        }
    }
    if(f==0) cout<<"pairwise coprime";
    else if(g==1) cout<<"setwise coprime";
    else cout<<"not coprime";
}




















Measured memory_bytes: 73796