akhauriyash/Code-Regression huggingface dataset:
# include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef long long ll;

int D,M,d,q;
int c[30];
int s[400][30];
int type[400];
int last[29];
ll satis_level[400];

ll calc_score(int d){
  rep(i,d,D+1) satis_level[i] = 0;
  if(d==1)
    rep(j,1,27) last[j]=0;
  else{
    rep(j,1,27) last[j]=0;
    rep(i,1,d) last[type[i]] = i;
  }
  ll down_satis;
  satis_level[d] = satis_level[d-1];
  rep(i,d,D+1){
    down_satis=0;
    last[type[i]] = i;
    satis_level[i] += s[i][type[i]];
    rep(j,1,27) down_satis += c[j]*(i-last[j]);
    satis_level[i] -= down_satis;
    satis_level[i+1] += satis_level[i];
  }
  return satis_level[D];
}

int main(){
  map<int,int, std::greater<int>> mp;
  satis_level[0]=0;
  cin >> D;
  rep(i,1,27){
    cin >> c[i];
    mp[c[i]]=i;
  }
  rep(i,1,D+1){
    rep(j,1,27){
      cin >> s[i][j];
    }
  }
  
  int j=1;
  for(auto i=mp.begin();j<=D;++i,j++) {
    type[j] = mp[i->first];
  }
  
  ll pre_score,new_score;
  int d,q,pq;
  pre_score = calc_score(1);
  random_device rnd; 
  mt19937 mt(rnd());
  uniform_int_distribution<> rand_d(1,D); 
  uniform_int_distribution<> rand_q(1,26); 
  rep(i,1,30000){
    d = rand_d(mt);
    q = rand_q(mt);
    pq = type[d];
    type[d] = q;
    new_score = calc_score(d);
    if(pre_score > new_score) type[d] = pq;
    else pre_score = new_score;
    if(pre_score > new_score && i%10000==0) type[d] = q;
  }
  
  rep(i,1,D+1) cout << type[i] << '\n';
  return 0;
}


Measured memory_bytes: 3688
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int w; cin >> w;
	int n; cin >> n;
	int a, b;
	vector<int>v(w);
	char c;
	for (int i = 0; i < w; i++)v[i] = i + 1;
	for (int i = 0; i < n; i++) {
		cin >> a >>c>> b;
		swap(v[a - 1], v[b - 1]);
	}
	for (int i = 0; i < w; i++)cout << v[i] << endl;
	return 0;
}

Measured memory_bytes: 3052
n,k = map(int,input().split())
input_lines = [[int(j) for j in input().split()]for i in range(n)]

input_dic = {}
for line in input_lines:
    input_dic[line[0]] = input_dic.get(line[0],0)+line[1]

for key in sorted(input_dic.keys()):
    if input_dic[key]>=k:
        print(key)
        break
    else:
        k-=input_dic[key]

Measured memory_bytes: 27228
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define fi first
#define se second
#define pii pair<int, int>

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    int h[n];
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    int dp[n];
    dp[n - 1] = 0;
    for (int i = n - 2; i >= 0; i--) {
        dp[i] = min(dp[i + 1] + abs(h[i] - h[i + 1]),
                    dp[i + 2] + abs(h[i] - h[i + 2]));
    }
    cout << dp[0] << "\n";
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cmath>
#define ll long long
#define mset(a,x) memset(a,x,sizeof(a))
using namespace std;
const double PI = acos(-1);
const int inf = 0x3f3f3f3f;
const double esp = 1e-6;
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;
int dir[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};
ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
ll inv(ll b) {
    if(b == 1)return 1;
    return (mod - mod / b) * inv(mod % b) % mod;
}
ll fpow(ll n, ll k) {
    ll r = 1;
    for(; k; k >>= 1) {
        if(k & 1)r = r * n % mod;
        n = n * n % mod;
    }
    return r;
}
ll Fpow(ll n, ll k) {
    ll r = 1;
    for(; k; k >>= 1) {
        if(k & 1)r = r * n;
        n = n * n;
    }
    return r;
}
ll upd(ll x, ll v) {
    x = x + v >= mod ? x + v - mod : x + v;
    return x;
}
ll a[maxn], dp[2005][2005];
int main() {
    ll n, x, i, j, k;
    scanf("%lld%lld", &n, &x);
    for(i = 1; i <= n; i++)	{
        scanf("%lld", &a[i]);
        dp[i][0] = a[i];
    }
    for(i = 1; i <= n; i++)	{
        for(j = 1; j < n; j++)	{
            int t = i - j;
            if(t <= 0)	t = n + t;
            dp[i][j] = min(dp[i][j - 1], a[t]);
        }
    }

    ll ans = 1e18;
    for(i = 0; i < n; i++)	{
        ll sum = 0;
        for(j = 1; j <= n; j++)		{
            sum += dp[j][i];
        }
        ans = min(ans, sum + i * x);
    }
    printf("%lld\n", ans);
}


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

