akhauriyash/Code-Regression huggingface dataset:
// header {{{
#include <bits/stdc++.h>
using namespace std;

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    string s;cin >> s;
    int w;cin >> w;
    int n = s.size();
    inc(i, 0, n){
        if(i%w == 0){
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[]a = new int[n]; //配列の個数宣言
        for(int i=0;i<a.length;i++){
            a[i] = sc.nextInt();
        }
        for(int i=n-1;i>=0;i--){
            System.out.printf("%d",a[i]);
            if(i!=0){
                System.out.printf(" ");
            }
        }
        System.out.println();
        sc.close();
    }
}


Measured memory_bytes: 26448
#include <bits/stdc++.h>
#define ll long long

#define TASKNAME ""

using namespace std;

const int INF = 1e9 + 7;
const int MAXN = 1e5 + 7;
const double EPS = 1e-8;
const int LOGN = 30;

int main() {
    #ifdef MY
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #else
        //freopen(TASKNAME".in", "r", stdin);
        //freopen(TASKNAME".out", "w", stdout);
    #endif // MY
    string s;
    cin >> s;
    ll ans = 0;
    ll n = s.size();
    vector <ll> cnt(LOGN, 0);
    for (char c : s) {
        cnt[c - 'a']++;
    }
    for (int i = 0; i < LOGN; i++) {
        ans += cnt[i] * (n - cnt[i]);
    }
    cout << ans / 2 + 1;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
	long int i, j;
	long int n;
	long int a[200000] = {0};
	long int sum = 0;
	long int left, right;
	long int ans = 0;
	
	scanf("%ld", &n);
	
	sum = 0;
	for(i = 0; i < n; i++) {
		scanf("%ld", &a[i]);
		sum += a[i];
	}
	
	left = 0;
	for(i = 0; i < n; i++) {
		left += a[i];
		if(left >= (sum / 2) ) {
			right = sum - left;
			//printf("%ld %ld\n", left, right);
			if(right == left) {
				printf("0\n");
				return 0;
			}
			ans = labs( right - left);
			if(labs( right - left) > labs( (right + a[i]) - (left - a[i]) ) ) {
				//printf("%ld %ld\n", left, right);
				ans = labs( (right + a[i]) - (left - a[i]) );
			}
			break;
		}
	}
	
	printf("%ld\n", ans);
	
	return 0;
}


Measured memory_bytes: 1792
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
q = int(input())
S = sum(a)
d = defaultdict(int)
for i in range(n):
    d[a[i]] += 1
for i in range(q):
    b,c = map(int,input().split())
    bnum = d[b]
    cnum = d[c]
    S += (c-b)*bnum
    d[b] = 0
    d[c] = bnum+cnum
    print(S)

Measured memory_bytes: 89632
import java.util.Scanner;

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

        int range = 2*D+1;
        int result;
        if (N%range == 0){
            result = N / range;
        }else{
            result = N / range + 1;
        }

        System.out.println(result);
    }
}


Measured memory_bytes: 22740
N, M = map(int,input().split())

A = []
for i in range(N):
  a,b = map(int,input().split())
  A.append([a,b])

A.sort()
#print(A)

nokori = M
yen = 0
mise = 0
while nokori > 0:
  if A[mise][1] >= nokori: #i番目の店で何本買えるか
    yen += A[mise][0]*nokori
    break
  else:
    yen += A[mise][0]*A[mise][1]
    nokori -= A[mise][1]
    mise += 1
print(yen)
  

