akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fori(n) for ( int i = 0; i < (n);i++)
#define forj(n) for ( int j = 0; j < (n);j++)
#define fork(n) for ( int k = 0; k < (n);k++)
#define forghj(n) for ( int ghj = 0; ghj < (n);ghj++)
#define fori1(n) for ( int i = (n)-1; i >= 0;i--)
#define all(vector) (vector).begin(),(vector).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define INF 1e9+7
/*
────────▄──────────────▄
────────▌▒█───────────▄▀▒▌
────────▌▒▒▀▄───────▄▀▒▒▒▐
───────▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐
─────▄▄▀▒▒▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐
───▄▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▀██▀▒▌
──▐▒▒▒▄▄▄▒▒▒▒▒▒▒▒▒▒▒▒▒▀▄▒▒▌
──▌▒▒▐▄█▀▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐
─▐▒▒▒▒▒▒▒▒▒▒▒▌██▀▒▒▒▒▒▒▒▒▀▄▌
─▌▒▀▄██▄▒▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▌
_▌▀▐▄█▄█▌▄▒▀▒▒▒▒▒▒░░░░░░▒▒▒▐
▐▒▀▐▀▐▀▒▒▄▄▒▄▒▒▒▒▒░░░░░░▒▒▒▒▌
▐▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒░░░░░░▒▒▒▐
─▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒▒▒░░░░▒▒▒▒▌
─▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▐
──▀▄▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▄▒▒▒▒▌
────▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀
───▐▀▒▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀
──▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▀▀
*/
int main() {
    ios::sync_with_stdio(false);
    int n,m,q;
    cin >> n >> m >> q;
    vector < pair < int, pair < int, int > > > tr;
    tr.resize(m);
    vector < vector < int > > kek;
    kek.resize(n);
    fori(n) kek[i].resize(n);
    fori(m) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        kek[x][y]++;
        tr[i].ss.ff = x;
        tr[i].ss.ss = y;
        tr[i].ff = y - x;
    }
    sort(all(tr));
    vector < vector < int > > a;
    a.resize(n);
    fori(n) a[i].resize(n);
    int kol = 0;
    for (int d = 0; d < n;d++) {
        for (int l = 0; l + d < n; l++) {
            int r = l + d;
            for (int k = l; k <= r; k++) {
                a[l][r] += kek[l][k];
                a[l][r] += kek[k][r];
            }
            a[l][r] -= kek[l][r];
            if (d < 2) continue;
            a[l][r] += a[l + 1][r - 1];
        }
    }

    fori(q) {
        int x,y;
        cin >> x >> y;
        x--; y--;
        cout << a[x][y] << "\n";
    }
}


Measured memory_bytes: 5248
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] array = new long[n];
		for (int i = 0; i < array.length; i++) {
			array[i] = sc.nextLong();
		}
		Sort st = new Sort();
		st.shellSort(array);
	}
}

class Sort {
	int count;
	
	public Sort() {
		count = 0;
	}
	
	public int insertionSort(long[] array, int g) {
		long v;
		int j;
		for (int i = g; i < array.length; i++) {
			v = array[i];
			j = i - g;
			while (j >= 0 && array[j] > v) {
				array[j + g] = array[j];
				j -= g;
				count++;
			}
			array[j + g] = v;
		}
		return count;
	}
	
	public void shellSort(long[] array) {
		count = 0;
		int[] g = new int[100];
		g[0] = (int) Math.pow((int) Math.sqrt(array.length), 2);
		int m = g.length / 2 + 1;
		for (int i = 1; i < g.length; i++) {
			g[i] = g[i - 1] / 2;
			if (g[i] <= 0 && g[i - 1] > 0) {
				g[i] = 1;
				break;
			}
		}
		System.out.println(g.length);
		for (int i = 0; i < g.length - 1; i++) {
			System.out.print(g[i] + " ");
		}
		
		System.out.println(g[g.length - 1]);
		for (int i = 0; i < m; i++) {
			if (g[i] == 0) {
				break;
			}
			insertionSort(array, g[i]);
		}
		System.out.println(insertionSort(array, 0));
		output(array);
	}
	
	public void output(long[] array) {
		for (int i = 0; i < array.length; i++) {
			System.out.println(array[i]);
		}
	}
}



Measured memory_bytes: 299364
n,d=[int(x) for x in input().split()]
x=[list(map(int,input().split())) for i in range(n)]
answer = 0
for i in range(n):
  for j in range(i+1,n):
    v = 0
    for k in range(d):
    	v += (x[i][k]-x[j][k])**2
    	t = 1
    while t**2<=v:
      	if t**2 == v:
        	answer += 1
        	break
      	t += 1
print(answer)


Measured memory_bytes: 3060
#include<stdio.h>
#include<iostream>
#include<set>

#define MAX_N 10005
#define MAX_Q 505

using namespace std;

set<int> arr;
set<int> dict;

int main()
{
    int N, Q;
    scanf("%d", &N);
    for(int i=0; i<N; i++){
        int data;
        scanf("%d", &data);
        arr.insert(data);
    }
    scanf("%d", &Q);
    for(int i=0; i<Q; i++){
        int data;
        scanf("%d", &data);
        dict.insert(data);
    }
    int cnt=0;
    for(set<int>::iterator it=arr.begin(); it!=arr.end(); it++){
        if(dict.find((*it))!=dict.end())
            cnt++;
    }
    printf("%d\n", cnt);
    return 0;
}



