akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll V[25], C[25];
    rep(i,0,N) cin >> V[i];
    rep(i,0,N) cin >> C[i];
    ll ans = 0;
    rep(i,0,N){
        if(V[i] - C[i] > 0){
            ans += V[i] - C[i];
        }
    }
    print(ans);
    
    
}

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <random>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)
#define ALL(a) ((a).begin(), (a).end())

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int N, K;
int ub, lb;
int ans[1008];
vector<vector<int>> v(1001);

bool check()
{

    for (int i = 0; i < K; ++i)
    {
        int cnt = 0;
        for (int j = 0; j < N / 2; ++j)
        {
            cnt += ans[v[i][j]];
        }
        if (cnt < lb || cnt > ub)
            return false;
    }
    return true;
}

void solve()
{
    for (int i = 0; i < N / 2; ++i)
        ans[i] = 1;
    while (1)
    {
        std::random_device seed_gen;
        std::mt19937 engine(seed_gen());
        shuffle(ans, ans + N, engine);
        if (check())
            break;
    }
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    //cout << fixed << setprecision(15);

    int N;
    while (cin >> N, N)
    {

        int t = 1000 - N;

        int cnt = 0;
        while (t >= 500)
        {
            t -= 500;
            cnt++;
        }
        while (t >= 100)
        {
            t -= 100;
            cnt++;
        }
        while (t >= 50)
        {
            t -= 50;
            cnt++;
        }
        while (t >= 10)
        {
            t -= 10;
            cnt++;
        }
        while (t >= 5)
        {
            t -= 5;
            cnt++;
        }

        while (t >= 1)
        {
            t -= 1;
            cnt++;
        }
        cout << cnt << endl;
    }
    return 0;
}



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

int main(void){
    int n; cin >> n;
    
    set<int> s;
    set<int> ::iterator it;

    for(int i = 0; i < n; i++){
        int input; cin >> input;
        it = s.find(input);
        if(it == s.end()){
            //cout << "ok" << endl;
            s.insert(input);
        }else{
            //cout << "ng" << endl;
            s.erase(input);
        }
    }

    int ans = 0;

    for(it = s.begin(); it != s.end(); it++){
        //cout << *it << endl;
        ans++;
    }

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

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

void solve() {
    int n;
    cin >> n;
    vector<int> a;
    int sum = 0;
    int sum2 = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if(x%10 > 0) {
            a.push_back(x);
            sum2 += x;
        }
        else {
            sum += x;
        }
    }
    if(a.size() == 0) {
        cout << 0;
    }
    else {
        int x = 0;
        sort(a.begin(), a.end());
        int i = 0;
        while((sum2 - x)%10 == 0) {
           x = a[i];
           i++;
        }
        cout << sum + sum2 - x;
    }
}


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


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

int main() {
	long N;
	cin >> N;
	vector<long> ABCDE(5);
	for (long& i : ABCDE) cin >> i;
	sort(ABCDE.begin(), ABCDE.end());
	cout << (ABCDE[0] + N - 1) / ABCDE[0] + 4;
}

Measured memory_bytes: 256
#include<iostream>
#include <cstdio>
using namespace std;
 
int main(){
    double a, b, c, d, e, f;
    double x, y;
    while(cin >> a >> b >> c>>d>>e>>f){
        y = (a*f-d*c)/(a*e-b*d);
        x = (c-b*y)/a;
        printf("%.3f %.3f\n", x, y);
    }
}


Measured memory_bytes: 3196
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

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

    vvi cost(n, vi(n));
    rep(i, n) rep(j, n) cin >> cost[i][j];

    ll res = 0;
    rep(i, n){
        range(j, i + 1, n){
            res += min(cost[i][j], cost[j][i]);
        }
    }

    cout << res << endl;

	return 0;
}

Measured memory_bytes: 1248
#define dbg(...) fprintf(stderr,__VA_ARGS__)
#define dpr(x) cerr<<#x<<": "<<x<<endl;
#define dprc(c) do{cerr<<#c<<":";for(auto&_i:(c)){cerr<<" "<<_i;}cerr<<endl;}while(0)
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
int INF = 1e9+7;
#define all(c) begin(c), end(c)
#define tr(i,c) for(auto i=begin(c);i!=end(c);i++)
#define rtr(i,c) for(auto i=(c).rbegin();i!=(c).rend();i++)
#define rep(i,b) for(auto i=0;i<(b);i++)
#define pb push_back
#define sz(c) int((c).size())

int stk[256];
int top;

void push(int x) {
  stk[top++] = x;
}

