akhauriyash/Code-Regression huggingface dataset:
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};


#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


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





void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    
    int n; cin >> n;
    vector<pair<int,int>> A;
    
    rep(i,n){
        int a; cin >> a;
        A.push_back(make_pair(a, i+1));
    }
    
    sort(A.begin(), A.end());
    
    for (auto itr = A.begin(); itr != A.end(); itr++) {
        cout << itr->second << endl;
    }
    
    
    
    
}



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



Measured memory_bytes: 1780
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------



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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
ll const mod=998244353;
//ll const mod=1e9+7;
const ll MAX=300000;
using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvl =vector<vector<ll>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}


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


int main(){
    int x,y;
    cin>>x>>y;
    int a=y-2*x;
    int b=4*x-y;
    if(a%2==0&&a>=0&&a<=2*x)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    

    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin >> s;
  string hitachi = "";
  for (int i = 1; i <= 5; i++)
  {
    hitachi += "hi";
    if (hitachi == s)
    {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


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

using namespace std;
int main()
{
	string s;
	int k;
	cin >> s >> k;
	for(int i=0; i<k; i++){
		if(s[i] > '1'){
			cout << s[i] << endl;
			return 0;
		}
	}
	cout << 1 << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0 ; i < n ; i++)
using namespace std;
int main(){
  string s;
  cin >> s;
  int n = s.size();
  const int64_t mod = 1E9+7;
  vector<vector<int64_t>> cont(100001 , vector<int64_t>(13));
  cont.at(0).at(0) = 1;
  
  rep(i,n){
    
    //?の時
    if(s.at(i) == '?'){
      rep(j,10){ 
        rep(k,13){
          cont.at(i+1).at( (10*k + j) % 13 ) += cont.at(i).at(k);
          cont.at(i+1).at( (10*k + j) % 13 ) %= mod;
        }
      } 
    }
    //普通の数字の時
    else{
      int a = (int)(s.at(i) - '0');
      rep(j,13){
        cont.at(i+1).at( (10*j + a) % 13 ) = cont.at(i).at(j);
        cont.at(i+1).at( (10*j + a) % 13 ) %= mod;
      }
    }
  }
  cout << cont.at(n).at(5) << endl;
}

Measured memory_bytes: 13696
#include<stdio.h>

int main(void){
    int n,i;

    scanf("%d",&n);
    int S[n];
    for(i=0;i<n;i++){
        scanf("%d",&S[i]);
    }

    for(i=n-1;i>-1;i--){
        if(i==0) printf("%d\n",S[0]);
        else printf("%d ",S[i]);
    }

    return 0;
}


Measured memory_bytes: 2104
import math
import collections
import fractions
import itertools
import functools
import operator

def solve():
    n = int(input())
    c = input()
    sushi = c.count("R")
    cnt = 0
    for i in range(sushi):
        if c[i] == "R":
            cnt += 1
    print(sushi - cnt)
    return 0

if __name__ == "__main__":
    solve()


Measured memory_bytes: 77664
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

void yes() {
  cout << "Yes";
}

void no() {
  cout << "No";
}

int main() {
  kyun;
  in6 n;
  cin >> n;
  n++;
  vi monster(n);
  vi attack(n-1);
  rep(i,n) cin >> monster[i];
  rep(i,n-1) cin >> attack[i];
  in6 ans = 0;
  rep(i,n-1) {
    if(attack[i] >= monster[i]) {
      ans += monster[i];
      attack[i] -= monster[i];
      ans += min(monster[i+1],attack[i]);
      monster[i+1] -= min(monster[i+1],attack[i]);
    }
    else ans += attack[i];
  }
  cout << ans;
  hinata;
}

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

int main(void)
{
    int n,d,x;
    cin >> n >> d >> x;
    vector<int> a(n);

    for (int i = 0;i < n;i++) cin >> a[i];

    int ans = x;

    for (int i = 0;i < n;i++)
    {
        for (int day = 1;day <= d;day += a[i])
        {
            ans++;
        }
    }

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


Measured memory_bytes: 3600
from sys import stdin

class Node:
    def __init__(self):
        self.children = [-1, -1]

###

def initNode(t_pre, t_in):
    global nodes
    if len(t_in) == 1:
        nodes[t_in[0]].children = [-1, -1]
        return t_in[0]
    else:
        r = t_in.index(t_pre[0])
        if r == 0: # 左部分木はなし
            rr = initNode(t_pre[1:], t_in[1:])
            nodes[t_in[r]].children = [-1, rr]
        elif r == len(t_in)-1: # 右部分木はなし
            lr = initNode(t_pre[1:r+1], t_in[:r])
            nodes[t_in[r]].children = [lr, -1]
        else:
            lr = initNode(t_pre[1:r+1], t_in[:r])
            rr = initNode(t_pre[r+1:], t_in[r+1:])
            nodes[t_in[r]].children = [lr, rr]

        return t_in[r]

def postorder(i):
    global nodes, res
    if i != -1:
        c = nodes[i].children
        postorder(c[0])
        postorder(c[1])
        res.append(i)

n = int(stdin.readline().rstrip())
t_pre = [int(x) for x in stdin.readline().rstrip().split()]
t_in = [int(x) for x in stdin.readline().rstrip().split()]

nodes = [Node() for _ in range(n+1)]
initNode(t_pre, t_in)

res = []
postorder(t_pre[0])
print(*res)


Measured memory_bytes: 5616
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define line cout << endl
using namespace std;
string s;
int main() {
	cin >> s;
	if (s == "ABC") cout << "ARC";
	else cout << "ABC";
	line;
	return 0;
}


Measured memory_bytes: 3052
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D, w) for(auto vec : vec2D) { for (auto v : vec) cerr << setw(w) << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

const char en = '\n';

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

typedef ll Weight;
void add_edge(vector<vector<Weight>> &g, Weight from, Weight to, bool isDirected) {
  g[from].push_back(to);
	if (!isDirected) g[to].push_back(from);
}

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

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

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

	sort(all(p));
	ll ans = 0;
	rep(i,k) ans += p[i];

	cout << ans << en;

}


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

using namespace std;

int n, q;
vector<int> A, m;
bool solve(int, int);

int main(){
	int i, j, k;
	int ain, min;
	bool exist;
	
	cin >> n;
	for(i=0;i<n;++i){
		cin >> ain;
		A.push_back(ain);
	}
	cin >> q;
	for(i=0;i<q;++i){
		cin >> min;
		m.push_back(min);
	}
	
	for(i=0;i<q;++i){
		exist = false;
		
		if(solve(0, m[i]))exist = true;
		if(exist)cout << "yes\n";
		else cout << "no\n";
	}
	
	return 0;
}

bool solve(int i, int m){
	int res;
	if(m == 0)return true;
	if(i>=n)return false;
	res = solve(i+1, m) || solve(i+1, m-A[i]);
	return res;
}


Measured memory_bytes: 3168
N = int(input())
S = [input() for i in range(N)]
MAX_LEN = 50

res = ""
for i in range(ord('a'), ord('a')+26):
	c = chr(i)
	curr = MAX_LEN
	for j in range(N):
		curr = min(curr,S[j].count(c))
	res += c * curr

print(res)

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

int main(){

    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i=0; i<N; i++) cin >> A.at(i);

    vector<ll> sum(N);
    sum.at(0) = A.at(0);
    for (int i=1; i<N; i++) sum.at(i) = sum.at(i-1) + A.at(i);

//    for (int i=0; i<N; i++) cout << sum.at(i) << " ";   //  debug
//    cout << endl;                                       //  debug

    vector<ll> lsum(N);
    vector<ll> rsum(N);
    ll dif = 0, ans = 1e18;
    for (int i=0; i<N; i++){
        dif = 0;
        lsum.at(i) = sum.at(i);
        rsum.at(i) = sum.at(N-1) - sum.at(i);

        dif = abs(rsum.at(i) - lsum.at(i));
        ans = min(dif, ans);         
    }

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

Measured memory_bytes: 9588
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
int main(){
  string s;ll k,i,ans = 0;cin >> s >> k;
  ll n = s.size();bool streak = false;
  if(count(s.begin(),s.end(),s[0]) == n){
    cout << n*k/2 << "\n";
    return 0;
  }
  for(i=1;i<n;i++){
    if(s[i] == s[i-1]) streak ^= true;
    else streak = false;
    ans += streak;
  }
  ans *= k;
  if(s[0] != s[n-1]){
    cout << ans << "\n";
    return 0;
  }
  bool lodd = true,rodd = true;
  for(i=1;i<n;i++){
    if(s[i] == s[i-1]) lodd ^= true;
    else break;
  }
  for(i=n-2;i>=0;i--){
    if(s[i] == s[i+1]) rodd ^= true;
    else break;
  }
  if(lodd && rodd) ans += k-1;
  cout << ans << "\n";
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007 //S(vector).size()
using namespace std;
typedef long long ll;

int main(void){
  int n;
  cin >> n;
  vector<int> memo(n + 1, 0), a(n + 2, 0);
  ll sum = 0;
  rep(i, n) cin >> a[i + 1];

  memo[1] = abs(a[1]);
  sum += abs(a[1]) + abs(a[n]);
  for(int i = 1; i < n; i++){
    memo[i + 1] = abs(a[i + 1] - a[i]);
    sum += memo[i + 1];
  }
  for(int i = 1; i <= n; i++){
    cout << sum - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1]) << endl;
  }
  return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n,m;
  int sh1[1111],sm1[1111];
  int sh2[1111],sm2[1111];
  int sx[1111];
  int gh[1111],gm[1111];
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> sh1[i] >> sm1[i];
    sx[i]=sh1[i]*60+sm1[i];
  }
  cin >> m;
  for(int i=0;i<m;i++){
    cin >> sh2[i] >> sm2[i];
    sx[n+i]=sh2[i]*60+sm2[i];
  }
  sort(sx,sx+n+m);//全体の分表示を昇順にする
  for(int i=0;i<n+m;i++){
    gh[i]=sx[i]/60;
    gm[i]=sx[i]-gh[i]*60;
  }
  for(int i=0;i<n+m;i++){//もしも同じ時刻があったとき ＆＆　出力
    if(gh[i]==gh[i+1] && gm[i]==gm[i+1])continue;
    else if(gm[i]/10==0){//分が１桁だったら
      cout << gh[i] << ":" << "0" << gm[i];
    }else{
      cout << gh[i] << ":" << gm[i];
    }
    if(i==n+m-1)cout << endl;
    else cout << " ";
  }
}

    

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 10000
#define MAP 100
#define Pair pair<int,int>

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

map<char,int> mp;
int main(){
    bool flg = true;
    ll n; cin >> n;
    ll t[n+1],x[n+1],y[n+1];
    t[0] = 0; x[0] = 0; y[0] = 0;
    for(ll i = 1; i <= n; i++){
        cin >> t[i] >> x[i] >> y[i];
    }
    for(ll i = 1; i <= n; i++){
        ll length = abs(x[i-1] - x[i])+abs(y[i-1] - y[i]);
        ll dif_time = t[i]-t[i-1];
        if(dif_time < length){
            cout << "No" << endl;
            return 0;
        } else if ((dif_time - length)%2 == 1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

//Write From this Line

const int mod = 1e9+7;
int main()
{
	int n , m ;
	cin >> n >> m ;
	if(n == m){
		coY();
	}
	else coN();

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long mod=1e9+7;
long N,dp[111][6][6][6][6];
long find(int now,int c1,int c2,int c3,int c4){
  if(dp[now][c1][c2][c3][c4]!=-1)return dp[now][c1][c2][c3][c4];
  if(c1==0&&c2==1&&c4==2)return 0;
  if(c2==0&&c3==1&&c4==2)return 0;
  if(c1==0&&c3==1&&c4==2)return 0;
  if(c2==0&&c3==2&&c4==1)return 0;
  if(c2==1&&c3==0&&c4==2)return 0;
  if(now==N)return 1;
  long ans=0;
  for(int i=0;i<4;i++)ans+=find(now+1,c2,c3,c4,i);
  return dp[now][c1][c2][c3][c4]=ans%mod;
}
int main(){
  cin>>N;
  memset(dp,-1,sizeof(dp));
  cout<<find(0,4,4,4,4)<<endl;
}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
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(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  int n;
  cin>>n;

  auto compress = [](vector<int>& v){
    auto s = v;
    sort(s.begin(),s.end());
    s.erase(unique(s.begin(),s.end()),s.end());
    for(auto& vi:v){
      int idx = lower_bound(s.begin(),s.end(),vi)-s.begin();
      vi = idx;
    }
    return v;
  };

  set<vector<int>> ans;

  auto dfs = [&](auto&& dfs,vector<int>& a,int dep){
    if(a.size()==n){
      ans.emplace(compress(a));
      return;
    }
    for(int i=0;i<min(dep+1,n);++i){
      a.push_back(i);
      dfs(dfs,a,dep+1);
      a.pop_back();
    }
  };

  vector<int> a;
  dfs(dfs,a,0);

  auto get = [](vector<int> const& a){
    string s;
    rep(i,a.size())s+=('a'+a[i]);
    cout<<s<<"\n";
  };

  for(auto& s:ans){
    get(s);
  }

}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  int left = 1001, right = 0;
  
  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    left = min(a, left);
    right = max(a, right);
  }
  cout << right - left << endl;
  return 0;
}



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

int main() {
	int H, W;
	char temp;
	std::cin >> H >> W;
	std::vector<std::vector<char>> vec(H, std::vector<char>(W, '0'));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			std::cin >> temp;
			if (temp == '#') {
				vec[i][j] = temp;
				for (int k = -1; k < 2; k++) {
					for (int l = -1; l < 2; l++) {
						if (i + k >= 0 && i + k < H && j + l >= 0 && j + l < W) {
							if (vec[i + k][j + l] != '#') {
								vec[i + k][j + l]++;
							}
						}
					}
				}
			}
		}
	}

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			std::cout << vec[i][j];
		}
		std::cout << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
#define rep(i, a, n) for (int i = (a); i < (n); i++)
#define repr(i, n, a) for (int i = (n)-1; i >= (a); i--)
#define each(it, v) for (auto(it) = (v).begin(); (it) != (v).end(); (it)++)
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vi>
#define vd vector<double>
#define vvd vector<vd>
#define co(x) cout << (x)
#define con(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define out(x) rep(i, 0, x.size()) cout << x[i] << ((i != x.size() - 1) ? " " : "\n")
const double PI = 3.14159265;
const int MAXN = 1 << 15;
const ll LINF = 1LL << 60;
const int INF = 1 << 30;
#define Pr(a) (#a) << "=" << (a) << " "
#define pr(a) cout << Pr(a) << '\n'
///////////////////////////////////////////////////////////

int N, q;
vector<int> V;
deque<int> D;
list<int> L;

int main() {
  cin >> N >> q;
  vector<queue<int>> Q(N);
  while (q--) {
    int cmd, t;
    cin >> cmd >> t;
    if (cmd == 0) {
      int x;
      cin >> x;
      Q[t].push(x);
    }
    if (cmd == 1) {
      if (!Q[t].empty()) cout << Q[t].front() << endl;
    }
    if (cmd == 2) {
      if (!Q[t].empty()) Q[t].pop();
    }
  }
  return 0;
}


Measured memory_bytes: 4268
#include <stdio.h>
int main(void){
 int a;
 int b;
 scanf("%d %d\n", &a ,&b);
 if(a > b){
 printf("a > b\n");
 }else if(a < b){
 printf("a < b\n");
 }else if(a == b){
 printf("a == b\n");
 }
 return 0;
}


Measured memory_bytes: 2044
a=input()
b=input()
c=input()
d=input()
leastnum=0
if a>=b and c>=d:
  leastnum=b+d
elif a>=b and d>=c:
  leastnum=b+c
elif b>=a and c>=d:
  leastnum=a+d
elif b>=a and d>=c:
  leastnum=a+c
print leastnum

Measured memory_bytes: 2696
N,M,Q = map(int, input().split())
# A[i][j]: L=i, R=jの本数
A = [[0] * 509 for _ in range(509)]
for _ in range(M):
    L, R = map(int, input().split())
    A[L][R] += 1

# 二次元累積和をとる O(N * N)
for i in range(1, N + 1):
    for j in range(1, N + 1):
        A[i][j] += A[i][j - 1]
for i in range(1, N + 1):
    for j in range(1, N + 1):
        A[i][j] += A[i - 1][j]

# クエリ O(Q)
for _ in range(Q):
    L, R = map(int, input().split())
    ans = A[R][R] - A[L - 1][R] - A[R][L - 1] + A[L - 1][L - 1]
    print(ans)

Measured memory_bytes: 13400
#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 100005
#define F first
#define S second
using namespace std;

typedef long long ll;
ll n, m, s, a[N], t[N];
pair<ll, ll> b[N];
int main()
{
	int i, j, k;
	cin >> n >> m;
	for (i = 0; i < n; i++) scanf("%lld", &a[i]);
	sort(a, a + n);
	for (i = 0; i < m; i++) scanf("%lld %lld", &b[i].S, &b[i].F);
	sort(b, b + m);
	k = 0;
	for (i = m - 1; i >= 0; i--) {
		for (j = 0; j < b[i].S && k < n; j++, k++) {
			t[k] = b[i].F;
		}
	}
	for (i = 0; i < n; i++) s += max(a[i], t[i]);
    cout << s << endl;
    return 0;
}

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

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll e = a * c;
  ll f = a * d;
  ll g = b * c;
  ll h = b * d;
  ll A = max(e, f);
  ll B = max(g, h);
  cout << max(A, B) << endl;
}


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

