akhauriyash/Code-Regression huggingface dataset:
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

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

string s;
vpi mainchain;
signed main(){
    cin >> s;
    int sz = s.size();
    REP(i,sz-1){
        if (s[i] != s[sz-2-i]){
            cout << -1 << endl;
            return 0;
        }
    }
    if (s[0] == '0' || s[sz-1] == '1'){
        cout << -1 << endl;
        return 0;
    }

    REP(i,sz-1){
        int no = i+1;
        if (s[i] == '1') mainchain.eb(no,no);
        mainchain.back().second++;
    }

    int ch = mainchain.size();
    mainchain.eb(sz,sz);

    REP(i,ch){
        FOR(j,mainchain[i].first,mainchain[i+1].first){
            printf("%lld %lld\n", j, mainchain[i].second);
        }
    }

}

//1001010010
// tBu -Ety- tBu


Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define typeof(x) __typeof__(x)
#define int long long int
#define double long double
#define mod(x) ((x % MOD) + MOD) % MOD
#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) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) (UB(c,x)-LB(c,x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (s).find(e)!=(s).end()
#define PB push_back
#define MP make_pair
#define vec vector
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define NL cerr << endl;

using namespace std;

typedef pair<int,int> P;
struct edge { int from, to; int cost; };
ostream& operator << (ostream& s, const edge& e) {
   s << "(" << e.from << "->" << e.to << ": " << e.cost << ")";
   return s;
}
bool operator< (const edge &edge1, const edge &edge2){
   return edge1.cost < edge2.cost;
};

const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator << (ostream& s, const vector<T>& v) {
   s << "[";
   for (int i = 0; i < v.size(); i++) { s << v[i]; if (i < v.size() - 1) s << " "; }
   s << "]";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const pair<T1,T2>& p) {
   s << "(" << p.first << "," << p.second << ")";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const map<T1,T2>& m) {
   s << "{";
   for (auto i = m.begin(); i != m.end(); ++i) {
      s << i->first << ":" << i->second;
      if (next(i) != m.end()) s << ", ";
   }
   s << "}";
   return s;
}

signed main()
{
   string s; cin >> s;

   char prev0 = 'a'-1;
   char prev1 = 'a'-1;

   REP(i, 0, SZ(s)) {
      if (prev0 == s[i]) {
         cout << i-1 << " " << i+1 << endl;
         return 0;
      }
      if (prev1 == s[i]) {
         cout << i << " " << i+1 << endl;
         return 0;
      }
      prev0 = prev1;
      prev1 = s[i];
   }

   cout << "-1 -1" << endl;

   return 0;
}


Measured memory_bytes: 512
N,K = map(int, input().split())
l = list(map(int, input().split()))
num = [i for i in range(10) if i not in l]

#print(l)
while True:    
    N_str = str(N)
    frag = 0
    for i in range(len(N_str)):
        if int(N_str[i]) in l:
            #print("yes")
            frag = 1
            break
    if frag == 0:
        break
    else:
        N += 1
print(N)



Measured memory_bytes: 3060
def solve():
    N, Y = list(map(int, input().split()))
    for a in range(N+1):
        b = ((Y - 10000*a) - 1000*(N - a))
        if b % 4000 != 0:
            continue
        else:
            b = int(b/4000)
            c = N - a - b
            if a >= 0 and b >= 0 and c >= 0:
                return a,b,c
    return -1, -1, -1

res = solve()
print(res[0], res[1], res[2])

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

int main(){
    string s;
    cin >> s;
    int times = s.length()-2;
    int ans = 999;
    rep(i, times){
        int num = (s[i]-48) *100 + (s[i+1]-48) * 10 + (s[i+2]-48);
        ans = min(ans, abs(num-753));
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
using System.Security.Principal;
using System.Text;
class Simple
{
    int H, W;
    string[] A;
    void Solve() {
        //input
        H = io.Int;
        W = io.Int;
        A = new string[H];
        for (int i = 0; i < H; ++i)
            A[i] = Console.ReadLine();
        //cal       
        var cnt = 0;
        for (int i = 0; i < H; ++i) for (int j = 0; j < W; ++j) {
            if (A[i][j] == '#')
                cnt++;
        }
        var flag = cnt == H + W - 1;
        //ret
        Console.WriteLine(flag ? "Possible" : "Impossible");
    }
    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Simple().Stream();
    void Stream() {
        Solve();
        io.writeFlush();
    }
}
class SimpleIO
{
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] { ' ' };
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if (BufferCnt < nextBuffer.Length) return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}


Measured memory_bytes: 13140
#line 2 "../../library/template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define rep3(i, l, r) for(ll i = l; i < (ll)r; i++)
#define per(i, n) for(ll i = (ll)n-1; i >= 0; i--)
#define per3(i, l, r) for(ll i = (ll)r-1; i >= (ll)l; i--)
#define all(v) begin(v), end(v)
template<class T, class U> inline void cmax(T& a, U b) { if (a < b) a = b; }
template<class T, class U> inline void cmin(T& a, U b) { if (a > b) a = b; }
constexpr char el = '\n';
template<class T, class U> ostream &operator<<(ostream &os, const pair<T, U>& p) { os << p.first << " " << p.second; return os; }
template<class T, class U> istream &operator>>(istream &is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<class T> ostream &operator<<(ostream &os, const vector< T > &v) { rep(i, v.size()) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }
template<class T> istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; }
struct IoSetup {
  IoSetup() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15); }
} io_setup;
#line 2 "d.cpp"

