akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vs = vector<string>;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

const int R_MAX = 100000;

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

	vector<bool> notPrimeNum(R_MAX + 1);
	notPrimeNum[0] = notPrimeNum[1] = true;
	for (int i = 2; i <= R_MAX; i++) {
		if (notPrimeNum[i]) {
			continue;
		}
		for (int j = 2 * i; j <= R_MAX; j += i) {
			notPrimeNum[j] = true;
		}
	}

	vector<int> cnt(R_MAX + 1);
	for (int i = 3; i <= R_MAX; i++) {
		if (!notPrimeNum[i] && !notPrimeNum[(i + 1) / 2]) {
			cnt[i]++;
		}
	}
	for (int i = 1; i <= R_MAX; i++) {
		cnt[i] += cnt[i - 1];
	}

	int q;
	cin >> q;
	for (int i = 0; i < q; i++) {
		int l, r;
		cin >> l >> r;
		cout << cnt[r] - cnt[l - 1] << endl;
	}
	return 0;
}


Measured memory_bytes: 1024
"use strict";
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  for(var i = 1; i <= 9; i++)for(var j = 1; j <= 9; j++){
    if(n === i*j)return "Yes";
  }
  return "No";
}

Measured memory_bytes: 21064
from itertools import accumulate

N, Q = list(map(int, input().split()))
S = input()
target = "AC"

# ACが来たらカウントする
dp = [0] * N
for i in range(1, N):
    s = S[i - 1] + S[i]
    if s == "AC":
        dp[i] += 1

# 累積和
DP = list(accumulate(dp))

input_list = []
for i in range(Q):
    l, r = list(map(int, input().split()))
    print(DP[r - 1] - DP[l - 1])


Measured memory_bytes: 8584
N, L, T = list(map(int, input().split()))

X = []
W = []
X_after = []
for _ in range(N):
    x, w = list(map(int, input().split()))
    if w == 1:
        x_a = (x + T) % L
    else:
        x_a = (x - T) % L
        x_a = x_a if x_a >= 0 else L + x_a
    X.append(x)
    W.append(w)
    X_after.append(x_a)

n_colide = 0
for i in range(1, N):
    if W[0] == 1 and W[i] == 2:
        dist = X[i] - X[0]
        n_colide += 2 * (T - (dist / 2)) // L + 1
    elif W[0] == 2 and W[i] == 1:
        dist = (L + X[0]) - X[i]
        n_colide += 2 * (T - (dist / 2)) // L + 1

if W[0] == 1:
    num_a0 = n_colide % N
else:
    num_a0 = N - (n_colide % N)

num_a0 = int(num_a0)

x_a0 = X_after[0]
X_after = sorted(X_after)
i = X_after.index(x_a0)
if W[0] == 1 and X_after.count(x_a0) == 2:
    i += 1
X_after = X_after[i-num_a0:] + X_after[:i-num_a0]

for x_a in X_after:
    print(x_a)


Measured memory_bytes: 13432
#include <iostream> 
#include <sstream> 
#include <iomanip> 
#include <algorithm> 
#include <cmath> 
#include <string> 
#include <vector> 
#include <list> 
#include <queue> 
#include <stack> 
#include <set> 
#include <map> 
#include <bitset> 
#include <numeric> 
#include <climits> 
#include <cfloat> 
using namespace std;

int w, h;
vector<int> area;
vector<vector<int> > sum;

int retNum;
vector<vector<int> > ret;

void solve(int y, int x, vector<vector<int> >& used)
{
    if(x > w){
        ++ y;
        x = 1;
    }
    if(y > h){
        ++ retNum;
        ret = used;
        return;
    }

    if(used[y][x] != 0){
        solve(y, x+1, used);
        return;
    }

    for(int y1=y; y1<=h; ++y1){
        for(int x1=x; x1<=w; ++x1){
            bitset<16> bs = sum[y1][x1] & (~sum[y1][x-1]) & (~sum[y-1][x1]);
            if(bs.count() != 1)
                continue;

            int k = 0;
            while(!bs[k])
                ++ k;
            if(area[k] != (y1 - y + 1) * (x1 - x + 1))
                continue;

            bool ng = false;
            vector<vector<int> > used1 = used;
            for(int i=y; i<=y1; ++i){
                for(int j=x; j<=x1; ++j){
                    if(used1[i][j] != 0)
                        ng = true;
                    used1[i][j] = k;
                }
            }
            if(!ng)
                solve(y, x+1, used1);
        }
    }
}

