akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
// #define endl "\n"

#define RIGHT 0
#define DIAG 1
#define DOWN 2

ll recurse(ll i, ll j, string& s, string& t, vector<vector<ll>>& dp, vector<vector<ll>>& pntr) {
    if (i == s.length() || j == t.length()) {
        return 0;
    }

    if (dp[i][j] != -1) {
        return dp[i][j];
    }

    if (s[i] == t[j]) {
        dp[i][j] = 1 + recurse(i+1, j+1, s, t, dp, pntr);
        pntr[i][j] = DIAG;
    } else {
        ll one = recurse(i + 1, j, s, t, dp, pntr);
        ll two = recurse(i, j + 1, s, t, dp, pntr);

        if (one > two) {
            dp[i][j] = one;
            pntr[i][j] = DOWN;
        } else {
            dp[i][j] = two;
            pntr[i][j] = RIGHT;
        }
    }
    return dp[i][j];
}

int main(void) {
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.tie(NULL);
    string s, t;
    cin >> s >> t;
    vector<vector<ll>> dp (s.length(), vector<ll> (t.length(), -1));
    vector<vector<ll>> pntr(s.length(), vector<ll>(t.length(), -1));
    recurse(0, 0, s, t, dp, pntr);
    string a;

    ll i = 0, j = 0;
    while(i < s.length() && j < t.length()) {
        if (pntr[i][j] == DIAG) {
            a.push_back(s[i]);
            i++;
            j++;
        } else if (pntr[i][j] == DOWN) {
            i++;
        } else {
            j++;
        }
    }
    cout << a << endl;


    
    return 0;
}

Measured memory_bytes: 141696
import java.util.*;
public class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    int R = sc.nextInt();

    if (R < 1200) {
      System.out.println("ABC");
    } else if (R < 2800) {
      System.out.println("ARC");
    } else {
      System.out.println("AGC");
    }

  }
}

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


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))

using namespace std;
int n,m;
char ban[70][70];
char ban2[70][70];


int main(){
  cin >> n >> m;
  string ans = "No";
  FOR(i,n){
    FOR(j,n){
      cin >> ban[i][j];
    }
  }
  FOR(i,m){
    FOR(j,m){
      cin >> ban2[i][j];
    }
  }
  FOR(i,n-m+1){
    FOR(j,n-m+1){
      int f = 0;
      FOR(k,m){
        FOR(l,m){
          if(ban[i+k-1][j+l-1]!= ban2[k][l]) f = 1;
        }
      }
      if (f==0) ans = "Yes";
    }
  }
  cout << ans <<endl;
  return 0;
}


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

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());

            var total = new BigInteger(0);
            for(var i = 1; i <= n; i++){
                if(i % 3 != 0 && i % 5 != 0){
                    total += i;
                }
            }

            Console.WriteLine(total);
        }
    }
}


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

long long x[100005];

struct WWUnionFind {
    vector<int> par;
    vector<int> sz;
    vector<long long> wt;
    vector<int> es;

    WWUnionFind(int n=0){
        if(n>0) initialize(n);
    }

    void initialize(int n){
        par.resize(n);
        sz.resize(n);
        wt.resize(n);
        es.resize(n);
        for(int i=0; i<n; i++){
            par[i] = i;
            sz[i] = 1;
            wt[i] = x[i];
            es[i] = 0;
        }
    }

    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;
        if(sz[x] < sz[y]){
            par[x] = y;
            sz[y] += sz[x];
            wt[y] += wt[x];
            es[y] += es[x];
        }else{
            par[y] = x;
            sz[x] += sz[y];
            wt[x] += wt[y];
            es[x] += es[y];
        }
    }

    bool same(int x, int y){
        return find(x) == find(y);
    }

    long long weight(int x){
        return wt[find(x)];
    }

    void add_edge(int x){
        x = find(x);
        es[x]++;
    }

    int result_edge(int x){
        x = find(x);
        int ret = es[x];
        es[x] = 0;
        return ret;
    }
};

struct edges
{
	int a;
	int b;
	long long y;

	bool operator<(const edges &cmp) const
	{
		return y<cmp.y;
	}
};

int main(int argc, char const *argv[])
{
	int n,m;
	cin>>n>>m;
	for (int i = 0; i < n; ++i)
	{
		cin>>x[i];
	}
	edges edge[m];
	for (int i = 0; i < m; ++i)
	{
		cin>>edge[i].a>>edge[i].b>>edge[i].y;
		--edge[i].a;--edge[i].b;
	}
	sort(edge,edge+m);
	WWUnionFind uf(n);
	int ans=0;
	for (auto v:edge)
	{
		uf.unite(v.a,v.b);
		uf.add_edge(v.a);
		long long w=uf.weight(v.a);
		if (w>=v.y)
		{
			ans+=uf.result_edge(v.a);
		}
	}
	cout<<m-ans<<endl;
	return 0;
}


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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long[] A = new long[(int) N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		Arrays.sort(A);
		long[] Match = new long[(int) N];
		if (N % 2 == 0) {
			int index = 0;
			for (long i = 1; i < N; i += 2) {
				Match[index] = i;
				index++;
				Match[index] = i;
				index++;
			}
		} else {
			int index = 1;
			Match[0] = 0;
			for (long i = 2; i < N; i += 2) {
				Match[index] = i;
				index++;
				Match[index] = i;
				index++;
			}
		}
		for (int i = 0; i < N; i++) {
			if (A[i] != Match[i]) {
				System.out.println(0);
				return;
			}
		}

		long ret = 1;
		for (int i = 0; i < N / 2; i++) {
			ret *= 2;
			ret %= 1000000007;
		}
		System.out.println(ret);

	}
}