vl gen_primes(ll n) {
  vector<bool> is_prime(n+1, true);
  is_prime[0] = is_prime[1] = false;
  rep(i, n+1) {
    if (is_prime[i]) {
      for (ll j = 2*i; j <= n+1; j += i) {
        is_prime[j] = false;
      }
    }
  }
  vl res;
  rep(i, n+1) {
    if (is_prime[i])
      res.push_back(i);
  }
  return res;
}

int main() {
  auto vec = gen_primes(55'555);
  ll n;
  cin >> n;
  for (auto&& i : vec) {
    if (n and i%5 == 4) {
      n--;
      cout << i << " ";
    }
  }
  cout << el;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int x;
  cin>>x;
  ll sum=x;
  int count=1;
  while(sum%360!=0){
    sum+=x;
    count++;
  }
  cout<<count<<'\n';
  return(0);
}


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

int n, pn, qn, c=0;
vector<int> p, q, tmp;

void dfs(int cur){
  if(cur == n){
    c++;

    if(p==tmp){
      pn = c;

    }
    if(q==tmp){
      qn = c;
    }
    return;
  }

  for(int i=1; i<=n; i++){
    bool find = false;
    for(int j=0; j<cur; j++)  if(tmp[j]==i){
      find=true;
      break;
    }
    if(find) continue;
    tmp[cur]=i;
    cur++;
    dfs(cur);
    cur--;
  }
}

int solve(){
  cin >> n;
  p = vector<int>(n);
  q = vector<int>(n);
  tmp = vector<int>(n);
  for(int i=0; i<n; i++)  cin >> p[i];
  for(int i=0; i<n; i++)  cin >> q[i];

  dfs(0);
  cout << abs(pn-qn) << endl;
  return 0;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
# a**bのmodを取りたい時に高速にできる
def modpow(a, n, mod):
    res = 1
    # 45 = 101101
    # ここでいう、1X11X1の部分飲み計算すれば良い
    # a**45 = a**32 + a**8 + a**4 + a**1なので、これだけ計算すれば良い
    # そしてそのためには、45を2進数に変えて、右ビットシフトしていけばok
    # なので、n >>= 1をする
    # ex)45,22,11,5,2,1
    while (n > 0):
        # print(n, a, res)
        # 3&1みたいな論理積とった結果、両方1のものがあった場合にresにたす
        if n & 1:
            res = res * a % mod
        # a = 掛け算の結果を更新する。
        # a*b の mod(c)は。a mod(c)*b mod(c)と同じなので、掛け算するaもmodをとっていく
        a = a * a % mod
        # n>>1で、1桁ずつ減らしていく
        # 101101 > 10110みたいな
        # 先頭の1文字が減るわけではない。45->45-32みたいな感じではない
        # でも、やりたいのは、1X11X1の部分のみ計算するための、右bitシフトなので45->22の部分に特に意味はない
        # 101101 > 10110をすることで末尾が一つずつ消していけることが重要
        # n=n>>1をすることで二進法展開ができる
        n = n >> 1
    return res


def modcomb(n, r, mod):
    if r > n - r:
        r = n - r
    nPr, rPr = 1, 1
    for i in range(r):
        nPr = nPr * (n - i) % mod
        rPr = rPr * (i + 1) % mod
    # print(n, r, nPr, rPr)
    # nCrのmodを高速に取りたい
    # nCr は nPr / rPr
    # 1/(33333P33333)のmodを取りたい
    # 1/277540578 のmodを取りたい
    # print(nPr, modpow(rPr, mod - 2, mod))
    # nCrのmodを高速にとる。nPr / rPr を nPr * (1/rPr)に分ける
    # modにおいて、rPrにbをかけると1になる。そのようなbがrPrの逆元である
    return nPr * modpow(rPr, mod - 2, mod) % mod


def main():
    X, Y = map(int, input().split())
    n = (-X + 2 * Y) / 3
    m = (2 * X - Y) / 3
    # これで(i+1,j+2)をとる回数がn回(i+2,j+1)をとる回数がm回だとわかる
    # 少数が出てきたら計算できないので0を返す
    if not(n.is_integer() and m.is_integer()):
        return 0
    if n >= 0 and m >= 0:
        # n+mCnを計算する。modを高速にとる
        return modcomb(int(n + m), int(n), mod=10 ** 9 + 7)
    else:
        return 0


print(main())
# print(modpow(277540578, 10**9 + 5, 10**9 + 7))


Measured memory_bytes: 38544
t = [int(input()) for _ in range(5)]
ans = 0
min_b = 10
for i in range(5):
  a = t[i]//10
  b = t[i]%10
  if b == 0:
    ans += a
  else:
    if min_b > b:
      min_b = b
    ans += a+1
print(ans*10 - (10-min_b))

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list> 
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<string>
#include<fstream>
#include<set>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define ll long long
#define ld long double
#define pb push_back
#define ld long double
#define vi vector<int>
#define vll vector<long long>
#define pi pair<int,int>
#define pll pair<long long,long long>
#define mp make_pair
#define B begin()
#define E end()
#define S size()
#define m9 1000000007
using namespace std;


 
/*
string fs(string str1, string str2)
{    if (str1.length() > str2.length())
        swap(str1, str2);
      string str = "";
    int n1 = str1.length(), n2 = str2.length();
    int diff = n2 - n1;
      int carry = 0;
      for (int i=n1-1; i>=0; i--)
    {
 
        int sum = ((str1[i]-'0') +
                   (str2[i+diff]-'0') +
                   carry);
        str.push_back(sum%10 + '0');
        carry = sum/10;
    }
      for (int i=n2-n1-1; i>=0; i--)
    {
        int sum = ((str2[i]-'0')+carry);
        str.push_back(sum%10 + '0');
        carry = sum/10;
    }
      if (carry)
        str.push_back(carry+'0');
      reverse(str.begin(), str.end());
 
    return str;
}*/
 
ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}
 
/*
ll gcdextended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    ll x1, y1; 
    int gcd = gcdextended(b%a, a, &x1, &y1); 
   
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
}
 
 
///RELATIVE COPRIME
ll modinverse(ll a, ll m) 
{ 
    ll x, y; 
   ll g = gcdextended(a, m, &x, &y); 
    if (g != 1) 
return -1;
    else
    { 
        ll res = (x%m + m) % m; 
        return res;  
    } 
} 
  */
ll powmod(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = powmod(x, y/2, m) % m; 
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
} 
///M IS PRIME
ll modif(ll x,ll m){
return(powmod(x,m-2,m));
 
}
 
bool fa(vll &x,vll &y){return x[0]<y[0];}
bool fa1(vll &x,vll &y){return x[1]<y[1];}
bool f1(pll &x,pll &y){return x.second<y.second;}
bool f2(pll &x,pll &y){return x.first>y.first;}
bool f3(ll &x,ll &y){
    return x>y; 
    }

#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define pin(a) for(auto x:a)cout<<x<<" ";cout<<endl
#define fck(a) cout<<a;exit(0)
#define vvll vector<vector<ll> >
#define A(b) b.begin(),b.end()


//include<bits/stdc++.h>


int main()
{ fastio;
//freopen("input.txt", "r", stdin); 
//freopen("output.txt", "w", stdout);


ll n;cin>>n;
ll x=n*n;
ll y=x*n;
cout<<x+y+n;








return 0;
}

Measured memory_bytes: 3632
//#define DEB1 //input from input.txt
//#define NDEBUG
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <thread>
#include <mutex>
#include <iomanip>
#include <cassert>

#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define ALL(t) (t).begin(),(t).end()
#define FILL(a,c) fill(a, a+ sizeof(a)/sizeof(*a),c)
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
#define REP(i,m) for(int i=0;i<(m);++i)
// closed interval, inverse repeat
#define CIREP(i,start,fin) for(int i=(start);i>=(fin);i--)
#define CREP(i,start,fin) for(int i=(start);i<=(fin);i++)
#define RNG(i,start,fin) for(int i=(start);i<(fin);i++)
#define IN(a, x, b) (a<=x && x<b)
#define PB push_back
#define SZ(x) (int)(x).size()

using namespace std;

using LL = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<LL,LL>;
using VI = vector<int>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VVI = vector<VI>;
const LL LINF = 1001002003004005006ll;
/* 
template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,SZ(v))i>>v[j];return i;}

template<typename T>string join(const vector<T>&v)
{stringstream s;REP(i,SZ(v))s<<' '<<v[i];return s.str().substr(1);}

template<typename T>inline ostream& operator<<(ostream&o,const vector<T>&v)
{if(SZ(v))o<<join(v);return o;}
*/

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




/*
constant values
*/

//const int dx[] = {1,0,-1,0};
//const int dy[] = {0,1,0,-1};
//const int MX = 31001;

//const ll INF= 1LL<<60 ;//INF = 1001001001001; //1e9


// Main program
void solve(){
    int N;
    string S;
    string str ("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    cerr << str.size();
    cin >> N;
    cin >> S;
    string ans = S;
    int L = S.size();

    REP(i,L){
        char a = S[i];
        REP(j,26){
            cerr << a << endl;
            if(a==str[j]){
                ans[i]=str[(j+N)%26];
            }
        }
    }
    cout << ans << endl;

    return;
}



// ----------------------------------------------
int main(){

#ifdef DEB1
    cout << "DEBUG MODE"  << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf()); //for debug
#endif

    int T=1; 

    for (int i = 0; i < T; ++i) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 384
import itertools, operator

N, C = map(int, input().split())
Ds = [list(map(int, input().split())) for i in range(C)]
cs = [list(map(int, input().split())) for i in range(N)]

Ds = list(map(list, zip(*Ds))) # 転置

cnts = [[0] * C for k in range(3)]
for i in range(N):
    for j in range(N):
        cnts[(i + j) % 3][cs[i][j] - 1] += 1

ws = [[0] * C for k in range(3)]
for k in range(3):
    for c in range(C):
        ws[k][c] = sum(map(operator.mul, cnts[k], Ds[c]))

ans = float('inf')
for x, y, z in itertools.permutations(range(C), 3):
    w = ws[0][x] + ws[1][y] + ws[2][z]
    ans = min(ans, w)

print(ans)


Measured memory_bytes: 5620
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cctype>
#include <climits>
#include <fstream>

using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second
using namespace std;


 
int main(){
    int a,b;
    string op;
    cin>>a>>op>>b;
    if(op == "+"){
        cout<<a+b<<endl;
    }else if(op == "-"){
        cout<<a-b<<endl;
    }
    return 0;
}


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

int x, y, a, b, c;

int main() {
	cin >> x >> y >> a >> b >> c;
	int cnt = x+y;

	priority_queue<int> q1, q2, q3;
	for (int i = 1; i <= a; i++) {
		int l; cin >> l;
		q1.push(l);
	}

	for (int i = 0; i < x; i++) {
		q3.push(q1.top()); q1.pop();
	}

	for (int i = 1; i <= b; i++) {
		int l; cin >> l;
		q2.push(l);
	}

	for (int i = 0; i < y; i++) {
		q3.push(q2.top()); q2.pop();
	}

	for (int i = 1; i <= c; i++) {
		int l; cin >> l;
		q3.push(l);
	}

	long long ans = 0LL;
	while (cnt--) {
		ans += q3.top(); q3.pop();
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3188
import queue
h,w = map(int,input().split())

city = [list(input()) for i in range(h)]
count = [[-1]*w for i in range(h)]
dx = [0,1,0,-1]
dy = [1,0,-1,0]
que = queue.Queue()

white = 0
for i in range(h):
  for j in range(w):
    if city[i][j] == ".":
      white += 1

def short():
  que.put([0,0])
  count[0][0] = 0
  while not que.empty():
    p = que.get()
    if p[0] == h-1 and p[1] == w-1:
      exit
    for i in range(4):
      ny = p[0] + dy[i]
      nx = p[1] + dx[i]
      if 0 <= nx < w and 0 <= ny < h and city[ny][nx] != "#" and count[ny][nx] == -1:
        que.put([ny,nx])
        count[ny][nx] = count[p[0]][p[1]] + 1    
  return count[h-1][w-1]

if short() >= 0:
  print(white - short() - 1)
else:
  print(short())

Measured memory_bytes: 3952
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  vector<int> a(5);
  ll minSum = 999999999;
  ll curSum;

  REP(i, 5) {
    cin >> a[i];
  }

  REP(i, 5) {
    REP(j, 5) {

      REP(k, 5) {

        REP(l, 5) {

          REP(m, 5) {
            curSum = a[i];
            if(i == j) continue;
            if(curSum % 10 != 0) {
              curSum += 10 - (curSum % 10);
            }
            curSum += a[j];

            if(i == k || j == k) continue;
            if(curSum % 10 != 0) {
              curSum += 10 - (curSum % 10);
            }
            curSum += a[k];

            if(i == l || j == l || k == l) continue;
            if(curSum % 10 != 0) {
              curSum += 10 - (curSum % 10);
            }
            curSum += a[l];

            if(i == m || j == m || k == m || l == m) continue;
            if(curSum % 10 != 0) {
              curSum += 10 - (curSum % 10);
            }
            curSum += a[m];

            minSum = min(minSum, curSum);
          }
        }
      }
    }
  }

  cout << minSum << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split())) #リスト形式の数値入力

ans = 0
high = 0
for i in range(1,N):
    if A[i-1] > high:
        high = A[i-1]
    if high > A[i]:
        ans += high - A[i]

print(ans)

Measured memory_bytes: 32096
#include<bits/stdc++.h>
#include<math.h>
#include <stdio.h>
#include<vector>
#include<deque>
#include<stdlib.h>
//#include <algorithm>
#include<set>
#include <limits>
#include<string>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
#define d_5 100000
#define d9_7 1000000007int N;

int main(void){
  string s;
  cin >> s;
  int now=0;
  int samenum=0;
  int result=0;
  //cout << s.size();
  s=s+"A";
  //cout << s.size();
  while(now<s.size()-1){
    //cout << " ss" << now << "e" << result << endl;
    if(s[now]!=s[now+1]){
      if(samenum==0){
        result++;
        now++;
        continue;
      }else if(samenum==1){
        if(now==s.size()-2){
          result++;
          break;
        }
        result+=2;
        now+=2;
        samenum=0;
        continue;
      }else{
        if(samenum%3==2){
          //cout << "1w" <<result<< endl;
          result+=((samenum+1)*2)/3;
          now++;
          samenum=0;
        }else if(samenum%3==0){
          //cout << "2w"<<result<<"eee"<<samenum<< endl;
          result+=2*(samenum/3) + 1;
          samenum=0;
          now++;
        }else if(samenum%3==1){
          //cout << "3w"<<result<< endl;
          if(now==s.size()-2){
            if(samenum==1){
              result++;
              break;
            }
            result+=((samenum+1)/3)*2 + 1;
            break;
          }
          result+=((samenum+1)/3)*2 + 2;
          samenum=0;
          now+=2;
        }
      }
    }else if(s[now]==s[now+1]){
        if(now==s.size()-2&&samenum==1){
          result++;
          break;
        }
      samenum++;
      now++;
    }
  }
  cout << result;
	return 0;
}

Measured memory_bytes: 772
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
using namespace std;
typedef long long ll;

const int MAXN = (int)3e5 + 2;
int N;
int cnt[MAXN] = {0}, pre[MAXN] = {0};
int pos[MAXN] = {0};
int f[MAXN] = {0}, ans[MAXN] = {0};

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

    sort(cnt + 1, cnt + 1 + N);

    for (int i = 1; i <= N; i++)
        pre[i] = pre[i - 1] + cnt[i];

    cnt[N + 1] = (int)1e9;
    for (int i = 1, x = 1; i <= N + 1 && x <= N; i++)
    {
        while (x <= N && cnt[i] >= x)
        {
            pos[x] = i;
            x++;
        }
    }

    for (int x = 1; x <= N; x++)
    {
        f[x] = (pre[pos[x] - 1] + (N - pos[x] + 1) * x) / x;
    }

    for (int i = 1; i <= N; i++)
    {
        ans[f[i]] = max(ans[f[i]], i);
    }

    for (int k = N - 1; k >= 0; k--)
    {
        ans[k] = max(ans[k], ans[k + 1]);
    }

    for (int k = 1; k <= N; k++)
    {
        cout << ans[k] << endl;
    }

    // for (int i = 1; i <= N; i++)
    //     cout << pos[i] << " ";
    // system("pause");
}

Measured memory_bytes: 6784
(v=>{
    const n = ~~(v.split('\n')[0])
    const s = v.split('\n')[1]
    let tmp = {'r':0, 'g':0, 'b':0}
    const arr = {'r':[],'g':[],'b':[]}
    for(let i=0;i<n;++i){
        if(s[i]=='R')tmp.r++
        if(s[i]=='G')tmp.g++
        if(s[i]=='B')tmp.b++
        arr.r.push(tmp.r)
        arr.g.push(tmp.g)
        arr.b.push(tmp.b)
    }
    const sm = {'r':arr.r[n-1], 'g':arr.g[n-1], 'b':arr.b[n-1]}
    const keys = {'R': 'gb', 'G':'br', 'B': 'rg'}
    let res = 0
    for(let i=1; i<n-1; ++i){
        const k = keys[s[i]]
    
        res += arr[k[0]][i-1] * (sm[k[1]] - arr[k[1]][i])
        res += arr[k[1]][i-1] * (sm[k[0]] - arr[k[0]][i])
        for(j=i-1,jj=i+1;j>=0&&jj<n;j--,jj++){
            if(s[i]!=s[j] && s[j]!=s[jj] && s[jj] != s[i]){
                res--
            }
        }
    }
    console.log(res)
})(require("fs").readFileSync("/dev/stdin", "utf8"))

Measured memory_bytes: 34140
import math


def main():
    n = int(input())
    maxv = -1
    for x in range(1, int(math.pow(n, 1/2))+1):
        t = x**2
        if t > maxv and t <= n:
            maxv = t
    print(maxv)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

x = int(arr_data[0][0])
y = int(arr_data[0][1])

arr01 = [1, 3, 5, 7, 8, 10, 12]
arr02 = [4, 6, 9, 11]


if (x in arr01 and y in arr01) or (x in arr02 and y in arr02):
    
    print("Yes")
    
else:
    
    
    print("No")

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int H=stdIn.nextInt();
		int N=stdIn.nextInt();
		int ans=0;
		for(int i=0;i<N;i++){
			ans+=stdIn.nextInt();
		}
		if(ans>=H)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}


