akhauriyash/Code-Regression huggingface dataset:
//     自己选择的路，跪着也要走完。朋友们，虽然这个世界日益浮躁起来，只
// 要能够为了当时纯粹的梦想和感动坚持努力下去，不管其它人怎么样，我们也
// 能够保持自己的本色走下去。                               ——陈立杰
/*************************************
 * @problem:      T132641 中子衰变.
 * @user_id:      63720.
 * @user_name:    brealid.
 * @time:         2020-05-30.
 * @language:     C++.
 * @upload_place: Luogu.
*************************************/ 

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

typedef signed char          int8;
typedef unsigned char       uint8;
typedef short                int16;
typedef unsigned short      uint16;
typedef int                  int32;
typedef unsigned            uint32;
typedef long long            int64;
typedef unsigned long long  uint64;

template <typename Int>
inline Int read()       
{
    Int flag = 1;
    char c = getchar();
    while ((!isdigit(c)) && c != '-' && c != EOF) c = getchar();
    if (c == '-') flag = -1, c = getchar();
    Int init = c & 15;
    while (isdigit(c = getchar())) init = (init << 3) + (init << 1) + (c & 15);
       return init * flag;
}

template <typename Int>
inline Int read(char &c)       
{
    Int flag = 1;
    c = getchar();
    while ((!isdigit(c)) && c != '-' && c != EOF) c = getchar();
    if (c == '-') flag = -1, c = getchar();
    Int init = c & 15;
    while (isdigit(c = getchar())) init = (init << 3) + (init << 1) + (c & 15);
       return init * flag;
}

template <typename Int>
inline void write(Int x)
{
    if (x < 0) putchar('-'), x = ~x + 1;
    if (x > 9) write(x / 10);
    putchar((x % 10) | 48);
}  

template <typename Int>
inline void write(Int x, char nextch)
{
    write(x);
    putchar(nextch);
}

// #define int int64

int n, task;
int a[2048 + 7];
int x, y;

inline void Read() {
    x = read<int>();
    y = read<int>();
    a[x] = y;
}

inline void order(int cmd) {
    write(cmd, 10);
    fflush(stdout);
    // if (cmd == 1) Read();
}

inline void output(int pl, int type) {
    write(pl, 32);
    write(type, 10);
    a[pl] = type;
    fflush(stdout);
}

inline bool end() {
    for (int i = 1; i <= n; i++) {
        if (a[i] || (a[i - 1] && a[i + 1] && a[i - 1] != a[i + 1])) continue;
        return false;
    }
    return true;
}

inline void expand(int &l, int &r) {
    l = r = (n + 1) >> 1;
    if (!a[l]) return;
    while (a[l - 1] == a[l]) l--;
    while (a[r + 1] == a[r]) r++;
}

inline bool SAmE(int l, int r) {
    if (l > r) swap(l, r);
    for (int i = l; i < r; i++)
        if (a[i] != a[i + 1]) return 0;
    return 1;
}

signed main() {write(read<int>() * read<int>());
    return 0;
}

// Create File Date : 2020-05-30

/*
wasa855,Hacked : n = 7 操作 1: 2 1 回答 : 6 -1 操作 2 : 4 1 回答 : 5 1 （不合法）
*/

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

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int f(int x,int y,int z){
	int w=x+y+z;
	if(w<=60)return 600;
	if(w<=80)return 800;
	if(w<=100)return 1000;
	if(w<=120)return 1200;
	if(w<=140)return 1400;
	if(w<=160)return 1600;
	return 0;

}

int g(int w){
	if(w<=2)return 600;
	if(w<=5)return 800;
	if(w<=10)return 1000;
	if(w<=15)return 1200;
	if(w<=20)return 1400;
	if(w<=25)return 1600;
	return 0;
}

int main(){
	int n;
	while(cin>>n){
		if(n==0)break;
		int sum=0;
		rep(i,n){
			int x,y,z,w;
			cin>>x>>y>>z>>w;
			int F=f(x,y,z),G=g(w);
			if(F==0 || G==0)sum+=0;
			else sum+=max(F,G);
		}
		cout<<sum<<endl;
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#define PI 3.14159265359
typedef long long ll;
const int MOD = 1e9+7;
const ll LLINF = 7e18;
using namespace std;

int h, w;
char grid[1001][1001];
vector<queue<pair<int, int> > > que(2);

bool is_range(int x, int y){
	if (1 <= x && x <= h && 1 <= y && y <= w) return true;
	return false;
}

void bfs(int x){
	int dirx[4] = {1, 0, -1, 0};
	int diry[4] = {0, 1, 0, -1};
	while(!que[x].empty()){
		auto f = que[x].front();
		que[x].pop();
		for (int i = 0; i < 4; i++){
			int nextx = f.first + dirx[i], nexty = f.second + diry[i];
			if (is_range(nextx, nexty)){
				if (grid[nextx][nexty] == '.'){
					grid[nextx][nexty] = '#';
					que[(x+1)%2].push(make_pair(nextx, nexty));
				}
			}
		}
	}
	return;
}

int main(){
	cin >> h >> w;
	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++){
			cin >> grid[i][j];
			if (grid[i][j] == '#'){
				que[0].push(make_pair(i, j));
			}
		}
	}

	int ans = 0;
	for (int i = 0; ; i++){
		if (!que[i%2].empty()) bfs(i%2);
		else break;
		ans++;
	}
	
	cout << ans-1 << endl;
	return 0;
}

