akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

#define LEN 4

int isCollect(char s[LEN]);

int main(void) {

    char s[LEN];
    scanf("%s", s);

    if ( isCollect(s) ) {
        puts("Yes");
    } else {
        puts("No");
    }

    return 0;
}

int isCollect(char s[LEN]) {
    if ( s[0] == s[1] ) {
        return s[2] == s[3] && s[0] != s[2];
    } else if ( s[0] == s[2] ) {
        return s[1] == s[3] && s[0] != s[1];
    } else if ( s[0] == s[3] ) {
        return s[1] == s[2] && s[0] != s[1];
    } else {
        return 0;
    }
}

Measured memory_bytes: 128
# https://atcoder.jp/contests/abc173/tasks/abc173_b

N = int(input())
D = {
    "AC": 0,
    "WA": 0,
    "TLE": 0,
    "RE": 0
}

for _ in range(N):
    s = input()
    D[s] += 1

for status in ["AC", "WA", "TLE", "RE"]:
    print("%s x %d" % (status, D[status]))


Measured memory_bytes: 9192
import java.io.PrintWriter;
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

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

        out.println(a * b);
        out.flush();
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 35912
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
typedef struct edge{
  edge(int a, int b):to(a),cost(b){};
  int to, cost;
}edge;
typedef struct state{
  state(int a, int b):v(a),cost(b){};
  int v, cost;
  bool operator<(const state s)const{return cost < s.cost;}
  bool operator>(const state s)const{return cost > s.cost;}
}state;

int dijkstra(vector<vector<edge> > &g, int start, int goal){
  priority_queue<state, vector<state>, greater<state> > que;
  que.push(state(start, 0));
  vector<int> ans(g.size(), 1e9);
  ans[start] = 0;
  while(not que.empty()){
    int v = que.top().v;
    int c = que.top().cost;
    que.pop();
    if(ans[v] < c)continue;
    if(v == goal)break;
    for (int i = 0; i < g[v].size(); i++) {
      int nv = g[v][i].to;
      if(ans[nv] > c + g[v][i].cost){
        ans[nv] = c + g[v][i].cost;
        que.push(state(nv, ans[nv]));
      }
    }
  }
  return ans[goal];
}

int main(){
  int n, m;
  std::cin >> n >> m;
  vector<vector<edge> > g(n);
  for (int i = 0; i < m; i++) {
    int a, b, c, d;
    scanf("%d,%d,%d,%d", &a, &b, &c, &d);
    a--, b--;
    g[a].push_back(edge(b, c));
    g[b].push_back(edge(a, d));
  }
  int start, goal, v, p;
  scanf("%d,%d,%d,%d", &start, &goal, &v, &p);
  start--, goal--;
  std::cout << v - p - (dijkstra(g, start, goal) + dijkstra(g, goal, start)) << std::endl;
  
  return 0;
}

Measured memory_bytes: 3124
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ppb pop_back()
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

void chmax2(Pll &a,Pll b){
    if(a.fi<b.fi){
        a.se=max(a.fi,b.se);
        a.fi=b.fi;
    }else{
        a.se=max(a.se,b.fi);
    }
}

const ll INF = 1e12;
signed main(){
    int n; cin >> n;
    vector<ll> a(1<<n);
    vector<Pll> dp(1<<n);
    rep(i,1<<n){
        cin >> a[i];
        dp[i]={a[i],-INF};
    }
    rep(i,n){
        rep(j,1<<n){
            if(j&(1<<i)){
                chmax2(dp[j],dp[j^(1<<i)]);
            }
        }
    }
    ll res=-INF;
    rep(i,1<<n){
        ll ans=dp[i].fi+dp[i].se;
        chmax(res,ans);
        if(i) cout << res << endl;
    }
}