Measured memory_bytes: 20064
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const int NIL = -1;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
struct Point {
	int x, y, id;
	Point() {}
	Point(int x, int y, int id = 0) :x(x), y(y), id(id) {}
	bool operator<(const Point &p) const {
		return id < p.id;
	}
	void print() { printf("%d\n", id); }
};
bool lessX(const Point &p1, const Point &p2) {
	return (p1.x == p2.x) ? (p1.y < p2.y) : (p1.x < p2.x);
}
bool lessY(const Point &p1, const Point &p2) {
	return (p1.y == p2.y) ? (p1.x < p2.x) : (p1.y < p2.y);
}
struct KDtree {
	struct Node {
		int index, l, r;
		Node() :index(NIL), l(NIL), r(NIL) {}
	};
	int n, np, root; vector<Point>points; vector<Node>nodes;
	KDtree(const vector<Point> &ps) :n(ps.size()), np(0), points(ps), nodes(n) {
		root = makeKDtree(0, n, true);
	}
	int makeKDtree(int l, int r, bool is_x_base = true) {
		if (!(l < r))return NIL;
		int t = np++, mid = (l + r) / 2;
		vector<Point>::iterator first = points.begin()+l,
			nth = points.begin() + mid, last = points.begin() + r;
		if (is_x_base)nth_element(first, nth, last, lessX);
		else nth_element(first, nth, last, lessY);
		nodes[t].index = mid;
		nodes[t].l = makeKDtree(l, mid, !is_x_base);
		nodes[t].r = makeKDtree(mid + 1, r, !is_x_base);
		return t;
	}
	vector<Point>ret;
	bool inrange(Point &p, Point &s, Point &t) {
		return (s.x <= p.x&&p.x <= t.x) && (s.y <= p.y&&p.y <= t.y);
	}
	vector<Point> find(Point s, Point t) {
		ret.clear();
		return find(root, s, t, true);
	}
	vector<Point> find(int v, Point s, Point t, bool is_x_base = true) {
		auto p = points[nodes[v].index];
		if (inrange(p, s, t))ret.emplace_back(p);
		if (is_x_base) {
			if (nodes[v].l != NIL && s.x <= p.x)find(nodes[v].l, s, t, !is_x_base);
			if (nodes[v].r != NIL && p.x <= t.x)find(nodes[v].r, s, t, !is_x_base);
		}
		else {
			if (nodes[v].l != NIL && s.y <= p.y)find(nodes[v].l, s, t, !is_x_base);
			if (nodes[v].r != NIL && p.y <= t.y)find(nodes[v].r, s, t, !is_x_base);
		}
		return ret;
	}
};
signed main() {
	int n; scanf("%d", &n);
	vector<Point>ps(n);
	rep(i, 0, n) {
		int x, y; scanf("%d%d", &x, &y);
		ps[i] = Point(x, y, i);
	}
	KDtree tree(ps);
	int q; scanf("%d", &q);
	rep(i, 0, q) {
		int sx, tx, sy, ty; scanf("%d%d%d%d", &sx, &tx, &sy, &ty);
		auto ans = tree.find(Point(sx, sy), Point(tx, ty));
		sort(all(ans));
		rep(j, 0, ans.size())ans[j].print();
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 20004
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define lcm( a, b ) ((a)/__gcd(a,b)*(b))
#define MP make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> iP;
typedef pair< LL, LL > LP;

const int INF = INT_MAX;
const int MIN = INT_MIN;
const LL LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const int SIZE = 300005;

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i ) {
            ret.pb( i );
            if( i * i != n ) ret.pb( n / i );

        }
    }
    sort( all( ret ) );
    return ret;
}

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

    string t;
    cin >> t;
    bool n = false, w = false, s = false, e = false;
    for( int i = 0; i < t.size(); ++i ) {
        if( t[i] == 'N' ) n = true;
        if( t[i] == 'W' ) w = true;
        if( t[i] == 'S' ) s = true;
        if( t[i] == 'E' ) e = true;

    }

    if( n && !s || !n && s || w && !e || !w && e ) cout << "No";
    else cout << "Yes";

    cout << endl;
    return 0;
}



Measured memory_bytes: 256
def f(n):
    N=n
    s=0
    for i in range(5):
        g = n%10
        s+=g
        n = int(n / 10)
        if n < 1:
            break
    if a<=s and s<=b:
        return N
    return 0
n,a,b = map(int, input().split())
l = [i+1 for i in range(n)]
l = list(map(f, l))
print(sum(l))

Measured memory_bytes: 3444
import collections
import math
import operator as op
from functools import reduce
from collections import Counter
import numpy as np
import math
import bisect
import heapq


MOD = 1000000007


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():
    A, B, C = get_inputs(int)
    print("{} {} {}".format(C, A, B))


if __name__ == '__main__':
    main()


Measured memory_bytes: 12668
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// I wanna be the wind
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e17 + 9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,m,k;
    cin>>n>>m>>k;
    vector<ll> a;
    vector<ll> b;
    rep(i,0,n){
        ll x;
        cin>>x;
        a.push_back(x);
    }
    rep(i,0,m){
        ll x;
        cin>>x;
        b.push_back(x);
    }
    rep(i,1,m){
        b[i]+=b[i-1];
    }
    ll acum=0;
    ll ans=0;
    rep(i,0,n){
        acum+=a[i];
        if(acum>k){
            continue;
        }
        ll ansact=i+1;
        ll kact= k-acum;
        ll encont=-1;
        ll ini=0,mid,fim=m-1;
        while(ini<=fim){
            mid=(fim+ini)>>1;
            if(b[mid]<=kact){
                encont=mid;
                ini=mid+1;
            }
            else fim=mid-1;
        }
        // cout<<acum<<" "<<encont<<'\n';
        if(encont!=-1)ans=max(ansact+encont+1,ans);
        else ans=max(ansact,ans);
    }
    ll kact=k;
    ll ini=0,mid,fim=m-1;
    ll encont=-1;
        while(ini<=fim){
            mid=(fim+ini)>>1;
            if(b[mid]<=kact){
                encont=mid;
                ini=mid+1;
            }
            else fim=mid-1;
        }
    if(encont!=-1)ans=max(encont+1,ans);
    cout<<ans<<"\n";
    return 0;  
}

Measured memory_bytes: 7960
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
const long long int N = 6999999;
#define all(x) begin(x),end(x)
#define ll long long int
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
using namespace std;

int main()
{
 
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n,td,cs=0;
  cin >> n >> td;
  vector <int> v(n+1);
  v[0] = 0;
  for (int i = 0; i < n; ++i)
  {
    int a;
    cin >> a;
    v[i+1] = v[i]+a;
  }
  for (int i = 0; i <= n; ++i)
  {
    if(v[i] <= td)
    {
      cs++;
    }
  }
  cout << cs << endl;
  return 0;
}


Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S=ST()
    C = False
    F = False
    for s in S:
        if s=="C":
            C=True
        if s=="F":
            if C:
                F=True

    if C and F:
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()