Measured memory_bytes: 12188
#include <stdio.h>
int main(void){
        int n,i=0,a,min,max;
        long long int sum=0;
        scanf("%d",&n);
        while(1){
                if(i>=n)
                        break;
                scanf("%d",&a);
                if(i==0){
                        min=a;
                        max=a;
                }if(min>a)
                min=a;
                if(max<a)
                        max=a;
                sum+=a;
                i++;
        }
        printf("%d %d %lld\n",min,max,sum);
        return 0;
}

Measured memory_bytes: 600
import sys
sys.setrecursionlimit(10**7)

def input(): return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def readInt():return int(input())
def readIntList():return list(map(int,input().split()))
def readStringList():return list(input())
def readStringListWithSpace():return list(input().split())
def readString():return input()

days = readString()
if 'RRR' in days:
  print(3)
elif 'RR' in days:
  print(2)
elif 'R' in days:
  print(1)
else:
  print(0)

# readStringList()
# count = 0
# res = 0
# for c in days:
#     count += 0 if c == 'S' else 1
#     res = max(res,count)
# print(res)

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

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

    for(int i = 0; i<N; i++ ) {
        if(i % 2 == 0) { 
            A += list[i];
        } else {
            B += list[i];
        }
    }
    cout << A - B << endl;


}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set>
using namespace std;
//int p = 998244353;
int p = 1000000007;
#define vel vector<int>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define rev(s) reverse(s.begin(),s.end())
int max_kai = 150000;
vel kai(max_kai, 1);
vel inv_kai;
int rui(int a, int n) {
	if (n == 0) { return 1; }
	int x = rui(a, n / 2);
	x *= x; x %= p;
	if (n % 2 == 1) { x *= a; x %= p; }
	return x;
}
int inv(int a) { return rui(a, p - 2); }
void make_kai() {
	for (int i = 1; i < max_kai; i++) { kai[i] = kai[i - 1] * i; kai[i] %= p; }
	inv_kai = kai;
	rep(i, max_kai) { inv_kai[i] = inv(kai[i]); }
}
int nCr(int n, int r) {
	int a = kai[n] * inv_kai[r]; a %= p;
	a *= inv_kai[n - r]; a %= p;
	return a;
}
vel pa;
int root(int x) {
	if (pa[x] == -1) { return x; }
	int ans = root(pa[x]); pa[x] = ans;
	return ans;
}
void marge(int x, int y) {
	x = root(x);
	y = root(y);
	if (x != y) {pa[x] = y;}
}
#define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin()
#define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin()
int num_lp(int a, vel &nex) {
	unordered_set<int> se;
	int ans = 0;
	while (true) {
		if (se.find(a) != se.end()) {
			break;
		}
		se.insert(a);
		a = nex[a];
		ans++;
	}
	return ans;
}
int find_cr(int a, vel &nex) {
	unordered_set<int> se;
	while (true) {
		if (se.find(a) != se.end()) {break;}
		se.insert(a);
		a = nex[a];
	}
	return num_lp(a, nex);
}
int inf = 2000000000;
vvel dp;
int solve(vvel &sum, int i, int j, bool is_f) {
	int h = sum.size(); h--;
	int w = sum[0].size();
	if (i == h || j == w) { return 0; }
	if (dp[i][j] == inf) {
		int ans1 = solve(sum, i + 1, j, !is_f);
		int ans2 = solve(sum, i, j + 1, !is_f);
		ans2 += sum[i][j];
		if (is_f) {
			dp[i][j] = min(ans1, ans2);
		}
		else {
			dp[i][j] = max(ans1, ans2);
		}
	}
	return dp[i][j];
}
int rui10(int a) {
	if (a == 0) { return 1; }
	return 10 * rui10(a - 1);
}
int gcd(int a, int b) {
	if (a < b) { swap(a, b); }
	if (b == 0) { return a; }
	return gcd(b, a%b);
}
signed main(){
	vel a(3), b(3);
	cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2];
	if (a > b) { swap(a, b); }
	if (a[1]<b[1] || (a[1]==b[1]&&a[2]<b[2])){
		cout << b[0] - a[0] + 1 << endl;
	}
	else {
		cout << b[0] - a[0] << endl;
	}
	return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
        using namespace std;
        #define int long long

        signed main() {
            int n,m;
            cin>>n>>m;
            int a[n],b,a0;
            for(int i=0;i<n;i++){
                cin>>b;
                a[i]=b/2;
            }
            a0=a[0];
            int mt=0,at[n]={};
           
            for(int i=0;i<n;i++){
                while(a[i]%2==0){
                    at[i]++;
                    a[i]/=2;
                }

            }
            for(int i=1;i<n;i++){
                if(at[0]!=at[i]){
                    cout<<0;
                    return 0;
                }
            }
           // cerr<<'y';
            int  x,y;
            for(int i=1;i<n;i++){
                x=a0,y=a[i];
              
                if(y>x)swap(x,y);
               // cerr<<y<<endl;
                while(y!=0){
                    x%=y;
                    swap(x,y);
                }
              //    cerr<<x<<' '<<y<<endl;
                a0=a0*a[i]/x;
                if(a0>m){
                    cout<<0;
                    return 0;
                }
              //   cerr<<a0<<endl;
            }
           //cerr<<m<<endl;
            if(m%(2*a0)>=a0)cout<<m/(2*a0) +1;
            else cout<<m/(2*a0);

         return 0;

        }


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

