akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
char s[15];
int64 dp[15],sum[15],ans,pre[15];
int N;
void Solve() {
    scanf("%s",s + 1);
    dp[0] = 1;
    N = strlen(s + 1);
    for(int i = 1 ; i <= N ; ++i) {
	sum[i] = sum[i - 1] * 10 + (s[i] - '0') * dp[i - 1];
	dp[i] = dp[i - 1] * 2;
	if(i != N) pre[i] = pre[i - 1] * 2 + sum[i];
	else pre[N] = pre[i - 1] + sum[i];
    }
    out(pre[N]);enter;
}

int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 256
n,x = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a)
count = 0
s = 0
for i in range(n):
    if i == n-1:
        if x == a[i]:
            count += 1
    else:
        s += a[i]
        if x > a[i]:
            x -= a[i]
            count += 1
        elif x < a[i]:
            break
        else:
            count += 1
            break
print(count)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <utility>
using namespace std;

template <typename T> ostream &operator<<(ostream &o,vector<T> &v)
{for(T &x:v)o<<(&x!=&v[0]?" ":"")<<x;return o;}

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

	vector<int> d(n);
	for (int &x: d)
		cin >> x;

	cout << d << endl;
	for (int i = 1; i < n; i++) {
		for (int j = i - 1; j >= 0 && d[j] > d[j + 1]; j--)
			swap(d[j], d[j + 1]);
		cout << d << endl;
	}
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<string> ves;
typedef vector<vector<int>> ve_vei;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define fs first
#define sc second
#define all(a) a.begin(),a.end()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 
int main() {
	//cout.precision(10);
	cin.tie(0);
	ios::sync_with_stdio(false);

    string s; cin >> s;
    bool appear[26] = {};
    rep(i,s.size()) appear[s[i] - 'a'] = true;
    rep(i,26){
        if(appear[i]) continue;
            cout << (char) ('a' + i) << endl;
            return 0;
    }
    cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 512
using System;

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var ans = 0;
        if (n >= 65 && n <= 90) ans = 1;
        else if (n >= 97 && n <= 122) ans = 2;
        Console.WriteLine(ans);
    }
}



Measured memory_bytes: 17996
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int min = N;
		for (int i = 1; i < N; i++) {
			String a = String.valueOf(N - i);
			String b = String.valueOf(i);
			int aSum = a.chars().map(c -> c - 48).sum();
			int bSum = b.chars().map(c -> c - 48).sum();
			min = Math.min(min, aSum + bSum);
		}
		
		System.out.println(min);
	}
}

Measured memory_bytes: 48120
#include <bits/stdc++.h>
# define M_PI           3.14159265358979323846  /* pi */
using namespace std;

int main() {
	int  N, Y;
	cin >> N >> Y;
	

	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N; j++) {
			int k = N - i - j;
			if (0 <= k) {
				if ((10000 * i) + (5000 * j) + (1000 * k) == Y) {
					cout << i << " " << j << " " << k << endl;
					return 0;
				}
			}
			
		}
		
	}
	cout << "-1" << " " << "-1" << " " << "-1" << endl;
	
}

Measured memory_bytes: 3600
#include <iostream>
#include <iomanip>

#define debug(x) cout << #x << "==" << x << endl;

const int INF = 1e+9 + 7;

using namespace std;

//入力
// #define MAX_N
char c;

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

  cin >> c;

  if( c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }



  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x,y) x = max(x, y)
#define mins(x,y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int a, b, c;
    cin >> a >> b >> c;
    
    cout << (a+b+c >= 22 ? "bust" : "win") << endl;


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

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;

int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}

/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/

long long int N, M, A[100005];
pair<long long int, long long int> CB[100005];
long long int Ap[100005];

