akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define ld           long double
#define vi           vector<int>
#define pii          pair<int,int>
#define pb           push_back
#define mp           make_pair
#define ff           first
#define ss           second
#define endl         '\n'
#define rep(i,s,e)   for(int i=(s);i<=(e);i++)
#define brep(i,s,e)  for(int i=(s);i>=(e);i--)
#define all(x)       (x).begin(),(x).end()
#define ball(x)      (x).rbegin(),(x).rend()
#define sz(x)        (int)x.size()
#define mem(x,y)     memset(x,(char)y,sizeof(x))
#define milf(x)      x.reserve(1LL<<14LL); x.max_load_factor(0.25); // less_equal
#define pbds         tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
mt19937              rng(chrono::steady_clock::now().time_since_epoch().count());
#define int          long long
const int INF = 0x3F3F3F3F3F3F3F3F;
const int MOD = 1e9+7;
ld EPS = 1e-12;


short rain()
{
    // int t;cin>>t;rep(test,1,t)
    {
        int n;
        cin >> n;
        int ans = 0;
        rep(k,1,n)
        {
            int v = (n/k);
            v *= (1LL+(n/k));
            v *= k;
            ans += v;
        }
        cout << ans/2 << endl;
    }

    return 0;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    // freopen("ip.txt","r",stdin);
    // freopen("op.txt","w",stdout);
    int tt = 1000*clock()/CLOCKS_PER_SEC;
    cout<<fixed<<setprecision(15);rain();
    cerr<<1000*clock()/CLOCKS_PER_SEC-tt<<"ms\n";
}

Measured memory_bytes: 3696
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int A, B, K, i, cnt=0; cin >> A >> B >> K;
  for (i=max(A, B); i>0; i--) {
    if (A%i==0 && B%i==0) cnt++;
    if (cnt==K) {
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

// https://atcoder.jp/contests/abc161/tasks/abc161_c
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long k = sc.nextLong();
		sc.close();

		long[] ansArray =  {n,n,n};

		n = n%k;
		long ans = n;
		long ans1 = n;
		long ans2 = n;
		while(true) {
			ansArray[2] = Math.abs(ansArray[1] - k);

			ans = Math.abs(ans - k);
			ans1 = Math.abs(ans - k);
			ans2 = Math.abs(ans1 - k);

			if(ans==ans2) {
				System.out.println(Math.min(ans1, ans2));
				return;
			}
		}


	}
}


Measured memory_bytes: 21844
def ipmatch(ip,iprule):
    ret=1
    for i in range(8):
        if iprule[i]!='?':
            ret*=ip[i]==iprule[i]
    return ret


def rulematch(sip,dip,rule):
    rulesip=rule[1]
    ruledip=rule[2]
    return ipmatch(sip,rulesip) and ipmatch(dip,ruledip)

while(1):
    [n,m]=[int(x) for x in raw_input().split()]
    if n==0 and m==0:
        break
    else:
        anssum=0
        ansmes=[]
        rules=[]
        for i in range(n):
            rulei=raw_input().split()
            rules.append(rulei)
        for i in range(m):
            message=raw_input().split()
            sip=message[0]
            dip=message[1]
            for j in range(-1,-n-1,-1):
                if rules[j][0]=='deny':
                    if rulematch(sip,dip,rules[j]):
                        break
                else:
                    if rulematch(sip,dip,rules[j]):
                        anssum+=1
                        ansmes+=[[sip,dip,message[2]]]
                        break
        print anssum
        for mm in ansmes:
            print mm[0],mm[1],mm[2]

Measured memory_bytes: 6668
#include <bits/stdc++.h>
#define REP(i,n) for (long i=0;i<(n);i++)
#define FOR(i,a,b) for (long i=(a);i<(b);i++)
#define RREP(i,n) for(long i=n;i>=0;i--)
#define RFOR(i,a,b) for(long i=(a);i>(b);i--)
#define dump1d_arr(array) REP(i,array.size()) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl;
#define dump2d_arr(array) REP(i,array.size()) REP(j,array[i].size()) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl;
#define dump(x)  cerr << #x << " => " << (x) << endl;
#define CLR(vec) { REP(i,vec.size()) vec[i] = 0; } 
#define llINF (long long) 9223372036854775807
#define loINF (long) 2147483647
#define shINF (short) 32767
#define SORT(c) sort((c).begin(),(c).end())

using namespace std;
typedef vector<char> VC;
typedef vector<VC> VVC;
typedef pair<long,long> P;
typedef vector<long> VI;
typedef vector<VI> VVI;

