akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int main(void)
{
	string S;
	cin >> S;
	if (S.size() >= 4 && S[0] == 'Y' && S[1] == 'A' && S[2] == 'K' && S[3] == 'I')
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}
	return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    ll ans = 1;
    rep(i,100000)
    {
	    if (i * i <= n)
	    {
		    ans = i * i;
	    }
	    else
	    {
		    break;
	    }
    }
    cout << ans << endl;
}



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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 2019LL;
// const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

ll dp[200005];

ll fastpow(ll a, ll n, ll mod = MOD) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  string s;
  cin >> s;

  for (ll i = s.size() - 1; i >= 0; i--) {
    auto ch = s.substr(i, 1);

    ll d = stoll(ch);
    ll c = s.size() - i - 1;
    ll v = d * fastpow(10, c);

    dp[i] = (v + dp[i + 1]) % MOD;
  }

  mll m;

  ll sum = 0;
  for (ll i = 0; i <= s.size(); i++) {
    // cout << dp[i] << endl;

    sum += m[dp[i]];
    m[dp[i]]++;
  }

  cout << sum << endl;
}


Measured memory_bytes: 5288
#include <stdio.h>
int is_prime(int n){
  int i;
  if(n==1)
    return 0;
  for(i=2;i*i<=n;i++)
    if(n%i==0)
      return 0;
  return 1;
}
int main(void){
  int n,c,i;
  while(scanf("%d",&n)!=EOF){
    c=0;
    for(i=1;i<=n;i++){
      if(is_prime(i)&&is_prime(n-i+1))
	c++;
    }
    printf("%d\n",c);
  }
  return 0;
}

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

using ll = long long;

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

    int T = 1;
    while (T--) {
        int x; cin>>x;
        if (x >= 30) printf("Yes\n");
        else printf("No\n");
    }
}


Measured memory_bytes: 3652
def main():
    X=int(input())
    P=100
    countYears=0
    while(True):
        A=P+P*(0.01)
        A=int(A)
        countYears+=1
        P=A
        if A>=X:
            break
    print(countYears)
if __name__=='__main__':
    main()