int main()
{
	cin >> N >> M;
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	for (int i = 0; i < M; i++)
	{
		cin >> CB[i].second >> CB[i].first;
	}

	sort(CB, CB + M);
	reverse(CB, CB + M);
	sort(A, A + N);

	int cou = 0;

	for (int i = 0; i < M; i++)
	{
		if (A[cou] >= CB[i].first) break;
		for (int j = 0 ; j < CB[i].second; j++)
		{				
			if (A[cou] >= CB[i].first) break;
			
				A[cou] = CB[i].first;
				cou++;

				/*for (int k = 0; k < N; k++)
				{
					cout << A[k] << " ";
				}
				cout << endl;*/

				if (cou == N) break;
			
		}
		if (cou == N) break;
	}

	long long int ans = 0;

	for (int i = 0; i < N; i++)
	{
		ans += A[i];
	}

	cout << ans;

	return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
#include<string.h> 
int main()
{
	int a,b;
	while(scanf("%d%d",&a,&b)!=EOF)
	{
		if(a+b<10&&a+b>=0)
		printf("%d\n",a+b);
		else
		printf("error\n");
	}
}

Measured memory_bytes: 128
i = list(map(int, input().split())) #i_1 i_2を取得し、iに値を入れる
N=i[0]
D=i[1]
count = 0
#a = [[0] * 2] * 4
for i in range(N):
  a= list(map(int, input().split())) #i_1 i_2を取得し、iに値を入れる
  dis = a[0]**2+a[1]**2
  if dis <= (D**2):
    count=count + 1
print(count)



Measured memory_bytes: 9172
#include<bits/stdc++.h>
#define FO(i,a,b) for(int i=a;i<=b;i++)
#define FE(i,a,b) for(int i=a;i<b;i++)
#define Edge(i,v,a) for(int i=head[a],v=to[i];i!=-1;i=nxt[i],v=to[i])
#define R(i) i=read()
using namespace std;
char s[1000];
int n,m,k;
int main() {
	cin>>n>>m>>k;
	if(n<m) swap(n,m);
	FO(i,0,n)
		FO(j,0,m)
			if(i*m+j*n-j*i*2==k) 
				{cout<<"Yes";return 0;}
	cout<<"No";
	return 0;
}

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

using namespace std;

#define REP(i,m) for(int i=0;i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
typedef long long ll;
typedef pair<int,int> pp;
ll mod =1000000007;

int n;
int c[10000000];
int d[10000000];
int main()
{
    for(int i =1;i<=5;i++){
        int a;
        cin>>a;
        if(a ==0){
            cout << i;
            return 0;
        }
    }
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] dice_argument = new int[6];
        for(int i = 0; i < 6; i++){

            dice_argument[i] = scan.nextInt();
        }
        Dice_b dice = new Dice_b(dice_argument[0], dice_argument[1], dice_argument[2], dice_argument[3], dice_argument[4], dice_argument[5]);

        int x = scan.nextInt();
        int a1;
        int a2;
        for(int i = 0; i < x; i++){

            a1 = scan.nextInt();

            a2 = scan.nextInt();

            dice.fix_position(a1, a2);
        }
    }

}

class Dice_b {
    int Top;
    int N;
    int E;
    int W;
    int S;
    int Bottom;

    Dice_b(int a, int b, int c, int d, int e, int f){
        Top = a;
        S = b;
        E = c;
        W = d;
        N = e;
        Bottom = f;
    }

    public void fix_position (int top, int s) {

        while(true){

            rollN();
            if(Top == top){
                break;
            }
            rollN();
            if(Top == top){
                break;
            }
            rollN();
            if(Top == top){
                break;
            }
            turnR();
            if(Top == top){
                break;
            }
            turnR();
            if(Top == top){
                break;
            }
            turnR();

        }

        while(true){
            if(S == s){
                break;
            }
            turnR();
        }

        System.out.println(E);

    }

    public void rollN () {
        int tmp = Top;
        Top = S;
        S = Bottom;
        Bottom = N;
        N = tmp;
    }

    public void turnR () {
        int tmp = E;
        E = N;
        N = W;
        W = S;
        S = tmp;
    }



}



Measured memory_bytes: 26128
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X = sc.nextInt() - 1;
		int Y = sc.nextInt() - 1;

		ArrayList<ArrayList<Integer>> vertexes = new ArrayList<ArrayList<Integer>>();

		for(int i = 0; i < N; i++){
			ArrayList<Integer> v = new ArrayList<Integer>();
			if(i != 0)v.add(i - 1);
			if(i != N - 1)v.add(i + 1);
			vertexes.add(v);
		}
		vertexes.get(X).add(Y);
		vertexes.get(Y).add(X);

		int dis[] = new int[N];
		Arrays.fill(dis, 0);

		for(int n = 0; n < N; n++){
			//BFS
			boolean[] seen = new boolean[N];
			Arrays.fill(seen, false);
			int count = 0;

			Queue<Integer> queue = new ArrayDeque<Integer>();
			queue.add(n);
			seen[n] = true;
			while(!queue.isEmpty()){
				int size = queue.size();
				for(int j = 0; j < size; j++){
					int x = queue.poll();
					ArrayList<Integer> v = vertexes.get(x);
					for(int i = 0; i < v.size(); i++){
						int y = v.get(i);
						if(!seen[y]){
							queue.add(y);
							seen[y] = true;
							dis[count]++;
						}
					}
				}
				count++;
			}
		}

		for(int i = 0;i < N-1; i++){
			System.out.println(dis[i]/2);
		}
	}
}

Measured memory_bytes: 61604
#include<bits/stdc++.h>
#define int long long int
#define mod 1000000007
#define inf 1e18
#define fo(i,y,n,inc)	for(int i=y;i<n+y;i+=inc)
#define cin(t) int t;cin>>t
#define w(t) while(t--)
#define nl cout<<endl;
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define ft(i) (i&(-1*i))
#define arrIn(arr,size)		for(int i=0;i<size;i++){cin>>arr[i];}
#define arrOut(arr,size,seperater)	for(int i=0;i<size;i++){cout<<arr[i]<<seperater;}
using namespace std;

int max(int a, int b) {
	if (a > b)
		return a;
	return b;
}

int min(int a, int b) {
	if (a < b)
		return a;
	return b;
}