Measured memory_bytes: 58208
#include<stdio.h>

int main(void){
  int n,a,b;
  scanf("%d %d %d",&n,&a,&b);

  if(a>=b){
    if((a+b)>=n){
      printf("%d %d",b,(a+b)-n);
    }else{
      printf("%d 0",b);
    }
  }else if(a<b){
    if((a+b)>=n){
      printf("%d %d",a,(a+b)-n);
    }else{
      printf("%d 0",a);
    }
  }
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

int32_t main(){
	int n;
	cin>>n;
	int ans = 0;
	for(int i=1;i<=n;i++){
		unless(i%3==0 || i%5==0){
			ans += i;
		}
	}
	cout<<ans;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
    string s;
    cin>>s;
    vector<bool> hoge(26);
    string ans;
    if(s.length()!=26){
        for(int i=0;i<s.length();i++){
            hoge[(char)s[i]-'a']=true;
        }
        int min;
        for(int i=0;i<26;i++){
            if(hoge[i]==false){
                min=i;break;
            }
        }
        ans=s;
        ans.push_back((char)'a'+min);
    }else{
        string hogefuga="zyxwvutsrqponmlkjihgfedcba";
        if(s==hogefuga){
            cout<<"-1"<<endl;
            return 0;
        }
        int min=s.back();
        int popcount;
        for(int i=0;i<26;i++){
            if(s[24-i]<s[25-i]){
                popcount=i+1;
                break;
            }
        }
        int i=0;
        while(true){
            if(s[25-popcount]<s[25-i]){
                char unti=s[25-i];
                for(int j=0;j<popcount;j++)
                    s.pop_back();
                s.back()=unti;
                break;
            }
            i++;
        }
        ans=s;
    }
    cout<<ans<<endl;
}

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

typedef long long int ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ar array
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll mod = 1e9 + 7;
const ll inf = 2e15 + 5;
double PI = 3.14159265358979323846;

void solve() {

    int n, w;
    cin >> n >> w;
    vl wt(n), val(n);
    ll V = 0;
    for (int i = 0; i < n; i++) {
        cin >> wt[i] >> val[i];
        V += val[i];
    }

    vl dp(V + 1, inf);
    dp[0] = 0;

    for (int i = 1; i <= n; i++) {
        for (int j = V; j >= 0; j--) {
            if (j - val[i - 1] >= 0) {
                dp[j] = min(dp[j], dp[j - val[i-1]] + wt[i - 1]);
            }
        }
    }

    ll ans = 0;
    for(int i = V;i >= 0;i--){
        if(dp[i]!=inf and dp[i] <= w){
            ans = i;
            break;
        }
    }
    cout << ans << endl;

}

int32_t main()
{
    IOS
    // int T; cin >> T; while (T--)
    solve();
    return 0;
}


Measured memory_bytes: 4004
import java.util.*;

public class Main {

	public static void main (String[] args)  {
		Scanner sc = new Scanner(System.in);
		char[] first = sc.next().toCharArray();
		long len = first.length;
		TreeSet<Integer>[] sets = new TreeSet[26];
		for (int i = 0; i < sets.length; i++) {
			sets[i] = new TreeSet<Integer>();
		}
		for (int i = 0; i < len; i++) {
			sets[first[i] - 'a'].add(i);
		}
		char[] second = sc.next().toCharArray();
		int line = 0;
		int idx = 0;
		for (char c : second) {
			Integer x = sets[c - 'a'].ceiling(idx);
			if (x == null) {
				idx = 0;
				line++;
				x = sets[c - 'a'].ceiling(idx);
				if (x == null) {
					System.out.println(-1);
					return;
				}
			}
			idx = x.intValue() + 1;
		}
		System.out.println(len * line + idx);
	}
}


Measured memory_bytes: 34192
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <cassert>

using namespace std;
using ll = long long;

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

int main()
{
    int a, b;
    cin >> a >> b;
    vector<int> ans(4, 1);
    ans[a] = 0;
    ans[b] = 0;
    for(int i = 1; i< 4; i++){
        if(ans[i] != 0){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var list = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).Where(x => x % 2 == 0).ToArray();
            Console.WriteLine((list.Where(x => (x % 3 == 0 || x % 5 == 0)).Count() == list.Count()) ? "APPROVED" : "DENIED");
        }
    }
}


Measured memory_bytes: 13396
#define FILEIO(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout);
#include <stdio.h>
#include <string.h>
#define N 5005
#define CLZ 1000000007
typedef long long ll;
int n,m,f[N][N];char s[N];
inline ll qpow(ll a,int b) {
	ll ans=1;
	for(;b;b>>=1) {
		if(b&1) ans=ans*a%CLZ;
		a=a*a%CLZ;
	}
	return ans;
}
int main() {
	//FILEIO("keyboard");
	int i,j,k,*cur,*nxt;
	scanf("%d%s",&n,s);
	m=strlen(s);f[0][0]=1;
	for(i=0;i<n;++i) {
		cur=f[i];nxt=f[i+1];
		for(j=0;j<=i;++j) {
			nxt[j+1]=(nxt[j+1]+(cur[j]<<1))%CLZ;
			k=j?j-1:0;
			nxt[k]=(nxt[k]+cur[j])%CLZ;
		}
	}
	printf("%d",int(f[n][m]*qpow(qpow(2,m),CLZ-2)%CLZ));
	return 0;
}