Measured memory_bytes: 9216
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
	while(true){
		int n,r;
		cin >> n >> r;
		if (n == 0 && r == 0) break;
		int cards[2][n];
		for (int i=0;i<n;++i){
			cards[0][i] = n-i;
			cards[1][i] = n-i;
		}
		for (int i=0;i<r;++i){
			int f = i%2;
			int t = (i+1)%2;
			int p,c;
			cin >> p >> c;
			for (int l=0;l<p-1;++l){
				cards[t][l+c] = cards[f][l];
			}
			for (int l=p-1;l<p+c-1;++l){
				cards[t][l-(p-1)] = cards[f][l];
			}
			for (int l=p+c-1;l<n;++l){
				cards[t][l] = cards[f][l];
			}
		}
		int t = r%2;
		cout << cards[t][0] << endl;

	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#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 all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define bit(k) (1LL<<(k))
typedef long long ll;

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/
const ll mod = 1e9+7;

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

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() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    COMinit();

    ll N,K;
    cin>>N>>K;
    vector<ll> A(N);
    rep(i,N)cin>>A[i];
    sort(all(A));

    ll ans = 0;
    rep(i,N){
        ll l = i;
        ll r = N - i - 1;
        ans += A[i] * COM(l,K-1);
        ans -= A[i] * COM(r,K-1);
        chmod(ans);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 24448
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  int a=0,b=0;
  cin>>s;
  for(int i=0;i<3;i++)
  {
    if(s[i]=='A')
      a++;
    
    if(s[i]=='B')
      b++;
  }
  if(a==3 || b==3)
    cout<<"No";
  else
    cout<<"Yes";
  return 0;
}


Measured memory_bytes: 256
#include <queue>
#include <tuple>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>

#pragma warning(disable : 4996)

using namespace std;

int N, M, C, A, B, E; long long sum;

vector<long long> P;

vector<tuple<int, int, int> > edges;

vector<vector<pair<int, int> > > G;

int main()
{
	scanf("%d", &N);
	scanf("%d", &M);
	scanf("%d", &C);

	G.resize(N);

	for (int i = 0; i < M; i++)
	{
		scanf("%d", &A);
		scanf("%d", &B);
		scanf("%d", &E);

		sum += E;

		G[A - 1].push_back(make_pair(B - 1, E));
		G[B - 1].push_back(make_pair(A - 1, E));

		edges.push_back(make_tuple(A - 1, B - 1, E));
	}

	vector<long long> D(N, 999999999999999999LL); D[0] = 0;

	priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > que;

	que.push(make_pair(0LL, 0));

	while (!que.empty())
	{
		pair<long long, int> p1 = que.top(); que.pop();

		long long dist = p1.first;

		int node = p1.second;

		for (int i = 0; i < G[node].size(); i++)
		{
			if (D[G[node][i].first] > D[node] + G[node][i].second)
			{
				D[G[node][i].first] = D[node] + G[node][i].second;

				que.push(make_pair(D[G[node][i].first], G[node][i].first));
			}
		}
	}

	vector<pair<long long, int> > I;

	for (int i = 0; i < M; i++)
	{
		I.push_back(make_pair(max(D[get<0>(edges[i])], D[get<1>(edges[i])]), get<2>(edges[i])));
	}

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

	vector<long long> J; for (int i = 0; i < M; i++) J.push_back(I[i].first);

	vector<int> K; for (int i = 0; i < M; i++) K.push_back(I[i].second);

	long long ret = 999999999999999999LL;

	for (int i = 0; i < N; i++)
	{
		long long cost = C * D[i] + sum;

		int ptr = upper_bound(J.begin(), J.end(), D[i]) - J.begin();

		for (int j = 0; j < ptr; j++)
		{
			cost -= K[j];
		}

		ret = min(ret, cost);
	}

	printf("%lld\n", ret);

	return 0;
}

Measured memory_bytes: 22280
#include <iostream>
#include <stdlib.h> //malloc

using namespace std;

#define M_MAX 500001

struct Node {
  int key;
  Node *right, *left, *parent;
};

void insert(int v);
void preorder(Node *u);
void inorder(Node *u);
int findNode(Node *u, int v);
void deleteNode(Node *u, int v);

Node *root = NULL;

int main(){
  int m, x;
  string command;

  cin >> m;

  while (m > 0) {
    cin >> command;

    if (command == "insert") {
      cin >> x;
      insert(x);
    }
    else if (command == "find") {
      cin >> x;
      if ( findNode(root, x) )
	cout << "yes" << endl;
      else
	cout << "no" << endl;
    }
    else if (command == "delete") {
      cin >> x;
      deleteNode(root, x);
    }
    else if (command == "print"){
      inorder(root);
      cout << endl;
      preorder(root);
      cout << endl;
    } else {
      cout << "Unknown command" << endl;
    }

    m--;
  }

  return 0;
}

void insert(int v) {
  Node *n, *x, *p;
  n = (Node *)malloc(sizeof(Node));
  n->key = v;
  n->parent = n->left = n->right = NULL;

  x = root;
  p = NULL;
  while (x != NULL) {
    p = x;
    if (v < x->key)
      x = x->left;
    else
      x = x->right;
  }

  if (p == NULL) {
    root = n;
    return;
  }

  x = n;
  n->parent = p;

  if (n->key < p->key)
    p->left = n;
  else
    p->right = n;
}

void preorder(Node *u){
  if (u == NULL) return;

  cout << " " << u->key;
  preorder(u->left);
  preorder(u->right);
}

void inorder(Node *u){
  if (u == NULL) return;

  inorder(u->left);
  cout << " " << u->key;
  inorder(u->right);
}

//???????????£?????????
//????????????????????????
int findNode(Node *u, int v) {
  if (u == NULL) return 0;

  if (u->key == v)
    return 1;
  else if (u->key > v)
    return findNode(u->left, v);
  else
    return findNode(u->right, v);
}

void deleteNode(Node *u, int v) {
  Node *p;

  while (u->key != v) {
    if (u->key > v) u = u->left;
    else u = u->right;
  }

  //????????????
  if (u->left == NULL && u->right == NULL) {    //??????????????´???
    if (u == root) {
      root = NULL;
      free(u);
      return;
    }

    p = u->parent;

    if (p->key > v) p->left = NULL;
    else p->right = NULL;

    free(u);
  }
  else if (u->left != NULL && u->right != NULL) {  //????????????????????´???
    //?????????u????????¨?????¨???????°?????????????????????£??\????????????????°?????????????????????????
    p = u->right;
    while (p->left != NULL) {
      p = p->left;
    }
    u->key = p->key;
    deleteNode(p, p->key);
  }
  else if (u->left != NULL) { //?????????????????´???
    if (u == root) {
      root = u->left;
      u->left->parent = NULL;
      free(u);
      return;
    }
    u->left->parent = u->parent;
    if (u->parent->key > v) u->parent->left = u->left;
    else u->parent->right = u->left;
    free(u);
  }
  else { //?????????????????´???
    if (u == root) {
      root = u->right;
      u->right->parent = NULL;
      free(u);
      return;
    }
    u->right->parent = u->parent;
    if (u->parent->key > v) u->parent->left = u->right;
    else u->parent->right = u->right;
    free(u);
  }
}

Measured memory_bytes: 21800
#include<iostream>
#include<math.h>
using namespace std;
int main(){
  int n; cin >> n;
  for(double i = 1; i <= n; i++){
    if(floor(i * 1.08) == n){
      cout << i;
      return 0;
    }
  }
  cout << ":(";
}
    
    
    

Measured memory_bytes: 3776
#include <bits/stdc++.h>
#include <unistd.h>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <cmath>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 1 << 30
#define LLINF LLONG_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define UP(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
using ll = long long;
using Pll = pair<ll,ll>;
using Pii = pair<int,int>;
using Pdd = pair<double,double>;
using dcomplex = complex<double>;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll fact(ll a){ll b=1;for(ll i=1;i<=a;i++)b*=i;return b;}
ll power(ll x,ll n){ll a=1;REP(i,n)a*=x;return a;}
double inf() {return std::numeric_limits<double>::infinity();}

ll N;

int main(int argc, char const *argv[]) {
  cin >> N;
  vector<ll> a(N,0);
  REP(i,N) cin >> a[i];
  auto mi = min_element(a.begin(), a.end());
  auto ma = max_element(a.begin(), a.end());
  if(*mi >= 0) {
    cout << (N-1) << endl;
    UP(i,1,N-1) cout << i << " " << i+1 << endl;
  } else {
    if(abs(*ma)-abs(*mi)>=0) {
      ll id = ma-a.begin(); id++;
      cout << (2*N-1) << endl;
      UP(i,1,N) cout << id << " " << i << endl;
      UP(i,1,N-1) cout << i << " " << i+1 << endl;
    } else {
      ll id = mi-a.begin(); id++;
      cout << (2*N-1) << endl;
      UP(i,1,N) cout << id << " " << i << endl;
      DOWN(i,N-1,1) cout << i+1 << " " << i << endl;
    }
  }
  return 0;
}


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

int main() {

    // input from txt （提出時にこの箇所は削除すること）
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    
    string S;
    cin >> S;
    if(S == "ABC"){
        cout << "ARC" << endl;
    }
    else{
        cout << "ABC" << endl;
    }

}


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

using namespace std;

const int N=1e5+10;

struct Edge{int to,next; }way[N<<1];
int n,k,a[N],ans,dis[N],num[N],tot;

void Build(int u,int v) { way[++tot]=(Edge){v,num[u]}; num[u]=tot; }

void Init()
{
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;++i) scanf("%d",&a[i]);
}

