akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int,int>;
using vi = std::vector<int>;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

ll N;

vector<ll> prime(ll n){
    vector<ll> primes;
    vector<bool> p(n+1,true);
    p[0] = p[1] = false;
    for(ll i=2;i<=n;i++){
        if(!p[i]) continue;
        if(p[i]) primes.push_back(i);
        for(ll j=2;i*j<=n;j++) p[i*j]=false;
    }
    return primes;
}

int main(){
    cin >> N;

    auto ps = prime(N);
    vector<ll> f(N+1,1);

    for(auto& v : ps){
        for(ll i=1;v*i<=N;i++){
            ll K = v*i;
            ll cnt = 0;
            while(K%v==0){
                cnt++;
                K/=v;
            }
            f[i*v] *= cnt+1;
        }
    }

    ll ans = 0;
    for(ll k=1;k<=N;k++){
        ans += k * f[k];
    }
    cout << ans << endl;
}


Measured memory_bytes: 86532
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
using namespace std;

signed main()
{
	int N, W;
	cin >> N >> W;
	//int w[100];
	//int v[100];
	vector<int> v[4];
	int w0;
	for (int i = 0; i < N; i++)
	{
		int ww;
		int vv;
		cin >> ww >> vv;
		if (i == 0) w0 = ww;
		int d = ww - w0;
		v[d].push_back(vv);
	}

	RSORT(v[0]);
	RSORT(v[1]);
	RSORT(v[2]);
	RSORT(v[3]);

	int max_v = 0;
	for (int i = 0; i <= v[0].size(); i++)
	{
		for (int j = 0; j <= v[1].size(); j++)
		{
			for (int k = 0; k <= v[2].size(); k++)
			{
				int w_sum = i * w0 + j * (w0 + 1) + k * (w0 + 2);
				if (W >= w_sum)
				{
					int l = MIN(v[3].size(), (W - w_sum) / (w0 + 3));
					int v_sum = 0;
					for (int m = 0; m < i; m++) v_sum += v[0][m];
					for (int m = 0; m < j; m++) v_sum += v[1][m];
					for (int m = 0; m < k; m++) v_sum += v[2][m];
					for (int m = 0; m < l; m++) v_sum += v[3][m];
					max_v = MAX(v_sum, max_v);
				}
			}
		}
	}
	cout << max_v << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cctype>

int main(){
  char str; //文字列は最後に終端文字
  int alp[26] = {0};

  while ( scanf("%c",&str) != EOF ){ 
    /*while (1) {
        scanf("%c",&str);
        if ( str == EOF ) break; 
      ではあかんみたい 書き方が*/
    for ( int j = 0; j < 26; j++ ) {
      if ( str == 'a' + j || str == 'A' + j ) {
        alp[j]++;
      }
    }
  }
  for ( int i = 0; i < 26; i++ ) {
    printf ("%c : %d\n",'a' + i,alp[i]);
  }

} 


Measured memory_bytes: 2620
#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 double long double
#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 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 X,Y,Z,ans=0;
  cin>>X>>Y>>Z;
  vector<tuple<ll,ll,ll>> L;
  ll A[X+Y+Z],B[X+Y+Z],C[X+Y+Z];
  REP(i,X+Y+Z){
    cin>>A[i]>>B[i]>>C[i];
    ans+=A[i];
    B[i]-=A[i];
    C[i]-=A[i];
    L.emplace_back(C[i]-B[i],B[i],C[i]);
  }
  
  priority_queue<ll> QB;
  ll MXB[X+Y+Z+1],MXC[X+Y+Z+1],a=0;
  REP(i,X+Y+Z+1){
    MXB[i]=0;
    MXC[i]=0;
  }
  
  SORT(L);
  
  REP(i,Y){
    QB.push(get<1>(L.at(i))*(-1));
    a-=get<1>(L.at(i));
  }
  MXB[Y-1]=a*(-1);
  for(int i=Y; i<X+Y; ++i){
    QB.push(get<1>(L.at(i))*(-1));
    a-=get<1>(L.at(i));
    a-=QB.top();
    QB.pop();
    MXB[i]=a*(-1);
  }
  
  priority_queue<ll> QC;
  a=0;
  
  REVERSE(L);
  REP(i,Z){
    QC.push(get<2>(L.at(i))*(-1));
    a-=get<2>(L.at(i));
  }
  MXC[X+Y-1]=a*(-1);
  for(int i=Z+1; i<=X+Z; ++i){
    QC.push(get<2>(L.at(i-1))*(-1));
    a-=get<2>(L.at(i-1));
    a-=QC.top();
    QC.pop();
    MXC[X+Y+Z-1-i]=a*(-1);
  }
  
  ll T=INF*(-1);
  for(int i=Y-1; i<X+Y; ++i){
    chmax(T,MXB[i]+MXC[i]);
  }
  
  co(ans+T);
  return 0;
}

Measured memory_bytes: 8304
#include<stdio.h>

int main(){
    
    int a, b, d, r;
    double f;
    
    scanf("%d %d", &a, &b);
    
    d = a / b;
    r = a % b;
    f = (double)a / b;
    
    printf("%d %d %.6f\n", d, r, f);
    
    return 0;
}


