akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll s ; cin >> s ;
	ll v = 1000000000 ;
	ll x = (v-s%v)%v ;
	ll y = (s+x)/v ;
	cout << "0 0 1000000000 1 " << x << " " << y << endl ;
}


Measured memory_bytes: 384
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


N = int(input())
G = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(lambda x: int(x)-1, input().split())
    G[a].append(b)
    G[b].append(a)


def dfs(v, dist):
    for u in G[v]:
        if dist[u] != -1:
            continue
        dist[u] = dist[v] + 1
        ret = dfs(u, dist)


dist_fen = [-1] * N
dist_fen[0] = 0
dfs(0, dist_fen)

dist_snu = [-1] * N
dist_snu[N-1] = 0
dfs(N-1, dist_snu)

fen = 0
for v in range(N):
    if dist_fen[v] <= dist_snu[v]:
        fen += 1
if fen > N // 2:
    print('Fennec')
else:
    print('Snuke')


Measured memory_bytes: 203696
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <utility>
using namespace std;

unsigned long long f(unsigned long long x, unsigned long long y){
  if(x % y == 0){ return x; }
  else if(y % x == 0){ return y; }
  else{
  unsigned long long z;
  z = __gcd(x, y);
  unsigned long long c;
  c = (x / z) * y;
  return c;
  }
}

int main(){ 
  int n;
  cin >> n;
  unsigned long long res = 1;
  vector<unsigned long long> v(n, 0);
  for(int i = 0; i < n; i++){
    cin >> v[i];
  }
  unsigned long long k = v[0];
  for(int i = 1; i < n; i++){
    k = f(k, v[i]);
  }
  cout << k << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	int n;
	cin>>n;
	if(!(n%1000)) cout<<0<<endl;
	else cout<<1000-n%1000<<endl;
	return 0;
}

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

/*		
for k == 1, just number of cards
for k == 2, we choose one from current maximum and one from next maximum?

if the maxcnt > n/k, then we will have dup
else we maintain the invariant that maxcnt <= n/k, easy

the question now is how to keep this maxcnt
all # > n/k just don't exist?
if we sort cnt's
keep pointer such that all on this and to the left
*/

int main(){
	int n;	
	scanf("%d", &n);
	int a[n + 1] = {};
	for(int i = 0;i < n; ++i){
		int x;
		scanf("%d",&x);
		++a[x];
	}
	vector<int> v;
	for(int i = 1;i <= n; ++i){
		if(a[i] != 0){
			v.push_back(a[i]);
		}
	}
	sort(v.begin(), v.end());
	int sz = v.size();
	int sum = n;
	for(int i = 1;i <= n; ++i){
		while(v.back() > sum/i){
			int ptr = v.size();
			int sub = 0;
			while(ptr && v[ptr-1] > sum/i){
				--v[--ptr];
				++sub;
			}
			sum-=sub;
		}
		cout << sum/i << '\n';
	}
}


Measured memory_bytes: 3572
import math

NS = [int(_) for _ in input().split()]
N = NS[0] # 偶数
M = NS[1] # 奇数

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def solve(N, M):
    # 全部の組み合わせ - 奇数になる組み合わせ
    return combinations_count(N+M, 2) - M * N

print(solve(N, M))

Measured memory_bytes: 3060
import java.math.*;
import java.util.*;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			int h = sc.nextInt();
			int n = sc.nextInt();
			int sum = 0;
			
			for (int i=0;i<n;i++) {
				sum+=sc.nextInt();
			}
			
			if(h>sum) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
		}

	}

Measured memory_bytes: 47304
#define Z(x)r=x[j],x[j]=x[j+1],x[j+1]=r
h[201],w[201],d[201];main(n,i,j,r){for(;scanf("%d",&n),n;printf("%d\n",r)){
for(i=0;i<n;i++)scanf("%d%d",h+i,w+i);
for(scanf("%d",&r),n+=r;i<n;i++)scanf("%d%d",h+i,w+i);
for(i=0;i<n-1;i++)for(j=0;j<n-i-1;j++)if(h[j]>h[j+1])Z(h),Z(w);
for(memset(d,0,sizeof(d)),r=i=0;i<n;r=r>d[i]?r:d[i],i++)for(d[i]=1,j=0;j<i;j++)if(h[j]<h[i]&&w[j]<w[i])d[i]=d[j]>=d[i]?d[j]+1:d[i];
}exit(0);}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 4611686018427387903;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

const int w=13;
const int k=300;
const int n=26;
int d;

VI c(n);
VVI s(365,VI(n));

struct st{
	VI a;
	ll score;
	bool operator<(const st &another) const {return score < another.score;};
};

vector<st> f(st p){
	VI a=p.a; ll score=p.score;
	int now=a.size()+1;
	VI last(n,0);
	REP(i,a.size())
		last[a[i]]=i+1;
	VI down(n); ll downsum=0;
	REP(i,n){
		down[i]=c[i]*(now-last[i]);
		downsum+=down[i];
	}
	a.push_back(-1);
	vector<st> tmp;
	REP(i,n){
		a[now-1]=i;
		tmp.push_back({a,score-downsum+down[i]+s[now-1][i]});
	}
	sort(ALL(tmp));
	vector<st> ret;
	REP(i,w)
		ret.push_back(tmp[n-1-i]);
	return ret;
}


