akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
using namespace std;
const int N=1e5+10, mod=1e9+7;

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	int n,i,x,ct=0;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>x;
		if(x!=i) ct++;
	}
	cout<<( (ct==2||ct==0)?"YES":"NO");
}
// check for any potential overflow before submitting


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

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

  int n; cin >> n;
  vector<int> a(n),b(n+1,0);
  for(int i = 0; i < n; i++){
    cin >> a[i];
    b[i+1] += a[i] + b[i];
  }

  vector< vector<int> > dp(401,vector<int>(401,-1));
  //dp[l][r] = {[l,r)を合体するときの最小コスト}

  function< int(int,int) > rec =
  [&](int l,int r){
    if(dp[l][r] != -1) return dp[l][r];
    if(l == r-1) return 0LL;

    int cost = b[r] - b[l];
    int res = 1LL << 60;
    for(int mid = l+1; mid < r; mid++){
      res = min(res,rec(l,mid) + rec(mid,r) + cost);
    }
    return dp[l][r] = res;
  };
  cout << rec(0,n) << endl;

  return 0;
}


Measured memory_bytes: 1536
N, K = map(int, input().split())
A = list(map(int, input().split()))

route = [0]
routeset = {0}
now_i = 0
loop_len = 0
for i in range(1, N):
    next_i = A[now_i]-1
    if next_i in routeset:
        loop_len = i - route.index(next_i)
        break
    routeset.add(next_i)
    route.append(next_i)
    now_i = next_i


base = len(route) - loop_len

if K < len(route):
    print(route[K]+1)
else:
    K -= base
    m = K % loop_len
    idx = route[base:][m]
    print(idx+1)



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

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    ll k,n;
    cin>>k>>n;
    vi v(n);
    rep(i,0,n-1) cin>>v[i];
    ll ans=k;
    rep(i,0,n-2){
        ans=min(ans,k-(v[i+1]-v[i]));
    }
    ans=min(ans,k-(k-v[n-1]+v[0]));
    cout<<ans;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 3000000000000000000; //3*10^18
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    int N; cin >> N;
    map<pair<int,int>,int> color;
    vector<vector<int>> G(N+1);
    vector<pair<int,int>> edge(N-1);
    int tmp1,tmp2;
    for (int i = 0; i < N-1; i++) {
        cin >> tmp1 >> tmp2;
        edge[i] = make_pair(tmp1, tmp2);
        G[tmp1].push_back(tmp2);
        G[tmp2].push_back(tmp1);
    }
    
    queue<int> bfs;
    vector<int> fin(N+1,-1);
    bfs.push(1);
    fin[1] = 0;
    int tmp, tmpp, cnt;
    while(!bfs.empty()){
        cnt = 1;
        tmp = bfs.front();
        bfs.pop();
        tmpp = fin[tmp];
        for(int i : G[tmp]){
            if(fin[i] != -1){
                continue;
            }
            else{
                if(cnt == tmpp) cnt++;
                fin[i] = cnt;
                if(tmp < i){
                    color[make_pair(tmp, i)] = cnt;
                }
                else{
                    color[make_pair(i, tmp)] = cnt;
                }
                cnt++;
                bfs.push(i);
            }
        }
    }
    cnt = 0;
    for (int i = 0; i < N-1; i++) {
        cnt = max(cnt, color[edge[i]]);        
    }
    printf("%d\n", cnt);
    for (int i = 0; i < N-1; i++) {
        printf("%d\n", color[edge[i]]);
    }



}


Measured memory_bytes: 13440
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
import itertools
import math
from operator import mul
from functools import reduce

mod = 10 ** 9 + 7

n = I()
if n < 2:
    ans = 0
elif n == 2:
    ans = 2
else:
    ans = 0
    # 1．普通に10個からN個重複ありで選ぶ
    a = pow(10, n, mod)
    # ２．0と9をのぞいた9個からn個重複選ぶ
    b = pow(9, n, mod) * 2
    # ３．0と9を除いた8個からn個重複ありで選ぶ
    c = pow(8, n)
    # 0を除いた配列からn個選ぶ過程で、9が選ばれていない場合がある。
    # 逆に9を除いた配列からn個選ぶ過程で、0が選ばれてない場合がある。
    # 2回引くと、0も9も選ばれていない組み合わせが余計にひかれているので足しこむ。
    ans = (a-b+c) % mod

print(ans)


Measured memory_bytes: 10480
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a;cin>>a;
  if(a=="A")cout<<"T"<<endl;
  else if(a=="T")cout<<"A"<<endl;
  else if(a=="C")cout<<"G"<<endl;
  else if(a=="G")cout<<"C"<<endl;
}

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

//#pragma GCC optimize ("Ofast")
//#pragma GCC target ("avx,avx2")

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define dbg(x) cerr<<#x<<" : "<<x<<endl

typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vii;
const ll INF = 1e18+1;
const ll MOD = 1000000007L;
clock_t time_p=clock();
void timer(){time_p=clock()-time_p;cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";}

template <typename Arg1> ostream& operator << (ostream& out, const vector<Arg1> &a) {out<<"[ ";for(const auto &x:a)out<<x<<" ";return out<<"]";}


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    vector<vi> a(n , vi (n-1,0));
    rep(i,n){
        rep(j,n-1){
            cin>>a[i][j];
            a[i][j]--;
        }
    }
    vi next(n,0); //next match idx

    ll ans = 0;
    queue<pair<ll,pii>> q;
    rep(i,n){
        if(a[i][next[i]] < i){
            ll j = a[i][next[i]];
            if(a[j][next[j]] == i){
                q.push({1,{i,a[i][next[i]]}});
            }
        }
    }

    while(!q.empty()){
        auto top = q.front();
        q.pop();
        ans = max(ans,top.X);
        next[top.Y.X]++;
        next[top.Y.Y]++;
        if(next[top.Y.X] < n-1){
            ll j = a[top.Y.X][next[top.Y.X]];
            if(a[j][next[j]] == top.Y.X){
                q.push({top.X+1,{j,top.Y.X} });
            }
        }
        if(next[top.Y.Y] < n-1){
            ll j = a[top.Y.Y][next[top.Y.Y]];
            if(a[j][next[j]] == top.Y.Y){
                q.push({top.X+1,{j,top.Y.Y} });
            }
        }
    }
    rep(i,n){
        if(next[i] < n-1){
            cout<<-1<<endl;
            exit(0);
        }
    }
    cout<<ans<<endl;

    timer();
    return 0;
}


Measured memory_bytes: 8064
var f = [];

function main(){
  for(var y=-2;y<12;y++){
    f[y] = [];
    for(var x=-2;x<12;x++){
      f[y][x] = 0;// initialize:undefined -> 0
    }
  }
  
  for(var i=0,len=input.length - 1;i<len;i++){
    //var s = input[i].split(',');
    //eval("d"+s[2]+"("+s[0]+","+s[1]+");");
    eval("d"+input[i][4]+"("+input[i][0]+","+input[i][2]+");");
  }

  var nd=0;//not dropped
  var md=0;//most dropped
  for(var y=0;y<10;y++){
    for(var x=0;x<10;x++){
      if(f[y][x] == 0)
        nd++;
      if(f[y][x] > md)
        md = f[y][x];
    }
  }

  console.log(nd);
  console.log(md);
}

function d1(x, y){
  f[y+1][x]++;
  f[y][x-1]++;
  f[y][x]++;
  f[y][x+1]++;
  f[y-1][x]++;
}

function d2(x, y){
  d1(x, y);
  f[y+1][x-1]++;
  f[y+1][x+1]++;
  f[y-1][x-1]++;
  f[y-1][x+1]++;
}

function d3(x, y){
  d2(x, y);
  f[y+2][x]++;
  f[y-2][x]++;
  f[y][x-2]++;
  f[y][x+2]++;
}

var
input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main();
});

Measured memory_bytes: 7640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int lim = sc.nextInt();
        String str = sc.next();
        sc.close();
        String result;

        if(str.length()>lim) {
            result = str.substring(0,lim);
            System.out.println(result+"...");
        } else {
            result = str;
            System.out.println(result);
        }


    }
}

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

int main(){
  bool bmap[10][10],fin = false;
  char s[10];
  while(true){
    for(int i=1;i<=8;i++){
      if(scanf("%s",s) == EOF){
	fin = true;
	break;
      }
      for(int j=0;j<8;j++){
	if(s[j] == '0')bmap[i][j+1] = false;
	else bmap[i][j+1] = true;
      }
    }
    if(fin)break;
    for(int i=1;i<=8;i++){
      for(int j=1;j<=8;j++){
	if(bmap[i][j]){
	  if(j+1<= 8 && i+1<=8 &&bmap[i][j+1] && bmap[i+1][j] && bmap[i+1][j+1]){
	    cout << "A" << endl; break;
	  }
	  else if(i+3<=8 && bmap[i+1][j] && bmap[i+2][j] && bmap[i+3][j]){
	    cout << "B" << endl; break;
	  }
	  else if(j+3<=8 && bmap[i][j+1] && bmap[i][j+2] && bmap[i][j+3]){
	    cout << "C" << endl; break;
	  }
	  else if(i+2<=8 && 1<=j-1 && bmap[i+1][j] && bmap[i+1][j-1] && bmap[i+2][j-1]){
	    cout << "D" << endl; break;
	  }
	  else if(i+1<=8 && j+2<=8 && bmap[i][j+1] && bmap[i+1][j+1] && bmap[i+1][j+2]){
	    cout << "E" << endl; break;
	  }
	  else if(i+2<=8 && j+1<=8 && bmap[i+1][j] && bmap[i+1][j+1] && bmap[i+2][j+1]){
	    cout << "F" << endl; break;
	  }
	  else if(i+1<=8 && 1<=j-1 && j+1<=8 && bmap[i][j+1] && bmap[i+1][j] && bmap[i+1][j-1]){
	    cout << "G" << endl; break;
	  }
	}
      }
    }
  
  }
  return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
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); }

//CODE

void solve(void)
{
  int X;
  cin>>X;
  cout<<48  - X<<endl;

  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, x, y) for (ll i = x; i <= y; i++)
#define BIT(t) (1ll << t)
#define PER(i, y, x) for (ll i = y; i >= x; i--)
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define pll pair<ll, ll>
#define SIZE(v) ll(v.size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
//        ios::sync_with_stdio(false);
//        cin.tie(nullptr);

ll const MOD = 998244353;
ll mod_p(ll x, ll y) {
       x %= MOD;
       y %= MOD;
       return (x + y + MOD) % MOD;
}

ll mod_m(ll x, ll y) {
       x %= MOD;
       y %= MOD;
       return x * y%MOD;
}

