akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#pragma region
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << (#x) << "] = [", _print(x)
#else
#define debug(x...)
#endif
#pragma endregion
typedef long long ll;
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(v) int((v).size())
#define int ll
#pragma region
#define f first
#define s second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#pragma endregion

int MOD = 1e9+7;
int fact[222'222];
int power(int a, int n)
{
    int res = 1;
    int now = a;
    while(n)
    {
        if (n&1)
        {
            res  = (res*now) %MOD;
        }
        n>>=1;
        now = (now*now)%MOD;
    }
    return res;
}
int inv(int a)
{
    return power(a, MOD-2);
}
int C(int n, int r)
{
    if (n < r) return 0;
    return fact[n] %MOD * inv(fact[n-r])%MOD * inv(fact[r])%MOD;
}

int n, k;
void solve()
{
    fact[0] = 1;
    for(int i=1; i < 222'222; ++i) fact[i] = (fact[i-1] * i)%MOD;
    //
    cin>>n>>k;
    int ans = 0;
    for (int i = 0; i <= min(k, n-1); ++i)
    {
        int ad = C(n, i) * C(n-1, i)%MOD;
        ans = (ans + ad)%MOD;
    }
    cout << ans << '\n';
}

signed main()
{
    int T = 1;
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << fixed << setprecision(22);
    //cin >> T;
    for(int i=1;i<=T;++i)
    {
        //cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 5392
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

const int mnx = 3e5 + 9;
const int mod = 1e9 + 7;

string s;
int ans = 100;
int now, mx;

int main(){

cin>>s;

for(int i=97; i<=122; i++){
    now = 0;
    mx = 0;
    for(char c : s){
        if(c == i){
            now = 0;
        } else {
            mx = max(mx, ++now);
        }
    }
    ans = min(ans, mx);
}

cout<<ans<<'\n';

return 0;

}















Measured memory_bytes: 256
#include <cstdio>

int main()
{
	char op;
	int a, b; 
    
    scanf("%d %c %d", &a, &op, &b);
    
    if (op == '+') 
    {
    	printf("%d", a+b);
	}
	else if (op == '-')
	{
		printf("%d", a-b);
	}
}

Measured memory_bytes: 1724
s=list(input())
ans = 0
for i in range(len(s)):
    a = 0
    for j in range(i,len(s)):
        if s[j] == "A" or s[j] == "C" or s[j] == "G" or s[j] == "T":
            a += 1
        else:
            break
    if a >ans:
        ans = a
print(ans)

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i];
    if(i == SZ(s)-1) {
      cout << endl;
    } else {
      cout << " ";
    }
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n; cin >> n;
  vector<double> a(n);
  for(int i=0;i<n;++i) {
    cin >> a[i];
  }

  vector<double> pos(n);
  pos[0] = a[0];
  for(int i=1;i<n;++i) {
    pos[i] = pos[i-1];
    for(int j=0;j<i;++j) {
      double tmp = sqrt(pow(a[j]+a[i],2)-pow(abs(a[i]-a[j]),2)+eps);
      pos[i] = max(pos[i], pos[j] + tmp);
    }
  }
  double l = 0, r = pos[n-1] + a[n-1];
  for(int i=0;i<n;++i) {
    l = min(l, pos[i] - a[i]);
    r = max(r, pos[i] + a[i]);
  }
  // printv(a);
  // printv(pos);
  // cout << l << ":" << r << endl;
  cout << r-l << endl;

}



Measured memory_bytes: 3248
import java.util.*;

import java.lang.*;

import java.math.*;



public class Main {

	Scanner sc = new Scanner(System.in);



	class p {

		int a;

		int m;

		int freq;

		p(int a, int m) {

			this.a = a;

			this.m = m;

		}

		int freq(){

			if(freq!=0){

				return freq;

			}

			int k=a;

			for(int i = 1; ;i++){

				if(k%m == 1){

					freq = i;

					return i;

				}

				k*=a;

				k%=m;

			}

		}

	}



	void run() {

		for (;;) {

			p[] data = new p[3];

			BigInteger lcm = BigInteger.ONE;

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

				int a = sc.nextInt();

				if(a==0) return;

				int m = sc.nextInt();

				data[i] = new p(a, m);

				

				lcm = BigInteger.valueOf(data[i].freq()).multiply(lcm).divide(BigInteger.valueOf(data[i].freq()).gcd(lcm));

			}

			System.out.println(lcm);

		}



	}



	public static void main(String[] args) {

		Main m = new Main();

		m.run();

	}

}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)
#define mp make_pair

#define dump(x)  cout << #x << " = " << (x) << "\n";
#define COUT(x) cout<<(x)<<"\n"

int main()
{
	int n = 0;
	cin >> n;
	vector<int> a(n + 1);
	REP(i, n)
	{
		int buf = 0;
		cin >> buf;
		a[i] = buf - 1;
	}

	int now = 0;
	int ct = 0;

	while(1)
	{
		if (now == 1)
		{
			COUT(ct);
			break;
		}
		if (ct >= n)
		{
			COUT(-1);
			break;
		}
		ct++;
		now = a[now];
	}

	return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, a, n) for (int i = a; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eps 1e-15

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef tuple<int, int, int> ti3;

int main()
{
    int x, y;
    scanf("%d %d", &x, &y);
    printf("%d", x + y / 2);

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	cin>>n;
	ll a[n+1],b[n+1],c[n+1];
	for(i=1;i<=n;i++){
		cin>>a[i];
	}
	for(i=1;i<=n;i++){
		cin>>b[i];
	}
	for(i=1;i<n;i++){
		cin>>c[i];
	}

	ll ans=0;
	for(i=1;i<=n;i++){
		ans+=b[a[i]];
		if(i>1){
			if(a[i-1]+1==a[i]){
				ans+=c[a[i-1]];
			}
		}
	}
	cout<<ans;
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
#include <iostream>  
using namespace __gnu_pbds;  
using namespace std;  
  
// Declaring ordered_set 
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update>  
    ordered_set;*/  


#define ll long long int
#define ld long double
#define le length()
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mkp make_pair
#define ppl pair<ll,ll>
#define ppi pair<int,int>
#define ppli pair<ll,int>
#define ps push
#define mod 1000000007
#define fi first
#define se second
#define debug1(x) cout<<#x<<" = "<<x<<'\n';
#define debug2(x, y) cout << #x << " = " << x << "   " << #y << " = " << y << "\n";
#define all(v) v.begin(),v.end()
#define mset(x) memset(x,0,sizeof(x))
#define sz size()


ll power(ll a,ll b)
{
    if(b==0)
    return 1;
    if(b==1)
    return a;
    ll r=power(a,b/2)%mod;
    if(b%2==0)
    return (r*r)%mod;
    else
    return (((r*r)%mod)*a)%mod;
}
#define pri 500009
int prime[pri];
int sumprime[pri];
void sieve(int n)
{ 
    prime[0]=prime[1]=1;
    for(int i=2;i<=sqrt(n);i++)
    {
        if(!prime[i])
        {
            for(int j=2*i;j<=n;j=j+i)
            {
                prime[j]++;
            }
        }
    }
    for(int i=1;i<=n;i++)
    {
        if(!prime[i])
        {
            sumprime[i]=sumprime[i-1]+1;
        }
        else
        {
            sumprime[i]=sumprime[i-1];
        }
    }
}

bool comp(const pair<ll,ll> &a, 
               const pair<ll,ll> &b)
{
       return (a.second < b.second);
}

const int N=5*1e5+9;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  /*  #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif*/
    sieve(500000);
    vector<ll> v;
    for(int i=0;i<200000;i++)
    {   
        if(!prime[i])
        {
            v.pb(i);
        }
    }
    ll x;
    cin>>x;
    auto val=lb(all(v),x);
    ll ww=*val;
    cout<<ww<<"\n";


    return 0;
}

Measured memory_bytes: 4608
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <iomanip>
#include <cmath>

#define vi vector<int>
#define tests int t; cin>>t; while(t--)
#define ll long long
#define vll vector<long long>
#define srt(v) sort(v.begin(), v.end())
#define srtg(v) sort(v.begin(), v.end(), greater<int> ())
#define FOR(k, n) for(int k=0; k<n; k++)



using namespace std;

char nums[10] = { '0','1','2','3','4','5','6','7','8','9' };
char alphsl[26] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
const ll MOD = 1000000007;
char alphs[26] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };

void solve() {

    int n;
    cin >> n;
    vector<vi> v(n, vector<int>(3, 0));

    for (auto& x : v) cin >> x[0] >> x[1] >> x[2];
    vector<vi> dp(n, vector<int>(3, 0));

    dp[n - 1][0] = v[n - 1][0];
    dp[n - 1][1] = v[n - 1][1];
    dp[n - 1][2] = v[n - 1][2];

    for (int i = n - 2; i >= 0; i--) {
        dp[i][0] = v[i][0] + max(dp[i + 1][1], dp[i + 1][2]);
        dp[i][1] = v[i][1] + max(dp[i + 1][0], dp[i + 1][2]);
        dp[i][2] = v[i][2] + max(dp[i + 1][1], dp[i + 1][0]);
    }

    cout << max(dp[0][0], max(dp[0][1], dp[0][2])) << endl;

}


int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);


    solve();



    return 0;
}

