akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);

int n,k;
cin>>n>>k;
string s;
cin>>s;

for(int i=0;i<n;i++)
{
  if(i==k-1)
  {
    cout<<static_cast<char>(tolower(s.at(i)));
  }
  else cout<<s.at(i);
}

return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define y0 yy
#define y1 Yy
#define yn YY
#include <assert.h>
#include <algorithm>
#include <vector>
using namespace std;

int n,m,a[305][305],pos[305],cnt[305],res=344;
bool f[305];

int main(){
    scanf("%d %d",&n,&m);
    for(int i=0;i<n;i++)for(int j=0;j<m;j++){
        scanf("%d",a[i]+j);
        a[i][j]--;
    }
    for(int i=0;i<m;i++){
        memset(cnt,0,sizeof cnt);
        int mx=0;
        for(int i=0;i<n;i++){
            cnt[a[i][pos[i]]]++;
            if(cnt[a[i][pos[i]]]>cnt[mx])mx=a[i][pos[i]];
        }
        res=min(res,cnt[mx]);
        f[mx]=true;
        for(int i=0;i<n;i++)while(pos[i]<m && f[a[i][pos[i]]])pos[i]++;
    }
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(),(v).end()
#define out(a) cout << (a) << endl
using namespace std;
using ll = long long;
int main(){
    int n, t;
    double a;
    cin >> n >> t >> a;
    double mini=5000000;
    int num=0;
    for(int i=0; i<n; i++){
        int h;
        cin >> h;
        double temp = t - 0.006 * h;
        if(mini > abs(a - temp)){
            mini = abs(a - temp);
            num = i+1;
        }
    }
    out(num);
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    char ch,ch1={'a','e','i','o','u'};
    ch=getchar();
    if(isupper(ch))
    {
        ch=tolower(ch);
    }
    if(ch=='a' || ch=='e' ||ch=='i' || ch=='o' || ch=='u')
    {
        printf("vowel\n");
    }
    else{
        printf("consonant\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>

using namespace std;

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  long long ans;
  if(c > a+b) {
    ans = a+b+b+1;
  }else {
    ans = c+b;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int a[n], b[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = n-1; i >= 0; i--) cin >> b[i];
    int dst = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] != b[i]) continue;
        while (dst < n && (a[dst] == a[i] || b[dst] == b[i])) dst++;
        if (dst == n) { cout << "No\n"; return 0; }
        swap(b[dst], b[i]);
        dst++;
    }
    cout << "Yes\n";
    for (int e : b) cout << e << " ";
    cout << endl;
}


Measured memory_bytes: 4760
//CODING ME ACCHHA KARNEKA HAI TERKO TO BAS PRACTICE KARTE REH
#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define aisort sort(a,a+n)
#define adsort sort(a,a+n,greater<ll>())
#define PI 2 * acos(0)

typedef pair<ll, ll> pii;
typedef pair<ll, pii> piii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef set<ll> Set;

const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}
    
//PRIME
    bool isPrime(ll n) { if (n <= 1)  return false; if (n <= 3)  return true;if (n%2 == 0 || n%3 == 0) return false; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } 




int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    double n;
   cin>>n;
   double res=6.28*n;
   cout << fixed << setprecision(2) << res;
}




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

#define ll long long

void solve() {
	int n;
	cin>>n;
	int k=n%10;
	if(k==3)
		cout<<"bon"<<"\n";
	else if(k==0 || k==1 || k==6 || k==8)
		cout<<"pon"<<"\n";
	else
		cout<<"hon"<<"\n";
}

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
































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

int main(){
    int n,m ;
    cin >> n >> m ;
    vector<vector<int>> a(n,vector<int>(m)) ;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++) cin >> a.at(i).at(j) ;
    }
    vector<int> b(m) ;
    for(int i=0;i<m;i++) cin >> b.at(i) ;
    for(int i=0;i<n;i++){
        int ans = 0 ;
        for(int j=0;j<m;j++) ans += a.at(i).at(j)*b.at(j) ;
        cout << ans << endl ;
    }
}


Measured memory_bytes: 3196
#include <iostream>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<queue>
#include<utility>

typedef long long ll;

#define rep0(i, n) for(int i=0; i < (int)(n); i++)
#define rep1(i, n) for(int i=1; i < (int)(n); i++)
#define rall(x) (x).rbegin(),(x).rend()
#define fill(x,y) memset(x,y,sizeof(x))
#define debug1(i) cout << i << '\n'
#define debug2(i,j) cout << i << j << '\n'

using namespace std;

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

int main() {
	int h, w;
	cin >> h >> w;
	char s[1000];
	queue<pair<int, int>>P;

	rep0(i, h) {
		cin >> s;
		rep0(j, w) {
			if (s[j] == '#') {
				P.push(make_pair(i, j));
				dis[i][j] = 1;
			}
		}
	}

	while (!P.empty()) {
		int x = P.front().first, y = P.front().second;
		P.pop();
		rep0(r, 4) {
			int tx = x + dx[r], ty = y + dy[r];
			if (tx < 0 || ty < 0 || tx >= h || ty >= w || dis[tx][ty]>0)continue;
			dis[tx][ty] = dis[x][y] + 1;
			P.push(make_pair(tx, ty));
		}
	}

	int ans = 0;
	rep0(i, h)rep0(j, w)if (ans < dis[i][j])ans = dis[i][j];
	cout << ans-1;
}

Measured memory_bytes: 12304
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"math"
	"os"
	"strconv"
)

