akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<string> vs;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

string s, t;

int main() {
    cin >> s >> t;
    int n = s.size() + 1;
    int m = t.size() + 1;

    int dp[n + 1][m + 1];
    rep(i, n + 1) rep(j, m + 1) {
        dp[i][j] = 0;
    }
    rep(i, n) rep(j, m) {
        if (s[i] == t[j]) {
            dp[i + 1][j + 1] = dp[i][j] + 1;
        } else {
            dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
        }
    }

    int i = n - 1;
    int j = m - 1;
    string ans = "";
    while (i > 0 && j > 0) {
        if (dp[i - 1][j] == dp[i][j]){
            i--;
            continue;
        }
        if (dp[i][j - 1] == dp[i][j]){
            j--;
            continue;
        }

        i--; j--;
        ans += s[i];
    }
    reverse(all(ans));
    cout << ans << endl;
}

Measured memory_bytes: 35456
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <utility>
#include <algorithm>

using namespace std;


int main()
{
    ios::sync_with_stdio(0);
   long long n;
	cin>>n;
	cout<<n*(n - 1)/2<<endl;
	return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        // 入力
        int x = int.Parse(Console.ReadLine());

        var flag = false;
        while (!flag)
        {
            flag = IsPrime(x);
            if (!flag)
            {
                x++;
            }
        }

        var ans = x;
        Console.WriteLine(ans);

    }


    public static bool IsPrime(int num)
    {
        if (num < 2) return false;
        else if (num == 2) return true;
        else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2)
        {
            if (num % i == 0)
            {
                // 素数ではない
                return false;
            }
        }

        // 素数である
        return true;
    }
}


Measured memory_bytes: 13140
// Created by Tanuj Jain
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll dp[3005][3005];
bool vis[3005][3005];
int N;
ll values[3005];

ll recursive(int start, int end)
{
	//cout<<start<<" "<<end<<endl;
	//base case
	if(start==end)
		return dp[start][end]=values[start];
	if(end==start+1)
		return dp[start][end]=max(values[end],values[start]);
	if(vis[start][end])
		return dp[start][end];
	//mark it as visited and find the value
	vis[start][end]=true;
	//I have 2 options choose the starting or to choose from the end
	//If i choose the starting value, then the next value i can get is 
	return dp[start][end]=max(values[start]+ min(recursive(start+2,end),recursive(start+1,end-1)),
								values[end]+ min(recursive(start+1,end-1),recursive(start,end-2)));
}
int main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

	//#ifndef ONLINE_JUDGE
	//freopen("inputf.in","r",stdin);
	//freopen("outputf.in","w",stdout);
	//#endif

	cin>>N;
	ll sum=0;
	for(int i=1;i<=N;i++)
	{
		cin>>values[i];
		sum+=values[i];
	}
	ll x=recursive(1,N);
	ll y=sum-x;
	//cout<<x<<" "<<y<<" "<<sum<<endl;
	cout<<x-y;
	
}

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

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

  for (int i = 1; i <= n; ++i) {
    int x = i;
    if (x % 3 == 0) {
      cout << " " << i;
      continue;
    }
    if (x % 10 == 3) {
      cout << " " << i;
      continue;
    }
    x /= 10;
    for (;;) {
      if (x) {
        if (x % 10 == 3) {
          cout << " " << i;
          break;
        }
        x /= 10;
      } else {
        break;
      }
    }
  } 
  cout << endl;
 }

Measured memory_bytes: 1164
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc097/tasks/abc097_b

int main() {
    int X; cin >> X;
    vector<int> expo(X+1);
    expo[1] = 1;

    for (int i = 2; i < X; i++) {
        int v = i * i;
        while(v <= X) {
            expo[v] = 1;
            v *= i;
        }
    }

    for (int i = X; i >= 0; i--) if (expo[i]){
            cout << i << "\n";
            return 0;
    }

    return 0;
}


Measured memory_bytes: 256
import sys
from bisect import bisect_left as bi_l

n = int(sys.stdin.readline().rstrip())
I = list(zip(*[map(int, sys.stdin.read().split())] * 2))
red = I[:n]
blue = I[n:]

def main():
    red.sort(key=lambda x: x[0])
    blue.sort(key=lambda x: x[0])
    a = []
    b = []
    for x, y in red:
        a.append(x)
        b.append(y)
    
    paired = [False] * n
    cnt = 0
    for c, d in blue:
        pair = None
        res = -1
        for i in range(bi_l(a, c)):
            if not paired[i] and b[i] < d and b[i] > res:
                pair = i
                res = b[i]
        if not pair is None:
            paired[pair] = True
            cnt += 1
    
    return cnt

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 3064
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <deque>
#include <string.h>
#include <math.h>

using namespace std;

#define PI 4.0*atan(1.0)
#define epsilon 0.000000001
#define INF 1000000000000000000
#define MOD 1000000007

int N, pre = -1, dp [500010];
char s [500010];

