akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
#define overload4(_1,_2,_3,_4,name,...) name
#define rep1(n) for(ll i=0;i<(n);++i)
#define rep2(i,n) for(ll i=0;i<(n);++i)
#define rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep4(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define vec vector<ll>
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;}

vec s;
void init(vec &a){
    s.push_back(0);
    for(ll x:a){
        s.push_back(x+s.back());
    }
}
ll query(ll from,ll to){
    return s[to+1]-s[from];
}

void solve(){
    ll n,m,v,p;
    cin>>n>>m>>v>>p;
    vec a(n);
    rep(i,n)cin>>a[i];
    sort(all(a));
    init(a);
    ll ans=p;
    rep(i,n-p){
        ll r=(v-p-i)*m;
        ll x=a[i]+m;
        if(x>=a[n-p]&&r<=(n-p-i)*x-query(i+1,n-p))ans++;
    }
    cout<<ans<<endl;
}

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


Measured memory_bytes: 2168
#include <queue>
#include <string>
#include <iostream>
using namespace std;
int main () {
  priority_queue<int> S;
  string a; //??????
  while (cin >> a && a != "end") {
    int b; //?????\????????°
    if (a == "insert") {
      cin >> b;
      S.push(b);
    }
    else {
      cout << S.top() << endl;
      S.pop();
    }
  }
}

Measured memory_bytes: 7036
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = INT64_MAX;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;
using Vi = vector<long long int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<=former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
typedef vector<vector<ll> > matrix;
///////////////////////////////////////////////////////////////////////////////////

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll a,b,t;
    cin>>a>>b>>t;
    ll ans = 0;
    rep(i,INF){
        if(i==0)continue;
        if(i*a>t)break;
        ans += b;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

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

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(1, 1E8); \
                 auto rnd = bind(__dis, __gen)

const int INF = 1E18;
const int mod = 1E9 + 7;

int32_t main() {
    fastIO();
    
    string s;
    cin >> s;
    cout << regex_replace(s, (regex)",", " ") << "\n";
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = 3.141592654;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw	 "\n"

int main(void)
{
	CIN;
	ll tc,l,k,sum=0,x=0,y,z=0,m=1,n=0,ans=0,cnt=0;
	cin>>n>>m>>k;
	for(ll i=n;i<=min(m,n+k-1);i++)cout<<i<<nw;
	for(ll i=max(n+k,m-k+1);i<=m;i++)cout<<i<<nw;

}

Measured memory_bytes: 3652
// problem: "https://atcoder.jp/contests/abc123/tasks/abc123_c"

#include<iostream>
#include<vector>
#define ll long long unsigned int

using namespace std;

ll timeN(ll N,ll C)
{
    if(N%C==0)
        return N/C;

    return N/C+1;
}

int main()
{
    ll N,i,t,m;
    vector<ll>V(5);

    cin>>N;
    for(i=0;i!=5;i++)
        cin>>V[i];

    t = 0;
    m = V[0];
    for(i=0;i!=5;i++)
    {
        if(i==0)
        {
            t += timeN(N,V[i]);     // define
        }
        else if(V[i]<m)
        {
            t += timeN(N-V[i]*(t-i),V[i]);
            m = min(m,V[i]);
        }
        else
        {
            t++;
        }

        //cout<<t<<'\n';
    }

    cout<<t;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
ll a,b,m;
cin>>a>>b>>m;
ll arr[a];
for(ll i=0;i<a;i++)
{
    cin>>arr[i];

}

ll brr[b];
for(ll i=0;i<b;i++)
{
    cin>>brr[i];
}
ll min=INT_MAX;
    for(ll i=0;i<m;i++)
    {
        ll x,y,c;
        cin>>x>>y>>c;
        x--;y--;
        ll sum = arr[x]+brr[y]-c;
        if(sum<min)
        {
            min=sum;
        }
    }
    sort(arr,arr+a);
    sort(brr,brr+b);
    if(arr[0]+brr[0]<min)
    {
        ll min=arr[0]+brr[0];;
        cout<<min;
    }
    else
        cout<<min;

}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long k = sc.nextLong();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        final long MOD = 1_000_000_007;
        long inner = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                if (a[i] > a[j]) {
                    inner++;
                }
            }
        }
        inner *= k;
        inner %= MOD;
        long outer = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (a[i] > a[j]) {
                    outer++;
                }
            }
        }
        outer *= (k * (k - 1) / 2) % MOD;
        System.out.println((inner + outer) % MOD);
    }
}


