akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N,K;
int A[1010];

signed main(){
	cin>>N>>K;
	REP(i,N){
		cin>>A[i];
	}
	sort(A,A+N);
	int ans=0;
	REP(i,K){
		ans+=A[i];
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
  vector<int> num;
  num = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  cout << num[K-1] << endl;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>t(n),a(n);
  for(i=0;i<n;i++)cin>>t[i]>>a[i];
  l=1;r=1;
  buf1=2*INF;
  for(i=0;i<n;i++){
    ll p=0,q=1e18;
    p=0;q=1e18;
    //cout<<p spa q<<endl;
    while(abs(p-q)>=2){
      buf=(p+q)/2;    
       if((buf1/t[i]<=buf||t[i]*buf>=l)&&
       (buf1/a[i]<=buf||a[i]*buf>=r))q=buf;
       else p=buf;
       //cout<<p spa q<<endl;
    }
    l=q*t[i];
    r=q*a[i];
    //cout<<l spa r spa i<<endl;
  }
  cout<<r+l<<endl;
  return 0;
}

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

int main() {
    ll a,b;
    std::cin >> a>>b;
    string s;
    std::cin >> s;
    for (int i = 0; i < a+b+1; i++) {
        if(i<a){
            if( s[i] == '-' ){
                std::cout << "No" << std::endl;
                return 0;
            }
        }else if(i == a){
            if( s[i] != '-' ){
                std::cout << "No" << std::endl;
                return 0;
            }
        }else{
            if( s[i] == '-' ){
                std::cout << "No" << std::endl;
                return 0;
            }
        }
    }
    std::cout << "Yes" << std::endl;
}


Measured memory_bytes: 256
r1,c1,r2,c2=map(int, raw_input().split())

N=r2+c2+1
mod=10**9+7
fact, inv_fact = [1], [1]
fact_tmp = 1
for i in range(1, N+1):
    fact_tmp *= i
    fact_tmp %= mod
    fact.append(fact_tmp)
    inv_fact.append(pow(fact_tmp, mod-2, mod))
 
def ncr(n,r):
	if n < 0 or r < 0 or n < r:	return 0
	else:	return (fact[n] * inv_fact[r] * inv_fact[n-r]) %mod

ans=0
for r in range(r1,r2+1):
    ans+=ncr(r+c2+1,r+1)-ncr(r+c1,r+1)
    ans%=mod

print ans


Measured memory_bytes: 132144
#include <iostream>
#include <string.h>
#include <math.h>
#define ll long long
using namespace std;


void printA(int *A,int size)
{
    for(int i=0;i<size;i++)
        cout<<A[i]<<" ";
}
void scanA(int *A,int size)
{
    for(int i=0;i<size;i++)
        cin>>A[i];
}


int absolute(int a,int b);

int main()
{
        int n;
      	cin>>n;
  
      	if(n%10==3)
          printf("bon");
      	else if(n%10==1 || n%10==6 || n%10==8 || n%10==0)
          printf("pon");
     	else
          printf("hon");



}






Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll r, g, b, n;
  cin >> r >> g >> b >> n;
  ll count = 0;
  for (ll i = 0; r * i <= n; i++){
    for (ll j = 0; r * i + g * j <= n;j++){
      if((n-r*i-g*j)%b==0){
        count++;
      }
    }
  }
  print(count);
}

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