int pop() {
  if (top == 0) {
    cerr << "stack is empty" << endl;
    exit(1);
  }
  return stk[--top];
}

int main(int argc, char **argv)
{
  vector<function<int(int,int)>> ops = {
    [](int a, int b){return a+b;},
    [](int a, int b){return a-b;},
    [](int a, int b){return a*b;},
  };

  string s;
  while (cin >> s) {
    auto i = string("+-*").find(s[0]);
    if (i != string::npos) {
      int b = pop();
      int a = pop();
      push(ops[i](a, b));
    } else {
      push(stoi(s));
    }
  }
  cout << pop() << endl;
  return 0;
}

Measured memory_bytes: 3148
N = int(input())
A = list(map(int,input().split()))
A.sort()
import numpy as np
Ac = A.copy()
Ac.sort(key = lambda x:np.abs(x))

import bisect
zero_idx = bisect.bisect(A,0)
if zero_idx == 0:
    An = []
    Ap = A[:]
elif zero_idx == N:
    Ap = []
    An = A[:]
else:
    An = A[:zero_idx]
    Ap = A[zero_idx:]
    
pnum = len(Ap)
nnum = len(An)
ans = 0
total = 0
for a in A:
    total += int(np.abs(a))

if N%2 == 0:
    if nnum % 2 == 0:
        ans = total
    else:
        ans = total - 2 * np.abs(Ac[0])
           
    
else:
    if nnum % 2 == 1:        
        ans = total - 2 * np.abs(Ac[0])
    else:           
        ans = total
    
    
print(ans)

Measured memory_bytes: 21708
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>
#include <cmath>
#include <iomanip>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////


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

    int K, A, B;

    cin >> K >> A >> B;
    for (int i = A; i <= B; i++) {
        if (i % K == 0) {
            cout << "OK\n";
            return 0;
        }
    }

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


Measured memory_bytes: 3644
#2019は3と673で割り切れることを考慮する必要がある(重要)
#入力。範囲指定
L, R = list(map(int,input().split()))
#解を仮に無限大と置いておく
ans = 150
#ans = float('inf')
"""
mod(x)とし、i = y1 * x + b, j = y2 * x + cなどと置くと i * j で xで括れない項は
b*c(余り同士の)掛け算のみ。
"""
#LとRの2019で割った時の余りは求めておく。
l = L % 2019
r = R % 2019
#LとRで挟まれる領域が十分に広い(673以上の)場合絶対に解は0(動ける範囲制限)
if R - L >= 673:
  ans = 0
  print(ans)
  exit(0)
#LとRで挟まれる範囲内に3で割り切れる要素と673で割り切れる要素が同時に存在したら解は0
#判定用変数
flag1 = 0 
flag2 = 0
#LとRで挟まれるリスト作製
list = [i for i in range(L,R+1)]
for i in range(len(list)):
  #3で割り切れるか判定
  if list[i] % 3 == 0:
    flag1 += 1
  #673で割り切れるか判定,3で割り切れていても判定するようにelifではなくifを使う
  if list[i] % 673 == 0:
    flag2 += 1
#両方満たしていたら解が0になる
if flag1 * flag2 != 0:
  ans = 0
  print(ans)
  exit(0)
#LとRの間に2019の倍数の壁がある=2019で割って余りが0になるタイミングがある
if l > r:
  ans = 0
  print(ans)
  exit(0)
#ここまで候補削ったらあとは全探索でもできる(と思われる)
#最小値をansと置く
ans = float('inf')
for i in range(l,r):
  for j in range(l+1,r+1):
    if ans > (i * j) % 2019:
      ans = (i * j) % 2019
print(ans)

Measured memory_bytes: 3064
from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi

MOD = 10 ** 9 + 7
INF = 10 ** 18

N, M = map(int, input().split())

arr = []
for i in range(M):
    arr.append([1, i + 2])
arr = arr[::-1]
#print(arr)

max_arr = -1
plus = 0
for a, b in arr[::2]:
    print(a + plus, b + plus)
    max_arr = max(max_arr, b + plus)
    plus += 1
#print(max_arr)

plus = 0
for a, b in arr[1::2]:
    print(max_arr + a + plus, max_arr + b + plus)
    plus += 1

