akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define mod 998244353 
#define pb push_back
//#define mp make_pair
#define INF 2000000011LL
#define INFLL 1000000000000000011LL
#define eps 1e-9
#define pp pair < pair<ll,ll> , ll> 
#define fo(i,j,k) for(int i=j;i<=k;i++)
#define foll(i,j,k) for(ll i=j;i<=k;i++)
#define clr(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vll vector<ll>
#define sz(a) a.size()
#define len(a) a.length()
#define all(a) a.begin(),a.end()
#define io_file freopen("input_file.in", "r", stdin); freopen("output_file.in", "w", stdout)

const int MAXN = 2e5+5;
using namespace std;
ll power(ll x, ll y)
{
  ll res = 1;
  while(y>0)
  {
    if(y&1)
       {
         res = (res*x)%mod;
        }
     x = (x*x)%mod;
     y = y>>1;
  }
    return res;
}
// std::vector<ll> divi[100004];
// void divisor(int n)
// {
//    for(ll i=1;i<=n;i++)
//    {
//      for(ll j=i;j<=n;j+=i)
//      {
//        divi[j].pb(i);
//      }
//    }
// }


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // io_file;
    
	int n,a,b;
	cin>>n>>a>>b;
	if((b-a-1)%2==0) 
	{
		cout<<"Borys"<<endl;
	}   
	else cout<<"Alice"<<endl;

    return 0;
    

}
	

Measured memory_bytes: 256
n,m,qq = map(int,input().split())
PQ = []
LR = [[_+1,0]+list(map(int,input().split())) for _ in range(m)]

for i in range(qq):
    p,q = map(int,input().split())
    PQ.append([i+1,1,p,q+0.1])
record = [0]*(n+1)
Ans = []

All = LR+PQ
from operator import itemgetter
All.sort(key = itemgetter(3))

for num,flag ,l, r in All:
    if flag :
        Ans.append([num,sum(record[l:int(r+1)])])
    else:
        record[l] += 1
Ans.sort(key = itemgetter(0))
for ans in Ans:
    print(ans[1])