Measured memory_bytes: 3244
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

ll solve(vector<ll> &coeff, vector<ll> &a) {
	sort(begin(coeff), end(coeff));
	ll res = 0;
	for (int i = 0; i < a.size(); i++) {
		res += coeff[i] * a[i];
	}

	return res;
}

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

	ll n;
	cin >> n;

	vector<ll> a(n);
	for (auto &v : a) {
		cin >> v;
	}

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

	vector<ll> highCoeff(n);
	for (int i = 0; i < n - 1; i++) {
		if (i & 1) {
			highCoeff[i]--;
			highCoeff[i + 1]++;
		} else {
			highCoeff[i]++;
			highCoeff[i + 1]--;
		}
	}

	vector<ll> lowCoeff = highCoeff;
	transform(begin(lowCoeff), end(lowCoeff), begin(lowCoeff), [](ll v) {
		return -v;
	});

	ll ans = max(solve(highCoeff, a), solve(lowCoeff, a));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2560
using System;
using System.Linq;

class D
{
	static int[] Read() => Console.ReadLine().Split().Select(int.Parse).ToArray();
	static void Main()
	{
		var h = Read();
		int n = h[0], m = h[1];
		var a = Read().Distinct().Select(x => x / 2).ToArray();

		long lcm = a[0];
		for (int i = 1; i < a.Length; i++)
		{
			lcm = Lcm(lcm, a[i]);
			if (lcm > m) { Console.WriteLine(0); return; }
		}

		if (a.Any(x => lcm / x % 2 == 0)) { Console.WriteLine(0); return; }
		Console.WriteLine((int)((m / lcm + 1) / 2));
	}

	static long Gcd(long x, long y) { for (long r; (r = x % y) > 0; x = y, y = r) ; return y; }
	static long Lcm(long x, long y) => x / Gcd(x, y) * y;
}


Measured memory_bytes: 24412
/*program by mangoyang*/
#include<queue>
#include<cmath>
#include<cstdio>
#include<ctype.h>
#include<cstring>
#include<iostream>
#include<algorithm>
#define INF (0x7f7f7f7f)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
#define N (200005)
#define Pow (21)
typedef long long ll;
using namespace std;
template <class T>
inline void read(T &x){
	int f = 0, ch = 0; x = 0;
	for(; !isdigit(ch); ch = getchar()) if(ch == '-') f = 1;
	for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
	if(f) x = -x;
}
int a[N], f[N][Pow + 1], n;
struct Point{int l, r, p1, p2;};
inline bool operator < (Point A, Point B){ return a[A.p1] > a[B.p1]; }
priority_queue<Point> q;
inline int rmq(int l, int r){
	int d = (int) log2(r - l + 1);
	//printf("%d %d %d\n", l, r - (1 << d) + 1, d);
	return a[f[l][d]] < a[f[r-(1<<d)+1][d]] ? f[l][d] : f[r-(1<<d)+1][d];
}
int main(){
	read(n);
	for(int i = 1; i <= n; i++) read(a[i]);
	for(int i = 1; i <= n; i++) f[i][0] = f[i][1] = i;
	for(int j = 2; j <= Pow; j++)
		for(int i = 1; i <= n; i++){
			if(i + (1 << j) - 1 > n + 1) continue;
			if(a[f[i][j-1]] < a[f[i+(1<<j-1)][j-1]]) 
				f[i][j] = f[i][j-1]; else f[i][j] = f[i+(1<<j-1)][j-1];
			//printf("%d %d %d\n", i, j, f[i][j]);
		}

	int pos = rmq(1, n);
	q.push((Point){1, n, pos, rmq(pos + 1, n + 1)});
	while(!q.empty()){
		Point now = q.top(); q.pop();
		int l = now.l, r = now.r, p1 = now.p1, p2 = now.p2, pos = 0;
		//printf("%d %d %d %d\n", l, r, a[p1], a[p2]);
		printf("%d %d ", a[p1], a[p2]);
		if(p2 < r - 1) pos = rmq(p2 + 1, r), q.push((Point){p2 + 1, r, pos, rmq(pos + 1, r + 1)});
		if(l < p1 - 1) pos = rmq(l, p1 - 1), q.push((Point){l, p1 - 1, pos, rmq(pos + 1, p1)});
		if(p1 + 1 < p2 - 1) pos = rmq(p1 + 1, p2 - 1), q.push((Point){p1 + 1, p2 - 1, pos, rmq(pos + 1, p2)});
	}
	return 0;
}


Measured memory_bytes: 20212
//بسم الله الرحمن الرحيم
///   ***   ---   |||		 In the name of ALLAH		|||   ---   ***   ///
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define el << endl
#define PI 3.141592653589793238
#define _test_ int t; cin >> t; while(t--)
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define file() freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)
ll gcd ( ll  a, ll b ) { return __gcd ( a, b ); }
ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }
int dx[]={0,0,+1,-1,+1,-1,-1,+1};
int dy[]={+1,-1,0,0,+1,-1,+1,-1};
///*......................*//* LET'S BEGIN (-_^) *//*............................///
const int mx= 2e6+123;

void _case_()
{
    int d,s,t;
    cin >> d >> t >> s;
    d<=s*t ? cout << "Yes\n" : cout << "No\n";

}

int main()
{

    optimize();
    //_test_
     _case_();
    return 0;

}

///////////*  N A Y E M  *///////////