int main(){
	cin >> d;
	REP(i,n) cin >> c[i];
	REP(i,d)REP(j,n) cin >> s[i][j];
	priority_queue<st> q;
	VI a(0);
	q.push({a,0});
	REP(i,d){
		priority_queue<st> next;
		REP(j,k){
			if(q.empty())
				break;
			for(auto nx:f(q.top()))
				next.push(nx);
			q.pop();
		}
		q=next;
	}
	REP(i,d)
		cout << q.top().a[i]+1 << endl;
	return 0;
}

Measured memory_bytes: 30560
<?php

$input_line = "";
while (($buffer = fgets(STDIN)) !== false) {
    $input_line.= $buffer;
}

$input_line = trim($input_line);
$input_array =  explode("\n", $input_line);
preg_match("/([0-9]+)/", array_shift($input_array), $number);

$left_students_info = explode(" ", array_shift($input_array));
$answer = [];
foreach ($left_students_info as $idx1 => $val1) {
    $answer[(int) $val1] =  $idx1 + 1;
}
ksort($answer);
echo implode(" ", $answer);

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

int main(){
    int a,b;
    cin>>a>>b;
    int count = 1;

    if(b==1){
        cout<<0<<endl;
    }else{
    while(1){
        if(b-a-(a-1)*(count-1)<=0){
            break;
        }
        count++;
    }
    cout<<count<<endl;
    }
    return 0;
}


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

    int match_count(string s, vector<string> &strs) {
      int count = 0;
      for(int i=0;i<strs.size();i++) {
        if (s == strs.at(i)) {
          count++;
        }
      }
      return count;
    }

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

      vector<string> blue(n, "");
      vector<string> checked(0);                                                                                                                                                    
      for(int i=0;i<n;i++) {
        cin >> blue.at(i);
      }

      cin >> m ;
      vector<string> red(m, "");
      for(int i=0;i<m;i++) {
        cin >> red.at(i);
      }

      int max = 0;
      for(int i=0;i<n;i++) {
        bool found = false;
        for(int j=0;j<checked.size();j++) {
          if (blue.at(i) == checked.at(j)) {
            found = true;
            break;
          }
        }
        if (found) continue;
        checked.push_back(blue.at(i));
        int plus = match_count(blue.at(i), blue);
        int minus = match_count(blue.at(i), red);
        if (plus - minus > max) {
          max = plus - minus;
        }
      }
      cout << max << endl;
    }



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s; cin>>s;
    int n=s.size();
    int K; cin>>K;
    vector <string> d;
    for(int i=0;i<n;i++){
        
            for(int k=1;k<min(5,n)+1;k++){
                string tmp= s.substr(i,k);
                bool ok=true;
                for(int z=0;z<d.size();z++){
                    if(d[z]==tmp) ok=false;
               }
                if(ok) d.push_back(tmp);
               // if(ok) cout<<tmp<<endl;
            }
        
    }
    sort(d.begin(),d.end());
    //d.erase(unique(d.begin(),d.end()));
    cout<<d[K-1]<<endl;
}

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

int main() {
  // reading
  int S1, S2, S3;
  double x;
  
  cin >> x;

  // counting
  S1 = x / 100;
  S2 = x / 10 - S1 * 10;
  S3 = x - S1 * 100 - S2 * 10;
  cout << S1 + S2 + S3 << endl;
}

Measured memory_bytes: 256
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


x, n = LI()
p = LI()
if n == 0:
    print(x)
    sys.exit()

ans = 10000
for i in range(-1, 102):
    if abs(x - i) < abs(x - ans) and i not in p:
        ans = i
print(ans)


Measured memory_bytes: 9212
""" tutorial05
    https://atcoder.jp/contests/abc095/tasks/arc096_a
"""
import sys
import math
from functools import reduce

def readStringSet(n):
    return sys.stdin.readline().split(" ")[:n]

def readIntegerSet(n):
    return list(map(int, readStringSet(n)))

def main(A, B, C, X, Y):
    """ main
    """
    if A + B > 2 * C:
        result = min([X, Y]) * 2 * C

        if X > Y:
            if A > 2 * C:
                return result + (X - Y) * 2 * C
            else:
                return result + (X - Y) * A
        else:
            if B > 2 * C:
                return result + (Y - X) * 2 * C
            else:
                return result + (Y - X) * B
    else:
        return X * A + Y * B

if __name__ == "__main__":
    _A, _B, _C, _X, _Y = readIntegerSet(5)

    print(main(_A, _B, _C, _X, _Y))

Measured memory_bytes: 9576
/*
    Vishal Raj
    IIT Kharagpur
*/

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,l,r) for( int i = l; i < r; i++ )