void Dfs(int x)
{
	dis[x]=1;
	for (int i=num[x];i;i=way[i].next)
	{
		int v=way[i].to;
		Dfs(v);
		dis[x]=max(dis[v]+1,dis[x]);
	}
	if (dis[x]>=k && a[x]!=1) 
		dis[x]=0,++ans;
}

void Solve()
{
	if (a[1]!=1) ans++,a[1]=1;
	
	for (int i=2;i<=n;++i) Build(a[i],i);
	
	dis[1]=0; Dfs(1);
	
	printf("%d\n",ans);
}

int main()
{
	Init();
	Solve();
	return 0;
}

Measured memory_bytes: 5376
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n):
  for j in range(i + 1, n):
    lf = j
    rf = n
    while rf - lf > 1:
      md = (lf + rf) // 2
      if l[md] < l[i] + l[j]:
        lf = md
      else:
        rf = md
    ans += lf - j
    #print(i, j, ans)
print(ans)

Measured memory_bytes: 41580
N, M = [int(x) for x in input().split()]
H = [int(x) for x in input().split()]
to = [set() for _ in range(N)]
for _ in range(M):
    a, b = [int(x)-1 for x in input().split()]
    to[a].add(b)
    to[b].add(a)
ans = 0
for i, h in enumerate(H):
    tmp = 1
    for v in to[i]:
        tmp *= (h > H[v])
    ans += tmp
print(ans)


Measured memory_bytes: 107484
#include<stdio.h>
#define NIL -1
#define MAX 10000

 struct Node{
         int parent;
         int left;
         int right;
         };

 struct Node N[MAX];
 int D[MAX],H[MAX],n;

 int depth(int u,int p){
            if(u==NIL)return;
            D[u]=p;
            depth(N[u].right,p+1);
            depth(N[u].left,p+1);
            }

 int height(int u){
        int h1=0;int h2=0;
        if(N[u].right!=NIL){h1=height(N[u].right)+1;}
        if(N[u].left!=NIL){h2=height(N[u].left)+1;}
        return H[u]=h1>h2?h1:h2;
        }

 int sibling(int u){
        if(N[u].parent==NIL)return NIL;
        if(N[N[u].parent].left!=u&&N[N[u].parent].left!=NIL)return N[N[u].parent].left;
        if(N[N[u].parent].right!=u&&N[N[u].parent].right!=NIL)return N[N[u].parent].right;
        return NIL;
        }

 void print(int u){
                   printf("node %d:",u);
                   printf(" parent = %d,",N[u].parent);
                   printf(" sibling = %d,",sibling(u));
                   int deg=0;
                   if(N[u].left!=NIL)deg++;
                   if(N[u].right!=NIL)deg++;
                   printf(" degree = %d,",deg);
                   printf(" depth = %d,",D[u]);
                   printf(" height = %d,",H[u]);

                   if(N[u].parent==NIL)printf(" root\n");
                   else if(N[u].left==NIL&&N[u].right==NIL)printf(" leaf\n");
                   else printf(" internal node\n");
                   }



