akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

void solve(long long N)
{
    cout << (N / 3) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    solve(N);
    return 0;
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<ll,int> pii;
typedef vector<ll> VL; const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	map<int, int> gs, ks;
	rep(i, n){
		int v; cin >>v;
		if(i%2) ks[v]++;
		else gs[v]++;
	}
	
	vector<pii> gps, kps;
	for(auto x: gs) gps.emplace_back(x.second, x.first);
	for(auto x: ks) kps.emplace_back(x.second, x.first);
	
	sort(gps.rbegin(), gps.rend());
	sort(kps.rbegin(), kps.rend());
	int ans = 1<<28;
	if(sz(gps)==1 && sz(kps) ==1 && gps[0].second == kps[0].second){
		cout << n/2 <<"\n"; return 0;
	}
	if(gps[0].second != kps[0].second) ans = n - gps[0].first - kps[0].first;
	else{
		ans = n - gps[0].first - kps[1].first;
		ans = min<ll>(ans, n - gps[1].first - kps[0].first);
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 7288
N, x = map(int,input().split())
a = list(map(int,input().split()))

ans=0
if a[0] > x:
    ans += a[0] - x
    a[0] = x

for i in range(1,N):
    if a[i] + a[i-1] > x:
        ans += a[i] - (x - a[i-1])
        a[i] = x - a[i-1]
print(ans)

Measured memory_bytes: 20076
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main {
  int n, m;
  while (cin >> n >> m, n) {
    vector<int> c(m), x(n);
    cin >> c >> x;
    auto dp = vectors(n + 1, 256, INF);
    dp[0][128] = 0;
    rep(i, n) rep(j, 256) rep(k, m) {
      int y = min(255LL, max(0LL, j + c[k]));
      cmin(dp[i + 1][y], dp[i][j] + (x[i] - y) * (x[i] - y));
    }
    cout << *min_element(all(dp[n])) << endl;
  }
}



Measured memory_bytes: 43756
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

dp = [0] * n
commands = [""] * n

for i in range(n):
    if t[i] == "r":
        commands[i] = "p"
        dp[i] = p
    elif t[i] == "s":
        commands[i] = "r"
        dp[i] = r
    elif t[i] == "p":
        commands[i] = "s"
        dp[i] = s

    if k <= i:
        if commands[i] == commands[i-k]:
            commands[i] = ""
            dp[i] = 0

print(sum(dp))

Measured memory_bytes: 4852
#include <stdio.h>
#include <stdlib.h>
#define ms_valtype int

//比較関数
int compare_ms(ms_valtype a, ms_valtype b){
	return a - b;
}

//昇順
void sort_sub(ms_valtype *origin, int left, int right, ms_valtype *tmp){
	if(right - left > 1){
		int i, j, k, half = (left + right) / 2;
		sort_sub(origin, left, half, tmp);
		sort_sub(origin, half, right, tmp);
		for(i = left; i < right; i++){
			tmp[i] = origin[i];
		}
		for(i = left, j = left, k = half; i < right; i++){
			if(k == right){
				origin[i] = tmp[j];
				j++;
			}
			else if(compare_ms(tmp[j], tmp[k]) <= 0 && j < half){
				origin[i] = tmp[j];
				j++;
			}
			else{
				origin[i] = tmp[k];
				k++;
			}
		}
	}
}

void sort(ms_valtype *origin, int N){
	ms_valtype *tmp = (ms_valtype *)malloc(sizeof(ms_valtype) * N);
	sort_sub(origin, 0, N, tmp);
	free(tmp);
}

int bound(int k, int N, int *b){
	int l = -1, h, r = N;
	while(r - l > 1){
		h = (l + r) / 2;
		if(b[h] < k){
			l = h;
		}
		else{
			r = h;
		}
	}
	return r;
}

int main(){
	int N, i, j, ans = 0, xor;
	scanf("%d", &N);
	int *a = (int *)malloc(sizeof(int) * N);
	int *b = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%d", &a[i]);
	}
	for(i = 0; i < N; i++){
		scanf("%d", &b[i]);
	}
	for(i = 28; i >= 0; i--){
		int dig = 1 << i, cov = (dig << 1) - 1;
		xor = N & 1;
//		printf("i = %d\n", i);
		for(j = 0; j < N; j++){
			a[j] &= cov;
			b[j] &= cov;
		}
		sort(b, N);
/*		for(j = 0; j < N; j++){
			printf("b[%d] = %d\n", j, b[j]);
		}
*/		for(j = 0; j < N; j++){
			xor ^= bound(1 * dig - a[j], N, b) & 1;
			xor ^= bound(2 * dig - a[j], N, b) & 1;
			xor ^= bound(3 * dig - a[j], N, b) & 1;
		}
//		printf("bound1 = %d\n", bound1);
//		printf("bound2 = %d\n", bound2);
//		printf("bound3 = %d\n", bound3);
//		printf("xor = %d\n", xor);
		ans |= (xor << i);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 2560
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s[] = new String[n+1];
        s[0] = "a";
        for(int i=1;i<=n;i++){
            s[i] = sc.next();
        }
        int m = sc.nextInt();
        String t[] = new String[m+1];
        t[0] = "a";
        for(int i=1;i<=m;i++){
            t[i] = sc.next();
        }
        int a[] = new int[n+1];
        int b[] = new int[n+1];
        int c[] = new int[n+1];
        for(int i=0;i<=n;i++){
            a[i] = 0;
            b[i] = 0;
            c[i] = 0;
        }
        int max = 0;
        for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++){
                if(s[j].equals(s[i])){
                    a[i] += 1;
                }
            }
            for(int k=1;k<=m;k++){
                if(t[k].equals(s[i])){
                    b[i] += 1;
                }
            }
            c[i] = a[i] - b[i];
            if(c[i]>max){
                max = c[i];
            }
        }
        System.out.println(max);
    }
}

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

