akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

 
///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

string S;
ll N;
ll ans;
ll cnt = 0;
ll s[26];

int main(){
	
	cin>>S;
	N = S.size();
	
	fill( s, s+26, 0 );
	
	ans = N*(N-1)/2;
	ans++;
	
	REP( i, N ){
		int idx = S[i]-'a';
		s[idx]++;
	}
	
	REP( i, 26 ){
		cnt = 0;
		cnt = s[i]*(s[i]-1)/2;
		ans -= cnt;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define repn(a,b,c) for(int a=b; a>=c; a--)
#define ll long long
#define sum(a,b) a=a+b
#define mem(a, b) memset(a, (b), sizeof(a))
#define loop(a,b,c) for(int  a=b ; a<c ; a++)
#define first fi
#define second se
#define INF (int)1e5


ll dp[100005];
ll a[100005];

int main(){

    mem(a,0);
    mem(dp, 0);

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

     int n;
     cin>>n;

     rep(i,1,n) cin>>a[i];
     rep(i,1,n) dp[i]=10000000001;
  
     dp[0]=0;
     dp[1]=0;

     dp[2]=abs(a[1]-a[2]);

     rep(i,3,n){
        ll x = abs(a[i]-a[i-2]);

        ll y = abs(a[i]-a[i-1]);

        ll best = min(x + dp[i-2] , y + dp[i-1]);

        dp[i]=best;
     }

     cout<<dp[n]<<endl;

    return 0;
}





Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x)+modulo)%modulo)
#define Inf 1000000000