Measured memory_bytes: 46852
N = int(input())
d = list(map(int, input().split()))
d.sort()
M = int(input())
t = list(map(int, input().split()))
t.sort()
idx = 0
for i in range(N):
    if idx != M and d[i] == t[idx]:
        idx += 1
if idx == M:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 122704
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <bitset>
#include <stack>

using namespace std;

typedef long long ll;

const ll prime = 10000000000 + 7;

/*
vector<int> z_algorithm(const string& s) {
	vector<int> prefix(s.size());
	for (int i = 1, j = 0; i < s.size(); i++)
	{
		if (i + prefix[i - j] < j + prefix[j]) {
			prefix[i] = prefix[i - j];
		}
	}
}
*/

int main() {
	
	ll n;
	cin >> n;
	vector<ll> m(n);
	vector<ll> vec(n + 1);
	for (ll i = 0; i < n; i++)
	{
		cin >> m[i];
		vec[m[i]] = i + 1;
	}

	for (ll i = 1; i < n; i++)
	{
		cout << vec[i] << " ";
	}
	cout << vec[n] << endl;


	return 0;
}

Measured memory_bytes: 2432
#include<iostream>
using namespace std;
int main(){
  int x,y;

  while(cin >> x >> y){
    int temp;
    if(x==0 && y==0) break;
    while(y!=0){
      x = x % y;
      temp = x;
      x = y;
      y = temp;
    }
    cout << x << endl;
  }
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    char tmp  = s[0];
    int cnt = 1;
    for(int i=1; i<n; i++){
        if(s[i] != tmp){
            cnt++;
            tmp = s[i];
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 512
s = str(input())
n = len(s)
dp = [[0,0] for i in range(n+1)]
for i in range(n):
  for j in [1,2]:
    for k in [1,2]:
      if i + k <= n:
        a = s[i-j:i]
        b = s[i:i+k]
        if a != b:
          dp[i+k][k-1] = max(dp[i+k][k-1],dp[i][j-1]+1)
print(max(dp[n]))

Measured memory_bytes: 38160
#include <bits/stdc++.h>
using namespace std;
int dp[200005];
int main()
{
	int n,k,c;
	string s;
	cin >> n >> k >> c >> s;
	vector<int> v({-(int)1e9}),ans;
	for (int i=0;i<n;i++)
	{
		if (s[i]=='o')
		v.push_back(i);
	}
	for (int i=n-1;i>=0;i--)
	{
		if (s[i]=='x')
		continue;
		dp[i]=1;
		int tmp=upper_bound(v.begin(),v.end(),i+c)-v.begin();
		if (tmp!=v.size())
		dp[i]=dp[v[tmp]]+1;
		if (dp[i]>k)
		return 0;
	}
	int cur=v[0];
	while (1)
	{
		int nex=upper_bound(v.begin(),v.end(),cur+c)-v.begin();
		if (nex==v.size())
		break;
		if (nex+1==v.size() || dp[v[nex]]!=dp[v[nex+1]])
		ans.push_back(v[nex]+1);
		cur=v[nex];
	}
	for (int i:ans)
	printf("%d\n",i);
}

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

int main() {
  ll n, m; cin>>n>>m;
  ll ans = n-m;
  if (ans > 0) cout<<ans<<endl;
  else cout<<0<<endl;
}


Measured memory_bytes: 256
// -*- coding:utf-8-unix -*-

use proconio::{fastout, input};
use std::collections::BTreeSet;

#[fastout]
fn main() {
    input! {
        n: usize,
        mut a: [usize; n],
    }
    a.sort_unstable();
    let a = a;

    let mut setwise_gcd = a[0];
    for i in 2..=n {
        setwise_gcd = gcd(setwise_gcd, a[i - 1]);
    }
    if setwise_gcd > 1 {
        println!("not coprime");
        return;
    }

    let mut nononecount = 0;
    for &ai in &a {
        if ai == 1 {
            continue;
        }
        nononecount += 1;
    }
    if nononecount > 78498 {
        println!("setwise coprime");
        return;
    }

    // Sieve of Eratosthenes
    const PMAX: usize = 1000000;
    let mut is_prime: Vec<bool> = vec![true; PMAX];
    is_prime[0] = false;
    is_prime[1] = false;
    let mut primes_vec: Vec<usize> = Vec::new();
    for i in 2..PMAX {
        if is_prime[i] {
            for j in i..=(PMAX - 1) / i {
                is_prime[i * j] = false;
            }
            primes_vec.push(i);
        }
    }
    let _ = is_prime;
    let primes_vec = primes_vec;

    let mut already_got = vec![false; primes_vec.len()];

    for &ai in &a {
        if ai == 1 {
            continue;
        }
        match primes_vec.binary_search(&ai) {
            Ok(i) => {
                if already_got[i] {
                    println!("setwise coprime");
                    return;
                } else {
                    already_got[i] = true;
                }
                continue;
            }
            Err(_) => {}
        }

        for i in 0..primes_vec.len() {
            let p = primes_vec[i];
            if p > ai {
                continue;
            }
            if ai % p == 0 {
                if already_got[i] {
                    println!("setwise coprime");
                    return;
                } else {
                    already_got[i] = true;
                }
            }
        }
    }
    println!("pairwise coprime");
}

fn gcd(m: usize, n: usize) -> usize {
    if m < n {
        return gcd(n, m);
    } else if n == 0 {
        return m;
    } else {
        return gcd(n, m % n);
    }
}


Measured memory_bytes: 17672
h,w=map(int,input().split())
lll=[list("."*(w+2))]
G=[list("."+input()+".") for _ in range(h)]
G=lll+G+lll
#print(G)
for i in range(1,h+1):
  for j in range(1,w+1):
    if G[i][j]=="#" and G[i-1][j]==G[i+1][j]==G[i][j-1]==G[i][j+1]==".":
      print("No")
      exit()
print("Yes")  


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m1 = sc.nextInt();
        int d1 = sc.nextInt();
        int m2 = sc.nextInt();
        int d2 = sc.nextInt();

        if (m1 != m2) {
            System.out.println('1');
        } else {
            System.out.println('0');
        }

    }
}


Measured memory_bytes: 23632
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes) if b else print(no)
# from collections import Counter,deque,defaultdict
# import itertools
import math
# import networkx
# from bisect import bisect_left,bisect_right
a,b,h,m=n1()

