akhauriyash/Code-Regression huggingface dataset:
# coding: utf-8
h,w=map(int,input().split())
field=[]
d=[]
for i in range(h):
    field.append(list(map(int,input().split())))
    d.append(field[-1][:])
count=0
for i in range(h):
    for j in range(w):
        if field[i][j]%2==1:
            count+=1

ans=[]

for i in range(h):
    if i%2==0:
        for j in range(w):
            if field[i][j]%2==1 and count>1:
                if j!=w-1:
                    ans.append([i,j,i,j+1])
                    field[i][j+1]+=1
                    if field[i][j+1]%2==0:
                        count-=2
                else:
                    ans.append([i,j,i+1,j])
                    field[i+1][j]+=1
                    if field[i+1][j]%2==0:
                        count-=2
    else:
        for j in range(w):
            j=w-1-j
            if field[i][j]%2==1 and count>1:
                if j!=0:
                    ans.append([i,j,i,j-1])
                    field[i][j-1]+=1
                    if field[i][j-1]%2==0:
                        count-=2
                else:
                    ans.append([i,j,i+1,j])
                    field[i+1][j]+=1
                    if field[i+1][j]%2==0:
                        count-=2
print(len(ans))
for i in range(len(ans)):
    print(ans[i][0]+1,ans[i][1]+1,ans[i][2]+1,ans[i][3]+1)

Measured memory_bytes: 28388
#include <iostream>
#define xl unsigned long long
using namespace std;
int n;
xl mcd(xl a,xl b){
    while(a!=0 && b!=0){
        if(a>b)a=a%b;
        else b%=a;
    }
    if(a==0)return b;
    else return a;
}
xl mcm(xl x){
    xl aux;
    if(x>2){
        aux=x/mcd(x,2);
        return 2*aux;
    }
    else{
         aux=2/mcd(x,2);
         return x*aux;
    }
    return 0;
}
int main(){
    cin>>n;
    cout<<mcm(n);
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
string str;
int cntw[255][255],cnth[255][255],cnta[255][255],cntb[255][255],n,t[255][255],ans;
int main(){
  while(cin>>n&&n){
    ans=0;
    for(int i=0;i<n;i++){
      cin>>str;
      for(int j=0;j<n;j++){
	t[i][j]=str[j]-'0';
	cntw[i][j]=cnth[i][j]=cnta[i][j]=cntb[i][j]=t[i][j];
      }
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(t[i][j]==0)continue;
	if(i>0) cnth[i][j]+=cnth[i-1][j];
	if(j>0) cntw[i][j]+=cntw[i][j-1];
	if(i>0&&j>0) cnta[i][j]+=cnta[i-1][j-1];
	if(i>0&&j<n-1) cntb[i][j]+=cntb[i-1][j+1];
	ans=max(ans,cnth[i][j]);
	ans=max(ans,cntw[i][j]);ans=max(ans,cnta[i][j]);
	ans=max(ans,cntb[i][j]);
      }
    }cout<<ans<<endl;
  }
}