int main(){
       int i,v,l,r,root=0;
       scanf("%d",&n);
       for(i=0;i<n;i++)N[i].parent=NIL;
       for(i=0;i<n;i++){
               scanf("%d%d%d",&v,&l,&r);
               N[v].left=l;
               N[v].right=r;
               if(l!=NIL)N[l].parent=v;
               if(r!=NIL)N[r].parent=v;
               }

       for(i=0;i<n;i++)if(N[i].parent==NIL)root=i;
       depth(root,0);
       height(root);

       for(i=0;i<n;i++)print(i);

       return 0;
       }
       



Measured memory_bytes: 2140
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <set>
#include <sstream>
#include <vector>
using namespace std;

#define DEBUG_ENABLED 0
typedef long long int ll;

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

    ll A, V, B, W, T;
    cin >> A >> V;
    cin >> B >> W;
    cin >> T;

    bool caught = false;

    ll velocity_diff = (V - W);
    if (DEBUG_ENABLED)
        cout << velocity_diff << endl;
    if (velocity_diff > 0)
    {
        // oni velocity is greater than sheep
        ll diff = (B - A > 0) ? (B - A) : (A - B);

        if (DEBUG_ENABLED)
            cout << diff << endl;

        if (diff <= velocity_diff * T)
        {
            caught = true;
        }
    }

    cout << (caught ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define vec vector
typedef long long ll;
typedef pair<ll,ll> P;
//const ll big=998244353;
const ll big=1000000007LL;
const ll INF=1e18;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
    if(x>y)return x;
    else return y;
}
ll min(ll x,ll y){
    if(x<y)return x;
    else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}


int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/
    
    int n;cin >> n;
    vector<bool> d(n);
    rep(i,n){
        int a,b;cin >> a >> b;
        d[i]=(a==b);
    }
    rep(i,n-2){
        if(d[i]&&d[i+1]&&d[i+2]){cout << "Yes" << endl;return 0;}
    }
    cout << "No" << endl;
}

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

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

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

    if(a+b>=10) puts("error");
    else cout << a+b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long N, long long A, long long B)
{
    if (A + B > N + 1)
    {
        cout << -1 << endl;
        return;
    }
    if (A * B < N)
    {
        cout << -1 << endl;
        return;
    }
    ll S = N - A;
    vector<int> ans(N);
    ll cur = N;
    for (int i = 0; i < A; i++)
    {
        int num = min(B - 1, S) + 1;
        S -= num - 1;
        for (int j = 0; j < num; j++)
        {
            ans.push_back(cur-num+1+j);
        }
        cur -= num;
    }

    reverse(ans.begin(),ans.end());

    for (int i = 0; i < N; i++)
    {
        cout << ans[i] << endl;
    }
    
}

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


Measured memory_bytes: 4588
# coding: utf-8
import sys
from collections import Counter

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
S = [sr() for _ in range(N)]
counter = Counter(S)
mo = counter.most_common()
ma = mo[0][1]
answer = []
for k, v in mo:
    if v == ma:
        answer.append(k)

answer.sort()
print(*answer, sep='\n')


Measured memory_bytes: 50188
#include <vector>
#include <queue>
#include <climits>
#include <cstdio>

struct Node {
  // このノードから伸びるエッジの情報
  int number;
  std::vector<int> edges_to;    // 各エッジの接続先のノード番号
  std::vector<int> edges_cost;  // 各エッジのコスト

  // ダイクストラ法のためのデータ
  bool done;  // 確定ノードか否か
  int cost;   // このノードへの現時点で判明している最小コスト
  Node() {
    done = false;
    cost = INT_MAX;
  }
  bool operator> (const Node &node) const {
    return cost > node.cost;
  }
};

class MyGraph {
public:
  MyGraph(int numNodes) {
    this->numNodes = numNodes;
    nodes = std::vector<Node>(numNodes);
    doneCount = 0;
  }
  int numNodes;
  std::vector<Node> nodes;
  std::priority_queue<Node, std::vector<Node>, std::greater<Node> > queue;
  int doneCount;

  void addEdge(int edge_from, int edge_to, int edge_cost) {
    nodes[edge_from].number = edge_from;
    nodes[edge_from].edges_to.push_back(edge_to);
    nodes[edge_from].edges_cost.push_back(edge_cost);
  }
  void updateCost(int node_start) {
    nodes[node_start].cost = 0;
    queue.push(nodes[node_start]);
    while (!queue.empty()) {
      Node &node = nodes[queue.top().number];
      queue.pop();
      if (node.done) {
        continue;
      }
      //printf("%d\n", node.number);
      node.done = true;
      doneCount++;
      for (int i = 0; i < (int)node.edges_to.size(); ++i) {
        Node &nodeNext = nodes[node.edges_to[i]];
        if (!nodeNext.done && nodeNext.cost > node.cost + node.edges_cost[i]) {
          nodeNext.cost = node.cost + node.edges_cost[i];
          //printf("%d %d\n", nodeNext.number, node.cost + node.edges_cost[i]);
          queue.push(nodeNext);
        }
      }
    }
  }
  int getCost(int node_num) {
    return nodes[node_num].cost;
  }
};