Measured memory_bytes: 14164
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;

int main(){
	int n,b,a=1;
	scanf("%d",&n);
	do
	{
		b=a*a;
		a++;
	}while(b<=n);
	a=a-2;
	b=a*a;
	printf("%d\n",b);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#define INF 100000000

using namespace std;
int main(){
  while(1){
    int n,k;
    cin >> n >> k;
    if(n==0&&k==0)break;
    vector< vector<int> > gr( n+1 , vector<int>(n+1, 0) );  
    //  int gr[n+1][n+1];
    int D[n+1];
    int R[n+1];
    int p;
    int a,b,c,d;
    for(int j=0;j<k;j++){
      cin >> a;
      if(a==0){
	cin >> b >> c;
	//D syoki
	for(int i=0;i<n+1;i++){
	  D[i]=INF;
	  R[i]=0;
	}
	//
	D[b]=0;
	R[b]=1;
	p=b;
	while(1){
	  for(int i=1;i<n+1;i++){
	    if(gr[p][i]!=0){
	      D[i]=min(gr[p][i]+D[p],D[i]);
	    }
	  }
	  int mini=INF+1;
	  int minn=-1;
	  for(int i=1;i<n+1;i++){
	    if(R[i]==1)continue;
	    mini=min(D[i],mini);
	    if(mini==D[i])minn=i;
	  }
	  if(minn==-1)break;
	  else{
	    R[minn]=1;
	    p=minn;
	  }
	}
	if(D[c]==INF)cout << -1 << endl;
	else cout << D[c] << endl;
      }
      //
      else if(a==1){
	cin >> b >> c >> d;
	if(gr[b][c]>d||gr[b][c]==0){
	  gr[b][c]=d;
	  gr[c][b]=d;
	}
      }
    }
  }
  return 0;  
}

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

using namespace std;

int main(int argc, char * argv[]) {
    string str;
    cin >> str;

    if (str[0] == str[1] || str[1] == str[2] || str[2] == str[3]) {
        cout << "Bad" << endl;
    } else {
        cout << "Good" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main  {
	public static void main(String[] args)throws Exception{
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        int N = Integer.parseInt(br.readLine());
        int K = Integer.parseInt(br.readLine());
        int X = Integer.parseInt(br.readLine());
        int Y = Integer.parseInt(br.readLine());
        if(N > K){
        System.out.print(K * (X - Y) + N * Y );
        }
        else{
        System.out.print(N * X);
        }
	}
}

Measured memory_bytes: 22612
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    private static int[] heap;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        heap = new int[N + 1];
        IntStream.rangeClosed(1, N).forEach(i -> heap[i] = sc.nextInt());

        IntStream.range(1, heap.length).forEach(i -> {
            StringBuilder sb = new StringBuilder();
            sb.append("node ").append(i)
                    .append(": key = ").append(heap[i]).append(", ");
            if (parent(i) >= 1) sb.append("parent key = ").append(heap[parent(i)]).append(", ");
            if (left(i) <= N) sb.append("left key = ").append(heap[left(i)]).append(", ");
            if (right(i) <= N) sb.append("right key = ").append(heap[right(i)]).append(", ");

            System.out.println(sb.toString());
        });
    }

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

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

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



Measured memory_bytes: 32284
//-----------------------------------------------------------
// すぐ使える
//-----------------------------------------------------------
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
		// 1行目数字、2行目文字
		long N = Long.parseLong(br.readLine());

		long a=0;
		long b=0;
		
		a = (long)Math.floor(Math.sqrt(N));
		for(long i=0; i < N; i++){
			if( N % a == 0 ) {
				//割り切れたら、そこで比べる
				b = N / a;
				break;
			} else {
				a -= 1;
			}
		}
		
		long ans = Math.max(String.valueOf(a).length(), String.valueOf(b).length());

		//System.out.println(ans + ", a=["+a+"], b=["+b+"]");
		System.out.println(ans);
		return;
    }

}