int powmd(int a, int b) {
	if (b == 1)	return a;
	if (b == 0)	return 1;

	int half = powmd(a, b / 2);
	int ans = half * half;
	ans %= mod;
	if (b & 1) {
		ans *= a;
	}
	ans %= mod;
	return ans;
}

void fastIO() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}

vector<vector<int> > multiply_mat(vector<vector<int> >&a, vector<vector<int> >& b, int n) {
	// cout << "in the func multiply_mat" << endl;
	vector<vector<int> > ans(n, vector<int>(n));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			int sum = 0;
			for (int k = 0; k < n; k++) {
				sum += (a[i][k] * b[k][j]);
				sum %= mod;
			}
			ans[i][j] = sum;
		}
	}
	return ans;
}

vector<vector<int> > mat_exp(vector<vector<int> >& adj_mat, int n, int k) {
	// cout << "in the func mat_exp" << k << endl;
	// if (k == 0) {
	// 	vector<vector<int> > identity_mat(n, vector<int>(n));
	// 	for (int i = 0; i < n; i++) {
	// 		identity_mat[i][i] = 1;
	// 	}
	// 	return identity_mat;
	// }
	if (k == 1)	return adj_mat;
	vector<vector<int> > half = mat_exp(adj_mat, n, k / 2);
	half = multiply_mat(half, half, n);
	if (k & 1) {
		half = multiply_mat(half, adj_mat, n);
	}
	return half;
}

int32_t main() {

	fastIO();

	int n, k;
	cin >> n >> k;
	vector<vector<int> > adj_mat(n, vector<int>(n));

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> adj_mat[i][j];
		}
	}

	vector<vector<int> > ans = mat_exp(adj_mat, n, k);
	int answer = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			answer += ans[i][j];
			answer %= mod;
		}
	}

	cout << answer << endl;

	return 0;
}

// cout << "Case #" << i << ": " << answer << endl;

Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	while(1){
		string s;
		cin>>s;
		if(s=="0") break;
		int a=0,b=0;
		rep(i,1,s.size()){
			if(s[i]=='A') a++;
			if(s[i]=='B') b++;
		}
		if(a<b) b++;
		else a++;
		o(a<<" "<<b);
	}
}

Measured memory_bytes: 1188
#include <stdio.h>
#include <vector>
using namespace std;
#define PB push_back
const int N=1e5+10;
struct BIT{
    vector<int> v;
    void init(int size){
        v.resize(size,0);
        return ;
    }
    void add(int n,int x){
        while(n<v.size()){
            v[n]+=x;
            n+=n&-n;
        }
        return ;
    }
    int ask(int n){
        int ans=0;
        while(n){
            ans+=v[n];
            n^=n&-n;
        }
        return ans;
    }
};
vector<int> graph[N];
int p[N],dep[N],to[N],top[N],size[N],val[N];
BIT b[N];
void dfs(int now){
    int temp=0;
    size[now]=1;
    val[now]=0;
    for(int i:graph[now]){
        dep[i]=dep[now]+1;
        dfs(i);
        if(size[i]>temp){
            temp=size[i];
            to[now]=i;
        }
        size[now]+=size[i];
    }
    return ;
}
void init(int now){
    if(graph[now].empty())b[top[now]].init(dep[now]-dep[top[now]]+1);
    for(int i:graph[now]){
        if(i==to[now])top[i]=top[now];
        else top[i]=i;
        init(i);
    }
    return ;
}
int query(int n){
    int ans=0;
    while(n>0){
        ans+=b[top[n]].ask(dep[n]-dep[top[n]]);
        ans+=val[top[n]];
        n=p[top[n]];
    }
    return ans;
}
int main(){
    int n,k,temp,q;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&k);
        for(int j=0;j<k;j++){
            scanf("%d",&temp);
            graph[i].PB(temp);
            p[temp]=i;
        }
    }
    top[0]=0;
    p[0]=-1;
    dep[0]=0;
    dfs(0);
    init(0);
    scanf("%d",&q);
    while(q--){
        scanf("%d",&k);
        if(k==0){
            scanf("%d%d",&k,&temp);
            if(k==top[k])val[k]+=temp;
            else b[top[k]].add(dep[k]-dep[top[k]],temp);
        }
        else{
            scanf("%d",&k);
            printf("%d\n",query(k));
        }
    }
}


Measured memory_bytes: 19084
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
//#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)

const int M=1000000007;
const int MM=998244353;


 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  if(m<=1)return 0;
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}

const ll N=1e5+5;

ll par[N];

ll find(ll x){
  if(par[x]==x)return x;
  return par[x]=find(par[x]);
}

void unio(ll a,ll b){
  a=find(a),b=find(b);
  par[a]=b;
}


int main()
{ 

IOS;


ll n;cin>>n;

for(int i=1;i<=9;i++){
  for(int j=1;j<=9;j++){
    if(i*j==n){
      cout<<"Yes";
      return 0;
    }
  }
}

cout<<"No";

return 0;
 
}