int main() {
    int N, M;
    cin >> N >> M;
    int T = 1900*M + 100*(N-M);
    rep(i, M) {
        T *= 2;
    }
    cout << T << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        int[] q = new int[n];

        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            q[i] = sc.nextInt();
        }

        int a = findRank(p,n);
        int b = findRank(q,n);
        System.out.println(Math.abs(a - b));

    }

    public static int fac(int n) {
        int res = 1, i;
        for (i=2; i<=n; i++)
            res *= i;
        return res;
    }

    public static int findSmallerInRight(int[] array, int low, int high) {
        int countRight = 0, i;

        for (i = low + 1; i <= high; ++i)
            if (array[i] < array[low])
                ++countRight;

        return countRight;
    }

    public static int findRank(int[] array, int length) {
        int mul = fac(length);
        int rank = 1;
        int countRight;

        for (int i = 0; i < length; ++i) {
            mul /= length - i;

            // count number of chars smaller
            // than str[i] from str[i+1] to
            // str[len-1]
            countRight = findSmallerInRight(array, i, length - 1);

            rank += countRight * mul;
        }

        return rank;
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >>N;
    if(N==1){
        cout << 1<<endl;
        return 0;
    }
    int count=0;
    for(int i=0;i<10;++i){
       ++count;
        N/=2;
        if(N==1||N==0){
            break;
        }
    }
    int rui=1;
    for(int i=0;i<count;i++){
        rui*=2;
    }
    
    cout << rui << endl;
}

