akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
using namespace std;

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

int n,k;
cin >> n >> k;
vector<int> h(n);
int i;
int ans=0;
for(i=0;i<n;i++){
    cin >> h[i];
    if(h[i]>=k) ans++;
}
cout << ans << endl;

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int i,j,k,count1=0,count2=0;
int gcd(int,int);
void ABC152();
void ABC153();
void ABC155();
void ABC156();
void ABC157();
void ABC158();
void ABC161();
void ABC162();
void ABC163();
void ABC164();

int main(){
    ABC152();
}

void ABC152(){
    int a,b,x,n,ans=0;
    cin>>n;
    //vector<int> p(n);
    for(i=0;i<n;i++){
        cin>>a;
        if(i==0){
            b=a;
            ans++;
        }
        if(i>=1){
            if(a<b){
                b=a;
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    token.parse().ok().unwrap()
}

fn main() {
    let x = input::<i64>();

    let ans = if x == 7 || x == 5 || x == 3 {
        "YES"
    } else {
        "NO"
    };
    println!("{}", ans);
}


Measured memory_bytes: 4352
num=list("0123456789")
a,b=map(int,input().split())
s=input()

for i in range(a+b+1):
    if i!=a:
        if s[i] not in num:
            print("No")
            break
    else:
        if s[i]!="-":
            print("No")
            break
else:
    print("Yes")

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<stack>
#include<queue>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	int n, m, x, y;
	cin >> n >> m >> x >> y;
	vector<int> a(n), b(m);
	rep(i, n) cin >> a[i];
	rep(i, m) cin >> b[i];
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	bool flag = true;
	int rx = -1000;
	int ly = 1000;
	rep(i, n) rx = max(rx, a[i]);
	rep(i, m) ly = min(ly, b[i]);
	rx = max(rx, x);
	ly = min(ly, y);
	if (rx < ly) cout << "No War" << endl;
	else cout << "War" << endl;
}

Measured memory_bytes: 256
// author: erray
#include<bits/stdc++.h>
 
using namespace std;
 
int main () {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  --n;
  vector<int> b(n);
  for (int i = 0; i < n; ++i) cin >> b[i];
  vector<int> a(n + 1, INT_MAX);
  for (int i = 0; i < n; ++i) {
    a[i] = min(a[i], b[i]);
    a[i + 1] = min(a[i + 1], b[i]);
  }
  cout << accumulate(a.begin(), a.end(), 0LL) << '\n';
}

Measured memory_bytes: 3660
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

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

#define MP make_pair
#define MT make_tuple
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

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

	string S;
	cin >> S;

	int ret = 0;
	char pre = 0;
	EACH(c,S){
		if(pre != c) ret++;
		pre = c;
	}

	cout << ret - 1 << endl;


	return 0;
}


Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
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; }