Measured memory_bytes: 67820
n , m = list(map(int, input().split()))
par=[i for i in range(n)]
rank=[0 for _ in range(n)]

def find(x):
    if x==par[x]:
        return x
    else:
        par[x]=find(par[x])
        return par[x]

def unit(x,y):
    x=find(x) ; y=find(y)
    if find(x)==find(y):
        return
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x]==rank[y]:
            rank[x]+=1

for _ in range(m):
    x , y=list(map(int, input().split()))
    x -= 1 ; y-=1
    unit(x,y)
count=[0 for _ in range(n)]
for i in range(n):
    count[find(i)]+=1
print(max(count))


Measured memory_bytes: 109020
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <cstdlib>
#include <queue>

std::vector<int> v[1000];
int main()
{
    int n;
    scanf("%d", &n);
    int k = 1;
    while(k*(k-1)/2 < n) k++;
    if(k*(k-1)/2 != n)
    {
        puts("No");
        return 0;
    }
    else
    {
        int cnt = 0;
        for(int i=1;i<=k;i++)
        {
            for(int j=i+1;j<=k;j++)
            {
                v[i].push_back(cnt+1);
                v[j].push_back(cnt+1);
                cnt++;
            }
        }
        puts("Yes");
        printf("%d\n", k);
        for(int i=1;i<=k;i++)
        {
            printf("%d ", v[i].size());
            for(int j=0;j<v[i].size();j++)
            {
                printf("%d", v[i][j]);
                if(j+1 != v[i].size()) putchar(' ');
                else putchar('\n');
            }
        }
    }
}

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

using namespace std;

int main() {
	string T;
	cin >> T;
	string T_A = "";
	for (long unsigned int i = 0; i < T.size(); i++) {
		if (T[i] == '?') {
			T_A += "D";
		}
		else {
			T_A += T[i];
		}
	}
	cout << T_A << endl;
	return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

int ACed[111111];
int cou[111111];

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

	ll n, m;cin >> n >> m;
	REP(i, m){
		ll a;cin >> a;
		string str;cin >> str;
		if(ACed[a])continue;
		if(str == "AC")ACed[a] = 1;
		else cou[a]++;
	}

	ll seica = 0;
	ll syl = 0;
	REP(i, 111111){
		seica += ACed[i];
		if(ACed[i])syl += cou[i];
	}

	cout << seica << " " << syl << endl;

	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(unsigned i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
template<class T> void chmin(T&x,T y){if(x>y)x=y;}
template<class T> void chmax(T&x,T y){if(x<y)x=y;}

inline void PUTS(int a){
    static stack<char> C;
    while(a) C.emplace('0'+a%10),a/=10;
    if(C.empty()) putchar_unlocked('0');
    for(;!C.empty();C.pop()) putchar_unlocked(C.top());
    putchar_unlocked('\n');
}

unsigned c,dp[1u<<26u],d[200001],n{};
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    d[0]=0;
    while((c=getchar_unlocked()-'a')<26) d[n+1]=d[n]^(1u<<c),++n;
    fill(dp,dp+(1u<<26u),500000);
    dp[d[n]]=0;
    ifr(i,n) fr(j,26) chmin(dp[d[i]],dp[d[i]^(1u<<j)]+1);
    PUTS(max(dp[0],1u));
}

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

int main(){
    int n; cin>>n;
    char s[n]; cin>>s;
    int cnt = 1;

    for(int i=0; i<n-1; i++){
        if(s[i] != s[i+1])cnt++;
    }

    cout<<cnt<<endl;

    return 0;
}

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

using namespace std;

const int N = 2e5 + 7;
int n;
int m;

int main() {
    std :: ios :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int x;
    cin >> x;
    if(x <= 599) cout << 8 << endl;
    else if(x <= 799) cout << 7 << endl;
    else if(x <= 999) cout << 6 << endl;
    else if(x <= 1199) cout << 5 << endl;
    else if(x <= 1399) cout << 4 << endl;
    else if(x <= 1599) cout << 3 << endl;
    else if(x <= 1799) cout << 2 << endl;
    else cout << 1 << endl;
    return 0;
}



Measured memory_bytes: 3656
// ARC074C.cpp
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 330, mod = 1e9 + 7;

typedef pair<int, int> pii;

int n, m, dp[MAX_N][MAX_N][MAX_N], ans;
vector<pii> rig[MAX_N];

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1, l, r, x; i <= m; i++)
    {
        scanf("%d%d%d", &l, &r, &x);
        rig[r].push_back(make_pair(l, x));
    }
    dp[0][0][0] = 1;
    for (int a = 0; a <= n; a++)
        for (int b = 0; b <= n; b++)
            for (int c = 0; c <= n; c++)
            {
                if (dp[a][b][c] == 0 || (a == b && a != 0) || (b == c && b != 0) || (a == c && a != 0))
                    continue;
                int i = max(a, max(b, c));
                bool flag = true;
                for (pii stat : rig[i])
                    if ((a >= stat.first) + (b >= stat.first) + (c >= stat.first) != stat.second)
                    {
                        flag = false;
                        break;
                    }
                if (!flag)
                {
                    dp[a][b][c] = 0;
                    continue;
                }
                dp[i + 1][b][c] = (0LL + dp[i + 1][b][c] + dp[a][b][c]) % mod;
                dp[a][i + 1][c] = (0LL + dp[a][i + 1][c] + dp[a][b][c]) % mod;
                dp[a][b][i + 1] = (0LL + dp[a][b][i + 1] + dp[a][b][c]) % mod;
                if (i == n)
                    ans = (0LL + ans + dp[a][b][c]) % mod;
            }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 129152
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int dx[6]={-1,-1,0,1,1,0};
int dy[2][6]={{-1,0,1,0,-1,-1},{0,1,1,1,0,-1}};
int W,H;
int m[105][105];
int f[105][105];
void bfs()
{
	memset(f,0,sizeof(f));
	queue<P> q;
	f[0][0]=1;
	q.push(P(0,0));
	while(!q.empty())
	{
		P a=q.front();
		q.pop();
		for(int i=0;i<6;i++)
		{
			int nx=a.fi+dx[i],ny=a.sec+dy[a.fi%2][i];
			if(nx<0||nx>105||ny<0||ny>105)continue;
			if(f[nx][ny]||m[nx][ny])continue;
			q.push(P(nx,ny));
			f[nx][ny]=1;
		}
	}
	return;
}
int count(int x,int y)
{
	int res=0;
	for(int i=0;i<6;i++)
	{
		int nx=x+dx[i],ny=y+dy[x%2][i];
		if(nx<0||nx>105||ny<0||ny>105)continue;
		if(f[nx][ny]!=f[x][y])res++;
	}
	return res;
}
int main()
{
	cin >> W >> H;
	for(int i=1;i<=H;i++)
	{
		for(int j=1;j<=W;j++)
		{
			cin >> m[i][j];
		}
	}
	bfs();
	int ans=0;
	for(int i=0;i<=H+2;i++)
	{
		for(int j=0;j<=W+2;j++)
		{
			ans+=count(i,j);
		}
	}
	ans/=2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1308
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    string a;
    cin >> a;

    int ans = 0;

    if (a[0] == 'R') {
        ans++;
        if (a[1] == 'R') {
            ans++;
            if (a[2] == 'R') {
                ans++;
            }
        }
    } else {
        if (a[1] == 'R') {
            ans++;
            if (a[2] == 'R') {
                ans++;
            }
        } else {
            if (a[2] == 'R') {
                ans++;
            }
        }
    }

    cout << ans;
    

    return 0;
}

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