Measured memory_bytes: 2760
from itertools import combinations_with_replacement
n,m,q = map(int, input().split())
abcd = []
for _ in range(q):
  a,b,c,d = map(int, input().split())
  abcd.append([a,b,c,d])

nums = list(range(1,m+1))
l = list(combinations_with_replacement(nums, n))

ans = 0
for i in l:
  p = 0
  for j in abcd:
    b = i[j[1]-1]
    a = i[j[0]-1]
    if b - a == j[2]:
      p += j[3]
  ans = max(ans, p)
  
print(ans)

Measured memory_bytes: 21640
n,m = map(int,input().split())
M = [0]*m
for i in range(n):
    K = list(map(int,input().split()))
    for j in range(1,K[0]+1):
        M[K[j] - 1] += 1

cnt = 0
for i in range(m):
    if M[i] >= n:
        cnt += 1
print(cnt)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
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 (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string s;
cin >> s;
string ans = "None";
rep(i,26){
    char c = 'a' + i;
    auto it=find(s.begin(), s.end(), c);
    auto d = distance(s.begin(), it);
    if(d>=s.size()){
        ans = c;
        break;
    }
}
cout << ans << endl;
//system("pause");
return 0;
}

Measured memory_bytes: 512
K , N = list(map(int, input().split()))
a = list(map(int, input().split()))
x = 0
t = (a[0]-a[N-1])%K
for i in range(N-1):
 if a[i+1]-a[i]>x:
  x = a[i+1]-a[i]
if x < t:
 x = t
y = K -x
print(y)

Measured memory_bytes: 25452
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String[] splitArray = S.split("");
    String kekka = "Good"; 
    
    for(int i=0;i<splitArray.length-1;i++){
      if(splitArray[i].equals(splitArray[i+1])){
        kekka = "Bad";
      }
    }
    
    System.out.println(kekka);
  }



}

Measured memory_bytes: 22740
# https://atcoder.jp/contests/abc118/tasks/abc118_b

N, M = map(int, input().split())

ans = {}

for _ in range(N):
    K, *A = list(map(int, input().split()))
    for a in A:
        if a in ans:
            ans[a] += 1
        else:
            ans[a] = 1

count = 0
for k, v in ans.items():
    if v == N:
        count += 1

print(count)


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

bool is_prime(ll x) { //素数判定
    if (x<=1) return false;
    for(ll i=2; i*i<=x; i++) 
        if (x%i==0) return false;
    return true;
}

int main() {
    ll n,mini=10000000000000,a,b,k;
    cin>>n;
    if (is_prime(n)) cout<<n-1<<endl;
    else {
        vector<ll> ret;
        for (ll i=1; i*i<=n; i++) {
            if (n%i==0) {
               ret.push_back(i);
               if (i*i!=n) ret.push_back(n/i);
            }
        }
        sort(ret.begin(),ret.end());
        if (ret.size()%2!=0) k=ret.size()/2+1;
        else k=ret.size()/2;
        for (ll i=0; i<k; i++) {
            a=ret[i];
            b=ret[ret.size()-i-1];
            mini=min(mini,a+b-2);
        }
        cout<<mini<<endl;
    }
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(void){
	vector<int> a(3);
	int i,k;
	cin>>a[0]>>a[1]>>a[2];
	cin>>k;
	for(i=0;i<k;i++){
		sort(a.begin(),a.end());
		a[2]*=2;
	}
	cout<<(a[0]+a[1]+a[2]);
	return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};

 
int main(){
  int n;
  cin >> n;
  for(int i=n; i<=999; i++){
    string s = to_string(i);
    if(s[0]==s[1] && s[1]==s[2]){
      cout << s << endl;
      return 0;
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
using namespace std;
 
void output(int H[3][10]){
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
            printf(" %d",H[i][j]);
        }
        printf("\n");
    }
}
 
 
int main(){
    int H1[3][10],H2[3][10],H3[3][10],H4[3][10],n,h_num,f_num,r_num,div_num;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
            H1[i][j] = H2[i][j] = H3[i][j] = H4[i][j] = 0;
        }
    }
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%d %d %d %d",&h_num,&f_num,&r_num,&div_num);
        switch(h_num){
        case 1:
            H1[f_num-1][r_num-1] += div_num;
            break;
        case 2:
            H2[f_num-1][r_num-1] += div_num;
            break;
        case 3:
            H3[f_num-1][r_num-1] += div_num;
            break;
        case 4:
            H4[f_num-1][r_num-1] += div_num;
            break;
        }
    }
 
    output(H1);
    printf("####################\n");
    output(H2);
    printf("####################\n");
    output(H3);
    printf("####################\n");
    output(H4);
 

} 


Measured memory_bytes: 2644
//For fast competitive programming

//INCLUDE
#include <bits/stdc++.h>
#include <algorithm>  
using namespace std;

//DATA_TYPES
typedef long long ll; 
typedef vector<int> vi;
typedef pair<int, int> ii; 
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f; //Infinity

//INITIALISING
//memset(arr, 0, sizeof arr);
//vi v(N, 0);

