akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <set>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <cmath>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>
#include <cassert>
#include <chrono>
#include <memory>

using namespace std;

#define int long long
//region TEMPLATE
#define double long double
typedef long long ll;
typedef unsigned long long ull;

template<typename T>
void __read(T &a) { cin >> a; }

template<typename T, typename ... Args>
void __read(T &a, Args &... args) {
    cin >> a;
    __read(args...);
}

#define make(t, ...) t __VA_ARGS__; __read(__VA_ARGS__)
#define makev(a, n) VI a(n); FOR(n) cin >> a[i];
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define FORE(i, l, r) for(int i = (l); i < (r); i++)
#define NFOR(i, n) for(int i = (((int) n)-1); i >= 0; i--)
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PPII;
constexpr ll M7 = 1000000007ll;
constexpr ll M9 = 1000000009ll;
constexpr ll MFFT = 998244353ll;
template<class T>
void outv(T &a) { for (auto &x : a) cout << x << ' '; }
static mt19937 rnd(static_cast<unsigned>(chrono::steady_clock::now().time_since_epoch().count())); // NOLINT(cert-err58-cpp)
template<class T>
static auto __super_speed__ = (ios_base::sync_with_stdio(0), cin.tie(
        0)); // NOLINT(cert-err58-cpp,cppcoreguidelines-interfaces-global-init)
//endregion