int main()
{
    for(;;){
        int n;
        cin >> w >> h >> n;
        if(w == 0)
            return 0;

        area.assign(n+1, 0);
        for(int i=0; i<n; ++i){
            int b, k;
            cin >> b >> k;
            area[b] = k;
        }

        sum.assign(h+1, vector<int>(w+1, 0));
        for(int y=1; y<=h; ++y){
            int tmp = 0;
            for(int x=1; x<=w; ++x){
                int a;
                cin >> a;
                if(a > 0)
                    tmp |= (1 << a);
                sum[y][x] = sum[y-1][x] | tmp;
            }
        }

        retNum = 0;
        vector<vector<int> > s(h+1, vector<int>(w+1, 0));
        solve(1, 1, s);

        if(retNum != 1){
            cout << "NA" << endl;
        }else{
            for(int i=1; i<=h; ++i){
                cout << ret[i][1];
                for(int j=2; j<=w; ++j)
                    cout << ' ' << ret[i][j];
                cout << endl;
            }
        }
    }
}

Measured memory_bytes: 0
a=int,input()
b=list(map(int,input().split()))
c_1=sum(b)//len(b)
c_2=c_1+1
j_1=0
j_2=0
for k in b:
  j_1+=(c_1-k)**2
for k in b:
  j_2+=(c_2-k)**2
if j_1>=j_2:
  print(j_2)
else:
  print(j_1)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;

namespace DDCC2020B
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputInt = long.Parse(Console.ReadLine());
            var inputArr = Console.ReadLine().Split().Select(long.Parse).ToArray();

            long sum = inputArr.Sum();

            long s = 0;
            long sb = 0;
            long sf = 0;
            for (int i = 0; i < inputInt; i++)
            {
                sb = s;
                sf = s + inputArr[i];

                s += inputArr[i];
                if (s > sum / 2)                
                {
                    break;
                }
            }

            double m = sum / 2.0 - sb;
            double n = sf - sum / 2.0;
            long ans =  (long)(2 *Math.Min(m, n));

            //string ans = "";

            Console.WriteLine(ans);
            Console.ReadKey();
        }
    }
}


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

int main(){
  int n, k;
  cin >> n >> k;
  int cnt = 0;
  rep(i,n){
    int a;
    cin >> a;
    if(a>=k)
      cnt++;
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 3564
#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 REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

map<ll, ll> get_prime(ll x){
    map<ll, ll> ret;
    for(ll i = 2; i * i <= x; i++){
        while(x % i == 0){
            ret[i]++;
            x /= i;
        }
    }

    if(x != 1) ret[x]++;
    return ret;
}

ll mod_pow(ll x, ll n, ll mod){
    ll ret = 1;
    while(n > 0){
        if(n%2) ret *= x;
        x *= x;
        n >>= 1;
        ret %= mod;
        x %= mod;
    }
    return ret;
}

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    map<ll, ll> P;
    REP(i,N){
        ll a;
        cin >> a;
        A[i] = a;
        auto prime = get_prime(a);
        for(auto&& p : prime){
            chmax(P[p.first], p.second);
        }
    }

    ll ans = 0;

    ll B = 1;
    for(auto&& p : P){
        B *= mod_pow(p.first, p.second, MOD);
        B %= MOD;
    }
    
    REP(i,N){
        ll a = A[i];
        auto prime = get_prime(a);
        ll b = B;
        for(auto&& p : prime){
            ll x = mod_pow(p.first, p.second, MOD);
            b *= mod_pow(x, MOD-2, MOD);
            b %= MOD;
        }
        ans += b;
        ans %= MOD;
    }

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


Measured memory_bytes: 896
#include <iostream>
using namespace std;
static const int MAX = 1000000000;

int main()
{

  int N, A[100];
  int nmax = -1;
  int nmin = MAX + 1;
  int now = 0;

  cin >> N;

  for (int i = 0; i < N; i++) {
    cin >> A[i];

    if (nmin > A[i]){
      nmin = A[i];
    }
    if (nmax < A[i]){
      nmax = A[i];
    }
  }

  cout << nmax - nmin << endl;

  return 0;
}

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

int main(){
  
  int S;
  cin >> S;
  
  vector<int> sign = {-1,1};
  
  for(int i : sign){
    for(int j : sign){
      for(int k : sign){
        
        if(S/1000 + S%1000/100*i + S%100/10*j + S%10*k==7){
          
          cout << S/1000;
          if(i==1) cout << "+";
          else     cout << "-";
          cout << S%1000/100;
          if(j==1) cout << "+";
          else     cout << "-";
          cout << S%100/10;
          if(k==1) cout << "+";
          else     cout << "-";
          cout << S%10 << "=7" << endl;
          
          return 0;
        }
      }
    }
  }
  
}





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

signed main(){
  int n,m;cin>>n>>m;
  vector<int> v(n,0);
  int ans=0,cnt=0;
  while(m--){
    int a;string t;cin>>a>>t;a--;
    if(v[a]<0)continue;
    if(t=="AC")ans+=v[a],v[a]=-1,cnt++;
    else v[a]++;
  }
  cout<<cnt<<" "<<ans<<endl;
}



Measured memory_bytes: 640
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        k: i32, a: i32, b: i32,
    }
    for i in a..=b {
        if i % k == 0 {
            println!("OK");
            return;
        }
    }
    println!("NG");
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, x, n) for (ll i = x; i < (ll)(n); i++)
#define lb lower_bound
#define ub upper_bound
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};

