akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    int s1 = stoi(s.substr(0,2));
    int s2 = stoi(s.substr(2,2));
    bool flag1 = false, flag2 = false, flag3 = false, flag4 = false;
    if(1 <= s1 && s1 <= 12) flag1 = true;
    if(0 <= s2) flag2 = true;
    if(1 <= s2 && s2 <= 12) flag3 = true;
    if(0 <= s1) flag4 = true;
    if(flag1 && flag2 && flag3 && flag4){
        cout << "AMBIGUOUS" << endl;
        return 0;
    }
    if(flag1 && flag2){
        cout << "MMYY" << endl;
        return 0;
    }
    if(flag3 && flag4){
        cout << "YYMM" << endl;
        return 0;
    }
    else{
        cout << "NA" << endl;
        return 0;
    }
}



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

using namespace std;

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

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

#define VIN(v) for(auto&elem_: (v) )cin>>elem_
#define VOUT(v, sep) for(_loop_int idx=0; idx<(_loop_int)v.size(); idx++) {cout<<v[idx]; if(idx<(_loop_int)v.size()-1) cout<<sep;} cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define DEBUG(x) cerr<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cerr<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cerr<<#v<<":";REP(debugidx,v.size())cerr<<" "<<v[debugidx];cerr<<endl
#define DEBUG_ARR(v,n) cerr<<#v<<":";REP(debugidx,n)cerr<<" "<<v[debugidx];cerr<<endl

const ll MOD = 1000000007ll;
const int IINF = numeric_limits<int>::max()/2-1;
const ll LINF = numeric_limits<ll>::max()/2-1;

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

#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

template <typename ... Args>
string format(const string& fmt, Args ... args )
{
    size_t len = snprintf( nullptr, 0, fmt.c_str(), args ... );
    vector<char> buf(len + 1);
    snprintf(&buf[0], len + 1, fmt.c_str(), args ... );
    return string(&buf[0], &buf[0] + len);
}

string solve(string s){
    int pos=-1;
    REP(i,s.size()){
        if(s[i]=='.'){
            pos=i;
            break;
        }
    }

    s.erase(s.begin()+pos);
    return s;
}
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    long double a,b,c;
    cin>>a>>b>>c;
    long double x = sqrt(a);
    long double y = sqrt(b);
    long double z = sqrt(c);

    // //string sx = to_string(x);
    // string sx = format("%.6f", x);
    // string sy = format("%.6f", y);
    // string sz = format("%.6f", z);

    // //DEBUG(sx);
    // sx = solve(sx);
    // sy = solve(sy);
    // sz = solve(sz);
    // //DEBUG(sx);

    // a = stol(sx);
    // b = stol(sy);
    // c = stol(sz);

    //cout<<setprecision(12)<<x<<endl;
    
    if(a+b + 2*(x*y) < c) yn;
    return 0;
}

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

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


    vector<int> dp(n+1);
    dp[0] = 0;
    for (int i = 1; i < n; ++i) {
        dp[i] = INT_MAX;
        for(int j=i-1;j>=0 && i-j<=k;j--) {
            dp[i] = min(dp[j] + abs(v[i]-v[j]), dp[i]);
        }
    }

    cout << dp[n-1] << "\n";

    // for (int i = 0; i < n; ++i) {
    //     cout << dp[i] << " " ;
    // }

    return 0;
}

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

int main(){
    string n;
    string t;
    int sum = 0;
    cin >> n;
    for(int i = 0; i < n.size(); i++){
            n[i] = toupper(n[i]);
    }
    
    while(1){
        cin >> t;
        if(t == "END_OF_TEXT"){
            break;
        }
        for(int i = 0; i < t.size(); i++){
            t[i] = toupper(t[i]);
        }
        if (n == t){
            sum += 1;
        }
    }
    cout << sum << endl;
    
    return 0;
}