int main()
{
  int a, b, c, d, e, f;
  while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF && a+b+c+d+e+f != 0) {
    int x = a + d;
    int y = b + e;
    int z = c + f;
    int w = min(x, min(y, z));
    int ans = 0;
    for (int i = max(0, w-2); i <= w; i++) {
      ans = max(ans, i + (x-i)/3 + (y-i)/3 + (z-i)/3);
    }
    printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,n,m,k,l,maxx,dp[200005],w;
pair <long long,long long> A[200005];
int main() {
           cin>>n>>w;
           for(long long i=1;i<=n;i++) {
                      cin>>A[i].first>>A[i].second;
           }
           for(long long i=1;i<=n;i++) {
                      for(long long j=w;j>=A[i].first;j--) {
                                 dp[j]=max(dp[j],dp[j-A[i].first]+A[i].second);
                      }
           }
           for(long long i=1;i<=w;i++) {
           maxx=max(maxx,dp[i]);
           //cout<<dp[i]<<" ";
           }
           cout<<maxx;
}

Measured memory_bytes: 2304
#include<iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

struct Node{
  int color, dist, parent;
};

int n, M[MAX][MAX];
Node node[MAX];

void Printnodes(){
  string col[3] = {"WHITE", "GRAY ", "BLACK"};
  for(int i = 0; i < n; i++){
    cout << "nodeID : " << i ;
    cout << " color : " << col[node[i].color];
    cout << " parent : " << node[i].parent;
    cout << " dist : " << node[i].dist << endl;
  }
  cout << endl;
}

int main(){
  cin >> n;

  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      cin >> M[i][j];
    }
    node[i].color = WHITE;
    node[i].dist = INFTY;
    node[i].parent = -1;
  }

  int p = 0;
  node[p].dist = 0;

  while(true){
    //Printnodes();

    for(int i = 0; i < n; i++){
      if(M[p][i] >= 0 && node[i].color != BLACK){
        if(node[i].dist > M[p][i]){
          node[i].dist = M[p][i];
          node[i].parent = p;
          node[i].color = GRAY;
        }
      }
    }

    int min_d = INFTY;
    p = -1;
    for(int i = 0; i < n; i++){
      if(node[i].dist < min_d && node[i].color != BLACK){
        min_d = node[i].dist;
        p = i;
      }
    }

    if(p == -1)
      break;

    node[p].color = BLACK;
    //cout << "node " << p << " turns to BLACK!" << endl;
  }

  int sum = 0;
  for(int i = 0; i < n; i++){
    if(node[i].parent != -1)
      sum += M[i][node[i].parent];
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1208
package main

import "fmt"

func main() {
	var w, h, x, y int
	fmt.Scan(&w, &h, &x, &y)

	a := float64(w*h) / 2.0
	b := 0
	if x+x == w && y+y == h {
		b = 1
	}
	fmt.Printf("%f %d\n", a, b)
}


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

#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main() {
  int n; cin>>n;
  string s; cin>>s;
  int k,m=s.size();
  string al="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  rep(i,m){
    rep(j,26){
      if(s.at(i)==al.at(j)){
        k=j+n;
        if(k>=26){k-=26;}
      }
    }
    cout<<al.at(k);
  }
}

Measured memory_bytes: 256
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**7) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


'''
ダイクストラ法
----------
input
    graph: 隣接リスト (list)
    start: 開始ノード番号
    INF  : distの最大値

output
    dist : startから各ノードへの距離 (list)
    
'''
from heapq import heappush, heappop

def dijkstra(graph: list, start, INF=float('inf')) -> list:
    n = len(graph)
    dist = [INF]*n
    visited = [False]*n
    
    dist[start] = 0
    que = [(0, start)]
    
    while que:
        cost, cur = heappop(que)
        
        if visited[cur]:
            continue
        
        visited[cur] = True
        
        for nextnode, edgecost in graph[cur]:
            nextcost = cost + edgecost
            if nextcost < dist[nextnode]:
                dist[nextnode] = nextcost
                heappush(que, (nextcost, nextnode))
      
    return dist

n,e,r = li()
graph = [[] for _ in range(n)]

for _ in range(e):
    s,t,d = li()
    graph[s].append((t, d))

INF = 1<<62
dist = dijkstra(graph, r, INF)

for di in dist:
    print('INF' if di == INF else di)


Measured memory_bytes: 90052
#include<stdio.h>
 