int main(){
  string N;
  cin >> N;
  if((N.at(0)==N.at(1) && N.at(1)==N.at(2))||(N.at(1)==N.at(2) && N.at(2)==N.at(3))) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
import math
n,m = map(int,input().split())
ps_ls = [list(input().split()) for i in range(m)]
ans_wa = 0
ans_ac = 0
strk_wa = 0
frag = 1
for i in range(m):
    ps_ls[i][0] = int(ps_ls[i][0])
ps_ls.sort(key=lambda x: x[0])

for i in range(m-1):
    if ps_ls[i][1] == "WA" and frag == 1:
        strk_wa += 1

    if ps_ls[i][1] == "AC":
        if frag == 1:
            ans_ac += 1
        frag = 0
        ans_wa += strk_wa
        strk_wa = 0
    if ps_ls[i][0] != ps_ls[i+1][0]:
        strk_wa = 0
        frag = 1
if ps_ls != []:
    if ps_ls[-1][1] == "AC":
        if frag == 1:
                ans_ac += 1
        ans_wa += strk_wa

print(ans_ac,ans_wa)

Measured memory_bytes: 30756
#include "bits/stdc++.h"
#include <random>
#define REP(i, n) for (ll i = 0; i < ll(n); ++i)
#define RREP(i, n) for (ll i = ll(n) - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < ll(n); ++i)
#define RFOR(i, m, n) for (ll i = ll(n) - 1; i >= ll(m); --i)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << (int)(d == 1) << endl;

}


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