m1=m*360/60
h1=(60*h+m)*360/(12*60)

hx=a*math.sin(math.radians(h1))
hy=a*math.cos(math.radians(h1))
mx=b*math.sin(math.radians(m1))
my=b*math.cos(math.radians(m1))

ans=math.dist([mx,my],[hx,hy])
print(ans)

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 1e5 + 5;
ll n, k, t, sum, ans;
int cnt[41];
ll benf[41][2];
int main() {
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> t;
        for (int j = 0; j < 41; ++j) {
            if (t & (1LL << j)) {
                ++cnt[j];
            }
        }
    }
    ll base = 1;
    for (int i = 0; i <= 40; ++i) {
        benf[i][0] = base * cnt[i];
        benf[i][1] = base * (n - cnt[i]);
        base *= 2;
    }

    base /= 2;
    for (int i = 40; i >= 0; --i) {
        // cout << i << ' ' << cnt[i] << ' ' << benf[i][0] << ' ' << benf[i][1] << endl;
        if (benf[i][0] >= benf[i][1]) {
            ans += benf[i][0];
        } else {
            if (sum + base > k) {
                ans += benf[i][0];
            } else {
                ans += benf[i][1];
                sum += base;
            }
        }
        base /= 2;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
    int n, m, i, j, count = 0;
    cin >> n >> m;
    int a[m][2];
    queue<int> q;
    for(i=0; i<m; i++){
        cin >> a[i][0] >> a[i][1];
    }
    for(i=0; i<m; i++){
        int visit[n+1] = {};
        int path[n+1][n+1] = {};
        visit[1]++;
        q.push(1);
        for(j=0; j<m; j++){
            if(j != i){
                path[a[j][0]][a[j][1]]++;
                path[a[j][1]][a[j][0]]++;
            }
        }

        while(!q.empty()){
            int tem = q.front();
            q.pop();
            for(j=1; j<=n; j++){
                if(path[tem][j] == 0) continue;

                if(visit[j] == 0){
                    visit[j]++;
                    q.push(j);
                }
            }
        }

        for(j=1; j<=n; j++){
            if(visit[j] == 0){
                count++;
                break;
            }
        }
    }
    cout << count;
    return 0;
}

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

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

	ll res = 1e18;

	for(int i=1;i<n;i++){
		ll h1 = i*m;
		ll h2 = max(((n-i)/2)*m,(n-i)*(m/2));
		ll h3 = (n-i)*m-h2;
		//cout<<"h3:"<<h3<<endl;
		vector<ll> v = {h1,h2,h3};
		sort(v.begin(),v.end());
		res = min(res,v[2]-v[0]);
	}
	swap(n,m);
	for(int i=1;i<n;i++){
		ll h1 = i*m;
		ll h2 = max(((n-i)/2)*m,(n-i)*(m/2));
		ll h3 = (n-i)*m-h2;
		vector<ll> v = {h1,h2,h3};
		sort(v.begin(),v.end());
		res = min(res,v[2]-v[0]);
	}

	cout<<res;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <cstring>
