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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int ans=0;
	ans += min(k,a);
	k -= min(k,a);
	k-=min(k,b);
	ans -=min(k,c);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3640
#include <vector>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>

using namespace std;

int main(void){

  int N,L;
  vector<string> S;

  cin >> N >> L;

  for(int i = 0; i < N; i++){
    string str;
    cin >> str;
    S.push_back(str);
  }

  sort(S.begin(),S.end());

  string ans = "";
  for(int i = 0; i < N; i++){

    ans += S.at(i);

  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	long long int n, a, b;
	cin >> n >> a >> b;
	if (n == 1) {
		if (a == b) {
			cout << 1 << endl;
		}
		else {
			cout << 0 << endl;
		}
	}
	else if (a > b) {
		cout << 0 << endl;
	}
	else {
		long long int aa = a*(n - 2);
		long long int bb = b*(n - 2);
		cout << bb - aa + 1 << endl;
	}
	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);
		String s = sc.nextLine();
		int l = s.length();
		if(l<6) {
			System.out.println("INVALID");
			return;
		}
		char[] p = new char[l];
		for(int i=0;i<l;i++) {
			p[i] = s.charAt(i);
		}
		boolean num = false;
		boolean cap = false;
		boolean lit = false;
		for(int i=0;i<l;i++) {
			char c = p[i];
			if('0'<=c && c<='9') num = true;
			if('A'<=c && c<='Z') cap = true;
			if('a'<=c && c<='z') lit = true;
		}
		if(num && cap && lit) {
			System.out.println("VALID");
		}else {
			System.out.println("INVALID");
		}
		
	}	
}





Measured memory_bytes: 26320
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define For(i,m,n) for(int i=m;i<n;i++)
#define ll long long
#define l long
#define all(x) x.begin(),x.end()
#define pb push_back
#define len(x) x.len
int main()
{


int n;
cin>>n;
vector<string> g;
FOR(i,n){string h;cin>>h;g.pb(h);}
map<string,int> m;
m["AC"]=0;
m["WA"]=0;
m["TLE"]=0;
m["RE"]=0;
for(int i=0;i<g.size();i++)m[g[i]]++;
cout<<"AC x "<<m["AC"]<<endl;
cout<<"WA x "<<m["WA"]<<endl;
cout<<"TLE x "<<m["TLE"]<<endl;
cout<<"RE x "<<m["RE"]<<endl;



return 0;}

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

