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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);
template<long long Mod = mod>
constexpr long long MOD(long long in) {
    return in % Mod;
}

int n, a, b, c, d;
std::string s;
int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    std::cin >> n >> a >> b >> c >> d;
    std::cin >> s;
    --a, --b, --c, --d;

    bool ok1 = true;
    bool before = false;
    for (int i = a; i <= c; ++i)
        if (s[i] == '#' && before) {
            ok1 = false;
            break;
        }
        else
            before = s[i] == '#';

    bool ok2 = true;
    before = false;
    for (int i = b; i <= d; ++i)
        if (s[i] == '#' && before) {
            ok2 = false;
            break;
        }
        else
            before = s[i] == '#';

    if (c < d) {
        if (ok1 && ok2)
            std::cout << "Yes" << std::endl;
        else
            std::cout << "No" << std::endl;
    }
    else {
        bool ok3 = false;
        int cnt = 0;
        if (s[b - 1] == '.' && s[b + 1] == '.' || s[d - 1] == '.' && s[d + 1] == '.')
            ok3 = true;
        else
            for (int i = b; i <= d; ++i)
                if (s[i] == '.') {
                    ++cnt;

                    if (cnt > 2) {
                        ok3 = true;
                        break;
                    }
                }
                else {
                    cnt = 0;
                }

        if (ok1 && ok2 && ok3)
            std::cout << "Yes" << std::endl;
        else
            std::cout << "No" << std::endl;
    }

    return 0;
}


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

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)
// ----------------------------------------------------------------------

// ----------------------------------------------------------------------
int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  int A, B, T;
  cin >> A >> B >> T;
  int n = B * (T / A);
  cout << n << endl;

  return 0;
}



Measured memory_bytes: 256
def INSTR():
	return input()

def INNUM():
	return int(INSTR())

def INSTR_S():
	return INSTR().split()

def INNUM_S():
	return map(int, INSTR_S())

def INSTR_SM(n):
	return [tuple(INSTR_S()) for _ in range(n)]

def INNUM_SM(n):
	return [tuple(INNUM_S()) for _ in range(n)]

A, B, C = INSTR_S()
print("YNEOS"[not(A[-1]==B[0] and B[-1]==C[0])::2])

Measured memory_bytes: 3064
#include <stdio.h>
#define MAX 100000
int parent(int i){
  return i/2;
}
int left(int i){
  return 2*i;
}
int right(int i){
  return (2*i)+1;
}

int main() {
  int num,Heap[MAX + 1],i;
  scanf("%d",&num);
  for(i=1;i<=num;++i){
    scanf("%d",&Heap[i]);
  }   
  for(i=1;i<=num;++i){
    printf("node %d: key = %d, ",i,Heap[i]);
    if(parent(i) >= 1)
      printf("parent key = %d, ",Heap[parent(i)]);
    if(left(i) <= num)
      printf("left key = %d, ",Heap[left(i)]);
    if(right(i) <= num)
      printf("right key = %d, ",Heap[right(i)]);
    printf("\n");
  }
    
  return 0;
}


Measured memory_bytes: 2104
//https://codeforces.com/blog/entry/10315
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

typedef struct node {
	ll s, e, val, pos;
	bool operator<(const node& n) const {
		if (e != n.e) return e < n.e;
		return val > n.val;
	}
	node() {};
	node(ll ss, ll ee, ll v, ll p) {
		s = ss, e = ee, val = v, pos = p;
	}
} node;
#define max 2000007

ll occs[max], tree[max], n, ans[max];

void update(ll x, ll val) {
	while (x <= n) {
		tree[x] += val;
		x += x & -x;
	}
}

ll query(ll x) {
	ll ret = 0;
	while (x > 0) {
		ret += tree[x];
		x -= x & -x;
	}
	return ret;
}

int main()
{
	ll q, s, e;
	vector<node> v;
	// scanf("%d", &n);
	cin >> n >> q;
	for (ll i = 1; i <= n; i++) {
		// scanf("%d", &s);
		cin >> s;

		v.push_back(node(i, i, s, -1));
	}
	for (ll i = 0; i < q; i++) {
		// scanf("%d %d", &s, &e);
		cin >> s >> e;
		v.push_back(node(s, e, 0, i));
	}

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

	for (ll i = 0; i < v.size(); i++) {
		if (v[i].val == 0) {
			ans[v[i].pos] = query(v[i].e) - query(v[i].s - 1);
		} else {
			if (occs[v[i].val] != 0) update(occs[v[i].val], -1);
			update(v[i].s, 1);
			occs[v[i].val] = v[i].s;
		}
	}

	for (ll i = 0; i < q; i++) {
		cout << ans[i] << "\n";
		// printf("%d\n", ans[i]);
	}

	return 0;
}


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