Measured memory_bytes: 4340
#include<stdio.h>
int main(void)
{
  int i=1;
  int x,n;
  scanf("%d",&n);
  while(i<(n+1)){
    x=i;
    if((x%3==0)||(x%10==3)){
      printf(" %d",i);
    }else{
        while(x){
          if(x%10!=3){
            x/=10;
          }else {
            printf(" %d",i);  
            break;
          }
        }
    }
    ++i;
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 2140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main(){
  int n,a,b,c=0,d=1e9;
  cin>>n;
  fr(i,n){cin>>a>>b;c=max(c,a);d=min(d,b);}
  cout<<c+d<<endl;
}

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

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

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;

#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 

using namespace std;

typedef long long ll;

const long long int INF = 1 << 30; //10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

inline void maxch(int& a, int b) { if (a < b) a = b; }

int bfs(int n, vector<vector<int>> &edge, map<pair<int,int>,int> &ecol) {
  queue<int> q;
	q.push(0);

	int maxcol = 0;

	while(!q.empty()){
		int col = 1, parcol = 0;
	  int par = q.front();
		q.pop();
		for (int v : edge[par]) {
		  if (ecol.at({par,v}) == 0) q.push(v);
			parcol = max(parcol, ecol.at({ par,v }));
		}
		// 色を付ける
		for (int v : edge[par]) {
		  if (col == parcol) col++;
			if (ecol.at({par,v}) == 0) {
			  ecol.at({par,v}) = col;
				ecol.at({v,par}) = col;
				maxcol = max(maxcol, col);
			  col++;
			}
		}
	}

	return maxcol;
}

int main() {
  int m,d,m2,d2;
	cin >> m >> d >> m2 >> d2;

	cout << (int) (m != m2) << endl;
}

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

int main() {
  int N, n;
  cin >> N;
  n = N;
  int x=0;
  for (int i = 0; i < 9; i++) {    
    x += n % 10;
    n /= 10;
  }
  
  if ( N % x == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 3584
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		
		int n=sc.nextInt();	
		int a=sc.nextInt();	
		
		 int l=a;
		 int r=a+n-1;
		 int eat=0;
		 
		 if(r<=0) {
			 eat=r;
		 }else if(l>=0) {
			 eat=l;
		 }else {
			eat=0;
		 }
		int answer=(r+l)*(r-l+1)/2-eat;
		System.out.println(answer);
		sc.close();
	}

}

Measured memory_bytes: 27028
import Control.Applicative
import Control.Monad
import Control.Monad.ST
-- import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Fixed
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
--import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import Text.Printf
-- import System.IO.Unsafe
 
-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
tjoin :: (Show a, Show b) => (a, b) -> String
tjoin (x, y) = show x ++ (' ' : show y)
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
whenM :: Monad m => m Bool -> m () -> m ()
whenM c a = c >>= flip when a
unconsU :: [a] -> (a, [a])
unconsU (x:xs) = (x, xs)
-- templete

f :: [(Double,Double)] -> [(Double,Double)]
f ps = firstP : sub firstP 0
  where
    sub p a = let np = nextP p a in if np==firstP then [] else np : sub np (angle $ diff p np)
    firstP = minimumBy (comparing snd <> flip (comparing fst)) ps
    nextP p a = minimumBy (comparing (da a . angle . diff p)) (delete p ps)
    diff (x1,y1) (x,y) = (x-x1,y-y1)
    angle (x,y) = atan2 y x
    da a na = mod' (na - a) (2*pi)

main = do
    n <- getInt
    unless (n==0) $ do
        ps <- map (apply2 (,) . map readDouble . wordsBy (==',')) <$> replicateM n getLine
        print $ n - length (f ps)
        main


Measured memory_bytes: 4692
n=int(input())
a=list(map(int,input().split()))
s=[0]*n
for i in a:
  s[i-1]+=1
  
cnt=0
for i in s:
  cnt+=i*(i-1)//2
  
for i in a:
  ans=cnt
  ans-=s[i-1]-1
  print(ans)


Measured memory_bytes: 100508
n = int(input())
nums = input().split(' ')
d, x = int(nums[0]), int(nums[1])

itvs = []
for i in range(n):
    a = int(input())
    itvs.append(a)

chocos = []
for itv in itvs:
    choco = int((d - 1) / itv) + 1
    chocos.append(choco)

print(sum(chocos) + x)

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

long long solve(int *x, int n, long long L) {
    long long ans = 0;
    long long s[n+1] = {0};
    for (int i = 0; i < n; i++) s[i+1] = s[i] + x[i];
    for (int i = 0; i < n; i++)
        if (2 * (i + 1) <= n)
            ans = max(ans, x[i] + 2 * (s[i] + L * (i + 1) - (s[2*i+2] - s[i+1])));
        else
            ans = max(ans, x[i] + 2 * (s[i] - s[2*i + 1 - n] + L * (n - i - 1) - (s[n] - s[i+1])));
    return ans;
}

int main() {
    int L, n; cin >> L >> n;
    int x[n]; for (int i = 0; i < n; i++) cin >> x[i];
    long long ans = max(x[n-1], L - x[0]);
    ans = max(ans, solve(x, n, L));
    reverse(x, x+n);
    for (int &a : x) a = L - a;
    cout << max(ans, solve(x, n, L)) << endl;
}


Measured memory_bytes: 2560
/*Filename: aoj0002.cpp
 *Author: Mushiyo
 */

#include <iostream>
#include <cmath>

using namespace std;

int countDigit(int num){
	if(num == 0){
		return 1;
	}

	int digit = (int)log10(num) + 1;

	return digit;
}

int main(){
	int a = 0, b = 0;

    while(cin >> a >> b){
        cout << countDigit(a + b) << endl;
    }

	return 0;
}

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

int main() {
  string S;
  cin >> S;
  string a = "abcdefghijklmnopqrstuvwxyz";
  map<char, bool> m;
  for (int i = 0; i < S.size(); i++) {
  	char c = S[i];
    m[c] = true;
  }
  bool flag = false;
  for (int i = 0; i < a.size(); i++) {
  	char key = a[i];
    if (!m[key]) {
      flag = true;
      cout << key << endl;
      break;
    }
  }
  if (!flag) {
  	cout << "None" << endl;
  }
}

Measured memory_bytes: 3684
object Main {

  def main(args: Array[String]): Unit = {
    val N = readLine()
    val As = readLine().split(" ").map(_.toInt)
    val Bs = readLine().split(" ").map(_.toInt)
    val Cs = readLine().split(" ").map(_.toInt)
    
    
    val total = Bs.sum + As.sliding(2).filter(t => {
      t(1) - t(0) == 1
    }).map(t => Cs(t(0)-1)).sum
    
    println(total)
  }
  
}

Measured memory_bytes: 25532
n, m, q = gets.chomp.split.map(&:to_i)

score_board = []
q.times do
  score_board << gets.chomp.split.map(&:to_i)
end

# mが最大10なので全通り
a_list = [*1..m].repeated_combination(n).to_a

max_score = 0
a_list.each do |a|
  score = 0
  score_board.each do |item|
    if a[item[1] - 1] - a[item[0] - 1] == item[2]
      score += item[3]
    end
  end
  max_score = score if score > max_score
end

puts max_score

Measured memory_bytes: 27864
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int Q, H, S, D; cin >> Q >> H >> S >> D;
    int N; cin >> N;
    int A = min({Q*4, H*2, S});
    int B = min(A*2, D);
    cout << (long long)B * (N / 2) + (long long)A * (N % 2) << endl;
    return 0;
}

Measured memory_bytes: 256
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

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

    sort(l.begin(), l.end());
    sort(r.begin(), r.end());

    int ans = 0;
    if (n & 1) {
        int ll = l[n / 2], rr = r[n / 2];
        ans = abs(rr - ll + 1);
    } else {
        int ll = l[n / 2] + l[n / 2 - 1], rr = r[n / 2] + r[n / 2 - 1];
        ans = abs(rr - ll + 1);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4732
#include <iostream>

using namespace std;

int vtoad(int);

int main(void){
	char	*val;
	int	c,N,ad;

	while(cin >> N){
		c=2;
		if(N==1||N==2)
			c=N-1;
		else{
			val = new char[N/3+2];
			for(int i=0;i<N/3+2;i++)
				val[i]=0;

			for(int i=1;i*6-1<=N;i++)
				for(int j=-1;j<=1;j+=2)
					if(i*6+j<=N&&(ad=vtoad(i*6+j)))
						if(!val[ad]){
							c++;
							for(int k=2;(i*6+j)*k<=N;k++)
								if(ad=vtoad((i*6+j)*k))
									val[ad]=1;
					}
			delete [] val;
		}
		cout << c << endl;
	}

	return 0;
}

int vtoad(int val){
	if(!((val+1)%6))
		return (val+1)/3-1;
	else if(!((val-1)%6))
		return (val-1)/3+2;
	else
		return 0;
}

Measured memory_bytes: 1520
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define MX 50
#define EPS 0.00000000001
#define MOD 1000000007
#define PI acos(-1)
#define INF 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    string s;
    cin>>s;
    if(s[2] == s[3] && s[4]==s[5]) cout<<"Yes\n";
    else cout<<"No\n";

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string> 
#include<map>
#include<set>
#include<vector>
#include<string.h>
#include<math.h>
#include<stdio.h>
#include<queue>
#include<utility>
#include<cstdio>
#include<cstring>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qui queue<int>
#define vit vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
int a[101];
int main()
{int n,s=0,u=583,e=0;cin>>n;
fo(i,0,n)cin>>a[i];
fo(i,0,n){
    if(a[i]%10){
	    s=1;u=min(u,a[i]);
    }
    e+=a[i];
}
if(!s){
	cout<<'0';return 0;
}
if(e%10)cout<<e;
else cout<<e-u;
system("pause");
return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr ll INF = 1e18;
int main(){
  int V, E;
  cin >> V >> E;
  vector<vector<ll>> d(V, vector<ll>(V,INF));
  rep(i,V) d[i][i] = 0;
  rep(i,E) {
    int s, t, c;
    cin >> s >> t >> c;
    d[s][t] = c;
  }

  auto warshllfloyd = [&](){
    bool ok = true;
    for (int k = 0; k < V; k++) {
      for (int i = 0; i < V; i++) {
        for (int j = 0; j < V; j++) {
          d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
      }
    }
    
    rep(i,V) if (d[i][i] < 0) ok = false;

    return ok;
  };

  if (!warshllfloyd()) {
    cout << "NEGATIVE CYCLE" << endl;
  } else {
    rep(i,V) {
      rep(j,V) {
        if (d[i][j] < INF / 2) cout << d[i][j];
        else cout << "INF";

        if (j < V-1) cout << " ";
        else cout << endl;
      }
    }
  }
  return 0;
} 


Measured memory_bytes: 3224
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  if(n <105)
    cout << 0;
  else if(n <135)
    cout << 1;
  else if(n <165)
    cout << 2;
  else if(n < 189)
    cout << 3;
  else if(n < 195)
    cout << 4;
  else
    cout << 5;
}
  

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define fin(x) cout << x << endl;

using namespace std;
using ll = long long;

int main(void) {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> vec(m);
  vector<int> ans(n, -1);
  rep(i, m) {
    cin >> vec[i].first >> vec[i].second;
  }
  if (m == 0 && n == 1) {
    fin(0);
    return 0;
  }
  rep(i, m) {
    int k = vec[i].first - 1;
    int num = vec[i].second;
    if (k == 0 && num == 0 && n != 1) {
      fin(-1);
      return 0;
    }
    if (ans[k] == -1 || ans[k] == num) {
      ans[k] = num;
    } else {
      fin(-1);
      return 0;
    }
  }
  if (ans[0] == -1) {
    ans[0] = 1;
  }
  rep(i, n) {
    if (ans[i] == -1) {
      cout << 0;
    } else {
      cout << ans[i];
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

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

using namespace std;
using ll = long long;

int main()
{
    ll a,b,v,w,t;
    cin>>a>>v;
    cin>>b>>w;
    cin>>t;

    if(w>=v){
        cout << "NO" << endl;
        return 0;
    }

    if(llabs(a-b)>llabs(v-w)*t){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }

    return 0;
}

Measured memory_bytes: 3620
#include<cstdio>

using namespace std;

typedef long long ll;

int main(){
	ll x; scanf("%lld", &x);
	ll b = (x + 10) / 11;
	printf("%lld\n", 11 * b - 5 >= x ? 2 * b - 1 : 2 * b);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <limits>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<int,int>
#define x first
#define y second
#define sf scanf
#define pf printf
#define vec vector
#define pb push_back
#define mp make_pair
#define sz(a) int(a.size())
#define all(a) a.begin(),a.end()
#define clr(a,b) memset(a,b,sizeof(a))
#define bin_cnt(x) __builtin_popcount(x)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define srep(sub,s) for(int sub=s&(s-1);sub;sub=(sub-1)&s)
#define irep(i,a) for(__typeof(a.begin()) i=a.begin();i!=a.end();i++)
#define irrep(i,a) for(__typeof(a.rbegin()) i=a.rbegin();i!=a.rend();i++)
#define inf numeric_limits<int>::max()
#define finf numeric_limits<double>::infinity()
#define eps 1e-8
#pragma GCC optimize ("O3")
#define o3 __attribute__((optimize("O3")))
#pragma comment(linker, "/STACK:32505856")

template<class T> inline T sqr(T a) {return a*a;}
template<class T> inline int gmin(T&a,T b) {if(a>b){a=b;return 1;}return 0;}
template<class T> inline int gmax(T&a,T b) {if(a<b){a=b;return 1;}return 0;}
inline int dcmp(const double &a) {return a>eps?1:(a<-eps?-1:0);}
struct Initializer{Initializer(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}}initializer;

#define N 100010
char s[N];

int main() {
  while (~sf("%s",s + 1)) {
    int len = strlen(s + 1);
    int k;
    sf("%d", &k);

    rep(i, 1, len - 1) {
      if (s[i] == 'a') {
        putchar('a');
      } else {

        int dis = 'z' - s[i] + 1;
        if (dis <= k) {
          k -= dis;
          putchar('a');
        } else {
          putchar(s[i]);
        }
      }
    }

    k %= 26;
    putchar(((s[len] - 'a') + k) % 26 + 'a');
    putchar('\n');
  }
  return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int r;
	cin >> r;

	if (r < 1200) {
		cout << "ABC" << endl;
	} else if (r < 2800) {
		cout << "ARC" << endl;
	} else {
		cout << "AGC" << endl;
	}
	return 0;
}


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

# define x first    
# define y second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector         
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

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

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {   
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") { 
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}   

int main()
{                                  
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  int n;
  cin >> n;                     
  int a[n + 2] = {0};
  int x;
   cin >> x;

  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort (a + 1, a + n + 1);
  a[n + 1] = x + 1;
  for (int i = 1; i <= n; i++) {
    a[i] += a[i - 1];
    if (a[i] > x) {
      cout << i-1;
      return 0;
    }
  }                  
  if (a[n] == x)
    cout << n;
  else
    cout << n-1;


  return 0;
}






// Coded by Z..



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
const ll INF = 100000000000000000;

int main(){
    int a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    ll hoge = 0;
    ll min = INF;
    rep(i,0,max(x,y)){
        ll d1 = x - i;
        ll d2 = y - i;
        if(d1<=0) d1 = 0;
        if(d2<=0) d2 = 0;
        hoge = 2*c*i+a*d1+b*d2;
        if(min>hoge) min = hoge;
    }
    cout<<min<<endl;
    return 0;
}

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


int main(){
  bool torf=false;
  ll x;
  cin >> x;
  vector<ll> five(120);
  
  rep(i,120){
    five.at(i)=pow(i,5.0);
  }
  
  ll a,b;

  //cout << five.at(0) << endl;
  //cout << five.at(69) << endl;
  rep(i,120){
    for(int j=i+1;j<120;j++){
      if(x==five.at(j)-five.at(i)){
        a=j;
        b=i;
        torf=true;
       // cout << "25" << endl;
        break;
      }
        
    }
    if(torf==true)
      break;
  }
  
  if(torf==false){
    rep(i,120){
    for(int j=i+1;j<120;j++){
      if(x==five.at(j)+five.at(i)){
        a=j;
        b=-i;
        torf=true;
      //  cout << "41" << endl;
        break;
      }
        
    }
    if(torf==true)
      break;
  }
    
  }
  
 // cout << torf << endl;
  cout << a << ' ' << b << endl;
  
}

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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

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

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}


int main(){

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

    int n,k;
    cin>>n>>k;

    vector<int> inp(n);

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

    sort(inp.rbegin(), inp.rend());

    ll sum = 0;

    for(int i = k; i < n; i++) {
        sum += inp[i];
    }

    cout<<sum<<endl;

}


Measured memory_bytes: 1024
def main(n)
  max = 55_555
  div = 5
  list = (2..max).to_a
  answers = []
  loop do
    num = list.shift
    break unless num

    list.delete_if { |l| l % num == 0 }
    if num % div == 1
      answers.push num
      break if answers.size >= n
    end
  end
  answers
end

n = gets.to_i
puts main(n).join(" ")

Measured memory_bytes: 2556
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

using namespace std;

typedef long long LL;
typedef vector<LL> VL;
#define REPD(i,a,b) for (LL i=(a);i<(b);i++)
#define REP(i,n) REPD(i,0,n)

LL inputValue(){
  LL a;
  cin >> a;
  return a;
};

string inputString(){
  string a;
  cin >> a;
  return a;
};

vector<LL> inputVector(LL a){
  vector<LL> rv;
  REP(i, a){
    LL input;
    cin >> input;
    rv.push_back(input);
  }
  return rv;
}

vector<string> inputVectorString(LL a){
  vector<string> rv;
  REP(i, a){
    string input;
    cin >> input;
    rv.push_back(input);
  }
  return rv;
}
vector<vector<LL>> inputVector2D(LL a, LL b){
  vector<vector<LL>> rv;
  REP(i, a){
    rv.push_back(vector<LL>());
    REP(j, b) {
      LL input;
      cin >> input;
      rv.at(i).push_back(input);
    }
  }
  return rv;
}

#if 0
#define debug(d) debug1(__LINE__,#d, d)
void debug1(LL line, const char* name, vector<LL>& v) {
  cout << line << ":" << name << ":vector<LL>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, LL i) {
  cout << line << ":" << name << ":LL " << i << endl;;
}
void debug1(LL line, const char* name, vector<string>& v) {
  cout << line << ":" << name << ":vector<string>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, vector<vector<LL>>& v) {
  cout << line << ":" << name << ":vector<vector<LL>>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    REP(j, (LL)v.at(i).size()) {
      cout << v.at(i).at(j) << " ";
    }
    cout << ", ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, priority_queue<LL>& p) {
  cout << line << ":" << name << ":priority_queue<LL>(" << p.size() << ") ";
  priority_queue<LL> copy = p;
  while(!copy.empty()) {
    cout << copy.top() << " ";
    copy.pop();
  }
  cout << endl;
}
#else
#define debug(n)
#endif

int main(int argc, const char * argv[]) {
	cout.precision(16);
  // source code

  auto n = inputValue();
  auto m = inputValue();
  auto as = inputVector(n);

  priority_queue<LL> q;
  REP(i, n) {
    q.push(as.at(i));
  }

  debug(q);

  REP(i, m) {
    auto t = q.top();
    q.pop();
    q.push(t/2);
  }

  LL r = 0;
  REP(i, n) {
    r += q.top();
    q.pop();
  }
  cout << r << endl;

  return 0;
}


Measured memory_bytes: 2548
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
      int ans = N%1000;
      
      if (ans == 0)
      {System.out.println(ans);}
      else
        {System.out.println(1000-ans);}
    }
}

Measured memory_bytes: 35776
#include<cstdio>
#include<algorithm>
struct Element{
    int l,r;
    bool operator < (const Element& other)const{
        return r<other.r;
    }
};
Element a[100005];

int main(){
    int n;
    scanf("%d",&n);
    for(int i = 1; i <= n; i++){
        int x,l;
        scanf("%d%d",&x,&l);
        a[i].l = x-l;
        a[i].r = x+l;
    }
    std::sort(a+1,a+1+n);
    int endPoint = a[1].r, ans = 1;
    for(int i = 2; i <= n; i++){
        if(a[i].l>=endPoint){
            endPoint = a[i].r;
            ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 896
# input
X, N = map(int, input().split())
p = list(map(int, input().split()))

if X not in p:
    print(X)
else:
    variable_val = 1
    while True:
        if X - variable_val not in p:
            print(X - variable_val)
            exit(0)
        if X + variable_val not in p:
            print(X + variable_val)
            exit(0)
        variable_val += 1

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

int Primenum(int );

int false=0,true=1,x[10000],count=0,n,m;

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

  printf("%d\n",count);

  return 0;
}

int Primenum(int x){
  int i;
  if(x==2){
    return true;
  }

  if(x<2 || x%2==0){
    return false;
  }

  i=3;
  while(i<=sqrt(x)){
    if(x%i==0) return false;
      i=i+2;
    
  }

  return true;

}

Measured memory_bytes: 624
#include <bits/stdc++.h>  
using namespace std;  
#define INF 0x3f3f3f3f  
typedef long long ll;  
const int N = 1310;  
#define FI first
#define SE second
typedef pair<int, int>pii;

int num[N];
int main()  
{  
 
 
   // ios::sync_with_stdio(0);
   int n;
   int rate[] = {399, 799, 1199, 1599, 1999, 2399, 2799, 3199};
   while (~scanf("%d", &n))
   {
    set<int>S;
    int up = 0;
     for (int i = 0; i < n; i++)
    {
       int x;
       scanf("%d", &x);
       bool f = false;
       for (int j = 0; j < 8; j++)
       {
         if (x <= rate[j])
         {
            S.insert(j);
            f = true;
            break;
         }
       }
        up += !f;
    }
       
       int mi = 0, mx = 0;
       // printf("<%d %d>\n", S.size(), up);
       if (S.size())
       {
        mi += S.size();
       }else
        mi = 1;

       mx = S.size() + up;

        printf("%d %d\n", mi, mx);
       
   }    

   return 0;  

}  

Measured memory_bytes: 256
n=int(input())
txy=[list(map(int,input().split())) for _ in range(n)]
u,v,w=0,0,0
for t,x,y in txy:
  p=t-u
  q=abs(v-x)+abs(w-y)
  if p<q or p%2!=q%2:
    print("No")
    break
else:
  print("Yes")
    

Measured memory_bytes: 60888
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int dp[100005][4];
int recur(int n,int last)
{
    if(n<6)
        return n;
    int &ret=dp[n][last];
    if(ret)
        return ret;
    ret=INT_MAX;
    for(int i=6; i<=n; i*=6)
        ret=min(ret,recur(n-i,1)+1);
    for(int i=9; i<=n; i*=9)
        ret=min(ret,recur(n-i,2)+1);
    return ret;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    cout<<recur(n,0)<<endl;
    return 0;
}


Measured memory_bytes: 6172
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD;
#define MODSUB(SUB_X,SUB_Y)  (SUB_X-SUB_Y)+MOD)%MOD;
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD;
#define LCM(LCM_X,LCM_Y) (LCM_X*LCM_Y)/__gcd(LCM_X,LCM_Y);
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};
vector<int>v[20];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,d;
    cin>>n>>d;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<d; j++)
        {
            int a;
            cin>>a;
            v[i].push_back(a);
        }
    }
    int cnt=0;
    for(int i=0; i<n; i++)
    {
        for(int j=i+1; j<n; j++)
        {
            int cur=0;
            for(int k=0; k<d; k++)
            {
                cur+=((v[i][k]-v[j][k])*(v[i][k]-v[j][k]));
            }
            int sq=sqrt(cur);
            if(sq*sq==cur)
                cnt++;

        }
    }
    cout<<cnt<<endl;

    return 0;
}


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

int main(){
    int N,K,i,output,temp,j;
    output = 0;
    int price[1000];
    cin >> N >> K;
    for (i=0; i<N; i++){
        cin >> price[i];
    }
    for (i=0; i<K; i++){
        for (j=0; j<N; j++){
            if (j == 0){
                temp = price[0];
            }
            if(price[j] < temp){
                temp = price[j];
            }
        }
        for (j=0; j<N; j++){
            if (price[j] == temp){
                price[j] = 1000000;
                break;
            }
        }
        output += temp;
    }
    cout << output << endl;
}


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

int main() {
    string s;
    cin >> s;
    int ans = 0;
    int l = s.length();
    
    for (int i = 0; i < l; i++) {
        if (s[i] == '+') {
            ans++;
        }
        else {
            ans--;
        }
    }
    
    cout << ans << endl;
    return 0;
}

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

using namespace std; 
typedef long long ll;
bitset<10000010> primes;
ll ub;
vector<ll> lprimes;
void crivo(int a){
	primes.set();
	primes[0] = primes[1] = 0;
	for(int i = 4;i <= a; i += 2){
		primes[i] = 0;
	}
	for(int i = 3; i * i <= a; i += 2){
		if(primes[i]){
			for(int j = i * i; j <= a; j += i){
				primes[j] = 0;
			}
		}
	}
}

int main(){
	ub = 10000010;
	crivo(ub);
	int a;
	cin>>a;
	int cont = 0;
	while(!primes[a + cont]){
		cont++;
	}
	cout<<a + cont<<endl;
	return 0;
}

Measured memory_bytes: 4864
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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

	long long h,w;
	cin>>h>>w;

	if (h%3==0 || w%3==0){
		cout<<0<<endl;
	}
	else{
		long long ans = min(h,w);
		for (int i=1;i<h;i++){
			long long ma,mi;
			mi = min(w*i, (w/2)*(h-i));
			ma = max(w*i, ((w+1) / 2)*(h - i));
			ans = min(ans, ma-mi );
		}
		swap(h,w);
		for (int i = 1; i<h; i++){
			long long ma, mi;
			mi = min(w*i, (w / 2)*(h - i));
			ma = max(w*i, ((w + 1) / 2)*(h - i));
			ans = min(ans, ma - mi);
		}
		cout<<ans<<endl;
	}


	return 0;
}