int main(int argc, char const *argv[]) {
  int H, W;
  scanf("%d%d", &H, &W);
  int A[H][W];
  int c;
  MyGraph graph = MyGraph(10*10);
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      scanf("%d", &c);
      if (i != j) {
        graph.addEdge(j, i, c);
      }
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      scanf("%d", &A[i][j]);
    }
  }
  graph.updateCost(1);
  int cost = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (A[i][j] != -1) {
        cost += graph.getCost(A[i][j]);
        // printf(" %d\n", graph.getCost(A[i][j]));
      }
    }
  }
  printf("%d\n", cost);
  return 0;
}


Measured memory_bytes: 384
/* 実装例　Atcoder Beginers Contest 174-F Range Set query */
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
signed main(){
    int n,q;
    std::cin >> n >> q;
    int sq=sqrt(n);
    std::vector<int> c(n);
    rep(i,n){
        std::cin >> c[i];
        c[i]--;
    }
    std::vector<int> l(q),r(q);
    rep(i,q){
        std::cin >> l[i] >> r[i];
        l[i]--;
    }
    
    std::vector<int> qu(q);
    rep(i,q) qu[i]=i;
    std::sort(ALL(qu),[&](int i,int j){if(l[i]/sq!=l[j]/sq) return l[i]<l[j]; else return r[i]<r[j];});
    
    std::vector<int> ans(q);
    std::vector<int> cnt(n,0);
    int nl=0,nr=0;
    int res=0;
    for(int i:qu){
        while(nl>l[i]){
            nl--;
            if(cnt[c[nl]]++==0) res++;
        }
        while(nl< l[i]){
            if(--cnt[c[nl]]==0) res--;
            nl++;
        }
        while(nr< r[i]){
            if(cnt[c[nr]]++==0) res++;
            nr++;
        }
        while(nr> r[i]){
            nr--;
            if(--cnt[c[nr]]==0) res--;
        }
        /* ここから結果 */
        ans[i]=res;
    }
    rep(i,q) std::cout << ans[i] << "\n";
}


Measured memory_bytes: 15460
#!/usr/bin/env python
l, r = map(int, input().split())

mod = 2019
if r >= l+mod-1:
    r = l+mod-1
X = [x%mod for x in list(range(l, r+1))]

ans = mod
for i in range(len(X)):
    for j in range(i+1, len(X)):
        ans = min(ans, (X[i] * X[j])%mod)
print(ans)

Measured memory_bytes: 41452
#include <cstdio>
#include <string.h>

int main(){
    int i,j;
    int H,W;
    char buf[10];

    scanf("%d %d",&H,&W);

    for(i = 0; i < H;i++){
        for(j = 0;j < W;j++){
            scanf("%s",buf);

            if(strcmp(buf,"snuke") == 0) { 
                printf("%c%d\n",j + 'A',i + 1);
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 128
/*Daruma Otoshi*/

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;

int dp[311][311];

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

		memset(dp, 0, sizeof(dp));
		for(int i=n-1; i>=0; i--) {
			dp[i][i] = dp[i][i+1] = 0;
			for(int j=i+1; j<=n; j++) {
				if(i + 1 < j && abs(w[i] - w[j-1]) <= 1 && dp[i+1][j-1] == j-i-2)
					dp[i][j] = j - i;

				for(int k=j+1; k<=n; k++)
					if(dp[i][k]<dp[i][j] + dp[j][k]) dp[i][k]=dp[i][j] + dp[j][k];
			}
		}
		printf("%d\n", dp[0][n]);
	}//endwhile

	return 0;
}


Measured memory_bytes: 3088
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		String a = scanner.next();
		String b = scanner.next();
		String c = scanner.next();
		System.out.println(a.charAt(a.length()-1) == b.charAt(0) && b.charAt(b.length()-1) == c.charAt(0) ? "YES":"NO");
	}
}

Measured memory_bytes: 23508
a, b, c = list(map(int, input().split()))
if a == 5 and b == 5 and c == 7:
  print('YES')
elif a == 5 and b == 7 and c == 5:
  print('YES')
elif a == 7 and b == 5 and c == 5:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 8960
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

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