int main(){
	int N,D;
	cin>>N>>D;
	D=D*2+1;
	cout<<(N+D-1)/D<<endl;
		
	
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(){
  int a[3];
  int count5=0,count7=0;
  for(int i=0;i<3;i++){
   	cin >> a[i];
    if(a[i] == 5){
      count5 +=1;
    }
    if(a[i]==7){
      count7 += 1;
    }
  }
  
  if(count5 == 2 and count7 == 1){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  
  
  return 0 ;
}

Measured memory_bytes: 256
from collections import deque
import bisect
N=int(input())
q=deque([int(input())])
for _ in range(1,N):
  A=int(input())
  i=bisect.bisect_right(q,A-1)
  if i==0:
    q.appendleft(A)
  else:
    q[i-1]=A
print(len(q))

Measured memory_bytes: 7364
(let ((w (read))
      (a (read))
      (b (read)))

  (format t "~A~%"
          (if (or (and (>= b a) (<= b (+ a w)))
                  (and (>= a b) (<= a (+ b w))))
            0
            (min (abs (- b a w)) (abs (- a b w))))))


Measured memory_bytes: 24076
#include<iostream>
#include<cmath>
#include<iomanip>

using namespace std;

#define pi 3.1415926535

int main(){
    double a, b;
    double x;
    cin >> a >> b >> x;

    if(x > (a * a * b / 2.0) ){
        cout << setprecision(7) <<  180.0 * atan(2.0* (a * a * b -x)/a/a/a) /pi << endl;
    }
    else{
        cout << setprecision(7) << 180.0 * atan(a * b * b / 2.0 / x) /pi << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a==b&&b==c)
		printf("1\n");
	else if(a!=b&&a!=c&&b!=c)
		printf("3\n");
	else
		printf("2\n");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define MIN(a,b) ((a) <= (b) ? (a) : (b))
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort( ALL(v) )

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



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

    int arr[n-1];
    rep(i,n-1)cin>>arr[i];

    int ans[n+1]{};

    rep(i , n-1){
        ans[arr[i]]++;
    }

    for(int i = 1 ; i<=n ; i++){

        cout << ans[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 5232
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<cstdio>
using namespace std;

static const int INF=100000;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    long long N,K;
    cin >> N >> K;
    long long a[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    long long f[N]={}; //初項
    long long d[N]={}; //公差
    for(int i=0;i<N;i++){
        for(int j=0;j<i;j++){
            if(a[j]>a[i]) f[i]++;
        }
    }
    //for(int i=0;i<N;i++){
        //cout << f[i] << endl;
    //}
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(a[j]>a[i]) d[i]++;
        }
    }
    //for(int i=0;i<N;i++){
        //cout << d[i] << endl;
    //}
    unsigned long long ans=0;
    unsigned long long k=K*(K-1)/2;
    k%=MOD;
    //cout << k << endl;
    for(int i=0;i<N;i++){
        ans+=(f[i]*K+d[i]*k)%MOD;
        ans%=MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#// Problem link : 
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define F(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m) for(int i=0;i<=n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}}cout<<endl;
string s;
int main()
{
	string s1,s2;
	cin>>s1>>s2;
	int m = s1.size();
	int n = s2.size();
	int dp[m+1][n+1];
	for(int i = 0 ; i<=m ; i++)
	{
		for(int j = 0 ; j<=n ; j++)
		{
			// cout<<i<<" "<<j<<" "<<endl;
			if(i==0 || j==0) dp[i][j]=0;
			else if(s1[i-1]==s2[j-1])
			{

			dp[i][j]=1+dp[i-1][j-1];
			// x.insert(s1[i-1]);
			}
			else
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);

		}
	}
	// for(int i=0;i<=m;i++)
	// {
	// 	for(int j=0;j<=n;j++)
	// 	{
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<'\n';
	// }
	int i = m;
	int j = n;
while( i>=0 && j>=0)
{
	if(dp[i][j]==dp[i-1][j])
	{
		i--;
	}
	else if(dp[i][j]==dp[i][j-1])
	{
		j=j-1;

	}
	else
	{
		s+=s2[j-1];
		i--;
		j--;

	}
}
reverse(s.begin(),s.end());
cout<<s<<endl;
}

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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int N, K; cin >> N >> K;
  int result = N - K + 1;
  cout << result << endl;
  return 0;
}

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

int P[15], C[15];

int main() {
    int D, G;
    scanf("%d %d", &D, &G);
    for (int i = 0; i < D; i++) scanf("%d %d", &P[i], &C[i]);
    int ans = 10000;
    for (int i = (1 << D) - 1; i >= 0; i--) {
        int p = 0, cnt = 0;
        for (int j = 0; j < D; j++) {
            if (i >> j & 1) {
                p += P[j] * (j + 1) * 100 + C[j];
                cnt += P[j];
            }
        }
        if (p >= G) {
            ans = min(ans, cnt);
            continue;
        }
        for (int j = 0; j < D; j++) {
            if (!(i >> j & 1)) {
                for (int k = 0; k < P[j]; k++) {
                    if (p + (j + 1) * k * 100 >= G) ans = min(ans, cnt + k);
                }
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    ll N;
    string S;
    cin >> N;

    

    /*REP(i,N){
        vec.at(i) = i+2;
    }
    vec.at(N-1) = 1;

    ll sum = 0;
    REP(i, N)
    {
        int tmp = 0;
        tmp = (i + 1) % (vec.at(i));
        sum += tmp;
    }
    cout << sum << endl;*/
    ll ans = (N - 1) * N / 2;
    cout << ans << endl;
}


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

int main(){
    int n, count, res;
    string s;
    cin >> n >> s;
    res = 0;
    count = 0;
    rep(i, n) {
        if(s[i] == 'A') count=1;
        else if(count == 1 && s[i] == 'B') count=2;
        else if(count == 2 && s[i] == 'C') count=3;
        else count = 0;

        if(count == 3) {
            count = 0;
            res++;
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>


int main(void){
  char a,b,c,d,e,f;

  scanf(" %c%c%c",&a,&b,&c);
  scanf(" %c%c%c",&d,&e,&f);

//  printf("%c %c %c %c %c %c %c\n",a,b,c,d,e,f);

  if(a == f && b == e && c == d)
    printf("YES\n");
  else
    printf("NO\n");

  return 0;

}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
char s[10010];
map <int,int>ma;
int x,y,n,m;
main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
		scanf("%d",&x),ma[x]++;
	scanf("%d",&m);
	for (int i=1;i<=m;i++)
	{
		scanf("%d",&x);
		if (ma[x]>0)
		{
			ma[x]--;
		}
		else
		{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
}

Measured memory_bytes: 9600
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define mod (1000000000+7)
#define N (10007)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;


int main(void){
	string s;
	while(true){
		cin>>s;
		if(s=="#")break;
		int y,m,d;
		cin>>y>>m>>d;
		if(y>31){
			cout<<"?"<<" "<<(y-30)<<" "<<m<<" "<<d<<endl;
		}
		else{
			if(y==31){
				if(m>=5)cout<<"?"<<" "<<(y-30)<<" "<<m<<" "<<d<<endl;
				else cout<<s<<" "<<y<<" "<<m<<" "<<d<<endl;
			}
			else cout<<s<<" "<<y<<" "<<m<<" "<<d<<endl;
		}
	}
    return 0;
}


Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if (a+b>c+d) cout<<"Left";
    else if (a+b==c+d) cout<<"Balanced";
    else if (a+b<c+d) cout<<"Right";
    cout<<endl;
    return 0;
}

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

int main() {
    int n,k;
    cin >> n >> k;
    vector<int> l(n);

    for (int i = 0; i < n; i++)
    {
        cin >> l[i];
    }
    sort(l.begin(),l.end());
    reverse(l.begin(),l.end());
    int x = 0;
    for (int i = 0; i < k; i++)
    {
        x += l.at(i);
    }
    cout << x << endl;
    return 0;
}

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

int main(void) {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    string str;

    while(cin >> str) {
        bool flag = true;
        int cnt = 0;
        while(str.length()) {
            int l = str.length();
            if(l <= 1) break;
            if(str[0] != str[l - 1]) {
                if(str[0] != 'x' && str[l - 1] != 'x') {
                    flag = false;
                    break;
                }
                if(str[0] == 'x' && str[l - 1] != 'x') {
                    str.insert(l, "x");
                    ++cnt;
                } else if(str[0] != 'x' && str[l - 1] == 'x'){
                    str.insert(0, "x");
                    ++cnt;
                }
            } else {
                str.erase(0, 1);
                str.erase(l - 2, 1);
            }
        }
        if(!flag) cnt = -1;
        cout << cnt << endl;
    }
}


Measured memory_bytes: 512
/* ****GT_18**** */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		int n,num,sum=0,ans=INT_MIN;
	cin>>n;
	rep(i,0,n)
	{
		cin>>num;
		sum+=num;
		ans=max(ans,num);
	}	
	cout<<sum-ans/2;
	}
	return 0;
}

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

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(int i##_to_ = (t), i = (f); i <= i##_to_; i++)
#define uptil(f, t, i)   for(int i##_to_ = (t), i = (f); i <  i##_to_; i++)
#define downto(f, t, i)  for(int i##_to_ = (t), i = (f); i >= i##_to_; i--)
#define downtil(f, t, i) for(int i##_to_ = (t), i = (f); i >  i##_to_; i--)
typedef long double LD;
#define long long long

#if defined(EBUG) && !defined(ONLINE_JUDGE)
#define debug true
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 2
#define _LIBCPP_DEBUG2 2
#define ln << endl
#else
#define debug false
#define ln << '\n'
#endif
#define tb << '\t'
#define sp << ' '



signed main() { // long: 64bit
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }

    int N, M; scanf("%d%d", &N, &M);
    vector<set<int>> P(N);
    times(M, i) {
        int A, B; scanf("%d%d", &A, &B);
        P[A-1].insert(B-1);
        P[B-1].insert(A-1);
    }
    vector<int> color(N, -1);
    bool pyon = false;
    queue<pair<int, int>> q; q.push({0, 0});
    while(!q.empty()) {
        int i, c; tie(i, c) = q.front(); q.pop();
        if(color[i] >= 0) {
            if(color[i] != c) pyon = true;
            continue;
        }
        color[i] = c;
        for(int j: P[i]) {
            if(color[j] >= 0) {
                if(color[j] == c) pyon = true;
                continue;
            }
            q.push({j, !c});
        }
    }

    long b = 0, w = 0;
    times(N, i) if(color[i]) ++b; else ++w;
    cout << (pyon ? (long)N * (N-1) / 2 : b * w) - M ln;

    return 0;
}


Measured memory_bytes: 14720
package main

import (
	"fmt"
	"strings"
)

func main() {
	// Code for A - UOIAUAI
	var c string
	fmt.Scanf("%s", &c)

	var flag string = "aeiou"
	if strings.IndexAny(c, flag) != -1 {
		fmt.Println("vowel")
	} else {
		fmt.Println("consonant")
	}
}


Measured memory_bytes: 1836
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

static class Program
{
    static int Solve(int H, int W, int[][] A, int[][] B)
    {
        const int K = 12640;
        bool[][][] dp = new bool[H][][];
        for (int i = 0; i < H; ++i)
        {
            dp[i] = new bool[W][];
            for (int j = 0; j < W; ++j)
            {
                dp[i][j] = new bool[K + 1];
                for (int k = 0; k <= K; ++k)
                {
                    if ((i == 0 && j == 0 && k == 0) || (i - 1 >= 0 && dp[i - 1][j][k]) || (j - 1 >= 0 && dp[i][j - 1][k]))
                    {
                        int k1 = Math.Abs(k + A[i][j] - B[i][j]);
                        int k2 = Math.Abs(k - A[i][j] + B[i][j]);
                        if (k1 <= K) { dp[i][j][k1] = true; }
                        if (k2 <= K) { dp[i][j][k2] = true; }
                    }
                }
            }
        }
        return Enumerable.Range(0, K + 1).First(i => dp[H - 1][W - 1][i]);
    }

    static void Main(string[] args)
    {
        int[] V1 = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int H = V1[0], W = V1[1];
        var A = new int[H][];
        for (int i = 0; i < H; ++i)
        {
            A[i] = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        }
        var B = new int[H][];
        for (int i = 0; i < H; ++i)
        {
            B[i] = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        }
        Console.WriteLine(Solve(H, W, A, B));
    }
}


Measured memory_bytes: 114368
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] n = line.split(" ");
		Arrays.sort(n);
		System.out.println(n[0] + " " + n[1] + " " + n[2]);
	}

}



Measured memory_bytes: 26232
#include <bits/stdc++.h>
using namespace std;
int n,a[100005];
int main()
{
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) {
        int tmp = a[i];
        int j = i-1;
        while (j >= 0 && a[j] > tmp) {
            a[j+1] = a[j--];
        }
        a[j+1]=tmp;
        for(int i = 0; i < n-1; i++)
            cout << a[i] << " ";
        cout << a[n-1] << '\n';
    }
}



Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

int main()
{
  ll N, K;
  cin >> N >> K;
  ll R, S, P;
  cin >> R >> S >> P;
  string T;
  cin >> T;

  vector<vector<ll>> dp(N + K + 1, vector<ll>(3, 0));
  for (ll i = 0; i < K; i++)
  {
    for (ll j = i + 1; j <= N; j += K)
    {
      for (ll k = 0; k < 3; k++)
      {
        if (k != 0)
          chmax(dp.at(j + K).at(0), dp.at(j).at(k) + R * (T.at(j - 1) == 's'));
        if (k != 1)
          chmax(dp.at(j + K).at(1), dp.at(j).at(k) + S * (T.at(j - 1) == 'p'));
        if (k != 2)
          chmax(dp.at(j + K).at(2), dp.at(j).at(k) + P * (T.at(j - 1) == 'r'));
      }
    }
  }

  ll ans = 0;
  for (ll i = N + 1; i <= N + K; i++)
  {
    ll tmp = 0;
    for (ll j = 0; j < 3; j++)
    {
      chmax(tmp, dp.at(i).at(j));
    }
    ans += tmp;
  }
  cout << ans << endl;
}

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

#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define repi(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define mt make_tuple
#define mp make_pair
template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); }
template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using P = pair<ll, ll>;
using ld = long double;  using vld = vector<ld>; 

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

	 if(a>=n%500) cout <<"Yes" <<endl;
     else cout <<"No" <<endl;
	
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a=2;
    int b[4];
    b[0]=4;
    b[1]=6;
    b[2]=9;
    b[3]=11;
    int x,y;
    
    
    scanf("%d%d",&x,&y);
    
    switch (x){
        case 2 :x=13;break;
        case 4 :x=14;break;
        case 6 :x=14;break;
        case 9 :x=14;break;
        case 11:x=14;break;
            default :x=12;
            
    }
    

    switch (y){
        case 2 :y=13;break;
        case 4 :y=14;break;
        case 6 :y=14;break;
        case 9 :y=14;break;
        case 11:y=14;break;
        default :y=12;
    }
    
    
    
    if(x==y)
        puts("Yes");
    else
        puts("No");
    
    return 0;
}
    

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

