akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
 
## input
 
# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
 
N,K,Q=map(int, input().split())
A = [int(input()) for _ in range(Q)]

point = []

for i in range(N):
    point.append(K-Q)

for j in range(Q):
    point[A[j]-1] += 1


for i in range(N):
    if point[i] >= 1:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 82260
N,K=(int(i) for i in input().split())
S=input()

p=0
m=0
r=1
r_list=[]
bit=True
ans=0
if S[0]=="R":
    m+=1
if S[0]=="L":
    p+=1
for i in range(N-1):
    if S[i]=="R" and S[i+1]=="L":
        p+=1
        if bit==True:
            r+=1
    elif S[i]=="L" and S[i+1]=="R":
        m+=1
        if bit==True:
            r+=1
    else:
        r_list.append(r)
        bit=False
        r=0
        ans+=1
if S[N-1]=="R":
    m+=1
    if bit==True:
        r+=1
        r_list.append(r)
if S[N-1]=="L":
    p+=1
    if bit==True:
        r+=1
        r_list.append(r)
t=min(p,m)
ans+=min(t,K)*2

if p+m==2:
    if max(r_list)==p+m:
        if t<=K:
            ans-=1
if p+m==3:
    if max(r_list)==p+m:
        if t<=K:
            ans-=1
if p+m==4:
    if max(r_list)==p+m:
        ans-=1
    if max(r_list)==p+m-1:
        ans-=1

if ans>=N:
    ans=N-1
if ans<0:
    ans=0
print(ans)

Measured memory_bytes: 45296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int x[2];
int main(){
	int ans = 0;
	REP(i, 2){
		scanf("%d", x+i);
		if(x[i] <= 3) ans += 4-x[i];
	}
	if(x[0] == 1 && x[1] == 1) ans += 4;
	printf("%d\n", ans*100000);
}


Measured memory_bytes: 256
_,*a=map(str.split,open(0))
U,R,D,L=S="URDL"
d={i:[]for i in S}
for *z, u in a:d[u]+=[*map(int,z)],
N,P,M=9e9,"x+y,","x-y,"
for A,B,S in(U,D,"x,y,"),(R,L,"y,x,"),(R,U,P+M),(D,L,P+M),(U,L,M+P),(R,D,M+P):
 n=p=-9e9
 for x,y,r in sorted(eval(f"[({S}Q)for P,Q in[(A,1),(B,0)]for x,y in d[P]]")):
  if r:n,p=x,y
  elif x==n:N=min(N,(y-p)*5)
print(["SAFE",N][N<9e9])

Measured memory_bytes: 131256
#include <bits/stdc++.h>
using namespace std;
int n;
double dp[3000][3000];
double p[2999];
double ans = 0;
int main()
{
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> p[i];
    dp[0][0] = 1;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j <= i; j++)
        {
            dp[i + 1][j] += dp[i][j] * (1 - p[i]);
            dp[i + 1][j + 1] += dp[i][j] * p[i];
        }
    }
    for (int i = n; i > n / 2; i--)
        ans += dp[n][i];

    printf("%.10lf\n", ans);
}

Measured memory_bytes: 68992
import sys
N = int(input())

input = sys.stdin.readline
lis = {}
for i in range(N):
  s = input().rstrip()
  if s in lis:
    lis[s] += 1
  else:
    lis[s] = 1
lis2 = sorted(lis.items(), key=lambda x:x[1], reverse=True)
x = next(iter(lis2))
keys = []
for i in lis2:
  if i[1] == x[1]:
    keys.append(i[0])
ans = sorted(keys)
for i in ans:
  print(i)

Measured memory_bytes: 50048
N,C=map(int,input().split())
D=[list(map(int,input().split()))for _ in range(C)]
c=[list(map(int,input().split()))for _ in range(N)]
cd=[[] for _ in range(3)]
for i in range(N):
    for j in range(N):
        cd[(i+j)%3].append(c[i][j]-1)
cost=[[0]*C for _ in range(3)]
for i in range(3):
    for j in range(C):
        for x in cd[i]:
            cost[i][j]+=D[x][j]
#print(cost)
from itertools import product
import pprint
A=list(product(range(C),repeat=3))
#print(A)
ans=float("inf")
for a in A:
    if a[0]==a[1] or a[1]==a[2] or a[2]==a[0]:
        continue
    cnt=0
    for i in range(3):
        cnt+=cost[i][a[i]]
    ans=min(ans,cnt)
print(ans)


Measured memory_bytes: 56284
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())

// code
// ------------------------------------------------
int main() {

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

  int x = (a + b) / 2;

  if( (a+b) % 2) x++;

  cout << x;


  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

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

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define REP(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)((x).size()))

const double PI  = acos(-1.0);
const double EPS = 1e-9;
const ll INF = 1e15+10;
const ll mod = 1e9+7;//998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define print(x) cerr << #x << " is " << x << endl;

map<P, int> m;
set<P> s;
int N;
ll powx[200001];


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