int main() {
	bool f[4] = { false };
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		char t;
		cin >> t;
		if (t == 'P')f[0] = true;
		if (t == 'Y')f[1] = true;
		if (t == 'W')f[2] = true;
		if (t == 'G')f[3] = true;
	}
	if (f[0] == true && f[1] == true && f[2] == true && f[3] == true) {
		cout << "Four" << endl;
	} else {
		cout << "Three" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
//ΔATCODER A
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
int main()
{
	char ch[111];
	cin>>ch;
	int i,l;
	l=strlen(ch);
	for(i=0;i<l-8;i=i+1)
		cout<<ch[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 764
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
const ll mod = 1e9 + 7;



int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VL a(n), b(n);
  ll asum = 0, bsum = 0;
  REP(i, 0, n) {
    cin >> a[i] >> b[i];
    asum += a[i];
    bsum += b[i];
  }
  vector<PL> pool(n);
  REP(i, 0, n) {
    ll x = a[i], y = b[i];
    if (x > y) swap(x, y);
    pool[i] = PL(x, y);
  }
  sort(pool.begin(), pool.end());
  vector<PL> det(n);
  REP(i, 0, n) det[i] = PL(pool[i].second, i);
  sort(det.begin(), det.end());
  ll mi = min(asum, bsum);
  ll tmp = 0;
  REP(i, 0, n) {
    tmp += pool[i].first;
  }
  vector<PL> u(2 * n);
  REP(i, 0, n) {
    u[i] = PL(a[i], i);
    u[i + n] = PL(b[i], i);
  }
  sort(u.begin(), u.end());
  vector<PI> idx(n, PI(-1, -1));
  REP(i, 0, 2 * n) {
    int q = u[i].second;
    if (idx[q].first == -1) idx[q].first = i;
    else idx[q].second = i;
  }
  ll sum = 0;
  REP(i, 0, n) sum += u[i].first;
  REP(i, 0, n) {
    int e = idx[i].first;
    int f = idx[i].second;
    ll val = sum;
    int pos = n;
    if (f >= pos) {
      pos--;
      val += u[f].first;
    }
    if (e >= pos) {
      pos--;
      val += u[e].first;
    }
    /*
    DEBUGP(i);
    DEBUGP(val);
    DEBUGP(e);
    DEBUGP(f);
    */
    REP(i, pos, n) val -= u[i].first;
    mi = min(mi, val);
  }
  /*
  int pos = 0;
  int cnt3 = 0;
  VI occ(n, 1);
  REP(i, 1, n + 1) {
    tmp -= pool[n - i].first;
    occ[n - i] &= ~1;
    if (occ[n - i] == 2) cnt3--;
    // if (occ[n - i] != 0) break;
    int idx = -1;
    while (pos < n) {
      idx = det[pos].second;
      if (cnt3 > 0 || occ[idx] != 0) break;
      pos++;
    }
    if (pos >= n) break;
    pos++;
    occ[idx] |= 2;
    if (occ[idx] == 3) cnt3++;
    tmp += det[i - 1].first;
    if (cnt3 > 0) {
      mi = min(mi, tmp);
    }
    if (1) {
      REP(i, 0, n) cerr << " " << occ[i];
      cerr << endl;
    }
  }
  */
  cout << mi << endl;
}


Measured memory_bytes: 10112
import random
import copy

def cal(x):
  Manzoku=0
  l=[0]*26
  for d in range(D):
    l[x[d]-1]=d
    Manzoku+=s[d][x[d]-1]
    for i in range(26):
      Manzoku-=c[i]*(d-l[i])
  return Manzoku

D=int(input())
c=list(map(int,input().split()))
s=[]
t=[]
for i in range(D):
  s.append(list(map(int,input().split())))
l=[0]*26

max=0
target=0
deg=0
#初期t生成
for d in range(D):
  degsum=0
  max=0
  for i in range(26):
    degsum+=c[i]*(d-l[i])
  for i in range(26):
    w=degsum-c[i]*(d-l[i])-s[d][i]
    if max < -w:
      max=-w
      target=i
  t.append(target+1)
  l[target]=d
  
mManzoku=cal(t)
for i in range(1000):
  rd=int(random.random()*D)
  ri=int(random.random()*26)
  t1=copy.deepcopy(t)
  t1[d]=ri+1
  n=cal(t1)
  if mManzoku < n:
    t=copy.deepcopy(t1)
    mManzoku=n

for i in range(D):
  print(t[i])


Measured memory_bytes: 9956
/*
СТРОИМ СТЕНУ РАБОТЯГИ!
█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
*/
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
 
  
  
using namespace std;
  
  
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
/** Interface */
  
inline int readChar();
template <class T = int> inline T readInt(); 
template <class T> inline void writeInt( T x, char end = 0 );
inline void writeChar( int x ); 
inline void writeWord( const char *s );
  
/** Read */
  
static const int buf_size = 4096;
  
inline int getChar() {
    static char buf[buf_size];
    static int len = 0, pos = 0;
    if (pos == len) {
        pos = 0, len = fread(buf, 1, buf_size, stdin);
    }
    if (pos == len) {
        return -1;
    }
    return buf[pos++];
}
  
inline int readChar() {
    int c = getChar();
    while (c <= 32) {
        c = getChar();
    }
    return c;
}
  
template <class T>
inline T readInt() {
    int s = 1, c = readChar();
    T x = 0;
    if (c == '-')
        s = -1, c = getChar();
    while ('0' <= c && c <= '9')
        x = x * 10 + c - '0', c = getChar();
    return s == 1 ? x : -x;
}
  
/** Write */
  
static int write_pos = 0;
static char write_buf[buf_size];
  
inline void writeChar( int x ) {
    if (write_pos == buf_size)
        fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
    write_buf[write_pos++] = x;
}
  
template <class T> 
inline void writeInt( T x, char end ) {
    if (x < 0)
        writeChar('-'), x = -x;
  
    char s[24];
    int n = 0;
    while (x || !n)
        s[n++] = '0' + x % 10, x /= 10;
    while (n--)
        writeChar(s[n]);
    if (end)
        writeChar(end);
}
  
inline void writeWord( const char *s ) {     while (*s)
writeChar(*s++); }
  
struct Flusher {
    ~Flusher() {
        if (write_pos)
            fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
    }
} flusher;
  
using namespace std;


#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left228
#define right right228
#define next next228
#define rank rank228
#define prev prev228


int x;

 
int main() {
    cin >> x;
    int s = 1;
    while (1LL * s * (s + 1) / 2 < x) {
        s++;
    }
    cout << s << endl;
    return 0;
}
 

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

int PN(int x){
	int x0 = x % 10, x1 = x % 100 / 10, x2 = x % 1000 / 100, x3 = x % 10000 / 1000, x4 = x % 100000 / 10000;
	if(x0 == x4 && x1 == x3){
		return 1;
	}
	else{
		return 0;
	}
}

int main(){
	int A, B, i, ans = 0;
	scanf("%d%d", &A, &B);
	for(i = A; i <= B; i++){
		ans += PN(i);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
from operator import mul


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


n = int(S()[-1])
if n in (2, 4, 5, 7, 9):
    print('hon')
elif n in (0, 1, 6, 8):
    print('pon')
else:
    print('bon')


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod=MOD){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)3e2+11;
ll const LG=(ll)log2(N)+1;


void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        
        ll a,b,c,d;
        cin>>a>>b>>c>>d;
        l=b-a+1;
        ll ans=l;
        ans-=(b/c - (a-1)/c );
        ans-=(b/d - (a-1)/d);
        ans+=(b/(lcm(c,d)) - (a-1)/(lcm(c,d)));
        cout<<ans<<endl;
        
}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        while(q--){
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}

Measured memory_bytes: 3632
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var ta = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var t = ta[0];
        var a = ta[1];
        var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
        double min = double.MaxValue;
        int ind = -1;
        for (int i = 0; i < h.Length; i++)
        {
            var tmp = t - h[i] * 0.006;
            var diff = Abs(tmp - a);
            if (diff >= min) continue;
            min = diff;
            ind = i;
        }
        Console.WriteLine(ind + 1);
    }
}

Measured memory_bytes: 28628
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <limits>
#include <numeric>
#include <functional>
#include <map>
#define FOR(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
using namespace std;

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

	int X, Y;

	cin >> X >> Y;

	cout << X + (Y / 2) << endl;

	return 0;
}

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