Measured memory_bytes: 27988
#!/usr/bin/env python3

from pprint import pprint
from collections import deque, defaultdict
import itertools
import math
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.buffer.readline
INF = float('inf')


def prime_factor(n):
    res = []
    dividend = n
    divisor = 2
    while divisor ** 2 <= n:
        while dividend % divisor == 0:
            dividend //= divisor
            res.append(divisor)
        divisor += 1
    if dividend != 1:
        res.append(dividend)
    return res


n = int(input())
res = prime_factor(n)
res_str = list(map(str, res))
print(f"{n}: {' '.join(res_str)}")



Measured memory_bytes: 6588
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            var num = int.Parse(Console.ReadLine());
            var que = new Queue<Int64>();
            for (int i = 1; i < 10; i++)
            {
                que.Enqueue(i);
            }
            for(int i = 0; i < num - 1; i++)
            {
                Action(que);
            }
            Console.WriteLine(Action(que));
            Console.ReadKey();
        }
        static Int64 Action(Queue<Int64> que)
        {
            var x = que.Dequeue();
            if (x % 10 != 0) que.Enqueue(10 * x + (x % 10) - 1);
            que.Enqueue(10 * x + (x % 10));
            if (x % 10 != 9) que.Enqueue(10 * x + (x % 10) + 1);
            return x;
        }
    }
}


Measured memory_bytes: 17120
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,m = map(int,ipt().split())
    way = [[] for _ in range(n)]
    for _ in range(m):
        s,t = map(int, ipt().split())
        way[s].append(t)

    cos = [0]*(n+1)
    cos[n] = 0 * n
    for i in range(n-1,0,-1):
        nm = 0
        sm = 0
        for j in way[i]:
            nm += 1
            sm += 1+cos[j]
        cos[i] = sm/nm

    gm = cos[1]
    for i in range(1,n-1):
        nm = 0
        ma = 0
        sm = 0
        for j in way[i]:
            nm += 1
            sm += 1+cos[j]
            if ma < 1+cos[j]:
                ma = 1+cos[j]
        if nm == 1:
            continue
        else:
            cos[i] = (sm-ma)/(nm-1)
        for j in range(i-1,0,-1):
            nm = 0
            sm = 0
            for k in way[j]:
                nm += 1
                sm += 1+cos[k]
            cos[j] = sm/nm
#        print(cos)
        if cos[1] < gm:
            gm = cos[1]

    print(gm)


    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 82832
#include <iostream>
using namespace std;
//---------------------------------------

//---------------------------------------

