akhauriyash/Code-Regression huggingface dataset:
list1 = [int(a) for a in input().split()]
list1_0 = list1[0] #AB
list1_1 = list1[1] #BC
list1_2 = list1[2] #CA

if (list1_0 * list1_1 // 2) > 1:
    print(list1_0 * list1_1 // 2)
else:
    print(list1)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vii vector<vi>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

//mod演算ライブラリ
//mod=1000000007

LL add(LL a,LL b){
  return (a+b)%mod;
}

LL sub(LL a,LL b){
  return (a+mod-b)%mod;
}

LL mul(LL a,LL b){
  return ((a % mod) * (b % mod)) % mod;
}

LL power(LL x,LL y){//繰り返し二乗法 単品利用可
  if(y==0)return 1;
  else if(y==1)return x%mod;
  else if(y%2==0){
    LL tmp=power(x, y/2) % mod;
    return tmp*tmp%mod;
  }else {
    LL tmp=power(x, y/2) % mod;
    return ((tmp*tmp)%mod)*x%mod;
  }
}

LL dvs(LL a,LL b){
  return mul(a,power(b,mod-2));
}

const int SIZE_mod=200005;
int invfact[SIZE_mod];
int fact[SIZE_mod];

LL factset(int a){//aまでの階乗%mod表を作成
  fact[0]=1;
  FORQ(i,1,a){
    fact[i]=mul(fact[i-1],i);
  }
}

LL cmbset(int a){//1~aまでの階乗と階乗数の逆元のmod(mod)を用意 O(a)
  factset(a);
  invfact[a]=power(fact[a],mod-2);
  invfact[0]=1;
  FORD(i,a,1){
    invfact[i]=mul(invfact[i+1],i+1);
  }

}

LL cmb(int n,int r){//nCr%mod  (cmbset後に使用)
  if(n<r||r<0||n<0)return 0;
  return mul(fact[n],mul(invfact[r],invfact[n-r]));
}

LL prm(int n,int r){//nPr%mod
    return mul(cmb(n,r),fact[n]);
}

LL homo(int n,int r){//nHr%mod
  return cmb(n+r-1,r);
}



int main(){
	 //cin.tie(0);
	//ios::sync_with_stdio(false);
	//std::cout << std::fixed;
	//std::cout << std::setprecision(12);
	//std::cout << std::defaultfloat;
	LL n,k;
	cmbset(2000*100);
	cin>>n>>k;
	FORQ(i,1,k){
		if(i>n-k+1){
			cout<<0<<endl;
			continue;
		}
		LL ans=mul(cmb((n-k+1),i),homo(i,k-i));
		cout<<ans<<endl;
	}

	return 0;
}


Measured memory_bytes: 1792
#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define f			first
#define sz(a)       ((int)(a).size())
#define s			second
#define all(v)		v.begin(),v.end()
#define pii 		pair<int,int>
#define vpii 		vector<pii>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)		for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define vi			vector<int>

using namespace std;
using ll  = long long;
using lld = long double;

const int oo = 0x3f3f3f3f;
const ll MOD = 1000000007;
const int N = 1e6 + 10;
int fre[N];



signed main(){

#ifndef ONLINE_JUDGE
	//freopen("in.txt" , "r" , stdin);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);

    int n;
    cin >> n;
    int p = 0;

    fo(i , n) {
        int x;
        cin >> x;
        p = __gcd(p , x);
        fre[x]++;
    }
    
    bool pair_wise = 1;
    for(int i = 2 ; i < N ; i++){
        int cnt = 0;
        for(int j = i ; j < N ; j += i){
            if(fre[j]) cnt+=fre[j];
            if(cnt >= 2){
                pair_wise = false;
                break;
            }
        }
        if(!pair_wise) break;
    }

    if(pair_wise)
        cout << "pairwise coprime\n";
    else if(p == 1)
        cout << "setwise coprime\n";
    else
        cout << "not coprime\n";

    return 0;
}



Measured memory_bytes: 7516
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>
#include<iomanip>

using namespace std;

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long

int main(){
    int n; cin >> n;
    vector<int> T, V; int max_s = 0;
    T.push_back(0);
    rep(i, n){
        int t; cin >> t; max_s += t; T.push_back(max_s);
    }
    rep(i, n){
        int v; cin >> v; V.push_back(v);
    }
    double limv[40005];
    rep(s, max_s+1) limv[s] = min(s, max_s-s);
    rep(s, max_s+1){
        limv[2*s] = min(s, max_s-s);
        limv[2*s+1] = min((double)s+0.5, (double)(max_s-s)-0.5);
    }
    rep(i, n){
        rep(s, max_s + 1){
            double lime;
            if(s < T[i]) lime = V[i]+T[i]-s;
            else if(s <= T[i+1]) lime = V[i];
            else lime = V[i]-T[i+1]+s;
            limv[2*s] = min(limv[2*s], lime);

            double u = s + 0.5, limo;
            if(u < T[i]) limo = V[i]+T[i]-u;
            else if(u <= T[i+1]) limo = V[i];
            else limo = V[i]-T[i+1]+u;
            limv[2*s+1] = min(limv[2*s+1], limo);
        }
    }
    double ans = 0;
    rep(s, max_s*2 + 1){
        ans += (double)limv[s];
    }
    cout << fixed << setprecision(10);
    cout << (ans/2) << endl;
}

Measured memory_bytes: 640
"use strict";
function main(input) {
  let heights = input
    .split(/\n/)[1]
    .split(/\s/)
    .map(s => Number(s));
  let res = 0;
  let maxHeight = 0;
  heights.forEach(height => {
    if (height >= maxHeight) {
      res++;
      maxHeight = height;
    }
  });
  console.log(res);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		int [] in = new int [5];
        for(int i=0;i<5;i++){
                             in[i] = sc.nextInt();
                             if(in[i]==0){ans=i+1;}
                            }
		
		System.out.println(ans);
	}
}


Measured memory_bytes: 35636
#ifdef loc
    #include "codes/loc_debug.h"
#else
    #include <bits/stdc++.h>
    #define pr(...)
    #define pra(a,n)
    #define praa(a,n,m)
    #define prl()
#endif
using namespace std;

typedef long long ll;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define sz(a) int(a.size())
const int N = 100005;

int a[25][25];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    set<int> b;
    rep(i, 0, 200) {
        b.insert(i * i);
    }
    int n, d;
    cin >> n >> d;
    rep(i, 0, n) {
        rep(j, 0, d) {
            cin >> a[i][j];
        }
    }
    int ans = 0;
    rep(i, 0, n) {
        rep(j, i + 1, n) {
            int res = 0;
            rep(k, 0, d) {
                res += (a[i][k] - a[j][k]) * (a[i][k] - a[j][k]);
            }
            if(b.find(res) != b.end()) {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void){
  double sum;
int a;
  scanf("%d",&a);
  for(int i=0;i<a;i++){
  double b;
  scanf("%lf",&b);
  char c[4];
  scanf("%s",c);
  char e[4]="JPY";
  if(strcmp(c,e)==0){
    sum+=b;}
  else{
sum+=b*380000;}
  }
  printf("%.6f",sum);
  return 0;
}

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

int main() {
  char c;
  cin >>c;
  
  if (c=='a'||c=='i'||c=='u'||c=='e'||c=='o'){
    cout<<"vowel"<<endl;
  }
  else{
    cout<<"consonant"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define double long double
#define int long long
#define mii map<int,int>
#define pii pair<int,int>
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf 10000000000000000 //10^16
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
signed main() {
  string s;
  cin>>s;
  int a=0,b=0,c=0;
  rep(i,s.size()) {
    if(i==0) a+=(s[i]-'0')*1000;
    else if(i==1) a+=(s[i]-'0')*100;
    else if(i==2) a+=(s[i]-'0')*10;
    else if(i==3) a+=(s[i]-'0');
    else if(i==5) b+=(s[i]-'0')*10;
    else if(i==6) b+=(s[i]-'0');
    else if(i==8) c+=(s[i]-'0')*10;
    else if(i==9) c+=(s[i]-'0');
  }
  if(a<=2019&&b<=4&&c<=30) cout<<"Heisei"<<endl;
  else cout<<"TBD"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int K = scanner.nextInt();
        int A = scanner.nextInt();
        int B = scanner.nextInt();

        if (A % K == 0 || B % K == 0) {
            System.out.println("OK");
            return;
        }

        int a = A / K;
        int b = B / K;
        if (b - a > 0) {
            System.out.println("OK");
        } else {
            System.out.println("NG");
        }
    }
}


Measured memory_bytes: 35708
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);
    
    int N, M; cin >> N >> M;
    vector<int> X(M);
    rep(i, M) cin >> X[i];
    if (M == 1) {
        cout << 0 << endl;
        return 0;
    }

    sort(X.begin(), X.end());

    vector<int> diff(M-1);
    ll all_sum = 0;
    rep(i, M-1) {
        diff[i] = X[i+1] - X[i];
        all_sum += diff[i];
    }
    sort(diff.begin(), diff.end());
    int nd = diff.size();
    int ns = min(nd, N-1);
    for (int i=0; i<ns; ++i) {
        all_sum -= diff[nd-1-i];
    }

    cout << all_sum << endl;
    return 0;
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
"""
A - Kenken Race
https://atcoder.jp/contests/agc034/tasks/agc034_a

"""
import sys


def solve(N, A, B, C, D, S):
    p_A = set([A])
    for p, n1, n2 in zip(range(A, C), S[A+1:], S[A+2:]):
        if p in p_A:
            if n1 == '.' and p+1 <= C:
                p_A.add(p+1)
            if n2 == '.' and p+2 <= C:
                p_A.add(p+2)

    p_B = set([B])
    for p, n1, n2 in zip(range(B, D), S[B+1:], S[B+2:]):
        if p in p_B:
            if n1 == '.' and p+1 <= D:
                p_B.add(p+1)
            if n2 == '.' and p+2 <= D:
                p_B.add(p+2)

    p_t = set()
    for p, p1, p2, p3 in zip(range(B, N+1), S[B-1:D], S[B:D+1], S[B+1:]):
        if p1 == '.' and p2 == '.' and p3 == '.' and p <= D:
            p_t.add(p)

    if C < D:
        if C in p_A and D in p_B:
            return 'Yes'
        return 'No'
    else:
        if (C in p_A) and (D in p_B) and (p_B & p_t):
            return 'Yes'
        return 'No'


def main(args):
    N, A, B, C, D = map(int, input().split())
    S = input()
    S = '#' + S + '##'
    ans = solve(N, A, B, C, D, S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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


//TEMPLATE
#define pb              push_back
#define mp              make_pair
#define ll              long long
#define ld              long double
//#define pi              3.1415926536
#define pi              acos(-1)
//#define mod             1000000007
#define newline         printf("\n")
#define printminusone   printf("-1\n")
#define scl1(n)         scanf("%lld", &n)
#define scl2(a, b)      scanf("%lld %lld", &a, &b)
#define scl3(a, b, c)   scanf("%lld %lld %lld", &a, &b, &c)
#define printl(n)       printf("%lld\n", n)
#define ssl1(str)       scanf(" %[^\n]", str)
#define scd1(n)         scanf("%lf", &n)
#define scd2(a, b)      scanf("%lf %lf", &a, &b)
#define printd(n)       printf("%lf\n", n)
#define printld(n)      printf("%Lf\n", n)
#define printcase       printf("Case %lld: ", i)
#define reversed(s)     reverse(s.begin(), s.end())
#define asorted(s)      sort(s.begin(), s.end())
#define dsorted(s)      sort(s.begin(), s.end(), cmp)
#define for0(i, n)      for (i = 0; i < n; i++)
#define for1(i, n)      for (i = 1; i <= n; i++)
#define fori(itt, stt)  for(itt = stt.begin(); itt != stt.end(); itt++)
#define pii             pair <ll, ll>
#define piii            pair <ll, pii>
//#define SIZE            100005
//#define INF             1000000005
#define F               first
#define S               second
#define FR              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ms(arr, x)      memset(arr, x, sizeof arr)
#define bitcount(n)     __builtin_popcountll(n)

const ll INF = 1e18;
const ll SIZE = 1e5+5;
const ll mod = 1e9+7;




int main() {
    ll t = 0, n, x, y, z, i, j, k, g, p, q, ans = 0, sum = 0, c = 0;
    string s, s1, s2;

    cin >> n >> k >> s;

    s[k-1] += 32;

    cout << s << "\n";

    return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;
 
int main(){
    int N,sum;
 
    while(1){
	cin >> N;
	if( N == 0 ) break;
	sum = 0;
	for( int j = 1 ; j*j <= N; j++ ){
	    if( N % j == 0 ){ 
		sum += j;
		if( j*j != N ) sum += N/j;
	    }
	}
   
	sum -= N;
	if( N < sum ) cout << "abundant number" << endl;
	else if( N > sum ) cout << "deficient number" << endl;
	else cout << "perfect number" << endl;
    }
    return 0;
 
}

Measured memory_bytes: 3068
#include <iostream>
using namespace std;
int main(void){
  int n;
  cin >> n;
  
  int buf = n;
  
  int sn = 0;
  
  while(n != 0){
    sn = sn + n % 10;
    n = n / 10;
  }
  
  if(buf % sn == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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; }

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

    string s; cin >> s; 

    rep(i,s.size()-1) {
        if(s[i] == 'A' and s[i+1] == 'C') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
people = list(input())
lst = []
count = 0
flag = people[0]
if flag == '1':
	lst.append(0)
for i in range(len(people)):
	if i == len(people) - 1:
		lst.append(count + 1)
	elif people[i] == flag and people[i+1] != flag:
		lst.append(count + 1)
		count = 0
		flag = people[i + 1]
	else:
		count += 1

maximum = 0
l = len(lst)
temp = sum(lst[0:2*K])
maximum = max(maximum, temp)
for i in range(2, l, 2):
	end = i+2*K
	temp = temp - lst[i-2] + sum(lst[end-2:end])
	if i != 2:
		temp -= lst[i-3]
	maximum = max(maximum, temp)

print(maximum)


Measured memory_bytes: 51208
// Problem C

#include <stdio.h>
#include <iostream>
#include <vector>
#include <string.h>
#include <cassert>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <stack>

#define MAXN 100050
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long int ll;
typedef pair<int, int> ii;

ll N;
ll A[MAXN];
ll suffix[MAXN];

int main() {
  cin >> N;
  for (int i=0; i<N+1; i++) scanf("%lld", A + i);
  for (int i=N; i>=0; i--) suffix[i] = suffix[i+1] + A[i];
  
  if (N == 0) {
    if (A[0] == 1) cout << "1\n";
    else cout << "-1\n";
    return 0;
  }
  if (A[0] > 0) {
    cout << "-1\n";
    return 0;
  }
  
  ll res = suffix[0];
  ll livPrec = 1;
  for (int i = 1; i <= N; i++) {
    res += livPrec;
    
    // se non ho abbastanza foglie disponibili
    if (livPrec*(ll)2 < A[i]) {
      cout << "-1\n";
      return 0;
    }
    
    // elimino le foglie e faccio il massimo di figli "intermedi" disponibili
    livPrec = min(livPrec*(ll)2 - A[i], suffix[i+1]);
    // cout << "Livello " << i << " --> " << livPrec << " nuovi nodi intermedi\n";
  }
  
  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 5220
/**
 * Created by hiramekun at 20:56 on 2020-05-17.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll k;
    string s;
    cin >> k >> s;
    if (s.size() <= k) cout << s << '\n';
    else {
        string ans;
        rep(i, k) ans += s[i];
        ans += "...";
        cout << ans << '\n';
    }
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <cassert>
#include <random>
#include <tuple>
#include <cstdint>

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

using namespace std;
typedef long long ll;

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

const int MAX = 210000;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

ll COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

ll modpow(ll a, ll n, ll MOD) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    ll n, m, k; cin >> n >> m >> k;
    COMinit();

    // ((x_dist * n * n + y_dist * m * m)) * com(n*m-2, k-2)
    ll x_dist = 0;
    rep(i, m) {
        if (i < m-1) {
            x_dist += ll(1 + m-i-1) * ll(m-i-1) / 2;
            x_dist %= MOD;
        }
    }
    ll y_dist = 0;
    rep(i, n) {
        if (i < n-1) {
            y_dist += ll(1 + n-i-1) * ll(n-i-1) / 2;
            y_dist %= MOD;
        }
    }
    
    x_dist *= n;
    x_dist %= MOD;
    x_dist *= n;
    x_dist %= MOD;

    y_dist *= m;
    y_dist %= MOD;
    y_dist *= m;
    y_dist %= MOD;

    ll ans = (x_dist + y_dist) % MOD * COM(n*m-2, k-2) % MOD;

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,x;
  cin >> n >> m >> x;
  int a[m];
  bool b[n+1];
  for(int i=0;i<n+1;i++)b[i]=0;
  for(int i=0;i<m;i++){
    cin >> a[i];
    b[a[i]]=1;
  }
  int c=0,d=0;
  for(int i=0;i<x;i++){
    if(b[i])c++;
  }
  for(int i=x;i<=n;i++){
    if(b[i])d++;
  }
  if(c>d)cout << d;
  else cout << c;
}


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

using namespace std;

#define FOR(i,s,e) for(int i=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp make_pair
#define mt make_tuple
#define t0(t) get<0>((t))
#define t1(t) get<1>((t))
#define t2(t) get<2>((t))

typedef long long ll;
const int N = 8;
int n, m;
int g[N][N];

int dfs(int s, int n, int p[N]) {
  int done = 1;
  REP(i,n) done &= p[i];
  if (done) return 1;
  int res = 0;
  REP(i,n) {
    if (!g[s][i]) continue;
    if (p[i]) continue;
    p[i] = 1;
    res += dfs(i,n,p);
    p[i] = 0;
  }
  return res;
}

int main() {
  fscanf(stdin, "%d%d ", &n, &m);
  REP(i,m) {
    int a, b;
    fscanf(stdin, "%d%d ", &a, &b);
    a--; b--;
    g[a][b] = g[b][a] = 1;
  }
  int p[N];
  memset(p, 0, sizeof(p));
  p[0] = 1;
  fprintf(stdout, "%d\n", dfs(0,n,p));
  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        scan.nextLine();
        String s = scan.nextLine();
        String[] t = scan.nextLine().split("");
        String c = "";
        scan.close();
        int l = n * 2;
        for (int i = 0; i < n; i++) {
            c += t[i];
            if (s.endsWith(c)) {
                l = n * 2;
                l -= (i+1);
            }

        }
        System.out.println(l);
    }
}


Measured memory_bytes: 9812
package main

import (
  "fmt"
  "strings"
  "sort"
)

func main() {
  var n, l int
  fmt.Scanf("%d %d", &n, &l)
  arr := make([]string, n)

  for i := 0; i < n; i++ {
    fmt.Scanf("%s", &arr[i])
  }
  sort.Strings(arr)
  fmt.Println(strings.Join(arr, ""))
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
cin >> N;
vector<int64_t> vec(N);
for (int i = 0; i < N ;i++){
  cin >> vec.at(i);}
int64_t a = 1;
int64_t k = 1;
bool right = true;
for ( int i = 0 ; i < N ; i++){
 if ( vec.at(i) == 0 ) {
   a = 0 ;
   cout << 0 << endl;
   return 0;
 }
}
for ( int i = 0 ; i < 18 ; i++){
k *= 10;}
for (int i = 0; i < N ; i++){
  a *= vec.at(i);
  if ( a > k ) {
    right = false ;
    break;
}
}
  
if (0 < a && right) {cout << a << endl;}
else {cout << -1 << endl;}
}


Measured memory_bytes: 4060
import java.util.Scanner;

public class Main 
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n;
		n=sc.nextInt();
		if(n==1)
			System.out.println("Hello World");
		else
		{
			int a,b;
			a=sc.nextInt();
			b=sc.nextInt();
			System.out.println(a+b);
		}
	}
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
const double EPS=1e-3;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int)((a).size())
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) a.rbegin(),a.rend()
#define FLL(a,b) memset((a),b,sizeof(a))
#define CLR(a) FLL(a,0)
#define declare(a,it) __typeof(a) it=(a)
#define FOR(it,a) for(declare(a.begin(),it);it!=a.end();++it)
#define FORR(it,a) for(declare(a.rbegin(),it);it!=a.rend();++it)
template<class T,class U> ostream& operator<< (ostream& o, const pair<T,U>& v){return o << "(" << v.F << ", " << v.S << ")";}
template<class T> ostream& operator<< (ostream& o, const vector<T>& v){o << "{";rep(i,SZ(v)) o << (i?", ":"") << v[i];return o << "}";}
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,-1,1,1,-1};
int s2i(string& a){stringstream ss(a);int r;ss>>r;return r;}
int geti(){int n;scanf("%d", &n);return n;}

int x[100],y[100];



int main(int argc, char *argv[])
{
  int n;
  cin >> n;

  double sumx = 0;
  double sumy = 0;
  for(int i = 0; i < n; ++i){
    cin >> x[i] >> y[i];
    sumx += x[i];
    sumy += y[i];
  }
  sumx /= n;
  sumy /= n;
  
  bool ok = true;
  for(int i = 0; i < n; ++i){
    double ax = x[(i+1)%n] - x[i];
    double ay = y[(i+1)%n] - y[i];
    double bx = x[(i+1+n/2)%n] - x[(i+n/2)%n];
    double by = y[(i+1+n/2)%n] - y[(i+n/2)%n];
    ok &= abs(ax*by - bx*ay) < EPS;
    ok &= abs(ax*ax+ay*ay-(bx*bx + by*by)) < EPS;
    continue;
    ok &= abs((ax*bx+ay*by)/sqrt(ax*ax+ay*ay)/sqrt(bx*bx+by*by)-
              cos(acos(-1)*2/n)) < EPS;
  }
  
  if(ok && ~n%2) printf("%.10f %.10f\n", sumx, sumy);
  else cout << "NA" << endl;
  
  return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;

typedef long long ll;

int h[102];

int main() {
  int N; cin >> N;
  for ( int i = 1; i <= N; i++ ) cin >> h[i];

  int ans = 0;
  int active = 0;
  for ( int i = 1; i <= N; i++ ) {
    if ( active < h[i] ) {
      ans += h[i]-active;
      active = h[i];
	} else {
      active = h[i];
    }
  }
  cout << ans << endl;
  return 0;
}


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


void solve(long long N, long long K, std::vector<long long> p){
    sort(p.begin(),p.end());
    long long ans = 0;
    for(int i=0; i<K; i++){
        ans += p[i];
    }
    cout << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> p(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&p[i]);
    }
    solve(N, K, std::move(p));
    return 0;
}


Measured memory_bytes: 3668
import numpy as np

if __name__ == '__main__':
    n, l = map(int, input().split())
    apples = np.arange(start=1, stop=n + 1, step=1)
    apples_taste = apples + l - 1
    apples_taste_abs = np.abs(apples_taste)
    index_can_eat_apple = apples_taste_abs.argmin()
    nokori_apples = np.delete(apples_taste, index_can_eat_apple)
    print(np.sum(nokori_apples))


Measured memory_bytes: 12484
#include<iostream>
#include<tuple>
#include<vector>
#include<algorithm>
#include<iterator>
#include<cmath>
#include<functional>
using namespace std;

int main(){
    long X;
    cin >> X;
    long r=0;
    for(int i=0; i<X+1; i++){
        r += i;
        if (r >= X){
            cout << i << endl;
            return 0;
        }
    }
}



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

int main(){
  string S;
  cin >> S;
  bool a=false;//false:TBD//
  string M="mm",D="dd";
  
  for(int i=0;i<2;i++){
    M.at(i)=S.at(i+5);
  }
  for(int i=0;i<2;i++){
    D.at(i)=S.at(i+8);
  }
  
  if(M=="01" || M== "02" || M=="03" || M=="04"){
    a=true;
  }
  if(a){
    cout << "Heisei" << endl;
  }
  else{
    cout << "TBD" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    rep(i,n){
        cin>>a[i];
    }
    int cnt=1;
    int ans=0;
    rep(i,n){
        if(a[i]==cnt){ans++; cnt++;}
    }
    if(ans!=0)cout<<n-ans<<endl;
    else cout<<-1<<endl;
}


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

int main() {
  // 100要素の配列で初期化
  int n;
  cin>>n;
  vector<int> vec(n);
string a="YES";
  // 100個の入力を受け取る
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  sort (vec.begin(),vec.end());
for (int i=1;i<n;i++){
  if (vec.at(i)==vec.at(i-1))
    a="NO";
    }
  cout <<a<<endl ;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int n;cin>>n;
  vector<int> a(n);
  rep(i,n)cin>>a[i];
  ll res=0;
  int cur=a[0];
  cur+=(1<<30);
  int l=0;
  a.push_back((1<<30));
  bool flag=true;
  rep1(i,n){
    if(a[i-1]!=0)flag=false;
    if(cur+a[i]==(cur^a[i])){
      cur+=a[i];
      //cout<<cur<<endl;
      continue;
    }
    else{
      while(cur+a[i]!=(cur^a[i])&&l<i){
        res+=i-l;
        cur-=a[l];
        
        l++;
      }
      cur+=a[i];
      //cout<<cur-(1<<30)<<endl;
      //cout<<"OK"<<endl;
    }
  }
  //if(!flag)res--;
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 4608
n = int(input())
s = input()

state  = 0
cn = 0

for i in s:
    if(i == "A"):
        state  = 1
    elif(i == "B"):
        if(state  == 1):
            state  = 2
        else:
            state = 0
    elif(i == "C"):
        if(state  == 2):
            cn += 1
        state = 0
    else:
        state = 0

print(cn)

Measured memory_bytes: 38360
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>
#include <unordered_map>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

struct RollingHash {
    static const int base1 = 1007, base2 = 2009;
    static const int mod1 = 1000000007, mod2 = 1000000009;
    vector<long long> hash1, hash2, power1, power2;

    // construct
    RollingHash(const string &S) {
        int n = (int)S.size();
        hash1.assign(n+1, 0);
        hash2.assign(n+1, 0);
        power1.assign(n+1, 1);
        power2.assign(n+1, 1);
        for (int i = 0; i < n; ++i) {
            hash1[i+1] = (hash1[i] * base1 + S[i]) % mod1;
            hash2[i+1] = (hash2[i] * base2 + S[i]) % mod2;
            power1[i+1] = (power1[i] * base1) % mod1;
            power2[i+1] = (power2[i] * base2) % mod2;
        }
    }

    // get hash of S[left:right]
    inline pair<long long, long long> get(int l, int r) const {
        long long res1 = hash1[r] - hash1[l] * power1[r-l] % mod1;
        if (res1 < 0) res1 += mod1;
        long long res2 = hash2[r] - hash2[l] * power2[r-l] % mod2;
        if (res2 < 0) res2 += mod2;
        return {res1, res2};
    }
};

bool check(string s, int mid, const RollingHash& rh){
    map<pair<LL,LL>,int> mp;
    for(int i = 0; i+mid <= int(s.length()); i++){
        auto p = rh.get(i,i+mid);
        if(mp.find(p) != mp.end()){
            if(i >= mp[p] + mid){
                return true;
            }
        }else{
            mp[p] = i;
        }
    }
    return false;
}


signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    string S; cin >> S;

    RollingHash rh(S);

    int ok = 0;
    int ng = N+1;
    while(abs(ng-ok) > 1){
        int mid = (ok + ng) / 2;
        if(check(S,mid,rh)){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    cout << ok << endl;


}


Measured memory_bytes: 768
# -*- coding: utf-8 -*-
from collections import Counter
# input
n = int(input())
s = []
for i in range(n):
    s.append(input())
c = Counter(s)
# output
ma = c.most_common()[0][1]
o = [k for k, v in c.items() if v == ma]
o.sort()
print('\n'.join(o))


Measured memory_bytes: 45076
import Data.Char
import Data.List
data PatTree = P { bodies :: [[Int]],
                   pieces :: [Int],
                   wastePiece :: [Int]} deriving Show

main = do
    pieces <- fmap (map (sort.map digitToInt).lines) getContents
    mapM_ (printResult.solve) pieces

printResult :: [Int] -> IO ()
printResult xs = if null xs then putStrLn "0"
                            else putStrLn.unwords.map show  $ xs
solve :: [Int] -> [Int]
solve ps = sort.nub.concat.map searchLastPiece.concat.map (foldl (>>=) [toPatTree (sort ps)]) $ patterns

toPatTree :: [Int] -> PatTree
toPatTree ints = P [] ints ps
    where ps = map snd.filter (\(a,b) -> a == 4) $ zip (map length.group $ ints) (nub ints)
addPattern :: PatTree -> [Int] -> PatTree
addPattern pattree pat = P (pat:bodies pattree) (pieces pattree \\ pat) (wastePiece pattree)

getOrder :: PatTree -> [PatTree]
getOrder pats = map (addPattern pats).searchOrder.pieces $ pats 
searchOrder xs = [ [x,y,z] | x <- xs', y <- xs' \\ [x], z <- xs' \\ [x,y], [x,y,z] == [x..x+2]]
    where xs' = nub xs

getTriple :: PatTree -> [PatTree]
getTriple pats = map (addPattern pats).searchTriple.pieces $ pats 
searchTriple xs = nub $ [[x,y,z] | x <- xs, y <- xs \\ [x], z <- xs \\ [x,y], x == y && y == z]

getHead :: PatTree -> [PatTree]
getHead pats = map (addPattern pats).searchHead.pieces $ pats 
searchHead xs = nub $ [[x,y] | x <- xs, y <- xs \\ [x], x == y]

patterns = [[a,b,c,d] | a <- [getTriple,getOrder], b <- [getTriple,getOrder], c <- [getTriple, getOrder], d <- [getTriple,getOrder]] ++ [[getHead,a,b,c] | a <- [getTriple,getOrder], b <- [getTriple,getOrder],c <- [getTriple, getOrder]]

searchLastPiece :: PatTree -> [Int] 
searchLastPiece pat = case length (pieces pat) of
                        1 -> lastHead pat
                        otherwise -> lastPiece pat

lastHead :: PatTree -> [Int] 
lastHead pat = if any (== (head.pieces $ pat)) (wastePiece pat) then []
                                                                else [head.pieces $ pat]

lastPiece :: PatTree -> [Int]
lastPiece pat = filter (\x -> 1 <= x && x <= 9).filter (not.flip elem (wastePiece pat)) $ n
    where n  
            | pieces pat == [i,i] = [i]
            | pieces pat == [i,i+1] = [i-1,i+2]
            | pieces pat == [i,i+2] = [i+1]
            | otherwise = []
          i = head.pieces $ pat
          j = i+1

Measured memory_bytes: 4352
fun main() {
    val (_, k) = readInts()
    val p = readInts().sorted()

    println(p.subList(0, k).sum())
}

// Input Reader
private fun readLn() = readLine()!!

private fun readStrings() = readLn().trim().split(" ")
//private fun readInt() = readLn().toInt()
private fun readInts() = readStrings().map { it.toInt() }


Measured memory_bytes: 40664
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
  
int main()
{
  int N, K;
  cin >> N >> K;

  vector<int> a(N);
  REP(i, N) cin >> a[i];

  sort(ALL(a));
  vector<pair<int,int>> b;
  map<int,int> c;
  REP(i,N){
    c[a.at(i)]++;
  }

  for(auto x:c){
    b.push_back(make_pair(x.second,x.first));
  }
  sort(ALL(b));
  reverse(ALL(b));

  int sum = 0;
  int d = min(K,int(b.size()));
  REP(i,d){
    sum+=b.at(i).first;
  }

  cout << N - sum << endl;
}

Measured memory_bytes: 12536
#include <stdio.h>


int main(void) {

	// 1_5-A Print a Rectangle

	int h,w;
	int i,j;
	
	scanf("%d %d",&h,&w);

	while(h!=0 && w!=0){
		for(i=0; i<h; i++){
			for(j=0; j<w; j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
		scanf("%d %d",&h,&w);
	}
        return 0;
}

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

using namespace std;
using ll = long long;

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

  int n;
  cin >> n;
  vector<ll> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i] - (i + 1);
  }
  sort(b.begin(), b.end());

  ll ans = 0;
  ll x = b[n / 2];
  for (auto bb : b) {
    ans += abs(bb - x);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6368
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

int main(void){
  string s;
  cin >> s;
  if (s[0] == 'S')
    cout << "Cloudy" << endl;
  else if (s[0] == 'C')
    cout << "Rainy" << endl;
  else
    cout << "Sunny" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

// const ll MOD = 1e9 + 7;
const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N;
    string s;
    cin >> N >> s;

    ll ans = 1;
    vl pcnt(4), ccnt(4);
    pcnt[0] = N;
    rep(i,3*N){
        ll c = s[i] % 3;
        ll p = 0;
        rep(j, 3) if (ccnt[c] < ccnt[j]) p++;
        ccnt[c]++;
        ans *= pcnt[p], ans %= MOD;
        pcnt[p]--, pcnt[p+1]++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 1000000007
#define N 500005
int main()
{
    int i,n,x;
    in(n);
    double d;
    rep(i,n+1)
    {
        d=i,d*=1.08;
        x=(int)d;
        if(x==n)
        {
            out(i);
            exit(0);
        }
    }
    printf(":(");
    exit(0);
}







Measured memory_bytes: 256
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'APPROVED' : 'DENIED') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n=gi
a=gsmi
can=true

n.times do |i|
  if a[i]%2==0
    unless a[i]%3==0 || a[i]%5==0
      can=false
      break
    end
  end
end
puts_yesno can

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

using namespace std;

using ll = long long;

ll Solve() {
    ll n, m;
    cin >> n >> m;

    ll res = 0;
    for (ll f = 1; f * f <= m; ++f) {
        if (m % f != 0) continue;

        if (f * n <= m) res = max(res, f);
        if ((m / f) * n <= m) res = max(res, m / f);
    }

    return res;
}

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

    cout << Solve() << endl;

    return 0;
}


Measured memory_bytes: 256
# coding: utf-8

N, x, y = map(int,input().split())
x, y = x-1, y-1
A = [0] * N

for i in range(N-1):
    for j in range(i+1,N):
        if i <= x and j <= x:
            dist = j - i
        elif i <= x and x <= j <= y:
            dist = min(j - i, x - i + 1 + y - j)
        elif i <= x and y <= j:
            dist = x - i + 1 + j - y
        elif x <= i <= y and x <= j <= y:
            dist = min(j - i, i - x + 1 + y - j)
        elif x <= i <= y and y <= j:
            dist = min(j - i, i - x + 1 + j - y)
        else:
            dist = j - i
        
        A[dist] += 1

for i in range(1,N):
    print(A[i])

Measured memory_bytes: 3444
#include <stdio.h>

int main(void){
	
int b,n;
int a[100]={0};
scanf("%d",&n);

for(b=1;b<=n;b++){
scanf("%d",&a[b]);
}

for(b=n;b>=1;b--){
printf("%d",a[b]);
if(!(b==1)){
printf(" ");
}
}
printf("\n");
return 0;
}

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

int main()
{
    int  i=0,j=0;


        for(i=0;i<9;i++){
            for(j=0;j<9;j++){
                cout << i+1 << 'x' << j+1 << '=' << (i+1)*(j+1) << endl;

            }
        }


        /*for(i=0;i<m;i++){//????????¨??????
            for(j=0;j<l;j++){
               cout << bb[i][j] << ' ';

            }
            cout << endl;
        }*/





    //cout << endl;

return 0;

}

Measured memory_bytes: 1116
# -*-coding:utf-8

#import fileinput
import math

def main():

    n = int(input())

    for i in range(1, n+1):
        x = i
        if (x%3 == 0):
            print(' %d' % i, end='')
        else:
            while(x):
                if (x%10 == 3):
                    print(' %d' % i, end='')
                    break
                else:
                    x = int(x/10)

    print('')

if __name__ == '__main__':
    main()

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}

vector<ll> time2(53);//time2[x]=2^x

ll ans(ll N,ll X){
	if(N==0 && X==1) return 1;
	if(X==1) return 0;
	if(X==time2[N+2]-3) return time2[N+1]-1;
	if(X==time2[N+1]-1) return time2[N];

	if(X<time2[N+1]-1) return ans(N-1,X-1);
	//if(X<time2[N+2]-3) 
	return time2[N]+ans(N-1,X-time2[N+1]+1);
}
//a,b x
int main(){
	ll N,X; cin>>N>>X;

	time2[0]=1;
	rep1(i,52) time2[i]=time2[i-1]*2;

	cout<<ans(N,X);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>
#include <bitset>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N; cin >> N;
  int ans;
  for (int i = 1; i <= 9; ++i){
    if (N <= 100 * i + 10 * i + i) {
      ans = 100 * i + 10 * i + i;
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
package main
import(
	"fmt"
)
func main(){
	n, m := 0, 0
	fmt.Scan(&n)
	fmt.Scan(&m)
	if 2*n > m{
		fmt.Println(m/2)
	}else{
		fmt.Println((n + (m - 2*n)/4))
	}
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
int main() {
	std::string a, b, c;
    std::cin>> a >> b >> c;
	if (a[a.size() - 1] == b[0] && b[b.size()-1] == c[0]) {
		std::cout << "YES" << std::endl;
	}
	else {
		std::cout << "NO" << std::endl;
	}
	return 0;
}


Measured memory_bytes: 256