var n = int(1e5) * 2

func main() {
	x := readInt()

	primes := make([]int, n+1)
	primes[0], primes[1] = -1, -1
	for i := 2; i < int(math.Sqrt(float64(n+1))); i++ {
		if primes[i] == -1 {
			continue
		}
		for j := i * 2; j < n+1; j++ {
			if j%i == 0 {
				primes[j] = -1
			}
		}
	}

	for i := x; i < n+1; i++ {
		if primes[i] == 0 {
			fmt.Println(i)
			return
		}
	}
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

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

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

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

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


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

int main() {
  int N, A, b, c;
  cin >> N;
  c = 0;
  
  for (int i = 0; i < N; i++) {
    cin >> A >> b;
    c = c + b - A + 1;
  }
  cout << c << endl;
}

Measured memory_bytes: 256
/********************************************************
  **░██████╗██╗░░░░░░█████╗░██╗░░░██╗██╗░█████╗░░██████╗░**
  **██╔════╝██║░░░░░██╔══██╗██║░░░██║██║██╔══██╗██╔════╝░**
  **╚█████╗░██║░░░░░███████║╚██╗░██╔╝██║██║░░╚═╝██║░░██╗░**
  **░╚═══██╗██║░░░░░██╔══██║░╚████╔╝░██║██║░░██╗██║░░╚██╗**
  **██████╔╝███████╗██║░░██║░░╚██╔╝░░██║╚█████╔╝╚██████╔╝**
  **╚═════╝░╚══════╝╚═╝░░╚═╝░░░╚═╝░░░╚═╝░╚════╝░░╚═════╝░**
  *********************************************************/

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


#define ll                          long long
#define ld                          long double

#define forn(i,n)                   for(int i=0;i<n;++i)
#define all(v)                      v.begin(), v.end()
#define rall(v)                     v.rbegin(),v.rend()
#define isSubstring(s1,s2)          s1.find(s2) != std::string::npos
	
#define pb                          push_back
#define pf                          push_front
#define mp                          make_pair
#define fr                          first
#define sc                          second

#define vpi                         vector<pair<int,int>>
#define vi                          vector<int>
#define sz(a)                       (int)a.size()

#define   endl                       "\n"
#define     nl                       cout<<"\n";
#define fastio                       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define  MN                           INT_MIN
#define  MX                           INT_MAX
#define int long long
bool isPrime(ll n){if(n<2)return false;for(ll x = 2;x*x <=n;x++){if(n%x == 0)return false;}return true;}
bool isPerfectSquare(long double x){long double sr=sqrt(x);return((sr-floor(sr))==0);}
int gcd(int a, int b){if(a==0)return b;if(b==0) return a;if(a==b)return a;if(a>b)return gcd(a-b,b);return gcd(a,b-a);}

int32_t main()
{
	string s;
	unordered_map<string,string> dp;
	dp["Sunny"] = "Cloudy";
	dp["Rainy"] = "Sunny";
	dp["Cloudy"] = "Rainy";
	cin >> s;
	cout << dp[s] << endl;
}

Measured memory_bytes: 3524
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e15+9
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int table[7][7] = {
	{ INF, 300, 500, 600, 700, 1350, 1650 },
	{ 6, INF, 350, 450, 600, 1150, 1500 },
	{ 13, 7, INF, 250, 400, 1000, 1350 },
	{ 18, 12, 5, INF, 250, 850, 1300 },
	{ 23, 17, 10, 5, INF, 600, 1150 },
	{ 43, 37, 30, 25, 20, INF, 500 },
	{ 58, 52, 45, 40, 35, 15, INF }
};

int dic, ric, h[10], m[10];

int main(){
	while (cin >> dic&&dic){
		cin >> h[0] >> m[0] >> ric >> h[1] >> m[1];
		dic--; ric--;
		int s = h[0] * 60 + m[0], e = h[1] * 60 + m[1];
		if ((s >= 17 * 60 + 30 && s <= 19 * 60 + 30)
			|| (e >= 17 * 60 + 30 && e <= 19 * 60 + 30)){
			if (table[ric][dic] <= 40){
				int num = table[dic][ric] / 2;
				if (num % 50 != 0){
					num += 25;
				}
				cout << num << endl;
			}
			else{
				cout << table[dic][ric] << endl;
			}
		}
		else{
			cout << table[dic][ric] << endl;
		}
	}
}

Measured memory_bytes: 1160
import itertools
N = 1
X = 1
while(True):
  N,X = map(int,input().split())
  if N == 0 and X == 0:
    break
  else:
    sum = 0
    for a,b,c in itertools.combinations(list(range(1,N+1)), 3):
      if a + b + c == X:
        sum += 1
    print(sum)


Measured memory_bytes: 5632
#include <stdio.h>
int main(void){
    long long n,m;
    scanf("%lld %lld",&n,&m);
    long long root;
    for(long long i=0;i<100000;i++){
        if(i*i<=m)root=i;
    }
    root++;
    long long a=0;
    for(long long i=1;i<root;i++){
        if((m%i)==0)a++;
    }
    long long y[a];
    a=0;
    for(long long i=1;i<root;i++){
        if((m%i)==0){
            y[a]=i;
            a++;
        }
    }
    long long b=0;
    for(long long i=0;i<a;i++){
        if(y[i]*n<=m)b=y[i];
    }
    for(long long i=a-1;i>=0;i--){
        if((m/y[i])*n<=m)b=(m/y[i]);
    }
    printf("%lld\n",b);
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int N,M;
int D[10000];
int P;
int ans=1000000000;
int sum;
int main()
{
	scanf("%d%d%d",&N,&M,&P);
	for(int i=0;i<M;i++){
		scanf("%d",&D[i]);
	}
	sort(D,D+M);
	for(int i=0;i<M;i++){
		if(D[i]>P)sum=min(D[i]-P,P-D[i]+N);
		else sum=min(P-D[i],D[i]-P+N);
		if(M==1)ans=sum;
		else if(M==2)sum+=min(D[1]-D[0],D[0]-D[1]+N);
		else sum+=min((D[i]-D[(i+1)%M]+N)%N,(D[(i-1+M)%M]-D[i]+N)%N);
		//printf("%d:%d\n",i,sum);
		ans=min(sum,ans);
	}		
	printf("%d\n",ans*100);
	return 0;
}

Measured memory_bytes: 1240
<?php

$result = array();
$score_list = array();
while(TRUE) {
	$line = trim(fgets(STDIN));

	list($ind, $score) = explode(',', $line);
	if ($ind == 0 && $score == 0) {
		break;
	}

	$result[$ind] = $score;
	$score_list[] = $score;
}

$score_list = array_unique($score_list);
rsort($score_list);
$order_list = array_flip($score_list);

while($i = trim(fgets(STDIN))) {
	$score = $result[$i];
	$order = $order_list[$score] + 1;
	echo $order . "\n";
}

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

int main()
{
  long N, A , B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;
  long n[5] = {A, B, C, D, E};
  sort(n, n+5);
  long a = n[0];
  long v = 4;
  if ( N%a != 0){
    v +=N/a +1;
  }
  else{
    v +=N/a;
  }
  cout << v <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pf printf
#define sf scanf
#define ff first
#define ss second
#define clr clear()
#define sz size()
#define pb push_back
#define mk make_pair
#define pi acos(-1)
#define inf 20000000000000000
#define mod 998244353
#define ull unsigned long long int
#define f(i,k,n) for(i=k;i<n;i++)
#define fr(i,n,k) for(i=n;i>=k;i--)
#define ent(a) scanf("%lld",&a)
#define ent2(a,b) scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a) memset(a,0,sizeof(a))
#define vec(v,s) vector<ll>v[s]
#define arr(a,s) ll a[s];
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
//knight and king//
int dr[]= {2,2,-2,-2,1,-1,1,-1};
int dc[]= {1,-1,1,-1,2,2,-2,-2};
int dr1[]= {0,0,1,1,1,-1,-1,-1};
int dc1[]= {1,-1,1,0,-1,0,1,-1};
int dr2[]= {0,0,1,-1};
int dc2[]= {1,-1,0,0};
////////////////////////////
using namespace std;
#define ma 200005


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll i,j,x,y,n,m,tc,x1,y1,x2,y2,k;
    while(cin>>n)
    {
        cout<<(n+1)/2<<endl;

    }
    return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int n;
    cin>>n;

    string s;
    cin>>s;

    if ( n >= 3200 )
    {
        cout<<s<<endl;
    }
    else
    {
        cout<<"red"<<endl;
    }
    

}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



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

int monthes[]={0,31,29,31,30,31,30,31,31,30,31,30,31};

std::string day[]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};

int main(void){
    int m,d,n;
    while(std::cin>>m>>d){
        if(m==0&&d==0) break;
        n=0;
        int i;
        for(i=1;i<m;i++) n+=monthes[i];
        n+=d;
        std::cout<<day[n%7]<<std::endl;
    }
    return 0;
}


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

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

const long long MOD = 1000000007;

int main(){
  string s;
  cin >> s;
  if(s=="ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;
}


Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include<map>
#include<vector>
#define int long long
using namespace std;
int a[123456], b[123456], c[123456], d[123456], e[123456];
signed main() {
	int n, k, ans = 0; cin >> n;
	for (int h = 1; h <= n; h++) {
		cin >> a[h];
	}sort(a + 1, a + n + 1);
	for (int h = 1; h <= n; h++) {
		cin >> b[h];
	}sort(b + 1, b + n + 1);
	for (int h = 1; h <= n; h++) {
		cin >> c[h];
	}sort(c + 1, c + n + 1);
	for (int h = 1; h <= n; h++) {
		int ok = 0, ng = n + 1, mid = 0;
		for (int i = 0; i < 600; i++) {
			mid = (ok + ng) / 2;
			if (ng - ok == 1) { d[h] = ok; break; }
			if (a[mid] >= b[h]) { ng = mid; }
			if (a[mid] < b[h]) { ok = mid; }
		}
		d[h] += d[h - 1];
	}
	for (int h = 1; h <= n; h++) {
		int ok = 0, ng = n + 1, mid = 0;
		for (int i = 0; i < 600; i++) {
			mid = (ok + ng) / 2;
			if (ng - ok == 1) { e[h] = d[ok]; break; }
			if (b[mid] >= c[h]) { ng = mid; }
			if (b[mid] < c[h]) { ok = mid; }
		}
		ans += e[h];
	}
	cout << ans << endl;
}

Measured memory_bytes: 4480
import sys
input = sys.stdin.buffer.readline
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

counter = Counter(A)
A_sum = sum(A)
for _ in range(Q):
    b, c = map(int, input().split())
    num_b = counter.get(b, 0)
    A_sum = A_sum + (c - b) * num_b
    del counter[b]
    counter[c] = counter.get(c, 0) + num_b
    print(A_sum)


Measured memory_bytes: 24528
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

s = input()
ans = 0
count = 0
for i in range(len(s)):
    if s[i] == 'R':
        count += 1
        ans = max(ans, count)
    else:
        count = 0
ans = max(ans, count)
print(ans)


Measured memory_bytes: 10220
N, Y = map(int, input().split())

for a in range(N+1):
    for b in range(N-a+1):
        c = N - a -b
        if 10000*a + 5000*b + 1000*c == Y:
            print(a, b, c)
            exit()
else:
    print(-1, -1, -1)

Measured memory_bytes: 9180
program main
  implicit none
  integer :: a, b, c
  logical :: judge
  read *, a, b, c

  if (a == b)  then
    judge = (a /= c)
  else if (a == c) then
    judge = (a /= b)
  else if (b == c) then
    judge = (a /= c)
  else
    judge = .false.
  end if
  if (judge) then
    print '(a)', 'Yes'
  else
    print '(a)', 'No'
  end if

end program

Measured memory_bytes: 256
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var nl = Console.ReadLine().Split(' ');
            var k = int.Parse(nl[0]);
            var x = int.Parse(nl[1]);
            var ans = (500 * k >= x) ? "Yes" : "No";
            Console.WriteLine(ans);
        }
    }
}

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