//-----------------------------------------------------------
//-----------------------------------------------------------



Measured memory_bytes: 21332
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

n,m,k = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
cd = [list(map(int, input().split())) for i in range(k)]

uf = [-1]*n
def root(x):
    if uf[x] < 0:
        return x
    uf[x] = root(uf[x])
    return uf[x]
def unite(x,y):
    rx, ry = root(x), root(y)
    if rx == ry:
        return False
    if uf[rx] > uf[ry]:
        rx, ry = ry, rx
    uf[rx] += uf[ry]
    uf[ry] = rx
    return True

hop1 = [0]*n
dislike = [0]*n
for a,b in ab:
    a,b = a-1, b-1
    unite(a, b)
    hop1[a] += 1
    hop1[b] += 1
for c,d in cd:
    c,d = c-1, d-1
    if root(c) == root(d):
        dislike[c] += 1
        dislike[d] += 1
ans = [-uf[root(i)]-hop1[i]-dislike[i]-1 for i in range(n)]
print(*ans)


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

int main() {
  int x,n;
  set<int> p;
  cin >> x >> n;
  for(int i=0;i<n;i++){
    int tmp;
    cin >> tmp;
    p.insert(tmp);
  }
  for(int i=0;i<100;i++){
    int a = x-i;
    int b = x+i;

    if(p.find(a)==p.end()){

      cout << a << endl;
      return 0;

    }else if(p.find(b)==p.end()){

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


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

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  int res;
  
  if (n*a > b) {
    res = b;
  }
  else {
    res = n*a;
  }
  
  cout << res << endl;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
A=[0]*n
for i in range(k):
    d=int(input())
    B=list(map(int,input().split()))
    for i in range(d):
        A[B[i]-1]+=1
ans=0
for a in A:
    if a==0:
        ans+=1
print(ans)

Measured memory_bytes: 9192
#include<stdio.h>

int main(){

int n[11]={};
int N,x;
while(1){
scanf("%d",&N);if(N==0)break;

for(int i=0;i<N;i++)
{
scanf("%d",&x);
n[x]++;
}

for(int i=0;i<10;i++)
{
if(n[i]>0){
for(int j=0;j<n[i];j++)
printf("*");}
else if(n[i]==0)printf("-");
printf("\n");
}

for(int i=0;i<10;i++)
	n[i]=0;
}
return 0;
}

Measured memory_bytes: 1000
#include<iostream>
#include<algorithm>
#define LL long long
int N;
int t[100010];
int x[100010];
int y[100010];
int main() {
	int N;
	std::cin >> N;
	for (int i = 1; i <= N; i++) {
		std::cin >> t[i] >> x[i] >> y[i];
	}
	for (int i = 1; i <= N; i++) {
		int T = std::abs(x[i] - x[i - 1]) + std::abs(y[i] - y[i - 1]);
		T = t[i] - t[i - 1] - T;
		if (T < 0 || T % 2) {
			std::cout << "No" << std::endl;
			return 0;
		}
	}
	std::cout << "Yes" << std::endl;
	return 0;
}

Measured memory_bytes: 1408
/**
 * Author: Deb Natkh Maxim (debnatkh@gmail.com)
 */

#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define getbit(x, i) (((x) >> (i)) & 1)
using namespace std;
typedef pair<int, int> pii; 

const int MAXN = 1e5;
int arr[MAXN];

signed main() {
	int n;
	cin >> n;
	cout << (n * (n - 1)) / 2 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int ans = 1234567890;
int check[20];
int S = 0;
int a,b,c;
int x[20],y[20][20];
void func(int k)
{
	if(k>a)
	{
		for(int j=1;j<=b;j++) if(check[j]<c) return;
		ans = ans<S?ans:S;
		return;
	}
	func(k+1);
	S += x[k];
	for(int j=1;j<=b;j++) check[j] += y[k][j];
	func(k+1);
	for(int j=1;j<=b;j++) check[j] -= y[k][j];
	S -= x[k];
}

int main()
{
	scanf("%d%d%d",&a,&b,&c);
	for(int i=1;i<=a;i++)
	{
		scanf("%d",&x[i]);
		for(int j=1;j<=b;j++) scanf("%d",&y[i][j]);
	}
	func(1);
	printf("%d",ans==1234567890?-1:ans);
}


Measured memory_bytes: 1704
#include <stdio.h>
#define NOT_FOUND -1

int linearSearch(int *,int );

int n,q;

int main(){
  int i,x=0,z;
  int s[10000],t[500];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
  }
 
  scanf("%d",&q);

  for(i=0;i<q;i++){
    scanf("%d",&t[i]);
  }

  for(i=0;i<q;i++){
    z = linearSearch(s,t[i]);
    if(z != NOT_FOUND) x++;
  }

  printf("%d\n",x);
  
  return 0;
}

int linearSearch(int *s,int t)
{
  int i = 0;

    s[n] = t;
    while(s[i] != t){
      i++;
    }
      if(i == n) return NOT_FOUND;
      else return i;
}

Measured memory_bytes: 640
n= int(input())
tbl=[[[0]*10 for i in range(0,3)] for j in range(0,4)]
for k in range(n):
    b,f,r,v = map(int,input().split())
    tbl[b-1][f-1][r-1] +=v
x=0
for i in range (4):
    if x !=0 : print("#"*20)
    x +=1
    for a in range(3):
        for b in range(10):
            print(" %d"%(tbl[i][a][b]),end="")     
        print()


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

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  int n;cin>>n;
  double a[n+10];rep(i,0,n)cin>>a[i];

  double dif=10000;
  double sum=0;
  rep(i,0,n){
    sum+=a[i];
  }
  double avg=sum/n;

  int ans=0;
  rep(i,0,n){
    if(abs(avg-a[i])<dif){
      dif=abs(avg-a[i]);
      ans=i;
    }
  }

  out(ans);




  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){

        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        int M = scanner.nextInt();
        int X = scanner.nextInt();

        int C[] = new int[N];
        int A[][] = new int[N][M];

        for(int loopN=0; loopN<N; loopN++){

            C[loopN] = scanner.nextInt();

            for(int loopM=0; loopM<M; loopM++){
                A[loopN][loopM] = scanner.nextInt();
            }
        }



        // 全冊読破で達成可能か判定
        for(int loopM=0; loopM<M; loopM++){
            int understand = 0;

            for(int loopN=0; loopN<N; loopN++){
                understand += A[loopN][loopM];
            }
            if(understand<X){
                System.out.println(-1);
                return;
            }
        }



        // 各パターンの理解度判定・コスト計算
        int maxCode = 1;
        int minCost = 0;
        for(int loop=0; loop<N; loop++){
            maxCode *= 2;
            minCost += C[loop];
        }
        maxCode--;

        for(int loopCode=1; loopCode<maxCode; loopCode++){
            int code = loopCode;
            int bookN[] = new int[N];
            for(int loop=0; loop<N; loop++){
                bookN[loop] = code % 2;
                code /= 2;
            }

            // 理解度判定
            boolean canUnderstand = true;
            for(int loopM=0; loopM<M; loopM++){
                int understand = 0;

                for(int loopN=0; loopN<N; loopN++){
                    understand = understand + ( A[loopN][loopM] * bookN[loopN] );
                }
                if(understand<X){
                    canUnderstand = false;
                }
            }
            if( canUnderstand ){

                // コスト計算
                int cost=0;
                for(int loopN=0; loopN<N; loopN++){
                    cost = cost + ( C[loopN] * bookN[loopN] );
                }
                if(cost<minCost){
                    minCost = cost;
                }
            }
        }

        System.out.println( minCost );

    }
}


Measured memory_bytes: 37996
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,f;
    while(cin>>a>>b>>c>>d)
    {
        if(a<=b)
        {
            e=a;
        }
        else
        {
            e=b;
        }
        if(c<=d)
        {
            f=c;
        }
        else
        {
            f=d;
        }
        cout<<e+f<<endl;



    }



    return 0;
}


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