int main() {

	int H,W,K;
	cin >> H >> W >> K;
	vector<string> G(H);
	rep(i,H) {
		cin >> G[i];
	}
	int mini = 1e9;
	rep(i,(1<<(H-1))) {
		int start = 0;
		int end = 1;
		int temp = 0;
		vector<int> startColumns;
		//cout << std::bitset<10>(i) << endl;
		while(start < H) {
			startColumns.pb(start);
			while(!((i>>temp)&1) && end <= H) {
				end++;
				temp++;
			}
			start = end;
			end = start + 1;
			temp++;
		}
		int sCsize = startColumns.size();
		/*rep(j,sCsize) {
			cout << startColumns[j] << " ";
		}
		cout << endl;
		*/
		vector<int> accWhite(sCsize);
		vector<int> startRows;
		int startRow = 0;
		bool flag2 = true;
		while(startRow < W) {
			startRows.pb(startRow);
			for(int j = startRow;; j++) {
				rep(k, sCsize) {
					int start = startColumns[k];
					int end;
					if(k == sCsize-1) end = H; 
					else end = startColumns[k+1];
					for(int l=start; l < end; l++) {
						if(G[l][j] == '1') {
							accWhite[k]++;
						}
					}
				}
				bool flag = false;
				rep(m, sCsize) {
					if(accWhite[m] > K) {
						flag = true;
					}
				}
				if(flag) {
					if(startRow == j) {
						startRow = W;
						flag2 = false;
						break;
					}
					startRow = j;
					rep(m,sCsize) {
						accWhite[m] = 0;
					}
					break;
				}
				if(j == W-1) {
					startRow = W;
					break;
				}
			}
		}
		int res = startColumns.size() - 1 + startRows.size() - 1;
		/*if(res < mini) {
			cout << "mini changed:" << endl;
			rep(p, startRows.size()) {
				cout << startRows[p] << " ";
			}
			cout << endl;
		}*/
		if(flag2) chmin(mini, res);
	}
	cout << mini << endl;
	
  return 0;
}


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

using namespace std;
#define endl "\n"

const int MOD = 1000000007;



int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
    int a, b;
    cin >> a >> b;
    if(a > 9 || b > 9)cout << "-1" << endl;
    else cout << a*b << endl;
    
    
    
    
    
	return 0;
}

Measured memory_bytes: 3596
N = int(input())

import math
order = int(math.log10(int(N)))
ans = 0

for i in range(order):
    if (i % 2) == 0:
        ans += 9 * 10 ** i

if (order % 2) == 0:
    a = N - 10 ** order
    ans += a + 1 

print(ans)

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#define NOMINMAX
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <functional>
#include <cstring>
#include <array>
#include <vector>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#include <complex>
#include <bitset>
#define full(c) c.begin(), c.end()
#define vector2d(name,type,h,w,init) vector<vector<type>> name(h,vector<type>(w,init)) 
const int PRIME = 1000000007;
const int INF = (int) 1e9;
const int INT_INF = 2147483647;
const long long int LL_INF = 9223372036854775807;
const double PI = acos(-1);
const double EPS = 0.00001;
typedef unsigned long long int ull;
typedef long long int ll;
using namespace std;

int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	int n;
	ll h;
	cin >> n >> h;
	vector<ll> a(n), b(n), nb;
	ll maxa = 0;
	ll minb = LL_INF, sumb = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		maxa = max(maxa, a[i]);
		minb = min(minb, b[i]);
	}
	for (int i = 0; i < n; i++) {
		if (b[i] > maxa) {
			maxa = max(maxa, a[i]);
			nb.push_back(b[i]);
		}
	}
	sort(full(nb), greater<ll>());
	int cnt = 0;
	for (int i = 0; i < nb.size(); i++) {
		h -= nb[i];
		cnt++;
		if (h <= 0) {
			cout << cnt << endl;
			return 0;
		}
	}
	cnt += (h + maxa - 1) / maxa;
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 2936
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 1e18;


int main() {
	int n,k; cin>>n>>k;
	vector<int> a(k);
	rep(i,0,n) cin>>a[i];
 	vector<bool> dp(k,0);
	rep(i,1,k+1)rep(j,0,n){
		if(i>=a[j]&&(!dp[i-a[j]])) dp[i]=1;
	}
	if(dp[k]) cout<<"First"<<endl;
	else cout<<"Second"<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <climits>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
	string s;
	int t,ans;
	cin >> s;
	if(s[0] < s[1] || s[0] < s[2])
		cout << (s[0]-'0'+1)*111;
	else
		cout << (s[0] - '0') * 111;
}

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

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define eprintf(...)
#define dump(x)
#define debug(x)
#endif

typedef long long ll;

const ll MOD = 1e9 + 7;

class B0Or1Swap {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int N;
	    in >> N;
	    vector<int> p(N);
	    REP(i,0,N) in >> p[i];

	    vector<int> wrongIndex;
	    REP(i,1,N+1) {
	        if (p[i-1] != i) wrongIndex.push_back(i);
	    }
	    bool answer = wrongIndex.size() == 0;
	    if (wrongIndex.size() == 2) {
	        answer = p[wrongIndex[0]-1] == wrongIndex[1] && p[wrongIndex[1]-1] == wrongIndex[0];
	    }
	    out << (answer ? "YES" : "NO") << "\n";
	}
};


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


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

int main()
{
	int n;
  cin>>n;
  int x = n%10;
  if(x == 2||x == 4||x == 5||x == 7||x == 9)
  	cout<<"hon"<<endl;
   else if(x == 0 || x == 1 || x == 6 || x == 8)
	cout<<"pon"<<endl;  
   else
    cout<<"bon"<<endl;
  
  return 0;
}

Measured memory_bytes: 3676
#include<stdio.h>
 int main(void)
 {
     int A,B;

     scanf("%d%d",&A,&B);

     if((A==1)&&(B==1)) printf("Draw\n");
     else if(A==1) printf("Alice\n");
     else if(B==1) printf("Bob\n");

     if((A!=1)&&(B!=1)){
       if(A>B) printf("Alice\n");
       else if(A<B) printf("Bob\n");
       else printf("Draw\n");
     }

     return 0;
 }


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