int32_t main() {
    make(char, c);
    cout << ++c;
    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 drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
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 const INF = 1001001001;


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

int N, M;
cin >> N >> M;
vi sx(N), sy(N), cx(M), cy(M);
rep(i,N) cin >> sx[i] >> sy[i];
rep(j,M) cin >> cx[j] >> cy[j];

rep(i,N) {
    int cur = 1<<30;
    int pres = -1;
    rep(j,M) {
        // chminを「最小値を更新したら」bool値を返す設定が生きる
        if(chmin(cur, abs(sx[i]-cx[j]) + abs(sy[i]-cy[j]))) pres = j;
    }
    cout << pres+1 << endl;
}
return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;

struct UnionFind{
  /*データメンバ*/
  vector<int> par; //par[i]:iの親の番号。
  /*コンストラクタ。独自の初期化処理などを行いたいときにコンストラクタを使う。引数の数を変えることで複数のコンストラクタを定義可能。*/
  UnionFind(int N) : par(N) {/*:の後ろに記述されたデータメンバの初期化を行う。*/
    rep(i,N)par[i]=i;
  }

  int root(int x){
    if(par[x]==x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y){//unite trees
    int rx = root(x);
    int ry = root(y);
    if(rx == ry) return;
    par[rx] = ry;
  }

  bool same(int x, int y){
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

int main(){
  int N,M; cin>>N>>M;
  vector<int> P(N); rep(i,N)cin>>P.at(i);
  UnionFind tree(N+1);
  rep(i,M){
    int x,y; cin>>x>>y;
    tree.unite(x,y);
  }
  ll res = 0;
  rep(i,N){
    if(P.at(i)==i+1)res++;
    else if(tree.same(P.at(i),i+1))res++;
  }
  cout<<res<<endl;
}


Measured memory_bytes: 1024
n = int(input())

dic = {}
ma = 1

for i in range(n):
    wo = input()
    if(wo in dic):
        dic[wo] += 1
        if(dic[wo] > ma):
            ma = dic[wo]
    else:
        dic.update({wo:1})


ans = []
for i in dic.keys():
    if(dic[i] == ma):
        ans.append(i)
ans.sort()
for j in ans:
    print(j)


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

int main() {
	int N, a, b, c, d;
  	cin >> N;
  
  	a = N / 1000;
  	b = (N - a * 1000) / 100;
  	c = (N - a * 1000 - b * 100) / 10;
  	d = (N - a * 1000 - b * 100 - c * 10);
  
	if ((b == c) && (a == b || c == d)) {
		cout << "Yes";
    } else {
      cout << "No";
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

inline int read() {
    int x = 0, f = 1;
    char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while('0' <= c && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}

int n, m, q, a[52], b[52], c[52], d[52];

int A[11], ans;

int check() {
    int res = 0;
    for(int i = 1; i <= q; ++i) {
        if(A[b[i]] - A[a[i]] == c[i]) res += d[i];
    }
    return res;
}

void dfs(int x, int low) {
    if(x == n + 1) {
        ans = max(ans, check());
        return;
    }
    for(int i = low; i <= m; ++i) {
        A[x] = i;
        dfs(x + 1, i);
    }
}

int main() {
    n = read(); m = read(); q = read();
    for(int i = 1; i <= q; ++i) {
        a[i] = read(); b[i] = read();
        c[i] = read(); d[i] = read();
    }
    dfs(1, 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "damage", long, "cost");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto s = sread();
    foreach (_; iota(s.length))
    {
        write('x');
    }
    writeln();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 256
/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
   public static void main(String args[])
   {
       Scanner sc=new Scanner(System.in);
       int n=sc.nextInt();
       int a[]=new int[n];
       for(int i=0;i<n;i++)a[i]=sc.nextInt();
       int dp[]=new int[n];
       dp[0]=0;
       dp[1]=Math.abs(a[1]-a[0]);
       for(int i=2;i<n;i++)
       {
           dp[i]=Math.min(dp[i-1]+Math.abs(a[i]-a[i-1]),dp[i-2]+Math.abs(a[i]-a[i-2]));
       }
       System.out.println(dp[n-1]);
       }
       
   }

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

int main() {
  int p = 0, p0 = 0;
  string a;
  char o[11];
  cin >> a;
  while (a[p] != 0) {
    if (a[p] == '1') {
      o[p0] = '1';
      p0++;
    } else if (a[p] == '0') {
      o[p0] = '0';
      p0++;
    } else if (a[p] == 'B') {
      if (p0) {
        p0--;
        o[p0] = '\0';
      }
    }
    p++;
  }
  o[p0] = '\0';
  cout << o;
  return 0;
}

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

int main(void){
    ll N,T;
    cin>>N>>T;
    vector<ll> t(N);
    for (int i=0;i<N;i++) cin>>t[i];

    ll ans = 0;
    ll cont = 0;
    int start = 0;
    

    for (int i=1;i<N;i++) {
        if (t[i]-t[i-1] > T) {
            ans += t[i-1] - t[start] + T;
            start = i;
        }
    }
    ans += t[N-1] - t[start] + T;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
import numpy as np
import sys
 
def main():
    sin = sys.stdin.buffer
    H, W = map(int, sin.readline().split())
    grid = np.frombuffer(sin.read(H * (W + 1)), dtype="B") == ord(".")
    grid = grid.reshape((H, W + 1))[:, :-1]
 
    L = np.empty((H, W), dtype="i4")
    R = np.empty((H, W), dtype="i4")
    T = np.empty((H, W), dtype="i4")
    B = np.empty((H, W), dtype="i4")
 
    T[0] = grid[0]
    for i in range(1, H):
        T[i] = (T[i - 1] + 1) * grid[i]
 
    B[-1] = grid[-1]
    for i in range(H - 2, -1, -1):
        B[i] = (B[i + 1] + 1) * grid[i]
 
    L[:, 0] = grid[:, 0]
    for i in range(1, W):
        L[:, i] = (L[:, i - 1] + 1) * grid[:, i]
 
    R[:, -1] = grid[:, -1]
    for i in range(W - 2, -1, -1):
        R[:, i] = (R[:, i + 1] + 1) * grid[:, i]
 
    ans = (T + B + L + R - 3).max()
    print(ans)
 
main()

Measured memory_bytes: 109952
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  vector<int> v(3);
  rep (i, 3) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  P(v[0] + v[1]);

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
const int MOD=1e9+7;
const int INF=1e15;

signed main(){
    int H,W;cin>>H>>W;
    char A[H][W];
    REP(i,H){
        REP(j,W){
            cin>>A[i][j];
        }
    }
    vector<vector<int>>ls(H,vector<int>(W,0));
 	vector<vector<int>>rs(H,vector<int>(W,0));
 	vector<vector<int>>us(H,vector<int>(W,0));
  	vector<vector<int>>ss(H,vector<int>(W,0));
    REP(i,H){
        REP(j,W){
            if(j==0&&A[i][0]=='.')ls[i][0]=1;
            else{
                if(A[i][j]=='#')ls[i][j]=0;
                else ls[i][j]=ls[i][j-1]+1;
            }
        }
    }
  	REP(i,H){
      	REP(j,W){
          	if(j==0&&A[i][W-1]=='.')rs[i][W-1]=1;
            else{
                if(A[i][W-1-j]=='#')rs[i][W-1-j]=0;
                else rs[i][W-1-j]=rs[i][W-j]+1;
            }
        }
    }
    REP(j,W){
        REP(i,H){
            if(i==0&&A[0][j]=='.')us[0][j]=1;
            else{
                if(A[i][j]=='#')us[i][j]=0;
                else us[i][j]=us[i-1][j]+1;
            }
        }
    }
  	REP(j,W){
      	REP(i,H){
            if(i==0&&A[H-1][j]=='.')ss[H-1][j]=1;
            else{
                if(A[H-1-i][j]=='#')ss[H-1-i][j]=0;
                else ss[H-1-i][j]=ss[H-i][j]+1;
            }
        }
    }
    int ans=0;
    REP(i,H){
        REP(j,W) ans=max(ls[i][j]+rs[i][j]+us[i][j]+ss[i][j]-3,ans);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 129536
#include<bits/stdc++.h>
using namespace std;
#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define lrp(i,n) for(long long i=0;i<n;i++)
#define lrep(i,m,n) for(long long i=m;i<=n;i++)
#define ll long long
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define abs(a,b) (a-b>0?a-b:b-a)

int main(){
    string a,b,c;
    cin >> a >> b >> c;
    char dif='A'-'a';
    char A=a.at(0)+dif;
    char B=b.at(0)+dif;
    char C=c.at(0)+dif;

    cout << A << B << C << endl;
    return 0;
}








Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
void Tgenerate(string W,int Ws,int T[]){
	T[0]=-1,T[1]=0;
	int i=2,j=0;//iはTの中で現在計算している位置、jは現在見ているサブ文字列の次の文字のindex
	while(i<Ws+1){
		if(W[i-1]==W[j]){
			T[i]=j+1;
			i++;
			j++;
		}
		else if(j>0) j=T[j];
		else{
			T[i]=0;
			i++;
		}
	}
}
int bubunmax(string S,int Ss,string W,int Ws){//KMP法
	int T[Ws+1]={};//部分マッチテーブル
	int ansmax=0;
	Tgenerate(W,Ws,T);
	int m=0;//S内の現在照合中の開始位置
	int i=0;//W内の現在位置
	while(m+i<Ss){
		if(W[i]==S[m+i]){
			i++;
			ansmax=max(i,ansmax);
			if(i==Ws) return m;
		}
		else{
			m=m+i-T[i];
			if(i>0) i=T[i];
		}
	}
	return ansmax;
}
int main(){
	string s,t;
	string skari;
	string s2,s3,t2,t3;
	scan(s>>t);
	skari=s;
	t2=t,t3=t;
	while(skari.size()<2*t.size()) skari+=skari;
	s2=skari+skari;
	s3=s2+skari;
	while(t2.size()<s2.size()) t2+=t2;
	while(t3.size()<s3.size()) t3+=t3;
	int s2s=s2.size(),s3s=s3.size(),t2s=t2.size(),t3s=t3.size();
	int bubunmax2=bubunmax(s2,s2s,t2,t2s),bubunmax3=bubunmax(s3,s3s,t3,t3s);
	if(bubunmax2==bubunmax3){
		prin(bubunmax2/t.size());
	}
	else{
		prin(-1);
	}
	return 0;
}


Measured memory_bytes: 71500
/* 

*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <bitset>
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define LSOne(S) (S & (-S))
#define EPS 1e-9
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pd;
typedef tree<pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;

const int MOD = 1e9+7;
const int MAXN = 1e5+5;
vector<int> graph[MAXN];
ll dp[MAXN][2]; // {black, white}
int n;

void DFS(int curr, int par)
{
    dp[curr][0] = dp[curr][1] = 1;

    for(auto& neighbor : graph[curr])
    {
        if(neighbor == par) continue;
        DFS(neighbor, curr);
        (dp[curr][0] *= dp[neighbor][1]) %= MOD;
        (dp[curr][1] *= (dp[neighbor][0] + dp[neighbor][1]) % MOD) %= MOD;
    }
}

int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0); // BEFORE SUBMIT DON'T FORGET TO UNCOMMENT THIS
    cin >> n;
    for(int i = 0; i < n-1; ++i)
    {
        int a, b;
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    DFS(1, 1);
    ll ans = (dp[1][0] + dp[1][1]) % MOD;
    cout << ans << "\n";
    return 0; 
}

Measured memory_bytes: 12800
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      int c = sc.nextInt();
      int cost = (int) b/a;
      if(cost >= c) System.out.println(c);
      else System.out.println(cost);
    }
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

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

    string AA;

    if (s == "Sunny")
        AA = "Cloudy";
    if (s == "Cloudy")
        AA = "Rainy";
    if (s == "Rainy")
        AA = "Sunny";

    cout << AA <<"\n";

    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s=sc.next(),t=sc.next();
		char[] c1=s.toCharArray(),c2=t.toCharArray();

		Arrays.sort(c1);
		Arrays.sort(c2);

		String ss= new String(c1);
		String ts= new String(c2);

		 ts= new StringBuilder(ts).reverse().toString();
		System.out.println(ss.compareTo(ts)<0?"Yes":"No");

	}
}

Measured memory_bytes: 23892
N,K=map(int,input().split())

xlist,ylist,xylist=[],[],[]
xyset=set()
xydic={}
yxdic={}
for i in range(N):
  x,y=map(int,input().split())
  xlist.append(x)
  ylist.append(y)
  xylist.append((x,y))
  xyset.add((x,y))
  xydic[x]=y
  yxdic[y]=x

xy_prod_list=[]
for x in xlist:
  for y in ylist:
    xy_prod_list.append((x,y))
xy_prod_list.sort()
#print(xy_prod_list)    

num_ld_dic={}
for xx,yy in xy_prod_list:
  num_ld=0
  for x,y in xylist:
    if x<=xx and y<=yy:
      num_ld+=1
  num_ld_dic[(xx,yy)]=num_ld
#print(num_ld_dic)

answer=float("inf")
for i in range(len(xy_prod_list)):
  x1,y1=xy_prod_list[i]
  for j in range(len(xy_prod_list)):
    x2,y2=xy_prod_list[j]
    if x1>=x2 or y1>=y2:
      continue
    
    area=(x2-x1)*(y2-y1)
    if area>answer:
      continue
      
    num_point=num_ld_dic[(x2,y2)]-num_ld_dic[(x1,y2)]-num_ld_dic[(x2,y1)]+num_ld_dic[(x1,y1)]
    if (x1,y1) in xyset:  
      num_point+=1
    else:
      xx=yxdic[y1]
      if x1<=xx<=x2:
        num_point+=1
      yy=xydic[x1]
      if y1<=yy<=y2:
        num_point+=1
      
    if num_point>=K:
      #print((x1,y1),(x2,y2),num_point)
      answer=min(answer,area)
    
print(answer)

Measured memory_bytes: 50268
//written by NewbieChd
#include <cstdio>
#include <cctype>
#include <algorithm>
using namespace std;

const int BUF = 1000000;
char buf[BUF], *p1, *p2;
inline char getChar() { return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, BUF, stdin), p1 == p2) ? EOF : *p1++; }
inline int read() {
    register int f = 0;
    bool b = 1;
    char c;
    while (!isdigit(c = getChar()))
        if (c == 45)
            b = 0;
    do
        f = f * 10 + (c ^ 48);
    while (isdigit(c = getChar()));
    return b ? f : ~f + 1;
}

const int maxN = 100003;
int s[maxN];

int main() {
    int n = read(), i, l, r;
    long long ans = 0, sum;
    for (i = 0; i < n; ++i)
        s[i] = read();
    for (i = 1; i < n; ++i) {
        l = 0, r = n - 1, sum = 0;
        while (r > i && (l < r || r % i))
            ans = max(ans, sum += s[l] + s[r]), l += i, r -= i;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <cstdlib>
#include <list>

const int MAX_N = 25;

struct Node {
  int parent;
  int left;
  int right;
};

int main(void) {
  int n = 0;
  struct Node *N[MAX_N];

  std::cin >> n;

  for (int i = 0; i < n; i++) {
    struct Node *node = (struct Node *) std::malloc(sizeof(struct Node));

    node->parent = -1;
    node->left = -1;
    node->right = -1;
    
    N[i] = node;
  }

  for (int i = 0; i < n; i++) {
    int id = 0;
    
    std::cin >> id;
    
    struct Node *node = N[id];

    std::cin >> node->left;
    std::cin >> node->right;

    if (node->left >= 0) {
      N[node->left]->parent = id;
    }
    if (node->right >= 0) {
      N[node->right]->parent = id;
    }
  }

  for (int i = 0; i < n; i++) {
    struct Node *node = N[i];
    
    std::cout << "node "<< i << ": ";
    std::cout << "parent = " << node->parent << ", ";

    std::cout << "sibling = ";

    if (node->parent >= 0) {
      struct Node *parent = N[node->parent];
      
      if(parent->left == i) {
    	std::cout << parent->right;
      } else {
    	std::cout << parent->left;
      }
    } else {
      std::cout << -1;
    }

    std::cout << ", ";
    std::cout << "degree = ";

    int degree = 0;

    if (node->left >= 0) {
      degree++;
    }
    if (node->right >= 0) {
      degree++;
    }

    std::cout << degree << ", ";

    int depth = 0;

    struct Node *p = node;

    while (p->parent >= 0) {
      p = N[p->parent];
      depth++;
    }
    
    std::cout << "depth = " << depth << ", ";

    int height = 0;
    std::list<int> nodes;

    nodes.push_back(i);

    std::cout << "height = ";

    while(!nodes.empty()) {
      std::list<int> newNodes;
      
      for (std::list<int>::iterator iterator = nodes.begin(); iterator != nodes.end(); ++iterator) {
    	if (*iterator < 0) {
    	  continue;
    	}

    	struct Node *v = N[*iterator];

    	if (v->left >= 0) {
    	  newNodes.push_back(v->left);
    	}
    	if (v->right >= 0) {
    	  newNodes.push_back(v->right);
    	}
      }

      if (newNodes.size() > 0) {
	height++;
      }

      nodes.clear();

      for (std::list<int>::iterator iterator = newNodes.begin(); iterator != newNodes.end(); ++iterator) {
    	if (*iterator >= 0) {
    	  nodes.push_back(*iterator);
    	}
      }
    }

    std::cout << height << ", ";

    if (node->parent < 0) {
      std::cout << "root";
    } else if ((node->left >= 0) || (node->right >= 0)) {
      std::cout << "internal node";
    } else {
      std::cout << "leaf";
    }

    std::cout << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n;
    cin>>n;
    int a;
    multiset<int> ms;
    for(int i=0;i<n;i++){
        cin>>a;
        auto it=ms.lower_bound(a);
        if(it!=ms.begin()){
            ms.erase(prev(it));
        }
        ms.insert(a);
    }
    cout<<ms.size()<<endl;
}


Measured memory_bytes: 4992
def solve():
    N = int(input())

    lb, ub = 0, 0
    for n_digit in range(1, 100):
        lb = ub + 1
        ub = (ub + 1) * 26
        if lb <= N <= ub:
            off = N - lb
            res = []
            while off > 0:
                off, r = divmod(off, 26)
                res.append(r)
            while len(res) < n_digit:
                res.append(0)
            res.reverse()
            res = ''.join([chr(ord('a') + x) for x in res])
            return res
    
print(solve())

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

using namespace std;

const long long int MOD = 1e9+7;

long long int power(long long int b, long long int p, long long int m) {
	if (b == 1) {
		return 1;
	}

	if (p == 0) {
		return 1;
	}

	if (p % 2 == 0) {
		long long int x = power(b, p/2, m);
		return (x * x) % m;
	}

	return (b * power(b, p-1, m)) % m;
}

int main() {
	long long int n;

	cin >> n;
	
	long long int ans = power(10, n, MOD);
	
	ans -= power(9, n, MOD);
	if (ans < 0) {
		ans += MOD;
	}

	ans -= power(9, n, MOD);
	if (ans < 0) {
		ans += MOD;
	}

	ans += power(8, n, MOD);
	if (ans >= MOD) {
		ans -= MOD;
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 3632
import sys
input = sys.stdin.readline

def main():
	mod = 10**9 + 7
	N = 13
	dp = [0] * N
	dp[0] = 1
	s = input().strip()
	mul = 1
	for i in reversed(range(len(s))):
		# print(dp)
		nextdp = [0] * N
		if s[i] == '?':
			for k in range(10):
				for j in range(N):
					nextdp[(k * mul + j) % N] += dp[j]
					nextdp[(k * mul + j) % N] %= mod
		else:
			k = int(s[i])
			# print("c: {},{}".format(i, k))
			for j in range(N):
				nextdp[(k * mul + j) % N] += dp[j]
				nextdp[(k * mul + j) % N] %= mod
		mul *= 10
		mul %= N
		dp = nextdp
	# print(dp)
	print(dp[5])

if __name__ == '__main__':
	main()


Measured memory_bytes: 43372
#include <bits/stdc++.h>
using namespace std;
#define take freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);freopen("error.txt","w",stderr);
#define speed ios_base::sync_with_stdio(false);
#define int long long
#define endl "\n"
#define maxi 10000007
#define rof(i,a,b) for(int i=a;i<b;i++)
int32_t main()
{
    speed
    //take
    int d,t,s;
    cin>>d>>t>>s;
    if(d>t*s)
    {
        cout<<"No";
    }
    else
    {
        cout<<"Yes";
    }
    
}

Measured memory_bytes: 3688
#include <stdio.h>
#include <stdlib.h>
#define N 100
#define INF 1000000000

int MatrixChain(int *, int);
int min(int, int);

int main() {
  int i, j, n;
  int r[N], c[N];
  int min;

  // input
  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    if(i == 0)scanf("%d %d", &r[i], &r[i+1]);
    else scanf("%d %d", &c[i], &r[i+1]);
  }

  // MATRIX-CHAIN MULTIPLICATION PROBLEM
  printf("%d\n", MatrixChain(r, n));

  return 0;
}

int MatrixChain(int *r, int n) {
  int i, j, k, l;
  int m[N][N];
  int len;
  int q;

  len = n;
  for(i = 1; i <= len; i++) {
    m[i][i] = 0;
  }

  for(l = 2; l <= len; l++) {
    for(i = 1; i <= len-l+1; i++) {
      j = i + l - 1;
      m[i][j] = INF;
      for(k = i; k <= j-1; k++) {
	q = m[i][k] + m[k+1][j] + r[i-1] * r[k] * r[j];
	m[i][j] = min(m[i][j], q);
      }
    }
  }

  return m[1][len];
}

int min(int x, int y) {
  if(x > y) return y;
  else return x;
}



Measured memory_bytes: 2108
#include <string>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <iomanip>


using namespace std;

typedef unsigned long long ull;

int main(void) {
	vector<int> dp = vector<int>(1000000, 0);
	int tmp = 0;
	for(int i = 2; i < 1000000; i++){
		if(dp[i] != 0)continue;
		dp[i] = ++tmp;
		for(int j = i * 2; j < 1000000; j += i){
			dp[j] = -1;
		}
	}
	int n;
	while(cin >> n){
		while(dp[n] == -1) n--;
		cout << dp[n] << endl;
	}
}

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

int main() {

    ios::sync_with_stdio(0);
    cin.tie(0);

    long long N; cin >> N;
    long long sum = 0;

    for (long long i = 1; i <= N; i++) {
        if (i % 3 != 0 and i % 5 != 0) {
            sum += i;
        }
    }

    cout << sum;

}

Measured memory_bytes: 3636
import sys
from collections import deque
def main():
    MOD=10**9+7
    q=deque()
    H,W=tuple(map(int,sys.stdin.readline().split()))
    m,dp=[],[[0 for _ in range(W)] for _ in range(H)]
    for _ in range(H):m.append(list(sys.stdin.readline().strip()))
    dp[0][0]=1
    q.append((0,0))
    while len(q)>0:
        h,w=q.popleft()
        if h+1<H and m[h+1][w]=='.':  # down
            if dp[h+1][w]==0:q.append((h+1,w))
            dp[h+1][w]=(dp[h+1][w]+dp[h][w])%MOD
        if w+1<W and m[h][w+1]=='.':  # right
            if dp[h][w+1]==0:q.append((h,w+1))
            dp[h][w+1]=(dp[h][w+1]+dp[h][w])%MOD
    print(dp[H-1][W-1])
if __name__=='__main__':main()

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

using namespace std;

const int N = 1e5 + 5;
int p[N];

int main() {
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; i ++) scanf("%d", &p[i]);
    int res = 0;
    for(int i = 1; i < n; i ++) if(p[i] == i) res ++, swap(p[i], p[i + 1]);
    if(p[n] == n) res ++;
    printf("%d\n", res);
    return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
const int maxN=1e5+10;
int N,H[maxN],dp[maxN];
int main()
{
	cin>>N;
	int mx=0;
	for(int i=0;i<N;i++)
	{
		cin>>H[i];
		if(i)
		{
			if(H[i]<=H[i-1])
			{
				dp[i]=dp[i-1]+1;
			}
		}
		mx=max(mx,dp[i]);
	}
	cout<<mx<<endl;
	return 0;
}
/*
5
5 4 3 2 1
Output:4

7
10 9 7 1 6 5 5
Output:3 
*/


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

using namespace std;
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define int long long
#define endl '\n'
#define MOD 1000000007

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int a, b ,c;
    cin >> a >> b >> c;
    a = a - b;
    if(c - a <= 0)
        cout << 0 << endl;
    else
        cout << c - a << endl;

    return 0;
}

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

#define mp make_pair
#define pb push_back

#define int int64_t
#define ld long double

const int MOD = 1e9+7;
const int N = 1e6+5;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,k;
    cin>>n>>k;
    int ans=0;
    for(int i=k;i<=n+1;i++)  {
        int t = ((n*(n+1))/2-(n-i)*(n-i+1)/2);
        t-=(i*(i-1)/2);
        t++;
        //cout<<t<<"\n";
        ans+=t;
        ans%=MOD;
    }
    ans+=MOD;
    ans%=MOD;
    cout<<ans;

    return 0;
}

Measured memory_bytes: 3608
import java.util.*;

// ABC 70-C
// https://beta.atcoder.jp/contests/abc070/tasks/abc070_c

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int N = in.nextInt();
		long answer = 1;
		
		for (int i = 0; i < N; i++) {
			long n = in.nextLong();
			answer = lcm(answer, n);
		}
		System.out.println(answer);
	}
	
	public static long lcm(long a, long b) {
		long gcd = gcd(a, b);
		return gcd * (a / gcd) * (b / gcd);
	}
	
	public static long gcd(long a, long b) {
		if (a == 0) {
			return b;
		}
		return gcd(b % a, a);
	}
}


Measured memory_bytes: 23764
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <complex>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
ll mod=1e9+7;
double eps=1e-7;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ull pexp(ull x,ull y){if(y<0) return 0; ull ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll eadivs(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=i+x/i;if(x%i==0 && i*i==x) ret+=i;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
ll rev(ll n, ll b){ll ret=0;while(n){ret=b*ret+n%b; n/=b;}return ret;}
ll sq(ll x){ll t=(ll)sqrt(x); for(ll i=t-2 ; i<=t+2 ; i++) if(i*i==x) return abs(i); return -1;}
ll extexp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=extm(x,x)){if(y&1)ret=extm(ret,x);}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
int stf[25555555];
int S; ll ans, cv;

ll gv(ll x)
{
	ll ret=0;
	if(S%x==0)
	{
		ll t=S/x; // x copies of t
		if(t>15LL || 9LL*pexp(10,t-1)>=x) ret=(mod+9LL*exp(10,t-1)-x+1);
		return ret%mod;
	}
	else
	{
		ll t=S/x, r=S%x;
		ll U=x-r; ll V=r; // U copies of t, V copies of t+1
		if(t>15LL || 9LL*pexp(10,t-1)>=U && 9LL*pexp(10,t)>=V) return 1;
		return 0;
	}
}

int main(void)
{
	cin>>S; ll i, j, l, r; stf[0]=0; l=0, r=0;
	for(i=1 ; i<=25000000 ; i++) stf[i]=stf[i/10]+1;
	while(l<10000000)
	{
		if(cv==S) ans++, cv+=stf[++r];
		else if(cv<S) cv+=stf[++r];
		else if(cv>S) cv-=stf[l++];
	}
	for(i=1 ; i<=S/8 ; i++) ans+=gv(i);
	cout<<ans%mod; return 0;
}


Measured memory_bytes: 98560
import java.util.*

fun main(args: Array<String>) {
	val scan = Scanner(System.`in`)
	val a = scan.nextInt()
	println("${(a - a % 3600) / 3600}:${(a % 3600 - a % 3600 % 60) / 60}:${a % 3600 % 60}")
}


Measured memory_bytes: 25640
N = int(input())
E = []
for _ in range(N):
    E += [(int(input()), 1)]
for _ in range(N):
    E += [(int(input()), -1)]
E.sort()
mod = 10**9 + 7
ans = 1
ab = 0
for e in E:
    if e[1] * ab < 0:
        ans *= abs(ab)
        ans %= mod
    ab += e[1]
print(ans)


Measured memory_bytes: 24512
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int[][] point=new int[300][100];
		int n=sc.nextInt();
		int[] score=new int[n+3];
		boolean check=false;
		for(int i=0;i<n;i++){
			for(int j=0;j<3;j++){
			    point[i][j]=sc.nextInt();
			}
		}
		for(int i=0;i<3;i++){
			for(int j=0;j<n;j++){
				check=false;
			    for(int k=0;k<n;k++){
			    	if(point[k][i]==point[j][i] && j!=k) check=true;
			    }
			    if(!check) score[j]+= point[j][i];
			}
		}
		for(int i=0;i<n;i++) System.out.println(score[i]);
	}
}

Measured memory_bytes: 28956
#include <stdio.h>

char num[1000050];

void check(void)
{
	int i, j;
	
	num[0] = 1;
	num[1] = 1;
	num[2] = 0;
	
	for (i = 2; i < 1000000; i++){
		if (num[i] == 0){
			j = 2;
			while (i * j < 1000000){
				num[i * j] = 1;
				j++;
			}
		}
	}
}
		
int main()
{
	int i, n, sum;
	
	check();
	
	while (scanf("%d", &n) != EOF){
		
		sum = 0;
		
		for (i = 0; i <= n; i++){
			
			if (num[i] == 0)
			sum++;
		}
		
		printf("%d\n", sum);
	}
	
	return (0);
}
		

Measured memory_bytes: 2000
N=int(input())
X =  [0] * N
Y =  [0] * N
for i in range(N):
    x,y = map(int,input().split())
    X[i] = x
    Y[i] = y
long = 0
for i in range(N-1):
    for j in range(i+1,N):
        l = ((X[i] - X[j])**2 + (Y[i] - Y[j])**2)**(1/2)
        long += l

ans = long*2/N
print(ans) 

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

using namespace std;

const int N = 500017;
const int MOD = 1000 * 1000 * 1000 + 7;

int n, X, Y;
int c[N], w[N], F[N];
vector<int> cols[N];
int P[N], W[N];

bool read() {
    if (!(cin >> n >> X >> Y))
        return false;

    for (int i = 0; i < n; ++i) {
        cin >> c[i] >> w[i];
        --c[i];
    }

    return true;
}

int getp(int u) { return u == P[u] ? u : P[u] = getp(P[u]); }

bool join(int u, int v) {
    if ((u = getp(u)) == (v = getp(v)))
        return false;

    if (W[u] < W[v])
        swap(u, v);

    P[v] = u;
    W[u] += W[v];
    return true;
}

long long binpow(long long a, int b, long long mod) {
    long long res = 1;

    for (; b > 0; b /= 2, a = a * a % mod)
        if (b & 1)
            res = res * a % mod;

    return res;
}

long long rev(long long a, long long mod) { return binpow(a, mod - 2, mod); }

void solve() {
    long long ans = 1;
    int m1 = min_element(w, w + n) - w;
    int m2 = -1;

    for (int i = 0; i < n; ++i) {
        P[i] = i;
        W[i] = 1;
        cols[c[i]].push_back(i);

        if (c[i] != c[m1] && (m2 == -1 || w[i] < w[m2]))
            m2 = i;
    }

    F[0] = 1;

    for (int i = 1; i <= n; ++i)
        F[i] = (long long) i * F[i - 1] % MOD;

    for (int col = 0; col < n; ++col) {
        if (cols[col].empty())
            continue;

        int m = cols[col][0];

        for (auto i : cols[col])
            if (w[i] < w[m])
                m = i;

        int mn = c[m1] != col ? m1 : m2;
        int cnt = 0;

        for (auto i : cols[col]) {
            int f = 0;

            if (w[i] + w[m] <= X)
                join(i, m), f = 1;

            if (mn != -1 && w[i] + w[mn] <= Y)
                join(i, mn), f = 1;

            cnt += f;
        }

        ans *= rev(F[cnt], MOD);
        ans %= MOD;
    }

    for (int i = 0; i < n; ++i)
        if (i == P[i])
            ans = ans * F[W[i]] % MOD;

    cout << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 23936
# ABC149C - Next Prime
def is_prime(n: int) -> bool:
    """
    Evaluate whether a number is prime or not.

    Args:
        n: a number to evaluate

    Returns: whether n is prime or not
    """
    if n == 2:
        return True
    if n == 1 or n % 2 == 0:
        return False
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i == 0:
            return False
    return True


def main():
    N = int(input())
    if N != 2 and N % 2 == 0:
        N += 1
    while not is_prime(N):
        N += 2
    print(N)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <cstdlib>
#include <stack>
#include <algorithm>
#include <queue>

using namespace std;

int main(){
    int n,timeSlot;
    cin>>n>>timeSlot;
    queue<pair<string, int> > Q;
    string name;
    int time;

    for(int i = 0;i<n;i++){
        cin>>name>>time;
        Q.push(make_pair(name,time));
    }


    // ????§??¨??????¶??´????????¬
    int timeMark = 0; //??¶??´??????
    int usedTime = 0;
    while(!Q.empty()){
        pair<string, int> task = Q.front();
        Q.pop();
        usedTime = min(timeSlot,task.second);
        task.second -= usedTime;
        timeMark += usedTime;
        if(task.second > 0){
            Q.push(task);
        } else {
            cout<<task.first<<" "<<timeMark<<endl;
        }
    }


    return 0;
}

Measured memory_bytes: 6312
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  bool ans=false;
  if(a==b||b==c||c==a){
    if(!(a==b&&b==c))ans=true;
  }
  if(ans) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

int main(){
    ll x;
    cin >> x;
    if(x%1000 == 0){
        cout << 0 << endl;
    }
    
    else{
        cout << (1000 - x%1000) << endl;
    }
    return 0;
}

Measured memory_bytes: 3568
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	int ans = 0;
	if ((a[1] - a[0]) % 2) {
		ans++;
		a[2]++;
		a[1]++;
	}
	ans += (a[1] - a[0]) / 2 + a[2] - a[1];
	cout << ans << '\n';
	return 0;	
}


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

int main(){
    int n,k;
    int x,ans=0;
    cin >> n >> k;
    rep(i,n){
        cin >> x;
        if(x >=k){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
// clang-format off
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
#define DEB(variable) cout << #variable << '=' << variable << endl

#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

using llint = long long int;

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr long long int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

// clang-format on
int main() {

    llint n;
    cin >> n;
    if(n % 2) {
        cout << 0 << endl;
    } else {
        llint result = 0;
        llint divisor = 5*2;
        while(n>=divisor){
            result += n / divisor;
            divisor *= 5;
        }
        cout << result << endl;
    }

    return 0;
}


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

#define EB emplace_back
#define int long long
#define F first
#define S second
#define N 500005
#define all(x) x.begin(),x.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define rt return 0;
#define len size()
using namespace std;



int32_t main(){
	IOS;
	string yy = "YES";
	string nn = "NO";
	int tt = 1; 
	cin >> tt;
	string arr[] = {"AC", "WA", "TLE", "RE"};
	map < string , int > mp;
	while(tt--){
		string s; cin >> s;
		mp[s]++;
		
	}
	for(int i = 0; i < 4; i++){
			cout << arr[i] << " x " << mp[arr[i]] << endl;
		}
	return 0;
}


Measured memory_bytes: 3660
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	int res=0;
	res=max(a+b,a-b);
	res=max(res,a*b);
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 256
n,m,k,*x=map(int,open(0).read().split())
s=sum(x[:n])
z=i=j=n
x+=k,
while~i:
	while s+x[j]<=k:s+=x[j];j+=1
	if s<=k:z=max(z,i+j)
	i-=1
	s-=x[i]
print(z-n)

Measured memory_bytes: 54980
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};

int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N,K,L; cin >> N >> K >> L;
    UnionFind ufk(N),ufl(N);
    for(int i = 0; i < K;i++){
        int u,v; cin >> u >> v;
        u--; v--;
        ufk.unionSet(u, v);
    }
    for(int i = 0; i < L;i++){
        int u,v; cin >> u >> v;
        u--; v--;
        ufl.unionSet(u, v);
    }
    map<pll,int> mp;
    for(int i = 0; i < N;i++){
        mp[pll(ufk.root(i),ufl.root(i))]++;
    }
    for(int i = 0; i < N;i++){
        cout << mp[pll(ufk.root(i),ufl.root(i))] << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 13568
#include<stdio.h>
#define MAX 100
#define INFTY 200000
#define WHITE 0
#define GRAY 1
#define BLACK 2
 
int n,T[MAX][MAX];
 
void dijkstra(){
  int minv,i,v,u;
  int d[MAX],color[MAX];
 
  for(i=0;i<n;i++){
    d[i] = INFTY;
    color[i] = WHITE;
  }
 
  d[0] = 0;
  color[0] = GRAY;
  
  while(1){
    minv = INFTY;
    u = -1;
    for(i = 0;i<n;i++){
      if(minv>d[i] && color[i] != BLACK){
	u = i;
	minv = d[i];
      }
    }
    
    if(u == -1)break;
    color[u] = BLACK;
    for(v = 0;v<n;v++){
      if(color[v] != BLACK && T[u][v] != INFTY){
	if(d[v]>d[u]+T[u][v]){
	  d[v] = d[u] + T[u][v];
	  color[v] = GRAY;
	}
      }
    }
  }
  
  for(i = 0;i<n;i++){
    printf("%d",i);
    printf(" ");
    d[i]= (d[i] == INFTY) ? -1 : d[i];
    printf("%d\n",d[i]);
  }
}
 
int main(){
  int i,k,c,u,v,j;
 
  scanf("%d",&n);
  
  for(i = 0;i<n;i++){
    for(j = 0;j<n;j++){
      T[i][j] = INFTY;
    }
  }
  
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j = 0;j<k;j++){
      scanf("%d %d",&v,&c);
      T[u][v] = c;
    }
  }
  
  dijkstra();
 
  return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String o = scan.next();
		String e = scan.next();
		if (o.length()==e.length()) {			
			for (int i = 0; i < o.length(); i++) {
				System.out.print(o.charAt(i));
				System.out.print(e.charAt(i));
			}
		} else {
			for (int i = 0; i < e.length(); i++) {
				System.out.print(o.charAt(i));
				System.out.print(e.charAt(i));
				if (i == e.length()-1) {
					System.out.print(o.charAt(i+1));
				}
			}
		}
	}
}


Measured memory_bytes: 21844
import java.util.*;

class Main {
    // ABC152D
    static final long MOD = 1_000_000_007;
    // 10^9+7
    //static final int MAX = 2_147_483_646;
    static final int MAX = 10_000_000;
    // intの最大値
    static final int INF = 1_000_000_000;
    // 10^9

  
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        int an = sc.nextInt();
        int bn = sc.nextInt();
        String c = sc.next();
        if(a.equals(c)){
            an--;
        }
        if(b.equals(c)){
            bn--;
        }
        System.out.println(an + " " + bn);
    }
    
}




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


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


Measured memory_bytes: 768
/************************************************
* Author        :RunningTime
* Created Time  :2017/4/29 20:06:28
* File Name     :B.cpp
 ************************************************/

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

typedef long long ll;
const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
int A, B, C;

int main() {
    ios::sync_with_stdio(false);
    cin >> A >> B >> C;
    int gcd = __gcd(A, B);
    if (C % gcd) cout << "NO" << '\n';
    else cout << "YES" << '\n';
    return 0;
}


Measured memory_bytes: 256