int main(){
    //freopen("fortmoo.in", "r", stdin); freopen("fortmoo.out", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(18);
    cin >> N >> (s+1); dp[0] = dp[1] = dp[2] = 0;
    for(int i = 3; i <= N; i++){
        dp[i] = dp[i-1];
        if(s[i] == '0'){ pre = -1; continue; }
        if(s[i-1] == '0' && s[i-2] == '1'){
            int j = i-2;
            while(j > 0 && s[j] == '1'){ dp[i] = max(dp[i], dp[j-1]+i-j-1); j--; }
            pre = i;
        }
        if(pre != -1) dp[i] = max(dp[i], dp[pre-3]+i-pre+1);
    }
    cout << dp[N] << '\n';
    return 0;
}


Measured memory_bytes: 2688
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long a = sc.nextLong();
		long b = sc.nextLong();
		long n = sc.nextLong();
		long s = 0;
		
		if(n<b-1) {
			s = n;
		}else {
			s = b-1;
		}
		System.out.println((a*s)/b);
	}
	
}


Measured memory_bytes: 27044
import java.io.*;
import java.util.*;
public class Main {        
    public static void main(String args[]) {
        // int t=II();
        // while(--t>=0){
            int x=II();
            if(x>=30)
                System.out.println("Yes");
            else 
                System.out.println("No");

        // }
    }
    
    ////////////////////////////////////
    static scan in=new scan(System.in);
    static int II() {
        return in.nextInt();
    }
    static long IL() {
        return in.nextLong();
    }
    static int[] IIA(int n) {
        int a[]=new int[n];
        for(int i=0;i<n;i++) {
            a[i]=II();
        }
        return a;
    }
    static String IS() {
        return in.next();
    }
    static char IC(){
        return in.next().charAt(0);
    }
    static String[] ISA(int n) {
        String a[]=new String[n];
        for(int i=0;i<n;i++) {
            a[i]=IS();
        }
        return a;
    }
    static char[] ICA(int n) {
        char a[]=new char[n];
        for(int i=0;i<n;i++) {
            a[i]=IC();
        }
        return a;
    }
}
class scan
{
    public static BufferedReader reader;
    public static StringTokenizer token;

    scan(InputStream str)
    {
        reader=new BufferedReader(new InputStreamReader(str));
        token=null;
    }

    static int nextInt()
    {
        while(token==null||!token.hasMoreTokens())
        {
            try { token=new StringTokenizer(reader.readLine());   }
            catch(IOException e){  throw new RuntimeException(e); }
        }
        return Integer.parseInt(token.nextToken());
    }

    static long nextLong()
    {
        while(token==null||!token.hasMoreTokens())
        {
            try { token=new StringTokenizer(reader.readLine());   }
            catch(IOException e){  throw new RuntimeException(e); }
        }
        return Long.parseLong(token.nextToken());
    }

    static String next()
    {
        while(token==null||!token.hasMoreTokens())
        {
            try { token=new StringTokenizer(reader.readLine());   }
            catch(IOException e){  throw new RuntimeException(e); }
        }
        return token.nextToken();
    }

}

Measured memory_bytes: 25344
#include <bits/stdc++.h>
using namespace std;using ll = long long;using ld = long double;using P = pair<ll,ll>;
#define rt "\n"
#define sp " "
#define test1 cout << "test1" << endl;
#define test2 cout << "test2" << endl;
#define fixprecision(n) fixed; cout << setprecision(n)
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL)
#define MOD 1000000007
#define iikae auto&
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, s, N) for(ll i{N - 1}; i > s - 1; i--)
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
struct UnionFind{vector<ll> par;UnionFind(ll n) : par(n, -1){}void init(ll n){par.assign(n, -1);}ll root(ll x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(ll x, ll y){return root(x) == root(y);}bool merge(ll x, ll y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};

int main(){
  kyopro;
  ll N;
  cin >> N;
  ll hardle{};
  ll ans{};
  rep(i, 0, N){
    ll height;
    cin >> height;
    if(hardle <= height){
      ans++;
      hardle = height;
    }
  }
  cout << ans << rt;
}

Measured memory_bytes: 256
import java.util.*;

// ARC 98-D
// https://beta.atcoder.jp/contests/arc098/tasks/arc098_b

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int N = in.nextInt();
		long[] arr = new long[N];
		
		for (int i = 0; i < N; i++) {
			arr[i] = in.nextLong();
		}
		
		long answer = 0;
		long temp = 0;
		int left = 0;
		int right = 0;
		
		while (left < N) {
			if (left == right) {
				temp = arr[right];
				answer++;
				right++;
			} else if (right < N && (temp & arr[right]) == 0) {
				temp += arr[right];
				answer++;
				right++;
			} else {
				temp -= arr[left];
				left++;
				answer += right - left;
			}
		}
		
		System.out.println(answer);
	}
}

