akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std ;
 
#define int long long
#define endl '\n'

#define IOS ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ;
 
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<vi>
#define vp vector<pii>
#define vs vector<string>
#define all(v) v.begin(),v.end()

#define lb  lower_bound
#define ub  upper_bound
#define bs  binary_search
#define ff  first
#define ss  second
#define sz(x) ((int)(x).size())
#define rep(i,l,r) for(int i=(l);i<(r);++i)
 
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
     
#define pi 3.14159265358979323846264338327950L
#define MOD 1000000007

int32_t main(){

     int n,k,ans=0;
     cin>>n>>k;
     vi f(n);
     for(auto &it:f)
          cin>>it;
     sort(all(f));
     for(int i=0;i<k;i++)
     {
          ans+=f[i];
     }
     cout<<ans;
  return 0;
}




Measured memory_bytes: 3592
#include<iostream>

using namespace std;

int main(){
  int n;
  long long ans, d;
  int list[] = {0,1,2,3,5,7,8,9};
  while(cin >> n, n){
    ans=0, d=1;
    while(n!=0){
      ans += d*list[n%8];
      d*=10;
      n/=8;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <map>
#include <stack>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define mkpr(x,y) make_pair(x,y)
#define all(x) x.begin(),x.end()

typedef long long int ll;

ll general,total;
//ll chk[55];
//ll num[55];
//ll num2[55];
//ll num[ten5];
//ll num2[ten5];
//char cmap[10][10];
//priority_queue<long long int> pq;   //big at front
//stack<int> stk;
vector<pair<ll,ll>> vpll;
//vector<ll> vll;
//deque<ll> deq[55];
//list<int> li;
//set<int> sint;
set<ll> sll;
//map<ll,ll> mp;

ll cmp(pair<ll,ll> a,pair<ll,ll> b)
{
    return a.first<b.first;
}

int main()
{
    //double ans=0.0,half;
    //float f,g,h;
    long long int sum,sum2,n1,n2,n3;
    long long int m,n,o,i,j,k=1;
    long long int a,a1,a2,a3,a4,a5,a6;
    sum=sum2=n1=n2=n3=0;
    a=a1=a2=a3=a4=a5=a6=0;
    //string s,s1;
    //char now,pre,c;
    cin>>n>>m;
    for(i=0;i<n;i++)
    {
        cin>>a1>>a2;
        vpll.pb(mkpr(a1,a2));
    }
    sort(all(vpll),cmp);
    for(i=0;i<n;i++)
    {
        if(m>=vpll[i].second)
        {
            sum+=vpll[i].first*vpll[i].second;
            m-=vpll[i].second;
        }
        else
        {
            sum+=vpll[i].first*m;
            break;
        }
    }
    cout<<sum;
    return 0;
}





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

int main() {
	int N, M; cin >> N >> M;
	vector<int> a(N);
	for (int u = 0; u < N; u++)
		cin >> a[u];
	vector<int> d(N);
	vector<vector<int> > G(N);
	while (M--) {
		int u, v; cin >> u >> v;
		u--; v--;
		d[u]++;
		G[v].push_back(u);
	}
	vector<vector<bool> > b(N, vector<bool>(N));
	for (int u = 0; u < N; u++)
		b[u][0] = true;
	queue<int> q;
	for (int u = 0; u < N; u++)
		if (!d[u])
			q.push(u);
	vector<bool> unko(N);
	while (!q.empty()) {
		int u = q.front(); q.pop();
		int x;
		for (x = 0; b[u][x]; x++);
		if (a[u] % 2) unko[x] = !unko[x];
		for (int v: G[u]) {
			b[v][x] = true;
			d[v]--;
			if (!d[v]) q.push(v);
		}
	}
	bool ok = false;
	for (int x = 0; x < N; x++)
		if (unko[x])
			ok = true;
	cout << (ok ? 1 : 2) << endl;
}

Measured memory_bytes: 3340
s=[int(0) for i in range(26)]
while True:
    try:
        x=input()
        for i in range(len(list(x))):
            if 97<=ord(list(x)[i].lower())<=122:
                s[ord(list(x)[i].lower())-97]=s[ord(list(x)[i].lower())-97]+1
    except EOFError:
        break
for i in range(26):
    print(chr(97+i),":",s[i])

Measured memory_bytes: 7424
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll now = 100;
    ll x; cin >> x;
    int y = 0;
    while(now < x){
        now += now/100;
        y++;
    }
    cout << y;
    cout << endl;
    return 0;
}

Measured memory_bytes: 3660
#include<iostream>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  if(a+b>=a*b&&a+b>=a-b){
    cout<<a+b;
  }
  else if(a-b>=a+b&&a-b>=a*b){
    cout<<a-b;
  }
  else if(a*b>=a+b&&a*b>=a-b){
    cout<<a*b;
  }
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#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(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int a, b;
    char op;
    vector<int> ans;

    while(true) {
        cin >> a >> op >> b;

        if(op == '?') break;
        else if(op == '+') ans.push_back(a + b);
        else if(op == '-') ans.push_back(a - b);
        else if(op == '*') ans.push_back(a * b);
        else if(op == '/') ans.push_back(a / b);
    }

    for(int i : ans) {
        cout << i << endl;
    }
    return 0;
}