int c[33], s[444][33];
int main() {
    int d;
    cin >> d;
    for(int i = 0; i < 26; i++)
        cin >> c[i];
    for(int i = 0; i < d; i++)
        for(int j = 0; j < 26; j++)
            cin >> s[i][j];
    stringstream ss[5555];
    int M = -1e9, tt;
    for(int a = 0; a < 50; a++) {
        for(int b = 0; b < 10; b++) {
            for(int z = 5; z < 16; z++) {
                int r = 0, l[33] = {};
                for(int i = 0; i < d; i++) {
                    auto m = 0.;
                    int t = 0;
                    for(int j = 0; j < 26; j++) {
                        double p = s[i][j];
                        p += c[j] * (i + 1 - l[j]) * .4 * a;
                        for(int k = 1; k < z; k++)
                            if(i + k < d)
                                p -= s[i + k][j] * (z - k) * .05 / z * b;
                        if(p > m)
                            m = p, t = j;
                    }
                    ss[a * 10 * 11 + b * 11 + z - 5] << t + 1 << '\n';
                    r -= c[t] * (i + 1 - l[t]) * (i - l[t]) / 2;
                    l[t] = i + 1;
                    r += s[i][t];
                }
                for(int j = 0; j < 26; j++)
                    r -= c[j] * (d + 1 - l[j]) * (d - l[j]) / 2;
                if(r > M)
                    M = r, tt = a * 10 * 11 + b * 11 + z - 5;
            }
        }
    }
    cout << ss[tt].str();
    cerr << M << endl;
    return 0;
}


Measured memory_bytes: 11372
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const ll INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

