akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans += min(a[i], abs(k - a[i])) * 2;
    }
    cout << ans << endl;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



int n;
vector<int> v[202020];
bool used[202020];
int ans = 0;
int dfs(int x){
	int ma = 0, ma2 = 0, cnt;
	for(int i = 0; i < v[x].size(); i++){
		if(used[v[x][i]]) continue;
		used[v[x][i]] = 1;
		cnt = dfs(v[x][i])+1;
		if(chmax(ma2,cnt)){
			if(ma < ma2) swap(ma,ma2);
		}
	}
	chmax(ans, ma+ma2);
	return ma;
}

void solve(){
	cin >> n;
	for(int i = 0; i < n-1; i++){
		int a,b;
		cin >> a >> b;
		a--; b--;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	
	used[0] = 1;
	dfs(0);
	if(ans%3 & 1){
		cout << "Second" << endl;
	}
	else{
		cout << "First" << endl;
	}
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 20480
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>
#include <unordered_map>
#include <bitset>

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 998244353;

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

  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  cout << s1[0] << s2[0] << s3[0] << endl;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  int N, Y;
  cin >> N >> Y;
  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= N - i; j++) {
      int k = N - i - j;
      if (10000 * i + 5000 * j + 1000 * k == Y) {
        cout << i << " " << j << " " << k << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>

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

using namespace std;
int N,K;

int main(){
  cin >> N >> K;
  if(K%2==1){
    long long int a = N/K;
    cout << a*a*a << endl;
    return 0;
  }
  else{
    long long int b = N/K;
    long long int c = N*2/K -b;
    cout << b*b*b+c*c*c << endl;
    return 0;
  }
}


Measured memory_bytes: 256
fun main(args : Array<String>) {
    val (n, x) = readLine()!!.split(" ").map { it.toInt() }
    val xx = readLine()!!.split(" ").map { it.toInt() }.toMutableList()
    xx.add(x)
    xx.sort()

    val diffs = mutableSetOf<Int>()
    for (i in 1..xx.size-1) {
        diffs.add(xx[i]-xx[i-1])
    }

    val sortedDiffs = diffs.toList().sorted()
    val min = diffs.min()!!

    outer@for (i in min downTo 2) {
        for (j in sortedDiffs) {
           if (j % i != 0) continue@outer
        }
        println(i)
        return
    }

    println(1)
}

Measured memory_bytes: 53504
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

int main(){
	int X, A, B;
	cin >> X >> A >> B;
	cout << ( (X - A) % B) << endl;
	
	
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from collections import defaultdict


def solve(H: int, W: int, M: int, h: "List[int]", w: "List[int]"):
    hDict = defaultdict(int)
    wDict = defaultdict(int)
    points = set()
    for i in range(M):
        hDict[h[i]]+=1
        wDict[w[i]]+=1
        points.add((h[i],w[i]))
    hArr = []
    wArr = []
    for hd in hDict:
        he = hDict[hd]
        hArr.append((-he,he,hd))
    for wd in wDict:
        he = wDict[wd]
        wArr.append((-he,he,wd))
    hArr.sort()
    wArr.sort()
    m = 0
    hm = hArr[0][1]
    wm = wArr[0][1]
    # hm+wm or hm+wm -1
    for h in hArr:
        if h[1] < hm:
            break
        for w in wArr:
            if w[1] < wm:
                break
            c = h[1] + w[1]
            if (h[2],w[2]) in points:
                c -= 1
            else:
                print(c)
                return
            m = max(m,c)
    print(m)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    h = [int()] * (M)  # type: "List[int]"
    w = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        h[i] = int(next(tokens))
        w[i] = int(next(tokens))
    solve(H, W, M, h, w)

if __name__ == '__main__':
    main()


Measured memory_bytes: 235344
k = input()
li = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(li[int(k) - 1])

Measured memory_bytes: 3060
#include<stdio.h>

int main(void)
{
  int a,b,c,first_r,r,i=2,temp;
  scanf("%d %d %d",&a,&b,&c);
  first_r = a % b;
  r = first_r;
  temp = a;
  while(r != c)
    {
      temp = a * i;
      r = temp % b;
      if(r == first_r)
	{
	  printf("NO\n");
	  return 0;
	}
      i++;
    }
  printf("YES\n");
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    int k;
    cin >> k;

    for (int i = 0; i < k; i++) {
        cout << "ACL";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    vector<bool> f(2), g(2); 
    f[0] = f[1] = true;
    rep(i, 1, n){
        g[0] = g[1] = false;
        // 0 : 何もしない
        if(f[0]){
            if(a[i] >= a[i - 1]) g[0] = true;
            if(a[i] >= a[i - 1] + 1) g[1] = true;
        }
        // 1 : 低くする
        if(f[1]){
            if(a[i] >= a[i - 1] - 1) g[0] = true;
            if(a[i] >= a[i - 1]) g[1] = true;
        }
        swap(f, g);
    }
    if(f[0] | f[1]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
    int n; cin >> n;
    vector<ll> x(n); for (int i = 0; i < n; i++) cin >> x[i];
    for (int i = n-1; i >= 1; i--) x[i] -= x[i-1];

    int m; ll k; cin >> m >> k;
    vector<vector<int>> p(64,vector<int>(n));
    for (int i = 0; i < n; i++) p[0][i] = i;
    for (int i = 0; i < m; i++) {
        int a; cin >> a;
        swap(p[0][a-1], p[0][a]);
    }
    for (int i = 1; i < 64; i++) {
        for (int j = 0; j < n; j++) {
            p[i][j] = p[i-1][p[i-1][j]];
        }
    }

    vector<ll> ans(n);
    for (int i = 0; i < n; i++) {
        int s = i;
        for (int j = 63; j >= 0; j--) {
            if (k & 1ll<<j) s = p[j][s];
        }
        ans[i] = x[s];
    }
    for (int i = 0; i < n; i++) {
        if (i) ans[i] += ans[i-1];
        cout << fixed << setprecision(10) << (double)ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 30044
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 50000;
const int MAX_M = 50000;

const int NSC = 12;

const string scs[NSC] = {
  "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"
};

/* typedef */

typedef map<string,int> msi;

/* global variables */

msi scmap;
int n, m;
int tis[MAX_N + 1], sis[MAX_M + 1];

/* subroutines */

inline int mod(int k) { return (k + NSC) % NSC; }

bool check(int ti) {
  for (int si = m - 1; si >= 0; si--) {
    if (ti < 0 || ti >= n) return false;

    int& t = tis[ti];
    int& s = sis[si];

    if (t == s) ti--;
    else if (mod(t + 1) == s) ti -= 2;
    else if (mod(t - 1) == s) ti++;
    else return false;
  }

  return (ti == -1);
}

/* main */

int main() {
  for (int i = 0; i < NSC; i++) scmap[scs[i]] = i;

  int tn;
  cin >> tn;

  while (tn--) {
    cin >> n >> m;
    string sc;
    
    for (int i = 0; i < n; i++) {
      cin >> sc;
      tis[i] = scmap[sc];
    }

    for (int i = 0; i < m; i++) {
      cin >> sc;
      sis[i] = scmap[sc];
    }

    bool ok = check(n - 1) || check(n - 2);
    cout << (ok ? "Yes" : "No") << endl;
  }

  return 0;
}

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

void dfs(int i, int k, int a, int b, int c, int &sum) {
    if (i == k) {
        sum = max(sum, a + b + c);
    } else {
        dfs(i+1, k, a*2, b, c, sum);
        dfs(i+1, k, a, b*2, c, sum);
        dfs(i+1, k, a, b, c*2, sum);
    }
}

int main() {
    int a, b, c;
    cin >> a;
    cin >> b;
    cin >> c;
    int k;
    cin >> k;
    int sum = 0;
    dfs(0, k, a, b, c, sum);
    cout << sum << endl;
}

Measured memory_bytes: 3588
w = str(input())

d ={}

flg = True

for i in range(len(w)):
    temp = w[i]
    
    
    if temp in d:
        d[temp] += 1
    else:
        d[temp] = 1
        

for i in d.values():
    
    if i %2 !=0:
        flg= False
    
if flg == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

int N;

signed main(){

    in(N);
    out(180*(N-2));

    return 0;
}


Measured memory_bytes: 888
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int f = sum(N);
		if ( N%f == 0 ) System.out.println("Yes");
		else System.out.println("No");
	}
	private static int sum(int n) {
		int res = 0;
		while(n>0) {
			res += n%10;
			n = n/10;
		}
		return res;
	}
}


Measured memory_bytes: 21844
def maxProfit(list):
    mini = 0
    ans = list[1] - list[0]
    for i in range(1, len(list)):
        if ans < list[i] - list[mini]:
            ans = list[i] - list[mini]
        if list[mini] > list[i]:
            mini = i
    return ans

N = int(input())
prolist = []
for i in range(N):
    prolist.append(int(input()))
print(maxProfit(prolist))




Measured memory_bytes: 13588
/*

    author : s@if

*/

#include<bits/stdc++.h>
using namespace std;

#define 		NIL 			-1
#define		 	fi	 		    first
#define 		sec 			second
#define 		MAX 			INT_MAX
#define			INF 			99999999
#define 		ll 			    long long
#define 		PI 			    acos(-1.0)
#define			MOD 			1000000007
#define 		PLL 			pair<ll,ll>
#define 		PII			    pair<int,int>
#define 		ull 			unsigned long long
#define 		For(i,a,b) 		for(int i=a;i<=(int)b;i++)


bool Check(int N , int pos)	{	return (bool) (N & (1<<pos));}
int Set(int N, int pos) {	return N = N | (1<<pos);}

int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};
int hr[]={-2,-2,-1,+1,+2,+2,-1,+1};
int hc[]={+1,-1,+2,+2,-1,+1,-2,-2};
int dx[]={+1,-1,+0,+0};
int dy[]={+0,+0,+1,-1};

const int MAXN = (int)2e3+9;

char ch[MAXN][MAXN] ;
int up[MAXN][MAXN], down[MAXN][MAXN];
int lft[MAXN][MAXN], rgt[MAXN][MAXN];

int main()
{
/*	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);  */

    int i,j,k,l,m,n,p,q,x,y,u,v,r,tc,t;

    cin>>n>>m;

    for(i=1; i<=n; i++)
    {
        cin>>ch[i]+1;
    }

    memset(up,0,sizeof(up));
    //memset(down,0,sizeof(down));
    memset(lft,0,sizeof(lft));
    //memset(rgt,0,sizeof(rgt));

    for(i=1; i<=n+1; i++)
    {
        for(j=1; j<=m+1; j++)
        {
            down[i][j] = n+1;
            rgt[i][j] = m+1;
        }
    }

    for(i=1; i<=n; i++)
    {
        for(j=1; j<=m; j++)
        {
            if(ch[i][j]=='#'){
                lft[i][j] = j;
                up[i][j] = i ;
            }
            else
            {
                lft[i][j] = lft[i][j-1];
                up[i][j] = up[i-1][j];
            }
        }
    }

    for(i=n; i>=1; i--)
    {
        for(j=m; j>=1; j--)
        {
            if(ch[i][j]=='#')
            {
                rgt[i][j] = j;
                down[i][j] = i;
            }
            else
            {
                rgt[i][j] = rgt[i][j+1];
                down[i][j] = down[i+1][j];
            }
        }
    }

  /*  for(i=1;i<=n;i++)
    {
        for(j=1;j<=m;j++)
            cout<<down[i][j]<<" ";
        cout<<endl;
    }  */

    int ans = 0;

    for(i=1; i<=n; i++)
    {
        for(j=1; j<=m; j++)
        {
            if(ch[i][j]=='.')
            {
                k = 1;
                k+=i - up[i][j]-1;
                k+=j - lft[i][j]-1;
                k+=down[i][j]-i-1;
                k+=rgt[i][j]-j-1;

               // cout<<k<<" ";
                ans = max(ans,k);
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 67200
#include <bits/stdc++.h>
using namespace std;
 
#define MOD 1000000007
#define INF  2000000000
//#define int ll
#define ll long long
#define ld long double
#define vi vector<int>
#define pa pair<int, int>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC(type, c, n) vector<type> c(n);for(auto& i:c)cin>>i;
#define MAT(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
 
#define BR cout << "\n";
#define SP cout << " ";
#define ENDL cout<<endl;
#define OUT(d) cout<<(d);
#define OUTL(d) cout<<(d); BR;
#define YES OUTL("YES")
#define Yes OUTL("Yes")
#define NO OUTL("NO")
#define No OUTL("No")
#define RET return 0;
#define SUM(a, n) accumulate(a, a+n, 0)
#define VSUM(v) accumulate(ALL(v), 0);
 
#define REP(i, n) for(int i=0;i<(n);i++)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define FOR(i, m, n) for(int i = m;i < n; i++)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define AREP(a, n) for(auto (a):(n))
#define ALL(a) (a).begin(),(a).end()
#define IN(n, a, b) ((a)<=(n)&&(n)<(b))

signed main(){ INIT;
    VAR(ll, x, y);
    int ans=0;
    ll num=x;
    while(num <= y) ans++, num*=2;
    OUTL(ans);
RET;}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int a[3], i, sum=0;
    for(i=0; i<3; i++) {
        scanf("%d", &a[i]);
        sum += a[i];
    }

    for(i=0; i<3; i++) {
        if((sum/2)==a[i] && sum%2==0) {
            printf("Yes\n");
            return 0;
        }
    }

    printf("No\n");

    return 0;

}

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

int main() {
  int a, b, c; cin >> a >> b >> c;
  if (a == 7 && (b == 5 && c == 5)) cout << "YES" << endl;
  else if (b == 7 && (a == 5 && c == 5)) cout << "YES" << endl;
  else if (c == 7 && (a == 5 && b == 5)) cout << "YES" << endl;
  else cout << "NO" << endl;
  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=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = 1001002003004005006ll;
const int inf = 1001001001;
const int mod = 1000000007;

ll gcd(ll a, ll  b) { return b ? gcd(b, a % b) : a; }

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(all(a));
	rrep(i, n) {
		a[i] %= a.front();
		if (a[i] == 0) a[i] += a.front();
	}
	int ans = a.front();
	rrep(i, n) ans = gcd(ans, a[i]);
	cout << ans << endl;
	return 0;
}

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

int main() {
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> P(N, 0);
    for(int i = 0; i < Q; i++) {
        int A;
        cin >> A;
        A--;
        P[A]++;
    }
    for(int p : P) {
        if(K - Q + p > 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}

Measured memory_bytes: 3764
#pragma GCC optimize("O3")   //
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, b, a) for(int i = b - 1; i >= a; i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double ld;
typedef unsigned long long ull;

unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937 eng(seed);

uniform_int_distribution<> DD(0, (1ll << 31));

ll random2(){
    return (ll(DD(eng))*(1ll << 31) + ll(DD(eng))) & ((1ll << 62ll)-1);
}

ll n,m,k,q,T;

const ll big = 1000000007;
const ll big2 = 1000000009;
const ll mod =  998244353;

const int MAXN = 1000001;


ll modpow(ll b, ll e) {
	ll ans = 1;
	for (; e; b = b * b % mod, e /= 2)
		if (e & 1) ans = ans * b % mod;
	return ans;
}

ll invert(ll a, ll b){
    return 1<a ? b - invert(b%a,a)*b/a : 1;
}

vl inverses(vl &A){
    vl result(sz(A));
    ll prod = 1;
    for(int i = 0; i < sz(A); i++){
        result[i] = prod;
        prod = (prod*A[i])%mod;
    }
    ll inv = invert(prod, mod);
    prod = 1;
    for(int i = sz(A)-1; i >= 0; i--){
        result[i] = (((result[i]*prod)%mod)*inv)%mod;
        prod = (prod*A[i])%mod;
    }
    return result;
}

vl FAC,INV;

ll bin(ll i, ll j){
    if(j > i)return 0;
    ll ans = FAC[i]*INV[j];
    ans %= mod;
    return (ans*INV[i-j])%mod;
}

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

    //freopen("input.txt","r",stdin);
    //freopen("autput.txt","w",stdout);

    ll a,b,c,d,e;

    ll t = 1;
    rep(c1,0,MAXN){
        FAC.push_back(t);
        t *= ll(c1+1);
        t %= mod;
    }
    INV = inverses(FAC);
    cin >> n >> m >> k;
    ll ans = 0;
    rep(c1,0,k+1){
        ll x = n-c1;
        ll temp = m*modpow(m-1,x-1);
        temp %= mod;
        temp *= bin(n-1, x-1);
        temp %= mod;
        ans += temp;
        ans %= mod;
    }
    cout << ans << "\n";


    return 0;
}


Measured memory_bytes: 18988
n,m=map(int,input().split())
h=list(map(int,input().split()))
adj=[[] for i in range(n+1)]
for i in range(m):
    u,v=map(int,input().split())
    adj[u].append(v)
    adj[v].append(u)
cnt=0
for i in range(1,n+1):
    ok=True
    for x in adj[i]:
        if h[i-1]<= h[x-1]:
            ok=False
            break
    if ok:
        cnt += 1
print(cnt)

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

using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    int A[N];

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

    sort(A, A+N);
    double parameter=(double)total/(double)(4*M);

   // cout << A[N-M] << " " << parameter << endl;
    if(A[N-M]>=parameter)
    {
        cout << "Yes";
    }

    else
    {
        cout << "No";
    }
}


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

int main() {
    int N;
    cin >> N;
  
    int AC_c = 0;
    int WA_c = 0;
    int TLE_c = 0;
    int RE_c = 0;
    std::string arr[N];
    for(int i { 0 }; i < N; ++i){
        cin >> arr[i];
        if(arr[i] == "AC"){AC_c+=1;}
        else if(arr[i] == "WA"){WA_c+=1;}
        else if(arr[i] == "TLE"){TLE_c+=1;}
        else if(arr[i] == "RE"){RE_c+=1;}
        
    }
    std::cout<<"AC x " << AC_c << std::endl;
    std::cout<<"WA x " << WA_c << std::endl;
    std::cout<<"TLE x " << TLE_c << std::endl;
    std::cout<<"RE x " << RE_c << std::endl;

    
}

Measured memory_bytes: 6696
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      Dice dice3a = new Dice(br.readLine().split(" "));
      Dice dice3b = new Dice(br.readLine().split(" "));
      String result = "No";

      dice3a.setFrontPosition(dice3a.getFrontSide());
      dice3b.setFrontPosition(dice3a.getFrontSide());

      for(int i=0; i<4; i++)  {
        for(int j=0; j<4; j++) {
          if( dice3a.equals(dice3b) ) {
            result = "Yes";
            break;
          }
          else dice3b.rotate("W");
        }
        if( dice3a.equals(dice3b)) break;
        dice3b.rotate("N");
      }
      System.out.println(result);
    }
  }
}

class Dice {
  private int[] side;

  public Dice( int[] ia ) {
    side = Arrays.copyOf(ia, ia.length);
  }
  public Dice( String[] s ) {
    side = new int[s.length];
    for ( int i=0; i < 6; i++)
      side[i] = Integer.parseInt(s[i]);
  }

  @Override
  public boolean equals(Object o) {
    if(o == this) return true;
    if(o == null) return false;
    if(!(o instanceof Dice)) return false;
    Dice r = (Dice) o;

    if(
      (side[0] == r.side[0]) &&
      (side[1] == r.side[1]) &&
      (side[2] == r.side[2]) &&
      (side[3] == r.side[3]) &&
      (side[4] == r.side[4]) &&
      (side[5] == r.side[5])
      ) return true;
    else return false;
  }

  public int getUpperSide() {
    return side[0];
  }
  public int getLowerSide() {
    return side[5];
  }
  public int getFrontSide() {
    return side[1];
  }
  public int getBackSide() {
    return side[4];
  }
  public int getRightSide() {
    return side[2];
  }
  public int getLeftSide() {
    return side[3];
  }

  public void setFrontPosition(int n) {
    for(int i=0; i < 3; i++){
      if(getUpperSide() != n) rotate("N");
    }
    for(int i=0; i < 3; i++){
      if(getUpperSide() != n) rotate("W");
    }
    rotate("S");
  }

  public int doRotate(String s) {
    for ( int i=0; i < s.length(); i++ ) {
      rotate(s.substring(i, i+1));
    }
    return side[0];
  }

  public void rotate(String o) {
    switch(o) {
      case "N" :
        rotateN();
        break;
      case "S" :
        rotateS();
        break;
      case "W" :
        rotateW();
        break;
      case "E":
        rotateE();
        break;
      default :
    }
  }

  private void rotateN() {
    int tmp = side[0];
    side[0] = side[1]; side[1] = side[5]; side[5] = side[4];
    side[4] = tmp;
  }
  private void rotateS() {
    int tmp = side[0];
    side[0] = side[4]; side[4] = side[5]; side[5] = side[1];
    side[1] = tmp;
  }
  private void rotateW() {
    int tmp = side[0];
    side[0] = side[2]; side[2] = side[5]; side[5] = side[3];
    side[3] = tmp;
  }
  private void rotateE() {
    int tmp = side[0];
    side[0] = side[3]; side[3] = side[5]; side[5] = side[2];
    side[2] = tmp;
  }
}


Measured memory_bytes: 24444
#include <bits/stdc++.h>
using namespace std;
int main() {
    int x, y, z, k; cin >> x >> y >> z >> k;
    vector<long long> a(x), b(y), c(z);
    for (int i = 0; i < x; i++) cin >> a[i];
    for (int i = 0; i < y; i++) cin >> b[i];
    for (int i = 0; i < z; i++) cin >> c[i];
    vector<long long> u, v;
    for (int i = 0; i < x; i++) {
        for (int j = 0; j < y; j++) {
            u.emplace_back(a[i] + b[j]);
        }
    }
    sort(u.rbegin(), u.rend());
    for (int i = 0; i < min(k, (int) u.size()); i++) {
        for (int j = 0; j < z; j++) {
            v.emplace_back(u[i] + c[j]);
        }
    }
    sort(v.rbegin(), v.rend());
    for (int i = 0; i < k; i++) {
        cout << v[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 43368
import numpy as np
a=int(input())
b=list(map(int,input().split()))
c=1
if 0 in b:
    print(0)
    exit()
else:
    for i in range(a):
        c=c*b[i]
        if c>10**18:
            print(-1)
            exit()
        else:
            continue
print(c)

Measured memory_bytes: 40208
n, m, c = map(int,input().split())
b = list (map(int,input().split()))
a = []
for i in range(n):
    A = list(map(int,input().split()))
    a.append(A)
ans = 0
for i in range(n):
    z = a[i]
    Z = 0
    for l in range(len(z)):
        Z += z[l] * b[l]
    if Z + c > 0:
        ans += 1
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
long long gcd(int a,int b)
{
	if(b==0)return a;
	else gcd(b,a%b);
}
long long lcm(int a,int b)
{
	return a/gcd(a,b)*b;
}
int main()
{
	int a,b;
	cin>>a>>b;
	cout<<lcm(a,b);
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
#include <tuple>
#include <queue>
#include <numeric>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define repi(m, itr) for (auto itr = m.begin();itr != m.end();++itr)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


// H - Grid 1
ll H, W;
vector<string> a;
const ll MOD = 1000000007;
ll dp[1100][1100];

void add(ll &a, ll b){
    a += b;
    if(a >= MOD){
        a -= MOD;
    }
}

int main(){
    cin >> H >> W;
    a.resize(H);
    rep(i, 0, H){
        cin >> a[i];
    }

    dp[0][0] = 1;
    rep(i, 0, H){
        rep(j, 0, W){
            if(i+1<H && a[i+1][j] == '.'){
                add(dp[i + 1][j], dp[i][j]);
            }
            if(j+1<W && a[i][j+1] == '.'){
                add(dp[i][j + 1], dp[i][j]);
            }
        }
    }



    cout << dp[H-1][W-1] << endl;
    return 0;
}




Measured memory_bytes: 9856
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	while (true){
		int n, num = 0, a;
		int max_v = 0, min_v = 500;
		cin >> n;
		if (n == 0)break;
		for (int i = 0; i < n; i++){
			num = 0;
			for (int i2 = 0; i2 < 5; i2++){
				cin >> a;
				num += a;
			}
			max_v = max(max_v, num);
			min_v = min(min_v, num);
		}
		cout << max_v << " " << min_v << endl;
	}
}

Measured memory_bytes: 1160
n = input()
(s,t) = n.split()
m = input()
(a,b)=m.split()
k = input()
if k == s:
    a_1 = int(a) - 1
    print(str(a_1)+' '+ b)
else:
    b_1 = int(b) -1
    print(a +' '+str( b_1))




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

static const int MAX = 1e6;
int d[MAX+1];

void eratos(int n){
    for (int i = 0; i <= n; i++){
        d[i] = i;
    }
    for (int i = 2; i * i <= n; i++) {
        if (d[i] != i) continue;
        for (int j = i + i; j <= n; j += i){
            if (d[j] != j) continue;
            d[j] = i;
        }
    }
}

int main(){
    int n;
    cin >> n;
    eratos(MAX);
    vector<int> cnt(MAX+1);
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        while (a != 1) {
            int pf = d[a];
            cnt[pf]++;
            while (a % pf == 0) a /= pf;
        }
    }
    bool nc = false;
    bool sc = false;
    for (int i = 2; i <= MAX; i++) {
        if (cnt[i] >= 2) {
            sc = true;
            if (cnt[i] == n) {
                nc = true;
            }
        }
    }
    if (nc) {
        cout << "not coprime\n";
    } else if (sc) {
        cout << "setwise coprime\n";
    } else {
        cout << "pairwise coprime\n";
    }
    return 0;
}

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

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

  int a, b, c;
  cin >> a >> b >> c;

  cout << max(0, c - (a - b)) << endl;

  return (0);
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
typedef long long lint;
using namespace std;

int n;

//エラトステネスの篩
vector<bool> eratosthenes_sieve(int n) {
    vector<bool> res(n + 1, true);
    res[0] = res[1] = false;
    for (int i = 2; i * i <= n; i++) {
        if (res[i]) {
            for (int j = i; i * j <= n; j++) res[i * j] = false;
        }
    }
    return res;
}

int main() {
    cin >> n;
    auto p = eratosthenes_sieve(55555);
    int now = 2;
    while (n > 0) {
        if (p[now] && now % 5 == 1) {
            cout << now << endl;
            n--;
        }
        now++;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int x, y, i, j;
  int hanako[101],taro[101],hsum,tsum, min = 1000, anstaro, anshanako;

  while(1){
    scanf("%d %d",&x, &y);
    hsum = 0;
    tsum = 0;
    min = 1000;
    if(x == 0 && y == 0){
      break;
    }
    tsum = 0;
    for(i = 0 ; i < x ; i++){
      scanf("%d",&taro[i]);
      tsum += taro[i];
    }
    for(i = 0 ; i < y ; i++){
      scanf("%d",&hanako[i]);
      hsum += hanako[i];
    }

    for(i = 0 ; i < x ; i++){
      for(j = 0 ; j < y ; j++){
	if(tsum - taro[i] + hanako[j] == hsum - hanako[j] + taro[i]){
	  if(taro[i]+hanako[j] < min){
	    min = taro[i] + hanako[j];
	    anstaro = taro[i];
	    anshanako = hanako[j];
	  }
	}
      }
    }
    if(min == 1000){
      printf("-1\n");
    }
    else{
      printf("%d %d\n",anstaro,anshanako);
    }
  }
  return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<std::string,int,int>;

int N;
std::vector<P> ps;

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

    std::cin >> N;

    for(int i=0;i<N;++i){
        std::string s;
        int p;
        std::cin >> s >> p;

        ps.emplace_back(s, -p, i + 1);
    }

    std::sort(ps.begin(), ps.end());

    for(auto &p : ps){
        int i;
        std::tie(std::ignore, std::ignore, i) = p;

        std::cout << i << std::endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
string s;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  int ans = 0;
  FOR(i, 0, sz(s)-1) if(s[i] != s[i+1]) ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int a[3];

  for (int i = 0; i < 3; i ++)
    std::cin >> a[i];

  std::cout << std::accumulate(a, a + 3, 0) - *std::max_element(a, a + 3) << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll n;
map<string, ll> mp;
int main() {
    cin>>n;
    REP(i, 0, n){
        string str;
        cin>>str;

        mp[str]++;
    }

    ll mx=0;
    for(auto itr:mp){
        mx=max(mx, itr.second);
    }

    vector<string> vs;
    for(auto itr:mp){
        if(mx == itr.second){
            vs.emplace_back(itr.first);
        }
    }
    sort(vs.begin(), vs.end());

    for(auto itr:vs){
        cout<<itr<<endl;
    }
    return 0;
}

Measured memory_bytes: 26868
/******************************************
 *  Author : Atul Anand   
 *  Created On : Sat Feb 08 2020
 *******************************************/

import java.io.*;
import java.util.*;

public class Main{
    
    public static void main(String[] args) throws IOException {
        String s=in.next();
        String t=in.next();

        int n1=s.length();
        int n2=t.length();
        int dp[][]=new int[n1+1][n2+1];

        for(int i=1;i<=n1;i++){
            for(int j=1;j<=n2;j++){
                if(s.charAt(i-1)==t.charAt(j-1)){
                    dp[i][j]=dp[i-1][j-1]+1;
                }
                else{
                    dp[i][j]=Math.max(dp[i-1][j], dp[i][j-1]);
                }
            }
        }
        
        int i=n1;
        int j=n2;
        StringBuilder ans=new StringBuilder();
        while(i>0 && j>0){
            // if corresponding characaters are same, add it to lcs
            if(s.charAt(i-1)==t.charAt(j-1)){
                ans.append(s.charAt(i-1));
                i--;
                j--;
            }
            else{
                // Otherwise go in the direction of larger value
                if(dp[i-1][j]>dp[i][j-1]){
                    i--;
                }
                else{
                    j--;
                }
            }
        }
        println(ans.reverse().toString());
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);
    static void read(int arr[], int N) throws IOException{ for(int i=0;i<N;i++){ arr[i]=in.nextInt(); } }
    static void read(long arr[], int N) throws IOException{ for(int i=0;i<N;i++){ arr[i]=in.nextLong(); } }
    static void read(String arr[], int N) throws IOException{ for(int i=0;i<N;i++){ arr[i]=in.next(); } }
    static void print(Object O){ out.print(O); }
    static void println(Object O){ out.println(O); }
    static void print(int arr[]){ for(int i=0;i<arr.length;i++){ print(arr[i]+" "); } println(""); }
    static void print(int arr[][]){ for(int i=0;i<arr.length;i++){ print(arr[i]); } }
    static void debug(Object O){ System.out.println(O); }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { tokenizer=new StringTokenizer(reader.readLine()); }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { return Integer.parseInt(next()); }
    double nextDouble() throws IOException { return Double.parseDouble(next()); }
    long nextLong() throws IOException { return Long.parseLong(next()); }
    String nextLine() throws IOException { return reader.readLine(); }
    void close() throws IOException { reader.close(); }
}

Measured memory_bytes: 80212
//
//  main.cpp
//  ABC
//
//  Created by Amarsanaa Davaasuren on 2019/08/31.
//  Copyright © 2019 Amarsanaa Davaasuren. All rights reserved.
//
# include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define rn return

using namespace std;
using ll = long long;

int main(){
    int N; cin >> N;
    vector<int> a(N);
    rep(i,N) cin >> a[i];
    int ans = 0;
    rep(i,N) ans += a[i] - 1;
    cout << ans;
    rn 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))
def case(L):
    result=0
    for x in a:
        result+=(x-1)//L
    return result
possible=0
impossible=max(a)
while impossible-possible>1:
    M=(impossible+possible)//2
    if case(M)>k:
        possible=M
    else:
        impossible=M
print(impossible)


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

int main()
{
	const int ABC = 1200, ARC = 2800;
	int r;
	cin >> r;
	if (r < ABC) cout << "ABC";
	else if (r >= ABC && r < ARC) cout << "ARC";
	else cout << "AGC";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m,ans=0;
  cin >> n >>m;
  int k[n],a[n][m],count[m];
  for (int i=0;i<m;i++)count[i]=0;
  for (int i=0;i<n;i++){
    cin >> k[i];
  	for (int j=0;j<k[i];j++){
     	cin >> a[i][j];
  		for(int l=0;l<m;l++)if(a[i][j]==l+1)count[l]++; 
    }
  }
  for (int i=0;i<m;i++)if(count[i]==n)ans++;
  cout << ans <<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

void Push(int);
int Pop();
int t,P[199];
int main(int argc,char *argv[]){
  int a,b;
  char p[100];
  t=0;
  while(scanf("%s",p)!=EOF){
    if(p[0]=='+'){
      a=Pop();
      b=Pop();
      Push(a+b);
    }
    else if(p[0]=='-'){
      b=Pop();
      a=Pop();
      Push(a-b);
    }
    else if(p[0]=='*'){
      a=Pop();
      b=Pop();
      Push(a*b);
    }
    else{
      Push(atoi(p));
    }
  }
  printf("%d\n",Pop());
  return 0;
}

void Push(int a){
  P[++t]=a;
}

int Pop(){
  t--;
  return P[t+1];
}



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

int main(){
  int n,k,x,y,ans = 0;
  scanf("%d%d%d%d",&n,&k,&x,&y);
  if(n-k < 0){
    ans += n * x;
  }else{
    ans += (k * x) + (n-k) * y;
  }
  printf("%d\n",ans);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define PI 3.1416

int main(){
	double x = 0.0,y = 0.0,range = 0.0;
	int a,b;
	while(1){
		scanf("%d,%d",&a,&b);
		if(!a && !b) break;
		x += a * sin(range * PI / 180.0);
		y += a * cos(range * PI / 180.0);
		range += b;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

Measured memory_bytes: 604
#include<vector>
#include<set>
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define INF (1<<30)
#define MAX_N 1000000


int main(void){
  int N, Q;
  int score[MAX_N+1], sorted_score[MAX_N];
  cin >> N >> Q;
  for(int i = 0; i < N; i++){
    cin >> score[i];
    sorted_score[i] = score[i];
  }

  sort(sorted_score, sorted_score + N);

  vector<int> leader;
  int a; string query;
  for(int i = 0; i < Q; i++){
    cin >> query >> a;
    if(query == "ADD"){
      leader.push_back(score[a-1]);
      sort(leader.begin(), leader.end());
    }else if(query == "REMOVE"){
      leader.erase(lower_bound(leader.begin(), leader.end(), score[a-1]));
    }else if(query == "CHECK"){
      int left = 0, right = INF;
      while(left != right){
        int mid = (left + right) / 2;
        int preLeaderPos = 0, numberOfIndependents = 0;
        for(int i = 0; i < leader.size(); i++){
          int pos = distance(sorted_score, lower_bound(sorted_score, sorted_score + N, leader[i] - mid));
          numberOfIndependents += max(pos - preLeaderPos, 0);
          preLeaderPos = distance(sorted_score, upper_bound(sorted_score, sorted_score + N, leader[i]));
        }
        numberOfIndependents += max(N - preLeaderPos, 0);
        if(numberOfIndependents <= a) right = mid;
        else left = mid + 1;
      }
      if(left != INF) cout << left << endl;
      else cout << "NA" << endl;
    }
  }
  return 0;
}

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

int main(){
    int n,c=0,ans;
    cin>>n;
    for (int i=0; i<3; i++){
        c = n % 10;
        n = n / 10;
        if(c == 9){
            c = 1;
        }else{
            c = 9;
        }
        ans += c * pow(10,i);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef string S;
long long n,r,i,j;S s;map<pair<S,S>,long long> a;
main() {
	cin>>n>>s;
	for(;i<1<<n;++i){
		S x,y;
		for(j=0;j<n;++j)(i>>j&1?x:y).push_back(s[j]);
		a[{x,y}]++;
	}
	while(i--){
		S x,y;
		for(j=n-1;j>=0;--j)(i>>j&1?y:x).push_back(s[n+j]);
		r+=a[{x,y}];
	}
	cout<<r;
}


Measured memory_bytes: 91904
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int INF = 1e18+7;

const int inf = 1e9;
int a[1000][1000], rui[1000][1000];
signed main(){
	int H, W, h, w;
	scanf("%lld%lld%lld%lld", &H, &W, &h, &w);
	rep(i,H)rep(j,W){
		if(i%h == 0 and j%w == 0)a[i][j] = inf-1;
		if(i%h == h-1 and j%w == w-1)a[i][j] = -inf;
	}
	if(H%h == 0 and W%w == 0){printf("No\n");return 0;}
	printf("Yes\n");
	rep(i,H){
		rep(j,W)printf("%lld%c", a[i][j], j == W-1 ? '\n' : ' ');
	}
	return 0;
}







Measured memory_bytes: 9088