int main()
{
	char S[200001];
	scanf("%s", S);
	
	int i, count = 0;
	long long sum;
	for (i = 0; S[i] != 0; i++) {
		if (S[i] == 'B') sum += i;
		else count++;
	}
	sum = -sum;
	for (i-- ; i >= count; i--) sum += i;
	
	printf("%lld\n", sum);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1908
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] l = new int[n];
		int count = 0;
		
		for(int i=0;i<n;i++) {
			l[i] = scan.nextInt();
		}
		
		for(int i=0;i<n-2;i++) {
			for(int j=i+1;j<n-1;j++) {
				for(int k=j+1;k<n;k++) {
					if(l[i] != l[j] && l[j] != l[k] && l[k] != l[i]) {
						if(l[i]+l[j]>l[k] && l[j]+l[k]>l[i] && l[k]+l[i]>l[j]){
							count++;
						}
					}
				}
			}
		}
		System.out.println(count);

	}

}


Measured memory_bytes: 36724
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <bitset>
#define ll long long
using namespace std;




int main(){
    int N;cin>>N;
    vector <int> A(0);
    A.push_back(0);
    for(int i=0;i<N;i++){
        int aa;cin>>aa;
        A.push_back(aa);
    }
    A.push_back(0);

    int sum=0;

    for(int i=1;i<=N+1;i++){

        sum += abs(A[i]-A[i-1]);
        

    }

   // cout<<sum<<endl;

    for(int i=1;i<A.size()-1;i++){
        if(A[i]<=A[i+1] and A[i]>=A[i-1]){
            cout<<sum<<endl;
            continue;
        }
        if(A[i]>=A[i+1] and A[i]<=A[i-1]){
            cout<<sum<<endl;
            continue;
        }

        if(abs(A[i]-A[i-1])>=abs(A[i]-A[i+1])){
            cout<<sum-2*abs(A[i]-A[i+1])<<endl;;
            continue;
        }

        cout<<sum - 2*abs(A[i]-A[i-1])<<endl;;
        continue;
    }

    //cout<<sum-abs(A[N]-A[N-1])<<endl;

    return 0;

    
    
}

 



Measured memory_bytes: 1784
n,a,b = map(int,input().split())
x = 0
y = 0
for i in range(1,n+1):
    x = i
    c = i%10
    i -= c
    d = i%100
    i -= d
    e = i%1000
    i -= e
    f = i%10000
    i -= f
    g = i
    if a<=c+d//10+e//100+f/1000+g/10000<=b:
        y += x
        
    
print(y)

