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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class A, class B>
bool chmax(A &a, const B &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, class B>
bool chmin(A &a, const B &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n;
  string s;
  while (1) {
    cin >> n;
    if (n == 0) break;
    vector<int> x(n, 0);
    cin >> s;
    int ba = 0;

    rep(i, 0, s.size()) {
      int next = i % n;
      if (s[i] == 'M') {
        x[next]++;
      } else if (s[i] == 'S') {
        ba += x[next] + 1;
        x[next] = 0;
      } else if (s[i] == 'L') {
        x[next] += ba + 1;
        ba = 0;
      }
    }

    sort(all(x));
    arep(i, x) cout << i << ' ';
    cout << ba << '\n';
  }

  return 0;
}


Measured memory_bytes: 3260
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n, d[55], ans;
int main(){
	scanf("%d", &n);
	rep(i,n) scanf("%d", d+i);
	sort(d,d+n);
	for(int i = 12; i >= 0; i--){
		int l[2] = {0,0}, k = 0;
		bool ok = true;
		rep(j,n){
			if(l[k]+i <= d[j] && l[!k]+i+d[j] <= 24) l[k] = d[j];
			else if(l[k^=1]+i <= d[j] && l[!k]+i+d[j] <= 24) l[k] = d[j];
			else{
				ok = false;
				break;
			}
			
		}
		if(ok){
			ans = i;
			break;
		}
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

long int gcd(long int x, long int y){
    while(y != 0){
        long int z = x % y;
        x = y;
        y = z;
    }
    return x;
}

long int lcm(long int x, long int y){
    return (x * y) / gcd(x, y);
}

int main(){
    long int a, b, c, d;

    cin >> a >> b >> c >> d;
    long int x = lcm(c, d);
    long int ans = (b - a + 1) + ((b / x) - ((a - 1) / x)) - ((b / c) - ((a - 1) / c)) - ((b / d) - ((a - 1) / d));
    cout << ans << endl;
}

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

int main() {
  string S; cin >> S;
  int N = S.length();
  
  bool flg = true;
  for (int i=0; i<N; i++) {
    if (i % 2 == 0) {
      if (S[i] != 'h') {
        flg = false;
        break;
      } 
    } else {
      if (S[i] != 'i') {
        flg = false;
        break;
      }
    }
  }
  
  if (N % 2 == 1) flg = false;
  
  if (flg) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N;
ll arr[55];
double A, B;

int main() {
	scanf("%lld", &N);
	for(int i = 0; i < N; i++) {
		scanf("%lld", &arr[i]);
	}
	sort(arr, arr + N);
	int flag = 0;
	double sum = 0;
	for(int i = 1; i < N; i++) {
		if(i == 1) {
			A = arr[0];
		}
		else {
			// cout << " ues";
			// cout << sum << " ";
			A = sum;
		}
		B = arr[i];
		// cout << A << " " << B << " " << sum << " " <<i<<" \n"; 
 		sum = (A + B) / 2.0;
		// cout << sum << " \n";
	}
	printf("%0.12lf\n", sum);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
#include <fstream>
#include <numeric>
#include <unordered_set>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
 
using namespace std;
 
#define ll long long
const int N = (ll)(2e5) + 100;
 
int div_cel(int n, int k) {
    return (n + k - 1) / k;
}

void solve() {
    int _sum = 0;
    int n,m;cin >> n >> m;
    int a[n + 1];
    for (int i = 1;i <= n;i ++) {
        cin >> a[i];
        _sum += a[i];
    }
    int need = (_sum / (4 * m));
    int cnt = 0;
    for (int i = 1;i <= n;i ++) {
        if (a[i] * (4*m)  >= _sum) ++ cnt;
    }
    if (cnt >= m) cout << "Yes";
    else cout << "No";
}
 
 
int main() {
    solve();
    return 0;
}

// 41 59 31
// 59 41 31
// 31 41 59


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline int read()
{
	int f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=100005;
int a[MAXN],b[MAXN],c[MAXN],d[MAXN],n;
int rt[MAXN],f[MAXN];
int findrt(int x){return rt[x]==x?rt[x]:rt[x]=findrt(rt[x]);}
map<int,int> id;
int main()
{
	n=read();int sum=0;
	for(int i=1;i<=n;i++)a[i]=read(),sum^=a[i];a[n+1]=sum;sum=0;
	for(int i=1;i<=n;i++)b[i]=read(),sum^=b[i];b[n+1]=sum;++n;
	for(int i=1;i<=n;i++)c[i]=a[i],d[i]=b[i];
	sort(c+1,c+1+n);sort(d+1,d+1+n);sum=0;
	for(int i=1;i<=n;i++)if(c[i]!=d[i])return pr2(-1),0;
	int tot=0;
	for(int i=1;i<n;i++)
	{
		if(a[i]!=b[i])
		{
			if(!id[a[i]])id[a[i]]=++tot;
			if(!id[b[i]])id[b[i]]=++tot;
		}
	}
	for(int i=1;i<=tot;i++)rt[i]=i;
	for(int i=1;i<n;i++)if(a[i]!=b[i])
	{
		++sum;
		int p=findrt(id[a[i]]),q=findrt(id[b[i]]);
		if(p!=q)rt[p]=q,f[q]=1;
	}int cnt=0;
	for(int i=1;i<=tot;i++)if(rt[i]==i)++cnt;
	if(!id[a[n]]||!f[findrt(id[a[n]])])++cnt;
	pr2(sum+cnt-1);
	return 0;
}


Measured memory_bytes: 9088
/// Bismillahir Rahmanir Rahim
//Author: Tanvir Hussain
//ICE,NSTU
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
const long long MOD = 1000000007;
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define SETBOOL(x) memset(x,false,sizeof(x))
#define CLR(x) memset(x, -1, sizeof(x))
#define mp make_pair
#define PII pair<int, int>
#define pf printf
#define sf scanf
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define no1 __builtin_popcount
#define BOUNDARY(i, j) ((i >= 0 && i < row) && (j >= 0 && j < column))
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define sz(a) int(a.size())
#define ff first
#define ss second
#define endl "\n"
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >


int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}
double sq(double x) {return x*x;}
void solve(){
    string s;
    cin>>s;
    int n=sz(s);
    rep(i,n) cout<<'x';
    cout<<endl;
}

signed main()

{
    IOS;
    /*#ifndef ONLINE_JUDGE
        freopen ("data.in","r",stdin);
        freopen ("data.out","w",stdout);
    #endif*/
    int t;
    t=1;
    while(t--){
        solve();
    }

     return 0;

}
///Alhamdulillah




Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**9


def f():
    s = input()
    l = len(s)
    sa = [c for c in s]
    m = 2**(l-1)
    r = 0
    for i in range(m):
        si = sa[0]
        for j in range(l-1):
            t = 2**j
            if i & t:
                si += '+'
            si += sa[j+1]
        r += eval(si)
    return r

print(f())


Measured memory_bytes: 7952
#include<bits/stdc++.h>
using namespace std;
#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef unsigned long long ull;
typedef long long ll;
typedef double db;

#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define mk make_pair
#define pi pair<int,int>
#define vi vector<int>
#define pL pair<ll,ll>
#define vL vector<ll>
#define vp vector<pi>
#define vpL vector<pL>

const int MX=2000000;
const int inf=1e9;
const ll mod=1000000007;

int main()
{
    FasterIO;

    ll h, w;
    cin>>h>>w;
    if(h==1 || w==1)
    {
        cout<<1<<endl; return 0;
    }
    ll r=h*w;
    if(r&1LL) r=r/2+1;
    else    r/=2;
    cout<<r<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
	int n;
	scanf("%d", &n);
	int a = 1;
	while (a <= n) a *= 2;
	printf("%d\n", a / 2);
	return 0;
}

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

int main() {
    int n, a, countmin, count;
    cin >> n;
    countmin = 999;
    count = 0;

    for (int i=0; i<n; i++) {
        cin >> a;
        count = 0;
        while (a%2==0) {
            a /= 2;
            count++;
        }
        if (count<countmin) countmin = count;
    }
    cout << countmin << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<ctime>
int last[500];
long long s[500][30];
long long c[30];
int tt[500];
int out[500];
int vis[30];
int bit[500][500];
long long sum[500];

void change(int t,int p,int v,int n){
    while(p<=n){
        bit[p][t] += v;
        p += (p&-p);
    }
}

int ask(int t,int p){
    int res = 0;
    while(p!=0){
        res += bit[p][t];
        p -= (p&-p);
    }
    return res;
}

int getAfter(int t,int p){
    int base = ask(t,p);
    if(ask(t,365)==base) return 366;
    else{
        int l = p+1, r = 365;
        int res = -1;
        while(l<=r){
            int m = (l+r)/2;
            if(ask(t,m)>base){
                res = m;
                r = m-1;
            }
            else l = m+1;
        }
        return res;
    }
}

int getBefore(int t,int p){
    int base = ask(t,p-1);
    if(base==0) return 0;
    else{
        base = ask(t,p-1);
        int l = 1, r = p-1;
        int res = -1;
        while(l<=r){
            int m = (l+r)/2;
            if(ask(t,m)>=base){
                res = m;
                r = m-1;
            }
            else l = m+1;
        }
        return res;
    }
}

long long getD(int d){
    for(int i = 1; i <= 26; i++) last[i] = 0;
    long long cur = 0;
    for(int i = 1; i <= d; i++){
        int t = tt[i];
        cur += s[i][t];
        last[t] = i;
        for(int j = 1; j <= 26; j++) cur -= c[j]*(i-last[j]);
    }
    return  cur;
}

int main(){
    sum[0] = 1;
    for(int i = 1; i <= 366; i++) sum[i] = sum[i-1]+i;
    srand(time(NULL));
    int d;
    scanf("%d",&d);
    for(int i = 1; i <= 26; i++) scanf("%lld",&c[i]);
    for(int i = 1; i <= d; i++){
        for(int j = 1; j <= 26; j++) scanf("%lld",&s[i][j]);
    }
    for(int i = 1; i <= d; i++){
        int find = 1;
        for(int j = 2; j <= 26; j++) if(s[i][j]>s[i][find]) find = j;
        tt[i] = find;
        change(find,i,1,365);
    }
    for(int i = 0; i < 300000; i++){
        int p = rand()%365+1;
        int a = tt[p], keep = tt[p];
        int last = getBefore(a,p), next = getAfter(a,p);
        long long base = -(sum[next-last-1]-sum[p-last-1]-sum[next-p-1])*c[a];
        long long add = 0;
        for(int j = 1; j <= 10; j++){
            int b = rand()%26+1;
            int last = getBefore(a,p), next = getAfter(a,p);
            last = getBefore(b,p), next = getAfter(b,p);
            long long cur = (sum[next-last-1]-sum[p-last-1]-sum[next-p-1])*c[b]+base+s[p][b]-s[p][a];
            if(cur>add){
                add = cur;
                keep = b;
            }
        }
        tt[p] = keep;       
        change(a,p,-1,365);
        change(keep,p,1,365);
    }
    for(int i = 1; i <= d; i++) printf("%d\n",tt[i]);
    return 0;
}


Measured memory_bytes: 2544
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define inv(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); }
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }
int bpm(int x, unsigned int y) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template <class T>
void cumulative_sum(T &container) {
  for (int i = 0; i < container.size() - 1; i++) container[i + 1] += container[i];
}

class C {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    string S;
    cin >> S;
    string T{};
    while (T.size() != S.size()) {
      if (S[T.size()] == 'd') {
        if (S[T.size() + 5] == 'e') {
          if (S[T.size() + 7] == 'a') {
            T += "dream";
          } else {
            T += "dreamer";
          }
        } else {
          T += "dream";
        }
      } else if (S[T.size()] == 'e') {
        if (S[T.size() + 5] != 'r') {
          T += "erase";
        } else {
          T += "eraser";
        }
      } else {
        cout << "NO" << endl;
        return;
      }
    }
    if (S == T) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
};


signed main() {
  C solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(){
  int test[5],ave = 0,i;
  for(i = 0;i < 5;i++){
  scanf("%d",&test[i]);
    if(test[i] >= 40){
      ave += test[i];
    }else{
      ave += 40;
    }
  }
  printf("%d\n",ave / 5);
  return 0;
}

Measured memory_bytes: 600
inf = 10**15
mod = 10**9+7

n,m,x = map(int, input().split())
san = [list(map(int, input().split())) for i in range(n)]
ans = inf
for i in range(2**n):
    cost = 0
    judge = [0 for i in range(m)]
    for j in range(n):  # このループが一番のポイント
        if ((i >> j) & 1):  # 1だったら(オンだったら)
            for k in range(m):
                judge[k] += san[j][k+1]
            cost+=san[j][0]
    flag = True
    for l in range(m):
        if judge[l] < x:
            flag = False
            break
    if flag:
        ans = min(ans,cost)
if ans == inf:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 69096
#include <bits/stdc++.h>
#include <iostream>
#define ll long long

using namespace std;

bool doneNode[100001];

int ans[100001];
pair<int, int> hen[100001];
unordered_set<int> used_color[100001];
vector<int> node_line[100001];

int colorNumber;

void search(int nodeIndex) {
  if (doneNode[nodeIndex]) {
    return;
  }
  doneNode[nodeIndex] = true;

  vector<int> queue;
  int next_color = 1;
  for (int lineIndex : node_line[nodeIndex]) {
    if (ans[lineIndex]) {
      continue;
    }

    int f = hen[lineIndex].first;
    int s = hen[lineIndex].second;

    while (true) {
      if ((used_color[f].find(next_color) != used_color[f].end())) {
        next_color++;
      } else if ((used_color[s].find(next_color) != used_color[s].end())) {
        next_color++;
      } else {
        break;
      }
    }
    ans[lineIndex] = next_color;
    colorNumber = max(colorNumber, next_color);

    used_color[f].insert(next_color);
    used_color[s].insert(next_color);
    next_color++;

    if (!doneNode[f]) {
      // search(f);
      queue.emplace_back(f);
    }
    if (!doneNode[s]) {
      // search(s);
      queue.emplace_back(s);
    }
  }

  for (int i = 0; i < queue.size(); i++) {
    search(queue[i]);
  }
}

int main() {
  int n;
  scanf("%d", &n);

  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);

    hen[i] = make_pair(a - 1, b - 1);

    node_line[a - 1].emplace_back(i);
    node_line[b - 1].emplace_back(i);
  }

  search(0);

  cout << colorNumber << endl;
  for (int i = 0; i < n - 1; i++) {
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 26240
A = list(input())

A,B,C,D = A[0],A[1],A[2],A[3]

for op1 in ['+','-']:
    for op2 in ['+','-']:
        for op3 in ['+','-']:
            if eval(A+op1+B+op2+C+op3+D) == 7:
                print(A+op1+B+op2+C+op3+D+'=7')
                exit()
                

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int> odd, even;
  int a;
  for(int i = 0; i < N; i++) {
    cin >> a;
    if(i % 2 == 0) odd.push_back(a);
    else even.push_back(a);
  }
  
  if(N % 2 == 0) {
    reverse(even.begin(), even.end());
    for(int b: even) cout << b << ' ';
    for(int b: odd) cout << b << ' ';
  } else {
    reverse(odd.begin(), odd.end());
    for(int b: odd) cout << b << ' ';
    for(int b: even) cout << b << ' ';
  }
  cout << endl;
  return 0;
}

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

//Dijkstra
const long long inf=1e15;
const int max_v=400;
struct edge { int to; long long cost; };
typedef pair<long long, int> P;
int v;//頂点数
vector<edge> g[max_v]; //各頂点の情報を持つ
long long d[max_v][max_v]; //最短距離
long long f[max_v][max_v]; //最短距離
long long l;
void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d[s], d[s] + v, inf);
    fill(f[s], f[s] + v, inf);
    d[s][s] = 0;
    f[s][s] = 0;
    que.push(P(0, s));
    while (!que.empty()) {
        P p = que.top(); que.pop();
        int w = p.second;
        if (d[s][w] < p.first) continue;
        for (int ii = 0; ii < g[w].size(); ii++) {
            edge e=g[w][ii];
            long long memo;
            if(f[s][w]+e.cost>l) memo = 1;
            else memo = 0;
            long long memo2;
            if(memo==0) memo2 = f[s][w] + e.cost;
            else memo2 = e.cost;
            if (d[s][e.to] > d[s][w] + memo) {
                d[s][e.to] = d[s][w] + memo;
                f[s][e.to] = memo2;
                que.push(P(d[s][e.to], e.to));
            } else if (d[s][e.to] == d[s][w] + memo && memo2 < f[s][e.to]) {
                d[s][e.to] = d[s][w] + memo;
                f[s][e.to] = memo2;
                que.push(P(d[s][e.to], e.to));
            } 
        }
    }
}

int main() {
	// your code goes here
	int m,i,j,aa,bb;
	long long cc;
	cin >> v >> m >> l;
	for(i=0;i<v;i++){
		for(j=0;j<v;j++){
			if(i!=j) d[i][j]=inf;
		}
	}
	for(i=0;i<m;i++){
		cin >> aa >> bb >> cc;
		if(cc<=l){
			edge e;
			e.to=bb-1; e.cost=cc;
			g[aa-1].push_back(e);
			e.to=aa-1; e.cost=cc;
			g[bb-1].push_back(e);
		}
	}
	for(i=0;i<v;i++){
		dijkstra(i); 
	}
	int q,r;
	cin >> q;
	for(r=0;r<q;r++){
		int s,t;
		cin >> s >> t;
		s--; t--;
		if(d[s][t]==1e15){
			cout << "-1" << endl;
		} else {
			cout << d[s][t] << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 4736
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String p, s;
        p= sc.next();
        s= sc.next();
        String st=p+p; 
        int result = st.indexOf(s);
        if(result==-1)System.out.println("No");
        else System.out.println("Yes");
    }
}


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

const int N = 9;

int n, m, ans = 0;
bool a[N][N], b[N]={};

void dfs(int u, int cnt){
    if(cnt == n) ans++;
    for(int v=1; v<=n; v++)
        if(!b[v] && a[u][v]){
            b[v] = true;
            dfs(v,cnt+1);
            b[v] = false;
        }
}

int main(){
    memset(a, false, sizeof a);
    memset(b, false, sizeof b);
    cin>> n>> m;
    for(int i=0; i<m; i++){
        int u, v; cin>> u>> v;
        a[u][v] = a[v][u] = true;
    }

    b[1] = true;
    dfs(1,1);

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


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

vector<P> g[1010][1010];
int dv[1010][1010],d[1010][1010];

queue<P> q;

int main(void){
	int n,m=0,i,j,a,b,x,y,ans=0;
	bool flag = true;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a; --a;
		for(j=2; j<n; ++j){
			cin >> b; --b;
			g[max(i,a)][min(i,a)].push_back(P(max(i,b),min(i,b)));
			++dv[max(i,b)][min(i,b)];
			a = b;
		}
	}
	for(i=0; i<n; ++i){
		for(j=0; j<i; ++j){
			++m;
			if(!dv[i][j]){
				--m;
				q.push(P(i,j));
			}
		}
	}
	while(!q.empty()){
		flag = false;
		a = q.front().first;
		b = q.front().second;
		q.pop();
		for(i=(g[a][b].l_ength()-1); i>=0; --i){
			x = g[a][b][i].first;
			y = g[a][b][i].second;
			--dv[x][y];
			if(dv[x][y]<0){
				flag = true;
				break;
			}
			if(!dv[x][y]){
				--m;
				d[x][y] = d[a][b] + 1;
				q.push(P(x,y));
			}
		}
		if(flag){
			break;
		}
	}
	if(flag || m){
		cout << "-1" << endl;
		return 0;
	}
	for(i=0; i<n; ++i){
		for(j=0; j<i; ++j){
			ans = max(ans,d[i][j]+1);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 47744
S=list(input())
str1=""
str2=""
flag=0
for i in range(7):
    str1+=S[i]
    str2+=S[len(S)-7]

if str1=="keyence"or str2=="keyence":
    flag=1
s=""
t=""
for i in range(7):
    for j in range(i):
        s+=S[j]
    for j in range(7-i):
        t+=S[len(S)-7+i+j]
    if s+t=="keyence":
        flag=1
    s=""
    t=""
if flag==1:
    print("YES")
else:
    print("NO")



Measured memory_bytes: 3064
import bisect

N,D,A = map(int,input().split())
mons = []; X = []; need = [0]*N; bomb_range = []

for _ in range(N):
    x,h = map(int,input().split())
    mons.append([x,h])
mons = sorted(mons)

for i in range(N):
    X.append(mons[i][0])
    need[i] = mons[i][1] // A
    if mons[i][1] % A != 0: need[i] += 1

for i in range(N):
    bomb_range.append(bisect.bisect_right(X,X[i] + 2*D))

if N == 1:
    ans = need[0]
else:
    # imos setting
    imos = [0]*(N+1)
    imos[0] = need[0]
    imos[bomb_range[0]] = - need[0]
    #
    ans = need[0]
    for i in range(1,N):
        imos[i] += imos[i-1]
        bomb = need[i] - imos[i]
        if bomb > 0:
            ans += bomb
            imos[i] += bomb
            imos[bomb_range[i]] -= bomb
        else:
            continue

print(ans)

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


using namespace std;

int main(){
    int H,W,a;
    scanf("%d%d",&H,&W);
    int A[H][W];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            scanf("%d",&a);
            A[i][j] =a;
        }
    }
    int road_sum=0;
    vector<int> RS;
    for(int kh = 0; kh<H;kh++){
        for(int kw=0;kw<W;kw++){
            for(int i=0;i<H;i++){
                for(int j=0;j<W;j++){
                    if(abs(kh-i)>abs(kw-j)){
                        road_sum += abs(kw-j)*A[i][j];
                    }
                    else{
                        road_sum += abs(kh-i)*A[i][j];
                    }
                }
            }
            RS.push_back(road_sum);
            // printf("%d\n",road_sum);
            road_sum =0;
        }
    }

    printf("%d\n",*min_element(RS.begin(),RS.end()));

    return 0;
}


Measured memory_bytes: 3304
n,k,q = map(int,input().split())
a = [int(input()) for _ in range(q)]
b = [0] * n
for i in a:
    b[i-1] += 1
c = k - q
for j in range(n):
    if (b[j]+c) > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 13640
<?php
list($D,$N)= explode(" ",trim(fgets(STDIN)));
if($D ==2){
  $N = ($N+floor($N/100)) *10000;
echo "$N";
}elseif($D==1){
  $N = ($N+floor($N/100)) * 100 ;
echo "$N";
}else{
echo "$N" + floor($N/100)+ floor($N/10000);
}

Measured memory_bytes: 3700
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  int k;
  cin >> k;
  string s;
  cin >> s;
  int n = s.size();
  
  if(n <= k){
	cout << s << endl;
    return 0;
  }
  else{
    REP(i,k){
	  cout << s[i];
    }
  }
  cout << "..." << endl;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("Ofast")
#pragma GCC optimization ("unroll-loops, no-stack-protector")
#pragma GCC target ("avx")
#pragma GCC target ("avx2")
#pragma GCC target ("fma")
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#define ordered_set tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update>
#pragma 03
using namespace std;
using namespace __gnu_pbds;
ll dp[3005][3005];
ll mod = 998244353;
ll a, b, c, d;
ll calc(ll x, ll y){
	if (dp[x][y] != -1) return dp[x][y];
	if ((x > c) || (y > d)) return dp[x][y] = 0;
	if ((x == c) && (y == d)) return dp[x][y] = 1;
	dp[x][y] = ((calc(x + 1, y) * y) + (calc(x, y + 1) * x) - calc(x + 1, y + 1) * x * y);
	dp[x][y] %= mod; dp[x][y] += mod; if (dp[x][y] > mod) dp[x][y] -= mod;
	return dp[x][y];
}
int main(){
	for (ll i = 0; i < 3005; i++) for (ll j = 0; j < 3005; j++) dp[i][j] = -1;
	cin >> a >> b >> c >> d; cout << calc(a, b) << endl;
}

Measured memory_bytes: 74508
# coding: utf-8

count_dic = {}

item_count = int(input().rstrip())

for i in range(item_count):
    w = input().rstrip()
    if w in count_dic:
        count_dic[w] += 1
    else:
        count_dic[w] = 1
max_count = max(count_dic.values())
keys = [k for k,v in count_dic.items() if v == max_count]
for k in sorted(keys):
    print(k)

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

int main(){
  int i,j,cnt=0;
  string s;
  cin>>s;
  if(s[0]!='A')s='A'+s;
  if(s.substr(0,4)!="AKIH"){
    cout<<"NO";
    return 0;
  }
  s=s.substr(4);
  if(s[0]!='A')s='A'+s;
  if(s.substr(0,2)!="AB"){
    cout<<"NO";
    return 0;
  }
  s=s.substr(2);
  if(s[0]!='A')s='A'+s;
  if(s.substr(0,2)!="AR"){
    cout<<"NO";
    return 0;
  }
  s=s.substr(2);
  if(s=="" || s=="A"){
    cout<<"YES";
  }else cout<<"NO";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

vector<vector<bool>> root;
lint N;
lint Search(lint count, set<lint> through, lint current)
{
	through.insert(current);

	if (through.size() == N)
		return count + 1;

	for (int i = 0; i < N; i++)
	{
		if (root[current][i] && through.count(i) == 0)
			count = Search(count, through, i);
	}
	through.erase(current);
	return count;
}
void execute()
{
	int M;
	cin >> N >> M;

	root = vector<vector<bool>>(N, vector<bool>(N, false));

	for (int i = 0; i < M; i++)
	{
		int tmp1, tmp2;
		cin >> tmp1 >> tmp2;
		root[tmp1 - 1][tmp2 - 1] = true;
		root[tmp2 - 1][tmp1 - 1] = true;
	}
	set<lint> through;

	cout << Search(0, through, 0) << endl;

	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	char s[4];	scanf("%s",s);
	int t[4]; t[0]=s[0]-48; t[1]=s[1]-48; t[2]=s[2]-48; t[3]=s[3]-48;
	int a[2];
	a[0]=t[0]*10+t[1];	a[1]=t[2]*10+t[3];
	int b[2];	b[0]=0;	b[1]=0;
	if(a[0]>12) b[0]=1;
	if(a[0]==0) b[0]=2;
	if(a[1]>12) b[1]=1;
	if(a[1]==0)	b[1]=2;

	if(b[0]+b[1]==0) printf("AMBIGUOUS");
	if(b[0]+b[1]==3||b[0]+b[1]==4||(b[0]==1&&b[1]==1)) printf("NA");
	if(b[0]==0&&(b[1]==1||b[1]==2)) printf("MMYY");
	if((b[0]==1||b[0]==2)&&b[1]==0) printf("YYMM");
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <set>
using namespace std;
int main(){
  int N;
  set<int> kuku;
  for(int a=1;a<10;a++)
    for(int b=1;b<10;b++)
      kuku.insert(a*b);
  cin >> N;
  if(kuku.end()!=kuku.find(N))cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  vector<int> q(n);
  for(int i = 0; i < n; i++) cin >> p[i];
  for(int i = 0; i < n; i++) cin >> q[i];
  vector<int> a(n);
  for(int i = 0; i < n; i++) a[i] = i+1;
  map<vector<int> ,int> mp;
  do{
    mp[a] = mp.size();
  }while (next_permutation(a.begin(), a.end()));
  int ans = abs(mp[p] - mp[q]);
  cout << ans << endl;
}

Measured memory_bytes: 5248
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var s = Console.ReadLine();
		
		if(s == "RRR")
		{
			Console.WriteLine(3);
		}
		else if(s == "RRS" || s == "SRR")
		{
			Console.WriteLine(2);
		}
		else if(s.Contains("R"))
		{
			Console.WriteLine(1);
		}
		else
		{
			Console.WriteLine(0);
		
		}
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

class HeapQueue<T> where T : IComparable<T>
{
	private List<T> _buffer;
	private Comparison<T> _comparer;
	
	public HeapQueue()
	{
		_buffer = new List<T>();
	}
	
	public HeapQueue(int capacity, Comparison<T> comparer = null)
	{
		_buffer = new List<T>(capacity);

		_comparer = comparer;
	}
	
	public void Push(T el)
	{
		List<T> array = _buffer;
		int n = array.Count;
		array.Add(el);
		
		while (n != 0)
		{
			int i = (n - 1) / 2;
			if (Compare(array[n], array[i]) > 0)
			{
				T tmp = array[n]; array[n] = array[i]; array[i] = tmp;
			}
			n = i;
		}
	}
	
	public T Pop()
	{
		T el = _buffer[0];
		
		List<T> array = _buffer;
		
		int n = array.Count - 1;
		array[0] = array[n];
		array.RemoveAt(n);

		for (int i = 0, j; (j = 2 * i + 1) < n; )
		{
			if ((j != n - 1) && (Compare(array[j], array[j + 1]) < 0))
				j++;
			if (Compare(array[i], array[j]) < 0)
			{
				T tmp = array[j]; array[j] = array[i]; array[i] = tmp;
			}
			i = j;
		}
		return el;
	}
	
	public T Peep()
	{
		if(_buffer.Count <= 0)
			return default(T);

		return _buffer[0];
	}
	private int Compare(T left, T right)
	{
		if(_comparer == null)
			return left.CompareTo(right);
		return _comparer(left, right);
	}
	
	public int Count
	{
		get{ return _buffer.Count; }
	}
	
}


Measured memory_bytes: 25796
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
string s;
int main(){
	cin>>s;
	if(s[5]>'0'){
		cout<<"TBD";
		return 0;
	}
	if(s[6]>'4'){
	cout<<"TBD";
	return 0;
}
	if(s[6]<'4'){
	cout<<"Heisei";
	return 0;
	}
	if(s[8]<'3'&&s[6]<='4'){
	cout<<"Heisei";
	return 0;
}
	if(s[8]<='3'&&s[6]<='4'&&s[9]=='0'){
	cout<<"Heisei";
	return 0;
}
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

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

int n;
vector<ll> A;

const int  MAX = 2000000;

vector<int> prime;
bool isntprime[MAX+1];
	
void solve() {
  map<int,int> mp;
  rep(i,n) mp[A[i]]++;
  set<int> BAN;
  for(auto tmp : mp) {
    if( tmp.snd != 1 ) {
      BAN.insert(tmp.fst);
    }
  }
  sort(ALL(A));
  A.erase(unique(ALL(A)),A.end());
  int cnt = 0;
  int j;
  rep(id,(int)A.size()) {
    int i = A[id];
    if(!isntprime[i]) {
      if( !BAN.count(i) ) {
	++cnt;
      }
      for(j=2*i;j<=MAX;j+=i)isntprime[j] = true;
    }
  }
  cout << cnt << endl;
}

int main() {
  cin >> n;
  A.resize(n);
  rep(i,n) cin >> A[i];
  solve();
  return 0;
}


Measured memory_bytes: 16196
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

int main(void) {
    int i, n;
    scanf("%d",&n);
    int l = 0, r = 1e7;
    while (l + 1 < r) {
        int m = (l + r) / 2;
        int rest = n;
        RREP (i,m,1) if (rest >= i) {
            rest -= i;
        }
        if (rest == 0)
            r = m;
        else
            l = m;
    }
    int rest = n;
    RREP (i,r,1) if (rest >= i) {
        rest -= i;
        printf("%d\n",i);
    }
    return 0;
}


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

int main(){
    int n,k=0;
    
    cin>>n;
  vector<int> a(n);
    rep(i,n){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    rep(i,n-1){
        if(a[i]==a[i+1]){
            k=1;
        }
    }
    if(k==1){
        cout<<"NO";
    }else{
        cout<<"YES";
    }
}

Measured memory_bytes: 3956
from itertools import accumulate
import heapq
n,m,s,t=map(int, input().split())
s-=1
t-=1
yen=[{} for _ in range(n)]
snk=[{} for _ in range(n)]
for _ in range(m):
    u,v,a,b=map(int, input().split())
    u-=1    
    v-=1    
    yen[u][v]=a
    yen[v][u]=a
    snk[u][v]=b
    snk[v][u]=b
 
def dijkstra(s, t, g):
    q=[]
    d=[float('inf')]*n
    d[s]=0
    heapq.heappush(q, (d[s], s))
    while q!=[]:
        du, u=heapq.heappop(q)
        if du>d[u]:
            continue
        for v in g[u]:
            if d[v]>du+g[u][v]:
                d[v]=du+g[u][v]
                heapq.heappush(q, (d[v], v))
    return d
 
d1=dijkstra(s, t, yen)
d2=dijkstra(t, s, snk)
ans=list(accumulate(reversed([y+s for y,s in zip(d1, d2)]), min))
for ai in reversed(ans):
    print(10**15-ai)


Measured memory_bytes: 94660
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;


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

    char c;
    cin >> c;

    cout << char(c+1) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
int n, b, f, r, v, i, j, k;
int room[5][4][11] = {{{0}}};

scanf("%d",&n);

while(n > 0){
scanf("%d %d %d %d",&b,&f,&r,&v);
room[b][f][r] += v;
n --;
}

for(i = 1; i <= 4; i++){
 for(j = 1; j <= 3; j++){
  for(k = 1; k <= 10; k++)
printf("%2d",room[i][j][k]);

printf("\n");
}
if(i != 4){
n = 0;
while(n < 20){
putchar('#');
n++;
}
printf("\n");
}

}
return 0;
}

Measured memory_bytes: 616
#include<stdio.h>
int main(void)
{
  int n,m;
  scanf("%d%d",&n,&m);
  int ans[n+1],tmp[n+1],flag=0;
 
  for(int i=0;i<=n;i++){
    ans[i]=0;
    tmp[i]=0;
  }
  for(int i=0;i<m;i++){
    int s,c;
    scanf("%d%d",&s,&c);
    //printf("%d %d\n",s,c);
    tmp[s]++;
    if(tmp[s]==1) ans[s]=c;
    else if(tmp[s]>1){
      if(ans[s]!=c){
        flag=1;
        break;
      }
    }
  }
  if(tmp[1]==0 && n>1) ans[1]=1;
  if((tmp[1]>0) && (ans[1]==0) && (n>1)) flag=1;
  if(flag==1) printf("-1");
  else if(flag==0){
    for(int i=1;i<=n;i++) printf("%d",ans[i]);
  }
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

const int MAX = 510000;
const int MOD = 1000000007;

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){

  ll n;cin>>n;
  ll a[n];rep(i,0,n)cin>>a[i];
  vector<ll>v;
  COMinit();

  map<ll,ll>mp;
  rep(i,0,n){
    if(mp[a[i]]==0)v.push_back(a[i]);
    mp[a[i]]++;
  }
  ll sum=0;
  rep(i,0,v.size()){
    sum+=mp[v[i]]*(mp[v[i]]-1)/2;
  }

  rep(i,0,n){
    ll ans=sum-mp[a[i]]*(mp[a[i]]-1)/2;
    if((mp[a[i]]-1)*(mp[a[i]]-2)/2<0)out(ans);
    else out(ans+(mp[a[i]]-1)*(mp[a[i]]-2)/2);
  }


  return 0;
}


Measured memory_bytes: 25716
h, _w = gets.chomp.split(' ').map(&:to_i)
su = 'snuke'
h.times do |i|
  s = gets.chomp.split(' ')
  s.each_with_index do |x, j|
    next unless x == su

    ans = ('A'.ord + j).chr << (i + 1).to_s
    print ans
    exit
  end
end


Measured memory_bytes: 14264
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  vector<string>s(n);
  for(int i=0;i<n;i++){
    cin >> s.at(i);
  }
  sort(s.begin(),s.end());
  int ans=0,cnt=1;
  vector<int>j(n,0);
  j.at(0)=1;
  for(int i=1;i<n;i++){
    if(s.at(i-1)==s.at(i)){
      cnt++;
    }
    ans=max(ans,cnt);
    if(s.at(i-1)!=s.at(i)){
      cnt=1;
    }
    j.at(i)=cnt;
  }
  for(int i=0;i<n;i++){
    if(j.at(i)==ans){
      cout << s.at(i) << endl;
    }
  }
}


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

using namespace std;
typedef long long ll;

int d[31][31];
int c[501][501];
ll ans[3][31];

int main(void) {
    int N, C;
    cin >> N >> C;
    for(int i=1; i<=C; i++) for(int j=1; j<=C; j++) {
        scanf("%d", &d[i][j]);
    }
    for(int i=1; i<=N; i++) for(int j=1; j<=N; j++) {
        scanf("%d", &c[i][j]);
    }

    for(int cc=1; cc<=C; cc++) {
        for(int i=1; i<=N; i++) {
            for(int j=1-(i-1); j<=N; j+=3) {
                if(j<=0) continue;
                ans[0][cc] += d[c[i][j]][cc];
            }
        }
        for(int i=1; i<=N; i++) {
            for(int j=2-(i-1); j<=N; j+=3) {
                if(j<=0) continue;
                ans[1][cc] += d[c[i][j]][cc];
            }
        }
        for(int i=1; i<=N; i++) {
            for(int j=3-(i-1); j<=N; j+=3) {
                if(j<=0) continue;
                ans[2][cc] += d[c[i][j]][cc];
            }
        }
    }

    ll res = INT32_MAX;
    for(int cc0=1; cc0<=C; cc0++) {
        for(int cc1=1; cc1<=C; cc1++) {
            for(int cc2=1; cc2<=C; cc2++) {
                if(cc0 == cc1 || cc1 == cc2 || cc2 == cc0) continue;
                res = min(res, ans[0][cc0]+ans[1][cc1]+ans[2][cc2]);
            }
        }
    }
    return !printf("%lld\n", res);
}

Measured memory_bytes: 1280
n = gets.to_i
t = n.times.map{gets.chomp.split(" ").map(&:to_i)}.unshift([0,0,0])
for i in 1..n
  unless (t[i][1]-t[i-1][1]).abs+(t[i][2]-t[i-1][2]).abs <= t[i][0]-t[i-1][0] && ((t[i][1]-t[i-1][1])+(t[i][2]-t[i-1][2]))%2 == (t[i][0]-t[i-1][0])%2
    puts "No"
    exit
  end
end
puts "Yes"

Measured memory_bytes: 9724
package main

import "fmt"
var N, K int
var u, w, v int
var dp, arr []int
var DP, mat [][]int
var vis, dist []int

const (
	MaxInt = 1<<31 - 1
	MinInt = -MaxInt - 1
	MOD = int(1e9) + 7
)
func addSelf(a *int, b int) {
	*a += b
}

func subSelf(a *int, b int) {
	*a -= b
}

func addSelfMOD(a *int, b int) {
	addSelf(a, b)
	if *a > MOD {
		*a -= MOD
	}
}

func subSelfMOD(a *int, b int) {
	subSelf(a, b)
	if *a < 0 {
		*a += MOD
	}
}
func max(a, b int) int {
	if a > b { return a }
	return b
}

func min(a, b int) int {
	if a < b { return a }
	return b
}

func abs(a int) int {
	if a < 0 { return -a }
	return a
}

func main() {
	_,e := fmt.Scanf("%d%d", &N, &K)
	if e != nil { return }
	dp = make([]int, K+1)
	dp[0] = 1
	for i:=0; i<N; i++ {
		_,e = fmt.Scanf("%d", &u)
		if e != nil { return }
		fake := make([]int, K+1)
		for used:=K; used>=0; used-- {
			tmp, L,R := dp[used], used+1, used + min(u, K-used)
			if L<=R {
				addSelfMOD(&fake[L], tmp)
				if R+1 <= K {
					subSelfMOD(&fake[R+1], tmp)
				}
			}
		}
		prefix := 0
		for i := range fake {
			addSelfMOD(&prefix, fake[i])
			addSelfMOD(&dp[i], prefix)
		}
	}
	fmt.Println(dp[K]%MOD)
}


Measured memory_bytes: 6968
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

using namespace std;
using ll = long long;

int main()
{
    // 整数の入力
    rep(i,5){
        int a;
        cin >> a;
        if(a == 0){
            cout << i+1 << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 3592