Measured memory_bytes: 3128
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
# from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)


class Combination:
    def __init__(self, mod=10**9+7, n=202020):
        self.f = [0] * n
        self.rf = [0] * n
        self.inv = [0] * n
        self.f[0], self.f[1] = 1, 1
        self.rf[0], self.rf[1] = 1, 1
        self.inv[1] = 1
        self.MOD = mod
        for i in range(2, n):
            self.f[i] = (self.f[i - 1] * i) % self.MOD
            self.inv[i] = (-self.inv[self.MOD % i] * (self.MOD // i)) % self.MOD
            self.rf[i] = (self.rf[i - 1] * self.inv[i]) % self.MOD

    def __call__(self, n, r):
        return (self.f[n] * self.rf[r] * self.rf[n - r]) % self.MOD


C = Combination(mod=MOD, n=2020202)

k = int(input())
s = input()

ans = 1
p = 1
for i in range(len(s), len(s)+k):
    ans = (ans*26 + C(i, len(s)-1)*pow(25, p, MOD)) % MOD
    p += 1

print(ans)


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

#define all(v)  begin(v), end(v)
#define endl    '\n';
#define int     long long
#define pii     pair<int, int>
#define sz(x)   (int) x.size()

void test_case() {
    int n, x, t;
    cin >> n >> x >> t;

    cout << t * ((n + x -1) / x) << endl;
}

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

    int t = 1;
    // cin >> t;

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



Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long ll;
// 二次元累積和
int sum[2005][2005];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < n; ++i){
        int x, y;
        char c;
        cin >> x >> y >> c;
        
        // すべて(c='B')にして、([0, 2k), [0, 2k))に圧縮
        if(c == 'W'){
            y += k;
        }
        x %= 2 * k;
        y %= 2 * k;
        
        ++sum[x + 1][y + 1];
    }
    
    // 二次元累積和
    // 横方向の累積和
    for(int i = 0; i <= 2 * k; ++i){
        for(int j = 0; j <= 2 * k; ++j){
            sum[i][j+1] += sum[i][j];
        }
    }
    // 縦方向の累積和
    for(int i = 0; i <= 2 * k; ++i){
        for(int j = 0; j <= 2 * k; ++j){
            sum[i+1][j] += sum[i][j];
        }
    }
    
    int res = 0;
    // (0, 0) ~ (2k-1, 2k-1)
    for(int tx = 0; tx < 2 * k; ++tx){
        for(int ty = 0; ty < 2 * k; ++ty){
                int temp = 0;
                
                // ([0, 2k], [0, 2k])内の黒に塗る部分に関して、点の数を足し合わせる
                if(tx <= k && ty <= k){
                    temp += sum[tx][ty];
                    temp += sum[tx][2*k] - sum[tx][ty+k];
                    temp += sum[2*k][ty] - sum[tx+k][ty];
                    temp += sum[tx+k][ty+k] - sum[tx+k][ty] - sum[tx][ty+k] + sum[tx][ty];
                    temp += sum[2*k][2*k] - sum[2*k][ty+k] - sum[tx+k][2*k] + sum[tx+k][ty+k];
                }
                else if(tx > k && ty > k){
                    temp += sum[tx-k][ty-k];
                    temp += sum[tx-k][2*k] - sum[tx-k][ty];
                    temp += sum[2*k][ty-k] - sum[tx][ty-k];
                    temp += sum[tx][ty] - sum[tx][ty-k] - sum[tx-k][ty] + sum[tx-k][ty-k];
                    temp += sum[2*k][2*k] - sum[2*k][ty] - sum[tx][2*k] + sum[tx][ty];
                }
                else if(tx > k){        // tx > k && ty <= k
                    temp += sum[tx][ty] - sum[tx-k][ty];
                    temp += sum[tx-k][ty+k] - sum[tx-k][ty];
                    temp += sum[tx][2*k] - sum[tx][ty+k] - sum[tx-k][2*k] + sum[tx-k][ty+k];
                    temp += sum[2*k][ty+k] - sum[2*k][ty] - sum[tx][ty+k] + sum[tx][ty];
                }
                else{       // tx <= k && ty > k
                    temp += sum[tx+k][ty-k] - sum[tx][ty-k];
                    temp += sum[tx][ty] - sum[tx][ty-k];
                    temp += sum[tx+k][2*k] - sum[tx+k][ty] - sum[tx][2*k] + sum[tx][ty];
                    temp += sum[2*k][ty] - sum[2*k][ty-k] - sum[tx+k][ty] + sum[tx+k][ty-k];
                }
                
                res = max(res, temp);
        }
    }
    
    cout << res << endl;
}