Measured memory_bytes: 96384
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
    int R[MAX], n;

    cin >> n;
    for (int i = 0; i < n; i++) cin >> R[i];

    int maxv = -2000000000;
    int minv = R[0];

    for (int i = 1; i < n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }

    cout << maxv << endl;

    return 0;
}

Measured memory_bytes: 3884
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
#include <string.h>
#include <cstring>

long long gcd(long long a, long long b){
    while(b!=0){
        long long r = a%b;
        a=b;
        b=r;
    }
    return a;
}
 
using namespace std;
int main() {
    double n;
    cin >> n;
    
    cout << 2*n*3.14159265358979 << endl;
    return 0;
}


Measured memory_bytes: 3784
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>

using namespace std;

#define memset_clear(_) memset(_,0,sizeof(_))
#define memset_clear_tre(_) memset(_,1,sizeof(_))
#define memset_clear_reg(_) memset(_,-1,sizeof(_))
#define memset_clear_max(_) memset(_,0x3f,sizeof(_))
#define memset_clear_min(_) memset(_,0x80,sizeof(_))
#define sqr(_) ((_)*(_))

#define int long long

inline int read(){
	int ret=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9') {if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
	return ret*f;
}

signed main(){
	int n=read();
	int ans=0;
	for (int i=1;i<=n;i++) if (i&1){
		int cnt=0;
		for (int j=1;j<=i;j++) if (i%j==0) cnt++;
		if (cnt==8) ans++;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 998244353
#define INF2 1000000000000000000
#define int long long

int F[2100010];

int Mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

void fact(void) {
	F[0] = 1;
	F[1] = 1;
	for (int i = 2; i <= 2100000; i++) {
		F[i] = Mul(i, F[i - 1]);
	}
}
int square(int x) {
	return (x * x) % mod;
}

int power(int x, int y) {
	if (y == 0) return 1;
	else if (y == 1) return x % mod;
	else if (y % 2 == 0) return square(power(x, y / 2)) % mod;
	else return square(power(x, y / 2)) * x % mod;
}

int Div(int a, int b) {
	return Mul(a, power(b, mod - 2));
}
int P(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return Div(F[n], F[n - r]);
}

int C(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	int ret;
	ret = Div(F[n], Mul(F[n - r], F[r]));
	return ret;
}
int H(int n, int r) {
	if (n == 0 && r == 0) return 1;
	return C(n + r - 1, r);
}
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, A, B, K;
    cin >> N >> A >> B >> K;
    int ans = 0;
    fact();
    rep(i, N + 1) {
        int remain = K - i * A;
        if (remain < 0 || remain % B != 0) continue;
        int j = remain / B;
        ans = (ans + Mul(C(N, i), C(N, j))) % mod;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 16640
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

void add(vector<int>& r,int w,int x,int p){
	if(!p)return;
	int lx = x-p < 0?0:x-p;
	int rx = x+p >w?w:x+p;
	r[lx]++;r[rx]--;
}

bool check(vector<int>&r){
	int rsum = 0;
	REP(i,r.size()-1){
		rsum+=r[i];
		if(!rsum)return false;
	}
	return true;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int n,w,h;
	cin>>n>>w>>h;
	vector<int> reach_w(w+1,0);
	vector<int> reach_h(h+1,0);
	REP(i,n){
		int x,y,p;
		cin>>x>>y>>p;
		add(reach_w,w,x,p);
		add(reach_h,h,y,p);
	}
	if(check(reach_w) || check(reach_h))cout << "Yes" << endl;
	else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632
#include"bits/stdc++.h"
using namespace std;
int check=0;
int num[32];
int func(int t)
{
	int count=0;
	while(t)
	{
		t-=t&-t;
		count++;
	}
	return count;
}
int main()
{
	int i,j;
	string str;
	int n;
	long long tmp,c;
	long long  sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		cin>>str;
		switch(str[0])
		{
			case 'M':check!=1<<4;
				 num[1<<4]++;
				 break;
			case 'A':check!=1<<3;
				 num[1<<3]++;
				 break;
			case 'R':check!=1<<2;
				 num[1<<2]++;
				 break;
			case 'C':check!=1<<1;
				 num[1<<1]++;
				 break;
			case 'H':check!=1<<0;
				 num[1<<0]++;
				 break;
		}
	}
	for(i=0;i<(1<<5);i++)
	{
		if(check&i!=i||func(i)!=3)
		{
			continue;
		}
		tmp=i;
		c=1;
		while(tmp)
		{
			c*=num[tmp&-tmp];
			tmp-=tmp&-tmp;
		}
		sum+=c;
	}
	printf("%lld",sum);
	return 0;
}

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

N = x[0]
L = x[1]

ls_N = []

for i in range(N):
    n = input()
    ls_N.append(n)

ls_N = sorted(ls_N)

# "".join(配列)で，””の中のものが入る．ただ続けたい場合は””の中に何も入れない

# sortedした文字列は自動で辞書順
s = "".join(ls_N)
print(s)

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;cin>>n;
  vector<P> r(n),b(n);
  rep(i,n)cin>>r[i].first>>r[i].second;
  rep(i,n)cin>>b[i].first>>b[i].second;
  sort(all(r));
  sort(all(b));
  int tot=0;
  rep(i,n){
      P t=b[i];
      int s=-1;
      int k=-1;
      rep(j,n){
        if(r[j].first<=t.first&&r[j].second<=t.second){
            if(r[j].second>s){
                s=r[j].second;
                k=j;
            }
        }
      }
      if(s!=-1){
        r[k].first=1000;
        tot++;          
      }
  }
  cout<<tot<<endl;
  return 0;
  }


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
vector<int> v[100010];
int ed[100010];
long long ans,m=1000000007;
int n,k;
void f(int x , int layer)
{
	int t=1;
	for(int i=0;i<v[x].size();i++)
	{
		if(ed[v[x][i]]==0)
		{
			ed[v[x][i]]=1;
			if(layer==1)
				ans*=(k-t) , t++;
			else
				ans*=(k-1-t) , t++;
			ans%=m;
			f(v[x][i] , layer+1);
		}
	}
}
int main()
{
	cin>>n>>k;
	ans=k;
	for(int i=1;i<=n-1;i++){
		int x,y;	cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	ed[1]=1;
	f(1 , 1);
	cout<<ans<<endl;
}

Measured memory_bytes: 10752
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

int main()
{
	int N;
	string tile;
	cin>>tile;
	N = tile.size();
	int blackFirst=0,whiteFirst=0;
	for(int i = 0; i < N; i++){
		if( i % 2 == 0){
			if( tile[i] == '0'){
				whiteFirst++;
			}else{
				blackFirst++;
			}
		}else{
			if( tile[i] == '1'){
				whiteFirst++;
			}else{
				blackFirst++;
			}
		}
	}
	cout<<min(blackFirst,whiteFirst)<<endl;
	return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, m;
    cin >> n >> m;
    int s[m], c[m];
    map<int, int> mp;
    rep(i, 0, m) {
        cin >> s[i] >> c[i];
        if (s[i] > n) {
            cout << -1 << endl;
            return 0;
        }
        if (mp[s[i]]) {
            if (mp[s[i]] != c[i]) {
                cout << -1 << endl;
                return 0;
            }
        } else {
            mp[s[i]] = c[i];
        }
        if (n >= 2 && s[i] == 1 && c[i] == 0) {
            cout << -1 << endl;
            return 0;
        }
    }
    string ans(n, '0');
    for (auto i : mp) {
        int d = i.first - 1;
        int num = i.second;
        ans[d] = char(num + '0');
    }
    if (n >= 2 && ans[0] == '0') ans[0] = '1';
    cout << ans << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

struct STree {
  int l, r;
  ll mx = 0;
  STree *left = 0;
  STree *right = 0;
  STree (int l, int r): l(l), r(r) {
    if (l == r) return;
    int m = (l + r) / 2;
    left = new STree(l, m);
    right = new STree(m + 1, r);
  }
  void update (const int pos, const ll val) {
    if (pos < l or r < pos) return;
    if (l == pos and pos == r) {
      mx = val;
      return;
    }
    left -> update(pos, val);
    right -> update(pos, val);
    mx = max(left -> mx, right -> mx);
  }
  ll getMax (const int L, const int R) {
    if (r < L or R < l) return 0;
    if (L <= l and r <= R) return mx;
    return max(left -> getMax(L, R), right -> getMax(L, R));
  } 
};

int main () {
  int n;
  cin >> n;
  vector <ll> h(n), a(n);
  for (int i = 0; i < n; i++) cin >> h[i];
  for (int i = 0; i < n; i++) cin >> a[i];
  vector <ll> dp(n + 1, 0);
  STree* tree = new STree(0, n);
  for (int i = 0; i < n; i++) {
    dp[h[i]] = max(dp[h[i]], a[i] + tree -> getMax(0, h[i] - 1));
    tree -> update(h[i], dp[h[i]]);
  }
  cout << tree -> mx << endl;
  return (0);
}


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

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

#define all(x)          x.begin(), x.end()
#define kill(x)         return cout << x << endl, 0
#define X               first
#define Y               second
#define sep             ' '
#define endl            '\n'

ll pw(ll a, ll b, ll mod) {
    if (!b)    return 1;
    if (b & 1) return a * pw(a * a % mod, b / 2, mod) % mod;
    return pw(a * a % mod, b / 2, mod) % mod;
}

const ll N    = 2e5 + 10;
const ll MOD  = 1e9 + 7;
const ll INF  = 1e18;

struct Point {
	int ind, x, y;
	bool operator<(const Point& p) {
		return x < p.x;
	}
};

int n, par[N], sz[N];
Point P[N];
vector<int> vec;

int Find(int u) {
	return (par[u] == -1 ? u : par[u] = Find(par[u]));
}

void Union(int u, int v) {
	u = Find(u);
	v = Find(v);
	if (u == v)
		return;
	if (sz[v] > sz[u])
		swap(u, v);
	par[v] = u;
	sz[u] += sz[v];
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    fill(par, par + N, -1);
    fill(sz, sz + N, 1);
    cin >> n;
    for (int i = 0; i < n; i++) {
    	cin >> P[i].x >> P[i].y;
    	P[i].ind = i + 1;
    }
    sort(P, P + n);
    for (int i = 0; i < n; i++) {
    	int tmp = P[i].y;
    	while (!vec.empty() && P[i].y > P[vec.back()].y) {
    		Union(P[i].ind, P[vec.back()].ind);
    		tmp = min(tmp, P[vec.back()].y);
    		vec.pop_back();
    	}
    	P[i].y = tmp;
    	vec.push_back(i);
    }
    for (int i = 1; i <= n; i++) {
    	cout << sz[Find(i)] << endl;
    }
    return 0;
}


Measured memory_bytes: 7564
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String contest = sc.next();
		if (contest.equals("ABC")) {
			System.out.println("ARC");
		} else 	if (contest.equals("ARC")) {
			System.out.println("ABC");
		}
	}		
}

Measured memory_bytes: 35680
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

void Canonize(vector<ll>& a) {
  int n = a.size();
  for (;;) {
    bool ok = true;
    for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) if (i != j && (a[i] ^ a[j]) < a[i]) {
      a[i] ^= a[j];
      ok = false;
    }
    if (ok) break;
  }
  vector<ll> result;
  for (ll x : a) if (x > 0) result.push_back(x);
  a = result;
}

int main()
{
  ll tn;
  cin >> tn;
  for (ll tst = 0; tst < tn; ++tst) {
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; ++i) cin >> a[i];
    string s;
    cin >> s;
    reverse(a.begin(), a.end());
    reverse(s.begin(), s.end());
    vector<ll> v;
    int winner = 0;
    for (int t = 0; t < n; ++ t) {
      if (s[t] == '0') {
        v.push_back(a[t]);
        continue;
      } else {
        Canonize(v);
        int rank = v.size();
        v.push_back(a[t]);
        Canonize(v);
        if (v.size() > rank) {
          winner = 1;
          break;
        }
      }
    }
    cout << winner << endl;
  }
  return 0;
}