ll mod_pow(ll x, ll t) {
       x %= MOD;
       if (t == 0) {
               return 1;
       }
       else {
               ll v = mod_pow(x, t / 2);
               if (t % 2 == 0) {
                       return v * v % MOD;
               }
               else {
                       return v * v%MOD * x %MOD;
               }
       }
}

ll mod_inv(ll x) {
       return mod_pow(x, MOD - 2);
}

vll fct(1e7 + 5), invfct(1e7 + 5), pow2(1e7 + 5);
void init(){
        fct[0] = invfct[0] = pow2[0] = 1;
        REP(i,1,1e7 + 2){
                fct[i] = mod_m(fct[i-1], i);
                invfct[i] = mod_inv(fct[i]);
                pow2[i] = mod_m(pow2[i-1], 2);
        }
}

ll ncr(ll x,ll y){
        return mod_m(fct[x], mod_m(invfct[y], invfct[x-y]));
}

int main(){
        init();
        ll n;
        cin >> n;
        ll m = n / 2;
        ll tmp = 0;
        REP(i,m+1, n){
                tmp = mod_p(tmp, mod_m(ncr(n,i), pow2[n-i]));
        }
        cout << mod_p(mod_pow(3,n), mod_m(-2, tmp)) << endl;
}



Measured memory_bytes: 234752
import java.util.*
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()
    val m = cin.nextInt()

    val a = Array<Int>(n, {0})

    for (i in 0..m-1) {
        val l = cin.nextInt()-1
        val r = cin.nextInt()-1
        a[l] += 1
        a[r] += 1
    }

    var f = true

    for (i in 0..n-1) {
        if (a[i] % 2 == 1) {
            f = false
            break
        }
    }

    if (f) {
        println("YES")
    } else {
        println("NO")
    }
}

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

int main() {
  long long  x;
  cin >> x;
  long long  a, b;
  if(x!=0){
    a = x / 500;
    b = (x%500)/5;
    cout << a*1000+b*5 << endl;
  }else{
    cout << "0" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
int n,m,t,p;
while(true) {
    cin >> n >> m >> t >> p;
    if(n+m+t+p==0)break;
    int ori[100][100];
    rep(i,100){rep(j,100)ori[i][j]=0;}
    rep(i,n){rep(j,m)ori[j][i]=1;}

    int sx=0;
    int sy=0;

    rep(i,t){
        int d,c;
        cin>>d>>c;
        if(d==1){
            for(int y=sy;y<m;y++){
                int xi=sx+c;
                for(int x=(sx+c-1);x>=sx;x--){
                    ori[y][xi]+=ori[y][x];
                    ori[y][x]=0;
                    xi++;
                }
            }
            int presx=sx;
            sx+=c;
            if(n-presx-c<c){
                int hami=presx+(2*c)-n;
                for(int x=sx;x<n+hami;x++){
                    for(int y=sy;y<m;y++){
                        ori[y][x-hami]=ori[y][x];
                    }
                }
                for(int x=n;x<n+hami;x++){
                    for(int y=sy;y<m;y++){
                        ori[y][x]=0;
                    }
                }
                sx-=hami;
            }


        }else{
            for(int x=sx;x<n;x++){
                int yi=sy+c;
                for(int y=(sy+c-1);y>=sy;y--){
                    ori[yi][x]+=ori[y][x];
                    ori[y][x]=0;
                    yi++;
                }
            }
            int presy=sy;
            sy+=c;
            if(m-presy-c<c){
                int hami=presy+2*c-m;
                for(int y=sy;y<m+hami;y++){
                    for(int x=sx;x<n;x++){
                        ori[y-hami][x]=ori[y][x];
                    }
                }
                for(int y=m;y<m+hami;y++){
                    for(int x=sx;x<n;x++){
                        ori[y][x]=0;
                    }
                }
                sy-=hami;
            }
        }
//        for(int j=m-1;j>=0;j--) {
//            for (int i = 0; i < n; i++) {
//                cout << ori[j][i];
//            }
//            cout << endl;
//        }
//        cout<<sx<<" "<<sy<<endl;
    }


    rep(i,p){
        int x,y;
        cin>>x>>y;
        cout<<ori[sy+y][sx+x]<<endl;
    }

}





    return 0;
}



Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
const int MAXN = 1e5 +5;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
  fio();
  LL x; cin>>x;
  LL pp = x%500;
  cout<<(1000*1LL*(x/500) + 5*(pp/5))<<endl;
  return 0;
}



Measured memory_bytes: 256
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] line = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int a = line[0];
            int b = line[1];
            int c = line[2];
            Console.WriteLine(b - a == c - b ? "YES" : "NO");
        }
    }
}

Measured memory_bytes: 13140
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int s = sc.nextInt();
        int cnt = 0;
        for(int x = 0; x <= k; x++) {
            for(int y = 0; y <= k; y++) {
                if(s - x - y <= k && s - x - y >= 0)
                    cnt++;
            }
        }

        System.out.println(cnt);
    }
}

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

using namespace std;

typedef long long ll;
using pi = pair<ll,ll>;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

void dijkstra(vector<vector<pair<ll,ll>>> &G, ll n, vector<ll> &dist, ll start) {
    priority_queue<pi, vector<pi>, greater<pi>> pq;
    dist[start] = 0;
    vector<ll> used(n+1,0);
    pq.push({0, start});
    while(!pq.empty()) {
        ll d = pq.top().first, v = pq.top().second;
        pq.pop();
        if(used[v])continue;
        used[v] = 1;
        if(dist[v]<d){
            continue;
        }
        for(pi e : G[v]) {
            ll to = e.first, cost = e.second;
            if(dist[v] + e.second < dist[to]) {
                dist[to] = dist[v] + cost;
                pq.push({dist[to], to});
            }
        }
    }
}

