akhauriyash/Code-Regression huggingface dataset:
#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 ld long double
#define pb push_back
#define eb emplace_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 llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

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

void print() {
  cout << endl;
}

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}

template <class T>
void print(vector<T> &vec, ll k){
   ll n = vec.size();
   k = min(k, n);
   rep(i, 0, k-1) cout << vec[i] << " ";
   cout << vec[k-1] << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
}

template<class T, class U>
void print(pair<T,U> &p){
  cout << p.first << " " << p.second << "\n";
}

const int LOG = 64;
const int MAX_N = 200005;
vvi to(LOG, vi(MAX_N)); // to[i][j]: jの2^i個先

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

  int N;
  ll K;
  cin >> N >> K;
  vi a(N);
  rep(i, 0, N) {
    cin >> to[0][i];
    to[0][i]--;
  }

  rep(i, 0, LOG-1) {
    rep(j, 0, N) {
      to[i+1][j] = to[i][to[i][j]];
    }
  }

  int v = 0;
  // for (int i = LOG-1; i >= 0; --i) {
  //   if ((K >> i) & 1) {
  //     v = to[i][v];
  //   }
  // }

  rep(i, 0, LOG) {
    if ((K >> i) & 1) {
      v = to[i][v];
    }
  }

  cout << v + 1 << endl;
  return 0;
};


Measured memory_bytes: 54292
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

from itertools import accumulate
acc = a
acc = list(accumulate(acc))

def dfs(ind,prev,tmp,ans):
    if ind == n:
        return ans
    now = acc[ind]

    if prev > 0:
        if now + tmp >= 0:
            ans +=abs(now + tmp +1)
            tmp += -(now + tmp +1)
    elif prev < 0:
        if now + tmp <= 0:
            ans +=abs(now + tmp -1)
            tmp += -(now + tmp -1)

    return dfs(ind+1, now+tmp,tmp,ans)

ansM = dfs(0,-1,0,0)
ansP = dfs(0,+1,0,0)

print(min(ansM,ansP))