Measured memory_bytes: 3596
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N, M;
  cin >> N >> M;
  if (N * 2 >= M) {
    cout << M / 2 << endl;
  } else {
    const int64_t t1 = (M - N * 2) / 4;
    const int64_t t2 = t1 + 1;
    auto Calc = [&](const int64_t t) { return min(N + t, (M - t * 2) / 2); };
    cout << max(Calc(t1), Calc(t2)) << endl;
  }
  return 0;
}


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

int main(void){

    string S; cin>>S;
    string divide[4]={"dream", "dreamer", "erase", "eraser"};

    reverse(S.begin(), S.end());
    for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());

    bool ok = true;

    for (int i = 0; i < S.size();) {
        bool ok2=false;
        for (int j = 0; j < 4; ++j) {
            string d = divide[j];
            if(d == S.substr(i,d.size())){
                ok2 = true;
                i+=d.size();
                break;
            }
        }
        if(ok2==false){
            ok = false;
            break;
        }
    }
    if(ok) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define fi           first
#define se           second
#define ll           long long
#define pb           push_back
#define mp           make_pair
#define pll          pair<ll,ll>
#define pii          pair<int,int>
#define all(x)       (x).begin(),(x).end()
#define isWorking()  cout<<"Wroking"<<endl
#define FOR(i,x,y)   for(int i=x; i<y; i++)
#define SORT(x)      sort(x.begin(),x.end())
#define PRINT(ok)    cout<<(ok? "YES":"NO")<<endl
#define Fast_Input   ios_base :: sync_with_stdio(false), cin.tie(NULL);
typedef vector < int > VI;
const ll mod= 1e9+7,INF=1e18,mx= 5e6+5,mn=100;
int testCase=1,cas=0;