int main()
{
    ll n,f=-1e11,ma=-1e11,m=0,h;
    cin>>n;
    for(ll i=0;i<n;++i){
        cin>>h;
        if(f<h)ma=max(m,ma),m=0;
        else m++;
        f=h;
    }
    ma=max(m,ma);
    cout<<ma<<endl;
    return 0;
}

Measured memory_bytes: 256
use itertools_num::ItertoolsNum;
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
use std::cmp::max;
use std::iter;

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        k: usize,
        a: [usize; n],
        b: [usize; m],
    }
    let a: Vec<_> = iter::once(0)
        .chain(a.into_iter().cumsum().collect::<Vec<_>>())
        .collect();
    let b: Vec<_> = iter::once(0)
        .chain(b.into_iter().cumsum().collect::<Vec<_>>())
        .collect();

    let mut l = b.len() - 1;
    let mut ans = 0;
    for (i, ai) in a.into_iter().enumerate() {
        if ai > k {
            break;
        }
        for j in (0..=l).rev() {
            let bj = b[j];
            if ai + bj <= k {
                ans = max(ans, i + j);
                l = j;
                break;
            }
        }
    }
    println!("{}", ans);
}


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

using namespace std;
#define ll long long int


int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> a(m);int s = 0;
    for(auto& w:a) {cin >> w; s+=w;}
    if(n-s<0)cout<<-1<<endl;
    else cout<<(n-s)<<endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "No" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N; cin>>N;
    vector<ll> x(N);
    rep(i,N) cin>>x[i];
    vector<P> A;
    rep(i,N) A.emplace_back(x[i]-1,i);
    SORT(A);
    ll ind=0;
    vector<ll> ans(N*N,-1);
    rep(i,N){
        ll basho=A[i].first, num=A[i].second;
        if(ans[basho]!=-1) dame;
        ans[basho]=num+1;
        rep(j,num){
            while(ans[ind]!=-1) ++ind;
            if(ind>basho) dame;
            ans[ind]=num+1;
        }
    }
    ind=N*N-1;
    repr(i,N-1,0){
        ll basho=A[i].first, num=A[i].second;
        rep(j,N-num-1){
            while(ans[ind]!=-1) --ind;
            if(ind<basho) dame;
            ans[ind]=num+1;
        }
    }
    cout<< "Yes" <<"\n";
    for(auto x: ans){
        cout<< x <<" ";
    }
    cout<<"\n";


}
 
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------

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