int main() {
	long long int N,K;
  	cin>> N >> K;
  	if(N>=K){
     	 N=N%K;
    }
  
  	while(true){
     	N=min(N,abs(N-K));
      	if(N<=abs(N-K)){
         	break; 
        }
    }
  
  	cout<<N<<endl;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
  using namespace std;
  string S;
  cin >> S;

  int ans=0;
  for (int i=0; i<S.size(); i++) {
    if (S[i] == '+'){
      ans++;
    } else {
      ans--;
    }
  }

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


Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int grundy(int m, int k){
    if(m/k == 0) return 0;
    if(m%k == 0) return m/k;
    return grundy(m-m/k-1, k);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N; cin >> N;
    int total = 0;
    for(int i = 0; i < N; i++){
        int a, k; cin >> a >> k;
        total ^= grundy(a, k);
    }
    cout << (total == 0 ? "Aoki" : "Takahashi") << endl; 
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int bemiho,katoshi = 0;
  cin >> bemiho >> katoshi;
  vector<int> kosakana(bemiho);
  for(int i = 0; i < bemiho; i++) {
    cin >> kosakana.at(i);
  }
  for(int i = 0; i < bemiho; i++) {
    katoshi -= kosakana.at(i);
  }
  sort(kosakana.begin(), kosakana.end());
  cout << bemiho + katoshi/kosakana.at(0) << endl;
}

Measured memory_bytes: 256
import java.io.*
import java.util.*

fun solve(n: Int, a: IntArray) {
    // dp[i] -> aから小さい順のi個を用いたときの最大ペア (bi, ci) bi < ci
    // dp[i] =
    val A = a.sorted().toList()
    val M = A.last()!!
    val half = M.toDouble() / 2
    val i = A.slice(0 until n-1)
        .map{ Math.abs(it.toDouble() - half) }
        .withIndex()
        .minBy{ it.value }!!
        .index
    println("$M ${A[i]}")
    return
}



fun <T : Comparable<T>> List<T?>.lowerBound(
        element: T,
        fromIndex: Int = 0,
        toIndex: Int = size
): Int {
    var low = fromIndex
    var high = toIndex
    while (low < high) {
        val mid = (low + high) / 2
        if (element <= this.get(mid)!!) {
            high = mid
        } else {
            low = mid + 1
        }
    }
    return low
}

fun <T : Comparable<T>> List<T?>.upperBound(
        element: T,
        fromIndex: Int = 0,
        toIndex: Int = size
): Int {
    var low = fromIndex
    var high = toIndex
    while (low < high) {
        val mid = (low + high) / 2
        if (element >= this.get(mid)!!) {
            low = mid + 1
        } else {
            high = mid
        }
    }
    return low
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val n = sc.next().toInt()
    val a = IntArray(n)
    for (i in 0 until n) {
        a[i] = sc.next().toInt()
    }
    solve(n, a)
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

ll dp[5100];

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

    ll A, B, C, D, E, F;
    std::cin >> A >> B >> C >> D >> E >> F;

    for(int i=0;i<=5000;++i){
        if(i + C <= 5000){
            dp[i + C] = max<ll>(dp[i + C], dp[i] + C);
        }
        if(i + D <= 5000){
            dp[i + D] = max<ll>(dp[i + D], dp[i] + D);
        }
        if(i + 1 <= 5000){
            dp[i + 1] = max(dp[i + 1], dp[i]);
        }
    }

    ll mx_w = 100 * A, mx_s = 0;
    for(int i=0;i<=30;++i){
        for(int j=0;j<=30;++j){
            if(i == 0 && j == 0){continue;}
            if(100ll * (A * i + B * j) > F){continue;}
            
            ll w = 100ll * (A * i + B * j), s = dp[min((A * i + B * j) * E, F - w)];
            if(mx_s * (w + s) < s * (mx_s + mx_w)){
                mx_w = w;
                mx_s = s;
            }
        }
    }

    std::cout << (mx_w + mx_s) << " " << mx_s << std::endl;
}


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

int main() {
    string a, b;
    cin >> a >> b;

    if (a == b) {
        cout << "EQUAL" << endl;
    }
    else if (a.length() > b.length()) {
        cout << "GREATER" << endl;
    }
    else if (a.length() < b.length()) {
        cout << "LESS" << endl;
    }
    else if (a.length() == b.length()) {
        for (int i=0; i<a.length(); ++i) {
            if (a[i] > b[i]) {
                cout << "GREATER" << endl;
                break;
            }
            else if (a[i] < b[i]){
                cout << "LESS" << endl;
                break;
            }
        }
    }

}


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

int main(){
    int x;
    cin >> x;
    if(x == 1){
        x = 0;
        cout << x << endl;
    }else{
        x = 1;
        cout << x << endl;
    }

}

Measured memory_bytes: 3596
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back   
#define sz(a) ((int)a.size())
using namespace std;
typedef long long ll ; 
const ll inf = 1e18 ;
const int mod = 1e9 + 7;
const int N = 3e5 + 5; 
const int SZ = 101;
ll po(ll x,ll y,ll p = mod) {ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

int lg2(int x){
    int cnt = -1;
    while(x) cnt++ , x >>= 1; 
    return cnt ;
}

void solve(){
    int n ;
    ll t = 0;
    cin >> n ;
    bool v[50] = {};
    for(int i = 0 ; i < n ; ++i){
        ll x ;
        cin >> x;
        t ^= x ;
        x ^= (x - 1);
        v[lg2(x + 1) - 1] = true ;
    }
    bitset<60> bset(t);
    int tmp = 59 , cnt = 0;
    bool ans = true ;
    while(tmp >= 0){        
        while(tmp >= 0 && !bset[tmp]) --tmp;
        if(tmp < 0) break ;
        ans &= (v[tmp]);
        cnt++;
        while(tmp >= 0 && bset[tmp]) --tmp;
        if(tmp < 0) break ;
        ans &= (v[tmp]);        
        cnt++;
    }
    cout << (ans ?  cnt : -1);

}

int main()
{
    ios::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL);
    int TC = 1, t = 0;
    // cin >> TC ;
    while(t++ < TC)
    {
        // cout << "Case #" << t << ": " ;
        solve();
        cout << "\n" ;
    }
    return 0;
}

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

using namespace std;

int n[1000]={};
long long a[1000][1000]={};
long long ans = 10000000000;

int main(){
    int s=0;
    while(1){
        scanf("%d",&n[s]);
        if(n[s] == 0){
            break;
        }
        for(int i=0;i<n[s];i++){
           scanf("%lld",&a[s][i]); 
        }
        s++;
    }

    int times =s;
    int sub;
    for(int i=0;i<s;i++){
        sort(a[i],a[i]+n[i]);
        for(int j=0;j<n[i]-1;j++){
            sub = abs(a[i][j] - a[i][j+1]);
            if(ans >= sub){
                ans = sub;
            }
        }
        cout << ans << endl;
        ans = 1000000000;
    }
    

    return 0;
}


Measured memory_bytes: 4264
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    val Array(a, b, k) = sc.nextLine.split(" ").map(_.toInt)


    @annotation.tailrec
    def go(n: Int, k: Int, gcdVal: Int): Int = {
      if (gcdVal % n == 0) {
        if (k == 1) {
          n
        }
        else go(n - 1, k - 1, gcdVal)
      }
      else go(n - 1, k, gcdVal)
    }


    def gcd(x: Int, y: Int): Int = {
      if (y == 0) x
      else gcd(y, x % y)
    }

    val gcdVal: Int = gcd(a, b)

    print(go(gcdVal, k, gcdVal))
  }
}