Measured memory_bytes: 3620
import copy
# @patch('builtins.input', test.test_input)
def main():
    h, w, K = map(int, input().split())
    c = [list(input()) for _ in range(h)]
    ans = 0
 
    def get_list(n):
        s = list(range(n))
        n = len(s)
        l = []
        for i in range(2 ** n):
            bit_set = []
            for j in range(n):
                if ((i >> j) & 1):
                    bit_set.append(s[j])
            l.append(bit_set)
        return l
     
    ws = get_list(w)
    hs = get_list(h)
    for wws in ws:
        d = copy.deepcopy(c)
#         print(wws)
        for i in wws:
            for x in range(h):
                d[x][i] = '.'
        e = copy.deepcopy(d)
        for hhs in hs:
            f = copy.deepcopy(e)
            for j in hhs:
                for x in range(w):
                    f[j][x] = '.'
            # print(f)
            tmp = 0
            for x in range(h):
                tmp += f[x].count('#')
            if tmp == K:
                ans += 1
        
    print(ans)
        
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 9276
let read_lines n =
  let rec read_lines n acc =
    if n = 0 then List.rev acc
    else read_lines (pred n) ((read_line ()) :: acc) in
  read_lines n []

let split str delim =
  let len = String.length str in
  let rec split offset acc =
    try
      let index = String.index_from str offset delim in
      split (index + 1) ((String.sub str offset (index - offset)) :: acc)
    with Not_found ->
      List.rev ((String.sub str offset (len - offset)) :: acc) in
  split 0 []