#define ROOT (-1)
#define INV (-1)
#define INFTY INT_MAX
#define MAX_NODES 100

int prim(int n, int dist[][MAX_NODES]){
	int ans = 0; // problem answer
	bool vis[MAX_NODES];
	int cost[MAX_NODES];
	int pi[MAX_NODES];

	for(int i = 0; i < n; i++){
		vis[i] = false;
		cost[i] = INFTY;
	}

	cost[0] = 0;
	pi[0] = ROOT;

	while( true ){
		int mincost = INFTY;
		int nmin;

		for(int i = 0; i < n; i++){
			if( !vis[i] && mincost > cost[i] ){
				mincost = cost[i];
				nmin = i;
			}
		}

		// end
		if( mincost == INFTY ) break;

		vis[nmin] = true;

		for(int i = 0; i < n; i++){
			if( vis[i] || dist[nmin][i] == INV ) continue; // skip
			if( dist[nmin][i] < cost[i] ){
				cost[i] = dist[nmin][i];
				pi[i] = nmin;
			}
		}
	}

	// calc
	for(int i = 1; i < n; i++){
		ans += ( (cost[i] == INFTY ? 100 : cost[i]) - 100) / 100;
	}
	return ans;
}

int main(void){
	while( true ){
		int dist[MAX_NODES][MAX_NODES];
		int n;
		int m;

		cin >> n;
		if( n == 0 ) break;
		cin >> m;
		
		// init
		for(int i = 0; i < sizeof(dist)/sizeof(*dist); i++){
			for(int j = 0; j < sizeof(dist[i])/sizeof(*dist[i]); j++){
				dist[ i ][ j ] = INV;
			}
		}

		// input
		for(int i = 0; i < m; i++){
			int a, b, d;
			char dum;
			cin >> a >> dum >> b >> dum >> d;
			dist[a][b] = d;
			dist[b][a] = d;
		}

		// prim algorithm
		cout << prim(n, dist) << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define MP make_pair
#define F first
#define S second
#define inf 10000000000000
#define vll vector<ll>
using namespace std;
const int N=100005;
ll dp[N][15],P[N];
string s;
ll n;
ll f(ll idx,ll m)
{
	if(idx==-1)
	{
		if(m==5)
			return 1;
		return 0;
	}
	ll &ans=dp[idx][m];
	if(ans!=-1)
		return ans;
	ll i;
	if(s[idx]!='?')
	{
		i=(s[idx]-'0');
		ans=f(idx-1,(m+i*P[n-1-idx])%13)%mod;
	}
	else

	
	{
		ans=0;
		for(i=0;i<10;i++)
			ans=(ans+f(idx-1,(m+i*P[n-1-idx])%13))%mod;
	}
	return ans;
}
void solve()
{
	P[0]=1LL;
	for(ll i=1;i<N;i++)
		P[i]=(P[i-1]*10LL)%13;
	cin>>s;
	n=s.length();
	memset(dp,-1LL,sizeof dp);
	cout<<f(n-1,0);
	
}
 
int main() {
    
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
 
    
    return 0;
}

Measured memory_bytes: 19280
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000


a,b,c = map(int,input().split())
if a+b == c or a == b+c or b == a+c:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 5576
#include<stdio.h>
int main()
{
    int n,l,i;
    int min,sum=0;
    scanf("%d %d",&n,&l);
    int p[n];
    for(i=0; i<n; i++)
    {
        p[i]=l+i;
    }
    min=l;
    for(i=0; i<n; i++)
    {
        if(abs(p[i])<abs(min))
            min=p[i];
    }
    for(i=0; i<n; i++)
    {
        sum=sum+p[i];
    }
    printf("%d",sum-min);
    return 0;
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int N;
  cin >> N;
  
  int cnt = 0;
  int p;
  int ans = 0;
  for(int i = 1; i <= N; i++){
    cin >> p;
    if(p == i){
      cnt++;
    }else{
      ans += (cnt+1)/2;
      cnt = 0;
    }
  }

  ans+= (cnt+1)/2;

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


Measured memory_bytes: 256
using System;
using System.Linq;

namespace ABC105
{
    class C
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());

            var ans = "";
            if (N == 0) ans = "0";
            while (N != 0)
            {
                if (N % 2 != 0)
                {
                    N--;
                    ans = "1" + ans;
                }
                else
                {
                    ans = "0" + ans;
                }
                N /= -2;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
bool sob(P x1,P x2){return x1.second> x2.second;};
int main(){
  int n;
  cin >> n;
  int ans=0;
  vector <pair<int,int>> r(n);
  vector <pair <int,int>> b(n);
  int a[n];
  for(int i=0;i<n;i++){
    cin >> r[i].first>> r[i].second;
    a[i]=1;
  }
  for(int i=0;i<n;i++){
    cin >> b[i].first>>b[i].second;
  }
  sort(b.begin(),b.end());
  sort(r.begin(),r.end(),sob);
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
    if(a[j]==1){
    if(b[i].first>r[j].first&&b[i].second>r[j].second){
      ans++;
      a[j]=0;
      break;
    }
  }
  }
}
  cout <<ans <<endl;
}


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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  cout << min(a+b,min(a+c,b+c)) << endl;
  
  return 0;
}


Measured memory_bytes: 256
while(1):
    n=int(raw_input())
    if n==0: break
    A=[[0,0] for i in range(n)] 
    for i in range(n):
        [a,b]=map(int,raw_input().split())
        A[i]=[a,b]
    A.sort(key= lambda x: x[1])
    s=0
    for i in range(n):
        if s+A[i][0]>A[i][1]:
            print 'No'
            break
        else:
            s+=A[i][0]
    else:
        print 'Yes'

Measured memory_bytes: 6292
n = int(input())
a = [int(input()) for i in range(n)]
a_s = sorted(a, reverse=True)
hantei = a_s[:2]
del a_s
for i in range(n):
    if a[i] == hantei[0]:
        print(hantei[1])
    else:
        print(hantei[0])

Measured memory_bytes: 13340
w,h,n=[int(i) for i in input().split()]
leftdown=[0,0]
righttop=[w,h]


def minimize(leftdown,righttop,x,y,a):
    if a==1:
        leftdown[0]=min(max(x,leftdown[0]),righttop[0])
    elif a==2:
        righttop[0]=max(min(x,righttop[0]),leftdown[0])
    elif a==3:
        leftdown[1]=min(max(y,leftdown[1]),righttop[1])
    else:
        righttop[1]=max(min(y,righttop[1]),leftdown[1])
    
for i in range(n):
    x,y,a=[int(i) for i in input().split()]
    minimize(leftdown,righttop,x,y,a)
print(max(0,(righttop[0]-leftdown[0])*(righttop[1]-leftdown[1])))
    

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

bool search(const vector<int>& A, int m, int i){
    if (A[i] == m) return true;
    if (i > A.size() - 1) return false;
    return search(A, m, i + 1) || search(A, m - A[i], i + 1);
}

int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int m;
        cin >> m;
        if (search(A, m, 0)) {
            cout << "yes" << endl;
        } else {
            cout << "no"  << endl;
        }
    }

    return 0;
}

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