Measured memory_bytes: 256
"use strict";
function main(input) {
    const line = input.split("\n");
    let arr = line[0].split(" ");
    const A = parseInt(arr[0]);
    const B = parseInt(arr[1]);
    const C = parseInt(arr[2]);
    const K = parseInt(arr[3]);
    if (K <= A) {
        console.log(K);
    } else if (K <= A + B) {
        console.log(A);
    } else {
        console.log(A - (K - A - B));
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

bool cmp(const pair<int,int> &a,const pair<int,int> &b) 
{ 
    return (a.first > b.first); 
} 

main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	int n;
	cin>>n;
	map<string,vector<pair<int,int>>> m;
	for(int i=1;i<=n;i++)
	{
		string s;
		int p;
		cin>>s>>p;

		m[s].pb({p,i});
	}

	for(auto it=m.begin();it!=m.end();it++)
		sort(it->second.begin(),it->second.end(),cmp);

	for(auto i:m)
	{
		for(auto j:i.second)
			cout<<j.second<<endl;
	}
}	

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

int main()
{
	int a,b;
	scanf("%d %d", &a, &b);
	if((a + b) % 2 == 0) printf("%d\n",(a + b) / 2);
	else printf("%d\n", (a + b) / 2 + 1);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string S;
  cin >> N >> S;
  string ans="";
  char d1[2]={'S','W'};
  char dN[2]={'S','W'};
  for (int i=0;i<2;i++){
    for (int j=0;j<2;j++){
      string a="";
      a+=d1[i];
      if ((i==0&&S[0]=='o')||(i==1&&S[0]=='x')){
        a+=dN[j];
      }
      else {
        a+=dN[(j+1)%2];
      }
      for (int k=1;k<N-1;k++){
        if ((a[k]=='S'&&S[k]=='o')||(a[k]=='W'&&S[k]=='x')){
          a+=a[k-1];
        }
        else {
          if (a[k-1]=='S'){
            a+='W';
          }
          else {
            a+='S';
          }
        }
      }
      if (a[N-1]==dN[j]){
        if (((j==0&&S[N-1]=='o')||(j==1&&S[N-1]=='x'))&&a[0]==a[N-2]){
          ans=a;
        }
        else if (((j==0&&S[N-1]=='x')||(j==1&&S[N-1]=='o'))&&a[0]!=a[N-2]){
          ans=a;
        }
      }
    }
  }
  if (ans.size()>0){
    cout << ans << endl;
  }
  else {
    cout << -1 << endl;
  }
}

Measured memory_bytes: 716
using System;

class Program
{
    static void Main(string[] args)
    {
        var s = Console.ReadLine();

        var d = new int[s.Length];
        var n = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (s[i] == 'R')
            {
                n = 0;
            }
            else
            {
                n--;
                d[i] = n;
            }
        }

        for (int i = s.Length - 1; i >= 0; i--)
        {
            if (s[i] == 'L')
            {
                n = 0;
            }
            else
            {
                n++;
                d[i] = n;
            }
        }

        var ans = new int[s.Length];
        for (int i = 0; i < s.Length; i++)
        {
            if (d[i] % 2 == 1)
            {
                ans[i + d[i] - 1]++;
            }
            else if (d[i] % 2 == -1)
            {
                ans[i + d[i] + 1]++;
            }
            else
            {
                ans[i + d[i]]++;
            }
        }

        for (int i = 0; i < s.Length; i++) Console.Write(ans[i] + " ");
        Console.WriteLine();
    }
}