int main(void){
    string s,t;
    cin >> s >> t;
    s += s;
    bool flag = 0;
    bool ans = 0;
    for(int i=0;i<t.length();i++){
        flag = 0;
        for(int j=0;j<t.length();j++){
            if(s[i+j] != t[j]){
                flag = 1;
                break;
            }
        }
        if(flag == 0){
            ans = 1;
            break;
        }
    }
    if(ans){
        cout << "Yes" <<endl;
    }
    else{
        cout <<"No" <<endl;
    }
    
    return 0;
}






















































Measured memory_bytes: 256
var s:string;
min:integer;
x,i:integer;
begin 
    readln(s);
    min:=1000;
    for i:=1 to length(s)-2 do 
    begin 
        val(copy(s,i,3),x);
        if abs(x-753)<min then min:=abs(x-753);
    end;
    write(min);
end.



Measured memory_bytes: 128
N = int(input())
travel = [list(map(int, input().split())) for _ in range(N)]

buff = [0, 0, 0]
ans = "Yes"

for i in range(N):
    t, x, y = travel[i]
    time = t - buff[0]
    distance = abs(x - buff[1]) + abs(y - buff[2])
    if time < distance or (time - distance) % 2 == 1:
        ans = "No"
        break
    buff = travel[i]

print(ans)


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

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (int i = j; i < (n); i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1e9;

int main(){

  ll n,m;cin>>n>>m;

  ll ans=0;
  if(m/2>=n){
    ans+=n;
    m-=n*2;
    ans+=m/4;
  }else{
    ans+=m/2;
  }

  out(ans);


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <math.h>
#define MOD 1000000007
using namespace std;

int main()
{
	int n, k,ans;
	int d[10];
	int a[6];
	cin >> n >> k;
	int i,j,l,flag;
	for (i = 0; i < k; i++){
		cin >> d[i];
	};
	for (i = 0; i < 10 * n; i++){
		ans = n + i;
		for (j = 0; j < 6; j++){
			a[j] = ans % 10;
			ans = ans / 10;
		};
		ans = n + i;
		flag = 0;
		for (j = 0; j < k; j++){
			for (l = 0; l < floor(log10(ans))+1; l++){
				if (a[l] == d[j]){
					flag = 1;
					break;
				};
			};
		};
		if (flag == 0){
			break;
		};
	};
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 640
import sys
import math
import numpy as np

stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n, m, v, p = na()
a = na()
a.sort(reverse=True)
a = np.array(a)
left = 0
right = n
def check(i):
    c = a[i] + m
    s = (p-1) * m + np.sum(np.minimum(c - a[p-1:], m))
    if i+1 <= p:
        return True
    elif a[i] + m < a[p-1]:
        return False
    elif s >= m * v:
        return True
    else:
        return False
while left + 1 < right:
    x = (left + right) // 2
    if check(x):
        left = x
    else:
        right = x
print(left + 1)

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned int ui32;
const long long INFLL = 1e18;

using namespace std;

const int MAXN = 3 * 100000;

int pref[MAXN + 10], suf[MAXN + 10];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("input.txt", "w", stdout);

    int n;
    cin >> n;

    string s;
    cin >> s;

    for (int i = 1; i <= n; i++) {
        pref[i] = pref[i - 1] + (s[i - 1] == 'W');
    }
    for (int i = n; i >= 1; i--) {
        suf[i] = suf[i + 1] + (s[i - 1] == 'E');
    }

    int ans = 1e9;

    for (int i = 1; i <= n; i++) {
        ans = min(ans, pref[i - 1] + suf[i + 1]);
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3092
/*input
6 5
8 6 9 1 2 1
1 3
4 2
4 3
4 6
4 6
*/

#include <bits/stdc++.h>

using namespace std;

const int Nmax = 1e5 + 10;

int n, m, res;
vector <int> a[Nmax];
int h[Nmax];

int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
		cin >> h[i];
	}
	while (m--) {
		int u, v;
		cin >> u >> v;
		a[u].push_back(v);
		a[v].push_back(u);
	}
	for (int u = 1; u <= n; ++u) {
		bool found = false;
		for (auto v : a[u]) {
			if (h[v] >= h[u]) {
				found = true;
				break; 
			}
		}
		if (found == false) res++;
	}
	cout << res << endl;
}

Measured memory_bytes: 9140
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
template <class T>
inline void chmin(T &a, const T &b) { a = min(a, b); }
template <class T>
inline void chmax(T &a, const T &b) { a = max(a, b); }
template <class T>
inline bool kbit(const T &x, const int &k) { return ((x >> k) & 1LL); }
inline int popcount(const int &n) { return __builtin_popcount(n); }
inline ll popcountll(const ll &n) { return __builtin_popcountll(n); }
inline ll mask(const ll &k) { return (1LL << k) - 1LL; }
template <class T>
void zip(V<T> &v) {
    sort(all(v));
    v.erase(unique(all(v)), v.end());
}
template <class T>
int lwb(V<T> &v, const T &x) { return lower_bound(all(v), x) - v.begin(); }
template <class T>
int upb(V<T> &v, const T &x) { return upper_bound(all(v), x) - v.begin(); }
void dump() {
    cerr << '\n';
}
template <class Head, class... Tail>
void dump(Head &&head, Tail &&... tail) {
    cerr << head << (sizeof...(Tail) == 0 ? " " : ", ");
    dump(std::move(tail)...);
}
template <class T>
void print(const vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
}
template <class T>
void read(vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}
constexpr char sp = ' ', newl = '\n';
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
constexpr ll INF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
//////////////////////////////////////////////INSERT ABOVE HERE
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int x;
    cin >> x;
    cout << 10 - (x / 200) << newl;
}

Measured memory_bytes: 3644
s =input()
k = int(input())

t = 0
u = s[0]

for i in range(len(s)):
	t +=1
	u = s[i]
	if s[i] !="1":                 #この時点でｔはi+1になっている
		break
if t<k+1:
	print(u)
else:
	print(1)

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct Node {
    int key;
    struct Node *right, *left, *parent;
};
typedef struct Node Node;

Node *root, *NIL;

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node *)malloc(sizeof(Node));
    z->key   = k;
    z->left  = NIL;
    z->right = NIL;
    
    while(x != NIL) {
        y = x;
        if(z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }
    
    z->parent = y;
    if(y == NIL) {
        root = z;
    } else {
        if( z->key < y->key) {
            y->left = z;
        } else {
            y->right = z;
        }
    }
}

