akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const ll Lmax=ll(1e18);
const ll INF=1e9;
const int Bmax=2e5;
const int Nd=61;


int main(){
  int n;cin>>n;
  vector<int> a(n);
  rep(i,n) cin>>a[i];
  ll g=1000;
  ll k=0; //
  ll c=0; //価値の総和

  //つねに価値の総和が最大になるように行動する.
  //株の価値は次の日の値をみる
  rep(i,n-1){
    ll allg=g+k*a[i]; //全て現金にした場合の価値
    ll allk=(g/a[i]+k)*a[i+1]+g%a[i]; //可能なかぎり株にした場合の価値
    if(allg<allk){//株にする
      k+=g/a[i];
      g=g%a[i];
    }else{//全て現金化
      g=g+k*a[i];
      k=0;
    }
  }
  cout<<g+k*a[n-1]<<endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int MAX = 305;
// const int MAX = 4;
/* global variables */
int N;
double dp[MAX][MAX][MAX];
bool flag[MAX][MAX][MAX];
/* funciton */
void init() {
    for (int i = 0; i < MAX; i++) for (int j = 0; j < MAX; j++) for (int k = 0; k < MAX; k++) {
        dp[i][j][k] = 0;
        flag[i][j][k] = false;
    }
}
double f(int c1, int c2, int c3) {
    if (flag[c1][c2][c3]) return dp[c1][c2][c3];
    flag[c1][c2][c3] = true;
    double d = c1+c2+c3;
    double ret = (double)N / d;  // (1−(0個の皿が選ばれる確率))
    //  + dp[c1−1][c2][c3] * (1個の皿が選ばれる確率) / (1−(0個の皿が選ばれる確率))
    if (c1 > 0) ret += f(c1-1, c2, c3) * c1 / d;
    //  + dp[c1+1][c2−1][c3] * (2個の皿が選ばれる確率) / (1−(0個の皿が選ばれる確率))
    if (c2 > 0) ret += f(c1+1, c2-1, c3) * c2 / d;
    //  + dp[c1][c2+1][c3−1] * (3個の皿が選ばれる確率) / (1−(0個の皿が選ばれる確率))
    if (c3 > 0) ret += f(c1, c2+1, c3-1) * c3 / d;
    return dp[c1][c2][c3] = ret;
}
/* main */
int main() {
    cin >> N;
    vector<int> cnt(4, 0);
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        cnt[a]++;
    }
    // dp[c1][c2][c3]
    // =(1個の皿:c1枚,2個の皿:c2枚,3個の皿:c3枚あるとき,全て食べるまでの操作回数の期待値)
    // 遷移)
    // dp[c1][c2][c3]
    // = 1
    //  + dp[c1−1][c2][c3] * (1個の皿が選ばれる確率)
    //  + dp[c1+1][c2−1][c3] * (2個の皿が選ばれる確率)
    //  + dp[c1][c2+1][c3−1] * (3個の皿が選ばれる確率)
    //  + dp[c1][c2][c3] * (0個の皿が選ばれる確率)
    // ---- dp[c1][c2][c3]を移項 ----
    // dp[c1][c2][c3]
    // = 1 / (1−(0個の皿が選ばれる確率))
    //  + dp[c1−1][c2][c3] * (1個の皿が選ばれる確率) / (1−(0個の皿が選ばれる確率))
    //  + dp[c1+1][c2−1][c3] * (2個の皿が選ばれる確率) / (1−(0個の皿が選ばれる確率))
    //  + dp[c1][c2+1][c3−1] * (3個の皿が選ばれる確率) / (1−(0個の皿が選ばれる確率))
    flag[0][0][0] = true;
    double ans = f(cnt[1], cnt[2], cnt[3]);
    cout << fixed << setprecision(10) <<  ans << '\n';
}

Measured memory_bytes: 127120
N, M = map(int, input().split())
L, R = [], []
for i in range(M):
  tmp = list(map(int, input().split()))
  L.append(tmp[0])
  R.append(tmp[1])

lower = max(L)
upper = min(R)
if lower > upper:
  print(0)
else:
  print(upper-lower+1)
  

Measured memory_bytes: 16788
Red, Green, Blue = map(int, input().split())
K = int(input())

Flag = False
for i in range(0, K):
    if not (Green > Red):
        Green = Green * 2
    elif not (Blue > Green):
        Blue = Blue * 2
    if (Green > Red) and (Blue > Green):
        Flag = True
        break

if Flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 61808
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long
#define mod 1000000007

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int n; cin >> n;
        int wh= 26, dg= 1, lm= 26;
        while (n > lm) { wh*= 26; lm+= wh; dg++;}
        wh= 26, lm= 0;
        lp(i, (dg- 1)) { lm+= wh; wh*= 26;  }
        n-= lm;
        n--;
        string str="";
        for (int i= 0; i< dg; i++) {
                str+= char('a'+n% 26);
                n/= 26;
        }
        reverse(all(str));
        cout << str;
return 0;
}


Measured memory_bytes: 3608
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long m = sc.nextLong();
		long ans = 0;
		if (n > m) {
			n ^= m;
			m ^= n;
			n ^= m;
		}
		if (n > 2 && m > 2) {
			System.out.println((n - 2) * (m - 2));
		} else if (n == 2 && m >= 1) {
			System.out.println(0);
		} else if (n == 1 && m == 1) {
			System.out.println(1);
		} else if (n == 1 && m >= 2) {
			System.out.println(m - 2);
		} else {
			throw new AssertionError();
		}
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


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

int main(){
    int n;
    cin>>n;
    for(int k=0;k<n;k++){
        string order,msg;
        cin>>order>>msg;
        reverse(order.begin(),order.end());
        for(int i=0;i<order.size();i++){
            if(order[i]=='C'){
                string tmp=msg;
                for(int j=0;j<msg.size();j++)
                    tmp[j]=msg[(j+1)%msg.size()];
                    msg=tmp;
            }
            if(order[i]=='J'){
                string tmp=msg;
                for(int j=0;j<msg.size();j++)
                    tmp[j]=msg[(j-1+int(msg.size()))%msg.size()];
                msg=tmp;


            }
            if(order[i]=='E'){
                string tmp=msg;
                if(!(msg.size()%2))
                    for(int j=0;j<msg.size()/2;j++){
                        tmp[j]=msg[msg.size()/2+j];
                        tmp[msg.size()/2+j]=msg[j];
                    }
                else
                    for(int j=0;j<msg.size()/2;j++){
                        tmp[j]=msg[msg.size()/2+1+j];
                        tmp[msg.size()/2+1+j]=msg[j];

                    }
                msg=tmp;
            }
            if(order[i]=='A')
                reverse(msg.begin(),msg.end());
            if(order[i]=='M'){
                for(int j=0;j<msg.size();j++)
                    if('0'<=msg[j] && msg[j]<='9')
                        msg[j]=(msg[j]-'0'+1)%10+'0';

            }
            if(order[i]=='P'){
                for(int j=0;j<msg.size();j++)
                    if('0'<=msg[j] && msg[j]<='9')
                        msg[j]=(msg[j]+10-'0'-1)%10+'0';


            }
      }

        cout<<msg<<endl;
    }


    return 0;
}
                  
                                                   

Measured memory_bytes: 3072
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class Main {

	public static void main(String[] args) {
		Task task = new Task();
		task.solve();
	}

	public static class Task {
		static final long MOD = (long) 1e9 + 7;

		public void solve() {
			Scan sc = new Scan();
			int n = (int) sc.scanLong();
			int k = (int) sc.scanLong();
			if ((n == 1 && k == n) || (n > 1 && k == 0)) {
				System.out.println("POSSIBLE");
				return;
			}
			int gcd = 0;
			int mx = 0;
			for (int i = 0; i < n; ++i) {
				int curr = (int) sc.scanLong();
				if (curr == k) {
					System.out.println("POSSIBLE");
					return;
				}
				gcd = gcd(gcd, curr);
				mx = Math.max(curr, mx);
			}
			if (k > mx)
				System.out.println("IMPOSSIBLE");
			else {
				System.out.println(k % gcd == 0 ? "POSSIBLE" : "IMPOSSIBLE");
			}
		}

		private int gcd(int a, int b) {
			if (b == 0)
				return a;
			return gcd(b, a % b);
		}
	}

	public static class Scan {
		private byte[] buf = new byte[1024];
		private int index;
		private InputStream in;
		private int total;

		public Scan() {
			in = System.in;
		}

		public int scan() {
			if (total < 0)
				throw new InputMismatchException();
			if (index >= total) {
				index = 0;
				try {
					total = in.read(buf);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				if (total <= 0)
					return -1;
			}
			return buf[index++];
		}

		public long scanLong() {
			long integer = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n)) {
				if (n >= '0' && n <= '9') {
					integer *= 10;
					integer += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			return neg * integer;
		}

		public double scanDouble() throws IOException {
			double doub = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n) && n != '.') {
				if (n >= '0' && n <= '9') {
					doub *= 10;
					doub += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			if (n == '.') {
				n = scan();
				double temp = 1;
				while (!isWhiteSpace(n)) {
					if (n >= '0' && n <= '9') {
						temp /= 10;
						doub += (n - '0') * temp;
						n = scan();
					} else
						throw new InputMismatchException();
				}
			}
			return doub * neg;
		}

		public String scanString() {
			StringBuilder sb = new StringBuilder();
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			while (!isWhiteSpace(n)) {
				sb.append((char) n);
				n = scan();
			}
			return sb.toString();
		}

		public char scanChar() {
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			return (char) n;
		}

		private boolean isWhiteSpace(int n) {
			if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
				return true;
			return false;
		}
	}
}


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

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

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

    int count = 1;
    int current_max = h[0];
    for(int i=1; i<n; i++){
        if(h[i] >= current_max){
            count += 1;
            current_max = h[i];
        }
    }
    cout << count << endl;
    return 0;
}

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

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 201