#define itr(a) begin(a), end(a)
#define pb push_back
#define x first
#define y second
#define endl '\n'

#define FAST cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

#ifndef __LOCAL
#define FILES(namein, nameout) freopen(namein, "r", stdin); freopen(nameout, "w", stdout); FAST;
#else
#define FILES(namein, nameout) FAST;
#endif //__LOCAL

using namespace std;
using namespace __gnu_pbds;
using python = void;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned short uss;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type> ordered_set;

const ll M = 1e9+7;
const ll N = 1024;
constexpr ll inf = 0x3f3f3f3f3f3f3f3f;
bool ban[N][N];
ll dp[N][N];
python solve(){
	FAST;
	ll n, m;
	cin>> n >> m;
	for(ll i =0;i<n;i++){
		for(ll j = 0;j<m;j++){
			char c;
			cin >> c;
			if(c == '#') ban[i][j] = 1;
		}
	}
	dp[0][0] = 1;
	for(ll i =0;i<n;i++){
		for(ll j = 0;j<m;j++){
			if(!i && !j) continue;
			if(ban[i][j]) dp[i][j] = 0;
			else{
				dp[i][j] = (i>0?dp[i-1][j]:0)+(j>0?dp[i][j-1]:0);
				dp[i][j] %=M;
			}
		}
	}
	cout << dp[n-1][m-1] << '\n';
}

signed main(){
	FAST;
	ll q = 1;
	//cin >> q;
	while(q--){
		solve();
	}
}

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

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

il ll val(int p){
	ll ans=1;
	while(p--) ans=ans*10;
	return ans;
}

il void ask(ll v){
	printf("? %lld\n",v);
	fflush(stdout);
}

il bool ans(){
	char tmp[4];
	scanf("%s",tmp);
	return tmp[0]=='Y';
}

int main(){
	ask((ll)1e18);
	if(ans()){
		//10^n
		int ul=1,ur=9;
		while(ul<=ur){
			int mid=ul+ur>>1;
			ask(val(mid)-1);
			if(ans()) ur=mid-1;else ul=mid+1;
		}
		printf("! %lld\n",val(ur));
		return 0;
	}
	//calc w
	int ul=1,ur=9;
	while(ul<=ur){
		int mid=ul+ur>>1;
		ask(val(mid-1));
		if(ans()) ul=mid+1;else ur=mid-1; 
	}
	int w=ur,res=val(ur)-1;//位数
	per0(i,w){
		ll ul=(i==w-1?1:0),ur=9;
		while(ul<=ur){
			ll mid=ul+ur>>1;
			ask(res*val(9)-(9-mid)*val(i+9)+999999999);
			if(ans()) ur=mid-1;else ul=mid+1;
		}
		res-=(9-ul)*val(i);
	}
	printf("! %d\n",res);
	return 0;
}


Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(ll i=0;i<N;i++)
typedef long long ll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int P,Q,R;
    cin>>P>>Q>>R;
    cout<<P+Q+R-max({P,Q,R})<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <numeric>
#include <algorithm>
#include<queue>
#include<vector>
using namespace std;
typedef pair<int, int> P;

int main(){
  int x;
  for(int i=0; i<5; i++){
    cin >> x;
    if(x != i+1){
      cout << i+1 << endl;
      return 0;
    }
  }
}

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

