akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef long long ll;
int main(void)
{
  ll n,k;
  scanf("%lld%lld",&n,&k);
  ll a[n+1],b[n+1],ans=1;
  for(ll i=1;i<=n;i++){
    scanf("%lld",&a[i]);
    b[i]=0;
  }
  ll tmp1=0,tmp2=0;
  for(ll i=1;i<=k;i++){
    b[ans]++;
    if(b[ans]==2){
      tmp1++;
    }
    if(b[ans]==3){
      tmp2=i;
      break;
    }
    ans=a[ans];
    if(i==k){
      printf("%lld",ans);
      return 0;
    }
  }
  //printf("%lld",tmp1);
  ll c[tmp2],tmp3=1;
  for(ll i=0;i<=(tmp2-1);i++){
    c[i]=tmp3;
    tmp3=a[tmp3];
  }
  printf("%lld",c[tmp2-tmp1+(k-tmp2)%tmp1]);

  return 0;
}

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

int main()
{
    int n;
    scanf("%d",&n);
    if(n==1)
    {
        printf("Hello World");
    }
    else
    {
        int a,b;
        scanf("%d %d",&a,&b);
        printf("%d",a+b);
    }
    return 0;
}


Measured memory_bytes: 256
from collections import deque
import sys

# downには「\」の数を入れる
down = deque()
edge = deque()
pool = deque()

for i, j in enumerate(sys.stdin.readline().splitlines()[0]):
    if j == "\\":
        down.append(i)
    # downが空でなく、かつ右斜面の場合
    elif down and j == "/":
        left = down.pop()
        area = i - left

        # edgeが空になるまで
        while edge:
            # 右端が
            if edge[-1] < left:
                break
            edge.pop()
            area += pool.pop()

        edge.append(left)
        pool.append(area)

print(sum(pool))
print(len(pool), *pool)



Measured memory_bytes: 6556
#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
typedef long long LL;
const LL INF = 0x3f3f3f3f3f3f3f3f;
LL ans = 0;
int X[N], tot, cnt, g[N], nxt[N << 1], v[N << 1], w[N << 1];
struct E {
    int x, y;
    LL z;
} e[N * 20];
void init() {
    memset(g, -1, sizeof(g));
    tot = 0;
}
void add_edge(int x, int y, int z) {
    v[tot] = y, w[tot] = z, nxt[tot] = g[x], g[x] = tot++;
}
void ADD(int x, int y, LL z) {
    e[cnt].x = x;
    e[cnt].y = y;
    e[cnt++].z = z;
}
int sum, root, size[N], dp[N], vis[N];
void getroot(int x, int fx) {
    size[x] = 1;
    dp[x] = 0;
    for (int i = g[x]; ~i; i = nxt[i]) {
        if (!vis[v[i]] && v[i] != fx) {
            getroot(v[i], x);
            size[x] += size[v[i]];
            dp[x] = max(dp[x], size[v[i]]);
        }
    }
    dp[x] = max(dp[x], sum - size[x]);
    if (dp[x] < dp[root]) root = x;
}
LL val;
int u;
vector<LL> q;
inline void dfsadd(int x, LL l, int pre) {
    if (l + X[x] < val) val = l + X[x], u = x;
    for (int i = g[x]; ~i; i = nxt[i]) {
        if (!vis[v[i]] && v[i] != pre) dfsadd(v[i], l + w[i], x);
    }
}
inline void dfscal(int x, LL l, int pre) {
    if (x != u) ADD(x, u, l + X[x] + val);
    for (int i = g[x]; ~i; i = nxt[i]) {
        if (!vis[v[i]] && v[i] != pre) dfscal(v[i], l + w[i], x);
    }
}
void cal(int x) {
    val = INF;
    u = 0;
    for (int i = g[x]; ~i; i = nxt[i]) {
        if (!vis[v[i]]) dfsadd(v[i], w[i], x);
    }
    if (u == 0) return;
    if (X[x] < val)
        val = X[x], u = x;
    else
        ADD(x, u, val + X[x]);
    for (int i = g[x]; ~i; i = nxt[i]) {
        if (!vis[v[i]]) dfscal(v[i], w[i], x);
    }
}
void solve(int x) {
    cal(x);
    vis[x] = 1;
    for (int i = g[x]; ~i; i = nxt[i]) {
        if (!vis[v[i]]) {
            root = 0;
            dp[0] = sum = size[v[i]];
            getroot(v[i], 0);
            solve(root);
        }
    }
}
int f[N];
int sf(int x) { return x == f[x] ? x : f[x] = sf(f[x]); }
int n;
int main() {
    scanf("%d", &n);
    init();
    for (int i = 1; i <= n; i++) scanf("%d", &X[i]);
    for (int i = 1; i < n; i++) {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        add_edge(a, b, c);
        add_edge(b, a, c);
    }
    dp[root = 0] = sum = n;
    getroot(1, 0);
    solve(root);
    for (int i = 1; i <= n; i++) f[i] = i;
    sort(e, e + cnt, [](E a, E b) { return a.z < b.z; });
    for (int i = 0; i < cnt; i++) {
        if (sf(e[i].x) == sf(e[i].y)) continue;
        f[sf(e[i].x)] = sf(e[i].y);
        ans += e[i].z;
    }
    printf("%lld\n", ans);
    return 0;
}


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