using namespace std;

int n, a[100005], b[100005];

int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    int ans = 0;
    int N = 1;
    for (int i = 1; i <= n; i++)
        if (a[i] > N && a[i] <= n) N = a[i];
    for (int i = 1; i <= n; i++)
        if (a[i] > n) ans++;
        else b[a[i]]++;
    for (int i = 1; i <= N; i++)
        if (b[i]!=0)
        {
            if (b[i] > i) ans += b[i] - i;
            if (b[i] < i) ans += b[i];
        }
    cout << ans;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int N, C, K; cin >> N >> C >> K;
	vector<int> T(N, 0);
	rep (i, N){
		cin >> T[i];
	} // end rep

	sort(ALL(T));
	vector<P> t(N);
	rep (i, N){
		t[i].first = T[i];
		t[i].second = T[i] + K;
	} // end rep

	queue<P> que;
	rep (i, N){
		que.push(t[i]);
	} // end rep

	int res = 0;
	int currC = 0;
	P curr = que.front(); que.pop();
	int finishT = curr.second;
	++currC;
	while(!que.empty()){
		P curr = que.front(); que.pop();
		if (curr.first > finishT || currC >= C){
			++res;
			finishT = curr.second;
			currC = 1;
		}else{
			++currC;
		} // end if
	} // end while

	if (currC != 0){
		++res;
	} // end if

	cout << res << endl;

	return 0;
}

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

