akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
using namespace std;

void resultPrinter(int a[], int n){
    for(int i = 0; i < n; i++){
        if(i > 0) printf(" ");
        printf("%d", a[i]);
    }
    printf("\n");
}

void insertion(int a[], int n){
    for(int i = 1; i < n; i++){
        int v = a[i];
        int j = i - 1;
        while(j >= 0 && a[j] > v){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        resultPrinter(a,n);
    }
}


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

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

    resultPrinter(a,n);
    insertion(a,n);

    return 0;
}




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

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

    int appear[26];
    for(int i = 0; i < 26; i++) appear[i] = 51;

    string s;
    for(int i = 0; i < n; i++){
        cin >> s;
        int tmp[26] = {};
        for(int j = 0; j < s.length(); j++){
            tmp[s[j] - 'a']++;
        }
        for(int j = 0; j < 26; j++){
            appear[j] = min(appear[j], tmp[j]);
        }
    }

    for(int i = 0; i < 26; i++){
        for(int j = 0; j < appear[i]; j++){
            cout << (char)('a' + i);
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define M 1000000007
using namespace std;
long long ans=1;
long long n,t[100000],a[100000],u[100000];
int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>t[i];
  for(int i=0;i<n;i++)cin>>a[i];
  u[0]=t[0];
  u[n-1]=a[n-1];
  for(int i=1;i<n;i++){
    if(t[i-1]!=t[i]){
      if(u[i]&&u[i]!=t[i])ans=0;
      u[i]=t[i];
    }
    if(t[i-1]>t[i])ans=0;
  }
  for(int i=n-2;i>=0;i--){
    if(a[i]!=a[i+1]){
      if(u[i]&&a[i]!=u[i])ans=0;
      u[i]=a[i];
    }
    if(a[i]<a[i+1])ans=0;
  }
  for(int i=0;i<n;i++){
    if(!u[i]){
      ans= ( ans*min(t[i],a[i]) )%(long long)(M);
    }
    else if(u[i]>min(t[i],a[i]))ans=0;
  }
  if(n==1&&a[0]!=t[0])ans=0;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 2560
# -*- coding: utf-8 -*-
import sys
import collections
input = sys.stdin.readline
def ii(): return int(input().rstrip())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def fi(): return float(input().rstrip())
def mfi(): return map(float, input().rstrip().split())
def lmfi(): return list(map(float, input().rstrip().split()))
def li(): return list(input().rstrip())
def exit(*arg): print(*arg); sys.exit()
# template

class edge:
    def __init__(self, src, to, info):
        self.src = src
        self.to = to
        self.info = info
        return

def main():
    n = ii()
    g = [[] for i in range(n)]
    for i in range(n - 1):
        a, b = mi()
        g[a - 1].append(edge(a - 1, b - 1, i))
        g[b - 1].append(edge(a - 1, b - 1, i))
    color = max(*map(len, g))
    print(color)
    q = collections.deque()
    ans = [-1 for i in range(n - 1)]
    idx = 0
    q.append((0, 0))
    while len(q):
        t, idx = q.popleft()
        for e in g[t]:
            if ans[e.info] != -1:
                continue
            idx += 1
            ans[e.info] = idx
            q.append((e.to, idx))
    print(*map(lambda x: x % color + 1, ans), sep="\n")
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 92576
#include <cstdio>
#include <iostream>
#include <vector>
#include <utility>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
	int n;
	while(scanf("%d\n", &n), n){
		vector<pair<ll, ll> > v;
		rep(i,n) {
			ll x, y, z;
			cin >> x >> y >> z;
			bool f = false;
			for(int j = 0; j < v.size(); ++j) {
				if(v[j].first == x) {
					v[j].second += y * z;
					f = true;
					break;
				}
			}
			if(!f) {
				v.push_back(make_pair(x, y * z));
			}
		}
		bool flag = false;
		for(int j = 0; j < v.size(); ++j) {
			if(v[j].second >= 1000000) {
				flag = true;
				cout << v[j].first << endl;
			}
		}
		if(!flag) cout << "NA" << endl;
	}
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main() {
    long long n, k, s;
    cin >> n >> k >> s;
    for (int i = 1; i <= k; ++i) {
        cout << s << ' ';
    }
    if (s == 1e9) {
        for (int i = 1; i <= n - k; ++i)
            cout << 1 << ' ';
    } else {
        for (int i = 1; i <= n - k; ++i)
            cout << s + 1 << ' ';
    }
    return 0;
}

Measured memory_bytes: 1280
import java.io.*;
import java.util.*;


public class Main{

	public static void main(String args[]){
		ArrayList<Swap> list = new ArrayList<Swap>();
		Scanner scan = new Scanner(System.in);
		while(true){
			int x =  scan.nextInt();
			int y =  scan.nextInt();
			if(x==0 && y==0)
				break;
			list.add(new Swap(x,y));
		}
		scan.close();
		for(Swap s : list){
			s.smaller();
			System.out.println(s);
		}
		

	}

}

class Swap{
	int a;
	int b;
	public Swap(int x, int y){
		a = x;
		b = y;	
	}
	
	public void smaller(){
		if(a < b)
			return;
		int tmp = a;
		a=b;
		b=tmp;
	}

	@Override
	public String toString(){
		return a + " " + b;
	}

}

Measured memory_bytes: 27732
/* ALDS1_6_A: Counting Sort */

#include <iostream>
#include <cstdio>

const int MAX_VALUE = 10000;

void counting_sort(int n, int in[], int out[], int max) {
    int counts[max + 1];
    std::fill_n(counts, max + 1, 0);

    for (int i = 0; i < n; i++)
        counts[ in[i] ]++;

    for (int i_c = 1; i_c <= max; i_c++)
        counts[i_c] += counts[i_c - 1];

    for (int i = n - 1; 0 <= i; i--) {
        out[ counts[in[i]] - 1 ] = in[i];
        counts[ in[i] ]--;
    }
}

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

    int *in = new int[n];
    for (int i = 0; i < n; i++)
        scanf("%d", &in[i]);

    int *out = new int[n];
    counting_sort(n, in, out, MAX_VALUE);

    printf("%d", out[0]);
    for (int i = 1; i < n; i++)
        printf(" %d", out[i]);
    puts("");

    return 0;
}

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


int N, A[100000], B[100000], C[100000];


int main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    for(int i = 0; i < N; i++){
        cin >> B[i];
    }
    for(int i = 0; i < N; i++){
        cin >> C[i];
    }
    sort(A, A+N);
    sort(B, B+N);
    sort(C, C+N);

    long long b_cnt[100000];
    
    for(int b = 0; b < N; b++){
        int *c = lower_bound(C, C+N, B[b]+1);
        b_cnt[b] = N-(c-C);
    }

    long long b_cnt_sum[100001];
    b_cnt_sum[N] = 0;
    for(int b = N-1; b >= 0; b--){
        b_cnt_sum[b] = b_cnt_sum[b+1] + b_cnt[b];
    }

    long long res = 0;
    int b = 0;
    for(int a = 0; a < N; a++){
        while((b < N) && (B[b] <= A[a])){
            b++;
        }
        if(b >= N){
            break;
        }
        res += b_cnt_sum[b];
    }
    cout << res << endl;
    
    /*
    int a = 0, b = 0, c = 0;
    long long res = 0;
    for(a = 0; a < N; a++){
        while((b < N) && (B[b] <= A[a])){
            b++;
        }
        while((c < N) && (C[c] <= B[b])){
            c++;
        }
        if( (b>=N) || (c>=N) ){
            break;
        }
        printf("a = %d, b = %d, c = %d\n", a, b, c);
        res += (N-b) * (N-c);
    }
    cout << res << endl;
    */

    return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;


int main(){
    int N,M;
    cin >> N >> M;
    vector<int> s[10];
    
    for(int i=0; i<M; i++){
        int k;
        cin >> k;
        for(int j=0; j<k; j++){
            int a;
            cin >> a;
            s[i].push_back(a);
        }
    }
    
//
    int p[10];
    for(int i=0; i<M; i++){
        cin >> p[i];
    }
    
    int ans=0;
    for(int t=0; t<(1<<N); t++){
        
        int ok=1;
        int on[10]={};
        
        int temp=t;
        for(int i=0; i<N; i++){
            on[i]=temp%2;
            temp/=2;
        }

        
        for(int i=0; i<M; i++){
            int num=0;
            for(auto x: s[i]){
                num+=on[x-1];
            }
            num%=2;
            if(num!=p[i]){
                ok=0;
                break;
            }
        }
        
        ans+=ok;
    }
    
    cout<<ans<<endl;
    return 0;
    
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>


typedef long long ll;
const double Eps = 1e-5;

using namespace std;

typedef complex<double> Point;

double dot(const Point& a, const Point& b)
{
	return a.real()*b.real() + a.imag()*b.imag();
}
double cross(const Point& a, const Point& b)
{
	return a.real()*b.imag() - a.imag()*b.real();
}
double distance_line_point(const Point& a, const Point& b, const Point& point)
{
	return abs(cross(a-b, point-b) / abs(a-b));
}
double distance_linesegment_point(const Point& a, const Point& b, const Point& point)
{
	if (dot(b-a, point-a) < Eps)
		return abs(a-point);
	else if (dot(a-b, point-b) <Eps)
		return abs(b-point);
	else
		return distance_line_point(a, b, point);
}

int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		Point wall[126];
		int radius[126];
		for (int i = 0; i < n; ++i)
		{
			int a, b, r;
			scanf("%d %d %d", &a, &b, &r);
			wall[i] = Point(a, b);
			radius[i] = r;
		}

		int m;
		scanf("%d", &m);
		for (int i = 0; i < m; ++i)
		{
			int a, b, c, d;
			scanf("%d %d %d %d", &a, &b, &c, &d);
			Point tarou(a, b), oni(c, d);

			bool safe = false;
			for (int j = 0; j < n; ++j)
			{
				double EpsR = Eps + radius[j];
				if (abs(tarou - wall[j]) < EpsR && abs(oni - wall[j]) < EpsR)
					continue;

				if (distance_linesegment_point(tarou, oni, wall[j]) < EpsR)
				{
					safe = true;
					break;
				}
			}
			if (safe)
				puts("Safe");
			else
				puts("Danger");
		}
	}

	return 0;
}

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

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int K, Q; cin >> K >> Q;
  int D[K];
  for (auto i = 0; i < K; i++) cin >> D[i];
  int n, x, m;
  long a, s1, s2, v;
  for (auto i = 0; i < Q; i++) {
    cin >> n >> x >> m;
    s1 = 0; s2 = 0;
    for (auto j = 0; j < K; j++) {
      v = D[j]%m == 0 ? m : D[j]%m;
      s1 += v;
      if (j < (n - 1)%K) s2 += v;
    }
    a = x%m + (n - 1)/K*s1 + s2;
    cout << (n - 1) - a/m << endl;
  }
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=a,i##_len=(b);i<i##_len;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;
typedef long long ll;