Measured memory_bytes: 80816
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  string s; cin >> s;
  int n = si(s);

  int ans = 0;
  rep(i, n/2) {
    if (s[i] == s[n-i-1]) continue;
    if (s[i] == 'x') s.insert(s.begin() + n-i, 'x');
    else if (s[n-i-1] == 'x') s.insert(s.begin() + i, 'x');
    else {
      cout << -1 << endl;
      return (0);
    }
    --i;
    ++ans;
    ++n;
  }

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

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

int D,G;
int P[10], C[10];
int m =1e9;

int main(){
    cin >> D >> G;
    for(int i=0; i<D; i++)
        cin >> P[i] >> C[i];
    bitset<10> bit(0);
    for(int x = 0; x < (1 << D); x++){
        bit = x;
        // cout << bit << endl;
        int sum=0, solve=0;
        for(int i=0; i<D; i++){
            if(bit[i]==1){
                sum += P[i]*100*(i+1) + C[i];
                solve += P[i];
            }
        }
        int i = D-1;
        while(i>=0){
            if(bit[i]==0){
                break;
            }
            i--;
        }
        if(0 > i){
            if(sum >= G) m = min(m, solve);
        }
        else{
            for(int j=0; j<=P[i]-1;j++){
                if(sum+j*100*(i+1) >= G){
                    m = min(m, solve+j);
                }
            }
        }
    }
    cout << m;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int N;
	while(scanf("%d", &N) != EOF){
		vector<int> ans;
		for(int i = 0; i < 10; i++){
			if(N & (1 << i)){
				ans.push_back((1 << i));
			}
		}
		for(int i = 0; i < ans.size(); i++){
			cout << ans[i];
			if(i == ans.size() - 1) cout << endl;
			else cout << " ";
		}
	}
	return 0;
}

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

int main() {

    long long N;
    cin >> N;

    vector<long long> A(N);

    long long right = 0;
    for (long long i = 0; i < N; ++i)
    {
        cin >> A[i];
        right += A[i];
    }
    // sort(A.begin(), A.end());

    long long ans = right;
    long long left  = 0;
    for (long long i = 0; i < N; ++i)
    {
        left  += A[i];
        right -= A[i];

        if((long long)abs(left - right) < ans) {
            ans = (long long)abs(left - right);
        }
    }

    cout << ans << endl;



	return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

signed main()
{
  int a, b;
  cin >> a >> b;

  int ans = 0;
  if (a > b) {
    ans += a;
    --a;
  } else {
    ans += b;
    --b;
  }

  cout << ans + max(a,b) << endl;
  return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#define N 100010
#define int long long
using namespace std;
int num[N];
signed main()
{
	int n,m,v,p;
	scanf("%lld%lld%lld%lld",&n,&m,&v,&p);
	for(int i=1;i<=n;i++) scanf("%d",&num[i]);
	sort(num+1,num+n+1);
	reverse(num+1,num+n+1);
	int sum=0,ans=p;
	for(int i=p+1;i<=n && num[i]+m>=num[p];i++)
	{
		int d=n-(i-p);
		if(v<=d) ++ans;
		else
		{
			int res=(1ll*(v-d)*m-sum-1)/(i-p)+1;
			if(num[p]+res<=num[i]+m) ++ans;
		}
		sum+=num[p]-num[i];
	}
	printf("%lld\n",ans);
	return 0;
}


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int WWW = 0;WWW < (n);WWW++)cerr << v[WWW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;
char mp[55][55];
int n,m,bb,ww;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
void hoge(int h,int w){
	queue<pair<int,int>> q;
	bool isb = false,isw = false;
	q.push(MP(h,w));
	int ret = 0;
	while(!q.empty()){
		auto now = q.front();q.pop();
		if(mp[now.FI][now.SE] == '#')continue;
		mp[now.FI][now.SE] = '#';
		ret++;
		REP(i,4){
			int yy = now.FI + dy[i];
			int xx = now.SE + dx[i];
			if(xx < 0 || yy < 0 || xx >= m|| yy >= n)continue;
			if(mp[yy][xx] == '.')q.push(MP(yy,xx));
			if(mp[yy][xx] == 'B')isb = true;
			if(mp[yy][xx] == 'W')isw = true;
		}
	}
	if((isb & isw) || !(isb | isw))return;
	if(isb)bb += ret;
	else ww += ret;
}
			

int main(){
	while(cin >> m >> n,n|m){
		bb = 0,ww = 0;
		REP(i,n)REP(j,m)cin >> mp[i][j];
		REP(i,n)REP(j,m){
			if(mp[i][j] == '.')hoge(i,j);
		}
		cout << bb << ' ' << ww << endl;
	}
	return 0;
}



Measured memory_bytes: 3028
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

s = lc()

if (("N" in s) and (not "S" in s)) or (("S" in s) and (not "N" in s)):
    print("No")
elif (("W" in s) and (not "E" in s)) or (("E" in s) and (not "W" in s)):
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <climits>
#define endl '\n'
#define ll long long

using namespace std;

// h(x, y) = max(0, H - |x-Cx| - |y-Cy|)
// Cx, Cy, H ?

struct Data{
        int x;
        int y;
        int h;
};
vector<Data> vec;

bool ok(int Cx, int Cy, int H)
{
        for(int i = 0; i < vec.size(); i++)
        {
                auto altitude = max(H - abs(vec[i].x - Cx) - abs(vec[i].y - Cy), 0);
                if(altitude != vec[i].h)
                        return false;
        }
        return true;
}

int main(void)
{
        cin.tie(NULL); ios_base::sync_with_stdio(false);
        int N; cin >> N; int H = 0;
        while(N--)
        {
                int x, y, h; cin >> x >> y >> h;
                vec.push_back(Data{x, y, h});
                H = max(H, h);
        }

        for(int i = 0; i < 101; i++)
        {
                for(int j = 0; j < 101; j++)
                {
                        for(int h = H; h <= H + 200; h++)
                        {
                                if(ok(i, j, h))
                                {
                                        cout << i << " " << j << " " << h << endl;
                                }
                        }
                }
        }



        return 0;
}


Measured memory_bytes: 384
//abc060_a.cpp
//Fri Oct 19 23:35:01 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	string a,b,c;
	cin >> a >> b >> c;

	if (a[a.size()-1] == b[0] && b[b.size()-1] == c[0]){
		cout << "YES" << endl;
	}else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

cnt = [0] * (10**6 + 1)
for i in range(N):
    cnt[A[i]] += 1

flag = True
for i in range(2, 10**6 + 1):
    multiple = 0
    for j in range(i, 10**6 + 1, i):
        multiple += cnt[j]
    if multiple == N:
        print("not coprime")
        exit()
    if multiple >= 2:
        flag = False

print("pairwise coprime" if flag else "setwise coprime")


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

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

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

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        int i = sc.nextInt();
        for (int i1 = 0; i1 < i; i1++) {
            int l = sc.nextInt();
            int r = sc.nextInt();
            if(l == r){
                count++;
                if(count >= 3){
                    System.out.println("Yes");
                    return;
                }
            }else{
                count = 0;
            }
        }
        System.out.println("No");
    }
}