int main() {
    ll n, m, i, j, k,s,t;
    cin >> n >> m >> s >> t;
    vector<vector<pair<ll,ll>>>G1(n+1),G2(n+1);
    for(i=0;i<m;i++){
        ll u,v,a,b;
        cin >> u >> v >> a >> b;
        G1[u].push_back({v,a});
        G1[v].push_back({u,a});
        G2[u].push_back({v,b});
        G2[v].push_back({u,b});
    }
    vector<ll> dista(n + 2, INF), distb(n + 2, INF);
    dijkstra(G1,n,dista,s);
    dijkstra(G2,n,distb,t);
    ll ret = INF;
    vector<ll> v;
    ll money = 1000000000000000;
    for(i=n-1;i>=0;i--){
        ret = min(dista[i+1]+distb[i+1],ret);
        v.push_back(ret);
    }
    reverse(v.begin(),v.end());
    for(ll x:v){
        cout << money-x << endl;
    }
    return 0;
}

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

#define faster  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define sq(x)   (x)*(x)
#define PI      acos(-1.0)
#define all(x) x.begin(),x.end()
#define nl      '\n'

typedef long long int ll;
typedef unsigned long long int  llu;

int main()
{
    ll n,ac=0,tle=0,wa=0,re=0;
    cin>>n;
    while(n--)
    {
        string s;
        cin>>s;
        if(s[0]=='A')
            ac++;
        else if(s[0]=='T')
            tle++;
        else if(s[0]=='W')
            wa++;
        else if(s[0]=='R')
            re++;
    }
    cout<<"AC x "<<ac<<nl;
    cout<<"WA x "<<wa<<nl;
    cout<<"TLE x "<<tle<<nl;
    cout<<"RE x "<<re<<nl;
    return 0;
}



Measured memory_bytes: 3632
import java.util.Scanner;

public class Main{
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int h = scan.nextInt();

		int area = (a + b) * h / 2;
		System.out.println(area);
	}
}


Measured memory_bytes: 21716
from math import atan, pi
a, b, x = map(int, input().split())
if (x/a > (a*b)/2):
    d = 2*x/(a**2) - b
    rad = atan((b-d)/a)
    print(rad*180/pi)
else:
    d = 2*x / (a*b)
    rad = atan(b/d)
    print(rad*180/pi)


Measured memory_bytes: 38384
import java.util.Scanner
import scala.util.control.Breaks._


object Main {
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    var TM_HP: Long = sc.nextLong
    var TM_AT: Long = sc.nextLong
    var AM_HP: Long = sc.nextLong
    var AM_AT: Long = sc.nextLong
    