Measured memory_bytes: 3600
void main() {
    writeln(readln.chomp.to!int / 3);
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
/* Fairy dandy tickling the fancy of his lady friend */

#include <iostream>

#include <vector>

#include <algorithm>

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

#define rep(i,a,b) for(int i=int(a); i<int(b); i++)

#define rip(i,a,b) for(int i=(int)a; i>=(int)b; i--)

#define pb push_back

#define mp make_pair

#define fst first

#define snd second

#define sz(x) int(x.size())

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

#define trace(x) cerr << #x << ": " << x <<endl;

using namespace std;
const int MOD = 1e9+7;

typedef long long int lli;

typedef pair<lli, lli> ii;

typedef vector<int> vi;

typedef vector<ii> vii;


lli dp[10005][105];
lli dpf[10005][105];
lli ans;


int main(){

    fastio;

	string k;
	lli d;
	cin>>k>>d;
	reverse(all(k));
	lli n=sz(k);
	rep(i, 1, 10){
		if(i<=k[0]-'0')
			dpf[0][i%d]++;
		dp[0][i%d]++;
	}
	if(n==1){
		cout<<dpf[0][0]<<endl;
		return 0;
	}
	ans+=dp[0][0];
	dp[0][0]++;
	dpf[0][0]++;
	rep(i, 1, n-1){
		rep(j, 1, 10){
			rep(l, 0, d){
				lli cur= (j+l)%d;
				if(j<k[i]-'0')
					dpf[i][cur]=(dpf[i][cur]+dp[i-1][l])%MOD;
				dp[i][cur]=(dp[i][cur]+dp[i-1][l])%MOD;
			}
		}
		ans = (ans+dp[i][0])%MOD;
		rep(j, 0, d){
			dpf[i][(k[i]-'0'+j)%d]=(dpf[i][(k[i]-'0'+j)%d]+dpf[i-1][j])%MOD;
			if(k[i]>'0') dpf[i][j]=(dpf[i][j]+dp[i-1][j])%MOD;
			dp[i][j]=(dp[i][j]+dp[i-1][j])%MOD;
		}
	}
	rep(i, 1, k[n-1]-'0') rep(j, 0, d)
			dp[n-1][(j+i)%d]=(dp[n-1][(j+i)%d]+dp[n-2][j])%MOD;
	ans = (ans+dp[n-1][0])%MOD;
	rep(i, 0, d){
		lli cur = ((k[n-1]-'0')+i)%d;
		dpf[n-1][cur]=(dpf[n-1][cur]+dpf[n-2][i])%MOD;
	}
	ans=(ans+dpf[n-1][0])%MOD;
	cout<<ans<<endl;

    return 0;

}

Measured memory_bytes: 16640
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main(){
    double r;
    cin >> r;
    double l,s;
    l = 2.0 * r * M_PI;
    s = 1.0 * r * r * M_PI;
    printf("%f %f\n",s,l);
}


Measured memory_bytes: 3192
(let* ((n (read))
       (m (read))
       (lst (loop :repeat m :collect (read))))
  (loop :for k :from 0
        :for j := (if (oddp k)
                      (+ n (- (/ (1+ k) 2)))
                      (+ n (/ k 2)))
        :if (not (position j lst))
          :do (princ j) :and :return 1))

Measured memory_bytes: 24596
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int mod=1000000007;
  i64 poww(i64 a, i64 b)
  {
    a%=mod;
    i64 res=1;
    while(b)
      {
if(b&1)res=res*a%mod;

      a=a*a%mod;
      b/=2;

      }
      return res;
  }
  i64 inv(i64 a)
  {
    return poww(a,mod-2);
  }


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

    // ifstream fin(".in");
    // ofstream fout(".in");

int n,k;
cin>>n>>k;
set<int>s;
for1(i,k)
{
int x;
cin>>x;
forn(j,x)
{
  int y;
  cin>>y;
  s.insert(y);
}

  }
cout<<n-s.size();

    return 0;
  }


Measured memory_bytes: 3648
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}
int compw(const void *a, const void *b){return (*(int*)a>*(int*)b)-(*(int*)a<*(int*)b);}

uint32_t nextpint(void){
	char c=getchar();
	while(c<'0'||'9'<c) c=getchar();
	uint_fast32_t x=0;
	while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); }
	return x;
}