#define ll long long
#define ld long double
#define vi vector<string>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define print(v) for (auto i: v) cerr << i << " ";

int main() {
    fast
    ll t;
    t=1;
    while(t--){
      ll k;
      string s;
      cin>>k>>s;
      ll n;
      n=s.length();
      if(n<=k)cout<<s<<endl;
      else{
        REP(i,0,k)cout<<s[i];
        cout<<"..."<<endl;
      }
    }
    return 0;
}


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

int getGroup(int x) {
	int a[] = {1, 3, 5, 7, 8, 10, 12};
	int b[] = {4, 6, 9, 11};
	
	for (int i = 0; i < 7; i++) if (x == a[i]) return 0;
	for (int i = 0; i < 4; i++) if (x == b[i]) return 1;
	
	return 2;
}

int main() {
	
	int x, y;
	scanf("%d %d", &x, &y);
	
	printf("%s", getGroup(x) == getGroup(y) ? "Yes" : "No");
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
using namespace std;
int main(void){
  double a, b, c, d, e, f;
  cout << fixed;
  cout << setprecision(3);
  
  while(cin >> a >> b >> c >> d >> e >> f) {
    double x = (b * f - c * e) / (b * d - a * e);
    double y = (d * c - a * f) / (b * d - a * e);
    
    x += 0;
    y += 0;
    cout << x << " " << y << endl;
  }
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	string s;
 
	cin >> s;
 
	int cnt = 0;
 
	for(int i=0;i<s.length();i++)
	{
		if(cnt==0 && s[i]=='C')
		{
			cnt++;
		}
		if(cnt==1 && s[i]=='F')
		{
			cnt++;
		}
	}
 
	if(cnt==2)
	{
		cout << "Yes" << '\n';
	}
	else
	{
		cout << "No" << '\n';
	}
	return 0;
}

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

typedef long long ll;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a,b,n;
	cin >> a >> b >> n;
	if( n < b )
	{
		cout << a*n/b - a*(n/b) << '\n';
	}else
	{
		ll z = (n - (b-1)) / b;
		ll x = z * b + b - 1;
		cout << a*x/b - a*(x/b) << '\n';
	}
	return 0;
}


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

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

	int cnt = 1;
	int ans = 0;

	while (cnt < b)
	{
		if (ans == 0)
		{
			cnt = a;
		}
		else
		{
			cnt = cnt - 1 + a;
		}
		ans++;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include <stdlib.h>
#include<algorithm>

using namespace std;

int main(){
	int ans;
	char sen[100];
	while( scanf("%s",&sen) != EOF ){
		ans=0;
		for(int i=0;sen[i]!='\0';i++){
			if(sen[i]=='I'){
				if(sen[i+1]=='V'||sen[i+1]=='X'){
					ans--;
				}
				else{
					ans++;
				}
			}
			if(sen[i]=='V'){
				ans+=5;
			}
			if(sen[i]=='X'){
				if(sen[i+1]=='L'||sen[i+1]=='C'){
					ans-=10;
				}
				else{
					ans+=10;
				}
			}
			if(sen[i]=='L'){
				ans+=50;
			}
			if(sen[i]=='C'){
				if(sen[i+1]=='D'||sen[i+1]=='M'){
					ans-=100;
				}
				else{
					ans+=100;
				}
			}
			if(sen[i]=='D'){
				ans+=500;
			}
			if(sen[i]=='M'){
				ans+=1000;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 2572
#include<bits/stdc++.h>
using namespace std;
#include <numeric> 
 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define int long long int
#define mod 1000000007
#define INT_BITS 16
#define test int t;cin>>t;while(t--)
#define INF 10000000
#define pi 3.141592
#define watch(x) cout<<(#x)<<"="<<(x)<<"\n" 
#define pb push_back
//#include "debug.cpp"
//__builtin_popcount
int n,m;
vector<int>g[200005];
bool visited[200005];
int c;


void dfs(int i)
{
    visited[i]=true;
    c++;
    for(auto x:g[i])
    {
        if(!visited[x])
            dfs(x);
    }
}

int32_t main()
{
    fast
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    
    
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int u,v;
        cin>>u>>v;
        u--;
        v--;

        g[u].pb(v);
        g[v].pb(u);
    }

    memset(visited,false,sizeof(visited));
    int mx=INT_MIN;
    for(int i=0;i<n;i++)
    {
        if(!visited[i])
        {
            c=0;
            dfs(i);
            mx=max(mx,c);
        }
    }
    cout<<mx<<endl;

}


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

struct node
{
    ll data;
    node *left, *right;
    node(ll data)
    {
        this->data = data;
        left = right = NULL;
    }
};
unordered_map<ll, list<ll>>ma;

ll h(node *head)
{
    if (head == NULL)
        return 0;
    else
    {
        ll lh = h(head->left);
        ll rh = h(head->right);
        return max(lh, rh) + 1;
    }
}
void spiral(node *root, ll level)
{
    if (root == NULL)
        return ;
    if (level & 1)
        ma[level].push_back(root->data);
    else
        ma[level].push_front(root->data);
    spiral(root->left, level + 1);
    spiral(root->right, level + 1);

}
// void inorder(node *head)
// {


// }

typedef long long ll;

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("output12.txt", "w", stdout);
#endif
    ll n;
    cin >> n;
    ll x, cnt = 0;
    for (ll i = 1; i <= n; i++)
    {cin >> x; if (x % 2 and i % 2)cnt++;}

    cout << cnt;

    return 0;
}


Measured memory_bytes: 3612
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;


public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] l = new int[n];
		int count = 0;
		for(int i = 0; i < n; i++) {
			l[i] = sc.nextInt();
		}
		Arrays.sort(l);
		for(int i = 0; i < n-1; i++) {
			int a = l[i];
			for(int j = i+1; j < n; j++) {
				int b = l[j];
				int c = a+b;
				int sum = Binary(l,c);
				count+=sum-j;
			}
		}
		System.out.println(count);
	}
	private static int Binary (int[] l,int c) {
		int left = 0;
		int right = l.length;
		while(right-left>1) {
			int mid = (right+left)/2;
			if(l[mid] < c) {
				left = mid;
			}
			else {
				right = mid;
			}
		}
		return left;
	}
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

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

#define sq(x)   (x)*(x)
#define PI      acos(-1.0)
#define all(x) x.begin(),x.end()
#define nl      '\n'

typedef long long int ll;
typedef unsigned long long int  llu;


int main()
{
	faster
	double a,b,c;
	cin>>a>>b>>c;
	double ans;
	ans=a/c;
	if(ans<=b)cout<<"Yes"<<nl;
	else cout<<"No"<<nl;
	return 0;

}


Measured memory_bytes: 3712
# -*- coding: utf-8 -*-

a, b = map(int, input().split())

isPossible = False

if a%3 == 0:
    isPossible = True
if b%3 == 0:
    isPossible = True
if (a+b)%3 == 0:
    isPossible = True

if isPossible:
    print("Possible")
else:
    print("Impossible")

Measured memory_bytes: 2940
def main():
    s = input()
    n = len(s)

    for i in range(n):
        for j in range(n - i + 1):
            if s[:i] + s[i + j:] == "keyence":
                print("YES")
                exit()
    else:
        print("NO")


if __name__ == "__main__":
    main()


Measured memory_bytes: 63392
n = int(input())
a = list(map(int,input().split()))
"""
マイナスの数偶数→いける
マイナスの数奇数→１こあまる
"""
b = [abs(a[i]) for i in range(n)]


"""
マイナスの個数は
"""
tmp = 0
for i in a:
	if i < 0:
		tmp += 1

if tmp % 2 == 0:
	print(sum(b))
else:
	sumb = sum(b)
	ans = 0
	for i in range(n):
		ans = max(sumb-2*b[i], ans)
	print(ans)

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

	public static void main(String[] args) {
		StringBuilder sb=new StringBuilder("");
		
		Scanner n=new Scanner(System.in);
		
		int a=n.nextInt();
		int b=n.nextInt();
		
		while (a!=0 || b!=0){
			for (int c=0;c<a;c++){
				for (int d=0;d<b;d++){
					sb.append("#");
				}
				sb.append("\n");
				
			}
			System.out.println(sb);
			a=n.nextInt();
			b=n.nextInt();
			sb=new StringBuilder("");
		}
	}
}

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