const int Max_N = 1e5;

bool cmp(int x,int y){
	return x>y;	
}

void move_one(char *s,int n)
{
	char t = s[0];
	for(int i=1; i<n; ++i)
		s[i-1] = s[i];
	s[n-1] = t;
}

bool Equal(char *a,char *b)
{
	int length=strlen(a);
	for(int i=0; i<length; i++){
		if(a[i] != b[i])return false; 
	}	
	return true;
}
int main(){
	int N,a[Max_N + 5];
	int res = 0;
	cin>>N;
	for(int i=0; i<N; ++i){
		cin>>a[i];
		res += a[i];
	}

	cout<<res-N<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define ll long long
using namespace std;
int main()
{
    ll n;
    cin>>n;
    ll i,j,k,x,y;
    vector<pair<ll,ll>> vp;
    
    for(i=0;i<n;i++)
    {
        cin>>x>>y;
        vp.pb({x,y});
    }
    sort(vp.begin(),vp.end());
    map<pair<ll,ll>,ll> mp;
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            mp[{vp[j].fi-vp[i].fi, vp[j].se-vp[i].se}]++;
        }
    }
    
    ll mx=0,p,q;
    for(auto m :mp)
    {
        if(m.se>mx)
        {
            mx= m.se;
            p=m.fi.fi;
            q=m.fi.se;
        }
    }
    // cout<<p<<" "<<q<<endl;
    cout<<n-mx;
    return 0;
}


Measured memory_bytes: 384
# ABC080C - Shopping Street
import sys
input = sys.stdin.readline

from itertools import product

def main():
    N = int(input())
    F = tuple(tuple(map(int, input().split())) for _ in range(N))
    P = tuple(tuple(map(int, input().split())) for _ in range(N))
    ans = []
    for b in tuple(product((0, 1), repeat=10))[1:]:
        cnt = 0
        for f, p in zip(F, P):
            opening = sum(i & j for i, j in zip(b, f))
            cnt += p[opening]
        ans += [cnt]
    print(max(ans))


if __name__ == "__main__":
    main()

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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define mem(x,val) memset((x),(val),sizeof(x))
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define PI acos(-1.0) 
#define MAXN 11111

const int INF = 1 << 29 ;
typedef long long ll ;
typedef pair < int , int > pii ;

int a[3][111] , n ;

int dfs(int i , int j) {
    if(i>2 || j>n) return 0 ;

    return max(dfs(i , j+1) , dfs(i+1 ,j)) + a[i][j] ;
}

int main() {
    scanf("%d" ,&n) ;

    for(int i = 1 ;i<=2 ;i++) {
        for(int j = 1 ;j <=n ; j++) {
            scanf("%d" , &a[i][j]) ;
        }
    }
    printf("%d\n" , dfs(1 ,1)) ;
    return 0 ;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
//#include <fstream>	// require freopen
#include <complex>

using namespace std;

typedef complex <double> P;

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)

// OÏ (cross product) : a~b = |a||b|sinÆ
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.altair6vega", "r", stdin );
	int n;
	int i, j;
	vector <bool> res;

	cin >> n;

	for (i = 0; i < n; ++i){
		double x1, y1, x2, y2, x3, y3;
	
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		P a(x1, y1), b(x2, y2), c(x3, y3 );

		vector <P> p(2);
		for (j = 0; j < 2; ++j ){
			cin >> p[j].real() >> p[j].imag();
		} // end for

		vector <bool> in (2, false );

		for (j = 0; j < 2; ++j ){	
			if (  ( cross (p[j] - a, p[j] - b ) > 0. && cross (p[j] - b, p[j] - c ) > 0. && cross (p[j] - c , p[j] - a ) > 0. )
			||    ( cross (p[j] - a, p[j] - b ) < 0. && cross (p[j] - b, p[j] - c ) < 0. && cross (p[j] - c , p[j] - a ) < 0. ) ) {
				in[j] = true;
			}else{
				in[j] = false;
			} // end if
		} // end for
		if (in[0] ^ in[1] ){
			res.push_back (true );
		}else{
			res.push_back (false );
		} // end if
	} // end for

	for (i = 0; i < n; ++i){
		if (res[i] ){
			cout << "OK" << endl;
		}else{
			cout << "NG" << endl;
		} // end if
	} // end for
		
	return 0;
}

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