int main()
{
  int n,k,pos;
  cin>>n>>k;
  for(int i=1;i<=n;i++)
  {
    int h;
    cin>>h;
    
  }
  if((n-1)%(k-1)==0)
    cout<<(n-1)/(k-1);
  else
    cout<<1 + ((n-1)/(k-1));
  
  return 0;
}


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

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))

#define INF 1000000000


int main()
{
	long long int N;

	scanf("%lld", &N);

	long long int M = N;

	long long int num=5;
	long long int tmp = 0;

	if (N % 2 == 0)
	{
		while (N >= num)
		{
			tmp += (N / num) / 2;
			num *= 5;
		}
		printf("%lld", tmp);

	}
	else
		printf("0\n");
}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>

using namespace std;

int main() {
  int X;
  cin >> X;
  int res = 1;
  for (int i = 2; i <= (int)sqrt(X); ++i) {
    int j = 2;
    while ((int)pow(i, j) <= X) {
      ++j;
    }
    res = max(res, (int)pow(i, j - 1));
  }
  printf("%d\n", res);
}

Measured memory_bytes: 3592
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        s: chars,
    }
    println!(
        "{}",
        if s[0] == s[1] || s[1] == s[2] || s[2] == s[3] {
            "Bad"
        } else {
            "Good"
        }
    );
}


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