Measured memory_bytes: 105032
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int ans = N * 2;
        if(N % 2 == 0){
            ans = N;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cstdlib>
#include <math.h>
#include<algorithm>
using namespace std;

int main(int argc,char** argv)
{

	int r;
	cin >> r;

	if(r<1200){
		cout << "ABC" << endl;
	}
	else if(r<2800){
		cout << "ARC" << endl;
	}
	else{
		cout << "AGC" <<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n,m;
  cin>>n>>m;
  vi P(m);
  vl Y(m);
  vector<pair<ll,int>> city(m);
  rep(i,m){
    cin >> P[i] >> Y[i];
    city[i].fi = Y[i];
    city[i].se = i;
  }
  vi C(n+1,0);
  sort(rng(city));
  vector<string> ans(m);
  for(auto it : city){
    C[P[it.se]]++;
    int x = C[P[it.se]];
    std::ostringstream ss;
    ss << std::setw(6) << std::setfill('0') << P[it.se]<< std::setw(6) << std::setfill('0') <<x;
    ans[it.se] = ss.str();
  }
  rep(i,m){
    cout<<ans[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 10112
#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 a, b, c;
    cin >> a >> b >> c;
    if (b-a == c-b) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#ifdef _DEBUG
#define _CRT_SECURE_NO_WARNINGS
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define MGN 8
#define LINF (LONG_MAX/2)
using namespace std;
typedef long long ll; typedef unsigned long long ull;
typedef vector<int> vi; typedef vector<vi> vvi; 
typedef vector<ll> vl; typedef vector<vl> vvl;
typedef vector<double> vd; typedef vector<string> vs;
typedef pair<int, int> pii; typedef pair<ll, ll> pll;
typedef vector<bool> vb; typedef vector<vb> vvb;
template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
    return left.second > right.second;}
vs split(string str, char sep) {
    vs v; stringstream ss(str); string t;
    while (getline(ss, t, sep)) v.push_back(t);
    return v;}
vs re_search_g(string s, regex re) {
    vs ret; smatch mc; auto it = s.cbegin();
    while (regex_search(it, s.cend(), mc, re)) {
        ret.push_back(mc[0]);
        it += mc.position(0) + mc.length();}
    return ret;}
#endif

void init_global_B() {}


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N; cin >> N;
    vi l(N), r(N); REP(i, N) cin >> l[i] >> r[i];

    vi e(1e5 + MGN, 0);
    REP(i,N){
        e[l[i]]++;
        e[r[i] + 1]--;
    }

    int L = e.size();
    FOR(x, 1, L) e[x] += e[x - 1];

    int ans = 0;
    FOR(x,0,L) {
        if (e[x] > 0) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i ,a, b) for (int i = a ; i <= b ; i++)
#define sz(a) int(a.size())
#define cuti(a) cout << a << endl;
#define cutii(a,b) cout << a << " " << b << endl;
#define cutiii(a,b,c) cout << a << " " << b << " " << c << endl;
#define vec(a) vector<int > a;

template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }

typedef long long LL;
typedef pair<int ,int > pii;
typedef pair<string ,int > psi;
typedef pair<string ,string > pss;
typedef pair<LL, LL> pLL;

const long long oo = 1e9 + 7;

string s;
int cnt;
pair<int ,int > b[12345];

int main(){
   // freopen("test.txt","r",stdin);
    cin >> s;
    string t = "";
    for (int i = 0 ; i < s.size()  ; i++) {
        if ( s[i] != 'x') t += s[i];
    }
    int i = 0 , j = s.size() - 1;
    while ( i <= j) {
        if ( s[i] != s[j]) {
            if (s[i] == 'x') cnt++, i++;
            else if ( s[j] == 'x') cnt++, j--;
            else {
                cout << -1 << endl;
                return 0;
            }
        } else {
            i++;
            j--;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 640
// Created by sz
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    vector<int> x(n);
    int mi = 1000, mx = -1;
    for (int i = 0; i < n; i++){
        cin >> x[i];
        mx = max(mx, x[i]);
        mi = min(mi, x[i]);
    }
    
    
    ll ans = 1e18;
    
    auto sqr = [](int p,int d){
        return (ll)(p-d)*(p-d);
    };
    for (int i = mi; i <= mx; i++){
        ll cur = 0;
        for (int j = 0; j <n; j++){
            cur += sqr(x[j], i);
        }
        ans  = min(ans, cur);
    }
    
    cout << ans << "\n";
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 
#define dump(x)  cout << #x << " = " << (x) << endl;
typedef long long lint;
using namespace std;
int main(){
	vector<vector<int>>a(3,vector<int>(3,-1));
	rep(i,3)rep(j,3)cin>>a.at(i).at(j);
	int n;
	cin>>n;
	vector<int>b(n);
	rep(i,n)cin>>b.at(i);
	rep(i,n)rep(j,3)rep(k,3)if(b.at(i)==a.at(j).at(k))a.at(j).at(k)=0;
	rep(i,3){
		if(!((a.at(i).at(0)||a.at(i).at(1)||a.at(i).at(2))&&(a.at(0).at(i)||a.at(1).at(i)||a.at(2).at(i)))){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	if(!(a.at(0).at(0)||a.at(1).at(1)||a.at(2).at(2))){
			cout<<"Yes"<<endl;
			return 0;
	}
	if(!(a.at(0).at(2)||a.at(1).at(1)||a.at(2).at(0))){
			cout<<"Yes"<<endl;
			return 0;
	}
	cout<<"No"<<endl;
}


Measured memory_bytes: 256
import collections
n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)

p = []
ans = 0
for k,v in c.items():
    ans += 1
    if v != 1:
        p.append([k,v])
p.sort()
lef = 0
rig = len(p)-1

while True:
    if lef == rig:
        if p[lef][1] % 2 == 1:
            print(ans)
            exit()
        elif p[lef][1] % 2 == 0:
            print(ans-1)
            exit()
    elif lef > rig:
        print(ans)
        exit()
    p[lef][1] -= 1
    p[rig][1] -= 1
    if p[lef][1] == 1:
        lef += 1
    if p[rig][1] == 1:
        rig -= 1

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

const int M = 998244353, maxn = 2e5+5;
struct Point
{
    int x, y;
} pts[maxn];
int N;

struct Node {
	int s, e, m;
	//covers s,e;
	int sum;
	Node *l, *r;
	
	Node(int a, int b) {
		s = a;
		e = b;
		sum = 0;
		if (s != e) {
			m = (s+e)/2;
			l = new Node(s,m);
			r = new Node(m+1,e);
		}
		else {
			l = NULL;
			r = NULL;
		}
	}

	void add(int i, int x) {
		if (s == e) {
			sum += x;
			return;
		}
		if (i <= m) {
			l->add(i,x);
		}
		else if (i > m) {
			r->add(i,x);
		}
		else assert(false);
		sum = l->sum + r->sum;
	}

	int getsum(int st, int en) {
        assert(st <= en);
		if (st <= s && e <= en) {
			return sum;
		}
		int ret = 0;
		if (st <= m) {
			ret += l->getsum(st,en);
		}
		if (en > m) {
			ret += r->getsum(st,en);
		}
		return ret;
	}
};

int modexp(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b&1) res = (1LL*res*a) % M;
        a = (1LL*a*a) % M;
        b >>= 1;
    }
    return res;
}

void madd(int& a, int b) {
    a = (a+b) % M;
}
void msub(int& a, int b) {
    a = (a-b+M) % M;
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> N;
    set<int> xs, ys;
    for (int i = 0; i < N; i++) {
        int x, y; cin >> x >> y;
        pts[i] = {x,y};
        xs.insert(x);
        ys.insert(y);
    }
    int pt = 1;
    sort(pts,pts+N,[](auto a, auto b) {
            return a.x < b.x;
            });
    for (int i = 0; i < N; i++) {
        pts[i].x = pt++;
    }
    pt = 1;
    sort(pts,pts+N,[](auto a, auto b) {
            return a.y < b.y;
            });
    for (int i = 0; i < N; i++) {
        pts[i].y = pt++;
    }
    //now they are compressed
    sort(pts,pts+N,[](auto a, auto b) {
            return a.x < b.x;
            });
    Node *root = new Node(0,N+1);
    int ans = 0;
    for (int i = 0; i < N; i++) {
        //cout << i << endl;
        int x = pts[i].x;
        int y = pts[i].y;
        madd(ans,modexp(2,N));
        //take out up, down, left, right
        msub(ans,modexp(2,N-y));
        msub(ans,modexp(2,y-1));
        msub(ans,modexp(2,N-x));
        msub(ans,modexp(2,x-1));
        //add back corners
        int leftup = root->getsum(y,N);
        madd(ans,modexp(2,leftup));
        madd(ans,modexp(2,(N-y)-leftup));

        int leftdown = root->getsum(1,y);
        /*
        cout << x << ' ' << y << '\n';
        cout << "left up : " << leftup << '\n';
        cout << "left down : " << leftdown << '\n';
        */
        madd(ans,modexp(2,leftdown));
        madd(ans,modexp(2,(y-1)-leftdown));
        
        madd(ans,-1);

        root->add(y,1);
    }
    cout << ans << '\n';
}



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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define has(c,i) ((c).find(i) != end(c))
#define DBGDO(X) ({ if(1) cerr << "DBGDO: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n; cin >> n;
	vl a(n), b(n);
	FOR(i,0,n) cin >> a[i] >> b[i];

	ll res = 0;
	FORD(i,0,n) {
		ll need = (b[i] - (a[i]+res) % b[i]) % b[i];
		res += need;
	}
	cout << res << endl;

}



Measured memory_bytes: 1792
import java.util.Scanner;

/**
 * The Number of Even Pairs
 * 
 * https://atcoder.jp/contests/abc159/tasks/abc159_a
 */
public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) throws Exception {
        int N = sc.nextInt();
        int M = sc.nextInt();

        int ans = N * (N - 1) / 2 + M * (M - 1) / 2;

        System.out.println(ans);
    }

}


Measured memory_bytes: 35676
n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = [1] * n
for i in range(m):
    a, b = map(int, input().split())
    if h[a-1] == h[b-1]:
        ans[a-1] = 0
        ans[b-1] = 0
    elif h[a-1] > h[b-1]:
        ans[b-1] = 0
    elif h[a-1] < h[b-1]:
        ans[a-1] = 0
print(sum(ans))

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

int main() {
	int n;
	cin >> n;
	unordered_set<string> m;
	string s;
	for(int i = 0; i < n; ++i) {
		cin >> s;
		m.insert(s);
	}
	cout << m.size() << "\n";
	return 0;
}

Measured memory_bytes: 17792
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll mod = 1000000007LL;
ll dp[100005][13];

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

    int n = s.size();

    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        if (s[i] == '?') {
            rep (k, 10) {
                int c = k;
                rep (j, 13) {
                    dp[i + 1][(10 * j + c) % 13] += dp[i][j];
                }
            }
        }
        else {
            int c = s[i] - '0';
            rep (j, 13) {
                dp[i + 1][(10 * j + c) % 13] += dp[i][j];
            }
        }
        rep (j, 13) dp[i + 1][j] %= mod;
    }
    
    cout << dp[n][5] << endl;
    return 0;
}

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

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    char d = 'a' - 'A';
    cout << (char)(a[0] - d) << (char)(b[0] - d) << (char)(c[0] - d) << endl;

    return 0;
}


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