let rec solve () =
  let line = read_line () in
  let n, m = Scanf.sscanf line "%d %d" (fun n m -> n, m) in
  if n = 0 && m = 0 then ()
  else
    let rec zero_list n acc =
      if n = 0 then acc
      else zero_list (n - 1) (0 :: acc) in
    let zero_list = zero_list m [] in
    let votes = List.map
                  (fun line -> List.map int_of_string @@ split line ' ')
                  (read_lines n) in
    let votes = List.fold_left
                  (fun acc vote -> List.map2 ( + ) acc vote)
                  zero_list
                  votes in
    let places = List.map fst
                 @@ List.sort (fun (p1, v1) (p2, v2) ->
                               let c = compare v2 v1 in
                               if c <> 0 then c
                               else compare p1 p2)
                 @@ List.mapi (fun i v -> (i + 1, v)) votes in
    print_endline @@ String.concat " " @@ List.map string_of_int places;
    solve ()

let () = solve ()

Measured memory_bytes: 8416
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};


int main(){
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  for(char a = '0'; a <= '9'; a++) {
	for(char b = '0'; b <= '9'; b++) {
	  for(char c = '0'; c <= '9'; c++) {
		string s;
		bool f1 = false;
		bool f2 = false;
		bool f3 = false;
		rep(i,N) {
		  if(S[i] == c && f2) f3 = true;
		  if(S[i] == b && f1) f2 = true;
		  if(S[i] == a) f1 = true;
		}
		if(f3) {
		  //		  printf("%c%c%c\n",a,b,c);
		  ans += 1;
		}

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



Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef deque<int> di;
typedef pair<int,int> pi;
#define pb push_back
#define mp make_pair
#define mh make_heap
#define pf push_front
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define INF 1000000000
#define FOR(i,a,b) for(ll i=a;i<b;i++)

int main()
{
    //freopen("contest.txt","r",stdin);
    //freopen("contest.txt","w",stdout);
    IOS
    string s,t;
    cin>>s>>t;
    int count_=0;
    FOR(i,0,s.size())
    {
        if(s[i]!=t[i])
            count_++;
    }
    cout<<count_<<endl;

    return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long> VLL;
#define inf (int)(1e9)
#define INF 1.1529215e+18
#define MAXX 999999
#define EPS (1e-7)
#define MOD ((ll)1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/
/*--------------------------------------------*/
int n;int flag;
void dfs(int sum){
    //printf("sum=%d\n",sum);
    if(sum==n){
        flag=1;
        return;
    }
    if(sum>n){return;}
    dfs(sum+4);
    dfs(sum+7);
}

int main(){
    cin>>n;dfs(0);
    cout<<(flag?"Yes":"No")<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdlib>

#define INF 1000000

using namespace std;

int H, W;
int c[10][10];
int **A;
int memo[10];

int getMinCost(int start){
  int dist[10], update;

  if(memo[start] != -1){
    return memo[start];
  }

  for(int i=0; i<10; i++){
    dist[i] = INF;
  }
  dist[start] = 0;

  update = 1;
  while(update) {
    update = 0;
    for(int i=0; i<10; i++){
      for(int j=0; j<10; j++){
        if(i == j) continue;
        if(dist[j] > dist[i] + c[i][j]){
          dist[j] = dist[i] + c[i][j];
          update = 1;
        }
      }
    }
  }
  
  return dist[1];
}

int main() {
  int ans = 0;
  scanf("%d %d", &H, &W);

  A = (int **)malloc(sizeof(int*) * H);
  for(int i=0; i<H; i++){
    A[i] = (int *)malloc(sizeof(int) * W);
  }
  for(int i=0; i<10; i++){
    for(int j=0; j<10; j++){
      scanf("%d", &c[i][j]);
    }
  }
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      scanf("%d", &A[i][j]);
    }
  }

  for(int i=0; i<10; i++){
    memo[i] = -1;
  }

  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      ans += getMinCost(A[i][j]);
    }
  } 

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

  for(int i=0; i<H; i++){
    free(A[i]);
  }
  free(A);
  return 0;
}


Measured memory_bytes: 512
#include <iostream>

int main()
{
using namespace std;

int a,b,c;
int now_num,counter=0;
cin>>a>>b>>c;

now_num=a;

while(now_num<=b)
{
if(c%now_num == 0)
counter++;

now_num++;
}

cout<<counter<<endl;
return 0;
}

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

int main() {
  
  int N; cin >> N; int ans = 1;
  
  bool increaseCase = false, decreaseCase = false;
  
  vector<int64_t> vec(N);
  
  for (int i = 0; i < N; i++) cin >> vec[i];
  
  for (int i = 0; i < N - 1; i++) {
    
    int tmp = vec[i], next = vec[i + 1];
    
    if (tmp < next) {
      
      if (increaseCase == false && decreaseCase == false) {
        increaseCase = true;
      }
      
      if (decreaseCase == true) {
        ans++; decreaseCase = false;
      }
      
    }
    
    if (next < tmp) {
      
      if (increaseCase == false && decreaseCase == false) {
        decreaseCase = true;
      }
      
      if (increaseCase == true) {
        ans++; increaseCase = false;
      }
      
    }
    
  }
  
  cout << ans << endl;
  
}

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

int main(){

  ll n , d;
  cin >> n >> d;
  int cnt = 0;
  for(int i = 0;i < n ; i++){
    ll x , y;
    cin >> x >> y;
    long double result = sqrt(x*x + y*y);
    if(d*1.00 >= result) cnt++;
    //cout<<result<<endl;
  }

  cout<<cnt<<endl;


  return 0;
}


Measured memory_bytes: 3648
n, y = map(int, input().split())
a = -1;b = -1;c = -1
for i in range(n + 1):
    for j in range(n + 1):
        s = n - i - j
        if y - i * 10000 - j * 5000 == 1000 * s and s >= 0:
            a = i
            b = j
            c = s
print(a, b, c)


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

using namespace std;

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

const long long MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
  int N;
  cin >> N;
  vector<string> s;
  for (int i = 0; i < N; ++i) {
    char c[11];
    cin >> c;
    sort(c, c + 10);
    s.push_back(c);
  }
  sort(s.begin(), s.end());
  ll ans = 0;
  ll cnt = 1;
  string prev = s[0];
  for (int i = 1; i < s.size(); ++i) {
    if (s[i] == prev) cnt++;
    else {
      ans += cnt * (cnt - 1) / 2;
      prev = s[i];
      cnt = 1;
    }
  }
  ans += cnt * (cnt - 1) / 2;
  cout << ans << endl;
}

Measured memory_bytes: 5748
#include<bits/stdc++.h>
 
using namespace std;
 
 
int main(){
 
 
	int N,K;
 
	cin >> N >> K;
 
	vector<int> DP(N,0);
	vector<int> A(N,0);
 
	for(int i=0;i<N;i++){
		cin >> A[i];
	}
 
	DP[1] = abs(A[1]-A[0]);
 
	for(int i=2;i<N;i++){
		int best_jump = INT_MAX;
		for(int j=1;(j<=K)&&(j<=i);j++){
			best_jump = min(best_jump,abs(A[i]-A[i-j])+DP[i-j]);
		}
		DP[i] = best_jump;
	}
 
	cout << DP[N-1] << endl;

 
	return 0;
 
}

Measured memory_bytes: 3988
#include <string.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <cstring>
#include <math.h>
#include <set>
#include <vector>
#include <algorithm>
#include <map>


using namespace std;

typedef long long ll;
#define INF 0x3f3f3f3f
#define ESP 1e-8;
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
const double PI = acos(-1.0);

int main(){
    int n;
    while(scanf("%d", &n)!=EOF){
        while(1){
            if(n%10==n/10%10&&n/10%10==n/100){
                printf("%d\n", n);
                break;
            }
            n++;
        }
    }

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, XY):
    
    SXY = [(math.atan2(y, x), x, y) for x, y in XY]
    SXY.sort()

    ans = 0
    for i in range(N):
        cx = 0
        cy = 0
        for j in range(N):
            _, x, y = SXY[i-j]
            cx += x
            cy += y
            ans = max(ans, cx**2 + cy**2)
    return math.sqrt(ans)


def main():
    N = read_int()
    XY = [read_int_n() for _ in range(N)]
    print("%.100f" % slv(N, XY))


if __name__ == '__main__':
    main()


Measured memory_bytes: 60736
/*
  AUTHOR:SOURABH
  CREATED:25:03:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<pll , null_type, less< pll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 998244353
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

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

    //freopen("in.txt","r",stdin);
    //freopen(2 "out.txt","w",stdout);

    ll t,n,x,y,i,j;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>n>>x>>y;
        vll ans(n);
        fs(i,1,n+1)
        {
            fs(j,i+1,n+1)
            {
                if(i<=x)
                {
                    if(j<=x)
                        ans[j-i]++;
                    else if(j<=y)
                    {
                        ans[x-i+min(y-j+1,j-x)]++;
                    }
                    else
                    {
                        ans[x-i+j-y+1]++;
                    }
                }
                else if(i<=y)
                {
                    if(j<=y)
                    {
                        ans[min(j-i,i-x+y-j+1)]++;
                    }
                    else
                    {
                        ans[j-y+min(i-x+1,y-i)]++;
                    }
                }
                else
                {
                    ans[j-i]++;
                }
            }
        }
        fs(i,1,n)
        cout<<ans[i]<<"\n";
    }
    return 0;
}









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

#define int long long
#define double long double

#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

using namespace std;
using P = pair<int, int>;
using ll=long long;
using ld=double;

constexpr int MOD = 1e9+7;

template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}

// https://twitter.com/vane11ope ←フォローしましょう
// (ノ)>◡<(ヾ)ﾓﾁﾓﾁ
signed main(signed argc, char* argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    map<string,int> mp;
    rep(i,n){
        string s;
        cin>>s;
        mp[s]++;
    }
    string s[]={"AC","WA","TLE","RE"};
    for(auto it:s){
        cout<<it<<" x "<<mp[it]<<endl;
    }
}


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

void trace(const vector<int>& a) {
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] << ((i != a.size() - 1)? " " : "");
  }
  cout << endl;
}

int selection_sort(vector<int>& a, int n) {
  int times = 0;
  for (int i = 0; i < n; i++) {
    int minj = i;
    for (int j = i; j < n; j++) {
      if (a[j] < a[minj]) {
        minj = j;
      }
    }
    if (minj != i) times++;
    swap(a[i], a[minj]);
  }
  return times;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i]; 
  }
  int times = selection_sort(a, n);
  trace(a);
  cout << times << endl;
}



Measured memory_bytes: 3080
#include<stdio.h>
#define N (5010)
#define M (210)
#define MAXA (1000000010)
typedef long long LL;
int lst[N],pre[N],b[N][M],pos[N];
LL a[N][N],s[N];
void add(int x1, int x2, int y1, int y2, int z){
	a[x1][y1]+=z;
	a[x1][y2+1]-=z;
	a[x2+1][y1]-=z;
	a[x2+1][y2+1]+=z;
}
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for (int i=2,x;i<=n;i++) scanf("%d",&x),s[i]=s[i-1]+x;
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++){
			scanf("%d",b[i]+j);
		}
	}
	for (int j=1,cl;j<=m;j++){
		lst[pos[cl=0]=0]=MAXA;
		for (int i=1;i<=n;i++){
			while (b[i][j]>=lst[cl]) cl--;
			pre[i]=pos[cl];
			pos[++cl]=i;
			lst[cl]=b[i][j];
		}
		pos[0]=n+1;
		lst[cl=0]=MAXA;
		for (int i=n;i;i--){
			while (b[i][j]>lst[cl]) cl--;
			add(pre[i]+1,i,i,pos[cl]-1,b[i][j]);
			pos[++cl]=i;
			lst[cl]=b[i][j];
		}
	}
	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++){
			a[i][j]+=a[i][j-1];
		}
	}
	LL ans=0;
	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++){
			a[i][j]+=a[i-1][j];
			if (i<=j&&a[i][j]-(s[j]-s[i])>ans){
				ans=a[i][j]-(s[j]-s[i]);
			}
		}
	}
	printf("%lld\n",ans);
}

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

int main()
{
    int n, in;
    bool flag = true;
    cin >> n;
    while(n--){
        cin >> in;
        if(in%2==0){
            if(in%3!=0 and in%5!=0){
                flag = false;
            }
        }
    }
    if(flag){
        cout << "APPROVED\n";
    }
    else
        cout << "DENIED\n";
    return 0;
}


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


int main(){
  string s;
  cin >> s;
  if((s[0]=='R'&&s[1]=='R'&&s[2]=='R')) cout << 3 << endl;
  else if((s[0]=='R'&&s[1]=='R'&&s[2]=='S')|(s[0]=='S'&&s[1]=='R'&&s[2]=='R')){
    cout << 2 << endl;
  }
  else if(s[0]=='S'&&s[1]=='S'&&s[2]=='S') cout << 0 << endl;
  else cout << 1 << endl;

  return 0;
}

Measured memory_bytes: 3608
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#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 rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define srep(i, from, to) for(int i = from; i < (int)(to); i++)
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main() {
  string s;
  cin >> s;
  string ans = string(s.size(), 'x');
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>
#include <bitset>
#include <sstream>
#include <cassert>
#include <time.h>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}
void printvec (vec &v) {
    Rep (i, (ll)v.size()) {
        cout << v[i] << " \n"[i+1 == (ll)v.size()];
    }
}

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

    string S, T;
    cin >> S >> T;
    ll n = S.size();
    ll ans = 0;
    Rep (i, n) {
        ans += S[i] != T[i];
    }

    cout << ans << endl;
}

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


using namespace std;


int main()
{
	int n;

	while (cin >> n && n)
	{
		int k[101];
		for (int i = 0; i < n; i++)
		{
			cin >> k[i];
		}

		string s;cin >> s;
		string ans;
		for (int i = 0; i < s.size(); i++)
		{
			int t = s[i];
			for (int j = 0; j < k[i%n]; j++)
			{
				t--;
				if (t == 'a'-1)
					t = 'Z';
				if (t == 'A'-1)
					t = 'z';
				if (t == 'z'+1)
					t = 'A';
				if (t == 'Z'+1)
					t = 'a';
			}

			ans += t;
		}
		
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1208
n=int(input())
w=list(map(int,input().split()))
t=0
for i in range(n):
  t+=w[i]
  if t>(sum(w)/2):
    ans1=t-(sum(w)-t)
    t-=w[i]
    ans2=sum(w)-t-t
    print(min(ans1,ans2))
    break

Measured memory_bytes: 38512
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

static const double PI = 3.14159265358979;
static const ll MOD = 1e9 + 7;
static const ll INF = (ll)1 << 62;

int main() {
	ll h, w; cin >> h >> w;
	char c[10][10] = {};
	bool v[10][10];

	repe(i, 0, h + 1) repe(j, 0, w + 1) c[i][j] = '.';

	repe(i, 1, h) {
		repe(j, 1, w) {
			cin >> c[i][j];
		}
	}
	repe(i, 1, h) {
		repe(j, 1, w) {
			if (c[i][j] == '#') {
				if (i == 1 && j == 1) {
					if (c[i + 1][j] == '#' && c[i][j + 1] == '.' || c[i][j + 1] == '#' && c[i + 1][j] == '.') {
					}
					else {
						cout << "Impossible" << endl;
						return 0;
					}
				}
				else if (i == h && j == w) {
					if (c[i - 1][j] == '#' && c[i][j - 1] == '.' || c[i][j - 1] == '#' && c[i - 1][j] == '.') {
					}
					else {
						cout << "Impossible" << endl;
						return 0;
					}
				}
				else {
					if ((c[i + 1][j] == '#' && c[i][j + 1] == '.' || c[i][j + 1] == '#' && c[i + 1][j] == '.') &&
						(c[i - 1][j] == '#' && c[i][j - 1] == '.' || c[i][j - 1] == '#' && c[i - 1][j] == '.'))
					{
					}
					else {
						cout << "Impossible" << endl;
						return 0;
					}
				}
			}
		}
	}
	cout << "Possible" << endl;
	return 0;
}

Measured memory_bytes: 256