int main() {
    Fast_Input

    //cin>>testCase;
    while(testCase--){
        int n,k; cin>>k>>n;

        int cnt=0;
        for(int i=0; i<=k; i++){
            for(int j=0; j<=k; j++){
                int x= n-(i+j);
                if(x>-1 && x<=k && i+j+x==n){
                    cnt++;
                }
            }
        }
        cout<<cnt<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int n;
int a[25][25];
int ans[25][1<<21];
long long int ways(int i, int val){
    if(i==n){
        if(val==((1<<n)-1))
            return 1;
        return 0;
    }
    if(ans[i][val] != -1)
        return ans[i][val];
    // cout << i << " " << val << "\n";
    long long int sum = 0;
    for(int j=0;j<n;j++){
        if(a[i][j] && !(val&(1<<j))){
            sum = (sum + ways(i+1,val|(1<<j)%mod))%mod;
        }
    }
    return ans[i][val] = sum;
}
int main(){
    cin >> n;
    memset(ans, -1, sizeof(ans));
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            cin >> a[i][j];
        }
    }
    cout << ways(0,0);
}

Measured memory_bytes: 208396
#include <iostream>

using namespace std;

int main(){
    string s;
    cin >> s;
    int N = s.size();
    if(s[N-1] == '0' && s[0] == '1' && s[N-2] == '1'){
        for(int i = 1; i < N-2; i++){
            if(s[i] != s[N-2-i]) {
                cout << -1 << endl;
                return 0;
            }
        }
        int ch = 1;
        int p = 2;
        cout << ch << ' ' << p << endl;
        for(int i = 1; i < N-1; i++){
            cout << i+2 << ' ' << p << endl;
            if(s[i] == '0'){
                
            }else{
                p = i+2;
            }
        }
    }else{
        cout << -1 << endl;
        return 0;
    }
}