Measured memory_bytes: 77332
#include <bits/stdc++.h>
using namespace std;
int main () {
  long H, W;
  cin >> H >> W;
  vector<vector<long>> data(10, vector<long> (10));
  for(int i = 0; i < 10; i++){
    for(int j = 0; j < 10; j++){
      cin >> data.at(i).at(j);
    }
  }
  for(int i = 0; i < 10; i++){
    for(int j = 0; j < 10; j++){
      for(int k = 0; k < 10; k++){
        data.at(j).at(k) = min(data.at(j).at(k), data.at(j).at(i) + data.at(i).at(k));
      }
    }
  }
  long ans = 0, a;
  for(int i = 0; i < H * W; i++){
    cin >> a;
    if(a != -1)ans += data.at(a).at(1);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <string>
#include <utility>
#include <map> 
#include <queue>
#include <stack>
#include <iomanip>
#include <sstream>
#define MP make_pair
#define PB push_back
#define S size()
#define B begin()
#define E end()
#define ll long long
#define REP(i,a,n) for(ll i=a; i<n; ++i)
#define RED(i,n,a) for(ll i=n; i>=a; --i)
#define m9 1000000007
#define endl "\n"
#define F first
#define SE second
#define ld long double



using namespace std;

ll gcd(ll a, ll b){
    if(a%b==0){
        return b;
    }
    else{
        return gcd(b, a%b);
    }
}
ld area(ld x1, ld y1, ld x2, ld y2, ld x3, ld y3){
    return abs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2;
}
 
ll dp[3001][3001];
bool vis[3001][3001];
ll n;
vector <ll> v;



/*ll solve(ll l, ll r){
    if(vis[l][r]){
        return dp[l][r];
    }
    vis[l][r]=1;
    if(l==r ){
        dp[l][r]=v[l-1];
        return dp[l][r];
    }
    
    dp[l][r]= max(v[l-1]-solve(l+1,r),v[r-1]-solve(l,r-1));
    return dp[l][r];
    
}*/

int main(){
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cin>>n;
    REP(i,0,n){
        ll x;
        cin>>x;
        v.PB(x);
    }
    REP(i,0,301){
        REP(j,0,301){
            dp[i][j]=0;
        }
    }
    RED(l,n-1,0){
        REP(r,l,n){
            if(r-1<0){
                dp[l][r]=v[l]-dp[l+1][r];
                continue;
            }
            dp[l][r]=max(v[l]-dp[l+1][r],v[r]-dp[l][r-1]);
        }
    }
    cout<<dp[0][n-1];
    
    
    
    
}


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

int main() {
  int h, a;
  cin >> h >> a;
  if(h%a == 0) cout << h/a << endl;
  else cout << h/a + 1 << endl;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
h=list(map(int,input().split()))
ans=[1]*n
for i in range(m):
	a,b=map(int,input().split())
	if h[a-1]>h[b-1]:
		ans[b-1]=0
	elif h[a-1]<h[b-1]:
		ans[a-1]=0
	else:
		ans[b-1]=0
		ans[a-1]=0
print(ans.count(1))


Measured memory_bytes: 20068
#if defined(LOCAL)
#define PROBLEM_NAME "c"
const double _max_double_error = 1e-9;
#include "testutils.h"
#define L(x...) (debug(x, #x))
#define C(x...) CHECK(x)
#else
#define L(x, ...) (x)
#define C(x, ...) ;
#include <bits/stdc++.h>
#endif

using namespace std;
using vi = vector<int>; using vvi = vector<vi>;
using ii = pair<int,int>; using vii = vector<ii>;
using l = long long; using vl = vector<l>; using vvl = vector<vl>;
using ll = pair<l,l>; using vll = vector<ll>; using vvll = vector<vll>;
using lu = unsigned long long;
using vb = vector<bool>; using vvb = vector<vb>;
using vd = vector<double>; using vvd = vector<vd>;
using mll = unordered_map<l, l>;
const l INF = numeric_limits<l>::max();
const double EPS = 1e-10; static constexpr auto PI = acos(-1);
const l e0=1, e3=1000, e5=100000, e6=10*e5, e7=10*e6, e8=10*e7, e9=10*e8;
const char lf = '\n';
#define all(x) begin(x), end(x)
#define F(a,b,c) for (l a = l(b); a < l(c); a++)
#define B(a,b,c) for (l a = l(c) - 1; a >= l(b); a--)
#define MAX(a,b)({__typeof__(a)__x=(a);__typeof__(b)__y=(b);__x<__y?__y:__x;})
#define MIN(a,b)({__typeof__(a)__x=(a);__typeof__(b)__y=(b);__x<__y?__x:__y;})

void solve(istream& cin, ostream& cout) {
  string s; cin >> s;
  l i = 0, j = s.size() - 1;
  l z = 0;
  while (i < j) {
    if (s[i] == s[j]) {i++; j--; continue;}
    if (s[i] == 'x') { i++; z++; continue;}
    if (s[j] == 'x') { j--; z++; continue;}
    cout << -1 << lf;
    return;
  }
  cout << z << lf;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout << fixed << setprecision(15);
#if defined(LOCAL)
  // _generate_random_test = generate_random;
  // _solve_brute = solve_brute;
  // _player_b = player_b;
  // _custom_solution_checker = solution_checker;
  maybe_run_tests(cin, cout);
#else
  solve(cin, cout);
#endif
}


Measured memory_bytes: 512
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val m = sc.nextInt()
    val d = sc.nextInt()
    var ans = 0
    for (k in 1..m) {
        for (i in 2..9) {
            for (j in 2..9) {
                if (10 * i + j <= d && i * j == k) ans++
            }
        }
    }
    println(ans)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


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

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

//毎回変える場所
#define N_MAX 200001
#define INF 1000000007

//問題文のとおり
char temp[50];
LL N, K;
LL a[50];

//関数
bool end(LL* b){
	REP(i, N) {
		if(b[i]>=N)return false;
	}
	return true;
}
bool allBig(LL* b) {
	REP(i, N) {
		if(b[i]<N)return false;
	}
	return true;
}

bool min(LL* b) {
	LL ans=b[0];
	REP(i, N) {
		if(a[i]<ans)ans=a[i];
	}
	return ans;
}

int main() {
	cin>>N;
	REP(i,N)cin>>a[i];

	//1回の操作で、数列全体で見れば-1されている。
	//そこで、溢れている数値を-1する
	//⇔操作を1回する　と考える。

	while (end(a) == false) {
		//全部が溢れているとき、一気に消す
		
		LL mini=min(a);
		if (mini >= N) {
			mini-=N;
			REP(i,N)a[i]-=mini;
			K+=mini*N;
		}

		REP(i, N) {
			//溢れている奴に対して適用
			if (a[i] >= N) {

				//消す回数
				LL delNum=a[i]/N;
				a[i]%=N;
				K+=delNum;

				//逆に増やす
				REP(j, N) {
					if(i!=j)a[j]+=delNum;
				}
			}
		}
	}


	cout<<K<<endl;
	//cin>>temp;

	return 0;
}

Measured memory_bytes: 384
-- local test = 123
local function query(x)
  io.write("? " .. x .. "\n")
  io.flush()
  if test then
    local f1 = tostring(x) <= tostring(test)
    local f2 = x <= test
    do return f1 == f2 end
  end
  local ret = io.read("*l")
  return ret == "Y"
end
local function ans(x)
  io.write("! " .. x .. "\n")
  io.flush()
  os.exit()
end
local function solve1(min, max)
  while 1 < max - min do
    local mid = (min + max) // 2
    if query(mid * 10) then
      max = mid
    else
      min = mid
    end
  end
  ans(max)
end
for i = 1, 9 do
  local lim = 1
  for j = 1, i do
    lim = lim * 10
  end
  local ret = query(lim)
  if not ret then
    solve1(lim // 10, lim - 1)
  end
end
do
  local tgt = 2
  for i = 0, 10 do
    if query(tgt) then
      ans(tgt // 2)
    end
    tgt = tgt * 10
  end
end


Measured memory_bytes: 3676
{-# LANGUAGE TypeApplications #-}

main :: IO ()
main = do
  l1 <- getLine
  let xs@[x1, x2, x3, x4, x5] = map (read @Int) $ words l1
  print $ f 1 xs

f i [] = undefined 
f i (x:xs) = if i == x then f (i + 1) xs else i


Measured memory_bytes: 3884
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
#define fi first
#define se second
int n,k,x;
vector<int>v[100002];
int d[100002],ans;
bool b[100002],c[100002];
bool t[100002],ng[100002];
int main(){
	r(i,100002)d[i]=1e8;
	cin>>n>>k;
	r(i,n){
		scanf("%d",&x);
		if(x){
			v[i].push_back(x-1);
			b[i]=1;
			t[x-1]=1;
		}
	}
	queue<P>q;
	r(i,n){
		if(!t[i]){
			q.push(P(i,0));
			c[i]=1;
		}
	}
	while(!q.empty()){
		P p=q.front();q.pop();
		x=p.fi;
		int dis=p.se;
		if(dis>=k-1)continue;
		r(i,v[x].size()){
			if(!c[v[x][i]]){
				c[v[x][i]]=1;
				q.push(P(v[x][i],dis+1));
			}
		}
	}
	r(i,n){
		if(c[i]||!b[i]){
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 9780
//
//  main.cpp
//  four
//
//  Created by deepaz on 8/10/20.
//  Copyright © 2020 deepaz. All rights reserved.
//
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <iterator>
#include <cstring>
#include <algorithm>
#define ll long long
//deepaz
using namespace std;
//int num = stoi(a); -> str to int
//a = to_string(num); -> int to str
//total += c-48; -> char to int
 
//comparison func
bool comp(int x,int y){
    return x<y;
}
//char to int
int to_int(char c){
    return c;
}
//minimum in array
ll getMin(ll arr[], ll n){
    long long res = 1e6;
    for (int i = 0; i <= n; i++){
        res = min(res, arr[i]);
    }
    return res;
}
//get divisors of number
ll divisors(int n){
    long long cnt = 0;
    for(int i=1;i<n;i++){
        if(n%i==0){
            cnt++;
        }
    }
    return cnt;
}
//find if prime
bool isPrime(ll n){
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
//display prime in faster way
void dispPrime(ll n){
    long long num = 1e6;
    bool prime[num+num+num];
    memset(prime,true,sizeof(prime));
    for(int i=2;i*i<num+num+num;i++){
        if(prime[i]){
            for(int j=i*2;j<num+num+num;j+=i){
                //cout<<"i: "<<i<<"j: "<<j<<"\n";
                prime[j] = false;
            }
        }
    }
    ll k = 2;
    ll cnt = 0;
    //ll upto = 2e6; //for summing prime upto certain number
    //ll tot = 0;
    while(true){
        if(prime[k]){
            //tot += k;
            cnt++;
            cout<<k<<" ";
        }
        if(cnt==n){break;}
        //if(k>=upto){break;}
        k++;
    }
    //cout<<tot<<"\n";
}
void solve(){
}
    //#ifndef ONLINE_JUDGE
    //freopen("leapfrog_ch__sample_input.txt","r",stdin);
    //cout<<"Case #"<<cnt<<": "<<solve()<<"\n";
    //freopen("leapfrog_ch__sample_output.txt","w",stdout);
    //#endif
    

int main(){
    ll n;
    cin>>n;
    ll arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    ll ans = 0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(arr[i]!=arr[j] and arr[j]!=arr[k] and arr[i]!=arr[k]){
                    if(arr[i]+arr[j]>arr[k] and arr[i]+arr[k]>arr[j] and arr[j]+arr[k]>arr[i]){
                        //cout<<arr[i]<<" "<<arr[j]<<" "<<arr[k]<<"\n";
                        ans++;
                    }
                }
            }
        }
    }
    cout<<ans<<"\n";
    return 0;
}




Measured memory_bytes: 3680
import java.util.Scanner;

//20180510
//06

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

		String s = scanner.nextLine();
		String p = scanner.nextLine();
		scanner.close();

		String loop = s + s;

		if(loop.contains(p)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
    }
}


Measured memory_bytes: 26268
import itertools 
N, M, Q = map(int, input().split())
li = [list(map(int, input().split())) for _ in range(Q)]
ans= 0
AA = [i for i in range(1, M+1)]
A = []
for i in sorted(list(itertools.combinations_with_replacement(AA, N))):
    A.append(i)

for i in A:
    result = 0
    for j in range(Q):
        if i[li[j][1]-1]-i[li[j][0]-1] == li[j][2]:
            result += li[j][3]
    ans = max(ans, result)

print(ans)

Measured memory_bytes: 22340
l=list(input() for i in range(3))
tn =0
while len(l[tn])>0:
    if l[tn][0]=="a":
        l[tn]=l[tn][1:]
        tn=0
    elif l[tn][0]=="b":
        l[tn]=l[tn][1:]
        tn=1
    elif l[tn][0]=="c":
        l[tn]=l[tn][1:]
        tn=2
if tn==0:
    print("A")
elif tn==1:
    print("B")
elif tn==2:
    print("C")


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

using namespace std;
int N;
const int MAX_N = 100000;
long long a[MAX_N];

void solve() {
	int x = 0, y = 0;
	string ans = "No";
	for (int i = 0; i < N; i++) {
		if (a[i] % 4 == 0) {
			x++;
		}
		else if (a[i] % 2 == 0) {
			y++;
		}
	}

	if (x >= N / 2) {
		ans = "Yes";
	}
	else {
		for (int i = 0; i < N; i++) {
			if (x >= N / 2 - i && y >= N - x * 2) {
				ans = "Yes";
			}
		}
	}

	cout << ans << endl;
}

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

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n, m;
    cin >> n >> m;
    vector<ll> figure;
    vector<ll> pat;
    string s;
    auto line2hash = [] (string s) -> ll {
        ll res = 0;
        for(char c: s) {
            if (c == '#') res = res*2+1;
            else res = res*2;
        }
        return res;
    };
    for(int i = 0; i < n; i++) {
        cin >> s;
        figure.push_back(line2hash(s));
    }
    for(int i = 0; i < m; i++) {
        cin >> s;
        pat.push_back(line2hash(s));
    }
    ll mask = (1LL << m) - 1;
    for(int k = 0; k < n-m+1; k++) {
        for(int i = 0; i <= n-m; i++) {
            vector<ll> tmp;
            for(int j = 0; j < m; j++) {
                tmp.push_back((figure[i+j] >> k) & mask);
            }
            // cout << tmp.size() << endl;
            if (tmp == pat) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
N = int(input())
Dic = {}
for n in range(N):
    S = input()
    if S in Dic.keys():
        Dic[S] = Dic[S] + 1
    else:
        Dic[S] = 1

max_val = max(Dic.values())# 変数にmax()の値を代入.
max_k_list = [kv[0] for kv in Dic.items() if kv[1] == max_val]#変数を参照する形にする.
max_k_list = sorted(max_k_list)

#for t in max_k_list:　←小技2を用いない場合
   # print(t) ←小技2を用いない場合
print(*max_k_list, sep="\n") # 小技2

Measured memory_bytes: 34012
#include<iostream>
#include<math.h>
using namespace std;
#define N 105
int sum;
int n;
int a[N];
int main()
{
    ios::sync_with_stdio(false);
    while(cin>>n)
    {
        sum=0;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            sum+=a[i];
        }
        double avg=sum*1.0/n;
        double min_diff=100;
        int ans=-1;
        for(int i=0;i<n;i++)
        {
            double temp=fabs(avg-a[i]);
            if(min_diff>temp)
            {
                ans=i;
                min_diff=temp;
            }
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int n, m;

int main(int argc, char const* argv[])
{
    cin >> n >> m;
    ll ans = 1900 * m + 100 * (n - m);
    ans = ans * pow(2, m);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

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

int main(){
  int n, a, b;
  int i;
  int sum2 = 0;
  
  scanf("%d", &n);
  scanf("%d", &a);
  scanf("%d", &b);
  
  for(i = 1; i <= n; i++){
    int sum = sum_of(i);
    if(sum >= a && sum <= b)
      sum2 += i;
  }
  
  printf("%d\n", sum2);
  return 0;
}


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

count = 0

for i in L:
    for j in L:
        for k in L:
            if i < j < k:
                if (i + j) > k:
                    if (i + k) > j:
                        if (k + j) > i:
                            count += 1
print(count)

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

using namespace std;
using ll = long long int;
using pii = pair<int, int>;
using pil = pair<int, ll>;

int main() {
	int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;
	A--;
	B--;
	C--;
	D--;
	string S;
	cin >> S;
	bool is_jump = false;
	bool is_possible = true;
	for (int i = A + 1; i <= C - 1; i++)
	{
		if (S[i] == '#') {
			if (is_jump) {
				is_possible = false;
				break;
			}
			is_jump = true;
		}
		else
			is_jump = false;
	}
	is_jump = false;
	for (int i = B + 1; i <= D - 1; i++)
	{
		if (S[i] == '#') {
			if (is_jump) {
				is_possible = false;
				break;
			}
			is_jump = true;
		}
		else
			is_jump = false;
	}
	
	if (D < C) {
		is_possible = false;
		for (int i = B; i <= D; i++) {
			if (S[i] == '#')
				continue;
			if (S[i - 1] == '.' and S[i + 1] == '.') {
				is_possible = true;
				break;
			}
		}
	}

	string ans;
	if (is_possible)
		ans = "Yes";
	else
		ans = "No";
	cout << ans << endl;
	return 0;
}

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

using ll = long long;

#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (int)(a.size())
#define clr(a, b) memset(a, b, sizeof(a))
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REPD(i, a, b) for(int i=(int)(a)-1; i>=(int)(b); --i)

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 10000000+5;
ll a[N];

void pre() {
	// REP(i, 1, N) a[i] = 1;
	for(int i=1; i<N; ++i) {
		for(int j=i; j<N; j+=i) 
			++a[j];
	}
}

int f(int n) {
	return a[n];
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    pre();
    int n;
    cin >> n;
    ll res = 0;
    REP(i, 1, n+1) {
    	res += 1ll * i * f(i);
    }
    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 81776
#include <bits/stdc++.h>
using namespace std;
#define loop(x,n) for(int x = 0; x < n; ++x)
#define ed end()  
#define bg begin()
#define ft first
#define sc second
# define ld long double
#define ll long long
#define ub(v,a) upper_bound(all(v),a)
#define lb(v,a) lower_bound(all(v),a)
#define sz(a) (int)(a.size())
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define tr(v,it) for(auto it=v.begin();it!=v.end();it++)
#define present(v,x) (v.find(x)!=v.end()) //set/map etc.
#define vpresent(v,x) (find(all(v),x)!=v.end()) // vector
#define M_PI 3.14159265358979323846
#define bs(v,x) binary_search(all(v),x)
typedef vector< int > vi;
typedef vector< long long > vll;
typedef vector<pair<ll,ll>> vp;
typedef vector< vi > vvi;
typedef pair< int,int > pii;
const long long max_sz = 1e5 + 1;
const long long mod = 1e9 + 7;
char flip(char k){ if(k=='0') return '1'; return '0'; }
ll sum_digit(ll n){ ll a=0,i; for(i=n;i>0;i=i/10){ a+=(i%10);} return a; }
ll gcd(ll a, ll b){
	if(b == 0) return a;
	return gcd(b, a%b);
}
int main(){
                   // ios_base::sync_with_stdio(false);
                    //cin.tie(NULL);
                    //cout.tie(NULL);
 
                     ll t;
                   //  cin >> t;
                     t=1;
                     while (t--){
                        ll n,d;cin>>n>>d;
                        ll jhc=0;
                        for(ll i=0;i<n;i++){
                            ll x,y;cin>>x>>y;
                            if(x*x + y*y <=d*d)jhc++;
                        }
                      cout<<jhc<<endl;
                     }
                      return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
int dp[100000];
const int INF = 2147483647;

int main(){
  int n,k;cin>>n>>k;
  int h[100000];
  REP(i,100000) dp[i]=INF;
  REP(i,n) cin>>h[i];
  REP(i,n){
    if(i==0) dp[0]=0;
    for(int j=1;j<=k;j++) if(i+j<n) dp[i+j]=min(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
  }

  cout<<dp[n-1];
}

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

int main(){
	int ans=0;
	int num=0;
	int n;	cin>>n;

	char ch;
	for(int i=0;i<n;i++){
		cin>>ch;
		if(ch=='I')num++;
		else num--;

		if(num>ans)ans=num;
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <tuple>
#include <algorithm>
#include <array>
using namespace std;
using ll = long long;
#define rep(i,n) for(decltype(n) i=0; i<n; ++i)
#define revrep(i,n) for(decltype(n) i=n-1; n>=0; --i)
inline constexpr ll Inf = (1ULL << 62) -1;

template <class T>
void updatemax(T& a, T b) { if (b > a) a = b; }

int main() {
    ll ans=0;
    string N;
    cin >> N;
    for (auto c : N) {
        ans += c - '0';
        ans %= 9;
    }
    cout << ((ans==0)?"Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 3484
def ceil(x, y):
    if x % y == 0:
        return x//y
    else:
        return (x//y) + 1


def solve(n):
    prev_t, prev_a = -1, -1
    for _ in range(n):
        t, a = map(int, input().split())
        x = 1
        if t < prev_t or a < prev_a:
            div_t = ceil(prev_t, t)
            div_a = ceil(prev_a, a)
            if t < prev_t and a < prev_a:
                x = max(div_t, div_a)
            elif t < prev_t:
                x = div_t
            else:
                x = div_a
        prev_t, prev_a = t*x, a*x

    return prev_t+prev_a


if __name__ == '__main__':
    n = int(input())
    print(solve(n))


Measured memory_bytes: 3064
from collections import deque

def main():
    N = int(input())
    A = deque(sorted((int(input()) for i in range(N))))
    dq = deque()
    dq.append(A.popleft())
    for _ in range(N-1):
        a_first = A[0]
        a_last = A[-1]
        dq_first = dq[0]
        dq_last = dq[-1]

        ff = abs(a_first-dq_first)
        fl = abs(a_first-dq_last)
        lf = abs(a_last-dq_first)
        ll = abs(a_last-dq_last)

        comp_list = [ff, fl, lf, ll]
        max_idx = comp_list.index(max(comp_list))
        if max_idx == 0:
            dq.appendleft(A.popleft())
        elif max_idx == 1:
            dq.append(A.popleft())
        elif max_idx == 2:
            dq.appendleft(A.pop())
        else:
            dq.append(A.pop())

    abs_sum = sum([abs(dq[i] - dq[i-1]) for i in range(1, N)])
    print(abs_sum)
if __name__ == "__main__":
    main()

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

int main() {
	int a, b;
	cin >> a >> b;
	int ans = 1;
	cout << ans + (a - b) << endl;
}

Measured memory_bytes: 256
//Link : https://atcoder.jp/contests/arc073/tasks/arc073_a

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 200005

void solve() {
  int n,T;scanf("%d %d ", &n,&T);
  ll ret = 0;
  int ed = 0;
  for(int i=0;i<n;++i) {
    int x;scanf("%d ", &x);
    if(i==0) {
      ed = T;
      ret = T;
    } else {
      if(ed<=x) {
        ed = x+ T;
        ret += T;
      } else {
        ret += x + T - ed;
        ed = x + T;
      }
    }
  }
  printf("%lld\n", ret);
}

int main() {
    //freopen("input.txt","r",stdin);
    solve();
    return 0;
}


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

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

    int n,k;    cin>>n>>k;
    int arr[n+1];

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

    int dp[n+1];
    dp[0]=0;
    dp[1]=0;
    for(int i=2;i<=n;i++){
        dp[i]=INT_MAX;
        for(int j=1;j<=k;j++){
            if(i-j>=1){
                dp[i]=min(dp[i], dp[i-j] + abs(arr[i]-arr[i-j]));
            }
        }
    }

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


Measured memory_bytes: 1152
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

N,K = inpl()
aa = inpl()
bitmax = 40
bitcnt = [0]*bitmax

for a in aa:
    for b in range(bitmax):
        if (a>>b) & 1 :
            bitcnt[b] += 1

X = 0
for b in reversed(range(bitmax)):
    if bitcnt[b] < N/2:
        X += 1<<b
    if X > K:
        X -= 1<<b

ans = 0
for a in aa:
    ans += a^X
print(ans)


Measured memory_bytes: 15976
#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.141592653289793;
using namespace std;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
#define lld long double
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> vp;
typedef vector<tuple<ll, ll, ll>> vt;
//vector<vector<ll>> vv(n, vector<ll>(n));

int main()
{
	int n, k;
	cin >> n >> k;
	int ans = 1;
	REP(i, n) {
		if (ans < k) ans *= 2;
		else ans += k;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main() { 
    char b;
    cin >> b;
    char ans;
    if(b == 'A'){
        ans = 'T';
    }
    else if(b=='T'){
        ans = 'A';
    }
    else if(b=='C'){
        ans = 'G';
    }
    else if(b=='G'){
        ans = 'C';
    }
    cout <<ans << endl;
}


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

int main(){
    int k,a,b;
    cin >> k >> a >> b;
    for(int i=a;i<=b;i++){
        if(i%k==0){
            cout << "OK" << endl;;
            return 0;
        }
    }
    cout << "NG" << endl;

}

Measured memory_bytes: 3636
// Problem : B - Judge Status Summary
// Contest : AtCoder - AtCoder Beginner Contest 173
// URL : https://atcoder.jp/contests/abc173/tasks/abc173_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll power(ll x,ll y,ll m){if(y==0)return 1;ll p=power(x,y/2,m)%m;p=(p*p)%m;return (y%2==0)?p:(x*p)%m;}
ll nCr(ll n,ll r,ll m){if(r>n)return 0;ll a=1,b=1,i;for(i=0;i<r;i++){a=(a*n)%m;--n;}while(r){b=(b*r)%m;--r;}return (a*power(b,m-2,m))%m;}
#define Test int t;cin>>t;while(t--)
#define endl '\n'
void solve()
{
	int n;
	cin >> n;
	map<string,int> mp;
	for(int i=0;i<n;++i)
	{
		string s;
		cin >> s;
		mp[s]++;
	}
	cout << "AC x " << mp["AC"] << endl; 
	cout << "WA x " << mp["WA"] << endl;	
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//Test
	solve();
	return 0;
}


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

void solve(long long N, long long M){
    ll n, m;
    if(N < 2) n = 1;
    else n = N - 2;
    if(M < 2) m = 1;
    else m = M - 2;
    cout << n * m << endl;
    return;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    solve(N, M);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    unsigned long int sum=0,i;
    for(i=0;i<s.size();i++)
        sum+=s[i]-'0';
    if(sum%9==0)
        cout<<"Yes"<<endl;
    else
        cout<< "No"<<endl;
    return 0;
}


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

int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);

  string s;
  cin >> s;
  int ans = 0;
  for (size_t i = 0; i < s.size(); ++i) {
    if (s[i] != '/') {
      ans = ans * 10 + s[i] - '0';
    }
  }
  if (ans <= 20190430) {
    cout << "Heisei\n";
  } else {
    cout << "TBD\n";
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const ll Mod = 998244353;
const int MAX = 510000;
const double PI = 3.14159265358979;
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};

int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i=0; i<N; i++) cin >> A[i];
  vector<ll> sum(N); // 累積和
  sum[0] = A[0];
  for (int i=1; i<N; i++) sum[i] = sum[i-1]+A[i];
  map<ll, ll> dict; // sumに登場する数字と登場回数
  for (int i=0; i<N; i++) {
    if (dict.count(sum[i])) dict[sum[i]]++;
    else dict[sum[i]] = 1;
  }
  ll res = 0;
  for (auto p: dict) {
    auto key = p.first;
    auto value = p.second;
    res += value*(value-1)/2;
    if (key==0) res += value;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <random>
#include <complex>
#include <assert.h>

using namespace std;
typedef long long ll;

template<typename T>
inline bool chmin(T& x, T a) {
	if (x >= a) { x = a; return true; }
	return false;
}

template<typename T>
inline bool chmax(T& x, T a) {
	if (x <= a) { x = a; return true; }
	return false;
}

int main() {
	int L; cin >> L;
	double ans = L * L * L;
	ans /= 27;
	cout << setprecision(18) << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
int t;
  cin>>t;
  int a[101];
  for(int i=1;i<=t;i++)
  {
    cin>>a[i];
  }
for(int i=1;i<=t;i++)
  {
    if(a[i]%2==0 && a[i]%3!=0 && a[i]%5!=0 )
    {
     cout<<"DENIED";
  return 0;
    }
  }
  cout<<"APPROVED";
  return 0;
}


Measured memory_bytes: 256
import sys
#import time
from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
import heapq
#import math
import itertools
import numpy as np
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))

n = ri()
a = []
b = []
for i in range(n):
    x,y = rl()
    a.append(x+y)
    b.append(x-y)
a.sort()
b.sort()
print(max(a[-1]-a[0], b[-1]-b[0]))

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int f(ll v) {
  int cnt = 0;
  while (v > 0) {
    cnt++;
    v /= 10;
  }
  return cnt;
}

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

  int ans = INF;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) ans = min(ans, max(f(i), f(n / i)));
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
a1, a2, a3 = list(map(int, input().split()))
v1 = abs(a1 - a2) + abs(a2 - a3)
v2 = abs(a1 - a3) + abs(a2 - a3)
v3 = abs(a2 - a1) + abs(a1 - a3)
v4 = abs(a2 - a3) + abs(a3 - a1)
v5 = abs(a3 - a1) + abs(a1 - a2)
v6 = abs(a3 - a2) + abs(a2 - a1)
print(min(v1, v2, v3, v4, v5, v6))



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

void test()
{
    int n;
    cin >> n;
    vector<int> v(n), B(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
        B[i] = v[i] - i - 1;
    }
    sort(B.begin(), B.end());
    int med = 0;
    if (n % 2 != 0)
    {
        med = B[n / 2];
    }
    else
        med = (B[n / 2] + B[n / 2 - 1]) / 2;
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        sum += abs(v[i] - (med + i + 1));
    }
    cout << sum << endl;
}
int32_t main()
{

    int t = 1;
    // cin >> t;
    while (t--)
    {
        test();
    }

    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <cmath>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int ans;
int D, G;
int p[15], c[15];

int solve() {
	int ans = 10000;
	for (int i = 0; i < 0x1<<D; i++) {
		int cnt = 0;
		int s = 0;
		for (int j = 0; j < D; j++) {
			if ( (i>>j) & 0x1 ) {
				cnt += p[j] + 1;
				s += c[j];
			}
		}
		int j = D - 1;
		while ( s < G && j >= 0) {
			if ( ((i>>j) & 0x1) == 0 ) {
				int base = 100 * (j+1);
				int remain = G - s;
				s += min(p[j], (int)ceil(remain/base)) * base;
				cnt += min(p[j], (int)ceil(remain/base));
			}
			j--;
		}
		if (s >= G ) ans = min(ans, cnt);
	}
	return ans;
}

int main(void) {
    scanf("%d %d", &D, &G);
    REP(i, 0, D) {
    	int px, cx;
    	scanf("%d %d", &px, &cx);
    	p[i] = px - 1; //全問正解は無視
    	c[i] = cx + 100 * (i+1) * px; //全問した場合の点数
    }
    
    printf("%d\n", solve());

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <iomanip>
using namespace std;
int main(void){
    // Your code here!
    int cnt;
    double avg, deviation2;
    
    while(1){
        cin >> cnt;
        double sum =0;
        double deviation1 = 0;
        double num[cnt];
        if(cnt==0) break;
        
        for(int i=0; i<cnt; i++){
            cin >> num[i];
            sum += num[i];
        }
        avg = sum/cnt;
        
        for(int i=0; i<cnt; i++){
            deviation1 += pow(num[i] - avg, 2.0);
        }
        deviation2 = deviation1/cnt;
        cout << fixed << setprecision(8) << sqrt(deviation2)  << endl;
    }
    return 0;
}



Measured memory_bytes: 3284
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n];
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
			b[i] = Integer.parseInt(sc.next());
		}
		for (int i = 0; i < n; i++) {
			c[i] = Integer.parseInt(sc.next());
			d[i] = Integer.parseInt(sc.next());
		}
		int count = 0;
		for (int i = 0; i < n; i++) {
			int min = Integer.MAX_VALUE;
			int index = 0;
			for (int j = 0; j < n; j++) {
				if (c[j] < min) {
					min = c[j];
					index = j;
				}
			}
			c[index] = Integer.MAX_VALUE;
			int mi = -1;
			int in = 0;
			for (int j = 0; j < n; j++) {
				if (a[j] < min && b[j] < d[index] && b[j] > mi) {
					mi = b[j];
					in = j;
				}
			}
			if (mi != -1) {
				count++;
				a[in] = Integer.MAX_VALUE;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 23636
#include <iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>

using namespace std;

int main(){
    
    string S;
    cin >> S;
    
    vector<int> vec(2,0);
    
    for(int i=0;i<S.size();i++){
        vec[S[i]-'0']++;
    }
    
    int ans = min(vec[0],vec[1]) * 2;
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define dl double long
const int INF=0x3fffffff;
const ll MOD=1000000007;
const ll MODD=998244353;
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }

int main()
{
  ll A, B, C, D, TtoA, AtoT;
  cin >> A >> B >> C >> D;
  TtoA = C/B; if(C%B != 0) ++TtoA;
  AtoT = A/D; if(A%D != 0) ++AtoT;
  (TtoA <= AtoT) ? cout << "Yes" << "\n" : cout << "No" << "\n";
}


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

int main()
{
  char N[3];
  cin >> N;

  if(N[0]==N[2]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main(){
  int N,K;
  cin >> N >> K;
  int H[N];
  for(int i=0;i<N;i++){ cin >> H[i]; }
  int dp[N] = {0};
  for(int i=1;i<N;i++){ dp[i] = INT_MAX; }
  
  for(int i=0;i<N-1;i++){
    for(int d=1;d<=K && i+d<N;d++){
      dp[i+d] = min(dp[i+d], dp[i]+abs(H[i+d]-H[i]));
    }
  }
  
  cout << dp[N-1];
}


Measured memory_bytes: 1024
n = int(input())
a = [int(input())for _ in range(n)]
ans = 0
num = 1
for i in range(n + 1):
  ans += 1
  if a[num - 1] == 2:
    break
  else:
    num = a[num - 1]
  if i == n:
    ans = -1
print(ans)

Measured memory_bytes: 7084
#include <bits/stdc++.h>
#define ll long long
#define inf 10000000
#define mod 30000000
#define omarshagar                    \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
using namespace std;

int main()
{
   int n;
   cin>>n;
   map<pair<int,int>,int>mapi;
   for(int i=1;i<=n;i++)
   {
       int x=log10(i);
      // cout<<x;
       int xx=pow(10,x);
      // cout<<xx<<endl;
      // cout<<i%10<<" "<<(int)(i/xx)<<endl;
       mapi[{(int)(i%10),(int)(i/xx)}]++;
   }
   ll res=0;
   for(int i=0;i<10;i++)
   {
       for(int ii=0;ii<10;ii++)
       {
           res+=mapi[{i,ii}]*mapi[{ii,i}];
       }
   }

   cout<<res<<endl;
    return 0;
}
/*












 */

Measured memory_bytes: 512
#include <iostream>
using namespace std;
long long K,N;
int main(){
	cin>>K>>N;
	long long arr[N];
	long long diffm;
	for(int i=0; i<N; i++){
		cin>>arr[i];
		if(!(i==0)){
			if(i==1){
				diffm=arr[1]-arr[0];
			}else if(arr[i]-arr[i-1]>diffm){
				diffm=arr[i]-arr[i-1];
			}
		}
	}
	if((K-arr[N-1])+arr[0]>diffm){
		diffm=(K-arr[N-1])+arr[0];
	}
	cout<<K-diffm<<'\n';
}

Measured memory_bytes: 1792
import java.util.*;
public class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
  Map<Integer,Integer>map=new HashMap<>();
  for(int i=0;i<n;i++){
    int po=sc.nextInt();
  if(map.containsKey(po)){
    map.put(po,map.get(po)+1);
  }
    else map.put(po,1);
  }
  ArrayList<Integer>a=new ArrayList<>();
  for(Integer i:map.keySet())a.add(i);
  Collections.sort(a);
  int count=a.size()-1;
  int x=0,y=0;
  while(count!=-1){
    if(map.get(a.get(count)).compareTo(2)>=0){
    x=a.get(count);
      map.put(a.get(count),map.get(a.get(count))-2);
      break;
    }
    else count--;
  }
  while(count!=-1){
    if(map.get(a.get(count)).compareTo(2)>=0){
    y=a.get(count);
      map.put(a.get(count),map.get(a.get(count))-2);
      break;
    }
    else count--;
  }
  System.out.println((long)x*y);
}
}


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

int main() {
  string S; cin >> S;
  string S2 = "CODEFESTIVAL2016";
  int ans = 0;
  for (int i = 0; i < 16; i++) if (S[i] != S2[i]) ans++;
  cout << ans << endl;
  return 0;
}

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

int n, c;
int beat[31];
int yuta[31];
int memo[31][1 << 16];


int dp(int index,int bit){
  if(index == n) return 0;
  if(memo[index][bit]) return memo[index][bit];
  
  int ans = 0;
  for(int i=0;i<c;i++){
    ans = max(ans,dp(index+1,(bit & ~yuta[i]) | beat[index+1]) + __builtin_popcount(bit & yuta[i]));
  }
  return memo[index][bit] = ans;
}


int main()
{
  while(cin >> n >> c, n || c){
    memset(beat, 0, sizeof(beat));
    memset(yuta, 0, sizeof(yuta));
    for(int i = 0; i < n; i++){
      for(int j = 0; j < 16; j++){
	int a; cin >> a;
	beat[i] |= (a << j);
      }
    }
    for(int i = 0; i < c; i++){
      for(int j = 0; j < 16; j++){
	int b; cin >> b;
	yuta[i] |= (b << j);
      }
    }
    memset(memo, 0, sizeof(memo));
    cout << dp(0, beat[0]) << endl;
  }
}

Measured memory_bytes: 9108
def main():
    N, M = map(int, input().split())

    dict = {}
    for _ in range(M):
        p, s = input().split()
        if not p in dict:
            if s == "AC":
                dict[p] = [1, 0]
            elif s == "WA":
                dict[p] = [0, 1]
        else:
            if dict[p][0] == 0:
                if s == "AC":
                    dict[p][0] = 1
                elif s == "WA":
                    dict[p][1] += 1

    ac = 0
    wa = 0
    for k, v in dict.items():
        if v[0] == 1:
            ac += v[0]
            wa += v[1]

    print(ac, wa)

if __name__ == '__main__':
    main()


Measured memory_bytes: 25264
from collections import  deque
import sys
import bisect
import math
import itertools
from queue import deque
from math import gcd

INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())
 
def inp_list(): return list(map(int, sys.stdin.readline().split()))

def lcm(x, y): return (x * y) // gcd(x, y)

R = inp()
print(math.pi * 2 * R)



Measured memory_bytes: 9948
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i + 100*j + 50*k == x:
                ans+=1
print(ans)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] num = new int[1001];
    for (int i = 2; i <= N; i++) {
      int tmp = i;
      for (int j = 2; j <= tmp; j++) {
        while (tmp % j == 0) {
          num[j]++;
          tmp /= j;
        }
      }
    }
    long ans = 1;
    for (int i = 2; i <= 1000; i++) {
      ans *= num[i] + 1;
      ans = ans % 1000000007;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
/*
Till the roof comes off, till the lights go out
Till my legs give out, can’t shut my mouth.
Till the smoke clears out. Am I high? Perhaps
I'ma rip this shit till my bones collapse.
*/
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <stack>
#include <string.h>
#include <map>
#include <vector>
#include <queue>
#include <math.h>
#include <stack>
#include <complex>


#define f first
#define s second
#define ll long long
#define sz(v)      ((int)((v).size()))
#define X real()
#define Y imag()
#define angle(a)                (atan2((a).imag(), (a).real()))
#define vec(a,b)                ((b)-(a))
#define same(p1,p2)             (dp(vec(p1,p2),vec(p1,p2)) < EPS)
#define dp(a,b)                 ( (conj(a)*(b)).real() )	// a*b cos(T), if zero -> prep
#define cp(a,b)                 ( (conj(a)*(b)).imag() )	// a*b sin(T), if zero -> parllel
#define len(a)               (hypot((a).imag(), (a).real()))
#define normalize(a)            (a)/length(a)

using namespace std;

typedef pair<int,ll>ii;
typedef pair<ii,int>node;
typedef complex<double>point;


const int N=2005;
const int M=101;
const double EPS = 1e-9;
const int INF =1e9;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
double getDist(point a,point b){return sqrt((a.X-b.X)*(a.X-b.X)+(a.Y-b.Y)*(a.Y-b.Y));}
int dcmp(double x, double y) {return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1;}

ll mod=1000000007;
ll power(ll base,int p){
  if(!p)return 1;
  ll ret=power(base,p/2);
  ret*=ret;
  ret%=mod;
  if(p&1)ret*=base,ret%=mod;
  return ret;
}
ll modInverse(int a){
  return power(a,mod-2);
}

int n;
ll dp[4][4][60];
string s1,s2;
ll solve(int a,int b,int idx){
  if(idx>n)return 0;
  if(idx==n)return 1;
  if(dp[a][b][idx]!=-1)return dp[a][b][idx];
  ll ret=0;
  if(s1[idx]==s2[idx]){
     for(int i=0;i<3;i++){
        if(i==a||i==b)continue;
        ret+=solve(i,i,idx+1);
        ret%=mod;
     }
  }
  else{
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            if(i==j||i==a||j==b)continue;
            ret+=solve(i,j,idx+2);
            ret%=mod;
        }
    }
  }
  return dp[a][b][idx]=ret;
}
int main()
{
    //freopen("test.in","r",stdin);
    // freopen("test.out","w",stdout);
    scanf("%d",&n);
    cin>>s1>>s2;
    memset(dp,-1,sizeof(dp));
    cout<<solve(3,3,0);
  return 0;
}

/*
100% reason to Remember THE NAME
*/


Measured memory_bytes: 256