int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(void){
	int n=nextpint()-1;
	printf("%d\n", a[n]);
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0;
#define HERE cout<<"here"<<en
#define _out(value) cout<<"      "<<value<<en
#define out(value) cout<<value<<en

int main(){
  int n;
  cin>>n;
  
  bool e=false;
  int ans=0;
  for(int i=5; i>=0; i--){
    int mod=1;
    for(int j=0; j<i; j++){
      mod*=10;
    }
    int k=n/mod;
    if(k){
      if(n%mod==0&&i!=0){
        cout<<10<<en
        RE
      }
      e=true;
      ans+=k;
      n-=k*mod;
    }
  }
  
  if(e) out(ans)
  else out(10)
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define bg begin()
#define en end()

using namespace std;

typedef long long ll;

int ans, N, M;
int G[55][55];
bool used[55];
queue<int> Q;
vector<pair<int, int> > vec;

bool check() {
  memset(used, 0, sizeof(used));
  used[1] = true;
  Q.push(1);
  while(!Q.empty()) {
    int u = Q.front(); Q.pop();
    rep(v, 1, N+1) {
      if (G[u][v] && !used[v]) {
        used[v] = true;
        Q.push(v);
      }
    }
  }
  rep(i, 1, N+1) if (!used[i]) return true;
  
  return false;
}

int main() {
  scanf("%d %d", &N, &M);
  rep(i, 0, M) {
    int a, b;
    scanf("%d %d", &a, &b);
    G[a][b] = G[b][a] = true;
    vec.pb(make_pair(a, b));
  }
  
  rep(i, 0, M) {
    int a = vec[i].first, b = vec[i].second;
    G[a][b] = G[b][a] = false;
    if (check()) ans++;
    G[a][b] = G[b][a] = true;
  
  }
  printf("%d\n", ans);

}

Measured memory_bytes: 384
unittest
{
	assert( [ "3 70", "20 30 10" ].parse.expand.solve == 2 );
	assert( [ "3 10", "20 30 10" ].parse.expand.solve == 1 );
	assert( [ "4 1111", "1 10 100 1000" ].parse.expand.solve == 4 );
	assert( [ "2 10", "20 20" ].parse.expand.solve == 0 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nx = input.front.split.to!( long[] );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( nx[ 1 ], as );
}

auto solve( long x, long[] as )
{
	auto ans = 0L;
	foreach( a; as.sort() )
	{
		if( a <= x )
		{
			x -= a;
			ans++;
		}
		else
		{
			x = 0;
			break;
		}
	}
	if( 0 < x ) ans--;		// 余らせてしまった場合、最後の子供に押し付けるので喜ばなくなる
	return ans;
}


Measured memory_bytes: 256
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
ans = 0
for i in range(1, n+1):
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        ans += i
print(ans)


Measured memory_bytes: 64528
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define ar array
#define db long double
#define pow pw
const db pi = 3.14159265358979323846;
int pw(int a,int b){
    int ans=1;
    while(b){
    if (b%2) ans*=a;
    a*=a;
    b/=2;
    }
    return(ans);
}
const int mxn=1e5+7;
int dp[mxn];
int a[mxn];
int n,k;
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>k;
    for (int i=0;i<n;i++) cin>>a[i];
    for (int i=0;i<=k;i++)
    {
        for (int j=0;j<n;j++)
        {
            if (i>=a[j]&&!dp[i-a[j]]) dp[i]=1;
        }
    }
    if (dp[k]) cout<<"First";
    else cout<<"Second";
    return 0;
}

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

#define rep(i,n) for(int i=0; i<(n); ++i)
#define rrep(i,n) for(int i=1; i<=(n); ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define v(T) vector<T>
#define imposs {cout<<"-1\n";return 0;}
#define LL_MAX LLONG_MAX
#define LL_MIN LLONG_MIN

typedef unsigned int uint;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef set<int> si;
typedef multiset<int> msi;
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}

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

  string s;
  cin >> s;
  cout << s.substr(0,3) << '\n';
  return 0;
}


Measured memory_bytes: 3608
import java.util.*;
import java.io.*;

 public class Main{
// taking inputs
static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split(" ");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;}
static long Modmul(long a,long b,long m){return ((a%m)*(b%m))%m;}
static long ModInv(long a,long m){return Modpow(a,m-2,m);}
static long nck(int n,int r,long m){if(r>n){return 0l;}return Modmul(f[n],ModInv(Modmul(f[n-r],f[r],m),m),m);}
static long[] f;
//......................................@uthor_Alx..............................................

   public static void main(String[] args) throws  IOException{
	        		  assign();
	        		  	String s=read();
	        		  	String t=read();
	        		  	int res=0;
	        		  	for(int i=0;i<s.length();i++){
	        		  		if(s.charAt(i)!=t.charAt(i)){
	        		  			res++;
	        		  		}
	        		  	}
	        		  	
	        		  	out.write((res)+"");
                      	out.flush();
	        		 
	}
}
	       


Measured memory_bytes: 39452
#include <stdio.h>

int main(void)
{
	
	int a,b,c,d,e,z;
	
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    scanf("%d",&d);
    scanf("%d",&e);
    
    if(a<40){a=40;}
    if(b<40){b=40;}
    if(c<40){c=40;}
    if(d<40){d=40;}
    if(e<40){e=40;}
    
    
    
    z=(a+b+c+d+e)/5;
    printf("%d\n",z);
	return 0;
}

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

#define L 100001

int main() {
    int n, q;
    int S[L];

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> S[i];
    }

    cin >> q;
    int count = 0;
    int target;
    for (int i = 0; i < q; i++) {
        cin >> target;
        S[n] = target;
        int j = 0;
        while(target != S[j]) {
            j++;
        }

        if (j != n) count++;
    }

    cout << count << endl;

    return 0;
}




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