int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	int ans=1;
	for(int i=m/n+1;i>=2;i--){
		if(m%i==0&&m/i>=n){
			ans=i;
			break;
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    *s, = input()
    cnt = 0
    for i in range(len(s)//2):
        if s[i]!=s[-(i+1)]:
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
n,m=map(int,input().split())
a,M,d=1,10**9+7,[1]*(n+1)
for i in range(n):
  d[i+1]=((m-n+i)*d[i]+i*d[i-1])%M
  a=a*(m-i)%M
print(a*d[-1]%M)


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
//const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
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; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

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

    ll n, P;
    cin >> n >> P;
    string S;
    cin >> S;

    if(P==2){
    	ll res = 0;
    	REP(i, n){
    		if((S[i]-'0')%2==0){
    			res += (i+1);
    		}
    	}
    	cout << res << endl;
    	return 0;
    }

    if(P==5){
    	ll res = 0;
    	REP(i, n){
    		if((S[i]-'0')%5==0){
    			res += (i+1);
    		}
    	}
    	cout << res << endl;
    	return 0;
    }

    vector<ll> b(n), c(n), d(n), e(n+1, 0);
    REP(i, n) b[i] = S[i] - '0';

    ll now = powLL(10, P-1, P);
    ll minv = modinv(10, P);

    REP(i, n){
    	c[i] = now;
    	now *= minv;
    	now %= P;
    }

    REP(i, n) d[i] = b[i] * c[i] % P;
    REP(i, n) e[i+1] = (e[i] + d[i])%P;

    ll res = 0;
    if(P==2||P==5){
    	1;
    }else{
    	vector<ll> cnt(P, 0);
    	REP(i, n+1){
 			res += cnt[e[n-i]];
    		cnt[e[n-i]]++;
    	}
    }

    cout << res << endl;
    /*
    cout << b << endl;
    cout << c << endl;
    cout << d << endl;
    cout << e << endl;
	*/

    return 0;
}

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

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

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

    int a, b, c;
    cin >> a >> b >> c;
    cout << (a + b + c >= 22? "bust" : "win") << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

h,w = l_in()
S = [s_in() for _ in range(h)]
    
from collections import deque

res = 0
for i in range(h):
    for j in range(w):
        q = deque()
        s = set()
        check = lambda x,y: (not (x,y) in s) and x >= 0 and x < h and y >=0 and y < w and S[x][y] == '.'
        
        if S[i][j] == '.':
            q.append((i,j,0))

        while len(q) > 0:
            i,j,d = q.popleft()
            s.add((i,j))
            res = max(d,res)
            
            if check(i+1,j):
                s.add((i+1,j))
                q.append((i+1,j,d+1))
            if check(i-1,j):
                s.add((i-1,j))                
                q.append((i-1,j,d+1))
            if check(i,j+1):
                s.add((i,j+1))            
                q.append((i,j+1,d+1))
            if check(i,j-1):
                s.add((i,j-1))            
                q.append((i,j-1,d+1))

print(res)



Measured memory_bytes: 74732
#include<stdio.h>
int main()
{int H,W,i,j,k;
for(i=0;;i++){
scanf("%d%d",&H,&W);
if(H!=0&&W!=0){
for(j=0;j<H;j++){
for(k=0;k<W;k++)
putchar('#');
putchar('\n');}
putchar('\n');}
else return 0;}}

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

int main(){
  
  string a, b, c;
  cin >> a >> b >> c;
  cout << a[0] << b[1] << c[2] << endl;

}

Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

int final_board[8][8] = {{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},
		{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0}};

void deletePossibility(int tmp_board[8][8],int row,int column){
	tmp_board[row][column] = 1;
	for(int i = 0; i < 8; i++){
		if(i != column){
			tmp_board[row][i] = -1;
		}
	}
	for(int i = 0; i < 8; i++){
		if(i != row){
			tmp_board[i][column] = -1;
		}
	}

	for(int r = row-1,c = column+1;r >= 0 && c <= 7; r--,c++){
		tmp_board[r][c] = -1;
	}
	for(int r = row+1,c = column+1;r <= 7 && c <= 7; r++,c++){
		tmp_board[r][c] = -1;
	}
	for(int r = row-1,c = column-1;r >= 0 && c >= 0; r--,c--){
		tmp_board[r][c] = -1;
	}
	for(int r = row+1,c = column-1;r <= 7 && c >= 0; r++,c--){
		tmp_board[r][c] = -1;
	}
}



void func(int tmp_board[8][8],int num_of_putQ){
	if(num_of_putQ == 8){
		for(int i = 0; i < 8; i++){
			for(int k = 0; k < 8; k++){
				final_board[i][k] = tmp_board[i][k];
			}
		}
	}else{

		int row,column,count = 0;
		for(row = 0; row < 8; row++){
			for(column = 0; column < 8; column++){
				if(tmp_board[row][column] == 0){
					count++;
				}
			}
			if(count > 0) break;
		}
		if(row == 8 && column == 8){
			//Do nothing
		}else{
			int tri_board[count][8][8];
			int index = 0;

			for(int a = 0; a < count; a++){
				for(int b = 0; b < 8; b++){
					for(int c = 0; c < 8; c++){
						tri_board[a][b][c] = tmp_board[b][c];
					}
				}
			}

			for(int i = 0; i < 8; i++){
				if(tmp_board[row][i] == 0){
					deletePossibility(tri_board[index],row,i);
					func(tri_board[index++],num_of_putQ+1);
				}
			}
		}

	}
}




int main(){

	int k,row,colum;
	int tmp_board[8][8];

	for(int i = 0; i < 8; i++){
		for(int k = 0; k < 8; k++){
			tmp_board[i][k] = 0;
		}
	}

	scanf("%d",&k);

	for(int i = 0; i < k; i++){
		scanf("%d %d",&row,&colum);
		deletePossibility(tmp_board,row,colum);
	}

	func(tmp_board,k);

	for(int i = 0; i < 8; i++){
		for(int p = 0; p < 8; p++){
			if(final_board[i][p] == 1){
				printf("Q");
			}else{
				printf(".");
			}
		}
		printf("\n");
	}

    return 0;
}

Measured memory_bytes: 1004
#include <iostream>
#include <cstdio>
#include <cstring>
//字符串旋转
using namespace std;

int main()
{
  char a1[150],a2[150];
  char pt;
  int l1,l2,i,j;
  scanf("%s",&a1);
  scanf("%s",&a2);
  l1=strlen(a1);
  l2=strlen(a2);
  if(l1!=l2)
  {
      printf("No\n");
  }
  else
  {
      for(i=0;i<l1;i++)
      {
          if(strcmp(a1,a2)==0)
          {
              printf("Yes\n");
              break;
          }
          else
          {
              pt=a1[l1-1];
              for(j=l1-2;j>=0;j--)
              {
                  a1[j+1]=a1[j];
              }
              a1[0]=pt;
          }
      }
      if(i==l1)
      {
          printf("No\n");
      }
  }
    return 0;
}


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

int main() {
  int n; cin >> n;
  int a = 0, b = 0;
  for (int i = 1; i <= n; i++) {
    int t; cin >> t;
    a += t;
    b = max(b, t);
  }
  a -= b / 2;
  cout << a << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <bits/stdc++.h>

using namespace std;  
int main() 
{
	string s;	
	cin >> s;	
	if (s.length() == 2)
		cout << s << endl;	
	else{
		for (int i = s.length() - 1; i >= 0; i--){
			cout << s[i];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
x, y = gets.strip.split.map(&:to_i)

foo = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], 2]
result = 0
for a in foo do
    break if a == 2
    result = 1 if a.include?(x) && a.include?(y)
end

puts result == 1 ? "Yes" : "No"


Measured memory_bytes: 1788
/*
  Motto - try hard to become an expert
*/
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define INF (int)INT_MAX
#define all(v)  v.begin(), v.end()
#define endl "\n"
 
//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const int N = 3*1e5 +5 ;
 long long MOD = 1e9 + 7;
const long long inf = 1e18;
 
using namespace std;
 
ll MAXN=100001;
ll spf[100001]; 
 
ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll modFact(ll n, ll p) 
{ 
    if (n >= p) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result;  
} 
 
bool isPrime(int x)
{
    if(x%2==0)
        return 0;
    for(int i=3;i<=sqrt(x);i+=2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
ll bionomial(ll n , ll r){
	
	ll res = 1 ;
	for (ll i =  0 ; i<r;i++){
		res *= (n-i) ;
		res %= MOD ;
	}
	return res ;
}
void solve()
{
	int n  ;
	cin>>n ;
	map<string , int>ma; 
	rep( i  , n){
		string temp ;
		cin>>temp ; 
		ma[temp]++;
	}

	multimap<int  , string>mar ;
	for(auto it  = ma.begin() ; it !=ma.end() ; it++){
		mar.insert(mp(it->se , it->fi));
	}

	set<string>s ;
	int eq  =  mar.rbegin()->fi ;

	for(auto it  = mar.rbegin() ;  it != mar.rend() ; it++){
		if(it->fi==eq){
			s.insert(it->se) ;
		}
	}
	// cout<<s.size()<<endl;
	for(auto it = s.begin() ; it != s.end() ;it++){
		cout<<*it<<endl;
	}
}
 
int main() {
    // #ifndef ONLINE_JUDGE
    //     // for getting input from input.txt
    //     freopen("input.txt", "r", stdin);
    //     // for writing output to output.txt
    //     freopen("output.txt", "w", stdout);
    // #endif
    
    // ios_base::sync_with_stdio(0);
    // cin.tie(NULL);
    int t = 1;
    //cin>>t;
    while(t--)
    {
        solve();
    } 
    // cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

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

int main(){

  string s;
  cin>>s;

  int a,b;
  a=(s.at(0)-'0')*10+s.at(1)-'0';
  b=(s.at(2)-'0')*10+s.at(3)-'0';
// cout<<a<<" "<<b<<endl;
  if(a>12||a==0){
    //YYMM+NA
    if(b<=12&&0<b)
    cout<<"YYMM"<<endl;
    else if(b>12||b==0)
    cout<<"NA"<<endl;
  }
  else if(0<a){
    //YYMM+MMYY+AMB+NA
    if(b<=12&&0<b)
    cout<<"AMBIGUOUS"<<endl;
    else if(b>12||b==0)
    cout<<"MMYY"<<endl;

  }
  // else{
  //   if(b<=12&&0<b)
  //   cout<<"YYMM"<<endl;
  //   else
  //   cout<<"NA"<<endl;
  // }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}

int main() {
  int N;
  cin>>N;
  vector<int>a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  set<int>k;
  int m=0;
  for(int i=0;i<N;i++){
   if(a[i]<3200){
    for(int j=0;j<=7;j++){
    if(a[i]>=400*j&&a[i]<400*(j+1)){k.insert(j);}
   }}
   else{m++;}
  }
  int MIN=0;
  if(k.size()>0){MIN=k.size();}
  else{MIN=1;}

  cout<<MIN<<" "<<k.size()+m<<endl;
  return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
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(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	LL n, c; cin >> n >> c;

	vector<LL> x(n+2);
	vector<LL> v(n+2);

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

	x[0] = 0;v[0] = 0;
	x[n + 1] = c; v[n + 1] = 0;

	//前計算
	//0-iまで0から時計まわり行ったあと0まで反時計回りで戻ったときの
	//幸福度の最大値をiで検索できるようにしたい
	
	vector<LL> tbl(n+2);

	LL sumbuf = 0;
	LL h = 0;
	for (int i = 0; i < n+2; i++) {
		LL l = x[i];
		sumbuf += v[i];

		h = max(h, sumbuf - l*2);
		tbl[i] = h;
	}

	//前計算
	//n+i-i+1まで0から反時計回りで行った時の
	//幸福度の最大値をi+1で検索できるようにしたい

	vector<LL> tbr(n + 2);

	sumbuf = 0;
	h = 0;
	for (int i = n + 1; i>=0; i--) {
		LL l = c-x[i];
		sumbuf += v[i];

		h = max(h, sumbuf - l*2);
		tbr[i] = h;
	}

	LL ans = 0;

	//左まわりで食べていく
	LL sum = 0;
	for (int i = 0; i < n+1; i++) {
		sum += v[i];
		ans = max(ans, sum - x[i] + tbr[i + 1]);
	}

	//右まわりで食べていく
	sum = 0;
	for (int i = n+1; i>=1; i--) {
		sum += v[i];
		ans = max(ans, sum - (c-x[i]) + tbl[i-1]);
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a;
  string b;
  int count = 0;
  cin >> a >> b;
  for(int i = 0; i < a.length(); i++){
      if(a[i] != b[i]){
          count ++;
      }
  }
  cout << count;
  
}


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

using namespace std;
#define REP(i, n) for (int i=0; i<(n); ++i)
#define RREP(i, n) for (int i=(int)(n)-1; i>=0; --i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, n) for (int i=(int)(n)-1; i>=(a); --i)

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector <T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair <T, U> &p) {
    return os << "(" << p.first << " " << p.second << ")";
}

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

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;


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

    // ifstream in("in.txt");
    // cin.rdbuf(in.rdbuf());

    string s, t; cin >> s >> t;

    cout << (s == t.substr(0, s.size()) ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 3612
# bubble sort

def bubble_sort! size, target_array
  count = 0
  swapped = true
  while swapped do
    swapped = false
    (size - 1).downto(1) do |i|
      if target_array[i] < target_array[i - 1]
        target_array[i], target_array[i - 1] = target_array[i - 1], target_array[i]
        swapped = true
        count += 1
      end
    end
  end
  count
end


size = STDIN.gets.chomp.to_i
target_array = STDIN.gets.chomp.split(' ').map{|n|n.to_i}

count = bubble_sort!(size, target_array)
puts target_array.join ' '
puts count

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

int main() {
map<string, int> score;

int n;
cin>>n;
rep(i,n)
{string s;
 cin >>s;
 score[s]=1;

}

cout <<score.size()<<endl;



}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

Measured memory_bytes: 19224
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
typedef long long int ll;
#define rep(i,n) for(int i = 0;i < n; i++)
#define c(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define Sort(a) sort(a.begin(), a.end())
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
using namespace std;
unsigned long long int m,k, a, b, c;string s, t;
vector<int> n = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
int main() {
	cin >> m >> k;
	a = m * k;
	if (m > 1 && k > 1) {
		if (m * k % 2 == 1) {
			cout << (a + 1) / 2 << endl;
		}
		else
			cout << a / 2 << endl;
	}
	else
		cout << 1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define bitcount(x)  __builtin_popcount(x)
#define bitcountll(x)  __builtin_popcountll(x)
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 1000000007
#define N 100005  //check the limits, man
int main()
{
    ll n;
    llin(n);
    if(n%2==1)
        out(0);
    else
    {
        n/=2;
        ll a=0;
        while(n>1)
            n/=5,a+=n;
        llout(a);
    }
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 1e9+5;
using Graph = vector<vector<int>>;

int N;
Graph d(301, vector<int>(301, INF));

void wf(){rep(k,N) rep(i,N) rep(j,N) d.at(i).at(j) = min(d.at(i).at(j), d.at(i).at(k) + d.at(k).at(j));}

int main() {
  int M, L;
  scanf("%d%d%d", &N, &M, &L);
  N++;
  int A, B, C;
  rep(i, M) {
    scanf("%d%d%d", &A, &B, &C);
    d.at(A).at(B) = d.at(B).at(A) = C;
  }
  wf();
  rep (i, N) {
    rep (j, N) {
      d.at(i).at(j) = d.at(j).at(i) = ((d.at(i).at(j) <= L) ? 1 : INF);
    }
  }
  wf();
  int Q, s, t;
  cin >> Q;
  rep(i, Q) {
    scanf("%d%d", &s, &t);
    printf("%d\n", (d.at(s).at(t) == INF) ? -1 : d.at(s).at(t) - 1);
  }
}

Measured memory_bytes: 896