Measured memory_bytes: 3060
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] h = new int[N];
        for (int i = 0; i < h.length; i++) {
            h[i] = sc.nextInt();
        }
        Arrays.sort(h);
        final int INF = (int)Math.pow(10, 9) + 7;
        int dif = INF;
        for (int i = 0; i < h.length - K + 1; i++) {
            dif = Math.min(dif, h[K - 1 + i] - h[i]);
        }
        System.out.println(dif);
        sc.close();
    }
}

Measured memory_bytes: 49100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &V) {
  for (int i = 0; i < (int)V.size(); ++i) {
    if (i != 0) os << ' ';
    os << V[i];
  }
  return os;
}
template<typename T>
istream &operator>>(istream &is, vector<T> &V) {
  for (int i = 0; i < (int)V.size(); ++i) {
    is >> V[i];
  }
  return is;
}

vector<int> get_div(int n) {
  vector<int> res;
  for (int i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      res.push_back(i);
      if (i * i != n) res.push_back(n / i);
    }
  }
  return res;
}

bool check(int gc, const vector<int>& V, int k) {
  vector<int> V2 = V;
  vector<int> dif;
  for (int num : V) {
    if (num % gc != 0) dif.push_back(num - gc * (num / gc));
  }
  sort(dif.begin(), dif.end());
  int sum = 0;
  int n = dif.size();
  for (int i = 0; i < n; ++i) {
    sum += dif[i];
  }
  if (sum % gc != 0) {
    return false;
  }
  int kek = n - sum / gc;
  sum = 0;
  for (int i = 0; i < kek; ++i) sum += dif[i];
  if (sum > k) {
    return false;
  }
  return true;
}

int main()  {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vector<int> V(n);
  cin >> V;
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    sum += V[i];
  }
  vector<int> D = get_div(sum);
  sort(D.begin(), D.end(), greater<int>());
  for (int i = 0; i < D.size(); ++i) {
    if (check(D[i], V, k)) {
      cout << D[i];
      return 0;
    }
  }
  return 0;
} 



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

int main() {
	int n; cin >> n;
	n--;
	int res = 0;
	REP(i, n)
		res += n / (i + 1);
	cout << res << '\n';
    return 0;
}


Measured memory_bytes: 3620
p=1;a=[]
n=int(input());s=n**.5
while n%2==0 and n>3:a+=[2];n//=2
d=3
while s>d and n>d:
 if n%d==0:a+=[d];n//=d
 else:d+=2
a+=[n]
for f in set(a):
 p*=f**a.count(f)*(1-1/f)
print(int(p))


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

int M, D;

int main(){
	cin >> M >> D;
	int d1, d2;
	int ans = 0;
	//
	for(int m = 4; m <= M; m++){
		d1 = 2;
		while ( d1 < m ) {
			if( m % d1 == 0 ){
				d2 = m/d1;
				//
				if(d2 < 10 && d1 < 10){
					ans += ((d1*10 + d2) <= D);
				}
			}
			d1++;
		}
	}
	//
	cout << ans;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = -1, f = -1, r = -1;
        while (true) {
            m = sc.nextInt();
            f = sc.nextInt();
            r = sc.nextInt();
            if (m == -1 && f == -1 && r == -1) {
                break;
            }
            if (m == -1 || f == -1) System.out.println("F");
            else if (m + f >= 80) System.out.println("A");
            else if (m + f >= 65) System.out.println("B");
            else if (m + f >= 50) System.out.println("C");
            else if (m + f >= 30) {
                if (r >= 50) System.out.println("C");
                else System.out.println("D");
            } else System.out.println("F");
        }
    }
}



Measured memory_bytes: 26332
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int N;
    string S;
    cin >> S;
    int left = 123456789, right = 0;
    int ans = 0;
   for(int i = 0;i < S.size();i++){
       if(S[i] == 'A') left = min(left,i);
       if(S[i] == 'Z') right = max(right,i);
   }
   ans = right - left + 1 ;
   if(ans >= 0)cout << ans << endl;
   else cout << 0 << endl;
  
   
}


Measured memory_bytes: 640
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int A = sc.nextInt();
      int B = sc.nextInt();
      if(A==2||B==2){
        System.out.println("No");
      }else{
        System.out.println("Yes");
      }
    }
}

Measured memory_bytes: 35784
import numpy as np

i = list(map(int, input().split()))
array=np.ones((i[1],i[0]))

n=[]
for l in range(i[2]):
    x,y,z=[int(l) for l in input().split()]
    n.append([x,y,z])

for num in range(i[2]):
  if n[num][2]==1:
    array[:, :n[num][0]]=0
  elif n[num][2]==2:
    array[:, n[num][0]:]=0
  elif n[num][2]==3:
    array[:n[num][1],:]=0
  elif n[num][2]==4:
    array[n[num][1]:,:]=0  
print(array.sum())

Measured memory_bytes: 12504
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(void) {
    int n, d; cin >> n >> d;
    int x[10][10];
    rep(i, n) {
        rep(j, d) {
            cin >> x[i][j];
        }
    }
    int cnt = 0;
    rep(i, n) {
        for(int j=i+1;j<n;j++) {
            int norm = 0;
            for(int k=0;k<d;k++) {
                int diff = abs(x[i][k]-x[j][k]);
                norm += diff * diff;
            }
            for(int k=1;k*k<=norm;k++) {
                if(k*k == norm) {
                    cnt++; break;
                }
            }
        }
    }
    cout << cnt;
}