vector<vector<long long>> comb(int n) {
    vector<vector<long long>> v(n + 1,vector<long long>(n + 1, 0));
    for (int i = 0; i < v.size(); i++) {
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for (int j = 1; j < v.size(); j++) {
        for (int k = 1; k < j; k++) {
            v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
        }
    }
    return v;
}

int main(void){

    int N, A, B;
    cin >> N >> A >> B;
    vector<ll> v(N);
    REP(i,N) cin >> v[i];
    SORT(v);

    ll sum = 0;
    REP(i,A) sum += v[N-1-i];
    double ave = (double)sum / A;

    int num1 = 0, num2 = 0;
    while(N-A-num1-1 >= 0 && v[N-A-num1-1] == v[N-A]) num1++;
    while(N-A+num2 < N && v[N-A] == v[N-A+num2]) num2++;
    int num = num1 + num2;

    vector<vector<ll>> ncr = comb(num);
    ll ans = 0;
    if(v[N-A] == v[N-1]) REP(i, min(B-A,num1)+1) ans += ncr[num][A+i];
    else ans = ncr[num][num2];

    cout << fixed;
    cout << setprecision(8) << ave << endl;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()
w = 0
b = 0
for c in S:
    if c == '.':
        w += 1
    if c == '#':
        b += 1
w0 = 0
b0 = 0
min_change = w
for c in S:
    if c == '.':
        w0 += 1
        w -= 1
    if c == '#':
        b0 += 1
        b -= 1
    min_change = min(min_change, w + b0)
print(min_change)
        

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

int main(){
    int T, A;
    cin >> T >> A;
    if(T <= A){
        for(int i = 0; i < A; i++){
            cout << T;
        }
    }
    else {
        for(int i = 0; i < T; i++){
            cout << A;
        }
    }
    cout << endl;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List
import Text.Printf

readInts :: IO [Int]
readInts = map read . words <$> getLine

main :: IO ()
main = do
  r <- readLn
  let (s, c) = solve r
  printf "%f %f\n" s c

solve :: Double -> (Double, Double)
solve r = (s, c)
 where
  s = pi * (r ^ 2)
  c = 2 * pi * r



Measured memory_bytes: 4008
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;


int main() {
	unordered_map <ll, ll> list;
	ll n;
	cin >> n;
	for (ll i = 0; i < n; i++) {
		ll tmp;
		cin >> tmp;
		list[tmp]++;
	}
	ll ans = 0;
	for (auto itr = list.begin(); itr != list.end(); itr++) {
		ans += itr->first * itr->second;
	}
	ll Q;
	cin >> Q;
	for (ll q = 0; q < Q; q++) {
		ll b, c;
		cin >> b >> c;
		ll tmp = list[b];
		ans -= tmp * b;
		list[b] = 0;
		list[c] += tmp;
		ans += tmp * c;
		cout << ans << endl;
	}
	
	
	
}


Measured memory_bytes: 7068
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons, std.bigint, std.functional;

void main() {

    // A(n) = B A(n-1) P A(n-1) B

    // A(0) = P
    // A(1) = BPPPB
    // A(2) = BBPPPBPBPPPBB

    //レベル n のバーガーは何層か？
    // l(n) とすると、
    // l(n) = 1 + l(n-1) + 1 + l(n-1) + 1
    //      = 2 l(n-1) + 3
    // (l(n)+3) = 2 (l(n-1)+3)
    // m(n) = l(n)+3 とすると、
    // m(n) = 2 m(n-1)
    // m(0) = l(0) + 3 = 4 なので、
    // m(n) = 2^(n+2)
    // l(n) = 2^(n+2)-3 となる。

    const tmp = readln.split.to!(BigInt[]);
    const N = tmp[0], X = tmp[1];

    BigInt pow(BigInt a, BigInt b) {
        if (b == 0) return BigInt(1);
        if (b == 1) return a;
        auto t = memoize!pow(a, b / 2);
        return t * t * memoize!pow(a, b-b/2*2);
    }

    // level lのバーガーの層数
    BigInt _layer(BigInt l) {
        return pow(BigInt(2), (l+2))-3;
    }
    alias layer = memoize!_layer;

    // level lのバーガーをx層食べたときのパティの数
    BigInt func(BigInt l, BigInt x) {
        if (l == 0) return BigInt(1);
        if (x <= 1) return BigInt(0);
        if (x <= 1 + layer(l-1)) return memoize!func(l-1, x-1);
        if (x == 2 + layer(l-1)) return memoize!func(l-1, layer(l-1)) + 1;
        if (x <= 2 + layer(l-1) * 2) return memoize!func(l-1, layer(l-1)) + 1 + memoize!func(l-1, x-layer(l-1)-2);
        if (x == 3 + layer(l-1) * 2) return memoize!func(l-1, layer(l-1)) * 2 + 1;
        assert(false);
    }
    writeln(func(N,X));
}


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

using namespace std;

namespace {
    int N, D, X;
    const int MAX_D = 10;
    const int MAX_N = 10;
    int P[MAX_D][MAX_N];
    void input() {
        cin >> N >> D >> X;
        for (int i = 0; i < D; i++)
            for (int j = 0; j < N; j++) cin >> P[i][j];
    }

    void solve() {
        for (int d = 0; d < D - 1; d++) {
            vector<int> dp(X + 1, 0);
            for (int i = 0; i < N; i++) {
                for (int x = 0; x <= X; x++) {
                    int y = x - P[d][i];
                    if (y < 0) continue;
                    dp[x] = max(dp[x], dp[x - 1]);
                    dp[x] = max(dp[x], dp[y] + P[d + 1][i]);
                }
            }
            int nX = X;
            for (int x = 0; x <= X; x++) {
                nX = max(nX, dp[x] + X - x);
            }
            X = nX;
        }
        cout << X << endl;
    }
}

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

Measured memory_bytes: 1300
#include<stdio.h>

int main(){
  int N, M, X, Y, x, y, max = -100, min = 100, flag = 0;
  
  scanf("%d %d %d %d", &N, &M, &X, &Y);
  for (int i = 0; i < N; i++){
    scanf("%d", &x);
    if(max < x){
      max = x;
    }
  }
  for (int i = 0; i < M; i++){
    scanf("%d", &y);
    if(min > y){
      min = y;
    }
  }
  for (int i = max + 1; i <= min; i++){
    if(i > X && i <= Y){
      flag = 1;
      break;
    }
  }
  
  if(flag == 1){
    printf("No War\n");
  } else {
    printf("War\n");
  }
  
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf_int = 1e9 + 100;
const ll inf_ll = 1e15;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double dbl;
#define pb push_back
const double pi = 3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz(a) (int(a.size()))
#define all(a) a.begin(),a.end()
bool debug = 0;
const int MAXN = 1e5 + 100;
const int LOG = 20;
const int mod = 1e9 + 7;
const int MX = 1e6 + 100;
typedef long long li;
const li MOD = 1000000000949747713ll;

vector<int> g[MAXN];
vector<int> order;
bool used[MAXN];
int dp[MAXN];
void dfs(int v){
    used[v] = 1;
    for(int to:g[v]){
        if(!used[to])
            dfs(to);
    }
    order.pb(v);
}
void solve() {
    int n,m;
    cin >> n >> m;
    for(int i=1;i<=m;++i){
        int a,b;
        cin >> a >> b;
        g[a].pb(b);
    }
    for(int i=1;i<=n;++i){
        if(!used[i]){
            dfs(i);
        }
    }
    int ans = 0;
    reverse(all(order));
    for(int v:order){
        for(int to:g[v]){
            dp[to] = max(dp[to],dp[v] + 1);
        }
        ans = max(ans, dp[v]);
    }

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

signed main() {
#ifdef zxc
    debug = 1;
    freopen("../input.txt", "r", stdin);
#else

#endif //zxc
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(20);

    int t = 1;

    while (t--)
        solve();
    dout << endl << (1.0 * clock() / CLOCKS_PER_SEC) << endl;
}

Measured memory_bytes: 8824
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [float('inf')]*N
dp[0] = 0

for i in range(N):
    for j in range(1, K+1):
        if N > i+j:
            dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]))

print(dp[N-1])


Measured memory_bytes: 84948
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		
		int n = Integer.parseInt(N);

		int result = N.chars().map(s -> Character.getNumericValue(s)).sum();
		
		if (n % result == 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}

}


Measured memory_bytes: 27092
#include <iostream>
#include <vector>
#include <bitset>

using namespace std;

int main() {
	int L, R;
	cin >> L >> R;

	bitset<2019> r;

	for(int i = L; i <= R; i++) {
		r[i % 2019] = true;
		if(r.all() == true) break;
	}

	int m = 2018;

	for(int i = 0; i < 2019; i++) {
		for(int j = i + 1; j < 2019; j++) {
			if(r[i] == false || r[j] == false) continue;
			int t = i * j;
			t %= 2019;
			m = min(m, t);
		}
	}

	cout << m << endl;
}


Measured memory_bytes: 888
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Integer[] cost_array = {2,5,5,4,5,6,3,7,6};
		List<Integer> cost = Arrays.asList(cost_array);

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());

		List<Integer> aArray = new ArrayList<>();

		for (int i=0; i<m; i++){
			aArray.add(Integer.parseInt(sc.next()));
		}

		String[] dp = new String[n+1];

		dp[0] = "";

		for (int i=0; i<=n; i++){
			for (int a: aArray){
				if (cost.get(a-1) <= i && dp[i-cost.get(a-1)] != null){
					dp[i] = func2(dp[i-cost.get(a-1)]+a, dp[i]);
				}
			}
		}

		System.out.println(dp[n]);
	}

	public static String func2(String x, String y) {
		if (y == null){
			return x;
		}else if (x.length() > y.length()){
			return x;
		}else if (x.length() < y.length()){
			return y;
		}else {
			for (int i=0; i<x.length(); i++){
				if (x.charAt(i) > y.charAt(i)){
					return x;
				}else if (x.charAt(i) < y.charAt(i)){
					return y;
				}
			}
			return x;
		}
	}
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

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