int main()
{
    int input, angka1, angka2, angka3;
    scanf("%d", &input);
    angka1 = input / 100;
    angka2 = input % 100 / 10;
    angka3 = input % 10;
    if(angka1 == 7 || angka2 == 7 || angka3 == 7)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 1660
// ↓ここから
#include <string>
#include <vector>
#include <iostream>
#ifdef USE_PYTHON_LIKE_PRINT
#include "print.h"
#else
template<char SEP = ' ', char END = '\n'> inline void print(...){}
template<char SEP = ' ', char END = '\n'> inline void printe(...){}
template<char SEP = ' ', char END = '\n'> inline void printo(...){}
#define define_print(...)
#define define_print_with_names(...)
#define define_to_tuple(...)
#endif
// ↑ここまで


#include <string.h>

using namespace std;

int main(void){
	const int X = 9;
	int N;
	cin >> N;
	
//	vector<int> count_2(X * 2, 0);
//	vector<int> count_5(X * 2, 0);
	
	vector<vector<int>> count(X * 2 + 1, vector<int>(X * 2 + 1, 0));
	
	vector<int> list_a2(N, 0);
	vector<int> list_a5(N, 0);
//	vector<long long> A_list(N, 0);
	
	char value[20];
	for(int i = 0; i < N; i ++){
		cin >> value;
		const int len = strlen(value);
		char* period = strchr(value, '.');
		if(period == nullptr){
			strcpy(value + len, "000000000");
		}else{
			char* p = period;
			for(; p < value + len - 1; p ++){
				*p = *(p + 1);
			}
			for(; p < period + X; p ++){
				*p = '0';
			}
			*p = 0;
		}
		const long long A = atoll(value);
		int max2;
		int max5;
		if(A == 0){
			max2 = X * 2;
			max5 = X * 2;
		}else{
			max2 = 0;
			max5 = 0;
			long long a2 = A;
			long long a5 = A;
			for(int j = 0; j < X * 2; j ++){
				if(a2 % 2 == 0){
//					count_2[j] ++;
					a2 /= 2;
					max2 = j + 1;
				}
				if(a5 % 5 == 0){
//					count_5[j] ++;
					a5 /= 5;
					max5 = j + 1;
				}
			}
		}
		list_a2[i] = max2;
		list_a5[i] = max5;
		count[max2][max5] ++;
	}
	for(int i = X * 2; i >= 0; i --){
		int c = 0;
		for(int j = X * 2; j >= 0; j --){
			c += count[i][j];
			count[i][j] = c;
		}
	}

	for(int j = X * 2; j >= 0; j --){
		int c = 0;
		for(int i = X * 2; i >= 0; i --){
			c += count[i][j];
			count[i][j] = c;
		}
	}
/*	for(int i = 0; i <= X * 2; i ++){
		printe(count[i]);
	}*/
	
	long long total = 0;
	for(int i = 0; i < N; i ++){
		const long long a2 = list_a2[i];
		const long long a5 = list_a5[i];
		
		total += count[X * 2 - a2][X * 2 - a5];
//		printe(i, count[X * 2 - a2][X * 2 - a5]);
		
		if(a2 >= 9 && a5 >= 9){
			total --;
		}
	}
	
//	printe(total);
	cout << total / 2 << endl;
	
	return 0;
}



Measured memory_bytes: 4752
#include<bits/stdc++.h>
#define rep(i,j,k) for(int i=j;i<=k;i++)
using namespace std;
template<typename T> void read(T &num){
	char c=getchar();T f=1;num=0;
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){num=(num<<3)+(num<<1)+(c^48);c=getchar();}
	num*=f;
}
template<typename T> void qwq(T x){
	if(x>9)qwq(x/10);
	putchar(x%10+'0');
}
template<typename T> void write(T x){
	if(x<0){x=-x;putchar('-');}
	qwq(x);putchar('\n');
}
template<typename T> void chkmax(T &x,T y){x=x>y?x:y;}
int p[5010];int c[5010];
int w[5010];

int main(){
	int n,k;read(n);read(k);
	rep(i,1,n)read(p[i]);
	rep(i,1,n)read(c[i]);
	
	long long ans=c[1];
	rep(i,2,n)chkmax(ans,1ll*c[i]);
	rep(i,1,n){
		long long mx=-1e15;
		int now=p[i];long long sum=0;int l=0;
		while(now!=i){sum+=c[now];l++;chkmax(mx,sum);now=p[now];}
		sum+=c[i];l++;chkmax(mx,sum);
		if(k<2*l){
			now=p[i];sum=0;
			rep(i,1,k){sum+=c[now];chkmax(ans,sum);now=p[now];}
		}else{
			if(sum<=0){chkmax(ans,mx);}
			else{
				int lc=((k%l==0)?((k/l)-2):((k/l)-1));now=p[i];long long t=0;
				rep(i,1,k-lc*l){t+=c[now];chkmax(ans,t+1ll*lc*sum);now=p[now];}
			}
		}
	}
	write(ans);
	return 0;
}

Measured memory_bytes: 3672
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#define pb push_back
using namespace std;
const int P=139;
const int mod=149;
const int maxn=1e6+5;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int minn=0xc0c0c0c0;
int n,cnt;
int Count(int x)
{
	int ans = 1;
	for(int i = 2; i * i <= x; i++)
	{
		if(x % i == 0)
		{
			ll temp = 0;
			while(x % i == 0)
			{
				x /= i;
				temp++;
			}
			ans *= (temp+1);
		}
	} 	
    if(x > 1)
		ans *= 2;
	return ans;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin>>n;
    int ans=0;
    for(int i=1;i<n;i++)
    {
    	cnt=Count(i);
    	ans+=cnt;
	}
	cout<<ans<<endl;
    return 0;
}

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

int cmp(string &a, string &b) {
	
	if(a.length() != b.length()) {
		return a.length() < b.length() ? -1 : 1;
	}
	
	for(int i = 0; i < a.length(); i++) {
		if(a[i] != b[i]) {
			return a[i] < b[i] ? -1 : 1;
		}
	}
	
	return 0;
	
}

int main() {
	
	string a, b;
	getline(cin, a);
	getline(cin, b);
	
	int c = cmp(a, b);
	if(c > 0) {
		cout << "GREATER" << endl;
	} else if(c < 0) {
		cout << "LESS" << endl;
	} else {
		cout << "EQUAL" << endl;
	}
	
	return 0;
}

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


int main()
{
	int n;
	long long int ans = 0, k[100005];
	cin >> n;
	k[0] = 0;
	k[n+1] = 0;
	for (int i = 1;i <= n;i++)
		cin >> k[i];
	for (int i = 1;i <= n+1;i++)
		ans += abs(k[i] - k[i - 1]);
	for (int i = 1;i <= n;i++)
		cout << ans - abs(k[i] - k[i - 1]) -
			abs(k[i] - k[i + 1]) + abs(k[i + 1] - k[i - 1])<<endl;
	return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

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

  if(a>=k){
    cout << k << endl; 
  }
  else if(a+b>=k){
    cout << a << endl;
  }
  else if(a+b+c>=k){
    cout << a - (k-a-b) << endl;
  }
  
  return 0;
}


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

