akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m,x;
	cin >> n >> m >> x;
	int a = 0, b = 0;
	REP(i, m) {
		int c;
		cin >> c;
		if (c < x)a++;
		else if (c > x)b++;
	}
	cout << min(a, b) << endl;


}

Measured memory_bytes: 256
n, h = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(n)]
A,B = zip(*AB)
a = max(A)
B = [b for b in B if b > a]
B.sort(reverse=True)
ans = 0
hp = h
attack_cnt = 0
for b in B:
    if hp <= 0:
        break
    attack_cnt += 1
    hp -= b
if hp > 0:
    attack_cnt += (hp - 1) // a + 1
print(attack_cnt)


Measured memory_bytes: 36084
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

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

ll gcd(ll a , ll b){
	if(b == 0) return a;
	return gcd(b , a % b);	
}
ll lcm(ll a , ll b){
	ll g = gcd(a , b);
	ll lc = (a/g) * b;
	return lc;
}

int main(){
    ios::sync_with_stdio(false);
    int k;
    int a,b;
    cin >> k;
    cin >> a >> b;
    int ind=0;
    for(int i=a;i<(b+1);i++){
        if(i%k==0) ind++;
    }
    if(ind>0) cout << "OK";
    else cout << "NG";
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

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; }
const int INF = 1e9;
const long long INFL = 1LL<<60;


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

  int n;
  cin >> n;
  set<string> s;
  rep(i, n) {
    string tmp;
    cin >> tmp;
    s.insert(tmp);
  }

  cout << s.size() << endl;

  return 0;
}


Measured memory_bytes: 19200
#include <iostream>
#include <fstream>
#include <vector>
#include <utility>

#include <algorithm>

#define REP(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

typedef long long ll;

int main()
{

    int n;
    cin >> n;
    vector<pair<int, int>> a(n);

    int ans = 0;
    REP(i, n)
    {
        pair<int, int> tmp;
        tmp.second = i;
        cin >> tmp.first;
        a[i] = tmp;
    }

    sort(a.begin(), a.end());
    for (auto s : a)
        cout << s.second + 1 << endl;

    return 0;
}

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

int bigger(ll a, ll b)
{
  int pA, pB;
  pA = pB = 1;
  while (1)
  {
    if (a / 10 <= 0)
    {
      break;
    }
    pA++;
    a /= 10;
  }
  while (1)
  {
    if (b / 10 <= 0)
    {
      break;
    }
    pB++;
    b /= 10;
  }
  return max(pA, pB);
}