#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr)
#define FILE_IO freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define int long long
using namespace std;


signed main() {
    FAST_IO;
    //FILE_IO;

    int n;
    cin >> n;
    int a[n];
    int sum = 0;
    map<int, int> cnt;
    for (int i = 0; i < n; i++) cin >> a[i], sum += a[i], cnt[a[i]]++;
    int q;
    cin >> q;
    while (q--) {
        int b, c;
        cin >> b >> c;
        int x = cnt[b];
        cnt[b] = 0;
        cnt[c] += x;
        sum += (x * c) - (x * b);
        cout << sum << "\n";
    }
    return 0;
}


Measured memory_bytes: 10292
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;

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

            var max = long.MaxValue;

            for(long i = 1; i * i <= n; i++) {
                if(n % i == 0) {
                    max = Math.Min(Math.Max(i.ToString().Length, (n / i).ToString().Length), max);
                }
            }

            Console.WriteLine(max);
        }
    }
}


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

int gcd(int a, int b){
  if(a % b == 0){
    return b;
  }
  else return(gcd(b,a%b));
}

int main(void){
  int n,r; cin >> n >> r;
  if(n >= 10){
    cout << r << endl;
    return 0;
  }
  cout << r + 100 * (10 - n) << endl;
  return 0;
}


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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