using ll = long long;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define pb push_back
#define mp make_pair
#define fill(x, y) memset(x, y, sizeof(x))
#define even(x) x % 2 == 0
#define odd(x) x % 2 != 0
#define all(x) x.begin(), x.end()
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

// these functions return the position of result of Binary Search.
#define LB(s, t, x) (int) (lower_bound(s, t, x) - s)
#define UB(s, t, x) (int) (upper_bound(s, t, x) - s)

ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1) ans = 1ll * ans * a % mo; a = 1ll * a * a % mo; } while (b >>= 1); return ans; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll temp = gcd(a, b); return temp ? (a / temp * b) : 0; }
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx8[] = { 1, -1, 0, 0, 1, 1, -1, -1 }, dy8[] = { 0, 0, -1, 1, -1, 1, -1, 1 };

template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(size_t a, size_t b, Ts... ts) { return vector<decltype(make_v<T>(b, ts...))>(a, make_v<T>(b, ts...)); }
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }
// auto dp = make_v<int>(4, h, w);
// fill_v(dp, 0);

const ll INF_LL = (1ll << 60);
const int INF_INT = (int)1e9;
const ll MOD_CONST = (ll)(1e9 + 7);

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

inline tuple<ll, ll> rotate45(tuple<ll, ll> point) { ll x = get<0>(point), y = get<1>(point); return tuple<ll, ll>(x + y, x - y); }
inline bool rangeCheck2D(int nx, int ny, int Width, int Height) { return nx >= 0 and nx < Width and ny >= 0 and ny < Height; }
void out_sequence(vector<ll> &out) { REP(i, (int)out.size()) { cout << out[i]; if (i == (int)out.size() - 1) cout << endl; else cout << " "; } }

int main(void)
{
	cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20);

    ll N, M; cin >> N >> M;
	vector<pair<ll, ll>> r(M);
	REP(i, M) {
		ll a, b;cin >> a >> b;
		r[i] = {a, b};
	}
	sort(all(r));

	ll ans = 1;
	ll n = r[0].first;
	ll m = r[0].second;
	REP(i, M) {
		chmax(n, r[i].first);
		chmin(m, r[i].second);
		if (n >= m) {
			ans++;
			m = r[i].second;
		}
	}
	cout << ans << endl;

	return 0;
}

//*/

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



int main() 
{
  ll N; cin>>N;
  N%=10;
  string ans;
  if(N==2||N==4||N==5||N==7||N==9)
  {
    ans="hon";
  }
  if(N==0||N==1||N==6||N==8)
  {
    ans="pon";
  }
  if(N==3)
  {
    ans="bon";
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3628
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner in = new Scanner(System.in);
        String forecast = in.next();
        String fact = in.next();
        int count = 0;
        for (int i = 0;i < forecast.length();i++){
            if (forecast.substring(i, i+1).equals(fact.substring(i, i+1))){
                count++;
            }
        }

        System.out.println(count);

    }
}


Measured memory_bytes: 21716
from collections import Counter
import heapq

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

cur = n-1
bit = 1
for i in range(n):
    if a[i] == b[i]:
        while a[i]==b[cur] or a[cur]==b[i]:
            if cur == 0:
                bit = -1
            if bit == -1 and cur == n-1:
                print('No')
                exit(0)
            cur-=bit
        b[i], b[cur] = b[cur], b[i]
print('Yes')
print(' '.join(list(map(str, b))))
    
    


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

void fnInput(vector<int> &rviTrg, vector<int> &rviSch)
{
  int iTrgCnt;
  cin >> iTrgCnt;

  rviTrg.resize(iTrgCnt);
  for (int i = 0; i < iTrgCnt; i++)
    cin >> rviTrg[i];

  int iSchCnt;
  cin >> iSchCnt;

  rviSch.resize(iSchCnt);
  for (int i = 0; i < iSchCnt; i++)
    cin >> rviSch[i];
}

void fnBinSch(const vector<int> &cnrviTrg, const vector<int> &cnrviSch, int &riFnd)
{
  for (int i = 0; i < cnrviSch.size(); i++)
  {
    int iLow  = 0;
    int iHigh = cnrviTrg.size();
    while (iLow < iHigh)
    {
      int iMid = (iLow + iHigh) / 2;
      if (cnrviSch[i] == cnrviTrg[iMid])
      {
        riFnd++;
        break;
      }
      else if (cnrviSch[i] < cnrviTrg[iMid])
        iHigh = iMid;
      else
        iLow  = iMid + 1;
    }
  }
}

void fnResult(int a_iFnd)
{
  cout << a_iFnd << endl;
}

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

  vector<int> viTrg, viSch;
  int iFnd = 0;

  fnInput(viTrg, viSch);
  fnBinSch(viTrg, viSch, iFnd);
  fnResult(iFnd);

  return 0;
}

Measured memory_bytes: 1592
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int k = sc.nextInt();
		String s = sc.next();

		if (s.length() <= k) {
			System.out.println(s);
		} else {
			System.out.println(s.substring(0, k) + "...");
		}
	}
}


Measured memory_bytes: 38684
#!/bin/usr/env python3

s = input()

a = []
for i in s:
    a.append(i)

b = a[0] + a[1]
b = int(b)

c = a[2] + a[3]
c = int(c)

dec1 = 0
dec2 = 0

if (1<=b<=12 and 1<=c<=12):
    print("AMBIGUOUS")
elif (1<=b<=12):
    print("MMYY")