Measured memory_bytes: 3188
#include <iostream>
using namespace std;
int main(){
	int A=0,B=0,rs=0,i=3;
  	cin >> A >> B;
	while(--i){
     if(A>B){
      rs += A--;
     }else{
      rs += B--; 
     }
    }
  	cout << rs << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAX = 100005;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;

int main()
{
    string a, b;
    cin >> a >> b;
    if(a.length() > b.length())
    {
        for(int i = 0; i < b.length(); ++i)
            cout << a[i] << b[i];
        for(int i = b.length(); i < a.length(); ++i)
            cout << a[i];
    }
    else
    {
        for(int i = 0; i < a.length(); ++i)
            cout << a[i] << b[i];
        for(int i = a.length(); i < b.length(); ++i)
            cout << a[i];
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define PI acos(-1.0)
using namespace std;
int main()
{
    ll a,b;
    cin>>a>>b;
    int x = a%2;
    int y = b%2;
    if(x==y){
        cout<<(a+b)/2<<endl;
    }
    else cout<<"IMPOSSIBLE"<<endl;
    return 0;
}



Measured memory_bytes: 256
(sx, sy, tx, ty) = map(int, input().split())

dx = tx - sx
dy = ty - sy

result = []
result.extend(['R' for _ in range(dx)])
result.extend(['U' for _ in range(dy)])
result.extend(['L' for _ in range(dx)])
result.extend(['D' for _ in range(dy + 1)])
result.extend(['R' for _ in range(dx + 1)])
result.extend(['U' for _ in range(dy + 1)])
result.extend(['L'])
result.extend(['U'])
result.extend(['L' for _ in range(dx + 1)])
result.extend(['D' for _ in range(dy + 1)])
result.extend(['R'])
print("".join(result))


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
char ch;
int main()
{
	for(int i=1;i<=3;i++)
	{
		scanf("%c",&ch);
		if(ch=='7')
		{
			puts("Yes"); 
			return 0;
		} 
	}
	puts("No");
	return 0;
} 

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

int main() {
    int n;
    cin>>n;
    int a;
    for (int i = 0; i < n; i++) {
        cin>>a;
        if (a % 2 == 0) {
            if (a % 3 != 0 && a % 5 != 0) {
                cout<<"DENIED"<<endl;
                return 0;
            }
        }
    }

    cout<<"APPROVED"<<endl;
}


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

// O(n^2)バージョン
// 残りの方針
// (1)indexVec[i]を持つ辺を探す所に無駄が多いので、端点毎にどのような辺があるかをlistとして持っておく。
// (2)

namespace ABC126
{
	class Problem
	{
		static void Main(String[] args)
		{
			// 入力
			int N = int.Parse(Console.ReadLine());
			int[] u = new int[N - 1];
			int[] v = new int[N - 1];
			int[] w = new int[N - 1];
			for (int i = 0; i < N - 1; i++)
			{
				int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
				// 頂点の数字は配列番号と1ずれている事に注意
				u[i] = a[0] - 1;
				v[i] = a[1] - 1;
				w[i] = a[2];
			}
			// 計算
			// 木を構築して、先頭から距離を求めながら色分けをしていけば良い。
			// 木の性質として、どこでも先頭にできるというものがある。
			// 各点から、辺で直接つながっている頂点についてのu,v,wの配列番号を求めて格納する
			List<List<int>> edgeArray = new List<List<int>>(N);
			for (int i = 0; i < N; i++)
			{
				edgeArray.Add(new List<int>());
			}
			for (int i = 0; i < N - 1; i++)
			{
				edgeArray[u[i]].Add(i);
				edgeArray[v[i]].Add(i);
			}
			// 0からの距離を求める
			Int64[] rootWeight = new Int64[N];
			for (int i = 0; i < N; i++)
			{
				rootWeight[i] = -1;
			}
			int[] indexVec = new int[N];// 0から順番に見ていって、どの辺を次に計算するか
			for (int i = 0; i < N; i++)
			{
				indexVec[i] = 0;
			}
			indexVec[0] = 0;
			rootWeight[0] = 0;
			int lastIndex = 1;
			for (int i = 0; i < N; i++)
			{
				// indexVec[i]をi=0から順に見ていく。
				int nowRoot = indexVec[i];
				// indexVec[i]を頂点に持つ辺を探して、その辺に対して処理をする
				for (int j = 0; j < edgeArray[nowRoot].Count; j++)
				{
					// 端点にnowRootを持つ辺を計算
					int otherPoint = N;
					int index = edgeArray[nowRoot][j];
					if (u[index] == nowRoot)
					{
						otherPoint = v[index];
					}
					else if (v[index] == nowRoot)
					{
						otherPoint = u[index];
					}
					if (otherPoint < N && rootWeight[otherPoint] < 0)
					{
						// 辺を見つけた場合(かつ、まだ距離計算をしていない点である場合)
						// 距離の計算
						rootWeight[otherPoint] = rootWeight[nowRoot] + w[index];
						// 探索対象にotherPointを追加
						if (lastIndex < N)
						{
							indexVec[lastIndex] = otherPoint;
							lastIndex++;
						}
					}
				}
			}
			// 出力
			for (int i = 0; i < N; i++)
			{
				if (rootWeight[i]<=0 || rootWeight[i]%2==0)
				{
					Console.WriteLine(0);
				}
				else
				{
					Console.WriteLine(1);
				}
			}
		}
	}
}

Measured memory_bytes: 28740
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll N = 200005;
const ll mm = 1e+18;
void solve()
{
    int n,k;
    cin>>n>>k;
    bool a[10];
    memset(a,false,sizeof(a));
    rep0(i,k){
        int x;
        cin>>x;
        a[x]=true;
    }
    while(1){
        int x1=n;
        bool p=true;
        while(x1){
            if(a[x1%10]){
                p=false;
                break;
            }
            x1/=10;
        }
        if(p){
            cout<<n;
            return;
        }
        n++;
    }
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int N;
int main() {
  string S;
  cin >> S;
  N = S.length();

  string prev = "";
  string cur = "";
  int cnt = 0;
  REP(i, 0, N) {
    cur += S[i];
    assert(cur.length()<3);
    if (cur != prev) {
      cnt++;
      prev = cur;
      cur = "";
    }
  }
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin>>a;
  if(a==25) cout<<"Christmas"<<endl;
  else if(a==24) cout<<"Christmas Eve"<<endl;
  else if(a==23) cout<<"Christmas Eve Eve"<<endl;
  else cout<<"Christmas Eve Eve Eve"<<endl;
  return 0;
}


Measured memory_bytes: 256
//Just try and the idea will come
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll n,i,a[19];
ll go(ll l,ll r,ll x,ll y){
    if(r-l<2)return 0ll;
    ll res=1e18;
    for(ll i=l+1;i<r;i++)res=min(res,a[i]*(x+y)+go(l,i,x,y+x)+go(i,r,x+y,y));
    return res;
}
int main(){
    scanf("%lld",&n);
    for(i=1;i<=n;i++)scanf("%lld",&a[i]);
    printf("%lld",a[1]+a[n]+go(1,n,1,1));
}


Measured memory_bytes: 256
using System;

class Greatest_Common_Divisor {
	public static void Main() {

		string a = Console.ReadLine();
		string[] input = a.Split();
		int r;

		int n = int.Parse(input[0]);
		int m = int.Parse(input[1]);

		while(m != 0) {
		r = n % m;
		n = m;
		m = r;	
		}
		Console.WriteLine(n);
	}
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector <int> A(N);
	for (size_t i = 0; i < N; i++)
	{
		cin >> A.at(i);
		if (A.at(i) % 2 == 0) {
			if (A.at(i) % 5 != 0 && A.at(i) % 3 != 0) {
				cout << "DENIED";
				return 0;
			}
		}
	}
	cout << "APPROVED";
}

Measured memory_bytes: 256
from array import array

class BIT(object):

    def __init__(self, size, init_data=None):
        self.size = size
        if init_data is None:
            init_data = [0] * (size + 1)
        self.data = array("q", init_data)

    def sum(self, idx):
        ret = 0
        while idx > 0:            
            ret += self.data[idx]
            idx -= idx & -idx # idx = idx & (idx - 1)
        return ret

    def add(self, idx, value):
        while idx <= self.size:
            self.data[idx] += value
            idx += idx & -idx

if __name__ == "__main__":
    n, q = list(map(int, input().split()))
    bit = BIT(n)
    for _ in range(q):
        com, x, y = list(map(int, input().split()))
        if com == 0:
            bit.add(x, y)
        else:
            print(bit.sum(y)-bit.sum(x-1))

Measured memory_bytes: 9352
#include<bits/stdc++.h>
using namespace std;
int main()
{	
	string s;cin>>s;
	int l=0,r=s.size()-1;
	int num=0;
	while(l<r){
		if(s[l]!=s[r]) num++;
		l++;
		r--;
	}
	cout<<num<<'\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <numeric>
#include <cstdlib>

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

using namespace std;

int main()
{
    vector<ll> lunlun;
    lunlun.assign(100010, 0);
    ll k;
    cin >> k;
    queue<ll> que;
    rep(i, 9) {
        lunlun[i] = i + 1;
        que.push(i + 1);
        }
    ll cnt = 9;
    while (cnt < 100010){
        ll v = que.front();
        que.pop();
        int l_dig = v % 10;
        if(l_dig == 0){
            lunlun[cnt] = v * 10 ;
            que.push(lunlun[cnt]);
            cnt += 1;
            lunlun[cnt] = v * 10+1;
            que.push(lunlun[cnt]);
            cnt += 1;
        }else if(l_dig == 9){
            lunlun[cnt] = v * 10 + 8;
            que.push(lunlun[cnt]);
            cnt += 1;
            lunlun[cnt] = v * 10 + 9;
            que.push(lunlun[cnt]);
            cnt += 1;
        }else{
            lunlun[cnt] = v * 10 + l_dig -1 ;
            que.push(lunlun[cnt]);
            cnt += 1;
            lunlun[cnt] = v * 10 + l_dig ;
            que.push(lunlun[cnt]);
            cnt += 1;
            lunlun[cnt] = v * 10 + l_dig + 1 ;
            que.push(lunlun[cnt]);
            cnt += 1;
        }
    }        
    cout << lunlun[k-1] << endl;
    return 0;
}

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

void solve() {
  int n, a, b;
  cin >> n >> a >> b;
  vector<int> v(n);
  for (auto &i : v) {
    cin >> i;
  }
  int ans = 0;
  for (int i = 1; i < n; i++) {
    ans += min((v[i] - v[i - 1]) * a, b);
  }
  cout << ans << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) solve();
}


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

int main() {
	int N, x;
	cin >> N >> x;
	if (x == 1 || x + 1 == N << 1) {
		cout << "No";
		return 0;
	}
	cout << "Yes";
	queue<int> que;
	for (int i = 1, l = N << 1;i < l;++ i) if (abs(i - x) > 2) que.push(i);
	if (x > 2) que.push(x + 2);
	for (int i = 0;i < N - 2;++ i) {
		cout << endl << que.front();
		que.pop();
	}
	for (int i = 0;i < min(4, N + 1);++ i) {
		int n = x + (x == 2 ? 1 - i : i - 1);
		if (i == 3) n += x == 2 ? 4 : -4;
		cout << endl << n;
	}
	for (int i = 0;i < N - 3;++ i) {
		cout << endl << que.front();
		que.pop();
	}
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

まず、もし隣り合った2マスが同じ値なら、そこから上は全て同じ値になるね
ということは、ピラミッドの中央下2マスがxになるように作ると良さそう
これは、ピラミッドの1段目でそうなるように調整すれば簡単にできるね
つまり、x=1, 2N-1で無ければそうすれば作れる
*/

Measured memory_bytes: 2304
using System;
using System.Linq;

class Program
{
    static void Main(string[] args) {
        int n = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[] ans = new int[9];
        for(int i = 0; i < n; i++) {
            if(a[i]<400) ans[0] = 1;
            else if(a[i]>=400 && a[i]<800) ans[1] = 1;
            else if(a[i]>=800 && a[i]<1200) ans[2] = 1;
            else if(a[i]>=1200 && a[i]<1600) ans[3] = 1;
            else if(a[i]>=1600 && a[i]<2000) ans[4] = 1;
            else if(a[i]>=2000 && a[i]<2400) ans[5] = 1;
            else if(a[i]>=2400 && a[i]<2800) ans[6] = 1;
            else if(a[i]>=2800 && a[i]<3200) ans[7] = 1;
            else ans[8] ++;
        }
        int min = ans.Where((x,y) => y<8).Sum() + (ans.Where((x,y) => y<8).Sum() > 0 ? 0 : 1);
        int max = ans.Where((x,y) => y<8).Sum() + (ans[8]>0 ? ans[8] : 0);
        Console.WriteLine("{0} {1}", min, max);
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define int long long
using namespace std;
int a[200010],b[200010];
int l[200010],r[200010];
int n;
signed main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)cin>>b[i];
	for(int i=1;i<=n;i++){
		if(a[i]>b[i]){
			puts("-1");
			return 0;
		}
	}
	for(int i=2;i<=n;i++)l[i]=i-1;
	l[1]=n;
	for(int i=1;i<n;i++)r[i]=i+1;
	r[n]=1;
	int step=0;
	while(1){
		bool ok=1,ch=0;
		for(int i=1;i<=n;i++){
			if(a[i]==b[i])continue;
			if(a[i]>b[i]){
				puts("-1");
				return 0;
			}
			ok=0;
			int p=b[l[i]]+b[r[i]];
			if(b[i]-p<a[i])continue;
			step+=(b[i]-a[i])/p;
			b[i]-=(b[i]-a[i])/p*p;
			ch=1;
		}
		if(ok)break;
		if(!ch){
			puts("-1");
			return 0;
		}
	}
	cout<<step<<endl;
	return 0;
}


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


int main(void){
    int a[3];
    for(int i=0;i<3;i++){
        cin>>a[i];
    }
    sort(a,a+3);
    int dist[2];
    for(int i=0;i<2;i++){
        dist[i]=a[i+1]-a[i];
    }
    sort(dist,dist+2);
    int ans=0;
    for(int i=0;i<2;i++){
        ans+=dist[i];
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	long long x;
	cin >> x;
	for(long long i=-6208;i<=6208;i++)
	{
		for(long long j=-6208;j<=6208;j++)
		{
			long long tmp=0;
			tmp=i*i*i*i*i;
			tmp-=(j*j*j*j*j);
			if(tmp==x)
			{
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}






}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in(),K=in();
	auto D=vecin(K);
	vector<int> H(10,0);
	REP(i,K){
		H[D[i]]=1;
	}

	REP(i,100000){
		int V=i+1;
		if(V<N) continue;
		bool hate=false;
		while(V){
			int U=V%10;
			if(H[U]) hate=true;
			V/=10;
		}
		if(hate) continue;
		out(i+1);
		return 0;
	}
	
	return 0;
}


Measured memory_bytes: 256
lines=readlines.map{|line| line.split(' ').map(&:to_i)}
l=lines[1].length-1
j=1
k=0
for i in 0..l
  if lines[1][i]==j then
    k=k+1
    j=j+1
  end
end
if j!=1 then
  puts lines[1].length-k
elsif j==1 then
  puts "-1"
end

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, m, a[101001], b[101010], c[101010];
//union-find
struct UnionFind {
	vector<int> par, depth, sz;
	UnionFind(int n) : par(n+1), depth(n+1), sz(n+1){
		for(int i = 0; i <= n; i++){
			par[i] = i;
			depth[i] = 0;
			sz[i] = 1;
		}
	}
	int find(int x){
		if(par[x] == x) return x;
		else return par[x] = find(par[x]);
	}
	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;
		sz[x] += sz[y];
		sz[y] = sz[x];
		if(depth[x] < depth[y]){
			par[x] = y;
		}
		else{
			par[y] = x;
			if(depth[x] == depth[y]) depth[x]++;
		}
	}
	bool same(int x, int y){
		return find(x) == find(y);
	}
	int size(int x){
		return sz[find(x)];
	}
};
////
void solve(){
	cin >> n >> m;
	UnionFind uf(n);
	for(int i = 0; i < m; i++){
		cin >> a[i] >> b[i] >> c[i];
		a[i]--; b[i]--;
		c[i] %= 2;
		uf.unite(a[i],b[i]);
	}
	
	bool used[101010] = {0};
	int cnt = 0;
	for(int i = 0; i < n; i++){
		if(used[uf.find(i)]) continue;
		used[uf.find(i)] = 1;
		cnt++;
	}
	cout << cnt << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 2688
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(true) {
			int m=sc.nextInt();
			int f=sc.nextInt();
			int r=sc.nextInt();
			if(m*f*r==-1 && m+f+r==-3) {
				System.exit(0);
			}
			else {
				System.out.println(exam(m,f,r));
			}
		}
	}
	public static char exam(int m,int f,int r) {
		if(m == -1 || f == -1) {
			return 'F';
		}
		else if(m+f>=80) {
			return 'A';
		}
		else if(m+f>=65) {
			return 'B';
		}
		else if(m+f>=50) {
			return 'C';
		}
		else if(r>=50) {
			return 'C';
		}
		else if(m+f>=30) {
			return 'D';
		}
		else {
			return 'F';
		}
	}
}


Measured memory_bytes: 26284
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
#define F first
#define S second

int main(){
	string s;
	cin>>s;
	int sum=0;
	if(s=="SUN")sum=7;
	if(s=="MON")sum=6;
	if(s=="TUE")sum=5;
	if(s=="WED")sum=4;
	if(s=="THU")sum=3;
	if(s=="FRI")sum=2;
	if(s=="SAT")sum=1;
cout<<sum<<endl;
}





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

vector<vector<int>> V;
vector<int> vis;
int A, B;

void dfs(int f){
	if(vis[f]) return;
	vis[f] = 1;
	for(int t:V[f]) if(f!=A || t!=B) dfs(t);
}

int main(){
	int N, M; cin>>N>>M;
	V.resize(N);
	vis.resize(N);
	vector<pair<int,int>> E;
	for(int i=0; i<M; ++i){
		cin>>A>>B; --A, --B;
		E.emplace_back(A, B);
		V[A].push_back(B);
		V[B].push_back(A);
	}
	int ans = 0;
	for(auto [a,b]:E){
		A = a, B = b;
		for(auto& x:vis) x = 0;
		dfs(a);
		if(!vis[b]) ans++;
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 3584
import java.util.*;
class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        int[] array = {1,2,3};
        
        for(int i=0 ; i<3 ; i++){
            if((array[i]==a)||(array[i]==b)){
                array[i] = 0;
            }
        }
        
        for(int i=0 ; i<3 ; i++){
            if(array[i]!=0){
                System.out.println(array[i]);
                return;
            }
        }
    }
}

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

#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 ll = long long;

using namespace std;
int main() {
	ll s,allsum = 0;
	cin >> s;
	int len = (s == 1) ? 1 : ceil(log10(s));
	for (int bit = 0; bit < (1 << (len - 1)); bit++) {
		ll tmps = s, cut = 10;
		rep(i, len - 1) {
			if (bit & (1 << i)) {
				allsum += tmps % cut;
				tmps /= cut;
				cut = 1;
			}
			cut *= 10;
		}
		allsum += tmps;
	}
	cout << allsum << endl;
}


Measured memory_bytes: 512
import sys
def input():
    return sys.stdin.readline()[:-1]
a,b=map(int,input().split())
grid=[[0]*100 for i in range(100)]
grid[0]
for i in range(50):
    for j in range(100):
        grid[50+i][j]=1
h,i,j=99,0,0

while(i<a-1):
    grid[h][j]=0
    i+=1
    j+=2
    if j==100:
        j=0
        h-=2

h,i,j=0,0,0
while(i<b-1):
    grid[h][j]=1
    i+=1
    j+=2
    if j==100:
        j=0
        h+=2
print("100 100")
for i in range(100):
    tmp=""
    for j in range(100):
        if grid[i][j]==1:
            tmp+="#"
        else:
            tmp+="."
    print(tmp)

Measured memory_bytes: 39152
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define print(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
    string S;
    int sum = 0;
    cin >> S;
    rep(i,3) sum += S[i];
    if(sum == 'a'+'b'+'c') print(yes);
    else print(no);
}

Measured memory_bytes: 256
import sys
 
chash = {}
for i in range( ord( 'a' ), ord( 'z' )+1 ):
    chash[ chr( i ) ] = 0
 
for line in sys.stdin:
    for i in range( len( line ) ):
        if line[i].isalpha():
            chash[ line[i].lower() ] += 1
 
for i in range( ord( 'a' ), ord( 'z' )+1 ):
    print( "{:s} : {:d}".format( chr( i ), chash[ chr( i ) ] ) )

Measured memory_bytes: 6724
#include<iostream>
using namespace std;
int main(){
  int a[3];
  int m = 0,ans = 0;
  for(int i = 0; i < 3; ++i){
    cin >> a[i];
    if(m < a[i]) m = a[i];
  }
  ans =10*m + a[0] + a[1] + a[2] - m;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n, k = gets.chomp.split(" ").map(&:to_i)
h = gets.chomp.split(" ").map(&:to_i)

dp = Array.new(n, 0)
dp[0] = 0
dp[1] = (h[1] - h[0]).abs

for i in 2..n - 1
  min = Float::INFINITY
  for j in 1..k
    if i - j < 0
      break
    end

    cost = dp[i - j] + (h[i] - h[i - j]).abs

    if cost < min
      min = cost
    end
  end
  dp[i] = min
end

puts dp[n - 1]

Measured memory_bytes: 12044
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define INPUT(x) scanf("%d",&x)
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(s,e) for(int x = s; x <= e; x++)
#define BR printf("\n")
#define INF 2000000000
#define INTM_1 2147483647

int SEG[400000];//18

void upd(int i){
    if(i == 0) return;
    if(i%2 == 1){//l
        int p = (i-1)/2;
        SEG[p] = min(SEG[i],SEG[i+1]);
        upd(p);
    }else{
        int p = (i-2)/2;
        SEG[p] = min(SEG[i-1],SEG[i]);
        upd(p);
    }
}

void Updade(int i,int x){
    SEG[i+131071] = x;//i + 2^17-1
    upd(i+131071);
}

int Rmq(int a, int b, int k, int l, int r){
    if (b <= l || r <= a) return INTM_1;
    if (a <= l && r <= b) return SEG[k];
    else{
        int lm = Rmq(a,b,2*k+1,l,(l+r)/2);
        int rm = Rmq(a,b,2*k+2,(l+r)/2,r);
        return min(lm,rm);
    }
}

int main(){
    REP1(i,400000) SEG[i] = INTM_1;
    INT(n);INT(q);
    
    REP1(i,q){
        INT(com);INT(x);INT(y);
        if (com == 0) {
            Updade(x,y);
        }else{
            printf("%d\n",Rmq(x,y+1,0,0,131072));
        }
    }
    return 0;
}

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

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    string a,b,c;
    cin >> a;
    cin >> b;
    cin >> c;
    
    string who="a";
    int ta=0,tb=0,tc=0;
    int turn=0;
    while(turn<1000){
        if(who=="a"){
            if(ta==(int)a.length()){
                cout << 'A';
                return 0;
            }
            who=a[ta];
            ta++;
        }
        if(who=="b"){
            if(tb==(int)b.length()){
                cout << 'B';
                return 0;
            }
            who=b[tb];
            tb++;
        }
        if(who=="c"){
            if(tc==(int)c.length()){
                cout << 'C';
                return 0;
            }
            who=c[tc];
            tc++;
        }
        turn++;
    }



}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    int a, p;
    cin >> a >> p;
    cout << (a * 3 + p) / 2 << endl;

    return 0;
}

Measured memory_bytes: 256
l = list(map(int,input().split()))
N = l[0]
L = l[1]

apple =[]

for i in range(N):
    apple.append(L + i)

pie = 0
flag = 1
min = abs(L)
for i in range(N):
    pie = pie + apple[i]
    if abs(apple[i]) < min:
        min = abs(apple[i])
        if apple[i]<0:
            flag = -1
        else:
            flag = 1

pie = pie - flag * min

print(pie)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
struct TSP{
  int n,d[16][16],dp[(1<<16)][16];
  TSP(int sz):n(sz){
    for(int i=0;i<16;i++)
      for(int j=0;j<16;j++) d[i][j]=1e8;
  }
  void add(int a,int b,int c){
    d[a][b] = c;
    //d[b][a] = c;
  }
  int solve(){
    for(int i=0;i<(1<<n);i++)
      for(int j=0;j<n;j++) dp[i][j]=1e8;
    dp[0][0]=0;
    for(int i=0;i<(1<<n);i++){
      for(int j=0;j<n;j++){
        if(!((1<<j)&i)){
          for(int k=0;k<n;k++){
            dp[i|(1<<j)][j]=min(dp[i|(1<<j)][j],dp[i][k]+d[k][j]);
          }
        }
      }
    }
    if(dp[(1<<n)-1][0]==1e8)return -1;
    return dp[(1<<n)-1][0];
  }
};
int main(){
  int n,m;
  cin>>n>>m;
  TSP T(n);
  for(int i=0;i<m;i++){
    int x,y,z;
    cin>>x>>y>>z;
    T.add(x,y,z);
  }
  cout<<T.solve()<<endl;
}


Measured memory_bytes: 5124
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    let A = parseInt(arg[0].split(" ")[0]);
    let B = parseInt(arg[0].split(" ")[1]);
    let C = parseInt(arg[0].split(" ")[2]);
    let K = parseInt(arg[1].split(" ")[0]);
    
    while(K > 0) {
        if(B <= A) {
            B *= 2;
        } else if(C <= B) {
            C *= 2;
        }
        
        K--;
    }
    
    console.log(C > B && B > A ? "Yes" : "No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29680
S = input()
AB = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
if len(S) == 26:
    if S == "zyxwvutsrqponmlkjihgfedcba":
        print(-1)
    else:
        out, Fin = [], False
        for i in range(26):
            out.append(AB.index(S[-1]))
            out.sort()
            S = S[:len(S)-1]
            for o in out:
                if AB.index(S[-1]) < o:
                    S = S[:len(S)-1] + AB[o]
                    print(S)
                    Fin = True
                    break
            if Fin:
                break
else:
    for i in AB:
        if i not in set(S):
            S += i
            print(S)
            break


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>

using namespace std;

constexpr int NIL = -1;
int N;

// 自身のidは配列の要素数として管理する
struct Node {
	int parent; // 親
	int right; // 右の兄弟
	int left; // 左の子供
};

Node T[100000];
int D[100000];

void printChildren(int id) {
	cout << "[";

	int c = T[id].left;
	bool f = false;
	if (c != NIL) {
		cout << c;
		c = T[c].right;

		while (c != NIL) {
			cout << ", " << c;
			c = T[c].right;
		}
	}
	cout << "]";
}

void setDepth(int id, int d) {
	D[id] = d;

	if (T[id].right != NIL) {
		setDepth(T[id].right, d);
	}
	if (T[id].left != NIL) {
		setDepth(T[id].left, d + 1);
	}
}

string checkType(int id) {
	if (T[id].parent == NIL) return "root";
	else if (T[id].left == NIL) return "leaf";
	else return "internal node";
}

void print(int id) {
	cout << "node " << id << ": " << "parent = " << T[id].parent << ", depth = " << D[id]
		<< ", " << checkType(id) << ", ";

	printChildren(id);

	cout << endl;
}

int main() {
	cin >> N;

	for (int i = 0; i < N; i++) {
		T[i].parent = NIL;
		T[i].right = NIL;
		T[i].left = NIL;
	}

	int id = NIL;
	int cnum;
	for (int j = 0; j < N; j++) {
		cin >> id >> cnum;


		// 子供のidを調べる
		vector<int> cId(cnum);
		for (int i = 0; i < cnum; i++) {
			cin >> cId[i];
		}

		// 子供の設定
		for (int i = 0; i < cnum; i++) {

			// これが一番左の子
			if (i == 0) {
				T[id].left = cId[i];
			}
			// 子供に右の子を設定する
			if (i < cnum - 1) {
				T[cId[i]].right = cId[i + 1];
			}

			// 親を設定
			T[cId[i]].parent = id;
		}

	}

	int r;
	for (int i = 0; i < N; i++) {
		if (T[i].parent == NIL) {
			r = i;
			break;
		}
	}

	// 深さを計算する
	setDepth(r, 0);

	for (int i = 0; i < N; i++) {
		print(i);
	}

	return 0;
}


Measured memory_bytes: 7720
n,x = map(int, input().split() )
a = list(map(int,input().split()))
b = 0

a.sort()

for i in range(n) :
   b += a[i]
   if b > x :
      print(i)
      break
else :
   if b == x :
      print(n)
   else :
      print(n-1)

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

int main() {
  int n;
  while(cin >> n && n) {
    int ans=0;
    for(int i=0; i*i*i<=n; i++) {
      int x=n-i*i*i;
      for(int j=0; j<=x; j++) {
        if(j*(j+1)*(j+2)/6>x) break;
        if(x>=j*(j+1)*(j+2)/6) ans=max(ans,i*i*i+j*(j+1)*(j+2)/6);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3048
#include<stdio.h>

main(void) {
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	if (a == 7) {
		if (b == 5 && c == 5) {
			printf("YES");
		}else printf("NO");
	}
	else if (b == 7) {
		if (a == 5 && c == 5) {
			printf("YES");
		}
		else printf("NO");
	}
	else if (c == 7) {
		if (b == 5 && a == 5) {
			printf("YES");
		}
		else printf("NO");
	}

	return 0;
}

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

int main(){
  long long N;
  cin >> N;
  vector<long long> hs(N);

  for(long long i = 0; i < N; i++) {
    cin >> hs[i];
  }

  long long count = 0;
  for(long long i = 1; i <= 100; i++) {
    bool flipflop = true;
    for(long long j = 0; j < N; j++) {
      if(flipflop) {
        if(hs[j] - i >= 0) {
          count++;
          flipflop = false;
        }
      }
      else {
        if(hs[j] - i < 0) flipflop = true;
      }
    }
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>
#include <numeric>
#define M_PI       3.14159265358979323846

using namespace std;

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FILL(a, x) memset(a, x, sizeof(a))

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)

LL dp[105][100005];

int main() {
	int n, w;
	scanf("%d%d", &n, &w);
	REP(i, n) {
		int u, v;
		scanf("%d%d", &u, &v);
		REP(j, w + 1)dp[i + 1][j] = dp[i][j];
		REP(j, w - u + 1) {
			dp[i + 1][j + u] = max(dp[i + 1][j + u], dp[i][j] + v);
		}
	}
	LL ret = 0;
	REP(i, w + 1)ret = max(ret, dp[n][i]);
	printf("%lld\n", ret);
	return 0;
}

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

using namespace std;

#define sz(a) (int)(a).size()
typedef long long ll;

int n;
int res [3010][3010];
vector <pair<int,int>> p;

int dp (int id, int rem)  {
	rem = max(0, rem);
	if (id == n) return 0;
	if (res[id][rem] != -1) return res[id][rem];
	
	int w = dp(id+1, rem);
	if (rem) w = max(w, dp(id+1, rem-p[id].first)+p[id].second);

	return res[id][rem] = w;
}

int main() {
	memset(res, -1, sizeof(res));
	int T;
	scanf("%d%d", &n, &T);

	p.resize(n);
	for (auto &x : p) {
		scanf("%d%d", &x.first, &x.second);
	}
	sort(p.begin(), p.end());

	cout << dp(0, T) << endl;
}




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

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

    if(a <= 12){
        b /= 2;
        if(a <= 5){
            b = 0;
        }
    }

    cout << b << endl;
    return 0;
}


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

int compute(int in, int c, int base)
{
    int low = (base - 1) / 10;
	if(base <= in){
		c += base - 1 - low;
		c = compute(in, c, base * 100);
	}else{
		c += max(0, in - low);
    }
	
	return c;
}

int main()
{
    // 整数の入力
    int in;
    cin >> in;
    
    // 出力
    cout << compute(in, 0, 10) << endl;

    return 0;
}

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

using namespace std;
const int maxn = 500010, inf = 1e9 + 233;
struct edge{int too, pre;}e[maxn << 1];
int n, x, y, tot, root, m;
int dep[maxn], mn[maxn][2], a[maxn], last[maxn];

inline void add(int x, int y) {e[++tot] = (edge){y, last[x]}; last[x] = tot;}

void dfs(int x, int fa)
{
	if (a[x] != -1 && ((a[x] - dep[x] + n) % 2 != (a[root] - dep[root] + n) % 2))
		puts("No"), exit(0);
	mn[x][0] = mn[x][1] = inf;
	for (int i = last[x], too; i; i = e[i].pre)
		if ((too = e[i].too) != fa)
		{
			dep[too] = dep[x] + 1;
			dfs(too, x);
			mn[x][0] = min(mn[x][0], mn[too][0]);
			mn[x][1] = min(mn[x][1], mn[too][1]);
		}
		
	if (a[x] != -1) mn[x][0] = min(mn[x][0], a[x] + dep[x]), mn[x][1] = min(mn[x][1], dep[x] - a[x]);
	
	if (mn[x][0] + mn[x][1] < 2 * dep[x]) puts("No"), exit(0);
}

inline bool check(int x, int delta)
{
	return (mn[x][0] + dep[x] - delta >= 2 * dep[x]) && (mn[x][1] + dep[x] + delta >= 2 * dep[x]);
}

void work(int x, int fa, int pre)
{
	if (a[x] == -1)
	{
		if (check(x, pre + 1)) a[x] = pre + 1;
		else a[x] = pre - 1;
	}
	
	for (int i = last[x], too; i; i = e[i].pre)
		if ((too = e[i].too) != fa)
			work(too, x, a[x]);
}

int main()
{
	scanf("%d", &n);
	for (int i = 1; i < n; i++)
		scanf("%d%d", &x, &y), add(x, y), add(y, x);
		
	for (int i = 1; i <= n; i++) a[i] = -1;
	scanf("%d", &m);
	for (int i = 1; i <= m; i++)
	{
		scanf("%d%d", &x, &y);
		a[x] = y;
	}
	root = x;
	
	dfs(root, 0);
	
	work(root, 0, 0);
	
	puts("Yes");
	for (int i = 1; i <= n; i++)
		printf("%d\n", a[i]);
}

Measured memory_bytes: 14956
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
#define pb push_back

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;
const double PI = acos(-1.0);


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}



const int MAX_N = 100010;

int group1[7] = { 1,3,5,7,8,10,12 };
int group2[4] = { 4,6,9,11 };

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n; cin >> n;
	VE c(n - 1), s(n - 1), f(n - 1);
	rep(i, n - 1)cin >> c[i] >> s[i] >> f[i];
	rep(i, n) {
		int now = 0;
		for (int j = i; j < n - 1; j++) {
			if (now < s[j])now += s[j] - now;
			else if (now % f[j] != 0) {
				now += f[j] - now % f[j];
			}
			now += c[j];
		}
		cout << now << endl;
	}
	return 0;
}

Measured memory_bytes: 256