#define MAX_V 105

#define MAX_N 100
#define MAX_M 100

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> ans(n, 0);

    REP(i, m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        ans[a]++, ans[b]++;
    }

    REP(i, n) {
        if(ans[i] % 2 != 0) {
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define fout(x) cout << fixed << setprecision(10) << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

auto print = [](auto &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
};

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VI a(n);
  rep(i, n) cin >> a[i];
  map<ll, ll> mp;
  rep(i, n) {
    mp[a[i]]++;
  }
  ll ans = 0;
  for(auto& v : mp) {
    if(v.second > 1) {
      ans += (ll)(v.second * (v.second - 1)) / 2;
    }
  }
  rep(i, n) {
    if(mp[a[i]] < 2) out(ans);
    else out(ans - mp[a[i]] * (mp[a[i]] - 1) / 2 + (mp[a[i]] - 1) * (mp[a[i]] - 2) / 2);
  }
  return 0;
}


Measured memory_bytes: 10368
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const int MOD = 1000000007;

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

    string c(n, ' ');
    for(int i=0; i<n; ++i)
        cin >> c[i];

    vector<vector<long long> > dp(n+1, vector<long long>(n+1, 0));
    dp[0][0] = 1;
    for(int i=0; i<n; ++i){
        if(c[i] == 'D'){
            for(int j=1; j<n; ++j){
                dp[i+1][j] += dp[i][j] * j;
                dp[i+1][j] %= MOD;
                dp[i+1][j-1] += dp[i][j] * j * j;
                dp[i+1][j-1] %= MOD;
            }
        }else if(c[i] == 'U'){
            for(int j=0; j<n; ++j){
                dp[i+1][j+1] += dp[i][j];
                dp[i+1][j+1] %= MOD;
                dp[i+1][j] += dp[i][j] * j;
                dp[i+1][j] %= MOD;
            }
        }else{
            for(int j=0; j<n; ++j)
                dp[i+1][j] = dp[i][j];
        }
    }

    cout << dp[n][0] << endl;

    return 0;
}

Measured memory_bytes: 1348
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#define debug(x) cout << #x " => " << (x) << endl
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n;
  cin >> n;
  vector<int> a(n);
  rep (i, n) cin >> a[i];
  if (count(all(a), 1) == 0) {
    cout << -1 << endl;
    return 0;
  }
  int num = 1, cnt = 0;
  rep (i, n) {
    if (a[i] == num) {
      ++num;
      ++cnt;
    }
  }
  cout << n - cnt << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int cal(int a, long double b, int c, int money, int year){
	int i;
	
	if(a==1){
		for(i=0;i<year;i++){
			money=(double)money*(1.0+b)-c;
		}
	}else{
		int risi=0;
		
		for(i=0;i<year;i++){
			risi+=money*b;
			money=money-c;
		}
		money+=risi;
	}
	
	return (int)money;
}
	