using namespace std;

int main()
{
  int N, Q; cin >> N >> Q;
  string S; cin >> S;
  vector<int> l(Q), r(Q);
  for (int i = 0; i < Q; ++i) cin >> l[i] >> r[i];

  vector<int> a(N);
  a[0] = 0;
  for (int i = 1; i < N; ++i) {
    a[i] = a[i-1];
    if (S[i-1] == 'A' and S[i] == 'C') {
      a[i]++;
    }
  }

  for (int i = 0; i < Q; ++i) {
    cout << a[r[i]-1] - a[l[i]-1] << endl;
  }

}

Measured memory_bytes: 2176
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

fn main() {
    input!{
        n: usize,
        s: Chars,
    }

    let r_num = s.iter().filter(|&x| *x == 'R').count();
    let b_num = s.iter().filter(|&x| *x == 'B').count();
    let g_num = s.iter().filter(|&x| *x == 'G').count();
    
    let mut cnt = 0;
    for i in 0..n-2 {
        for j in i+1..n-1 {
            let k = 2*j - i;
            if !(k < n) { continue; }
            if s[i] != s[j] && s[j] != s[k] && s[k] != s[i] {
                cnt += 1;
            }
        }
    }
    println!("{}", r_num * b_num * g_num - cnt)
}


Measured memory_bytes: 2116
#include <iostream>
#include <vector>
#include <algorithm>
typedef std::pair<int, int> p;
int main(){
  int N,H;
  std::vector<p> katana(100001);
  std::cin>>N>>H;
  int maxa=0, ans=0;;
  for(int i=0;i<N;++i){
    std::cin>>katana[i].second>>katana[i].first;
    maxa=std::max(maxa, katana[i].second);
  }
  int H_=H;
  std::sort(katana.rbegin(),katana.rend());
  for(int i=0;i<N;++i){
    if(katana[i].first>maxa){
      H_-=katana[i].first;
//      std::cout<<H_<<std::endl;
      ans++;
      if(H_<=0){
        std::cout<<ans<<std::endl;
        return 0;
      }
    }else break;
  }
  int t=H_/maxa;
  std::cout<<ans+(H_%maxa==0?t:t+1)<<std::endl;
  /*for(int i=0;i<N;++i){
    std::cout<<katana[i].first<<" "<<katana[i].second<<std::endl;
  }//*/
  return 0;
}


Measured memory_bytes: 1024
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e9
#define NUM 1000000007
#define all(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

/*ll gcd(ll a, ll b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}*/

/*ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a * (b / g);
}*/

/*int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}*/

int main() {
	int n;
	cin >> n;
	VI a(n);
	rep(i, n)cin >> a[i];

	sort(all(a));

	int cnt = 1,mem=a[0];
	REP(i, 1, n) {
		if (mem < a[i]) {
			cnt++;
			mem = a[i];
		}
	}
	cout << cnt << endl;
}



Measured memory_bytes: 256
import math
n = int(input())
a = list(map(int, input().split()))
scores = [0]*n

for index in range(n):
	count = 0
	x = a[index]
	while x!=0 and ((x & 1) == 0):
		x = x >> 1
		count += 1
	scores[index] = count

print(min(scores))


Measured memory_bytes: 3060
n,x =map(int,input().split())
a=[int(x) for x in input().split()]
ans=0
for i in range(n-1):
  if(a[i]+a[i+1]>x):
    p = a[i]+a[i+1]-x
    ans+=p
    a[i+1]=max(0,a[i+1]-p)
print(ans)

Measured memory_bytes: 14540
#include <bits/stdc++.h>
using namespace std;
//template
//main
signed main(){
  int N,T;cin>>N>>T;
  std::vector<int> t(N);
  for(int i=0;i<N;i++)cin>>t[i];
  int ans=T;
  for(int i=0;i<N-1;i++)ans+=min(t[i+1]-t[i],T);
  cout<<ans<<endl;
}


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

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

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

int main(){
  ll A,B;
  cin >> A >>B;
  cout << lcm(A,B) << endl;
  
}

Measured memory_bytes: 3572
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var N int
	var AC, WA, TLE, RE int
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &N)

	for i := 0; i < N; i++ {
		scanner.Scan()
		switch scanner.Text() {
		case "AC":
			AC++
		case "WA":
			WA++
		case "TLE":
			TLE++
		default:
			RE++
		}
	}
	line := `AC x %d
WA x %d
TLE x %d
RE x %d
`
	fmt.Printf(line, AC, WA, TLE, RE)
}


Measured memory_bytes: 1848
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    ll n, k;
    cin >> n >> k;

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

    ll ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (a[i] > a[j]) {
                if (i < j) ans += k * (k + 1) / 2LL;
                if (i > j) ans += k * (k - 1) / 2LL;
            }
            ans %= MOD;
        }
    }

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

Measured memory_bytes: 888
def main():
    n, = map(int, input().split())
    pp = tuple(map(int, input().split()))
    qq = tuple(map(int, input().split()))

    from itertools import permutations

    a, b = 0, 0
    for i, cc in enumerate(permutations(range(1, n+1), n)):
        if cc == pp:
            a = i + 1
        if cc == qq:
            b = i + 1
        if a and b:
            break

    print(abs(a - b))