Measured memory_bytes: 1664
[N,Y] = list(map(int,input().split()))
x = [0,0,0]
x[0] = Y//10000
x[1] = (Y - (10000*x[0]))//5000
x[2] = (Y - (10000*x[0]) - (5000*x[1]))//1000
ans = [-1,-1,-1]
for i in range(x[0]+1):
    for j in range(x[1]+(2*i)+1):
        N_temp = (x[0]-i) + (x[1]+2*i-j) + (x[2]+5*j)
        if N_temp == N:
            ans = [(x[0]-i) , ((x[1]+2*i-j)) , (x[2]+5*j)]
print('{0[0]} {0[1]} {0[2]}'.format(ans))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define ff first
#define setp(a) setprecision(a)<<fixed
#define ss second
#define fori(v) for(ll i=0; i<v; i++)
#define forj(v) for(ll j=0; j<v; j++)
#define fork(v) for(ll k=0; k<v; k++)
#define forl(v) for(ll l=0; l<v; l++)
#define fort(v) for(ll t=0; t<v; t++)
#define forz(v) for(ll z=0; z<v; z++)
#define forx(v) for(ll x=0; x<v; x++)
#define fory(v) for(ll y=0; y<v; y++)
#define ll long long
#define ld long double
#define MAX (int)(pow(10,6) + 10)
#define pb(a) push_back(a)
const ll INF = 0x3f3f3f3f;
const ll inf = pow(10,18);
ll modulo = pow(10,9)+7;
ld eps = 1e-9;

ll sz[MAX];
vector<ll> g[MAX];

void dfs(ll hd){

	sz[hd] = 1;
	
	for(auto hr : g[hd]){
		dfs(hr);
		sz[hd] += sz[hr];
	}
	
	
}

void deal(){
	ll n ;
	cin>>n;
	fori(n-1){
		ll ed;
		cin>>ed;
		--ed;
		g[ed].pb(i+1);
	}
	dfs(0);
	
	fori(n){
		--sz[i];
		cout<<g[i].size()<<'\n';
	}	
	
}


int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	deal();
}





























Measured memory_bytes: 44264
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <bitset>
#include <cmath>
#include <map>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int INF = 1e9;

int n,m;
vector<pair<int,int>> key;
void input(){
    cin >> n >> m;
    rep(i,m){
        int a,b; cin >> a >> b;
        int s=0;
        rep(j,b){
            int c; cin >> c;
            c--;
            s|=1<<c;
        }
        key.emplace_back(a,s);
    }
}
int main(){
    input();
    vector<int> dp(1<<n,INF);
    dp[0]=0;
    rep(s,1<<n){
        rep(i,m){
            int t = s|key[i].second;
            chmin(dp[t],dp[s]+key[i].first);
        }
    }
    if(dp[(1<<n)-1]==1e9){
        cout << -1 << endl;
        return 0;
    }
    cout << dp[(1<<n)-1] << endl;
}




Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

 int main()
 {
     char S[8];
     int n;
     gets(S);
     n=strcmp(S,"Sunny");
     if(n==0){
        printf("Cloudy\n");
     }
     n=strcmp(S,"Cloudy");
     if(n==0){
        printf("Rainy\n");
     }
     n=strcmp(S,"Rainy");
     if(n==0){
        printf("Sunny\n");
     }
     return 0;
 }