    breakable {
    	while(true) {
            AM_HP = AM_HP - TM_AT
            if( AM_HP < 1){
              println("Yes")
              break
            }
            
            TM_HP = TM_HP - AM_AT
            if( TM_HP < 1){
              println("No")
              break
            } 
    	    
    	}
    }


    
  }
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
int main() {
    //bit全探索
    int h,w,k;
    cin>>h>>w>>k;
    char s[h+1][w+1];
    rep(i,h){
        rep(j,w){
            cin>>s[i+1][j+1];
        }
    }
    long long ans=1000000;
    for(int i=0;i<(1<<(h-1));i++){
        bitset<10-1> num(i);
        //cout<<i<<endl;
        //cout<<num<<endl;
        //cout<<num.test(0)<<endl;
        //cout<<num<<endl;
        vector<vector<int>> vec={};
        int index=0;
        long long ans1=0;
        vec.push_back({1});
        for (int j=0;j<h-1;j++){
            if (num.test(j)){
                index+=1;
                ans1+=1;
                vec.push_back({j+2});
            }
            else{
                vec[index].push_back(j+2);
            }
        }

        vector<int> vv(index+1,0);
        vector<int> vv2(index+1,0);
        int b1=1;

        for (int j=1;j<w+1;j++){
            int b=1;
            for (int l=0;l<index+1;l++){
                int s1=0;
                for (int p=0;p<vec[l].size();p++){
                    if (s[vec[l][p]][j]=='1'){
                        s1+=1;
                    }
                }
                if (s1>k){
                    b1=0;

                }
                else{
                    vv[l]+=s1;
                    vv2[l]=s1;
                    if (vv[l]>k){
                        b=0;
                    }
                }

            }
            if (b==0){
                ans1+=1;
                for (int l=0;l<index+1;l++){
                    vv[l]=vv2[l];
                    b=1;
                }
            }

        }

       /*for (int j=0;j<index+1;j++){
         for (int l=0;l<vec[j].size();l++){
           cout<<vec[j][l];
         }
         cout<<endl;}*/
        /*for (int j=0;j<index+1;j++){
            int ss=0;
            for (int aa=1;aa<w+1;aa++){
                int s1=0;
                for (int l=0;l<vec[j].size();l++){
                    cout<<vec[j][l]<<" "<<aa<<" "<<s[vec[j][l]][aa]<<endl;
                    if (s[vec[j][l]][aa]=='1'){
                        s1+=1;
                    }
                }
                cout<<s1<<endl;
                if (s1>k){
                    b=0;
                    break;
                }
                else{
                    ss+=s1;
                    if (ss>k){
                        ans1+=1;
                        ss=s1;
                    }

                }
        
            }
            if (b==0){
                break;
            }
        }*/
        if (b1==1){
        ans=min(ans,ans1);
        }
        


    }
    cout<<ans<<endl;

    

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>

using namespace std;

vector<int> s;

int main(){
	string tmp;
	cin >> tmp;

	for(int i = 0; i < tmp.size(); i++){
		if(tmp[i] == 'L'){
			s.push_back(0);
		}else{
			s.push_back(1);
		}
	}

	long long n = s.size();
	vector<long long> ans(n, 0);

	long long start = 0;
	long long mid = 0;
	long long end = 0;
	int stat = 1;

	for(int i = 0; i < n; i++){
		if(stat == 1 && s[i] == 1){

		}else if(stat == 1 && s[i] == 0){
			mid = i-1;
			stat = 0;
		}else if(stat == 0 && s[i] == 1){
			end = i-1;
			stat = 1;
			if(start%2 != end%2){
				ans[mid] = (end - start + 1) / 2;
				ans[mid + 1] = (end - start + 1) / 2;
			}else if(start%2 == 0){
				if(mid%2 == 0){
					ans[mid] = (end - start + 2) / 2;
					ans[mid + 1] = (end - start) / 2;
				}else{
					ans[mid] = (end - start) / 2;
					ans[mid + 1] = (end - start + 2) / 2;
				}
			}else{
				if(mid%2 == 1){
					ans[mid] = (end - start + 2) / 2;
					ans[mid + 1] = (end - start) / 2;
				}else{
					ans[mid] = (end - start) / 2;
					ans[mid + 1] = (end - start + 2) / 2;
				}
			}
			start = i;
			mid = i;
		}else{

		}
	}

	end = n-1;
	stat = 1;
	if(start%2 != end%2){
		ans[mid] = (end - start + 1) / 2;
		ans[mid + 1] = (end - start + 1) / 2;
	}else if(start%2 == 0){
		if(mid%2 == 0){
			ans[mid] = (end - start + 2) / 2;
			ans[mid + 1] = (end - start) / 2;
		}else{
			ans[mid] = (end - start) / 2;
			ans[mid + 1] = (end - start + 2) / 2;
		}
	}else{
		if(mid%2 == 1){
			ans[mid] = (end - start + 2) / 2;
			ans[mid + 1] = (end - start) / 2;
		}else{
			ans[mid] = (end - start) / 2;
			ans[mid + 1] = (end - start + 2) / 2;
		}
	}

	for(int i = 0; i < n; i++){
		cout << ans[i] << " ";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 2040
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<cstdlib>
#include <memory>
using namespace std;

typedef struct Node {
    int key;
    Node *parent, *left, *right;
} Node;

Node *root, *NIL;

void insert(int k) {
    Node *x = root;
    Node *y = NIL;
    Node *z = new Node;

    z -> key = k;
    z -> left = NIL;
    z -> right = NIL;

    while (x != NIL) {
        y = x;
        if (z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }

    z -> parent = y;
    if (y == NIL) root = z;
    else {
        if ( z->key < y->key ) y->left = z;
        else y->right = z;
    }
}

void inorder(Node *u) {
    if ( u == NIL ) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u) {
    if ( u == NIL ) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main() {
    int n, i, x;
    string com;

    scanf("%d", &n);

    for ( i = 0; i < n; i++ ) {
        cin >> com;
        if ( com == "insert" ) {
            scanf("%d", &x);
            insert(x);
        } else if ( com == "print" ) {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}


Measured memory_bytes: 26628
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+7;

int main() {
    ios::sync_with_stdio(false);
    Int n, x;
    cin >> n >> x;
    vector<Int> a(n);
    for (Int i = 0; i < n; i++) cin >> a[i];
    vector<vector<Int>> b(n + 1, vector<Int>(n));
    b[0] = a;
    for (Int i = 0; i < n; i++) {
        for (Int j = 0; j < n; j++) {
            b[i + 1][j] = min(b[i][j], a[(j - (i + 1) + n) % n]);
        }
    }
    Int res = 1e18;
    for (Int i = 0; i < n; i++) {
        Int sum = i * x;
        for (Int j = 0; j < n; j++) {
            sum += b[i][j];
        }
        res = min(res, sum);
    }
    dump(res);
    return 0;
} 

Measured memory_bytes: 31616
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f(a, b) for (ll i = a; i <= b; i++)
#define pb push_back
#define pf push_front
#define mp make_pair
using namespace std;
#define N 200005
const ll INF = 1000000000000000001;
const ll MOD = 1000000000;

//vector< vector<ll> > g(N);
//vector< pair<ll, pair< ll, ll > > > g(N);
//ll vis[N] = {0}, par[N] = {0}, child[N] = {0},cnt = 0;


void solve(){
    ld n, x, t; cin >> n >> x >> t;
    cout << (ll)ceil(n/x)*(ll)t << "\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
    //ll t;cin >> t;for(ll index=1; index<=t; index++){
        //cout << "Case #" << index << ": " ;
        solve();
    //}
    return 0;
}

Measured memory_bytes: 3688
from sys import stdin

N = int(stdin.readline().rstrip())
S = stdin.readline().rstrip()

ans = 1
inf = 10 ** 9 + 7
d = 'L'
l_count = 1
r_count = 0

if S[0] == 'W' or S[2 * N - 1] == 'W':
    print(0)
    exit()

for i in range(1, 2 * N):
    if S[i] != S[i - 1]:
        if d == 'R':
            ans *= l_count - r_count
            ans %= inf
            r_count += 1
        else:
            l_count += 1
    else:
        if d == 'R':
            d = 'L'
            l_count += 1
        else:
            ans *= l_count - r_count
            ans %= inf
            d = 'R'
            r_count += 1

if l_count != r_count:
    print(0)
    exit()

for j in range(1, N + 1):
    ans *= j
    ans %= inf

print(ans % inf)

Measured memory_bytes: 40304
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(N: int, S: str):
    pre = 0
    op = 0
    for c in S:
        if c == '(':
            op += 1
        elif c == ')':
            if op > 0:
                op -= 1
            else:
                pre += 1
    ret = (''.join(['(' for _ in range(pre)]) + S + 
           ''.join([')' for _ in range(op)]))
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()


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

typedef long long ll;

template <class T>
void printArray(vector<T> arr) {
	for (T a: arr) cout << a << " ";
	cout << '\n';
}

void printVerdict(bool verdict) {
	cout << (verdict ? "YES": "NO") << '\n';
}

void printDecimal(double d) {printf("%.9f\n", d);}

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	string s; cin >> s;
	int ret = 1;
	int ptr1 = 0;
	for (int i = 0; i<n; i++) {
		if (s[i] != s[ptr1]) {
			ret++;
			ptr1 = i;
 		}
	}
	cout << ret << '\n';
}



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



int main() {
    int N, a;
    cin >> N;
    int lim = N+1;
    vector<int> check(lim, 2);
    map<int, int> a_frq_map;
    for (int i = 0; i < N; ++i) {
      cin >> a;
      if(lim < a){
        cout << 0 << endl;
        return 0;
      }
      check[a]--;
//      if(a_frq_map.find(a) == a_frq_map.end()) a_frq_map[a] = 1;
//      a_frq_map[a] += 1;
    }

  for (int i = N-1; i >= 1; i-=2) {
    if(check[i] != 0){
      cout << 0 << endl;
      return 0;
    }
  }


  //
  long long mod = pow(10, 9) + 7, ans = 1;
  for (int i = N-1; i >= 1; i-=2) {
    ans *= 2;
    if(ans > mod) ans = ans % mod;
  }

  cout << ans << endl;

  return 0;
}



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

#define INF (1<<30)

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

	int ans=0, prev=INF;
	for(int i=0;i<n;i++){
		int x;	cin>>x;
		if(prev<x)ans++;

		prev=x;
	}
	cout<<ans<<endl;

	return 0;
}



Measured memory_bytes: 3116
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	
	void doIt(){
		Person [][] record = new Person[3][8];
		Person [] others = new Person[6];
		int c=0;
		for(int i=0;i<3;i++){
			for(int j=0;j<8;j++){
				record[i][j] = new Person(sc.nextInt(),sc.nextDouble());
			}
		}
		for(int i=0;i<3;i++){
			Arrays.sort(record[i]);
			System.out.println(record[i][0].toString() + "\n" + record[i][1].toString());
			others[c++] = record[i][2];
			others[c++] = record[i][3];
		}
		Arrays.sort(others);
		System.out.println(others[0].toString() + "\n" + others[1].toString());		
	}

	public static void main(String[] args) {
		new Main().doIt();
	}
	
	class Person implements Comparable<Person>{
		int number;
		double time;
		Person(int number , double time){
			this.number = number;
			this.time = time;
		}
		@Override
		public String toString() {
			return number + " " + time;
		}
		@Override
		public int compareTo(Person o) {
			if(time<o.time){
				return -1;
			}else if(time == o.time){
				return 0;
			}else{
				return 1;				
			}
		}
	}
}

Measured memory_bytes: 20076
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1000000000
#define  pow(x) pow(10,(x)) 
typedef long long int LL;

int main(){
    string S,T; cin >> S >> T ;
    map<char,char> mp,imp;
    bool ok = true;
    
    rep(i,S.size()){
        char s = S[i] , t = T[i];
        if(mp.count(s)) if(mp[s] != t) ok = false;
        if(imp.count(t)) if(imp[t] != s) ok = false;
        mp[s] = t;
        imp[t] = s;             
    }
    if(ok){
         cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 776
#include<stdio.h>
#include <stdlib.h>
#include<string.h>
#include<math.h>
#define loop(i, l, r) for(i=l; i<r; i++)/*Instead of function, (for).*/
#define rep(i,r) for(i=0; i<r; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
typedef long long int lli;
/*Return Combination ,(nCr)*/
int combi(int n, int r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
/*Return gcd(a, b)*/
int gcd(int a, int b){
	if(b == 0) return a;
	else return gcd(b, a % b);
}
int main(void)
{
	int cut = 0;
	double x, y, w, h;
	scanf("%lf%lf%lf%lf", &w, &h, &x, &y);
	double ans = w*h/2;
	printf("%.10lf ", ans);
	if(x+x == w && y+y == h){
		printf("1");
	}else{
		printf("0");
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      long a = sc.nextLong();
      long b = (long)(sc.nextDouble() * 100 + 0.01);
      long ans = a * b;
      System.out.print(ans / 100);
    }
}


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

bool G[8][8];
int N,M,ans;
int order[8] = {0,1,2,3,4,5,6,7};

int check(int* v){
    rep(i,N-1){
        if(!G[v[i]][v[i+1]])return false;
    }
    return true;
}

int main(void){
    cin >> N >>M;
    rep(i,M){
        int u,v;
        cin >> u >> v;
        u--;v--;
        G[u][v] = G[v][u] = true;
    }
    
    do{if(check(order))ans++;}while(next_permutation(order+1,order+N));    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    
    int D;
    cin >> D;
    
    if(D == 25) cout << "Christmas" << endl;
    if(D == 24) cout << "Christmas Eve" << endl;
    if(D == 23) cout << "Christmas Eve Eve" << endl;
    if(D == 22) cout << "Christmas Eve Eve Eve" << endl;
}


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

using namespace std;

#define FOE(i, s, t) for (int i = s; i <= t; i++)
#define FOR(i, s, t) for (int i = s; i < t; i++)
#define FOD(i, s, t) for (int i = s; i >= t; i--)

#define LL long long
#define mp make_pair
#define pb push_back

int k;
string x;

int main() {
	cin >> k;
	cin >> x;
	
	if (x.length() <= k) {
		cout << x << endl;	
	} else {
		FOR(i, 0, k) cout << x[i];
		cout << "..." << endl;	
	}
}

Measured memory_bytes: 3636
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var n = sc.nextInt();
		var a = IntStream.range(0, n).map(i -> sc.nextInt()).toArray();
		sc.close();

		var sum = new boolean[32];
		for (int i = 0; i < n; i++) {
			sum = xor(getBits(a[i]), sum);
		}

		var sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			if(sb.length() > 0) {
				sb.append(" ");
			}
			sb.append(getInt(xor(getBits(a[i]), sum)));
		}
		System.out.println(sb.toString());
	}

	public static boolean[] getBits(int n) {
		var bits = new boolean[32];
		for (int i = 0; i < 32; i++) {
			bits[i] = ((n % (int) Math.pow(2, i + 1)) / ((int) Math.pow(2, i))) != 0;
		}
		return bits;
	}

	public static int getInt(boolean[] bits) {
		var value = 0;
		for (int i = 0; i < 32; i++) {
			value += bits[i] ? Math.pow(2, i) : 0;
		}
		return value;
	}

	public static boolean[] xor(boolean[] bits1, boolean[] bits2) {
		var bits = new boolean[32];
		for (int i = 0; i < 32; i++) {
			bits[i] = bits1[i] ^ bits2[i];
		}
		return bits;
	}
}


Measured memory_bytes: 61444
#include <stdio.h>
int main(void){
    int a,b,c;
 
    scanf("%d %d %d",&a,&b,&c);
 
    if(a==b&&b==c&&c==a) 
        printf("1");
    else if(a!=b&&b!=c&&c!=a)
        printf("3");
    else
        printf("2");
 
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main()
{
	int b, f, r, v, n;
	int a[3][10] = {0}, c[3][10] = {0}, d[3][10] = {0}, e[3][10] = {0};
	
	scanf("%d", &n);
	
	for(int i = 0; i < 3; i++)
	{
		for(int j = 0; j < 10; j++)
		{
			a[i][j] = 0;
			c[i][j] = 0;
			d[i][j] = 0;
			e[i][j] = 0;
		}
	}
	
	for(int i = 0; i < n; i++)
	{
		scanf("%d %d %d %d", &b, &f, &r, &v);
		if(b == 1)
		{
			a[f-1][r-1] += v;
		}
		if(b == 2)
		{
			c[f-1][r-1] += v;
		}
		if(b == 3)
		{
			d[f-1][r-1] += v;
		}
		if(b == 4)
		{
			e[f-1][r-1] += v;
		}
	}

	for(int j = 0; j < 3; j++)
	{
		for(int k = 0; k < 10; k++)
		{
			printf(" %d", a[j][k]);
		}
		printf("\n");
	}

	for(int i = 0; i < 20; i++)
	{
		printf("#");
	}
	printf("\n");
	for(int j = 0; j < 3; j++)
	{
		for(int k = 0; k < 10; k++)
		{
			printf(" %d", c[j][k]);
		}
		printf("\n");
	}

	for(int i = 0; i < 20; i++)
	{
		printf("#");
	}
	printf("\n");
	
	for(int j = 0; j < 3; j++)
	{
		for(int k = 0; k < 10; k++)
		{
			printf(" %d", d[j][k]);
		}
		printf("\n");
	}
	
	for(int i = 0; i < 20; i++)
	{
		printf("#");
	}
	printf("\n");
	
	for(int j = 0; j < 3; j++)
	{
		for(int k = 0; k < 10; k++)
		{
			printf(" %d", e[j][k]);
		}
		printf("\n");
	}

}


Measured memory_bytes: 2712
#include"bits/stdc++.h"
using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	int cnt = 0;
	for (int i = 0;i < 3;i++) {
		if (s[i] == t[i]) {
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
li = list(map(int, input().split()))

counter = 0

for i in range(1, n):
    if i + 2 > n:
        break
    if (li[i-1] < li[i] < li[i+1]) or (li[i+1] < li[i] < li[i-1]):
        counter += 1

print(counter)


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

int main() {
  
  int n , d ;
  
  cin >> n >> d ;
  
  if (n%(2*d+1) >0){
    
    cout <<  (n/(2*d+1)+1) << endl;
  }
  
  else{
    
    cout << n/(2*d+1) << endl;
  }
    
  
  
}


Measured memory_bytes: 256
(defun splitat (c line)
  (labels ((rec (line acc)
				(let ((pos (position-if (lambda(cc) (char= c cc)) line)))
				  (if pos
					  (rec (subseq line (1+ pos)) (cons (subseq line 0 pos) acc))
					(nreverse (cons line acc))))))
	(rec line nil)))

(defun f(h a)
  (ceiling (/ h a)))
(let ((line (mapcar #'parse-integer (splitat #\space (read-line nil nil)))))
  (format t "~A~%" (f (car line) (cadr line))))


Measured memory_bytes: 16352
#include <stdio.h>
#include <iostream>

int main(){
    int a1,a2,a3;

    scanf("%d %d %d",&a1,&a2,&a3);
    if(a1+a2+a3>=22){
        std::cout << "bust" << std::endl;;
    }else{
        std::cout << "win" << std::endl;;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
  
int main(){
    int cost[22][22]={0};
    int n,m,i,j,k,a,b,c,d;
    char cc;
    cin>>n>>m;
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            cost[i][j] = 1<<28;
        }
    }
    for(i=0;i<m;i++){
        cin>>a>>cc>>b>>cc>>c>>cc>>d;
        cost[a][b]=c;cost[b][a]=d;
    }
    for(k=1;k<=n;k++){
        for(i=1;i<=n;i++){
            for(j=1;j<=n;j++){
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
                cin>>a>>cc>>b>>cc>>c>>cc>>d;
            }
        }
    }
    cout << c-d-cost[a][b]-cost[b][a] << endl;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  int num = 1;
  for (int i = 1; i <= N; i *= 2) {
    num = i;
  }

  cout << num << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
abc = [tuple(map(int, input().split())) for _ in range(n)]

dp = [[0] * 3 for _ in range(n)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]

for i in range(1, n):
    for j in range(3):
        for k in range(3):
            if j != k:
                dp[i][j] = max(dp[i][j], dp[i-1][k] + abc[i][j])

print(max(dp[n-1]))


Measured memory_bytes: 74584
//Generated at 2019-08-18 21:24:25 UTC+8
//Created by Alphagocc
#include <bits/stdc++.h>
using namespace std;
vector<int> v[256];

int main()
{
    string s, t;
    cin >> s >> t;
    map<char, int> cnt1, cnt2;
    for (auto i : s) { cnt1[i] = 1; }
    for (auto i : t) { cnt2[i] = 1; }
    for (auto it : cnt2)
    {
        if (cnt1.count(it.first) == 0)
        {
            cout << -1 << endl;
            return 0;
        }
    }
    for (int i = 0; i < s.size(); i++) { v[s[i]].push_back(i); }
    int ans = 0, sPos = -1;
    for (int i = 0; i < t.size(); i++)
    {
        auto k = upper_bound(v[t[i]].begin(), v[t[i]].end(), sPos);
        if (k == v[t[i]].end())
        {
            sPos = v[t[i]][0];
            ans++;
        }
        else
        {
            sPos = (*k);
        }
    }
    cout << 1LL * ans * s.size() + sPos + 1 + 0LL << endl;
    return 0;
}

Measured memory_bytes: 1216
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

int main() {
  int L, R, d;
  cin >> L >> R >> d;
  cout << R / d - (L - 1) / d << endl;
  return 0;
}

Measured memory_bytes: 3228
#include <iostream>

using namespace std;

int main(){
  int a , b, cnt = 0;
  cin >> a  >> b;
  for(int month = 1; month <= a; month++){
    for(int day = 1; day <= 31; day++){
      if(month == day) cnt++;
      if(day == b && a == month) break;
    }
  }
  cout << cnt << endl;
  return 0;
}


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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)

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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 109, M = 509, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;

int main(){
    init();

    int a, b, c;    cin >> a >> b >> c;
    if(c >= a && c <= b)    cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
const string tr="abcdefghijklmnopqrstuvwxyz";
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll i = 2; i < MAX; i++){fac[i] = fac[i - 1] * i % MOD;inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;finv[i] = finv[i - 1] * inv[i] % MOD;}}
long long COM(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}
ll llpow(ll n,ll i){ll cnt=n;  for(ll j=0;j<i-1;j++){n*=cnt;}return n;}

int main(){
  ll n;
  cin>>n;
  string s;
  cin>>s;
  map<char,ll> mp;
  rep(i,n){
    mp[s[i]]++;
  }
  ll ans=1;
  for(auto x:mp){
    ans*=x.second+1;
    ans%=MOD;
  }
  if(ans<0) ans+=MOD;
  cout<<ans-1<<endl;
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
	int n;
	cin >> n;
	vector<int> p(n);
	for(int i=0;i<n;i++) cin >> p[i];
    
  	int ans=0;
  	for(int i=1;i<(n-1);i++){
      if(p[i-1]>p[i] && p[i]>p[i+1])ans++;
      else if(p[i-1]<p[i] && p[i]<p[i+1])ans++;
    }
  	cout << ans << endl;
  	return 0;
}

Measured memory_bytes: 256
H, W, M = map(int, input().split())
h = [0 for i in range(H)]
w = [0 for i in range(W)]
DP = set()
for i in range(M):
    hh, ww = map(int, input().split())
    h[hh - 1] += 1
    w[ww - 1] += 1
    DP.add((hh - 1, ww - 1))

hhh = max(h)
www = max(w)
hhhh = [i for i, x in enumerate(h) if x == hhh]
wwww = [i for i, x in enumerate(w) if x == www]
check = 0

for i in hhhh:
    for j in wwww:
        if (i, j) not in DP:
            print(hhh + www)
            exit()
print(hhh + www - 1)


Measured memory_bytes: 156884