akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int sum=0,tk=1000;
        int mod=n%1000;
        while(tk<n){
            tk=tk+1000;
        }
        sum=tk-n;
        System.out.println(sum);
    }
}

Measured memory_bytes: 35564
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        System.out.println(a[n - 1] - a[0]);
    }
}


Measured memory_bytes: 21972
n = int(input())
a = list(map(int, input().split()))
b = []
for i, v in enumerate(a):
    b.append([v, i])
b.sort(reverse = True)
dp = [[0] * (n+1) for _ in range(n+1)]
ans = 0

for i in range(n+1):
    for j in range(n+1-i):
        if i > 0:
            dp[i][j] = max(dp[i][j], dp[i-1][j] + b[i+j-1][0] * (b[i+j-1][1] - (i - 1)))
        if j > 0:
            dp[i][j] = max(dp[i][j], dp[i][j-1] + b[i+j-1][0] * ((n - j) - b[i+j-1][1]))

for i in range(n+1):
    ans = max(ans, dp[i][n-i])

print(ans)

Measured memory_bytes: 100308
#include <iostream>

using namespace std;

int N;
int a[100005];
int cnt;

int main(void)
{
	cin >> N;
	for(int i = 0; i < N; i++) cin >> a[i];
	
	for(int i = 0; i < N; i++){
		if(a[i] % 2) cnt++;
	}
	
	if(cnt % 2) cout << "NO" << endl;
	else cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 640
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]

MOD = 1000000007

d = [0] * (N+1)
OK = [True]*(N+1)
d[0] = 1

for i in range(M):
    OK[a[i]] = False

#print(OK)

if(OK[1]):
    d[1] = 1
else:
    d[1] = 0

for i in range(2,N+1):
    if(OK[i-1]):
        d[i] += d[i-1]
    if(OK[i-2]):
        d[i] += d[i-2]
    d[i] %= MOD
    '''
    if(i in a):
        d[i] = 0
    else:
        d[i] = d[i-1] + d[i-2]
    d[i] %= MOD
    '''

print(d[-1])

Measured memory_bytes: 53592
#include <stdio.h>
#include <iostream>

using namespace std;

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

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

    if (e - a > k) {
        cout << ":(" << endl;
    } else {
        cout << "Yay!" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import sys
# 小さすぎても怒られるので
from collections import defaultdict
n = int(input())
sys.setrecursionlimit(max(1000, 2*n))

cs = [0] + [int(c) for c in input().split()]
ns = defaultdict(set)
for _ in range(n-1):
    a,b = [int(c) for c in input().split()]
    ns[a].add(b)
    ns[b].add(a)

ans = [0] * (n+1) # kを通らないパスの総数
minus = [0] * (n+1) # uの部分木のうち
minus0 = defaultdict(int)
st = {k: [] for k in range(1, n+1)}
nextu = {}
def dfs(u, prev, ans):
    global minus, st, minus0
    k = cs[u]
    st[k].append(u)
    ss = 1
    for v in ns[u]:
        if v==prev:
            continue
        nextu[u] = v
        s = dfs(v, u, ans)
        ss += s
        tmp = s - minus[v]
        ans[k] += (int(tmp * (tmp - 1) / 2) + tmp)
    st[k].pop()
    if st[k]:
        minus[nextu[st[k][-1]]] += ss
    else:
        minus0[k] += ss
#     print(ss)
    return ss

dfs(1, -1, ans)
for k in range(1, n+1):
    tmp = n - minus0[k]
    ans[k] += (int(tmp * (tmp - 1) / 2) + tmp)
    
total = int(n * (n+1) / 2)
for i in range(1, n+1):
    print(total - ans[i])

Measured memory_bytes: 427260
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

const int MOD = 1e9 + 7;

inline int add(int x, int y){
	int res = x + y;	
	while(res >= MOD)res-=MOD;
	return res;
}

inline int mul(int x,int y){
	return (1LL * x * y) % MOD;
}

int modpow(int x,int p){
	int res = 1;
	while(p){
		if(p&1)gmul(res,x);
		gmul(x,x);
		p/=2;
	}
	return res;
}

inline int invert(int x){
	return modpow(x,MOD - 2);
}

const int N = 1e6;

int fac[N], inv[N];

void init(int n){
	fac[0] = inv[0] = 1;
	for(int i = 1;i < n; ++i){
		fac[i] = mul(fac[i-1], i);	
		inv[i] = invert(fac[i]); 
	}
}

int comb(int n,int k){
	return mul(fac[n],mul(inv[k], inv[n-k]));	
}

int fall(int n, int k){
	return mul(fac[n], inv[n-k]);
}

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	init(N);
	int n,m;
	cin >> n >> m;
	int ans = 0;
	rep(i,0,n+1){
		int amt = mul(comb(n,i),fall(m-i,n-i));
		if(i&1)amt = MOD - amt;
		gadd(ans, amt);
	}
	gmul(ans, fall(m,n));
	cout << ans << '\n';
}