ll sti(string s)
{
    ll res = 0;
    reverse(all(s));
    ll cnt = 1;
    rep(i, siz(s))
    {
        if (s[i] == '1')
        {
            res += cnt;
            if (res >= 210000)
                break; //
        }
        cnt *= 2;
        if (cnt >= 210000)
        {
            res = 210000;
            break;
        }
    }
    return res;
}

long long mpow(long long a, long long n)
{ //a^n(mod)を求める
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a;
        a = a * a; //次の準備
        n >>= 1;
    }
    return res;
}

signed main()
{
    ll n,ans=0;cin>>n;
    vector<ll> b(n-1);
    rep(i,n-1){
        cin>>b[i];
    }
    ans+=b[0]+b[n-2];

    for(int i=0;i < n-2;i++)
    {   
        ans+=min(b[i],b[i+1]);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>

int main() {
    std::string s; std::cin >> s;
    int k; std::cin >> k;
    int n = s.size();
    for (int i = 0; i < std::min(n, k); i++) {
        if (s[i] != '1') {
            std::cout << s[i] << std::endl;
            return 0;
        }
    }
    std::cout << 1 << std::endl;
    return 0;
}


Measured memory_bytes: 256
import sys

class SCC:
  '''
  SCC class with non-recursive DFS.
  '''
  def __init__(self,N):
    self.N = N
    self.G1 = [[] for _ in range(N)]
    self.G2 = [[] for _ in range(N)]
  
  def add_edge(self,a,b):
    self.G1[a].append(b)
    self.G2[b].append(a)
    
  def scc(self):
    self.seen = [0]*self.N
    self.postorder=[-1]*self.N
    self.order = 0
    for i in range(self.N):
      if self.seen[i]:continue
      self._dfs(i)

    self.seen = [0]*self.N
    scclist = []
    for i in self._argsort(self.postorder,reverse=True):
      if self.seen[i]:continue
      cc = self._dfs2(i)
      scclist.append(cc)
    
    return scclist
    
  def _argsort(self,arr,reverse=False):
    shift = self.N.bit_length()+2
    tmp = sorted([arr[i]<<shift | i for i in range(len(arr))],reverse=reverse)
    mask = (1<<shift) - 1
    return [tmp[i] & mask for i in range(len(arr))]
  
  def _dfs(self,v0):
    todo = [~v0, v0]
    while todo:
      v = todo.pop()
      if v >= 0:
        self.seen[v] = 1
        for next_v in self.G1[v]:
          if self.seen[next_v]: continue
          todo.append(~next_v)
          todo.append(next_v)
      else:
        if self.postorder[~v] == -1:
          self.postorder[~v] = self.order
          self.order += 1
    return
  
  def _dfs2(self,v):
    todo = [v]
    self.seen[v] = 1
    cc = [v]
    while todo:
      v = todo.pop()
      for next_v in self.G2[v]:
        if self.seen[next_v]: continue
        self.seen[next_v] = 1
        todo.append(next_v)
        cc.append(next_v)
    return cc

class TwoSAT:
  def __init__(self,N):
    self.N = N
    self.scc = SCC(2*N)
    self.flag=-1
  
  def add_clause(self,i,f,j,g):
    self.scc.add_edge(f*N+i,(1^g)*N+j)
    self.scc.add_edge(g*N+j,(1^f)*N+i)
    
  def satisfiable(self):
    if self.flag==-1:
      self.scclist = self.scc.scc()
      self.order = {j:i for i,scc in enumerate(self.scclist) for j in scc}
      self.flag = True
      self.ans = [0]*self.N
      for i in range(self.N):
        if self.order[i] > self.order[self.N+i]:
          self.ans[i] = 1
          continue
        elif self.order[i] == self.order[i+self.N]:
          self.flag = False
          return self.flag
      return self.flag
    else: return self.flag
  
  def answer(self):
    return self.ans
  
N,D=map(int,input().split())
xy = [tuple(map(int,input().split())) for _ in range(N)]
ts=TwoSAT(N)
for i in range(N-1):
  for j in range(i+1,N):
    for k1,k2 in [(0,0),(0,1),(1,0),(1,1)]:
      pos1,pos2 = xy[i][k1],xy[j][k2]
      if abs(pos2-pos1)<D:
        ts.add_clause(i,k1^1,j,k2^1)
        
if ts.satisfiable():
  print('Yes')
  print(*[xy[i][ts.ans[i]] for i in range(N)],sep="\n")
else:
  print('No')

Measured memory_bytes: 10208
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    int N,M,X;
    cin >> N >> M >> X;
    vec<int> C(N);
    vec<vec<int>> A(N,vec<int>(M,0));
    rep(i,N){
        cin >> C[i];
        rep(j,M) cin >> A[i][j];
    }
    int ans = 1e9+7;
    rep(i,1<<N){
        int tmpans = 0;
        vec<int> Xs(M,X);
        rep(j,N){
            if(!(i&1<<j)) continue;
            tmpans += C[j];
            for(int k=0;k<M;++k) Xs[k]-=A[j][k]; 
        }
        bool flag = true;
        for(auto e:Xs) if(e>0) flag = false;
        if(flag)ans = min(ans, tmpans);
    }
    cout << ((ans==(int)1e9+7)?-1:ans) << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int r;
  cin>>r;
  cout<<3*r*r<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; ++i){
    cin >> a[i];
  }
  int count = 0;
  int b;
  for (int i = 0; i < n; ++i){
    b = a[i]-1;
    if(a[b]-1 == i) count++;
  }
  cout << count/2 << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
using namespace std;

using VI = vector <int> ;
using VVI = vector <VI> ;

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

    cout << (N+1) / 2 <<endl;
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;

int a, b, ans;

int main() {
    scanf("%d %d", &a, &b);
    
    if ( a >= 13) {
        ans = b;
    } else if ( a >= 6 ) {
        ans = b / 2;
    } else {
        ans = 0;
    }

    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int ll;
typedef vector<int > vecint;
typedef vector<bool > vecbool;
typedef vector<string > vecstr;
typedef vector<vector<int > > vec2int;
typedef vector<vector<bool > > vec2bool;
int dx[4] {-1,+1, 0, 0};
int dy[4] { 0, 0,-1,+1};
int main()
{
  int n, k, s;
  cin >> n >> k >> s;
  int t = 0;
  if(s == 1e9){
    t = 1e9 - 2;
  }else{
    t = s + 1;
  }
  //////////////////////
  if(s == 1){
    REP(i,k){
      cout << 1 << endl;
    }
    REP(i, n - k){
      cout << t << endl;
    }
    return 0;
  }
  //////////////////////
  if(k == 0){
    REP(i,n){
      cout << t << endl;
    }
    return 0;
  }
  //////////////////////
  if(k == n){
    REP(i,n){
      cout << s << endl;
    }
    return 0;
  }
  //////////////////////
  if(k == n - 1 && k == n - 2){
    REP(i,k){
      cout << s << endl;
    }
    REP(i, n - k){
      cout << s - 1 << endl;
    }
    return 0;
  }
  //////////////////////
  REP(i, k - 1){
    cout << s << endl;
  }
  cout << s - 1 << endl;
  cout << 1  << endl;
  REP(i, n - k - 1){
    cout << t << endl;
  }

}


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

struct Dinic{
  const int INF=1<<28;
  
  struct edge {
    int to,cap,rev;
    edge(){}
    edge(int to,int cap,int rev):to(to),cap(cap),rev(rev){}
  };

  int n;
  vector<vector<edge> > G;
  vector<map<int,int> > M;
  vector<int> level,iter;

  Dinic(){}
  Dinic(int sz):n(sz),G(n),M(n),level(n),iter(n){}
  
  void add_edge(int from,int to,int cap){
    M[from][to]=G[from].size();
    M[to][from]=G[to].size();
    G[from].push_back(edge(to,cap,G[to].size()));
    // undirected
    //G[to].push_back(edge(from,cap,G[from].size()-1));
    // directed
    G[to].push_back(edge(from,0,G[from].size()-1));
  }
  
  void bfs(int s){
    fill(level.begin(),level.end(),-1);
    queue<int> que;
    level[s]=0;
    que.push(s);
    while(!que.empty()){
      int v=que.front();que.pop();
      for(int i=0;i<(int)G[v].size();i++){
	edge &e = G[v][i];
	if(e.cap>0&&level[e.to]<0){
	  level[e.to]=level[v]+1;
	  que.push(e.to);
	}
      }
    }
  }
  
  int dfs(int v,int t,int f){
    if(v==t) return f;
    for(int &i=iter[v];i<(int)G[v].size();i++){
      edge &e=G[v][i];
      if(e.cap>0&&level[v]<level[e.to]){
	int d = dfs(e.to,t,min(f,e.cap));
	if(d>0){
	  e.cap-=d;
	  G[e.to][e.rev].cap+=d;
	  return d;
	}
      }
    }
    return 0;
  }
  
  int flow(int s,int t,int lim){
    int fl=0;
    for(;;){
      bfs(s);
      if(level[t]<0||lim==0) return fl;
      fill(iter.begin(),iter.end(),0);
      int f;
      while((f=dfs(s,t,lim))>0){
	fl+=f;
	lim-=f;
      }
    }
  }

  int flow(int s,int t){
    return flow(s,t,INF);
  }

  //cap==1 only
  bool back_edge(int s,int t,int from, int to){
    for(int i=0;i<(int)G[from].size();i++) {
      edge& e=G[from][i];
      if(e.to==to) {
	if(e.cap==0&&flow(from,to,1)==0) {
	  flow(from,s,1);
	  flow(t,to,1);
	  return 1;
	}
      }
    }
    return 0;
  }
};

//INSERT ABOVE HERE
const int K = 28;
int cap[K][K];
signed main(){
  int n;
  cin>>n;
  vector<string> s(n);
  for(int i=0;i<n;i++) cin>>s[i];

  for(int i=0;i<26;i++){
    Dinic flow(K);
    int x=26,y=27,z=0,e=0;
    memset(cap,0,sizeof(cap));
    for(int j=0;j<n;j++){
      int u=s[j].front()-'a';
      int v=s[j].back()-'a';
      if(u==i) z++;
      if(v==i) e++;
      if(u==i) u=x;
      if(v==i) v=y;
      if(u!=v) cap[u][v]++;
    }
    for(int u=0;u<K;u++)
      for(int v=0;v<K;v++)
	if(cap[u][v]) flow.add_edge(u,v,cap[u][v]);
    if((e&&!z)||(z&&flow.flow(x,y)==z)) cout<<char('a'+i)<<endl;
  }
  
  return 0;
}



Measured memory_bytes: 4944
#include <iostream>
#include <vector>

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

    float sum = 0;
    int input;
    for(int i = 0; i < n; ++i){
        std::cin >> input;
        sum += 1 / static_cast<float>(input);
    }
    std::cout << 1 / sum << std::endl;
}

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

int main (void)
{
    int N,M;
    scanf("%d%d",&N, &M);
    int i;
    for(i=M/N;i>0;i--){
        if(M % i == 0) {
            printf ("%d",i);
            break;
        }
    }
    return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        // 入力
        long[] nm = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long n = nm[0];
        long m = nm[1];

        long ans = 0;
        if (n == 1 && m == 1)
        {
            ans = 1;
        }
        else if (m == 1)
        {
            ans = n - 2;
        }
        else if (n == 1)
        {
            ans = m - 2;
        }
        else if (n == 2 || m == 2)
        {
            ans = 0;
        }
        else
        {
            ans = (n - 2) * (m - 2);
        }

        Console.WriteLine(ans);


    }
}


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

