akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

// const int dx[4] = { 1, 0, -1, 0 };
// const int dy[4] = { 0, 1, 0, -1 };

// const int dx[8] = {1, 1, 0,-1,-1,-1, 0, 1};
// const int dy[8] = {0, 1, 1, 1, 0,-1,-1,-1};

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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 (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}

// TODO: write
int main() {
  int n;cin>>n;
  
  int m = INF;
  ll ans = 0;
  int minus = 0;
  rep(i,n){
    int tmp;cin>>tmp;
    if(tmp < 0)minus++;
    
    tmp = abs(tmp);
    ans += tmp;
    m = min(tmp,m);
  }

  if(minus % 2)ans -= m*2;

  print(ans);
  return 0;
}



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

int main() {
    int N, M;
    cin >> N >> M;
    int A[N][M];
    int B[M];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) cin >> A[i][j];
    }
    for (int i = 0; i < M; i++) cin >> B[i];
    for (int i = 0; i < N; i++) {
        int ans = 0;
        for (int j = 0; j < M; j++) ans += A[i][j] * B[j];
        cout << ans << endl;
    }
}


Measured memory_bytes: 3156
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    static class AACOrWA
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var n = int.Parse(input[0]);
            var m = int.Parse(input[1]);
                       
            Console.WriteLine(n == m ? "Yes" : "No");
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b>=c) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}



Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

    int H, W; cin >> H >> W;
    vs S(H+1); REP(i, H) cin >> S[i];

    REP(i, H) S[i] += "#";
    S[H] = string(W + 1, '#');

    vector<vector<pii>> x(H, vector<pii>(W));
    REP(i,H){
        int l = 0;
        REP(j,W+1) {
            if (S[i][j] == '#') {
                for(int r=0; r<l; r++) {
                    x[i][j - 1 - r].second = r;
                }
                l = 0;
            } else { // '.'
                x[i][j].first = l;
                l++;
            }
        }
    }
    vector<vector<pii>> y(H, vector<pii>(W));
    REP(j,W) {
        int u = 0;
        REP(i,H+1){
            if (S[i][j] == '#') {
                for(int d=0; d<u; d++) {
                    y[i - 1 - d][j].second = d;
                }
                u = 0;
            } else {
                y[i][j].first = u;
                u++;
            }
        }
    }

    int ans = 0;
    REP(i,H){
        REP(j,W) {
            if (S[i][j] == '#') continue;

            int l = x[i][j].first, r = x[i][j].second;
            int u = y[i][j].first, d = y[i][j].second;

            ans = max(ans, l + r + u + d + 1);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 71040
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <string>
#include <string.h>
#include <math.h>
#include <iomanip>
#include <stdio.h>
using namespace std;

#define int64 long long
#define pii pair <int64, int64>
#define fr first
#define sc second
#define heap priority_queue
struct piii{
    int64 fr, sc, th;
    bool operator < (const piii &b){
        if (fr != b.fr) return fr < b.fr;
        if (sc != b.sc) return sc < b.sc;
        return th < b.th;
    }
};
///////////////////////////////////////////////
///////////////////////////////////////////////

const int64 md = 1e9 + 7;
int64 n, k, res;

int main(){
    cout << setprecision(2) << fixed;
    ios::sync_with_stdio(false), cin.tie(0);
    //freopen("input.txt", "r", stdin);
    cin >> n >> k;
    int64 s1 = 0, s2 = 0;
    for (int i = 0; i <= n; i++){
        s1 += i;
        s2 += n - i;
        if (i >= k - 1)
            res = (res + (s2 - s1 + 1) % md) % md;
    }
    cout << res;
    return 0;
}


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

long long comb(long long n,long long k)
{
  	if(n-k < k)
      k = n-k;
	long long t = 1;
	long long j = 1;
	for(long long i = n; i  >= n-k+1; i--) {
		t *= i;
		t /= j;
		j++;
	}
	return t;
}
int main(){
 	int n,a,b;
	cin >> n >> a >> b;
	
	vector<long> v(n);
	vector<long> vc(n*2);
	for(int i = 0; i < n; i++) {
		cin >> v[i];
	}
	int now=0;
	int pt=0;
	sort(v.begin(), v.end());
	vc[0] = v[0];
	vc[1] = 1;
	for(int i = 1; i < n; i++) {
		if(vc[now*2] != v[i]) {
			now++;
			vc[now*2] = v[i];
		}
		vc[now*2+1]++;
		if(i == n-a) {
			pt = now;
		}
	}

	long long t = 0;
	for(int i = n-1; i >= n-a; i--){
		t += v[i];
	}
	printf("%6f\n", (double)t/a);
	t=0;
	if(pt != now) {
      //aのみ a+1以上で必ず平均下がる
      	long used=0;
		for(int i = pt+1; i <= now; i++) {
			used += (long)vc[i*2+1];
		}
		t =  comb((long long) vc[pt*2+1],(long long) a-used);
	} else {
      //上がない(全部同じ)だからa~x<bでok
		int i = a;
		while(vc[pt*2+1] >= i && b >= i) {
 			t +=  comb((long long ) vc[pt*2+1],(long long ) i);
			i++;
		}
	}
	cout << t << endl;
	
}



Measured memory_bytes: 256
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class Read>void in(Read &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
ll n,m,ans;
int main(){
	in(n);
    if(n%2==1){
        puts("0");
        return 0;
    }
    m=5;
    while(m<=n){
        ans+=n/m/2;
        m*=5;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#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;

typedef long long int ll;
typedef long double ld;

#define llset tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define en '\n'
#define S second
#define F first
#define pll pair<ll,ll>
#define PB push_back

const ll N = 1e6+7;
ll mod = 1e9+7;
#define calncr for(int i=1  ;i<=1e6;i++) fac[i] = (fac[i-1]*i)%mod;
ll fac[N] = {0};

ll gen_base(const ll before, const ll after) {
    auto seed = std::chrono::high_resolution_clock::now().time_since_epoch().count();
    std::mt19937 mt_rand(seed);
    int base = std::uniform_int_distribution<ll>(before+1, after)(mt_rand);
    return base % 2 == 0 ? base-1 : base;
}

ll pow(ll a,ll b)
{
    if(!b)
        return 1;
    ll p = pow(a,b/2);
    if(b%2)
        return (a*((p*p)%mod))%mod;
    else
        return (p*p)%mod;
}

ll modInv(ll a)
{
    //cout<<a<<" "<<mod<<en;
    return pow(a%mod,mod-2);
}

ll nCr(ll n,ll r)
{
    return (fac[n]*modInv((fac[r]*fac[n-r])%mod))%mod;
}

ll hashf(ll r,ll x,ll mod)
{
    return (x+r)%mod;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    fac[0] = 1;
    calncr;
    ld a,b,c;
    cin>>a>>b>>c;
    cout<<(a/c<=b?"Yes":"No")<<en;
}


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

int main() {
  string s;
  cin>>s;
  string res;
  if (s.length() == 0) {cout<<res; return 0;}
  for (long long int i = 0; i < s.length(); i+=2) {
    cout<<s[i];
  }
  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>

static bool is_solved(char cube[30])
{
    for (int i = 1; i < 9; i++)
    {
        if (cube[i] != cube[0]) return false;
        if (cube[21 + i] != cube[21]) return false;
    }
    if (cube[9] != cube[10] || cube[10] != cube[11]) return false;
    if (cube[12] != cube[13] || cube[13] != cube[14]) return false;
    if (cube[15] != cube[16] || cube[16] != cube[17]) return false;
    if (cube[18] != cube[19] || cube[19] != cube[20]) return false;
    return true;
}

#define SWAP(a, b) {char temp = (a); (a) = (b); (b) = temp;}

static void flip_up(char cube[30])
{
    SWAP(cube[0], cube[27])
    SWAP(cube[1], cube[28])
    SWAP(cube[2], cube[29])
    SWAP(cube[14], cube[15])
    SWAP(cube[18], cube[20])
}

static void flip_down(char cube[30])
{
    SWAP(cube[6], cube[21])
    SWAP(cube[7], cube[22])
    SWAP(cube[8], cube[23])
    SWAP(cube[12], cube[17])
    SWAP(cube[9], cube[11])
}

static void flip_left(char cube[30])
{
    SWAP(cube[0], cube[23])
    SWAP(cube[3], cube[26])
    SWAP(cube[6], cube[29])
    SWAP(cube[9], cube[20])
    SWAP(cube[15], cube[17])
}

static void flip_right(char cube[30])
{
    SWAP(cube[2], cube[21])
    SWAP(cube[5], cube[24])
    SWAP(cube[8], cube[27])
    SWAP(cube[12], cube[14])
    SWAP(cube[11], cube[18])
}

static int min(int a, int b)
{
    return a < b ? a : b;
}

static int solve(char cube[30], int iteration)
{
    if (iteration >= 9) return 9;

    char cU[30], cD[30], cL[30], cR[30];
    memcpy(cU, cube, 30);
    memcpy(cD, cube, 30);
    memcpy(cL, cube, 30);
    memcpy(cR, cube, 30);

    flip_up(cU);
    flip_down(cD);
    flip_left(cL);
    flip_right(cR);

    if (is_solved(cU))
        return iteration;
    if (is_solved(cD))
        return iteration;
    if (is_solved(cL))
        return iteration;
    if (is_solved(cR))
        return iteration;

    int min_iteration = solve(cU, iteration + 1);
    min_iteration = min(min_iteration, solve(cD, iteration + 1));
    min_iteration = min(min_iteration, solve(cL, iteration + 1));
    min_iteration = min(min_iteration, solve(cR, iteration + 1));

    return min_iteration;
}

int main(int argc, const char *argv[])
{
    int N;
    scanf("%d", &N);

    while (N-- > 0)
    {
        char cube[30];

        for (int i = 0; i < 30; i++)
        {
            scanf("%hhd", &cube[i]);
        }

        int ans = 0;

        if (!is_solved(cube))
        {
            ans = solve(cube, 1);
        }

        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 2728
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))


n,k = readints()
a = readints()

l = 0
r = 10**10

while r-l>1:
    m = (l+r)//2
    x = [(a[i]-1)//m for i in range(n)]
    if sum(x)<=k:
        r = m
    else:
        l = m

print(r)


Measured memory_bytes: 168916
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
string to_string(ll a){
  string s="";
  while(a){
    s=(char)('0'+a%10)+s;
    a/=10;
  }
  if(s=="")s="0";
  return s;
}
int main(){
  ll n,m;
  while(cin>>n>>m,n){
    n--;
    ll t=1,tt=1;
    while(n>=9*t*tt){
      n-=t*tt*9;
      t++;
      tt*=10;
    }
    ll s=tt+n/t;
    for(n%=t;m>0;s++){
      string ss=to_string(s);
      int l=0;
      if(n)l=n;
      n=0;
      string out=ss.substr(l,m);
      m-=out.size();
      cout<<out;
    }
    cout<<endl;
  }
}

Measured memory_bytes: 2984
#include <iostream>
#include <vector>
 
using namespace std;
 
int main(int, const char**) {
    long long A, B, N;
    cin >> A >> B >> N;
    long long x = N;
    if(N>B-1){
        x=B-1;
    }
    
    long long ans = (A*x)/B-A*(x/B);
    
    cout << ans << endl;
 
    return 0;
}


Measured memory_bytes: 3556
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
import itertools #list(accumulate(A))

N = ii()
l = []

for keta in range(3, 10):
    for koho in itertools.product(['3', '5', '7'], repeat=keta):
        l.append(int(''.join(koho)))

l.sort()

ele = ['3', '5', '7']
cnt = 0
for num in l:
    if num > N:
        break
    num = str(num)
    if all(e in num for e in ele):
        cnt += 1

print(cnt)

Measured memory_bytes: 4272
#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
using namespace std;
#define int long long
typedef pair<int, int> P;

int r, c, n;
int x[100000][2], y[100000][2];

void input() {
	cin >> r >> c >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[i][0] >> y[i][0] >> x[i][1] >> y[i][1];
	}
}

int getPos(int X, int Y) {
	if (Y == 0) return X;
	if (X == r) return r + Y;
	if (Y == c) return r + c + (r - X);
	return r + c + r + (c - Y);
}

signed main() {
	int i, j;
	input();
	
	vector<P> nums;		//pos, num
	for (i = 0; i < n; i++) {
		for (j = 0; j < 2; j++) {
			if (x[i][j] == 0 || x[i][j] == r || y[i][j] == 0 || y[i][j] == c) {}
			else { break; }
		}
		if (j == 2) {
			int p = getPos(x[i][0], y[i][0]);
			int q = getPos(x[i][1], y[i][1]);
			nums.push_back(P(p, i));
			nums.push_back(P(q, i));
		}
	}
	sort(nums.begin(), nums.end());
	
	static bool exist[100000] = {false};
	stack<int> stk;

	for (i = 0; i < nums.size(); i++) {
		int v = nums[i].second;
		if (!exist[v]) {
			stk.push(v);
			exist[v] = true;
		}
		else {
			if (stk.top() != v) { cout << "NO" << endl; return 0; }
			stk.pop();
			exist[v] = false;
		}
	}
	
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 9584
n=int(input())
*a,=map(int,input().split())
length=sum(a)
for i in range(1,n):a[i]+=a[i-1]
m=10**18
for i in range(n-1):
    left=a[i]
    right=length-left
    m=min(m,abs(left-right))
print(m)

Measured memory_bytes: 26220
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
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 (a > b) { a = b; return 1; } return 0; }
const int64_t INF = 1LL << 60;

int main() {
 int64_t N,A,B,C,D,E;
 cin>>N>>A>>B>>C>>D>>E;
 int64_t a=min({A,B,C,D,E});
 cout<<(N+a-1)/a+4<<endl;
return 0;
} 

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

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define PB push_back
#define INT(n) int n;assert(0<scanf("%d",&n))

int main(){
  INT(n); INT(m);
  vector<vector<int>> gr(n + 1);
  REP(i, m){INT(a); INT(b); gr[a].PB(b); gr[b].PB(a);}
  vector<int> ans(n + 1, -1); ans[1] = 1;
  int cnt = 0;
  queue<int> qu; qu.push(1);
  while (!qu.empty()){
    int u = qu.front(); qu.pop();
    for(int v: gr[u]){
      if (ans[v] < 0){
        ans[v] = u; qu.push(v); cnt++;
      }
    }
  }
  if (cnt == n - 1){
    printf("Yes\n");
    REP(i, 2, n + 1){printf("%d\n", ans[i]);}
  } else {
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 10216
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

/////////////////////////////////////

int main() {
	ll N;
	cin >> N;
	vll L(N + 1);
	repn(i, N)cin >> L[i];
	
	ll ans = 0;
	repn(i, N)for (ll j = i + 1; j <= N; j++)for (ll k = j + 1; k <= N; k++) {
		if (L[i] != L[j] && L[j] != L[k] && L[k] != L[i]) {
			if (L[i] + L[j] > L[k] && L[j] + L[k] > L[i] && L[k] + L[i] > L[j]) {
				ans++;
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>
using namespace std;
long n,i,j,t,s,a[10000];
int main()
{
    int k,x,y;
    char op;
    cin>>x>>op>>y;
    if(op=='+')
    cout<<x+y;
    else
    {
        cout<<x-y;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

ll gcd(ll a, ll b) {
    if (a<b) swap(a, b);
    while(b!=0) {
        ll t = a;
        a = b;
        b = t%b;
    }
    return a;
}

ll lcm(ll a, ll b) { return a/gcd(a, b)*b; }

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

int const H = 81;
int const W = 81;
bool dp[H][W][(H+W)*H];

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

    ll n, k; cin >> n >> k;
    vector<ll> v(n);
    rep(i, n) cin >> v[i];

    ll ans = 0;
    rep(l, n) repr(r, l-1, n) {
        // 左から [0, l), 右から (r, n-1] まで取る
        if (l+ n-1-r > k) continue;
        int tmpk = k;
        tmpk -= (l + n-1-r);
        priority_queue<ll, vector<ll>, greater<ll>> pq; ll tmp = 0;
        rep(i, l) {
            tmp += v[i];
            if (v[i]<0) pq.push(v[i]);
        }
        repr(i, r+1, n) {
            tmp += v[i];
            if (v[i]<0) pq.push(v[i]);
        }
        while(tmpk>0 && pq.size()) {
            tmp += -pq.top(); pq.pop(); --tmpk;
        }
        chmax(ans, tmp);
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SpeeD ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ll long long
//pair<int, int> *p=new pair<int, int>[n];
//std::vector<pair<int,int>> vp;
//v.push_back(make_pair(x,y))
//pair<int, int> p[1000001];
//string *s=new string [n];
//int freq[e];
//freq[a[i]-'a']++; freq[a[i]]++;
 using namespace std;  
ll n,t,c,m,sum,x,y,mx,mn,avg;
map<ll,ll>mp ;
int cum[100002];
bool isPrime(int x)
{
for (int i=2;i*i<=x;i++)
if (x%i==0)
return false;
return true;
}
int main(void) 
{ 
   SpeeD;
cin>>t>>n;
ll k = t*n;
if (t== 1 || n==1){cout<<1; return 0;}
if (k&1)cout<<k/2 + 1;
else cout<<k/2;
}
    

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args) { 
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			boolean isPrime[] = new boolean[n+1];
			for(int i=0;i<=n;i++)
				isPrime[i]=true;
			isPrime[1]=false;
			for(int p=2;p<=n;p++)
				if(isPrime[p])
					for(int j=p+p;j<=n;j+=p)
						isPrime[j]=false;
			int cnt = 0;
			for(int i=2;i<=n;i++)
				if(isPrime[i])
					cnt++;
			System.out.println(cnt);
		}
	}
}

Measured memory_bytes: 36132
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt(); 
    String s = sc.next();
    int len = s.length();
    if(len <= k){
      System.out.println(s);
    }else{
    char[] a = s.toCharArray();
    for(int i = 0;i < k;i++){
      System.out.print(a[i]);
    }
    System.out.print("...");
    }
  }
}

Measured memory_bytes: 35616
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int H[100000];

int main()
{
	int N;
	bool ans = true;

	cin >> N;
	rep(i, N) cin >> H[i];

	rep(i, N) {
		if (i == 0) H[i]--;
		else {
			if (H[i - 1] > H[i]) ans = false;
			else if (H[i - 1] < H[i]) H[i]--;
		}
	}

	cout << (ans ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long m,n,i,j,k,x,y,z,a[100000],p=-10,q=1000000,cnt=0;
    cin>>n;
    for(i=1;i<=9;i++)
    {
        if(n%i==0)
        {
            p=i;
            q=n/i;
            if(q<=9)
            {
                cnt=1;
                break;
            }
        }
    }
    if(cnt==1)
    {
        cout<<"Yes"<<endl;

    }

    else
        cout<<"No"<<endl;

}



Measured memory_bytes: 3644
D,G=map(int,input().split())
p=[]
c=[]
for _ in range(D):
    P,C=map(int,input().split())
    p.append(P)
    c.append(C)

point=[0]*2**D
num=[0]*2**D

for i in range(2**D):
    b=bin(i)[2:].zfill(D)
    for j in range(D):
        num[i]+=int(b[D-j-1])*p[j]
        point[i]+=int(b[D-j-1])*(100*(j+1)*p[j]+c[j])
        if b[D-j-1]=="0":
            rest=j #足りない時は100(rest+1)点の問題を解く
    k=0
    while point[i]<G and k<p[rest]:
#        print(k,point[i])
        point[i]+=100*(rest+1)
        num[i]+=1
        k+=1
    if point[i]<G:
        num[i]+=1000
#    print(b,rest,point[i],num[i])
print(min(num))

Measured memory_bytes: 3064
n, m = map(int, input().split())
parent = [i + 1 for i in range(n)]
rank = [0 for i in range(n)]

def find(x):
    if parent[x - 1] == x:
        return x
    else:
        parent[x - 1] = find(parent[x - 1])
        return parent[x - 1]

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    if rank[x - 1] < rank[y - 1]:
        parent[x - 1] = y
    else:
        parent[y - 1] = x
        if rank[x - 1] == rank[y - 1]:
            rank[x - 1] += 1

for i in range(m):
    a, b = map(int, input().split())
    unite(a, b)
s = set()
for i in range(n):
    s.add(find(i + 1))
print(len(s) - 1)

Measured memory_bytes: 21692
#include<stdio.h>

int main(void)
{
	int card[4][14];
	int n,i,j,right,d;
	char b;
	for(i=0;i<4;i++)
	{
		for(j=0;j<14;j++)
		{
			card[i][j] = 0;
		}
	}
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf(" %c %d",&b,&right);
		if(b=='S')
		{
			card[0][right]=1;
		}
		else if(b=='H')
		{
			card[1][right]=1;
		}
		else if(b=='C')
		{
			card[2][right]=1;
		}
		else if(b =='D')
		{
			card[3][right]=1;
		}
	}
	for(i=0;i<4;i++)
	{
		for(j=1;j<14;j++)
		{
			if(card[i][j]==0)
			{
				if(i==0)
				{
					printf("S");
				}
				else if(i==1)
				{
					printf("H");
				}
				else if(i==2)
				{
					printf("C");
				}
				else if(i==3)
				{
					printf("D");
				}
				printf(" %d\n",j);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

public class Main {
	
	public static void main(String args[]) {
		
		Scanner in = new Scanner(System.in);

		char[] s = in.next().toCharArray();
		char[] t = in.next().toCharArray();
		
		LCS(s,t);
	}
		
	private static void LCS(char[] s, char[] t) {
		// TODO Auto-generated method stub
		int ns = s.length;
		int nt = t.length;
		
		int[][] dp = new int[ns+1][nt+1];
		
		for(int i=0;i<=ns;i++) {
			for(int j=0;j<=nt;j++) {
				if(i==0 || j==0) dp[i][j]=0;
				else if(s[i-1]==t[j-1]) dp[i][j] = 1+dp[i-1][j-1];
				else {
					dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]);
				}
			}
		}
		printSubArr(s,t,dp,ns,nt);
		System.out.print(" ");
//		System.out.println(dp[ns][nt]);
	}
	private static void printSubArr(char[] s, char[] t, int[][] dp, int i, int j) {
		if(i==0 || j==0) return;
		else if(s[i-1]==t[j-1]) {
			 printSubArr(s, t, dp, i-1, j-1);
			 System.out.print(s[i-1]);
		}
		else if(dp[i-1][j]>dp[i][j-1])  printSubArr(s, t, dp, i-1, j);
		else  printSubArr(s, t, dp, i, j-1);
	}

	private static void getProb(double[] p, int n) {
		double[][] dp = new double[n+1][n+1];
		dp[0][0]=1;
		
		for(int i=1;i<=n;i++) {
			for(int j=0;j<=i;j++) {
				if(j==0) dp[i][j] = dp[i-1][j]*(1-p[i-1]);
				else {
					dp[i][j] = dp[i-1][j-1]*p[i-1] + dp[i-1][j]*(1-p[i-1]);
				}
			}
				
		}
//		print2d(dp);
		double ans=0;
		for(int i=(n+1)/2 ; i<=n;i++) {
			ans+=dp[n][i];
		}
		System.out.println(ans);
		
	}

	public static void print2d(double[][] arr) {
		for(int i=0;i<arr.length;i++) {
			for(int j=0;j<arr[i].length;j++) {
				System.out.print(arr[i][j]+ " ");
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 82248
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
    char a;
    cin>>a;
    if(a=='A')
        cout<<"T";
    else if(a=='T')
        cout<<"A";
    else if(a=='C')
        cout<<"G";
    else if(a=='G')
        cout<<"C";
    return 0;
}


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

int main () {
  int N;
  cin >> N;
  vector <int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  int answer = 0, now = 0;
  for(int i = 0; i < N; i++){
    if(A.at(i) == now + 1){
      answer++;
      now++;
    }
  }

  if(answer == 0){
    cout << -1 << endl;
  }
  
  else{
    cout << N - answer << endl;
  }

}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>

int main()
{long int A,B,K;
scanf("%ld %ld",&A,&B);
    if((A%2!=0 && B%2==0)||(A%2==0 && B%2!=0))
{
     printf("IMPOSSIBLE\n");
}
else
{K=((A+B)/2);
   printf("%ld\n",K);
}

    return 0;
}


Measured memory_bytes: 128
#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    X = int(input())

    cnt = 0
    tmp = 100
    while True:
        cnt += 1
        tmp = int(tmp * 1.01)
        if tmp >=X :
            break
    print(cnt)

if __name__ == '__main__':
    main()

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

int main(){
    int n,q;
    cin >> n >> q;

    vector<vector<int>> to(n);
    vector<int> add(n,0);
    vector<int> res(n,0);
    vector<int> visited(n,0);
    rep(i,n-1){
        int a,b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    rep(i,q){
        int p;
        cin >> p;
        p--;
        int x;
        cin >> x;
        add[p]+=x;
    }

    stack<P> s;
    P p(0,0);
    s.push(p);
    while(!s.empty()){
        P p;
        p = s.top();
        s.pop();
        //cout << "v" << p.first << "add" << p.second << endl;
        visited[p.first]=1;
        res[p.first]+=p.second;
        res[p.first]+=add[p.first];

        rep(i,to[p.first].size()){
            P q;
            q.first = to[p.first][i];
            q.second = res[p.first];
            if(visited[q.first]==0) s.push(q);
        }
    }

    /*
    cout << "add" << endl;
    rep(i,add.size()) cout << add[i] << " ";
    cout << endl;
    */

    rep(i,res.size()) cout << res[i] << " ";
    cout << endl;
    
}

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

int main() {
  	vector<long> a(3);
  	cin >> a[0] >> a[1] >> a[2];
  	sort(a.begin(),a.end());
  	if(a[0] %2 != 0 && a[1] %2 != 0 && a[2] %2 != 0)
      	cout << a[0]*a[1] <<endl;
  	else
      	cout << 0 << endl;
  
}


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

namespace competitive_programming
{
    class Program
    {
        static void Main(string[] args)
        {
            var main = new Program();
            main.solve();
        }

        void solve()
        {
            long[] input = Console.ReadLine().Split(' ').Select(n => long.Parse(n)).ToArray();

            long count = 1;
            long num = input[0];
            while(num * 2 <= input[1])
            {
                num = num * 2;
                count++;
            }
            Console.WriteLine(count);
        }
    }

    struct Vector2
    {
        public Vector2(int x,int y)
        {
            this.x = x;
            this.y = y;
        }
        public int x;
        public int y;
    }

    struct Vector3
    {
        public int x;
        public int y;
        public int z;
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;cin >> n >> m;
  string s;cin >> s;
  int cnt=0;
  for(int i=0;i<n+1;i++){
    if(s[i]=='1'){
      cnt++;
    }
    else{
      cnt=0;
    }
    if(cnt>=m){
      cout << -1 << endl;
      return 0;
    }
  }
  reverse(s.begin(),s.end());
  int t=0;
  vector<int> ans;
  int r=0;
  while(t<n){
    int num=t;
    for(int i=num+1;i<=num+m;i++){
      if(s[i]=='0'){
        t=i;
      }
    }
    ans.push_back(t-num);
  }
  for(int i=ans.size()-1;i>=0;i--){
    cout << ans[i] << " ";
  }
  cout << endl;
}

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

typedef long long ll;

ll T;
ll N;
vector<ll> A;
string S;
vector<ll> M;

void join(ll a) {
  for (ll i = 0; i < M.size(); ++i) {
    if ((M[i] ^ a) < a) a ^= M[i];
  }
  if (a != 0) {
    M.push_back(a);
    sort(M.begin(), M.end(), greater<ll>());
  }
}
bool check(ll a) {
  for (ll i = 0; i < M.size(); ++i) {
    if ((M[i] ^ a) < a) a ^= M[i];
  }
  return a == 0;
}
ll solve() {
  M.clear();
  for (ll i = N - 1; i >= 0; --i) {
    if (S[i] == '0') {
      join(A[i]);
    } else {
      if (!check(A[i])) return 1;
    }
  }
  return 0;
}
int main() {
  cin >> T;
  for (ll t = 0; t < T; ++t) {
    cin >> N;
    A.resize(N);
    for (ll i = 0; i < N; ++i) cin >> A[i];
    cin >> S;
    cout << solve() << endl;
  }
  return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
#define int ll
ll n, m, k;

signed main()
{
    ll n, m;
    cin >> m >> k;
    if (k == 0)
    {
        for (int i = 0; i < (1 << m); i++)
        {
            cout << i << " " << i << " ";
        }
        return 0;
    }
    n = (1 << m) - 1;
    if (k > n)
    {
        cout << "-1";
        return 0;
    }
    ll r = 0;
    for (int i = 0; i <= n; i++)
    {
        if (i != k)
            r = (r ^ i);
    }
    if (r != k)
    {
        cout << -1;
        return 0;
    }
    cout << k << " ";
    for (int i = 0; i <= n; i++)
    {
        if (i != k)
            cout << i << " ";
    }
    cout << k << " ";
    for (int i = n; i >= 0; i--)
    {
        if (i != k)
        {
            cout << i << " ";
        }
    }
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdint>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <cassert>

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

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

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

template <LL MOD=1000000007> class MODLL {
public:
  LL x;
  MODLL(const LL _x) : x(_x % MOD) {};
  MODLL operator+(const MODLL rhs) const { return MODLL(*this) += rhs; }
  MODLL operator-(const MODLL rhs) const { return MODLL(*this) -= rhs; }
  MODLL operator*(const MODLL rhs) const { return MODLL(*this) *= rhs; }
  MODLL operator/(const MODLL rhs) const { return MODLL(*this) /= rhs; }
  MODLL& operator+=(const MODLL rhs) { x += rhs.x; x %= MOD; return *this; }
  MODLL& operator-=(const MODLL rhs) { x -= rhs.x; x %= MOD; if(x<0) x += MOD; return *this; }
  MODLL& operator*=(const MODLL rhs) { x *= rhs.x; x %= MOD; return *this; }
  MODLL inv() const {
    if(x == 0) { throw "does not have inverse"; }
    LL a = x, b = MOD, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b; swap(a, b);
      u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return MODLL(u);
  }
  MODLL& operator/=(const MODLL rhs) { (*this) *= rhs.inv(); return *this; }
  MODLL pow(ULL n) const {
    MODLL res = 1;
    MODLL a = x;
    while (n > 0) {
      if (n & 1) res *= a;
      a = a * a;
      n >>= 1;
    }
    return res;
  }
};

typedef MODLL<> ML;

void test() {
  {
    ML x = 3;
    assert(x.pow(45).x == 644897553);
  }
  {
    for(int i=1; i<13; i++) {
      MODLL<13> x = i;
      assert( (x.inv().x * i) % 13 == 1 );
    }
  }
}


int main() {
  LL L;
  cin >> L;
  int l = 0; // bit length of l
  for( int i=0; i<21; i++) {
    if( (L >> i) == 0 ) { l = i; break; }
  }

  std::vector< std::tuple<int,int,int> > edges;
  //make back bones
  // 0 - 1 - ... - (l-1)
  for( int i=1; i<l; i++) {
    edges.push_back(std::make_tuple(i, i - 1, 0));
    edges.push_back(std::make_tuple(i, i - 1, 1<<(i-1)) );
  }
  // make branch
  // L - 2^{l-1}
  int bits = L - (1<<(l-1));  // upper most bit is deleted
  int w = L; // remaining weight
  for(int i=0; i<21; i++) {
    if( bits & (1<<i) ) {
      w = w - (1<<i);
      edges.push_back(std::make_tuple(l-1, i, w));
    }
  }

  std::cout << l << ' ' << edges.size() << std::endl;
  for( auto t : edges ) {
    std::cout << l - std::get<0>(t) << ' ' << l - std::get<1>(t) << ' ' << std::get<2>(t) << std::endl;
  }

  return 0;
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}

	l, r := make([]int, n), make([]int, n)
	l[0] = a[0]
	r[n-1] = a[n-1]
	for i := 0; i < n-1; i++ {
		l[i+1] = gcd(l[i], a[i+1])
		r[n-1-i-1] = gcd(r[n-1-i], a[n-1-i-1])
	}

	ans := 0
	for i := 0; i < n; i++ {
		var g int
		if i == 0 {
			g = r[i+1]
		} else if i == n-1 {
			g = l[i-1]
		} else {
			g = gcd(l[i-1], r[i+1])
		}
		if ans < g {
			ans = g
		}
	}
	fmt.Println(ans)
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

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

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int N,M;
int a[100001];
int p[100001];
int cnt[100001];
int main(){
	cin>>N>>M;
	rep(i,N){
		int x;
		cin>>x;
		cnt[x]++;
	}
	rep1(i,100000){
		a[i%M]+=cnt[i];
		p[i%M]+=cnt[i]/2;
	}
	int ans=0;
	rep(i,M){
		if(i+i==M||i==0){
			ans+=a[i]/2;
		}else if(i+i<M){
			int x=min(a[i],a[M-i]);
			ans+=x;
			if(a[i]>x){
				ans+=min(p[i],(a[i]-x)/2);
			}
			if(a[M-i]>x){
				ans+=min(p[M-i],(a[M-i]-x)/2);
			}
		}else{
			break;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)

const int inf=1000000007;
const int MOD=1000000007;
const long long INF=1000000000000000007;



int main() {
  int a, b, c;
  cin >> a >> b >> c;

  int rest = a - b;
  cout << max(0, c - rest) << endl;
}


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

int main() {
	cin.tie(0)->sync_with_stdio(false);

	ll n, k; cin >> n >> k;
	vector<ll> a(n);
	REP(i, n) cin >> a[i];
	for (int i = k; i < n; i++) {
		if (a[i - k] < a[i]) cout << "Yes" << '\n';
		else cout << "No" << '\n';
	}
	return 0;
}

Measured memory_bytes: 4796
N = int(input())
G = {}
for _ in range(N):
    s = "".join(sorted(list(input())))
    if s not in G:
        G[s] = 0
    G[s] += 1
cnt = 0
for s in G:
    if G[s]>1:
        cnt += (G[s]*(G[s]-1))//2
print(cnt)

Measured memory_bytes: 17936
n, x = map(int,input().split())

if n % 2 == 0 and n//2 == x:
    print(3 * x)
    exit()

if x > n // 2:
    x = n - x

xx = x
yy = n - x


ans = n
i = 0

while True:
    
    if yy >= xx:
        ans += 2 * (yy // xx) * xx
        yy %= xx

        if yy == 0:
            ans -= xx
            break

        if yy < xx:
            tmp = xx
            xx = yy
            yy = tmp

print(ans)

Measured memory_bytes: 43120
#include<bits/stdc++.h>
#include <ext/rope>

#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(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

#define count_one(a) __builtin_popcount(a)  // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i)    __builtin_parity(i)  //even parity 0 and odd parity 1
#define blz(a)       __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a)       __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b)     __gcd(a,b)
#define lcm(a,b)     (a*(b/gcd(a,b)))

#define pb   push_back
#define PI   M_PI
#define endl "\n"
#define sc   scanf
#define pf   printf

#define ll  long long
#define ull unsigned long long

#define W(t)            while(t--)
#define rep1(i,n)       for(int i = 0; i < n; i++)
#define rep2(a,b)       for(int i = a; i <= b; i++)
#define rep3(a,b,c)     for(int i = a; i <= b; i+=c)
#define irep(a,b,c)     for(int i = b; i >=a; i-=c)
#define repit(it,type)  for(it = type.begin(); it != type.end(); it++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
using namespace __gnu_cxx;

int main()
{
     IOS
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s;

    cin>>s;

    for(int i = 0; i < 3; i++)
     cout<<s[i];

     return 0;
}



Measured memory_bytes: 3640
# -*- coding: utf-8 -*-
import copy

class Node():
    def __init__(self, index):
        self.index = index
        self.connect = []
        self.michi = None
    
    def add_edge(self, node):
        self.connect.append(node)
    
    def show_connect_node_index(self):
        return [node.index for node in self.connect]
    
    def add_michisirube(self, index):
        self.michi = index


N, M = map(int, input().split())
node_list = [Node(i) for i in range(1,N+1)]

for m in range(M):
    A_m, B_m = map(int, input().split())
    node_list[A_m-1].add_edge(node_list[B_m-1])
    node_list[B_m-1].add_edge(node_list[A_m-1])

# 道標追加。Node 1から順に
tansaku_node = [node_list[0]]
while tansaku_node != []:
    new_tansaku_node = []
    for node in tansaku_node:
        for child_node in node.connect:
            if child_node.michi == None:
                child_node.michi = node.index
                new_tansaku_node.append(child_node)
    tansaku_node = new_tansaku_node

print('Yes')
for n in range(1,N):
    print(node_list[n].michi)

Measured memory_bytes: 40688
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

int a[100];

int main(void) {
	int n;
	int max = 0;
	for (int i = 0; i < 100; i++)a[i] = 0;

	while (scanf("%d", &n) != EOF) {
		a[n]++;
	}

	for (int i = 0; i < 100; i++) {
		if (a[i] > max)max = a[i];
	}
	for (int i = 0; i < 100; i++) {
		if (a[i] == max) printf("%d\n", i);
	}
	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
using namespace std;
 
int main(){
           char chr;
           cin >> chr;
          if(chr == 'a' || chr == 'i' || chr == 'u' || chr == 'o' || chr == 'e'){
              cout << "vowel" << endl;
}
         else{
              cout << "consonant" << endl;
}
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N;
    cin >> N;
    N = N%10;
    switch (N)
    {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
        pr("hon");
        break;
    
    case 0:
    case 1:
    case 6:
    case 8:
        pr("pon");
        break;

    case 3:
        pr("bon");
        break;
    }
}

Measured memory_bytes: 3592