Measured memory_bytes: 17440
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
#define pb push_back
#define INF 1e5
#define REP(i,a,b) for(int i=a;i<b;++i)
#define REPN(i,a,b) for(int i=a;i<=b;++i)

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);   
    
    int A[3];
  cin>>A[0]>>A[1]>>A[2];
  sort(A,A+3);
  if(A[0]==A[1] && A[1]!=A[2]) cout<<"Yes\n";
  else if(A[1]==A[2] && A[0]!=A[1]) cout<<"Yes\n";
  else cout<<"No\n";    
	return 0;
    
}


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

int main() {
  string s, t;
  cin >> s >> t;
  int sum = 0, ss = s.size();
  for(int i = 0; i < ss; i++) {
    if(s[i] != t[i]) sum++;
  }
  cout << sum;
}

Measured memory_bytes: 3920
#include <bits/stdc++.h>
#define ll  long long int
#define N 100000
#define M 1000000007
#define f(i,a,b) for(ll i=(ll)a;i<=(ll)b;i++)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define po pop_back
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define PI 3.14159265
#define cot cout.tie(0)
using namespace std;
/**
  * @author :: Sawlani
  *
  */
int main()
{
   ll n,k;
  cin >> n >>  k;
  string s;
  cin >> s;
  s[k-1]=tolower(s[k-1]);
    cout << s << endl;
}