Measured memory_bytes: 16000
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstdlib>
#include<algorithm>
using namespace std;
string s,st;
void Cambridge(int w)
{
    if(s[w]=='e')
    {
        st="";
        for(int i=w; i<=w+4; i++)st+=s[i];
        if(st=="erase")
        {
            if(w+4==s.size()-1){cout<<"YES"<<endl;exit(0);}
            if(s[w+5]=='r')
            {
                if(w+5==s.size()-1){cout<<"YES"<<endl;exit(0);}
                Cambridge(w+5+1); 
            }
            else Cambridge(w+4+1);
        }
        else
        return ;
    }
    if(s[w]=='d')
    {
        st="";
        for(int i=w; i<=w+4; i++)st+=s[i];
        if(st=="dream")
        {
            if(w+4==s.size()-1){cout<<"YES"<<endl;exit(0);}
            if(s[w+5]=='e'&&s[w+6]=='r')
            {
                if(w+6==s.size()-1){cout<<"YES"<<endl;exit(0);}
                Cambridge(w+6+1);
                Cambridge(w+4+1);
            }
            else Cambridge(w+4+1);
        }
        else
        return ;
    }
}
int main()
{
    cin>>s;
    if(s[0]!='d'&&s[0]!='e'){cout<<"NO"<<endl;return 0;}
    Cambridge(0);
    cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 1536
#include<iostream>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if(a==1 && b==2)
    cout << 3 << endl;
  else if(a==1 && b==3)
    cout << 2 << endl;
  else if(a==2 && b==1)
    cout << 3 << endl;
  else if(a==2 && b==3)
    cout << 1 << endl;
  else if(a==3 && b==1)
    cout << 2 << endl;
  else if(a==3 && b==2)
    cout << 1 << endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class CDifferBy1Bit {
public:

    int n;
    vector<vector<int>> dp;

    void func(int s, int t) {
      if (s+2==t) return;
      int m = (s+t)/2;

      int idx = -1;
      rep(i, n) {
        if (dp[i][s] != dp[i][t-1]) {
          idx = i;
          break;
        }
      }

      for(int i=s+1; i<m; i++) {
        dp[idx][i] = dp[idx][s];
      }
      for(int i=m; i<t; i++) {
        dp[idx][i] = dp[idx][t-1];
      }
      bool changed = false;
      for(int i=0; i<n; i++) {
        if (dp[i][m-1] == -1) {
          if (!changed) {
            dp[i][m] = dp[i][m-1] = 1-dp[i][s];
            changed = true;
          } else {
            dp[i][m] = dp[i][m-1] = dp[i][s];
          }
        }
      }

      func(s, m);
      func(m, t);
    }


    void solve(istream& cin, ostream& cout) {
      SPEED;
      int a, b; cin >> n >> a >> b;
      int ac = __builtin_popcount(a);
      int bc = __builtin_popcount(b);
      if ((ac+bc)%2==0) {
        cout << "NO" << endl;
        return;
      }
      cout << "YES" << endl;
      dp.resize(n, vector<int>(1<<n, -1));
      int k = 1<<n;
      rep(i, n) {
        rep(j, k) {
          dp[i][j] = -1;
        }
      }
      rep(i, n) {
        if (a & (1 << i)) {
          dp[i][0] = 1;
        } else {
          dp[i][0] = 0;
        }
        if (b & (1 << i)) {
          dp[i][k-1] = 1;
        } else {
          dp[i][k-1] = 0;
        }
      }

      func(0, k);

      rep(i, k) {
        int ret = 0;
        rep(j, n) {
          ret += dp[j][i] * (1<<j);
        }
        cout << ret << ' ';
      }
      cout << endl;

    }
};

signed main() {
  CDifferBy1Bit solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 9852
# C Marks
N, K = map(int, input().split())
A = list(map(int, input().split()))  # リストがうまく作れてない？ 
j = 0
i = K
ct = 1
while ct <= (N - K):
    if A[j] < A[i]:
        print("Yes")
    else:
        print("No")
    j += 1
    i += 1
    ct += 1


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

void lunlun_gen(ll num, vector<ll> &lunlun_num, int keta_num, int end_num) {
    if (keta_num == end_num) return;
    if (num != 0) {
        lunlun_num.push_back(num);
    }
    rep(i, 10) {
        if (num == 0) {
            if (i == 0) continue;
            lunlun_gen(num*10+i, lunlun_num, keta_num+1, end_num);
        }
        else {
            if (num % 10 - 1 >= 0 && i == num % 10 - 1) {
                lunlun_gen(num*10+i, lunlun_num, keta_num+1, end_num);
            }
            if (num % 10 + 1 <= 9 && i == num % 10 + 1) {
                lunlun_gen(num*10+i, lunlun_num, keta_num+1, end_num);
            }
            if (num % 10 == i) {
                lunlun_gen(num*10+i, lunlun_num, keta_num+1, end_num);
            }
        }
    }
    return;
}

int main(){
    ll k;
    cin >> k;
    ll now_num = 1;
    vector<ll> lunlun_num;
    lunlun_gen(0, lunlun_num, 0, 11);
    sort(lunlun_num.begin(), lunlun_num.end());
    cout << lunlun_num[k-1] << endl;
    return 0;
}


Measured memory_bytes: 5348
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define mod 1e9 +7;
typedef long long ll;
typedef vector<ll> vll;
const double phi = (1 + sqrt(5)) / 2;
const double phi_ = (1 - sqrt(5)) / 2;
ll fib(ll n){
    double res = pow(phi, n+1) - pow(phi_, n+1);
    return res / sqrt(5);
}
ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}
ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}
string to_bin_string(ll n){
    stringstream ss;
    ss << bitset<8>(n); //任意の桁数<m>
    string s = ss.str();
    return s;
}
int main()
{
    ll n, m;
    cin >> n >> m;
    cout << (ll)((100*(n-m) + 1900*m)*pow(2, m)) << endl;
    return 0;
} 

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