void inorder(Node *u) {
    if(u == NIL) return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
void preorder(Node *u) {
    if(u == NIL) return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}
Node * find(Node *u, int k) {
    while(u != NIL && k != u->key) {
        if(k < u->key) u = u->left;
        else u = u->right;
    }
    return u;
}

    
int main(void) {
    int n, i, x;
    char com[16];
    scanf("%d",&n);
    
    for(i=0;i<n;i++) {
        scanf("%s",com);
        if(com[0] == 'f') {
            scanf("%d",&x);
            Node *t = find(root,x);
            if(t != NIL) printf("yes\n");
            else printf("no\n");
        } else if(!strcmp(com,"insert")) {
            scanf("%d",&x);
            insert(x);
        } else if(!strcmp(com,"print")) {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}




Measured memory_bytes: 20524
from itertools import accumulate
def prm(x):
    if x == 1 or x == 4:
        return False
    for i in range(2,int(x**0.5+1)):
        if x%i==0:
            return False
    else:
        return True
def like2017(x):
    if x == 2:
        return False
    if prm(x) and prm((x+1)//2):
        return True
q=int(input())
l=[0]*(10**5+1)
for i in range(1,10**5+1):
    if like2017(i):
        l[i]=1
acl = list(accumulate(l))
for i in range(q):
    l,r=map(int,input().split())
    print(acl[r]-acl[l-1])

Measured memory_bytes: 7096
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    int64_t N;
    std::cin >> N;

    std::vector<int64_t> A(100000);
    for (decltype(N) i = 0; i < N; ++i) {
        int64_t t;
        std::cin >> t;
        A[t]++;
    }

    int64_t max = 0;
    for (size_t i = 0; i < 100000-2; ++i) {
        max = std::max(max, A[i] + A[i+1] + A[i+2]);
    }

    std::cout << max << std::endl;

    return 0;
}


Measured memory_bytes: 1024
import numpy as np
def combinations(n,k,mod=10**9+7):
    x,y = 1,1
    for i in range(k):
        x = (x*(n-i))%mod
        y = (y*(i+1))%mod
    y = pow(y,mod-2,mod)
    return (x*y)%mod

N,P = map(int,input().split())
a = np.array(list(map(int,input().split())))%2
a1 = np.count_nonzero(a==1)
a0 = np.count_nonzero(a==0)

ans = 0
for i in range(P,a1+1,2):
    ans += combinations(a1,i)

print(ans*(2**a0))


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

using namespace std;

#define ll long long int

#define SAY_YES cout << "Yes" << endl
#define SAY_NO cout << "No" << endl
#define say(s) cout << s << endl
#define rep(i, n) for(int i=0; i<(int)(n); i++)

#define vec vector

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a != b && a != c && b != c) {
    SAY_NO;
  } else if (a == b && a == c && b == c) {
    SAY_NO;
  } else {
    SAY_YES;
  }
  return 0;
}


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

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

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))
#define INF (1<<28)
#define pb push_back
#define fs first
#define sc second