#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define fs first
#define sc second
#define fr(i, a, b) for(int i = a ; i < b ; i++)
#define frr(i, a, b) for(int i = a ; i >= b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str() // int to string
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)
#define deb(x) cout << #x" = " << x << '\n'
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

int main() {
//    freopen("input.in", "r", stdin);
	int k, s;
	ll res = 0;
	scanf("%d %d", &k, &s);
	fr(i, 0, k+1) {
		fr(j, 0, k+1) {
			int to = s-(i+j);
//			deb(to);
			if(to >= 0 && to <= k) res++;
		}
	}
	cout << res << '\n';
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int a = sc.nextInt();
			String op = sc.next();
			int b = sc.nextInt();
			if(op.equals("+")) {
				System.out.println(a + b);
			} else if(op.equals("-")) {
				System.out.println(a - b);
			} else if(op.equals("*")) {
				System.out.println(a * b);
			} else if(op.equals("/")) {
				System.out.println(a / b);
			} else {
				break;
			}
		}
	}
}

Measured memory_bytes: 26180
// starter code
# include<bits/stdc++.h>
using namespace std;
int main(){
// taking input into an array
  int n, flag = 0;
  cin >> n;
  int arr[n];
  for(int i = 0; i < n; i++){
       cin >> arr[i];
  }
  int temp;
  for (int i = n-1; i > 0; i--){
    temp = arr[i] - arr[i-1];
  		if(temp < -1){
        	flag = 1;
        }
    	else if(temp == -1){
        	arr[i-1] -= 1;
        }
  }
  if(flag) cout <<"No"<<'\n';
  else cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 640
def Main(S, Q, q):
    pre = []
    suf = []
    flipped = False
    for i in range(Q):
        if q[i][0] == '1':
            if not flipped:
                flipped = True
            else:
                flipped = False
        elif q[i][0] == '2':
            if q[i][1] == '1':
                if not flipped:
                    pre.append(q[i][2])
                else:
                    suf.append(q[i][2])
            elif q[i][1] == '2':
                if not flipped:
                    suf.append(q[i][2])
                else:
                    pre.append(q[i][2])
    pre.reverse()
    ans = pre + list(S) + suf
    if flipped:
        ans.reverse()
    return "".join(ans)              
    
def main():
    S = str(input())
    Q = int(input())
    q = []
    for i in range(Q):
        q.append(list(map(str, input().split())))
    print(Main(S, Q, q))

if __name__ == '__main__':
    main()

Measured memory_bytes: 45300
/*?°´?????????(Water Rate)*/
#include <stdio.h>
int main(){
  int x, y, A, B, C, D, P;
  scanf("%d %d %d %d %d", &A, &B, &C, &D, &P);
  x = P * A;
  if (C < P) {
    y = B + (P - C) * D;
  } else {
    y = B;
  }
  if (x < y) {
    printf("%d\n", x);
  } else {
    printf("%d\n", y);
  }
  return 0;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;

int main() {
  llong T;
  cin >> T;
  while (T--) {
    llong N;
    vector<vector<lpair>> l, r;
    cin >> N;
    l.resize(N + 1);
    r.resize(N + 1);
    for (int i = 0; i < N; i++) {
      llong K, L, R;
      cin >> K >> L >> R;
      if (K < N && L < R) {
        r[K].push_back(lpair(L, R));
      }
      else {
        l[K].push_back(lpair(L, R));
      }
    }

    llong ans = 0;
    priority_queue<llong> left, right;
    for (int i = 1; i <= N; i++) {
      for (auto vv: l[i]) {
        ans += vv.first;
        left.push(vv.second - vv.first);
      }
      while (left.size() > i) {
        ans += left.top();
        left.pop();
      }
    }
    for (int i = N - 1; i >= 1; i--) {
      for (auto vv: r[i]) {
        ans += vv.second;
        right.push(vv.first - vv.second);
      }
      while (right.size() > N - i) {
        ans += right.top();
        right.pop();
      }
    }
    cout << ans << endl;
  }


  return 0;
}


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e9
#define MOD 1000000007

int main()
{

    ll n, t, ans = inf;
    cin >> n >> t;
    for(ll i = 0; i < n; i++)
    {

        ll ci, ti;
        cin >> ci >> ti;
        if(ti <= t)
        {

            if(ci < ans)
            {

                ans = ci;
            }
        }
    }
    if(ans==inf) cout << "TLE";
    else cout << ans;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    public static void main(String args[]) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long n = in.nextLong();
        long k = in.nextLong();
        long ans = gcd(n,k);
        System.out.println(find(n,k));
    }
    static long find(long n,long k){
        if(Math.abs(n-k)<n) return find((long)Math.min(n%k,k%n), k);
        return n;
    }
}

Measured memory_bytes: 21844
#include<iostream>

using namespace std;

int main() 
{
  int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  int ans;
  cin>>K;
  ans=a[K-1];
  
  cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)
#define Graph vector<vecctor<ll>>
#define pairs vector<pair<ll,ll>>
#define pb push_back



using namespace std;
using ll = long long;
const ll INF = 1e18;
const double PI = acos(-1);

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;
}
const ll mod = 1e9 + 7;