int main()
{
  ll n, ans = 100000, buf = 0;
  cin >> n;
  ll sqrt = pow(n, 0.5);
  for (ll i = 1; i < sqrt + 1; i++)
  {
    if (n % i == 0)
    {
      buf = bigger(i, n / i);
      ans = min(ans, buf);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4020
import numpy as np


def getInput():
    """

    :return: list of list of str. 1st dim: row, 2nd dim: column.
    """
    separator = ' '
    ret_array = []
    while True:
        try:
            row = input().split(sep=separator)
            ret_array.append(row)
        except EOFError:
            break
    return ret_array


g = getInput()

# number
p = np.array(list(map(int, g[0])), dtype=np.int32)
h, f = divmod(p, 10)
if h == 9 or f == 9:
    print('Yes')
else:
    print('No')

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

using namespace std;
using ll = long long;
using vec = vector<int>;

#define rep(i, n)  for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define Sort(a)    sort(a.begin(), a.end())
#define gSort(a)   sort(a.begin(), a.end(), greater<int>())
#define pout(n, a) cout << fixed << setprecision(n) << (a)
#define Cast(dig, n) static_cast<std::bitset<(dig)>>(n)

const int INF = 2147483647;
const ll  MOD = 1000000007;

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vec c(n);
    vector<vector<int>> a;
    a.resize(n);

    for(int i = 0; i < n; ++i) {
        cin >> c[i];
        for(int j = 0; j < m; ++j) {
            int tmp;
            cin >> tmp;
            a[i].emplace_back(tmp);
        }
    }

    int ans = INF;

    for(int bit = 0; bit < (1 << n); ++bit) {
        // 合計金額
        int sum = 0;
        // 理解度
        vec understood(m, 0);

        // bitに含まれているか
        for(int i = 0; i < n; ++i) {
            if(bit & (1 << i)) {
                rep(j, m) {
                    understood[j] += a[i][j];
                }
                sum += c[i];
            }
        }

        bool isUnderstand = true;
        rep(i, m) {
            if(understood[i] < x) {
                isUnderstand = false;
                break;
            }
        }

        if(isUnderstand) ans = min(ans, sum);
    }

    if(ans == INF) {
        cout << "-1";
        return 0;
    }
    cout << ans;
    return 0;
}

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

using namespace std;

int main() {

//	string s;
//	cin >> s;

	long long n,k;
	cin >> n >> k;

	long long nn;
	nn = n;

	int counter;
	counter = 0;

	while (nn != 0) {
		nn /= k;
		counter++;
	}

	cout << counter << endl;
	
	return 0;

}

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

ll a,b,c,d;

int main(void){
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	ll ans=b*d;
	ans=max(ans,a*c);
	ans=max(ans,a*d);
	ans=max(ans,b*c);
	printf("%lld\n",ans);
	return 0;
}


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

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  int sum = 100 * r + 10 * g + b;
  if (sum % 4 == 0) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
import heapq

def main():
    X, Y, A, B, C, *Z = map(int, open(0).read().split())
    P = sorted(Z[:A], reverse=True)
    Q = sorted(Z[A: A + B], reverse=True)
    R = sorted(Z[A + B:], reverse=True)
    # print(X, Y, A, B, C, P, Q, R)
    q = []
    ans = 0
    for i in range(X):
        v = P[i]
        heapq.heappush(q, v)
        ans += v
    for i in range(Y):
        v = Q[i]
        heapq.heappush(q, v)
        ans += v
    for i in range(C):
        vr = R[i]
        v = heapq.heappop(q)
        if v < vr:
            heapq.heappush(q, vr)
            ans += vr - v
        else:
            break
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38204
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;

long long GCD(long long a, long long b) {
    if(b == 0)
        return a;
    else
        return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
    long long g = GCD(a, b);
    return a / g * b;
}
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() {
long double L;
cin>>L;
std::cout << std::setprecision(10) << (L/3)*(L/3)*(L/3)<<endl;
}


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

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)


int main(void){
 int n,T;
 cin>>n>>T;
 int mini=100000;
 vector<int> c(n),t(n);


 r(i,n){
   cin>>c.at(i)>>t.at(i);
   if(t.at(i)<=T){
     if(mini>c.at(i)){mini=c.at(i);}

   }
 }
 if(mini==100000)cout<<"TLE"<<endl;
 else cout<<mini<<endl;




return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const ll INF = 1e16;

void solver(ll K, ll A, ll B, ll &ans){

    ll ans_buf;
    ll plus_dif = B - A;

    if(plus_dif <= 1) ans_buf = 1 + K;
    else{
        ll num_buf;
        num_buf = K - (A - 1);
        ans_buf = A;

        if(num_buf%2 == 0) ans_buf += plus_dif*(num_buf/2);
        else ans_buf += plus_dif*(num_buf/2) + 1;
    }
    ans = ans_buf;

    return;
}

int main(){

    ll K, A, B;
    cin >> K >> A >> B;

    ll ans;
    solver(K, A, B, ans); 

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3640
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)


Measured memory_bytes: 47444
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define mp make_pair
#define pb push_back
#define EB emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr double eps = 1e-14; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int N;

ll TEN[10];

ll calc_TEN(int x){
    ll ret = 1;
    for(int i=0;i<x;i++) ret *= 10;
    return ret;
}

void solve(){
    vector<string> s(N);
    rep(i,N) cin >> s[i];
    set<char> st;
    rep(i,N) rep(j,sz(s[i]))st.insert(s[i][j]);
    int n=st.size();
    map<char,int> cton;
    map<int,char> ntoc;
    {
        int cnt=0;
        for(char c : st) cton[c] = cnt++;
        for(char c : st) ntoc[cton[c]] = c;
    }

    vector<bool> okz(n,true);
    rep(i,N){
        if(s[i].size()>1){
            okz[cton[s[i][0]]]=false;
        }
    }

    vector<vector<int>> calc(10,vi(10,0));
    rep(i,N-1){
        string str = s[i];
        reverse(all(str));
        rep(j,str.size()){
            char ch = str[j];
            calc[cton[ch]][j]++;
        }
    }

    vector<ll> g(n,0);
    rep(i,n){
        rep(j,10){
            g[i] += calc[i][j] * TEN[j];
        }
    }


    int cnt=0;
    for(int mask=0;mask<(1<<10);mask++){
        if(__builtin_popcount(mask) != n) continue;
        vector<int> v;
        rep(i,10) if(mask & (1<<i)) v.pb(i);
        vector<string> vs(N);
        do{
            bool check=true;
            rep(i,n){
                if(v[i]==0 && !okz[i]){
                    check=false;
                    break;
                }
            }
            if(!check) continue;
            ll sum=0;
            for(int i=0;i<n;i++){
                sum +=  v[i] * g[i];
            }

            ll sum2=0;
            for(int i=0;i<s[N-1].size();i++){
                int p = sz(s[N-1])-1-i;
                sum2 += TEN[p] * v[cton[s[N-1][i]]];
            }
            if(sum==sum2) cnt++;
        }while(next_permutation(all(v)));
    }
    cout << cnt << endl;
}

int main(){
    for(int i=0;i<10;i++) TEN[i] = calc_TEN(i);
    while(cin>>N){
        if(N==0) break;
        solve();
    }
}

Measured memory_bytes: 3100
#include<cstdio>
#include<cmath>
#include<algorithm>

using namespace std;

typedef long long ll;

#define MOD 1000000007

ll n, m;

ll solve(){
	if(abs(n - m) > 1) return 0;
	ll res = 1;
	for(int i = 1; i <= n; i++) res = res * i % MOD;
	for(int i = 1; i <= m; i++) res = res * i % MOD;
	if(abs(n - m) == 1) return res;
	return 2 * res % MOD;
}

int main(){
	scanf("%lld %lld", &n, &m);
	printf("%lld\n", solve());
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;

// long long gcd(long long a, long long b){
//     if (a < b){
//         a ^= b;
//         b ^= a;
//         a ^= b;
//     }
//     return b ? gcd(b, a % b) : a;
// }

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

int main(){
    string s;
    cin >> s;
    if(s == "SUN") cout << "7" << endl;
    if(s == "MON") cout << "6" << endl;
    if(s == "TUE") cout << "5" << endl;
    if(s == "WED") cout << "4" << endl;
    if(s == "THU") cout << "3" << endl;
    if(s == "FRI") cout << "2" << endl;
    if(s == "SAT") cout << "1" << endl;
}


Measured memory_bytes: 256
// Calvin Gagliano 
// @calgagi
// Oregon State University
// Competitive Programming Template
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ii = pair<int, int>;

int main() {
    ios_base::sync_with_stdio(false);  
    cin.tie(NULL);
    srand(chrono::steady_clock::now().time_since_epoch().count()); 
    // freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); 
    

    string s, t, u;
    int a, b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if (u == t) {
        b--;
    } else if (u == s) {
        a--;
    }
    
    cout << a << " " << b << endl;

    return 0;
}


Measured memory_bytes: 256
from sys import stdin

s = stdin.readline().rstrip()
n = int(stdin.readline().rstrip())
li = []

for i in range(1,6):
    for j in range(len(s)-i+1):
        li.append(s[j:j+i])
li = list(set(li))
li.sort()
print(li[n-1])

Measured memory_bytes: 5068
#include <cstring>
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
  long long n,k,a=0;
  cin>>n>>k;
  if(k==0) a=n*n;
  else
  for(int i=k+1;i<=n;i++){
    a+=(n/i)*(i-k);
    if(n%i>=k) a+=(n%i-k+1);
  }cout<<a;
    return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : d.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include<vector>
using namespace std;
int modPow(long long a, long long n, long long p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}
int main() {
	long long x,y;cin>>x>>y;
	int def=1;
	for(int i=0;i<9;i++)def*=10;
	def+=7;
	int sum=x+y;
	if(sum%3){
		cout<<0<<endl;
		return 0;
	}
	long long jump=sum/3;
	if(x<jump||y<jump){
		cout<<0<<endl;
		return 0;
	}
	vector<long long> c(x-jump+1);
	c[0]=1;
	c[1]=jump;
	for(int i=2;i<=x-jump;i++){

		c[i]=c[i-1]*(jump-i+1);
		c[i]%=def;
		c[i]*=modPow(i,def-2,def);
		c[i]%=def;
	}
	cout<<c[x-jump]<<endl;
//	ans=jumpCx-jump
	return 0;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
struct unionfind{
    int par[200100];
    int rank[200100];

    void init(int n){
        for(int i=0;i<n;i++){
            par[i]=i;
            rank[i]=0;
        }
    }

    int find(int x){
        if(par[x] == x) return x;
        else return par[x] = find(par[x]);
    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(rank[x]<rank[y]) par[x] = y;
        else{
            par[y] = x;
            if(rank[x] == rank[y]) rank[x]++;
        }
    }

    bool same(int x, int y){
        if(find(x)==find(y)) return true;
        else return false;
    }
};
int main(){
   long long n, m, ans=0, i, cnt[200100]={0}, a[200100], b[200100];
   unionfind g;
   cin >> n >> m;
   g.init(n);
   for(i=0;i<m;i++){
       cin >> a[i] >> b[i];
       g.unite(a[i], b[i]);
   }

   for(i=0;i<n;i++){
      cnt[g.find(i)]++;
   }
   for(auto x : cnt){
       ans=max(ans, x);
   }
   cout << ans <<endl;

   return 0;
}

Measured memory_bytes: 9816
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 310;

int n;
int cnt[4];
double dp[N][N][N];

double gdp(int i, int j, int k) {
  return (i >= 0 && j >= 0 && k >= 0) ? dp[i][j][k] : 0;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif

  int n;
  scanf("%d", &n);
  for (int rep = 0; rep < n; ++rep) {
    int a;
    scanf("%d", &a);
    ++cnt[a];
  }
  for (int i = 2; i; --i)
    cnt[i] += cnt[i + 1];
  for (int i = 0; i <= cnt[1]; ++i)
    for (int j = 0; j <= min(cnt[2], i); ++j)
      for (int k = 0; k <= min(cnt[3], j); ++k) {
        if (i == 0)
          continue;
        int x = i - j, y = j - k, z = k;
        dp[i][j][k] = (gdp(i - 1, j, k) * x + gdp(i, j - 1, k) * y + gdp(i, j, k - 1) * z + n) / i;
      }
  printf("%.10lf\n", dp[cnt[1]][cnt[2]][cnt[3]]);

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 225536
#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;
	string	S;
	cin >> N >> S;
	int		count;
	rep (i, N - 2)
	{
		if (S.substr(i, 3) == "ABC")
			count++;
	}
	cout << count << endl;
}


Measured memory_bytes: 256
def resolve():
    n=int(input())
    l=list(map(int, input().split()))
    joken=0
    cnt=0
    while joken==0:
        for i in range(n):
            if l[i]%2!=0:
                joken=1
        if joken==0:
            for i in range(n):
                l[i]=l[i]//2
            cnt+=1
    print(cnt)
resolve()

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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

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

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( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    string s; cin >> s;
    REP( i, 3 ){
        if( s[i] == s[i + 1] ){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
}


Measured memory_bytes: 256
macro_rules! get {
  ($t:ty) => {
    {
      let mut line: String = String::new();
      std::io::stdin().read_line(&mut line).unwrap();
      line.trim().parse::<$t>().unwrap()
    }
  };
  ($($t:ty),*) => {
    {
      let mut line: String = String::new();
      std::io::stdin().read_line(&mut line).unwrap();
      let mut iter = line.split_whitespace();
      (
          $(iter.next().unwrap().parse::<$t>().unwrap(),)*
      )
    }
  };
  ($t:ty; $n:expr) => {
    (0..$n).map(|_|
        get!($t)
    ).collect::<Vec<_>>()
  };
  ($($t:ty),*; $n:expr) => {
    (0..$n).map(|_|
        get!($($t),*)
    ).collect::<Vec<_>>()
  };
  ($t:ty ;;) => {
    {
      let mut line: String = String::new();
      std::io::stdin().read_line(&mut line).unwrap();
      line.split_whitespace()
          .map(|t| t.parse::<$t>().unwrap())
          .collect::<Vec<_>>()
    }
  };
  ($t:ty ;; $n:expr) => {
    (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
  };
}

fn main() {
  let (x,y) = get!(i32, i32);
  if x <= 8 && y <= 8 {
    println!("Yay!");
  } else {
    println!(":(");
  }
}


Measured memory_bytes: 4352
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    try {
        val a = sc.nextInt()
        val b = sc.nextInt()
        when {
            a < b -> println("a < b")
            a > b -> println("a > b")
            else -> println("a == b")
        }
    } catch (e: Exception) {
        println(e)
    }
}


Measured memory_bytes: 25424
#include <stdio.h>
#include <stdlib.h>

void insertionSort(int A[], int N);
void trace(int A[], int N);

int main() {

	int N, i, j;
	int A[100];

	scanf("%d", &N);
	for (i = 0; i < N; i++) scanf("%d", &A[i]);

	trace(A, N);
	insertionSort(A, N);

	return 0;
}

void insertionSort(int A[], int N) {

	int i, j, v;

	for (i = 1; i < N; i++) {
		v = A[i];
		j = i - 1;
		while (j >= 0 && v < A[j]) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
		trace(A, N);
	}
}

void trace(int A[], int N) {
		int i;
		for (i = 0; i<N; i++) {
			if (i>0) printf(" ");
			printf("%d", A[i]);
		}
		printf("\n");

	}




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

int main() {
    string s;
    cin >> s;
    int top, tail;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'A') {
            top = i;
            break;
        }
    }
    for (int i = s.size() - 1; i >= 0; i--) {
        if (s[i] == 'Z') {
            tail = i;
            break;
        }
    }

    cout << (tail - top + 1) << endl;


    return 0;
}


Measured memory_bytes: 640
#include<cstdio>
using namespace std;
int n;
int y;
bool find;
int a1,a2,a3;
int main()
{
	scanf("%d%d",&n,&y);
	for(int a=0;a<=n;a++)
	{
		int res=a*10000;
		for(int b=0;b<=n-a;b++)
		{
			res+=b*5000;
			res+=(n-a-b)*1000;
			if(res==y)
			{
				find=true;
				a1=a;
				a2=b;
				a3=n-a-b;
				break;
			}
			res-=b*5000;
			res-=(n-a-b)*1000;
		}
		if(find)
		{
			break;
		}
	}
	if(find)
	{
		printf("%d %d %d",a1,a2,a3);
	}
	else
	{
		printf("-1 -1 -1\n");
	}
	return 0;
}

Measured memory_bytes: 128
/* ex4_1
   YSK722 */

#include <stdio.h>

int main(void){
    int num, watch, count;
    scanf("%d %d", &num, &watch);
    while (num > 0) {
        // 一人の監視員が監視できる本数を端から数える
        num -= (watch * 2 + 1);
        // 監視員の人数
        count++;
    }
    printf("%d", count);
    return 0;
}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
//#define DEBUG
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(void) {
#ifdef DEBUG
	printf("");
#endif
	char s[100001] = { '\0' };
	scanf("%s", s);

	int i;
	for (i = 0; i < 100000 && s[i] != '\0'; i += 2) {
		printf("%c", s[i]);
	}
	printf("\n");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N; cin>>N;
  vi A(N+1,-1);
  REP(i,1,N) cin>>A[i];
  int ans=0;
  bool flag=1;
  REP(i,1,N){
    if(A[i-1]+1<A[i]){
      ans=-1;
      flag=0;
    }
  }
  if(flag){
  map<int,int> M;
  REP(i,1,N){
    int X=i-A[i];
    M[X]=max(M[X],A[i]);
  }
  for(auto p:M) ans+=p.second;
  }
  cout<<ans<<endl;
  }


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    sort(ALL(a), greater<int>());

    OP(accumulate(a.begin(), a.begin() + k, 0));
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int MAX = 100000, mod = 1e9+7;
int A[MAX];
int main(){
    int n, maxi = 0;
    long long sum = 1;
    cin >> n;
    A[0] = 3;
    
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        maxi = max(maxi, a);
        if (A[a] == 0)
        {
            cout << 0 << endl;
            return 0;
        }
        if (maxi + 1 < a)
        {
            cout << 0 << endl;
            return 0;
        }
        sum = (sum * A[a]) % mod;
        A[a]--;
        A[a+1]++;
    }
    cout << sum << endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int s[200005];
int dex[200005];
int main(){
	cin>>n;
	int ans=0;
	for(int i=1;i<=n;i++){
		scanf("%d",s+i);
		dex[s[i]]=dex[s[i]-1]+1;
		ans=max(dex[s[i]],ans);
	}
	cout<<n-ans;
	return 0;
}

Measured memory_bytes: 1792
"use strict"

function main(input) {
  // S < T

  input = input.split(/\n/)
  let S = input[0].split("").sort()
  let T = input[1].split("").sort((a, b) => b.charCodeAt() - a.charCodeAt())
  const n = Math.min(S.length, T.length)
  let ans = "No"

  if (S.join("") == T.join("").substring(0, S.length) && S.length < T.length)
    ans = "Yes"
  else {
    for (let i = 0; i < n; i++) {
      //   console.log(S[i].charCodeAt(), T[i].charCodeAt())
      if (S[i].charCodeAt() < T[i].charCodeAt()) {
        ans = "Yes"
      }
    }
  }
  //   console.log(S.join(""), S, T)
  console.log(ans)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"))

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define inc( i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec( i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(i, v) for(auto i =  v.begin(); i !=  v.end(); ++i)
#define RFOR(i, v) for(auto i = v.rbegin(); i != v.rend(); ++i)

template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T> ostream & operator<<(ostream & os, const vector<T> & v) {
	os << "[";
	FOR(it, v) {
		if(it != v.begin()) { os << ", "; }
		os << *it;
	}
	os << "]";
	return os;
}
template<typename F, typename S> ostream & operator<<(ostream & os, const pair<F, S> & p) {
	os << "<" << p.FI << ", " << p.SE << ">";
	return os;
}

// ---- ----

template<typename T> class BIT {
public:
	T * a;
	int s;
	BIT(int size) {
		s = 1 << size;
		a = new T[s];
		inc(i, s) { a[i] = 0; }
	}
	virtual ~BIT() { delete[] a; }
	T f(int p, T v) { return g(s + p, v); }
	
private:
	T g(int p, T v) {
		if(p == 1) { return 0; }
		
		if(p % 2 == 0) { a[p / 2] += v; }
		T w = g(p / 2, v);
		if(p % 2 != 0) { w += a[p / 2]; }
		return w;
	}
};

int n, m;
vector<pair<int, int>> vec[100001];
BIT<int> L(17), R(17);

int main() {
	cin >> n >> m;
	inc(i, n) {
		int l, r;
		cin >> l >> r;
		vec[r - l + 1].EB(l, r + 1);
	}
	
	int a = n;
	inc1(d, m) {
		int k = d, b = 0;
		while(k <= m) {
			b += L.f(k + 1, 0) - R.f(k + 1, 0);
			k += d;
		}
		
		cout << a + b << "\n";
		
		inc(i, vec[d].size()) {
			L.f(vec[d][i].FI, 1);
			R.f(vec[d][i].SE, 1);
			a--;
		}
	}
	
	return 0;
}


Measured memory_bytes: 8576
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    output(N / 3);
    return 0;
}


Measured memory_bytes: 256
while True:
    d, w, h = map(int, input().split())
    if d == 0:
        break
    d = min(d**2 + w**2, w**2 + h**2, h**2 + d**2)
    n = int(input())
    for i in range(n):
        d_i = (int(input())*2)**2
        if d_i > d:
            print("OK")
        else:
            print("NA")



Measured memory_bytes: 5596
n, m = map(int, input().split())
link = [[] for _ in range(n)]
for _ in range(m):
    u, v = map(int, input().split())
    link[u].append(v)
    link[v].append(u)
group = [-1] * n
gid = 0
for i in range(n):
    if group[i] != -1:
        continue
    stack = [i]
    group[i] = gid
    while stack:
        u = stack.pop()
        for v in link[u]:
            if group[v] == -1:
                group[v] = gid
                stack.append(v)
    gid += 1
q = int(input())
for _ in range(q):
    u, v = map(int, input().split())
    print('yes' if group[u] == group[v] else 'no')



Measured memory_bytes: 23376
#include <iostream>
#include <cmath>

#include <set>
#include <string>
#include <bits/stdc++.h>
#include <string>
#define FIXED_FLOAT(x)  std::fixed <<std::setprecision(6)<<(x)
#define MAX 100
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INF INT_MAX
#define ll long long
#define vi vector<int>
#define all(a) a.begin(), a.end()
#define pb push_back
#define ull unsigned long long;


using namespace  std;

void sol2() {
    int a, b;
    cin >> a>> b;
    int q = a*b;
    cout << q << "\n";
}

int main() {
    fast;
    sol2();


}




Measured memory_bytes: 3648
import java.util.Scanner;

public class Main
{

  public static void main(String[] args)
  {
    try (Scanner scanner = new Scanner(System.in))
    {
      while (scanner.hasNextLine())
      {
        String[] tmp = scanner.nextLine().split(" ");
        int x1 = Integer.valueOf(tmp[0]);
        int x2 = Integer.valueOf(tmp[1]);
        System.out.println(solver(x1,x2));
      }
    }
  }

  private static int solver(int x1,int x2)
  {
    return Math.max(x1, x2) - Math.min(x1, x2);
  }
}



Measured memory_bytes: 26284
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime> 
#include <memory.h>
#include <assert.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18 + 1;

int main(){
    ll X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<ll> A(X), B(Y), C(Z);
    for(auto& e : A) cin >> e;
    for(auto& e : B) cin >> e;
    for(auto& e : C) cin >> e;

    multiset<ll> s, t;
    for(auto a : A) {
        for(auto b : B) {
            s.insert(a+b);
        }
        while(s.size() > K) {
            s.erase(s.begin());
        }
    }

    for(auto e : s) {
        for(auto c : C) {
            t.insert(e+c);
        }
        while(t.size() > K) {
            t.erase(t.begin());
        }
    }

    auto iter = t.rbegin();
    while(iter != t.rend()) {
        cout << *iter << endl;
        iter++;
    }

    return 0;
}

Measured memory_bytes: 640
class Security:
    def __init__(self):
        self.S = [str(s) for s in input()]

    def check_difficulty(self):
        pre_cha = ""

        for s in self.S:
            if pre_cha == s:
                print("Bad")
                return

            pre_cha = s

        print("Good")


security = Security()
security.check_difficulty()


Measured memory_bytes: 3060
N = gets.to_i
W = gets.split(" ").map(&:to_i)

sum = 0
W.each do |w|
  sum += w
end

min = sum
sum_b = 0
W.each do |w|
  sum_b += w
  sum -= w
  min = [min, (sum - sum_b).abs].min
end
puts min



Measured memory_bytes: 1788
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

input = sys.stdin.readline

# N個整数
n, k = list(map(int, input().split()))

s = input() + '2'

# 1整数
# n = int(input())

ret = 0


##この文字の次の0まで示す
def next0(l: int):
    if l >= n:
        return l
    l += 1
    while s[l] != '2' and s[l] != '0':
        l += 1
    return min(l, n)


##この文字の次の1まで示す
def next1(l: int):
    if l >= n:
        return l
    l += 1
    while s[l] != '2' and s[l] != '1':
        l += 1
    return min(l, n)


start = 0
end = 0
ret = 0
# まずendをKこ進める
end = next0(end)
for i in range(k):
    end = next1(end)
    end = next0(end)

ret = end - start
#print(start, end, ret)

while end < n:
    start = next1(next0(start))
    end = next0(next1(end))
    ret = max(ret, end - start)
    #print(start, end, ret)
print(ret)


Measured memory_bytes: 4316
import sys
N = int(input())
A = [int(i) for i in input().split()]
A.sort()
mod = 10**9 + 7
ans = 1
if N == 1:
    if A[0] == 0:
        print(ans)
        sys.exit()
    else:
        print(0)
        sys.exit()
if N%2 == 0:
    for i in range(N//2):
        if A[2*i] != 2*i+1 or A[2*i+1] != 2*i+1:
            print(0)
            sys.exit()
        else:
            ans = 2*ans%mod
    print(ans)
else:
    if A.pop(0) != 0:
        print(0)
        sys.exit()
    else:
        for i in range((N-1)//2):
            if A[2*i] != 2*i+2 or A[2*i+1] != 2*i+2:
                print(0)
                sys.exit()
            else:
                ans = 2*ans%mod
    print(ans)

Measured memory_bytes: 13880
#include <cstdio>

using namespace std;

int main() {
  int i, j, k;
  int N;
  char s[100010][11];
  long long table[5] = {};
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%s", s[i]);
    if (s[i][0] == 'M') {
      table[0] += 1;
    }
    if (s[i][0] == 'A') {
      table[1] += 1;
    }
    if (s[i][0] == 'R') {
      table[2] += 1;
    }
    if (s[i][0] == 'C') {
      table[3] += 1;
    }
    if (s[i][0] == 'H') {
      table[4] += 1;
    }
  }
  long long ans = 0;
  for (i = 0; i < 5; i++) {
    for (j = 0; j < i; j++) {
      for (k = 0; k < j; k++) {
	ans += table[i]*table[j]*table[k];
      }
    }
  }
  printf("%lld", ans);
  return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>
#include <math.h>
#include <stdlib.h>
int main (){
int n,m,a[52],b[52],c[52],d[52],i,j,e,f,g;
scanf("%d %d",&n, &m);
for(i=1;i<=n;i++){
scanf("%d %d",&a[i],&b[i]);
}
for(i=1;i<=m;i++){
scanf("%d %d",&c[i],&d[i]);
}
for(i=1;i<=n;i++){
e=500000000;
for(j=m;j>=1;j--){
f=abs(a[i]-c[j])+abs(b[i]-d[j]);
if (f<=e) {
e=f;
g=j;
}
}
printf("%d\n",g);
}
return 0;
}


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

int main()
{
	long long int a, b ; cin>>a>>b;
	int x = a ,  y = b;
	/*for(int i = 1 ; i < y ; i++ ){
		a = a*10 + x ;
	}
	for(int i = 1 ; i < x ; i++ ){
		b = b*10 + y ;
	}*/	
	//cout<<a<<" "<<b;
	if( x > y ){
		for( int i = 0 ; i< x ; i++) cout<<b;
	}
	else for(int i =0 ; i<y ;i++) cout<<a;
	
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashSet;
fn main() {
    input! {
        a: i64,
        b:i64,
        k: i64,
    }
    for v in a..std::cmp::min(b + 1, a + k) {
        println!("{}", v);
    }
    for v in std::cmp::max(a + k, b - k + 1)..b + 1 {
        println!("{}", v);
    }
}


Measured memory_bytes: 4476
//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
//----------------------------------------------------------------------

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

int main(void) {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> s(n+1);

    rep(i, n) {
        s[i+1] = s[i] + a[i];
    }

    ll ans = 1e18;
    for(int i = 1; i < n; ++i) {
        ans = min(ans, abs(s[i] - (s[n] - s[i])) );
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3328
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_A 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 LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
#endif

#ifdef _DEBUG
void init_global_A() {}
#else

#endif

int main_A() {
    cin.tie(0);
    ios::sync_with_stdio(false);
     
    int R, G; cin >> R >> G;

    // G = (R+P)/2
    int ans = 2*G - R;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import Foundation
//最大公約数を求める関数
func gcd(_ num1: Int, _ num2: Int) -> Int {
   let r = num1 % num2
   if r != 0 {
       return gcd(num2, r)
   } else {
       return num2
   }
}
//３つ以上の数の最大公約数を求める
func gcdArr(_ numArr: [Int]) -> Int {
    var ans: Int = numArr[0]
    for i in numArr {
        ans = gcd(ans, i)
    }
    return ans
}

//最小公倍数を求める関数
func lcm(_ num1: Int, _ num2: Int) -> Int {
    
    var gcdNum = gcd(num1, num2)
    return num1*num2/gcdNum
}

//３つ以上の最大公約数を求める
func lcmArr(_ numArr: [Int]) -> Int {
    var ans: Int = 1
    for i in numArr {
        ans = lcm(ans, i)
    }
    return ans
}


let ri = Int(readLine()!)!
let ra = readLine()!.split(separator: " ").map({Int($0)!})
print(gcdArr(ra))

Measured memory_bytes: 18068
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  string s,t;
  cin >> s >> t;
  ll res = 0;
  for(int i = 0;i < (int)s.size();i++){
    if(s[i] != t[i])res++;
  }
  cout << res << endl;
}

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

int main() {
	long long n; cin >> n;
	string res = {};
	while (n > 0)
	{
		n--;
		long long d = n % 26;
		res.push_back('a' + d);
		n /= 26;
	}
	reverse(res.begin(), res.end());
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;

int main() {
    int h,w;
    cin>>h>>w;
    vector<vector<char> >vec(h,vector<char>(w));
    for(int i=0;i<h;i++) for(int j=0;j<w;j++) cin>>vec[i][j];
    vector<vector<int> >dp(h,vector<int>(w,0));
    dp[0][0]=1;
    for(int i=1;i<w;i++) if(vec[0][i]=='.') dp[0][i]=dp[0][i-1]%mod;
    for(int i=1;i<h;i++) if(vec[i][0]=='.') dp[i][0]=dp[i-1][0]%mod;
    for(int i=1;i<h;i++) for(int j=1;j<w;j++)
    {
        if(vec[i][j]!='.') continue;
        dp[i][j]=(dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
    }
    cout<<dp[h-1][w-1];
    return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h> //library
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //for-loop (from 0)
#define reps(i,n) for(int i = 1; i <= (int)(n); i++) //for-loop (from 1)
#define all(x) (x).begin(),(x).end() //start-to-end iteration, mainly in upper_bound, lower_bound
#define SZ(x) ((int)(x).size()) //unsigned to signed

using namespace std;
using ll = long long; //long long
ll M = 1000000000 + 7;
const ll INF = 1LL << 60;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; } //compare a,b and replace by greater
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; } //compare a,b and replace by smaller
ll qp(int a, ll b) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; } //power
ll qp(int a, ll b, ll Mod) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a%Mod; a = 1ll * a*a%Mod; } while (b >>= 1); return ans; } //power(mod)
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; } //gcd
int dx[4] = { 1,0,-1,0 }; //path
int dy[4] = { 0,1,0,-1 }; //path
ll RS(ll N, ll P) { if (P == 0)return 1; else if (P % 2 == 0) { ll sq = RS(N, P / 2); return sq*sq; } else { return N*RS(N, P - 1); } } //power(repeat-square,fast)
ll nPr(ll n, ll r) { ll ans = 1; rep(i, r) { ans = ans * (n - i); } return ans; } //permutation
ll nCr(ll n, ll r) { ll bunbo = 1; ll bunshi = 1; rep(i, r) { bunbo = bunbo * (i + 1); bunshi = bunshi * (n - i); } return bunshi / bunbo; } //combination
ll RS(ll N, ll P, ll Mod) { if (P == 0)return 1; else if (P % 2 == 0) { ll sq = RS(N, P / 2, Mod); return sq*sq%Mod; } else { return N*RS(N, P - 1, Mod) % Mod; } } //power(mod)(repeat-square,fast)
ll nPr(ll n, ll r, ll Mod) { ll ans = 1; rep(i, r) { ans = ans * (n - i) % Mod; } return ans; } //permutation
ll nCr(ll n, ll r, ll Mod) { ll bunbo = 1; ll bunshi = 1; rep(i, r) { bunbo = bunbo * (i + 1) % Mod; bunshi = bunshi * (n - i) % Mod; } return bunshi * RS(bunbo, Mod - 2, Mod) % Mod; } //combination

int cod[11][11];

int main(void) {
  int N,D; cin >> N >> D;
  rep(i,N) rep(j,D) cin >> cod[i][j];
  int res = 0;
  for (int i = 0; i < N; i++){
    for (int j = i+1; j < N; j++){
      int dist = 0;
      rep(d,D) dist += (cod[i][d]-cod[j][d])*(cod[i][d]-cod[j][d]);
      reps(x,130){
        if (dist == x*x){
          res++;
          break;
        }
      }
    }
  }
  
  cout << res << "\n";
  
  return 0;
}


Measured memory_bytes: 256
// Problem: https://atcoder.jp/contests/abc160/tasks/abc160_c
// Type:

#include <bits/stdc++.h>

using namespace std;

typedef int32_t i32;
typedef uint32_t u32;
typedef int64_t i64;
typedef uint64_t u64;

int main() {
	
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);

	int k, n;
	cin >> k >> n;
	
	vector<int> m(n);
	for (auto &e : m) {
		cin >> e;
	}

	int d = 0;
	int max_segment = 0;
	for (int i = 1; i < m.size(); ++i) {
		max_segment = max(max_segment, m[i] - m[i - 1]);
		d += m[i] - m[i - 1];
	}
	d += m[0] + (k - m[m.size() - 1]);
	max_segment = max(max_segment, m[0] + (k - m[m.size() - 1]));
	cout << d - max_segment << '\n';

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
int a[3][3],n;
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

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

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







int main() {
  int n;
  cin >> n;
  map<ll, int> m;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    m[a]++;
  }

  ll tate = 0;
  for (auto mm : m) {
    if (mm.second >= 2) {
      tate = max(tate, mm.first);
    }
  }
  m[tate] -= 2;

  ll yoko = 0;
  for (auto mm : m) {
    if (mm.second >= 2) {
      yoko = max(yoko, mm.first);
    }
  }

  cout << tate * yoko << endl;

  return 0;
}


Measured memory_bytes: 6528
#include "stdio.h"

int main()
{
	int input_time;
	int sec, min, hour;
	
	do
	{
		scanf("%d", &input_time);
	} 
	while (input_time >= 86400 && input_time < 0);

	sec  = input_time % 60;
	min  = ((input_time - sec) / 60) % 60;
	hour = (input_time - (input_time % 3600)) / 3600;

	printf("%d:%d:%d\n", hour, min, sec);


	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,h,w;cin >> n >> h >> w;
	int ans=0;
	rep(i,n){
		int a,b;cin >> a >> b;
		if(a>=h && b>=w) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256