#include <unordered_set>
using namespace std;

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

int main() {
	ll n, x;
	cin >> n >> x;
	ll prev; cin >> prev;
	ll ret = 0;
	for (int i = 1; i < n; i++) {
		ll a; cin >> a;
		if (a+prev > x) {
			ll m = a+prev-x;
			ret += m;
			a = max(0ll, a-m);
		}
		prev = a;
	}
	cout << ret << '\n';
}

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

int main() {
  vector<string> s = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
  string t;
  cin >> t;
  for (int i = 0; i < 7; i++) {
    if (t == s.at(i)) {
      cout << 7 - i << endl;
      return 0;
    }
  }
}


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

vector<int> SuffixArray(string s){
  int n = s.size(), k;
  vector<int> sa(n+1), rank(n+1);

  auto comp = [&](int i, int j){
    if(rank[i] != rank[j]) return rank[i] < rank[j];
    return (i+k < n ? rank[i+k] : -1) < (j+k < n ? rank[j+k] : -1);
  };
  for(int i = 0; i <= n; i++){
    sa[i] = i;
    rank[i] = i < n ? s[i] : -1;
  }
  for(k = 1; k <= n; k *= 2){
    sort(sa.begin(),sa.end(),comp);
    auto tmp = rank;
    tmp[sa[0]] = 0;
    for(int i = 1; i <= n; i++){
      tmp[sa[i]] = tmp[sa[i-1]] + comp(sa[i-1], sa[i]);
    }
    rank = tmp;
  }
  return sa;
}