int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
    string s;
    cin >> s;

    if (s[0] == s[1] && s[1] == s[2]) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 760
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int k, t;
    cin >> k >> t;
    vector<int> a(t);
    for(int i=0; i<t; i++)cin >> a[i];
    sort(a.begin(), a.end(), greater<int>());
    
    cout << max(a[0] - 1 - (k - a[0]), 0) << endl;
}


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

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

	cin >>a >>b >>c;
	for(int i=0;i<=b;i++){
		if(a*i%b==c){
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
read = sys.stdin.buffer.read


N = int(readline())
A = list(map(int, readline().rstrip().split()))
A = sorted(A, reverse=True)

M = -(-N // 2)
ans = A[0]
for m in range(1, M):
    ans += A[m] * 2

if N % 2 != 0:
    ans -= A[M - 1]

print(ans)

Measured memory_bytes: 29432
package main

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

var sc = bufio.NewScanner(os.Stdin)

func stringLineScan() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	n, _ := strconv.Atoi(stringLineScan())
	r, _ := strconv.Atoi(stringLineScan())
	if n >= 10 {
		fmt.Println(r)
	} else {
		fmt.Println(r + 100*(10-n))
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; ++i)
    {
        /* code */
        cin >> a[i];
    }
    int ans = 0;
    for (int i = 0; i < n; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            if (a[i] == a[j]) continue;
            for (int k = j + 1; k < n; ++k)
            {
                if (a[j] == a[k] || a[i] == a[k]) continue;
                if (a[i] + a[j] > a[k] && a[i] + a[k] > a[j] && a[j] + a[k] > a[i])
                    ans++;
            }
        }
    }
    cout << ans;
}

Measured memory_bytes: 3632
PROGRAM otoshidama
      IMPLICIT NONE
      INTEGER :: N,Y
      INTEGER :: a,b,c, s,ans(3)
      LOGICAL :: flag
      !a10000 b5000 c1000
      
      READ*,N ,Y
      
      flag = .FALSE.
      
      outer:DO a = 0,N
        DO b = 0,N-a
          c = N - a - b
          s = 10000*a + 5000*b + 1000*c
          IF(s==Y)THEN
            flag = .TRUE.
            ans(1)=a;ans(2)=b;ans(3)=c
          END IF
        END DO
      END DO outer
      
      IF(flag)THEN
        print'(I0,X,I0,X,I0)',ans(:)
      ELSE
        print'(A)','-1 -1 -1'
      END IF
      
      
      
      
      
      
      END PROGRAM

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
ll gcd(ll a, ll b) {
  if(a < b) swap(a, b);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

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

ll GetFactorNum(ll a, ll b)
{
    return a / b;
}

ll F(ll a, ll b, ll c)
{
    return a - (GetFactorNum(a, b) + GetFactorNum(a, c) - GetFactorNum(a, lcm(b, c)));
}

void _main()
{
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    const ll a = F(B, C, D);
    const ll b = F(A - 1, C, D);
    cout << a - b << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;
const ll LINF=1e18;

int main(){
    ll s,t;
    cin>>s>>t;
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll x=s*(a-c);
    ll y=t*(b-d);
    if(x+y==0){
        cout<<"infinity"<<endl;
        return 0;
    }
    if(x+y<0){
        x=-x;
        y=-y;
    }
    if(x>0){
        cout<<0<<endl;
        return 0;
    }
    ll u=(-x)/(x+y)+1;
    ll ans=((-x)/(x+y)+1)*2-1;
    if((x+y)*(u-1)+x==0){
        ans-=1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toInt()
        val f = LongArray(N + 1) { 1 }
        for (i in 2..N) {
            var j = i
            while (j <= N) {
                f[j]++
                j += i
            }
        }

        var ans = 0L
        for (i in 1..N) {
            ans += f[i] * i
        }
        pw.println(ans)
    }
}


Measured memory_bytes: 117128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define out(a) cout<<fixed<<setprecision((a))


int main(){
	string s;
	cin >> s;
	FOR(i,0,3){
		if(s[i]==s[i+1]){
			cout << "Bad" << endl;
			return 0;
		}
	}
	cout << "Good" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#define MAXN 100
using namespace std;
typedef long long ll;

ll N, M;
ll ans;

int main() {
	ans = 0;

	cin >> N >> M;
	
	if (N == 1 && M == 1) {
		ans = 1;
	}
	else if (N == 2 || M == 2) {
		ans = 0;
	}
	else if (N == 1) {
		ans = M - 2;
	}
	else if (M == 1) {
		ans = N - 2;
	}
	else {
		ans = (N - 2)*(M - 2);
	}

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

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define MAX_N 1000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>

using namespace std;

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

static const double eps = 1e-8;

int main(){
	int n;
	while(~scanf("%d",&n)){
		if(n==0) break;

		int* a = new int[n];
		for(int i=0;i<n;i++){
			scanf("%d",a+i);
		}

		int res=0;
		for(int i=0;i<n;i++){
			for(int j=0;j+1<n;j++){
				if(a[j]>a[j+1]){
					swap(a[j],a[j+1]);
					res++;
				}
			}
		}

		printf("%d\n",res);

		delete[] a;
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define _for(i, a, b) for (int i = (a); i < (b); i++)
#define _count(i, a, b) for (int i = (a); i <= b; i++)
#define PB emplace_back
#define MINI -2147483648
#define MAXI 2147483647
#define MAXLL 9223372036854775807
#define MINLL -9223372036854775808
#define VI vector<int>
#define VB vector<bool>
#define VLL vector<long long>
#define LL long long
#define ULL unsigned long long
#define ALL(X) X.begin(), X.end() 
#define pii pair<int, int>
#define F first
#define S second
#define mp make_pair
//#define Remilia_is_so_cute
#define StarBurst std::ios::sync_with_stdio(false),cin.tie(NULL);
#define lowerBit(x) x&-x
using namespace std;
 
inline void R_P(vector<int> &vec) {
  int temp;
  cin>>temp;
  vec.push_back(temp);
} 
inline bool checkMax(int &base, int test) {
  return (test > base) ? base = test, true : false; 
}
 
inline bool checkMin(int &base, int test){
  return (test < base)? base = test, true : false;
}
template <class T>
void test(vector<T> &vec, const string &warn) {
  cout<<warn<<'\n';
  _for(i, 0, vec.size())
    cout<<vec[i]<<' ';
  cout<<"\nTest end..............\n";
}
 
int n;
bool prime[1501];
VI primes;
/*
int gcd(int a, int b) {
  if (a < b)
    swap(a, b);
  while(a != 0 && b != 0) {
    a %= b;
    if (a != 0)
      b %= a;
  }
 
  return a + b;
}*/
int gcd(int a, int b) {
  if (a < b)
    swap(a, b);
  if (b == 0)
    return a;
  else
    return gcd(a % b, b);
}
int main () {
  StarBurst
  #ifdef Remilia_is_so_cute
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
  
  _for(i, 2, 1501)
    prime[i] = true;
  _for(i, 2, 1501) {
    if (!prime[i])
      continue;
 
    primes.PB(i);
    int r = 1;
    while(++r * i <= 1500)
      prime[i * r] = false;
  }
  
  cin >> n;
  VI vec(n, 0);
  _for(i, 0, n)
    cin >> vec[i];
 
  set<int> se;
  bool ok = true;
  for(int X : vec) {
 
    for(int pri : primes) {
 
      if (X % pri == 0) {
        while(X % pri == 0) X /= pri;
        if (se.count(pri))
          ok = false;
        se.insert(pri);
      }
      if (X == 1)
        break;
    }
 
    if (X != 1) {
      if (se.count(X))
        ok = false;
      se.insert(X);
    }
  }
  //cout << "test\n";
  /*
  for(int X : se) {
    cout << X << '\n';
  }*/
  if (ok) {
    cout << "pairwise coprime\n";
    return 0;
  }
 
  int tmp = gcd(vec[0], vec[1]);
  _for(i, 2, n)
    tmp = gcd(tmp, vec[i]);
 
  if (tmp == 1) {
    cout << "setwise coprime\n";
  } else {
    cout << "not coprime\n";
  }
 
 
  return 0;
}

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

int main() {
    //int a, b, c;
    string a, b;
    cin >> a;
    for (int i = 0; i < a.size(); ++i) {
        if (a[i] == 'B') {
            if (b.empty()) continue;
            b.pop_back();
        }  else {
            b.push_back(a[i]);
        }
    }
    cout << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

/*
  let's try computer shogi
*/


struct block{
  ll x;
  ll y;
};

bool sblock(const block& left, const block& right){
  return left.x == right.x ? left.y > right.y : left.x < right.x;
}

int main(){
  ll h,w,n;
  cin >>h >> w >> n;
  vector<block> s;
  s.resize(n);
  for(ll i=0;i<n;++i){
    cin >> s[i].x >> s[i].y;
  }
  sort(s.begin(), s.end(), sblock);
  ll xmax = 1;
  ll ymax = 1;
  for(ll i=0;i<n;++i){
    cerr<<"block "<<s[i].x << " "<<s[i].y<<endl;
    cerr<<"xymax "<<xmax<<" "<<ymax<<endl;
    if(s[i].x < s[i].y){
      continue; //meaning less
    }
    // head attack
    if(xmax != s[i].x && s[i].x - xmax == s[i].y - ymax){
      cerr<<"head attack"<<endl;
      ymax = s[i].y - 1;
      xmax = s[i].x;
      continue;
    }
    if(xmax == s[i].x || s[i].x - xmax > s[i].y - ymax-1){
      cerr<<"hit"<<endl;
      cout<<s[i].x-1<<endl;
      return 0;
    }
  }
  cout<<h<<endl;
}

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

int main() {
  string s;
  cin >> s;
  string ans;
  rep(i,s.size()) {
    if (i%2 == 0)
      ans += s[i];
  }
  cout << ans <<endl;
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int ans = 0;
    for(int i = 1; i <= N; i++) {
      ans += i;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define ll long long
#define P pair<int, int>
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------
void solve(){
}
int main(){
    string s;
    cin >> s;
    int n = s.size();
    bool ck = true;
    for(int i = 0; i < (n + 1) / 2; i++){
        if(s.at(i) != s.at(n - 1 - i)){
            ck = false;
            break;
        }
    }
    if(ck){
        for(int i = 0; i < (n - 1) / 2; i++){
            if(s.at(i) != s.at((n - 3) / 2 - i)){
                ck = false;
                break;
            }
        }
    }
    if(ck){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;

    solve();
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数


template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N, M, d,op;cin >> N >> M;vector<ll> H(N+1);
	for (int i = 1;i <= N;i++) cin >> H[i];
	ll ans = 0;
	vector<ll> A(M+1), B(M+1);
	vector<ll> path(N+1);
	for (int i = 1;i <= M;i++)cin >> A[i] >> B[i];
	for (int i = 1;i <= M;i++) {
		if (H[A[i]] < H[B[i]]) {
			path[A[i]] = -1;
		}else if(H[A[i]] == H[B[i]]) {
			path[B[i]] = -1;
			path[A[i]]=-1;
		}else path[B[i]] = -1;
	}
	for (int i = 1;i < N + 1;i++) if (path[i] != -1) ans++;
	cout << ans << endl;
}


Measured memory_bytes: 6416
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef pair<long long, int>P;
long long bit[100010]={}, N;
long long sum(int i){
	long long s = 0;
	while(i>0){
		s+=bit[i];
		i-=(i&-i);
	}
	return s;
}
void add(int i, long long x){
	while(i<=N){
		bit[i]+=x;
		i+=(i&-i);
	}
}
long long countBubble(const vector<long long>&vec){
	N = vec.size();
	long long res = 0;
	for(int i=0;i<vec.size();i++){
		res += (long long)i - sum(vec[i]);
		add(vec[i], 1);
		
	}
	return res;
}

int main(){
	
	int n;
	cin>>n;
	std::vector<long long>s(n);
	std::vector<P>sorted(n);
	for(int i=0;i<n;i++){
		int p;
		cin>>p;
		if(i)s[i]=s[i-1]+p;
		else s[i]=p;
		sorted[i].first = s[i];
		sorted[i].second = i;
	}
	sort(sorted.begin(), sorted.end());
	for(int i=0;i<n;i++){
		int l;
		cin>>l;
		int p;
		if(i)p=sorted[i].first-sorted[i-1].first;
		else p=sorted[i].first;
		if(l>p){
			cout<<-1<<endl;
			return 0;
		}
		s[sorted[i].second]=i+1;
	}
	cout<<countBubble(s)<<endl;
	
	return 0;
}



Measured memory_bytes: 6000
#include <cstdio>
using namespace std;

int main() {
    int n;
    scanf("%d", &n);// don't forget &
    int x = n % 10;
    if (x == 3) {
        puts("bon");
    } else if (x <= 1 || x == 6 || x == 8) {
        puts("pon");
    } else {
        puts("hon");
    }
    return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int n,l,sum,k=2e9,ans;
int main(){
	scanf("%d%d",&n,&l);
	for(int i=1;i<=n;i++){
		sum+=l+i-1;
		if(k>abs(l+i-1)){
			ans=l+i-1;
			k=abs(l+i-1);
		}
	}
	printf("%d",sum-ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

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

    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    string result = "YES";
    for(int i = 0; i < n - 1; i++){
        if(a[i] == a[i + 1]){
            result = "NO";
        }
    }
    cout << result << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(){
	int a[10],i,j,n;
	for(i=0;i<10;i++)scanf("%d",&a[i]);
	for(i=0;i<10;i++){
		for(j=i;j<10;j++){
			if(a[i]<a[j]){
				n=a[i];
				a[i]=a[j];
				a[j]=n;
			}
		}
	}
	for(i=0;i<3;i++)printf("%d\n",a[i]);
	return 0;
}


Measured memory_bytes: 2120
#include<stdio.h>

int main(void)
{
	int a[100],n,i,j,box,count=0;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&a[i]);//配列読み込み
	for(i=0;i<n-1;){ //i ソート済みの配列番号
		for(j=n-1;j>=i;j--){ //末尾からソート済みまでの範囲をソート
			if(j!=0&&a[j-1]>a[j]){//隣接交換
				box=a[j-1];
				a[j-1]=a[j];
				a[j]=box;
				count++;//交換実行毎にcountをインクリメント
			}
			if(i==j) i++;//ソート済みまでいけばiをインクリメント
			
		}
	}
	
	for(i=0;i<n;i++){
	    printf("%d",a[i]);
	    if(i!=n-1) printf(" ");
	}
	printf("\n%d\n",count);
			
	return 0;
}


Measured memory_bytes: 2100
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

string r0 = "AKIHABARA";
set<string> rr;

int main(){
	string s;
	cin>>s;
	rr.insert(r0);
	rep(_, 10){
		for(auto &&r: rr){
			rep(i, r.size()){
				if(r[i]!='A') continue;
				else rr.insert(r.substr(0, i)+r.substr(i+1));
			}
		}
	}
	if(rr.count(s)) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    for(int z; cin>>z,z;){
        int ans = 1e9;
        for(int x=1; x*x*x<=z*z*z; x++){
            for(int y=1; y*y*y + x*x*x <= z*z*z; y++){
                ans = min(z*z*z - x*x*x - y*y*y, ans);
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1160
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int X, Y;
  cin >> X >> Y;

  cout << X + Y / 2 << endl;
  return 0;
}


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

int main(void){
    int n;
    cin>>n;
    vector<int> r(n);
    for (int i = 0; i < n; ++i) {
        cin>>r[i];
    }
    int ans=-1000000007;
    int minv=r[0];
    for (int i = 1; i < n; ++i) {
        ans=max(ans,r[i]-minv);
        minv=min(minv,r[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3620
from sys import stdin


def main() -> None:
    s = next_str()
    t = next_str()
    print(("No", "Yes")[s in t * 2])


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
#define INF 0x3f3f3f3f
const int maxn=2e5+10;
#define _rep(i,a,b) for(int i=(a);i<=(b);++i)
int n,a[maxn],ans;

int main()
{
    #ifdef __LOCAL__
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
    scanf("%d",&n);
    _rep(i,1,n)
        scanf("%d",&a[i]);
    int last=1,ans=1;
    _rep(i,2,n)
    {
        if(a[i]<a[last])
        {
            ans++;
            last=i;
        }    
        // TLE
        // bool flag=true;
        // _rep(j,1,i)
        // {
        //     if(a[j]<a[i])
        //     {
        //         flag=false;
        //         break;
        //     }
        // }
        // if(flag==true)
        //     ans++;

    }
    cout<<ans;
    
    return 0;
}

Measured memory_bytes: 1024
def main():
    n, m, c = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    sourcecode = [[int(i) for i in input().split()] for _ in range(n)]
    ans = 0
    for A in sourcecode:
        _sum = 0
        for i in range(m):
            _sum += A[i] * B[i]
        if _sum > -c:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 62348
#include <cstdio>
#include <utility>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;
const int maxn = 1005;
pair<int,double> b[maxn];
int n,t;
double a;
double zhu(int h)
{
	return double((t + 0.0) - (h + 0.0) * 0.006);
}
int main(int argc, char const *argv[])
{
	double ans = 0x3f3f3f3f;
	int ans_pos = 1;
	scanf("%d%d%lf",&n,&t,&a);
	for(int i = 0;i < n; ++i)
	{
		int x;
		scanf("%d",&x);
		double now = fabs(a - zhu(x));
		if(now < ans)
		{
			ans = now;
			ans_pos = i + 1;
		}
	}
	cout<<ans_pos<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <sstream>
#include <stdio.h>
#include<math.h>
using namespace std;

int main(){

    int A,P;

    cin >> A >> P;

    int max;
    max = (3 * A + P) / 2;

    cout << max;


    return 0;
}

Measured memory_bytes: 256
//hinagata.cpp
//作成日
//更新日
//目的
//手段
/*includes*/
#include <bits/stdc++.h>
/*namespace*/
using namespace std;
using ll= long long;
/*define macro*/
#define REP(i,n) for(ll i=0;i<(n);i++)
#define REPi(i,a,b) for(ll i=(a);i<(b);i++)
#define REPRi(i,a,b) for(ll i=(a);i>(b);i--)
#define ALL(x) (x).begin(),(x).end()

int main(){
    int N,K;
    cin>>N>>K;
    vector<double> P(N+1);
    REPi(i,1,N+1){
        cin>>P[i];
    }
    //inputend
    vector<double> sum(N+1,0);
    REPi(i,1,N+1){
        double Poi=(1+P[i])/2;
        //Poiはあるiにおける出目の期待値
        sum[i]=sum[i-1]+Poi;
    }
    double ans=0;
    REP(i,N-K+1){
        ans=max(sum[i+K]-sum[i],ans);
    }
    printf("%.12f\n",ans);
}

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define dbg(x) cout<<#x" = "<<(x)<<ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, p[22222], t, a[22222], b[22222];

int main() {
	cin >> n;
	repst(i,1,n) {
		cin >> t;
		p[t] = i;
	}
	repst(i,1,n) a[i] = i*30000, b[i] = (n-i)*30000 + p[i];
	repst(i,1,n) cout << a[i] << (i==n ? '\n' : ' ');
	repst(i,1,n) cout << b[i] << (i==n ? '\n' : ' ');
}

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

int main(){
    int n,m,c;
    int B[20] = {};
    const int MAX = 256;
    int A[MAX][20] = {};
    int sum = 0;
    int num = 0;

    cin >> n >> m >> c;

    for (int i = 0; i < m; i++) {
        cin >> B[i];
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++){
            cin >> A[i][j];
        }
    }

    for (int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            sum += A[i][j] * B[j];
        }
        sum += c;

        if ( sum > 0 ) num++;
        sum = 0;
    }

    cout << num << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {

    vector<int> a(3);

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

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


    if(a.at(0) == 5 && a.at(1) == 5 && a.at(2) == 7)cout << "YES" << endl;
    else cout << "NO" << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <sstream>

#define fi first
#define se second
#define pb push_back
#define fore(i, a, b) for (int i = (a), _b = (b); i < (_b); ++i)
#define fort(i, a, b) for (int i = (a), _b = (b); i <= (_b); ++i)
#define ford(i, a, b) for (int i = (a), _b = (b); i >= (_b); --i)

using namespace std;

typedef long long LL;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const int INF = 1e9 + 3;
const int MOD = 1e9 + 7;

void input() {
	
}

void solve() {
	string s; cin >> s;
	if (s[0] == 'S') cout << "Cloudy\n";
	else if (s[0] == 'C') cout << "Rainy\n";
	else cout << "Sunny\n";
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
	input();
	solve();
    return 0;
}


Measured memory_bytes: 256
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]

ans = [0 for i in range(n)]
for i in range(m):
    ab = list(map(int, input().split()))
    ans[ab[0]-1] += 1
    ans[ab[1]-1] += 1

for i in range(n):
    print(ans[i])

Measured memory_bytes: 3060
n=int(input())
ans_list=[]

for i in range(n):
	a=int(input())
	b=int(input())
	if max(a,b,a+b)>=10**80:
		ans_list.append("overflow")
	else:
		ans_list.append(a+b)

for i in ans_list:
	print(i)

Measured memory_bytes: 7568
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
const ll Mod=1000000007;
const ll INF=999999999999999999;
const ll NN=(ll)(1e6+5);
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {
     string s;
     cin>>s;
     cout<<s;
     if(s[s.length()-1]=='s')
       cout<<"e";
     cout<<"s";
   }
}

Measured memory_bytes: 3640
a, b = map(int, input().split())
r = list(map(int, input().split()))
ans = 0
num_m = 0

for i in range(1, len(r)):
    k = r[i] - r[i-1]
    ans += k
    if k > num_m:
        num_m = k
k = r[0] + a - r[-1]
ans += k
if k > num_m:
    num_m = k

print(ans - num_m)


Measured memory_bytes: 26444
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
string S;
  cin>>S;
  if(S=="ABC") {
cout<<"ARC"<<endl;
  }
  else {
cout<<"ABC"<<endl;
  }
}


Measured memory_bytes: 3556
/*input
4 4
1 1
4 4
..#.
..#.
.#..
.#..
*/

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

const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};

int main() {
    int h, w;
    cin >> h >> w;
    int si, sj;
    cin >> si >> sj;
    int ti, tj;
    cin >> ti >> tj;
    --si; --sj; --ti; --tj;
    vector<string> s(h);
    rep(i, h) cin >> s[i];

    const int INF = 1e9;
    vector<vector<int>> dist(h, vector<int>(w, INF));
    deque<P> q;
    dist[si][sj] = 0;
    q.emplace_back(si, sj);
    while (!q.empty()) {
        int i = q.front().first;
        int j = q.front().second;
        int d = dist[i][j];
        q.pop_front();
        rep(v, 4) {
            int ni = i+di[v], nj = j+dj[v];
            if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
            if (s[ni][nj] == '#') continue;
            if (dist[ni][nj] <= d) continue;
            dist[ni][nj] = d;
            q.emplace_front(ni, nj);
        }
        for (int ei = -2; ei <= 2; ++ei) {
            for (int ej = -2; ej <= 2; ++ej) {
                int ni = i+ei, nj = j+ej;
                if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
                if (s[ni][nj] == '#') continue;
                if (dist[ni][nj] <= d+1) continue;
                dist[ni][nj] = d+1;
                q.emplace_back(ni, nj);
            }
        }
    }
    int ans = dist[ti][tj];
    if (ans == INF) ans = -1;
    cout << ans << endl;
}

Measured memory_bytes: 9512
h,w,k=map(int,input().split())
c=["" for i in range(h)]
checkw="."*w
gyou=[]
retu=[]
black=[]
alww=[]
alwh=[]
pat1=[]
pat2=[]
ans=0
for i in range(h):
    c[i]=input()
    for j in range(w):
        if (c[i][j]=="#"):
            black.append(len(black))
            gyou.append(i)
            retu.append(j)
            

for i in range(2**h):
    tmp1 = [False] * (h)
    for j in range(h):
        if i >> j & 1:
            tmp1[j] = True
    pat2.append(tmp1)
    
for i in range(2**w):
    tmp2 = [False] * (w)
    for j in range(w):
        if i >> j & 1:
            tmp2[j] = True
    pat1.append(tmp2)


for i in range(len(pat1)):
    for j in range(len(pat2)):
        g=[]
        for x in range(w):
            if (pat1[i][x]==True):
                for l in range(len(black)):
                    if (retu[l]==x):
                        g.append(l)
        for y in range(h):
            if (pat2[j][y]==True):
                for l in range(len(black)):
                    if (gyou[l]==y):
                        g.append(l)
        #print(g)
        #print(gyou)
        #print(retu)
        #print(pat1)
        #print(pat2)
        #print(g)
        #print(len(set(g)))
        if (k==len(black)-len(set(g))):
            #print(pat1[i])
            #print(pat2[i])
            ans+=1
            
print(ans)

Measured memory_bytes: 9324
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;

int main() {
  set<char> st;
  st.insert('A');
  st.insert('C');
  st.insert('G');
  st.insert('T');

  string s;
  cin >> s;
  int ans = 0;
  rep(i, s.length()) {
    int cnt = 0;
    for (int j = i; j < s.length(); ++j) {
      if(st.find(s[j]) == st.end()) break;
      cnt++;
    }
    chmax(ans, cnt);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
using namespace std;


int main()
{
	int X, Y;
	cin >> X >> Y;

	cout << X + Y / 2 << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<numeric>
#include<cctype>
#include<random>
using namespace std;

//fixed << setprecision(10)
#define Yes(a) a ? "Yes" : "No";
#define YES(a) a ? "YES" : "NO";
#define rep(i,n) for(int i=0;i<n;i++)

int gcd(int a,int b) {
	if (a < b) {
		int tmp = a;
		a = b;
		b = tmp;
	}
	int r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}

map<int, int> prime;
void Prime(long long int n) {
	for (int i = 2; i <= n; i++) {
		int count = 0;
		while (n % i == 0) {
			count++;
			n /= i;
		}
		if (count != 0) {
			prime.insert(make_pair(i, count));
		}
	}
}

int main() {
	int a, b;
	cin >> a >> b;
	int ans = a - 2 * b;
	if (ans < 0)
		ans = 0;
	cout << ans << endl;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 30;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n;
  string s;
  cin >> n >> s;
  vector<int> w(n, 0), b(n, 0);
  rep(i, n) {
    if(s[i] == '#') ++b[i];
    if(i < n-1) b[i+1] += b[i];
  }
  reverse(ALL(s));
  rep(i, n) {
    if(s[i] == '.') ++w[i];
    if(i < n-1) w[i+1] += w[i];
  }
  reverse(ALL(w));

  int ans = INF;
  chmin(ans, b[n-1]);
  chmin(ans, w[0]);

  rep(i, n-1) {
    chmin(ans, w[i+1]+b[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 5244