int main()
{
	std::ios_base::sync_with_stdio(0);
	std::cin.tie(NULL);
	ll ans=0;
	//write your code here
	int t;
	cin>>t;
	for(int z=1;z<=t;z++)
	for(int y=1;y<=t;y++)
	for(int x=1;x<=t;x++)
     ans =ans+ __gcd(z,(__gcd(y,x)));

cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>
typedef long long ll;
using namespace std;


int main() {
    char s[1000000];
    char a[26] = {0};
    scanf("%s", s);

    for (int i = 0; s[i] != '\0'; i++) a[s[i] - 'a']++;
    for (int i = 0; i < 26; i++) {
        if (a[i] == 0) {
            printf("%c\n", char(i + 'a'));
            return 0;
        }
    }
    cout << "None" << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

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

  int max_s=0, s=0;
  for (int i = 1; i < N; i++){
    if (H[i-1] >= H[i]) s++;
    else if(max_s < s){
      max_s = s;
      s = 0;
    }else{
      s = 0;
    }
  }
  max_s = max(max_s, s);
  printf("%d\n", max_s);
  
}


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

using ll = long long;

const int MAXN = 1.1e5;
int N, V, P; ll M;

ll A[MAXN];
ll pref[MAXN];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N >> M >> V >> P;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A, A + N);
	reverse(A, A + N);
	pref[0] = 0;
	for (int i = 0; i < N; i++) {
		pref[i+1] = pref[i] + A[i];
	}

	int ans = P; // the first P are guaranteed
	for (int i = P; i < N; i++) {
		ll nExtra = max(V-P - (N-1-i), 0);
		if ((A[i] + M >= A[P-1]) && ((A[i] + M) * (i - (P-1)) >= (pref[i] - pref[P-1]) + M * nExtra)) {
			ans++;
		}
	}
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next(); //Input String
    int N = s.length(); //Size of the input string    
    //Case 1: 101010101010
    int caseoneanswer = 0;
    int casetwoanswer = 0;
    for(int i = 1; i<=N; i++){
      if(i%2 == 1 && s.charAt(i-1) == '0'){
        caseoneanswer++; 
      } else if(i%2 == 1) {
    	  casetwoanswer++;
      }
      if(i%2 == 0 && s.charAt(i-1) == '1'){
        caseoneanswer++; 
      } else if(i%2 == 0) {
    	  casetwoanswer++;
      }
    }
    System.out.println(Math.min(caseoneanswer, casetwoanswer));
  }
}