using namespace std;

typedef long long ll;

int main() {
    int n;  cin >> n;
    vector<ll> a(n), b(n), c(n);
    for (int i = 0; i < n; i++)
        cin >> a[i] >> b[i] >> c[i];

    vector<vector<ll> > dp(n+1, vector<ll>(3));
    dp[0][0] = 0, dp[0][1] = 0, dp[0][2] = 0;

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

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

    return 0;
}

Measured memory_bytes: 11020
#include <bits/stdc++.h>
//#pragma GCC optimize("O2")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse4")
using namespace std;

# define mp make_pair
# define pb push_back
# define PI acos(-1)
# define ff first 
# define ss second 
# define endl '\n'
# define vt vector
# define all(c) (c).begin(), (c).end()
# define rep(i,a,b) for(ll i = a ; i < b ; ++i)

typedef long long ll ; 
typedef long double ld ; 
typedef pair<int,int> pii ; 
typedef pair<ll,ll> pll ;

template<class T> bool umin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool umax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

const int MOD = 998244353  ;
const ll inf = 1e18 ;  
const ll mod = 1e9+7 ;  
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T lcm(T a, T b) { return (a*b)/gcd(a,b) ; }
template<typename T> T power(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }
ll nCr(ll n,ll r){ll t=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){t*=(n-i);t/=(i+1);}return t;}