const char dx[]={0,1,0,-1},dy[]={1,0,-1,0};
template<class T>
ostream &operator<<(ostream &out, const vector<T> &v){
	out << "{";
	rep(i,v.size()) out << v[i] << ", " ;
	return out << "}" << endl;
}
template<class S,class T>
ostream &operator<<(ostream &out, const pair<S,T> p){
	return out << "(" << p.fs << ", " << p.sc << ")";
}
#define MOD 1000000007
int main(){
	int n;
	cin >> n;
	vi t(n), a(n);
	rep(i,n) cin >> t[i];
	rep(i,n) cin >> a[i];
	ll ans = 1;
	vi det(n);
	det[0]=t[0];
	det[n-1]=a[n-1];
	if(n==1&&t[0]!=a[0])ans=0;
	rep(i,n){
		if(i && t[i]>t[i-1]){
			if(i==n-1&&t[i]!=a[i]) ans = 0;
			det[i]=t[i];
		}
		if(det[i]&&det[i]>a[i]) ans = 0;
	}
	rep(j,n){
		int i=n-1-j;
		if(i!=n-1 && a[i]>a[i+1]){
			if(det[i]!=0 && a[i]!=det[i])ans=0;
			det[i] = a[i];
		}
	}
	int m;
	rep(i,n){
		int l = max(t[i],a[i]);
		if(i&&m!=l)ans=0;
		m=l;
	}
	rep(i,n){
		if(!det[i]){
			ans *= min(t[i],a[i]);
			ans = ans % MOD;
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 2688
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        // Youtube解説通り実装

        int n = int.Parse(Console.ReadLine());

        var to = new List<List<int>>();
        for (int i = 0; i < n; i++)
            to.Add(new List<int>());
        var cost = new List<List<int>>();
        for (int i = 0; i < n; i++)
            cost.Add(new List<int>());

        for (int i = 1; i < n; i++)
        {
            string[] cin = Console.ReadLine().Split();
            int a = int.Parse(cin[0]);
            int b = int.Parse(cin[1]);
            int w = int.Parse(cin[2]);
            // -1してインデックス0スタートに
            a--;
            b--;
            // cin[0]から出るi番目の辺について
            // toとcostを記録
            to[a].Add(b);
            cost[a].Add(w);
            // 無向木なので
            to[b].Add(a);
            cost[b].Add(w);
        }

        var ans = new int[n];
        ans[0] = 0;
        for (int i = 1; i < n; i++)
        {
            ans[i] = -1;
        }
        var q = new Queue<int>();

        q.Enqueue(0);

        while (0 < q.Count)
        {
            // u→vでコストw
            int u = q.Dequeue();
            for (int i = 0; i < to[u].Count; i++)
            {
                int v = to[u][i];
                int w = cost[u][i];

                if (ans[v] != -1) continue;
                ans[v] = (ans[u] + w) % 2;
                q.Enqueue(v);
            }
        }

        // #FIXED:ここが遅い?
        Console.WriteLine(String.Join("\n", ans));
    }
}

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

#define space cout<<" ";
#define line cout<<"\n";

using namespace std;


int main()
{
    long long int x;
    cin>>x;
    long long int ans = 0;
    long long int multiplier;


    multiplier = x/500;
    ans+=multiplier*1000;
    x = x%500;
    multiplier = x/5;
    ans+=multiplier*5;



    cout<<ans;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,x=0,xmax=0;
  string s;
  cin>>N>>s;
  for(int i=0;i<N;i++){
    if(s[i]=='I')x++;
    else if(s[i]=='D')x--;
    xmax=max(x,xmax);
  }
  cout<<xmax<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
        int n,ijk;
    scanf("%d",&n);
    for(ijk=0;ijk<n;ijk++){
    int x[1000]={0},y[1000]={0},i,j,c=1,k,aa,d=0,ov=0,m=0,count=1,counts=1,countss=0;
    char a[1000]={0},b[1000]={0};
    int xx[1000]={0},yy[1000]={0};
    int sum[1000]={0};
    int along=0,blong=0;
    int sumlong=0,cntss=0;
    scanf("%s",a);
    along=strlen(a);
    //if(along>=81){
    //ov=1;
    //goto overflow;
    //}
    scanf("%s",b);
    blong=strlen(b);
    if(along>blong)c=along;
    else if(blong>along)c=blong;
    else if(along=blong)c=along;
    if(c-1>=81){
    ov=1;
    goto overflow;
    }
    if(c-1>=81){
    ov=1;
    goto overflow;
    }
    for(i = 100;i>=0; i--){
        if(a[i]=='\0');
        if(a[i]!='\0'){
            x[i] = a[i]-'0';
            xx[count] = x[i];
            count++;
        }
    }
    for(i = 100;i>=0; i--){
        if(b[i]=='\0');
        if(b[i]!='\0'){
            y[i] = b[i]-'0';
            yy[counts] = y[i];
            counts++;
    }
    }
    for(i=1;i<=100;i++){
            sum[i]+=xx[i]+yy[i];
            if(sum[i]>9){
                    sum[i]-=10;
                    sum[i+1]=sum[i+1]+1;
            }
        }

        if(sum[c+1]==0)d++;
        for(k=c+1-d;k>=0;k--){
                if(k==0&&sum[0]==0&&cntss==81){
                        ov=1;
                        goto overflow;
                }
                cntss++;
        }
        for(k=c+1-d;k>=0;k--){
                if(k==0&&sum[0]==0)break;
                printf("%d",sum[k]);
        }
        printf("\n");
        overflow:
        if(ov==1)printf("overflow\n");
    }
        return 0;
    }

Measured memory_bytes: 624
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
const int INF=1e+9;
const ll INFLL=1e+17;
int X;
int solve(){
  int res=1,sum=1;
  while(sum<X){
    res++;
    sum+=res;
  }
  return res;
}
int main(){
  cin>>X;
  prin(solve());
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<fstream>

using namespace std;

int main(){
  //ifstream in("input.txt");
  //cin.rdbuf(in.rdbuf());

  long N,R;
  cin>>N>>R;

  if(N<=10){
    cout<<R+100*(10-N)<<endl;
    return 0;
  }else{
    cout<<R<<endl;
    return 0;
  }

}

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

using namespace std;

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

    vector<int> A(N);
    for(int i=0; i<N; i++)cin >> A.at(i);

    sort(A.begin(), A.end());
    // for(int a : A)cout << a << " ";
    // cout << endl;

    int res = 0;
    for(int i=0; i<N; i++){
        for(int j=i+1; j<N; j++){
            if(A.at(i) == A.at(j))continue;
            for(int k=j+1; k<N; k++){
                if(A.at(j) == A.at(k))continue;
                if(A.at(k)<A.at(i)+A.at(j))res++;
            }
        }
    }

    cout << res << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

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

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
	int n, m;
	cin >> n >> m;
	vector<long long> dp(n + 1);
	vector<int> ok_step(n + 1, true);
	for (int i = 0; i < m; ++i) {
		int a; cin >> a;
		ok_step[a] = false;
	}
	dp[0] = 1;
	//移動パターン数を累積和でカウントする
	for (int i = 0; i < n; ++i) {
		//今立っている段から1段,2段移動する
		for (int j = i + 1; j <= min(n, i + 2); ++j) {
			//壊れている階段には移動しないので、加算は行わない
			if (ok_step[j]) {
				dp[j] += dp[i];
				dp[j] = dp[j] % MOD;
			}
		}
	}
	cout << dp[n] << endl;
    return;
}

int main() {
    solve();
    return 0;
}



Measured memory_bytes: 1408
#include"bits/stdc++.h"
	using namespace std;


	int main() {
		int n, a, b, c1, c2;
		cin >> n >> a >> b;
		c1 = n * a;
		c2 = b;
		if (c1 > c2) {
			cout << c2;
		}
		else {
			cout << c1;
		}
	}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var AB = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (A, B) = (AB[0], AB[1]);

        long GCD(long a, long b) => (b != 0) ? GCD(b, a % b) : a;
        long LCM(long a, long b) => a / GCD(a, b) * b;

        var ans = LCM(A, B);

        WriteLine(ans);
    }
}