ll dp[2005][4];






int main(void)
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    ll s;
    cin >> s;
    dp[1][1] = 1;
    dp[1][2] = 0;
    dp[1][3] = 0;
    for(int i = 2; i <= s; ++ i){
        dp[i][1] = dp[i-1][3]%mod;
        dp[i][2] = dp[i-1][1]%mod;
        dp[i][3] = dp[i-1][3] + dp[i-1][2];
        dp[i][3] %= mod;
    }

    cout << dp[s][3] << endl;

    return 0;
}


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

int main()
{
    int k,n;
    cin>>k>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    a[n]=a[0]+k;
    int z=0;
    for(int i=0;i<n;i++)
    {
        z=max(z,a[i+1]-a[i]);
    }
    cout<<k-z<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    int N, Q; cin >> N >> Q;
    vector<int> S(N), T(N), X(N), D(Q);
    for (int i = 0; i < N; i++) cin >> S[i] >> T[i] >> X[i];
    for (auto &d : D) cin >> d;
    map<int, vector<int>> M;
    for (int i = 0; i < N; i++) {
        int s = S[i] - X[i];
        int t = T[i] - X[i];
        if (s < 0) s = 0;
        if (t < 0) t = 0;
        if (s == t) continue;
        M[s].push_back(X[i]);
        M[t].push_back(X[i]);
    }
    set<int> SS;
    auto it = begin(M);
    for (auto d : D) {
        while (it != end(M) && it->first <= d) {
            for (auto a : it->second) {
                if (SS.count(a)) {
                    SS.erase(a);
                } else {
                    SS.insert(a);
                }
            }
            ++it;
        }
        if (SS.empty()) {
            cout << -1 << '\n';
        } else {
            cout << *begin(SS) << '\n';
        }
    }
    return 0;
}


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

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
        #define eprintf(...) 42