int n,m;
vector<vector<int>> alist;
vector<vector<int>> parent;
vector<int> visited;
vector<int> tsort;

void dfs( int u ) {
    visited[u] = 1;
    FOR(i,0,alist[u].size()) {
        int v = alist[u][i];
        if( !visited[v] ) {
            dfs(v);
        }
    }
    tsort.push_back(u);
}

int main() {
    cin>>n>>m;
    int dp[n+1];
    memset(dp,0,sizeof(dp));
    alist.assign(n+1,vector<int>());
    parent.assign(n+1,vector<int>());
    visited.assign(n+1,0);
    FOR(i,0,m) {
        int u,v;
        cin>>u>>v;
        alist[u].push_back(v);
        parent[v].push_back(u);
    }
    FOR(i,1,n+1) {
        if( !visited[i] ) {
            dfs(i);
        }
    }
    FOR(i,0,tsort.size()) {
        int u = tsort[i];
        FOR(j,0,parent[u].size()) {
            int v = parent[u][j];
            dp[v] = max(dp[v],dp[u]+1);
        }
    }
    int ans = 0;
    FOR(i,1,n+1) ans = max(ans,dp[i]);
    cout<<ans<<"\n";
}


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

int main() {
  string a,b;
  cin >> a >> b;
  if(a.size() > b.size()){
    cout << "GREATER" << endl;
    return 0;
  }
  if(a.size() < b.size()){
    cout << "LESS" << endl;
    return 0;
  }
  for(int i = 0;i < a.size();i++){
    if(a[i] > b[i]){
      cout << "GREATER" << endl;
      return 0;
    }
    if(a[i] < b[i]){
      cout << "LESS" << endl;
      return 0;
    }
  }
  cout << "EQUAL" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solveA();
		// new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			if (numN % 2 == 0) {
				System.out.println(numN);
			} else {
				System.out.println(numN * 2);
			}

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 23636
#include <stdio.h>
int n,k,x[100005],cur,ret;
int main(){
for(;;){
	ret=-2000000000;cur=0;
	scanf("%d%d",&n,&k);if(!n)return 0;
	for(int i=0;i<n;i++){
		scanf("%d",&x[i]);
		cur+=x[i];
		if(i>=k) cur-=x[i-k];
		if(i>=k-1&&ret<cur) ret=cur;
	}
	printf("%d\n",ret);
}
}

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

int main() {
  long long int N, A, B, sho,amari;
  cin >> N >> A >> B;

  sho=N/(A+B);
  amari =N%(A+B);
  if(amari-A>=0) amari=A;
  cout << A*sho + amari << endl;
}


Measured memory_bytes: 256
n,x=map(int,input().split())
p=[1]
a=[1]
for i in range(0,n):
  p.append(p[i]*2+1)
  a.append(a[i]*2+3)
def f(n,x):
  if n==0 and x<=0:
    return 0
  elif n==0:
    return 1
  elif x<=1+a[n-1]:
    return f(n-1,x-1)
  else:
    return p[n-1]+f(n-1,x-a[n-1]-2)+1
print(f(n,x))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template

//main
signed main(){
  int N;cin>>N;
  typedef pair<int,int> P;
  std::vector<P> edge[N];
  for(int i=0;i<N-1;i++){
    int u,v,w;cin>>u>>v>>w;u--;v--;w%=2;
    edge[u].push_back(P(v,w));
    edge[v].push_back(P(u,w));
  }
  std::vector<int> color(N,-1);
  color[0]=0;
  queue<int> que;
  que.push(0);
  while(que.size()){
    int p=que.front();que.pop();
    for(auto q:edge[p]){
      if(color[q.first]!=-1)continue;
      color[q.first]=(color[p]+q.second)%2;
      que.push(q.first);
    }
  }
  for(int i=0;i<N;i++)cout<<color[i]<<endl;
}