Measured memory_bytes: 11456
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n = ni()

print(n * 800 - (n // 15) * 200)

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

using namespace std;

long long roundup(long long N,long long a)
{
  long long result;
  if(N%a == 0){
    return N/a;
  }
  else {
    return N/a + 1;
  }
}

int main(){
  long long N;
  vector<long long> a(5);
  vector<long long> b(5);
  
  cin >> N;
  long long m = 0;
  for(int i=0;i<5;i++){
    cin >> a[i];
    
    if(i==0){
      m = a[i];
    }
    else {
      m = min(m,a[i]);
    }
  }
  
  long long result = roundup(N,m) + 4;
  
  cout << result << endl;
}
  
  
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define double long double
#define ll long long
#define INF LLONG_MAX/3
#define P pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
#define ggr getchar();getchar();return 0
using namespace std;
int h,w;
char s[3010][3010];
int r1[3010][3010],r2[3010][3010];
signed main(){
	cin>>h>>w;
	rep(i,h){
		rep(j,w)cin>>s[i][j];
	}
	rep(i,h){
		rep(j,w){
			if(j)r1[i][j]=r1[i][j-1];
			if(s[i][j]=='O')r1[i][j]++;
			if(i)r2[i][j]=r2[i-1][j];
			if(s[i][j]=='I')r2[i][j]++;
		}
	}
	int ans=0;
	rep(i,h){
		rep(j,w){
			if(s[i][j]=='J'){
				if(i){
					if(j){
						ans+=(r1[i][w-1]-r1[i][j-1])*(r2[h-1][j]-r2[i-1][j]);
					}
					else ans+=r1[i][w-1]*(r2[h-1][j]-r2[i-1][j]);
				}
				else{
					if(j){
						ans+=(r1[i][w-1]-r1[i][j-1])*r2[h-1][j];
					}
					else ans+=r1[i][w-1]*r2[h-1][j];
				}
			}
		}
	}
	cout<<ans<<endl;
	ggr;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int INF = 1001001001;

int N, M, R;
int d[201][201];
int r[9];
int A, B, C;
int res;
bool used[9];

void dfs(int c, int las, int dist) {
    if (c == R) {
        if (res > dist) res = dist;
        return;
    }
    for (int i = 0; i < R; i++) {
        if (!used[i]) {
            used[i] = true;
            if (las == -1) dfs(c + 1, i, 0);
            else dfs(c + 1, i, dist + d[r[las]][r[i]]);
            used[i] = false;
        }
    }
}

int main() {
    cin >> N >> M >> R;
    rep(i, N) rep(j, N) if (i != j) d[i][j] = INF;
    rep(i, R) cin >> r[i], r[i]--;
    rep(i, M) {
        cin >> A >> B >> C;
        A--;
        B--;
        if (d[A][B] > C) d[A][B] = d[B][A] = C;
    }
    rep(k, N)rep(i, N)rep(j, N)if (d[i][j] > d[i][k] + d[k][j])d[i][j] = d[i][k] + d[k][j];

    res = INF;
    dfs(0, -1, 0);
    cout << res << endl;
}

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

static const int N = 101;

using namespace std;

int main () {
  int V[N + 1][N + 1], n, v, v2, k;

  for (int i = 0; i <= N; i++)
    for (int j = 0; j <= N; j++)
      V[i][j] = 0;

  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> v >> k;

    for (int j = 0; j < k; j++) {
      cin >> v2;
      V[v][v2] = 1;
    }
  }

  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++)
      cout << V[i][j] << (j == n ? "" : " ");
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int am,pm,maxe,num;
   char arfabet[]="ABCDE";
   while(cin>>am&&cin>>pm&&am!=0&&pm!=0){
        maxe=am+pm;num=0;
        for(int i=1;i<5;i++){
            cin>>am>>pm;
            if(am+pm>maxe){
                maxe=pm+am;num=i;
            }

        }
         cout<<arfabet[num]<<" "<<maxe<<endl;
   }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,n) for(int i=(a); i<(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

int main() {
  ll a ; cin >> a;
  double b; cin >> b;
  ll c = b*100 + 0.5;
  ll ans = a * c / 100 ;
  
  cout << ans << endl;
}
      


Measured memory_bytes: 3732
import java.util.*;

public class Main {
    static long mod = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int a = s / 100;
        int b = s % 100;

        if (a <= 12 && b <= 12 && a > 0 && b > 0) {
            System.out.println("AMBIGUOUS");
        } else if (b <= 12 && b > 0) {
            System.out.println("YYMM");
        } else if (a <= 12 && a > 0) {
            System.out.println("MMYY");
        } else {
            System.out.println("NA");
        }
    }
}


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

long long d,m,d1,d10,cont;

int main(){

	cin>>m>>d;
	
    for(int i=1;i<=m;i++){
        for(int j=1;j<=d;j++){
            d1=j%10;
            d10=j/10;
            
            if(d1>=2 && d10>=2 && (d1*d10)==i)cont++;
        }
	}

    cout<<cont<<endl;

return 0;
}


Measured memory_bytes: 256
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

h, w = MAP()
s = [input() for i in range(h)]
dp = [[inf]*w for i in range(h)]

if s[0][0] == '#':
    dp[0][0] = 1
else:
    dp[0][0] = 0

for i in range(h):
    for j in range(w):
        if i+1 < h:
            if s[i][j] == '.' and s[i+1][j] == '#':
                dp[i+1][j] = min(dp[i+1][j], dp[i][j]+1)
            else:
                dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        if j+1 < w:
            if s[i][j] == '.' and s[i][j+1] == '#':
                dp[i][j+1] = min(dp[i][j+1], dp[i][j]+1)
            else:
                dp[i][j+1] = min(dp[i][j+1], dp[i][j])

print(dp[h-1][w-1])

Measured memory_bytes: 10220
### constant

MAX_N = 100000
MOD = 100000007

KEYS = [3, 5, 5, 5, 5, 5, 5, 5, 3, 5]

### main

dp5 = [0]
(1..5).each{|i| dp5[i] = 1 << (i - 1)}

for i in (6..MAX_N)
  d5 = 1
  for j in (1..5)
    d5 = (d5 + dp5[i - j]) % MOD
  end
  dp5[i] = d5
end

dp3 = [0]
(1..3).each{|i| dp3[i] = 1 << (i - 1)}

for i in (4..MAX_N)
  d3 = 1
  for j in (1..3)
    d3 = (d3 + dp3[i - j]) % MOD
  end
  dp3[i] = d3
end

loop do
  line = gets.strip
  break if line == '#'

  count = 1
  i = 0

  while ! line[i].nil?
    ch = line[i]
    len = 1

    while ch == line[i + len]
      len += 1
    end

    dp = (KEYS[ch.to_i] == 5) ? dp5[len] : dp3[len]
    count = (count * dp) % MOD

    i += len
  end

  puts count
end

Measured memory_bytes: 8128
#include <stdio.h>

int main(void) {
	int a, b, c;
	int M, ope;
	ope = 0;

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

	if (a >= b && a >= c) {
		M = a;
	}
	else if (b >= a && b >= c) {
		M = b;
	}
	else {
		M = c;
	}
	if ((3 * M) % 2 == (a + b + c) % 2) {
		ope = (3 * M - (a + b + c)) / 2;
	}
	else {
		ope = (3 * (M + 1) - (a + b + c)) / 2;
	}

	printf("%d\n", ope);

	return 0;
}

Measured memory_bytes: 128
import math

def check(x):
    if x <= 1:
        return 0
    k = int(math.sqrt(x))
    for i in range(2, k+1):
        if x % i == 0:
            return 0
    return 1

n = int(input())
while check(n) == 0:
    n += 1
print(n)


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

string S;

int main(){
	cin>>S;
	if(S.size()&1){
		puts("No");
	}
	else{
		for(int i=0;i<S.size();i+=2){
			if(S[i]!='h'||S[i+1]!='i'){
				puts("No");
				return 0;
			}
		}
		puts("Yes");
	}
}


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


using namespace std;


int main()
{
	int n;cin >> n;int a[2020];
	for(int i = 1; i <= n ; i++) cin >> a[i];
	int f = 1;
	for(int i = 1; i <= n ;i++){
		if(a[i] % 2 == 1) continue;
		else{
			if(a[i] % 3 != 0 && a[i] % 5 != 0) {
				f = 0;break;
			}
		}
	}
	if(f == 1) printf("APPROVED\n");
	else printf("DENIED\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rrep(i, n) for(int i=((int)(n));i>0;i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)	
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define REVSORT(c) SORT(c);REVERSE(c)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
const long long MOD = 1000000007;
typedef long long ll;

int main(){
	char a, b;
	cin >> a >> b;
	char ans = '=';
	if(a > b)ans = '>';
	else if(a < b)ans = '<';
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  int k;
  cin>>n>>k;
  string s;
  cin>>s;
  s[k-1]+=0x20;
  cout<<s<<endl;

  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
ll N;
cin>>N;
ll cnt=0;
ll ans=0;
for (int i = 1; i<=sqrt(N); i++)
{
    
    if(N%i==0 && N/i -1 >i ){
        ans += N / i - 1;
    }
    ll tmp = N / i;
    if(N%tmp==0 && N/tmp-1>tmp) ans += N / tmp - 1;
}

cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 256
#include <functional>
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <sstream>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <cctype>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queue>
#include <stdio.h>
#include <stack>
#include <ctime>
#include <list>
#include <map>
#include <set>
#include <assert.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define TR(i,x) for(__typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define ALL(x) x.begin(),x.end()
#define SORT(x) sort(ALL(x))
#define CLEAR(x) memset(x,0,sizeof(x))
#define FILL(x,c) memset(x,c,sizeof(x))

using namespace std;

const double eps = 1e-8;

#define PB push_back
#define MP make_pair

typedef map<int,int> MII;
typedef map<string,int> MSI;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<long double> VD;
typedef pair<int,int> PII;
typedef long long int64;
typedef long long LL;
typedef unsigned int UI;
typedef long double LD;
typedef unsigned long long ULL;

int cnt[4];

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

    int ans = 0;
    REP(i, n) {
        string s;
        cin >> s;

        for (int j = 0; j + 1 < s.size(); ++j) {
            if (s[j] == 'A' && s[j + 1] == 'B') {
                ++ans;
            }
        }

        int mask = 0;
        if (s[0] == 'B') mask |= 1;
        if (s.back() == 'A') mask |= 2;

        ++cnt[mask];
    }
    int m = min(cnt[1], cnt[2]);
    if (cnt[3] > 0 && m > 0 && cnt[1] == cnt[2]) {
        --m;
    }
    cnt[1] -= m;
    cnt[2] -= m;
    ans += m;
    if (cnt[3] > 0) {
        ans += cnt[3] - 1;
        if (cnt[1] > 0) ++ans;
        if (cnt[2] > 0) ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 1; i < (int)(n); i++)
int64_t MOD=1000000007;


int main() {

  int n; cin>>n;
  int ans[100005];
  
  rep (x, 105) {
    rep (y, 105) {
      rep (z, 105) {
        ans[x*x + y*y + z*z + x*y + x*z + y*z]++;
      }
    }
  }
  for (int i=1; i<=n; i++) {
    cout<< ans[i] <<endl;
  }
}


Measured memory_bytes: 3852
a = int(input())
b = list(input())
c = 0
for i in range(a):
    d = {}
    e = {}
    for j in range(0, min(i+1, a)):
        if b[j] not in d:
            d[b[j]] = 1
    for j in range(i+1, a):
        if b[j] in d and b[j] not in e:
            e[b[j]] = 1

    c = max(c, len(e))
print(c)


Measured memory_bytes: 3064
#include<stdio.h>
#include<iostream>
using namespace std;
int main(void){
	int i,s;
	scanf("%d",&s);
	if(s >= 400 && s <= 599){
	        printf("8");
	}else if (s>=600 && s<= 799 ){
	       printf("7");
	}else if (s>=800 && s<= 999 ){
	       printf("6");
	}else if (s>=1000 && s<=1199 ){
	       printf("5");
	}else if (s>=1200 && s<= 1399 ){
	       printf("4");
	}else if (s>=1400 && s<= 1599 ){
	       printf("3");
	}else if (s>=1600 && s<= 1799 ){
	       printf("2");
	}else if (s>=1800 && s<= 1999 ){
	       printf("1");
	}
}


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

int n;
vector<int> d;
template <class T>
void readVector(int n, vector<T> &v){
    for(int i=0; i<n; ++i){
        T t;
        cin >> t;
        v.push_back(t);
    }
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n;
	readVector(n, d);
	sort(d.begin(), d.end());
	int ans = 1;
	int tmp = d[0];
	for(int i=1; i<n; ++i){
		if(d[i] > tmp){
			tmp = d[i];
			++ans;
		}
	}
	cout << ans << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>

#define rep(i,p) for(long long int i=0;i<p;i++)
#define reep(i,p) for(long long int i=1;i<=p;i++)
#define ll long long

using namespace std;

int main(){


ll int D,T,S;
cin >> D >> T >> S;

if((double)(D)/(double)(S)<=(double)(T)){
	cout <<"Yes";
}
else{
	cout << "No";
}










	return 0;

}



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

ll powll(ll a,ll n){
  if(n==0)
  {
    return 1;
  }
  return powll(a,n-1)*a;
}


int main() {
   ll i,j,k;
   ll n;
   string s;
   cin >>s; 
   n=s.size();

   for(i=0; i<(n-1)/2; i++)
   {
     if(s[i]!=s[n-i-1])
     {
        cout<<  "No"<<endl;
        return 0;
     }
   }

n=(n-1)/2;

if(n==2)
{
  if(s[0]==s[1])
  {
     cout<<  "Yes"<<endl;
        return 0;
  }else
  {
     cout<<  "No"<<endl;
        return 0;
  }
  
}
  for(i=0; i<(n-1)/2; i++)
  {
    if(s[i]!=s[n-i-1])
    {
         cout<<  "No"<<endl;
        return 0;
    }
  }

   cout<< "Yes" <<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def solve():
    s = input()
    if s == "ABC":
        print("ARC")
    else:
        print("ABC")

    return 0

if __name__ == "__main__":# {{{
    solve()

# vim: set foldmethod=marker: }}}


Measured memory_bytes: 79684
from functools import reduce

# 入力
N = int(input())
S1 = input()
S2 = input()

MOD = 1000000007


class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(
                pow(self.x, other.x, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    def __radd__(self, other):
        return ModInt(other + self.x)

    def __rsub__(self, other):
        return ModInt(other - self.x)

    def __rmul__(self, other):
        return ModInt(other * self.x)

    def __rtruediv__(self, other):
        return ModInt(other * pow(self.x, MOD - 2, MOD))

    def __rpow__(self, other):
        return ModInt(pow(other, self.x, MOD))


# (1x2)x2 と (2x1) を1ブロックとみなして、色の塗り方の組合せを数え上げる
ans, _ = reduce(
    lambda acc, s:
        (3 * acc[0], 3) if acc[1] == 0 and s[0] == s[1] else
        (6 * acc[0], 1) if acc[1] == 0 and s[0] != s[1] else
        (acc[0], 2) if acc[1] == 1 else
        (acc[0], 3) if acc[1] == 2 and s[0] == s[1] else
        (3 * acc[0], 1) if acc[1] == 2 and s[0] != s[1] else
        (2 * acc[0], 3) if acc[1] == 3 and s[0] == s[1] else
        (2 * acc[0], 1),
    zip(S1, S2),
    (ModInt(1), 0)
)

# 出力
print(ans)


Measured memory_bytes: 3572
#include<stdio.h>
int main(void)
{
	int n;
	int a[10000];
	int b[10000];
	int i;
	int suma,sumb;
	
	scanf("%d",&n);
	while(n!=0){	
		suma=0;
		sumb=0;
		for(i=0;i<n;i++){
			scanf("%d %d",&a[i],&b[i]);
			if(a[i]>b[i]){
				suma=suma+a[i]+b[i];
			}
			else if(a[i]<b[i]){
				sumb=sumb+a[i]+b[i];
			}
			else{
				suma=suma+a[i];
				sumb=sumb+b[i];
			}
		}
		printf("%d %d\n",suma,sumb);
		scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 1104
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const auto INF = (ll)1e9;
using v = vector<ll>;
using m = map<int,int>;
using vv = vector<v>;


int main(){
    int n;
    cin >> n;
    int f[100][10]={0};
    ll   p[100][11] ={0};
    ll   c[100] = {0};
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < 10; j++)
        {
             cin >> f[i][j];     
        }   
    }
    
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j <= 10; j++)
        {
           cin >> p[i][j];
        }   
    }
    
    ll ans = -INF;
    for (int j = 1; j< 1<<10; j++)
    {
        ll c[100] = {0};
        ll temp=0;
        for (int jj = 0; jj < 10; jj++)
        {
            temp=0;
            for (int i = 0; i < n; i++)
            {
                if(1&(j>>jj)&&f[i][jj]){
                  	c[i]++;
                }
            }

            for (int i = 0; i < n; i++)
            {
                temp +=p[i][c[i]];
            }
        }
      	
        ans = max(temp,ans);
    }
    cout << ans;
}


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

#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 1e9 + 7;

template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

int op(int a, int b) { return max(a, b); }
int e() { return 0; }

int main() {
    int i, j;
    int n, k;
    cin >> n >> k;
    int m = 303030;
    vector<int> a(m);
    for (i = 0; i < n; i++) cin >> a[i];

    segtree<int, op, e> seg(m);

    for (i = 0; i < n; i++) {
        int l = max(a[i] - k, 0);
        int r = min(a[i] + k + 1, m);
        seg.set(a[i], seg.prod(l, r) + 1);
    }
    cout << seg.prod(0, m) << endl;
}

Measured memory_bytes: 9892
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std; 
typedef long long LL;
const int MAXN=1E5+10;
int f[MAXN],sum[MAXN],tong[MAXN],a[MAXN];
long long sumans;

int main() {
	int N,K;
	scanf("%d",&N);
	sumans=0;
	for(int i=1;i<=N;++i) {
		scanf("%d",&a[i]);
		sumans+=a[i];
		tong[a[i]]+=1;
	}
	scanf("%d",&K);
	for(int i=1;i<=K;++i) {
		int b,c;scanf("%d%d",&b,&c);
		sumans-=1ll*tong[b]*b;
		sumans+=1ll*tong[b]*c;
		
		tong[c]+=tong[b];
		tong[b]=0;
		
		printf("%lld\n",sumans);
	}
	
	return 0;
} 

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
  pr(b);
}

int ans = 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{

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

  int count = 0;
  while (count < 2)
  {
    if (a > b)
    {
      ans += a;
      a--;
    }
    else
    {
      ans += b;
      b--;
    }
    count++;
  }
  pr(ans);

  return 0;
}


Measured memory_bytes: 3624
use proconio::input;

fn main() {
    input! {
        n: u64,
        m: u64,
        k: u64,
        book_a: [u64; n],
        book_b: [u64; m],
    }

    let mut accum_a = vec![0];
    let mut accum_b = vec![0];
    
    let mut acc = 0;
    for a in &book_a {
        acc += a;
        accum_a.push(acc);
    }
    acc = 0;
    for b in &book_b {
        acc += b;
        accum_b.push(acc);
    }

    let mut maximum = 0;
    let mut index_b = accum_b.len() - 1;
    for (i, a) in accum_a.iter().enumerate() {
        if k < *a {
            break;
        }
        while k - a < accum_b[index_b] {
            index_b -= 1;
        }
        if maximum < i + index_b {
            //println!("i {} index_b {}", i, index_b);
            maximum = i + index_b;
        }
    }

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


Measured memory_bytes: 12720
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#define int long long
using namespace std;
signed main() {
	string A,B,C;
    cin>>A>>B>>C;

    if(A[A.size()-1]==B[0]&&B[B.size()-1]==C[0]){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String[] strlist = str.split(" ");
		int a = Integer.parseInt(strlist[0]);
		int b = Integer.parseInt(strlist[2]);
		int answer = 0;

		if(strlist[1].equals("+")){
			answer = a + b;
		}else {
			answer = a - b;
		}


		System.out.println(answer);


	}

}


Measured memory_bytes: 21588
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main()
{
        //input->compute->output//
        int X;
        cin >> X;

        int ans = 1;
        for (int b = 2; b < X + 1; b++)
        {
                int power = b * b;
                for (int p = 2;; p++)
                {
                        if (power>X)
                        {
                                break;
                        }
                        ans = max(ans, power);
                        power *= b;
                }
        }
        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))

sum = 0
min = 1000000000
flag = 1
for i in range(n):
  sum += abs(A[i])
  if min > abs(A[i]):
    min = abs(A[i])
  if A[i] < 0:
    flag *= -1
    
if flag == 1:
  print(sum)
else:
  print(sum - min * 2)

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

int dp[210][110];
int d,n,t[210],a[210],b[210],c[210];

int main(){
  cin >> d >> n;
  for(int i=0;i<d;i++)cin >> t[i];
  for(int i=0;i<n;i++)cin >> a[i] >> b[i] >> c[i];

  for(int i=0;i<=d;i++)
    for(int j=0;j<=100;j++)dp[i][j] = -1;
  for(int j=0;j<n;j++)
    if(a[j]<=t[0] && t[0]<=b[j])dp[0][c[j]] = 0;

  for(int i=1;i<d;i++){
    for(int j=0;j<n;j++){
      if(a[j]<=t[i] && t[i]<=b[j]){
	for(int k=0;k<=100;k++){
	  if(dp[i-1][k]>=0)dp[i][c[j]] = max(dp[i][c[j]],dp[i-1][k]+abs(k-c[j]));
	}
      }
    }
  }

  int ans = 0;
  for(int i=0;i<=100;i++)ans = max(ans,dp[d-1][i]);
  cout << ans << endl;
}

Measured memory_bytes: 1252
import sys

n = int(sys.stdin.readline().strip())
a = [int(s) for s in sys.stdin.readline().strip().split(' ')]

app = True
for ai in a:
    if ai % 2 == 0:
        if ai % 3 != 0 and ai % 5 != 0:
            app = False

if app:
    print('APPROVED')
else:
    print('DENIED')


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

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

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

  ll bd = b-1;

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


  ll ans = a*bd/b;
  cout<<ans;
}


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

int main(){

    int N;
    cin >> N;

    int X5 = 100000 - 10000;
    int X3 = 1000 - 100;
    int X1 = 9;
    int X = 0;
    int ans = 0;

    if(N / 100000 != 0){
        ans = X5 + X3 + X1;
    }else if(N / 10000 != 0){
        X = N - 10000 + 1;
        ans = X + X3 + X1;
    }else if(N / 1000 != 0){
        ans = X3 + X1;
    }else if(N / 100 != 0){
        X = N - 100 + 1;
        ans = X + X1;
    }else if(N / 10 != 0){
        ans = X1;
    }else{
        ans = N;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int q[N];
int main()
{
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
	int n,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>q[i];
		if(i%2==1&&q[i]%2==1)ans++;
	}
	cout<<ans;


}


Measured memory_bytes: 3600
a=(1..4).map{(1..3).map{[0]*10}}
gets
while gets
b,f,r,v=$_.split.map &:to_i
a[b-1][f-1][r-1]+=v
end
puts a.map{|b|b.map{|f|' '+f*' '}*$/}*($/+?#*20+$/)

Measured memory_bytes: 6112
#include <cstdio> 
#include <iostream>
#include <string>
using namespace std;
int n,m,i,j;
string s[110];
int main(){
	cin>>n>>m;
	for(i=1;i<=n;++i)cin>>s[i];
	for(i=1;i<=m+2;++i)putchar('#');
	puts("");
	for(i=1;i<=n;++i)cout<<'#'<<s[i]<<'#'<<endl;
	for(i=1;i<=m+2;++i)putchar('#');
	puts("");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using namespace boost::multiprecision; 
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define nl '\n'
#define mp make_pair
#define debug1(x) cout <<#x<<" "<<x<<'\n';
#define debug2(x,y) cout <<#x<<" "<<x <<" "<<#y<<" "<<y <<'\n';
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<'\n';
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
const int mod = (int)1e9+7;
pair<ll,ll>s4[4]={{-1,0},{1,0},{0,-1},{0,1}};
pair<ll,ll>s8[8]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,1},{1,0},{1,-1}};

void solve() {
    int k;
    cin >> k;
    int a,b;
    cin >> a >> b;
    for(int i=a;i<=b;i++) {
        if(i%k==0){
            cout << "OK\n";
            return;
        }
    }
    cout << "NG\n";
}

signed main() {
    boost;
    solve();
}

Measured memory_bytes: 3664
n=int(input())
a_list = list(map(int,input().split()))

mod = 10**9 + 7

a_sum = sum(a_list)

ans = 0
for i in range(0, n):
    ans += (a_list[i] * (a_sum - a_list[i]))
ans = ans // 2
print(ans % mod)

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

using namespace std;


#ifdef zxc

#include <sys/resource.h>
#include "debug.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ll = int64_t;
using ld = double;
const ld EPS = 1e-9;
//const ll MOD = 924844033;
const ld PI = 3.141592653589793;
const int maxn = 300001;

void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}


signed main() {
#ifdef zxc
    struct rlimit rl;
    const rlim_t kStackSize = 512L * 1024L * 1024L;
    assert(!getrlimit(RLIMIT_STACK, &rl));
    rl.rlim_cur = kStackSize;
    assert(!setrlimit(RLIMIT_STACK, &rl));
    freopen("../kolya_input.txt", "r", stdin);
//    freopen("../kolya_output.txt", "w", stdout);
#else
    //    mt19937 mt(std::chrono::high_resolution_clock::now().time_since_epoch().count());
    //            freopen("", "r", stdin);
    //        freopen("hack.out", "w", stdout);
#endif
    fast_io();
    cout.precision(6);
    cout << fixed;
    auto start = chrono::steady_clock::now();
    int k, a, b;
    cin >> k >> a >> b;
    for (int i = a; i <= b; ++i) {
        if (i % k == 0) {
            cout << "OK";
            return 0;
        }
    }
    cout << "NG";
    auto end = chrono::steady_clock::now();

    debug("time", chrono::duration_cast<chrono::milliseconds>(end - start).count() / 1000.0);

}



Measured memory_bytes: 3688
s = int(input())
num = s
a = [s]
exists = False
while exists == False:
	if num % 2 == 0:
		num = int(num / 2)
	else:
  		num = 3 * num + 1
	if num in a:
		exists = True
	a.append(num)
print(len(a))

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

int main(){
    int n,cntr=0,cntl=0;
    string s;
    cin >> n >> s;
    for(int i = 0;i < n;i ++){
        if(s[i]=='(') cntl ++;
        if(s[i]==')'){
            if(cntl) cntl --;
            else cntr ++;
        }
    }
    s = string(cntr,'(') + s + string(cntl,')');
    cout << s << endl;
    return 0;
}

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

int main() {
  int n;
  unsigned long int sum = 0;
  cin >> n;

  for (int i = 1; i <= n; ++i) {
    if (i % 3 != 0 && i % 5 != 0) {
      sum += i;
    }
  }

  cout << sum << endl;
}


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

typedef long long ll;
#define forn(i,n) for (int i = 0; i < int(n); i++)

bool solve() {
    int n; cin >> n;

    map<int,int> cnt;
    forn(i,n) {
        int x; cin >> x;
        cnt[x]++;
    }

    vector<int> num, rep;
    for (auto kv : cnt) {
        num.push_back(kv.first);
        rep.push_back(kv.second);
    }

    if (num.size() == 1) {
        return num[0] == 0;
    }
    else if (num.size() == 2) {
        return num[0] == 0 && rep[0]*2 == rep[1];
    }
    else if (num.size() == 3) {
        return (num[0]^num[1]^num[2]) == 0 && (rep[0] == rep[1]) && (rep[1] == rep[2]);
    }
    else return false;
}

int main() {
    cout << (solve() ? "Yes" : "No");
    return 0;
}


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

int main() {
  int n;

  cin >> n;

  vector<int> h;

  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    h.push_back(tmp);
  }

  int ans = 0, cnt = 0;

  for (int i = (int)h.size() - 1; i > 0; i--) {
    if (h.at(i) <= h.at(i - 1))
      cnt++;
    else
      cnt = 0;
    ans = max(ans, cnt);
  }

  cout << ans;

  return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cmath>
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  int sum = 0;
  for (int i = 0;;i++){
    string s = to_string(a+i);
    string rev;
    for (int j = 0;j < 2;j++)
      rev += s.substr(4-j,1);
    if (s.substr(0,2) == rev)
      sum++;
    if ((a+i) == b)
      break;
  }
  cout << sum << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define INF 10000000000000009
#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl



signed main(){
    int N;
    int P=0,p[15];
    cin >> N;
    REP(i,N){
        cin >> p[i];
        P+=p[i];
    }
    sort(p,p+N);
    cout << P-p[N-1]/2 << endl;
    return 0;
}   


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N=1e5;
int main()
{
    FASTINOUT;
    int a,b,x;
    cin>>a>>b>>x;
    if (a>x)
        cout<<"NO\n";
    else{
        x-=a;
        if (x>b)
            cout<<"NO\n";
        else
            cout<<"YES\n";
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String s1 = sc.next();
	String s2 = sc.next();

	char[] c1 = s1.toCharArray();
	char[] c2 = s2.toCharArray();

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

	char ch1, ch2;
	int max = Math.min(c1.length, c2.length);
	for(int i = 0; i<max; i++) {
	    ch1 = c1[i];
	    ch2 = c2[c2.length-1-i];
	    if(ch1<ch2) {
		System.out.println("Yes");
		return;
	    }
	    if(ch1>ch2) {
		System.out.println("No");
		return;
	    }
	}
	if(c1.length<c2.length) {
	    System.out.println("Yes");
	}else {
	    System.out.println("No");
	}



    }
}

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

ones = []
t = 0
for i in range(N):
    if i == 0:
        t += 1
        pass
    elif (S[i - 1] != S[i]):
        ones.append(t)
        t = 1
    else:
        t += 1
ones.append(t)

if S[0] == '0':
    t = ones
    ones = [0]
    ones.extend(t)

res = 0
if len(ones) >= (2 * K + 1):
    for k in range(2 * K + 1):
        res += ones[k]
else:
    print(sum(ones))
    res = -1

ans = res
if res >= 0:
    for i in range(2 * K + 1, len(ones), 2):
        res += ones[i]
        if i + 1 < len(ones):
            res += ones[i + 1]

        res -= ones[i - 2 * K] + ones[i - 2 * K - 1]
        if ans < res:
            ans = res
    print(ans)

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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;

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

Measured memory_bytes: 3616
N=int(input())
A=list(map(int,input().split()))

if A[0]:
    if N==0 and A[0]==1:
        print(1)
    else:
        print(-1)
    exit()

B=[0 for _ in range(N)]

B.append(A[-1])
for i in range(N)[::-1]:
    B[i]=B[i+1]+A[i]

r=1
ans=1
for i in range(1,N+1):
    t=min(r*2,B[i])
    ans+=t
    r=t-A[i]
    if r<0:
        print(-1)
        exit()

print(ans)

Measured memory_bytes: 20108
#include<stdio.h>
#include<string.h>
int main(void){
  char s[11];
  int len, i;
  int cnt = 0;
  int kaisuu = 0;
  
  scanf("%s", s);
  len = strlen(s);
  
  for(i = 0; i < len; i++){
    if(s[i] == 'A' || s[i] == 'T' || s[i] == 'C' || s[i] == 'G'){
      kaisuu++;
    }
    else{
      if(cnt < kaisuu){
        cnt = kaisuu;
      }
      kaisuu = 0;
    }
  }
  if(cnt < kaisuu){
    cnt = kaisuu;
  }
  printf("%d\n", cnt);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define pb push_back
#define pf push_front
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
typedef long long ll;
typedef pair<char, char> c_c;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
const int INF = 1000000007;
const ll LLINF = 1000000000000000007LL;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    vector<vector<int>> a(3, vector<int>(3));
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            cin >> a[i][j];
        }
    }
    vector<vector<int>> table(3, vector<int>(3));
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            table[i][j]=0;
        }
    }
    
    int n;
    cin >> n;
    

    for(int i=0; i<n; i++){
        int b;
        cin >> b;

        for(int i=0; i<3; i++){
            for(int j=0; j<3; j++){
                if(a[i][j]==b) table[i][j] = 1;
            }
        }
    }

    for(int i=0; i<3; i++){
        int ok1=0, ok2=0;

        for(int j=0; j<3; j++){
            ok1+=table[i][j];
            ok2+=table[j][i];
        }
        if(ok1==3 || ok2==3){
            cout << "Yes" << endl;
            return 0;
        }
    }
    if((table[0][0]+ table[1][1]+table[2][2]==3) || (table[2][0]+ table[1][1]+table[0][2]==3)){
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;

    return 0;
}   

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

void max_self (ll &a, ll b) {
    a = max(a, b);
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ///freopen("input.in", "r", stdin);
    ///freopen("output.out", "w", stdout);
    ll n, m;
    cin >> n >> m;
    ll dp[m + 1]{};
    for (ll i = 0; i < n; ++i) {
        ll first, second;
        cin >> first >> second;
        for (ll j = m - first; j >= 0; --j)
            max_self(dp[j + first], dp[j] + second);
    }
    ll ans = 0;
    for (ll i : dp)
        max_self(ans, i);
    cout << ans;
    return 0;
}

/**


**/


Measured memory_bytes: 1024