#endif

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
*/

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

  vector<pii> v[n+1];
  rep(i, m){
    int p, y;
    cin >> p >> y;
    v[p].pb({y, i}); 
  }

  rep(i, n+1) sort(all(v[i]));

  vector<ll> ans(m);
  rep(i, n+1){
    rep(j, v[i].size()){
      ans[v[i][j].second] = (ll)i*1000000+j+1;
    }
  }

  for(ll i : ans){
    printf("%012lld\n", i);
  }

  return 0;
}


Measured memory_bytes: 7680
console.log((args=>{
  const [S,q,...tmp] = args.trim().split`\n`;
  const Q = q|0;
  const s = Array(Q).fill('').concat( S.split``, Array(Q).fill('') );
  let ol = Q-1, or = S.length+Q, r = false;
  for ( let i = 0; i < Q; i++ ) {
    const [cmd,f,c] = tmp[i].split` `;
    if ( cmd === '1' ) r = !r;
    else if (r^(f-1)) s[or++] = c;
    else s[ol--] = c;
  }
  if (r) s.reverse();
  return s.join``;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


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

inline int square(int x) {
    return x * x;
}

bool is_right_triangle(vector<int> &sides)
{
    sort(sides.begin(), sides.end());
    return square(sides[0]) + square(sides[1]) == square(sides[2]);
}

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

    for (vector<int> sides(3); length > 0 && cin >> sides[0] >> sides[1] >> sides[2]; length--)
        cout << (is_right_triangle(sides) ? "YES" : "NO") << endl;

    return 0;
}

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

int main() {
  int a,b,c,x;
  int count=0;
  cin>>a>>b>>c>>x;
  for(int i=0;i<=a;i++){
    for(int j=0;j<=b;j++){
      for(int k=0;k<=c;k++){
        if(i*500+j*100+k*50==x)count++;
      }
    }
  }
  cout<<count<<endl;
  return 0;
}

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

#define int long long
//typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main() {

    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    
    sort(A.begin(), A.end(), greater<int>());
    
    int plus = 0;
    rep(i,N) if(A[i]>0) plus++;
    
    if(plus==0) plus=1;
    if(plus==N) plus=N-1;

    int minus = N-plus;
    
    int ans=0;
    rep(i,plus) ans+= A[i];
    rep(i,minus) ans-= A[N-i-1];
    
    cout << ans << endl;
    
    int a = A[0];
    rep(i,minus-1){
        cout << a << " " << A[plus+i] << endl;
        a -= A[plus+i];
    }
    
    int b = A[N-1];
    rep(i,plus-1){
        cout << b << " " << A[i+1] << endl;
        b -= A[i+1];
    }
    
    cout << a << " " << b << endl;
    
    
}



Measured memory_bytes: 2688
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

using ll = long long;
using Pi = pair<ll, ll>;
const int INF = 1 << 28;

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

void get() {}

template <class Head, class... Tail>
void get(Head& head, Tail&... tail) {
  cin >> head;
  get(tail...);
}

template <class T>
void getv(vector<T>& vec) {
  for (int i = 0; i < vec.size(); ++i)
    cin >> vec[i];
}

int main() {
  int N, K;
  get(N, K);
  vector<Pi> list(N);
  FOR(i, N) {
    int x, y;
    get(x, y);
    list[i] = Pi(x, y);
  }
  ll ans = 1LL << 62;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      for (int i2 = 0; i2 < N; ++i2) {
        for (int j2 = 0; j2 < N; ++j2) {
          int cnt = 0;
          ll xmin = min(
              {list[i].first, list[j].first, list[i2].first, list[j2].first});
          ll xmax = max(
              {list[i].first, list[j].first, list[i2].first, list[j2].first});
          ll ymin = min({list[i].second, list[j].second, list[i2].second,
                         list[j2].second});
          ll ymax = max({list[i].second, list[j].second, list[i2].second,
                         list[j2].second});
          for (int k = 0; k < N; ++k) {
            if (xmin <= list[k].first && list[k].first <= xmax &&
                ymin <= list[k].second && list[k].second <= ymax) {
              cnt++;
            }
          }
          if (cnt >= K)
            ans = min(ans, (xmax - xmin) * (ymax - ymin));
        }
      }
    }
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a,b,sum=0,i;
  scanf("%d", &a);
  scanf("%d", &b);

  for(i=0;i<2;i++){
      if(a>b){
      sum+=a;
      a-=1;
    }else{
      sum+=b;
      b-=1;
    }
  }
  printf("%d",sum);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct _OMAZINAI_ { _OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } __omazinai_instance__;
#define INF (1LL<<61 + 1<<29)
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
void _INPUT_IMPL_() {};
template <class T, class... Args> void _INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; _INPUT_IMPL_(args...); }
void _OUTPUT_IMPL_() {};
template <class T, class... Args> void _OUTPUT_IMPL_(T dest, Args... args) { cout<< dest << (sizeof...(Args)?" ":""); _OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; _INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define out(...) _OUTPUT_IMPL_(__VA_ARGS__)

int main() {
	in(int, n);
	cout << "ABC" << n << endl;
}

Measured memory_bytes: 256
/*
 * main.c
 *
 *  Created on: 2020/03/28
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)
typedef long long int ll;
typedef unsigned long long int ull;

int sort_inc(const void *a, const void *b) { return (*(int*)a - *(int*)b);}
int sort_dec(const void* a, const void* b) { return (*(int*)b - *(int*)a);}
int sort_dec_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = -1; }
    else if (da == db) { val = 0; }
    else { val = 1; }
    return val;
}
int sort_inc_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = 1; }
    else if (da == db) { val = 0; }
    else { val = -1; }
    return val;
}
int sort_dic(const void *a, const void *b) {
    char *pa = (char *)a;    char *pb = (char *)b;    int i = 0, val = 0, N = 10;
    for (i = 0; i < N; i++) {
    	char da = pa[i], db = pb[i];
    	if (da == db) continue;
  		if (da > db) val = 1; else val = -1;
        break;
    }
    return val;
}

void yesno(int ans) {
	if (ans == 1) {	printf("Yes\n");
	} else {		printf("No\n");	}
	return;
}

void YESNO(int ans) {
	if (ans == 1) {	printf("YES\n");
	} else {		printf("NO\n");	}
	return;
}

void okng(int ans) {
	if (ans == 1) { printf("OK\n");
	} else { 		printf("NG\n");	}
	return;
}

int main()
{
	ll A = 0, B = 0, V = 0, W = 0, T = 0;
	scanf("%lld %lld", &A, &V);
	scanf("%lld %lld", &B, &W);
	scanf("%lld", &T);

	ll i = 0;
	int ans = 0;
	if (V <= W) {
		YESNO(0);
		return 0;
	}
	ll d = abs(A-B);
	ll s = V - W;
	if (d <= (T*s)) {
		ans = 1;
	}

	YESNO(ans);
	return 0;
}


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

int main() {
	string S;
  	cin>>S;
  
  int answer;
  
  if(S[0]=='1'){answer++;
  }
  if(S[1]=='1'){answer++;
  }
 if(S[2]=='1'){answer++;
  }
   
  
  cout<<answer<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int a,b,c,d,e;
  int f,g=0;
  cin>>a>>b>>c>>d>>e;
  f=min(min(a*8,b*4),min(c*2,d));
  if(e!=(e/2)*2) g=min(min(a*4,b*2),c);
  cout<<f*(e/2)+g<<"\n";
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import deque
def main():
    k=int(input())
    que=deque([1,2,3,4,5,6,7,8,9])
    for _ in range(k-1):
        q=que.popleft()
        if q%10>0:que.append(10*q+q%10-1)
        que.append(10*q+q%10)
        if q%10<9:que.append(10*q+q%10+1)
    print(que[0])


if __name__=='__main__':
    main()

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

int main() {
  int n, x;
  cin >> n;
  cin >> x;
  int m[n];
  for(int i=0; i<n; i++)
    cin >> m[i];

  int min = m[0];
  x -= m[0];
  for(int i=1; i<n; i++) {
    x -= m[i];
    if(min > m[i]) min = m[i];
  }

  int add = 0;
  while(1) {
    x -= min;
    if(x < 0)
      break;
    else
      add++;
  }

  cout << n + add << endl;

}

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

namespace kakomon
{
    class Program
    {
        static void Main(string[] args)
        {
            abc063_c();
        }

        static void abc063_c()
        {
            // C - Bugged
            int n = int.Parse(Console.ReadLine());
            List<int> S = new List<int>();
            for (int i=0; i<n; i++)
            {
                S.Add(int.Parse(Console.ReadLine()));
            }
            // 合計が10の倍数でないなら、そのまま答えになる
            int total = S.Sum();
            int ans = total;
            if (total % 10 == 0)
            {
                // 合計が10の倍数の場合、10の倍数でない最小の配点を選んで、減らす
                int[] cand = S.Where(x => x % 10 != 0).ToArray();
                if (cand.Count() > 0) ans -= cand.Min();
                else ans = 0;
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13268
import numpy as np
import math
n, m = map(int,input().split())
h = list(map(int,input().split()))
mr = [1 for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1] <= h[b-1]:
        mr[a-1] = 0
    if h[a-1] >= h[b-1]:
        mr[b-1] = 0
ans = 0
for i in mr:
    ans += i
print(ans)

    

Measured memory_bytes: 38600
#include <iostream>

using namespace std;

long long n,a,total;

int main(void){

  total = 0;
  cin >> n;

  for( int i = 0 ; i < n ; i++ ){
    cin >> a;
    total += a;
  }
  cout << (int)(total / n) << endl;
  return 0;
} 

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int r = 0, k = 0;
    for (char c : s) {
        if (string("ATCG").find(c) == string::npos) k = 0; else k++;
        r = max(r, k);
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
function Main(input) {
  const weathers = input.trim();
  //
  //R
  //RR
  //RRR
  let rst = 0;
  if (
    weathers === "RSS" ||
    weathers === "SRS" ||
    weathers === "SSR" ||
    weathers === "RSR"
  ) {
    rst = 1;
  } else if (weathers === "RRS" || weathers === "SRR") {
    rst = 2;
  } else if (weathers === "RRR") {
    rst = 3;
  }

  console.log(rst);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int N;
	string s;
	cin >> N >> s;

	int pos = s.find("xx");
	if(pos == string::npos){
		cout << N << endl;
	}
	else{
		cout << pos + 1 << endl;
	}
}

Measured memory_bytes: 3292