Measured memory_bytes: 28224
import itertools

def enum(a):
    t = [0]
    for a1, a2 in itertools.combinations(a, 2):
        t.append(a1[0]-a2[0])
        t.append(a2[0]-a1[0])
        t.append((a1[0]-a2[0])/2)
        t.append((a2[0]-a1[0])/2)
    return t

def calcWidth(l, t):
    x_min = x_max = l[0][0] + l[0][1] * t
    for item in l:
        x_min = min(x_min, item[0] + item[1] * t)
        x_max = max(x_max, item[0] + item[1] * t)
    return x_max - x_min

def calc(x_trip, y_trip, t):
    if t < 0:
        return calcWidth(x_trip, 0) * calcWidth(y_trip, 0)
    return calcWidth(x_trip, t) * calcWidth(y_trip, t)

n = int(input())
x_r, x_n, x_l = [], [], []
y_u, y_n, y_d = [], [], []
for _ in range(n):
    x, y, d = input().strip().split()
    x, y = int(x), int(y)
    if d == "R":
        x_r.append(x)
    elif d == "L":
        x_l.append(x)
    else:
        x_n.append(x)

    if d == "U":
        y_u.append(y)
    elif d == "D":
        y_d.append(y)
    else:
        y_n.append(y)

x_r.sort()
x_n.sort()
x_l.sort()
y_u.sort()
y_n.sort()
y_d.sort()