void read(vt<int> &a) {
    rep(i,0,a.size()) 
        cin >> a[i] ; 
}
void read(vt<ld> &a) {
    rep(i,0,a.size()) 
    cin >> a[i] ; 
}

bool prime(ll t) {
    for(ll i  =2 ; i*i <= t ; ++i) {
        if(t%i==0) 
            return 0 ; 
    }
    return 1 ; 
}
bool cmp(pii &a , pii &b) {
    if(a.ss == b.ss) 
        return a.ff > b.ff ; 
    return a.ss < b.ss ; 
}

// ==========Start Here==============
const int N = 1e6 + 1 ; 




int main() 
{ 
    int n ; 
    cin >> n ; 
    vt<int> a(n) ; 
    unordered_map<int,int> cnt ; 
    int x ; 
    rep(i,0,n)  {
        cin >> a[i] ;  
        ++cnt[a[i]] ; 

    }

    int g = 0 ; 
    rep(i,0,n) {
        g = gcd(g,a[i]) ; 
    }
    if(g>1) {
      cout << "not coprime"; 
      return 0 ; 
    }

    for(int i = 2 ; i < N ; ++i) {
        int tmp =0 ; 
        for(int j = i ; j < N ; j += i ) 
            tmp += cnt[j] ; 
        if(tmp > 1) {
            cout << "setwise coprime" ; 
            return 0 ; 
        }
    }
    cout << "pairwise coprime" ; 
    

    return 0; 
} 


Measured memory_bytes: 46520
import java.util.*;
public class Main {
	
	static int time=0,visit[],tstamp[][];
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		List<List<Integer>> ls=new ArrayList<>();
		visit=new int[n]; tstamp=new int[n][2];
		
		for(int i=0;i<n;i++) {
			int u=Integer.parseInt(in.next()),k=Integer.parseInt(in.next());
			
			ls.add(new ArrayList<>());
			for(int j=0;j<k;j++) {
				ls.get(u-1).add(Integer.parseInt(in.next())-1);
			}
		}
		
		for(int i=0;i<n;i++) {
			if(visit[i]==0)solve(i,ls);
		}
		
		for(int i=0;i<n;i++) {
			System.out.println(i+1+" "+tstamp[i][0]+" "+tstamp[i][1]);
		}
	}
	
	static void solve(int node,List<List<Integer>> ls) {
		visit[node]=1;
		tstamp[node][0]=++time;
		for(int i=0;i<ls.get(node).size();i++) {
			int nxt=ls.get(node).get(i);
			if(visit[nxt]==0)solve(nxt,ls);
		}
		tstamp[node][1]=++time;
	}

}



Measured memory_bytes: 27648
<?php
$n=trim(fgets(STDIN));
$d=explode(" ",trim(fgets(STDIN)));
$s=array_sum($d);
$i=0;
$ans=0;
while($i<$n){
  $s-=$d[$i];
  $ans+=$d[$i]*$s;
  ++$i;
}
echo $ans;

Measured memory_bytes: 4728
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int money;
		int n;

		n = sc.nextInt();
		money = 100000;
		for (int i = 0; i < n; i++) {
			money *= 1.05;
			money = (money % 1000 == 0) ? money : money - money % 1000 + 1000;
		}
		System.out.println(money);
	}
}

Measured memory_bytes: 12000
#include <cstddef>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <limits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <memory>
#include <random>
#include <fstream>
#include <locale>
#include <cctype>

using ll = long long;
using ull = unsigned long long;

template <class T>
using vec = std::vector<T>;

template <class T>
using vvec = vec<vec<T>>;

constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }



int main()
{
    using namespace std;

    int N, W;
    cin >> N >> W;

    vec<int> w(N);
    vec<int> v(N);

    for (int i = 0; i < N; ++i)
        cin >> w[i] >> v[i];

    vvec<ll> dp(N + 1, vec<ll>(W + 1, 0));


    for (int i = 1; i <= N; ++i)
        for (int j = 0; j <= W; ++j)
        {
            dp[i][j] = dp[i - 1][j];
            if (j - w[i - 1] >= 0)
            {
                dp[i][j] = max(dp[i][j], dp[i - 1][j - w[i - 1]] + v[i - 1]);
            }
        }

    cout << *max_element(dp[N].cbegin(), dp[N].cend()) << endl;

    return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

std::string S;

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

    std::cin >> S;

    bool ok = true;

    for(int i=0;i<4;++i){
        if(std::count(S.begin(), S.end(), S[i]) != 2){
            ok = false;
        }
    }

    if(ok){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
}


Measured memory_bytes: 256
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b, c, d, m, h, w, x, y, sum, k, q;

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

  cin >> n;
  rep(i, n) cin >> a[i];
  rrep(i, 1, n - 1) {
    ll tmp[10] = {};
    tmp[0] = a[i - 1];
    tmp[1] = a[i];
    tmp[2] = a[i + 1];
    sort(tmp, tmp + 3);
    if (tmp[1] == a[i]) ans++;
  }
  Cout(ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>
#include <utility>
#include <climits>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;
constexpr auto mod = 1000000007;
constexpr auto INF = ULLONG_MAX;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }
template <typename T> inline T max_value(vector<T>& x) { return *max_element(x.begin(), x.end()); }
template <typename T> inline T min_value(vector<T>& x) { return *min_element(x.begin(), x.end()); }
template <typename T> inline T sum_value(vector<T>& x) { return accumulate(x.begin(), x.end(), 0); }

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

  ull result = 0;
  if (a >= b) {
    result += a;
    a--;
  } else {
    result += b;
    b--;
  }

  if (a >= b) {
    result += a;
  } else {
    result += b;
  }

  cout << result << endl;

  return 0;
}


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

using namespace std;
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
const int N=1e9+5;///1e18+5

void solve()
{
    string a,b;
    cin>>a>>b;
    int al=a.size();
    int bl=b.size();

    int res=1000,cnt=0;

    for(int i=0; i<=al-bl; i++)
    {
        for(int k=i,j=0; k<bl+i; k++,j++)
        {
            if(a[k]!=b[j])
            {
                cnt++;
            }
        }
        res=min(res,cnt);
        cnt=0;
    }
    cout<<res<<endl;
}


int main()
{
    //freopen("input.txt","r",stdin);
    IO;
    int tc=1;
    //cin>>tc;
    while(tc--)
    {
        solve();
    }
    return 0;
}


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


int main() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  int ans_ws = 100*a, ans_s = 0;
  rep(i, 31){
    rep(j, 31){
      int w = 100*a*i + 100*b*j;
      if(w == 0) continue;
      rep(ii, f/c+1){
        rep(jj, f/c+1){
          int s = c*ii + d*jj;
          if(s*100 <= e*w && s+w <=f 
            && s*ans_ws > ans_s*(w+s)){
            ans_ws = w+s;
            ans_s = s;
          }
        }
      }
    }
  }
  cout << ans_ws << " " << ans_s << endl;
}


Measured memory_bytes: 3524
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr int INF = 1e9;

int main(){
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<pair<char, char>> query(q);
  rep(i,q) cin >> query[i].first >> query[i].second;

  auto ok = [&](int now) {
    for (auto p : query) {
      if (s[now] != p.first) continue;
      if (p.second == 'L') now--;
      else now++;
      if (now < 0) return -1;
      if (now >= n) return 1;
    }
    return 0;
  };
  //左側
  int l = -1, r = n;
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (ok(m) == -1) l = m;
    else r = m;
  }
  int fl = r;
  l = -1, r = n;
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (ok(m) == 1) r = m;
    else l = m;
  }
  int fr = n - l-1;
  cout << n - (fl+fr) << endl;
  return 0;
}