Measured memory_bytes: 8704
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONG_INF 1000000000
int main() {
	string ans[4] = { "maerd","remaerd","esare","resare" };
	string s;
	cin >> s;
	for (int i = s.length()-1;i >= 0;--i) {
		for (int q = 0;q < 4;++q) {
			int hoge = i - ans[q].length();
			if (hoge >= -1) {
				for (int j = 0;j < ans[q].length();++j) {
					if (ans[q][j] != s[i - j]) goto omg;
				}
				i -= ans[q].length()-1;
				goto ok;
			}
		omg:;
		}
		cout << "NO" << endl;
		return 0;
	ok:;
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
char s[4] = {'R', 'L', 'U','D'};
char t[4] = {'L', 'R', 'D', 'U'};
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, -1, 1};

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W; cin >> H >>W;
    int N; cin >> N;
    int sx, sy; cin >> sy >> sx;
    string S; cin >> S;
    string T; cin >> T;
    int X[4] = {sx, sx, sx, sx};
    int Y[4] = {sy, sy, sy, sy};
    rep(i, 4) {
        rep(j, N) {
            
            if (S[j] ==  s[i]) X[i] += dx[i];
            if (S[j] ==  s[i]) Y[i] += dy[i];
            if (i == 0 && X[i] > W) {
                cout << "NO" << endl;
                return 0;
            }
            if (i == 1 && X[i] <= 0) {
                cout << "NO" << endl;
                return 0;
            }
            if (i == 2 && Y[i] <= 0) {
                cout << "NO" << endl;
                return 0;
            }
            if (i == 3 && Y[i] > H) {
                cout << "NO" << endl;
                return 0;
            }
            //cout << i << " " << X[i] << " " << Y[i] << endl;
            if (T[j] == t[i] && !(X[i] - dx[i] <= 0 || X[i] - dx[i] > W)) X[i] -= dx[i];
            if (T[j] == t[i] && !(Y[i] - dy[i] <= 0 || Y[i] - dy[i] > H)) Y[i] -= dy[i];
        }
    }
    cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 920
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

constexpr long long LLINF = 1e18 + 1;

int main() {
    int n; cin >> n;
    vector<ll> a(n),b(n+1,0);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        b[i + 1] = b[i] + a[i];
    }
    ll ans = LLINF;
    for (int i = 0; i < n; i++) {
        ans = min(ans, abs(b[n] - b[i] - b[i]));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include <algorithm>
#include <functional>

using namespace std;

int main (void){
    int H,A,K;
    cin >> H;
    cin >> A;
    K = H / A;
    if(H%A != 0){
        K++;
    }
    cout << K;
    return 0; 
}

Measured memory_bytes: 256
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt
from fractions import gcd

def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

def mulinputs():
    return map(int,input().split())

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas



N, M = mulinputs()

# 出力
if N == M:
    print('Yes')
else:
    print('No')




Measured memory_bytes: 5816
#include <bits/stdc++.h>
#define MAX (ll)(2e2 + 7)
#define INF (ll)(5e5 + 7)
#define MOD (ll)(1e9 + 7)

using namespace std;
using ll = long long;
using cd = complex<double>;

int main () {
	int n;
	cin >> n;
	int ar[n];
	for (int i = 0; i < n; i++) {
		cin >> ar[i];
	}
	sort (ar, ar + n);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++)  {
			for (int k = j + 1; k < n; k++) {
				if (ar[i] + ar[j] > ar[k] && ar[i] != ar[j] && ar[j] != ar[k]) {
					ans++;
				}
			}
		}
	}
	cout << ans << "\n";
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define forn(x, n)              for (int x = 0; x < n; x++)
#define forr(x, n)              for (int x = n; x >= 0; x--)
#define fore(x, a, b, c)        for (int x = a; x <= b; x += c)
#define forre(x, a, b, c)       for (int x = a; x >= b; x -= c)
#define clr                     cin.ignore(numeric_limits<streamsize>::max(), '\n')
#define all(container)          (container).begin(), (container).end()
#define rall(container)         (container).rbegin(), (container).rend()
#define tracev(v)               for (auto& x: v) cerr << x << " "; cerr << '\n';
#define trace2v(v)              for (auto& x: v) cerr << x.fi << " - " << x.se << '\n'; cerr << '\n';
#define FILL(x, val)            memset(x, val, sizeof(x))
#define pb                      push_back
#define eb                      emplace_back
#define fi                      first
#define se                      second
#define mod                     (int)1000000007
#define INF                     (int)0x3f3f3f3f

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }  

typedef long long ll; 
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifndef ONLINE_JUDGE
    freopen("errlog", "w", stderr);
#endif
    int n, m; cin >> n >> m;
    int cnt[n];
    memset(cnt, 0, sizeof(cnt));
    forn(i, m) {
        int a, b; cin >> a >> b;
        --a; --b;
        cnt[a]++;
        cnt[b]++;
    }
    forn(i, n) cout << cnt[i] << '\n';
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>

//#include<bits/stdc++.h>