int main(){
  int N;
  
  cin >> N;
  
  if(N/1000==N%1000/100&&N%1000/100==N%1000%100/10){
    cout << "Yes" << endl;
  }
  
  else if(N%1000/100==N%1000%100/10&&N%1000%100/10==N%1000%100%10){
    cout << "Yes" << endl;
  }
    
    else{
    cout << "No" <<endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int INF=0x3f3f3f3f;
const int maxn = 105;
int main()
{
   ll x,y;
   scanf("%lld%lld",&x,&y);
   ll ans = 0;
   while(x <= y)
   {
       x *= 2;
       ans++;
   }
   printf("%lld",ans);
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;


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

    int dp[45];
    dp[0] = 1;
    dp[1] = 1;

    for (int i = 2; i <= N; ++i){
        dp[i] = dp[i - 1] + dp[i - 2];
    }

    cout << dp[N] << endl;

    return 0;
}


Measured memory_bytes: 3084
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

ll fac(ll x){
    ll tmp = 1;
    for(ll i = 1; i <= x; i++){
        tmp *= i;
        tmp %= INF;
    }
    return tmp;
}

ll power(ll m, ll n){
    if(n == 0) return 1;
    if(n % 2 == 1) return m * power(m, n-1) % INF;
    ll tmp = power(m, n/2);
    return tmp * tmp % INF;
}

int main(){
    ll X, Y;
    cin >> X >> Y;
    ll a = 2 * X - Y, b = 2 * Y - X;
    if(a % 3 != 0 || b % 3 != 0 || a < 0 || b < 0){
        cout << 0 << endl;
        return 0;
    }

    a /= 3;
    b /= 3;

    ll ans = fac(a + b);
    ans *= power(fac(a), INF - 2);
    ans %= INF;
    ans *= power(fac(b), INF - 2);
    ans %= INF;

    cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 100000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
/*---------------------------------------------------*/

int main(){
  int n,k;
  int ans=1;
  cin>>n>>k;
  
  rep(i,n){
    ans=min(ans*2,ans+k);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
n, k = gets.split.map(&:to_i)
a = [*1..n]
calc = 0
calc1 = 1/n.to_f
b = a.select {|i| i < k + 1}
length = a.length - b.length
b.each do |i|
  calc2 = 0
  coin = 0
  ans = i
  while k > ans
    ans = ans*2
    coin += 1
  end
  calc2 = (1/2.to_f)**coin
  calc += calc1*calc2
end
puts calc + (calc1*length)

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

int main(){
	string s;
	cin>>s;

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

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

	bool can = true;
	for(int i=0;i<s.size();){
		bool can2 = false;
		for(int j=0;j<4;++j){
			string d = divide[j];
			if(s.substr(i,d.size()) == d){
				can2 = true;
				i += d.size();
			}
		}
		if(!can2){
			can = false;
			break;
		}
	}

	if(can) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {

	private void doit(){
		Scanner sc = new Scanner(System.in);
		long mod = 1000000007;
		while(sc.hasNext()){
			StringBuilder [] data = new StringBuilder[3];
			
			for(int i = 0; i < 3; i++){
				data[i] = new StringBuilder(sc.next());
			}
			
			int [] inds = new int[3];
			int ind = 0;
			
			while(true){
				if(data[ind].length() == inds[ind]){
					System.out.println((char)('A' + ind));
					break;
				}
				
				char c = data[ind].charAt(inds[ind]);
				inds[ind]++;
				if(c == 'a'){
					ind = 0;
				}
				else if(c == 'b'){
					ind = 1;
				}
				else{
					ind = 2;
				}
			}
			
			
		}

	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

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

}


Measured memory_bytes: 9940
def main():
    n = int(input())
    rows = []
    for i in range(n):
        rows.append([int(x) for x in input().split()])
    for row in rows:
        u,k = row[0],row[1]
        ul = [0]*n
        for j in range(k):
            ul[row[j+2]-1] = 1
        print(' '.join([str(u) for u in ul]))

if __name__ == '__main__':
    main()



Measured memory_bytes: 5620
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define double long double
using namespace std;
signed main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	if (abs(c - a) <= d)puts("Yes");
	else if (abs(b - a) <= d && abs(b - c) <= d)puts("Yes");
	else puts("No");
	getchar(); getchar(); return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <algorithm>

using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<n; i++)


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


    repr(i, 0, N + 1) {
        repr(j, 0, N - i + 1) {
            if (((i * 10000) + (j * 5000) + ((N - i - j) * 1000)) == Y){
            cout << i  << ' '<< j << ' ' << (N - i - j) << endl;
            return 0;
}
        }
    }

    cout << "-1 -1 -1" << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
  int n, k;
  std::cin >> n >> k;
  std::vector<int> p(n);
  for (int i = 0; i < n; i++)
  {
    std::cin >> p[i];
    p[i]++;
  }
  unsigned long long c = 0;
  for (int i = 0; i < k; i++)
  {
    c += p[i];
  }
  
  auto m = c;
  for (int i = k; i < n; i++)
  {
    c = c - p[i-k] + p[i];
    m = std::max(m, c);
  }
  std::cout << (m/2) << "." << ((m%2)?5:0);
  
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

int n, m;
vector<i64> a, s;
int main() {
    cin >> n >> m;
    read_n(a, n);
    s.resize(n + 1);
    map<i64, i64> cnts;
    for (int i = 0; i <= n; ++i) {
        if (i > 0) {
            (s[i] += s[i - 1] + a[i - 1]) %= m;
        }
        cnts[s[i]]++;
    }

    i64 ans = 0;
    for (auto p : cnts) {
        i64 x = p.second;
        ans += x * (x - 1 ) / 2;
    }

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

Measured memory_bytes: 5760
#include <iostream>

using namespace std;

template <typename T>
T cin2var()
{
    T val;
    cin >> val;
    return val;
}

int main()
{
    const int A(cin2var<int>());
    const int B(cin2var<int>());
    const int C(cin2var<int>());
    int coin = 0;
    int day = 1;
    for (; coin < C; ++day) {
        coin += A;
        if (day % 7 == 0) {
            coin += B;
        }
    }
    --day;
    cout << day << endl;
    return 0;
}


Measured memory_bytes: 3112
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

ll dp[110][8];

int main(){
    int H,W,K; cin >> H >> W >> K;
    K--;
    dp[0][0] = 1;
    rep(i,H)rep(j,W){
        rep(k,1<<(W-1)){
            bool ok = true;
            rep(l,W-2){
                if(k>>l&1 && k>>(l+1)&1) ok = false;
            }
            if(ok){
                if(j+1 < W && k>>j&1){
                    dp[i+1][j] += dp[i][j+1];
                    dp[i+1][j] %= MOD;
                }
                else if(j >= 1 && k>>(j-1)&1){
                    dp[i+1][j] += dp[i][j-1];
                    dp[i+1][j] %= MOD;
                }
                else{
                    dp[i+1][j] += dp[i][j];
                    dp[i+1][j] %= MOD;
                }
            }
        }
    }
    cout << dp[H][K] << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  ll res = n % 1000;
  cout << (1000 - res) % 1000 << endl;
}

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

int N;
deque<int> A;

int main(){
	int direct = 1;
	scanf("%d", &N);
	for(int i = 0; i < N; i++){
		int var;
		scanf("%d", &var);
		if(direct)
			A.push_front(var), direct = 0;
		else
			A.push_back(var), direct = 1;
	}
	if(!direct){
		printf("%d", A[0]);
		for(int i = 1; i < A.size(); i++) printf(" %d", A[i]);
		printf("\n");
	}else{
		printf("%d", A[A.size() - 1]);
		for(int i = A.size() - 2; i >= 0; i--) printf(" %d", A[i]);
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2944
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>

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

using namespace std;
typedef long long ll;

int n,m,p;
int H[10][10];
int F[10][10][10];

int dx[13] = { 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1};
int dy[13] = { 0, 1, 0, 1,-1, 0, 0, 1, 1, 1, 1,-1,-1};
int dz[13] = { 0, 0, 1, 0, 0, 1,-1, 1,-1, 1,-1, 1,-1};

bool can(int x,int y,int z) {
    if(0 <= x && x < n && 0 <= y && y < n && 0 <= z && z < n) return true;
    return false;
}

int main() {
    while(cin >> n >> m >> p) {
        if(n == 0 && m == 0 && p == 0) break;
        
        memset(H,0,sizeof(H));
        memset(F,0,sizeof(F));

        bool flag = false;

        rep(q,p) {
            int x,y;
            cin >> x >> y;
            x--;
            y--;

            F[y][x][H[y][x]] = q%2 + 1;
            H[y][x]++;

            rep(i,n) {
                rep(j,n) {
                    rep(k,n) {
                        rep(l,13) {
                            int y = i;
                            int x = j;
                            int z = k;
                            int len = 0;

                            while(can(x,y,z) && F[y][x][z] == q%2 + 1) {
                                y += dy[l];
                                x += dx[l];
                                z += dz[l];
                                len++;
                            }
                            

                            if(len >= m && !flag) {
                                flag = true;
                                if(q%2 == 0) cout << "Black ";
                                else cout << "White ";
                                cout << q+1 << endl;
                            }
                        }
                    }
                }
            }
        }

        if(!flag) cout << "Draw" << endl;







    }

    return 0;
}

Measured memory_bytes: 1168
import sys

import math
import itertools
import random
H, W, K = map(int, input().split())
li = [[''] * W for i in range(H)]
for h in range(H):
    tmp=input()
    for w in range(W):
        li[h][w] = tmp[w]
tmpli = [0]*H
for h in range(H):
    tmpli[h] = h
tmpli2 = [0] * W
for w in range(W):
    tmpli2[w] = w
    ans = 0
for h in range(0,H+1):
    combi_H=list(itertools.combinations(tmpli, h))
    for w in range(0,W+1):
        combi_W = list(itertools.combinations(tmpli2, w))
        for x in combi_H:
            for y in combi_W:
                tx = list(x)
                ty = list(y)
                cnt=0
                for a in range(H):
                    if (a not in tx):
                        continue
                    for b in range(W):
                        if (b not in ty):
                            continue
                        if (li[a][b] == '#'):
                            cnt += 1
                if (cnt == K):
                    ans += 1
print(ans)
                        



Measured memory_bytes: 9572
import math

N=int(input())
X=[]
Y=[]
for i in range(N):
	x,y=map(int,input().split())
	X.append(x)
	Y.append(y)
L=[]
for i in range(N-1):
	for j in range(i,N):
		l=math.sqrt(((X[i]-X[j])**2)+((Y[i]-Y[j])**2))
		L.append(l)
ans=sum(L)*(2/N)
print(ans)

Measured memory_bytes: 3192
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	fsc := NewFastScanner()
	N := fsc.NextInt()
	X, Y := fsc.NextInt64(), fsc.NextInt64()
	for i := 1; i < N; i++ {
		T, A := fsc.NextInt64(), fsc.NextInt64()
		x := T
		y := A
		res1 := int64(X / x)
		if X%x != 0 {
			res1++
		}
		res2 := int64(Y / y)
		if Y%y != 0 {
			res2++
		}
		if res1 < res2 {
			res1 = res2
		}
		X = x * res1
		Y = y * res1
	}
	fmt.Println(X + Y)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 2028)
	return &FastScanner{r: rdr}
}

func (s *FastScanner) Next() string {
	s.Pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}

func (s *FastScanner) NextInt() int {
	val, err := strconv.Atoi(s.Next())
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) NextInt64() int64 {
	val, err := strconv.ParseInt(s.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}

func (s *FastScanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, err := s.r.ReadLine()
		if err != nil {
			panic(err.Error())
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define MOD 1000000007
#define INF 1000000007
#define PI 3.14159265358979323846
using namespace std;
//
int N,A,sum;
bool check;
int main(){
  cin>>N;
  FOR(i,0,N){
    cin>>A;
    sum+=A;
  }
  if(N==2){
    if(sum==2){
      cout<<2<<endl;
    }else{
      cout<<0<<endl;
    }
    return 0;
  }
  int M=N/2;
  int MM=2*M*M;
  if(N%2!=0){
    MM+=2*M;
  }
  if(MM!=sum){
    check=true;
  }
  if(check){
    cout<<0<<endl;
  }else{
    long long X=1;
    FOR(i,0,N/2){
      (X*=2)%=INF;
    }
    cout<<X<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int A[100][100], B[100][100], n, m, l, i, j, k;
	long long C[100][100] = {0};

	scanf("%d %d %d", &n, &m, &l);
	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			scanf("%d", &A[i][j]);
		}
	}
	for (i = 0; i < m; i++) {
		for (j = 0; j < l; j++) {
			scanf("%d", &B[i][j]);
		}
	}

	for (i = 0; i < n; i++) {
		for (j = 0; j < l; j++) {
			for (k = 0; k < m; k++) {
				C[i][j] += (A[i][k] * B[k][j]);
			}
			printf(j != 0 ? " %lld" : "%lld", C[i][j]);
		}
		printf("\n");
	}

	return 0;
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
#define Set(a,b) memset(a,b,sizeof(a))
template<class T>inline void init(T&x){
	x=0;char ch=getchar();bool t=0;
	for(;ch>'9'||ch<'0';ch=getchar()) if(ch=='-') t=1;
	for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+(ch-48);
	if(t) x=-x;return;
}typedef long long ll;
const int N=2e5+10;
int dp[N][2];
char S[N];
int s[N];
int main()
{
	int n;init(n);
	scanf("%s",S+1);
	for(int i=1;i<=n;++i) s[i]=(S[i]=='.');
	dp[1][s[1]^1]=1;
	for(int i=2;i<=n;++i) {
		if(s[i]==0) {
			dp[i][0]=min(dp[i-1][0],dp[i-1][1]);
			dp[i][1]=dp[i-1][1]+1;
		}else{
			dp[i][0]=min(dp[i-1][0],dp[i-1][1])+1;
			dp[i][1]=dp[i-1][1];
		}
	}
	cout<<min(dp[n][0],dp[n][1])<<endl;
	return 0;
}


Measured memory_bytes: 2816
from collections import defaultdict
Hash1=defaultdict(lambda:0)
Hash2=defaultdict(lambda:0)
Hash3=defaultdict(lambda:0)
Hash4=defaultdict(lambda:0)
N=int(input())
arr=list(map(int,input().split()))
arr.insert(0,-1)
count=0
for i in range(1,N+1):
    count+=Hash4[i-arr[i]]
    Hash1[arr[i]-i]+=1
    Hash2[-arr[i]-i]+=1
    Hash3[i-arr[i]]+=1
    Hash4[i+arr[i]]+=1
# for i in Hash1.keys():
#     count+=Hash2[i]
# for j in Hash4.keys():
#     count+=Hash3[j]
print(count) 


Measured memory_bytes: 173892
N=int(input())
cnt={"M":0, "A":0, "R":0, "C":0, "H":0}
for _ in range(N):
    s=input()
    if s[0]=="M":
        cnt["M"]+=1
    elif s[0]=="A":
        cnt["A"]+=1
    elif s[0]=="R":
        cnt["R"]+=1
    elif s[0]=="C":
        cnt["C"]+=1
    elif s[0]=="H":
        cnt["H"]+=1

from itertools import combinations
comb=combinations(["M", "A", "R", "C", "H"], 3)

ans=0
for c in comb:
    ans+=cnt[c[0]]*cnt[c[1]]*cnt[c[2]]

print(ans)

Measured memory_bytes: 9244
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Scanner;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int h, m, s;
		s = S;
		h = s / 3600;
		s -= 3600 * h;
		m = s / 60;
		s -= 60 * m;
		System.out.println(h + ":" + m + ":" + s);
		
	}
}

Measured memory_bytes: 26268
#include <stdio.h>
#include <math.h>

int main()
{
  double deg_C, rad_C;
  double input_a, input_b;
  double S, L, h, edge_c;

  scanf("%lf %lf %lf", &input_a, &input_b, &deg_C);

  rad_C = deg_C * M_PI / 180;

  S = (input_a * input_b * sin(rad_C)) / 2;
  L = input_a + input_b + sqrt(input_a * input_a + input_b * input_b - 2 * input_a * input_b * cos(rad_C));
  h = (2 * S) / input_a;

  printf("%lf\n", S);
  printf("%lf\n", L);
  printf("%lf\n", h);

  return 0;
}



Measured memory_bytes: 2040
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner s = new Scanner(System.in);

		int[] nums = new int[5];

		int index = 0;

		for(index = 0 ; index < 5 ; index++) {

			nums[index] = s.nextInt();
		}

		for(index = 0 ; index < 5 ; index++) {

			if(nums[index] == 0) {
				System.out.println(index+1);
				break;
			}
		}

	}

}


Measured memory_bytes: 35752
#include <iostream>
#include <set>
using namespace std;
int n,a[52];
long long go(int x,long long s)
{
	if(x==n)return s;
	long long c=0;
	long long s1=0;
	for(int i=x;i<n;i++)
	{
		c=c*10+a[i];
		s1+=go(i+1,s+c);
	}
	return s1;
}
int main()
{
	char c=getchar();
	while(c<=32)
	{
		c=getchar();
	}
	while(c>32)
	{
		a[n++]=c-'0';
		c=getchar();
	}
	cout<<go(0,0)<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define DEBUG 0
#define nl          '\n'
#if     DEBUG
#define trace(var)  {cerr << "Line " << __LINE__ << ": " << #var << "=" << var << nl;}
#else
#define trace(var)	{}
#endif
#define fori(n)			for(int i = 0; i < n; ++i) 
#define forj(n)			for(int j = 0; j < n; ++j)
#define fork(n)			for(int k = 0; k < n; ++k)
#define forl(n)			for(int l = 0; l < n; ++l)

typedef long long ll;typedef pair<int,int> pii;typedef vector<bool> vbool;typedef vector<int> vint;typedef vector<ll> vll;typedef long double ld;typedef vector<vector<int>> vvi; typedef unordered_set<int> useti;


const ll N = 22;
const ll INF = 0x3f3f3f3f;
const ll MOD = 1e9 + 7;

int n, a[N][N]; //a[m][w]

//M, W
int mem[2097160][N];

int solve(int m, int w) {
	if (mem[m][w] != -1) return mem[m][w];

	if (w == 0) {
		int cur = __builtin_ctz((1 << n)-1 - m);
		return mem[m][w] = a[cur][w];
	}

	ll res = 0;
	for(int i = 0; i < n; ++i) {
		if (((1 << i) & m)  == 0 && a[i][w]) {
			res += solve((1 << i) | m, w-1);
			res %= MOD;
		}
	}
	return mem[m][w] = res;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	fori(n)
		forj(n) 
			cin >> a[i][j];

	fori(2097160) 
		forj(N)
			mem[i][j] = -1;

	cout << solve(0,n-1) << nl;

	#if DEBUG
	cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << " s" << nl;
	#endif
	return 0;
}


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

#define F first
#define S second
#define PB push_back
#define PP pop_back
#define sz(x) (int)(x.size())

using namespace std;

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

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

	int n, m, a;
	cin >> n >> m;
	int sum = 0;
	for (int i = 0; i < m; i++) cin >> a, sum += a;
	if (sum > n) return cout << -1 << endl, 0;
	cout << n - sum << endl;
	return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner scanner = new Scanner(System.in);

        while (true) {
            int n = scanner.nextInt();
            int x = scanner.nextInt();
            int cnt = 0;
            if (n == 0 && x == 0)
                break;

            for (int i = 1; i <= n - 2; i++)
                for (int j = i + 1; j <= n - 1; j++)
                    for (int k = j + 1; k <= n; k++)
                        if (i + j + k == x)
                            cnt++;
            System.out.println(cnt);
        }
    }
}


Measured memory_bytes: 26728
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return float64(i)
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

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

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

func main() {
	sc.Split(bufio.ScanWords)

	s := readString()
	t := readString()

	for i := 0; i < len(s); i++ {
		if s[i] != t[i] {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 1756
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		List<Integer> inputList = new ArrayList<>();
        for(int i = 0; i < 3; i++) {
        	inputList.add(sc.nextInt());
        }
        sc.close();
        Collections.sort(inputList);

		if (inputList.get(0) != 5) {
			System.out.println("NO");
			return;
		}

		if (inputList.get(1) != 5) {
			System.out.println("NO");
			return;
		}

		if (inputList.get(2) != 7) {
			System.out.println("NO");
			return;
		}


		System.out.println("YES");

	}
}

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

int n;
string s;

int main(){

	cin >> n;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		s[i] += ( s[i] + n < 91?n:n-26);
		cout <<  s[i];
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;


int main(){
    ll h, w, k;
    cin >> h >> w >> k;
    vector<string> c(h);
    REP(i, h){
        cin >> c.at(i);
    }

    ll ans = 0;
    REP(s, 1 << h){
        REP(t, 1 << w){
            ll count = 0;
            REP(i, h){
                REP(j, w){
                    if(((s >> i) & 1) || ((t >> j) & 1)){
                        continue;
                    }
                    count += (c.at(i).at(j) == '#');
                }
            }
            ans += (count == k);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3608
# include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin >> s;
	for(int i = 0; i < s.size(); i += 2)
		if(s[i] == 'L' || (i + 1 < s.size() && s[i + 1] == 'R')) return cout << "No" , 0;
	cout << "Yes";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};

int main()
{
    int n, m;
    cin >> n >> m;
    if(n == m) cout << "Yes" << endl;
    else cout << "No" << endl; 
}


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

int main() {
  int n, count = 0;
  string s;
  cin >> n >> s;
  for (char c : s) {
    if (c == '(') {
      count++;
    } else {
      count = max(count - 1, 0);
    }
  }
  s.insert(s.end(), count, ')');
  count = 0;
  for (int i = s.size() - 1; i >= 0; i--) {
    if (s[i] == ')') {
      count++;
    } else {
      count = max(count - 1, 0);
    }
  }
  s.insert(s.begin(), count, '(');
  cout << s;
  return 0;
}

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

int main() {
  int D, G;
  cin >> D >> G;
  vector<int> p(D), c(D);
  rep(i, D) {
    cin >> p.at(i) >> c.at(i);
  }
  vector<int> cp(D);
  rep(i, D) {
    cp.at(i) = 100 * (i + 1) * p.at(i) + c.at(i);
  }
  int ans = 1000;
  for (int tmp = 0; tmp < (1 << D); tmp++) {
    int w = 0, sum = 0;
    bitset<10> bs(tmp);
    rep(i, D) {
      if (bs.test(i)) {
        sum += cp.at(i); w += p.at(i);
      }
    }
    int sec = 10;
    rep(j, D) {
      if (!bs.test(D - j - 1)) {
        sec = D - j - 1; break;
      }
    }
    if (sec < 10 && sum < G && (G - sum) <= (sec + 1) * 100 * (p.at(sec) - 1)) {
      int rem = (G - sum + 100 * (sec + 1) - 1) / (100 * (sec + 1));
      w += rem;
    }
    else if (sum < G) {
      w = 1000;
    }
    ans = min(ans, w);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n, m;
    cin >> n >> m;
    vi first;
    vi second;
    int u, v;
    REP(i, m) {
        cin >> u >> v;
        if (u == 1) first.emplace_back(v);
        if (v == n) second.emplace_back(u);
    }
    SORT(second);
    for (auto f : first) {
        if (binary_search(ALL(second), f)) {
            cout << "POSSIBLE" << endl;
            return;
        }
    }
    cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 4292
/*
問題の名称:0-1 Knapsack Problem
問題のURL:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_B&lang=jp
所要時間:約1時間
学んだこと:動的計画法　要素数が多い配列の宣言の仕方(vectorを使う)
*/
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int N,W;
	cin >> N >> W;
	int v[100],w[100];
	for (int i = 0; i < N; ++i)
	{
		cin >> v[i] >> w[i];
	}

	vector<vector<int>> ans(100,vector<int>(10000)); //ans[i][j] i番目(iは0から)の品物までで、容量jの時の最適解
	//int ans[100][100];

	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j <= W; ++j)
		{
			if ((i == 0)&&(j < w[i]))
			{
				ans[i][j] = 0;
			}
			else if ((i == 0)&&(j >= w[i]))
			{
				ans[i][j] = v[i];
			}
			else if (j - w[i] < 0)
			{
				ans[i][j] = ans[i-1][j];			
			}
			else
			{
				ans[i][j] = max(v[i]+ans[i-1][j-w[i]],ans[i-1][j]);
			}
		}
	}

	cout << ans[N-1][W] << endl;
	return 0;
}


Measured memory_bytes: 6844
main = do
    [a, b, c, x, y] <- map read . words <$> getLine
    let ab = a * x + b * y
    let cx = 2 * x * c + (if x < y then b * (y - x) else 0)
    let cy = 2 * y * c + (if x > y then a * (x - y) else 0)
    print $ minimum [ab, cx, cy]


Measured memory_bytes: 508
using System;
using System.Collections.Generic;
using System.Text;

namespace AtCoder
{
  class Program
  {
    static void Main(string[] args)
    {
      string[] ss = Console.ReadLine().Split(' ');
      int N = int.Parse(ss[0]);
      int K = int.Parse(ss[1]);
      long p = K;
      for(int i = 1; i < N; i++)
      {
        p *= (K-1);
      }

      Console.WriteLine(p);
      Console.ReadLine();
    }

  }
}

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

int main() {
  int N;
  cin >> N;
  int x8 = N / 10000000 % 10;
  int x7 = N / 1000000 % 10;
  int x6 = N / 100000 % 10;
  int x5 = N / 10000 % 10;
  int x4 = N / 1000 % 10;
  int x3 = N / 100 % 10;
  int x2 = N / 10 % 10;
  int x1 = N % 10;
  int x = x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8;
  if (N % x == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(ll i = 0; i<n; i++)
#define rep_s(i, start, n) for(ll i= start;  i<n; i++)
#define rep_down(i, n) for(ll i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(ll i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()
#define print(ans) cout << ans << endl;
#define MOD 1000000007
string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll keta_num(ll num){
  ll total = 0;
  while(num){
    num /= 10;
    total++;
  }
}


ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

ll fibonacchi(ll num){
  ll f0 = 0, f1 = 1, f2;
  ll count = 0;
  while(count<num){
    f2 = f0+f1;
    f0 = f1;
    f1 = f2;
    count++;
  }
  return f2;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, E, F, G, K,L, W, H, P, Q, R, V, X, Y;
  string S, T;
  cin >> N >> R;
  if (N<10) cout << R+100*(10-N)<< endl;
  else cout <<R << endl;



}


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

using namespace std;
#define int long long
#define double long double
#define fst first
#define snd second
#define fr(s,n,i) for(int i=s;i<n;i++)
#define times(n) for(int i=0;i<n;i++)
#define fr_(s,n,i) for(int i=s;i>=n;i--)
#define srt(v) sort(v.begin(), v.end());
#define upr(v, aim, ind) int ind; ind=(int)distance(v.begin(), upper_bound(v.begin(),v.end(), aim))
#define sz(v) (int)v.size()
#define ers(v, i) v.erase(v.begin() + i)
#define last(v) v[sz(v) - 1]
#define swp(v, i, j) int buf = v[j]; v[j] = v[i]; v[i] = buf
#define shout(a) cout << a << endl
#define dshout(a) printf("%.16Lf\n", a)
#define pr pair<int, int>
#define vi vector<int>
#define vp vector<pair<int, int>>
#define vd vector<double>
#define vdd vector<vd>
#define mx(a, b) a = max(a, b)
#define mn(a, b) a = min(a, b)
#define mulM(a,b,c) a = a * b % c
#define squM(a,b) a = a * a % b
#define mpr(a,b) make_pair(a,b)
#define iinp(a) int a; cin >> a
#define sinp(a) string a; cin >> a
#define dinp(a) double a; cin >> a
#define ios() ios_base::sync_with_stdio(0);cin.tie(0)

int MOD = 1000000007;
int INF = ~(1LL << 63);

int powM(int base, int exp){
    int ret = 1;
    int buf = base;
    while(exp > 0){
        if(exp & 1){
            ret *= buf;
        }
        squM(buf, MOD);
        exp >>= 1;
    }
    return ret;
}
int combM(int a, int b){
    if(b == 0){
        return 1;
    }
    if(a-b < b){
        return combM(a, a-b);
    }
    int ans = 1;
    fr(1,b+1,i){
        ans *= a + 1 - i;
        ans /= i;
    }
    return ans;
}
void solve();
signed main() {
    ios();
    solve();
    return 0;
}





int standZero(int a, int needle){
    int div = ((a+1) / (needle * 2)) * needle;
    return div + max(((a+1) % (needle * 2) - needle), 0LL);
}
bool stand(int a, int b, int needle){
    if(a == 0){
        return standZero(b, needle) % 2 == 1;
    }
    int aa = standZero(a-1,needle);
    int bb = standZero(b,needle);
    return (bb - aa) % 2 == 1;
}
void solve(){
    int A,B;
    cin >> A >> B;
    int needle = 1LL << 50;
    int answer = 0;
    if(A==B){
        shout(A);
        return;
    }
    while(needle > 0){
        if(B >= needle){
            if(stand(A,B,needle)){
                answer += needle;
            }
        }
        needle >>= 1;
    }
    shout(answer);
}
















Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

char s[50];

int main() {

    scanf("%s", s);

    string a = s;

    if (a.size() < 26) {
        for (char ch = 'a'; ch <= 'z'; ch++) {
            if (count(a.begin(), a.end(), ch) == 0) {
                printf("%s%c\n", a.c_str(), ch);
                break;
            }
        }
    } else {
        for (int i = 25; i >= 0; i--) {
            string now = "";
            for (int j = 0; j < i; j++) {
                now += a[j];
            }
            for (char ch = 'a'; ch <= 'z'; ch++) {
                if (ch > a[i] && count(now.begin(), now.end(), ch) == 0) {
                    printf("%s%c\n", now.c_str(), ch);
                    exit(0);
                }
            }
        }
        puts("-1");
    }

    return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include <map>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#include"time.h"
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define dump(x)  cerr << #x << " = " << (x) << endl

//毎回変える場所
#define N_MAX 100000


//問題文のとおり
LL N,temp;
vector<LL>A;
int num=0;
LL ans=0;

int main() {
	cin>>N;
	REP(i,N){
		cin >> temp;
		A.push_back(temp);
	}
	sort(A.begin(),A.end());
	for (int i = A.size() - 2; i >= 0; i--) {
		if (A[i] == A[i + 1]) {
			if(num==0){
				ans = A[i];
				num++;
				i--;
			}
			else if (num == 1) {
				ans*=A[i];
				num++;
				break;
			}
		}
	}
	if(num!=2)cout<<0<<endl;
	else      cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 1400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            Solve();
        }
        private const long MOD = 1000000007;
        
        static void Solve()
        {

            var o = ReadAndParseIntArr();
            int sx = o[0];
            int sy = o[1];
            int tx = o[2];
            int ty = o[3];

            var sb = new StringBuilder();
            int dy = ty - sy;
            int dx = tx - sx;
            Loop(dy, 'U', sb);
            Loop(dx, 'R', sb);
            Loop(dy, 'D', sb);
            Loop(dx, 'L', sb);
            Loop(1, 'L', sb);
            Loop(dy + 1, 'U', sb);
            Loop(dx + 1, 'R', sb);
            Loop(1, 'D', sb);
            Loop(1, 'R', sb);
            Loop(dy + 1, 'D', sb);
            Loop(dx + 1, 'L', sb);
            Loop(1, 'U', sb);
            Console.WriteLine(sb.ToString());
        }
        private static void Loop(int n , char c, StringBuilder sb)
        {
            for (int i = 0; i < n; ++i)
            {
                sb.Append(c);
            }
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 11176