using namespace std;

int main()
{   
    int A, B;
    cin >> A >> B;
    if((A+B) >= 10){
        cout << "error" << endl;
    }else{
        cout << A + B << endl;
    }
}

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

using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<int> as(n + 1), bs(n);
  rep(i, n + 1) cin >> as[i];
  rep(i, n) cin >> bs[i];
  ll ans = 0;
  rep(i, n) {
    ll l = min(as[i], bs[i]);
    ans += l;
    as[i] -= l;
    bs[i] -= l;
    ll r = min(bs[i], as[i + 1]);
    ans += r;
    bs[i] -= r;
    as[i + 1] -= r;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4056
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for (ll i = (begin); i < (end); i++)
#define REP(i, n) FOR(i, 0, n)
#define IFOR(i, begin, end) for (ll i = (begin)-1; i >= (end); i--)
#define IREP(i, n) IFOR(i, n, 0)
#define SORT(a) sort(a.begin(), a.end())                 //昇順
#define ISORT(a) sort(a.begin(), a.end(), greater<ll>()) //降順
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v)                                                              \
  cout << #v << "=(" << v[0];                                                  \
  FOR(i_debug, 1, v.size()) { cout << "," << v[i_debug]; }                     \
  cout << ")" << endl;
#define mdebug(m)                                                              \
  cout << #m << "=" << endl;                                                   \
  REP(i_debug, m.size()) {                                                     \
    REP(j_debug, m[i_debug].size()) { cout << m[i_debug][j_debug] << ","; }    \
    cout << endl;                                                              \
  }
#define Lower_bound(v, x)                                                      \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x)                                                      \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;

template <typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) {
  REP(i, a.size()) {
    cin >> a[i];
    a[i]--;
  }
}

ll mod = 1000000007;