int main() {
    cin >> N;
    int z_z = 0, z_non = 0, non_z = 0;
    rep(i, N){
        ll a, b;
        cin >> a >> b;
        if (a == 0 && b == 0){
            z_z++;
        } else if (a == 0){
            z_non++;
        } else if (b == 0){
            non_z++;
        } else {
            ll gg = gcd(a, b);
            a /= gg;
            b /= gg;
            if (a < 0)a = -a, b = -b;
            m[P(a, b)]++;
        }
    }
    //N -= z_z - z_non - non_z;
    
    powx[0] = 1;
    rep(i, N)powx[i + 1] = powx[i] * 2%mod; // 2^N;
        
    ll ans = (powx[z_non] + powx[non_z] - 1)%mod;
    
    for(auto ite = m.begin(); ite != m.end(); ite++){
        ll a = ite->first.first;
        ll b = ite->first.second;
        int cnt = ite->second;
        ll aa = -b;
        ll bb = a;
        if (aa < 0)aa = -aa, bb = -bb;
        if (s.find(P(aa, bb)) == s.end()){
            s.insert(P(aa, bb));
            s.insert(P(a, b));
            int cnt2 = m[P(aa, bb)];
            //fprintf(stderr, "%d (%d, %d), %d\n", cnt, a, b, cnt2);
            ll tmp = (powx[cnt] + powx[cnt2] - 1)%mod;
            
            (ans *= tmp) %= mod;
        }
    }
    cout << (ans + mod + z_z - 1) %mod;
    
    return 0;
}


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

using namespace std;
using p=pair<int,int>;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  if(n%2==0){
    cout << n/2 << endl;
  }
  else if(n%2==1){
    cout << n/2+1 << endl;
  }
  return 0;

}

Measured memory_bytes: 3656
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxn 100
using namespace std;
typedef long long ll;
ll read()
{
    ll x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int main()  
{
    char s[5];
    scanf("%s",s);
    s[0]++;
    printf("%c\n",s[0]);
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = Integer.parseInt(stdIn.next());
        int r = Integer.parseInt(stdIn.next());

        if (n >= 10) {
            System.out.println(r);
        } else {
            System.out.println(r + 100 * (10 - n));
        }
    }
}

Measured memory_bytes: 23636
#include "bits/stdc++.h"

#include <unordered_map>