template<class T>
struct SparseTable{
  vector<vector<T>> dat;
  vector<int> height;

  SparseTable(){};
  SparseTable(vector<T> v){
    int n = v.size(), h = 0;
    while ((1<<h) < n) h++;
    dat.assign(h, vector<T> (1<<h)); height.assign(n+1, 0);
    for(int i = 2; i <= n; i++) height[i] = height[i>>1] + 1;
    for(int i = 0; i < n; i++) dat[0][i] = v[i];
    for(int i = 1; i < h; i++){
      for(int j = 0; j < n; j++){
        dat[i][j] = min(dat[i-1][j], dat[i-1][min(j+(1<<(i-1)),n-1)]);
      }
    }
  }
  T getval(int a, int b) {
    return min(dat[height[b-a]][a], dat[height[b-a]][b - (1<<height[b-a])]);
  }
};

struct LongestCommonPrefixArray{
  vector<int> lcp, rank;
  SparseTable<int> st;
  LongestCommonPrefixArray(string s, vector<int> sa){
    int n = s.size();
    lcp.resize(n+1, 0), rank.resize(n+1);
    for(int i = 0; i <= n; i++){
      rank[sa[i]] = i;
    }
    int h = 0;
    for(int i = 0; i < n; i++){
      int j = sa[rank[i] - 1];
      if(h > 0) h--;
      for(; max(i, j) + h < n; h++){
        if(s[i + h] != s[j + h]) break;
      }
      lcp[rank[i] - 1] = h;
    }
    st = SparseTable<int>(lcp);
  }