int main() {
  ll A, B, X;
  cin >> A >> B >> X;

  if (A <= X && X <= A + B)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
//strÌ(start)Ú©ç3¶æèo·
char* strpick(char *str, int start)
{
	char *result = new char[4];
	for (int i = 0; i < 3; i++)
	{
		result[i] = str[start+i];
	}
	result[3] = '\0';
	return result;
}
int main()
{
	char str[10001];
	char *tmp = new char[4];
	int ioi, joi, i;
	while (cin >> str)
	{
		if (cin.eof()) break;
		ioi = joi = 0;
		for (i = 0; i < signed(strlen(str))-2;)
		{
			if (str[i] == 'I' || str[i] == 'J')
			{
				tmp = strpick(str, i);
				if (strcmp(tmp, "IOI") == 0)
					ioi++, i+=2;
				else if (strcmp(tmp, "JOI") == 0)
					joi++, i+=2;
				else
					i++;
			}
			else
				i++;
		}
		cout << joi << endl << ioi << endl;
	}
}

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

a.sort()
amax=a[-1]
boo = [0]*(amax+1)
from collections import Counter
c=Counter(a)

for aa in a:
    if boo[aa]==0:
        if c[aa]>=2:
            for i in range(aa,amax+1,aa):
                boo[i]=1
        else:
            for i in range(aa*2,amax+1,aa):
                boo[i]=1

print( n-sum(boo[aa] for aa in a))

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

class Program
{
    static void Main(string[] args)
    {
        var input0 = Console.ReadLine();
        var input1 = Console.ReadLine().Split(' ').ToList();
        var n = int.Parse(input0);
        var numList = new List<int>();
        input1.ForEach(numStr => numList.Add(int.Parse(numStr)));
        var orderByNumList = numList.OrderBy(_ => _).ToList();
        int sameCount = 0;
        for (int i = 0; i < n; i++)
        {
            if (numList[i] == orderByNumList[i])
            {
                sameCount++;
            }
        }
        if(sameCount == n || sameCount == n - 2)
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    int n;
    cin >> n;
    string a[n];
    rep(i, n) cin >> a[i];
    int s[n][n];
    rep(i, n)rep(j, n) s[i][j] = a[i][j] - '0';

    int ans = 0;
    int r[n];

    rep(i, n){
        fill(r, r + n, 0);
        r[i] = 1;
        vector<int> v;
        rep(j, n){
            if (s[i][j]){
                v.push_back(j);
                r[j] = 2;
            }
        }
        int num = 2;
        bool flag = true;
        while(v.size() > 0){
            vector<int> v_n;
            while(v.size() > 0){
                int j = v.back();
                v.pop_back();
                rep(k, n){
                    if (s[j][k]){
                        if (r[k] == 0){
                            r[k] = num + 1;
                            v_n.push_back(k);
                        }else if (r[k] != num - 1 && r[k] != num + 1){
                            flag = false;
                            break;
                        }
                    }
                }
                if (!flag) break;
                
            }
            if (!flag) break;
            rep(j, v_n.size()){
                v.push_back(v_n[j]);
            }
            num++;
        }

        if (!flag) continue;

        // rep(i, n) cout << r[i] << " ";
        // cout << endl;

        ans = max(ans, num - 1);
    }

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

}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define REPR(i,n) for(int i=n-1; i>=(int)(0); i--)
#define FOR(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define FORR(i,a,b) for(int i=(int)(b)-1; i>=(int)(a); i--)
#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()
//**関数リスト**//
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
ll nod(ll F) {
	ll keta = 1;
	while (F / 10 > 0) {
		keta++;
		F /= 10;
	}
	return keta;
}
ll gcd(ll x, ll y) {
	ll r;
	if (x < y) {
		swap(x, y);
	}
	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll isPrime(ll x) {
	ll i;
	if (x < 2) {
		return 0;
	}
	else if (x == 2) {
		return 1;
	}
	else if (x % 2 == 0) {
		return 0;
	}
	else {
		for (i = 3; i * i <= x; i += 2) {
			if (x % 1 == 0) {
				return 0;
			}
		}
		return 1;
	}
}
void eratos(vl isPrime) {
	//(注)isPrimeのサイズはN+1にする！実際にはmain内に配置して使用
	ll i, j;
	REP(i, isPrime.size()) {
		isPrime[i] = 1;
	}
	isPrime[0] = 0; isPrime[1] = 0;
	for (i = 2; i * i <= isPrime.size() - 1; i++) {
		if (isPrime[i] == 1) {
			j = i * 2;
			while (j <= isPrime.size() - 1) {
				isPrime[j] = 0;
				j = j + i;
			}
		}
	}
}
ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
void bitSearch(ll n) {
	//実際にはコピーして中身を改変して使う
	ll i;
	REP(i, pow(2, n)) {
		ll p = i;
		REP(i, n) {
			cout << p % 2;
			p /= 2;
		}
		cout << endl;
	}
}

void bfs(ll now) {
	//中身は毎回書き換えて使用
	queue<ll> Q;
	Q.push(now);
	ll u;
	while (!Q.empty()) {
		u = Q.front();
		Q.pop();
		//ll v=;
		//Q.push(v);
	}
}
//**定義場所**//
ll i, j, k, l, m, n;
ll N, M, K, H, W;
ll MOD = 1000000007;
ll ans = 0;
//***********//

int main() {
	cin >> N;
	vl A(N + 1);
	for (i = 0; i < N+1; i++) {
		cin >> A[i];
	}
	vl B(N);
	for (i = 0; i < N; i++) {
		cin >> B[i];
	}
	for (i = 0; i < N; i++) {
		if (A[i] <= B[i]) {
			ans += A[i];
			B[i] -= A[i];
			if (A[i + 1] <= B[i]) {
				ans += A[i+1];
				A[i + 1] = 0;
			}
			else {
				ans += B[i];
				A[i + 1] -= B[i];
			}
		}
		else {
			ans += B[i];
		}
	}
	cout << ans;
}

Measured memory_bytes: 1792
def main():
    X = int(input())
    if 400 <= X and X < 600:
        print('8')
    elif 600 <= X and X < 800:
        print('7')
    elif 800 <= X and X < 1000:
        print('6')
    elif 1000 <= X and X < 1200:
        print('5')
    elif 1200 <= X and X < 1400:
        print('4')
    elif 1400 <= X and X < 1600:
        print('3')
    elif 1600 <= X and X < 1800:
        print('2')
    elif 1800 <= X and X < 2000:
        print('1')


if __name__ == "__main__":
    main()

Measured memory_bytes: 61764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define INF (ll)(1e18)
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }



void solve() {
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    
    map<int, int> mp[2];
    rep(i, n) {
        mp[i % 2][v[i]]++;
    }
    vector<pii> v2[2];
    rep(i, 2) for (auto e : mp[i]) {
        v2[i].eb(pii(e.S, e.F));
    }
    rep(i, 2) sort(all(v2[i]), greater<pii>()); // greater debuged
    rep(i, 2) {
        // cout << endl;
        // rep(j, sz(v2[i])) cout << v2[i][j].F << " " << v2[i][j].S << endl;
    }
    
    if (v2[0][0].S != v2[1][0].S) {
        // cout << v2[0][0].F << endl;
        cout << ((n - n / 2) - v2[0][0].F) + (n / 2 - v2[1][0].F) << endl;
    } else { // n ≥ 2
        if (sz(v2[0]) == 1 && sz(v2[1]) == 1) {
            cout << n / 2 << endl;
        } else if (sz(v2[0]) == 1) {
            cout << ((n - n / 2) - v2[0][0].F) + (n / 2 - v2[1][1].F) << endl;
        } else if (sz(v2[1]) == 1) {
            cout << ((n - n / 2) - v2[0][1].F) + (n / 2 - v2[1][0].F) << endl;
        } else {
            int a = ((n - n / 2) - v2[0][1].F) + (n / 2 - v2[1][0].F);
            int b = ((n - n / 2) - v2[0][0].F) + (n / 2 - v2[1][1].F);
            cout << min(a, b) << endl;
        }
    }
}

/*
 5
 3 1 3 1 2
 
 2 ?!
 
 
 */


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




Measured memory_bytes: 6524
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan=new Scanner(System.in);
		String s=scan.next();
		String t=scan.next();
		int kekka=0;
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)!=t.charAt(i)){
				kekka+=1;
			}
		}
		System.out.println(kekka);
	}
}