Measured memory_bytes: 3616
#include "bits/stdc++.h"
using namespace std;
int a, b, n;
int total(int i){
    int memo = 0;
    for(int j = 0; j < 5; j++){
        memo += i % 10;
        i /= 10;
    }
    return memo;
}
void solve(){
    cin >> n >> a >> b;
    int ans = 0;
    for(int i = 0; i < n; i++){
     if(total(i + 1) >= a && total(i + 1) <= b){
         ans += i + 1;
     }   
    }
    cout << ans << endl;
}
int main(){
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define tez ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int gcd(long long int a,long long int b)
{
    int x=min(a,b);
    int y=max(a,b);
    if(x==0)
    return y;
    else
    return gcd(y%x,x);
    
}
int main()
{
    tez;
    long long int a,b;
    cin>>a>>b;
    if(a==b)return 0;
    cout<<((a*b)/gcd(a,b));
}


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

using namespace std;

int main(){
    int h, w;
    cin >> h >> w;
    char grid[105][105];
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> grid[i][j];
        }
    }
    
    for(int i = 0; i < h; i++){
        bool flag = true;
        int st;
        for(int j = 0; j < w; j++){
            if(grid[i][j] != '.'){
                flag = false;
            }
            if(flag == true && j == w - 1){
                st = i;
            }
        }
        if(flag){
            for(int k = st; k < h-1; k++){
                for(int i = 0; i < w; i++){
                    grid[k][i] = grid[k+1][i];
                }
            }
            h = h - 1;
            i--;
        }
    }

    for(int i = 0; i < w; i++){
        bool flag = true;
        int st;
        for(int j = 0; j < h; j++){
            if(grid[j][i] != '.'){
                flag = false;
            }
            if(flag == true && j == h - 1){
                st = i;
            }
        }
        if(flag){
            for(int k = st; k < w-1; k++){
                for(int i = 0; i < h; i++){
                    grid[i][k] = grid[i][k+1];
                }
            }
            w = w - 1;
            i--;
        }
    }

    //print
    for(int i = 0 ; i < h; i++){
        for(int j = 0; j < w; j++){
            cout << grid[i][j];
        }
        cout << endl;
    }

}

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

int main() {
  string S; cin >> S;
  int n = 0;
  n = S.size();
  
  if(S.at(n - 1) == 's') {
    cout << S + "es" << endl;
  }else{
    cout << S + 's' << endl;
  }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(f) (f).begin(),(f).end()
#define allr(f) (f).rbegin(),(f).rend()
const int mod = 1e9+7, A = 1e2+5;
using namespace std;

int main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n, cnt = 0;
	string s;
	cin >> n >> s;
	for (int i = 0; i < n-2; i++)
	{
		if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C')
			cnt++;
	}
	cout << cnt;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
	int n,sum=0,a;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		sum=sum+i;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*; 
import java.util.*;
import java.util.regex.*;

/*
			  br = new BufferedReader(new FileReader("input.txt"));
			  pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
			  br = new BufferedReader(new InputStreamReader(System.in));
			  pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 */

public class Main {
	private static BufferedReader br;
	private static StringTokenizer st;
	private static PrintWriter pw;

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		//int qq = 1;
		int qq = Integer.MAX_VALUE;
		//int qq = readInt();
		for(int casenum = 1; casenum <= qq; casenum++) {
			int n = readInt();
			int m = readInt();
			char[][] big = load(n);
			char[][] small = load(m);
			boolean can = false;
			for(int a = 0; a <= n-m; a++) {
				for(int b = 0; b <= n-m; b++) {
					int match = 0;
					for(int i = 0; i < m; i++) {
						for(int j = 0; j < m; j++) {
							if(big[a+i][b+j] == small[i][j]) {
								match++;
							}
						}
					}
					can |= match == m*m;
				}
			}
			pw.println(can ? "Yes" : "No");
		}
		exitImmediately();
	}

	public static char[][] load(int s) throws IOException {
		char[][] r = new char[s][s];
		for(int i = 0; i < s; i++) {
			String ss = readToken();
			for(int j = 0; j < s; j++) {
				r[i][j] = ss.charAt(j);
			}
		}
		return r;
	}
	
	private static void exitImmediately() {
		pw.close();
		System.exit(0);
	}

	private static long readLong() throws IOException {
		return Long.parseLong(readToken());
	}

	private static double readDouble() throws IOException {
		return Double.parseDouble(readToken());
	}

	private static int readInt() throws IOException {
		return Integer.parseInt(readToken());
	}

	private static String readLine() throws IOException  {
		String s = br.readLine();
		if(s == null) {
			exitImmediately();
		}
		st = null;
		return s;
	}

	private static String readToken() throws IOException  {
		while(st == null || !st.hasMoreTokens())  {
			st = new StringTokenizer(readLine().trim());
		}
		return st.nextToken();
	}
}

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

#define rep(i,n) for(int i=0; i<n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1e9)