main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll d,t,s;cin>>d>>t>>s;
    if(s*t>=d){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
}

Measured memory_bytes: 3648
while True:
    N = int(raw_input())

    if N == 0:
        break

    ans, t = 0, 0

    for i in range(1, N):
        t = i
        for j in range(i+1, N):
            t += j
            if t == N:
                ans += 1
                break
            elif t > N:
                break

    print ans


Measured memory_bytes: 4672
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <functional>
#include <cassert>

using namespace std;

typedef long long ll;
typedef unsigned long ull;

mt19937_64 rnd(12334);

const int N = 1e6 + 7;
ull go[N];

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int n;
  cin >> n;
  vector <string> s(n);
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
  }
  sort(s.begin(), s.end(), [&] (string a, string b) {
    if (a.size() != b.size()) return a.size() < b.size();
    return a < b;
  });
  for (int i = 0; i < N; ++i) go[i] = rnd();
  unordered_map <ull, vector <int>> cnt;
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    string t = s[i];
    vector <int> cur(26);
    for (auto c : t) {
      ++cur[c - 'a'];
    }
    ull h = 0;
    for (int i = 0; i < (int)t.size(); ++i) {
      if (cnt.find(h) != cnt.end()) {
        auto &v = cnt[h];
        for (int j = 0; j < 26; ++j) {
          if (cur[j]) {
            ans += v[j];
          }
        }
      }
      h += go[i] * t[(int)t.size() - i - 1];
      --cur[t[(int)t.size() - i - 1] - 'a'];
    }
    h = 0;
    for (int i = 0; i + 1 < (int)t.size(); ++i) {
      h += go[i] * t[(int)t.size() - i - 1];
    }
    if (cnt.find(h) == cnt.end()) cnt[h] = vector <int> (26);
    ++cnt[h][t[0] - 'a'];
  }
  cout << ans << '\n';
}



Measured memory_bytes: 40996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 7;
const int MOD = 1e9 + 7;

int par[N], sz[N];
int val[N];
int fact[N];
vector<int> all[N];

int root(int v)
{
	return par[v] == -1 ? v : par[v] = root(par[v]);
}
void merge(int v, int u)
{
	v = root(v);
	u = root(u);
	if (v == u)
		return;
	par[v] = u;
	sz[u] += sz[v];
}

bool cmp(int a, int b)
{
	return val[a] < val[b];
}

int bpow(int a, int b)
{
	int res = 1;
	while (b)
	{
		if (b & 1)
			res = 1LL * res * a % MOD;
		a = 1LL * a * a % MOD;
		b >>= 1;
	}
	return res;
}

int main()
{
	ios::sync_with_stdio(false);

	fact[0] = 1;
	for (int i=1; i<N; i++)
		fact[i] = 1LL * i * fact[i-1] % MOD;
	for (int i=0; i<N; i++)
		sz[i] = 1, par[i] = -1;

	int n, A, B;
	cin >> n >> A >> B;
	for (int i=0; i<n; i++)
	{
		int c;
		cin >> c >> val[i];
		all[--c].push_back(i);
	}
	for (int i=0; i<N; i++)
		sort(all[i].begin(), all[i].end(), cmp);
	int mn = -1, mn2 = -1;
	for (int i=0; i<N; i++)
		if (!all[i].empty())
		{
			if (mn == -1 || val[all[mn][0]] > val[all[i][0]])
				mn2 = mn, mn = i;
			else if (mn2 == -1 || val[all[mn2][0]] > val[all[i][0]])
				mn2 = i;
		}
	for (int i=0; i<N; i++)
	{
		for (auto x : all[i])
		{
			if (val[all[i][0]] + val[x] <= A)
				merge(all[i][0], x);
			if (mn != -1 && mn != i)
			{
				if (val[all[mn][0]] + val[x] <= B)
					merge(all[mn][0], x);
			}
			else if (mn2 != -1 && mn2 != i)
			{
				if (val[all[mn2][0]] + val[x] <= B)
					merge(all[mn2][0], x);
			}
		}
	}
	int res = 1;
	for (int i=0; i<n; i++)
		if (par[i] == -1)
			res = 1LL * res * fact[sz[i]] % MOD;
	for (int i=0; i<N; i++)
	{
		map<int, int> mp;
		for (auto x : all[i])
			mp[root(x)]++;
		for (auto &x : mp)
			res = 1LL * res * bpow(fact[x.second], MOD - 2) % MOD;
	}
	cout << res << "\n";
	return 0;
}

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

int main(){

	int n, x ; cin >> n >> x ;

	int total = 0 ;

	for (int i = 2; i <= n + 1; ++ i) {
		int foo ; cin >> foo ; total += foo ;
		if (total > x) return cout << i - 1, 0 ;
	}

	cout << n + 1 << endl ;

	return 0 ;
}

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

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

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

int main(){
    ll X,Y;
    cin>>X>>Y;
    ll A=X;
    ll Co=0;
    while(A<=Y){
        Co++;
        A*=2;
    }    
    cout<<Co<<endl;
    return 0;
}

//a=97,z=122

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

using namespace std;