Measured memory_bytes: 82864
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
#define spln(i,n) (i==n?'\n':' ')
using namespace std;
int n,m,i,j,l,r,mid,ans;
string st,mem;
bool check(int x)
{
	st=mem;
	int s=x*9,i,j;
	fz1(i,n){
//		cerr<<st<<endl; 
		if(s<st[i]-'0') return 0;
		while(s%10!=(st[i]-'0')) s--;
		if(i+8>=n){
			int t=0;
			fd(j,n,i) t=t*10+st[j]-'0';
			s=min(s,t);
		}
		int t=s;
		fz(j,i,n){
			st[j]-=t%10;
			if(st[j]<'0'){
				st[j+1]--;
				st[j]+=10;
			}
			t/=10;if(!t&&(j==n||st[j+1]>='0')) break;
		}
	}
	return 1;
}
int main()
{
	rdst(st,500005);n=st.length();reverse(st.begin(),st.end());st=" "+st;mem=st;
	l=0;r=n;
	while(l<r){
		mid=(l+r+1)/2;
		if(check(mid)){
			r=mid-1;
			ans=mid;
		}
		else l=mid;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1700
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;

int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	ll a, b, k;
 	cin >> a >> b >> k;
 	if(a>=k) cout << a-k << ' ' << b;
 	else if(a+b>=k) cout << 0 << ' ' << b+a-k;
 	else cout << 0 << ' ' << 0;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);

template <class T>void Sort(vector<T> & a) { sort(a.begin(), a.end()); }
template <class T>void ReSort(vector<T>& a) { sort(a.rbegin(), a.rend()); }
template <class T>void Reverse(vector<T>& a) { reverse(a.begin(), a.end()); }
template <class T>void Unique(vector<T>& a) { a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T>T Sum(vector<T> a, T init = 0) { return accumulate(a.begin(), a.end(), init); }

//INPUT//
void CINPUT() {}
template<class H, class ...T> void CINPUT(H&& h, T&& ...t) { cin >> h; CINPUT(forward<T>(t)...); }
#define in(...) int __VA_ARGS__; CINPUT(__VA_ARGS__);
#define In(T,...) T __VA_ARGS__; CINPUT(__VA_ARGS__);
#define Vin(T,name,n) int n; cin>>n; vector<T> name(n); rep(i,n)cin>>name[i];
#define VIn(T,name,n) vector<T> name(n); rep(i,n)cin>>name[i];

//OUTPUT//
void print() { cout << endl; }
template <class H> void print(H&& h) { cout << h << endl; }
template <class H, class... T> void print(H&& h, T&& ... t) { cout << h << " "; print(forward<T>(t)...); }
template<class T>void out(T n) { cout << n << endl; }
template<class T>void out(vector<T> a, string sep = " ", string end = "\n") { for (int i = 0; i < (int)a.size(); ++i)cout << a[i] << (i == (int)a.size() - 1 ? end : sep); }
void yes(bool f) { puts(f ? "yes" : "no"); }
void Yes(bool f) { puts(f ? "Yes" : "No"); }
void YES(bool f) { puts(f ? "YES" : "NO"); }
void poss(bool f) { puts(f ? "possible" : "impossible"); }
void Poss(bool f) { puts(f ? "Possible" : "Impossible"); }
void POSS(bool f) { puts(f ? "POSSIBLE" : "IMPOSSIBLE"); }

int main() {
	in(a, b);
	out(a <= b ? a : a - 1);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
using namespace std;
int main() {
	string s;
	cin >> s;
	int n = s.size();
	int N = 0, S = 0, W = 0, E = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'N') {
			N++;
		}
		else if (s[i] == 'S') {
			S++;
		}
		else if (s[i] == 'W') {
			W++;
		}
		else {
			E++;
		}
	}
	if (N == 0 && S > 0) {
		cout << "No" << endl;
	}
	else if (S == 0 && N > 0) {
		cout << "No" << endl;
	}
	else if (W == 0 && E > 0) {
		cout << "No" << endl;
	}
	else if (E == 0 && W > 0) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];
ll a[N];

int main() {
    FAST;
    string s; cin >> s;
    deque<char> que(s.begin(), s.end());
    int q; cin >> q;
    bool rev = false;
    for (int i = 0; i < q; i++) {
        int t; cin >> t;
        if (t == 1) {
            rev = !rev;
        } else {
            int f; char c; cin >> f >> c;
            if (f == 1) {
                if (rev) {
                    que.push_back(c);
                } else {
                    que.push_front(c);
                }
            } else {
                if (rev) {
                    que.push_front(c);
                } else {
                    que.push_back(c);
                }
            }
        }
    }
    if (rev) reverse(que.begin(), que.end());
    for (char c : que) cout << c;
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 8272
#include <bits/stdc++.h>
#include <random>
using namespace std;
#define init_random mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define start_routine cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int begtime = clock();
#define end_routine int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define contests_de_diya_kar 0
#define PB push_back
#define MP make_pair
#define int long long
#define sd(n) scanf("%lld", &n)
#define pd(n) printf("%lld", n)
#define MOD ((long long) (1000*1000*1000 + 7))
#define inf (int) 2e15
#define exit(a, b) return cout << a, b;
#define eps (double)1e-9
#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define vi vector<int>
#define vb vector<bool>
#define all(v) v.begin(), v.end()
#define ll long long 
#define pii pair<int, int>
#define mii map<int, int> 
#define print(stuff) cout << stuff << endl
#define len(stuff) stuff.size()

int exp (int a, int b) {
  if (b == 0) return 1LL;
  int ans = exp(a, b/2);
  ans = (ans * ans);
  if (b % 2) ans = (ans * a);
  return ans;
}

int root (int n, int i) {
  int hi = min((int) pow(n, (long double) 1 / (long double) i) + 5LL, n);
  int lo = max(1LL, (int) pow(n, (long double) 1 / (long double) i) - 5LL);

  while (lo < hi - 3) {
    int mid = (lo + hi) / 2;
    int calc = exp(mid, i);
    if (calc > n) {
      hi = mid - 1;
    }
    else {
      lo = mid;
    }
  }

  int ret = lo;
  for (int j = lo; j <= hi + 4LL; j += 1) {
    if (exp(j, i) <= n) ret = j;
  } 
  return ret;
}

vi memo((int) 1e6 + 1, -1);
mii memo_mp;
int f (int n) {
  if (n <= (int) 1e6) {
    if (memo[n] != -1) return memo[n];
  }
  else if (memo_mp.find(n) != memo_mp.end()) return memo_mp[n];
  int ans = n - 1;
  for (int p = 2; p <= 60LL; p += 1) {
    int rt = root(n, p);
    if (rt <= 1) break;
    ans -= f(rt);
  }
  if (n <= (int) 1e6) memo[n] = ans;
  else memo_mp[n] = ans;
  return ans;
}

signed main()
{
  start_routine;
  #ifndef ONLINE_JUDGE
 //  freopen("input.txt", "r", stdin);
  #endif

  int n;
  cin >> n;

  set<string> s;
  string inp[n + 1];
  forn(0, n, i) {
    cin >> inp[i];
    if (s.find(inp[i]) != s.end()) {
      cout << "No";
      return 0;
    }
    s.insert(inp[i]);
    if (i > 0) {
      if (inp[i - 1][len(inp[i - 1]) - 1] != inp[i][0]) {
        cout << "No";
        return 0;
      }
    }
  }
  cout << "Yes";
  end_routine;
}

Measured memory_bytes: 8064
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    VI a(n);
    REP(i, n) cin >> a[i];

    ll ans = 0;
    ll sum = 0;
    int right = 0; 
    REP(left, n) {
        while(right < n && (sum ^ a[right]) == sum + a[right]) {
            sum += a[right];
            right++;
        }
        ans += right - left;
        if(left == right) right++; 
        sum -= a[left];
    }

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


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t n;
  cin >> n;
  int p[n] = {};
  int q[n] = {};
  vector<int> index(n);
  for(int i=0;i<n;i++){
    cin >> p[i];
    index[i]=i+1;
  }
  for(int i=0;i<n;i++){
    cin >> q[i];
  }
  
  int64_t pPos = 0;
  int64_t qPos = 0;
  int64_t current = 0;
  do{
    bool isP = true;
    bool isQ = true;
    for(int i=0;i<n;i++){
      if(p[i]!=index[i]) isP = false;
      if(q[i]!=index[i]) isQ = false;
    }
    if(isP)pPos=current;
    if(isQ)qPos=current;
    current++;
  }while(next_permutation(index.begin(),index.end()));

  cout << abs(qPos-pPos) << endl;;    
  return 0;
}

Measured memory_bytes: 3688
#include<bits/stdc++.h>
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
using namespace std;

int main(){
    Fast;
    int n;
    cin>>n;
    unsigned long long int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]==0)
        {
            cout<<0<<endl;
            return 0;
        }
    }
    sort(a,a+n);
    bool ok=true;
    unsigned long long int ans=1LL,x=1e18;
    for(int i=0;i<n;i++){
        ans*=a[i];
        if(ans<0){
            cout<<-1<<endl;
            return 0;
        }
    }
    if(ans>0 && ans<=x){
        cout<<ans<<endl;
    }
    else{
        cout<<-1<<endl;
    }
}