  int getlcp(int a, int b){
    return st.getval(min(rank[a], rank[b]), max(rank[a], rank[b]));
  }
};

signed main(){

  int n; cin >> n;
  string s; cin >> s;

  auto sa = SuffixArray(s);
  LongestCommonPrefixArray lcp(s, sa);
  int ans = 0;
  for(int i = 0; i < n; i++){
    for(int j = i+1; j < n; j++){
      ans = max(ans, min(j - i, lcp.getlcp(i, j)));
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1408
s = input()
s1 = s[0 : len(s) // 2]
s2 = s[len(s) // 2  + 1 : len(s)]
c, c1, c2 = 0, 0, 0
flag = 0
for i in range(len(s) // 2):
    if s[i] != s[len(s) - i - 1]:
        break
    else:
        c += 1
if c != len(s) // 2:
    print("No")
    exit()
for i in range(len(s1) // 2):
    if s1[i] != s1[len(s1) - i - 1]:
        break
    else:
        c1 += 1
if c1 != len(s1) // 2:
    print("No")
    exit()
for i in range(len(s2) // 2):       
    if s2[i] != s2[len(s2) - i - 1]:
        break
    else:
        c2 += 1
if c2 != len(s2) // 2:
    print("No")
    exit()
print("Yes")
    


Measured memory_bytes: 3064
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
TA = [LIST() for _ in range(N)]
vote_T = 1
vote_A = 1
for x, y in TA:
	n = max((vote_T+x-1)//x, (vote_A+y-1)//y)
	vote_T = x * n
	vote_A = y * n
print(vote_A + vote_T)


Measured memory_bytes: 9968
package main

import "fmt"

func HasSuffix(s, suf string) bool {
	return len(s) >= len(suf) && s[len(s)-len(suf):] == suf
}

func TrimSuffix(s, suf string) string {
	return s[:len(s)-len(suf)]
}

func main() {
	var s string
	fmt.Scan(&s)

	div := []string{"dream", "dreamer", "erase", "eraser"}

	ans := true
	for len(s) > 0 {
		flg := false
		for _, suf := range div {
			if HasSuffix(s, suf) {
				s = TrimSuffix(s, suf)
				flg = true
				break
			}
		}
		if !flg {
			ans = false
			break
		}
	}

	if ans {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 1280
import collection.mutable.ListBuffer
import io.StdIn

object Main extends App {

  def primeFact(n:Long):List[Long] = {
    val ret = ListBuffer.empty[Long]

    var num = n
    var root = 2L
    while(root * root <= num) {
      if(num % root == 0L) {
        ret += root
        num /= root
      }
      else root += 1L
    }

    (ret += num).toList
  }

  val n = StdIn.readLong

  val ans = primeFact(n)
  println(n + ": " + ans.mkString(" "))
}


Measured memory_bytes: 43828
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Int32;
using static System.Math;

class Program
{

    static void Main(string[] args)
    {
        label:
        ReadLine();
        var list = ReadLine().Split().Select(Parse).ToList();
        list.Sort();
        bool alice = list.Count % 2 == 1;
        int result = 0;
        foreach(int num in list)
        {
            if (alice) result += num;
            else result -= num;
            alice = !alice;
        }
        WriteLine(result);
        //goto label;
    }
}


Measured memory_bytes: 13396
fun main(args: Array<String>) {
    val (a, b) = readLine()!!.split(" ").map(String::toInt)
    if (a >= b) {
        for(i in 0 until a) {
            print(b)
        }
    } else if(a <= b) {
        for(j in 0 until b) {
            print(a)
        }
    }
}

Measured memory_bytes: 37872
#include <iostream>
#include <vector>
#include <array>
#include <stack>
#include <queue>
#include <algorithm>

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

  std::string ans = "APPROVED";
  for (int i=0; i<n; ++i)
    {
      int a;
      std::cin >> a;

      if (a % 2 == 0)
        {
          if ((a % 3 != 0) && (a % 5 != 0))
            {
              ans = "DENIED";
            }
        }
    }
  std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main(void){
    char s[12];
    for(int i=0;i<12;i++)s[i]='A';
    scanf("%s",s);
    int d,x;
    int min=999;
    for(int i=0;i<12;i++)if(s[i]!='A')d=i;
    for(int i=0;i<d;i++){
        for(int j=i+1;j<d;j++){
            for(int k=j+1;k<d;k++){
                x=(s[i]-'1'+1)*100+(s[j]-'1'+1)*10+(s[k]-'1'+1)*1;
                if(abs(x-753)<min&&i+1==j&&j+1==k)min=abs(x-753);
            }
        }
    }
    printf("%d\n",min);
}

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

#define pb push_back
#define mp make_pair
#define fst first
#define snd second

#define fr(i,n) 	for(int i=0;i<n;i++)
#define frr(i,n)	for(int i=1;i<=n;i++)
#define pv(x, n)    fr(iii, n) printf("%d%c", x[iii], " \n"[iii==n-1])
#define pvv(x, n)    frr(iii, n) printf("%d%c", x[iii], " \n"[iii==n])
#define vp(v)        pv(v, v.size()) 


#define ms(x,i)	memset(x,i,sizeof(x))
#define dbg(x)	cout << #x << " = " << x << endl
#define all(x)	x.begin(),x.end()
#define otp(x) cout << x << endl;
#define rvr(x) int x; scanf("%d", &x)
#define gnl cout << endl
#define olar cout << "olar" << endl
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;

const int N = 1e5 + 1;

ll freq[N];

int main(){
    rvr(n);
    ll k; scanf("%lld", &k);
    fr(i, n){
        rvr(a); rvr(b);
        freq[a] += (ll)b;
    }
    int i = 1;
    while(k){
        if(freq[i] >= k){
            printf("%d\n", i);
            return 0;
        }
        k -= freq[i++];
    }
}


Measured memory_bytes: 1024
N = int(input())
A = input()
B = input()

ptn = []
i = 0
while i < N:
    if A[i] == B[i]:
        ptn.append(1)
        i += 1
    else:
        ptn.append(2)
        i += 2

MOD = 10**9+7
ans = 3 * ptn[0]
for a,b in zip(ptn,ptn[1:]):
    if a == 1 and b == 1:
        ans *= 2
    elif a == 1 and b == 2:
        ans *= 2
    elif a == 2 and b == 2:
        ans *= 3
    ans %= MOD
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#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++)
typedef long long ll;

int main(){
  char c;
  cin >> c;
  cout << char(c+1);
  return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

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

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

typedef pair <ll,ll> P;

bool pairCompareF(const P& firstElof, const P& secondElof)
{
    return firstElof.first < secondElof.first;
}

bool pairCompareS(const P& firstElof, const P& secondElof)
{
    return firstElof.second < secondElof.second;
}

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<P> store(N);
    rep(i, N)
    {
        P p;
        cin >> p.first >> p.second;
        store[i] = p;
    }
    sort(store.begin(), store.end(), pairCompareF);
    ll count = 0;
    for (long i = 0; i < store.size(); i++)
    {
        while(store[i].second > 0) {
            count += store[i].first;
            store[i].second--;
            M--;
            if (M == 0)
            {
                cout << count << endl;
                return 0;
            }
        }
    }

}



Measured memory_bytes: 1792