Measured memory_bytes: 35928
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>


// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
  return modpow(a, mod - 2, mod);
}

// nCk @mod を計算する
long long nCk(long long n, long k, long long mod){
  long long retval = 1;
  for (int i=0; i<k; i++){
    retval *= (n-i);
    retval %= mod;
  }
  for (int i=1; i<=k; i++){
    retval *= modinv(i, mod);
    retval %= mod;
  }
  return retval;
}

// nPk @mod を計算する
long long nPk(long long n, long k, long long mod){
  long long retval = 1;
  for (int i=0; i<k; i++){
    retval *= (n-i);
    retval %= mod;
  }
  return retval;
}

int main(){
  int N;
  scanf("%d", &N);
  std::map<int, int > mp;
  long long ans = 0;
  for (int i=1; i<=N; i++){
    for (int j=i; j<=N; j+=i){
      ans += j;
    }
  }
  std::cout << ans << std::endl;
  return 0;
  
}


Measured memory_bytes: 3260
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 1e5
#define INF 1<<30
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;
int main() {
	char a;
	cin >> a;
	if (a == 'A')cout << 'T' << endl;
	else if (a == 'T')cout << 'A' << endl;
	else if (a == 'G')cout << 'C' << endl;
	else cout << 'G' << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int c0 = 0;
    int c1 = 0;
    int len = S.length();
    String NS = S;
    int c = 0;
    for(int i = 0;i < len;i++){
      if(S.charAt(i)=='1'){
        c1++;
      }else{
        c0++;
      }
    }
    c = c1;
    if(c1 > c0)c=c0;
    if(c1==0||c0==0)c=0;
    System.out.println(c*2);
  }
}


Measured memory_bytes: 25172
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(ALL(x)),(x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)
#define debug(x) cerr<<#x<<"="<<(x)<<endl
#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl
#define ri(x) scanf("%d",&x)
#define rl(x) scanf("%lld",&x)
#define rlcfpoj(x) scanf("%I64d",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define plcfpoj(x) printf("%I64d",x)
#define lfd() printf("\n")
#define sp() printf(" ")
#define inrep(x) int x;scanf("%d",&x);while(x--)
#define testbit(mask,i) (((mask)>>(i))&1)
#define setbit(mask,i) ((mask)|(1<<i))
#define delbit(mask,i) ((mask)^(1<<i))
int n;
vector<int> ga[100100];
int u,v;
int d1[100100],d2[100100];
void dfs(int u,int p,int* d){
	d[u]=d[p]+1;
	for(int j=0;j<ga[u].size();j++){
		int v=ga[u][j];
		if(v!=p){
			dfs(v,u,d);
		}
	}
}
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=1;i<n;i++){
		cin>>u>>v;
		ga[u].push_back(v);
		ga[v].push_back(u);
	}
	dfs(1,0,d1);
	dfs(n,0,d2);
	int f=0,s=0;
	for(int i=1;i<=n;i++){
		if(d1[i]<=d2[i])
			f++;
		else
			s++;
	}
	if(s>=f)
		cout<<"Snuke"<<endl;
	else
		cout<<"Fennec"<<endl;
	return 0;
}