Measured memory_bytes: 4436
import re

c=0
p=input().upper()
ptn=re.compile(r'^'+p+r'$')

while True:
    s=input()
    if s =='END_OF_TEXT':
        break
    a=s.upper().split()
    for i in a:
        if re.match(ptn, i):
            c+=1
print(c)

Measured memory_bytes: 7640
#include <iostream>

using namespace std;

int main()
{
    int n[26]={0};
    string str1;


    while(getline(cin,str1)){
        for(int i=0;i<str1.length();i++){
            if((str1[i]>='a')&&(str1[i]<='z')){
                n[str1[i]-'a']++;
            }
            else if((str1[i]>='A')&&(str1[i]<='Z')){
                n[str1[i]-'A']++;
            }
        }
    }
    
    
    for(int i=0;i<26;i++){
        cout << char('a'+i)<<" : "<<n[i] <<endl;
    }



    return 0;
}



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

// <formula> ::= 0 | 1 | 2 | P | Q | R |
// -<formula> | (<formula>*<formula>) | (<formula>+<formula>)

int eval(string &s,int &i,map<char,int> &v){
    char c = s[i];
    i++;
    if(isdigit(c) || isalpha(c)) return v[c];
    if(c == '-') return 2-eval(s,i,v);
    int l = eval(s,i,v);
    char op = s[i];
    i++;
    int r = eval(s,i,v);
    i++;
    if(op == '*'){
        if(l*r == 0) return 0;
        if(l*r == 4) return 2;
        return 1;
    }
    if(op == '+'){
        if(l+r == 0) return 0;
        if(l== 2 || r == 2) return 2;
        return 1;
    }
    assert(false);
}