int main() {
    int H, N;
    cin >> H >> N;  //入力

    vector<int> A(N);

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

    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());

    int allattack = 0;

    for (int i = 0; i < N; i++) {
        allattack += A.at(i);
    }

    // cout << allattack << endl;

    if (H <= allattack) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


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

const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.14159265;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,n,r) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,n,0)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()

#define cout cout << setprecision(12)

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;
using pq = priority_queue<ll>;

template < typename T >
inline void dbg(T a) { cout << a << ' '; }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s,t,u;
char c;

/*--------------------template--------------------*/

int main() {
    cin >> s >> t >> n >> m >> u;
    if (s == u) 
   		cout << n -1 << ' ' << m;
  	else
    	cout << n << ' ' << m-1 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static void cut(int[] deck, int p, int c) {
        // deck???p????????????c????????????????????£????????????
        int[] temp = new int[c]; //p???????????????c????????????????????????
        System.arraycopy(deck, p-1, temp, 0, c); //p????????????c??????temp?????????
        System.arraycopy(deck, 0, deck, c, p-1); //p????????????c??????temp?????????
        System.arraycopy(temp, 0, deck, 0, c); //p????????????c??????temp?????????
   }

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

        while (true) {
            n = sc.nextInt();
            r = sc.nextInt();
            if (n == 0)
                break;

            int[] deck = new int[n];
            for (int i = 0; i < n; i++) {
                deck[i] = n-i;
            }

            for (int i = 0; i < r; i++) {
                p = sc.nextInt();
                c = sc.nextInt();
                cut(deck, p, c);
            }

            System.out.println(deck[0]);
        }

    }
}

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

using namespace std;

const int N = 2e5 + 10;

int n;
char a[N];
char s[N];
int nxt[N];
int nn[N][30];
int fa[N][20];

int go(int h) {
  int ret = 0;
  for (int i = 19 - 1; i >= 0; --i) {
    if (fa[h][i] <= n) {
      h = fa[h][i];
      ret += 1 << i;
    }
  }
  return ret;
}

int main() {
  scanf("%s", a);
  n = strlen(a);
  for (int j = 0; j < 26; ++j) {
    nn[n + 1][j] = n + 1;
    nn[n][j] = n + 1;
  }
  nxt[n + 1] = n + 1;
  nxt[n] = n + 1;
  for (int i = n - 1; i >= 0; --i) {
    nn[i][a[i] - 'a'] = i + 1;
    for (int j = 0; j < 26; ++j) {
      if (j != a[i] - 'a') nn[i][j] = nn[i + 1][j];
    }
    nxt[i] = *max_element(nn[i], nn[i] + 26);
  }
  for (int j = 0; j <= n + 1; ++j) fa[j][0] = nxt[j];
  for (int i = 1; i < 20; ++i) {
    for (int j = 0; j <= n + 1; ++j) {
      fa[j][i] = fa[fa[j][i - 1]][i - 1];
    }
  }
  /*
  for (int j = 0; j <= n + 1; ++j) {
    for (int i = 0; i < 20; ++i) cout << fa[j][i] << " "; cout << endl;
  }*/
  int z = go(0);
  // z + 1
  int head = 0;
  for (int i = 0; i < z + 1; ++i) {
    for (s[i] = 'a'; s[i] <= 'z'; ++s[i]) {
      int nw = nn[head][s[i] - 'a'];
      //cout << i << " " << head << " " << nw << endl;
      if (nw > n) {
        head = nw;
        break;
      }
      int t = go(nw);
      if (t + i + 1 < z + 1) {
        head = nw;
        break;
      }
    }
  }
  puts(s);
  return 0;
}


Measured memory_bytes: 40320
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <bitset>
#include <iomanip>
#include <deque>
#include <tuple>
#include <algorithm>

using namespace std;