Measured memory_bytes: 128
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define SIZE(a) int((a).size();
const int INF=INT_MAX;
int main(){
  string s,t;
  cin>>s>>t;
  vin ss(26,-1),tt(26,-1);
  ll x=s.size();
  bool ok=true;
  rep(i,0,x){
    int a=s[i]-'a';
    if(ss[a]==-1){ss[a]=t[i]-'a';}
    else{
      if(ss[a]!=t[i]-'a'){ok=false;}
    }
  }
  rep(i,0,x){
    int a=t[i]-'a';
    if(tt[a]==-1){tt[a]=s[i]-'a';}
    else{
      if(tt[a]!=s[i]-'a'){ok=false;}
    }
  }
  cout<<(ok?"Yes":"No")<<endl;
}

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

using namespace std;

const int limit = 100010;
long long int INF = LLONG_MAX;
long long depth[limit];
using edge = struct{
	int to;
	long long cost;
};
std::vector<std::vector<edge>> tree;

void dfs(int now, int parent, long long dis){
	depth[now] = dis;
	for (size_t i = 0; i < tree[now].size(); i++) {
		if (tree[now][i].to == parent) {
			continue;
		}
		dfs(tree[now][i].to, now, dis+tree[now][i].cost);
	}
}

int main(int argc, char const *argv[]) {
	int N;
	std::cin >> N;
	int a,b,c;
	tree.resize(N);
	for (size_t i = 0; i < N-1; i++) {
		std::cin >> a >> b >> c;
		a--;
		b--;
		tree[a].push_back({b,c});
		tree[b].push_back({a,c});
	}
	int Q,K;
	std::cin >> Q >> K;
	K--;

	dfs(K,-1,0);

	int x,y;
	for (size_t i = 0; i < Q; i++) {
		std::cin >> x >> y;
		x--;
		y--;
		std::cout << depth[x] + depth[y] << '\n';
	}

	return 0;
}


Measured memory_bytes: 14336
import java.util.Scanner;
public class Main {
	public static void main(String[] args)
	{
		int N;
		int D;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		D = sc.nextInt();
		int d[] = new int[10];
		for(int i=0;i<D;i++)
		{
			d[sc.nextInt()]=1;
		}
		int sum=0;
		int maxD = String.valueOf(N).length();
		for(int i=maxD-1;i>=0;i--)
		{	
			int x = N/(int)Math.pow(10,i);
			N = N%(int)Math.pow(10, i);
			if(d[x]==1)
			{	
				for(int j=x;j<10;j++)
				{
					if(d[j]!=1)
					{
						x=j;
						N=0;
						break;
					}
					if(j==9)
					{
						j=0;
						N=sum%(int)Math.pow(10, i+2);
						sum = sum - N;
						N = N + (int)Math.pow(10, i+1);
						i=i+2;
						x=0;
						break;
					}
				}
			
			}
			sum = sum + x*(int)Math.pow(10, i);
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 9552
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <fstream>
#include <math.h>
#include <cmath>
#include <map>
using namespace std;

int saidai(int a,int b)
{
	int m=0,mx,mn;
	mx=max(a,b);
	mn=min(a,b);
	m = mx % mn;

	while(m!=0){
		mx = mn;
		mn = m;
		m = mx % mn;
	}
	return mn;
}

int main()
{
	int N,T,A,tmp1,ANS=0;
	double tmp2,MIN=1000000;
	cin >> N >> T >> A;
	for(int i=0;i<N;i++)
	{
		cin >> tmp1;
		tmp2 = abs(A - T +(tmp1*0.006));
		if(MIN>tmp2)
		{
			ANS = i+1;
			MIN = tmp2;
		}
	}
	cout << ANS << endl;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    A = [int(_) for _ in input().split()]

    sumMod2 = 0
    sumMod4 = 0
    sumElse = 0
    for v in A:
        if v % 4 == 0:
            sumMod4 = sumMod4 + 1
        elif v % 2 == 0:
            sumMod2 = sumMod2 + 1
        else:
            sumElse = sumElse + 1

    if sumMod2 == 0:
        if sumElse -1 <= sumMod4:
            print("Yes")
            return
        else:
            print("No")
            return
    else:
        if sumElse <= sumMod4:
            print("Yes")
            return
        else:
            print("No")
            return

if __name__ == "__main__":
    main()

Measured memory_bytes: 14224
"use strict";

const main = arg => {
    const prices = arg.split("\n")[0].split(" ").map(n=>parseInt(n));

    console.log(prices.sort((a,b)=>a-b).slice(0,2).reduce((m,n)=>m+n));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
#include<queue>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
using namespace std;

int H(int time){
  int ans=0;
  REP(i,time+1)ans+=i;
  return ans;
}
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int X;
  cin>>X;
  int ans=0,time=0;
  while(H(time)<X)time++;  
  cout<<time; 
  return 0;
}

Measured memory_bytes: 256
// problem: "https://atcoder.jp/contests/abc141/tasks/abc141_e"

#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    string s;

    cin>>n>>s;

    int i,j;

    vector<vector<int>>V(n+1,vector<int>(n+1,0));

    for(i=0;i!=n;i++)
    {
        for(j=0;j!=n;j++)
        {
            if(s[i] == s[j])
                V[i+1][j+1] = min(V[i][j]+1,j-i);
            else
                V[i+1][j+1] = 0;
        }
    }

    int m = 0;
    for(i=1;i!=n+1;i++)
        for(j=i+1;j!=n+1;j++)
            m = max(m,V[i][j]);

    cout<<m;

    return 0;
}


Measured memory_bytes: 98176
using System;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int x = sc.NextInt();
        int n = sc.NextInt();
        var p = new bool[200];
        for (int i = 0; i < n; i++)
        {
            p[sc.NextInt()] = true;
        }


        int diff = int.MaxValue;
        int ans = -1;
        for (int i = 0; i <= 101; i++)
        {
            if (p[i]) continue;

            int d = Math.Abs(x - i);
            if(d < diff)
            {
                diff = d;
                ans = i;
            }
        }

        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27496
import math
a = []
k = 0
for i in range(5):
    tmp = int(input())
    a.append([tmp,(tmp-1)%10])
a.sort(reverse=True, key=lambda x:x[1])
for i in range(4):
    k += (math.ceil(a[i][0]/10))*10
k += a[4][0]
print(k)

Measured memory_bytes: 3060
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
ans = 0


for i in range(N):
    ins_C = C
    A = list(map(int, input().split()))
    for j in range(M):
        ins_C += A[j]*B[j]
    
    if ins_C > 0:
        ans += 1
        
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <math.h>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define inf std::numeric_limits<double>::infinity()
#define DECI(n) fixed<<showpoint<<setprecision(n)
#define MOD 1000000007LL
#define FOR(i,start,end) for (int i=start;i<end;i++)
#define FORR(i,end,start) for(int i=end-1;i>start;i--)
#define INPUT(arr,n) FOR(i,0,n) cin>>arr[i];
#define INPUT2d(arr,n,k) FOR(i,0,n) FOR(j,0,k) cin>>arr[i][j];
#define SIZE 100005
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))

int main(){
ll x;cin>>x;
  ll  c=x/500;
  ll  d=x%500;
ll  e=d/5;
  ll  ans=(c*1000)+(5*e);
  cout<<ans<<endl;
  
return 0;
}








Measured memory_bytes: 256
N, K = map(int, input().split())
tmp = 0

for i in range(1,N+1):
    n = i
    if n < K:
      count = 0
      while n < K:
        n *= 2
        count += 1
    else:
      count = 0
    tmp += (1/N) * (1/2)**count
#    print(i, count, n, tmp)
print(tmp)



Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,x,k=0;cin>>a>>b>>c>>x;
  x/=50;
  for(int i=0;i<=a;i++){
    if(x-10*i>=0){
      for(int j=0;j<=b;j++){
        int s=x-10*i-2*j;
        if(s>=0&&s<=c)k++;
      }
    }
  }
  cout<<k<<endl;
}


Measured memory_bytes: 256
/*
मनस्वी म्रियते कामं कार्पण्यं न तु गच्छति ।
अपि निर्वाणमायाति नानलो याति शीतताम् ॥
*/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define vpi vector<ppi>
#define vpl vector<ppl>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define p2d(v) for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v) for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v) for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define imx INT_MAX
#define imn INT_MIN
#define inf 9000000000000000000
#define minf -inf
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793
#define MAXN 100005
#define test1(x) cout << #x " = " << x << endl;
#define test2(x,y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define test3(x,y,z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define test4(w,x,y,z) cout << #w " = " << w << " " << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
const ll infinity = 9e18;

/*
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast
    pre
/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt",  "r",  stdin);
        freopen("output.txt", "w", stdout);
    #endif
//*/

    ld r;
    cin>>r;

    cout<<(2*pi*r);
        
        












    return 0;
}