int main(void) {
	int i, n, j;
	
	scanf("%d", &n);
	
	for(i=0;i<n;i++){
		int m, y, t, max=0, a[111], c[111], money[111];
		long double b[111];
		
		scanf("%d\n%d\n%d", &m, &y, &t);
		
		for(j=0;j<t;j++){
			scanf("%d %llf %d", &a[j], &b[j], &c[j]);
			
			money[j]=cal(a[j], b[j], c[j], m, y);
			
			if(max<money[j])
			max=money[j];
		}
		
		printf("%d\n", max);
		
		
	}
	return 0;
}

Measured memory_bytes: 636
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();

    let mut x_used = vec![false; n];
    let mut y_used = vec![false; n];

    let mut px = vec![(0, 0); n];
    let mut py = vec![(0, 0); n];

    for _ in 0..n {
        let x = sc.read::<usize>() - 1;
        let y = sc.read::<usize>() - 1;
        if x_used[x] || y_used[y] {
            println!("-1");
            return;
        }
        x_used[x] = true;
        y_used[y] = true;
        px[x] = (x, y);
        py[y] = (x, y);
    }

    let mut ans = 0;
    for i in 0..n {
        let p1 = px[i];
        let p2 = py[i];
        if p1 == p2 {
            assert_eq!(p1, (i, i));
            continue;
        }
        let (x1, y1) = p1;
        let (x2, y2) = p2;
        assert_eq!(x1, i);
        assert_eq!(y2, i);
        px[i] = (i, i);
        py[i] = (i, i);

        let next = (x2, y1);
        px[x2] = next;
        py[y1] = next;

        ans += 1;
    }

    println!("{}", ans);
}

/// ..x
/// x..
/// .x.

/// x..
/// ..x
/// .x.

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}



Measured memory_bytes: 9064
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define mem0(s) memset(s,0,sizeof(s))
#define meminf(s) memset(s,0x3f,sizeof(s))
#define mp_insert(a,b,c) mp.insert(map<pair<int,int>,int>::value_type(make_pair(a,b),c))
double pi=acos(-1);
typedef long long ll;
const double ex=1e-5;
typedef unsigned long long ull;
inline ll lowbit(ll x){return x&(-x);}
inline ll min(ll a,ll b){return a<b?a:b;}
inline ll max(ll a,ll b){return a>b?a:b;}
const int INF=0x3f3f3f3f,max_n=200005;
const int mod=1000000007;
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}

ll ans;
ll data1[200005];
ll max1;
int main()
{
	int n,x;cin>>n>>x;
	for(int i=1;i<=n;i++)
	{
		cin>>data1[i];
		data1[i]++;
	}
	for(int i=1;i<=x;i++)
	{
		ans+=(data1[i]);
	}
	max1=ans;
	for(int i=x+1;i<=n;i++)
	{
		ans+=(data1[i]);
		ans-=(data1[i-x]);
		max1=max(max1,ans);
	}
	if(max1%2==0)
	{
		cout<<max1/2;
	}
	else cout<<max1/2<<".5";
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> a(n),b(n),c(m),d(m);
  for(int i=0;i<n;++i){
    cin>>a[i]>>b[i];
  }
  for(int i=0;i<m;++i){
    cin>>c[i]>>d[i];
  }
  int val=0;
  for(int i=0;i<n;++i){
    int ans=1000000000;
    for(int j=0;j<m;++j){
      int dis=abs(a[i]-c[j])+abs(b[i]-d[j]);
      if(ans>dis){
        val=j+1; 
        ans=dis;
      }
    }
    cout<<val<<endl;
  }
}

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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
    for (auto v : (V)) cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */
const long double PI = (acos(-1));

int main(){
    /* code */ 
    int r; cin >> r;
    cout << 2.0 * PI * (double)r << endl;
    return 0;
}

Measured memory_bytes: 3788
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

vector<pair<LL, LL>> prime_factorize(LL n) {
    vector<pair<LL, LL>> res;

    for (LL p = 2; p * p <= n; p++) {
        if (n % p != 0) continue;

        int num_p = 0;
        while (n % p == 0) {
            num_p++;
            n /= p;
        }
        res.push_back(make_pair(p, num_p));
    }
    if (n != 1) res.push_back(make_pair(n, 1));

    return res;
}

int n;
map<LL, int> exponent;

LL rec(map<LL, int>::iterator p, LL mul) {
    if (p == exponent.end()) {
        if (mul == 1) return 1;
        else return 0;
    }

    LL res = 0;
    for (int i = 0; i < p->second + 1; i++) {
        if (mul % (i + 1) != 0) continue;

        res += rec(++p, mul / (i + 1));
        p--;
    }
    return res;
}
int main() {
    cin >> n;

    for (int i = 2; i <= n; i++) {
        auto ps = prime_factorize(i);
        for (auto it : ps) {
            exponent[it.first] += it.second;
        }
    }
    cout << rec(exponent.begin(), 75) << endl;

    return 0;
}


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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