elif (1<=c<=12):
    print("YYMM")
else:
    print("NA")


Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>

int main(void)
{
  char s[10];
  char t[10];
  char u[101];
  int a, b;

  scanf("%s %s", s, t);
  scanf("%d %d", &a, &b);
  scanf("%s", u);
  if (strcmp(u, s) == 0 && strlen(u) == strlen(s))
  {
    a -= 1;
    printf("%d %d", a, b);
  }
  else if (strcmp(u, t) == 0 && strlen(u) == strlen(t))
  {
    b -= 1;
    printf("%d %d", a, b);
  }
  return 0;
}

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

int main() {
    int n,k,a[101],count=0;
    memset(a,0,sizeof(a));
    cin >> n >> k;
    rep(i,k){
        int d;
        cin >> d;
        rep(i,d){
            int x;
            cin >> x;x--;
            a[x]++;
        }
    }
    rep(i,n){
        if(a[i] == 0){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3636
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<long long>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, s, t, q, sum, last, cnt, ans = 0;
Pll a[1100] = {};
LL d[1010][1010] = {};
int dd[4][2] = { {1,0},{0,1},{ -1,0 },{ 0,-1 } };
string str,ss;
struct Edge { LL cost, from, to; };
vector<Edge>vec;
bool f;
char c[10000][10000];
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> h >> w >> n;
	rep(i, n) {
		cin >> a[i].fir >> a[i].sec;
		if (i) {
			if ((a[i].fir < a[i - 1].fir&&a[i].sec >a[i - 1].sec)||(a[i].fir > a[i - 1].fir&&a[i].sec <a[i - 1].sec))
				ans += (abs(a[i].fir - a[i - 1].fir)+abs(a[i].sec - a[i - 1].sec));
			else
				ans += max(abs(a[i].fir - a[i - 1].fir), abs(a[i].sec - a[i - 1].sec));
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3188
# ABC

import numpy as np

def rle(x):
    ''' Run Length Encoding

    rle('001111000000011')
    (array([2, 4, 7, 2]),
     array(['0', '1', '0', '1'], dtype='<U1'))

    rle('aabcccbbbaab')
    (array([2, 1, 3, 3, 2, 1]),
     array(['a', 'b', 'c', 'b', 'a', 'b'], dtype='<U1'))
    '''
    x = np.array(list(x))
    n = len(x)
    if n == 0:
        return (1, '')
    y = list(map(lambda a, b: a != b, x[1:], x[:-1]))
    i = np.hstack((np.where(y)[0]+1, n))
    return (np.diff(np.hstack((0, i))), x[i-1])

n = int(input())
s = input()
a = rle(s)
print(len(a[0]))


Measured memory_bytes: 16976
#include <stdio.h>
int main()
{
  char s[200001];
  char t[200001];
  scanf("%s",&s);
  scanf("%s",&t);
  int cnt = 0;
  char *sp = s;
  char *tp = t;
  while (*sp)
  {
    if (*sp - *tp != 0)
      cnt++;
    sp++;
    tp++;
  }
  printf("%d\n",cnt);
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
   ll d,n;cin >>d>>n;
   ll k=1;
    for (int i = 0; i < d; ++i) {
        k*=100;
    }
    if(n==100)n++;
    ll ans=k*n;
    cout <<ans <<endl;
   return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,i,j;
    scanf("%d",&n);
    int p[n],c=1;
    for(i=0;i<n;i++)
        scanf("%d",&p[i]);
        j=p[0];
        for(i=1;i<n;i++){
            if(p[i]<j){
                c++;
              j=p[i];
            }
    
    }
    printf("%d\n",c);
}

Measured memory_bytes: 2460
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>

typedef long long ll;
using namespace std;

int main()
{
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int a, b, i, j, k, l;
    a = x2 - x1;
    b = y2 - y1;



    cout << x2 - b<<" " <<  y2 + a<< " "<< x1 - b << " "<< y1 + a << endl;
    
    return 0;
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n;
    string s;
    cin >> n >> s;
    vector<set<ll>> vs(26);
    for(i = 0;i < n;++i){
        char tmp = s.at(i);
        vs.at(tmp - 'a').insert(i);
    }
    ll q;
    cin >> q;
    for(i = 0;i < q;++i){
        ll com;
        cin >> com;
        if(com == 1){
            ll ind;
            char c;
            cin >> ind >> c;
            --ind;
            char tmp = s.at(ind);
            s.at(ind) = c;
            vs.at(tmp - 'a').erase(ind);
            vs.at(c - 'a').insert(ind);
        }else{
            ll l,r;
            cin >> l >> r;
            ll ans = 0;
            rep(j,26){
                auto it1 = vs.at(j).lower_bound(l-1);
                auto it2 = vs.at(j).lower_bound(r);
                if(it1 != it2) ++ans;
            }
            cout << ans << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 24324
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    int n;
    cin>>n;
    if(n<=999)cout<<"ABC"<<endl;
    else cout<<"ABD"<<endl;
}

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

int main()
{
  bool Is1 = false;
  int n, a[200000], b[200000] = {0}, lf = 0, r = 0;
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
    if (a[i] == lf + 1)
    {
      if (a[i] == 1)
      {
        Is1 = true;
        r += i;
      }
      else
      {
        r += i - b[lf - 1] - 1;
      }
      b[lf++] = i;
      // cout << a[i] << ":" << i << endl;
    }
  }
  if (!Is1)
  {
    cout << -1 << endl;
    return 0;
  }
  cout << r + n - b[lf-1] - 1 << endl;
}


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

#define ll long long
// #define endl '\n'

void max_self(int &a, int b){ a = max(a, b);}
void min_self(int &a, int b){ a = min(a, b);}

void solve(){
	string s; cin>>s;
	int cnt = 0;
	for(char i : s){
		cnt += i - '0';
	}
	if(cnt%9){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
	}
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int t = 1;// cin>>t;
	for(int i = 1; i<=t; i++){
		solve();
	}
	return 0;
}


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

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

    bool dup = false;
    map<int, int> memo;
    for (int i=0; i<N; i++) {
        long long A;
        cin >> A;
        memo[A] += 1;
        if (1 < memo[A]) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
      string  n;
      cin>>n;
      long long  t;
      int i=0;
      while(i!=n.length())
      {
        t+=(n[i]-'0');
        t=t%9;
        i++;
      }
    if(t%9==0)
      cout<<"Yes\n";
      else
        cout<<"No\n";
      return 0;}



Measured memory_bytes: 3752
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
void *wmem;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void rd(string &x){
  char *buf=(char *)wmem;
  rd(buf);
  x = buf;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
inline void wt_L(string &x){
  int i=0;
  for(i=0;x[i]!='\0';i++){
    putchar_unlocked(x[i]);
  }
}
char memarr[96000000];
int N;
int L;
string S[100];
int main(){
  int i;
  string res;
  wmem = memarr;
  rd(N);
  rd(L);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<(N);Lj4PdHRW++){
      rd(S[Lj4PdHRW]);
    }
  }
  sort(S,S+N);
  for(i=0;i<(N);i++){
    res += S[i];
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190822-2

// --- original code ---
// int N, L;
// string S[100];
// {
//   int i;
//   string res;
//   rd(N,L,S(N));
//   sort(S,S+N);
//   rep(i,N) res += S[i];
//   wt(res);
// }


Measured memory_bytes: 256
import sys
N = int(input())
b_arr = list(map(int, input().split()))

a_arr = []


while b_arr != []:
    tmp = -1
    for i in b_arr:
        if i-1 > len(b_arr)-1:
            print(-1)
            sys.exit()

        if b_arr[i-1] == i:
            tmp = max(i-1,tmp)

    a_arr.append(b_arr.pop(tmp))

for i in range(N-1,-1,-1):
    print(a_arr[i])


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define PRINT(x) cout<<(x)<<endl
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
#define PB push_back
#define MP make_pair

const int MAX_N = 200000, MAX_M = 200000;

int N, M;
ll K;
ll A[MAX_N];
ll B[MAX_M];

ll cum_A[MAX_N + 1];
ll cum_B[MAX_N + 1];

int main() {
    cin >> N >> M >> K;
    cum_A[0] = 0, cum_B[0] = 0;
    REP(i, N) {
        cin >> A[i];
        cum_A[i+1] = cum_A[i] + A[i];
    }
    REP(i, M) {
        cin >> B[i];
        cum_B[i+1] = cum_B[i] + B[i];
    }

    int ans = 0;
    REP(i, N+1) {
        int num_A = i;
        if (K - cum_A[i] < 0) break;
        int num_B = upper_bound(cum_B, cum_B + M + 1, K - cum_A[i]) - cum_B - 1;
        ans = max(ans, num_A + num_B);
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 9880
N = gets.to_i
S = (1..N).map { gets.chomp }.select {|s| s.match(/^[MARCH]/) }
num = S.group_by {|s| s[0] }.map {|c, a| a.size }
n = num.size

s = 0
for i in 0...n
  for j in (i+1)...n
    for k in (j+1)...n
      s += num[i]*num[j]*num[k]
    end
  end
end

puts s




Measured memory_bytes: 21560
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
 
using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}

template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

ll pow_mod(ll a, ll b, ll mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }

  ll x = 1;

  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}



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

  ll n,m,r;
  std::cin>>n>>m>>r;

  std::vector<std::vector<ll>> graph(n,std::vector<ll>(n,MOD));

  std::vector<ll> sort(r);
  rep(i,0,r){
    std::cin>>sort[i];
    sort[i]--;
  }

  rep(i,0,m){
    ll a,b,c;
    std::cin>>a>>b>>c;
    a--;b--;
    graph[a][b]=c;
    graph[b][a]=c;
  }

  rep(k,0,n){
    rep(i,0,n){
      rep(j,0,n){
        graph[i][j]=std::min(graph[i][j],graph[i][k]+graph[k][j]);
      }
    }
  }

  std::sort(all(sort));

  ll ans=MOD;

  do{
    ll temp=0;
    rep(i,1,r){
      temp+=graph[sort[i]][sort[i-1]];
    }
    chmin(ans,temp);
  }while(std::next_permutation(all(sort)));

  std::cout<<ans;

  return 0;
}

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

int main() {
	int i,x[10000], y[10000];
	
	for(i=1;i<=10000;i++){
		cin >> x[i] >> y[i];
	}
	for(i=1;i<=10000;i++){
		if(y[i] < x[i]){
			cout << y[i] << " " << x[i] <<endl;	
		}else if(y[i]==0 && x[i]==0){
			break;
		}else{
			cout << x[i] << " " << y[i] <<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n;
int d[510][510];
bool bl[510][510];
int ans;
queue<P> que;
int dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 };

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++)for (int j = 0; j < n; j++)d[i][j] = min({ i,j,n - 1 - i,n - 1 - j });
	for (int i = 0; i < n*n; i++) {
		int p; cin >> p; p--;
		ans += d[p / n][p % n];
		bl[p / n][p % n] = true;
		que.push(make_pair(p / n, p % n));
		while (!que.empty()) {
			int x = que.front().first, y = que.front().second; que.pop();
			for (int j = 0; j < 4; j++) {
				int tx = x + dx[j], ty = y + dy[j];
				if (tx < 0 || n <= tx || ty < 0 || n <= ty)continue;
				int s = d[x][y];
				if (!bl[x][y])s++;
				if (s < d[tx][ty]) {
					d[tx][ty] = s;
					que.push(make_pair(tx, ty));
				}
			}
		}
	}
	cout << ans << endl;
}

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


using namespace std;


void atcoder_beginner_contest999()
{
  string n;
  cin >> n;

  for (int i = 0; i < n.size(); ++i)
  {
    if (n[i] == '1') n[i] = '9';
    else if (n[i] == '9') n[i] = '1';
  }
  cout << n << "\n";
}


void programming_education()
{
  int n;
  cin >> n;
  
  if (n == 1)
  {
    cout << "Hello World\n";
    return;
  }
  else
  {
    int a, b;
    cin >> a >> b;
    cout << a + b << "\n";
  }
}

void discount_fare()
{
  int x, y;
  cin >> x >> y;

  cout << x + y / 2 << "\n";
}


void A_114()
{
  int x;
  cin >> x;

  if (x == 3 || x == 5 || x == 7) cout << "YES\n";
  else cout << "NO\n";
}


void christmas_eve_eve_eve()
{
  int d;
  cin >> d;

  if (d == 25) cout << "Christmas\n";
  else if (d == 24) cout << "Christmas Eve\n";
  if (d == 23) cout << "Christmas Eve Eve\n";
  if (d == 22) cout << "Christmas Eve Eve Eve\n";
}


void right_triangle()
{
  int a, b, c;
  cin >> a >> b >> c;

  cout << a * b / 2 << "\n";
}


void entrance_examination()
{
  int t, x;
  cin >> t >> x;

  cout << (double)t / (double)x << "\n";
}


void A_118()
{
  int a, b;
  cin >> a >> b;

  if (b % a == 0) cout << a + b << "\n";
  else cout << b - a << "\n";
}


void still_TBD()
{
  string s;
  cin >> s;

  if (s[5] == '1' || s[6] >= '5') cout << "TBD\n";
  else cout << "Heisei\n";
}


int main()
{
  //atcoder_beginner_contest999();
  //programming_education();
  //discount_fare();
  //A_114();
  //christmas_eve_eve_eve();
  //right_triangle();
  //entrance_examination();
  //A_118();
  still_TBD();
}

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

double delta = pow(0.1,10);

vector<int> next(vector<int> vec, int N, int j){
  if(vec.at(j)==N-1){
    vec.at(j) = 0;
    vec = next(vec,N,j+1);
  }
  else{
    vec.at(j)++;
  }
  return vec;
}

double sqrt(int a){
  double left = 0;
  double right = a;
  double center;
  while(right-left>delta){
    center = (left+right)/2;
    if(center*center<=a){
      left = center;
    }
    else{
      right = center;
    }
  }
  return left;
}

double d(int i, int j, vector<int> x, vector<int> y){
  int X = x.at(i) - x.at(j);
  int Y = y.at(i) - y.at(j);
  return sqrt(X*X+Y*Y);
}

double SUM(vector<int> vec, vector<int> x, vector<int> y){
  double sumation=0;
  for(int i=0; i<vec.size()-1; i++){
    sumation += d(vec.at(i),vec.at(i+1),x,y);
  }
  return sumation;
}

int stair(int N){
  int res = 1;
  for(int i=1; i<=N; i++){
    res*=i;
  }
  return res;
}

int main(){
  int N;
  cin >> N;
  vector<int> x(N), y(N);
  for(int i=0; i<N; i++){
    cin >> x.at(i) >> y.at(i);
  }
  vector<int> vec(N);
  vector<int> vecN(N);
  vector<int> vecs(N);
  for(int i=0; i<N; i++){
    //vecN.at(i) = N-1;
    vecs.at(i) = i;
  }
  //vector<int> ch(N);
  vector<vector<int>> res;
    do {
        res.push_back(vecs);
    } while (next_permutation(vecs.begin(), vecs.end()));
  /*while(vec!=vecN){
    ch = vec;
    sort(ch.begin(),ch.end());
    if(ch==vecs){
      res.push_back(vec);
    }
    vec = next(vec,N,0);
  }*/
  double sumation = 0;
  for(int i=0; i<res.size(); i++){
    sumation += SUM(res.at(i),x,y);
  }
  cout << fixed << setprecision(7);
  cout << sumation/stair(N) << endl;
}

Measured memory_bytes: 3384
N, M, C = map(int,input().split())
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]

count = 0
for Ai in A:
  count += sum(a * b for a,b in zip(Ai,B)) + C > 0
print(count)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define fatafat ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define MOD ((long long)(1e9)+7)
#define excl(i,a,b) for(int i=a;i<b;i++)
#define incl(i,a,b) for(int i=a;i<=b;i++)
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define PII pair<int,int>

using namespace std;

int binexp(int a,int b)
{
    if(b)
    {
        if(b%2)
            return a*binexp(a*a,b/2);
        return binexp(a*a,b/2);
    }
    return 1;
}

int modexp(int a,int b,int m)
{
    if(b)
    {
        if(b%2)
            return (a*modexp((a*a)%m,b/2,m))%m;
        return modexp((a*a)%m,b/2,m);
    }
    return 1;
}

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

int euclidgcd,euclidx,euclidy;

void exteuclid(int a,int b)
{
    if(b==0)
    {
        euclidgcd=a;
        euclidx=1;
        euclidy=0;
    }
    else
    {
        exteuclid(b,a%b);
        int temp=euclidx;
        euclidx=euclidy;
        euclidy=temp-euclidy*(a/b);
    }
}

int modinv(int a,int m)
{
    exteuclid(a,m);
    return (euclidx%m + m)%m;
}

int pmodinv(int a,int m)
{
    return modexp(a,m-2,m);
}

bool checkprime(int a)
{
    for(int i=2;i*i<=a;i++)
        if(a%i==0)
            return false;
    return true;
}

vector<bool> seive(int n)
{
    vector<bool> ret(n+1,true);
    ret[0]=ret[1]=false;
    for(int i=2;i*i<=n;i++)
        if(ret[i])
            for(int j=i*i;j<=n;j+=i)
                ret[j]=false;
    return ret;
}

vector<bool> seivelims(int l,int r)
{
    vector<bool> ret(r-l+1,true);
    for(int i=2;i*i<=r;i++)
    {
        for(int j=max(i*i,((l+i-1)/i)*i);j<=r;j+=i)
        {
            ret[j-l]=false;
        }
    }
    return ret;
}

vector<int> rootnfact(int n)
{
    vector<int> ret;
    for(long i=2;i*i<=n;i++)
        while(n%i==0)
        {
            ret.push_back(i);
            n/=i;
        }
    if(n!=1)
        ret.push_back(n);
    return ret;
}

vector<int> prelognfact(int n)
{
    vector<int> minprime(n+1,0);
    minprime[0]=minprime[1]=0;
    for(int i=2;i*i<=n;i++)
    {
        if(minprime[i]==0)
        {
            for(int j=i*i;j<=n;j+=i)
            {
                if(minprime[j]==0)
                    minprime[j]=i;
            }
        }
    }
    for(int i=2;i<=n;i++)
        if(minprime[i]==0)
            minprime[i]=i;
    return minprime;
}

vector<int> lognfact(int n,vector<int> minprime)
{
    vector<int> ret;
    while(n!=1)
    {
        ret.push_back(minprime[n]);
        n/=minprime[n];
    }
    return ret;
}

signed main()
{
    fatafat;
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
        cin>>arr[i];
    int pre[n],suff[n];
    pre[0]=arr[0];
    suff[n-1]=arr[n-1];
    for(int i=1;i<n;i++)
    {
        pre[i]=__gcd(arr[i],pre[i-1]);
        suff[n-i-1]=__gcd(arr[n-i-1],suff[n-i]);
    }
    int ans=max(suff[1],pre[n-2]);
    //cout<<ans<<endl;
    for(int i=1;i<n-1;i++)
    {
        int temp=__gcd(pre[i-1],suff[i+1]);
        //cout<<temp<<endl;
        if(temp>ans)
            ans=temp;
    }
    cout<<ans;
}

Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
using namespace std;
char s[10];
int a[10];

int main(){
    scanf("%s",s);
    for(int i = 0 ; i < 4 ; i++)    a[i] = s[i]-'0';
    for(int i = 0 ; i < 8 ; i++){
        int tmp = a[0];
        for(int j = 1 ; j < 4 ; j++){
            if( i&(1<<(j-1)) ){
                tmp += a[j];
                s[j] = '+';
            }else{
                tmp -= a[j];
                s[j] = '-';
            }
        }
        if( tmp == 7 ){
            printf("%d%c%d%c%d%c%d=7\n",a[0],s[1],a[1],s[2],a[2],s[3],a[3]);
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, a, b, c, d;
  cin >> n;
  a = n/1000%10;
  b = n/100%10;
  c = n/10%10;
  d = n%10;
  if (a==b && b==c){
    cout << "Yes" << endl;
  }
  else if (b==c && c==d){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


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

typedef long long int ll; 

 
 
 int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
 
ll findlcm(int arr[], int n) 
{ 
    
    ll ans = arr[0]; 
 
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (gcd(arr[i], ans))); 
  
    return ans; 
} 
 
int main() 
{ 
 
	ll n,a=0;
	cin>>n;
    int  arr[n];
    double i, s = 0.0,lcm=0.0; 
	
	    for(int i=0; i<n; i++)
	    {
	        cin>>arr[i];
    	}
    	
    	lcm=findlcm(arr,n);
    	 
    	 for(int i=0; i<n; i++)
	    {
	        a+=lcm/arr[i];
    	}
    	s=lcm/a;
    	cout<<s;
	
	
	return 0; 
} 


Measured memory_bytes: 256
import sys
import bisect
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
nl = lambda: list(map(int, stdin.readline().split()))

n, m = na()
l = []
for i in range(m):
    s = na()
    l.append(s[1::])
p = na()
ans = 0
for i in range(2**n):
    tmp = [0] * n
    flag = True
    for j in range(n):
        if (i >> j) & 1:
            tmp[j] = 1
    for s, pi in zip(l, p):
        total = 0
        for si in s:
            if tmp[si-1]:
                total += 1
        if total % 2 != pi:
            flag = False
            break
    if flag:
        ans += 1
print(ans)





Measured memory_bytes: 3188
#include<iostream>
#include<queue>
using namespace std;
int main(){
	priority_queue<int,vector<int>,greater<int> > q1;
	priority_queue<int > q2;
	int a=0;
	int b=0;
	int i=0;
	long long int x=0;
	
	cin>>a;
	for(i=0;i<a;i++){
		cin>>b;
		q1.push(b);
		q2.push(b);
		x+=b;
	}
	cout<<q1.top()<<" "<<q2.top()<<" "<<x<<endl;
}

Measured memory_bytes: 1348
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pi pair<int ,int >
#define pl pair<ll ,ll >
#define pb push_back
#define vl vector <long long int >
#define vi vector <int >
#define vp vector <pi>
#define mod 1000000007
#define eps 1e-9
#define fi first
#define se second
#define _ <<" "<<
#define forn(x,	n) for(int x = 0; x < n ;++ x) 
#define forn1n(x,n) for(int x = 1; x <= n ;++ x)
#define forn1(x,n) for(int x = 1; x < n ;++ x)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#pragma GCC optimize ("Ofast")
void scan(){}
template<typename F, typename... R> void scan(F &f,R&... r){cin>>f;scan(r...);}
int di_; string dnms_, co_ = ",";
void debug_(){cout<<endl;}
template<typename F, typename... R> void debug_(F &f, R&... r){while(dnms_[di_] != ',')cout<<dnms_[di_++];di_++;cout<<": "<<f<<",";debug_(r...);}
#define debug(...) dnms_=#__VA_ARGS__+co_,di_=0,debug_(__VA_ARGS__)

template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}

int main(){
	IOS

	int a,b;
	cin>>a>>b;
	if(b==1)
		{
			cout<<0;
			return 0;
		}
	
	cout<<((b-1)+(a-2))/(a-1);
 
	return 0;	
}


Measured memory_bytes: 256
A, B, C, X, Y = (int(i) for i in input().split()) 
 
if A + B > 2 * C :
    if X > Y:
        if A > C * 2:
            print(Y * 2 * C + (X - Y) * C * 2)
        else:
            print(Y * 2 * C + (X - Y) * A)
    else:
        if B > C * 2:
            print(X * 2 * C + (Y - X) * C * 2)
        else:
            print(X * 2 * C + (Y - X) * B)
else:
    print(A * X + B * Y)

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
		for (int i=0; i<=100; i++) {
			if ( (i*A%B) == C ) {
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");
	}
}


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

int map[101][101];

bool solve(int map[][101]){
	int a, b, c;
	a=b=c=0;
	for(int i=1; i<=100; i++){
		a+=map[1][i];//?§????????????????
		b+=map[2][i];//??????????????????
	}
	if(!(a%2)||!(b%2))return false;//??¶??°?????£???????????????

	for(int i=3; i<=100; i++){
		for(int j=1; j<=100; j++){
			c+=map[i][j];//?§???????????????\???????????????
		}
		if(c%2)return false;//?\???°???????????????
		c=0;
	}
	return true;
}

int main(){
	int a, b;

	while(1){
		fill(&map[0][0], &map[101][101], 0);
		while(cin>>a>>b, a||b){
			map[a][b]++;
			map[b][a]++;
		}
		if(cin.eof())break;
		solve(map) ? cout<<"OK\n" : cout<<"NG\n";
	}
	return 0;
}

Measured memory_bytes: 3052
#include<stdio.h>

int main()
{
 char st[105];
 int i, midchar;
 int charcount=0;

 for(i=0; i<100; i++)
 {
  scanf("%c",&st[i]);
  if((st[i]<'a')|(st[i]>'z')) break;
  charcount++;
 }

 midchar=charcount-2;
 printf("%c%d%c\n",st[0],midchar,st[charcount-1]);
return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	
	int a[10000], b[10000];
	char op[10000];
	int soe = 0, max;
	
	while (op[soe - 1] != '?'){
		scanf("%d %c %d", &a[soe], &op[soe], &b[soe]);
		
		++soe;
	
	}
	
	max = soe - 1;
	
	soe = 0;
	while (soe != max){
		if (op[soe] == '+'){
			printf("%d\n", a[soe] + b[soe]);
			
		}
		
		else if (op[soe] == '-'){
			printf("%d\n", a[soe] - b[soe]);
		}
		
		else if (op[soe] == '*'){
			printf("%d\n", a[soe] * b[soe]);
		}
		else {
			printf("%d\n", a[soe] / b[soe]);
		}
		
		++soe;
		
	}
	
	return 0;
}

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

int main(){
	int N, M, X;
	cin >> N >> M >> X;
	vector<int> A(100);
	int cnt = 0;
	for(int i = 0; i < M; i++)
	{
		cin >> A[i];
		if(A[i] < X) cnt++;
	}
	int mincost = min(cnt, M-cnt);
	cout << mincost << endl;
	

	return 0;
}

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

const int maxn(105);

int n;
vector < pair <int, int> > que, edge;

int main() {
	int i, j, l;
	scanf("%d", &n);
	if (~n & 1) {
		for (i = 1; i <= n; ++i)
			for (j = i + 1; j <= n; ++j)
				if (i + j == n + 1) que.push_back(make_pair(i, j));
		l = que.size();
		for (i = 0; i < l; ++i)
			for (j = i + 1; j < l; ++j) {
				edge.push_back(make_pair(que[i].first, que[j].second));
				edge.push_back(make_pair(que[i].first, que[j].first));
				edge.push_back(make_pair(que[i].second, que[j].second));
				edge.push_back(make_pair(que[i].second, que[j].first));
			}
	}
	else {
		for (i = 1; i <= n; ++i)
			for (j = i + 1; j <= n; ++j)
				if (i + j == n) que.push_back(make_pair(i, j));
		l = que.size();
		for (i = 0; i < l; ++i) {
			edge.push_back(make_pair(que[i].first, n));
			edge.push_back(make_pair(que[i].second, n));
			for (j = i + 1; j < l; ++j) {
				edge.push_back(make_pair(que[i].first, que[j].second));
				edge.push_back(make_pair(que[i].first, que[j].first));
				edge.push_back(make_pair(que[i].second, que[j].second));
				edge.push_back(make_pair(que[i].second, que[j].first));
			}
		}
	}
	printf("%d\n", j = (int)edge.size());
	for (i = 0; i < j; ++i) printf("%d %d\n", edge[i].first, edge[i].second);
	return 0;
}

Measured memory_bytes: 384
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
const int dx[8] = { -1,0,1,-1,1,-1,0,1 };
const int dy[8] = { 1,1,1,0,0,-1,-1,-1 };


//LOVE NyantakoGG	https://www.youtube.com/channel/UC6XdFs8T6Ei54O0FYl3PVVA


using namespace std;



int main() {
	int N;
	cin >> N;
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			if (4 * i + 7 * j == N) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}


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

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0LL)
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

template<typename A, size_t N, typename T> // n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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

int res;

int rec(int a, int b){
  if (a>b) swap(a,b);

  if (b%a!=0){
    res += (b/a)*a*2;
    rec(b%a, a);
  }
  else{
    res += (b/a)*a*2;
    res -= a;
    return 0;
  }
}

int solve(){
  int n,x;cin>>n>>x;

  res = n;
  rec(n-x, x);

  cout << res << endl;

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long n,m,i,j,k,x=0,y=0,z,xx,yy;
    string s;
    cin>>s;
    stack<char>st;
    for(i=0;i<s.size();i++){
        if(s[i]=='0'){
            if(!st.empty()){
                char c=st.top();
                if(c=='1'){
                    x=x+2;
                    st.pop();
                }
                else{
                    st.push(s[i]);
                }
            }
            else{
                st.push(s[i]);
            }
        }
        else{
            if(!st.empty()){
                char c=st.top();
                if(c=='0'){
                    x=x+2;
                    st.pop();
                }
                else{
                    st.push(s[i]);
                }
            }
            else{
                st.push(s[i]);
            }
        }
    }
    cout<<x<<endl;
}


Measured memory_bytes: 512
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int x = sc.nextInt();
      int y = sc.nextInt();
      Map<Integer, List<Integer>> graph = new HashMap<>();
      for(int i = 1; i <= n; i++) graph.put(i, new ArrayList<>());
      for(int i = 1; i < n; i++) {
        graph.get(i).add(i+1);
        graph.get(i+1).add(i);
      }
      graph.get(x).add(y);
      graph.get(y).add(x);

      Map<Integer, Integer> cntMap = new HashMap<>();
      for(int i = 1; i <= n; i++)
          bfs(cntMap, graph, i);
      
      for(int k = 1; k <= n - 1; k++)
        System.out.println(cntMap.getOrDefault(k, 0));
  }

  private static void bfs(Map<Integer, Integer> cntMap, Map<Integer, List<Integer>> graph, int start) {
      Set<Integer> visited = new HashSet<>();
      visited.add(start);
      Queue<Integer> queue = new LinkedList<>();
      queue.offer(start);
      int t = 0;
      while(!queue.isEmpty()) {
        int size = queue.size();
        for(int i = 0; i < size; i++) {
          int node = queue.poll();
          List<Integer> children = graph.get(node);
          for(int child : children) {
            if(visited.contains(child)) continue;
            visited.add(child);
            queue.offer(child);
            if(start < child)
                cntMap.put(t+1, cntMap.getOrDefault(t+1, 0) + 1);
          }
        }
        t++;
      }
  }
}

Measured memory_bytes: 254116
from sys import setrecursionlimit 
setrecursionlimit(10**6)

n, m, k = map(int, input().split())

fr = [set() for _ in range(n)]
bl = [set() for _ in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    fr[a-1].add(b-1)
    fr[b-1].add(a-1)
    
for i in range(k):
    c ,d = map(int, input().split())
    bl[c-1].add(d-1)
    bl[d-1].add(c-1)
    
def dfs(v, temp):
    visited[v] = True
    temp.add(v)
    for i in fr[v]:
        if visited[i] == False:
            temp = dfs(i, temp)
    return temp
visited = [False]*n

cc = [0]*n
for v in range(n):
    if visited[v] == False:
        c = dfs(v,set())
        for i in c:
            cc[i] = c


ans = []
for i in range(n):
    aa = len(cc[i]) - len(cc[i] & fr[i]) - len(cc[i] & bl[i]) - 1
    ans.append(aa)
print(*ans)


Measured memory_bytes: 103068