Measured memory_bytes: 25664
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

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

const (
	yymm = "YYMM"
	mmyy = "MMYY"
	amb  = "AMBIGUOUS"
	na   = "NA"
)

func checkFormat(s string) string {
	isYYMM := isMM(s[2:])
	isMMYY := isMM(s[:2])
	switch {
	case isYYMM && isMMYY:
		return amb
	case isYYMM:
		return yymm
	case isMMYY:
		return mmyy
	default:
		return na
	}
}

func isMM(ss string) bool {
	switch ss {
	case "01", "02", "03", "04", "05", "06",
		"07", "08", "09", "10", "11", "12":
		return true
	default:
		return false
	}
}

func main() {
	s := nextString()
	r := checkFormat(s)
	fmt.Println(r)
}


Measured memory_bytes: 640
def gattai(a):
    tmp = ''
    for i in a:
        tmp += str(i)
    return tmp
import itertools
N = int(input())
a = [0]*N
p = gattai(list(map(int, input().split())))
q = gattai(list(map(int, input().split())))
for i in range(1,N+1):
    a[i-1] = i
ans1 = 0
ans2 = 0
count = 0
for i in itertools.permutations(a):
    count += 1
    if gattai(i) == p:
        ans1 = count
    if gattai(i) == q:
        ans2 = count
print(abs(ans1-ans2))

Measured memory_bytes: 3064
#include <stdio.h>

const int maxn = 100005;
int a[maxn];

int main()
{
    int k;
    scanf("%d",&k);
    for (int i = 1; i <= k; i++)
        scanf("%d", &a[i]);
    long long maxm = 2, minm = 2;
    for(int i = k; i > 0; i--)
    {
        if(minm % a[i] != 0)
            minm = minm / a[i] * a[i] + a[i];
        maxm = maxm / a[i] * a[i] + a[i] - 1;
        if(minm > maxm)
            break;
    }
    if(minm <= maxm)
        printf("%lld %lld\n", minm, maxm);
    else
        printf("-1\n");
    return 0;
}


Measured memory_bytes: 512
import math

n = int(input())
A = list(map(int,input().split()))

MAX = max(A)
m = min(A)
B = A.copy()
result = 0

def merge(A, left, mid, right):

  global  count

  L = A[left:mid]
  L.append(math.inf)
  R = A[mid:right]
  R.append(math.inf)
  i = 0
  j = 0

  for k in range(left,right):
    if L[i] <= R[j]:
      A[k] = L[i]
      i = i + 1
    else:
      A[k] = R[j]
      j = j + 1


def mergeSort(A,left,right):
    if left +1 < right:
        mid = (left+right) // 2
        mergeSort(A,left,mid)
        mergeSort(A,mid,right)
        merge(A,left,mid,right)

mergeSort(B,0,n)

T = [None] * (MAX+1)
V = [False] * n
for i in range(n):
    T[B[i]] = i

for i in range(n):
    if V[i]: continue
    cur = i
    ant = 0
    S = 0
    s = MAX
    while(1):
        V[cur] = True
        v = A[cur]
        if v < s:
            s = v
        S += v
        ant += 1

        cur = T[v]
        if V[cur]: break

    result += min(S+(ant-2)*s,S+s+(ant+1)*m)


print(result)



Measured memory_bytes: 5840
//aのケツとbの頭、bのケツとcの頭が一致するか

#include <string>
#include <iostream>
using namespace std;

main(){
    string wordA;
    string wordB;
    string wordC;

    cin >> wordA >> wordB >> wordC;

    if(wordA.back() != wordB.front()){
        cout << "NO" << endl;
    }else if(wordB.back() != wordC.front()){
        cout << "NO" << endl;
    }else{
    cout << "YES" << endl;
    }
    return 0;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;
 
int main() {
 int n, k;
 cin >> n >> k;
 vector<int>a(k);
 rep(i, 0, k)cin >> a[i];
 rep(i, 0, 100000){
     int tempn = n+ i;
     string temps = to_string(tempn);
     int m = temps.size();
     int cnt = 0;
     rep(j, 0, m){
         rep(l, 0, k){
             if(temps[j]-'0'== a[l])cnt++;
        }
     }
     if(cnt == 0){
         cout << temps << endl;
         return 0;
     }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long, long long> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<pair<int,int> > vii;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<pair<long long,long long> > vpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int,pair<int,int> > iii;
#define PI 3.141592653589793
#define mod (ll)(1000*1000*1000+7)
//# define N 300005
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=((ans%m)*(a%m))%m; b/=2; a=((a%m)*(a%m))%m; } return ans%m; }
# define INF (ll)1e15
# define LG 20  
typedef pair<int,pair<int,int> > pii;
# define INF1 (int)1e9+2
# define maxn 200005
# define offset 100005

ll ans;
ll fast_exp(ll a, ll b)
{
	ll res=1;
	while(b>0)
	{
		if(b&1)
		{
			res*=a;
		}
		a*=a;
		b/=2;
	}
	return res;
}

int a[maxn];
int n;

ll check(ll x)
{
	ll ans=0;
	for(int i=0;i<n;i++)
	{
		 ans+=abs(a[i]-x-i-1);
	}
	return ans;
}

int main()
{
	
	cin >> n;

	for(int i=0;i<n;i++)
		cin >> a[i];
	ll lo=-INF1;
	ll hi=INF1;
	while(lo<=hi)
	{
		ll mid=(lo+hi)/2;
		ll val1=check(mid);
		ll val2=check(mid-1);
		ll val3=check(mid+1);
		if(val1<=val2 && val1<=val3)
		{
			ans=mid;
			break;
		}
		else if(val2<val1)
		{
			hi=mid-1;
		}
		else
			lo=mid+1;
	}
	ll fans=0;
	for(int i=0;i<n;i++)
	{
		fans+=abs(a[i]-ans-i-1);
	}
	cout << fans;
}

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

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

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

    int x;
    cin>>x;
    for(int k=1;;k++)
        if(k*x%360==0)
            cout<<k,exit(0);
}