int main () {
    int N;

    while (cin >> N) {
        vector<int> A(N), B(N), C(N);
        for (int i = 0;i < N;i++)
            cin >> A[i];
        for (int i = 0;i < N;i++)
            cin >> B[i];
        for (int i = 0;i < N-1;i++)
            cin >> C[i];
        int ans = 0;
        for (int i = 0;i < N;i++)
            ans += B[i];
        for (int i = 0;i < N-1;i++) {
            if (A[i] == A[i+1] - 1) {
                ans += C[A[i]-1];
            }
        }
        cout << ans << endl;
    }
    return 0;
}


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

const int maxn=2e5+5;
int parent[maxn],Size[maxn];
int find(int u)
{
    if(parent[u]==u) return u;
    return parent[u]=find(parent[u]);
}
void merge(int u,int v)
{
    int ru=find(u),rv=find(v);
    if(ru==rv) return;
    parent[ru]=rv;
    Size[rv]+=Size[ru];
}
int main(void)
{
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;++i) parent[i]=i,Size[i]=1;
    for(int i=0;i<m;++i)
    {
        int a,b;
        cin>>a>>b;
        merge(a,b);
    }
    int ans=0;
    for(int i=1;i<=n;++i) ans=max(ans,Size[find(i)]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 11344
import math

def InvMod(i, pow, mod): #階乗のmodを計算
    if pow == 1:
        return i % mod
    else:
        if pow % 2 == 0:
            return InvMod((i**2) % mod, pow//2, mod) % mod
        else:
            return InvMod((i**2) % mod, pow//2, mod) * i % mod

def Prime(i): #素数であればTrueを返す
    root = math.sqrt(i)
    j, div = 2, True
    while j <= root:
        if i % j == 0:
            div = False
            break
        j += 1
    return div

N, M = map(int, input().split())
max = int(math.sqrt(M))
mod = 7 + 10**9

Pinv = [0]
Pfact = 1
for i in range(1, 31): #(階乗)^-1の計算, 2^31 > 10^9なので階乗は高々30乗まで
    Pfact *= i
    Pfact %= mod
    Pinv.append(InvMod(Pfact, mod-2, mod))

P = []
for i in range(2, max+1): #素因数の列挙
    if M % i == 0:
        if Prime(i):
            P.append(i)
        if Prime(M//i) and i**2 != M:
            P.append(M//i)

ans = 1
for p in P:
    C, pow = M, 0
    while C % p == 0: 
        pow += 1
        C //= p
    comb = Pinv[pow]  #(N-1)!/pow!(N-1)!
    for i in range(pow): #comb * (N-1+1)(N-1+2)…(N-1+pow)
        comb *= (N+i)
        comb %= mod
    ans *= comb
    ans %= mod

print(ans)

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

int main(){
  int d;
  cin >> d;
  if(d == 25) cout << "Christmas" << endl;
  if(d == 24) cout << "Christmas Eve" << endl;
  if(d == 23) cout << "Christmas Eve Eve" << endl;
  if(d == 22) cout << "Christmas Eve Eve Eve" << endl;
}


Measured memory_bytes: 256
n = n = int(input())
a = [int(_) for _ in input().split()]

b1 = b2 = b4 = 0

for c in a:
    if c % 4 == 0:
        b4 += 1
    elif c % 2 == 0:
        b2 = -1
    else:
        b1 += 1

if b1 <= b4+b2+1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;

vector<long long int> inverse;
vector<long long int> f, f_inverse;

void factorial_Initialize(int max){
    vector<long long int> a(max+1,1);
    inverse = a;
    f = a;
    f_inverse = a;

    for (int i=2; i<=max; i++){
        inverse[i]   = MOD - inverse[MOD % i] * (MOD / i) % MOD;
        f[i]         = f[i-1]         * i          % MOD;
        f_inverse[i] = f_inverse[i-1] * inverse[i] % MOD;
    }
}

long long int nCr(int n, int r){
    if(n < r || r < 0) return 0;
    if (n >= f.size()){
        factorial_Initialize(n);
    }
    return f[n] * f_inverse[r] % MOD * f_inverse[n-r] % MOD;
}

long long int modpow(long long int b, long long int p){// modinv(x) = modpow(x, MOD-2)
    long long int num = 1, power = b;
    for(int i=0; i<=30; i++){
        if((p>>i) & 1){
            num *= power;
            num %= MOD;
        }

        power *= power;
        power %= MOD;
    }
    return num;
}

int main(){
    long long int b, w;
    cin >> b >> w;
    cout << modpow(2, MOD-2) << endl;
    factorial_Initialize(1e6);

    vector<long long int> p(b+w), q(b+w);
    for(int i=1; i<b+w; i++){
        p[i] = p[i-1] + nCr(i-1,b-1) * modpow(modpow(2,MOD-2), i-1) % MOD * modpow(2, MOD-2); p[i] %= MOD;
        q[i] = q[i-1] + nCr(i-1,w-1) * modpow(modpow(2,MOD-2), i-1) % MOD * modpow(2, MOD-2); q[i] %= MOD;

        long long int ans = ((1 - p[i] - q[i]) % MOD + MOD) % MOD * modpow(2, MOD-2) + q[i] * 1;
        ans %= MOD;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 34392
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
a = li()

cnt = [0] * (10**6+1)

for i in a:
    cnt[i] += 1

single = []
for i in a:
    if cnt[i] == 1:
        single.append(i)

st = [0] * (10**6+1)
unique = list(set(a))

for i in unique:
    if st[i] >= 1:
        continue
    j = i*2
    while j <= 10**6:
        st[j] = 1
        j += i

ans = 0
for i in single:
    if st[i] == 0:
        ans += 1

print(ans)

Measured memory_bytes: 49224