Measured memory_bytes: 63552
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int n,l; cin>>n>>l;
    string s[n]; rep(i,n) cin>>s[i];
    sort(s,s+n);
    string ans;
    rep(i,n){
        ans+=s[i];
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(void){
    // 入力
    int n,m;
    cin >> n >> m;
    // 各品物の値段をpriority_queueに格納
    priority_queue<long long> costs;
    for(int i=0; i<n; i++){
        long long a; cin >> a;
        costs.push(a);
    }

    // m回最大値取り出して1/2する
    for(int i=0; i<m; i++){
        long long max = costs.top();
        // 一旦削除
        costs.pop();
        max /= 2;
        costs.push(max);
    }

    // costsにはn個の値が入ってるので合計する
    long long ans=0;
    while(!costs.empty()){
        ans += costs.top();
        costs.pop();
    }

    cout << ans;
    
    return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>

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

    int a, b;
    while(std::cin >> a >> b){
        int cnt = 0;
        int r = a+b;
        while(r){
            r/=10;
            ++cnt;
        }
        std::cout << cnt << "\n";
    }
    return 0;
}

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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int n;
vector<bool> vis;
vector<vector<bool>> g;
void dfs(int x) {
    if (vis[x]) return;
    vis[x] = true;
    rep(i, n) if (g[x][i]) dfs(i);
}

int main(){
    int m;
    cin >> n >> m;
    g = vector<vector<bool>>(n, vector<bool>(n));
    vpii ab(m);
    rep(i, m) {
        cin >> ab[i].first >> ab[i].second;
        ab[i].first--; ab[i].second--;
    }
    rep(i, m) {
        int a = ab[i].first, b = ab[i].second;
        g[a][b] = g[b][a] = true;
    }
    int ans = 0;
    rep(i, m) {
        int a = ab[i].first, b = ab[i].second;
        g[a][b] = g[b][a] = false;
        vis = vector<bool>(n);
        dfs(0);
        bool brd = false;
        rep(i, n) if (!vis[i]) brd = true;
        if (brd) ++ans;
        g[a][b] = g[b][a] = true;
    }
    cout << ans << endl;
    return 0;
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

const string YES = "Yes";
const string NO = "No";

bool x_dp[2][16001], y_dp[2][16001];

void solve(std::string s, long long x, long long y){
    bool no_T = true;
    int mv = 0;
    int use_x = 0;
    int use_y = 0;
    int DIFF = 8000;

    x_dp[use_x][DIFF] = true;
    y_dp[use_y][DIFF] = true;
    
    REP(i, s.length()) {
        if(s[i] == 'T') {
            mv = (mv == 0 ? 1 : 0);
            no_T = false;
        } else {
            int f_cnt = 0;
            for(; i < s.length(); i++) {
                if(s[i] == 'F') {
                    f_cnt++;
                    continue;
                }
                break;
            }
            if(i != s.length()) i--;

            if (mv == 0) {
                int next_x = (use_x + 1) % 2;
                REP(j, 16001) {
                    if(!no_T && x_dp[use_x][j]) {
                        x_dp[next_x][j - f_cnt] = true;
                    }
                    if(x_dp[use_x][j]) { 
                        x_dp[next_x][j + f_cnt] = true;
                    }
                    x_dp[use_x][j] = false;
                }
                use_x = next_x;
            } else {
                int next_y = (use_y + 1) % 2;
                REP(j, 16001) {
                    if(y_dp[use_y][j]) {
                        y_dp[next_y][j - f_cnt] = true;
                        y_dp[next_y][j + f_cnt] = true;
                    }
                    y_dp[use_y][j] = false;
                }
                use_y = next_y;
            }
        }
    }

    cout << ((x_dp[use_x][DIFF + x] && y_dp[use_y][DIFF + y]) ? YES : NO ) << endl;
}

int main(){
    std::string s;
    std::cin >> s;
    long long x;
    scanf("%lld",&x);
    long long y;
    scanf("%lld",&y);
    solve(s, x, y);
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long ll;


int main()
{
    int n,x,t;
    scanf("%d %d %d",&n,&x,&t);
    
    n=(n+x-1)/x;
    n=n*t;

    printf("%d\n",n);

    return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <algorithm>
#include <stack>
#include <string.h>
using namespace std;

string s;
stack<char> stk;

int main()
{
    cin >> s;
    long len = s.size();
    for (int i = 0; i < len; i++)
    {
        if (stk.empty() || (stk.top() == 'S' && s[i] == 'S') || stk.top() == 'T')
            stk.push(s[i]);
        
        if (stk.top() == 'S' && s[i] == 'T')
            stk.pop();
    }
    cout << stk.size();
    
    return 0;
}


Measured memory_bytes: 832
var n:longint;
procedure       nhap;
var k,dem,i:longint;
begin
        readln(n);
        k:=1;
        dem:=0;
        if n=1 then
                begin
                writeln(1);
                halt;
                end;
        while n>=2 do
                begin
                n:=n div 2;
                inc(dem);
                end;
        for i:=1 to dem do
                k:=k*2;
        writeln(k);
end;
begin
        
        nhap;
       
end.


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <stdio.h>
using namespace std;

typedef long long ll;

#define min(a, b) (((a) < (b))? (a):(b))
#define max(a, b) (((a) > (b))? (a):(b))
#define REP(i, a, n) for(int i=(a); i<(n); i++)
#define rep(i, n) REP(i, 0, (n))
#define square(a) (a)*(a)
#define pb push_back

int num,dig,sum;
int main(){
    cin >> num;
    int num2 = num;
    while(num){
        dig += num % 10;
        num /= 10;
    }
    cout << (num2%dig == 0 ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils,math;
var
  a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;
  l:array of Integer;
  s,s123,s1,s2,s3:string;
  tf:Boolean;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Read(a);
    Read(b);
    Readln(c);
    Readln(k);

    max:=(((a+b+abs(a-b))div 2)+c+abs((a+b+abs(a-b))div 2-c))div 2;

    Writeln(a+b+c-max +(max*trunc(power(2,k))));
    Readln;

  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


Measured memory_bytes: 128
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int T; cin >>T;
  REP(t, T){
    int x, y, X, Y, W, H, C, ans = 0; cin >>X >>Y >>W >>H >>C;
    REP(c, C){
      cin >>x >>y;
      if(x >= X && x <= X + W && y >= Y && y <= Y + H) ++ans;
    }
    cout <<ans <<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
 
#define l long
#define ll long long
 
#define FI(z,n) for(int j=z; j<=n; j++)
#define FL(z,n) for(l j=z; j<=n; j++)
 
#define inf 10000000000
#define mod 1000000007
 
 
void In_Out(){
 
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
		freopen("error.txt", "w", stderr);
	#endif
}

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

	char grid[h][w];

	for(int i=0; i<h; i++)
		for(int j=0; j<w; j++)
			cin >> grid[i][j];

	l dp[h][w];
	memset(dp, 0, sizeof(dp));

	dp[0][0] = 1;

	for(int i=1; i<w; i++){
		if(grid[0][i] != '#'){
			dp[0][i] = dp[0][i-1]%mod;
		}
		else{
			break;
		}
	}

	for(int j=1; j<h; j++){
		if(grid[j][0] != '#'){
			dp[j][0] = dp[j-1][0]%mod;
		}
		else{
			break;
		}
	}

	for(int i=1; i<h; i++){
		for(int j=1; j<w; j++){

			if(grid[i][j] != '#'){
				dp[i][j] = ((dp[i-1][j]%mod) + (dp[i][j-1]%mod))%mod;
			}
		}
	}

	cout << dp[h-1][w-1];
}

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

		int main(){
			int attack,health,r,n;
			cin>>health>>n;
			
			r = health;
			while(n--){
				cin>>attack;
				 r = r-attack; 
			}
			
			if(r <= 0){
				cout<<"Yes";
			}else{
				cout<<"No";
			}


			
			return 0;
		}

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

int main(){
  string s;cin>>s;
  fol(i,3){
    if(s[i]=='9')s[i]='1';
    else s[i]='9';
  }
  cout << s<< endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(x) for x in input().split()]
m = 10**9+7
s = sum(A)
cnt = 0
#print(mod_A)
for i in range(N) :
    s = s - A[i]
    cnt += A[i] * s
    cnt = cnt % m

print(cnt)


Measured memory_bytes: 31436
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/A-Parking.py
#
n, a, b = map(int, input().split())
planA = n * a
planB = b
if planA >= planB:
    print(planB)
else:
    print(planA)

Measured memory_bytes: 2940
import java.util.*;

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

      int a = sc.nextInt();
      int p = sc.nextInt();

      int ppp = 3*a+p;

      int ans = ppp/2;

      System.out.println(ans);

    }
}


Measured memory_bytes: 23508
#include<bits/stdc++.h>
using namespace std;
int fac(int a);
int main(){
    int a,b;
    cin>>a>>b;
    cout<<fac(b-a-1)-a<<endl;
     return 0;
}
int fac(int a){
    return int(a*(a+1)*0.5);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
 
int main() {
    int N, M; cin >> N >> M;
    vector<pair<int, int>> cuts;
    rep(i, M) {
        int a, b; cin >> a >> b;
        cuts.push_back({a, b});
    }
    
    sort(cuts.begin(), cuts.end());
    
    int ans = 1, b = N;
    rep(i, M) {
        if(cuts[i].first < b) {
            b = min(b, cuts[i].second);
        } else {
            b = cuts[i].second;
            ans++;
        }
    }
 
    
    cout << ans << endl;
}

Measured memory_bytes: 1400
#include <iostream>
#include <string>

#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
//#include <list>
#include <iomanip>
//#include <stdlib.h>
//#include <cctype>

using namespace std;

#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t

int main() {
    Int n;
    cin>>n;
    cout<<n+n*n+n*n*n;






    cout<<endl;
    return 0;
}



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

int main(void){
    int k, a[10000];
    for(int i=0;i<5;++i)cin >> a[i];
    cin >> k;
    for(int i=0;i<5;++i){
        for(int j=i+1;j<5;++j){
            if(abs(a[i]-a[j]) > k){
                cout << ":(\n";
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  int n,x; cin>>n>>x;
  VI a(n); rep(i,n) cin>>a[i];
  sort(ALL(a));
  int i = 0;
  while(a[i]<=x&&i<n-1){
    x -= a[i]; i++;
  }
  if(x==a[i]) i++;
  cout << i << endl;

  return 0;
}


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

int main()
{
	double sequence[11];
	while(cin >> sequence[1]){
		double sum=sequence[1];
		for(int i=2;i<=10;i++){
			if(i%2==1){
				sequence[i] = sequence[i-1]/3.0;
				sum += sequence[i];
			}
			else{
				sequence[i] = sequence[i-1]*2.0;
				sum += sequence[i];
			}
		}
		cout << setprecision(8) << fixed << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

typedef long long ll;



int main() {
	int n;
	scanf("%d", &n);
	vector<int> t(n);
	for(int i = 0; i < n; ++i) scanf("%d", &t[i]);
	int answer = 0;
	for(int i = 0; i < n; ++i) {
		int cnt = 1;
		while(i + 1 < n && t[i] == t[i+1]) {
			++i;
			++cnt;
		}
		answer += cnt / 2;
	}
	printf("%d\n", answer);
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
int main(){
    int n;
    cin >> n;
    vector<ll> v(n);
    rep(i,n){
        cin >> v[i];
    }
    vector<ll> imos(n+1);
    rep(i,n){
        imos[i+1] = imos[i]+v[i];
    }
    ll ans =1e18; 
    for(int i=1;i<n;i++){
        ans = min(ans,abs(imos[i]-(imos[n]-imos[i])));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
	ll a,b;
	cin>>a>>b;
	a--;
	ll res_a, res_b;
	if(a%4==0)
		res_a = a;
	else if(a%4==1)
		res_a = 1;
	else if(a%4==2)
		res_a = a+1;
	else
		res_a = 0;
	if(b%4==0)
		res_b = b;
	else if(b%4==1)
		res_b = 1;
	else if(b%4==2)
		res_b = b+1;
	else
		res_b = 0;
	cout<<(res_a^res_b)<<endl;
	return 0;
}

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

int main() {
    ll N, K;
    cin >> N >> K;

    vector<ll> a(N);
    REP(i,N) cin >> a[i];

    vector<ll> b;
    REP(i,N) {
        ll sum = 0;
        rep(j,i,N) {
            sum += a[j];
            b.push_back(sum);
        }
    }

    ll ans = 0;
    for(ll t = 40 ; t >= 1 ; t--){
        ll pt = pow(2,t-1);

        ll cnt = 0;
        bool flg = false;
        REP(i,b.size()){
            if(((ans + pt) & b[i]) == (ans + pt)) cnt++;
            if(cnt >= K) {
                flg = true;
                break;
            } 
        }
        if(flg) ans += pt;
    }

    pl(ans)

    return 0;
}

Measured memory_bytes: 6516
let rec for_fold a b v f = if a >= b then v else for_fold (a+1) b (f a v) f
let rec fix f x = f (fix f) x
let sq x = x * x
let () =
  Scanf.scanf "%d %d" @@ fun n d ->
  let ps = Array.init n @@ fun _ ->
    Array.init d @@ fun _ -> Scanf.scanf " %d" ((+) 0)
  in
  let ans =
    for_fold 0 n 0 @@ fun i v ->
      for_fold (i+1) n v @@ fun j v ->
        let w = for_fold 0 d 0 @@ fun k w -> w + sq (ps.(i).(k) - ps.(j).(k)) in
        let r = fix (fun f x -> if x*x > w then x-1 else f (x+1)) 1 in
        if r * r = w then v+1 else v
  in
  Printf.printf "%d\n" ans


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;


int main()
{
  // 整数の入力
  ll N;
  cin >> N;
  map<ll,ll> counts;
  for (size_t i = 0; i < N; i++)
  {
      ll a;
      cin >> a;
      counts[a]++;
  }
    ll ans = 0;
    for(auto p: counts){
        ans += p.first * p.second;
    }

    ll Q;
    cin >> Q;
    for (size_t i = 0; i < Q; i++)
    {
        ll b,c;
        cin >> b >> c;
        counts[c] += counts[b];
        ans += counts[b]* (c - b);
        counts.erase(b);
        cout << ans << endl;
    }

  return 0;
}

Measured memory_bytes: 7496
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	w, a, b := iScan(), iScan(), iScan()
	if a+w < b {
		fmt.Println(b - a - w)
	} else if b+w < a {
		fmt.Println(a - b - w)
	} else {
		fmt.Println(0)
	}
}


Measured memory_bytes: 1776
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < int > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vll vector < ll >
# define pii pair < int , int >
# define mp make_pair
# define int ll
static ll dp[1 << 20];
static int pos[1 << 20];
static int s[1 << 20];
int n,S,T;
int32_t main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    fi>>n>>S>>T;
    for (int i = 1;i <= n;++i)
        fi>>s[i];
    for (int i = 1;i <= n;++i)
    {
        pos[i] = pos[i - 1];
        while (T < 2ll * (s[i] - s[pos[i]])) ++pos[i];
    }
    dp[0] = 0;
    static ll mn[1 << 20];
    mn[0] = -2ll * s[1];
    for (int i = 1;i <= n;++i)
        {
            dp[i] = 1e18;
            for (int j = max(0ll,pos[i] - 5);j <= min(i - 1,pos[i] + 5);++j)
                dp[i] = min(dp[i],dp[j] + s[i] - s[j] + 2ll * (s[i] - s[j + 1]) + max(0ll,1ll * T - 2 * (s[i] - s[j + 1])));
            if (pos[i] >= 5)
                dp[i] = min(dp[i],3ll * s[i] + mn[pos[i] - 5]);
            mn[i] = min(dp[i] - s[i] - 2ll * s[i + 1],mn[i - 1]);
        }
    fo << dp[n] + S - s[n] << '\n';
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}

Measured memory_bytes: 3456
/*
	2100:Saizo
*/
#include	<iostream>
#define VALUE__INF 2000000000

using namespace std;

int main(void) {
	int d, n, h[100], S[99] = { 0 }, mx, mn;
	
	cin >> d;
	for(int t = 0; t < d; t++) {
		mx = 0, mn = VALUE__INF;
		cin >> n;
		for(int i = 0; i < n; i++) {
			cin >> h[i];
			if(i != 0) {
				S[i-1] = h[i] - h[i-1];
				if(S[i-1] > mx && S[i-1] > 0) { mx = S[i-1]; }
				else if(S[i-1] < mn && S[i-1] < 0) { mn = S[i-1]; }
			}
		}
		if(mn == VALUE__INF) { mn = 0; }
		cout << mx << ' ' << -mn << endl;
	}
	return 0;
}

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

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int compar(const int *val1, const int *val2);

int main(void) {
    int ary[10];
    int n;
    int i;

    for(i=0;i<10;i++)
        scanf("%d",&ary[i]);
    n = sizeof(ary)/sizeof(ary[0]);
    qsort(ary, n, sizeof(int),(int (*)(const void *, const void *))compar);

    for ( i = 9; 6<i; i-- ) 
        printf("%d\n", ary[i]);
 
    return 0;
}

int compar(const int *val1, const int *val2) {
    if ( *val1 < *val2 ) {
        return -1;
    } else if ( *val1 == * val2 ) {
        return 0;
    } else {
        return 1;
    }
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
long long int dp[110000][2];
vector<int> v[110000];

void dfs(int now,int last = -1){
    dp[now][0] = dp[now][1] = 1;
    for(auto next :v[now]){
        if(next == last)continue;
        dfs(next,now);
        dp[now][0] = dp[now][0] * ((dp[next][0]+dp[next][1])%1000000007)%1000000007;
 
        dp[now][1] = dp[now][1] * dp[next][0] %1000000007;
 
    }
}

int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n-1;i++){
        int a,b;
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    dfs(1);
    cout<<(dp[1][0]+dp[1][1])%1000000007<<endl;
	return 0;
}

Measured memory_bytes: 14464
#include <iostream>
#include <vector>
#define rep(i, n) for((i) = 0; (i) < (n); (i)++)
using namespace std;

int main(){
    int n, i, ans;
    string s;
    cin >> n >> s;
    vector <int> le(n + 1); rep(i, n) le[i] = 0;
    vector <int> ri(n + 1); rep(i, n) ri[i] = 0;

    for(i = 0; i < n - 1; i++){
        le[i + 1] = le[i];
        if(s[i] == 'W') le[i + 1] += 1;
    }

    for(i = n - 1; i > 0; i--){
        ri[i - 1] = ri[i];
        if(s[i] == 'E') ri[i - 1] += 1;
    }

    ans = ri[0] + le[0];
    for(i = 1; i < n; i++){
        ans = min(ans, ri[i] + le[i]);
    }

    cout << ans << endl;

    return 0;
}


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

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

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        int a;
        cin >> a;
        --a;
        ans += a;
    }
    
    cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<list>

using namespace std;

using ll = long long int;
using ull = unsigned long long int;

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

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

ll mygcd(ll a,ll b){
    if(b == 0)return a;
    return mygcd(b,a%b);
}

ll twoPow(ll shiftNum){
    return (1LL << (shiftNum - 1));
}

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

    vector<ll> a(n);
    for(auto &x: a){
        cin >> x;
    }

    unordered_map<ll,ll> factorMap;
    vector<vector<pair<ll,ll>>> factorArr;

    for(const auto x: a){
        auto tmp = x;
        vector<pair<ll,ll>> localFactorArr;
        for(int i = 2; i*i <= x; i++){
            ll count = 0;
            while(tmp%i == 0){
                count++;
                tmp /= i;
            }
            if(count > 0){
                localFactorArr.push_back({i,count});
            }
        }
        if(tmp > 1){
            localFactorArr.push_back({tmp,1});
        }
        factorArr.push_back(localFactorArr);
        for(const auto y : localFactorArr){
            if(factorMap.find(y.first) != factorMap.end()){
                factorMap[y.first] = max(factorMap[y.first],y.second);
            }else{
                factorMap.insert({y.first,y.second});
            }
        }
    }

    ll ans = 0;

    for(const auto x : factorArr){
        unordered_set<ll> checked;
        ll tmpCalc = 1;
        for(const auto y : x){
            tmpCalc *= mypow(y.first,factorMap[y.first] - y.second);
            tmpCalc %= MOD;
            checked.insert(y.first);
        }
        for(const auto z : factorMap){
            if(checked.find(z.first) == checked.end()){
                tmpCalc *= mypow(z.first,z.second);
                tmpCalc %= MOD;
            }
        }
        ans += tmpCalc;
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;
#define EPS (1e-7)
#define INF (1e9)


typedef long long  ll;
#define endl '\n'




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


const int MOD = 1000000007;
const long double PI = (acos(-1));
const int MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];

//////////////////////////////////////////


void COMinit() {
   fac[0] = fac[1] = 1;
   finv[0] = finv[1] = 1;
   inv[1] = 1;
   for (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;
   }
}

bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}

int N, M;
void Input() {

    cin >> N >> M;
}



void Solve() {


    vector< pair<int, int> > p(M);

    for(int i = 0; i < M; i++) {

        int a, b;
        cin >> a >> b;

        p[i].first = a;
        p[i].second = b;
    }

    sort(p.begin(), p.end(), sortbysec);


    int l, up;

    l = p[0].first;
    up = p[0].second;
    int ans = 1;
    for(int i = 1; i < M; i++) {

        if(p[i].first > l && p[i].first >= up) {

            ans++;
            l = p[i].first;
            up = p[i].second;
        }


    }

    cout << ans << endl;


}

int main() {

  cin.tie(0);
  ios::sync_with_stdio(false);
  Input();
  Solve();


  return 0;

}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
int x;
cin>>x;
int ans;
  while(true){
    int cnt=0;
    for(int i=1; i<=x; i++){
      if(x%i==0) cnt++;
    }
    if(cnt==2) {
      ans=x;
      break;
    }
    else {
      x++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
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; }


using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X, Y;
    cin >> X >> Y;
    ll ans = 1;
    while(X * 2 <= Y){
        ans++;
        X = X * 2;
    }
    cout << ans << endl;
}

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

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

        int x = n;


        int num = 0;
        while(x > 0){
            num += x % 10;
            x /= 10;
        }
        
        if(n % num == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }

        sc.close();
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);
    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    ll ans = 1;

    vector<int> cnt(3, 0);

    rep(i, n){
        int p = 0;
        bool right = false;
        rep(j, 3) if(cnt[j] == a[i]) { ++p; right = true; }
        if(!right) { cout << 0 << endl; return 0; }
        rep(j, 3) if(cnt[j] == a[i]) { ++cnt[j]; break; }
        ans *= p;
        chmod(ans);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int N=100100;
int a;
int zpyz[N];
int ans;
int main()
{
	cin>>a;
	int li,ri;
	for(int i=1;i<=a;i++) {cin>>li>>ri; ans+=ri-li+1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int a = Integer.parseInt(scanner.next());
        long b = Integer.parseInt(scanner.next());
        long[][] r = new long[a][2];
        for(int x = 0; x < a; x++) {
            r[x][0] = Integer.parseInt(scanner.next());
            r[x][1] = Integer.parseInt(scanner.next());
        }
        Comp comp = new Comp();
        comp.set_index(0);
        Arrays.sort(r, comp);

        //for(int i = 0; i < r.length; i++){
        //    System.out.print(r[i][0] + " ");
        //    System.out.println(r[i][1]);
        //}

        long count = 0;
        for(int x = 0;; x++){
            if(b <= 0) {
                //System.out.println("a" + x);
                break;
            }
           // b = (b - r[x][1]) > 0 ?  (b - r[x][1]) : 0
            b = b - r[x][1];
           //System.out.println((r[x][0] * r[x][1]));
           count +=  b > 0 ? (r[x][0] * r[x][1]) : r[x][0] * (r[x][1] - Math.abs(b));
        }

        System.out.println(count);
    }
}
class Comp implements Comparator {

    int index = 0;

    void set_index (int i) {
        index = i;
    }

    public int compare(Object a, Object b) {
        long[] int_a = (long[]) a;
        long[] int_b = (long[]) b;
        return (int)(int_a[index] - int_b[index]);
    }

}


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

using namespace std;
using ll = long long;
using ld = long double;

vector<int> seen;
void dfs(vector<vector<int>> &g, int v, int u){
    seen[v]=u;
    for(int i = 0; i < g[v].size(); i++) {
        if(seen[g[v][i]]==-1){
            dfs(g,g[v][i],u);
        }
    }
}

//#define int long long
//signed main(){
int main() {
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    int n,m,k;
    cin >> n >> m >> k;
    int a,b;
    vector<vector<int>> g(n);
    for(int i = 0; i < m; i++) {
        cin >> a >> b;
        --a;
        --b;
        g[a].emplace_back(b);
        g[b].emplace_back(a);
    }

    seen.assign(n,-1);
    int u=0;
    int idx=0;
    for(int i = 0; i < n; i++) {
        if(seen[i]!=-1) continue;
        dfs(g,i,u);
        u++;
    }

    int un[u]={};
    for(int i = 0; i < n; i++) {
        un[seen[i]]++;
    }

    int ans[n];
    for(int i = 0; i < n; i++) {
        ans[i]=un[seen[i]]-g[i].size()-1;
    }

    int c,d;
    for(int i = 0; i < k; i++) {
        cin >> c >> d;
        --c;
        --d;
        if(seen[c]==seen[d]){
            ans[c]--;
            ans[d]--;
        }
    }

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

    return 0;
}


Measured memory_bytes: 7552
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define rep(i, j, k) for (auto i = j; i < k; i++)
#define rrep(i, j, k) for (auto i = j; i > k; i--)
using namespace std;

int main() {
  ll n; cin >> n;
  int ans = 0;
  while (n > 1) {
    if (n % 3 == 0) n /= 3;
    else {
      n = n / 3 + 1;
    }
    ans++;
  }
  cout << ans << endl;
}



Measured memory_bytes: 3104
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#define FOR(n) for(int i = 0;i < n;i++)
#define PRN(n) printf("%d\n",n)

 int main(void){
   int a, b, c;
   scanf("%d%d%d",&a,&b,&c);
   if(a + b == c || a + c == b || b + c == a)
     printf("Yes");
   else
     printf("No");
   return 0;
}

Measured memory_bytes: 128
import collections
n = int(input())
s = [input() for _ in range(n)]
s = collections.Counter(s)
print("AC x " + str(s["AC"]))
print("WA x " + str(s["WA"]))
print("TLE x " + str(s["TLE"]))
print("RE x " + str(s["RE"]))


Measured memory_bytes: 16624
#include <bits/stdc++.h>
#define INF 1023456789
#define sacnf scanf
#define CRLF <<'\n';
#define ALL(v) v.begin(),v.end()
#define PRPAIR(x) x.first << x.second
#define DEBUG(x) do { std::cerr <<(x)<<'\n'; } while (0)
#define rep(i,a,b) for(int i=(a);i!=(int)b-((a)>(b));(a)>(b)?--i:++i)
#define trav(it,v) for(typeof(v.begin()) it = v.begin(); it != v.end(); ++it)

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


int main(){
    ll n;
    scanf("%lld",&n);
    string name ="";
    while(n>0){
        int m = n%26;
        if (m==0)
            m=26;
        if (n%26==0)
            n/=26,n--;
        else
            n/=26;
        name += (char) ('a'+m-1);
    }
    reverse(ALL(name));
    cout << name;
}


Measured memory_bytes: 3684
import std.stdio, std.conv, std.string, std.algorithm, std.array, std.range;

const long INF = 9999999999;

void main() {
    long h, w;
    char[][] field = [];

    readf("%d %d\n", &h, &w);
    foreach (_; 0..h) {
        field ~= readln.strip.dup;
    }


    auto dists = new long[][](h, w);
    long[] xs = [];
    long[] ys = [];
    foreach (y; 0..h) {
        foreach (x; 0..w) {
            if (field[y][x] == '#') {
                dists[y][x] = 0;
                xs ~= x;
                ys ~= y;
            }
            else {
                dists[y][x] = INF;
            }
        }
    }

    while (xs.length > 0) {
        long x = xs.front;
        long y = ys.front;
        xs = xs[1..$];
        ys = ys[1..$];

        long[] dx = [0, -1, 1, 0];
        long[] dy = [-1, 0, 0, 1];

        foreach (i; 0..dx.length) {
            long x2 = x + dx[i];
            long y2 = y + dy[i];
            if (0 <= x2 && x2 < w && 0 <= y2 && y2 < h) {
                if (dists[y2][x2] > dists[y][x]+1) {
                    dists[y2][x2] = dists[y][x] + 1;
                    xs ~= x2;
                    ys ~= y2;
                }
            }
        }
    }

    long ans = 0;
    foreach (y; 0..h) {
        foreach (x; 0..w) {
            if (ans < dists[y][x]) {
                ans = dists[y][x];
            }
        }
    }
    writeln(ans);
}


Measured memory_bytes: 46972
#include <iostream>
#include <iterator>
#include <vector>

#define MAX_N 100000
#define MAX_M 100

using namespace std;

int N, M;
int A[MAX_N];

vector<int> solve()
{
    vector<int> B;

    vector<int> O; // 奇数のインデックス
    for ( int i = 0; i < M; i++ )
        if ( A[i] % 2 ) O.push_back( i );

    switch ( O.size() )
    {
    case 2:
        swap( A[O[1]], A[M - 1] );
    case 1:
        swap( A[O[0]], A[0] );
        break;
    case 0:
        break;
    default:
        return B;
    }

    if ( A[0] > 1 ) B.push_back( A[0] - 1 );
    switch ( M )
    {
    case 1:
        B.push_back( 1 );
        break;
    default:
        for ( int i = 1; i < M - 1; i++ ) B.push_back( A[i] );
        B.push_back( A[M - 1] + 1 );
    }

    return B;
}

int main( int argc, char **argv )
{
    cin >> N >> M;

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

    auto B = solve();

    if ( B.size() == 0 )
        cout << "Impossible" << endl;
    else
    {
        copy( A, A + M, ostream_iterator<int>( cout, " " ) );
        cout << endl;

        cout << B.size() << endl;

        copy( B.begin(), B.end(), ostream_iterator<int>( cout, " " ) );
        cout << endl;
    }

    return 0;
}


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

using namespace std;
using ll = long long;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    ll sum = 0, ans = 0;
    for(ll i = 0; i < n; i++) {
        ll x;
        cin >> x;
        ans += sum * x;
        ans %= 1000000007;
        sum += x;
        sum %= 1000000007;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3652
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>

using namespace std;
#define     loop(n,i,a)     for(int i=a;i<n;i++)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     vi              vector<int>
#define     vll             vector<ll>
#define     sz(x)           (int)x.size()
#define     pb              push_back
int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
bool Sort(const pair<string,int> &a,const pair<string,int> &b)
{
       return a.second>b.second;
}
int main() {
	int n;cin>>n;
	set<string>st;
	map<string,int>mp;
	loop(n,i,0){
		string s;cin>>s;
		st.insert(s);
		mp[s]++;
	}
	int sz=0;
	for(auto s:st)sz=max(sz,mp[s]);
	for(auto s:st){
		if(mp[s]==sz)cout<<s<<endl;
	}
}



Measured memory_bytes: 34560
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1000000007;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,m,n) for(ll i=(m);i<(n);i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back





int main(){


    string s;
    cin>>s;

    int n=int(s.size());

    if (s.at(n-1)=='s'){
        cout<<s<<"es"<<endl;
    }
    else {
        cout<<s<<"s"<<endl;
    }














}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007LL;
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
//_______________________________________________________________________________
const int N = 300005;
int seg[4*N];
int a[N];
int dp[N];
void build(int ind,int rl,int rr)
{
          if(rl == rr)
          {
                    seg[ind] = a[rr];
                    return;
          }
          int mid = (rl + rr)/2;
          build(2*ind,rl,mid);
          build((2*ind)+1,mid+1,rr);
          seg[ind] = max(seg[2*ind],seg[(2*ind)+1]);
}
void update(int ind,int idx,int val,int rl,int rr)
{
          if(rl == rr)
          {
                    seg[ind] = val;
                   // a[idx] = val;
                    return;
          }
          int mid = (rl+rr)/2;
          if(idx >= rl && idx <= mid)
          {
                    update(2*ind,idx,val,rl,mid);
          }
          else{
                    update((2*ind)+1,idx,val,mid+1,rr);
          }
          seg[ind] = max(seg[2*ind],seg[(2*ind)+1]);
}
int query(int ind,int ql,int qr,int rl,int rr)
{
          if(ql > rr || rl > qr)
          {
                    return -1;
          }
          if(rr <= qr && rl >= ql)
          {
                    return seg[ind];
          }
          int mid = (rl+rr)/2;
          return max(query(2*ind,ql,qr,rl,mid),query((2*ind)+1,ql,qr,mid+1,rr));
}
int main()
{
       int n,k;
       cin>>n>>k;
       memset(dp,0,sizeof dp);
       memset(seg,0,sizeof seg);
       for(int i = 0 ; i < n ; i++)cin>>a[i];
       for(int i = n-1 ; i >= 0; i--){
              int mn = max(a[i]-k,0);
              int mx = min(a[i]+k,300002);
              dp[a[i]] = max(dp[a[i]],query(1,mn,mx,0,300002)+1);
       //       cout<<a[i]<<" "<<query(1,mn,mx,0,300002)<<endl;
              update(1,a[i],dp[a[i]],0,300002);
       }
       int ans = 0;
       for(int i = 0 ; i < n; i++){
              ans = max(ans,dp[a[i]]);
       }
       cout<<ans<<endl;
}


Measured memory_bytes: 10616