Measured memory_bytes: 3644
from math import ceil
from collections import deque


N, D, A = map(int, input().split())
monsters = []
for i in range(N):
    x, h = map(int, input().split())
    monsters.append((x, h))
monsters.sort()


damage_sum = 0
ans = 0
q = deque([])
for i in range(N):
    x, h = monsters[i]
    while q and q[0][0] < x:
        damage_sum -= q[0][1]
        q.popleft()
    h -= damage_sum
    if h > 0:
        hit = ceil(h / A)
        ans += hit
        damage = hit * A
        damage_sum += damage
        q.append((x + 2 * D, damage))

print(ans)


Measured memory_bytes: 44540
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  int n;
  int s,e;
  cin >> a >> b;
  cin >> n;
  bool f=false;
  while(n--){
    cin >> s >> e;
    if((s<=a&&a<e)||(s<b&&b<=e)||(a<=s&&b>=e))
      f=true;
  }
    cout << f << endl;
  return 0;
}

Measured memory_bytes: 3084
#include <stdio.h>

int main(){
    char a[ 20 + 1 ] = { 0 };
    int i;

    scanf( "%20s", a );
    for ( i = 19; i >= 0; i -- ) {
        a[ i ] ? putchar( a[ i ] ) : 0 ;
    }
    putchar( '\n' );

    return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, start, stop) for (int i = start; i < stop; i++)
#define FORR(i, start, stop) for (int i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<int>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<int>());
#define REMOVE(v,n) remove(vector<int> v,v+v.size(),int n)
#define ERASE(v,n) v.erase(v.begin()+n);
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<int> vint;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;
void chmin(int &a, int b) { if (a > b) a = b; }

//vector< vector<int> > v (size1, vector<int>(size2) );

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll K,X;
    cin>>K>>X;
    FOR(i,X-K+1,X+K){
        cout<<i<<' ';
    }

}

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

using namespace std;

typedef long long ll;

signed main(){
    int k, n;
    cin >> n >> k;
    vector<int> a(n);
    for(auto& x : a)
        cin >> x;
    sort(a.begin(), a.end());
    int ans = 1e9;
    for(int i = 0; i < n - k + 1; ++i){
        ans = min(ans, a[i + k - 1] - a[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        int A = sc.nextInt();
        int B = sc.nextInt();
        int T = sc.nextInt();

        WriteLine((T / A) * B);
    }
}


class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 11092
N = int(input())
a = list(map(int, input().split()))
max = 0
for i in range(len(a)+1):
  for j in range(i+1, len(a)):
    #print(i, j)
    if max < abs(a[i] - a[j]):
      max = abs(a[i] - a[j])
print(max)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main (){
  int N;
  cin>>N;
  vector<int> train(N);
  for(int i=0;i<N;i++){
    cin>>train.at(i);
  }
  int s=1;
  int n=0;
  for(int i=0;i<N;i++){
    s=train.at(s-1);
    n++;
    if(s==2){
      cout<<n<<endl;
      break;
    }
    else if(i==N-1){
      cout<<"-1"<<endl;
      break;
    }
  }
}


Measured memory_bytes: 3800
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		new Main().start();
	}
	void start(){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = in.nextInt();
		}
		int count = 0;
		int i = 0;
		while(true){
			if(i == 1){
				break;
			}else if(count > 100000){
				break;
			}
			i = a[i]-1;
			count++;
		}
		if(count != 100001){
			System.out.println(count);
		}else{
			System.out.println(-1);
		}
		in.close();
	}
}


Measured memory_bytes: 50956
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;

ll fac[100005];  //k!(mod M)
ll aa[100005]; //n!(1+1/2+..+1/k) (mod M)
ll saa[100005];

ll mpow(ll x, ll n){ //x^n(mod M)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % MOD;
        x = x*x % MOD;
        n = n >> 1;
    }
    return ans;
}