ll bignum = 1000000000000;

int main(void){
    int N, M; ll L; cin >> N >> M >> L;
    ll wf[N+1][N+1];
    rep(i, N+1) rep(j, N+1) wf[i][j] = bignum;
    rep(i, M){
        int a, b; ll c; cin >> a >> b >> c;
        wf[a][b] = c; wf[b][a] = c;
    }
    rep(i, N+1) wf[i][i] = 0;
    for(int k = 1; k <= N; k++){
        for(int i = 1; i <= N; i++){
            for(int j = 1; j <= N; j++){
                wf[i][j] = min(wf[i][j], wf[i][k] + wf[k][j]);
            }
        }
    }

    vector<int> near[N+1];
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= N; j++){
            if(wf[i][j] <= L && i != j) near[i].push_back(j);
        }
    }
    int wf2[N+1][N+1];
    rep(i, N+1) rep(j, N+1) wf2[i][j] = mod;
    rep(i, N+1) wf2[i][i] = 0;
    for(int i = 1; i <= N; i++){
        rep(j, near[i].size()){
            int to = near[i][j];
            wf2[i][to] = 1;
        }
    }

    for(int k = 1; k <= N; k++){
        for(int i = 1; i <= N; i++){
            for(int j = 1; j <= N; j++){
                wf2[i][j] = min(wf2[i][j], wf2[i][k] + wf2[k][j]);
            }
        }
    }
/*
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= N; j++){
            cout << wf[i][j] << " ";
        }
        cout << endl;
    }

    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= N; j++){
            cout << wf2[i][j] << " ";
        }
        cout << endl;
    }
*/
    int Q; cin >> Q;
    rep(i, Q){
        int s, t; cin >> s >> t;
        if(wf2[s][t] == mod) cout << -1 << endl;
        else cout << wf2[s][t]-1 << endl;
    }

    return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> dp(3, 0);
	vector<int> new_dp(3, 0);
	for(int i = 0; i < n; i++){
		int a, b, c;
		cin >> a >> b >> c;
		new_dp[0] = max(dp[1] + a, dp[2] + a);
		new_dp[1]	=	max(dp[0] + b, dp[2] + b);
		new_dp[2] = max(dp[0] + c, dp[1] + c);
		dp = new_dp;	
	}
	cout << max(max(dp[0], dp[1]), dp[2]) << endl;
	return 0;
}

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

using namespace std;

int S(int n)
{
    int sum = 0;
    while (n != 0)
    { 
        sum += n % 10;
        n /= 10;
    }
    
    return sum;
}

int main()
{
    int N;
    
    cin >> N;
    
    if (N % S(N) == 0)
    {
        cout << "Yes" << endl;
    }
    else 
    {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
int main(){
    string s, t;
    cin >> s >> t;

    vector<vector<ll>> data(26);
    rep(i, s.size())data[s[i]-'a'].push_back(i);

    if(data[t[0]-'a'].empty()){
        cout << -1;
        return 0;
    }
    ll back = data[t[0]-'a'][0];
    ll ans = back;
    for(int i = 1; i < t.size(); ++i){
        int pos = t[i]-'a';
        if(data[pos].empty()){
            cout << -1;
            return 0;
        }
        auto f = upper_bound(ALL(data[pos]), back);
        if(f == data[pos].end()){
            ans += s.size()-back + data[pos][0];
            back = data[pos][0];
            // cout << s.size() << "-" << back << "+" << data[pos][0] << endl;
        }
        else {
            ans += data[pos][f-data[pos].begin()] - back;
            back  = data[pos][f-data[pos].begin()];
            // cout << data[pos][f-data[pos].begin()]<< "-" << back << endl;
        }
    }
    ans++;
    cout << ans << endl;

}

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

public class Main implements Runnable{
	public static void main (String[] args) {new Thread(null, new Main(), "_cf", 1 << 28).start();}

	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		char[] str = fs.next().toCharArray();
		int n = str.length;
		for(int i = 0; i < n-1; i++) {
			if(str[i] == str[i+1]) {
				System.out.printf("%d %d\n", i+1, i+2);
				return;
			}
			if(i+2 < n && str[i] == str[i+2]) {
				System.out.printf("%d %d\n", i+1, i+3);
				return;
			}
		}
		out.println("-1 -1");
		out.close();
	}

	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}                
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
		
		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for(int i = 0; i < n; i++) res[i] = nextInt();
			return res;
		}
		
	}

}