//#include <iostream>//POJ
//#include <vector>
//#include <string>
//#include <iomanip>
//#include <math.h>
//#include <algorithm>
//#include <cstring>
using namespace std;
#define setc cin.tie(0);ios::sync_with_stdio(0)
#define dd(n) cout<<fixed<<setprecision(n)
#define inp(x) (cin>>x,x)
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define repi_(i,a,b) for(int i=(a), i##_len=(b); i<=i##_len; ++i)
#define rep_(i,n) repi_(i,0,n)
#define repir(i,a,b) for(int i=(a)-1, i##_first=(b); i>=i##_first; --i)
#define repr(i,n) repir(i,n,0)
#define repir_(i,a,b) for(int i=(a), i##_first=(b); i>=i##_first; --i)
#define repr_(i,n) repir_(i,n,0)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
//template<typename T> T vpop(vector<T> *v) {
//	T res = v->back();
//	v->pop_back();
//	return res;
//}
//char vpop(string *v) {
//	char res = v->back();
//	v->pop_back();
//	return res;
//}
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define contain(q) !q.empty()
#define cont(q) !q.empty()
//#define qpop(q, a, b) a=q.back().first;b=q.back().second;q.pop()
//#define pqpop(p, a, b) a=q.top().first;b=q.top().second;q.pop()
#define el "\n"
#define sp " "
#define pi 3.14159265358979
#define co(x) cout<<x<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define cosp(x) cout<<(x)<<' '
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#define POSSIBLE(c) coc(c, "POSSIBLE", "IMPOSSIBLE")
#define Possible(c) coc(c, "Possible", "Impossible")
#define possible(c) coc(c, "possible", "impossible")
#define inf INT_MAX
#define wildcard(T) numeric_limits<T>::min()

#define pb push_back
#define pq priority_queue
#define np next_permutation

#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
const unsigned int bf0 = (1 << 0);
const unsigned int bf1 = (1 << 1);
const unsigned int bf2 = (1 << 2);
const unsigned int bf3 = (1 << 3);
const unsigned int bf4 = (1 << 4);
const unsigned int bf5 = (1 << 5);
const unsigned int bf6 = (1 << 6);
const unsigned int bf7 = (1 << 7);

//#define lint long long
typedef long long lint;
typedef vector<int> ivec; typedef vector<string> svec;
typedef vector<lint> lvec;
typedef vector<vector<int>> ivvec;
typedef pair<int, int> P;

const int
dx8[8] ={ 0,1,1,1,0,-1,-1,-1 },
dy8[8] ={ 1,1,0,-1,-1,-1,0,1 },
dx9[9] ={ 0,1,1,1,0,0,-1,-1,-1 },
dy9[9] ={ 1,1,0,-1,0,-1,-1,0,1 },
dx4[4] ={ 0,1,0,-1 },
dy4[4] ={ 1,0,-1,0 };

template<class T>inline bool maxi(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool mini(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

int main(){
	setc;

	string s;cin>>s;lint ctr=0;char cur=s[0];
	rep(i, siz(s)){
		if(cur!=s[i])++ctr;
		cur=s[i];
	}co(ctr);
	gc();
}


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

int main() {
    int a, b, c;
    string s;
    cin >> a >> b;
    if ( (a*b)%2 == 0 ){
        s = "Even";
    } else {
        s = "Odd";
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

ll dp[MAX_N], h[MAX_N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i,n){
        cin >> h[i];
    }
    rep(i,n+1){
        dp[i] = (1LL << 60);
    }
    dp[0] = 0;
    rep(i,n-1){
        cmn(dp[i+1], dp[i]+abs(h[i+1]-h[i]));
        if(i < n-2){
            cmn(dp[i+2], dp[i]+abs(h[i+2]-h[i]));
        }
    }
    cout << dp[n-1] << "\n";
    return 0;
}

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

int main(){
	int h,w;
	cin >> h >> w;
	vector<vector<char> > map(h, vector<char>(w));
	vector<vector<pair<int,int> > > place(26);
	vector<int> exist(26, false);
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			cin >> map[i][j];
			if(map[i][j]!='.'){
				place[map[i][j]-'A'].push_back(make_pair(i,j));
				exist[map[i][j]-'A'] = true;
			}
		}
	}
	
	bool nochange = false;
	int score = 0;
	while(!nochange){
		nochange = true;
		for(int i=0; i<='Z'-'A'; i++){
			if(!exist[i]) continue;
			int x1 = place[i][0].first, y1 = place[i][0].second;
			int x2 = place[i][1].first, y2 = place[i][1].second;
			bool success = true;
			bool tap = false;
			if(x1 == x2){
				for(int j=min(y1,y2)+1; j<max(y1,y2); j++){
					if(map[x1][j]=='.'){
						tap=true;
					}else{
						success = false;
						break;
					}
				}
			}else if(y1 == y2){
				for(int j=min(x1,x2)+1; j<max(x1,x2); j++){
					if(map[j][y1]=='.'){
						tap=true;
					}else{
						success = false;
						break;
					}
				}
			}else{
				tap = true;
				for(int j=min(y1,y2)+1; j<max(y1,y2); j++){
					if(map[x1][j]!='.'){
						success = false;
						break;
					}
				}
				for(int j=min(x1,x2)+1; j<max(x1,x2); j++){
					if(map[j][y2]!='.'){
						success = false;
						break;
					}
				}
				if(map[x1][y2]!='.'){
					success = false;
				}
				if(!success){
					success = true;
					for(int j=min(y1,y2)+1; j<max(y1,y2); j++){
						if(map[x2][j]!='.'){
							success = false;
							break;
						}
					}
					for(int j=min(x1,x2)+1; j<max(x1,x2); j++){
						if(map[j][y1]!='.'){
							success = false;
							break;
						}
					}
					if(map[x2][y1]!='.'){
						success = false;
					}
				}
			}
			
			if(success && tap){
				score += 2;
				map[x1][y1] = map[x2][y2] = '.';
				exist[i] = false;
				nochange = false;
			}
		}
	}
	cout << score << endl;
    return 0;
}

Measured memory_bytes: 3280
vis = [0]*4

for i in range(3):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    vis[a] += 1
    vis[b] += 1

cnt1 = vis.count(1)
cnt2 = vis.count(2)

if cnt1 == 2 and cnt2 == 2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9124
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}


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

    int n,m;
    cin>>n>>m;
    int sum = 0;
    for(int i=0;i<m;i++){
        int a;cin>>a;sum+=a;
    }
    n -= sum;
    n = max(n,-1);
    cout << n << endl;

}

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

int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  bool judge=true;

  rep(i,n){
    if(a[i]%2==0){
      if(a[i]%3!=0&&a[i]%5!=0){
        judge=false;
        break;
      }
    }
  }
  if(judge==true)cout<<"APPROVED"<<endl;
  else cout<<"DENIED"<<endl;
  
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int A, B, C;
int main(){
	cin>>A>>B>>C;
	for(int i = 1; i <= B; i ++){
		if(i * A % B == C){cout << "YES"<<endl; return 0; }
	}
	cout << "NO" << endl;
	return 0;
}

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

int main() {
	string s;
	while (getline(cin,s)) {
		stack<double>stk;
		string sa;
		
		for (int i = 0;i < s.size();i++) {
			if (s[i] != ' ') {
				sa+=(s[i]);
			}
			else {
					if (sa == "+") {
						double a = stk.top();
						stk.pop();
						double b = stk.top();
						stk.pop();
						stk.push(a + b);
					}
					else if (sa == "-") {
						double a = stk.top();
						stk.pop();
						double b = stk.top();
						stk.pop();
						stk.push(b - a);
					}
					else if (sa == "*") {
						double a = stk.top();
						stk.pop();
						double b = stk.top();
						stk.pop();
						stk.push(a*b);
					}
					else if (sa == "/") {
						double a = stk.top();
						stk.pop();
						double b = stk.top();
						stk.pop();
						stk.push(b / a);
					}
				else {
					int a = stoi(sa);
					stk.push(a);
				}
				sa.clear();
			}
		}
		if (!sa.empty()&&sa!="+"&&sa!="-"&&sa!="*"&&sa!="/")stk.push(stoi(sa));
		else {
			if (sa == "+") {
				double a = stk.top();
				stk.pop();
				double b = stk.top();
				stk.pop();
				stk.push(a + b);
			}
			else if (sa == "-") {
				double a = stk.top();
				stk.pop();
				double b = stk.top();
				stk.pop();
				stk.push(b - a);
			}
			else if (sa == "*") {
				double a = stk.top();
				stk.pop();
				double b = stk.top();
				stk.pop();
				stk.push(a*b);
			}
			else if (sa == "/") {
				double a = stk.top();
				stk.pop();
				double b = stk.top();
				stk.pop();
				stk.push(b / a);
			}
		}
		printf("%.9lf\n", stk.top());
	}
	return 0;
}