int main(void){
    string s;
    while(cin>>s, s!="."){
        int cnt = 0;
        map<char,int> v;
        rep(i,3) v['0'+i] = i;
        rep(p,3)rep(q,3)rep(r,3){
            int i = 0;
            v['P'] = p;
            v['Q'] = q;
            v['R'] = r;
            if(eval(s,i,v)==2) cnt++;
        }
        cout<<cnt<<endl;
    }
    return 0;
}



Measured memory_bytes: 3224
use std::collections::HashSet;

/// Rustで競技プログラミングの入力をスッキリ記述するマクロ
///
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[inline]
#[allow(dead_code)]
fn gcd(mut m: u64, mut n: u64) -> u64 {
    if m < n {
        std::mem::swap(&mut m, &mut n);
    }

    loop {
        let k = m % n;
        if k == 0 {
            return n;
        }

        m = n;
        n = k;
    }
}

#[inline]
#[allow(dead_code)]
fn lcm(m: u64, n: u64) -> u64 {
    m / gcd(m, n) * n
}

// 点が辺に接続しているなら true していないなら false
fn incident(v: u64, e: &Vec<u64>) -> bool {
    e.contains(&v)
}

fn dfs(ab_a: &Vec<Vec<u64>>, v: u64, mut visited_v: HashSet<u64>) -> HashSet<u64> {
    // println!("v = {}", v);

    // v を訪問済みにする
    visited_v.insert(v);

    for ab in ab_a {
        // v が ab に接続していないなら continue
        if !incident(v, ab) {
            continue;
        }

        // 次に訪問する頂点を求める
        let to_v = if ab[0] == v {
            ab[1]
        } else {
            ab[0]
        };

        // to_v に 訪問済みなら continue
        if visited_v.contains(&to_v) {
            continue;
        }

        // println!("use edge ({}, {})", ab[0], ab[1]);

        visited_v = dfs(ab_a, to_v, visited_v);
    }

    visited_v
}

fn main() {
    input!{
        n: usize,
        m: usize,
        ab_a: [[u64; 2]; m],
    }

    let mut ans = 0;
    for ab_i in 0..m {
        let mut ab_v = ab_a.to_vec();
        ab_v.remove(ab_i);

        // println!("remove edge ({}, {}). dfs start.", ab_a[ab_i][0], ab_a[ab_i][1]);
        if dfs(&ab_v, 1, HashSet::new()).len() != n {
            // println!("unconnected.");
            ans += 1;
        }
    }

    println!("{}", ans);
}



Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<cstring>
//#include<vector>
#include<algorithm>


#ifdef L_JUDGE
#pragma warning(disable:4996)
#endif

using namespace std;
const int MAXN=1005;


int N;
char str[MAXN];