Measured memory_bytes: 25684
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n;
	vector<pi> ans;
	vi v(n); rep(i, n) cin >> v[i];
	int mx = -inf, mxi;
	rep(i, n) if(mx < abs(v[i])) mx = abs(v[i]), mxi = i;
	
	rep(i, n) if(i != mxi){
		ans.emplace_back(mxi, i);
		v[i] += v[mxi];
	}
	if(v[mxi] >= 0){
		rep(i, n - 1) ans.emplace_back(i, i + 1);
	}
	else{
		for(int i = n - 1; i > 0; i--) ans.emplace_back(i, i - 1);
	}
	cout << ans.size() << endl;
	for(pi i : ans) cout << i.first + 1 << " " << i.second + 1 << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}


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

    string S ;
    ll K ;
    ll limit = 5e15;
    cin >> S ;
    cin >>  K;
    
    rep(i, S.size()){
        ll n = S[i] - '0';
        if(n == 1) K--;
        else K = 0;
        
        if(K == 0) {cout << n << endl; break;}
    }
    
    
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<double> dvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int cnt=0;
    rep(i,n-2){
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') cnt++;
        
    }
    cout<<cnt;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;

int main(){
    int N; cin >> N;
    vector<pair<string,int> > S(N);
    vector<int> P(N);
    for(int i=0;i<N;i++){
        cin >> S[i].first >> P[i];
        S[i].second = i;
    }
    sort(S.begin(),S.end());
    int cnt=0;
    vector<pair<int,int> > p;
    for(int i=0;i<N;i++){
        //cerr << S[i].first << " " << S[cnt].first << endl;
        if(S[i].first.compare(S[cnt].first)==0){
            //cerr << P[S[i].second] << " " << S[i].second <<" "<< S[i].first << endl;
            p.push_back(make_pair(P[S[i].second],S[i].second));
        }else{
            cerr << "\n\n\n";
            cnt=i;
            i--;
            sort(p.begin(),p.end());
            for(int j=p.size()-1;j>=0;j--){
                //cerr << S[p[j].second].first << " " << P[p[j].second] << endl;
                cout << p[j].second+1 << endl;
            }
            p.clear();
        }
        if(i==N-1){
            sort(p.begin(),p.end());
            for(int j=p.size()-1;j>=0;j--){
                //cerr << S[p[j].second].first << " " << P[p[j].second] << endl;
                cout << p[j].second+1 << endl;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
  ll X;
  cin >> X;
  ll P = X / 100;
  ll Q = X % 100;
  if(P >= (Q + 4) / 5) {
    cout << 1 << endl;
  }
  else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 3584
#include <stdio.h>

int main(void) {
	char a[10];
	scanf("%s", a);
	if(a[0]!=a[1] && a[1]!=a[2] && a[0]!=a[2]){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>
using namespace std;

string toString(int n) {
    stringstream ss;
    ss << n;
    return ss.str();
}

int main() {
    int n;
    while (cin >> n, n) {
        string ans = "";
        for (long long a=1; n; a*=-10) {
            int c = 0;
            while (n % abs(a * 10) != 0) {
                n -= a;
                c ++;
            }
            ans = toString(c) + ans;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1224
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.La;
		if(s[0]<=s[2]){
			s[2]-=s[0];
			s[0]=0;
		}
		else{
			s[0]-=s[2];
			s[2]=0;
		}
		if(s[2]>0){
			if(s[1]<=s[2]){
				s[2]-=s[1];
				s[1]=0;
			}
			else{
				s[1]-=s[2];
				s[2]=0;
			}
		}
		Console.WriteLine("{0} {1}",s[0],s[1]);
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <utility>
#include <map>
#include <climits>
#include <vector>
#include <set>
#include <string>
#include <numeric>

#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define int long long
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<pair<int, int>> vii;
const int N = 2 * (1e5 + 1);
const int INF = 1e9 + 5;
const long long MOD = 1e9 + 7;

int32_t main() {
    FAST_IO;
    int k, s;
    cin >> k >> s;
    int c = 0;
    for (int i = 0; i <= k; i++) {
        for (int j = 0; j <= k; j++) {
            //for (int x = 0; x <= k; x++) {
            int z = s - i - j;
            if (z >= 0 && z <= k) c++;
            //}
        }
    }
    cout << c;
    return 0;
}


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


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

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

	cout << (a * 3 + p) / 2 << endl;
}



Measured memory_bytes: 256