int main(void)
{
	int min = 2000000001;      
	int num;
	int profit;
	int max_profit = -1000000000;
	
	cin >> num;
	
	for(int i = 0; i < num; i++){
		int now_num;  //?????¨?????????
		cin >> now_num;
		
		//??????
		profit = now_num - min; //?????¨?????????
		if(max_profit < profit){
			max_profit = profit;
		}
		//??????????????´??°
		if(min > now_num){
			min = now_num;
		}
	}
	cout << max_profit << endl;
	
	return 0;
}
//--------------------------------------------

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

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

  int max_l = 1;
  int min_r = 1e5;

  rep(i, m) {
    int l, r;
    cin >> l >> r;
    max_l = max(max_l, l);
    min_r = min(min_r, r);
  }

  int ans = min_r - max_l;
  if (ans >= 0) {
    ans += 1;
  } else {
    ans = 0;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use {
    proconio::{fastout, input, marker::*},
    std::cmp::*,
    std::collections::*,
    std::ops::*,
};

fn main() {
    input! {
        l: usize // [2, 1e6]
    }

    let mut n = 0;
    while l >> n > 0 {
        n += 1;
    }
    let mut ans = vec![];
    for i in 1..n {
        ans.push((i, i + 1, 0usize));
        ans.push((i, i + 1, 1 << (n - i - 1)));
    }

    let mut x = 1 << (n - 1);
    for i in (0..n - 1).rev() {
        if (l >> i) & 1 == 1 {
            ans.push((1, n - i, x));
            x ^= 1 << i;
        }
    }

    println!("{} {}", n, ans.len());
    for (u, v, w) in ans.iter() {
        println!("{} {} {}", u, v, w);
    }
}


Measured memory_bytes: 2160
#include<stdio.h>
#define N 100
int main()
{
    int A[N],j,flag=1,n,a,count=0;
    scanf("%d",&n);
    for(j=0;j<n;j++){
        scanf("%d",&A[j]);
    }

    while(flag!=0){
        flag=0;
        for(j=n-1;j>=1;j--){
            if(A[j]<A[j-1]){
                a=A[j];
                A[j]=A[j-1];
                A[j-1]=a;
                flag=1;
                count++;
            }
        }
    }
    for(j=0;j<n-1;j++){
        printf("%d ",A[j]);
    }
    printf("%d\n",A[n-1]);
    printf("%d\n",count);
    return 0;

}



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

int main(){
         string s = "";
         cin >> s;
         int result = 700;
         for(int i = 0; i < s.length(); i++){
            if(s[i] != 'x')
                result+= 100;
         }
         cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstring>
#define ll  long long
#define endl '\n'
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const long long INF = 1e18L + 5; // 10^18
#define fastIN  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
{
    fastIN
    //freopen("input.in", "r", stdin);
    ll n,x;
    cin>>n;
    ll sum=0,s=0;
    vector<ll>v;
    for(int i=0;i<n;i++){
        cin>>x;
        sum+=x;
        v.push_back(x);
    }
    ll sum1=0,sum2=0;
    for(int i=0;i<n;i++){
        sum1+=v[i];
        sum-=v[i];
        if(sum1>sum){
            sum1-=v[i];
            cout<<min(sum1+v[i]-sum,sum+v[i]-sum1);
                        return 0;
        }
        else if(sum1==sum){
            cout<<0<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3572
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		// TODO 自動生成されたメソッド・スタブ
		Scanner in = new Scanner(System.in);
		int a = in.nextInt(), p = in.nextInt();

		System.out.println((int)((a*3)+p)/2);
	}

}


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

typedef double du ;
typedef string st ;
typedef long long ll ;

int main ()
{
    int numf , tall , cnt = 0 , talls ;

    cin >> numf >> tall ;

    for (int i = 0 ; i < numf ; i ++)
    {
        cin >> talls ;
        if (talls >= tall)
        {
            cnt ++ ;
        }
    }
    cout << cnt << endl ;

    return 0 ;
}


Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const ll MOD = 1e9 + 7; 
const int MINF = -1050000000;


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

int main() {
	
	int n;
	cin >> n;
	vector<int> dp(n+1,n);
	dp[0] = 0;


	rep(i, n) {
		for (int pow6 = 1; i + pow6 <= n; pow6 *= 6) {
			dp[i + pow6] = min(dp[i + pow6], dp[i] + 1);
		}
		for (int pow9 = 1; i + pow9 <= n; pow9 *= 9) {
			dp[i + pow9] = min(dp[i + pow9], dp[i] + 1);
		}
	}

	cout << dp[n] << endl;
	return 0;
}


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

using namespace std;

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

    vector<int> sosu;
    sosu.push_back(2);
    bool flag;
    auto it = sosu.begin();

    if(x == 2){
        cout << 2 << endl;
        return 0;
    }

    // 素数を求めてvectorに入れる
    for(int i = 3; i < x; i++){
        flag = true;
        while(it != sosu.end()){
            if(i % *it == 0) flag = false;
            ++it;
        }
        if(flag) sosu.push_back(i);
        it = sosu.begin();
    }

    // 素数軍団で割り切れないものを探す
    flag = true;
    for(int i = x; flag; ++i){
        it = sosu.begin();
        while(it != sosu.end()){
            if(i % *it == 0) break;
            ++it;
        }
        if(it == sosu.end()){
            flag = false;
            cout << i << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

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

signed main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int L = lcm(C, D);
    int x = B / C - (A - 1) / C;
    int y = B / D - (A - 1) / D;
    int z = B / L - (A - 1) / L;
    dump(x, y, z);
    cout << B - (A - 1) - x - y + z << endl;
    return (0^_^0);
}



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

using namespace std;

typedef long long ll;

int main() {

    int N;

    cin>>N;

    vector<int> a;
    vector<int> b;
    vector<int> c;
    a.resize(N);
    b.resize(N);
    c.resize(N);
    for(int i=0; i<N; ++i)
        cin>>a[i]>>b[i]>>c[i];

    vector<vector<int>> dp;
    dp.resize(N+1);
    for(int i=0; i<N+1; ++i)
        dp[i].resize(3);
    for(int i=0; i<3; ++i)
        dp[0][i] = 0;

    for(int i=0; i<N; ++i)
    {
        dp[i+1][0] = max(dp[i][1]+a[i], dp[i][2]+a[i]);
        dp[i+1][1] = max(dp[i][0]+b[i], dp[i][2]+b[i]);
        dp[i+1][2] = max(dp[i][1]+c[i], dp[i][0]+c[i]);
    }

    cout<<max(max(dp[N][0], dp[N][1]), dp[N][2])<<endl;


    return 0;
}

Measured memory_bytes: 6912
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, m = map(int, input().split())
    edge = [[f_inf] * n for _ in range(n)]
    for _ in range(m):
        a, b = map(int, input().split())
        edge[a - 1][b - 1] = 1
        edge[b - 1][a - 1] = 1

    dp = [[f_inf] * n for _ in range(1 << n)]
    dp[0][0] = 0
    cnt = [[0] * n for _ in range(1 << n)]
    cnt[0][0] = 1
    for S in range(1 << n):
        for v in range(n):
            for u in range(n):
                if v == u or S & (1 << v) or edge[u][v] == f_inf:
                    continue
                if dp[S | (1 << v)][v] > dp[S][u] + edge[u][v]:
                    dp[S | (1 << v)][v] = dp[S][u] + edge[u][v]
                    cnt[S | (1 << v)][v] = cnt[S][u]
                elif dp[S | (1 << v)][v] == dp[S][u] + edge[u][v]:
                    cnt[S | (1 << v)][v] += cnt[S][u]

    mi = min(dp[-2])
    idx = []
    for i in range(n):
        if dp[-2][i] == mi:
            idx.append(i)

    res = 0
    for j in idx:
        res += cnt[-2][j]
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9316
// https://atcoder.jp/contests/abc177/tasks/abc177_e
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

const int SZ = 1e6;

// エラトステネスの篩
template <int N> struct Prime {
    bitset<N + 1> b;
    Prime() : b() {
        // trueで初期化
        b.flip();
        b[0] = b[1] = false;
        for (int i = 2; i <= N; ++i) {
            if (b[i]) {
                for (int j = i * i; j <= N; j += i) {
                    b[j] = false;
                }
            }
        }
    }
};
Prime<SZ> prime;

void solve() {
    int N;
    cin >> N;
    vector<int> A(N), D(SZ + 1);
    for (auto &x : A) {
        cin >> x;
        // 同じ数が重複するケースを考慮
        D[x]++;
    }
    // trueなら "pairwise coprime"
    bool pc = true;

    REP(i, SZ) {
        // 素数の場合
        if (prime.b[i]) {
            int cnt = 0;
            for (int now = i; now <= SZ && cnt <= 1; now += i) {
                cnt += D[now];
            }
            // 共通の素数を含むのでgcd(ALL) >= i
            if (cnt >= 2) {
                pc = false;
                break;
            }
        }
    }
    if (pc) {
        cout << "pairwise coprime" << endl;
    } else {
        int g = A[0];
        for (auto &x : A) {
            g = gcd(g, x);
        }
        if (g == 1)
            cout << "setwise coprime" << endl;
        else
            cout << "not coprime" << endl;
    }
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 19040
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int n;
	char str[105];
	while(scanf("%d%*c%s",&n,str)==2)
	{
		int x=0;
		int maxx=x;
		for(int i=0;i<n;i++)
		{
			if(str[i]=='I')
			x++;
			else
			x--;
			maxx=max(maxx,x);
		}
		printf("%d\n",maxx);
	}
	return 0;
}

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

typedef pair<int,int> P;

int h, w;
string s[12];

void check(vector<P> A, int S){
  
  string t[12];
  
  for(int i=0;i<(int)A.size();i++){
    
    t[i] = s[A[i].first];
    
    t[h-i-1] = s[A[i].second];
    
  }
  
  if( h % 2 == 1 ){
    
    for(int i=0;i<h;i++){
      
      if( S >> i & 1 ) continue;
      
      t[h/2] = s[i];
      
    }
    
  }
  
  int S2 = 0;
  
  for(int i=0;i<w;i++){
    
    if( S2 >> i & 1 ) continue;
    
    for(int j=i+1;j<w;j++){
      
      if( S2 >> j & 1 ) continue;
      
      int flag = 1;
      
      for(int k=0;k<h;k++){
	if( t[k][i] != t[h-k-1][j] ) flag = 0;
      }
      
      if( flag == 1 ){
	S2 |= ( 1 << i ) | ( 1 << j );
	break;
      }
      
    }
    
  }
      
  if( w % 2 == 0 && __builtin_popcount(S2) == w ){
    cout << "YES" << endl;
    exit(0);
  }
  
  if( w % 2 == 1 && __builtin_popcount(S2) == w - 1 ){
    
    for(int i=0;i<w;i++){
      
      if( S2 >> i & 1 ) continue;
      
      int flag = 1;
      
      for(int j=0;j<h;j++){
	if( t[j][i] != t[h-j-1][i] ) flag = 0;
      }
      
      if( flag == 1 ){
	cout << "YES" << endl;
	exit(0);
      }
      
    }
    
  }
  
}

void dfs(vector<P> A, int S, int X){
  
  if( h - __builtin_popcount(S) <= 1 ){
    
    check( A, S );
    
    return;
  }
  
  int idx = -1;
  
  for(int i=0;i<h;i++){
    
    if( i == X ) continue;
    
    if( S >> i & 1 ) continue;
    
    idx = i;
    
    break;
    
  }
  
  if( idx == -1 ) return;
  
  for(int i=idx+1;i<h;i++){
    
    if( i == X ) continue;
    
    if( S >> i & 1 ) continue;
    
    vector<P> nA = A;
    
    nA.push_back(P( idx, i ));
    
    int nS = S | ( 1 << idx ) | ( 1 << i );
    
    dfs( nA, nS, X );
    
  }
  
}

signed main(){
  
  cin>>h>>w;
  
  for(int i=0;i<h;i++) cin>>s[i];
  
  if( h % 2 == 0 ) dfs( vector<P>(0), 0, -1 );
  else{
    for(int i=0;i<h;i++) dfs( vector<P>(0), 0, i );
  }
  
  cout << "NO" << endl;
  
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner scanner = new Scanner(System.in);
    int consecutiveValue = scanner.nextInt();
    int includedValue = scanner.nextInt();
    
    int startValue = includedValue - (consecutiveValue - 1); 
    int times = (consecutiveValue - 1) * 2; 
    for(int i = 0; i <= times; i++) {
    	System.out.print(startValue + " ");
    	startValue++;
    }
  }
}


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

vector<pair<ll, ll>> prime_factorize(ll n)
{
  vector<pair<ll, ll>> res;
  for (ll i = 2; i * i <= n; i++)
  {
    if (n % i != 0)
    {
      continue;
    }
    ll ex = 0;
    while (n % i == 0)
    {
      ex++;
      n /= i;
    }
    res.push_back({i, ex});
  }
  if (n != 1)
  {
    res.push_back({n, 1});
  }
  return res;
}

int main()
{
  ll n;
  cin >> n;
  const auto &res = prime_factorize(n);
  ll ans = 0;
  for (ll i = 0; i < res.size(); i++)
  {
    ll x = res[i].second;
    ll b = 1;
    while (b <= x)
    {
      x -= b;
      b++;
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3584
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        this.BaseNum = Reader.ReadLine();

        long ans = GetAns(0, BaseNum[0].ToString());
        Console.WriteLine(ans);
    }


    string BaseNum;
    private long GetAns(int idx, string subNum) {
        if(idx>=BaseNum.Length - 1) {
            return subNum.Split('+').Select(a => long.Parse(a)).Sum();
        }
        long ans = 0;

        ans += GetAns(idx + 1, subNum + "+" + BaseNum[idx + 1]);
        ans += GetAns(idx + 1, subNum + BaseNum[idx + 1]);
        return ans;
    }

    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"


125


";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}

Measured memory_bytes: 11348
#include<iostream>
using namespace std;
int main()
{
  string  s;
  cin>>s;

  int m = 0;
  int ans = 0;
  for(int i = 0;i<3;i++)
  {
      if(s[i]=='R')
      {
          m++;
      }
      else
      {
          ans = max(ans,m);
          m = 0;
      }
  }
  ans= max(ans,m);
  cout<<ans;

}


Measured memory_bytes: 3624
#include <iostream>
#include <math.h>
using namespace std;

int main() {
    int D, N;
    cin >> D >> N;

    int t = 1;
    while (D--) t *= 100;

    if (N < 100) cout << N * t << endl;
    else cout << 101 * t << endl;
    
    return 0;
}

Measured memory_bytes: 256
#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;
	string s,t;
	cin >> s >> t;
	rep(i,n){
		cout << s[i] << t[i] ;
	}
	cout << endl;
}

Measured memory_bytes: 3580
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    long long A, B, K;
    cin >> A >> B >> K;
    if (A > K) {
        cout << A - K << " " << B << "\n";
    } else if (K < A + B) {
        cout << 0 << " " << A + B - K << "\n";
    } else {
        cout << 0 << " " << 0 << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
n=int(input())
s=[0]*n
for i in range(n):
    s[i] = input()
    
lis = set(s)
dic = {ss:0 for ss in lis }
for ss in s:
    dic[ss]+=1
    
ma = max(dic.values())
ans = [k for k,v in dic.items() if v==ma]
ans.sort()
print("\n".join(ans) )

Measured memory_bytes: 121296
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp(a, b) make_pair(a, b)
#define pb(t) push_back(t)
#define ft first
#define sc second
#define pt(num) cout << num << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

ll N;
ll l[10];
ll a, b, c;

ll dfs(string s) {
    ll res=INF;
    
    if(s.size()==N) {
        ll ta=0, tb=0, tc=0;
        ll cnt=N;
        for(ll i=0; i<N; i++) {
            if(s[i]=='0') ta+=l[i];
            else if(s[i]=='1') tb+=l[i];
            else if(s[i]=='2') tc+=l[i];
            else cnt--;
        }
        
        if(ta==0 || tb==0 || tc==0) return INF;
        return abs(ta-a)+abs(tb-b)+abs(tc-c)+10*(cnt-3);
    }
    
    for(char c='0'; c<'4'; c++)
        chmin(res, dfs(s+c));
    
    return res;
}

int main(void) {
    cin >> N;
    cin >> a >> b >> c;
    for(ll i=0; i<N; i++) cin >> l[i];
    
    pt(dfs(""));
}




Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
using namespace std;
int main(void){
    char str1[101], str2[101], str3[201];
    scanf("%s %s", str1, str2);
    strcpy(str3, str1);
    strcat(str3, str1);
    if(strstr(str3, str2)) printf("Yes\n");
    else printf("No\n");

    return 0;
}



Measured memory_bytes: 2672
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl
#define printD(a) cout << setprecision(15) << (a) << endl
using namespace std;
int max_int = 2147483647;
int prime = 10e9+7;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<auto>& a,int n);
double PI = 3.14159265358979;
int n;




signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int k;
    cin >> n >> k;
    int r,s,p;
    cin >> r >> s >> p;
    string S;
    cin >> S;
    REP(i,k){
        int tmp = k;
        while(tmp+i<n){
            if(S[i+tmp] == S[i+tmp-k]){
                S[i+tmp] = 'x';
            }
            tmp += k;
        }
    }
    int ans = 0;
    REP(i,n){
        switch (S[i])
        {
        case 'r':
            ans += p;
            break;
        case 's':
            ans += r;
            break;
        case 'p':
            ans += s;
            break;
        default:
            break;
        }
    }
    print(ans);
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}

//key以上の初めてのitr
int nibul(auto a,auto b){return lower_bound(All(a),b) - a.begin();}
//key以下の最後のitr
int nibuu(auto a,auto b){return upper_bound(All(a),b) - a.begin()-1;}

void input(vector<auto>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
	
	int n, a, max = 0, b, ans;

	cin >> n;

	for( int i = 0 ; i < n ; i++ ){
		cin >> a >> b;
		
		if( a > max ){
			max = a;
			ans = a+b;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long int 
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define from(i,n)       for(int i=0;i<(int)n;i++)
#define from_j(i,j,n)   for(int i=j;i<(int)n;i++)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
 
int32_t main()
{
    c_p_c();
    int n,k ; cin>>n>>k;
    int arr[n+1]={0};
    while(k--){
        int d; cin>>d;
        while(d--){
            int a; cin>>a;
            arr[a]++;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(!arr[i])ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

signed main(){
    cin.tie(0); 
    ios::sync_with_stdio(false);
    int n;
    int p[25];
    int ans=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>p[i];
    }
    for(int i=1;i<n-1;i++){
        if(p[i] > p[i-1] && p[i] < p[i+1] || p[i] < p[i-1] && p[i] > p[i+1]){
            ans++;
        }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m;
  cin>>n>>m;
  int arr[n];
  for(int i=0;i<n;i++) cin>>arr[i];
  vector<int> ar[n];
  for(int i=0;i<m;i++)
  {
    int a,b;
    cin>>a>>b;
    ar[a-1].push_back(b-1);
    ar[b-1].push_back(a-1);
  }
  int an=0;
  for(int i=0;i<n;i++)
  {
    int maxi=INT_MIN;
    for(int j=0;j<ar[i].size();j++)
       maxi=max(maxi,arr[ar[i][j]]);
    if(maxi<arr[i])
       an++;
  }
  cout<<an<<endl;
  return 0;
}  


Measured memory_bytes: 9156
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
typedef long long ll;
using namespace std;

int main(void) {
  cout << fixed << setprecision(12);
  ll n, k;
  cin >> n >> k;
  ll ans = k;
  for(int i = 0; i < n - 1; i++) {
    ans *= k - 1;
  }

  cout << ans << endl;

  return 0;
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> ord(N);
  rep(i, 0, N) {
    cin >> A[i];
    ord[i] = i;
  }
  sort(All(ord), [&] (int a, int b) {
    return A[a] > A[b];
  });
  sort(All(A));
  reverse(All(A));
  vector<int> ans(N);
  rep(i, 0, N) {
    int Ai = A[i];
    int idx = ord[i];
    if (i == 0) {
      ans[idx] = A[1];
    } else {
      ans[idx] = A[0];
    }
  }
  rep(i, 0, N) {
    cout << ans[i] << endl;
  }
};


Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
int main() {
	// your code goes here
	int h,w,n;
	cin>>h>>w>>n;
	int m=h>w? h:w;
	if(n%m==0)
	cout<<n/m<<endl;
	else
	cout<<n/m+1<<endl;
	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 rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;

int main(){
  int n;
  cin >> n;
  map<int,int> mp;
  rep(i,n){
    int x;
    cin >> x;
    mp[x]++;
  }
  vector<pair<ll,ll>> m;
  for(auto p : mp){
    if(p.second >= 2){
      m.push_back(make_pair(p.first,p.second));
    }
  }
  if(m.size() == 0){
    cout << 0 << endl;
    return 0;
  }
  sort(m);
  reverse(m);
  if(m[0].second >= 4){
    cout << m[0].first * m[0].first << endl;
    return 0;
  }
  cout << m[0].first * m[1].first << endl;
}

Measured memory_bytes: 4992
n=int(input())
h=list(map(int,input().split()))
dp=[10**10]*n #最小化問題なので，デカい値に初期化
dp[0]=0 #初期条件
for i in range(1,n):
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])



Measured memory_bytes: 52208
#include <iostream>
using namespace std;
int main(void){
   int H,W;
   while(true){
       cin >> H >> W;
       for(int i=0;i<H;i++){
           for(int j=0;j<W;j++){
               if((i+j)%2==0){
                   cout << "#";
               }
               else{
                   cout << ".";
               }
           }
       cout << endl;
       }if(W == 0 && H == 0){
           break;
       }
       cout << endl;
   }
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define int long long int
#define double long double
#define inf (int)(1e15)
#define all(x) (x).begin(), (x).end()
#define pair pair<int, int>
typedef vector<int> vi;   // Vector of long long
typedef vector<vi> vvi;   // Vector of vi
typedef vector<pair> vii; // Vector of pairs
typedef vector<vii> vvii; // Vector of Vector of pairs
typedef vector<bool> vb;  // Vector of bool
#define pq priority_queue // Max heap (To convert to min heap, use negative sign before every value)
#define ff first          // For pairs
#define ss second
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, -1, 0, 1};
const int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}, dy8[] = {1, -1, 1, 0, -1, 1, -0, -1};
#define testcases(t) \
    int(t);          \
    cin >> (t);      \
    while ((t)--)
int c[10][10], n, ans = 0, head, tail, num;
signed main()
{
    cin >> n;
    memset(c, 0, sizeof(c));
    for (int k = 1; k <= n; k++)
    {
        num = k;
        tail = num % 10;
        while (num > 0)
        {
            if (num <= 9)
                head = num;
            num /= 10;
        }
        c[head][tail]++;
    }
    for (int i = 1; i <= 9; i++)
    {
        for (int j = 1; j <= 9; j++)
        {
            ans += (c[i][j] * c[j][i]);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000000)

N, M, X = map(int, input().split())
Matrix = []

for _ in range(N):
    row = list(map(int, input().split()))
    Matrix.append(row)

U = [0] * (M + 1)
def rec(ans, pos):
    if pos == N:
        return ans
    row = Matrix[pos]
    for i in range(M  + 1):
        U[i] += row[i]

    for u in U[1:]:
        if u < X:
            ans = min(rec(ans, pos + 1), ans)
            break
    else:
        ans = min(U[0], ans)

    for i in range(M  + 1):
        U[i] -= row[i]
    return min(rec(ans, pos + 1), ans)

ans = rec(float('inf'), 0)
if ans == float('inf'):
    ans = -1
print(ans)

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

#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef long double ld;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

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

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





int main(){

    bool flag=false;
    ll ans=0,sum=0;

    char c;
    cin>>c;

    if(isupper(c))flag=true;

    //cout <<fixed<<setprecision(16)<< << endl;
    if(flag)cout << "A" <<endl;
    else cout << "a" <<endl;

    return 0;
}


Measured memory_bytes: 3540
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int gcd(int a, int b) {
  int v0=a, v1=b, v2=v0%v1;
  while(v2>0) {
    v0 = v1;
    v1 = v2;
    v2 = v0%v1;
  }
  return v1;
}

int main() {
  int K;
  cin>>K;
  int ans = 0;
  for(int a=1;a<=K;++a) {
    for(int b=1;b<=K;++b) {
      for(int c=1;c<=K;++c) {
        ans += gcd(a, gcd(b, c));
      }
    }
  }
  cout<<ans<<endl;
}



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

int main() {
  int a, b;
  string op;

  while (true) {
    cin >> a >> op >> b;

    if (op == "+")
      cout << a + b << endl;
    else if (op == "-")
      cout << a - b << endl;
    else if (op == "*")
      cout << a * b << endl;
    else if (op == "/")
      cout << a / b << endl;
    else
      break;
  }
}



Measured memory_bytes: 3144
#include <iostream>
using namespace std;
int main(){
    //cout << "Hgjnreair" << endl;

    string a1,a2,a3;

    cin >> a1 >> a2>>a3;

    if(a1[a1.length()-1] == a2[0] && a2[a2.length()-1] == a3[0]){

        cout << "YES" << endl;
    }else{

        cout << "NO" << endl;

    }

    


    return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
h_deff = []
ans = 0
ans_list = []
for i in range(1,n):
  h_deff.append(h[i-1]-h[i])
for j in range(n-1):
  if h_deff[j] >= 0:
    ans += 1
  else:
    ans_list.append(ans)
    ans = 0
ans_list.append(ans)
print(max(ans_list))

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

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define mp1(a,b,c) P1(a,P(b,c))
#define pque(a) priority_queue<a>
#define rpque(a) priority_queue<a,vector<a>,greater<a>>

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
const int kaijou[10]={1,1,2,6,24,120,720,5040,40320,362880};

int main(){
	static ll n,l;
	static ll a[100010];
	
	scanf("%lld%lld",&n,&l);
	rep1(i,n){
		scanf("%lld",&a[i]);
	}
	
	vector<P> vec;
	rep1(i,n){
		vec.pb( P ( a[i] , i ) );
	}
	sor(vec);
	rev(vec);
	
	static ll ret = 0;
	static ll dp[100010] = {};
	
	rep(i,vec.size()){
		int p = vec[i].sc;
		dp[p] = max( dp[p-1] , dp[p+1] ) + l-a[p];
		ret = max ( ret , dp[p] );
	}
	
	printf("%lld\n",ret);
}

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

typedef ostringstream OSS;
typedef istringstream ISS;

typedef long long LL;
typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<PII> VPII;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x) (x).begin(),(x).end()
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a) { OSS oss; oss << a; return oss.str(); };

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int H, W;

PII solve() {
    PII res;
    PII min_dh(INF, INF);

    PII this_dh(H * H + W * W, H);

    // x > y
    for (int y = 1; y <= 150; y++) {
        for (int x = y + 1; x <= 150; x++) {
            PII dh(x * x + y * y, y);
            if (this_dh < dh && dh < min_dh) {
                min_dh = dh;
                res = MP(y, x);
            }
        }
    }

    return res;
}

int main(void) {
    while (cin >> H >> W, H) {
        PII ans = solve();
        cout << ans.fst << " " << ans.snd << endl;
    }

	return 0;
}

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

int main()
{
	int n;
	cin>>n;
	if(n==25)
	{
	    cout<<"Christmas";
	    return 0;
    }
	else if(n==24)
	{
	    cout<<"Christmas Eve";
	    return 0;
	}
	else if(n==23)
	{    
	    cout<<"Christmas Eve Eve";
	    return 0;
	}
	else
	{
	    cout<<"Christmas Eve Eve Eve";  
	    return 0;
	}
} 

Measured memory_bytes: 256