Measured memory_bytes: 30296
function Main(input){
    const lines = input.trim().split("\n");
    const s = lines[0];
    const t = lines[1];

    if (s === t.substring(0, t.length - 1)) {
        console.log("Yes");
    } else {
        console.log("No");
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 30024
k = int(input())
cnt = 0
mod = [0]
not_found = 1
while cnt<k+1:
    cnt+=1
    n = mod[-1]*10+7
    mod.append(n%k)
    if n % k == 0:
        not_found = 0
        print(cnt)
        break
if(not_found):
    print(-1)


Measured memory_bytes: 48656
{-# LANGUAGE OverloadedStrings #-}
import Data.Maybe
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector.Unboxed as VU

main :: IO()
main = do
  xs <- getLine
  ys <- getLine
  print . length . filter id $ zipWith (==) xs ys

-- IO
readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt

getInt :: IO Int
getInt = readInt <$> BS.getLine

getIntList :: IO [Int]
getIntList = unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

getIntVec :: Int -> IO (VU.Vector Int)
getIntVec n = VU.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine


Measured memory_bytes: 380
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
typedef pair<int,int> P;
int cnt[100010][32]={{0}};
int main(){
	int n,c;
	cin>>n>>c;
	lol(i,n){
		int x,y;
		cin>>x>>y>>c;
		for(int i=x;i<=y;i++)cnt[i][c]++;
	}
	int ans=0;
	lol(i,100010){
		int a=0;
		lol(j,32)if(cnt[i][j]>0)a++;
		ans=max(ans,a);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 12800
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
sc = []
for i in range(n):
    sc.append(input())
ob = set(sc)
m = ii()
disc = []
for i in range(m):
    disc.append(input())

score = 0
for i in ob:
    score = max(score,sc.count(i)-disc.count(i))
print(score)

Measured memory_bytes: 3064
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7;
void solve(){
    string a, b, c;
    cin >> a >> b >> c;
    if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) {
        cout << "YES";
    }
    else cout << "NO";
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] boxes = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            boxes[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] contents = new int[n + 1];
        for (int i = 0; i < q; i++) {
            int type = sc.nextInt();
            int apple = sc.nextInt();
            int count = sc.nextInt();
            if (type == 1) {
                contents[apple] += count;
                if (contents[apple] > boxes[apple]) {
                    System.out.println(apple);
                    return;
                }
            } else if (type == 2) {
                contents[apple] -= count;
                if (contents[apple] < 0) {
                    System.out.println(apple);
                    return;
                }
            }
        }
        System.out.println(0);
    }
}



Measured memory_bytes: 100060
#include<stdio.h>
#include<string.h>
#include<stdlib.h>


int main(void){
	char in[1026],o[80]={""};
	char t,*p;
	int ii,i,l,a,b,f,c,e,n;
	char s[9][6]={".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};

	

	scanf("%d",&n);
	f=-1;
	for(ii=0;ii<n;ii++){
		scanf("%s",in);
		t='0';
		c=0;
//for(i=0;i<9;i++)printf("%s\n",s[i]);

for(i=0;(unsigned int)i<strlen(in);i++){
			if(t=='0' && in[i]=='0')continue;
			else if(t!='0' && in[i]=='0'){
				f=atoi(&t);
				//printf("atoi=%d\n",f);
				//o[strlen(o)]=s[f-1][(c-1)%strlen(s[f-1])];
//printf("atoi=%d\nc=%d\n",f,(c-1)%strlen(s[f-1]));
				printf("%c",s[f-1][(c-1)%strlen(s[f-1])]);
				t='0';
				c=0;
				//f=-1;
				continue;
				}
			//else if(in[i]==t || (t=='0' && in[i]!='0')){
			else if(in[i]!='0'){
				t=in[i];
				c++;
				//if(f==-1)f=atoi(&t);
				continue;
			}
		}
		//printf("%s\n",o);
		printf("%s\n",o);
		//for(i=0;o[i]!=NULL;i++)o[i]=NULL;
		for(i=0;in[i]!=NULL;i++)in[i]=NULL;
	}
	
	return 0;
}
	

Measured memory_bytes: 0
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int c1, c2, c3;
    while (scanf("%d%d%d", &c1, &c2, &c3) != EOF) {
        int a = 0, b = 0;
        rep (i, 10) if (i+1 != c1 && i+1 != c2 && i+1 != c3) {
            if (c1+c2+i+1 <= 20) a++; else b++;
        }
        puts(a >= b ? "YES" : "NO");
    }
    return 0;
}

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

using namespace std;
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using D = double;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;

#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
#define rep(i, x)  for(int i = 0; i < (x); i++)
#define rrep(i, x) for(int i = (x - 1); i >= 0; i--)
#define sqrt(x) sqrt(abs(x))
#define y1 y1_1234413
#define j1 j1_235
#define y0 y0_235
#define j0 j0_256
#define fi first
#define se second
#define re return
#define prev PREV
#define next NEXT
#define sz(x) ((int)x.size())

template<typename T> T sqr(T a) { re a * a; }
template<typename T> T gcd(T a, T b) { re b ? gcd(b, a % b) : a; }
template<typename T> T sgn(T a) { re a > 0 ? 1 : (a < 0 ? -1 : 0); }
template<typename T> T abs(T a) { re a > 0 ? a : -a; }

const int inf = 2e9;
const ld st = 0.000001;
const ld pi = acos((ld)-1);
const int MAXN = 100000;
const int mod = 1e9 + 7;


#define FILENAME ""


int main() {
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    //  freopen(FILENAME ".in", "r", stdin);
    //  freopen(FILENAME ".out", "w", stdout);
    ll n;
    cin >> n;
    vector <ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll ans = 0;
    ll k = 0;
    for (int i = 0; i < n - 1; i++) {
        if (a[i] >= a[i + 1]) ++k;
        else {
            ans = max(ans, k);
            k = 0;
        }
    }
    ans = max(ans, k);
    cout << ans;
    return 0;
}

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


int main() {
  int N, x; cin >> N >> x;
  vector<int> a(N);
  rep(i, N) cin >> a[i];
  
  int ans = 0;
  sort(a.begin(), a.end());
  
  rep(i, N) {
    x -= a[i];
    if(x>=0) ans++;
    else break;
  }
  if(x>0) ans--;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,a[222222];
vector<long long> v;
map<int,int> mp;
long long maxn=0;
int powerup(int n)
{
	int s=1;
	while(true)
	{
		s*=2;
		if(s>n)
		  break;
	}
	return s;
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		mp[a[i]]++;
		if(a[i]>maxn)
		  maxn=a[i];
    }
    long long s=1,ans=0;
	sort(a,a+n);
	for(int i=n-1;i>=0;i--)
	{
		if(mp[a[i]]<=0)continue;
		int x=a[i];
		int y=powerup(x)-x;
		if(mp[y]){
			mp[x]--;
			mp[y]--;
			if(mp[y]>=0)
			ans++;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 20608
use std::io;

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let s1:Vec<char> = buf.trim().chars().collect();
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let s2:Vec<char> = buf.trim().chars().collect();
	let mut flag = true;
	for i in 0..3 {
		if s1[i] != s2[2-i] {
			flag = false;
			break;
		}
	}
	if flag {
		println!("YES");
	}else{
		println!("NO");
	}
}

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<pi> vpi;
typedef vector<bool> vbool;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define forall(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define F0(i,n) for(ll i = 0; i < n; i++)
#define F1(i,n) for(ll i = 1; i <= n; i++)
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define per(i,a,b) for(int i = b-1; i >= a; i--)
#define FIN ios::sync_with_stdio(false);cin.tie(0);
#define db(x) cout<<#x<<" = "<<x<<"\n"
#define all(v) v.begin(),v.end()
#define modulo(a,b) ((a%b)+b)%b
#define F first
#define S second
#define INF 1000000010
#define INFLL 1000000000000000000
#define eps 0.000000000001
#define mod 1000000007
template<class C> void mini(C&a, C b){ a=min(a, b);}
template<class C> void maxi(C&a, C b){a=max(a,b);}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

//=======================//

vvi adj;
set<int> comps;
vbool visited;
void dfs(int a, int c) {
    if (visited[a]) return;
    visited[a] = true;
    int p = c==-1 ? a : c;
    comps.insert(p);
    for(auto b : adj[a]) {
        dfs(b, p);
    }
}

int main () {
	//FIN
    int n,m; cin >> n >> m;
    adj = vvi(n);
    F0(i,m) {
        int a,b; cin >> a >> b;
        a--; b--;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    visited = vbool(n,0);
    for(int i = 0; i < n; i++) {
        dfs(i, -1);
    }
    cout << comps.size() - 1 << "\n";
	return 0;
}










Measured memory_bytes: 10388
import queue
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
ans = float('inf')
q = queue.Queue()
vals = [[float('inf')]*w for _ in range(h)]
vals[0][0] = 0
q.put([0, 0])

while not q.empty():
    a = q.get()
    for i, j in ((1, 0), (0, 1)):
        x, y = a[0]+i, a[1]+j
        if 0 <= x < h and 0 <= y < w:
            if s[x][y] == '#' and s[a[0]][a[1]] == '.':
                if vals[x][y] > vals[a[0]][a[1]]+1:
                    vals[x][y] = vals[a[0]][a[1]]+1
                    q.put([x, y])
            elif vals[x][y] > vals[a[0]][a[1]]:
                vals[x][y] = vals[a[0]][a[1]]
                q.put([x, y])
ans = vals[-1][-1]
if s[0][0] == '#':
    ans += 1

print(ans)


Measured memory_bytes: 9808
//arc067_b.cpp
//Sun Jan  5 13:04:11 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	ll ans = 0;
	ll x[n];
	for (int i=0;i<n;i++){
		cin >> x[i];
		if (i>0){
			if ((x[i]-x[i-1])*a > b){
				ans+=b;
			}else {
				ans+=(x[i]-x[i-1])*a;
			}
		}
	}



	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 1024
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

ab = sorted(x+y for x in a for y in b)[:-k-1:-1]
abc = sorted(x+y for x in ab[:k] for y in c)[:-k-1:-1]
print(*abc, sep='\n')

Measured memory_bytes: 160508
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <stdio.h>
using namespace std;

int main(){
    int a;
    string str;
    cin>>a>>str;
    if(a>=3200){
        cout<<str;
    }else{
        cout<<"red";
    }
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    int i = 1;
    for (; i * (i + 1) / 2 < n; i++) {
    }
    if (i * (i + 1) / 2 > n) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    int a[i + 1][i];
    int b = 1;
    for (int j = 0; j < i; j++) {
        for (int k = 0; k <= j; k++) {
            a[j + 1][k] = a[k][j] = b++;
        }
    }
    cout << i + 1 << endl;
    for (int j = 0; j <= i; j++) {
        cout << i;
        for (int k = 0; k < i; k++) {
            cout << ' ' << a[j][k];
        }
        cout << '\n';
    }
    return 0;
}


Measured memory_bytes: 2176
from operator import lt, gt


def hoge(a, K, op):
    from collections import deque
    dq = deque()
    pop, popleft, append = dq.pop, dq.popleft, dq.append

    for i, v in zip(range(K), a):
        while dq and not op(a[dq[-1]], v):
            pop()
        append(i)

    yield a[dq[0]]

    for i in range(K, len(a)):
        while dq and not op(a[dq[-1]], a[i]):
            pop()
        append(i)
        if dq[0] == i-K:
            popleft()
        yield a[dq[0]]


N, K = map(int, input().split())
a = tuple(map(int, input().split()))

inv_flag = [0]*N

for i, (x, y) in enumerate(zip(a, a[1:]), start=1):
    inv_flag[i] = i if x > y else inv_flag[i-1]

min_coro = hoge(a, K, lt)
max_coro = hoge(a, K, gt)

prev_min, prev_max = next(min_coro), next(max_coro)
ans, flag = inv_flag[K-1] != 0, inv_flag[K-1] == 0

for l, r, x, y in zip(range(1, N), range(K, N), min_coro, max_coro):
    if inv_flag[l] == inv_flag[r]:
        flag = 1
    elif not (prev_min < x and prev_max < y):
        ans += 1

    prev_min, prev_max = x, y

print(ans + flag)


Measured memory_bytes: 25000
//#pragma optimization_level 3
#include <bits/stdc++.h>
#define  f               first
#define  s               second
#define  sym(s)          s = "#" + s + "#";
#define  all(x)          (x).begin(), (x).end()
#define  alll(x,n)       x+1, x+n+1
#define  newl            cout<<"\n";
#define  foo(i,a,n)      for(ll i = (a); i <= n; i++)
#define  deb1(a)         cout<<a<<"\n";
#define  deb2(a,b)       cout<<a<<" "<<b<<"\n";
#define  deb3(a,b,c)     cout<<a<<" "<<b<<" "<<c<<"\n";
#define  deb4(a,b,c,d)   cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
#define  debp(a)         cout<<a.f<<" "<<a.s<<"\n";
#define  debv(a)         for(auto it: a)cout<<it<<" ";newl;
#define  debm(a)         for(auto it: a)cout<<"{"<<it.f<<","<<it.s<<"}, ";newl;
#define  deb1d(a,n)      foo(i,1,n)cout<<a[i]<<" ";newl;
#define  deb2d(a,n,m)    foo(i,1,n){foo(j,1,m){cout<<a[i][j]<<" ";}newl;}

using namespace std;
using ll              =  long long;
using ld              =  long double;
const ll   MOD        =  1e+9 + 7;
const ll   INF        =  LLONG_MAX;
const int  N          =  (int)2e+5 + 8;

ll n, a[N]; 
ll x, t;

void MAIN(int tc){
    cin>>n>>x>>t;
    cout<<(ll)ceil((ld)n/x) * t;
}

int main(){
    ios:: sync_with_stdio(false); 
    cin.tie(nullptr); cout.tie(nullptr);
    cout<<fixed; cout<<setprecision(10);

    int test_cases = 1;
    //cin>>test_cases;
    for(int i = 1; i <= test_cases; i++){
        MAIN(i);
    }
}

Measured memory_bytes: 3612
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input()) - 1
    res = []
    while 1:
        res.append(chr(ord('a') + n % 26))
        n = n // 26 - 1
        if n == -1:
            break

    res.reverse()
    print(''.join(res))
resolve()

Measured memory_bytes: 61792
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
   

   string s;
   cin>>s;

   int n = s.length();

   if(s[n-1] == 's')
   {
       s = s + "es";
       cout<<s<<endl;
   }
   else
   {
       s = s+ "s";
       cout<<s<<endl;
   }
}


Measured memory_bytes: 3600
N = int(input())
W = list(map(int,input().split()))
T = 0
w = sum(W)
v = w / 2

for i in range(len(W)):
    if w - W[i] > v:
        w = w - W[i]
        T += 1
    else:
        break
x = abs(sum(W[:T]) - sum(W[T:]))
y = abs(sum(W[:T+1]) - sum(W[T+1:]))
if x < y:
    print(x)
else:
    print(y)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll a[100010];
map<ll,ll>b;
int main() {
	ll n,k;
	cin>>n>>k;
	for(ll i=1;i<=n;i++){
		cin>>a[i];
	}
	for(ll i=2;i<=n;i++){
		a[i]=a[i]+a[i-1];
	}
	for(ll i=0;i<=n;i++){
		a[i]=a[i]%k;
	}
	for(ll i=0;i<=n;i++){
		b[a[i]]++;
	}
	ll ans=0;
	for(auto itr=b.begin();itr!=b.end();itr++){
		ll key=itr->first;
		ll val=itr->second;
		//if(key==0){
		//	ans+=val*(val+1)/2;
		//}
		//else{
			ans+=(val-1)*val/2;
		//}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

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

#define ll long long
#define ld long double

#define pii pair<int, int>
#define pci pair<char, int>
#define pcc pair<char, char>

#define vi vector <int>
#define vll vector<long long>
#define vld vector<long double>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>

#define vvi vector<vi>
#define vvll vector<vll>
#define vvld vector<vld>
#define vvb vector<vb>
#define vvc vector<vc>
#define vvs vector<vs>

#define vpii vector<pii>
#define vpci vector<pci>
#define vpcc vector<pcc>

#define all(v) (v).begin(), (v).end()
#define allrev(v) (v).rbegin(), (v).rend()
#define allcomp(v) (v).begin(), (v).end(), comp
#define allrevcomp(v) (v).rbegin(), (v).rend(), comp

const int MOD = 1e9 + 7;
const ld pi = 3.1415926535897932384626433832;

#define line cout<<"\n";
#define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

void solve(int test_case){

    char a;
    cin >> a;
    if(a < 95)
        cout << "A";
    else cout << "a";

}

int main(){
    fast
    int test = 1;
    //cin>>test;
    for(int i = 1; i <= test; i++){
        solve(i);
    }
    return 0;
}


Measured memory_bytes: 3604
#include "bits/stdc++.h"
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    if(n==1){
        cout<<0<<endl;
        return 0;
    }
    vector<int>dp(n);
    dp[0]=0;
    dp[1]=abs(v[1]-v[0]);
    for(int i=2;i<n;i++){
        int x = dp[i-1]+abs(v[i-1]-v[i]);
        int y = dp[i-2]+abs(v[i]-v[i-2]);
        dp[i]=min(x,y);
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = 1234567;

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

int main(void){
	int d;
	cin>>d;
	cout<<"Christmas";
	rep(i, 25-d){
		cout<<" Eve";
	}
	cout<<endl;
	return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  
  if (a > 0 && b > 0) {
    cout << "Positive" << endl;
  } else if (a > 0 || b > 0) {
    cout << "Zero" << endl;
  } else {
    int diff = abs(b - a);
    cout << (diff & 1 ? "Positive" : "Negative") << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<utility>
#include<functional>
#include<stack>
#include<queue>
#include<cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef std::pair<int, int> int_pair;
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }


int main() {
	double a, b;
	cin >> a >> b;
	cout << a / b << endl;

}


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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; long long t; cin >> n >> t;
    vector<long long> a(n), b(n), c(n);
    for (int i = 0; i < n; i++) cin >> a[i] >> b[i], c[i] = i;
    auto cmp = [&](int i, int j) {
        return a[i] * (b[j] + 1) > a[j] * (b[i] + 1);
    };
    sort(c.begin(), c.end(), cmp);
    vector<long long> dp(33, t * 2 + 1);
    multiset<long long> ms; dp[0] = 0;
    for (int i = 0; i < n; i++) {
        if (a[c[i]] == 0) {
            ms.insert(b[c[i]]);
            continue;
        }
        for (int j = 31; j >= 0; j--) {
            if (dp[j] > t) continue;
            if ((a[c[i]] + 1) * (dp[j] + 1) + b[c[i]] <= t) {
                dp[j+1] = min(dp[j+1], (a[c[i]] + 1) * (dp[j] + 1) + b[c[i]]);
            } 
        }
    }
    vector<long long> v;
    long long curr = 0;
    v.emplace_back(curr);
    for (auto &x: ms) {
        curr += x + 1;
        v.emplace_back(curr);
    }
    int ans = 0;
    for (int i = 0; i < 32; i++) {
        if (t < dp[i]) continue;
        int x = upper_bound(v.begin(), v.end(), t-dp[i]) - v.begin();
        ans = max(ans, i + max(0, x-1));
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 16500
n = int(input())
t = [0] * n
x = [0] * n
y = [0] * n
for i in range(n):
    t[i], x[i], y[i] = map(int, input().split())

x_defo = 0
y_defo = 0
t_defo = 0
result = 0

for i in range(n):
    dt = t[i] - t_defo
    it = abs(x[i]-x_defo) + abs(y[i]-y_defo)
    if it > dt:
        result = 1
        break
    if it %2 != dt %2:
        result = 1
        break
    else:
        x_defo = x[i]
        y_defo = y[i]
        t_defo = t[i]

if result ==0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 17272
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String str = scan.next();

		scan.close();

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < str.length(); i++) {
			sb.append('x');
		}

		System.out.println(sb.toString());
	}

}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
//cout << fixed << setprecision(10);

int main () {
  ll n;
  cin >> n;
  
  vector<pll> p(n);
  rep(i,n) {
    ll x, l;
    cin >> x >> l;
    p[i] = pll(x+l, x-l);
  }
  sort(p.begin(), p.end());
  ll ans = 0, pos = -INFLL;
  rep(i,n) {
    if (pos <= p[i].se) {
      ans++;
      pos = p[i].fi;
    }
  }

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

Measured memory_bytes: 1792
/*
 * Author : Sadi
 * Mon 20/07/2020
 * 13:32:12.49
 */
#include <bits/stdc++.h>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    int n;
    cin >> n;
    unordered_map<string, int> umap;
    int maxCount = 0;
    for(int i = 0; i < n; ++i) {
        string str;
        cin >> str; 
        umap[str]++;
        maxCount = max(maxCount, umap[str]);
    }
    vector<string> v;
    for(auto it = umap.begin(); it != umap.end(); ++it) {
        if(it->se == maxCount) {
            v.push_back(it->fi);
        }
    }
    sort(v.begin(), v.end());
    for(auto s : v) {
        cout << s << "\n";
    }
    return 0;
}


Measured memory_bytes: 26996
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] h=new int[n];
    for(int i=0;i<n;i++){
      h[i]=sc.nextInt();
    }
    int ans=0;
    for(int i=100;i>0;i--){
      boolean living=false;
      for(int j=0;j<n;j++){
        if(h[j]==i){
          h[j]--;
          if(!living){
            living=true;
            ans++;
          }
        }else{
          living=false;
        }
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23124
N = int(input())

length = len(str(N))

ans = 0

if length % 2 == 1:
    ans += N - (10**(length-1)) + 1

for i in range(1, length+1, 2):
    if i == length:
        break
    ans += 10 ** i - (10**(i-1))



print(ans)


Measured memory_bytes: 2940
import java.io.*;

class Main{
	public static void main(String arg[]) throws IOException{
		String message;
		int n=0;
		int k=0;
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		message = br.readLine();
		String num[] = message.split(" ");
		message = br.readLine();
		String nagasa[] = message.split(" ");
		n = Integer.parseInt(num[0]);
		k = Integer.parseInt(num[1]);
		int numnum[] = new int[n];
		for(int i=0;i<n;i++){
			numnum[i] = Integer.parseInt(nagasa[i]);
		}
		int max=0;
		int nowmax=9999;
		int maxlong=0;
		int hantei = 0;
		for(int i=0;i<k;i++){
			for(int j=0;j<n;j++){
				if(numnum[j]>max && nowmax>=numnum[j]){
					max=numnum[j];
					hantei = j;
				}
			}
			maxlong += max;
			nowmax=max;
			numnum[hantei] = 0;
			hantei = 0;
			max=0;
		}
		System.out.println(""+maxlong);		
	}
}




Measured memory_bytes: 22484
import sys
import numpy as np
# inputを高速化する。
input = sys.stdin.readline
n, k = map(int, input().split())
h = [int(i) for i in input().split()]
# dpの配列を作る。
dp = np.zeros(n, dtype=int)
# hの配列を作る。
h = np.array(h)
for i in range(1, n):
    # start は負になることはない。
    start = max(0, i-k)
    # 行列として足し算できるのでforを使う必要がない。
    dp[i] = min(dp[start: i] + np.abs(h[i] - h[start: i]))
print(dp[n-1])

Measured memory_bytes: 38272
n, m = map(int, input().split())
food = [0]*m
for i in range(n):
    a = list(map(int, input().split()))
    for j in range(1, a[0]+1):
        food[a[j]-1] += 1
ans = 0
for i in range(m):
    if food[i] == n:
        ans += 1
print(ans)

Measured memory_bytes: 38256
from pprint import pprint
n, m = map(int, input().split())
ab = []
for i in range(m):
    a, b = map(int, input().split())
    ab.append((i, a, b))

rm = []
for i, a, b in sorted(ab, key=lambda x:x[2]):
    pre = ab[rm[-1]][2] - 1 if len(rm) else 0
    if a <= pre:
        continue
    else:
        rm.append(i)
print(len(rm))


Measured memory_bytes: 23524
'''
セグメント木
配列バージョン
'''

N, Q = map(int, input().split())
pn = 1
while pn < N:
    pn *= 2
N = pn
A = [0]*(2*N-1)


def add(x, y):
    n = N+x-1
    A[n] += y
    while n > 0:
        n = (n-1)//2
        A[n] += y


def getSum(k, x, y, s, t):
    '''
    範囲[x,y)
    区間[s,t)
    '''
    #print("sum ", x, y, s, t)
    # 交差しない
    if x >= t or y <= s:
        #print("no intersect", x, y, s, t)
        return 0
    # 範囲が区間を包含する
    if x <= s and t <= y:
        #print("intersect ", x, y, s, t)
        return A[k]

    # それ以外
    #print("other ", x, y, s, t)
    lv = getSum(2*k+1, x, y, s, (s+t)//2)
    rv = getSum(2*k+2, x, y, (s+t)//2, t)
    return lv+rv


for i in range(Q):
    com, x, y = map(int, input().split())
    if com == 0:
        add(x-1, y)
    else:
        print(getSum(0, x-1, y, 0, N))
    # print(A)



Measured memory_bytes: 10756
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;
#define LL long long
#define MOD 100000
#define inf 1999999999


int main() {
	LL a[10];
	char s;

	for (int i = 0; i < 19; i++) {
		char c;
		cin >> c;
		if (i == 5 || i == 13)cout << " ";
		else cout << c;
	}
	cout << endl;
	return 0;
}


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

const int MAX_PRIME = 200000;
vector<int> primes;
vector<bool> is_prime;
// 小さい素数(MAX_PRIMEまで)は先に用意しとく
void init_primes() {
  is_prime = vector<bool>(MAX_PRIME + 1, true);
  is_prime[0] = is_prime[1] = false;
  for (int i = 2; i <= MAX_PRIME; i++) {
    if (is_prime[i]) {
      primes.push_back(i);
      for (int j = i*2; j <= MAX_PRIME; j+=i) {
        is_prime[j] = false;
      }
    }
  }
}


int sum[100005];

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  init_primes();
  int q;cin>>q;

  for(int i=1;i<100005;i++){
    sum[i]+=sum[i-1];
    if(i%2==0)continue;
    if(is_prime[i]&&is_prime[ (i+1) / 2 ]){
      sum[i]++;
    }
  }
  while(q--){
    int l,r;cin>>l>>r;
    cout<<sum[r]-sum[l-1]<<endl;
  }

  return 0;
}


Measured memory_bytes: 1280
# include <iostream>
# include <algorithm>
# include <functional>
# define MAX 102

using namespace std;

int N, X;
int m[MAX];
int minv = 1000000000;
int ans = 0;

int main () {
    cin >> N >> X;
    for ( int i = 0; i < N; i++) {
        cin >> m[i];
        X -= m[i];
        ans ++;
        minv = min (minv, m[i]);
    }
    ans += X / minv;
    X -= ( X / minv) * minv;
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,dp[110][100006];
vector<pair<ll,ll>> v;
int main(){
  ll i,j,x,y,z,t;
  cin>>n>>k;
  for(i=0;i<n;i++){
    cin>>x>>y;
    v.push_back({x,y});
  }
  sort(v.begin(),v.end());
  for(i=0;i<=n;i++)
  for(j=0;j<=100000;j++)
  dp[i][j]=1e15;
  dp[0][0]=0;
  ll ans=0;
  for(i=1;i<=n;i++){
    for(j=0;j<=100000;j++){
      dp[i][j]=min(dp[i][j],dp[i-1][j]);
      if(dp[i-1][j]==1e15)
        continue;
      dp[i][j+v[i-1].second]=min(dp[i][j+v[i-1].second],dp[i-1][j]+v[i-1].first);
    }
  }
  for(i=0;i<100001;i++){
      if(dp[n][i]<=k)
      ans=max(ans,i);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 82492
from collections import Counter
from itertools import combinations
N = int(input())
S = [input() for _ in range(N)]
S = Counter([i[0] for i in S if i[0] in "MARCH"])
if len(S) < 3:
    print(0)
    exit()
count = 0
for x,y,z in combinations(S.keys(),3):
    count += S[x] * S[y] * S[z]
print(count)

Measured memory_bytes: 10880