/*
int main(){ 
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<P> p(26);
  vector<int> dist(26,0);
  rep(i,26) p[i].first = 0, p[i].second = 0;
  rep(i,q) {
    char t, d;
    cin >> t >> d;
    int idx = t - 'A';
    if (d == 'L') dist[idx]--;
    else dist[idx]++;
    p[idx].first = min(p[idx].first, dist[idx]);
    p[idx].second = max(p[idx].second, dist[idx]);
  }
  int res = 0;
  vector<int> de(n,0);
  for (int i = 0; i < n; i++) {
    int idx = s[i] - 'A';
    int l = p[idx].first, r = p[idx].second;
    if (i + l < 0 || i + r >= n) de[i] = 1;
    else res++;
  } 
  rep(i,n) cout << de[i] << " ";
  cout << endl;
  cout << res << endl;
  return 0;
} 
*/

Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,n) for(int i=(a); i<(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

int main(){
  const int lim = 1e6+100;
  int N; cin >> N;
  vector<bool> prime(lim,false);
  
  for(int i = 2; i*i < lim; ++i){
    if(prime[i] == true) continue;
    for(int j = i*i; j < lim; j += i) prime[j] = true;
  }
  
  for(int i = N; i < lim; ++i){
    if(prime[i] == false){
      cout << i << endl;
      return 0;
    }
  }
  
  return 0;
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
 
  if(N % 2 == 0){
    cout << 0.5 << endl;
  }else {
    cout << (N / 2 + 1) / (float)N << endl;
  }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <climits>
#include <ctime>
#include <random>
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define eps 1e-9
#define inf 0x3f3f3f3f
#define mod 1000000007
using namespace std;

int main() {
	speed;
	ll x, k, d;
	cin >> x >> k >> d;
	x = abs(x);
	/*if (k * d > x && (x / d + 1)* d <= k * d) {
		ll p1 = x - (x / d) * d, p2 = x - (x / d + 1) * d;
		if (abs(p1) <= abs(p2))
			ans = p1;
		else
			ans = p2;
	}
	else
		ans = x - k * d;*/
	ll t = min(x / d, k);
	k -= t;
	x = x - t * d;
	if (k % 2) {
		if (x < 0)
			x += d;
		else
			x -= d;
	}
	cout << abs(x);
}

Measured memory_bytes: 3120
using System;
using System.Collections.Generic;
using System.Linq;

public static partial class Program
{
    public static void Main()
    {
        var n = CRL().ToInt();
        var wis = CRL().ArrayInts();

        var min = int.MaxValue;
        for (int i = 1; i <= n; i++)
        {
            var s = wis.Take(i).Sum();
            var b = wis.Skip(i).Take(n - i).Sum();
            min = Math.Min(min, Diff(s, b));
        }
        
        CWL(min);
    }
}

public static partial class Program
{
    //テンプレここから
    public static int Sigma(int n, int next = 1, int val = 0) => next > n ? val : Sigma(n, next + 1, val + next);
    public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);
    public static int GCD(int a, int b) => b == 0 ? a : GCD(b, a % b);
    public static long LCM(long a, long b) => a * b / GCD(a, b);
    public static int LCM(int a, int b) => a * b / GCD(a, b);
    public static string CRL() => Console.ReadLine();
    public static void CWL(object obj) => Console.WriteLine(obj);
    public static int ToInt(this double d) => (int) d;
    public static long ToLong(this double d) => (long) d;
    public static int ToInt(this string str) => int.Parse(str);
    public static long ToLong(this string str) => long.Parse(str);
    public static long[] ToLong(this IEnumerable<string> strs) => strs.Select(x => x.ToLong()).ToArray();
    public static int[] ToInt(this IEnumerable<string> strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ArrayLongs(this string str, char opr = ' ') => str.Split(opr).ToLong();
    public static int[] ArrayInts(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static int Diff(int a, int b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static long Sign(this long i) => Math.Sign(i);
    public static bool IsEven(this long i) => i % 2 == 0;
    public static bool IsEven(this int i) => i % 2 == 0;
    public static readonly int[] Dx = new[] {0, -1, 0, 1};
    public static readonly int[] Dy = new[] {-1, 0, 1, 0};
    public const int Mod = 1000000007;
    public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
    public static long ToLong(this char c) => c.ToString().ToLong();
    public static int ToInt(this char c) => c.ToString().ToInt();
    public static long[] Sort(this long[] array) => array.OrderBy(x => x).ToArray();
    public static int[] Sort(this int[] array) => array.OrderBy(x => x).ToArray();
    public static long[] DSort(this long[] array) => array.OrderByDescending(x => x).ToArray();
    public static int[] DSort(this int[] array) => array.OrderByDescending(x => x).ToArray();
    public static string Join(this IEnumerable<string> array, string sep = "") => string.Join(sep, array);
    public static string Join(this IEnumerable<char> array, string sep = "") => string.Join(sep, array);

    public static string JoinToStr(this IEnumerable<int> array, string sep = "")
        => array.Select(x => x.ToString()).Join(sep);

    //テンプレここまで
}


Measured memory_bytes: 13396
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include <climits>
#include<fstream>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x%p;
		x = x * x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int n, m;
int d[20000];
int p[20000];
H a[20000];
signed main() {
	while (cin >> n >> m && n + m > 0) {
		for (int i = 0; i < n; i++) {
			cin >> d[i] >> p[i];
			a[i] = H{ p[i],i };
		}
		sort(a, a + n);
		reverse(a, a + n);
		int ans = 0;
		for (int i = 0; i < n; i++) {
			int t = a[i].y;
			if (m >= d[t]) {
				m -= d[t];
			}
			else {
				ans += p[t] * (d[t] - m);
				m = 0;
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3468
# -*- coding: utf-8 -*-
"""
Created on Fri Aug  9 21:17:49 2019

@author: Yamazaki Kenichi
"""

N = input()
n = int(N)

S = '909090'
S2 = '090909'

if len(N) & 1:
    ans = n - int(S[-len(N):])
else:
    ans = int(S2[-len(N):])

print(ans)

Measured memory_bytes: 3060
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let s: String = read();
    let s = s.chars().collect::<Vec<_>>();
    let central_char = s[s.len() / 2];

    let mut former_idx;
    let mut latter_idx;
    if s.len() % 2 == 0 {
        former_idx = s.len() / 2 - 1;
        latter_idx = s.len() / 2;
    } else {
        former_idx = s.len() / 2;
        latter_idx = s.len() / 2;
    }

    let mut ans = s.len() / 2;
    loop {
        if s[former_idx] != central_char || s[latter_idx] != central_char {
            break;
        }
        ans += 1;
        if former_idx == 0 {
            break;
        }
        latter_idx += 1;
        former_idx -= 1;
    }
    println!("{}", ans);
}


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

int main() {
  long long N,T;
  cin >> N >> T;
  vector<long long> t(N);
  for(int i=0;i<N;i++){
    cin >> t[i];
  }
  long long brank;
  brank=0;
  for(int i=0;i<N-1;i++){
    if(t[i+1]-t[i]>T)
      brank=brank+t[i+1]-t[i]-T;
  }
  cout << t[N-1]+T-brank << endl;
}

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

using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int A,B,X;
	
	cin >> A >> B >> X;

	if(A > X){
		cout << "NO\n";
		return 0;
	}else if(A+B >= X){
		cout << "YES\n";
		return 0;
	}else{
		cout << "NO\n";
		return 0;
	}
}

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

int main() {
  int64_t s;
  cin >> s;
  
  int64_t pro = 100, ans = 1000;
  int64_t x;
  bool bo = true;
  
  while (bo) {
    pro *= 10;
    x = abs((((s % pro) - (s % (pro / 1000))) / (pro / 1000)) - 753);
    ans = min(ans, x);
    if (s < pro) {
      bo = false;
    }
  }
  cout << ans << endl;
}


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

const int N = 1e5+10;
int a[N];
int main(){
    int h1,h2,m1,m2,k;
    cin >> h1 >> m1>> h2 >> m2 >> k;
    h2 -= h1;
    m2 -= m1;
    h2 -= k/60;
    m2 -= k%60;
    // if(m2 < 0) {
    //     m2 += 60;
    //     h2 --;
    // }
    m2 += 60 * h2;
    cout << m2 << '\n';
    return 0;
}

Measured memory_bytes: 3608
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    String[] a = new String[n];
    boolean flag = true;
    for(int i = 0;i < n;i++){
      a[i] = scan.next();
    }
    for(int i = 0;i < n;i++){
      if(i == 0){
        continue;
      }
      if(a[i].charAt(0) != a[i-1].charAt(a[i-1].length()-1)){
        flag = false;
        break;
      }
      for(int j = 0;j < i;j++){
        if(a[i].equals(a[j])){
          flag = false;
          break;
        }
      }
      if(flag == false){
        break;
      }
    }

    if(flag){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 23892
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string t = Console.ReadLine();
            bool res = false;
            if (t.Length - s.Length == 1 && t.Substring(0, s.Length) == s)
                res = true;

            if (res)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");

        }

    }
}


Measured memory_bytes: 25676
N, K = map(int, input().split())
A = list(map(int, input().split()))
sum = 0
li = []
for i in range(N):
    A[i] = A[i] / 2 + 0.5

for i in range(K):
    sum += A[i]
li.append(sum)
for i in range(N - K):
    sum -= A[i]
    sum += A[i+K]
    li.append(sum)


print(max(li))

Measured memory_bytes: 78472
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
using namespace std;
using ll = long long;
const ll mod =  1000000007;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP_FROM(i, j, n) for (ll i = (j); i < (n); ++i)
#define all(x) (x).begin(),(x).end()

ll power(ll base, ll exponent, ll module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ ll root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
ll inverse(ll x){ return power(x, mod - 2, mod);}
ll gcd(ll a, ll b) {if(a < b) gcd(b, a);ll r;while(r=a%b) {a=b;b=r;}return b;}
struct combination{ vector<ll> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } ll C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };

ll dp[500010] = {};

struct UnionFind {
  vector<int> par;

  UnionFind(int n) : par(n, -1) {}
  void init(int n) { par.assign(n, -1); }

  int root(int x) {
    if (par[x] < 0)
      return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y)
      return;
    if (par[x] > par[y])
      swap(x, y);
    par[x] += par[y];
    par[y] = x;
  }

  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
  int size(int x) { return -par[root(x)]; }
};


signed main() {
  ios::sync_with_stdio(false);
  ll r, d, x;
  cin >> r >> d >> x;
  REP(i, 10) {
    x = r*x-d;
    cout << x << endl;
  }
  return 0;
}


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

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           node(a,b,c)                 mp(mp(a,b),c)
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=500005;
int s[M+2],t[M+2],c[M+2];
 main()

{
    fast
    int n,ch,ses=0;
    cin>>n>>ch;
    f(i,1,n)
    {
        cin>>s[i]>>t[i]>>c[i];
    }
    vector<int>tym(M+2,0);
    f(tvc,1,ch)
    {
        vector<int>yo(M+2,0);
        f(i,1,n)
        {
            if(c[i]==tvc)
            {
                yo[s[i]*2-1]++;
                yo[t[i]*2]--;
            }
        }
        f(i,1,M)
        {
            yo[i+1]+=yo[i];
        }
        f(i,1,M)
        {
            tym[i]+=(yo[i]>0);
        }
    }
    f(i,1,M)
    {
       ses=max(ses,tym[i]);
    }
    cout<<ses<<"\n";
    return 0;

}





































Measured memory_bytes: 13472
N,M,K=map(int,input().split())
MOD=998244353

#逆元を定義する
def inv(a):
  return pow(a,MOD-2,MOD)

#「n!」の剰余を求める
fact=[0,1]
for i in range(2,N+1):
  fact.append((fact[-1]*i)%MOD)

#nCr(MOD)を求める
def choose(n,r):
  if r==0 or r==n:
    return 1
  else:
    return fact[n]*inv(fact[r])*inv(fact[n-r])%MOD

#(M-1)**n(MOD)を求める
exp=[1]
for i in range(1,N):
  exp.append((exp[-1]*(M-1))%MOD)  
  

#答えを計算する
ans=0
for i in range(K+1):
  ans+=(M*choose(N-1,i)*exp[N-1-i]%MOD)  
  ans%=MOD
print(ans)  

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

int main() {
    string S;
    cin >> S;
    string sub = "";
    int i = S.size()-1;
    for(; i>=0; --i) {
        sub.push_back(S[i]);
        if(sub == "maerd" || sub == "remaerd" || sub == "esare" || sub == "resare") {
            sub = "";
        } else if(sub.size() == 7) {
            break;
        }
    }
    if(i == -1) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 512
import numpy as np

n, m, x = map(int, input().split())
cost_list = []
matrix = []

for _ in range(n):
  tmp = list(map(int, input().split()))
  matrix.append(tmp)

list_ = []
for i in range(2**n):
  check_list = [0 for _ in range(n)]
  cnt=0
  while True:
    check_list[cnt] = i%2
    i //= 2
    cnt+=1
    if i==0:
      break
  list_.append(check_list)

ans = 100000000000000
for check in list_:
  ans_list = np.zeros(m+1)
  for i, v in enumerate(check):
    if v==1:
      ans_list += np.array(matrix[i])


  flg = True
  for value in ans_list[1:]:
    if value<x:
      flg=False
  if flg:
    ans = min(ans,ans_list[0])

if ans == 100000000000000:
  ans = -1
print(int(ans))

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

int main(void){
    string s;
    int a, b;
    cin >> a >> s >> b;
    int ans;
    if(s[0] == '+')
        ans = a+b;
    if(s[0] == '-')
        ans = a-b;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(){
    int a,b;
    -1000<=a<=1000;
    -1000<=b<=1000;
    scanf("%d %d",&a,&b);
    if(a<b){
        printf("a < b\n");
    }else if(a>b){
        printf("a > b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}


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

int n,s, a[105];
int main()
{
	int i;
	cin >> n;
	for (i = 1; i <= n; i++) {
		scanf ("%d", &a[i]);
	}
	for (i = 2; i <= n; i++){
		if (a[i] == a[i - 1]) {
			s++;
			i++;
		}
	}
	cout << s;
    return 0;
}


Measured memory_bytes: 256