void pre( long n )
{
    fac[0] = 1;
    long i;
    for(i=0; i<n; i++){
        fac[i+1] = fac[i]*(i+1) % MOD; // k!(mod M)
    }
    aa[0]=saa[0]=0;
    for(i=1; i<=n; i++) {
        aa[i] = fac[n] * mpow(i, MOD-2) % MOD;
        saa[i] = saa[i-1] + aa[i];
    }

    return;
}

int main(int argc, char* argv[])
{    
    long n;
    scanf("%ld", &n);

    vector<long> a(n+1);
    long i;
    for(i=1; i<=n; i++) {
        scanf("%ld", &a[i]);
    }

    pre(n);

    ll ans = 0;
    for(i=1; i<=n; i++) {
        ll tmp = (saa[i] + saa[n-i+1] - fac[n] + MOD)%MOD;
        ans = (ans + tmp * a[i]) %MOD;
    }

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


Measured memory_bytes: 3328
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		
		int a[] = new int[n];
		int x[] = new int[n];
		
		for(int i=0;i<n;i++) {
			a[i]=sc.nextInt();
		}
		
		for(int i=0;i<n;i++) {
			if(i%2==1)
				x[0]-=a[i];
			if(i%2==0)
				x[0]+=a[i];
		}
		
		for(int i=1;i<n;i++) {
			x[i]=a[i-1]*2-x[i-1];
		}
		
		for(int i=0;i<n;i++) {
			System.out.print(x[i]);
			System.out.print(" ");
		}
		

	}

}

Measured memory_bytes: 67752
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main()
{
	fast	
	int a,b,c;
	cin>>a>>b>>c;
	int ar[3]={a,b,c};
	sort(ar,ar+3);
	if(ar[1]==ar[0] && ar[1]!=ar[2] || ar[0]!=ar[1] && ar[1]==ar[2])
		cout<<"Yes\n";
	else cout<<"No\n";
	
}

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

int main() {
    int n;
    cin >> n ;
    vector<int> a(n);
    for (int i=0;i<n;i++){
        cin >> a.at(i);
    }
    int now =a.at(0);
    int count = 1;
    for (int i=0;i<n+1;i++){
        if (now == 2){
            cout << count << endl;
            return 0;
        }       
        now = a.at(now-1);
        count++;
    }
    cout << -1 << endl;
    return 0;
}



Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
	int a,b,x;
	int sum=0;
	
	scanf("%d%d",&a,&b);
	
	x=b-a;
	
	for(int i=0;i<=x;i++){
		sum=sum+i;
	}
	
	printf("%d\n",sum-b);
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define maxn 100005
int a[maxn],anc[maxn][22];
int main(){
	int n,q,l;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	scanf("%d%d",&l,&q);
	for(int i=n;i>=1;i--){
		anc[i][0]=lower_bound(a+1,a+n+1,a[i]+l)-a;
		if(anc[i][0]>n)anc[i][0]=n;
		if(a[anc[i][0]]>a[i]+l)anc[i][0]--;
		for(int j=1;j<=21;j++){
			anc[i][j]=anc[anc[i][j-1]][j-1];
		}
	}
	for(int i=1;i<=q;i++){
		int x,y,ans=0;
		scanf("%d%d",&x,&y);
		if(x>y)swap(x,y);
		for(int j=21;j>=0;j--){
			if(anc[x][j]<y){
				ans+=pow(2,j);
				x=anc[x][j];
			}
		}if(x<y)ans++;
		printf("%d\n",ans);
	}
}

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

int main() {
  long double x, y;
  cin >> x >> y;
  cout << ceil(log2l((y + 1) / x)) << endl;
}


Measured memory_bytes: 512
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let N: usize = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };
    let s: Vec<i64> = (0..N)
        .map(|_| {
                let mut line: String = String::new();
                std::io::stdin().read_line(&mut line).unwrap();
                line.trim().parse().unwrap()
        })
        .collect();

    let t = {
        let mut t = s.clone();
        t.push(0);
        t
    };
    let m = t.iter().sum::<i64>();
    let ans = t.iter().map(|&x| if (m - x) % 10 == 0 { 0 } else { m - x }).max().unwrap();

    println!("{}", ans);
}


Measured memory_bytes: 4352
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,m = map(int, readline().split())


print((n-1)*(m-1))

Measured memory_bytes: 3064
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <chrono> //1e+9で割る auto end= chrono::system_clock::now()-st;  cout<<end.count()%1e+9<<endl;
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef long double db;

#define fr first
#define sc second
#define pb push_back
#define rep(i,x) for(ll i=0;i<x;i++)
#define rep1(i,x) for(ll i=1;i<=x;i++)
#define rrep(i,x) for(ll i=x-1;i>=0;i--)
#define rrep1(i,x) for(ll i=x;i>0;i--)

ll N;
ll A[100000];
ll a=0xffffff,b=-1000000;

int main()
{
	cin>>N;
	rep(i,N){
		cin>>A[i];
		a=min(a,A[i]);
		b=max(b,A[i]);
	}
	cout<<b-a<<endl;
}