int main(void){
	short dx[4] = {1,0,-1,0};
	short dy[4] = {0,1,0,-1};

	short H,W;
	cin >> H >> W;
	VVI d(H,VI(W,loINF));
	long cnt = 0;

	VVC arr(H,VC(W));

	REP(i,H){
		REP(j,W){
			cin >> arr[i][j];
			if (arr[i][j] == '#') cnt ++;
		}
	}

	queue<P> que;
	que.push(P(0,0));
	d[0][0] = 0;

	while(!que.empty()){
		P p = que.front();
		que.pop();

		if (p.first == (W-1) && p.second == (H-1)) break;

		REP(i,4){
			long nx = p.first + dx[i];
			long ny = p.second + dy[i];

			if ( 0 <= nx && nx < W && 0 <= ny && ny < H && arr[ny][nx] != '#' && d[ny][nx] == loINF){
				que.push(P(nx,ny));
				d[ny][nx] = d[p.second][p.first] + 1;
			}
		}
	}

	if (d[H-1][W-1] == (loINF)) {
		cout << (-1) << endl;
		exit(0);
	}

	cout << H * W - (d[H-1][W-1]+1) - cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <map>
#include <list>
#include <cmath>
#include <queue>
#include <cstring>
#include <iostream>
#include <algorithm>
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int n,x,y,ans;
int main()
{
	fast;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>x>>y;
		ans+=y-x+1;
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
function Main(input) {
  let result = false;
  for (let i = 0;i < input;i++) {
    for (let j = 0;j < input;j++) {
      if (input % (7 * i + 4 * j) == 0) {
        result = true;
      }
    }
  }
  console.log(result ? 'Yes' : 'No');
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0, sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    string S; cin >> S;
    cout << (S[2]==S[3] && S[4]==S[5] ? "Yes" : "No") << endl;
    return 0;
}

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

int main(int argc, char const *argv[])
{
  int k, s;
  cin >> k >> s;
  int num = 0;

  for(int x = 0; x <= k; x++)
  {
    if(x > s)
      break;
      
    if(s - x > 2*k)
      ;
    else if(s - x > k)
    {
      num += 2*k - (s - x) + 1;
    }
    else
      num += s - x + 1;
  }
  cout << num << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define A 0
#define B 1
#define W 2
#define X 3
#define Y 4
#define Z 5
#define undef 6
using namespace std;

int main()
{
  //A,B,W,X,Y,Z,undef
  int map[7][2]={
    {X,Y},
    {Y,X},
    {B,Y},
    {undef,Z},
    {X,undef},
    {W,B},
    {undef,undef}
  };
  string p;
  for(;cin>>p,p!="#";)
    {
      int now=0;
      for(int i=0;i<p.size();i++)
	{
	  now=map[now][p[i]-'0'];
		  //cout<<now<<endl;
	}
      if(now==1)
	cout<<"Yes"<<endl;
      else
	  cout<<"No"<<endl;
    }
  
}

Measured memory_bytes: 1176
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int a, b, c;
int k;
int main(void){
    cin >> a >> b >> c;
    cin >> k;
    int count = 0;
    while(a >= b){
        b *= 2;
        count++;
    }
    while(b >= c){
        c *= 2;
        count++;
    }
    if (count <= k) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 3644
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<math.h>
using namespace std;
#define mod (1000000000+7)
#define N (10007)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 
 
ll dp[110][100010];
 
int main(void){
    ll n,W;
    cin>>n>>W;
    vector<ll>v(n),w(n);
    for(ll i=0;i<n;i++){
        cin>>w[i]>>v[i];
    }
    for(ll i=0;i<110;i++){
        for(ll j=0;j<100010;j++){
            dp[i][j]=(ll)INF;
        }
    }
    dp[0][0]=0;
    for(ll i=0;i<n;i++){
        for(ll j=0;j<100010;j++){
            dp[i+1][j]=dp[i][j];
            if(j>=v[i]){
                dp[i+1][j]=min(dp[i+1][j],dp[i][j-v[i]]+w[i]);
            }
        }
    }
    ll ans = 0;
    for(ll j=0;j<100010;j++){
        if(dp[n][j]<=W)ans=j;
    }
    cout<<ans<<endl;
	return 0; 
}

Measured memory_bytes: 86144
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int n;
    ll l;
    cin >> n >> l;
    ll a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll mx = 0;
    int mx_idx = 1;
    for (int i = 0; i < n - 1; i++) {
        if (a[i] + a[i+1] > mx) {
            mx = a[i] + a[i+1];
            mx_idx = i + 1;
        }
    }

    if (mx < l) {
        cout << "Impossible\n";
    } else {
        cout << "Possible\n";
        for (int i = 1; i < mx_idx; i++) {
            cout << i << "\n";
        }
        for (int i = n-1; i > mx_idx; i--) {
            cout << i << "\n";
        }
        cout << mx_idx << "\n";
    }

    return 0;
}

Measured memory_bytes: 1664
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def f(x):
    cnt = k
    for i in a:
        tmp = math.ceil(i / x)
        cnt -= tmp - 1
        if cnt < 0:
            return False
    return True

n, k = LI()
a = LI()
a.sort(reverse=True)
ok = sum(a)
ng = 0
while ok - ng > 1:
    mid = (ok + ng) // 2
    if f(mid):
        ok = mid
    else:
        ng = mid
print(ok)

Measured memory_bytes: 92268
dfs a b
  | a == 0    = - b
  | otherwise = 2 * a * (b `div` a) + dfs (b `mod` a) a


solve (n : x : _) = n + dfs a b
  where
    a = min x (n - x)
    b = max x (n - x)

main = getLine >>= print . solve . map read . words


Measured memory_bytes: 508
// Volume1-0158 Collatz's Problem

#include <stdio.h>

#define in(x) scanf("%d", &x)

int step;

void collatz(int n)
{
	if ((n % 2) == 1 && n > 1){
		step++;
		collatz(3 * n + 1);
	}
	else if (n % 2 == 0){
		step++;
		collatz(n / 2);
	}
}

int main(void)
{
	int n;
	
	while (in(n) != EOF && n != 0){
		step = 0;
		collatz(n);
		printf("%d\n", step);
	}
	
	return (0);
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
//
int main(){
  int A,B;
  int N;
  cin>>A>>B>>N;
  FOR(i,0,N){
    int S,F;
    cin>>S>>F;
    if(B<=S||F<=A){
      continue;
    }else{
      cout<<1<<endl;
      return 0;
    }
  }
  cout<<0<<endl;
  return 0;
}


Measured memory_bytes: 3080
from collections import Counter
def main():
    mod = 10**9+7
    n = int(input())
    a = list(map(int,input().split(' ')))
    c = Counter(a)
    ans = (2**(n//2))%mod
    if n%2 != 0:
        for key,i in c.items():
            if key%2 != 0 or (key==0 and i != 1) or (key != 0 and i != 2):
                ans = 0
                break
    else:
        for key,i in c.items():
            if key%2 ==0 or i !=2:
                ans = 0
                break

    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 14820
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
const ll mod = 1e9+7;
const int MAX = 1e6;

vector<ll> fac(MAX), finv(MAX), inv(MAX);

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

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

ll Pow(ll x, ll n){
  if(n == 0) return 1;
  if(n % 2 == 0) return Pow(x*x % mod, n/2);
  else return x * Pow(x,n-1) % mod;
}

ll mod_inverse(ll a) {
  return Pow(a,mod-2);
}

int main(){
  ll n, m;
  cin >> n >> m;
  COMinit();
  vector<ll> perm(m+1);
  perm[0] = 1;
  for(ll i = 1; i <= m; i++) perm[i] = (perm[i-1]*i) % mod;
  ll ans = perm[m] * mod_inverse(perm[m-n]) % mod;
  (ans *= ans) %= mod;
  for(int i = 1; i <= n; i++) {
    ll res = perm[m] * COM(n,i) % mod;
    (res *= perm[m-i]) %= mod;
    (res *= mod_inverse(perm[m-n])) %= mod;
    (res *= mod_inverse(perm[m-n])) %= mod;
    if(i % 2) (ans -= res) %= mod;
    else (ans += res) %= mod;
  }
  if(ans < 0) ans += mod;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 30652
#include<stdio.h>
int main()
{
    int a,b,c,d=0,i,j;
    scanf("%d",&a);
    int x[a];
    for(i=0;i<a;i++){
        scanf("%d",&x[i]);
    }
    for(i=0;i<a-1;i++){
        for(j=a-1;j>i;j--){
            if(x[j-1]>x[j]){
                c=x[j-1];x[j-1]=x[j];x[j]=c;
                d++;
            }
        }
    }
    for(i=0;i<a;i++){
        if(i==a-1)printf("%d\n",x[i]);
        else printf("%d ",x[i]);
    }
    printf("%d\n",d);
    return 0;
}

Measured memory_bytes: 600
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	char a, b; cin >> a >> b;
	bool x = a == 'H', y = b == 'H';
	cout << (x^y ? 'D' : 'H') << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int r = sc.nextInt();
        
        int naibu = 0;
        int hyouji = r;
        
        if (n >= 10) {
            naibu = hyouji;
        } else {
            naibu = hyouji + 100 * (10- n);
        }
        System.out.println(naibu);
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

int main() {
  string s;
  cin>>s;
  int a=0,b=0,c=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='a') a++;
    if(s[i]=='b') b++;
    if(s[i]=='c') c++;
  }
  bool ans=false;
  if((a==b) and (c==a-1 or c==a+1)) ans=true;
  if((a==c) and (b==a-1 or b==a+1)) ans=true;
  if((c==b) and (a==c-1 or a==c+1)) ans=true;
  if(a==b and b==c) ans=true;
  if(ans) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 512
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//239///F.Sugoroku
	int m,d;
	cin>>m>>d;
	switch(m) {
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			if(d==31)cout<<1;
			else cout<<0;
			break;
		case 4:
		case 6:
		case 9:
		case 11:
			if(d==30)cout<<1;
			else cout<<0;
			break;
		default:
			if(d==28)cout<<1;
			else cout<<0;
		}
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string a[3];
  cin>>a[0]>>a[1]>>a[2];
  int ans=0;
  for(int i=0;i<n;i++){
    set<char> s;
    for(int j=0;j<3;j++){
      s.insert(a[j].at(i));
    }
    ans+=s.size()-1;
  }
  cout<<ans<<endl;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  string s;
  cin>>s;
  int n = s.size();
  int ans = 1000000;
  REP(i,n-2){
    int x = (s[i]-'0')*100 + (s[i+1]-'0')*10 + (s[i+2]-'0');
    CHMIN(ans, abs(x-753));
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
/////////////////////////////////
int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) {
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
    }
    sort(s.begin(), s.end());
    ll ans = 0;
    ll cnt = 1;
    rep(i,n-1){
        if(s[i]==s[i+1])
            cnt++;
        else{
            ans += (cnt - 1) * cnt / 2;
            cnt = 1;
        }
    }
    ans += cnt * (cnt - 1) / 2;
    cout << ans << endl;
}

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

int main() {
 int A;
 string op;
  int B;
  cin >> A;
  cin >> op;
  cin >> B;
  
  if(op == "+"){
    cout << A + B << endl;
  }
  
     if(op == "-"){
    cout << A - B << endl;
  }
  cout << endl;
    
  

}

    


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#define MAX 100010

using namespace std;

int n;
long long a,b;
long long h[MAX];

bool Judge(long long x)
{
    long long re;
    long c=0;
    int i;
    for(i=0;i<n;i++)
    {
        re=h[i]-x*b;
        if(re<=0)
            continue;
        else
            {
                c+=re/(a-b);
                if(re%(a-b)!=0)
                    c++;
                if(c>x)
                    return false;
            }
    }
    return true;
}

int main()
{
    long long l=0,r=1e9,ans,count;
    cin>>n>>a>>b;
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    ans=r;
    while(l<=r)
    {
        count=(l+r)/2;
        if(Judge(count))
        {
            r=count-1;
            ans=min(count,ans);
        }
        else
            l=count+1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  vector <int> city(n,0);
  
  for(int i=0;i<m;i++){
    int a,b;
    cin >> a>>b;
    city.at(a-1)++;
    city.at(b-1)++;
  }
  
  for(int i=0;i<n;i++){
    cout << city.at(i) << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair<ll,ll>; using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
/////////

constexpr int offset = 80 * 80 + 3;
constexpr int m = offset * 2 + 3;
bitset<m> dp[80][80];

void solve(){
  ini(H,W);
  vvi a(H,vi(W)); in(a);
  rep(i,H) rep(j,W){ini(x); a[i][j] = abs(a[i][j] - x);}

  dp[0][0][offset - a[0][0]] = dp[0][0][offset + a[0][0]] = 1;

  rep(i , H) rep(j , W){
    if(i) dp[i][j] |= (dp[i-1][j] >> a[i][j]) | (dp[i-1][j] << a[i][j]);
    if(j) dp[i][j] |= (dp[i][j-1] >> a[i][j]) | (dp[i][j-1] << a[i][j]);
  }
  for(int i = offset ; i < m ; i++){
    if(dp[H-1][W-1][i]) die(i - offset);
  }

  
}

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

int main()
{
    int a,b;

    cin >> a >> b;
    if (a == 1 && b == 2) cout << "3" << endl;
    else if (a == 1 && b == 3) cout << "2" << endl;
    else if (a == 2 && b == 3) cout << "1" << endl;
    else if (a == 2 && b == 1) cout << "3" << endl;
    else if (a == 3 && b == 1) cout << "2" << endl;
    else if (a == 3 && b == 2) cout << "1" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int n,m,d[1<<18],t[1<<18];
main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>d[i];
	sort(d,d+n);
	cin>>m;
	for(int i=0;i<m;i++)cin>>t[i];
	sort(t,t+m);
	int j=0;
	for(int i=0;i<m;i++)
	{
		while(j<n&&t[i]!=d[j])j++;
		if(j==n)
		{
			cout<<"NO"<<endl;
			return 0;
		}
		j++;
	}
	cout<<"YES"<<endl;
}


Measured memory_bytes: 1792
n = 3
x = [list(map(int, input().split())) for _ in range(n)]
a = [0] * n
b = [0] * n
a[0] = 0
b[0] = x[0][0]
b[1] = x[0][1]
b[2] = x[0][2]
a[1] = x[1][0] - b[0]
a[2] = x[2][0] - b[0]


for i in range(n):
    for j in range(n):
        if x[i][j] != (a[i] + b[j]):
            print('No')
            exit()
print('Yes')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for (int i = 0; i < 1000; ++i) {
    string str;
    auto cp = i;
    while (cp > 0) {
      int p = cp % 10;
      cp /= 10;
      str.push_back(p + '0');
    }
    if (str.size() < 3) {
      auto tt = str.size();
      repr(k, 3 - tt, 0) str.push_back('0');
    }

    reverse(str.begin(), str.end());

    int now = 0;
    for (int k = 0; k < n; ++k) {
      if (s[k] == str[now]) now ++;
      if (now == 3) {
        ans ++;
        break;
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>


using namespace std;

typedef long long ll;



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

	stack<string> st;


	int i = s.length() - 1;
	while (i >= 0) {
		if (s[i] == 'r') {
			if (s[i-2] == 's') {
				st.push("eraser");
				i -= 6;
			}
			else if (s[i - 2] == 'm') {
				st.push("dreamer");
				i -= 7;
			}
			else {
				break;
			}
		}
		else if (s[i] == 'm') {
			st.push("dream");
			i -= 5;
		}
		else if (s[i] == 'e') {
			st.push("erase");
			i -= 5;
		}
		else {
			break;
		}
	}

	string t;
	while (!st.empty()) {
		t += st.top();
		st.pop();
	}

	cout << (s == t ? "YES" : "NO");
}


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

typedef pair<int, int> P;
vector<P> graph[21];        // (to, cost)で有向グラフを表す
int n = 2;      // 頂点数
int m = 2;      // 辺数
int len = 2;    // 最長パス + 1

// lenを1増やしてグラフを拡張
void odd_expansion(){
    graph[0].push_back(P(n-1, len));
    ++m;
    ++len;
    
    return;
}

// lenを2倍ずつ増やしてグラフを拡張
// 既にあるグラフのコストをすべて2倍にしておいて、
// 最後の頂点から、コスト0の辺とコスト1の辺を新しい頂点に伸ばす。
// この操作の後、(n, m, len)の更新もしていく
void even_expansion(int cnt){
    for(int i = 0; i < cnt; ++i){
        
        for(int a = 0; a < n; ++a){
            for(int b = 0; b < graph[a].size(); ++b){
                graph[a][b].second *= 2;
            }
        }
        
        graph[n-1].push_back(P(n, 0));
        graph[n-1].push_back(P(n, 1));
        
        ++n;
        m += 2;
        len *= 2;
    }
    
    return;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int l;
    cin >> l;
    
    // (len=2)のグラフを作成(0-indexed)
    graph[0].push_back(P(1, 0));
    graph[0].push_back(P(1, 1));
    
    // lenがlと一致するまでグラフを拡張
    
    // (len=2)からどの順番でグラフを拡張するか
    vector<P> order;    // (偶奇, 回数)
    while(l > 2){
        int odd_cnt = 0, even_cnt = 0;
        
        if(l % 2 != 0){
            --l;
            ++odd_cnt;
        }
        if(odd_cnt > 0){
            order.push_back(P(1, odd_cnt));
        }
        
        while(l > 2 && l % 2 == 0){ // lenを2倍ずつ増やしてグラフを拡張する回数
            l /= 2;
            ++even_cnt;
        }
        if(even_cnt > 0){
            order.push_back(P(0, even_cnt));
        }
    }
    reverse(order.begin(), order.end());    // 逆順になっているのを正しておく

    for(int i = 0; i < order.size(); ++i){
        if(order[i].first == 1){
            odd_expansion();
        }
        else{
            even_expansion(order[i].second);
        }
    }

    cout << n << " " << m << "\n";
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < graph[i].size(); ++j){
            // 出力時に(0-indexed)を(1-indexed)にする。
            cout << i + 1 << " " << graph[i][j].first + 1 << " " << graph[i][j].second << "\n";
        }
    }
}

Measured memory_bytes: 256
// Author: getharshkumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n;
    cin >> n;
    cout << n * (n - 1) / 2;
    return 0;
}

Measured memory_bytes: 892
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.AGC_028
{
    class A
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            long[] nm = ReadLongs();
            string s = Read();
            string t = Read();
            for (long i = 0; i < nm[0]; i++)
            {
                if ((nm[1] * i) % nm[0] == 0)
                {
                    long j = nm[1] * i / nm[0];
                    if (s[(int)i] == t[(int)j])
                    {
                        continue;
                    }
                    else
                    {
                        Console.WriteLine(-1);
                        return;
                    }
                }
            }
            Console.WriteLine(LCM(nm[0], nm[1]));
        }

        static long GCD(long a, long b)
        {
            long c = b;
            do
            {
                c = a % b;
                a = b;
                b = c;
            } while (c > 0);
            return a;
        }

        static long LCM(long a, long b)
        {
            long c = GCD(a, b);
            return a * b / c;
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

int main(void)
{
  unsigned int N;
  unsigned int i, j, k;
  unsigned int num;
  unsigned int data[1000][3];

  scanf("%d", &N);
  for (i = 0; i < N; i++){
    scanf("%d", &data[i][0]);
    scanf("%d", &data[i][1]);
    scanf("%d", &data[i][2]);
 }

  for (i = 0; i < N; i++){
    for (j = 0; j < 3; j++){
      num = 0;
      for (k = 0; k < 3; k++){
	if (k == j) continue;
	num += pow(data[i][k], 2);
      }
      if (num == pow(data[i][j], 2)){
	printf("YES\n");
	break;
      }
    }
    if (j == 3){
      printf("NO\n");
    }
  }

  return 0;
}

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


Measured memory_bytes: 128
S = list(input())
N = len(S)+1
cnt = [0] * N
j = 0
k = 0

for i in range(N-2):
    if S[i] == S[i+1]:
        k += 1
    
    else:
        k += 1
        cnt[j] = k
        j += 1
        k = 0

if S[N-2] == S[N-3]:
    cnt[j] = k + 1
else:
    cnt[j] = 1

ans = 0
if S[0] == "<":
    st = 0
else:
    ans += cnt[0]*(cnt[0]+1)//2
    st = 1

for k in range(st,N,2):
    if cnt[k] != 0:
        m = min(cnt[k],cnt[k+1])
        M = max(cnt[k],cnt[k+1])
        ans += m*(m-1)//2 + M*(M+1)//2 
    else:
        break
print(ans)

Measured memory_bytes: 11440
let n = read_int()

module SS = Set.Make(String)

let rec f i ans set =
  if i = n then ans
  else
    let s = read_line () in
    if SS.mem s set then f (i + 1) ans set
    else f (i + 1) (ans + 1) (SS.add s set)

let () = print_int (f 0 0 SS.empty)


Measured memory_bytes: 29348
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
using namespace std;

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

    vector <int> v(n);
    for(int i = 0; i < n; i ++)
    	cin >> v[i];

    int count = 0;
    for(int i = 1; i < n - 1; i ++)
   	{
   		if(!(v[i] < v[i - 1] && v[i] < v[i + 1]) && !(v[i] > v[i - 1] && v[i] > v[i + 1]))
   			count ++;
   	}

   	cout << count << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define INF 100000000000
#define MAX 200001
#define MOD 1000000007  

int main(){
    int N; 
    int AC = 0;
    int WA = 0;
    int TLE = 0;
    int RE = 0;
    cin >> N;
    for(int i = 0; i < N; i++){
        string s;
        cin >> s;
        if(s == "AC") AC++;
        else if(s == "WA") WA++;
        else if(s == "TLE") TLE++;
        else RE++;
    }
    cout << "AC x " << AC << endl;
    cout << "WA x " << WA << endl;
    cout << "TLE x " << TLE << endl;
    cout << "RE x " << RE << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int dp[200000][2];
int a[200];

int main(){
	int n,K;scanf("%d%d",&n,&K);
	rep(i,n)scanf("%d",&a[i]);
	dp[0][0]=1;dp[0][1]=0;
	for(int i=1;i<=K;i++){
		dp[i][0]=1;dp[i][1]=0;
		rep(j,n){
			if(a[j]<=i){
				if(dp[i-a[j]][1]==0)dp[i][0]=0;
				if(dp[i-a[j]][0]==1)dp[i][1]=1;
			}
		}
	}
	if(dp[K][0]==0)puts("First");
	else puts("Second");
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    string s;
    cin >> s;
    int count = 0;
    REP(i,3){
        if(s[i] == 'o')count++;
    }
    cout << 700 + count * 100 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL << 60)
#define EPS (1e-10)
using namespace std;
typedef long long Int;
typedef pair<int, int> P;

int n, m, u, v;
vector<int> edge[110000];
int memo[110000];
bool done[110000];

int dp(int v) {
  if(done[v])
    return memo[v];
  int ans = 0;
  for(int to: edge[v]) {
    ans = max(ans, dp(to) + 1);
  }
  done[v] = true;
  memo[v] = ans;
  return ans;
}

int main()
{
  cin >> n >> m;
  for(int i = 0; i < m; i++) {
    cin >> u >> v;
    edge[u].push_back(v);
  }
  int ans = 0;
  for (int v = 1; v <= n; v++) {
    ans = max(dp(v), ans);
  }

  cout << ans << endl;

  return 0;
}

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

int main(){
  int n; cin>>n;
  string ans = "No";
  for (int i=1; i<=9;i++){
    for (int j=1; j<=9;j++){
      if (i * j == n) {
        ans = "Yes";
        break;
      }
    }
    if (ans == "Yes") break;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3612
S = list(input())
check = 0
for i in range(len(S)):
  if i % 2 == 0:
    if (S[i] == 'R' or S[i] == 'U' or S[i] == 'D') and len(S) >= 1 and len(S) <= 100:
        check += 1
  elif i % 2 == 1:
    if (S[i] == 'L' or S[i] == 'U' or S[i] == 'D') and len(S) >= 1 and len(S) <= 100:
        check += 1

if check == len(S):
    print('Yes')
else:
    print('No')
        

Measured memory_bytes: 3064
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int c = Integer.parseInt(sc.next());
		int d = Integer.parseInt(sc.next());
		if(Math.abs(a-b)<=d&&Math.abs(b-c)<=d) {
			System.out.println("Yes");
		}else if(Math.abs(c-a)<=d) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n, q; cin >> n >> q;
	string str; cin >> str;
	int sum[n+1];
	sum[0] = 0;
	sum[1] = 0;
	for( int i = 2; i <= n; ++i ){
		sum[i] = sum[i-1];
		if( str[i-2] == 'A' && str[i-1] == 'C' ){
			++sum[i];
		}
	}
	/*
	for( int i = 0; i <= n; ++i ){
		cout << sum[i] << " ";
	}
	cout << endl;
	*/
	for( int i = 0; i < q; ++i ){
		int l, r; cin >> l >> r;
		cout << sum[r] - sum[l] << endl;
	}
	return 0;
}

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

int main(){
    int N, X, Y;
    cin >> N >> X >> Y;
    vector<vector<int>> dp(N+1, vector<int>(N+1));
    for(int i=1;i< N;i++){
        for(int j=i+1;j<=N;j++){
            if (i <= X){
                if(j <= X){
                    dp[i][j] = j-i;
                }else if (j <= Y){
                    dp[i][j] = min(j-i, X-(i-1)+(Y-j));
                }else{
                    dp[i][j] = X-(i-1) + (j-Y);
                }
            }else if (i <= Y){
                if(j <= Y){
                    dp[i][j] = min(j-i, i-X+1+Y-j);
                }else{
                    dp[i][j] = min(j-i, i-X+1+j-Y);
                }
            }else{
                dp[i][j] = j-i;
            }
        }
    }
    vector<int> cnt(N);
    for(int i=1;i<=N;i++){
        for(int j=i+1;j<=N;j++){
            cnt[dp[i][j]]++;
        }
    }
    for(int i=1;i<N;i++) cout << cnt[i] << endl;
}

Measured memory_bytes: 16000
#include<stdio.h>
int main(void)
{
  int i,j,sum[2]={0,0},score;
  for(j=0;j<2;j++)
  {
    for(i=0;i<4;i++)
    {
      scanf("%d",&score);
      sum[j]+=score;
    }
  }
  if(sum[0]>sum[1]) printf("%d\n",sum[0]);
  else printf("%d\n",sum[1]);
  return 0;
}



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

int main() {
  int n;
  cin >> n;
  if (n % 2 != 0) {
    cout << "No" << endl;
    return 0;
  }
  char str[n];
  for (int i = 0; i < n; i++) {
    cin >> str[i];
  }
  bool flag = true;
  for (int i = 0; i < n / 2; i++) {
    if (str[i] != str[i + n / 2]) {
      flag = false;
      break;
    }
  }
  if (flag) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
/* Properties of modulo:
	(a/b)%m ,where m is prime  = (a%m) * (b^(m-2))%m
*/
    /*ROLLING HASH
    Rabin-Karp algorithm for pattern matching in a string in O(n) time
    Calculating the number of different substrings of a string in O(n2logn)
    Calculating the number of palindromic substrings in a string.
    */
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define ll long long
#define pb push_back
#define nl cout<<"\n"
#define endl "\n"
#define all(c) (c).begin(),(c).end()
#define trav(a,x) for(auto a = x.begin() ; a != x.end() ; a++)
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
//template<typename T>
//#define o_set(T) tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
// o_set(ll) name ; -- defining ordered set
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : counting from zero it returns the k-th largest or smallest element in the set - returns iterator
bool compare(ll a, ll b){
    return a > b;
}
inline ll max(ll a,ll b)
{return ((a>b)?a:b);}
inline ll min(ll a,ll b)
{return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b)
{if(b==0) return a;a%=b;return gcd(b,a);}
ll power(ll x, ll ex , ll md) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}
void solve(){
    ll a,  b,c , k;
    cin >> a >> b >> c >> k;
    if(a >= k) cout << k << endl;
    else if(a + b >= k) cout <<a << endl;
    else{
        k = k -a - b;
        cout << a - k << endl;
    }
}
int main(){
    IOS;
    ll T=1;
    //cin>>T;
    ll t=0;
    while(t++<T){
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 3808
#include<bits/stdtr1c++.h>
#include<list>
#include<algorithm>
using namespace std;

int main(){
    int A,B;
    cin >> A >> B;
    if (A == 1){
        A = 14;
    }
    if (B == 1){
        B = 14;
    }
    if (A > B){
        cout <<"Alice" << endl;
    }
    else if (A < B){
        cout << "Bob" << endl;
    }
    else{
        cout << "Draw" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n, k, c;
	scanf("%d %d %d", &n, &k, &c);
	char s[200005];
	scanf("%s", s);
	int i, j;
	int l[200005], r[200005];
	j = 0;
	for (i = 0;j < k; j++)
	{
		while (s[i] == 'x')
			i++;
		l[j] = i;
		i += c + 1;
	}
	j = k - 1;
	for (i = n - 1; j >= 0; j--)
	{
		while (s[i] == 'x')
			i--;
		r[j] = i;
		i -= c + 1;
	}
	for (i = 0; i < k; i++)
		if (l[i] == r[i])
			printf("%d\n", l[i] + 1);
	return 0;
}


Measured memory_bytes: 3200
N = int(input())
A = list(map(int,input().split()))
for i in range(N):
    if A[i]%2 == 0:
        if A[i]%3 == 0 or A[i]%5 == 0:
            pass
        else:
            print("DENIED")
            break
else:
    print("APPROVED")

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

signed main(){
	int N,W; cin>>N>>W;
	vector<vector<int>> dp(100+10,vector<int>(100000+100,0));
	int w[N],v[N];
	for(int i=0;i<N;i++)cin>>w[i]>>v[i];
	for(int i=0;i<N;i++){
		for(int j=0;j<=W;j++){
			if(j+w[i]<=W){
				dp[i+1][j+w[i]]=max(dp[i][j]+v[i],dp[i+1][j+w[i]]);
			}
			dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
		}
	}
	cout<<dp[N][W]<<endl;
}

Measured memory_bytes: 87296
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		int y=sc.nextInt();
		int a=Math.max(x,y);
		int b=Math.min(x,y);
		System.out.println(gcd(a,b));
	}
	static int gcd(int a, int b){
		int r;
		while(b>0){
			r=a%b;
			a=b;
			b=r;
		}
		return a;
	}

}

Measured memory_bytes: 26332
#include<bits/stdc++.h>
#define N 2005
using namespace std;
 
int n,m,cnt,s[N][N],s1[N][N],s2[N][N];
char a[N][N];
int calc(int s[][N],int x1,int y1,int x2,int y2){
	if (x1>x2 || y1>y2) return 0;
	return s[x2][y2]-s[x1-1][y2]-s[x2][y1-1]+s[x1-1][y1-1];
}
int main(){
	scanf("%d%d%d",&m,&n,&cnt);
	int i,j;
	for (i=1; i<=m; i++) scanf("%s",a[i]+1);
	for (i=1; i<=m; i++)
		for (j=1; j<=n; j++){
			s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+(a[i][j]=='1');
			s1[i][j]=s1[i-1][j]+s1[i][j-1]-s1[i-1][j-1]+(a[i][j]=='1' && j<n && a[i][j+1]=='1');
			s2[i][j]=s2[i-1][j]+s2[i][j-1]-s2[i-1][j-1]+(a[i][j]=='1' && i<m && a[i+1][j]=='1');
		}
	while (cnt--){
		int x1,x2,y1,y2; scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		printf("%d\n",calc(s,x1,y1,x2,y2)-calc(s1,x1,y1,x2,y2-1)-calc(s2,x1,y1,x2-1,y2));
	}
	return 0;
}


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

int main(){
    string s="Hello World";
    int n,a,b;
    cin>>n>>a>>b;
    if(n==1){
        cout<<s<<endl;
    }
    else if(n==2){
        cout<<a+b<<endl;
    }
    else{}
    return 0;
}


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

int main() {
  string S,T;
  cin >> S >> T;
  int i=0;
  for (int j=0 ; j<3 ; j++){
    if (S.at(j)==T.at(j))
    i++;
  }
 cout << i << endl; 
}


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

#include <vector>

#include <algorithm>

using namespace std;

#define repeat(n) for(int _ = 1; _ <= (n); _++)

int main()
{
	ios::sync_with_stdio(false);
#ifdef CAI_WEI_HAN
	freopen("test.in", "r", stdin);
#endif
	
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	
	cout << (a-c) * (b-d);
}


Measured memory_bytes: 256