int n;
bool S[100010]={},go,ok1=false,ok2=false;
bool start[4][2]={{1,0},{1,1},{0,0},{0,1}};
string s;
int main(){
  cin >> n >> s;
  rep(i,4){
    //初期設定
    S[0] = start[i][0];
    S[1] = start[i][1];

    for(int j=1; j<=n-2; j++){
      if(s[j]=='o'){
        if(S[j]&&S[j-1])S[j+1]=1;
        if(S[j]&&!S[j-1])S[j+1]=0;
        if(!S[j]&&S[j-1])S[j+1]=0;
        if(!S[j]&&!S[j-1])S[j+1]=1;
      }
      if(s[j]=='x'){
        if(S[j]&&S[j-1])S[j+1]=0;
        if(S[j]&&!S[j-1])S[j+1]=1;
        if(!S[j]&&S[j-1])S[j+1]=1;
        if(!S[j]&&!S[j-1])S[j+1]=0;
      }
    }

    //矛盾しないかどうか判定
    if(s[n-1]=='o'){
      if((S[n-1]==1&&S[0]==S[n-2])||(S[n-1]==0&&S[0]!=S[n-2])){
        ok1 = 1;
      }
    }else{
      if((S[n-1]==1&&S[0]!=S[n-2])||(S[n-1]==0&&S[0]==S[n-2])){
        ok1 = 1;
      }
    }
    if(s[0]=='o'){
      if((S[0]==1&&S[1]==S[n-1])||(S[0]==0&&S[1]!=S[n-1])){
        ok2 = 1;
      }
    }else{
      if((S[0]==1&&S[1]!=S[n-1])||(S[0]==0&&S[1]==S[n-1])){
        ok2 = 1;
      }
    }
    if(ok1&&ok2)break;
    ok1=false;
    ok2=false;
    rep(i,n){
      S[i]=0;
    }
  }
  if(ok1&&ok2){
    rep(i,n){
      if(S[i])cout << "S";
      else cout << "W";
    }
    cout << endl;
  }else{
    cout << -1 << endl;
  }
}

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

using namespace std;

using int64 = long long;

template< typename Monoid, typename OperatorMonoid = Monoid >
struct LazySegmentTree
{
  using F = function< Monoid(Monoid, Monoid) >;
  using G = function< Monoid(Monoid, OperatorMonoid) >;
  using H = function< OperatorMonoid(OperatorMonoid, OperatorMonoid) >;
  using P = function< OperatorMonoid(OperatorMonoid, int) >;

  int sz;
  vector< Monoid > seg, lazy;
  const F f;
  const G g;
  const H h;
  const P p;
  const Monoid M1;
  const OperatorMonoid OM0;


  LazySegmentTree(int n, const F f, const G g, const H h, const P p, const Monoid &M1, const OperatorMonoid OM0)
      : f(f), g(g), h(h), p(p), M1(M1), OM0(OM0)
  {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
    lazy.assign(2 * sz, OM0);
  }

  void set(int k, const Monoid &x)
  {
    seg[k + sz] = x;
  }

  void build()
  {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  void propagate(int k, int len)
  {
    if(lazy[k] != OM0) {
      if(k < sz) {
        lazy[2 * k + 0] = h(lazy[2 * k + 0], lazy[k]);
        lazy[2 * k + 1] = h(lazy[2 * k + 1], lazy[k]);
      }
      seg[k] = g(seg[k], p(lazy[k], len));
      lazy[k] = OM0;
    }
  }

  Monoid update(int a, int b, const OperatorMonoid &x, int k, int l, int r)
  {
    propagate(k, r - l);
    if(r <= a || b <= l) {
      return seg[k];
    } else if(a <= l && r <= b) {
      lazy[k] = h(lazy[k], x);
      propagate(k, r - l);
      return seg[k];
    } else {
      return seg[k] = f(update(a, b, x, 2 * k + 0, l, (l + r) >> 1),
                        update(a, b, x, 2 * k + 1, (l + r) >> 1, r));
    }
  }

  Monoid update(int a, int b, const OperatorMonoid &x)
  {
    return update(a, b, x, 1, 0, sz);
  }


  Monoid query(int a, int b, int k, int l, int r)
  {
    propagate(k, r - l);
    if(r <= a || b <= l) {
      return M1;
    } else if(a <= l && r <= b) {
      return seg[k];
    } else {
      return f(query(a, b, 2 * k + 0, l, (l + r) >> 1),
               query(a, b, 2 * k + 1, (l + r) >> 1, r));
    }
  }

  Monoid query(int a, int b)
  {
    return query(a, b, 1, 0, sz);
  }

  Monoid operator[](const int &k)
  {
    return query(k, k + 1);
  }
};


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

  auto f = [&](int64 a, int64 b) { return a + b; };
  auto p = [&](int64 a, int b) { return a * b; };
  LazySegmentTree< int64 > seg(N, f, f, f, p, 0, 0);

  while(Q--) {
    int T, X;
    scanf("%d %d", &T, &X);
    if(T == 0) {
      int Y, Z;
      scanf("%d %d", &Y, &Z);
      seg.update(X - 1, Y, Z);
    } else {
      printf("%lld\n", seg[X - 1]);
    }
  }
}



Measured memory_bytes: 7072
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		int A, B, C;

		A = scan.nextInt();
		B = scan.nextInt();
		C = scan.nextInt();

		if (A + B >= C) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


Measured memory_bytes: 26812
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>

#define pb push_back
#define mp make_pair

using namespace std;

template<typename T>inline void upmin(T &x,T y) { y<x?x=y:0; }
template<typename T>inline void upmax(T &x,T y) { x<y?x=y:0; }

typedef unsigned int u32;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod pi=acos(-1);
const int oo=1<<30;
const LL OO=1e18;