Measured memory_bytes: 256
N = int(input())
s = list([int(input()) for _ in range(N)])

s_sum = sum(s)
s.append(101)

if s_sum%10!=0:
    print(s_sum)
else:
    s_min=min([i for i in s if i%10!=0])
    if s_min==101:print(0)
    else:print(s_sum-s_min)

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

int N, M;
set<string> dir, file;

string conv(string s, bool check) {
  bool flag = *s.rbegin() == '/';
  replace(s.begin(), s.end(), '/', ' ');
  deque<string> deq;
  string now = "";
  for(stringstream ss(s); ss >> s; ) {
    if(check) {
      if(!dir.count(now + "/")) return "#";
    } else {
      dir.insert(now + "/");
    }
    if(s == "..") {
      if(deq.empty()) return "#";
      now = deq.back();
      deq.pop_back();
    } else if(s == ".") {
      //
    } else {
      deq.push_back(now);
      now += "/" + s;
    }
  }
  if(flag) now += "/";
  return now;
}

int main() {
  for(; cin >> N >> M && (N|M); ) {
    dir.clear();
    file.clear();
    for(int i = 0; i < N; ++i) {
      string s;
      cin >> s;
      file.insert(conv(s, false));
    }
    while(M--) {
      string a, b;
      cin >> a >> b;
      a = conv(a, true);
      b = conv(b, true);
      vector<string> va, vb;
      if(*a.rbegin() == '/') {
        va.push_back(a + "index.html");
      } else {
        va.push_back(a);
        va.push_back(a + "/index.html");
      }
      if(*b.rbegin() == '/') {
        vb.push_back(b + "index.html");
      } else {
        vb.push_back(b);
        vb.push_back(b + "/index.html");
      }
      int res = 0;
      for(int i = 0; i < va.size(); ++i) {
        if(!file.count(va[i])) continue;
        for(int j = 0; j < vb.size(); ++j) {
          if(!file.count(vb[j])) continue;
          res = max(res, 1);
          if(va[i] == vb[j]) {
            res = 2;
          }
        }
      }
      if(res == 0) cout << "not found" << endl;
      else if(res == 1) cout << "no" << endl;
      else cout << "yes" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1252
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	int x1,x2,x3,x4,x5;
	cin>>x1>>x2>>x3>>x4>>x5;
	if(x1==0)cout<<1;
	if(x2==0)cout<<2;
	if(x3==0)cout<<3;
	if(x4==0)cout<<4;
	if(x5==0)cout<<5; 
	return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int t = scn.nextInt() - 1;
		char[] c = scn.next().toCharArray();
		c[t] += 'a' - 'A';
		System.out.println(c);
		scn.close();
	}
}


Measured memory_bytes: 22740
/**
 *    author:  FromDihPout
 *    created: 2020-07-14
**/

#include <bits/stdc++.h>
using namespace std;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        if ((i & 1) && (x & 1)) {
            ans++;
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define se second
#define fi first
ll binsearch(ll x, vector<ll> v)
{
  ll l = 0, r = v.size() - 1, mid, ans = 0;
  while (l <= r)
  {
    mid = (l + r) / 2;
    if (v[mid] < x)
      l = mid + 1, ans = mid;
    else if (v[mid] > x)
      r = mid - 1;
    else
      return mid;
  }
  return ans;
}
bool cmp(ll a, ll b)
{
  return a > b;
}
int main()
{

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ll n;
  cin >> n;
  ll arr[n];
  for (int i = 0; i < n; i++)
  {
    cin >> arr[i];

  }
  sort(arr, arr + n, cmp);
  ll ans = 0;
  ans += arr[0];

  ll k = n - 2;
  for (int i = 1; i < n; i++)
  {
    if (k)
    {
      ans += arr[i];
      k--;
      if (k)
      {
        ans += arr[i];
        k--;
      }
      else
        break;

    }
    else
    {
      break;
    }
  }
  cout << ans << endl;


}

Measured memory_bytes: 5144
#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <float.h>
#include <stdlib.h>
#include <functional>
using namespace std;
int main(){
    int n,m;
    int a[120],b[120];
    int s=0;
    int d=0;
    cin >> n >> m;
    for(int i=0;i<n;i++){
        cin >> a[i];
        s=a[i]+s;
    }
    for(int i=0;i<n;i++){
        b[i]=1;
        if(s>a[i]*4*m){
            b[i]=0;
        }
    }
    for(int i=0;i<n;i++){
        d=b[i]+d;
    }    
    if(d<m){
        cout << "No";
    }else
    {
        cout << "Yes";
    }
    

    }



Measured memory_bytes: 256
import java.util.*;

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

        char[][] m = new char[3][3];
        for(int i = 0; i < 3; i++) {
            m[i] = sc.next().toCharArray();
        }

        for(int i = 0; i < 3; i++) {
            System.out.print(m[i][i]);
        }
        System.out.println();
        
    }
}