Measured memory_bytes: 12800
use std::char;
use std::io::Read;

fn main() {
    let mut buf = String::new();

    std::io::stdin().read_to_string(&mut buf).unwrap();

    let mut iter = buf.split_whitespace();
    let mut a = vec![vec![0; 3]; 3];
    for i in 0..3 {
        for j in 0..3 {
            a[i][j] = iter.next().unwrap().parse().unwrap();
        }
    }
    let n: usize = iter.next().unwrap().parse().unwrap();
    let b: Vec<i32> = (0..n).map(|_| iter.next().unwrap().parse().unwrap()).collect();

    for i in 0..3 {
        for j in 0..3 {
            a[i][j] = if b.contains(&a[i][j]) { 1 } else { 0 };
        }
    }
    let mut ans = false;
    if a[0][0] + a[0][1] + a[0][2] == 3 { ans = true ;}
    if a[1][0] + a[1][1] + a[1][2] == 3 { ans = true ;}
    if a[2][0] + a[2][1] + a[2][2] == 3 { ans = true ;}
    if a[0][0] + a[1][0] + a[2][0] == 3 { ans = true ;}
    if a[0][1] + a[1][1] + a[2][1] == 3 { ans = true ;}
    if a[0][2] + a[1][2] + a[2][2] == 3 { ans = true ;}
    if a[0][0] + a[1][1] + a[2][2] == 3 { ans = true ;}
    if a[2][0] + a[1][1] + a[0][2] == 3 { ans = true ;}
    
    println!("{}", if ans { "Yes" } else { "No "});
}


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

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

	vector<vector<int>> cards( 4, vector<int>( 13 ) );
	for( int i = 0; i < n; ++i ) {
		char ch;
		int rk;
		cin >> ch >> rk;

		switch( ch ) {
		case 'S': cards.at( 0 ).at( rk-1 ) += 1; break;
		case 'H': cards.at( 1 ).at( rk-1 ) += 1; break;
		case 'C': cards.at( 2 ).at( rk-1 ) += 1; break;
		case 'D': cards.at( 3 ).at( rk-1 ) += 1; break;
		}
	}

	vector<char> card_ch { 'S','H','C','D' };
	for( int i = 0; i < 4; ++i ) {
		for( int j = 0; j < 13; ++j ) {
			if( cards.at( i ).at( j ) == 0 ) {
				cout << card_ch.at( i ) << ' ' << (j+1) << endl;
			}
		}
	}
}



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

int main()
{
	int n;
	cin>>n;
	int a[n];
	int c=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<=n;i++)
	{
		if(i%2==1 and a[i]%2==1)
		{
			c++;
		}
	}
	cout<<c<<endl;
}

Measured memory_bytes: 3592
I = input().split()
A = int(I[0])
B = int(I[1])
C = int(I[2])
D = int(I[3])
An = A
Cn = C
while An > 0 or Cn > 0 :
    #print(An)
    #print(Cn)
    Cn = Cn - B 
    #print(Cn)
    if Cn <= 0 :
        ans = 'Yes'
        break
    else:
        An = An - D 
        #print(An)
        if An <= 0 :
            ans = 'No'
            break

print (ans)