Measured memory_bytes: 3232
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	char x;
	cin>>x;
	if(x=='S')cout<<"Cloudy\n";
	if(x=='R')cout<<"Sunny\n";
	if(x=='C')cout<<"Rainy\n";
	return 0;
}

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

bool isPrime(int p) {
	if (p == 1)return false;
	for (int i = 2; i < p; i++) {
		if (p % i == 0)return false;
	}
	return true;
}


int main() {
	int n; cin >> n;
	for (int i = 31; i <= 55555; i += 30) {
		if (isPrime(i)) {
			if (i != 31)cout << ' ';
			cout << i; n--;
		}
		if (n == 0)break;
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
typedef long long int ll;
using namespace std;
using Graph = vector<vector<int> >;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int K,X;
cin>>K>>X;
if(500*K>=X)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
//system("pause");
return 0;
}

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

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

  bool ok = true;
  if(s[0] != 'A') ok = false;
  int cnt = 0;
  int d;
  for(int i = 2; i < s.size() - 1; i++){
    if(s[i] == 'C'){
      cnt++;
      d = i;
    } 
  }
  if(cnt != 1) ok = false;

  string alphabet = "abcdefghijklmnopqrstuvwxyz";
  for(int i = 1; i < s.size(); i++){
    bool isalpha = false;
    for(int j = 0; j < 26; j++){
      if(i != d){
        if(s[i] == alphabet[j] ) isalpha = true;
      }
      else isalpha = true;
    }
    if(isalpha == false) ok = false;
  }

  if(ok){
    cout << "AC" << endl;
  }
  else{
    cout << "WA" <<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
//printf("%.10f\n", N);
/*
ll memo[100000];
ll fibo(ll n){
    if(memo[n] != 0)return memo[n];
    if(n <= 1)return n;
    else return memo[n] = fibo(n - 1)+ fibo(n - 2);
}*/
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/
int main(){
    ll N,K;
    cin >> N >> K;
    vector<ll> num(N);
    rep(i,N)cin >> num[i];
    ll memo[100005];
    rep(i,N)memo[i] = INF;
    memo[0] = 0;
    rep(i,N){
        for(ll j = 1;j <= K && i - j >= 0;j++){
            memo[i] = min(memo[i],memo[i - j] + abs(num[i] - num[i - j]));
        }
    }
    cout << memo[N - 1] << endl;
}

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


using namespace std;



int same(string s, string s2) {
	int ans = 0;
	int sz = s.size();
	int sz2 = s2.size();
	for (int i = 0; i < min(sz, sz2); i++) {
		if (s[i] == s2[i]) {
			ans++;
		}
		else {
			break;
		}
	}
	return ans;
}

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		string s;
		vector<string> id;
		for (int i = 0; i < n; i++) {
			cin >> s;
			string ss = "";
			ss += s[0];
			for (int j = 0; j+1 < s.size(); j++) {
				if (s[j] == 'a' || s[j] == 'e' || s[j] == 'i' || s[j] == 'o' || s[j] == 'u') {
					ss += s[j + 1];
				}
			}
			id.push_back(ss);
			//cout << id[i] << endl;
		}
		sort(id.begin(), id.end());
		bool h = true;
		int MM = 0;
		for (int i = 0; i < id.size(); i++) {
			for (int j = i + 1; j < id.size(); j++) {
				MM = max(MM, same(id[i], id[j]));
				if (id[i] == id[j]) {
					h = false;
				}
			}
		}
		if (!h) {
			cout << -1 << endl;
		}
		else {
			cout << MM + 1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3068
L,R = map(int,input().split())
ans = 2019

for i in range(L,min(R,L+2019),1):
    for j in range(L+1,min(L+2019,R+1),1):
        ans = min(ans, i*j % 2019)
        if ans==0:
            break
print(ans)


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

int main() 
{
    string s, p;                                                       //Sが円になっている文字列、Pが探す文字列
    bool judge;                                                        //YES, NOを判定する変数

    cin >> s;
    cin >> p;

    for( int i = 0; i < s.size(); i++ )
    {
        for( int j = i, t = 0; j < p.size() + i; j++, t++ )            
        {
            if( s[j % s.size()] != p[t] )                              //falseならbreakする
            {
                judge = false;
                break;
            }
            else                                                       //一通り一致したらtrueが入っているので
                judge = true;       
        }
        if( judge )                                                    //ループを抜けて結果を出力
            break;
    }

    if( judge )
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3220
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
if a[1]-a[0] == b[1] - b[0] == c[1] - c[0] and a[1]-a[2] == b[1] - b[2] == c[1] - c[2]:
  print("Yes")
else:
  print("No")

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

#define endl "\n"
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first 
#define ss second 
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vii vector<pii>
#define vvi vector<vi>
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

//#define int int64_t
int a[N+2]={0};

int32_t  main(){
	IOS;
  int n;cin>>n;  
  memset(a,0,sizeof(a));
  fori(i,n){
    int va;cin>>va;
    a[va]++;
  }
  int cnt2=0,cnt1=0;
  for(int i=1;i<=N;++i){
    if(a[i]>=3){
      if(a[i]%2==0)a[i]=2;
      else a[i]=1;
    }
    if(a[i]==1)cnt1++;
    else if(a[i]==2) cnt2++;
  }
 // cout<<cnt1<<" cnt1\n";
//  cout<<cnt2<<" cnt2\n";
  
  if(cnt2>1){
    if(cnt2%2==0){
      cnt1+=(cnt2);
      cnt2=0;
    }else{
      cnt1+=cnt2-1;
      cnt2=1;
    }
  }
  int ans=cnt1;
  cout<<ans<<endl;
  return 0;
}



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

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

    int k, x;
    cin >> k >> x;

    li fr = max(-1000000, x - k + 1), to = min(1000000, x + k - 1);
    for (int i = fr; i <= to; ++i) {
        cout << i;
        if (i == to) {
            cout << endl;
        } else {
            cout << " ";
        }
    }

    return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;

void main(string[] args){
	while(1){
		int n = to!int(readln.chomp);
		if(n == 0) break;
		int S = 0;
		int Smin = 0;
		int Smax = int.min;
		int dmax = int.min;
		for(int i = 0; i < n; i ++){
			S += to!int(readln.chomp);
			if(S > Smax) Smax = S;
			if(Smax - Smin > dmax) dmax = Smax - Smin;
			if(S < Smin) Smin = S, Smax = int.min;
			}
		writeln(dmax);
		}
	}

Measured memory_bytes: 1044
import sys
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

s = LS2()
a = 0
for i in range(len(s)):
    if s[i] == 'A':
        a = i
        break
b = 0
for i in range(len(s)-1,-1,-1):
    if s[i] == 'Z':
        b = i
        break
print(b-a+1)

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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

struct edge {
    ll to;
    char cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;
// 入力
int H, W;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int N;

vector<string> ans;

int dfs(string s, char mx){
    if(s.size() == N){
        cout << s << endl;
        return 0;
    }
    for(char c = 'a'; c <= mx+1; c++){
        string t = s;
        t += c;
        dfs(t, max(mx, c));
    }
    return 0;

}

int main(void){
    cin >> N;
    dfs("", 'a'-1);
    return 0;

    
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define pii pair<int,int>
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#define fio freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define vll vector<long long int>
#define vpii vector<pair<int,int>>
#define dsc [](int a,int b)->bool {return a>b;}
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define MAX 1000000000000000000
#define test int t; cin>>t;
#define MOD 1000000007LL
#define all(x) (x).begin(),(x).end()

using namespace std;

ll nxt(){
    ll x;
    cin>>x;
    return x;
}

int main()
{
    #ifndef ONLINE_JUDGE
        fio
    #endif
    IOS
    
    ll d,t,s;
    cin>>d>>t>>s;
    ll time = ceil((double)d/s);
    if(time<=t) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    

    return 0;
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
#include <cstdio>
#include <chrono>
#include <random>
using namespace std;

#define DRACARYS ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, -1, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define PI 3.14159265
const long long int MAXN = 1e5+10;
const long long int MINN = 1e5+10;
const long long int inf = 1e18+7;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi; 
typedef stack<int> st;

ll n,a[405],dp[405][405],pre[405];
int r=1,c=3,s=3;

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    DRACARYS    
    cin>>n;
    repA(i,1,n) cin>>a[i];
    pre[1]=a[1];
    repA(i,2,n) pre[i]=pre[i-1]+a[i];
    repA(i,1,n-1) dp[i][i+1]=a[i]+a[i+1];
    while(1){
    	while(1){
    		ll val=inf;
    		repA(k,r,c-1) val=min(val,dp[r][k]+dp[k+1][c]);
    		dp[r][c]=val+pre[c]-pre[r-1];
    		++r;
    		++c;
    		if(c>n) break; 
    	}
    	++s;
    	r=1;
    	c=s;
    	if(c>n) break;
    }
    cout<<dp[1][n]<<endl;
    return 0;
}



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

int main(){
  int n;
  int i,count1=0,count2=0; //count1:入力したnの個数 count2:合成数の個数

  while(scanf("%d",&n)!=EOF){
    count1++;
    if(n!=2 && n%2==0){
      count2++;//2以外の偶数を除く
      continue;
    }
    for(i=3;i<=sqrt(n);i+=2){
      if(n%i==0){
	count2++;
	break;
      }
    }
  }
  printf("%d\n",count1-count2);
  
  return 0;
}

// xが合成数ならば、√x以下の約数を持つことを利用した



Measured memory_bytes: 2084
#include<iostream>
#include<string>
#include<cctype>
using namespace std;
int main(){
	int ans=0,a;
	string str;
	while(1){
		cin>>str;
		if(str[0]=='0'){
			break;
		}
		for(int i=0;i<str.size();i++){
			a=str[i]-'0';
			ans+=a;
		}
		cout<<ans<<endl;
		ans=0;
	}
	return 0;
}

Measured memory_bytes: 3196
#include<stdio.h>

int main(void)
{
    int a, b, c, n;

    scanf("%d %d %d", &a, &b, &c);

    if(a > b)
    {
        n = a;
        a = b;
        b = n;
    }

    if(b > c)
    {
        n = b;
        b = c;
        c = n;
    }

    if(a > b)
    {
        n = a;
        a = b;
        b = n;
    }

    printf("%d %d %d\n", a, b, c);

    return 0;
}


Measured memory_bytes: 2044
import java.util.*;
import java.awt.*;

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

        int N = sc.nextInt();
        int k = -1;
        for (int i = 1; i < N; i++) {
            if (i * (i+1) == 2 * N) {
                k = i;
            }
        }
        if (N == 1) {
            System.out.println("Yes");
            System.out.println("2");
            System.out.println("1 1");
            System.out.println("1 1");
            return;
        }
        if (k == -1) {
            System.out.println("No");
        } else {
            System.out.println("Yes");

            int[][] ans = new int[k+1][k];
            int count = 1;

            for (int i = 0; i < k+1; i++) {
                for (int j = 0; j < k; j++) {
                    if (i == j+1) {
                        ans[i][j] = ans[i-1][j];
                    } else if ( i > j + 1) {
                        ans[i][j] = ans[i-1][j] + 1;
                    } else {
                        ans[i][j] = count;
                        count++;
                    }
                }
            }

            System.out.println(k+1);
            for (int i = 0; i < k+1; i++) {
                System.out.print(k);
                for (int j = 0; j < k; j++) {
                    System.out.print(' ');
                    System.out.print(ans[i][j]);
                }
                System.out.println("");
            }
        }
    }
}


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

using namespace std;
using ll = long long;
int main(){
    ll N,ans=0;
    cin >> N;
    ll A[N];
    for(ll i = 0;i < N;i++){
        cin >> A[i];
        if(i>0 && A[i-1]>A[i]){
            ans += (A[i-1]-A[i]);
            A[i] = A[i-1];
        }
    }
    cout << ans << endl;
}

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

int main(void){
	long long s=0, t=0, n, a, ans=0;
 	cin >> n;
	for(int i=0; i<n; i++){
		cin >> a;
		s += a;
		t += a*a;
	}
	a = s/n;
	if(s%n==0) ans = t - s*s/n;
	else ans = min(n*a*a-2*s*a+t, n*(a+1)*(a+1)-2*s*(a+1)+t);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
#define FOR(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;

  ll r = 0, g = 0, b = 0;
  for (auto c : S) {
    if (c == 'R') r++;
    if (c == 'G') g++;
    if (c == 'B') b++;
  }

  ll ans = r * g * b;
  FOR(i, N) {
    FOR2(j, i + 1, N) {
      if (S[i] == S[j]) continue;
      int k = 2 * j - i;
      if (k >= N || S[k] == S[i] || S[k] == S[j]) continue;
      ans--;
    }
  }

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


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

#define PI 4*atan(1)

int main(){
  long long int n;
  while(cin >> n, n){
    map<long long int,long long int> e;
    vector<long long int> num;
    int cntnum[4000] = {0};
    for(int i = 1; i <= 4000; i++){
      e[i] = 0;
    }
    for(int i = 0; i < n; i++){
      long long int tmp[3];
      cin >> tmp[0] >> tmp[1] >> tmp[2];
      e[tmp[0]] += tmp[1] * tmp[2];
      if(cntnum[tmp[0]] == 0){
        num.push_back(tmp[0]);
        cntnum[tmp[0]]++;
      }
    }
    long long int cnt = 0;
    for(int i = 0; i < num.size(); i++){
      if(e[num[i]] >= 1000000){
        cout << num[i] << endl;
        cnt++;
      }
    }
    if(cnt == 0){
      cout << "NA" << endl;
    }
  }
}

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


int main()
{
   string s;
   cin>>s;
   if(s=="SUN") printf("7");
   else if(s=="MON") printf("6");
   else if (s=="TUE") printf("5");
   else if (s=="WED") printf("4");
   else if(s=="THU") printf("3");
   else if(s=="FRI") printf("2");
   else printf("1");
   return 0;
   
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<random>
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e16;

lint N, X, L;
plint arr[100000];
int main() {
	cin >> N;
	REP(i, N) {
		cin >> X >> L;
		arr[i] = { X + L, max(0ll, X - L) };
	}
	sort(arr, arr + N);
	lint cnt = 0;
	lint l = -1;
	REP(i, N) {
		if (arr[i].second >= l) {
			cnt++;
			l = arr[i].first;
		}
	}
	cout << cnt << endl;
}


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

int main() {
  int N, a, count;
  cin>>N;
  a=1;
  vector<int> A(N);
  for (int i=0; i<N; i++)
    cin>>A.at(i);
  for (int i=0; i<N; i++){
    a=A.at(a-1);
    if (a==2){
      cout<<i+1<<endl;
      break;
    }
  }
  if (a!=2)
    cout<<"-1"<<endl;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
 
int main() {
    int time;
    cin >> time;
    int hours = time / 3600;
    int minutes = (time - hours * 3600) / 60;
    int secounds = time - hours * 3600 - minutes * 60;
    cout << hours << ":" << minutes << ":" << secounds << endl;
}
    

Measured memory_bytes: 1164
#include<string.h>
#include<algorithm>
#include<iostream>
#include<stdio.h>
int num[100005];
using namespace std;
int main()
{
	int n,x,k=0;
	scanf("%d",&n);
	memset(num,0,sizeof(num));
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&num[i]);
	}
	for(int i=1;i<n;i++)
	{
		if(num[i]==i)
		{
			k++;
			swap(num[i],num[i+1]);
		}
	}
	if(num[n]==n)k++;
	printf("%d\n",k);
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int prime[999999];

int main() {
  int i, k, n, N = 0;
  for(i = 2; i <= 999999; i++) {
    prime[i] = 1;
  }
  for(i = 2; i*i <= 999999; i++) {
    if(prime[i]) {
      for(k = 2 * i; k <= 999999; k += i) {
        prime[k] = 0;
      }
    }
  }
  while(scanf("%d", &n) != EOF){
    for(i = 2; i <= n; i++){
      if(prime[i] == 1) N++;
    }
    printf("%d\n", N);
    N = 0;
  }
  return 0;
}

Measured memory_bytes: 4496
from sys import stdin, setrecursionlimit

setrecursionlimit(10 ** 9)
INF = 1 << 60


def input():
    return stdin.readline().strip()


K = int(input())
S = input()

if len(S) <= K:
    print(S)
else:
    S = S[:K] + '...'
    print(S)

Measured memory_bytes: 9172
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <bitset>
#include <complex>
using namespace std;

const double EPS = 1e-9;
const double PI = 3.14159265359;

typedef complex<double> P;

class ERA{
public:
	int y1, m1, d1;
	int y2, m2, d2;

	ERA(int year1, int month1, int day1, int year2, int month2, int day2){
		y1 = year1;
		m1 = month1;
		d1 = day1;
		y2 = year2;
		m2 = month2;
		d2 = day2;
	}
	bool isContain(int year, int month, int day){
		bool ret = false;
		if(year == y1 && year == y2){
			// 省略
		}else if(year == y1){
			if(month > m1){
				ret = true;
			}else if(month == m1){
				if(day >= d1){
					ret = true;
				}
			}
		}else if(year == y2){
			if(month < m2){
				ret = true;
			}else if(month == m2){
				if(day <= d2){
					ret = true;
				}
			}
		}else if(year > y1 && year < y2){
					ret = true;
		}
		return ret;
	}
};

int main(){
	int y, m, d;

	ERA pre_meiji(0, 0, 0, 1868, 9, 7);
	ERA meiji(1868, 9, 8, 1912, 7, 29);
	ERA taisho(1912, 7, 30, 1926, 12, 24);
	ERA showa(1926, 12, 25, 1989, 1, 7);

	while(cin >> y >> m >> d){
		if(pre_meiji.isContain(y, m, d)){
			cout << "pre-meiji" << endl;
		}else if(meiji.isContain(y, m, d)){
			cout << "meiji" << ' ' << y+1-meiji.y1 << ' ' << m << ' ' << d << endl;
		}else if(taisho.isContain(y, m, d)){
			cout << "taisho" << ' ' << y+1-taisho.y1 << ' ' << m << ' ' << d << endl;
		}else if(showa.isContain(y, m, d)){
			cout << "showa" << ' ' << y+1-showa.y1 << ' ' << m << ' ' << d << endl;			
		}else{
			cout << "heisei" << ' ' << y+1-showa.y2 << ' ' << m << ' ' << d << endl;
		}
	}

	return 0;
}

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

class Task{
private:
  int n;
  string str;
  char maxC;
public:
  Task(int n, string str, char maxC): n(n), str(str), maxC(maxC){
  }

  void enTask(stack<Task*>* stack){
    if(str.length() == n){
      cout << str << endl;
      return;
    }

    for(char c = maxC; c >= 'a'; c--){
      stack->push(new Task(n, str + c, (maxC == c) ? maxC + 1: maxC));
    }
  }
};

signed main() {
  int n;
  cin >> n;
  std::stack<Task*>* stack = new std::stack<Task*>();
  Task* firTask = new Task(n, "", 'a'); 
  stack->push(firTask);
  while(!stack->empty()){
    Task* task = stack->top();
    stack->pop();
    task->enTask(stack);
  }
}

Measured memory_bytes: 12928
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-10;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

void unq(vi& v)
{
	sort(ALL(v));
	auto it = unique(ALL(v));
	v.erase(it, v.end());
}

int main()
{
	int m, n;
	unordered_map<string, vi> mp;
	cin >> m;
	REP(i, m)
	{
		string c; int a, b; cin >> c >> a >> b;
		vi v;
		FOR(i, a, b + 1) v.push_back(i);
		mp[c] = v;
	}
	stack<vi> st;
	cin >> n;
	bool f = true;
	REP(i, n)
	{
		string s; cin >> s;
		if (s == "+")
		{
			vi a = st.top(); st.pop();
			vi b = st.top(); st.pop();
			vi v;
			REP(i, b.size())REP(j, a.size()) v.push_back((b[i] + a[j]) % 256);
			unq(v);
			st.push(v);
		}
		else if (s == "-")
		{
			vi a = st.top(); st.pop();
			vi b = st.top(); st.pop();
			vi v;
			REP(i, b.size())REP(j, a.size()) v.push_back((b[i] - a[j] + 256) % 256);
			unq(v);
			st.push(v);
		}
		else if (s == "*")
		{
			vi a = st.top(); st.pop();
			vi b = st.top(); st.pop();
			vi v;
			REP(i, b.size())REP(j, a.size()) v.push_back((b[i] * a[j]) % 256);
			unq(v);
			st.push(v);
		}
		else if (s == "/")
		{
			vi a = st.top(); st.pop();
			vi b = st.top(); st.pop();
			vi v;
			REP(i, b.size())REP(j, a.size())
			{
				if (a[j] == 0)
				{
					f = false;
					goto end;
				}
				else v.push_back((b[i] / a[j]) % 256);
			}
			unq(v);
			st.push(v);
		}
		else if (isalpha(s[0]))
		{
			st.push(mp[s]);
		}
		else
		{
			int n = stoi(s);
			vi v = { n };
			st.push(v);
		}
	}
end:;
	puts(f ? "correct" : "error");
	return 0;
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
using namespace std;
#define repr(i,k,n) for(int i = (k); i < (n); i++)
#define rep(i,n) repr(i,0,n)
#define ALL(a) begin(a),end(a)
const int MOD = 1000000007;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
  }
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, D, A;
    cin >> N >> D;
    A = N / (D * 2 + 1);
    A += (N % (D * 2 + 1)?1:0);
    cout << A <<endl;
}


Measured memory_bytes: 256
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	ll a, b, c; cin >> a >> b >> c;
	ll d = c - a - b;
	if (d <= 0)cout << "No" << endl;
	else if (4 * a*b < powl(d,2))cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

int main() {
  int K,ans=0,mod;
  cin >> K;
  if(K%2 == 0 or K%5 == 0){
    cout << -1 << endl;
    return 0;
  }
  mod = 7%K;
  ans++;
  while(mod != 0){
    mod = (10*mod+7)%K;
    ans++; 
  }
  cout << ans << endl;
}

Measured memory_bytes: 3572
N,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
a_list=0
count=0
if sum(a)<x:
    count=N-1
else:    
    for i in range(len(a)):
        a_list+=a[i]
        if a_list<=x:
            count+=1
        else:
            break
print(count)

Measured memory_bytes: 40048
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main {
static  Scanner sc = new Scanner(System.in);


public static void main(String[] args) {

int n=Integer.parseInt(sc.nextLine());
int[] num=new int[n];
for(int i=0;i<n;i++){
num[i]=Integer.parseInt(sc.nextLine());
}
Arrays.sort(num);
int res=0;
for(int i=0;i<n-1;i++){
res+=num[i];
}
res+=num[n-1]/2;
System.out.println(res);

}

}




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

int main()
{
	int N;
	int A[110];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	bool check = true;
	for (int i = 0; i < N; i++) {
		if (A[i] % 2 == 0 && A[i] % 3 != 0 && A[i] % 5 != 0) {
			check = false;
		}
	}
	if (check) {
		cout << "APPROVED" << endl;
	}
	else {
		cout << "DENIED" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <functional>
#include  <vector>
#include <algorithm>
#include <numeric>
#include <string>
using namespace std;





int main()
{
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;

    transform(s1.begin(), s1.end(), s1.begin(), ::toupper);
    transform(s2.begin(), s2.end(), s2.begin(), ::toupper);
    transform(s3.begin(), s3.end(), s3.begin(), ::toupper);

    cout << s1[0] << s2[0] << s3[0] << endl;

    return 0;
}


Measured memory_bytes: 256
"use strict"
const main = (input) => {
  const list = input.split(" ")
  const a = parseInt(list[0])
  const b = parseInt(list[1])
  if(b%a == 0){
    console.log(a+b)
  }else{
  	console.log(b-a)
  }
}

main(require("fs").readFileSync("/dev/stdin","utf-8"))


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

int main() {
    int n;
    cin >> n;
    vector<int> a = vector<int>(n);
    vector<int> b = vector<int>(n);
    int ans =0;

    for(int i = 0; i < n; i ++) {
        cin >> a.at(i);
    }
    for(int i = 0; i < n ; i ++) {
        cin >> b.at(i);
        ans += max(a.at(i) - b.at(i),0);
    }

    cout << ans <<endl;

}

Measured memory_bytes: 384