int main() {
    string s;
    cin >> s;
    if (s[1] == s[2]) {
        if (s[0] == s[1])
            cout << "Yes" << endl;
        else if (s[2] == s[3])
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    } else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;

int main(void){
  int N, T;
  cin >> N >> T;
  vector<int> c(N), t(N);
  REP(i, N) cin >> c[i] >> t[i];
  int ans = INF;
  REP(i, N){
    if(c[i] < ans && t[i] <= T) ans = c[i];
  }
  if(ans == INF){
    cout << "TLE" << endl;
    return 0;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	char s[200], p[100];
	int slen = 0, plen = 0, i = 0, cnt = 0;

	while ((s[i] = getchar()) != '\n') {
		i++;
	}
	slen = i;

	i = 0;
	while ((p[i] = getchar()) != '\n') {
		i++;
	}
	plen = i;

	for (i = slen; i < 2 * slen - 1; i++) {
		s[i] = s[i - slen];
	}

	for (i = 0; i < 2 * slen - 1; i++) {
		if (s[i] == p[0]) {
			cnt = 0;
			while (true) {
				if (s[i + cnt] != p[cnt]) break;
				if (cnt == plen - 1) { printf("Yes\n"); goto saigo; }
				cnt++;
			}
		}
	}
	printf("No\n");

saigo:
	return 0;
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  string s;
  cin >> s;
  auto dp = make_v< int >(s.size() + 1, 5);
  fill_v(dp, -inf);
  dp[0][0] = 0;
  for(int i = 0; i < s.size(); i++) {
    for(int j = 0; j < 5; j++) {
      for(int k = 1; k < 5 && i + k <= s.size(); k++) {

        if(dp[i][j] >= 0) {
          string x, y;
          for(int p = 0; p < j; p++) x += s[i - p - 1];
          reverse(begin(x), end(x));
          for(int p = 0; p < k; p++) y += s[i + p];

          if(x != y) {
            chmax(dp[i + k][k], dp[i][j] + 1);
          }
        }


      }
    }
  }

  int ret = 0;
  for(auto &p : dp.back()) chmax(ret, p);
  cout << ret << endl;
}




Measured memory_bytes: 13544
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
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; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	vector<int> a(N); rep(i, 0, N) {
		cin >> a[i];
	}
	int cnt = 0;
	while (true) {
		bool ok = true;
		rep(i, 0, N) {
			if (a[i] >= N)
				ok = false;
		}
		if (ok)break;
		auto m = max_element(all(a));
		int k = (*m - (N - 1)) / N + !!((*m - (N - 1)) % N);
		int mi = m - a.begin();
		cnt += k;
		rep(i, 0, N) {
			if (i == mi)
				a[i] -= k*N;
			else
				a[i] += k;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
M, d = map(int, input().split())

count = 0
for m in range(1, M+1):
    for d in range(1, d+1):
        if d % 10 >= 2 and d // 10 >= 2 and ((d % 10) * (d // 10) == m):
            count += 1
print(count)

Measured memory_bytes: 2940
#include <algorithm>
#include <bits/stdc++.h>
#define MOD 1000000007

using namespace std;
using ll = long long;

int main()
{
    int a,b;
    int n;
    while(cin >> n){
        string s,s1;
        cin >> s >> s1;
        string r = "";
        for( int i = 0; i < n; i++ ){
            r.push_back(s[i]);
            r.push_back(s1[i]);
        }
        cout << r << "\n";
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define array(N,t) (t*)calloc(N,sizeof(t))
typedef long long LL;
inline LL IN(void)
{
  LL x=0;int f=1;char c=getchar();
  while((c<'0'||c>'9')&&c!='-')c=getchar();
  if(c=='-')f=-f,c=getchar();
  while(c>='0'&&c<='9')x=x*10+c-48,c=getchar();
  return f*x;
}
int main(void)
{
  int N,i,j,p;LL K;
  N=IN(),K=IN();
  int *A=array(N,int),*town=array(N,int);
  for(i=0;i<N;i++)A[i]=IN(),town[i]=-1;
  for(i=0,j=0;;i=A[i]-1,j++)if(town[i]<0)town[i]=j;else break;
  for(p=0;K>0;p=A[p]-1,K--)if(i==p){K%=town[i]-j;if(!K)break;}
  free(A),free(town);
  return printf("%d\n",p+1),0;
}

Measured memory_bytes: 2876
#include <iostream>
#include <math.h>

typedef long long ll;

using namespace std;

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

	ll n1 = (a % x == 0) ? a / x : a / x + 1;
	ll n2 = (b % x == 0) ? b / x : b / x;

	cout << n2 - n1 + 1 << endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
int main(){
	char a,b;
	cin>>a>>b;
	int x=a-'A',y=b-'A';
	if(x<y)
		cout<<'<';
	else if(x>y)
		cout<<'>';
	else
		cout<<'=';
}


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

long long func(long long n, long long k)
{
  if(n * 2 <= k) return n;
  n -= n/k * k;
  return abs(n-k) < n ? abs(n-k) : n;
}

int main()
{
  long long n, k;
  cin >> n >> k;
  long long ans = func(n, k);
  cout << ans << endl;
}

Measured memory_bytes: 3512
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main() {
  int i, j = 0, k, N;
  long ans = 0;
  long H[100001];
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%ld", H + i);
  }
  for (i = 0; i < N - 1; i++) {
    if (H[i + 1] <= H[i]) {
      j++;
    }
    else {
      if (j > ans) {
        ans = j;
      }
      j = 0;
    }
  }

  if (j > ans) {
    ans = j;
  }
  printf("%ld", ans);
  return 0;
  }

Measured memory_bytes: 896
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ
char in[210][210];
int g[210][210];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)for(int j=0;j<a;j++)g[i][j]=mod;
	for(int i=0;i<a;i++)g[i][i]=0;
	for(int i=0;i<a;i++){
		scanf("%s",in[i]);
		for(int j=0;j<a;j++){
			if(in[i][j]=='1')g[i][j]=1;
		}
	}
	for(int k=0;k<a;k++)for(int i=0;i<a;i++)for(int j=0;j<a;j++)g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
	int ret=0;
	for(int i=0;i<a;i++){
		bool ok=true;
		int t=0;
		for(int j=0;j<a;j++)t=max(t,g[i][j]);
		for(int j=0;j<a;j++)for(int k=0;k<a;k++){
			if(in[j][k]=='1'){
				if(ABS(g[i][j]-g[i][k])!=1)ok=false;
			}
		}
		if(!ok){
			printf("-1\n");return 0;
		}

		ret=max(ret,t+1);
	}
	printf("%d\n",ret);
}

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

int main() {
    int H,W;
    cin >> H >> W;
    vector<string> s(H);
    for(int i=0;i<H;i++){
        cin >> s.at(i);
    }
    for(int i=0;i<W+2;i++){
        cout << "#";
    }
    cout << endl;
    for(int i=0;i<H;i++){
        cout << "#" << s.at(i) << "#" << endl;
    }
    for(int i=0;i<W+2;i++){
        cout << "#";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"reflect"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	X := nextInt64()
	happiness := int64(0)
	happiness += int64(X/500) * 1000
	happiness += int64((X%500)/5) * 5

	fmt.Println(happiness)

}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}

// -*-*-*-*-*-*-*-*-
// * tool snippets *
// -*-*-*-*-*-*-*-*-
func duplicate2Int(base [][]int) (ret [][]int) {
	ret = make([][]int, len(base))
	for i, v := range base {
		ret[i] = append([]int{}, v...)
	}
	return
}

// -*-*-*-*-*-*-*-*-*-*-*-*-*-
// * Algorithms Utility Zone *
// -*-*-*-*-*-*-*-*-*-*-*-*-*-

// -*-*-*-*-*-*-*-
// * 1. nibutan  *
// -*-*-*-*-*-*-*-
func lower_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if arr[mid] < target {
			l = mid + 1
		} else {
			r = mid
		}
	}
	return l
}

func upper_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if target < arr[mid] {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l
}

// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// * math flavor typical theories *
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
func gcd(a, b int) int {
	if a > b {
		return gcd(b, a)
	}
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

func pow(a, b int) (ret int) {
	ret = a
	// 10^2 = 100ってことは10に10を1回掛けることだね
	// なので初期値を含めると上限b-1未満
	for i := 0; i < b-1; i++ {
		ret *= a
	}
	return
}

func powMod(n, m, mod int) (ret int) {
	ret = 1
	for m > 0 {
		if m&1 == 1 {
			ret *= n
			ret %= mod
		}
		n *= n
		n %= mod
		m >>= 1
	}
	return ret
}


Measured memory_bytes: 640
#include <algorithm>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <regex>
#include <sstream>
#include <string>
#include <thread>
#include <tuple>
#include <type_traits>
#include <vector>

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

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

    ll a;
    double b;
    cin >> a >> b;
    ll ib = b * 100 + 0.5;
    cout << a * ib / 100 << endl;
    return 0;
}


Measured memory_bytes: 3168
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;

// typedef
typedef long long ll;
typedef unsigned long ul;
// #define int long long

// macro
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // 値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)  // 直後の要素をパディング
#define space_pad(num) setfill(' ') << std::right << setw(num)  // 直後の要素をパディング

// func declaration
template <class T> void print2DVec(vector< vector<T> >&);
template <class T> void calcVec(vector<T>&, int, char);
int char_to_int(const char);

// const
const int INF = 10000000;

/*MEMO
・辞書順
abc < abcd, atcoder < atlas
・イテレータ
std::vector<int>::iterator とタイプするのは面倒なので、
 通常は型推論の auto を使用する。
 auto iter = max_element(ALL(vec));
・2次元配列
vector<vector<int>> vec = {{1, 2, 3}, {4, 5, 6}}
・20×10の配列
vector<vector<int>> vec(20, vector<int>(10, 0));
・(n, m)の多次元配列
vector< vector<int> > vec(n, vector<int>(m, 0))  // 0で初期化
*/

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

    // input
    int X, A, B;
    cin >> X >> A >> B;
    
    // calculation
    X -= A;
    X -= X/B * B;
    cout << X << "\n";
    
    return 0;
}