Measured memory_bytes: 256
#include<stdio.h>
    #include<stdlib.h>
    #include<string.h>
    #include<math.h>
    #include<algorithm>
    using namespace std; 
    int min(int a,int b)
    {
    	return a<b? a:b;
    }
    int main()
    {
        int a[100]={0};
        int N;
        scanf("%d",&N);
        int b=0;
        for(int i=0;i<N;i++)
        {
        	int num;
        	scanf("%d",&num);
        	if(num/400<8)
        		a[num/400]++;
        	else
        		b++;
        }
        int c=0;
    	for(int i=0;i<8;i++)
    		if(a[i]!=0)
    			c++;
    	int maxx;
    	maxx=c+b;
    	if(c==0 )
    		c=1;
    	printf("%d %d\n",c,maxx);
    	
        return 0;
     }


Measured memory_bytes: 128
n = int(input())
def count_factors(n, factors):
    factors.setdefault(2, 0)
    while n%2 == 0:
        factors[2] += 1
        n //=2

    for f in range(3, int(n**0.5)+ 1, 2):
        factors.setdefault(f, 0)
        while n%f == 0:
            factors[f] += 1
            n //= f
    if n != 1:
        factors.setdefault(n, 0)
        factors[n] += 1


cf = {1: 1}
for i in range(1, n+1):
    count_factors(i, cf)

# 約数が75個になるように選ぶ
ans = 0
c25 = 0
c15 = 0
c5 = 0
c3 = 0
c2 = 0
for v in cf.values():
    if v >= 74:
        ans += 1
    if v >= 24:
        c25 += 1
    if v >= 14:
        c15 += 1
    if v >= 4:
        c5 += 1
    if v >= 2:
        c3 += 1
    if v >= 1:
        c2 += 1

ans += c25 *(c3 - 1)
ans += c15 *(c5 - 1)
ans += c5 * (c5-1) * (c3-2)//2
print(ans)


Measured memory_bytes: 62428
# coding: utf-8

data = input().split()
shoplist = []
for i in range(int(data[0])):
    shopdata = list(map(int, input().split()))
    shoplist.append(shopdata)
shoplist.sort()

payment = 0
wantdrink = int(data[1])
while wantdrink > 0 :
    restdrink = shoplist[0][1]
    if restdrink >= wantdrink:
        payment += wantdrink * shoplist[0][0]
        break
    else:
        payment += restdrink * shoplist[0][0]
        wantdrink -= restdrink
        del shoplist[0]
print(payment)

Measured memory_bytes: 27760
import java.util.Scanner;

/**
 * Main
 */
public class Main {

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

        int N = s.nextInt();

        float res;

        if (N % 2 == 0)  res = (float) (1.0 / 2.0);
        else {
            int odd = N /2 +1;
            res = (float)odd / N;
        }

        System.out.println(res);
        s.close();
    }
}

Measured memory_bytes: 21972
#include <stdio.h>