int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
int a[10010],b[10010];
int main()
{
	int n=gi();LL A=0,B=0;
	for (int i=0;i<n;i++) a[i]=gi();
	for (int i=0;i<n;i++) b[i]=gi();
	for (int i=0;i<n;i++)
		if (a[i]<=b[i])
			A+=(b[i]-a[i])/2;
		else
			B+=a[i]-b[i];
	puts(A>=B?"Yes":"No");
	return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double n = sc.nextDouble();
		int k = sc.nextInt();
		
		double sum = Math.max(n - k + 1, 0);
		for (int i = 1; i <= n && i < k; i++) {
			int score = i;
			double cnt = 0;
			while (score < k) {
				score *= 2;
				cnt++;
			}
			sum += 1.0 / Math.pow(2, cnt);
		}
		
		double ans = sum / n;
		System.out.printf("%.10f\n", ans);

	}
}


Measured memory_bytes: 22612
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

using namespace std;

int main() {
	int a;
	int b;
	cin >> a;
	cin >> b;
	int ret = b + (b - a);
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
ll L;

int main()
{
    cin >> L;
    ll LLL = L * L * L;
    long double lll = LLL;
    long double b = 27.0;
    cout << fixed;
    cout << setprecision(30) << lll / b << endl;
}


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

using namespace std;

vector<pair<int, int> > E[200005];
vector<pair<int, int> > EE[200005];

int x[100005];
int visit[100005];
int L[200005];
int R[200005];
int D[200005];

void dfs(int pos,int value){

	if(visit[pos]==1){return;}

	visit[pos]=1;
	x[pos]=value;

	int i;

	for(i=0;i<E[pos].size();i++){
		dfs(E[pos][i].first,value+E[pos][i].second);
	}
	for(i=0;i<EE[pos].size();i++){
		dfs(EE[pos][i].first,value+EE[pos][i].second);
	}

}

int main() {

	int N,M;

	scanf("%d %d",&N,&M);

	int i;

	for(i=0;i<M;i++){
		scanf("%d %d %d",&L[i],&R[i],&D[i]);
		E[L[i]].push_back(make_pair(R[i],D[i]));
		EE[R[i]].push_back(make_pair(L[i],-D[i]));
	}
	for(i=0;i<M;i++){
		dfs(L[i],0);
	}
	for(i=0;i<M;i++){
		if(x[R[i]]-x[L[i]]!=D[i]){
			printf("No\n");
			return 0;
		}
	}

	printf("Yes\n");

	return 0;
}

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


ll powoften(int i){
  ll vol = 1;
  REP(j,i){
    vol *= 5;
  }
  return vol;
}

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


  ll ans = 0;

  if (N%2 == 1) {
    cout <<  ans << endl;
    return 0;
  }

  N /= 2;


  REP(i,25){
    ans += N / powoften(i);
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;

ll valid_month(ll n) {
	if(n <= 12 && n > 0) return 1;
	return 0;
}

int main() {
	
	cin.tie(0); cout.tie(0);
	string t; cin >> t;
	ll s[4];
	s[0] = t[0] - '0';
	s[1] = t[1] - '0';
	s[2] = t[2] - '0';
	s[3] = t[3] - '0';
	bool f1 = false, f2 = false;
	ll a = 0, b = 0;
	a = s[1] + (10 * s[0]);
	b = s[3] + (10 * s[2]);
	if(valid_month(a) && valid_month(b)) {
		cout << "AMBIGUOUS";
		return 0;
	}
	else if(valid_month(a)) {
		cout << "MMYY";
		return 0;
	}
	else if(valid_month(b)) {
		cout << "YYMM";
		return 0;
	}
	else {
		cout << "NA";
	}
 	return 0;                         
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
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; }

int main()
{
    int n, k; cin >> n >> k;
    vector<bool> a(n, false);
    rep(i, k){
        int d; cin >> d;
        rep(j, d) {
            int e; cin >> e;
            a[e-1] = true;
        }
    }
    int ans = 0;
    rep(i, n) if(a[i]==false) ans++;
    pr(ans);
    return 0;}

Measured memory_bytes: 3572
N = gets.to_i
A = gets.split.map(&:to_i)
#buka_count = ['0']
buka_count = Array.new(N+1,0)

A.each { |buka|
  buka_count[buka] += 1
}
buka_count.drop(1).each { |buka,idx| p buka>0 ? buka : 0 }



Measured memory_bytes: 42512
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

ll mpow(ll a, ll b){
	if(b==0){
		return a;
	}else if(b%2==0){
		ll memo = mpow(a,b/2);
		return memo*memo%MOD;
	}else{
		return mpow(a,b-1) * a % MOD;
	}
}

ll gcd(ll a, ll b){
	if(b==0){
		return a;
	}else{
		return gcd(b, a%b);
	}
}

int main(void){
	int n,d;
	vector<int> D;
	cin>>n;
	rep(i,n){
		cin>>d;
		D.push_back(d);
	}
	sort(all(D));
	cout<<D[n/2]-D[n/2-1]<<endl;
	return 0;
}


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

int main(){
    string A,B,C;
    cin>>A>>B>>C;

    if(A.back()==B.front()&&B.back()==C.front())
        cout<<"YES"<<"\n";
    else cout<<"NO"<<"\n";    
    
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int i,N,x,cnt1=0,cnt4=0;
	
	cin>>N;
	for(i=1;i<=N;i++)
	{
		cin>>x;
		if(x&1)cnt1++;
		if(!(x&3))cnt4++;
	}
	if(cnt4<cnt1-1)cout<<"No";
	else
	{
		if(cnt4==cnt1-1)
		{
			if(N-cnt4-cnt1)cout<<"No";
			else cout<<"Yes";
		}
		else cout<<"Yes";
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(a == b && b == c)
    cout << 1 << endl;
  else if(a != b && b != c && c != a)
    cout << 3 << endl;
  else
    cout << 2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  fspcnt = 0;
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}*/


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int64_t a,b,k;
  cin >> a >> b >> k;
  rep(i,k){
    if(i % 2 == 0){
      if(a % 2 == 1){
        a--;
      }
      b = b + a/2;
      a = a/2;
      
    }else{
      if(b % 2 == 1){
        b--;
      }
      a = a + b/2;
      b = b/2;
      
    }
  }
  printf("%d %d\n",a,b);
      
    
  
}

Measured memory_bytes: 256
def solve(string):
    a, b = map(int, string.split())
    if b == 0:
        return "0"
    bin_a = "{:040b}".format(a)
    bin_b = "{:040b}".format(b)
    aa = [-1 if _a == "0" else int(bin_a[i + 1:] or "0", 2) for i, _a in enumerate(bin_a)]
    bb = [-1 if _b == "0" else int(bin_b[i + 1:] or "0", 2) for i, _b in enumerate(bin_b)]
    ans = [str((bb[i] + 1 + max(0, aa[i])) % 2) for i in range(bin_b.index("1"), 40)]
    ans[-1] = str((b - a) // 2 % 2) if a % 2 == b % 2 == 0 else str(((b - a) // 2 + 1) % 2)
    return str(int("".join(ans), 2))


if __name__ == '__main__':
    print(solve(input()))


Measured memory_bytes: 3064
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#define NUM 100
using namespace std;

bool cmp_int(int a, int b){
    return a > b;
}

bool cmp_pair(pair<int, int> a, pair<int, int> b){
    return a.second > b.second;
}

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

    vector<int> A(n);
    for(int i = 0; i < n; i++){
        scanf("%d", &A[i]);
    }

    vector<pair<int, int>> P;
    for(int i = 0; i < m; i++){
        int b, c;
        scanf("%d %d", &b, &c);
        P.push_back(make_pair(b, c));
    }
    sort(P.begin(), P.end(), cmp_pair);

    int count = 0;
    for(int i = 0; i < m; i++){
        int b = P[i].first;
        int c = P[i].second;
        for(int j = 0; j < b; j++){
            A.push_back(c);
        }
        count += b;
        if(n < count){
            break;
        }
    }

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

    long long sum = 0;
    for(int i = 0; i < n; i++){
        sum += A[i];
    }

    printf("%lld\n", sum);
}


Measured memory_bytes: 2796
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<string>
#include<string.h>
#include<vector>
using namespace std;
typedef unsigned long long ll;
#pragma GCC optimize(2)
//vector<ll> a;
int main()
{
    ll n,i;
    string s;
    cin>>n>>s;
    ll a=0;
    a=s.length();
    if(a<=n)
    {
        cout<<s<<endl;
    }
    else
    {
        for(i=0;i<n;i++)
        {
            cout<<s[i];
        }
        cout<<"..."<<endl;
    }
}


Measured memory_bytes: 3624
import math

a, b, t = map(int, input().strip().split())

t = math.radians(t)
h = b * math.sin(t)
l = a + b + math.sqrt(a*a + b*b - 2*a*b*math.cos(t))
s = a * h / 2

print(s)
print(l)
print(h)

Measured memory_bytes: 7984
/*AtCoder2370(ATCODER013D) 
题意：给N个球（有两种颜色，初始颜色所有可能都有），你进行M次操作，问最后取出的球的序列有多少个不同的
操作定义：取出一个球，放进一个红球和一个蓝球，取出一个球
INPUT:
2(初始有2个球) 3(进行3次操作)
OUTPUT:
56(取出顺序数目) 
分析:dp[i][j]表示当前是第i次操作，当前有j个红球
这样显然会算重，于是我们考虑一个类似于最小表示法的东西
对于每种方案，我们让初始的红球个数尽可能少，这样一定存在某个时刻红球个数为0
这样我们可以用dp[i][j][0/1]来dp了
将所有方案分到[0]和[1]两个世界中,[1]世界中的方案会在某时刻红球个数为0,[0]世界中的方案则不会
两个世界相互独立,只有通过"没有红球"这个入口进出
另外如果"没有红球"则直接进入[1]世界(dp[x][0][1])而不是先进入"没有红球"的[0]世界(dp[x][0][0])再进入"没有红球"的[1]世界(dp[x][0][1])
     以方便最后答案收集.即dp[x][0][0]将永远为0. 
*/ 
#include <bits/stdc++.h>  
#define xx first  
#define yy second  
#define mp make_pair  
#define pb push_back  
#define fill( x, y ) memset( x, y, sizeof x )  
#define copy( x, y ) memcpy( x, y, sizeof x )  
using namespace std;  
//因为一种取出顺序可以对应若干种初始状态,因此我们只选取可以让红球个数为0的初始状态代表这种取出顺序
typedef long long LL;  
typedef pair < int, int > pa;  
  
const int MAXN = 3005;  
const int mod = 1e9 + 7;  
  
inline void inc(int &x, int y) { x += y; if( x >= mod ) x -= mod; }  
  
int n, m, dp[MAXN][MAXN][2], ans;  
  
int main()  
{  
    scanf( "%d%d", &n, &m );  
    for( int i = 1 ; i <= n ; i++ ) dp[ 0 ][ i ][ 0 ] = 1;  
    dp[ 0 ][ 0 ][ 1 ] = 1;  
    for( int i = 0 ; i < m ; i++ )  //第i次操作
        for( int j = 0 ; j <= n ; j++ )  //当前有j个红球
            for( int k = 0 ; k < 2 ; k++ )  //两个世界相互独立,只能通过入口出入 
            if( int cur = dp[ i ][ j ][ k ] )  
            {  
                if( !j )            //没有红球
                {  
                    inc( dp[ i + 1 ][ j ][ 1 ], cur );      //从没有红球来的状态直接进入[1]的世界 
                    inc( dp[ i + 1 ][ j + 1 ][ 1 ], cur );  //从没有红球来的状态直接进入[1]的世界 
                }  
                else if( j == n )  //全是红球(普通情况中的特例) 
                {  
                    inc( dp[ i + 1 ][ j ][ k | ( j == 1 ) ], cur );  
                    inc( dp[ i + 1 ][ j - 1 ][ k | ( j == 1 ) ], cur );  
                }  
                else   //普通情况 
                {  
                    inc( dp[ i + 1 ][ j ][ k ], cur );  
                    inc( dp[ i + 1 ][ j + 1 ][ k ], cur );  
                    inc( dp[ i + 1 ][ j ][ k | ( j == 1 ) ], cur );       //中间时刻曾经一个红球也没有,进入[1]的世界  
                    inc( dp[ i + 1 ][ j - 1 ][ k | ( j == 1 ) ], cur );   //红球减少为0了,进入[1]的世界,之所以在此处进入[1]的世界而不是先进入[0]的世界
					                                                      //再通过没有红球进入[1]的世界是为了收集答案时方便 
                }  
            }  
    for( int i = 0 ; i <= n ; i++ ) inc( ans, dp[ m ][ i ][ 1 ] );  
    return printf( "%d\n", ans ), 0;  
}  

Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n, k; cin >> n >> k;
  vector<int> sunuke(n);
  int okashi=0, d=0; 
  
  for (int i=0; i<k; i++){
    cin >> d;
    for (int j=0; j<d; j++){
      cin >> okashi;
      sunuke.at(okashi-1)++;
    }
  }
  int cnt =0;
  for (int i=0; i<n; i++){
    if (sunuke.at(i)==0){
      cnt++;
    }
  }
  cout << cnt << endl;
}

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

int main(){
  ll t1, t2, a1, a2, b1, b2;
  cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
  if (a1 > b1) {
    swap(a1, b1);
    swap(a2, b2);
  }
  ll p = (a1-b1)*t1;
  ll q = (a2-b2)*t2;
  if (p+q < 0) {
    cout << 0 << endl;
    return 0;
  }
  if (p+q == 0) {
    cout << "infinity" << endl;
    return 0;
  }
  if ((-p)%(p+q) != 0) {
    cout << ((-p)/(p+q))*2 + 1 << endl;
  }
  else {
    cout << ((-p)/(p+q))*2 << endl;
  }
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

if reduce(gcd, A) != 1:
    print("not coprime")
    exit()
ma = max(A)
p = list(range(ma+1))

for x in range(2, int(ma ** 0.5) + 1):
    if p[x]:
        # xは素数，それがpの要素にあるうちは続ける
        for i in range(2 * x, ma + 1, x):
            p[i] = x

s = [set() for _ in range(N)]
t = set()

for i, x in enumerate(A):
    while x != 1:
        s[i].add(x)
        t.add(x)
        # 割り続けるとs[i]にその素数がたまっていく
        x //= p[x]
l = sum(len(x) for x in s)
print("pairwise coprime" if l == len(t) else "setwise coprime")


Measured memory_bytes: 441408
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

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

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  string S;
  cin >> S;
  const char* s = S.c_str();

  REP(i, 1, S.size() - 1) {
    ll size = S.size() - i;
    if (size % 2 != 0) {
      continue;
    }
    REP(j, 0, size / 2) {
      if (s[j] != s[j + size / 2]) {
        goto label;
      }
    }
    cout << size << endl;
    return 0;
    label:;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define REP(i, n) for(int i = 0;i < n;i++)
const long long INF = 1LL << 60;

int MOD = 1000000007;

int main(){
    std::ios_base::sync_with_stdio(false);

    string s; int x,y;
    cin >> s >> x >> y;

    vector<int> h; vector<int> v;

    int start = 0;
    while(start<s.length()&&s[start]=='F'){
      start++;
    }

    x-=start;

    bool hor = true;

    for(int j=start; j<s.length(); ++j){
      if(s[j]=='T'){

        hor = !hor;
      }else{
        int cnt=0;
        while(j<s.length()&&s[j]=='F'){
          cnt++; j++;
        }
        --j;
        if(hor) h.push_back(cnt);
        else v.push_back(cnt);
      }
    }

    vector<bool> ph(8020, false); ph[0]=true;
    vector<bool> pv(8020, false); pv[0]=true;

    REP(i,h.size()){
      vector<bool> t(8020, false);
      REP(j, 8020){
        if(ph[j]){
          t[j+h[i]] = true;
          t[abs(j-h[i])] = true;
        }
      }
      ph = t;
    }

    REP(i,v.size()){
      vector<bool> t(8020, false);
      REP(j, 8020){
        if(pv[j]){
          t[j+v[i]] = true;
          t[abs(j-v[i])] = true;
        }
      }
      pv = t;
    }

    if(ph[abs(x)] && pv[abs(y)]) cout << "Yes" << endl;
    else cout<<"No"<<endl;

    return 0;
}


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

int main(){
  string s;
  lint k;
  cin>>s >>k;
  for(lint i=0;i<min((lint)s.size(), k);i++){
    if(s[i]!='1'){
      cout<<s[i]<<endl;
      return 0;
    }
  }
  
  cout<<1<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
signed main(){
	int a,b,c,n,ans=0;
	cin>>a>>b>>c>>n;
	for(int i=0;i<=n;i+=a){
		for(int j=i;j<=n;j+=b){
			if((n-j)%c==0){
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define pa pair<int,int>
const int N=2e5+10; 
const int mod=1e9+7;
using namespace std;



char a[N];
int dp[N];
int main()
{
	int n; scanf("%d",&n);
	scanf("%s",a+1);
	int c=0;
	for(int i=n;i>=1;i--)
	{
		dp[i]=dp[i+1];
		if(a[i]=='#') 
		{
			dp[i]=min(c,1+dp[i+1]);
		}
		else c++;
	}
	printf("%d\n",dp[1]);
	// int b=-1;
	// for(int i=1;i<=n;++i) if(a[i]=='#') {b=i;break;}
	// if(b==-1) return 0*puts("0");
	// int ans=0;
	// for(int i=b;i<=n;++i) ans+=(a[i]=='.');
	// int an=0,y=n;
	// while(y&&a[y]=='#') y--;
	// if(y==0) an=0;
	// else
	// {
	// 	for(int i=b;i<=y;i++) an+=(a[i]=='#');
	// }
	// printf("%d\n",min(ans,an));
return 0;
}
/*
*/

Measured memory_bytes: 1280
import java.util.Scanner;

class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] a = new int[n];
	
		for(int i = 0; i < n; i++){
			a[i] = scan.nextInt();
		}
	
		boolean flag = true;
		int swap;
		int count = 0;
		
		while(flag){
			flag = false;
			for(int i = n-1; i >= 1; i--){
				if(a[i] < a[i-1]){
					swap = a[i];
					a[i] = a[i-1];
					a[i-1] = swap;
					count++;
					flag = true;
				}
			}
		}
		
		for(int i = 0; i < n; i++) {
			System.out.print(a[i]);

			if(i != n-1) System.out.print(" ");
		}
		System.out.println();
		System.out.println(count);
	}
}

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

using namespace std;

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

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

bool used[1<<18];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int n, s[1<<18];
	cin>>n;
	int m=1<<n;
	REP(i, m){
		cin>>s[i];
	}
	sort(s, s+m);
	set<pii> st;
	REP(i, m-1) st.insert(pii(s[i], i));
	used[m-1]=true;
	REP(_, n){
		vi v;
		FORR(i, 0, m){
			if(!used[i]) continue;
			auto t=st.lower_bound(pii(s[i], -1));
			if(t==st.begin()){
				cout<<"No"<<'\n';
				return 0;
			}
			--t;
			pii x=*(t);
			v.push_back(x.second);
			st.erase(t);
		}
		for(auto &u : v) used[u]=true;
	}
	cout<<"Yes"<<'\n';
	return 0;
}


Measured memory_bytes: 13696
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
#define pb push_back
const int MOD=1e9+7;
const int INF=1e15;

signed main(){
    int N;string S;cin>>N>>S;
    map<char,int>memo;
    int ans=0;
    for(int i=1;i<N;i++){
        int count=0;
        string C=S.substr(0,i);
        string V=S.substr(i);
        REP(j,C.size()){
            memo[C[j]]++;
        }
        REP(j,V.size()){
            if(memo[V[j]]!=0){
                count++;
                memo[V[j]]=0;
            }
        }
        ans=max(ans,count);
        memo.clear();
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        long t = n / k;
        long ans = t * t * t;

        if (k % 2 == 0) {
            long temp = n / (k / 2) - t;
            ans += temp * temp* temp;
        }

        System.out.println(ans);
    }
}


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

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

	int h[n] ;

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

	}

	int dp[n] ;
	memset(dp,0,sizeof(dp)) ;

	dp[0]=0 ;
	dp[1]=abs(h[0]-h[1]) ;
	for(int i=2;i<n;i++){


		dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2])) ;

	}
	/*
	for(int i=0;i<n;i++){
		cout<<dp[i]<<" " ;
	}
	
	cout<<"\n" ;
	*/
	cout<<dp[n-1] ;
}

int main(){

	
	int y ;

	y=1 ;
	//cin>>y ;

	while(y--)
	{	
		solve() ;
	}

}

Measured memory_bytes: 4376
N = int(input())
flg = False
count = 0
for i in range(N):
  D1,D2 =  map(int, input().split())

  if D1 == D2:
    count += 1
    if count >= 3:
      flg = True
  else:
    count = 0

if flg:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9176
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int cnt = 0;
		for(int i=0; i<=a; i++){
			for(int j=0; j<=b; j++){
				if(x-500*i-100*j>=0 && (x-500*i-100*j)/50<=c)cnt++;
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 22996
import java.util.*;

public class Main {


    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String st = scan.next();
        int ans = 0;
        for (int i = 0; i < st.length(); i++) {
            ans = (ans + st.charAt(i) - '0') % 9;
        }
        System.out.println(ans == 0 ? "Yes" : "No");
    }
}


Measured memory_bytes: 40096