using namespace std;
int main() {

	int a, b;
	cin >> a >> b;
	if (a % 2 && b % 2)cout << "Odd" << endl;
	else cout << "Even" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int N;
int C[20],V[20];

int main(){
  cin >> N;
  for(int n = 0;n < N;n++)cin >> V[n];
  for(int n = 0;n < N;n++)cin >> C[n];
  int ans = 0;
  for(int n = 0;n < N;n++){
    if(V[n]-C[n] > 0)ans += V[n]-C[n];
  }
  cout << ans << endl;
  return 0;
}

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

public class BinarySearch{
	public static void Main()
	{
		Console.ReadLine();
		var sList = ReadLineAndToIntList();
		Console.ReadLine();
		var tList = ReadLineAndToIntList();
	
		int count = 0;
	
//		tList.ForEach(t =>
//		{
//			if(sList.BinarySearch(t) > -1) count++;
//		});
		
		count = tList.Count (l => sList.BinarySearch(l) > -1 );
		
		Console.WriteLine(count);
	}
	
	//??????????????????????????????
	public static List<int> ReadLineAndToIntList()
	{
		return Console.ReadLine().Split().Select (c => int.Parse(c)).ToList();
	}
}

Measured memory_bytes: 15740
using System;
using System.Collections.Generic;
public class ABC130B {
    public static void Main() {
        int N, X, D = 0, ans = 0;
        List<int> L = new List<int>();
        string[] str = System.Console.ReadLine().Split(' ');
        N = int.Parse(str[0]);
        X = int.Parse(str[1]);
        str = System.Console.ReadLine().Split(' ');
        for (int i = 0; i < N; i++) {
            L.Add(int.Parse(str[i]));
        }
        int j = 0;
        while (D <= X) {
            ans++;
            if (j == L.Count) break;
            D += L[j];
            j++;
        }

        System.Console.WriteLine(ans);
    }
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++)
#define repr(i, n) for(int i = n-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define lint long long

int main(){
    int n, m; cin >> n >> m;
    vector<pair<int, int>> claim;
    rep(i, m){
        int a, b; cin >> a >> b;
        claim.push_back(make_pair(b, a));
    }
    sort(all(claim));
    int ans = 0;
    int cut = 1e5 + 5;
    for(auto& c : claim){
        if(c.second > cut || cut >= c.first){
            ans++;
            cut = c.first - 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define DL double
#define MLL map<LL,LL>::iterator
#define MSL map<string,L>::iterator
#define MLS map<LL,string>::iterator
#define MSS map<string,string>::iterator
#define MCL map<char,LL>::iterator
#define SL set<LL>::iterator
#define SS set<string>::iterator
#define VL V<LL>::iterator
#define G getline
#define SZ size()
#define IN insert
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define MAX 1e18
#define MIN -1e18
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
V<LL>v;
map<LL,LL>u;
int main()
{
    LL n,m,i,j,k,p,q,o,l,s,t,z=0,r;
    string a;
   cin>>n>>m>>o;
   k=-m+o;
   if(k<=0)
   {
       cout<<"delicious"<<endl;
   }
   else if(k>0 && n>=k)
   {
       cout<<"safe"<<endl;
   }
   else
   {
       cout<<"dangerous"<<endl;
   }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	set <int> snuke;
	int n, k;
	cin >> n >> k;
	for(int i = 0; i < k; i++){
		int a;
		cin >> a;
		for(int j = 0; j < a; j++){
			int s;
			cin >> s;
			snuke.insert(s);
		}
	}
	cout << n - snuke.size();
}

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

int main(){
  while(1){
    int a, b;
    string op;
    cin>>a>>op>>b;

    int ans;
    if(op == "+") ans = a + b;
    if(op == "-") ans = a - b;
    if(op == "*") ans = a * b;
    if(op == "/") ans = a / b;
    if(op == "?") break;

    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3112
import sys
import heapq

input = sys.stdin.readline
N, C = map(int, input().split())
stc = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
tmp = [[] for _ in range(C)]
for s, t, c in stc:
    if len(tmp[c - 1]) != 0 and tmp[c - 1][-1][1] == s:
        tmp[c - 1][-1][1] = t
    else:
        tmp[c - 1].append([s, t, c])
stc_clean = []
for e in tmp:
    stc_clean += e
stc_clean = sorted(stc_clean, key=lambda x: x[0])

hq = []
heapq.heapify(hq)

ans = 0
for s, t, _ in stc_clean:
    while len(hq) > 0 and hq[0][0] < s:
        heapq.heappop(hq)
    heapq.heappush(hq, (t, s, c))
    ans = max(ans, len(hq))
print(ans)


Measured memory_bytes: 109280
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cmath>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<iomanip>
#include<utility>
using namespace std;
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define rg register
#define il inline
#define lch(x) ((x)<<1)
#define rch(x) ((x)<<1^1)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define rep0(i,n) for(register int i=0;i<(n);++i)
#define per0(i,n) for(register int i=(n)-1;i>=0;--i)
#define rep(i,st,ed) for(register int i=(st);i<=(ed);++i)
#define per(i,ed,st) for(register int i=(ed);i>=(st);--i)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double dbl;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> il T qmin(const T &a,const T &b){return a<b?a:b;}
template<typename T> il T qmax(const T &a,const T &b){return a>b?a:b;}
template<typename T> il void getmin(T &a,const T &b){if(a>b) a=b;}
template<typename T> il void getmax(T &a,const T &b){if(a<b) a=b;}
il void fileio(string s){
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

const int inf=(int)1e9+7;
const ll linf=(ll)1e17+7;
const int N=1e5+7;

int a[N],n,m;
bool can[N];

int main(){
	scanf("%d%d",&n,&m);
	rep(i,1,n) a[i]=1;
	can[1]=true;
	while(m--){
		int x,y;
		scanf("%d%d",&x,&y);
		if(!a[x]) continue;
		if(can[x]){
			if(a[x]==1) can[x]=false;
			can[y]=true;
		}
		--a[x],++a[y];
	}
	int ans=0;
	rep(i,1,n) ans+=can[i];
	printf("%d\n",ans); 
	return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    string T;
    cin >> T;
    for (int i = 0; i < T.size(); ++i) {
        if (T[i] == '?') T[i] = 'D';
    }
    cout << T << endl;
    return 0;
}


Measured memory_bytes: 3784
import sys
import math


def is_prime(N):
    if N == 1:
        return False
    i = 2
    while i * i <= N:
        if N % i == 0:
            return False
        i += 1
    return True

def prime(N):
    prime = []
    is_prime = []  # 全て素数であると初期化
    for i in range(N):
        if i * i > N:
            break
        is_prime.append(True)
    is_prime[0] = is_prime[1] = False # 0,1は素数ではない
    n = len(is_prime)
    for i in range(2, n):
        if is_prime[i]:
            # iは素数である
            prime.append(i)
            for j in range(2 * i, n, i):
                # iの倍数は素数でない
                is_prime[j] = False
    # N以下の素数を表示
    return prime, n

def main():
    N = int(input())
    if N == 1:
        print(0)
    else:
        if is_prime(N):
            print(1)
        else:
            prime_list, n = prime(N)
            used = []
            prime_exponentiation = []
            count = 0
            for i in range(len(prime_list)):
                now = prime_list[i]
                j = 1
                while now ** j <= N:
                    prime_exponentiation.append(now ** j)
                    j += 1
            prime_exponentiation.sort()
            for i in range(len(prime_exponentiation)):
                now = prime_exponentiation[i]
                if N < now:
                    j = 0
                    while not is_prime(N):
                        if N == 1:
                            break
                        while N % prime_list[j] == 0:
                            N //= prime_list[j]
                        j += 1 
                    break
                if N % now == 0:
                    count += 1
                    used.append(now)
                    N //= now
            if N not in used and N != 1:
                count += 1
            print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 19928
#include<bits/stdc++.h>
using namespace std;
#define N 1111116

int n,a[N],cnt;
char s[N];

int main(){
	scanf("%s",s);n=strlen(s);
	for (int i=0;i<n;i++) a[i]=9*(s[n-1-i]-'0');
	for (int i=0;i<n;i++) a[i+1]+=a[i]/10,a[i]%=10;
	for (int i=0;i<=n;i++) cnt+=a[i];
	for (int t=1;;t++){
		a[0]+=9;cnt+=9;
		for (int i=0;a[i]>=10;i++)
			a[i+1]++,a[i]-=10,cnt-=9;
		if (cnt<=9*t) {printf("%d\n",t);return 0;}
	}
	return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define MODB 998244353
#define INF 9223372036854775807
signed main()
{
  int x=0,y=0,z=0,w=0,n=0,m=0;
  string s;
  std::cin >> s;
  if(s=="SUN")z=7;
  else if(s=="MON")z=6;
  else if(s=="TUE")z=5;
  else if(s=="WED")z=4;
  else if(s=="THU")z=3;
  else if(s=="FRI")z=2;
  else if(s=="SAT")z=1;
  std::cout << z << '\n';
}


Measured memory_bytes: 256
import math

a, b, h, m = map(int, input().split())
theta_a = (h % 12) * 30 + 0.5 * m
theta_b = 6 * m
theta = theta_a - theta_b
if theta > 180:
    theta = 360 - theta

c = math.sqrt(a * a + b * b - 2 * a * b * math.cos(math.radians(theta)))
print(c)


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

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)

int main(void){
  int n;
  cin>>n;
  int a1,a2,a3,a4,a5,a6,a7,a8,a9,a0;
  a9=n/1000000000;
  a8=(n%1000000000)/100000000;
  a7=(n%100000000)/10000000;
  a6=(n%10000000)/1000000;
  a5=(n%1000000)/100000;
  a4=(n%100000)/10000;
  a3=(n%10000)/1000;
  a2=(n%1000)/100;
  a1=(n%100)/10;
  a0=(n%10);
  

  if(n%(a0+a1+a2+a3+a4+a5+a6+a7+a8+a9)==0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;



return 0;}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int k, n;
  cin >> k >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int mx = 0;
  for (int i = 0; i < n - 1; i++) mx = max(mx, a[i + 1] - a[i]);
  mx = max(a[0] + k - a[n - 1], mx);
  cout << k - mx << endl;
  return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    string N_str;
    cin >> N_str;
    int n = N_str.length();

    vector<int> N(n, 0);
    rep(i,n) N[i] = N_str[n - 1 - i] - '0';

    vector<vector<int>> dp(n + 1, vector<int>(2, INF));
    dp[0][0] = 0;

    rep(i,n) rep(j,2) {
        N[i] += j;
        rep(A,10) {
            int p = i + 1, q = 0;
            int B = A - N[i];
            if (B < 0) {
                q = 1;
                B += 10;
            }
            dp[p][q] = min(dp[p][q], dp[i][j] + A + B);
        }
        N[i] -= j;
    }

    cout << min(dp[n][0], dp[n][1] + 1) << endl;
    
    return 0;
}

Measured memory_bytes: 59780
s = input()
s1 = s[0:2]
s2 = s[2:4]
if 0 <= int(s1) <= 99 and 1 <= int(s2) <= 12:
    flag_YYMM = True
else:
    flag_YYMM = False
if 0 <= int(s2) <= 99 and 1 <= int(s1) <= 12:
    flag_MMYY = True
else:
    flag_MMYY = False
if flag_YYMM == True and flag_MMYY == True:
    print("AMBIGUOUS")
elif flag_YYMM == True and flag_MMYY == False:
    print("YYMM")
elif flag_YYMM == False and flag_MMYY == True:
    print("MMYY")
else:
    print("NA")

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)

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

    int N,T;
    cin >> N >> T;
    int t[N];
    rep(i,0,N) scanf("%d", &t[i]);
    
    long long ans = 0;
    rep(i,1,N) ans += min(T, t[i]-t[i-1]);
    ans += T;
    
    cout << ans;

    return 0;
}


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

public class Main {
  Scanner sc;
  int INF = 1 << 28;

  int compare(int v1, int h1, int v2, int h2) {
    if ( v1 < v2 ) {
      return 1;
    } else if ( v1 > v2 ) {
      return -1;
    } else {
      if ( h1 < h2 ) {
        return 1;
      } else if ( h1 > h2 ) {
        return -1;
      } else {
        return 0;
      }
    }
  }

  void run() {
    for ( ;; ) {
      int h = ni();
      int w = ni();

      if ( ( h | w ) == 0 )
        break;

      int min = INF;
      int minh = INF;
      int minw = INF;

      int trg = h * h + w * w;
      // debug(trg);
      for ( int i = 1; i <= 150; ++i ) {
        for ( int j = i + 1; j <= 150; ++j ) {
          int v = i * i + j * j;

          // debug(i, j, v);
          if ( compare( trg, h, v, i ) > 0 ) {
            if ( compare( min, minh, v, i ) < 0 ) {
              min = v;
              minh = i;
              minw = j;
            }
          }
        }
      }

      System.out.println( minh + " " + minw );
    }
  }

  Main() {
    sc = new Scanner( System.in );
  }

  int ni() {
    return sc.nextInt();
  }

  public static void main(String[] args) {
    new Main().run();
  }

  void debug(Object... os) {
    System.err.println( Arrays.deepToString( os ) );
  }
}

Measured memory_bytes: 20380
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i = a ; i < (int)n ; i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define eps 1e-14
#define INF 1e9
#define m0(x) memset(x, 0, sizeof(x))

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

signed main(){
  string a;

  cin >> a;
  //cout << a.size() - 2 << endl;
  string s = a.substr(0, a.size()-2);
  //cout << "s:" << s << endl;

  int ans = -1;
  while(s.size()){
    string s1 = s.substr(0, s.size() / 2);
    string s2 = s.substr(s.size()/2, s.size()/2);
    //cout << s1 << " " << s2 << endl;
    int cnt = 0;
    while(s1[cnt] == s2[cnt] && cnt < (int)s1.size()) cnt++;
    
    //cout << "cnt:" << cnt << endl;
    ans = max(ans, cnt);

    s = s.substr(0, s.size() - 2);
    if(s.size() <= 2) break;
  }

  cout << ans*2 << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <time.h>
#include <queue>
#include <string.h>
#define sf scanf
#define pf printf
#define lf double
#define ll long long
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
#define LL long long
#define eps 1e-6
using namespace std;


int main(){
	ll n;
	sld(n);
	ll sum = 0;
	for(int i = 1; i <= n; i ++){
		sum += i;
	} 
	pld(sum) pn
    return 0;
}

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

int main() {
	int N;
	cin >> N;
	
	int K;
	cin >> K;
	
	int l[N];
	for(int i=0; i<N; i++){
		cin >> l[i];
	}
	sort(l,l+N);
	
	int sum=0;
	for(int i=N-1;i>N-1-K;i--){
		sum+=l[i];	
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
use std::io;

fn main() {
    let nums = read_line();
    let n = nums[0];
    let a = nums[1];
    let b = nums[2];

    let mut sum = 0;

    for i in 1..(n+1) {
        let digit_sum = digit_sum(i);
        if digit_sum >= a && digit_sum <= b {
            sum += i;
        }
    }

    println!("{}", sum);
}

fn digit_sum(x: i32) -> i32 {
    if x < 10 {
        x
    } else {
        digit_num(x) + digit_sum(x/10)
    }
}

fn digit_num(x: i32) -> i32 {
    x - (x / 10) * 10
}

fn read_line() -> Vec<i32> {

    let mut input_str = String::new();
    io::stdin().read_line(&mut input_str)
        .expect("Failed to read line")
        ;

    let vec: Vec<&str> = input_str.split(" ").collect();

    let mut int_vec: Vec<i32> = Vec::new();
    for v in vec {
        let input_num: i32 = match v.trim().parse() {
            Ok(num) => num ,
            Err(_)  => panic!("input wrong number."),
        };

        int_vec.push(input_num);
    }

    let int_vec = int_vec;
    int_vec
}


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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;


int main() {
    int x, y;
    cin >> x >> y;

    if (x == 2 || y == 2) {
        cout << "No" << endl;
        return 0;
    }
    if (x == 4 || x == 6 || x == 9 || x == 11) {
        if (y == 4 || y == 6 || y == 9 || y == 11) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        if (x == 2) {
            cout << "No" << endl;
            return 0;
        }
        if (y == 4 || y == 6 || y == 9 || y == 11) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }

    }
}


Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define ll long long
#define P pair<int, int>

using namespace std;

int N, M;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> M;

  vector<int> graph[N];

  rep(i, M) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  rep(i, N) {
    if (graph[i].size()%2 != 0) {
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << '\n';
}


Measured memory_bytes: 5376
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

int main(){

//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;

    // 右端行って上端行く。帰るときは左端行って下端いく
    // 2往復するらしい
    // 中をジグザグすすむのは強い?? -> 最初に右に移動or上に移動しないと最短でないので、
    // 中ジグザグと端ダッシュは距離変わらない
    // 1個外に出る必要あり?? 

    string res = "";

    for(int i = sx; i < tx; ++i)
    {
        res += "R";
    }

    for(int i = sy; i < ty; ++i)
    {
        res += "U";
    }

    //数があってればよいので、逆にしない
//    for(int i = tx; i > sx; --i)
    for(int i = sx; i < tx; ++i)
    {
        res += "L";
    }

    for(int i = sy; i < ty; ++i)
    {
        res += "D";
    }

    //膨らむ
    res += "D";
    for(int i = sx; i < tx + 1; ++i)
    {
        res += "R";
    }
    for(int i = sy; i < ty+1; ++i)
    {
        res += "U";
    }
    res += "L";

    //戻るときも膨らむ
    res += "U";
    for(int i = sx; i < tx + 1; ++i)
    {
        res += "L";
    }
    for(int i = sy; i < ty+1; ++i)
    {
        res += "D";
    }
    res += "R";

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int N;
	char S[101];
	scanf("%d", &N);
	scanf("%s", S);
	
	int i, j, lb[26], ub[26], max = 0, count;
	for (j = 0; j < 26; j++) {
		lb[j] = -1;
		ub[j] = -1;
	}
	for (i = 0; S[i] != 0; i++) {
		if (lb[S[i] - 'a'] == -1) lb[S[i] - 'a'] = i;
		else ub[S[i] - 'a'] = i;
	}
	for (i = 1; S[i] != 0; i++) {
		count = 0;
		for (j = 0; j < 26; j++) {
			if (ub[j] == -1) continue;
			else if (lb[j] < i && ub[j] >= i) count++;
		}
		if (count > max) max = count;
	}
	
	printf("%d\n", max);
	fflush(stdout);
	return 0;
}

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

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

  if(((a-b)<2)&&((a-b)>-2))
    cout<<a+b<<endl;
  else if(a>b)
    cout<<a+a-1<<endl;
  else
    cout<<b+b-1<<endl;
}


Measured memory_bytes: 256
n = int(input())
def ok(x):
    return x*(x+1)//2 >= n
for x in range(1,n+1):
    
    if ok(x):
        ans = []
        v = x*(x+1)//2 - n
        
        for i in range(1,x+1):
            if i == v:continue
            
            ans.append(i)
        break
            
        
        
        
    else:continue
print(*ans)

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int D, N;
    cin >> D >> N;

    if (D == 0) {
        if (N == 100) cout << 101 << endl;
        else cout << N << endl;
    }
    else if (D == 1) {
        if (N == 100) cout << (N+1)*100 << endl;
        else cout << N*100 << endl;
    }
    else {
        if (N == 100) cout << (N+1)*10000 << endl;
        else cout << N*10000 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n;
    cin >> n;
    vint a(n);
    rep(i, n) cin >> a[i];
    map<int, int> mp;
    rep(i, n) {
        mp[a[i]-1]++;
        mp[a[i]]++;
        mp[a[i]+1]++;
    }

    int ans = 0;
    for (auto x : mp) {
        ans = max(ans, x.se);
    }

    cout << ans << endl;
    return 0;
}

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

int gcd(int a, int b, int c)
{
  int l,r;
  if(a<b)swap(a,b);
  if(a<c)swap(a,c);
  if(b<c)swap(b,c);

  l=a%b;
  while(l){
    a=b;
    b=l;
    l=a%b;
  }

  if(b<c)swap(b,c);

  r=b%c;
  while(r){
    b=c;
    c=r;
    r=b%c;
  }

  return c;
}

int main()
{
  int k,sum=0;

  cin >> k;

  for(int i1=1; i1<=k; i1++){
    for(int i2=1; i2<=k; i2++){
      for(int i3=1; i3<=k;i3++){
       sum+=gcd(i1,i2,i3); 
      }
    }
  }

  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 3596