int main(int argc, char **argv)
{
	char s[16];
	unsigned int a, b;
	
	while(scanf("%s %d %d", s, &a, &b) != EOF){
		printf("%s %d %d\n", s, (a+b), (200*a+300*b));
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <cstdint>
#include <deque>
#include <iostream>

static std::deque<int> first_half;
static int             num = 0;

void Construct(int64_t count) {
    if (!count) return;
    if (count & 1) {
        Construct((count - 1) >> 1);
        first_half.push_back(++num);
    } else {
        Construct(count - 1);
        first_half.push_front(++num);
    }
}

int main() {
    int64_t n;
    std::cin >> n;
    Construct(n);
    std::cout << (num << 1) << '\n';
    while (!first_half.empty()) {
        std::cout << first_half.front() << ' ';
        first_half.pop_front();
    }
    for (int i = 1; i < num; ++i) std::cout << i << ' ';
    std::cout << num << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */



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

    int n, m; cin >> n >> m;
    int cnt = 0;
    int sum = 0;
    vector<int> a(n);
    for(int i=0; i<n; ++i) cin >> a[i], sum += a[i];

    for(int i=0; i<n; ++i) {
        if (4*m*a[i] >= sum) ++cnt;
    }

    if(cnt >= m) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3688
/*    
 *  eat_code    
 *  IIIT Allahabad
 */
#include <bits/stdc++.h>
//#include "pretty_print.h"
using namespace std;

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define CONTAINS(a, x) (a.find(x) != a.end())
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)x.size()
#define nl cout << endl
#define F first
#define S second

#define what_is(x) cout << #x << " = " << x << endl
#define boost ios::sync_with_stdio(false);cin.tie(NULL)
#define CASET int ___T, case_n = 1; scanf("%d", &___T); while (___T-- > 0) 

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

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<ii> vii;
typedef vector<vi> vvi;

ll INF = 1E9;
ll M = 1E9 + 7;

inline ll power (ll a,ll p){
    ll res = 1, x = a;
    while ( p ) {
        if ( p & 1 ) res = ( res * x );
        x = ( x * x ); p >>= 1;
    }
    return res;
}

int main() {
    boost;
    if(fopen("input.txt", "r")){
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    }
    string s;
    cin >> s;
    int a, b, c, d;
    a = s[0] - '0';
    b = s[1] - '0';
    c = s[2] - '0';
    d = s[3] - '0';
    vector<char> op = {'+', '-'};
    for(int n1 = 0;n1 < 2;n1++){
        for(int n2 = 0;n2 < 2;n2++){
            for(int n3 = 0;n3 < 2;n3++){
                char op1 = op[n1];
                char op2 = op[n2];
                char op3 = op[n3];
                int sum = a;
                if(op1 == '+')sum += b;
                else sum -= b;
                if(op2 == '+')sum += c;
                else sum -= c;
                if(op3 == '+')sum += d;
                else sum -= d;
                // what_is(sum);
                if(sum == 7){
                    cout << a << op1 << b << op2 << c << op3 << d << "=7";
                    exit(0);
                }
            }
        }
    }

    return 0;
}
//  Train Insane or Remain the same
 

Measured memory_bytes: 256
import sys


def solve(h, n, ab):
    ab.sort(key=lambda x: x[1] / x[0])
    INF = 10 ** 18
    cache = {}
    # とりあえず一番コスパいいやつだけを使った結果を暫定最良値としておく
    best = ((h - 1) // ab[0][0] + 1) * ab[0][1]

    def dp(k, i=0, cost=0):
        nonlocal best
        if k <= 0:
            return cost
        if (k, i) in cache:
            return cache[k, i] + cost
        a, b = ab[i]
        if k / a * b + cost >= best:
            # どう足掻いても残りでbestより良い結果は得られない
            return INF
        c = (k - 1) // a + 1
        if i == n - 1:
            ret = cost + b * c
        else:
            ret = min(dp(k - a * j, i + 1, cost + b * j) for j in range(c + 1))
        cache[k, i] = ret - cost
        best = min(best, ret)
        return ret

    dp(h)
    return best


sys.setrecursionlimit(10001)

h, n = map(int, input().split())
ab = [tuple(map(int, line.split())) for line in sys.stdin]
print(solve(h, n, ab))


Measured memory_bytes: 6256
import math
x = int(input())
y = []
for i in range(1000):
    y.append(i**5)
for j in range(1000):
    for k in range(j,1000):
        if y[k]+ y[j] == x:
            a = k
            b = -j 
        if y[k] - y [j] == x:
            a = k
            b = j
            
print(a,b)

Measured memory_bytes: 9096
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
using namespace std;
#define ll long long

int d = 365;
vector<vector<int>> s(d, vector<int>(26, 0));
vector<ll> c(26);

void init() {
    cin >> d;
    for(int i = 0; i < 26; i++) cin >> c[i];
    for(int i = 0; i < d; i++) {
        for(int j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    return;
}

ll calc(vector<int> out) {
    ll score = 0;
    vector<ll> last(26, 0);
    for(int i = 0; i < out.size(); i++) {
        last[out[i]] = i+1; // タイプ番号
        //cout << "out[" << i << "] " << out[i] << " ";
        for(int j = 0; j < 26; j++) {
            score -= c[j]*((i+1)-last[j]);
        }
        score += s[i][out[i]];
        //cout << "score : " << score << endl;
    }
    return score;
}


int main() {
    init();
    vector<int> out;
    ll ans = 0;
    //ll tmp = 0;
    ll max_v = -1;
    for(int i = 0; i < d; i++) {
        //max_v = -100000000000;
        max_v = LLONG_MIN;
        int best = 0;
        for(int j = 0; j < 26; j++) {
            out.push_back(j);
            ll tmp = calc(out);
            if(max_v < tmp) {
                max_v = tmp;
                best = j;
            }
            out.pop_back();
        }
        out.push_back(best);
    }
    
    for(int i = 0; i < d; i++) {
        cout << out[i]+1 << endl;
    }
    //cout << max_v << endl;
    return 0;
}

Measured memory_bytes: 3704
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> num = new ArrayList<Integer>();
		ArrayList<String> param = new ArrayList<String>();
		int system = 0; // 文字の空白区切り　0:ON　1:OFF

		while (sc.hasNext()) {
			if (sc.hasNextInt()) {
				num.add(sc.nextInt());
			} else {
				if(system==0) param.add(sc.next());
				if(system==1) param.add(sc.nextLine());
			}
		}
		Method(num, param);
	}

	static void Method(ArrayList<Integer> num, ArrayList<String> param) {
		
		if(num.get(2) - num.get(1) > num.get(0)){
			System.out.println("dangerous");
		} else if(num.get(1) >= num.get(2)){
			System.out.println("delicious");
		} else {
			System.out.println("safe");
		}
	}
}

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

using namespace std;

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


int main()
{
  int k, s;
  cin >> k >> s;
  int res = 0;
  for (int x = 0; x <= k; x++){
    for (int y = 0; y <= k; y++){
      int z = s - x - y;
      if (z >= 0 && z <= k) {
        res++;
      }
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int, int> P;
 
int main(){
  int r;
  cin >> r;

  double pi = 3.141592653589793;
  
  cout << 2*pi*r << endl;
  return 0;
}

Measured memory_bytes: 3784
def gcd(a, b):
    if b > a:
        a,b = b,a
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
N = int(input())
A = list(map(int,input().split()))
a = A[0]
for i in range(1,N):
    a = gcd(a,A[i])
print(a)


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    n=n%10;
    if(n==1||n==0||n==6||n==8)
        cout<<"pon";
    else if(n==3)
        cout<<"bon";
    else
        cout<<"hon";
    return 0;
}


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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    cin >> n >> m;
    if(n<=m){
        cout << n << endl;
    }else {
        cout << n-1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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 nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

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




int main(){
  ll n; cin >> n;
  vl num(4);
  
  rep(i,4){
    num[3-i] = n % 10;
    n /= 10;
  }
  
  for(ll bit = 0; bit <(1<<3); bit++){
    vector<ll> s; vector<char> her(3,'+');
    for(ll i=0; i < 3; i++){
      if(bit & (1<<i)) s.push_back(i);
    }
  
    for(ll x : s){
      her[x] = '-';
    }
    
    ll ans = num[0];
    rep(i,3){
      if(her[i] == '+') ans += num[i+1];
      else ans -= num[i+1];
    }
    
    if(ans == 7){
      rep(i,3) cout << num[i] << her[i];
      cout << num[3] << "=7" << endl;
      return 0;
    }
  }
  
  
}

Measured memory_bytes: 3656
import sys
s = list(raw_input())

l = len(s)

if l == 2:
	if s[0] == s[1]:
		print "1 2"
		sys.exit()

	else:
		print '-1 -1'
		sys.exit()

for i in range(l-2):
	t = []
	for j in range(3):
		if s[i + j] in t:
			print i+1,i+3
			sys.exit()
		else :
			t.append(s[i + j])

print "-1 -1"

Measured memory_bytes: 6532
#define taskname "test"

#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)x.size()
#define fi first
#define se second

typedef long long lli;
typedef pair<int, int> pii;

const lli maxn = 1000000000000001;

lli n;

void read_input()
{
    cin >> n;
}

lli getpow(int x, int k)
{
    lli res = 1;
    for(; k > 0; --k)
        res *= 1LL * x;
    return res;
}

void solve()
{
    lli pre = 26, lst = 0;
    int cnt = 1;
    while(n > pre)
    {
        ++cnt;
        lli x = lst;
        lst = pre;
        pre += (pre - x) * 26LL;
    }
    n -= lst;
    for(int i = 0; i < cnt; ++i)
        for(int j = 0; j < 26; ++j)
        {
            if(n > getpow(26, cnt - i - 1))
                n -= getpow(26, cnt - i - 1);
            else
            {
                cout << char('a' + j);
                break;
            }
        }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    solve();
}



Measured memory_bytes: 3668
#include <iostream>

using namespace std;

int main()
{
    int a,b,c ;
    cin>>a;
    cin>>b;
    cin>>c;
    if(a==c){
       cout<<b;
    }
     if(a==b){
       cout<<c;
    }
     if(b==c){
       cout<<a;
    }
    return 0;
}


Measured memory_bytes: 256
from queue import Queue
H, W = map(int, input().split())
S = [input() for _ in range(H)]
ans = 0

for h in range(H):
    for w in range(W):
        if S[h][w] != '.':
            continue
        q = Queue()
        seen = [[False]*W for _ in range(H)]
        q.put((h, w, 0))
        seen[h][w] = True
        while not q.empty():
            h, w, d = q.get()
            for nh, nw in [(h+1, w), (h, w+1), (h-1, w), (h, w-1)]:
                if nh < 0 or nw < 0 or nh >= H or nw >= W:
                    continue
                if not seen[nh][nw] and S[nh][nw] == '.':
                    q.put((nh, nw, d+1))
                    seen[nh][nw] = True
                    ans = max(d+1, ans)
print(ans)


Measured memory_bytes: 56020
#include <bits/stdc++.h>
using namespace std;
#define maxN 1000001
#define mod 1000000007
#define maxLL 1000000000000000000
typedef long long ll;

bool compared(int a,int b){
	return a < b;
}

int cmp(const void *a,const void *b){
	return(*(int*)b - *(int*)a);
}

int GCD(int a,int b){
	return b?GCD(b,a%b):a;
}

int main(){
	ll a,b,c;
	scanf("%lld %lld.%lld",&a,&b,&c);
	printf("%lld\n",a*(b*100+c)/100);
	return 0;
}


Measured memory_bytes: 3804
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		String S = stdin.next();
		String T = stdin.next();
		int sum=0;
		
		for(int i=0;i<3;i++) {
			if((S.substring(i, i+1)).equals(T.substring(i,i+1))) {
				sum+=1;
			}
		}
			
		out.println(sum);
		
		out.flush();
	}

}


Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>

using namespace std;

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

int main(){
    long int n, a[5];
    cin >> n;
    long int mn = 100000000000000000;
    rep(i, 5) {
        cin >> a[i];
        mn = min(mn, a[i]);
    }
    long int ans;
    if (n % mn == 0){
        ans = n / mn;
    }else{
        ans = n / mn + 1;
    }
    cout << ans + 4 << endl;
    
}


Measured memory_bytes: 256