int main(void){

	int N; cin >> N;
	vector<int> X(N);
	vector<int> Y(N);

	REP(i,N){
		cin >> X[i];
		Y[i] = X[i];
	}

	SORT(Y);

	REP(i,N){
		if(X[i] < Y[N/2]) cout << Y[N/2] << endl;
		else cout << Y[N/2-1] << endl;
	}


	return 0;

}


Measured memory_bytes: 3712
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int Nmax = 30;
int N,M;
int K[Nmax], A[Nmax][Nmax];
int c[Nmax];

int main(){
	cin >> N >> M;
	for(int i=0; i<N; i++){
		cin >> K[i];
		for(int j=0; j<K[i]; j++){
			cin >> A[i][j]; A[i][j]--;
		}
	}

	for(int i=0; i<N; i++){
		for(int j=0; j<K[i]; j++){
			c[A[i][j]]++;
		}
	}

	int ans = 0;
	for(int i=0; i<M; i++){
		if(c[i] == N) ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

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

int main() {
	int n;
	cin >> n;
	vector<ll> l(2);
	l[0] = 2;
	l[1] = 1;
	int i = 0;
	while (i+2 != n+1) {
		ll next = l[i] + l[i + 1];
		l.push_back(next);
		i++;
	}
	cout << l[l.size() - 1] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;

#define loop(i, a, b) for (long long i = (a); i < (b); ++i)
#define rep(i, n) for (long long i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

const double PI = acos(-1.0);

void solve(long long N) {
    vector<long long> f(10000001, 2);
    f[0] = 0;
    f[1] = 1;
    loop(i, 2, 10000001) {
        loop(j, 2, 10000001) {
            if (i * j < 10000001) f[i * j] += 1;
            else break;
        }
    }
    long long ans = 0;
    loop(i, 1, N+1) {
        ans += i * f[i];
    }
    cout << ans << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    solve(N);
    return 0;
}


Measured memory_bytes: 81416
while True:
    line = raw_input().split()
    a = int(line[0])
    op = str(line[1])
    b = int(line[2])
    if op == '+':
        print a + b
    elif op == '-':
        print a - b
    elif op == '*':
        print a * b
    elif op == '/':
        print int(a / b)
    elif op == '?':
        break

Measured memory_bytes: 6364
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const int mod=1e9+7;
// Not for Rating """"""""""I'm in Love with Experience :)""""""""""""""""""
void solve()
{
    ll N;cin>>N;
    if(N>=30)cout<<"Yes\n";
    else cout<<"No";
}
int main(void)
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int T=1;while(T--){solve();}return 0;
}/*Solved By:- RITIK AGARWAL*/

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define maxn 200010
typedef long long LL;
char s[maxn];
LL cnt[maxn];
void work() {
}
int main() {
    scanf("%s", s);
    LL len = strlen(s);
    LL ans = len * (len - 1) / 2;
    for (int i = 0; i < len; ++i) ++cnt[s[i]-'a'];
    for (int i = 0; i < 26; ++i) {
        ans -= (cnt[i] * (cnt[i] - 1)) / 2;
    }
    printf("%lld\n", ans+1);
    return 0;
}


Measured memory_bytes: 384
<?php /*atcoder.php*/

$at = new Atcoder();
$at->main();
unset($at);

class Atcoder{
	private function arrayIn(){
		$buf = explode(" ", fgets(STDIN));
		return $this->killNewLine($buf);
	}
	private function killNewLine($buf = null){
		$buf = str_replace("\r\n", "", $buf);
		$buf = str_replace("\n", "", $buf);
		$buf = str_replace("\r", "", $buf);
		return $buf;
	}

	public function main(){
		$s = $this->arrayIn();
	
		$ans = array();

		$a = $s[0];
		$b = $s[1];
		$c = $s[2];
		
		$ans[] = ( ( $b * 10 ) + $c ) + $a;
		$ans[] = ( ( $c * 10 ) + $b ) + $a;
		$ans[] = ( ( $a * 10 ) + $b ) + $c;
		$ans[] = ( ( $b * 10 ) + $a ) + $c;
		$ans[] = ( ( $a * 10 ) + $c ) + $b;
		$ans[] = ( ( $c * 10 ) + $a ) + $b;

		rsort($ans);

		echo $ans[0] . "\n";
	}
}
?>

Measured memory_bytes: 4856
#include <iostream>
#include <cmath>
#include <cstdio>
//#include <fstream>

using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.tr", "r", stdin );

	double q;

	while (cin >> q &&  q != -1.0 ){
		double x = q/2.;
		while (fabs (x*x*x - q) >= 0.00001*q  ){
			double y = (x*x*x - q )/(3.*x*x );
			x = x - y;
		} // end while
		printf ("%.6f\n", x );
	} // end loop
		
	return 0;
}

Measured memory_bytes: 1236
import math
import sys
r,g,b,n = map(int, input().split())
count=0
hiku=0
for i in range(n+1):
    for j in range(n+1):
        hiku=n-r*i-g*j
        if hiku%b==0 and hiku>=0:
            count+=1
print(count)

Measured memory_bytes: 67632
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;

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


Measured memory_bytes: 3636
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = inp()
BB = [INF] + inpl() + [INF]
ans = 0
for i in range(N):
    ans += min(BB[i],BB[i+1])

print(ans)


Measured memory_bytes: 4460
A = input()
total = 0
for i in range(3):
    if A[0] == "R" and A[1] == "R" and A[2] == "R":
        total = 3
    elif A[0] == "R" and A[1] == "R" and A[2] == "S":
        total = 2
    elif A[0] == "R" and A[1] == "S" and A[2] == "R":
        total = 1
    elif A[0] == "S" and A[1] == "R" and A[2] == "R":
        total = 2
    elif A[0] == "S" and A[1] == "S" and A[2] == "R":
        total = 1
    elif A[0] == "S" and A[1] == "R" and A[2] == "S":
        total = 1
    elif A[0] == "R" and A[1] == "S" and A[2] == "S":
        total = 1
    elif A[0] == "S" and A[1] == "S" and A[2] == "S":
        total = 0

print(total)


Measured memory_bytes: 9168
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

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

using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

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

    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    ll maxi, mini;
    for (int i=0; i<n; i++) cin >> a[i] >> b[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    if (n & 1) {
        maxi = b[n/2];
        mini = a[n/2];
    } else {
        maxi = b[n/2] + b[n/2-1];
        mini = a[n/2] + a[n/2 - 1];
    }
    cout << maxi - mini + 1 << endl;

}

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

int main(){
    int n;
    cin >> n;
    map<string , int> m;
    for(int i = 0 ; i < n ;i++){
        string s;
        cin >> s;
        m[s]++;
    }
    cout<<"AC x "<<m["AC"]<<"\n";
    cout<<"WA x "<<m["WA"]<<"\n";
    cout<<"TLE x "<<m["TLE"]<<"\n";
    cout<<"RE x "<<m["RE"]<<"\n";
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
double all[10000][10000];
int main(){
    int a,kari,ko,b,c,d,x,y,jo;
    cin>>a;
    cin>>d;
    for(int i=0;i<d;i++){
        cin>>b>>c;
        if(b>a/2){b=a-b+1;}
        if(c>a/2){c=a-c+1;}
        jo=min(b,c)%3;
        if(jo==0){jo=3;}
        cout<<jo<<endl;;
    }
    // zugatukureruyo1000x1000guraisikatukurenaikedo
    //ko=a-1;
    //if(a%2==0){kari=a/2;}
    //if(a%2==1){kari=a/2+1;}

    /*for(int i=0;i<kari;i++){
        for(int j=i;j<a-i;j++){
            if(i%3==0){
                all[j][i]=1;
                all[i][j]=1;
                all[ko-i][j]=1;
                all[j][ko-i]=1;
            }
            if(i%3==1){
                all[i][j]=2;
                all[j][i]=2;
                all[ko-i][j]=2;
                all[j][ko-i]=2;
            }
            if(i%3==2){
                all[i][j]=3;
                all[j][i]=3;
                all[ko-i][j]=3;
                all[j][ko-i]=3;
            }
        }
    }*/
    /*for(int i=0;i<a;i++){



        for(int j=0;j<a;j++){
            cout<<all[i][j]<<" ";
        }cout<<endl;
    }*/

}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 61)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



int k;
string s;
i64 mod_pow(i64 x, i64 y, i64 mod){
	i64 res = 1;
	while(y > 0){
		if(y & 1) res = res * x % mod;
		x = x*x %mod;
		y >>= 1;
	}
	return res;
}
const int MAX = 2010101, MOD = INF;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
	inv[0] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long C(i64 n, i64 k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
	/*i64 res = 1;
	for(int i = 1; i <= k; i++){
		res *= n-i+1;
		res %= MOD;
		res *= inv[i];
		res %= MOD;
	}
	return res;
	*/
}
void solve(){
	cin >> k >> s;
	int n = s.size();
	
	COMinit();
	
	//文字列sを部分列に含む k+|s|文字の文字列の数は?
	i64 ans = 0;
	for(int i = n; i <= n+k; i++){
		ans += mod_pow(26,n+k-i,INF) * mod_pow(25,i-n,INF) % INF * C(i-1, n-1) % INF;
		ans %= INF;
	}
	cout << ans << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 51500
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < (int)(x); i++)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n; cin >> n;
    vector<ll> p(n);
    rep(i,n) cin >> p[i];
    ll temp = 0;
    ll res = 0;
    rep(i,n){
        if(p[i] == i+1){
            temp++;
        }
        else{
            res += (temp+1)/2;
            temp = 0;
        }
        if(i == n-1)res += (temp+1)/2;
    }
    cout << res << endl;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;

int N,M;
int X[101010],Y[101010];
int A[101010],B[101010];
vector<pair<ll,int>> E;
vector<vector<pair<int,int>>> G(101010);
ll sum[101010];

int par[101010];
int rnk[101010];

void init(){
  for(int i=0;i<N;i++){
    par[i]=i;
    rnk[i]=0;
    sum[i]=X[i];
  }
}

int find(int x){
  if (par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x, int y){
  x = find(x);
  y = find(y);
  if (x == y) return;

  if (rnk[x] < rnk[y]){
    par[x] = y;
    sum[y]+=sum[x];
  }else{
    par[y] = x;
    sum[x]+=sum[y];
    if (rnk[x] == rnk[y]) rnk[x]++;
  }
}

int use[101010];

void dfs(int v,int ma){
  for(auto p:G[v]){
    int e=p.second;
    if(use[e]==0&&Y[e]<=ma){
      use[e]=1;
      dfs(p.first,ma);
    }
  }
}

int main(){
  cin>>N>>M;
  rep(i,N) cin>>X[i];
  init();
  rep(i,M){
    cin>>A[i]>>B[i]>>Y[i]; A[i]--,B[i]--;
    G[A[i]].push_back({B[i],i});
    G[B[i]].push_back({A[i],i});
    E.push_back({Y[i],i});
  }
  sort(E.begin(),E.end());
  stack<int> st;
  for(auto p:E){
    int i=p.second,pa=find(A[i]),pb=find(B[i]);
    if(pa==pb){
      if(sum[pa]>=Y[i]) st.push(i);
    }else{
      if(sum[pa]+sum[pb]>=Y[i]) st.push(i);
    }
    unite(A[i],B[i]);
  }
  while(st.size()){
    int i=st.top(); st.pop();
    use[i]=1;
    dfs(A[i],Y[i]);
    dfs(B[i],Y[i]);
  }
  int ans=M;
  rep(i,M) ans-=use[i];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 14320
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Libraries --------------------------------//

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//akari : 1D, yukari : 2D, maki : 3D vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//akane : ascending order, aoi : decending order
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void solve()
{
    int n, m;
    cin >> n >> m;
    yukari<pair<int, int>> g(n);
    for (int i = 0; i < m; i++)
    {
        int s, t;
        cin >> s >> t;
        s--, t--;
        g[s].push_back(make_pair(t, 1));
    }
    akari<double> dp(n, n + 1);
    akari<int> heavy(n), vst(n);
    auto calc = [&](auto &&calc, akari<double> &dp, int s) -> double {
        if (vst[s])
        {
            return dp[s];
        }
        double res = 0, maxi = 0;
        int cnt = 0;
        vst[s] = 1;
        for (auto np : g[s])
        {
            if (!np.second)
            {
                continue;
            }
            cnt++;
            double w = calc(calc, dp, np.first) + 1;
            if (maxi < w)
            {
                maxi = w;
                heavy[s] = np.first;
            }
            res += w;
        }
        if (cnt)
        {
            res /= cnt;
        }
        else if (s != n - 1)
        {
            res = n + 1;
        }
        return dp[s] = res;
    };
    double ans = calc(calc, dp, 0);
    for (int s = 0; s < n - 1; s++)
    {
        akari<double> dp2(n, n + 1);
        fill(vst.begin(), vst.end(), 0);
        for (auto &p : g[s])
        {
            if (p.first == heavy[s])
            {
                p.second = 0;
                calc(calc, dp2, 0);
                ans = min(ans, dp2[0]);
                p.second = 1;
                break;
            }
        }
    }
    cout << setprecision(15) << ans << endl;
}

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

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

int main(){
    int n;
    cin >> n;
    int a[n] = {};
    for (int i=0;i<n;i++){
        cin >> a[i];
    }
    int b;
    int count = 0;
    for (int j=n-1;j>-1;j--){
        for (int k=0;k<j;k++){
            if (a[k] > a[k+1]){
              b = a[k];
              a[k] = a[k+1];
              a[k+1] = b;
              count +=1;    
            }
        }
    }
    for (int l=0;l<n;l++){
        cout <<a[l];
        if (l!=n-1) cout << " ";
    }
    cout << endl << count <<endl;
    return 0;
}


Measured memory_bytes: 3088