signed main(void)
{
	int h, w;
	int g1, g2, g4;
	cin >> h >> w;
	vector<int> mp(26);
	rep(i, h) rep(j, w)
	{
		char c;
		cin >> c;
		mp[c - 'a']++;
	}
	g1 = 0;
	g2 = 0;
	g4 = (h / 2) * (w / 2);
	if (h % 2 == 0 || w % 2 == 0)
	{
		if (!(h % 2 == 0 && w % 2 == 0))
			g2 = (h % 2 == 0 ? h : w) / 2;
	}
	else
	{
		g1 = 1;
		g2 = (h / 2) + (w / 2);
	}

	rep(i, 26)
	{
		int v = mp[i];
		while (g4 > 0 && v >= 4)
		{
			v -= 4;
			g4--;
		}
		while (g2 > 0 && v >= 2)
		{
			v -= 2;
			g2--;
		}
		while (g1 > 0 && v >= 1)
		{
			v--;
			g1--;
		}
		if (v > 0)
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
int main(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	fastio
	ll n,k;
	cin>>n>>k;
	ll ar[n];
	for(int i=0;i<n;++i) cin>>ar[i];
	sort(ar,ar+n);
	ll sum=0;
	for(int i=0;i<n-k;++i) sum+=ar[i];
	cout<<sum;
	return 0;
}

Measured memory_bytes: 5160
p=1
while p==1:
    a,b=map(int,input().split())
    if a==0 and b==0:
        break
    else:
        if a%2==0:
            for i in range(int(a/2)):
                if b%2==0:
                    print("#."*int((b/2)))
                    print(".#"*int((b/2)))
                else:
                    print("#."*int((b/2))+"#")
                    print(".#"*int((b/2))+".")
        else:
            if b%2==0:
                for i in range(int(a//2)):
                    print("#."*int(b/2))
                    print(".#"*int(b/2))
                print("#."*int(b/2))
            else:
                for i in range(int(a//2)):
                    print("#."*int(b/2)+"#")
                    print(".#"*int(b/2)+".")
                print("#."*int(b/2)+"#")
    print()        


Measured memory_bytes: 5616
import sys

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")



a,b=MI()
x=a

if b == 1:
    print(0)
    exit()
if x >= b:
    print(1)
    exit()
for i in range(2,21):
    x+=(a-1)
    if x >= b:
        print(i)
        exit()

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

int main()
{
	int64_t a, b;
	scanf("%lld%lld", &a, &b);
	if (a <= 0 && 0 <= b) puts("Zero");
	else if (b < 0 && (b - a + 1) % 2 == 1) puts("Negative");
	else puts("Positive");

	return 0;
}

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

string station = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  int n;
  while(cin >> n, n){;
    vector<int> k(n);
    for(int i = 0; i < n; i++) cin >> k[i];
    string s;
    cin >> s;
    string ans = "";
    for(int i = 0; i < s.size(); i++){
      int prev = k[i % k.size()];
      int idx;
      for(int j = 0; j < station.size(); j++){
        if(station[j] == s[i]){
          idx = j;
          break;
        }
      }
      ans += station[(idx - prev + 52) % 52];
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3180
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    val l = IntArray(n) { sc.nextInt() }.toList()

    data class Len(val length: Int, val count: Int) {
        fun needMp(t: Int) = Math.abs(t - length) + (count - 1) * 10
        fun add(t: Int) = Len(length + t, count + 1)
    }


    fun calcMp(x: Len, y: Len, z: Len): Int {
        if (x.count == 0 || y.count == 0 || z.count == 0) return Int.MAX_VALUE
        val t = listOf(a, b, c)
        return t.map i@{ i ->
            t.map j@{ j ->
                t.map k@{ k ->
                    if (i == j || i == k || j == k) return@k Int.MAX_VALUE
                    x.needMp(i) + y.needMp(j) + z.needMp(k)

                }
            }.flatten()
        }.flatten()
            .min()!!
    }

    fun rec(x: Len, y: Len, z: Len, r: List<Int>): Int {
        if (r.isEmpty()) {
            return calcMp(x, y, z)
        }

        val nr = r.drop(1)
        val next = r.first()
        return listOf(
            rec(x, y, z, nr),
            rec(x.add(next), y, z, nr),
            rec(x, y.add(next), z, nr),
            rec(x, y, z.add(next), nr)
        ).min()!!
    }

    val ret = rec(Len(0, 0), Len(0, 0), Len(0, 0), l)
    println(ret)
}



Measured memory_bytes: 79384
#include<bits/stdc++.h>
using namespace std;
#define Elhabashy ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void input()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}
const int N=3000+5,mod=1e9+7;
typedef long long ll;
int n1,n2,dp[N][N];
string s1,s2;
int solve(int i=0,int j=0){
    if(i==n1 || j==n2)return 0;
    int &ret=dp[i][j];
    if(~ret)return ret;
    if(s1[i]==s2[j])return ret=1+solve(i+1,j+1);
    ret=solve(i+1,j);
    ret=max(ret,solve(i,j+1));
    return ret;

}
string ans="";
void build(int i=0,int j=0){
    if(i==n1 || j==n2)return ;
    int &ret=dp[i][j];

    if(s1[i]==s2[j]){
        ans+=s1[i];
        build(i+1,j+1);
        return ;
    }
    int ch1=solve(i+1,j);
    int ch2=solve(i,j+1);
    if(ch1==ret)
        build(i+1,j);
    else build(i,j+1);

}
int main()
{
    Elhabashy
    input();
    cin>>s1>>s2;
    n1=s1.length();n2=s2.length();
    memset(dp,-1,sizeof dp);
    int x=solve();
    build();
    cout<<ans<<endl;
}


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

int main() {
    int K;
	string S;
    cin >> K >> S;
	if(K>=S.size()){
		cout << S << endl;
	}else{
		for(int i=0;i<K;i++){
			cout << S[i];
		}
		cout << "..." << endl;
	}
	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
#define PI 3.1415926535897932384626433
#define ceil1(a,b)   (a+(b-1))/b
#define all(v)  v.begin(),v.end()
#define gen(arr,n,nxt)  generate(arr,arr+n,nxt)
#define base ios_base::sync_with_stdio(false);cin.tie(0);
#define open freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
using namespace std;
const int mo=1e9+7;
int nxt(){int x;cin>>x;return x;}
int mod(int n,int m){int ans=n%m;if(ans<0)ans+=m;return ans;}
int32_t main(){
    base
    int n=nxt();
    int arr[n];
    int cnt=0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        cnt+=arr[i];
        cnt=mod(cnt,mo);
    }
    int ans=0;
    for(int i=n-1;i>=0;i--){
        cnt-=arr[i];
        cnt=mod(cnt,mo);
        ans+=arr[i]*cnt;
        ans=mod(ans,mo);
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  
  int64_t H, W; cin >> H >> W;
  
  if (H == 1 || W == 1) {
    cout << 1 << endl;
    return 0;
  }
  
  if (H * W % 2 == 0) cout << H * W / 2 << endl;
  
  else cout << H * W / 2 + 1 << endl;
  
}

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

int main() {
    int A, B, C, X;
    cin >> A >> B >> C >> X;
    
    int cnt = 0;
    rep(i, A + 1) rep(j, B + 1) rep(k, C + 1) {
        if (500 * i + 100 * j + 50 * k == X) ++cnt;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
n = input()
slist = []
for i in range(int(n)):
  slist.append(input())

slist.sort()
cnt = 0

for i in range(int(n)):
  if i == 0:
    cnt += 1
    word = slist[i]
  elif word != slist[i]:
    cnt += 1
    word = slist[i]
    
print(cnt)

Measured memory_bytes: 23784
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);++i)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int N,M,j=0,ans=0,tmp=0;
priority_queue<int> Q;

signed main(){
  cin >> N >> M;
  vector<vector<int>> jobs(M+1);
  int a,b;
  rep(i,N){
    cin >> a >> b;
    if(a<=M) jobs[a].push_back(b);
  }
  for(int i=1;i<=M;i++){
    for(int b:jobs[i]) Q.push(b);
    if(Q.empty());
    else{
      ans+=Q.top();
      Q.pop();
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5632
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
       mut  a: i64, b: i64,mut  c: i64, d: i64,
    }

    loop {
        c -= b;
        if c <= 0 {
            println!("Yes");
            return;
        }
        a -= d;
        if a <= 0 {
            println!("No");
            return;
        }
    }
}


Measured memory_bytes: 2084
#include <stdio.h>

int main(){
  int a,b;
  int a_out=0,b_out=0;
  int i;
  
  scanf("%d %d",&a,&b);
  
  if(a<=b){
    for(i=0;i<b;i++){
      a_out*=10;
      a_out+=a;
    }
    printf("%d",a_out);
  } else {
    for(i=0;i<a;i++){
      b_out*=10;
      b_out+=b;
    }
    printf("%d",b_out);
  }
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  string s;
  cin >> s;
  cout << (s[5] == '0' && (s[6] - '0') <= 4 ? "Heisei" : "TBD");
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <memory>

//#define int long long

//#define ENABLE_TRACE
#ifdef ENABLE_TRACE
#define TRACE cout << __func__ << "()" << endl;
#define TRACE1(a) cout << __func__ << "(" << a << ")" << endl;
#define TRACE2(a, b) cout << __func__ << "(" << a << ", " << b << ")" << endl;
#else
#define TRACE
#define TRACE1(a)
#define TRACE2(a, b)
#endif  // #ifdef ENABLE_TRACE

using namespace std;

// Greatest Common Divisor
int Gcd(int a, int b) {
	TRACE2(a, b);
	if (a % b == 0) return b;
	return Gcd(b, a % b);
}

void Main()
{
	int n, m;
	cin >> n >> m;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	vector<int> good(n, 1);
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		if (h[a] < h[b]) {
			good[a] = 0;
		}
		else if (h[b] < h[a] ) {
			good[b] = 0;
		}
		else {
			good[a] = 0;
			good[b] = 0;
		}
	}

	int ans = 0;
	for (const auto& goodi : good) {
		ans += goodi;
	}

	cout << ans << endl;
}

int32_t main()
{
	Main();
	return 0;
}



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


int main(){
    ll x;
    cin >> x;
    ll p = 100, step = 0;
    while(p < x){
        p += p/100;
        step++;
    }
    cout << step << endl;
    return 0;
}

Measured memory_bytes: 3584
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        String x = in.next();

        int cnt = 0;

        for (int i = 0; i < n - 2; i++) {

            StringBuilder ans = new StringBuilder();
            ans.append(x.charAt(i));
            ans.append(x.charAt(i+1));
            ans.append(x.charAt(i+2));

            if (ans.toString().equals("ABC")) {
                cnt++;
            }

        }


        System.out.println(cnt);

    }

}


Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H,W,K;
  cin>>H>>W>>K;
  vector<string> A(H);
  for(string &S:A)cin>>S;
  int ans=H+W-2;
  for(int bi=0;bi<(1<<(H-1));bi++){
    bitset<15> S(bi);
    int cnt=S.count();
    vector<int> B(H);
    B[0]=0;
    for(int i=0;i<H-1;i++){
      B[i+1]=B[i];
      if(S.test(i))B[i+1]++;
    }
    vector<int> C(B[H-1]+1,0),D(B[H-1]+1,0);
    for(int i=0;i<W;i++){
      for(int j=0;j<H;j++){
        if(A[j][i]=='1')D[B[j]]++;
      }
      int mx=0,mx2=0;
      for(int j=0;j<H;j++)mx=max(mx,C[B[j]]+D[B[j]]),mx2=max(mx2,D[B[j]]);
      if(mx2>K){
        cnt=H+W;
        break;
      }
      if(mx>K){
        for(int j=0;j<H;j++)C[B[j]]=0;
        cnt++;
      }
      for(int j=0;j<H;j++){
        C[B[j]]+=D[B[j]];
        D[B[j]]=0;
      }
    }
    ans=min(ans,cnt);
  }
  cout<<ans<<endl;
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define INF LLONG_MAX/2
#define PI acos(-1.0)
//#define MOD 1000000007

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;
typedef priority_queue<int> PQi;

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;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vout(Vs &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());} //vectorの同じ要素消す
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
int leng(int n){string s=to_string(n); return s.size();} //intの桁数
int digitsum(int n){int ret=0; while(n>0){ret+=n%10;n/=10;}return ret;} //桁和
int lesscount(int x,Vi &a){return lower_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx未満の数の個数
int orlesscount(int x,Vi &a){return upper_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx以下の数の個数
int morecount(int x,Vi &a){return a.size()-orlesscount(x,a);} //vector aにおけるxより大きい数の個数
int ormorecount(int x,Vi &a){return a.size()-lesscount(x,a);} //vector aにおけるx以上の数の個数
int count(int x,Vi &a) {return upper_bound(ALL(a),x)-lower_bound(ALL(a),x);} //vector aにおけるxの個数
Vi accum(Vi &v){Vi ret((v).size()+1);REP(i,0,(v).size()) ret[i+1]=ret[i]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

int n,m,q,ans=0;
Vi a,b,c,d;
void dfs(Vi now,int sum){
    if(now.size()==n-1){
        Vi nowsum;
        nowsum.pb(1);
        REP(i,0,n-1) nowsum.pb(nowsum[i]+now[i]);
        //vout(nowsum);
        int tmpans=0;
        REP(i,0,q){
            if(nowsum[b[i]]-nowsum[a[i]]==c[i]) tmpans+=d[i];
        }
        chmax(ans,tmpans);
        return;
    }
    for(int i=0; sum+i<=m-1; i++){
        Vi ret=now;
        int retsum=sum;
        ret.pb(i);
        retsum+=i;
        dfs(ret,retsum);
    }
    return;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);
    cin>>n>>m>>q;
    a.resize(q); b.resize(q); c.resize(q); d.resize(q);
    REP(i,0,q){
        cin>>a[i]>>b[i]>>c[i]>>d[i];    
        a[i]--; b[i]--;
    }
    Vi t;
    dfs(t,0);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3668
MOD = 10 ** 9 + 7

n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

dp = [[0 for _ in range(m + 1)] for _ in range(n + 1)]
for i in range(1, n + 1):
    for j in range(1, m + 1):
        if a[i - 1] == b[j - 1]:
            dp[i][j] = (1 + dp[i - 1][j] + dp[i][j - 1]) % MOD
        else:
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1]) % MOD

print((dp[n][m] + 1) % MOD)

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

ll make_value(const vector<ll>& A, const ll& b, const int& A_size) {
  ll answer {};
  rep(i, A_size) {
    if (A[i] < b+i) {
      answer += (b+i)-A[i];
    } else {
      answer += A[i] - (b+i);
    }
  }
  return answer;
}

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

  int N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];

  ll min_A{A[0]};
  ll max_A{A[0]};
  rep(i, N) {
    mins(min_A, A[i]);
    maxs(max_A, A[i]);
  }
  ll value {};
  ll left {min_A-N};
  ll left_value {make_value(A, left, N)};
  ll right {max_A+N};
  ll right_value {make_value(A, max_A, N)};
  for(;right-left>1;) {
    ll mid = (left+right)/2;
    if (left_value < right_value) {
      value = make_value(A, mid, N);
      right = mid;
      right_value = value;
      left -= (mid-left)/2;
      left_value = make_value(A, left, N);
    } else {
      value = make_value(A, mid, N);
      left = mid;
      left_value = value;
      right += (right-mid)/2;
      right_value = make_value(A, right, N);
    }
  }
  value = min(left_value, right_value);
  cout << value << '\n';
}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
			//var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			//Console.SetOut(sw);

			//// 文字列の入力
			//string s = Console.ReadLine();

			//// 整数の入力
			//long n = long.Parse(Console.ReadLine());

			//// 文字列配列の入力
			//string[] inputStrArray = Console.ReadLine().Split(' ');

			//// 整数配列の入力
			//var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

			var data = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

			long a = data[0];
			long b = data[1];

			var ans = Math.Ceiling((a + b) / 2.0);

            Console.WriteLine(ans.ToString());

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 11348
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

    int k,s;
    cin >> k >> s;
    int ans=0;
    rep(x,k+1) {
        rep(y,k+1) {
            int z=s-x-y;
            if (z>=0 && z<=k) ++ans;
        }
    }
    cout << ans << endl;

   
    return 0;   
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
const int MOD = 1e9+7;
const int EPS = 1e-6;
#define pi 3.14159265358979323846
#define VI vector<int>
#define PII pair<int, int>
#define pb push_back
#define eb emplace_back
#define sz size
#define ll long long
#define REP(i, l, r, inc) for(int i=(l);i<(r);i+=(inc))
#define RREP(i, r, l, dec) for(int i=(r-1);i>=(l);i-=(dec))
#define endl '\n'

int dp[MAXN+1][3];
int n;

signed main() {
	cin.tie(0); cout.sync_with_stdio(0);
	cin >> n;
	REP(i, 1, n+1, 1) {
		int a, b, c;
		cin >> a >> b >> c;
		dp[i%2][0] = max(dp[(i-1)%2][1], dp[(i-1)%2][2])+a;
		dp[i%2][1] = max(dp[(i-1)%2][0], dp[(i-1)%2][2])+b;
		dp[i%2][2] = max(dp[(i-1)%2][0], dp[(i-1)%2][1])+c;
	}
	cout << max(max(dp[n%2][0], dp[n%2][1]), dp[n%2][2]) << endl;
}

Measured memory_bytes: 3648
import math

def main():
 a,b,c = map(int, input().split())
 c = c * (math.pi / 180)

 h = b * math.sin(c)
 s = a * h /2
 l = math.sqrt(a**2 - 2*a*b*math.cos(c) + b**2) + a + b

 print(s,l,h)

if __name__ == '__main__':
  main()


Measured memory_bytes: 5712
#include<iostream>
#define INDEX 100000
#define NULLL -1
using namespace std;

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

Node node[INDEX];
int depth[INDEX];

void setDepth(int u, int p);
void printChildren(int u);

int main() {
	int i, j, n, d, id, dim, tmp, cleft;
	
	cin >> n;
	
	for (i = 0; i < n; i++) {
		node[i].parent = NULLL;
		node[i].left = NULLL;
		node[i].right = NULLL;
	}
	
	for (i = 0; i < n; i++) {
		cin >> id >> dim;
		for (j = 0; j < dim; j++) {
			cin >> tmp;
			if (j == 0) node[id].left = tmp;
			else node[cleft].right = tmp;
			node[tmp].parent = id;
			cleft = tmp;
		}
	}

	i = 0;
	while(1) {
		if (node[i].parent == NULLL)break;
		i++;
	}
	setDepth(i, 0);

	for (i = 0; i < n; i++) {
		cout << "node " << i << ": parent = " << node[i].parent << ", depth = " << depth[i] << ", ";
		if (node[i].parent == NULLL)cout << "root";
		else if (node[i].left == NULLL)cout << "leaf";
		else cout << "internal node";
		cout << ", ";
		printChildren(i);
	}

	return 0;
}

void setDepth(int u, int p) {
	depth[u] = p;
	if (node[u].right != NULLL)setDepth(node[u].right, p);
	if (node[u].left != NULLL)setDepth(node[u].left, p + 1);
}

void printChildren(int u) {
	int i = 0, cleft;
	if (node[u].left == NULLL) {
		cout << "[]\n";
		return;
	}
	cout << "[" << node[u].left;
	cleft = node[u].left;
	while (node[cleft].right != NULLL) {
		cout << ", " << node[cleft].right;
		cleft = node[cleft].right;
	}
	cout << "]\n";
}

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

int main(){
    int n;
    cin>>n;
    vector<int> a(10000000);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int count=1;
        int ans=0;
    for(int i=0;i<n;i++){
        if(a[i]!=count){
            ans++;
        }
        else{
            count++;
        }

    }
    if(ans==n){
            cout<<-1<<endl;
        }
        else{
            cout<<ans<<endl;
        }

    return 0;
}

Measured memory_bytes: 39296
MOD = 10 ** 9 + 7
N = int(input())
M = len(bin(N)) - 2
L = bin(N)[2:]

dp = [[0] * 3 for _ in range(M + 1)]
dp[0][0] = 1

for i in range(M):
    if L[i] == '1':
        dp[i + 1][0] += dp[i][0]
        dp[i + 1][1] += dp[i][0] + dp[i][1]
        dp[i + 1][2] += 2 * dp[i][1] + 3 * dp[i][2]
    else:
        dp[i + 1][0] += dp[i][0] + dp[i][1]
        dp[i + 1][1] += dp[i][1]
        dp[i + 1][2] += dp[i][1] + 3 * dp[i][2]
    
    for j in range(3):
        dp[i + 1][j] %= MOD


print(sum(dp[M]) % MOD)


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

int main() {
  int n,k;
  cin>>n>>k;
  int test[n];
  for(int i=0; i<n; i++) cin>>test[i];

  for(int i=0; i<n-k; i++) {
    if(test[i]<test[i+k]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }

  return 0;
}

Measured memory_bytes: 4336
#include <iostream>
#include <string>

using namespace std;

int main(){

	string s,t;
	cin>>s>>t;
	int sn=s.size();
	int tn=t.size();
	int a=0;
	int ans=0;
	for(int i=0;i<sn-tn+1;i++){

		for(int j=i;j<i+tn;j++){
		
			int x=0;
			if(s[j]==t[j-i]){
			
				a++;
			}

		}
		if(a>ans){
		
			ans=a;
		}
		a=0;
	}
	cout<<tn-ans<<'\n';
	return 0;
}



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

int main() {
  int n,ans = 0;
  cin >> n;
  vector<int>data(n);
  for(int i = 0;i < n;i++){
    cin >> data[i];
  }
  for(int i = 0;i < n-1;i++){
    if(data[i] == data[i+1]){
      ans++;
      i++;
    }
  }
  cout << ans << endl;
}


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

using namespace std;

int getMinCost (vector <int> &heights) {
    int n = heights.size();
    if (n <= 1) {
        return 0;
    }
    vector <int> dp(n);

    // for (int height : heights) {
    //     cout << height << " ";
    // }
    dp[0] = 0;
    dp[1] = abs(heights[0] - heights[1]);
    for (int i = 2; i < n; ++i) {
        dp[i] = min(dp[i - 2] + abs(heights[i - 2] - heights[i]), dp[i - 1] + abs(heights[i - 1] - heights[i]));
    }
    return dp.back();
}

int  main () {
    int n = 0;
    scanf("%d", &n);
    vector <int> heights(n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &heights[i]);
    }
    printf("%d\n", getMinCost(heights));
    return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int D, N; scanf("%d %d", &D, &N);
  vector<int> v;
  for (int i = 0; i < 100; ++i) {
    v.push_back(i);
  }
  v.push_back(101);
  int ans = v[N];
  for (int i = 0; i < D; ++i) {
    ans *= 100;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using V = vector<ll>;
#define _GLIBCXX_DEBUG
#define rep(i, a) for(int i = 0; i < a; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    string s; cin>>s;
    int ans=0;
    rep(i,4){
        if(s[i]=='+') ans++;
        else ans--;
    }
    cout<<ans<<endl;
}

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


int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> imos(n + 1, 0);
  rep(i, m)
  {
    int l, r;
    cin >> l >> r;
    imos[l-1]++;
    imos[r]--;
  }
  int ans = 0;
  int s = 0;
  rep(i, n)
  {
    s += imos[i];
    if (s == m)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
    int a[5];
    int m;
    for(int i=0;i<5;i++){
        cin>>a[i];
    }
    m=1000;
    int k=100;
    for(int i=0;i<5;i++){
        if(m>a[i]%10 && a[i]%10!=0){
            m=a[i]%10;
            k=i;
        }
    }

    int ans=0;

    for(int i=0;i<5;i++){
        if(i!=k){
            ans+=a[i]+(10-a[i]%10)%10;
        }
    }
    if(k!=100){
        ans+=a[k];
    }
    cout<<ans<<endl;

}

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

int main(void)
{
	int x;
	cin >> x;

	string ret;
	if(x < 1200)
		ret = "ABC";
	else
		ret = "ARC";
	
	cout << ret << endl;

	return 0;
}


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

priority_queue<int> q;

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0, x; i < n; i++) {
    scanf("%d", &x);
    q.push(x);
  }
  while (m--) q.push(q.top() >> 1), q.pop();
  long long ans = 0;
  while (!q.empty()) ans += q.top(), q.pop();
  printf("%lld", ans);
  return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using ll =long long int;
constexpr ll mod = 1e12;
int main()
{
	int n; cin >> n; string s; cin >> s;
	if (s.size() <= n)cout << s;
	else {
		for (int i = 0; i < n; ++i)cout << s[i];
		cout << "...";
	}
	return 0;
}

Measured memory_bytes: 3596
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
te=[]
ans=0
for i in range(n):
  if i-k<0:
    if t[i]=='r':
      te.append('p')
      ans+=p
    elif t[i]=='s':
      te.append('r')
      ans+=r
    elif t[i]=='p':
      te.append('s')
      ans+=s
  else:
    if t[i]=='r' and te[i-k]!='p':
      te.append('p')
      ans+=p
    elif t[i]=='s' and te[i-k]!='r':
      te.append('r')
      ans+=r
    elif t[i]=='p' and te[i-k]!='s':
      te.append('s')
      ans+=s
    else:
      te.append('other')
print(ans)


Measured memory_bytes: 47984
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>

using namespace std;


int main() {
	map<int, int> mp;
	long long int n, m = 0, tmp, ax = 0, k = 0, t[500000], s[500000] = {}, x, y, res = 0, a, b, c, GCD, two = 1, kisuu = 0, p, q, r, type = 0, memo;
	string str, str2[5000];
	cin >> n >> k;


	for (int i = 1; i <= n; i++) {
		cin >> t[i];
	}
	for (int i = 1; i <= k; i++) {
		s[i] = abs(t[i] - t[1]);
	}
	for (int i = k + 1; i <= n; i++) {
		tmp = 100000000000000;
		for (int j = 1; j <= k; j++) {
			if (tmp > s[i-j]+abs(t[i] - t[i - j])) {
				tmp = s[i - j] + abs(t[i] - t[i - j]);
				
			}
		}
		s[i] = tmp ;
	}
	cout << s[n];
}

Measured memory_bytes: 8064
#include<iostream>
#include<vector>

void dfs(int node, std::vector<int>& viz, std::vector<int> G[]){
	viz[node]++;
	for(int i = 0; i < G[node].size(); i++){
		if(!viz[G[node][i]]){
			dfs(G[node][i], viz, G);
		}

		viz[node] = std::max(viz[node], 1+ viz[G[node][i]]);
	}
}


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

	std::vector<int>G[n+1];

	for(int i = 0; i < m; i++){
		int x, y;
		std:: cin >> x >> y;
		G[x].push_back(y);
	}

	std::vector<int>viz(n+1, 0);
	for(int i = 1; i <= n; i++){
		if(!viz[i]){
			dfs(i, viz, G);
		}
	}

	int longestPath = 0;
	for(int i = 1; i <= n; i++){
		longestPath = std::max(longestPath, viz[i]);
		//std::cout << viz[i]<< " ";
	}

	std::cout << longestPath-1;
	return 0;
}

Measured memory_bytes: 8832
D = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(D)]
t = [int(input()) for i in range(D)]
cont = 0
last = [0]*26
for i in range(D):
    cont += s[i][t[i]-1]
    last[t[i]-1] = i+1
    for j in range(26):
        cont -= c[j]*(i+1-last[j])
    print(cont)

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

p = list(map(int, input().split()))
c = list(map(int, input().split()))

for i in range(len(p)):
    p[i] -= 1

ans = float("-inf")

for i in range(N):
    #iはスタートポジション
    pos = i
    #移動先のマスにかかれたポイント
    point = []
    total = 0
    while True:
        pos = p[pos]
        point.append(c[pos])
        # totalは周期の和がマイナスかプラスかで後々場合分けするために使う。(周期が負だったら一巡目で終わらせたい。周期が正だったらできる限り後の方で終わらせたい)
        total += c[pos]
        #スタートポジションに戻ってきた==サイクルを検知した
        if pos == i: break
    l = len(point)

    t = 0
    #total<0のときはif total>0以外の処理でまきとれる
    for i in range(l):
        t += point[i]
        #Kがi+1より小さい時のハンドリング
        if i+1 > K: break
        now = t
        if total > 0:
            #K-i-1の-1はポイントの一個目を獲得する時に1個動くので-1。二こ目のポイントを取る時はi=1で、K-2になり計算が合う。それをlでわり周期が何個回れるかを計算する
            #nowはtotalのセットが何個かあって、その先にpoint[i]がくっつくイメージ。[a,b,c] + [a,b,c] + [a,b,c] + ([a] or [a+b] + [a+b+c]) 
            now += (total * ((K-i-1)//l))
        ans = max(ans, now)
print(ans)



 



Measured memory_bytes: 80876
#include <iostream>

using namespace std;

int main(int argc, char const* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, K, i;
    cin >> A >> B >> K;
    for (i=A; i<A+K; ++i) {
        if (i > B) return 0;
        cout << i << endl;
    }
    for (i=i<B-K+1?B-K+1:i; i<=B; ++i) {
        cout << i << endl;
    }
    return 0;
}


Measured memory_bytes: 888
using System;

class Program
{
	static void Main(string[] args)
	{
		//入力数を分解して配置
		string[] input = Console.ReadLine().Split(' ');
		int a = int.Parse(input[0]);
		int b = int.Parse(input[1]);

		if ((a * b) % 2 == 1)
		{
			Console.WriteLine("Odd");
		}
		else
		{
			Console.WriteLine("Even");
		}
	}
}

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

int main(){
    string ans;
    for(int i = 0; i < 3; i++) {
        string s;
        cin >> s;
        ans.push_back(s[0] + 'A' - 'a');
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<list>
#define MOD 1000000007LL
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
int main() {
    int n;
    cin>>n;
    ll a[114514]={};
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    ll sum=a[0];
    int ans=0;
    for(int i=1;i<n;i++){
        if(2*sum<a[i]){
            ans=i;
        }
        sum+=a[i];
    }
    ans=n-ans;
    cout<<ans<<endl;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
main()
{
    int a,b[1007],c[1007],e,d[1007],f,t,i,j,k=0;
    cin>>t>>a;
    for(i=0;i<t;i++){
        cin>>b[i]>>c[i];
        if(c[i]<=a){
            d[k]=b[i];
            k++;}}
            sort(d,d+k);
            if(k==0)
                cout<<"TLE"<<endl;
            else
            cout<<d[0]<<endl;
            return 0;}



Measured memory_bytes: 256
import sys
import math
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()
A = INT()
B = INT()
C = INT()
D = INT()
E = INT()
F = [A, B, C, D, E]
G = [math.ceil(N/f)-1 for f in F]

#print(G)
print(5+max(G))

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

using namespace std;
const int IINF = INT_MAX;
using ll = long long;
using P = pair<int,int>;
#define INF 1000000000000
int main(){
    int a; 
    int b = 1;
    
   while(cin >> a){
   		if(a == 0){
   			cout << b << endl;
   			return 0;
   		}
   		b++;
   }
    
    return 0;	
}

Measured memory_bytes: 3548