int n, T, a, s, en, st, i;
int main()
{
	cin >> n >> T;
	for (i = 0; i < n; i++) {
		scanf ("%d", &a);
		if (en < a) {
			s += en - st;
			st = a;
		}
		en = a + T;
	}
	s += en - st;
	cout << s;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#if defined __has_include
# if __has_include(<bits/debug_aamir.h>)
#  define dbg(...) DEBUG(#__VA_ARGS__, __VA_ARGS__);
#  include<bits/debug_aamir.h>
# else
#  define dbg(...)
# endif
#endif

typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
typedef pair<ll, ll> pll;
#define sz(x) int(x.size())
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define rep(i, begin, end) for(__typeof(end) i=begin; i<end; i++)
#define per(i, begin, end) for(__typeof(end) i=begin; i>=end; i--)
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 1e18 + 1;


template<typename T>
T gcd(T a, T b){	return b ? gcd(b, a%b): a; }
template<typename T>
T lcm(T a, T b){	return a/gcd(a, b) * b;		}


int main()
{
	fastio;
	int n, k;
	cin >> n >> k;
	vi h(n), dist(n, INF);
	rep(i, 0, n)	cin >> h[i];
	dist[0]=0;
	rep(i, 0, n){
		for(int j=1; j<=k && i+j<n; j++){
			dist[j+i] = min(dist[j+i], dist[i]+abs(h[j+i]-h[i]));
		}
	}
	printf("%d\n", dist[n-1]);
}



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

using namespace std;

int main(){

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

    //freopen("input.txt", "r", stdin);

    int r, g, b, n;

    cin >> r >> g >> b >> n;

    int cnt = 0;

    // x y

    for(int x = 0; x <= 3000; ++x){
        for(int y = 0; y <= 3000; ++y){
            int left = n - x * r - y * g;
            if(left >= 0 && left % b == 0)
                ++cnt;
        }
    }

    cout << cnt;


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s,t;
  cin>>s>>t;
  if(t.size()>s.size()){
    cout<<"UNRESTORABLE";
    return 0;
  }
  for(int i=s.size()-t.size();i>=0;i--){
    string a=s.substr(i,t.size());
    bool can=true;
    for(int j=0;j<t.size();j++){
      if(a[j]==t[j]||a[j]=='?') continue;
      can=false;
      break;
    }
    if(can){
      for(int j=i;j<i+t.size();++j){
        s[j]=t[j-i];
      }
      for(auto &x:s){
        if(x=='?') x='a';
      }
      cout<<s;
      return 0;
    }
  }
  cout<<"UNRESTORABLE";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <math.h>
using namespace std;
typedef long long ll;
ll mod=1e9+7;

ll power(ll a,ll b,ll c){
    ll res=1;
    while(b){
        if(b%2)res =res*a %c;
        a=a*a %c;
        b/=2;
    }
    return res;
}

ll ncr(ll a,ll b,ll c){
    ll res=1;
    for(ll i=1;i<=b;i++)res=res*(a-i+1)%c*power(i,c-2,c)%c;
    return res;
}

int main(){
    ll n,a,b;cin>>n>>a>>b;
    ll ans=power(2LL,n,mod)-1LL;
    ans-=ncr(n,a,mod);
    ans-=ncr(n,b,mod);
    while(ans<0)ans+=mod;
    cout<<ans%mod;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in(),M=in();
	string S(M,char(N+'0')),T(N,char(M+'0'));

	out(S<T?S:T);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 3e5;
#define endl '\n'
int vis[maxn],ans[maxn];
vector<int> g[maxn];
void dfs(int u,int p){
  ans[u] = p;
  vis[u] = 1;
  for(auto v:g[u]){
    if(!vis[v])
      dfs(v,u);
  }
}
int32_t main()
{

  IOS
  int n,m;
  cin>>n>>m;
  for(int i = 1;i<=m;i++){
    int a,b;
    cin>>a>>b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  queue<int> q;
  ans[0] = 0;
  q.push(1);
  while(!q.empty()){
    int u = q.front();
    q.pop();
    vis[u] = 1;
    for(auto v:g[u]){
      if(!vis[v]){
        q.push(v);
        
        vis[v] = 1;
        ans[v] = u;
      }
    }
  }
  for(int i =  1;i<=n;i++)
    if(!vis[i]){
      cout<<"No"<<endl;
      return 0;
    }
  cout<<"Yes"<<endl;
  for(int i = 2;i<=n;i++)
    cout<<ans[i]<<endl;
}


Measured memory_bytes: 15648
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int N = sc.nextInt();
			if (N == 0)
				break;
			int[] A = new int[N];
			for (int i = 0; i < N; ++i) {
				A[i] = sc.nextInt();
			}

			solve(N, A);
		}
	}

	void solve(int N, int[] A) {
		boolean[] vis = new boolean[N];
		PriorityQueue<Integer> pq = new PriorityQueue<>();
		for (int v : A) {
			pq.add(v);
		}
		int ans = 0;
		while (!pq.isEmpty()) {
			int v = pq.poll();
			ArrayList<Integer> lis = new ArrayList<>();
			for (int i = 0; i < N; ++i) {
				if (vis[i] || A[i] % v != 0)
					continue;
				for (int j = 0; j < 10; ++j) {
					if (A[i] / v == (1 << j)) {
						lis.add(1 << j);
						vis[i] = true;
					}
				}
			}
			ans = Math.max(ans, calc(lis));
		}
		System.out.println(ans);
	}

	int calc(ArrayList<Integer> lis) {
		int sum = 0;
		for (int v : lis) {
			sum += v;
		}

		int[] dp = new int[sum + 1];
		Arrays.fill(dp, -Integer.MAX_VALUE / 16);
		dp[0] = 0;
		for (int v : lis) {
			for (int i = sum / v * v; i >= v; i -= v) {
				dp[i] = Math.max(dp[i], dp[i - v] + 1);
			}
		}
		int ret = 0;
		for (int i = 1; i <= sum; i <<= 1) {
			ret = Math.max(ret, dp[i]);
		}
		return ret;
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

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

int main() {

  int N, P;
  cin >> N >> P;

  string S;
  cin >> S;

  // Pが2か5の場合
  if (P == 2 || P == 5) {
    long long answer = 0;
    for (int i = 0; i < N; i++) {
      if ((S[i] - '0') % P == 0) {
        answer += i + 1;
      }
    }
    cout << answer << endl;
    return 0;
  }

  // Pが2か5以外の場合
  vector<int> d(N+1);
  int count = 1;
  for (int i = N-1; 0 <= i; i--) {
    int a = (S[i] - '0') * count % P;
    d[i] = (d[i+1] + a) % P;
    count *= 10;
    count %= P;
  }

  vector<int> sum(P);
  long long answer = 0;
  for (int i = N; 0 <= i; i--) {
    answer += sum[d[i]];
    sum[d[i]]++;
  }

  cout << answer << endl;

  return 0;

}

Measured memory_bytes: 1412
#pragma once

#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;

#define rep(a,n) for(int a = 0;a < n;a++)
#define repi(a,b,n) for(int a = b;a < n;a++)

const ull mod = 1000000007;

int main(void)
{
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;
	rep(i, n) {
		cout << s[i] << t[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
# your code goes here
def solve():
	n = int(input())
	a = input().split()
	a = [int(aa) for aa in a]
	
	for aa in a:
		if aa == 0:
			print(0)
			return 0
	
	ans = 1;
	for aa in a:
		ans *= aa;
		if ans > 1e18:
			print(-1)
			return 0
	print(ans)
	
solve()

Measured memory_bytes: 21788
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
 
int main() {
	ios::sync_with_stdio(false);
	int n,m;
	cin >> n >> m;
	int a[n][n],b[m][m];
	char d;
	for (int i=0;i<n;i++) {
		for (int j=0;j<n;j++) {
			cin >> d;
			if ( d == '.' ) a[i][j] = 1;
			else a[i][j] = 0;
		}
	}
	for (int i=0;i<m;i++) {
		for (int j=0;j<m;j++) {
			cin >> d;
			if ( d == '.' ) b[i][j] = 1;
			else b[i][j] = 0;
		}
	}
	if ( n == m ) {
		for (int i=0;i<n;i++) {
			for (int j=0;j<n;j++) {
				if (a[i][j]!=b[i][j]) {
					cout << "No\n";
					return 0;
				}
			}
		}
		cout << "Yes\n";
	} else {
		for (int i=0;i<n-m+1;i++) {
			for (int j=0;j<n-m+1;j++) {
				bool y=0;
				for (int k=0;k<m;k++) {
					for (int l=0;l<m;l++) {
						if ( b[k][l] != a[i+k][j+l] ) {
							y=1;
							break;
						}
					}
				}
				if ( y == 0 ) {
					cout << "Yes\n";
					return 0;
				}
			}
		}
		cout << "No\n";
	}
}

Measured memory_bytes: 256
import java.util.*;
class Main {
  static Scanner scan = new Scanner(System.in);
  public static void main(String[] args) {
  	int N = scan.nextInt();
    int K = scan.nextInt();
    int[] arr = new int[N];
    takeInput(arr);
    System.out.println(minPrice(arr, K));
  }
  private static void takeInput(int[] arr) {
  	for(int i = 0; i < arr.length; i++) {
    	arr[i] = scan.nextInt();
    }
  }
  private static int minPrice(int[] arr, int K) {
  	Arrays.sort(arr);
    int sum = 0;
    for(int i = 0; i < K; i++) {
    	sum += arr[i];
    }
    return sum;
  }
}

Measured memory_bytes: 38872
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<ll> l(n);
    rep(i,n) cin>>l[i];

    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i+1; j < n; ++j) {
            for (int k = j+1; k < n; ++k) {
                if (l[i] != l[j] && l[j] != l[k] && l[i] != l[k]) {
                    if (abs(l[j]-l[k]) < l[i] && l[i] < l[j]+l[k]) ans++;
                }
            }
        }
    }

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

Measured memory_bytes: 3544
#include <iostream>

using namespace std;

using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN_LL(v) ll v;cin>>v;
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<endl
const int MOD = 1000000007;
const int INF = 1000000000;

int main() {
  IN(N);

  ll T = 1, A = 1;
  REP(i, N) {
    IN_LL(t); IN_LL(a);
    ll k = max((T+t-1) / t, (A+a-1) / a);
    T = t * k;
    A = a * k;
  }
  OUT(T+A);

  return 0;
}


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

const int INF = 1001001001;
ll gcd(ll a, ll b){ return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b){ return a/gcd(a,b)*b; }

int main(void){
  int a, b, c;
  cin >> a >> b >> c;
  int d = a%b;
  if(d == c){
    cout << "YES" << endl;
    return 0;
  }
  if(d == 0){
    cout << "NO" << endl;
    return 0;
  }
  REP(i, b){
    if(d*(i+1)%b == c){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>
#include<map>
#include<cmath>
#include<queue>
#include <functional>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define PI 3.141592

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> vNum(N, 0);
	rep(i, N) cin >> vNum[i];

	int result = 0;
	int count = 0;
	int prev = 0;
	rep(i, N)
	{
		if (vNum[i] <= prev)
		{
			++count;
		}
		else
		{
			count = 0;
		}
		result = max(result, count);
		prev = vNum[i];
	}

	printf("%d", result);
}


Measured memory_bytes: 640
#include <iostream>
#include <cstring>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    int  broken[n+1];
    memset(broken,0,sizeof(broken));
    for(int i = 0; i <= m; i++)
    {
        int step;
        cin >> step;
        broken[step] = 1;
    }

    int mod = 1e9+7;
    long long ways[n + 1];
    ways[0] = 1;
    ways[1] = 1;
    ways[2] = 2;
    if(broken[1]==1)
    {
            ways[1] = 0;
            ways[2] = 1;
    }
    if(broken[2]==1)
    {
            ways[2] = 0;
    }
    for(int i = 3; i <= n; i++)
    {
    	
    	ways[i] = (ways[i - 1] + ways[i - 2])%mod;
        if(broken[i]==1)
            ways[i] = 0;
        
    }

    cout << ways[n];
    return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
const int maxn=1002;
ll a[maxn],b[maxn],c[maxn],d[maxn],e[maxn],f[maxn],g[maxn],h[maxn];
ll r1,r2,r3,r4,r5,r6,r7,r8,ans;
int n,m;
int main()
{
	cin>>n>>m;
	ll q1,q2,q3;
	for(int i=1;i<=n;i++)
	{
		cin>>q1>>q2>>q3;
		a[i]=q1+q2+q3; b[i]=q1-q2+q3; c[i]=q1+q2-q3; d[i]=q1-q2-q3;
		e[i]=-q1+q2+q3; f[i]=-q1-q2+q3; g[i]=-q1+q2-q3;h[i]=-q1-q2-q3;
	}
	sort(a+1,a+n+1); sort(b+1,b+n+1); sort(c+1,c+n+1); sort(d+1,d+n+1);
	sort(e+1,e+n+1); sort(f+1,f+n+1); sort(g+1,g+n+1); sort(h+1,h+n+1);
	for(int i=n;i>=n-m+1;i--)
	{
		r1+=a[i]; r2+=b[i]; r3+=c[i]; r4+=d[i];
		r5+=e[i]; r6+=f[i]; r7+=g[i]; r8+=h[i];
	}
	ans=max(max(max(r1,r2),max(r3,r4)),max(max(r8,r5),max(r6,r7)));
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
using System;

namespace abc139_c
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            string[] input = Console.ReadLine().Split(' ');
            int[] h = new int[n];
            for (int i = 0; i < n; i++)
            {
                h[i] = Convert.ToInt32(input[i]);
            }

            int move = 0;
            int ans = 0;
            for (int i = 1; i < n; i++)
            {

                if  (h[i-1] >= h[i])
                {
                    move++;
                }
                else
                {
                    ans = Math.Max(ans, move);
                    move = 0;
                }

            }
            ans = Math.Max(ans, move);
            Console.WriteLine(ans);
            Console.Read();

        }
    }
}

Measured memory_bytes: 25052
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int f=0;
  while(n)
  {
    int d = n%10;
    if(d == 7)
    	f=1;
    n/=10;
  }
  if(f==1)
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}

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

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long;
using pll = pair<ll, ll>;

template<typename T> T gcdraw(T a, T b)
{
    return a ? gcdraw(b%a, a) : b;
}

template<typename T> T gcd(T a, T b)
{
    const auto aa = abs(a), bb = abs(b);
    return aa > bb ? gcdraw(aa, bb) : gcdraw(bb, aa);
}

const ll MAXN = 1000001;
ll P[MAXN + 1];
bool B[MAXN + 1];

void makeLowestPrimeTable()
{
    for (ll i=2;i*i<=MAXN;++i)
    {
        if (P[i]) { continue; }
        for (ll j=i*2;j<=MAXN;j+=i) if(!P[j]) { P[j] = i; }
    }
}

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

    vector<ll> A(N);
    rep (i, N) { cin >> A[i]; }

    makeLowestPrimeTable();

    bool isPairwise = true;
    ll setwiseValue = A[0];

    for (ll i=0;i<N;++i)
    {
        for (ll x=A[i];isPairwise&&x!=1;)
        {
            const auto p = P[x] ? P[x] : x;
            while ((x % p) == 0) { x /= p; }

            isPairwise &= !B[p];
            B[p] = true;
        }

        setwiseValue = gcd(setwiseValue, A[i]);
    }

    if (isPairwise)             { cout << "pairwise coprime" << endl; }
    else if (setwiseValue == 1) { cout << "setwise coprime" << endl; }
    else                        { cout << "not coprime" << endl; }

    return 0;
}


Measured memory_bytes: 18992
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

const int maxn=1e5+10;

vector <int> adg[maxn];

int s;

int dp[maxn];

bool mark[maxn];

void dfs(int v)
{
    mark[v]=1;
    if(adg[v].size()==0)
        return ;
    for(int i=0;i<adg[v].size();i++)
    {
        int u=adg[v][i];
        if(mark[u]==0)
        {
            dfs(u);
        }
        dp[v]=max(dp[v],dp[u]+1);
    }
    if(dp[v]>s)
        s=dp[v];
}

int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        adg[b].push_back(a);
    }
    for(int i=1;i<=n;i++)
    {
        if(mark[i]==0)
        {
            dfs(i);
        }
    }
    cout<<s;
	return 0;
}