Measured memory_bytes: 21844
/*ex4_2
series2*/

# include <stdio.h>
# include <math.h>
int main(void){
    //各文字の箱を作って読み取り
    int l_hand,s_hand,hour,minute;
    scanf("%d %d %d %d",&l_hand,&s_hand,&hour,&minute);
    //二本の針の差を0以上pi以下で計算
    //2*M_PI*(60*hour+minute)/(12*60)は時針の進んだ角度
    //2*M_PI*minute/60は分針の進んだ角度
    long double diff=2*M_PI*(60*hour+minute)/(12*60)-2*M_PI*minute/60;
    //余弦定理を用いて端点の差を計算
    printf("%.20f\n",sqrt((l_hand*l_hand+s_hand*s_hand-2*l_hand*s_hand*cos(diff))));
    return 0;
}

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

int n, k, x=1;

int main (){
	cin >> n>> k;
	for(int i=1;i<=n;i++){
		if(x+k<=2*x){
			x=x+k;	
		}
		else if(x+k>2*x){
			x=x*2;
		} 
	}
	cout << x << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

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

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int h, w, k;
    cin >> h >> w >> k;

    vector< vs32 > s(h + 1, vs32(w + 1));
    rep (i, h) s[i][0] = 0;
    rep (j, w) s[0][j] = 0;

    string t;
    rep (i, h)
    {
        cin >> t;
        rep (j, w)
        {
            s[i + 1][j + 1] = s[i + 1][j] + (t[j] == '1' ? 1 : 0);
        }
    }

    rep (i, h)
    {
        rep (j, w)
        {
            s[i + 1][j + 1] += s[i][j + 1];
        }
    }

    int ans = (int)1e9;
    rep (i, (1 << (h - 1)))
    {
        vs32 v;
        v.push_back(0);
        int j = i;
        int cnt = 1;
        while (j)
        {
            if (j & 1) v.push_back(cnt);
            ++cnt;
            j >>= 1;
        }
        v.push_back(h);

        int sum = v.size() - 2;
        int l = 0, r = 1;
        while (r <= w)
        {
            bool flag = false;
            rep (j, v.size() - 1)
            {
                if (s[v[j + 1]][r] - s[v[j]][r] - s[v[j + 1]][l] + s[v[j]][l] > k)
                {
                    flag = true;
                }
            }
            if (flag)
            {
                if (l == r - 1)
                {
                    sum = 1e9;
                    break;
                }
                l = r - 1;
                --r;
                ++sum;
            }
            ++r;
        }

        ans = MIN(ans, sum);
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 256
// ITP1_6_A:   Reversing Numbers
// 2017.7.27

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

int main()
{
  int n,k,arr[101];
  scanf("%d",&n);
  for (int i = 0; i < n; i++)
  {
    scanf("%d",&k);
    arr[i] = k;
  }
  for (int c = n-1; c >= 0; c--)
  {
    if(c > 0)printf("%d ",arr[c]);
    else
    {
      printf("%d",arr[c]);
    }
    
    
  }
  printf("\n");
	return 0;
  

}





Measured memory_bytes: 2036
#include "bits/stdc++.h"
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
using ll = long long;
using namespace std;

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

sort(a, a + N, greater<int>())   // descend
sort(a, a+N)                    //  ascend


** nCk
void comb(vector<vector <long long int > > &v) {
for (int i = 0; i < v.size(); i++) {
v[i][0] = 1;
v[i][i] = 1;
}
for (int k = 1; k < v.size(); k++) {
for (int j = 1; j < k; j++) {
v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
}
}
}


** main内でnCn~nC0 生成 **
vector<vector<long long int> > v(n + 1, vector<long long int>(n + 1, 0));
comb(v);


*/



int main() {
	ll n;
	cin >> n;
	ll prime[1000] = { 0 };
	ll ans = 1;
	rep(i, 2, n + 1) {
		ll c = i;
		rep(j,2,n+1){
			while(c%j == 0) {
				prime[j]++;
				c /= j;
			}
		}
	}
	rep(i, 2, n + 1) ans = (ans*(prime[i]+1))%(1000000000+7);
	cout << ans;
}


Measured memory_bytes: 256
//                _                                      
//  ___ _ __ ___ (_) __ ___      ___   _ _ __ ___  _ __  
// / __| '_ ` _ \| |/ _` \ \ /\ / / | | | '_ ` _ \| '_ \ 
// \__ \ | | | | | | (_| |\ V  V /| |_| | | | | | | |_) |
// |___/_| |_| |_|_|\__, | \_/\_/  \__,_|_| |_| |_| .__/ 
//                  |___/                         |_|  
//code by smigwump
//https://codeforces.com/blog/entry/62393 hashing hack protection
//https://codeforces.com/blog/entry/61587 rand() alternatives
//https://codeforces.com/blog/entry/61675 randomized hack protection
#include <bits/stdc++.h>
typedef long long ll;
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define REP(i,a,b) for(ll i = a; i <= b; i++)
#define PER(i,a,b) for(ll i = a; i >= b; i--)

using namespace std;

int main() {
	// #ifndef ONLINE_JUDGE
	//     freopen("input.txt", "r", stdin);
	//     freopen("output.txt", "w", stdout);
	// #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin>>t;
    int c0=0,c1=0,c2=0,c3=0;
    while(t--) {
    	string s;
        cin>>s;
        if(s=="AC") c0++;
        else if(s=="WA") c1++;
        else if(s=="TLE") c2++;
        else if(s=="RE") c3++;
    }
    cout<<"AC x "<<c0<<"\n";
    cout<<"WA x "<<c1<<"\n";
    cout<<"TLE x "<<c2<<"\n";
    cout<<"RE x "<<c3<<"\n";
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// --------------------------------------------------------
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; }
#define FOR(i,l,r) for (int i = (l); i < (r); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUM(c) accumulate(ALL(c), 0)
#define SUMLL(c) accumulate(ALL(c), 0LL)
#define SZ(c) ((int)(c).size())
#define debug(x) cerr << #x << " = " << (x) << '\n';
using P = pair<int,int>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
static const double EPS = 1e-10;
static const double PI  = acos(-1.0);
static const ll MOD = 1000000007;
// static const ll MOD = 998244353;
static const int INF = 1 << 30;
// static const ll INF = 1LL << 62;
// --------------------------------------------------------

vector<bool> is_prime_numbers(ll n) {
    vector<bool> is_prime(n + 1, true);
    is_prime[0] = false;
    is_prime[1] = false;
    ll root_n = (ll)(sqrt(n) + 0.5);
    for (int i = 2; i <= root_n; i++) {
        for (int j = 2 * i; j <= n; j += i) {
            is_prime[j] = false;
        }
    }
    return is_prime;
}


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

    ll N; cin >> N;

    static const int MAX_A = 55555;
    auto is_prime = is_prime_numbers(MAX_A);
    
    VI B;
    FOR(i,11,MAX_A+1) {
        if (is_prime[i]) {
            if (i % 5 == 1) {
                B.push_back(i);
                if (SZ(B) == N) break;
            }
        }
    }

    REP(i,N) {
        if (i) cout << " ";
        cout << B[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3644
#include <cstdio>
#include <string>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <map>
#include <math.h>
using namespace std;

int main() {
    int n, sum = 0;
    scanf("%d", &n);
    if (n == 10 || n == 100 || n == 1000 || n == 10000 || n == 100000) 
        printf("10\n");
    else {
        while (n > 0) {
            sum += n%10;
            n = n/10;
        }
        printf("%d\n", sum);
    }
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_H = 50;
const int MAX_W = 50;

const int INF = 1 << 29;

/* typedef */

/* global variables */

int flds[MAX_H][MAX_W];
int dp[MAX_H][MAX_W];

/* subroutines */

/* main */

int main() {
  int h, w;
  cin >> h >> w;

  for (int y = 0; y < h; y++) {
    string line;
    cin >> line;
    for (int x = 0; x < w; x++)
      flds[y][x] = line[x] - '0';
  }

  for (int y = 0; y < h; y++)
    for (int x = 0; x < w; x++) dp[y][x] = INF;
  dp[0][0] = flds[0][0];
  
  for (int y = 0; y < h; y++) {
    for (int x = 0; x <= w; x++) {
      if (x > 0 && dp[y][x] > dp[y][x - 1] + flds[y][x])
	dp[y][x] = dp[y][x - 1] + flds[y][x];
    if (y > 0 && dp[y][x] > dp[y - 1][x] + flds[y][x])
	dp[y][x] = dp[y - 1][x] + flds[y][x];
    //printf("dp[%d][%d]=%d\n", y, x, dp[y][x]);
    }
  }

  cout << dp[h - 1][w - 1] << endl;
  
  return 0;
}

Measured memory_bytes: 1224
#include<iostream> 
#include<algorithm>
#include<cstring>
using namespace std;
int main()
{
	int n;
	int sum=0;
	int a[3005];
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];	
		sum+=a[i]-1;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
def ruisekiXOR(x):
    if x % 4 == 0:
        return(x)
    elif x % 4 == 1:
        return(1)
    elif x % 4 == 2:
        return(x + 1)
    elif x % 4 == 3:
        return(0)

A, B = list(map(int, input().split()))

ruiA1 = ruisekiXOR(A - 1)
ruiB = ruisekiXOR(B)

print(ruiA1 ^ ruiB)


Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	int n; cin >> n;
	rep(i, 0, n) {
		int A[4] = {}, OUT = 0, ans = 0;
		for (string s; cin >> s;) {
			if (s == "HOMERUN") {
				ans++;
				rep(j, 0, 3) { ans += A[j]; A[j] = 0; }
			}
			else if (s == "HIT") {
				rrep(j, 1, 4)A[j] = A[j - 1];
				A[0] = 1;
				ans += A[3];
			}
			else {
				OUT++;
				if (OUT >= 3)break;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 2992