Measured memory_bytes: 41088
def resolve():
    N, X = list(map(int, input().split()))
    level_len = [1]
    for i in range(1, N+1):
        level_len.append(2*level_len[i-1]+3)
    #print(level_len)
    mem = {"0-0": 1}

    def get_cnt(level, pos):
        if "{}-{}".format(level, pos) in mem:
            return mem["{}-{}".format(level, pos)]

        result = None
        if pos == 0:
            result = 0
        elif 1 <= pos <= level_len[level-1]:
            result = get_cnt(level-1, pos-1)
        elif pos == 1+level_len[level-1]:
            result = get_cnt(level-1, level_len[level-1]-1)+1
        elif 1+level_len[level-1] < pos <= 1+2*level_len[level-1]:
            result = get_cnt(level-1, level_len[level-1]-1) + 1 + get_cnt(level-1, pos-level_len[level-1]-2)
        elif pos == 2*level_len[level-1]+2:
            result = 2*get_cnt(level-1, level_len[level-1]-1)+1

        if result is None:
            #print(level, pos)
            raise Exception("Invalid")
        mem.setdefault("{}-{}".format(level, pos), result)
        return result
    
    print(get_cnt(N, X-1))

    

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 3064
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
struct matrix
{
	ll a[2][2];
	matrix(){memset(a,0,sizeof(a));}
	matrix operator*(const matrix &t)
	{
		matrix ret;
		for(int i=0;i<2;i++)
		{
			for(int j=0;j<2;j++)
			{
				for(int k=0;k<2;k++)
				{
					ret.a[i][k]=(ret.a[i][k]+a[i][j]*t.a[j][k])%mod;
				}
			}
		}
		return ret;
	}
};
matrix qpow(matrix x,ll k)
{
	matrix ret;
	ret.a[0][0]=ret.a[1][1]=1;
	while(k)
	{
		if(k&1)ret=ret*x;
		x=x*x;
		k>>=1;
	}
	return ret;
}
char s[1011][1011];
int n,m;
ll K;
ll qpow(ll x,ll k){return k==0?1:qpow(x*x%mod,k>>1)*(k&1?x:1)%mod;}
int main()
{
	getiii(n,m,K);
	int cnt=0,cnth=0,cntv=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			s[i][j]=getreal();
			cnt+=s[i][j]=='#';
		}
	}
	for(int i=1;i<=n;i++)cnth+=s[i][1]==s[i][m]&&s[i][1]=='#';
	for(int i=1;i<=m;i++)cntv+=s[1][i]==s[n][i]&&s[1][i]=='#';
	if(cnth&&cntv)puts("1");
	else if(!cnth&&!cntv)putsi(qpow(cnt,K-1));
	else
	{
		matrix A;
		A.a[0][0]=cnt;
		int cnt2=0;
		for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)
		{
			if(s[i][j]!='#')continue;
			if(cnth>0)cnt2+=s[i][j]==s[i][j+1];
			else cnt2+=s[i][j]==s[i+1][j];
		}
		A.a[1][0]=cnt2;
		A.a[1][1]=max(cnth,cntv);
//		cout<<cnt<<" "<<cnt2<<" "<<max(cnth,cntv)<<endl;
		A=qpow(A,K-1);
		cout<<(A.a[0][0]-A.a[1][0]+mod)%mod<<endl;
	}
	return 0;
}


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

int main() {
    int A, B, C, X;

    cin >> A >> B >> C >> X;

    int pattern_num = 0;
    for (int fifty_hund=0; fifty_hund<=A; fifty_hund++) {
        for (int one_hund=0; one_hund<=B; one_hund++) {
            for (int fifty=0; fifty<=C; fifty++) {
                int res = (500 * fifty_hund) + (100 * one_hund) + (50 * fifty);
                if (X == res) {
                    pattern_num++;
                }
            }
        }
    }
    cout << pattern_num << endl;
}

Measured memory_bytes: 256
r, c, R, C = [int(_) for _ in input().split()]
mod = 10**9 + 7

f = [1] * (3 * 10**6 + 10)
for i in range(1, 3 * 10**6 + 10):
    f[i] = i * f[i - 1] % mod
fi = {}


def inv(x):
    return pow(x, mod - 2, mod)


a1 = (C + 2) * f[c + 1] * f[C + R + 2] - (c + 1) * f[C + 2] * f[c + R + 1]
a1 *= inv(f[c + 1]) * inv(f[C + 2]) * inv(f[R + 1])
a2 = (C + 2) * f[c + 1] * f[C + r + 1] - (c + 1) * f[C + 2] * f[c + r]
a2 *= inv(f[c + 1]) * inv(f[C + 2]) * inv(f[r])
ans = a1 - a2
ans %= mod
print(ans)


Measured memory_bytes: 121716