int main()
{
    string s;
    int ans = 700;

    cin >> s;

    for (int i = 0; i < 3; i++) {
        if (s[i] == 'o') {
            ans += 100;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
const int maxn = 1010;
int n, m, col[maxn], cnt[2], x[maxn], y[maxn], tot;
bool flag = 1, edge[maxn][maxn], vis[maxn], dp[maxn][maxn];

void dfs(int u) {
	vis[u] = 1;
	cnt[col[u]]++;
	for(int i=1; i<=n; i++)
		if(!edge[u][i]) {
			if(!vis[i]) {
				col[i] = !col[u];
				dfs(i);
				if(!flag) return;
			}
			else {
				if(col[i] == col[u] && i != u) {
					flag = 0;
					return;
				}
			}
		}
}

int main()
{
	scanf("%d%d", &n, &m);
	for(int i=1; i<=m; i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		edge[u][v] = edge[v][u] = 1;
	}
	for(int i=1; i<=n; i++) {
		if(!vis[i]) {
			cnt[0] = cnt[1] = 0;
			dfs(i);
			if(!flag) {
				cout<<"-1"<<endl;
				return 0;
			}
			x[++tot] = cnt[0], y[tot] = cnt[1];
		}
	}
	dp[0][0] = 1;
	int ans = 1e9;
	for(int i=1; i<=tot; i++)
		for(int j=0; j<=n; j++)
			if(dp[i-1][j]) {
				dp[i][j+x[i]] = 1;
				dp[i][j+y[i]] = 1;
			}
	for(int i=1; i<n; i++)
		if(dp[tot][i]) ans = min(ans, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
	cout<<ans<<endl;
}

Measured memory_bytes: 1664
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int a = in.nextInt();
            char c = in.next().charAt(0);
            int b = in.nextInt();
            out.println(c == '+' ? a + b : a - b);
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}



Measured memory_bytes: 21332
import itertools

def comb(n, r):
    return len(list(itertools.combinations(range(n), r)))

def get_runlength(s): # ex) s = 'RRLLLLRLRLRLRR'
    ret = []
    count = 1
    for i in range(len(s)):
        if i == len(s) - 1:
            ret.append((s[i], count))
            continue
        if s[i] == s[i + 1]:
            count += 1
        else:
            ret.append((s[i], count))
            count = 1
    return ret

n = int(input())
dic = {}
for i in range(n):
    sin = input()
    sin = list(sin)
    sin.sort()
    sin = ''.join(sin)
    try:
        dic[sin] += 1
    except:
        dic[sin] = 1

count = 0
for v in dic.values():
    count += v * (v - 1) / 2
count = int(count)
print(count)

Measured memory_bytes: 17936
#include<stdio.h>
#include<string.h>
int main()
{
    int h, w;
    scanf("%d %d", &h, &w);
    int i, j;
    char s[30][30][10];
    for (i = 0; i < h; i++)
        for (j = 0; j < w; j++)
            scanf("%s", s[i][j]);
    char ans[10] = "snuke";
    for (i = 0; i < h; i++)
        for (j = 0; j < w; j++)
            if (strcmp(ans, s[i][j]) == 0)
                printf("%c%d\n", 'A' + j, i + 1);
    return 0;
}

Measured memory_bytes: 128
#include<cstdio>
int main(){
	int a,b,c,d,man,woman;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	man=a*b;
	woman=c*d;
	if(man>woman) printf("%d",man);
	else if(man<woman) printf("%d",woman);
	else if(man == woman) printf("%d",man);
	return 0;
	}

Measured memory_bytes: 128
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)

using namespace std;



int main()
{
	int n,A[3000],f=0,max=0,ans=0;
	cin >> n;
	rep(i, n) {
		cin >> A[i];
		ans += A[i] - 1;
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int k,n;
  cin >> k >> n;
  
  vector<int>a(n+1);
  for(int i=0; i<n; i++){
   cin >> a[i]; 
  }
  a[n]=a[0]+k;
  
  int Max=0;
  for(int i=0; i<n+1; i++){
    int s=a[i+1]-a[i];
    Max = max(Max,s);
  }
  
  int ans = k-Max;
  
  cout << ans << endl;
  
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool flag){
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}
void fp(bool flag, string s, string t){
    if(flag)cout << s << endl;
    else cout << t << endl;
}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl digit10(intl a){
    if(!a)return 1;
    intl b = 0;
    while(a){
        a /= 10;
        b++;
    }
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n,k;
    cin >> n >> k;
    ld p[n];
    rep(i,n){
        ld a;
        cin >> a;
        p[i] = (a + 1) / 2;
    }
    //rdebug(i,p);
    ld max = 0;
    rep(i,k){
        max += p[i];
    }
    ld m = max;
    repi(i,k,n){
        m -= p[i - k];
        m += p[i];
        max = max(m,max);
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
using namespace std;
int main(){
	int a, b, c, t=0;
	cin >> a >> b >> c;
	if (a>=b){
		for(b;b<=a;b++){
			if (b==c){
				 t=1;
			}
		}
	}else if(b>=a){
		for(a;a<=b;a++){
			if (a==c){
			t=1;
			}
		}
	}if (t==1){
				cout << "Yes" << endl;
			}else {
				cout << "No" << endl;
			}
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <stdio.h>
#include <math.h>
using namespace std;
 
#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
 
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, P> PP;
 
struct edge {
	int to, cost;
	edge(int t, int c) :to(t), cost(c) {}
};
 
int dx[] = { 1,-1,0,0 }, dy[] = { 0,0,1,-1 };
int ddx[] = { 1,1,1,0,-1,-1,-1,0 }, ddy[] = { 1,0,-1,-1,-1,0,1,1 };
 
ll mypow(ll x, ll n, ll m) {	//xのn乗をmで割った余り
	if (n == 0) return 1;
	if (n % 2 == 0) return mypow(x*x%m, n / 2, m);
	else return x*mypow(x, n - 1, m) % m;
}
 
//-----------------------------------------------------------------------------

int a,b,c,d;

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

	cin>>a>>b>>c>>d;
	cout<<max(a*b,c*d)<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

vector<long long int> v(1, 1), p(1, 1);

long long int f(long long int layer, long long int x) {
	if (x == 0) return 0;
	if (x == 1) {
		if (layer == 0) return 1;
		return 0;
	}

	if (x <= v[layer - 1] + 1) {
		return f(layer - 1, x - 1);
	} else {
		return p[layer - 1] + 1 + f(layer - 1, min(x - 2 - v[layer - 1], v[layer - 1]));
	}
}

int main() {
    long long int n, x;
    cin >> n >> x;
    for (int i = 1; i <= n; i++) {
    	v.push_back(2 * v.back() + 3);	
    	p.push_back(2 * p.back() + 1);
    }
    cout << f(n, x) << endl;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);

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

  if (N <= 9) {
    cout << N << endl;
    return 0;
  }

  int ans = 0;
  int cnt = 0;
  int x = N;
  while (N > 0) {
    N /= 10;
    if (cnt % 2 == 0) {
      if (N > 0) {
        ans += 9 * pow(10, cnt);
      } else {
        int mod = x % (int)pow(10, cnt+1) - pow(10, cnt);
        ans += mod + 1;
      }
    }
    cnt++;
  } 
  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class E
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = Scanner.Scan<int>();
            var A = Scanner.ScanEnumerable<long>().ToArray();
            var max = (int)1e6 + 1;
            var sieve = new int[max];
            foreach (var a in A) sieve[a]++;

            var isPairwise = true;
            for (var i = 2; i < max && isPairwise; i++)
            {
                var count = 0;
                for (var j = i; j < max; j += i)
                {
                    count += sieve[j];
                }
                if (count > 1) isPairwise = false;
            }
            if (isPairwise)
            {
                Console.WriteLine("pairwise coprime");
                return;
            }

            var gcd = A.Aggregate((x, y) => GCD(x, y));
            Console.WriteLine(gcd == 1 ? "setwise coprime" : "not coprime");
        }

        static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
            public static IEnumerable<T> ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(x => (T)Convert.ChangeType(x, typeof(T)));
        }
    }
}


Measured memory_bytes: 126316
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define PPF pop_front
#define PPB pop_back
#define MA make_pair
#define ll long long
#define PA pair<int,int>
#define VE vector<int>
#define VP vector<PA>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
//
struct poi{
  int X;int Y;int Z;
  bool operator<(const poi&R)const{
    return X==R.X ? Y==R.Y ? Z<R.Z : Y<R.Y : X<R.X;
  }
};
//
//
int main(){
	string S;
	int K;
	cin>>S>>K;
	int L=S.size();
	vector<string> V;
	set<string> s;
	FOR(i,1,min(10,L)+1){
		FOR(j,0,L-i+1){
			string aa;
			FOR(k,j,j+i){
				aa=aa+S[k];
			}
			if(s.find(aa)!=s.end()){
				continue;
			}
			s.insert(aa);
			V.PB(aa);
		}
	}
	sort(V.begin(),V.end());
	cout<<V[K-1]<<endl;
	return 0;
}


Measured memory_bytes: 4344
#include <stdio.h>
typedef long long int key;

void marge(key data[], key work[], int start, int mid, int end){
    int i = start;
    int j = mid + 1;
    int k = start;
    while(i <= mid && j <= end){
        if(data[i] <= data[j]){
            work[k++] = data[i++];
        }else{
            work[k++] = data[j++];
        }
    }
    
    if(i <= mid){
        while(i <= mid){
            work[k++] = data[i++];
        }
    }else{
        while(j <= end){
            work[k++] = data[j++];
        }
    }
    
    for(k = start; k <= end; k++){
        data[k] = work[k];
    }
}

void margesort(key data[], key work[], int start, int end){
    int mid;
    if(start < end){
        mid = start + (end - start)/2;
        margesort(data, work, start, mid);
        margesort(data, work, mid + 1, end);

        marge(data, work, start, mid, end);
    }
}

int main(void){
    int n, k;
    static long long int h[1000000];
    static long long int work[1000000];
    long long int count;
    int i;
    
    scanf("%d %d", &n, &k);
    
    for(i = 0; i < n; i++){
        scanf("%lld", &h[i]);
    }
    
    margesort(h, work, 0, n-1);
    count = 0;
    for(i = n-k-1; i >= 0; i--){
        count += h[i];
        //printf("%ld", h[i]);
    }
    
    printf("%lld", count);
    return 0;
}

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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

vector<ll> A;
// vectorのリサイズ
// A.resize(N);

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

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

  string s, t;
  cin >> s >> t;
  int ans = 0;
  rep(i, 3) {
    if (s[i] == t[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int N;
vector<int> x, y, h;

int solve(int i, int j) {
  int H = -1;
  int Hmax = 1e9 + 300;
  rep(k,N) {
    int d = abs(x[k] - i) + abs(y[k] - j);
    if(h[k] == 0) {
      Hmax = min(Hmax, d);
    } else {
      int t = h[k] + d;
      if(H != -1 && t != H) return -1;
      H = t;
    }
    if(H > Hmax) return -1;
  }
  return H == -1 ? Hmax : H;
}

int main () {

  cin >> N;

  x = vector<int>(N);
  y = vector<int>(N);
  h = vector<int>(N);
  rep(i,N) {
    cin >> x[i] >> y[i] >> h[i];
  }

  rep(i,101) {
    rep(j,101) {
      int res = solve(i, j);
      if(res != -1) {
        printf("%d %d %d\n", i, j, res);
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
from array import array
import bisect
import collections
import heapq
import itertools
import operator
import sys


class BIT:
    def __init__(self, n):
        self.n = n
        self.arr = array("l", [0] * (n + 1))

    def __str__(self):
        return str(self.arr.tolist())

    def add(self, i, x):
        while i <= self.n:
            self.arr[i] += x
            i += i & -i

    def sum(self, i, j=None):
        if j is None:
            s = 0
            while i > 0:
                s += self.arr[i]
                i -= i & -i
            return s

        if i > j:
            raise ValueError

        return self.sum(j) - self.sum(i - 1)


def main():
    n = int(sys.stdin.readline())
    nums = list(map(int, sys.stdin.readline().split()))
    d = dict((num, i) for i, num in enumerate(sorted(set(nums)), 1))
    # print(d)
    bit = BIT(n + 1)

    ans = 0
    for num in nums:
        bit.add(d[num], 1)
        # print(bit)
        ans += bit.sum(d[num] + 1, n + 1)

    print(ans)


if __name__ == "__main__":
    main()



Measured memory_bytes: 42428
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            long[] W = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long sumLeft = 0;
            long sumRight = 0;
            List<long> result = new List<long>();
            for (int j = 0; j < N; j++)
            {
                 sumLeft += W[j];
                 sumRight = W.Sum()-sumLeft;
                result.Add(Math.Abs(sumLeft - sumRight));
            }
            result.Sort();
            Console.WriteLine(result[0]);
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


Measured memory_bytes: 13524
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
//////////////////////////////////


int main() {
  long long n; cin >> n;

  string ans = "";
  while(n) {
    n--;
    ans += 'a' + (n%26);
    n /= 26;
  }
  reverse(all(ans));
  cout << ans << endl;
  return 0;
}

// EOF

Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
bool h[9][9]={
	{0,1,0,1,0,0,0,0,0},
	{1,0,1,0,1,0,0,0,0},
	{0,1,0,0,0,1,0,0,0},
	{1,0,0,0,1,0,1,0,0},
	{0,1,0,1,0,1,0,1,0},
	{0,0,1,0,1,0,0,0,1},
	{0,0,0,1,0,0,0,1,0},
	{0,0,0,0,1,0,1,0,1},
	{0,0,0,0,0,1,0,1,0}
};
int main(){
	string s;
	rep(i,1000){
		cin>>s;
		bool ans=true;
		rep(j,s.size()-1)if(!h[s[j]-'A'][s[j+1]-'A']){
			ans=false;
			break;
		}
		if(ans)cout<<s<<endl;
	}
}

Measured memory_bytes: 1176
#include <cstdio>
#include <algorithm>

const int MaxN = 505;

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

int n, dp[MaxN][MaxN];
bool vis[MaxN][MaxN];

void dfs(int x, int y) {
	int t = dp[x][y] + !vis[x][y];
	for (int d = 0; d < 4; ++d) {
		int X = x + dx[d];
		int Y = y + dy[d];
		if (X >= 0 && Y >= 0 && X < n && Y < n && dp[X][Y] > t) {
			dp[X][Y] = t;
			dfs(X, Y);
		}
	}
}

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			dp[i][j] = std::min({i, j, n - i - 1, n - j - 1});
		}
	}
	int ans = 0;
	for (int i = n * n; i; --i) {
		int p;
		scanf("%d", &p); --p;
		int x = p % n, y = p / n;
		ans += dp[x][y];
		vis[x][y] = 1;
		dfs(x, y);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 18396
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    int n,r;
    cin >> n >> r;
    cout << r + (n >= 10 ? 0 : 100 * (10 - n)) << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define pi  acos(-1)
const int w=2e5+5;
const ll mod=998244353;
int main()
{
    int i,j;
    string a;
    cin>>a;
    if(a[2]==a[3]&&a[4]==a[5])
        puts("Yes");
    else
        puts("No");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    ll n,k;
    cin >> n >> k;
    
    cout << min(n%k,abs(n%k-k)) <<endl;


}

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

constexpr int MOD=(int)1e5;

constexpr int MAX_S=3000;

int n,m,s;

int dp[50][MAX_S+1];

int main() {

    while(std::cin>>n>>m>>s, n+m+s){

        std::memset(dp,0,sizeof(dp));

        dp[0][0]=1;

        for(int i=1;i<=std::min(m,s);++i){
            for(int j=n*n;j>0;--j){
                for(int k=i;k<=s;++k)
                    dp[j][k]=(dp[j][k]+dp[j-1][k-i])%MOD;
            }
        }
        
        std::cout<<dp[n*n][s]<<std::endl;
    }

    return 0;
}

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

const int MAXN = 1e6 + 100 ; 

pair<int , int> a[MAXN] ; 
int32_t main(){

	ios_base::sync_with_stdio(0) ; 
	cin . tie(0) ; cout . tie(0) ;

	int n ; cin >> n ;
	for(int i = 0 ; i < n ; i ++){
		cin >> a[i] . first ; a[i] . second = i ; 
	}
	sort(a , a + n) ; 
	int ans = 0 ; 
	for(int i = 0 ; i < n ; i ++)
		ans += (i + a[i] . second) % 2 ; 
	cout << ans / 2 ; 

}

Measured memory_bytes: 1024
data = [str(i) for i in input().split()]
stack = []


def is_int(num) -> bool:
    try:
        int(num)
    except ValueError:
        return False
    return True


for d in data:
    if is_int(d):
        stack.append(d)
    else:
        if d == '+':
            a = int(stack.pop())
            b = int(stack.pop())
            stack.append(a + b)
        elif d == '-':
            a = int(stack.pop())
            b = int(stack.pop())
            stack.append(b - a)
        elif d == '*':
            a = int(stack.pop())
            b = int(stack.pop())
            stack.append(a * b)
        else:
            raise ValueError('+, -, *以外の演算子が出現。')
print(stack.pop())


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

int A[25];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);

    int N;
    cin >> N;

    for(int i=1; i<=N; i++)
        cin >> A[i];
    
    int ans = 0;

    for(int i=2; i<=N-1; i++)
        ans += A[i] != max(A[i], max(A[i-1], A[i+1])) && A[i] != min(A[i], min(A[i-1], A[i+1]));

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
using Pl=pair<ll,ll>;
using PPl=pair<ll,Pl>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n,t;
    cin>>n>>t;
    int ans=INF;
    REP(i,n){
        int a,b;
        cin>>a>>b;
        if(b<=t){
            chmin(ans,a);
        }
    }
    if(ans==INF){
        cout<<"TLE"<<endl;
    }else{
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] date = scanner.next().split("");
        date[3] = "8";
        StringBuilder d = new StringBuilder();
        for (String aDate : date) {
            d.append(aDate);
        }
        System.out.println(d);

    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int n, m, x;
      int left = 0, right = 0;
      cin >> n >> m >> x;
      vector<int> vec(m);
      for(int i = 0; i < m; i++) {
        cin >> vec.at(i);
      }
      for (int i = 0; i < m; i++) {
        if (vec.at(i) > x) left++;
        else right++;
      }
      cout << min(left, right) << endl;
    }

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i = 1; i <= 100000; i++) {
        if (i * 108 / 100 == n) {
            cout << i;
            return 0;
        }
    }
    cout << ":(";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;

int main() {
	int a, b;
	cin >> a >> b;
	if (a < 0 && b > 0) {
		cout << "Zero" << endl;
		return 0;
	}
	if (a == 0 || b == 0) {
		cout << "Zero" << endl;
		return 0;
	}
	if (a > 0) {
		cout << "Positive" << endl;
		return 0;
	}
	if ((a - b+1) % 2 == 0) {
		cout << "Positive" << endl;
	}
	else {
		cout << "Negative" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int A,B;
cin >> A >> B;
if (A % 2 == 1 && B %2 == 1) cout << "Yes" << endl;
else cout << "No" << endl;

return 0;
}


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

int main()
{
	long double a, b, h, m;
  	cin >> a >> b >> h >> m;
  	cout << setprecision(20) << sqrt(a * a + b * b - 2 * a * b * cos(abs(6*m - (30*h+0.5*m))/180*3.141592653589793238)) << endl;
}


Measured memory_bytes: 4044
#include<iostream>
#include<iomanip>
#include<complex>
using namespace std;
typedef complex<double> Point;

Point Rfl(Point z1, Point z2, Point z3) {
    Point z = (z3 - z1) / (z2 - z1);
    return (z2 - z1) * conj(z) + z1;
}

int main() {
    int n;
    double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> n;
    Point z1(x1, y1), z2(x2, y2);
    while (n--)
    {
        cin >> x3 >> y3;
        Point z3(x3, y3);
        Point p = Rfl(z1, z2, z3);
        cout << fixed << setprecision(10) << p.real() << " " << p.imag() << endl;
    }
    return 0;
}


Measured memory_bytes: 3288
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int a, b, k;
    cin >> a >> b >> k;
    if(a + k - 1 >= b - k + 1){
        for(int i = a; i <= b; i++) cout << i << endl;
    }else{
        for(int i = a; i < a + k; i++) cout << i << endl;
        for(int i = b - k + 1; i <= b; i++) cout << i << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void) {
  char S[100];
  scanf("%s", S);
  int l = strlen(S);
  for (int i = 0; i < l; i++) {
    S[i] = 'x';
  }
  printf("%s\n", S);
  return 0;
}

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

using namespace std;

vector<vector<bool>> Input() {
    int h, w;
    cin >> h >> w;
    if (h == 0 && w == 0) return {};

    vector<vector<bool>> image(h + 2, vector<bool>(w + 2, true));
    for (int i = 0; i < h; ++i)
        for (int j = 0; j < w; ++j) {
            char c;
            cin >> c;
            image[i + 1][j + 1] = (c == '.');
        }

    return image;
}

vector<set<int>> Tree(const vector<vector<bool>> &image) {
    const int h = image.size(), w = image.front().size();
    vector<set<int>> tree;
    vector<vector<int>> idx(h, vector<int>(w, -1));

    const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1};
    const int dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};
    for (int y = 0; y < h; ++y) {
        for (int x = 0; x < w; ++x) {
            if (idx[y][x] != -1) continue;

            int cur_idx = idx[y][x] = tree.size();
            tree.emplace_back();

            stack<pair<int, int>> st;
            st.push(make_pair(y, x));
            while (!st.empty()) {
                const int cur_y = st.top().first, cur_x = st.top().second;
                st.pop();

                for (int dir = 0; dir < (image[cur_y][cur_x] ? 4 : 8); ++dir) {
                    const int ny = cur_y + dy[dir], nx = cur_x + dx[dir];
                    if (ny < 0 || nx < 0 || h <= ny || w <= nx) continue;

                    if (idx[ny][nx] != -1 && idx[ny][nx] != idx[cur_y][cur_x]) {
                        tree[cur_idx].insert(idx[ny][nx]);
                        tree[idx[ny][nx]].insert(cur_idx);
                    }
                    else if (idx[ny][nx] == -1 && (image[cur_y][cur_x] == image[ny][nx])) {
                        st.push(make_pair(ny, nx));
                        idx[ny][nx] = cur_idx;
                    }
                }
            }
        }
    }

    return tree;
}

string Coding(const int par, const int cur, const vector<set<int>> &tree) {
    vector<string> child;

    for (auto v : tree[cur])
        if (v != par) child.emplace_back(Coding(cur, v, tree));

    sort(child.begin(), child.end());
    string code = "(";
    for (const auto &c : child) code += c;

    return code + ")";
}

inline bool Isomorphism(const vector<set<int>> &t1, const vector<set<int>> &t2) {
    return Coding(-1, 0, t1) == Coding(-1, 0, t2);
}

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

    while (true) {
        auto image1(Input());
        if (image1.empty()) break;
        auto image2(Input());

        cout << (Isomorphism(Tree(image1), Tree(image2)) ? "yes" : "no") << '\n';
    }

    return 0;
}



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

int main() {
  int n;
  long long k,sum = 0;
  cin >> n >> k;
  vector<pair<int,int>>data(n);
  for(int i = 0;i < n;i++){
    cin >> data[i].first >> data[i].second;
  }
  sort(data.begin(),data.end());
  for(int i = 0;i < n;i++){
    sum += data[i].second;
    if(sum >= k){
      cout << data[i].first << endl;
      return 0;
    }
  }
}


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

#define REP(i,N) for(int i=0;i<(N);++i) 
  
int GCD(int a, int b){
  int t;
  while((t = a%b) != 0) {
    a = b;
    b = t;
  }
  return b;
}

int main(){
  int S = 27720, N;
  cin >> N;
  
  if(N==3) {
    cout << "2 3 25" << endl;
    return 0;
  }
  
  for(int i = 2; i < S/2 && N >= 2; ++i){
    if(GCD(i, S) != 1) {
      cout << i << " " << S-i << " ";
      N -=2;
    }
  }
  if(N == 1) 
    cout << S;
  cout << endl;
}

Measured memory_bytes: 384
#include <stdio.h>

int main (){
	char num[10];
	scanf("%s", num);
	
	if(num[0]== '7'|| num[1]== '7'|| num[2]== '7'){
		printf("Yes\n");
	}else {
		printf("No\n");
	}

	return 0;
	
}

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

#define ll long long
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int MAX = 1e5 + 5;

int main()
{
	IOS
	int t = 1;
	//cin >> t;
	while(t--)
	{
		int a;
		cin >> a;
		int ans = a + a * a + a * a * a;
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <random>
using namespace std;
#define Would
#define you

int main() {
	int a, b, n;
	string h;
	cin >> a >> b >> h;
	for (int i = 0; i < h.length(); i++) {
		if (h[i] == '-') {
			++n;
		}
	}
	if (n == 1 && h[a] == '-') {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
mod = 10**9+7
def pow(n,p):
    res=1
    while p >0:
        if p%2==0:
            n = n**2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod

def main():
    s=input()
    res = 0
    ca = 0
    cc = s.count("C")
    cw = 0
    aw = s.count("?")
    for c in s:
        if c == "A":
            ca += 1
        elif c == "C":
            cc -= 1
        elif c == "B":
            res += ca*cc*pow(3,aw)+ca*(aw-cw)*pow(3,aw-1)+cw*cc*pow(3,aw-1)+cw*(aw-cw)*pow(3,aw-2)
            res %= mod
        elif c == "?":
            res += ca*cc*pow(3,aw-1)+ca*(aw-cw-1)*pow(3,aw-2)+cw*cc*pow(3,aw-2)+cw*(aw-cw-1)*pow(3,aw-3)
            res %= mod
            cw += 1

    print(res)

main()

Measured memory_bytes: 44264
#include<bits/stdc++.h>
using namespace std;
void solve()
{
    long double a,b;
    cin>>a>>b;

    long double res = a*b;
     string s = to_string(res);
    //cout<<s<<endl;
    for(auto x :s)
    {
       if(x == '.')
        break;
      else
        cout<<x;
    }
    cout<<endl;
}

signed main(void)
{
      //fast();
      //w(t)
      solve();

}


Measured memory_bytes: 3832
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

const int M=26;
int h,w;
int x[M][2],y[M][2];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>h>>w;
	for(int i=0;i<M;i++) for(int j=0;j<2;j++) x[i][j]=y[i][j]=-1;
	for(int i=0;i<h;i++) for(int j=0;j<w;j++){
		char c;
		cin>>c;
		if(isalpha(c)){
			int id=c-'A';
			if(x[id][0]==-1) x[id][0]=i,y[id][0]=j;
			else x[id][1]=i,y[id][1]=j;
		}
	}
	for(int i=0;i<M;i++) if(x[i][0]>=0){
		if(x[i][0]>x[i][1]||x[i][0]==x[i][1]&&y[i][0]>y[i][1]){
			swap(x[i][0],x[i][1]);
			swap(y[i][0],y[i][1]);
		}
	}
	int res=0;
	while(1){
		bool B=0;
		for(int i=0;i<M;i++) if(x[i][0]>=0){
			if(abs(x[i][0]-x[i][1])+abs(y[i][0]-y[i][1])==1) continue;
			bool b1=1,b2=1;
			for(int j=0;j<M;j++) for(int k=0;k<2;k++) if(i!=j&&x[j][k]>=0){
				if(x[i][0]==x[i][1]){
					if(x[j][k]==x[i][0]&&y[i][0]<y[j][k]&&y[j][k]<y[i][1]) b1=0,b2=0;
				}
				else if(y[i][0]==y[i][1]){
					if(y[j][k]==y[i][0]&&x[i][0]<x[j][k]&&x[j][k]<x[i][1]) b1=0,b2=0;
				}
				else{
					if(x[j][k]==x[i][0]&&(y[i][0]<y[j][k]^y[j][k]>y[i][1])) b1=0;
					if(y[j][k]==y[i][1]&&x[i][0]<=x[j][k]&&x[j][k]<x[i][1]) b1=0;
					if(x[j][k]==x[i][1]&&(y[i][0]<y[j][k]^y[j][k]>y[i][1])) b2=0;
					if(y[j][k]==y[i][0]&&x[i][0]<x[j][k]&&x[j][k]<=x[i][1]) b2=0;
//					cout<<b1<<' '<<b2<<endl;
				}
			}
//			cout<<i<<' '<<b1<<' '<<b2<<endl;
			if(b1||b2){
//				cout<<x[i][0]<<' '<<y[i][0]<<' '<<x[i][1]<<' '<<y[i][1]<<endl;
				x[i][0]=-1,y[i][0]=-1;
				x[i][1]=-1,y[i][1]=-1;
				B=1;
				res+=2;
				break;
			}
		}
		if(!B) break;
	}
	cout<<res<<endl;
}


Measured memory_bytes: 3180
//Atcoder AISing Programing Contest 172 A問題

#include <stdio.h>

int main(void) {
    int l, r, d;
    int ceil, bottom, answer;

    scanf("%d", &l);
    scanf("%d", &r);
    scanf("%d", &d);

    ceil = r / d;
    bottom = (l - 1) / d;

    answer = ceil - bottom;

    printf("%d", answer);

    return 0;
}


Measured memory_bytes: 1736