Measured memory_bytes: 3756
#include<stdio.h>

#define MAX 100000


int parent(int i){ return i/2;}

int left(int i){return 2 * i;}

int right(int i){ return 2 * i + 1;}


int main(){
  int i,H,A[MAX+1];

  scanf("%d",&H);
  for(i = 1 ; i <= H; i++)
    scanf("%d",&A[i]);

  for(i = 1;i <= H; i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(parent(i) >= 1)printf("parent key = %d, ",A[parent(i)]);
    if(left(i) <= H)printf("left key = %d, ",A[left(i)]);
    if(right(i) <= H)printf("right key = %d, ",A[right(i)]);
    
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2052
n = gets.to_i
dp = Array.new(100001, 100000)
dp[0], dp[1] = 0, 1
list = [1]
(1...10000).each do |i|
  break if 6 ** i > 100000
  list.push(6 ** i)
end
(1...10000).each do |i|
  break if 9 ** i > 100000
  list.push(9 ** i)
end
(2..n).each do |i|
  list.each do |j|
    dp[i] = [dp[i - j] + 1, dp[i]].min if i - j >= 0
  end
end
puts dp[n]

Measured memory_bytes: 2556
import sys

N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)

cnt = 0
for i in range(N-1):
  if A[i] - A[i+1] == 0:
    cnt +=1
if cnt < 2:
  print("0")
  sys.exit()

leng1 = 0
leng2 = 0
diff = 10**9

i = 0
while diff != 0:
  diff = A[i] - A[i+1]
  i += 1  
leng1= A[i]

A.remove(leng1)
A.remove(leng1)

i = 0
diff = 10**9
while diff != 0:
  diff = A[i] - A[i+1]
  i += 1  
leng2= A[i]

print(leng1*leng2)

Measured memory_bytes: 20084
#include<iostream>
using namespace std;
int main(){
    int a,b,c;
    int s;
    cin >> a >> b >> c;
    if (a > b) swap(a,b);
    if (a > c) swap(a,c);
    if (b > c) swap(b,c);
    cout << a << " " << b << " " << c << endl;
}


Measured memory_bytes: 3096
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  int a,b;
  std::cin >> a >> b;
  if(a*b%2==0)printf("Even\n");
  else printf("Odd\n");


  return 0;

}


Measured memory_bytes: 256
import java.util.*;
//import java.util.stream.Collectors;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		for(int i=0; ; i++){
			if(i * (a - 1) + 1 >= b){
				System.out.println(i);
				break;
			}
		}
	}
}


Measured memory_bytes: 35720
#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;
	cin >> n;
	
	vector<int> a(n);
	vector<int> b(n);
	vector<int> c(n-1);
	rep(i,n) cin >> a[i];
	rep(i,n) cin >> b[i];
	rep(i,n-1) cin >> c[i];
	
	
	int res = 0;
	
	rep(i,n){
		res += b[a[i]-1];
		if(i > 0 && a[i] == a[i-1]+1) res += c[a[i-1]-1];
	}
	
	cout << res << endl;
	return 0;
}

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

int n[6];

int main() {
    while(cin>>n[0]>>n[1]>>n[2]>>n[3]>>n[4]>>n[5]) {
        if(n[0] == 0 && n[1] == 0 && n[2] == 0
           && n[3] == 0 && n[4] == 0 && n[5] == 0) break;

        for(int i=0; i<6; ++i) {
            if(n[i] < 0) assert(false);
        }

        int ans = 0,mp = 1<<29;
        n[0] += n[3];
        n[1] += n[4];
        n[2] += n[5];

        for(int i=0; i<3; ++i)
            mp = min(n[i], mp);
        ans += mp;
        for(int i=0; i<3; ++i) ans += (n[i]-mp)/3;

        for(int k=0; k<=2; ++k) {
            if(k > mp) break;
            int tmp = k;
            for(int i=0; i<3; ++i)
                tmp += (n[i]-k)/3;
            ans = max(tmp, ans);
        }

        cout<<ans<<endl;
        
    }
}

Measured memory_bytes: 0