int main(){
	string s;cin>>s;
	ll n = s.size();
	ll cnt = 0;
	ll ans = 0;
	for(ll i = 0; i < n; i++) {
		if (s[i] == 'B')cnt++;
		else{
			ans += cnt;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>

void trace(int A[],int N){
    int i;
    for(i=0;i<N;i++){
        if(i>0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}

void insertionSort(int A[],int N){
    int j,i,v;
    for(i=1;i<N;i++){
        v=A[i];
        j=i-1;
        while(j>=0 && A[j]>v){
            A[j+1]=A[j];
            j--;
        }
        A[j+1]=v;
        trace(A,N);
    }
}

int main(){
    int N,i,j;
    int A[100];
    
    scanf("%d",&N);
    for(i=0;i<N;i++) scanf("%d",&A[i]);
    
    trace(A,N);
    insertionSort(A,N);
    
    return 0;
}


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

const int M = 200010; 

int64_t dp[M][16][2], dp_min[M][2];

int main(){
    int N;
    int64_t A[M];
    cin >> N;
    for(int i=0; i<N; i++) cin >> A[i];

    for(int i=0; i<N-1; i++) for(int k=0; k<2; k++) dp_min[i][k] = 1e18;

    for(int k=0; k<2; k++){
        for(int j=0; j<=15; j++) dp[N-1][j][k] = j;

        for(int i=N-2; i>=0; i--){
            for(int j=0; j<=15; j++){
                int64_t a = A[i] << (2*j);
                int j2 = 0;
                while(a > (A[i+1]<<(2*j2))) j2++;
                if(j2 <= 15){
                    dp[i][j][k] = dp[i+1][j2][k] + j;
                }else{
                    dp[i][j][k] = dp[i+1][15][k] + j + (N-1-i) * (j2-15);
                }
                dp_min[i][k] = min(dp_min[i][k], dp[i][j][k]);
            }
        }
        reverse(A, A+N);
    }

    int64_t ans = 1e18;
    for(int i=0; i<=N; i++){
        int64_t result = i + 2 * (dp_min[i][0] + dp_min[N-i][1]);
        ans = min(ans, result);
    }
    cout << ans << endl;
    return 0;
}


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


int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);
	
	int n;
	cin >> n;
	vector<vector<int>> robot(n, vector<int>(2));
	for (int i = 0; i < n; ++i)
		cin >> robot[i][0] >> robot[i][1];
	sort(robot.begin(), robot.end());
	
	int ans = 0, x = 0;
	for (int i = 1; i < n; ++i) {
		if (robot[x][0] + robot[x][1] > robot[i][0] - robot[i][1]) {
			if (robot[x][0] + robot[x][1] > robot[i][0] + robot[i][1]) x = i;
			ans++;
		}
		else x = i;
	}

	cout << n - ans << endl;

	return 0;
}


Measured memory_bytes: 5760
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int M = sc.nextInt();
    	int X = sc.nextInt();
    	int[] c = new int[N];
    	int[][] a = new int[N][M];
    	for(int i = 0; i < N; i++){
    		c[i] = sc.nextInt();
    		for(int j = 0; j < M; j++){
    			a[i][j] = sc.nextInt();
    		}
    	}
    	sc.close();
    	int ans = Integer.MAX_VALUE;
    	for(int mask = 0; mask < Math.pow(2, N); mask++){
    		int[] d = new int[M];
    		int tmp = 0;
    		for(int i = 0; i < N; i++){
    			if(((mask >> i) & 1) == 1){
    				tmp += c[i];
    				for(int j = 0; j < M; j++){
    					d[j] += a[i][j];
    				}
    			}
    		}
    		boolean ck = true;
    		for(int i = 0; i < M; i++){
    			if(d[i] < X) ck = false;
    		}
    		if(ck){
    			ans = Math.min(ans, tmp);
    		}
    	}
    	System.out.println(ans == Integer.MAX_VALUE?-1:ans);
    }
}

Measured memory_bytes: 37680
#include<stdio.h>
int main()
{
    int n,m,ans=-1;
    scanf("%d%d",&n,&m);
    for(int i=m/n;i>0&&ans==-1;i--){
        if(m%i==0&&ans==-1)ans=i;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
N, *B = map(int, open(0).read().split())
buildings = [[[0] * 10 for _ in range(3)] for _ in range(4)]
for i in range(0, len(B), 4):
    b = B[i]
    h = B[i+1]
    w = B[i+2]
    v = B[i+3]
    buildings[b-1][h-1][w-1] += v
for i, b in enumerate(buildings):
    for r in b:
        print(" " + " ".join(map(str, r)))
    if i != 3:
        print("####################")


Measured memory_bytes: 5628
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
#define mod 1000000007
ll gcd(ll a, ll b){
    if(a % b == 0) return b ;
    ll k = a % b ;
    return gcd(b, k) ;
}
int main(){
    int n ;
    cin >> n ;
    vector<int> a (n) ;
    vector<int> c (1000005) ;
    rep(i, n) {
        cin >> a[i] ;
        c[a[i]]++ ;
    }
    bool can = true ;
    for(int i = 2; i < 1000005 ; i++){
        int cnt = 0 ;
        for(int j = i; j < 1000005 ; j += i){
            cnt += c[j] ;
        }
        if(cnt > 1){
            can = false ;
        }
    }
    if(can){
        cout << "pairwise coprime" << endl ;
        return 0 ;
    }
    int g = 0 ;
    rep(i, n) g = gcd(g, a[i]) ;
    if(g == 1) {
        cout << "setwise coprime" << endl ;
        return 0 ;
    }
    cout << "not coprime" << endl ;
    return 0 ;
}

Measured memory_bytes: 11052
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=1e5+10;
int a[maxn],b[maxn],c[maxn],x[maxn],y[maxn];
int main(){
	int A,B,M;
	int res,ans;
	cin>>A>>B>>M;
	for(int i=0;i<A;i++)
		cin>>a[i];
	for(int i=0;i<B;i++)
		cin>>b[i];
	for(int i=0;i<M;i++)
		cin>>x[i]>>y[i]>>c[i];
	res=a[x[0]-1]+b[y[0]-1]-c[0];
	for(int i=1;i<M;i++){
		ans=a[x[i]-1]+b[y[i]-1]-c[i];
		res=min(res,ans);
	}
	sort(a,a+A);
	sort(b,b+B);
	res=min(res,a[0]+b[0]);
	cout<<res;
	return 0;
}

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

using namespace std;

int main(void){
  int ans = 0;
  string op;
  
  cin >> op;
  
  for(int i=0 ; i < 4 ; i++){
    if(op[i] == '+') ans++;
    else if(op[i] == '-') ans--;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
// D.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<vector>
#include<string>

using namespace std;


const long long waru = 1000000007;

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
long long kumi(int x, int y) {
    if (y == 1)return 1;
    long long kaix, kaiy, kaiwa,kai;
    kai = 1;
    kaiy = 1;
    for (int i = x + 1; i <= x + y - 1; i++) {
        kai *= i;
        kai %= waru;
    }
    for (int i = 1; i <= y - 1; i++) {
        kaiy *= i;
        kaiy %= waru;
    }
    return( kai *modinv ( kaiy,waru)) % waru;
    
}

int main()
{
    int s;

    long long ans = 0;

    cin >> s;

    s -= 3;
    int cnt = 1;
    while (s >= 0) {
        ans += kumi(s, cnt);
        ans %= waru;
        s -= 3;
        cnt++;
    }

    cout << ans << endl;
}




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

int main(){
	string s; cin >> s;
	int a,b,c;
	a=b=c=0;
	for(int i=0;i<s.length();i++){
		if(s[i]=='a') a++;
		if(s[i]=='b') b++;
		if(s[i]=='c') c++;
	}
	if(a==1 && b==1 && c==1) cout << "Yes" << endl;
	else cout << "No" << endl;	
}


Measured memory_bytes: 256
<?php
  $a = trim(fgets(STDIN));
  $b = trim(fgets(STDIN));
  $c = trim(fgets(STDIN));
  $d = trim(fgets(STDIN));
  $e = trim(fgets(STDIN));
  
  $order = [$a,$b,$c,$d,$e];
  $wait = [];
  for($i=0; $i<count($order); $i++){
    $wait[$i] = ceil($order[$i]/10)*10-$order[$i];
  }
  arsort($wait);
  $last = key($wait);
  asort($wait);
  $time = 0;
  foreach($wait as $w => $t){
    if($w != $last){
      $time += ceil($order[$w]/10)*10;
    }else{
      $time += $order[$w];
    }
  }
  echo $time."\n";
  

Measured memory_bytes: 4604
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> a(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=n-1;i>=0;i--){
if(i>0){
cout<<a[i]<<" ";
}

}
  cout<<a[0]<<endl;
}


Measured memory_bytes: 3088
#include<iostream>

using namespace std;

const long long MAXN = 1e4+10;
long long Ti[MAXN],Ai[MAXN];

int main()
{
    ios::sync_with_stdio(false);
    long long N;
    cin >> N;
    for(long long i = 0 ; i < N ; i++)
    {
        cin >> Ti[i] >> Ai[i];
    }
    long long A,B;
    A = 1,B=1;
    for(long long i = 0 ; i < N ; i++)
    {
        long long beiA = A/Ti[i];
        if(A%Ti[i] != 0){beiA++;};
        long long beiB = B/Ai[i];
        if(B%Ai[i] != 0){beiB++;};
        long long L = min(beiA,beiB);
        long long R = max(beiA,beiB);
        long long bei= L;
        while( L <= R)   //如果查找区间不为空就继续查找
        {
            long long mid = L+(R-L)/2; //取查找区间正中元素的下标
            //cout<<" L = "<<L<<" R = "<<R<<" mid = "<<mid<<endl;
            if(Ti[i]*mid>=A && Ai[i]*mid>=B) {//如果成立就再小一点
                bei = mid;
                R = mid - 1;
            }
            else{
                L = mid+1;
            }
        }
        A = bei*Ti[i];
        B = bei*Ai[i];
    }
    cout<<A+B<<endl;
    return 0;
}



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


int main() {
	int n;
	cin >> n;
	if(n%2==0)
		cout << n / 2 << endl;
	else
		cout << n / 2 +1<< endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long   gcd(long long a,long long b)
{
	if(b==0)return a;
	gcd(b,a%b);
}
int main()
{
	long long a,b;
	cin>>a>>b;
	 //cout<<a/gcd(a,b)*b<<endl;
	 for(int i = 1; i <= b; i++){
    if((a* i) % b == 0){
      cout << a * i << endl;
      break;
    }
  }
return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(void){
	while(1){
		int n;
		cin >> n;
		if(!n) break;
		if(n == 6174) cout << 0 << endl;
		else {
			int as[4], de[4];
			int c = 1, flg;
			while(1){
				for(int i = 0; i < 4; i++){
					int t = n % 10;
					as[i] = t; de[i] = t;
					n /= 10;
				}
				flg = 1;
				for(int i = 1; i < 4; i++){
					if(as[i] != as[i - 1]) flg = 0;
				}
				if(flg){
					cout << "NA" << endl;
					break;
				}
				sort(as, as + 4);
				sort(de, de + 4, greater<int>());
				int a = 0, d = 0;
				for(int i = 0; i < 4; i++){
					a *= 10; d *= 10;
					a += as[i]; d += de[i];
				}
				if(d - a == 6174) break;
				else n = d - a, c++;
			}
			if(flg != 1) cout << c << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3120
import math

n = input().split() 

N = int(n[0])
D = int(n[1])
mainList = [input() for i in range(N)]

C = 0
for xY in mainList:
    x = int((xY.split())[0])
    y = int((xY.split())[1])
    R = (x ** 2) + (y ** 2)
    r = math.sqrt(R)

    if D >= r:
        C += 1

print(C)

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

int main(void){
    int n;
    cin >> n;
    int a[n],b[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
	// for(int i=1;i<=n;i++){
    //     for(int j=0;j<n;j++){
    //         if(a[j]==i){
    //             b[i-1] = j+1;
    //         }
    //     }
    // }
    for(int i=0;i<n;i++){
        b[a[i]-1] = i+1;
    }
    
    for(int i=0;i<n;i++){
        cout << b[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 4312
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(abs(a-c) <= d){
    printf("Yes\n");
  }else{
    if(abs(a-b)<=d&&abs(b-c)<=d){
      printf("Yes\n");
    }else{
      printf("No\n");
    }
  }
  return 0;
}


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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector< ii >
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }

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

int32_t main(){
  DESYNC;
  int n;
  cin >> n;
  int ids[n];
  for(int i=0; i<n; i++) cin >> ids[i];
  int s[n+1];
  for(int i=1; i<=n; i++) cin >> s[i];
  int extra[n+2];
  for(int i=2; i<=n; i++) cin >> extra[i];
  
  int lst = -1;
  int ans = 0;
  for(int i=0; i<n; i++){
    int x = ids[i];
    ans += s[x];
    if(lst+1 == x) ans += extra[x];
    lst = x;
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

# nCr
def nCr(n,r):
  return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))

# 方針
# 大きい順から選ぶと平均は最大値を取れる
# 選んだ数字の最初と最後が違う場合、A個選んだ場合のみ平均が最大値になる
# よって最後の数の選び方が何通りあるかを求めればよい
# 最初と最後が同じ場合、選んだ数の種類は全て同じ
# よってその数を選ぶ方法は何通りあるかを求める

def main():
  n,a,b=LI()
  l=LI()

  l=sorted(l,key=lambda x:x,reverse=True)

  l2=l[:a]
  print(sum(l2)/len(l2))
  
  if l2[0]!=l2[-1]:
    c=l.count(l2[-1])
    c2=l2.count(l2[-1])
    print(nCr(c,c2))

  else:
    c=l.count(l2[-1])
    sm=0
    for i in range(a,min(b+1,c+1)):
      sm+=nCr(c,i)

    print(sm)

main()


Measured memory_bytes: 5408
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
lint h[100100];
int main()
{
	int n;lint a,b,c,lo=0,hi=1000000000;
	cin>>n>>a>>b;c=a-b;
	rep(i,n) cin>>h[i];
	while(hi>lo){
		lint mi=(hi+lo)/2,sum=0;
		rep(i,n){
			lint t=h[i]-b*mi;
			t=max(t,0LL);
			sum+=(t+c-1)/c;
		}
		if(sum<=mi) hi=mi;else lo=mi+1;
	}
	cout<<lo<<endl;
}


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
	is >> p.first >> p.second;
	return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
	os << p.first << " " << p.second;
	return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}
/*
typedef __int128_t Int;
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
std::ostream::sentry s(dest);
  if (s) {
	__uint128_t tmp = value < 0 ? -value : value;
	char buffer[128];
	char *d = std::end(buffer);
	do {
	  --d;
	  *d = "0123456789"[tmp % 10];
	  tmp /= 10;
	} while (tmp != 0);
	if (value < 0) {
	  --d;
	  *d = '-';
	}
	int len = std::end(buffer) - d;
	if (dest.rdbuf()->sputn(d, len) != len) {
	  dest.setstate(std::ios_base::badbit);
	}
  }
  return dest;
}

__int128 parse(string &s) {
  __int128 ret = 0;
  for (int i = 0; i < s.length(); i++)
	if ('0' <= s[i] && s[i] <= '9')
	  ret = 10 * ret + s[i] - '0';
  return ret;
}
*/

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template <class T> bool chmin(T &a, const T &b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	int A, B, C; cin >> A >> B >> C;
	vector<int>l(N); rep(i, 0, N) { cin >> l[i]; }
	int ans = INF;
	rep(i, 0, 1 << N) {
		rep(j, 0, 1 << N) {
			int a = 0, b = 0, c = 0;
			int p = 0, q = 0, r = 0;
			rep(k, 0, N) {
				int x = (i >> k) & 1;
				int y = (j >> k) & 1;
				if (x and y) {
					a += l[k];
					p++;
				}
				else if (x) {
					b += l[k];
					q++;
				}
				else if (y) {
					c += l[k];
					r++;
				}
			}
			if (a == 0 or b == 0 or c == 0)continue;
			if (chmin(ans, 10 * (p + q + r - 3) + abs(A - a) + abs(B - b) + abs(C - c))) {
				dump(a, b, c, p, q, r);
			}
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N];
int32_t main(){_

   int a, b;
   cin >> a >> b;

   if (b == 1){
      cout<<0;
      exit(0);
   }

   for (int i = 1; ; ++i)
   {
      int curr = a * i - (i-1);
      if (curr >= b){
         cout<<i;
         exit(0);
      }
   }
   

   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S; 
  char a, b, c, d; 
  a = S.at(0), b = S.at(1), c = S.at(2), d = S.at(3); 
  int N = -4; 
  if(a == '+') N += 2; 
  if(b == '+') N += 2; 
  if(c == '+') N += 2; 
  if(d == '+') N += 2; 
  cout << N << endl;
}

Measured memory_bytes: 256
H,N=map(int,input().split())

A=[]
B=[]

for i in range(N):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)

DP=[[1000000000]*(H+max(A)+1) for i in range(N+1)]


for i in range(N):
    DP[i+1][A[i]]=B[i]


for i in range(N):
    for h in range(H+max(A)+1):
        DP[i+1][h]=min(DP[i+1][h],DP[i][h])
        if h-A[i]>=0:
            DP[i+1][h]=min(DP[i+1][h-A[i]]+B[i],DP[i+1][h])

print(min(DP[N][H:]))

Measured memory_bytes: 127856
let N = Int(readLine()!)!
let S = readLine()!.characters.map{$0}
var a = (1..<N).reduce(0){$0+(S[$1]<"W" ?1:0)}
var ans = a
for i in 1..<N {
    a += (S[i-1]>"E" ?1:0)-(S[i]<"W" ?1:0)
    ans = min(a, ans)
}
print(ans)

Measured memory_bytes: 5848
#include<cstdio>
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

const int CMax = 100002;

int n, a, b, c, Q, K, x, y;
long long L[CMax];
vector< pair<int, long long> >V[CMax];

void go(int vr) {
    for (int i = 0; i < V[vr].size(); i++){
        if (V[vr][i].first != K && L[V[vr][i].first] == 0){
            L[V[vr][i].first] = L[vr] + V[vr][i].second;
            go(V[vr][i].first);
        } else if (L[V[vr][i].first] > L[vr] + V[vr][i].second) L[V[vr][i].first] = L[vr] + V[vr][i].second;
    }
}

int main(){
    scanf("%d", &n);
    for (int i = 0; i < n-1; i++){
        scanf("%d %d %d", &a, &b, &c);
        V[a].push_back(make_pair(b, (long long)c));
        V[b].push_back(make_pair(a, (long long)c));
    }

    scanf("%d %d", &Q, &K);

    go(K);

    for (int i = 0; i < Q; i++){
        scanf("%d %d", &x, &y);
        cout << L[x] + L[y] << endl;
    }
}


Measured memory_bytes: 14336
#2271
cnt1 = 0
cnt2 = 0
cnt3 = 0
cnt4 = 0
word = str(input())
w2 = len(word)
for i in range(w2):
    if ord('K') == ord(word[i]):
        cnt1 += 1
    if ord('U') == ord(word[i]):
        cnt2 += 1
    if ord('C') == ord(word[i]):
        cnt3 += 1
    if ord('P') == ord(word[i]):
        cnt4 += 1
if cnt1 > cnt2:
    cnt1 = cnt2
if cnt1 > cnt3:
    cnt1 = cnt3
if cnt1 > cnt4:
    cnt1 = cnt4
print(cnt1)


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

int main() {
    char c;
    cin >> c;

    if(c == 'A'){
        cout << 'T' << endl;
    }
    else if(c == 'T'){
        cout << 'A' << endl;
    }
    else if(c == 'C'){
        cout << 'G' << endl;
    }
    else if(c == 'G'){
        cout << 'C' << endl;
    }
}

Measured memory_bytes: 256
def solve_a(a, b):
    res = max(0, a - 2 * b)
    return res


def main():
    a, b = map(int, input().split())
    res = solve_a(a, b)
    print(res)


def test():
    assert solve_a(12, 4) == 4
    assert solve_a(20, 15) == 0
    assert solve_a(20, 30) == 0


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 2940
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int[][] sight = new int[4][2]; 
		while(scan.hasNext()){
			double left = scan.nextDouble();
			double right = scan.nextDouble();
			if(left >= 1.1){
				sight[0][0]++;
			}else if(left >= 0.6){
				sight[1][0]++;
			}else if(left >= 0.2){
				sight[2][0]++;
			}else{
				sight[3][0]++;
			}
			if(right >= 1.1){
				sight[0][1]++;
			}else if(right >= 0.6){
				sight[1][1]++;
			}else if(right >= 0.2){
				sight[2][1]++;
			}else{
				sight[3][1]++;
			}
		}
		for(int i = 0;i < 4;i++){
			System.out.println(sight[i][0] + " " + sight[i][1]);
		}
	}
}

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

#include <atcoder/all>
#define For(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); ++(i))
#define rFor(i, a, b) for (int(i) = (int)(a)-1; (i) >= (int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
using namespace atcoder;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T div_floor(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a >= 0 ? a / b : (a + 1) / b - 1;
}
template <class T>
T div_ceil(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a > 0 ? (a - 1) / b + 1 : a / b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

using mint = modint998244353;

struct monoid {
    lint inv;
    int zero, one;

    static monoid op(monoid lhs, monoid rhs) {
        return {lhs.inv + rhs.inv + (lint)lhs.one * rhs.zero,
                lhs.zero + rhs.zero, lhs.one + rhs.one};
    }

    static monoid e() { return {0, 0, 0}; }
};

struct op_monoid {
    int x;

    static monoid mapping(op_monoid lhs, monoid rhs) {
        if (lhs.x == 0) return rhs;
        return {(lint)rhs.zero * rhs.one - rhs.inv, rhs.one, rhs.zero};
    }

    static op_monoid composition(op_monoid lhs, op_monoid rhs) {
        return {lhs.x ^ rhs.x};
    }

    static op_monoid id() { return {0}; }
};

int main() {
    int n, q;
    scanf("%d%d", &n, &q);
    vector<monoid> a(n);
    rep(i, n) {
        int x;
        scanf("%d", &x);
        if (x == 0)
            a[i] = {0, 1, 0};
        else
            a[i] = {0, 0, 1};
    }
    lazy_segtree<monoid, monoid::op, monoid::e, op_monoid, op_monoid::mapping,
                 op_monoid::composition, op_monoid::id>
        st(a);
    rep(_, q) {
        int t, l, r;
        scanf("%d%d%d", &t, &l, &r);
        --l;
        --r;
        if (t == 1)
            st.apply(l, r + 1, {1});
        else
            printf("%lld\n", st.prod(l, r + 1).inv);
    }
}

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


while not(a[0] == a[1] == a[2]):
    a.sort()
    if a[2] - a[0] >= 2:
        a[0] += 2
        cnt += 1


    elif a[2] - a[0] >= 1 or a[2] - a[1] >= 1:
        a.sort()
        a[0] += 1
        a[1] += 1
        cnt += 1

print(cnt)


Measured memory_bytes: 3060
A = Array.new(3)
B = Array.new(3) {Array.new(3, 0)}

3.times do |i|
    A[i] = gets.chomp.split(" ")
end

N = gets.to_i

N.times do
    n = gets.chomp
    A.each_with_index do |a, i|
        a.each_with_index do |b, j| 
            if b == n
               B[i][j] = 1
            end
        end
    end
end

if B[0] == [1, 1, 1] || B[1] == [1, 1, 1] || B[2] == [1, 1, 1]
    puts "Yes"
elsif (B[0][0] == 1 && B[1][1] == 1 && B[2][2] == 1) || (B[0][2] == 1 && B[1][1] == 1 && B[2][0] == 1)
  puts "Yes"
else
    B = B.transpose
    if B[0] == [1, 1, 1] || B[1] == [1, 1, 1] ||B[2] == [1, 1, 1]
        puts "Yes"
    else
      puts "No"
    end
end

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
#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 itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;


vector<pair<llong,llong>> factoring(llong n){
    vector<pair<llong,llong>> ans;
    if( n== 1){
        ans.push_back( make_pair(1,1));
        return ans;
    }
    llong i=1;
    while(1){
        i+=1;
        if( i * i > n) break;
        pair<llong,llong> tmp;
        tmp.first=i;
        tmp.second=0;
        while(1){
            if(n%i != 0) break;
            n/=i;
            tmp.second+=1;
        }
        if(tmp.second!=0) ans.push_back(tmp);
    }
    if(n!=1) ans.push_back( make_pair(llong(n),llong(1)));
    return ans;

}


int main(){
    llong x,n;
    cin >> n >> x;
    vector<pair<llong,llong>> a;
    a = factoring(x);
    llong ans = 1;
    itrfor(itr,a){
        llong tmp = (*itr).second / n;
        REP(i,tmp) ans *= (*itr).first;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void check(int k1,int k2)
{
	k2=k2-k1*k1*k1*k1;
	if(k2%5!=0) return;
	k2=k2/5;
	if(k2==0)
	{
		cout<<k1<<" "<<0;
		exit(0);
	}
	for(int b=1;b*b<=abs(k2);b++)
	{
		
		if(k2%b==0)
		{
		//	cout<<k2<<" "<<b<<" "<<k1*k1*k1+2*k1*k1*b+2*k1*b*b+b*b*b<<" "<<k2/b<<endl;
			if(k1*k1*k1+2*k1*k1*b+2*k1*b*b+b*b*b==(k2/b))
			{
				cout<<b+k1<<" "<<b;
				exit(0);
			}
			b=-b;
		//	cout<<k2<<" "<<b<<" "<<k1*k1*k1+2*k1*k1*b+2*k1*b*b+b*b*b<<" "<<k2/b<<endl;
			if(k1*k1*k1+2*k1*k1*b+2*k1*b*b+b*b*b==(k2/b))
			{
				cout<<b+k1<<" "<<b;
				exit(0);
			}
			b=k2/b;
		//	cout<<k2<<" "<<b<<" "<<k1*k1*k1+2*k1*k1*b+2*k1*b*b+b*b*b<<" "<<k2/b<<endl;
			if(k1*k1*k1+2*k1*k1*b+2*k1*b*b+b*b*b==(k2/b))
			{
				cout<<b+k1<<" "<<b;
				exit(0);
			}
			b=-b;
		//	cout<<k2<<" "<<b<<" "<<k1*k1*k1+2*k1*k1*b+2*k1*b*b+b*b*b<<" "<<k2/b<<endl;
			if(k1*k1*k1+2*k1*k1*b+2*k1*b*b+b*b*b==(k2/b))
			{
				cout<<b+k1<<" "<<b;
				
				exit(0);
			}
			b=k2/b;
		//	cout<<k2<<" "<<b<<endl;
		}
	}
}
int main()
{
	int n;
	cin>>n;
	for(int i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			int k1=i,k2=n/i;
		//	cout<<k1<<" "<<k2<<endl;
			check(k1,k2);
		//	check(k2,k1);
		}
	}
	
}

Measured memory_bytes: 3596
//https://onlinejudge.u-aizu.ac.jp/problems/ALDS1_2_D
//p077.cpp

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

//間隔g を指定した挿入ソート
void insertionSort(int A[], int n, int g) {
	for (int i = g; i < n; i++) {
		int v = A[i];
		int j = i - g;
		while (j >= 0 && A[j] > v) {
			A[j + g] = A[j];
			j -= g;
			cnt++;
		}
		A[j + g] = v;
	}
}

void shellSort(int A[], int n) {
	// 数列G = {1,4,13,40,121,364,1093,...} を生成
	for (int h = 1; ; ) {
		if (h > n)break;
		G.push_back(h);
		h = 3 * h + 1;
	}

	for (int i = G.size() - 1; i >= 0; i--) {
	//逆順に G[i] = g を指定
		insertionSort(A, n, G[i]);
	}
}

int main() {
	cin >> n;
	//より速い入力scanf関数を使用
	for (int i = 0; i < n; i++)scanf("%d", &A[i]);
	cnt = 0;

	shellSort(A, n);

	cout << G.size() << endl;
	for (int i = G.size() - 1; i >= 0; i--) {
		printf("%d", G[i]);
		if (i)printf(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for (int i = 0; i < n; i++)printf("%d\n", A[i]);

	return 0;
}







Measured memory_bytes: 7164
N = int(input())
s = list()

for a in range(1, N+1):
    S, P = input().split()
    P = int(P)
    s.append([S, P, a])

s = sorted(s, key=lambda x: (x[0], -x[1]))  # 複数のキーでソートしたい時　昇順と降順を混ぜたい時はマイナスつける

for a in range(N):
    print(s[a][2])


Measured memory_bytes: 3060
L = list(map(int,input().split()))
L.sort()

if (L[-1]-L[0])%2 + (L[-1]-L[1])%2 == 2:
    print((L[-1]-L[0])//2 + (L[-1]-L[1])//2 + 1)
elif (L[-1]-L[0])%2 + (L[-1]-L[1])%2 == 1:
    print((L[-1]-L[0])//2 + (L[-1]-L[1])//2 + 2)
else:
    print((L[-1]-L[0])//2 + (L[-1]-L[1])//2)

Measured memory_bytes: 3064
//template
import java.util.*;
import java.util.stream.*;
import java.io.*;
public class Main{
	static BufferedReader in= new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter out= new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	
	private static final int HUNDRED = 100;
	public static void main(String[] args) throws IOException{
		
		StringTokenizer st=new StringTokenizer(in.readLine());
		int n=Integer.parseInt(st.nextToken());
		int d=Integer.parseInt(st.nextToken());
		int cont=0;
		double dist=0;
		for(int i=0;i<n;i++) {
			st=new StringTokenizer(in.readLine());
			double x=Double.parseDouble(st.nextToken());
			double aux=x;
			double y=Double.parseDouble(st.nextToken());
			x=Math.pow(x, 2);
			y=Math.pow(y, 2);
			//out.append(x+" "+y+"\n");
			double num=Math.sqrt(x+y);
			if(num<=d)
				cont++;
			//out.append(num+" \n");
		}
		out.append(cont+"\n");
		
		out.flush();
		in.close();
		out.close();
	}
	public static long ans(long a,long b,long x,long y,long n) {
		long diff=Math.min(n, a-x);
		n-=diff;
		a-=diff;
		b=Math.max(y, b-n);
		return a*b;
	}
	public static int mcm(long num1,long num2) {
		int mcm=1;
		int i=2;
		while(i <= num1 || i <= num2)
        {
            if(num1%i==0 || num2%i==0)
            {
            mcm=mcm*i;
            if(num1%i==0) num1=num1/i;
            if(num2%i==0) num2=num2/i;
            }
            else
                i=i+1;               
        }                       
		return mcm;
	}
	public static long MCD(long a, long b) {
	       if(b==0)
	           return a;
	       else
	           return MCD(b, a % b);
	}
	private static int modulo(int S, int N) { return ((S) & (N - 1)); } // returns S % N, where N is a power of 2
	private static int isPowerOfTwo(int S) { return (S & (S - 1)) == 0 ? 1 : 0; }
	private static int[] readInts() throws IOException {
		return Stream.of(in.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
	}
	private static int readInt() throws IOException {
		return Integer.parseInt(in.readLine());
	}
	private static long[] readLongs() throws IOException {
		return Stream.of(in.readLine().split(" ")).mapToLong(Long::parseLong).toArray();
	}
	private static long readLong() throws IOException {
		return Long.parseLong(in.readLine());
	}
	 
}


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

int main(){
	int a,b,c,x;
	float temp;
	cin>>a>>b;
	if(b==100)
		c=a*1000+b;
	else if(b/10==0)
		c=a*10+b;
	else
		c=a*100+b;
	temp = sqrt(c);
	x= temp+0.5f;
	if(x*x==c)
		cout<<"Yes";
	else
		cout<<"No"; 
	
}

Measured memory_bytes: 256
import itertools
N=int(input())
M=list(range(1,N+1))
P=[int(x) for x in input().split()]
Q=[int(x) for x in input().split()]
p=0
q=0
c=0
for Y in itertools.permutations(M):
  c +=1
  if list(Y)==P:
    p=c
  if list(Y)==Q:
    q=c
print(abs(p-q))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstring>
#define ll long long 
using namespace std;

ll dp[3050][3050];
int n;
ll a[3050];

ll solve(int i, int f){
  if(i == f)
    return a[i];
  
  if(dp[i][f] != -1)
    return dp[i][f];

  return dp[i][f] = max(a[i] - solve(i+1, f), a[f] - solve(i, f-1));
}

int main()
{
    cin >> n;
    memset(dp, -1, sizeof dp);

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

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

    return 0;
}

Measured memory_bytes: 76460
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

  if ( n >= 10) {
    cout << r << endl;
  } else {
    int ans = r + 100*(10-n);
    cout << ans << endl;
  }
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)
#define Pr(a) (#a)<<"="<<(a)<<" "
#define pr1(a) cerr<<Pr(a)<<endl
#define pr2(a,b) cerr<<Pr(a)<<Pr(b)<<endl
#define pr3(a,b,c) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<endl
#define pr4(a,b,c,d) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<endl
#define pr5(a,b,c,d,e) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<endl
#define pr6(a,b,c,d,e,f) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<Pr(f)<<endl
#define int long long
#define double long double
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}



vector<int> sim(int n,vector<int> Idx){
  vector<int> pos(n); iota(pos.begin(), pos.end(),0);
  
  auto minus=[&](int I){for(int i = I;i<n;i++) pos[i]--;};
  
  vector<int> ans;
  int len = n;
  for(int i=0;i<Idx[0];i++) ans.push_back(pos[i]), minus(i), len--;

  for(int i=0;i<(int)Idx.size()-1;i++){
    assert((Idx[i+1] - Idx[i])%2 == 0);
    int num = (Idx[i+1] - Idx[i])/2;
    int idx = (Idx[i+1] + Idx[i])/2;
    for(int i=0;i<num;i++) ans.push_back(pos[idx]), minus(idx), len -= 2;
    for(int i=0;i<num;i++) minus(idx);
  }
  
  for(int i=Idx.back()+1;i<n;i++) ans.push_back(len - 1), len--;
  return ans;  
}

int calc(vector<int> A,vector<int> ans){
  for(int a:ans){
    int n = A.size();
    if(a == 0) A.erase(A.begin());
    else if(a == n-1) A.erase(A.end()-1);
    else A[a] = A[a-1] + A[a+1], A.erase(A.begin() + a + 1), A.erase(A.begin() + a - 1);
  }
  return A[0];
}

signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  
  int n;
  cin>>n;
  vector<int> A(n);
  cin>>A;
  
  vector<int> dp(n+1);
  vector<int> pre(n+1,-1);
  for(int i=0;i<n;i++) dp[i] = A[i];
  

  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      if((j - i) % 2 == 1) continue; 
      int &a = dp[j];
      int b = dp[i] + A[j];
      if(a < b) pre[j] = i, a  = b;
    }
  }
  int idx = 0;
  for(int i=0;i<n;i++) if(dp[idx] < dp[i]) idx = i;
  
  int ans = dp[idx];
  
  vector<int> Idx;
  while(idx != -1) Idx.push_back(idx), idx = pre[idx];
  sort(Idx.begin(),Idx.end());
  vector<int> Ans = sim(n, Idx);

  cout<<ans<<endl;
  cout<<Ans.size()<<endl;
  for(int a:Ans) cout<<a+1<<endl;
  assert(ans == calc(A,Ans));
  return 0;
}


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

int main(){
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	sort(a.begin(),a.end());
	cout << a[n-1] - a[0] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a, b, c, k, ans=0;
  scanf("%d %d %d %d", &a, &b, &c, &k);
  if(k>a){
    ans=a;
    k=k-a;
    if(k>b){
      k=k-b;
      ans-=k;
      printf("%d\n", ans);
    }
    else printf("%d\n", ans);
  }
  else printf("%d\n", k);
}

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

int main(){
    int a, b, i;
    char op;
    for(i = 0; ;i++){
        scanf("%d %c %d", &a, &op, &b);
        if(op == '?') break;
        else if(op == '+') printf("%d\n", a + b);
        else if(op == '-') printf("%d\n", a - b);
        else if(op == '*') printf("%d\n", a * b);
        else printf("%d\n", a / b);
    }
}


Measured memory_bytes: 3216
use v5.26; # strict say state biwise
use warnings;
use List::Util qw(reduce any all none notall first max maxstr min minstr product sum sum0 pairs unpairs pairkeys pairvalues pairfirst pairgrep pairmap shuffle uniq uniqnum uniqstr);

chomp (my $k = <STDIN>);
my @memo;
sub gcd {
  my ($x, $y) = @_;
  return $memo[$x][$y] if $memo[$x][$y] > 0;
  my ($u, $v) = ($x, $y);
  while ($y) {
    my $r = $x % $y;
    $x = $y;
    $y = $r;
  }
  $memo[$u][$v] = $x;
}
for my $i (1..200) {
  for my $j (1..200) {
    gcd($i, $j);
  }
}
my $ans = 0;
for my $i (1..$k) {
  for my $j (1..$k) {
    my $c = $memo[$i][$j];
    for my $l (1..$k) {
      $ans += $memo[$c][$l];
    }
  }
}
say $ans;

Measured memory_bytes: 6760
from decimal import *

def main():
    a, b, c = map(int, input().split())

    ad = Decimal(a).sqrt()
    bd = Decimal(b).sqrt()
    cd = Decimal(c).sqrt()

    if ad + bd < cd:
        is_big = True
    else:
        is_big = False

    print('Yes' if is_big else 'No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 59600
#include <stdio.h>

int main(void)
{
	char a;
	int b,i,n,s[13]={0},h[13]={0},c[13]={0},d[13]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%c%d",&a,&b);
		if(a=='\n')scanf("%c%d",&a,&b);
		if(a=='S')s[b-1]++;
		else if(a=='H')h[b-1]++;
		else if(a=='C')c[b-1]++;
		else d[b-1]++;
	}
	for(i=0;i<13;i++)if(s[i]==0)printf("S %d\n",i+1);
	for(i=0;i<13;i++)if(h[i]==0)printf("H %d\n",i+1);
	for(i=0;i<13;i++)if(c[i]==0)printf("C %d\n",i+1);
	for(i=0;i<13;i++)if(d[i]==0)printf("D %d\n",i+1);
	return 0;
}


Measured memory_bytes: 2040
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
//int a[101];
//int j;
int main()
{
    long long a,b;
    int k;
    cin>>a>>b>>k;
    if(k>(b-a)/2)
    for(int i=a;i<=b;i++)cout<<i<<endl;
    else{
    for(long long i=a;i<=a+k-1;i++)
        cout<<i<<endl;
    if(b-k+1==a+k-1)
    for(long long i=b-k+2;i<=b;i++)
        cout<<i<<endl;
    else for(long long i=b-k+1;i<=b;i++)
        cout<<i<<endl;}
system("pause");
return 0;
}

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

int N;
vector<int> X(101);

void solve(){
    int ans = INT_MAX;
    for(int P = 1; P <= 100; ++P){
        int sum = 0;
        for(int i = 1; i <= N; ++i){
            sum += (X[i] - P) * (X[i] - P);
        }
        ans = min(ans, sum);
    }
    cout << ans;
}
int main(){
    cin >> N;
    for(int i = 1; i <= N; ++i){
        cin >> X[i];
    }
    solve();
    return 0;
}

Measured memory_bytes: 256
/*ITP1_10_D:Distance II*/
#include <iostream>
#include <cmath>
using namespace std;
 
int main()
{
    int n, x[100], y[100];
    cin >> n;

    for(int i=0; i<n; i++) cin >> x[i];
    for(int i=0; i<n; i++) cin >> y[i];
    
    for(int p=1; p<=3; p++)
    {   
        double sum = 0;
        for(int i=0; i<n; i++)
            sum += pow( fabs(x[i]-y[i]), p );
        double Dxy = pow(sum,1.0/p);
        cout << fixed << Dxy << endl;
        //printf("%lf\n", Dxy);
    }    
    
    double max = -1.0;   
    for(int i=0; i<n; i++)
        if( max < fabs(x[i]-y[i]) ) max = fabs(x[i]-y[i]);
    cout << fixed << max << endl;
    
    return 0;
}



Measured memory_bytes: 3428
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#define rep(i,n) for (int i = 0; i < n; ++i)
const int INF = 1001001001;

using namespace std;

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

    if (s.size() <= k) {
        cout << s << endl;
    } else {
        rep(i,k) {
            cout << s[i];
        }
        cout << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    N,M=map(int, input().split())
    H=list(map(int,input().split()))
    edge = [[] for i in range(N)]
    for i in range(M):
        x, y = map(int, input().split())
        x, y = x - 1, y - 1
        edge[x].append(y)
        edge[y].append(x)
    cnt=0
    for i in range(N):
        val=H[i]
        if edge[i]==[]:
            cnt+=1
        else:
            if all(val>H[j] for j in edge[i]):
                    cnt+=1
    print(cnt)
resolve()

Measured memory_bytes: 89892
N = int(input())
L = list(map(int, input().split()))

ans = 0
for i in range(len(L)):
    for j in range(len(L)):
        for k in range(len(L)):
            if i < j < k:
                if L[i] == L[j] or L[i] == L[k] or L[j] == L[k]:
                    continue
                if L[i] + L[j] + L [k] <= max(L[i], L[j], L[k]) * 2:
                    continue
                ans += 1
print(ans)



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

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

  string s;
  cin >> s;

  if(n % 2 != 0) {
   cout << "No";
   return 0;
 }

  string s1 = s;
  string s2 = s;

  if(s1.substr(0,n/2) == s2.substr(n/2))  cout << "Yes";
  else cout << "No";
}


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

int main(){
  int a[5],k,brk=0;cin >>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>k;
  for(int i=0;i<5;i++){
    for(int j=0;j<5-i;j++){
      if ((a[i]-a[j])*(a[i]-a[j]) > k*k){
        brk=1;
        break;
      }
    }
  }
  if(brk==1){
    cout <<":("<<endl;
  }else{
    cout <<"Yay!"<<endl;
  }
}


Measured memory_bytes: 256
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if b<a :
    temp=a
    a=b
    b=temp
if c<b :
    temp=b
    b=c
    c=temp
if b<a :
    temp=a
    a=b
    b=temp
print(a,b,c)


Measured memory_bytes: 5592