def ht(x, d):
    if len(x) > 0:
        return [(x[0], d), (x[-1], d)]
    return []
x_list = ht(x_r, 1) + ht(x_n, 0) + ht(x_l, -1)
y_list = ht(y_u, 1) + ht(y_n, 0) + ht(y_d, -1)
t = enum(x_list + y_list)

ans = calc(x_list, y_list, 0)
for t1 in t:
    if t1 < 0:
        continue
    wx = calcWidth(x_list, t1)
    wy = calcWidth(y_list, t1)
    ans = min(ans, calc(x_list, y_list, t1))
    ans = min(ans, calc(x_list, y_list, t1 + (wx-wy)/2))
    ans = min(ans, calc(x_list, y_list, t1 + (wy-wx)/2))
    ans = min(ans, calc(x_list, y_list, t1 + (wx*2-wy)/4))
    ans = min(ans, calc(x_list, y_list, t1 + (wx-wy*2)/4))
    ans = min(ans, calc(x_list, y_list, t1 + (wy*2-wx)/4))
    ans = min(ans, calc(x_list, y_list, t1 + (wy-wx*2)/4))
    ans = min(ans, calc(x_list, y_list, t1 + (wx*2-wy*2)/8))
    ans = min(ans, calc(x_list, y_list, t1 + (wy*2-wx*2)/8))
print(ans)



Measured memory_bytes: 11252
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string S;
  cin >> S;
  int N=S.size();
  
  vector<char> q;
  
  for(int i=0;i<N;i++){
    q.push_back(S.at(i));
  }
  
  int ans1=0;
  int ans2=0;
  
  vector<char> a,b;
  
  for(int j=0;j<N;j++){
    if(j%2==0){
      a.push_back('1');
    }else{
      a.push_back('0');
    }
  }
  
  for(int k=0;k<N;k++){
    if(k%2==0){
      b.push_back('0');
    }else{
      b.push_back('1');
    }
  }
  
  for(int l=0;l<N;l++){
    if(q.at(l)!=a.at(l)){
      ans1++;
    }
  }
  
  for(int m=0;m<N;m++){
    if(q.at(m)!=b.at(m)){
      ans2++;
    }
  }
  
  cout << min(ans1,ans2) << endl;
  
}

Measured memory_bytes: 896
#include<stdio.h>
int main()
{
	const double MAX = 2147483647;
	double n, t, a, ans = MAX;
	int ansnum = 1;
	double h[1000];
	scanf("%lf%lf%lf", &n, &t, &a);
	for (int i = 0; i <= n - 1; i++)
	{
		scanf("%lf", &h[i]);
		h[i] = a - (t - h[i] * 0.006);
		if (h[i] < 0)
		{
			h[i] = -h[i];
		}
		if (h[i] < ans)
		{
			ans = h[i];
			ansnum = i + 1;
		}
	}
	printf("%d", ansnum);
	return 0;
}


Measured memory_bytes: 128
#include<queue>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;
struct node{
	int y,next;
}e[200010];int len=0,last[100010];
int n,c[100010],d[100010],f[100010];
bool vis[100010];
int tot=0,ans=0;
void ins(int x,int y)
{
	e[++len].y=y;
	e[len].next=last[x];last[x]=len;
}
char s[100010];
int N;
queue<int> q;
void pre()
{
	for(int i=1;i<=n;i++) if(s[i]=='B'&&d[i]==1) q.push(i);
	while(!q.empty())
	{
		int x=q.front();q.pop();
		vis[x]=true;N--;
		for(int i=last[x];i;i=e[i].next)
		{
			int y=e[i].y;
			d[y]--;if(d[y]==1&&s[y]=='B') q.push(y);
		}
	}
	if(N==0) {printf("0");exit(0);}
}
void dfs(int x,int fa)
{
	if(vis[x]) return;
	f[x]=c[x];ans=max(ans,c[x]);
	for(int i=last[x];i;i=e[i].next)
	{
		int y=e[i].y;
		if(y==fa) continue;
		dfs(y,x);ans=max(ans,f[x]+f[y]);
		f[x]=max(f[x],f[y]+c[x]);
	}
}
int main()
{
	scanf("%d",&n);N=n;
	for(int i=1;i<n;i++)
	{
		int x,y;scanf("%d %d",&x,&y);
		ins(x,y);ins(y,x);
		d[x]++;d[y]++;
	}
	memset(vis,false,sizeof(vis));
	scanf("%s",s+1);
	pre();
	for(int i=1;i<=n;i++) if(!vis[i]) tot+=d[i];
	for(int i=1;i<=n;i++)
	{
		if(vis[i]) continue;
		int k=s[i]=='B';
		if((d[i]+k)%2==1) c[i]=0;
		else tot++,c[i]=2;
	}
	if(N==1) {printf("%d",tot);return 0;}
	for(int i=1;i<=n;i++)
		if(!vis[i])
		{
			dfs(i,0);
			break;
		}
	printf("%d",tot-ans);
}

Measured memory_bytes: 7680