int main(){
	#ifdef L_JUDGE
		freopen("in.txt","r",stdin);
//		freopen("out.txt","w",stdout);
	#endif
    cin>>N>>str;
    int x=0;
    int ans=0;
    for(int i=0;i<N;i++){
         if(str[i]=='I')x++;
         else x--;
         ans=max(ans,x);
    }
    printf("%d\n",ans);


	#ifdef L_JUDGE
		fclose(stdin);
		fclose(stdout);
//		system("out.txt");
	#endif

	return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    n = int(input())
    a = [0]+list(map(int,input().split()))

    res = [0]*(n+1)
    b = []
    for i in range(n,0,-1):
        e = a[i]
        p = 0
        v = i
        while v <= n:
            p += res[v]
            v += i
        if p%2 != e:
            res[i] = 1
            b.append(i)
    print(len(b))
    for e in b:
        print(e,end=' ')

if __name__ == '__main__':
    main()

Measured memory_bytes: 65912
#include <iostream>
#include <fstream>
#include <sstream>

#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>

#include <algorithm>
#include <numeric>

#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>

#define pb push_back
#define pbk pop_back
#define mp make_pair
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define foreach(i, a) for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
#define len(a) ((int) (a).size())

#ifdef CUTEBMAING
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

using namespace std;

typedef long long int64;
typedef long double ld;
typedef unsigned long long lint;

const int inf = (1 << 30) - 1;
const int64 linf = (1ll << 62) - 1;
const int N = 1e6 + 100;

int n, m, q;
int a[N];

bool used[N];
vector<int> perm;

int it[N];
set<int> qt[N];
int pos[N];

int main() {
#ifdef XCODE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> n >> m >> q;
    for (int i = 0; i < q; i++) {
        scanf("%d", &a[i]), a[i]--;
    }
    for (int i = q - 1; i >= 0; i--) {
        if (!used[a[i]]) {
            perm.pb(a[i]);
            used[a[i]] = true;
        }
    }
    for (int i = 0; i < len(perm); i++) {
        pos[perm[i]] = i;
    }
    for (int i = 0; i < n; i++) {
        qt[it[i]].insert(i);
    }
    for (int i = q - 1; i >= 0; i--) {
        int cur = pos[a[i]];
        if (len(qt[cur]) == 0) {
            continue;
        }
        int start = *qt[cur].begin();
        qt[cur].erase(qt[cur].begin());
        qt[cur + 1].insert(start);
    }
    static int last[N];
    for (int i = 0; i < N; i++) {
        for (int j : qt[i]) {
            last[j] = i;
        }
    }
    int minLast = *min_element(last, last + n);
    static bool cused[N];
    for (int j = 0; j < minLast; j++) {
        cused[perm[j]] = true;
    }
    int it = 0;
    for (int j = minLast; j < len(perm); j++) {
        while (cused[it]) {
            it++;
        }
        if (it != perm[j]) {
            puts("No");
            return 0;
        }
        it++;
    }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 53496
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;

int main(void){
  int n;
  cin >> n;
  vector<string> s(n);
  map<string, priority_queue<P>> mp;
  REP(i, n){
    int p;
    cin >> s[i] >> p;
    mp[s[i]].push(P(p, i+1));
  }
  sort(ALL(s));
  REP(i, n){
    cout << mp[s[i]].top().second << endl;
    mp[s[i]].pop();
  }
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1e+9;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


int fac(int num) {
  if(num==1) return 1;
  else return num*fac(num-1);
}




int sum[210000];
vector<int> v(210000);
ll ans = 0;
string s;
int pw[210000];


map<ll,ll> mp;


int main() {
  pw[0] = 1;
  cin >> s;reverse(all(s));
  int N = s.size();
  rep(i,210000) {
    pw[i+1] = pw[i]*10%2019;
  }
  rep(i,N) {
    int num = s[i] - '0';
    sum[i+1] = sum[i] + pw[i]*num;
    sum[i+1] %= 2019;
  }

  rep(i,N+1) v[sum[i]]++;
  rep(i,210000) {
    if(v[i]) ans += v[i]*(v[i]-1)/2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5568
fun main(args: Array<String>) {
    val S = next()
    var ans = false
    if (S.length == 2 && S.startsWith("hi")) ans = true
    if (S.length == 4 && S.startsWith("hihi")) ans = true
    if (S.length == 6 && S.startsWith("hihihi")) ans = true
    if (S.length == 8 && S.startsWith("hihihihi")) ans = true
    if (S.length == 10 && S.startsWith("hihihihihi")) ans = true
    println(if (ans) "Yes" else "No")
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfLong() = listOfString().map(String::toLong)
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta


Measured memory_bytes: 33688
#include <cstdio>
int main() {
	int n, sum = 0, x;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &x);
		sum += x;
	} 	
	printf("%d\n", sum - n);
	return 0;
}

Measured memory_bytes: 128
import sys
stdin = sys.stdin
     
pi=3.1415
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N=int(input())
S=[]
for i in range(N):
    S.append(ns())

S.sort()
c=0
tmp=''
for i in range(N):
    val=S.pop()
    if(val!=tmp):
        c+=1
    tmp=val

print(c)

Measured memory_bytes: 23776
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair

#define REP(i, n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,h) for(int i=(int)(l);i<=(int)(h);++i)
#define FORD(i,h,l) for(int i=(int)(h);i>=(int)(l);--i)

//#define max(a,b) a>b?a:b
//#define min(a,b) a>b?b:a

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define ALL(t) (t).begin(),(t).end()

using namespace std;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int sum() { return 0; }

template<typename T, typename... Args>
T sum(T a, Args... args) { return a + sum(args...); }



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll int n;cin>>n;
	std::vector<int> v(n+1, 0);
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 0; j <= n; j += i)
		{
			v[j]++;
		}
	}
	ll int sum =0;
	for (int i = 1; i <= n; ++i)
	{
		sum += (ll)i*v[i];
	}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 42248
/*
author: madhav_1999 aka orthodoxparadox
31 May 2020 at 5:21 PM
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define dbl long double
#define int ll
#define ll long long
#define pii pair<int, int>
#define len(x) (int) x.size()
#define rev(a) reverse(all(a))
#define oiint ostream_iterator<int>(cout, " ") 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define onlyunique(v) v.erase(unique(all(v)), v.end()); //only for sorted vector
#define inf 2e18
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#ifdef MADHAV
#define dbg(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define dbg(...) 42
#endif
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(int i=0;i<(int)v.size();++i) x<<v[i]<<" ";return x;} 
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;} 
template <typename X> ostream& operator << (ostream& x,const multiset<X>& v){for(auto it:v) x<<it<<" ";return x;} 
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;} 
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
struct pair_hash {inline std::size_t operator()(const std::pair<int, int> & v) const {return v.first*31+v.second;}};
const int MOD = 1e9 + 7;

int takemod(int a, int mod = MOD){a%=mod;if(a<0)a+=mod;return a;}

int fast_exp(int base, int expo, int mod = MOD) {
	int res=1;
	while(expo>0) {
		if(expo&1) res=(res*base)%mod;
		base=(base*base)%mod;
		expo>>=1;}
	return res;}

int modinv(int a, int mod = MOD){return takemod(fast_exp(takemod(a, mod), mod-2, mod), mod);}


void solve()
{
	int a, b;
	cin >> a >> b;
	cout << a * b;
}

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	#ifdef MADHAV
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
	#endif
	clock_t t1, t2;
	t1 = clock();

	int tt = 1;
	// cin >> tt;
	while(tt--)
	{
		solve();
	}
	#ifdef MADHAV
	t2 = clock(); cout << "\n\ntime taken: " << (t2-t1)/(dbl)CLOCKS_PER_SEC;
	#endif
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <boost/foreach.hpp>
using namespace std;
#define pi 2*asin(1.0)
#define MAX 10000000
#define MOD 1000000007
#define _GLIBCXX_DEBUG
 








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


//Answer


int main() {
long A,B;
cin>>A>>B;
if(A<10&&B<10){
    cout<<A*B<<endl;
}else{
    cout<<-1<<endl;
}




}




Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <climits>
#include <cfloat>

using namespace std;

//start of 0uts1de's library

int cin_int_arr(vector<int> &arr) {
    for (int &i : arr) {
        cin >> i;
    }
    return 0;
}

int cin_double_arr(vector<double> &arr) {
    for (double &i : arr) {
        cin >> i;
    }
    return 0;
}


int cout_int_arr(vector<int> &arr, bool addNewline = true) {
    for (int i : arr) {
        if (addNewline) {
            cout << i << endl;
        } else {
            cout << i << flush;
        }
    }
    return 0;
}

int cout_double_arr(vector<double> &arr, bool addNewline = true) {
    for (double i : arr) {
        if (addNewline) {
            cout << i << endl;
        } else {
            cout << i << flush;
        }

    }
    return 0;
}


int max_int_arr(std::vector<int> &arr, bool returnValue = true) {    //Value mode and Index mode
    int maxVal = INT_MIN;       //min of int
    int maxIndex = 0;
    if (returnValue) {
        for (int i : arr) {
            if (i > maxVal) {
                maxVal = i;
            }
        }
        return maxVal;
    } else {
        for (unsigned int i = 0; i < arr.size(); ++i) {
            if (arr.at(i) > maxVal) {
                maxVal = arr.at(i);
                maxIndex = i;
            }
        }
        return maxIndex;
    }
}

double max_double_arr(std::vector<double> &arr) {    //data mode
    double maxVal = -DBL_MAX;       //min of double
    for (double i : arr) {
        if (i > maxVal) {
            maxVal = i;
        }
    }
    return maxVal;
}

int max_double_arr(std::vector<double> &arr, int mode) {    //overload index mode
    double maxVal = -DBL_MAX;       //min of double
    int maxIndex = 0;
    for (unsigned int i = 0; i < arr.size(); ++i) {
        if (arr.at(i) > maxVal) {
            maxVal = arr.at(i);
            maxIndex = i;
        }
    }
    return maxIndex;
}

//end of 0uts1de's library

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

    if (n < 1000) {
        cout << "ABC" << endl;
    } else {
        cout << "ABD" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
S = input()
T = input()


def main():
    if len(S) < len(T):
        print("UNRESTORABLE")
        return

    for i in range(len(S) - len(T), - 1, -1):
        for j in range(len(T)):
            if S[i + j] != "?" and S[i + j] != T[j]:
                break
        else:
            print(S[:i].replace("?", "a") + T +
                  S[i + len(T):].replace("?", "a"))
            break
    else:
        print("UNRESTORABLE")

    return


main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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

signed main() {
  ll N;
  cin >> N;

  vector<P> PP(N);
  rep(i, N) {
    ll a;
    cin >> a;
    PP[i] = {a, i + 1};
  }
  SORT(PP);

  rep(i, N) {
    P p = PP[i];
    if (i == 0) {
      cout << p.second;
    } else {
      cout << " " << p.second;
    }
  }
  ENDL;
  return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <cctype>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map> // pair
#include <set>
#include <string>

#define MAXSIZE 200000
#define PI 3.141592653589
using namespace std;

template<typename T>
T add(T a,T b){
  return a+b;
}

namespace A
{
  int f(void){
    return 1;
  }
}

// int main(){
//   int n;
//   while (std::cin >> n) {
//     int count=0;//素数の数
//     for(int i=2;i<=n;i++){
//       int flag=0;
//       if(i==2){
//         count++;
//         continue;
//       }else if(i%2==0){
//         continue;
//       }
//
//       for(int j=3;j<=sqrt(i);j=j+2){
//         if(i%j==0){
//           flag=1;
//           break;
//         }
//       }
//       if(flag==0){
//         count++;
//       }
//     }
//     std::cout << count << '\n';
//   }
//
// }

int main(){
  int a,t[1000000],u[1000000];
  for(int i=0;i<1000000;i++){
    t[i]=1;
  }
  t[0]=t[1]=u[0]=u[1]=0;
  for(int i=2;i<=1000000;i++){
    if(t[i]==1){
      for(int j=i+i;j<1000000;j+=i)t[j]=0;
      u[i]=u[i-1]+1;
    }else{
      u[i]=u[i-1];
    }
  }
  while(cin>>a){
    cout<<u[a]<<endl;
  }
  return 0;
}



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

string Rotate(string str);

int main(){
	string S, T;
	cin >> S >> T;

	bool isSame = false;
	int t = 0;
	int maxT = S.length();

	do{
		if (S == T){
			isSame = true;
		}
		else{
			S = Rotate(S);
		}

		t++;
	} while (!isSame && t < maxT);

	if (isSame){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

string Rotate(string str){
	string temp;
	temp = str[str.length() - 1];
	for (int i = 0; i < str.length() - 1; i++){
		temp += str[i];
	}
	return temp;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3", "unroll-loops")
#include <bits/stdc++.h>

using namespace std;
const int maxn = 100 + 10;
int dp[3][maxn], arr[3][maxn], n;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	for (int i = 1; i <= 2; i++)
		for (int j = 1; j <= n; j++) {
			cin >> arr[i][j];
			dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + arr[i][j];
		}
	cout << dp[2][n] << '\n';
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)


int main(){
  ll n;
  cin >> n;
  ll l,sum=0,res=-1;
  string ans="Yes";
  rep(i,n){
    cin >> l;
    sum+=l;
    res=max(res,l);
  }
  //cout << sum <<" " << res << endl;
  if((sum-res)>res)cout <<ans <<endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256