Measured memory_bytes: 256
N,Y=map(int,input().split())
a=-1
b=-1
c=-1
for i in range(0,N+1):
    for j in range(0,N-i+1):
        if 10000*i+5000*j+1000*(N-i-j) == Y:
                a=i
                b=j
                c=N-i-j
print(a,b,c)

Measured memory_bytes: 3060
import sys
# from bisect import bisect_right
# gcd
# from fractions import gcd
# from math import ceil, floor
# from copy import deepcopy
# from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# print(S.most_common(2))  # [('b', 5), ('c', 4)]
# print(S.keys())  # dict_keys(['a', 'b', 'c'])
# print(S.values())  # dict_values([3, 5, 4])
# print(S.items())  # dict_items([('a', 3), ('b', 5), ('c', 4)])
# from collections import Counter
# import math
# from functools import reduce
#
# fin = open('in_1.txt', 'r')
# sys.stdin = fin
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template

# def solve(L, A, B, M):
#     ret, digits = 0, 0
#     for d in range(18, 0, -1):
#         lo = 10 ** (d - 1)
#         hi = 10 ** d - 1
#         if hi < A or A + B * (L - 1) < lo:
#             continue
#         imin = 0 if lo <= A else (lo - A + B - 1) // B
#         init = A + B * imin
#         if init > hi:
#             continue
#         imax = L - 1 if A + B * (L - 1) <= hi else imin + (hi - init) // B
#         n = imax - imin + 1
#         p = 10 ** d % M
#         a = matpow([[0,1,0], [0,0,1], [1,1,1]], n, M)
#         # a[0][3] = sum p^i for i in [0, n-1]
#         # a[1][3] = sum i * p^i for i in [0, n-1]
#         # sum (A + B * (imax - i)) * p^i for i in [0, n-1]
#         sub = (A + B * imax) % M * a[1][3] % M + M - (B * a[0][3] % M)
#         ret += sub % M * pow10(digits, M) % M
#         digits += d * (imax - imin + 1)
#     return ret % M