if __name__ == "__main__":
    main()


Measured memory_bytes: 38640
n, m = list(map(int, input().split()))
dist_given = {}
dist = [[1000]*(n+1) for _ in range(n+1)]
for i in range(1, n+1): dist[i][i] = 0
for _ in range(m):
    a, b, c = list(map(int, input().split()))
    dist[a][b] = c
    dist[b][a] = c
    dist_given[tuple(sorted([a, b]))] = c

for k in range(1, n+1):
    for i in range(1, n+1):
        for j in range(1, n+1):
            dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j])
# print(dist)
ans = 0
for i in range(1, n):
    for j in range(i+1, n+1):
        if (i, j) in dist_given.keys() and dist[i][j] < dist_given[(i, j)]:
            ans += 1
print(ans)

Measured memory_bytes: 3568
//12, 01, 2019, 10:01:30 Rafaelcs cpp
#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

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

    int n, h, w;

    cin >> n >> h >> w;

    cout << (n - h + 1) * (n - w + 1) << endl; 
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
typedef long long ll;

using ipair = pair<int, int>;

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

bool operator>(const ipair a,const ipair b){return a.first > b.first;}


const double PI=3.14159265358979323846;

double a, b, x;
bool over_half = true;

double f(double alpha){
  if(over_half){
    return (a*a*a) * tan(PI/2 - alpha);
  }else{
    return 0.5 * b * b* tan(alpha);
  }
}

int main(){
  cin >> a >> b >> x;

  if(2*x < a*a*b){
    over_half = false;
  }

  double target;
  if(over_half){
    target = 2*a*a*b - 2*x;
  }else{
    target = x/a;
  }

  double alpha;
  double l=0, r=PI/2;

  int cnt = 0;
  while(1){
    double m = (l+r) / 2;
    if(cnt > 1000){
      alpha = m;
      break;
    }

    if(over_half){
      if(f(m) > target){
        l = m;
      }else{
        r = m;
      }
    }else{
      if(f(m) > target){
        r = m;
      }else{
        l = m;
      }
    }
    cnt++;
  }

  printf("%.14f\n", ((PI/2 - alpha) / PI) * 180.0);

  return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

/**
 * お遊び
 *
 * @author s-sugimoto
 */
public class Main {

	/**
	 * 隠蔽
	 */
	private Main() {
	}

	/**
	 * main
	 *
	 * @param args 起動引数
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		// ボールの数
		int n = scanner.nextInt();
		// Bのy座標
		int k = scanner.nextInt();
		List<Integer> x = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			x.add(scanner.nextInt());
		}

		int result = 0;
		for (int i = 0; i < n; i++) {
			// Bからのボールの距離
			int tmp = k - x.get(i);
			if (Math.abs(tmp) < x.get(i)) {
				result = result + tmp * 2;
			} else {
				result = result + x.get(i) * 2;
			}
		}
		System.out.println(result);
	}

}


Measured memory_bytes: 23636
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define rep(i,n) for(int i=0;i<(n);i++)
#define tr(it,container) for(typeof(container.begin()) it = container.begin(); \
                                                  it != container.end(); ++it)
#define mp(a,b) make_pair((a),(b))

typedef long long ll;
typedef complex<double> point;

// up right down left
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};

const double EPS = 1e-9;
const int days[]     = {31,28,31,30,31,30,31,31,30,31,30,31};
const int daysleap[] = {31,29,31,30,31,30,31,31,30,31,30,31};

int main(){
    while(true){
        int h,w;
        cin >> h >> w;
        if(h == 0 and w == 0 ) break;
        vector<vector<int> > number(h+2,vector<int>(w+2,0));
        vector<vector<char> > input(h+2,vector<char>(w+2,'.'));
        for(int i=1;i<=h;i++){
            string s;
            cin >> s;
            for(int j=1;j<=w;j++){
                input[i][j] = s[j-1];
            }
        }
        int now = 1;
        int cnt = 0;
        for(int i=1;i<=h;i++){
            for(int j=1;j<=w;j++){
                if(number[i][j] == 0){
                    char c = input[i][j];
                    // h,w
                    queue<pair<int,int> > Q;
                    Q.push(mp(i,j));
                    number[i][j] = now;
                    while(!Q.empty()){
                        int qh = Q.front().first;
                        int qw = Q.front().second;
                        Q.pop();
                        for(int k=0;k<4;k++){
                            int newh = qh+dy[k];
                            int neww = qw+dx[k];
                            if(number[newh][neww] == 0 and input[newh][neww] == c){
                                number[newh][neww] = now;
                                Q.push(mp(newh,neww));
                            }
                        }
                    }
                    now++;
                    cnt++;
                }
            }
        }
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 1292
#include <stdio.h>

int main(void) {
	int i, j;
	int H, W;
	for(; ; ) {
		scanf("%d%d", &H, &W);
		if(H==0 && W==0) break;
		for(i=0; i<H; i++) {
			if(i%2) {
				for(j=0; j<W; j++) {
					if(j%2) printf("#");
					else printf(".");
				}
				putchar('\n');
			}
			else {
				for(j=0; j<W; j++)  {
					if(j%2) printf(".");
					else printf("#");
				}
				putchar('\n');
			}
		}
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 576