// function
template <class T> void print2DVec(vector< vector<T> >& vec) {
    REP(i, vec.size()) {
        REP(j, vec.front().size()) {
            cout << vec.at(i).at(j);
        }
        cout << endl;
    }
}

template <class T> void calcVec(vector<T> &vec, int num, char ch) {
    // vec全体への演算
    switch (ch) {
        case '+':
            REP(i, vec.size()) vec.at(i) += num; break;
        case '-':
            REP(i, vec.size()) vec.at(i) -= num; break;
        case '*':
            REP(i, vec.size()) vec.at(i) *= num; break;
        case '/':
            REP(i, vec.size()) vec.at(i) /= num; break;
        case '%':
            REP(i, vec.size()) vec.at(i) %= num; break;
        default:
            cout << "Incorrect Operator" << endl;
    }
}

int char_to_int(const char c) {
    if('0' <= c && c <= '9') return (c - '0');
    return -1;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

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

        int sx = sc.nextInt();
        int sy = sc.nextInt();
        int tx = sc.nextInt();
        int ty = sc.nextInt();

        System.out.println(solve(sx, sy, tx, ty));

        sc.close();
    }

    static String solve(int sx, int sy, int tx, int ty) {
        int dx = tx - sx;
        int dy = ty - sy;

        return String.join("", repeat('U', dy), repeat('R', dx), repeat('D', dy), repeat('L', dx + 1),
                repeat('U', dy + 1), repeat('R', dx + 1), "DR", repeat('D', dy + 1), repeat('L', dx + 1), "U");
    }

    static String repeat(char ch, int count) {
        return IntStream.range(0, count).mapToObj(i -> String.valueOf(ch)).collect(Collectors.joining());
    }
}