# def pow10(p, mod):
#     if p % 2 == 1:
#         return 10 * pow10(p - 1, mod) % mod
#     elif p > 0:
#         sub = pow10(p // 2, mod)
#         return sub * sub % mod
#     else:
#         return 1


# def matpow(a, p, mod):
#     if p % 2 == 1:
#         return matmul(a, matpow(a, p - 1, mod), mod)
#     elif p > 0:
#         b = matpow(a, p // 2, mod)
#         return matmul(b, b, mod)
#     else:
#         n = len(a)
#         return [[1 if i == j else 0 for j in range(n)] for i in range(n)]


# def matmul(a, b, mod):
#     n = len(a)
#     ret = [[0 for j in range(n)] for i in range(n)]
#     for i in range(n):
#         for k in range(n):
#             for j in range(n):
#                 ret[i][j] += a[i][k] * b[k][j]
#         for j in range(n):
#             ret[i][j] %= mod
#     return ret





if __name__ == '__main__':

    # write code
    X,A = mi()
    if X < A:
        print(0)
    else:
        print(10)

Measured memory_bytes: 38384
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cmath>

using namespace std;

int devide(int x){
    if(x%2==1) return 0;
    return 1+devide(x/2);
}

int main(){
    int N;   
    cin>>N;
    vector<int> a(N);
    int count=0;
    for(int i=0;i<N;i++) {
        cin>>a[i];
        count+=devide(a[i]);
    }
    
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

class RollingHash{
    private:
    long long B[5]={114514,1919,810,893,364364};
    long long M[5]={1000000007,1000000009,999999937,998244353,2147483647};
    long long Binv[5];
    
    public:
    string S;
    vector<long long> H[5],Hsum[5],Power[5];
    
    //繰り返し二乗法
    long long BE(long long b,int e,int m){
        long long r=1;
        while(e){
            if(e&1){
                r=(r*b)%M[m];
            }
            b=(b*b)%M[m];
            e >>=1;
        }
        return r;
    }

    
    
    void init(string cs){
        S=cs;
        int n=S.size();
        
        //逆元は一定なので前計算(near 575)
        for(int i=0;i<5;i++){
            Binv[i]=BE(B[i],M[i]-2,i);
        }
        
        //本体
        for(int i=0;i<5;i++){
            H[i].assign(n+1,0);
            long long b=1;
            for(int j=n-1;j>=0;j--){
                H[i][j]=(b*(int)S[j])%M[i];
                b=(b*B[i])%M[i];
            }
        }
        
        //累積和すると嬉しいと思いませんか？僕は思います
        for(int i=0;i<5;i++){
            Hsum[i].assign(n+1,0);
            for(int j=0;j<n;j++){
                Hsum[i][j+1]=(Hsum[i][j]+H[i][j])%M[i];
            }
        }
    }
    
    //外からハッシュ値を呼びたい
    long long get(int l,int r,int m){
        long long R=(Hsum[m][r+1]-Hsum[m][l])%M[m];
        R=(R+M[m])%M[m];
        R=(R*BE(Binv[m],(S.size())-r-1,m))%M[m];
        return R;
    }
    
    
};

signed main(void){
    int N;
    string S;
    cin >> N;
    cin >> S;
    RollingHash roliha;
    roliha.init(S);
    map<vector<int>,int> R;
    vector<vector<int>> V;
    
    int ok=0,ng=S.size(),mid;
    
    while(abs(ng-ok)>1){
        mid=(ok+ng)/2;
        
        R.clear();
        V.clear();
        for(int i=0;i+mid-1<N;i++){
            vector<int> K;
            REP(j,5){
                int k=roliha.get(i,i+mid-1,j);
                K.push_back(k);
            }
            V.push_back(K);
            //REP(j,K.size()){cout << K[j] << "  "; }cout << endl;
        }
        //cout << V.size() MM N-mid << endl;
        bool c=false;
        REP(i,N){
            if(i-mid>=0){
                R[V[i-mid]]++;
            }
            if(i<V.size()){
                if(R[V[i]]>=1){
                    c=true;
                }
            }
        }
        
        if(c){
            ok=mid;
        }else{
            ng=mid;
        }
        
        //cout << ok MM ng MM mid << endl;
        
    }
    cout << ok << endl;
    return 0;
}



Measured memory_bytes: 1664
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Graph=vector<vector<int>>;
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();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N;
  cin>>N;
  ll C[N+1];
  RREP(i,N) cin>>C[i];
  
  ll DP[200010],LAST[200010];
  RREP(i,200010){
    DP[i]=0;
    LAST[i]=0;
  }
  
  DP[1]=1;
  LAST[C[1]]=1;
  ll T=C[1];
  
  for(int i=2; i<=N; ++i){
    if(LAST[C[i]]==0 || T==C[i]) DP[i]=DP[i-1];
    else DP[i]=DP[i-1]+DP[LAST[C[i]]];
    
    DP[i]%=MOD;
    LAST[C[i]]=i;
    T=C[i];
  }
  
  co(DP[N]);
  return 0;
}

Measured memory_bytes: 4992