Measured memory_bytes: 10752
#include <stdio.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long ll;
const ll M = 200013;
int main()
{
    ll i,m,n;
    scanf("%lld%lld",&n, &m);
    if(n==m)
    printf("Yes\n");
    else
        printf("No\n");
        return 0;
    }


Measured memory_bytes: 128
// 3_abc141_c
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
#define MOD (1000000007)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k, q;
    cin >> n >> k >> q;

    vector<int> b(n);
    rep(i, n){
        b[i] = 0;
    }
    rep(i, q){
        int a;
        cin >> a;
        a--;
        b[a]++;
    }

    rep(i, n){
        if(k - (q - b[i]) > 0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 1024
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T>
vector<T> make_vec(size_t s, T val) { return vector<T>(s, val); }
template<class... Size>
auto make_vec(size_t s, Size... tail) {
	return vector<decltype(make_vec(tail...))>(s, make_vec(tail...));
}

template<class T>
inline bool chmin(T &a, const T b) { return a > b && (a = b, true); }

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, M;
	cin >> N >> M;

	auto edge = make_vec(N, 0, 0);
	for (int i = 0; i < M; i++) {
		int u, v;
		cin >> u >> v;
		u--, v--;
		edge[u].emplace_back(v);
	}

	int s, t;
	cin >> s >> t;
	s--, t--;

	auto dp = make_vec(N, 3, INF);
	dp[s][0] = 0;

	auto dfs = [&](auto &&f, int now) -> void {
	
		for (const auto &e : edge[now]) {

			bool update = false;
			for (int i = 0; i < 3; i++) {
				if (chmin(dp[e][(i + 1) % 3], dp[now][i] + 1)) update = true;
			}
			if(update) f(f, e);

		}

	};

	dfs(dfs,s);
	DMP(dp);

	cout << (dp[t][0] == INF ? -1 : dp[t][0] / 3) << "\n";

	return 0;
}

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

int n,q,sz,w[200005],s[200005],dp[200005];
vector<int> g[200005];
int dat[800005];

void upd(int l,int r,int x){
    l+=sz;r+=sz;
    while(l<=r){
        dat[l]=min(dat[l],x);
        dat[r]=min(dat[r],x);
        l=(l+1)>>1;r=(r-1)>>1;
    }
}

int qry(int x){
    int r=0x3f3f3f3f;
    x+=sz;
    while(x){
        r=min(r,dat[x]);
        x>>=1;
    }
    return r;
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    memset(dat,0x3f,sizeof(dat));
    sz=1;while(sz<n)sz<<=1;
    for(int i=1;i<=n;i++){
        cin>>w[i];
        s[i]=s[i-1]+1-w[i];
    }
    cin>>q;
    while(q--){
        int a,b;
        cin>>a>>b;
        g[b].push_back(a);
    }
    for(int i=1;i<=n;i++){
        upd(i-1,i-1,dp[i-1]-s[i-1]);
        for(int &j:g[i]){
            upd(j,i,qry(j-1));
        }
        dp[i]=min(dp[i-1]+w[i],qry(i)+s[i]);
    }
    cout<<dp[n]<<endl;

    return 0;
}

Measured memory_bytes: 15232
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int INF = 1001001001;
vector<int> to[100005];

int main(){
  int n, m;
  cin >> n >> m;
  REP(i,m){
    int a, b;
    cin >> a >> b;
    --a; --b; //始点を０からにするため
    //ノードにつながる他のノードを配列に格納
    to[a].push_back(b);
    to[b].push_back(a);
  }

  //BFS
  queue<int> q;
  vector<int> dist(n, INF); //すべての要素にINFを代入して初期化
  vector<int> pre(n, -1); //直前の頂点
  //始点の０をキューに入れる
  q.push(0);
  while(!q.empty()){
    //キューの先頭から取り出し
    int v = q.front();
    q.pop();
    //vを訪れる
    for(int u : to[v]){
      if(dist[u] != INF) continue; //既に訪れていたら何もしない
      dist[u] = dist[v] + 1;
      pre[u] = v;
      q.push(u);
    }
  }

  cout << "Yes" << endl;
  REP(i,n){
    if(i == 0) continue;
    int ans = pre[i];
    ++ans; //始点を１に戻す
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 10544
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    int n; cin >> n;
    vector<int> seki(26, 50);
    rep(i, n) {
        string s; cin >> s; int sz = s.size();
        vector<int> tmp(26, 0);
        rep(i, sz) tmp[s[i]-'a']++;
        rep(i, 26) seki[i] = min(seki[i], tmp[i]);
    }
    rep(i, 26) {
        char alp = 'a' + i;
        rep(j, seki[i]) {
            cout << alp;
        }
    }puts("");
}


Measured memory_bytes: 256
while True:
    try:
        array = map(str,raw_input())
        display = []
        for i in range(len(array)):
            if array[i] != '@':
                display.append(array[i])
            elif array[i] == '@':
                insert = int(array[i+1])*array[i+2]
                display.append(insert)
                array[i+1] ,array[i+2]= '',''
            
        for i in range(len(display)-1):
            display[i+1] = display[i]+ display[i+1]

        print display[-1]
    except EOFError:
        break

Measured memory_bytes: 4240