Measured memory_bytes: 9200
/*
	Name:
	Author: xiaruize
	Date:
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second
#define sz(a) int((a).size())

inline int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
    return x*f;
}
#define int ll
int f[10000005],ans,n;

signed main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;i*j<=n;j++)
		{
			f[i*j]++;
		}
	}
	for(int i=1;i<=n;i++)
	{
		ans+=i*f[i];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 81788
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int n;

template<typename T>
vector<T> radix_conversion(T x, T b) {
  vector<T> res;
  T t = 1, k = llabs(b);
  while(x) {
    res.emplace_back((x * t) % k);
    if(res.back() < 0) res.back() += k;
    x -= res.back() * t;
    x /= k;
    t *= b/k;
  }
  if(res.empty()) res.emplace_back(0);
  for (int i = res.size(); i < n; ++i) res.emplace_back(0);
  reverse(res.begin(),res.end());
  return res;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  vector<int> A(3);
  cin >> n;
  rep(i,3) cin >> A[i];
  vector<int> L(n);
  rep(i,n) {
    cin >> L[i];
  }
  int maxi = 1;
  rep(i,n) maxi *= 3;
  ll ans = 1LL<<60;
  rep(x, maxi) {
    auto v = radix_conversion(x, 3);
    bool ok = true;
    vector<vector<int> > G(3);// 3グループ
    rep(i,n) {
      G[v[i]].emplace_back(i);
    }

    ll cost = 0; //3グループのコスト最小値の合計
    rep(i,3) {
      int m = G[i].size();
      if (m == 0) {
        ok = false; break;
      }
      ll mincost = 1001001001;
      rep(bit, (1<<m)) {
        if (bit == 0) continue;
        ll MP = (__builtin_popcount(bit)-1) * 10;
        ll lensum = 0;
        rep(j,m) {
          if (bit & (1<<j)) lensum += L[G[i][j]];
        }
        MP += llabs(A[i] - lensum);
        chmin(mincost, MP);
      }
      cost += mincost;
    }
    if (!ok) continue;
    chmin(ans, cost);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __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...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

int main() {
  int len, n, m;
  scanf("%d%d%d", &n, &m, &len);
  if (n < m) swap(n, m);
  int ret = (len + n - 1) / n;
  printf("%d\n", ret);
  return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int mod=1000000007;

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

int N,Q;
int P[111111];

int T[111111];
int cnt[44][111111];
int sum[44][111111];

signed main(){
    cin>>N>>Q;
    rep(i,N)cin>>P[i],P[i]--;

    rep(i,N){
        int v=i;
        while(true){
            v=P[v];
            T[i]++;
            if(v==i)break;
        }
    }

    rep(i,N){
        cnt[T[i]][i+1]++;
    }
    rep(i,N){
        int v=i;
        while(true){
            v=P[v];
            sum[T[i]][v+1]=(sum[T[i]][v+1]+(i+1))%mod;
            if(i==v)break;
        }
    }

    rep(i,40+1)rep(j,N){
        sum[i][j+1]=(sum[i][j+1]+sum[i][j])%mod;
        cnt[i][j+1]+=cnt[i][j];
    }

    while(Q--){
        int l,r;
        cin>>l>>r;
        l--;
        int t=1;
        for(int i=1;i<=40;i++)if(cnt[i][r]-cnt[i][l])t=t/gcd(t,i)*i;
        int ans=0;
        for(int i=1;i<=40;i++){
            ans=(ans+t/i%mod*(sum[i][r]-sum[i][l]+mod))%mod;
        }
        cout<<ans<<endl;
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  int A;
    cin >> A;
    int a = A;
    int j = 0;
    while (true) {
      if (a%2 == 1)
        break;
      else 
        a/=2;
      j++;
    }
  int sum = j;

  for (int i = 0; i<N-1 ; i++) { 
    int j = 0;
    int A;
    cin >> A;
    int a = A;
    while (true) {
      if (a%2 == 1)
        break;
      else 
        a/=2;
      j++;
    }
    if (j < sum) 
      sum = j;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
	int n,m;
    cin >> n >> m;
    bool b[n];
    int c[n];
    for(int i=0;i<n;i++){
      b[i]=false;
      c[i]=0;
    }
    string s;
    int p=0,q=0;
  
    for(int i=0;i<m;i++){
    	cin >> p >> s;
        if(s=="AC"){
        	b[p-1]=true;
        }else{
        	if(!b[p-1]){
            	c[p-1]++;
            }
        }
    }
    p=0;
    for(int i=0;i<n;i++){
    	if(b[i]){
          p++;
          q+=c[i];
        }
    }
    cout << p <<" " << q << endl;
    return 0;
}


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

int levenshtein(string a, string b) {
  int alen = a.length(), blen = b.length();
  int dp[alen+1][blen+1];
  
  for (int i = 0; i <= alen; i++) dp[i][0] = i;
  for (int j = 0; j <= blen; j++) dp[0][j] = j;
  
  int l, m, r;
  for (int i = 1; i <= alen; i++) {
    for (int j = 1; j <= blen; j++) {
      l = dp[i-1][j] + 1;
      r = dp[i][j-1] + 1;
      if (a[i-1] == b[j-1]) {
        m = dp[i-1][j-1];
      } else {
        m = dp[i-1][j-1] + 1;
      }
      dp[i][j] = min(l, min(m, r));
    }
  }
  
  return dp[alen][blen];
}

int main(void){
  string s1, s2;
  cin >> s1;
  cin >> s2;
  
  cout << levenshtein(s1, s2) << endl;
  
  return 0;  
}

Measured memory_bytes: 5104
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
const ll LL_MAX=LLONG_MAX;
template <typename T>
T in(){
    T x;
    cin >> x;
    return x;
}

template <typename T,typename U>
void forin(T* x,U n){
    for (U i=0;i<n;i++) cin >> x[i];
}

template <typename T>
int div1(T x) {
    return x%1000000007;
}

template <typename T>
void out(T x){
    cout << x << endl;
}

main(){
    int k=in<int>(),x=in<int>();
    if (k*500>=x) out("Yes");
    else out("No");
}

Measured memory_bytes: 256
using System;
class A{
static void Main()
{
string[] gh=Console.ReadLine().Split();
string []a=new string[int.Parse(gh[0])];
for(int i=0;i<int.Parse(gh[0]);i++)
{
a[i]=Console.ReadLine();
}
Array.Sort(a);
for(int i=0;i<int.Parse(gh[0]);i++)
{
Console.Write(a[i]);
}Console.WriteLine();
}
}

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

int main(){
    long N;
    long tempP;
    long invP[200002]={};
    long forans=1;
    long tempforans=1;

    cin >> N;
    for(long i = 1; i <= N; i++){
        cin >> tempP;
        invP[tempP] = i;
    }

    for(long i = 1;i < N; i++){
        if(invP[i] < invP[i+1]){
            tempforans++;
        }
        else{
            forans = max(forans,tempforans);
            tempforans = 1;
        }
    }
    forans = max(forans,tempforans);
 
    cout << N - forans << endl;
    
    return 0;
}

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

#define ll long long int
#define MAX 100005
#define MOD 1000000007
#define sz size()
#define ln length()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define pi(n) printf("%d",n)
#define pin(n) printf("%d\n",n);
#define pl(n) printf("%lld",n)
#define pln(n) printf("%lld\n",n);
#define FUCK_YEAH ios_base::sync_with_stdio(false);cin.tie(NULL)
inline ll gcd(ll x,ll y){return x%y==0?y:gcd(y,x%y);}
inline ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
inline ll powmod(ll a,ll b,ll mod) 
{
    ll res=1;
    a%=mod; 
    assert(b>=0); 
    for(;b;b>>=1)
    {
        if(b&1)res=res*a%mod;
        a=a*a%mod;
    }
    return res;
}
inline ll mulmod(ll a, ll b, ll c)
{
    if(!b)return 0;
    ll x = mulmod(a, b/2, c);
    if (b & 1)return (x+x+a)%c;
    return (x+x)%c;
}

ll t[MAX],x[MAX],y[MAX];

int main()
{
    FUCK_YEAH;
    ll q;
    cin >> q;
    ll f = 0;
    for(int i = 0 ; i < q; i++) {
        cin >> t[i] >> x[i] >> y[i];
        if(i == 0) {
            ll s = x[i] + y[i];
            ll tt = t[i];
            if(tt >= s && tt%2 == s%2); //Good
            else {
                f = 1;
            }
        }
        else {
            ll s = abs(x[i]-x[i-1]) + abs(y[i] - y[i-1]);
            ll tt = t[i] - t[i-1];
            if(tt >= s && tt%2 == s%2); //Good
            else {
                f = 1;
            }
        }
    }
    if(!f) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 2560
# -*- coding: utf-8 -*-
n,m = list(map(int,input().split()))
min_id = 1
max_id = n
for _ in range(m):
    l,r=list(map(int,input().split()))
    if l > min_id:
        min_id = l
    if r < max_id:
        max_id = r
print(max(max_id-min_id+1,0))


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 a, b;

i64 gcd(i64 x, i64 y) {
  return x % y == 0 ? y : gcd(y, x % y);
}

int main() {
  cin >> a >> b;
  
  i64 x = gcd(a, b);
  i64 ans = 1; // 1
  for (i64 i = 2; i <= min(x, i64(1000001)); ++i) {
    if (x % i == 0) {
      while (x % i == 0) x /= i;
      ans++;
    }
  }
  if (x > 1) ++ans;
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while(true) {
		int n = stdIn.nextInt();
		if(n == 0) {
			break;
		}
		for(int i = 0; i < n; i++) {
			int x1 = stdIn.nextInt();
			int y1 = stdIn.nextInt();
			int z1 = stdIn.nextInt();
			int w1 = stdIn.nextInt();
			int x2 = stdIn.nextInt();
			int y2 = stdIn.nextInt();
			int z2 = stdIn.nextInt();
			int w2 = stdIn.nextInt();
			
			int x3 = x1*x2 + y1*y2*-1 + z1*z2*-1 + w1*w2*-1;
			int y3 = x1*y2 + y1*x2 + z1*w2 + w1*z2*-1;
			int z3 = x1*z2 + y1*w2*-1 + z1*x2 + w1*y2;
			int w3 = x1*w2 + y1*z2 + z1*y2*-1 + w1*x2;
			System.out.println(x3 + " " + y3 + " " + z3 + " " + w3);
		}
		}
			
	}
}

Measured memory_bytes: 23652
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
#define DEF_ELM_MAX 20001
char pStr[DEF_ELM_MAX];
 
typedef struct _PAIR {
    int indx;
    int diff;
} PAIR;
 
int S1[DEF_ELM_MAX];
PAIR S2[DEF_ELM_MAX];
 
int s1_top = 0;
 
int s1_pop()
{
    return S1[--s1_top];
}
 
void s1_push(int x)
{
    S1[s1_top++] = x;
}
 
int s2_top = 0;
 
PAIR s2_Top()
{
    return S2[s2_top-1];
}
 
PAIR s2_pop()
{
    return S2[--s2_top];
}
 
void s2_push(int indx, int diff)
{
    PAIR x;
    x.indx = indx;
    x.diff = diff;
 
    S2[s2_top++] = x;
}
 
/////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
int main(void)
{
    int j;
    int i;
    int sum;
    int a;
    char c;
 
//
    scanf("%s", pStr);
 
    sum = 0;
    i = 0;
    while ( (c = pStr[i]) != 0 ) {
        if ( c == '\\' ) {
            s1_push(i);
        } else if ( s1_top > 0 && c == '/') {
            j = s1_pop();
            a = i - j;
            sum += a;
            while ( s2_top > 0 && s2_Top().indx > j) {
                a += s2_pop().diff;
            }
            s2_push(j, a);
        }
        i++;
    }
 
    printf("%d\n", sum);
    printf("%d", s2_top);
    for ( i = 0 ; i < s2_top; i++ ) {
        printf(" ");
        printf("%d", S2[i].diff);   
    }
    printf("\n");   
 
    return 0;
}

Measured memory_bytes: 1872
n=int(input())
p=[]

for i in range(n):
    p.append(int(input()))

a=max(p)
q=0
c=0
for i in range(0,len(p)):
    if p[i]==a and c==0 :
        q=q+p[i]/2
        c+=1
    else:
        q=q+p[i]
print(int(q))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;

int		main(void)
{
	int N;
	cin >> N;
	vector<ll> march(5);
	for (int i = 0; i < N; i++)
	{
		string S;
		cin >> S;
		if (S[0] == 'M')
			march[0]++;
		else if (S[0] == 'A')
			march[1]++;
		else if (S[0] == 'R')
			march[2]++;
		else if (S[0] == 'C')
			march[3]++;
		else if (S[0] == 'H')
			march[4]++;
	}
	ll sum = 0;
	for (int i = 0; i < 3; i++)
	{
		for (int j = i+1; j < 4; j++)
		{
			for (int k = j+1; k < 5; k++)
			{
				sum += march[i] * march[j] * march[k];
			}
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 256
import math
import bisect
import collections
import itertools
import heapq
import string
import sys
sys.setrecursionlimit(10**9)
def gcd(a,b):return math.gcd #最大公約数
def lcm(a,b):return (a*b) // math.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i: divisors.append(n//i)
    return divisors
def is_prime(n):
    if n == 1: return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0: return False 
    return True
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n + 1, i): is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
def sieve_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()
P = iln()
Q = iln()

PS = sorted(list(perm(P,N)))

p = 0
q = 0
for i in range(len(PS)):
    if P == list(PS[i]):
        p = i
    if Q == list(PS[i]):
        q = i
print(abs(p-q))


Measured memory_bytes: 9016
#include<iostream>
using namespace std;
char c[110][110];
int h,w;
int main(){
	cin>>h>>w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++)cin>>c[i][j];
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++)cout<<c[i][j];cout<<endl;
		for(int j=0;j<w;j++)cout<<c[i][j];cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

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

b = [a[0]]
for i in range(1,n):
    b.append(b[-1]+a[i])


b.sort()


res = 0
cnt = 1
for i in range(1,n):
    if b[i] == b[i-1]:
        cnt += 1
    else:
        res += (cnt-1)*cnt//2
        cnt = 1
for i in range(n):
    if b[i] == 0:
        res += 1
res += (cnt-1)*cnt//2
print(res)

Measured memory_bytes: 25812
N, Q = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(lambda x:int(x)-1, input().split())
    G[a].append(b)
    G[b].append(a)

points = [0] * N 
for _ in range(Q):
    p, x = map(int, input().split())
    points[p-1] += x

from collections import deque
st = deque([[0, points[0]]])
result = ['0'] * N
visited = [0] * N
visited[0] = 1
while st:
    idx, count = st.pop()
    result[idx] = str(count)
    for ni in G[idx]:
        if visited[ni] != 1:
            visited[ni] = 1
            st.append([ni, count+points[ni]])

print(" ".join(result))

Measured memory_bytes: 73648
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
    double l; cin >> l;
    double ll = l/3;
    cout << fixed << setprecision(10) << ll*ll*ll << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, b, n) for (int i = b; i <= n; ++i)

using namespace std;
using ll = long long;
using P = pair<int, int>;

void solve(vector<ll> x) {
  REP(i, 5)
    if (x[i] != i + 1) {
      cout << i + 1<< endl;
      return;
    }
}

int main(){
  // int 3E4  long 2E9  ll 9E18
  cin.tie(0);
  ios::sync_with_stdio(false);

  vector<ll> x(5);
  REP(i, 5) {
    cin >> x[i];
  }

  solve(move(x));

  return 0;
}


Measured memory_bytes: 3652