Measured memory_bytes: 26964
#include <stdio.h>

#define SQUARE(X) ((X)*(X))

/** Application main entry point. */
int main (
  int argc,
  char *argv[ ]
  )
{
  int n;

  scanf ( "%d", &n );

  while ( n-- )
  {
    double xa, ya, ra;
    double xb, yb, rb;
    double d;

    scanf ( " %lf %lf %lf", &xa, &ya, &ra );
    scanf ( " %lf %lf %lf", &xb, &yb, &rb );

    d = SQUARE( xb - xa ) + SQUARE( yb - ya );

    if ( d <= SQUARE( ra + rb ) )
    {
      if ( d < SQUARE( ra - rb ) )
      {
        if ( ra > rb )
        {
          puts ( "2" );
        }
        else
        {
          puts ( "-2" );
        }
      }
      else
      {
        puts ( "1" );
      }
    }
    else
    {
        puts ( "0" );
    }
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
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<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//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 SQ(a) ((a)*(a))
#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 SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

LL Gcd(LL a, LL b) {
  if (a < b) {
    return Gcd(b,a);
  }
  if (b == 0) {
    return a;
  }
  else {
    return Gcd(b,a%b);
  }
}

LL Lcm(LL a, LL b) {
  LL abd = Gcd(a,b);
  LL x = a / abd, y = b / abd;
  
  return x*y*abd;
}


LL RepSqu(LL N, LL P, LL M) {
  if(P == 0) {
    return 1;
  }
  if(P%2 == 0) {
    LL t = RepSqu(N, P/2, M);
    return t*t % M;
  }
  return (N * RepSqu(N, P-1, M)) % M;
}


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

int main() {
  VVI A(3,VI(3));
  vector<VB> C(3,VB(3,false));
  bool ans = false;
  REP(i,3){
    REP(j,3){
      cin >> A.at(i).at(j);
    }
  }
  int N;
  cin >> N;
  
  REP(i,N){
    int b;
    cin >> b;
    REP(i,3){
      REP(j,3){
        if(A.at(i).at(j) == b){
        C.at(i).at(j) = true;
        }
      }
    }
  }
  
  REP(i,3){
    if(C.at(i).at(0) && C.at(i).at(1) && C.at(i).at(2)){
      ans = true;
    }
     if(C.at(0).at(i) && C.at(1).at(i) && C.at(2).at(i)){
      ans = true;
    }
  }
  if(C.at(0).at(0) && C.at(1).at(1) && C.at(2).at(2)){
      ans = true;
    }
  if(C.at(0).at(2) && C.at(1).at(1) && C.at(2).at(0)){
      ans = true;
    }
  
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=500005;
struct ab
{
	int x,y,id;
	ab operator- (const ab a){return (ab){x-a.x,y-a.y};}
	int operator^ (const ab a){return x*a.y-y*a.x;}
} t1[N],t2[N],s[N],q[N];
int x[N],v[N],top,Q,flag[N];
double ans[N];
int cmp(ab x,ab y)
{
	if(x.x==y.x) return x.y<y.y;
	return x.x<y.x;
}
int cmp1(ab x,ab y)
{
	return x.y*y.x-x.x*y.y<0;
}
int le(ab x,ab y,ab z)
{
	return ((z-x)^(y-x))<=0;
}
double get(ab x,ab y)
{
	return ((double)x.y-y.y)/(x.x-y.x);
}
signed main()
{
	int n,X,T,tot1=0,tot2=0;
	scanf("%lld%lld%lld",&n,&X,&T);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",x+i,v+i);
		x[i]-=X,v[i]-=T;
		if(x[i]<=0&&v[i]>0) t1[++tot1]=(ab){-x[i],v[i],0};
		if(x[i]>=0&&v[i]<0) t2[++tot2]=(ab){x[i],-v[i],0};
	}
	t1[++tot1]=(ab){0,0,0};
	t2[++tot2]=(ab){0,0,0};
	sort(t2+1,t2+1+tot2,cmp);
	for(int i=1;i<=tot2;i++)
	{
		while(top>1&&le(s[top-1],s[top],t2[i])) top--;
		s[++top]=t2[i];
	}
	for(int i=1;i<=n;i++)
	{
		if(x[i]>0) continue;
		q[++Q]=(ab){x[i],-v[i],i};
	}
	for(int i=1;i<=Q;i++)
	{
		int l=1,r=top,now=1;
		while(l<=r)
		{
			int mid=(l+r)>>1;
			if(le(s[mid-1],s[mid],q[i])||mid==1) l=mid+1,now=mid;
			else r=mid-1;
		}
		if(s[now].x==q[i].x) ans[q[i].id]=0;
		else if(s[now].y==q[i].y||s[now].y<q[i].y||s[now].x<q[i].x) flag[q[i].id]=-1;
		else ans[q[i].id]=((double)s[now].x-q[i].x)/(s[now].y-q[i].y);
	}
	sort(t1+1,t1+1+tot1,cmp);
	top=0;
	for(int i=1;i<=tot1;i++)
	{
		while(top>1&&le(s[top-1],s[top],t1[i])) top--;
		s[++top]=t1[i];
	}
	Q=0;
	for(int i=1;i<=n;i++)
	{
		if(x[i]<0) continue;
		q[++Q]=(ab){-x[i],v[i],i};
	}
	sort(q+1,q+1+Q,cmp1);
	for(int i=1;i<=Q;i++)
	{
		int l=1,r=top,now=1;
		while(l<=r)
		{
			int mid=(l+r)>>1;
			if(le(s[mid-1],s[mid],q[i])||mid==1) l=mid+1,now=mid;
			else r=mid-1;
		}
		if(s[now].x==q[i].x) ans[q[i].id]=0;
		else if(s[now].y==q[i].y||s[now].y<q[i].y||s[now].x<q[i].x) flag[q[i].id]=-1;
		else ans[q[i].id]=((double)s[now].x-q[i].x)/(s[now].y-q[i].y);
	}
	for(int i=1;i<=n;i++)
	{
		if(flag[i]) printf("-1\n");
		else printf("%.14lf\n",ans[i]);
	}
	return 0;
}


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

a = input()
a = a.split(" ")

a = [int(i) for i in a]

ave = sum(a) / N

sa = float("inf")

for i in range(N):
  if sa > abs(a[i] - ave):
    sa = abs(a[i] -ave)
    index = i
print(index)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N;
  string S;
  cin >> N >> S;
  ll r=0,g=0,b=0;
  rep(i,N) {
    if(S[i]=='R') r++;
    if(S[i]=='G') g++;
    if(S[i]=='B') b++;
  }
  ll ans=r*g*b;
  
  rep2(i,1,(N-1)/2+1) {
    rep(j,N-2*i) {
      if(S[j]!=S[j+i]&&S[j+i]!=S[j+2*i]&&S[j+2*i]!=S[j]) ans--;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3644
package main

import (
	"fmt"
)

func main() {
  var a, b, add, ct int
  fmt.Scan(&a)
  fmt.Scan(&b)
  add = 1
  for i:=0; add < b; i++ {
    add = add + a - 1
    ct++
  }
  fmt.Println(ct)
}
      
    
	

Measured memory_bytes: 1768
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
typedef long long int ll;

int n,m,q;

int a[55],b[55],c[55],d[55];
int ans=0;

void dfs(int cnt,int p,vector<int> v){
    if(cnt==n){
        int res=0;
        for(int i=0;i<q;i++){
            if(v[b[i]]-v[a[i]]==c[i]){
                res+=d[i];
            }
        }
        ans=max(res,ans);
        return;
    }
    for(int i=p;i<=m;i++){
        vector<int> vv=v;
        vv.push_back(i);
        dfs(cnt+1,i,vv);
    }
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> n >> m >> q;
    vector<int> v;
    for(int i=0;i<q;i++){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--;
        b[i]--;
    }
    dfs(0,1,v);
    printf("%d\n",ans);
}

Measured memory_bytes: 3760
#pragma warning(disable: 4996)
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <sstream>
#include <fstream>
#include <math.h>
#include <algorithm>
#include <map>
#include <bitset>
#include <queue>

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

int main() {
    ll a[2],b[2];
    ll ans = -1000000000000000005;
    rep(i, 2) {
        cin >> a[i];
    }
    rep(i, 2) {
        cin >> b[i];
    }
    rep(i, 2) {
        rep(j, 2) {
            ans = max(ans, a[i] * b[j]);
        }
    }
    cout << ans << endl;
   
    return 0;
}

Measured memory_bytes: 3164
#include <cstdio>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {
    string s, t;
    int n=0;
    cin >> s >> t >> n;
    
    if (s[0] == t[0]) n++;
    if (s[1] == t[1]) n++;
    if (s[2] == t[2]) n++;
    cout << n << endl;
   return 0;
}

Measured memory_bytes: 256
def main():
    from collections import defaultdict

    N = int(input())
    *a, = map(int, input().split())

    i_m_Ai = defaultdict(int)
    i_p_Ai = defaultdict(int)
    for i, x in enumerate(a, start=1):
        i_m_Ai[i - x] += 1
        i_p_Ai[i + x] += 1

    ans = 0
    keys = {*i_p_Ai.keys(), *i_m_Ai.keys()}

    for key in keys:
        ans += (i_p_Ai[key] * i_m_Ai[key])
    print(ans)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


Measured memory_bytes: 172704
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin>>N;
    int P[100]={};
    for(int i=0;i<N;i++){
        int A;
        cin>>A;
        P[i]=A;
    }
    int max=0;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(abs(P[i]-P[j])>=max){
                max=abs(P[i]-P[j]);
            }
        }
    }
    cout<<max<<endl;
}


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

int main(){
   
      ll a,b,c,n;
      string s;
      cin >> a >> b;
      cout << 6-a-b << endl;
      
  }


Measured memory_bytes: 256
import sys
import math
 
n = int(input())
T,A = 1,1
for i in range(n):
    t,a = map(int,input().split(" "))
    coef = max((T+t-1)//t,(A+a-1)//a)
    T,A = coef * t, coef * a 
print(T+A) 

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
int main() {
	char a[102];
	char b[102];
	int c, d;

	scanf("%s", a);
	fflush(stdin);
	scanf("%s", b);
	fflush(stdin);

	c = strlen(a); d = strlen(b);
	if (c>d) {
		printf("GREATER\n");
	}
	else if (c < d) {
		printf("LESS\n");
	}
	else if (strcmp(a, b) < 0) {
		printf("LESS\n");
	}
	else if (strcmp(a, b) == 0) {
		printf("EQUAL\n");
	}
	else if (strcmp(a, b) > 0) {
		printf("GREATER\n");
	}
	return 0;
}

Measured memory_bytes: 128