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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

signed main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> as(N);
    rep(i, N) cin >> as[i];
    ll ans = 0;
    for (int i = 50; i >= 0; i--) {
        int cnt = 0;
        auto mask = 1LL << i;
        for (auto& j : as) {
            if (j & mask) cnt++;
        }
        if (cnt < (N + 1) / 2) {
            if (ans + mask <= K)
                ans += mask;
        }
    }
    rep (i, N) as[i] ^= ans;
    cout << accumulate(be(as), 0LL) << endl;
}


Measured memory_bytes: 1024
#!/usr/bin/perl

my ($x,$y,$z) = map { $_ - 0 } split(/\s+/,<STDIN>);

my $d = $x;
$x = $y;
$y = $d;

my $d = $x;
$x = $z;
$z = $d;

print "$x $y $z\n";





Measured memory_bytes: 384
import sys
def input(): return sys.stdin.readline().rstrip()
class mod_comb3:
    def __init__(self,mod=10**9+7,n_max=1):
        self.mod,self.n_max=mod,n_max
        self.fact,self.inv,self.factinv=[1,1],[0,1],[1,1]
        if 1<n_max:setup_table(n_max)
    def comb(self,n,r):
        if r<0 or n<r:return 0
        if self.n_max<n:self.setup_table(n)
        return self.fact[n]*(self.factinv[r]*self.factinv[n-r]%self.mod)%self.mod
    def setup_table(self,t):
        for i in range(self.n_max+1,t+1):
            self.fact.append(self.fact[-1]*i%self.mod)
            self.inv.append(-self.inv[self.mod%i]*(self.mod//i)%self.mod)
            self.factinv.append(self.factinv[-1]*self.inv[-1]%self.mod)
        self.n_max=t

def main():
    s = int(input())
    mod = 10**9+7
    mod_c = mod_comb3()
    ans = 0
    for k in range(1,s//3+1):
        ans = (ans + mod_c.comb(s-2*k-1,k-1))%mod
    print(ans)


if __name__=='__main__':
    main()

Measured memory_bytes: 65052
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#include <utility>
#include <numeric>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
const int MOD = 1000000007;
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<pair<ll, ll>>a(n);
	REP(i, n) {
		cin >> a[i].second >> a[i].first;
	}
	sort(a.begin(), a.end());
	bool flag = true;
	ll time = 0;
	REP(i, n) {
		time += a[i].second;
		if (time > a[i].first) {
			flag = false;
			break;
		}
	}
	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3328
n = int(input())
choice = [list(map(int, input().split())) for _ in range(n)]
dp = [[0 for _ in range(3)] for __ in range(n)]
dp[0] = choice[0]

for i in range(1, n):
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + choice[i][0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + choice[i][1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + choice[i][2]
    
print(max(dp[-1]))


Measured memory_bytes: 76632
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int sum = 0;
	
	for(;k > 0; k--){
	    if(a > 0){
	        a--;
	        sum++;
	    }else if(b > 0){
	        b--;
	    }else if(c > 0){
	        c--;
	        sum--;
	    }
	}
	cout<<sum<<endl;
}


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

int main() {
    int n;
    scanf("%d", &n);
    map<int, int> mp;
    for (int i = 0; i < n; i++) {
        int x;
        scanf("%d", &x);
        mp[x]++;
    }

    int m;
    scanf("%d", &m);
    for (int i = 0; i < m; i++) {
        int y;
        scanf("%d", &y);
        if (mp[y] == 0) {
            puts("NO");
            return 0;
        }
        mp[y]--;
    }
    puts("YES");

    return 0;
}

Measured memory_bytes: 9600
n, m = gets.split.map(&:to_i)
h = gets.split.map(&:to_i)

bads = Array.new(n, 1)

m.times do |i|
  a, b = gets.split.map(&:to_i)

  a -= 1
  b -= 1

  if h[a] <= h[b]
    bads[a] = 0
  end

  if h[b] <= h[a]
    bads[b] = 0
  end
end

p bads.reduce(&:+)


Measured memory_bytes: 22616
/*  ex3_3
    potter0723sw  */

//方針：NをKで何回も割って商が0になるまでの割る回数をカウントする

#include <stdio.h>

int main(void) {
	int N,K,answer;
	scanf("%d %d", &N, &K);
	answer = 1;//最後に2桁増えることを考慮して1からスタート
	while(N >= K){//NがKより小さくなったら割るのを終わる
		N = N / K;
		answer += 1;
    }
    printf("%d\n",answer);
	return 0;
}


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

using namespace std;

int main()
{
    long n,i,cnt=0;
    cin>>n;
    long a[n];
    
    
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    
    sort(a,a+n);
    
    for(i=0;i<n-1;i++)
    {
        if(a[i]==a[i+1])
            cnt++;
    }
    
    if(cnt)
        cout<<"NO";
    else
        cout<<"YES";

    return 0;    
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define per(i,a,b) for(ll i=b-1;i>=a;i--)
ll k,ans;
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cin>>k;
    rep(i,1,k+1) rep(j,1,k+1) rep(h,1,k+1)
        ans+=__gcd(i, __gcd(j,h));
    cout<<ans<<"\n";
}


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

int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(ll, X);
    CIN(ll, Y);
    CIN(ll, Z);
    CIN(ll, K);
    vector<ll> s1(1e5, -1);
    vector<ll> s2(1e5, -1);

    CINS(ll, A, X);
    CINS(ll, B, Y);
    CINS(ll, C, Z);

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    reverse(A.begin(), A.end());
    reverse(B.begin(), B.end());

    ll index = 0;
    for (int i = 0; i < X; i++) {
        for (int j = 0; j < Y && i * j <= 3000; j++) {
            s1[index] = A[i] + B[j];
            index++;
        }
    }
    sort(C.begin(), C.end());
    sort(s1.begin(), s1.end());
    reverse(C.begin(), C.end());
    reverse(s1.begin(), s1.end());

    index = 0;
    for (int i = 0; i < 3000; i++) {
        for (int j = 0; j < Z && i * j <= 3000; j++) {
            s2[index] = s1[i] + C[j];
            index++;
        }
    }
    sort(s2.begin(), s2.end());
    reverse(s2.begin(), s2.end());

    for (int i = 0; i < K; i++) {
        cout << s2[i] << "\n";
    }

    return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    int r,g,b,n;
    cin >> r >> g >> b >> n;
    int ans = 0;
    for(int i = 0;i < n/r+1;i++){
        for(int j = 0;j < (n-i*r)/g+1;j++){
            if((n-r*i-g*j)%b == 0)ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int a, b, x, y;

    scanf("%d %d", &a, &b);

    x = 2 * b;
    if(x<a){
        y = a - x;
        printf("%d\n", y);
    }
    else printf("0\n");

    return 0;
}


Measured memory_bytes: 1720
class Node(object):
    def __init__(self, num, prv = None, nxt = None):
        self.num = num
        self.prv = prv
        self.nxt = nxt


class DoublyLinkedList(object):
    def __init__(self):
        self.start = self.last = None

    def insert(self, num):
        new_elem = Node(num)

        if self.start is None:
            self.start = self.last = new_elem
        else:
            new_elem.nxt = self.start
            self.start.prv = new_elem
            self.start = new_elem

    def delete_num(self, target):
        it = self.start
        while it is not None:
            if it.num == target:
                if it.prv is None and it.nxt is None:
                    self.start = self.last = None
                else:
                    if it.prv is not None:
                        it.prv.nxt = it.nxt
                    else:
                        self.start = self.start.nxt

                    if it.nxt is not None:
                        it.nxt.prv = it.prv
                    else:
                        self.last = self.last.prv
                break
            it = it.nxt

    def delete_start(self):
        if self.start is self.last:
            self.start = self.last = None
        else:
            self.start.nxt.prv = None
            self.start = self.start.nxt

    def delete_last(self):
        if self.start is self.last:
            self.start = self.last = None
        else:
            self.last.prv.nxt = None
            self.last = self.last.prv

    def get_content(self):
        ret = []
        it = self.start

        while it is not None:
            ret.append(it.num)
            it = it.nxt

        return ' '.join(ret)


def _main():
    from sys import stdin

    n = int(stdin.readline().strip())

    lst = DoublyLinkedList()
    
    for _ in range(n):
        cmd = stdin.readline().strip().split()
        if cmd[0] == 'insert':
            lst.insert(cmd[1])
        elif cmd[0] == 'delete':
            lst.delete_num(cmd[1])
        elif cmd[0] == 'deleteFirst':
            lst.delete_start()
        elif cmd[0] == 'deleteLast':
            lst.delete_last()

    print(lst.get_content())


if __name__ == '__main__':
    _main()

Measured memory_bytes: 229052
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <math.h> 
#include <algorithm>
#include <iomanip>

#define PI 3.14159265358979323846

using namespace std;

int main(){
  int a, b, h, m;
  cin >> a >> b >> h >> m;
  int degM = m*6;
  double degH = (double)(60*h + m)/2;
  double deg = min(abs(degH-degM), 360 - abs(degM - degH));
  cout <<setprecision(15) << sqrt(a*a + b*b - 2*a*b*cos(deg*PI/180.0));
}

Measured memory_bytes: 4228
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto A = aryread();
    A.sort();
    foreach (i; 1 .. N)
        if (A[i] == A[i - 1])
        {
            writeln("NO");
            return;
        }
    writeln("YES");
}


Measured memory_bytes: 11128
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

void ignore() {
    while (getchar() != '\n');
}

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

    char a, b;

    scanf("%c %c", &a, &b);
    ignore();

    if (a == 'H' && b == 'H') printf("H\n");
    else if (a == 'H' && b == 'D') printf("D\n");
    else if (a == 'D' && b == 'H') printf("D\n");
    else if (a == 'D' && b == 'D') printf("H\n");

    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main(){
    int n;

    scanf("%d",&n);
 
    unsigned char s[n][11];
    char tmp[11];
    int count=0;

    for(int i=0;i<n;i++){
        scanf("%s",s[i]);
    }

    qsort(s, n, sizeof(char) * 11, strcmp);

    for(int k=0;k<n;k++){
        if((strcmp(s[k],s[k+1]))==0)count++;
    }
    printf("%d",n-count);

}

Measured memory_bytes: 5716
#include<bits/stdc++.h>
using namespace std;
int n,m,a[1010],b[1010],dp[1010][30010],ans=1e9;
int main(){
	cin>>n>>m;
	for (int i=1;i<=m;i++) cin>>a[i]>>b[i];
	for (int i=1;i<=m;i++){
		for (int j=0;j<=30000;j++) dp[i][j]=dp[i-1][j];
		if (dp[i][a[i]]!=0)
			dp[i][a[i]]=min(dp[i][a[i]],b[i]);
		else
			dp[i][a[i]]=b[i];
		for (int j=a[i];j<=30000;j++)
			if (dp[i][j-a[i]]!=0&&dp[i][j]!=0)
				dp[i][j]=min(dp[i][j],dp[i][j-a[i]]+b[i]);
			else if (dp[i][j-a[i]]!=0)
				dp[i][j]=dp[i][j-a[i]]+b[i];
	}
	for (int i=1;i<=m;i++)
		for (int j=n;j<=30000;j++)
			if (dp[i][j]!=0) ans=min(ans,dp[i][j]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 117504
n = int(input())

arr = map(int,raw_input().split())

colors = [0] * 8
ans = 0

for i in arr:
	t = i/400
	if t < 8:
		colors[t] += 1

	else:
		ans += 1

col = 0
for i in colors:
	if i > 0:
		col += 1
if col == 0 and ans > 0 :
	print col+1 , ans 
	quit()
	
print col, col + ans




Measured memory_bytes: 2820
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int n = S.length();
    int k = n - 2;
    if(S[0] == S[n - 1]) k--;
    //cout << k << endl;
    if(k % 2 == 0) {
        cout << "Second" << endl;
    } else {
        cout << "First" << endl;
    }

    return 0;
}

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

template<class T>
T lcm(T a, T b){
    //ユークリッド互除法
    T r;
    T x = a, y = b;
    while(1){
        if(x < y){
            T tmp = x;
            x = y;
            y = tmp;
        }
        r = x % y;
        if(r == 0){
            break;
        }
        x = r;
    }
    return a*b/y;
}

int main(){
    long long A, B, C, D;
    cin >> A >> B >> C >> D;
    long long C_lb = (A-1)/C;
    long long D_lb = (A-1)/D;
    long long X = lcm(C, D);
    long long CD_lb = (A-1)/X;
    long long lb = C_lb + D_lb - CD_lb;
    long long C_ub = B/C;
    long long D_ub = B/D;
    long long CD_ub = B/X;
    long long ub = C_ub + D_ub - CD_ub;
    cout << B - A - (ub - lb) + 1;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
struct node
{
	int l,r;
}a[100005];
int n,lim,cnt=0,x,l;
const int inf=1e9+7;
bool cmp(node a,node b){return a.r<b.r;}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&x,&l);
		a[i].l=x-l;a[i].r=x+l;
	}
	lim=-inf;
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		if(a[i].l>=lim)
		{
			cnt++;
			lim=a[i].r;
		}
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(cnt,e) for(ll cnt=0;cnt<e;cnt++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;

typedef tuple<ll,ll,ll> T;


ll i,j,k;


int main(){
    ll A,B;
    cin>>A>>B;
    if(A<=B)cout<<"unsafe";
    else cout<<"safe";
    cout<<endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int n;
string s[2];
set<char> used;

int main(void) {
    cin >> n >> s[0] >> s[1];
    const int fi = s[0][0] == s[1][0] ? 1 : 2;
    LL ans = fi * 3;
    FOR(i, fi, n) {
        if (s[0][i - 1] == s[1][i - 1]) {
            (ans *= 2) %= MOD;
        } else {
            if (s[0][i] != s[1][i]) {
                (ans *= 3) %= MOD;
            }
        }
        i += s[0][i] != s[1][i];
    }
    cout << ans << endl;
}


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

using namespace std;

long long add_mod(long long x,long long y){
    return (x+y)%1000000007;
}
int n,m;
long long dp[1000][1000];
void solve(){
    int h,w;
    cin >> h >> w;
    vector<string> f(h);
    for(int i = 0;i < h;i++) cin >> f[i];
    dp[0][0] = 1;
    for(int i = 0;i < h-1;i++){
        for(int j = 0;j < w-1;j++){
            if(f[i+1][j] == '.') dp[i+1][j] = add_mod(dp[i+1][j],dp[i][j]);
            if(f[i][j+1] == '.') dp[i][j+1] = add_mod(dp[i][j+1],dp[i][j]);
        }
        if(f[i+1][w-1] == '.') dp[i+1][w-1] = add_mod(dp[i+1][w-1],dp[i][w-1]);
    }
    for(int j = 0;j < w-1;j++) if(f[h-1][j+1] == '.') dp[h-1][j+1] = add_mod(dp[h-1][j+1],dp[h-1][j]);
    cout << dp[h-1][w-1] << endl;
}

int main(){
    solve();
}


Measured memory_bytes: 9088
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B = il()
    ret = 0
    for n in range(A, B+1):
        if str(n) == str(n)[::-1]:
            ret += 1

    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
import java.io.*;
 
class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
        String s = buf.readLine();
        int x = Integer.parseInt(s);
        int res = x * x * x;
        System.out.println(res);
    }
}

Measured memory_bytes: 24412
#include <bits/stdc++.h>
 
using namespace std;
 
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl

int main()
{
	int n;
	cin>>n;
	if(n>=30)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 200005
#define eps 1e-12
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') {
        res = res * 10 + c - '0';
        c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
        out(x / 10);
    }
    putchar('0' + x % 10);
}
int N;
int64 s[MAXN];
void Solve() {
    read(N);
    for(int i = 1 ; i <= N ; ++i) read(s[i]);
    for(int i = 1 ; i <= N ; ++i) s[i] += s[i - 1];
    int64 ans = abs(s[N] - 2 * s[1]);
    for(int i = 1 ; i < N ; ++i) {
        ans = min(ans,abs(s[N] - 2 * s[i]));
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
    Solve();
}


Measured memory_bytes: 1792
a=0
list_grade=[]
list_grade.append([int(w) for w in input().split()])

while not list_grade[a]==[-1,-1,-1]:
    a+=1
    list_grade.append([int(w) for w in input().split()])
    
a=0
while not list_grade[a]==[-1,-1,-1]:
    score=list_grade[a][0]+list_grade[a][1]
    if list_grade[a][0]==-1 or list_grade[a][1]==-1 or score<30: 
        print('F')
        a+=1
        continue
    
    if score>=80:
        print('A')
        
    elif 65<=score<80:
        print('B')
        
    elif 50<=score<65:
        print('C')
        
    elif 30<=score<50:
        if list_grade[a][2]>=50:
            print('C')
            a+=1
            continue
        print('D')
    a+=1


Measured memory_bytes: 5608
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll dp[100005][4];
#define mod 1000000009

ll helper(ll A[], ll B[], ll C[], ll n, ll i, ll x){
    
    if(i >= n){
        return 0;
    }
    
    if(dp[i][x] != -1){
        return dp[i][x];
    }
    
    ll ans = 0;
  	if(x == 0){
      ans = max(ans, A[i] + helper(A, B, C, n, i + 1, 1));
      ans = max(ans, B[i] + helper(A, B, C, n, i + 1, 2));
      ans = max(ans, C[i] + helper(A, B, C, n, i + 1, 3));
    } else if(x == 1){
      	ans = max(ans, B[i] + helper(A, B, C, n, i + 1, 2));
      	ans = max(ans, C[i] + helper(A, B, C, n, i + 1, 3));
    } else if(x == 2) {
      	ans = max(ans, A[i] + helper(A, B, C, n, i + 1, 1));
      	ans = max(ans, C[i] + helper(A, B, C, n, i + 1, 3));
    } else {
      ans = max(ans, A[i] + helper(A, B, C, n, i + 1, 1));
      ans = max(ans, B[i] + helper(A, B, C, n, i + 1, 2));
    }
    return dp[i][x] = ans;
}

int main(){
    ll n;
    cin >> n;
    ll A[n], B[n], C[n];
    for(ll i = 0; i < n; i++){
        cin >> A[i] >> B[i] >> C[i];
    }
    memset(dp, -1, sizeof(dp));
    cout << helper(A, B, C, n, 0, 0) << endl;
    
    
}


Measured memory_bytes: 19996
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
using P = pair<int, int>;
int n, a, x[1005];
vector<int> ch[1005];
P dfs(int p){
	bool ok[5005] = {true};
	int mi = 0, sm = 0, f, s, t = 0;
	for(auto it: ch[p]){
		tie(f, s) = dfs(it);
		mi += f; sm += f*2 + s;
		for(int i = x[p]; i >= s; i--) if(ok[i-s]) ok[i] = true;
	}
	if(mi > x[p]){
		puts("IMPOSSIBLE");
		exit(0);
	}
	for(int i = 0; i+mi <= x[p]; i++) if(ok[i]) t = i;
	f = sm - mi - t; s = x[p];
	if(f > s) swap(f, s);
	return P(f, s-f);
}
int main(){
	scanf("%d", &n);
	rep(i,n-1){
		scanf("%d", &a); a--;
		ch[a].push_back(i+1);
	}
	rep(i,n) scanf("%d", x+i);
	dfs(0);
	puts("POSSIBLE");
}

Measured memory_bytes: 2432
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		while(in.hasNext()){
			String line = in.nextLine();
			String[] Array = line.split(" ");
			int a = Integer.parseInt(Array[0]);
			int b = Integer.parseInt(Array[2]);
			if(Array[1].equals("op")){
				break;
			}
			if(Array[1].equals("+")){
				System.out.println(a+b);
			}else if(Array[1].equals("-")){
				System.out.println(a-b);
			}else if(Array[1].equals("*")){;
			System.out.println(a*b);
			}else if(Array[1].equals("/")){
			System.out.println(a/b);
			}else{

			}
		}
	}
}

Measured memory_bytes: 26012
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
using namespace std;
long long MOD = 1e9 + 7;

long long N;
int main() {
	cin >> N;
	long long ans = LLONG_MAX;
	for (long long n = 1; n * n <= N; n++) {
		if (N % n != 0)continue;
		ans = min(ans, (n + N / n) - 2);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);for(int n,m,x,y,i;(n=s.nextInt())>0;){for(i=m=0;n-->0;){x=s.nextInt();if((y=s.nextInt()+s.nextInt())>m){i=x;m=y;}}System.out.println(i+" "+m);}}}

Measured memory_bytes: 12000
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;

int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int a[100000];
signed main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ans = a[0];
	for (int i = 1; i < n; i++) {
		ans = gcd(ans, a[i]);
	}
	cout << ans << endl;
}

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

namespace ABC094C
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();

            int N = int.Parse(s1);
            string[] ss = s2.Split(' ');

            int max = 0;
            int[] wrk = new int[N];
            int[] num = new int[N];

            int x = 0;
            for (int i = 0; i < N; i++)
            {
                x = int.Parse(ss[i]);
                if (x > max)
                {
                    max = x;
                }
                wrk[i] = x;
                num[i] = x;
            }

            Array.Sort(num);
            Array.Reverse(num);

            int res = 0;
            for (int i = 0; i < N; i++)
            {
                int cp = N / 2 - 1;

                if (num[cp] <= wrk[i])
                {
                    res = num[cp + 1];
                }
                else
                {
                    res = num[cp];
                }

                Console.WriteLine(res);
            }

            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 36296
def main():
    N = int(input())

    for h in range(1, 3501):
        for n in range(1, 3501):
            x = 4 * h * n - N * n - N * h
            if x <= 0: continue
            w, mod_ = divmod(N * h * n, x)
            if not mod_ and w > 0:
                print(h, n, w)
                return

main()


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


string divide[4] = {"dream", "dreamer", "erase", "eraser"};

int main(){
  string s;
  cin >> s;
  
  reverse(s.begin(), s.end());
  for(int i = 0; i < 4; i++){
    reverse(divide[i].begin(), divide[i].end());
  }
  
  bool can = true;
  for(int i = 0; i < s.size();){
    bool can2 = false;
    for(int j = 0; j < 4; j++){
      string d = divide[j];
      if(s.substr(i, d.size()) == d){
        can2 = true;
        i += d.size();
      }
    }
    if(!can2){
      can = false;
      break;
    }
  }
  
  if(can) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;


constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
	template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
	template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
	template<typename T> void chadd(T& a, T b) { a = a + b; }

	void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
	template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
	template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }


	// 標準入出力
	struct inp {
		std::size_t sz;
		inp(std::size_t _sz = 1) : sz(_sz) {}
		template <typename T> operator T () const { T a; std::cin >> a; return a; }
		template <typename T> operator std::vector<T>() const { vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
		template <typename T, typename U> operator std::pair<T, U>() const { T f; U s; std::cin >> f >> s; return std::pair<T, U>(f, s); }
	};

	inp inp1; // input one

	bool Kaibun(string s) {
		int n = s.length();
		bool onazi = true;
		if (n % 2 == 1) {
			int a = (n - 1) / 2;
			int b = (n + 3) / 2;
			// 前半
			string mae = "";
			// 後半
			string usiro = "";
			rep(i, a) {
				mae += s[i];
			}
			for (int i = n - 1; i >= b - 1; --i) {
				usiro += s[i];
			}


			rep(i, a) {
				if (mae[i] != usiro[i]) {
					onazi = false;
					break;
				}
			}
		}
		else {
			// 前半
			string mae = "";
			// 後半
			string usiro = "";
			int a = n / 2;
			rep(i, a) {
				mae += s[i];
				usiro += s[n - 1 - i];
			}
			rep(i, a) {
				if (mae[i] != usiro[i]) {
					onazi = false;
					break;
				}
			}
		}
		return onazi;
	}
}

int main() {

	string s = inp1;
	int n = s.length();
	int a = (n - 1) / 2;
	int b = (n + 3) / 2;

	bool yes = true;

	if (!Kaibun(s)) yes = false;
	if (!Kaibun(s.substr(b - 1))) yes = false;
	if (!Kaibun(s.substr(0, a))) yes = false;


	Cout(Yes(yes));

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int total = 0;

		TreeMap<String, Integer> s = new TreeMap<>();

		for (int i = 0; i < n; i++) {
			String input = sc.next();
			if (s.containsKey(input)) {

			} else {
				s.put(input, 1);
			}
		}

		for (String key : s.keySet()) {
			total++;
		}

		System.out.println(total);

	}
}


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

#define ll long long
#define endl '\n'
#define REP(i, a, n) for(int i=a; i<n; ++i)
#define pb push_back
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const double PI = 3.141592653589793238460;
const ll mod = 1e9 + 7;

void FAST(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

int main(){
  FAST();

  int str;
  cin >> str;
  int x = str / 100;
  int y = str % 100;
  if(x > 0 && x < 13){
    if(y > 0 && y < 13)
      cout << "AMBIGUOUS\n";
    else
      cout << "MMYY\n";
  }

  else{
    if(y > 0 && y < 13)
      cout << "YYMM\n";
    else
      cout << "NA\n";
  }

  return 0;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,1):0;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,1):0;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int A = nextInt();
  int B = nextInt();
  int C = nextInt();
  int D = nextInt();

  int ans = 0;
  ans = -max(A,C) + min(B,D);
  if (ans < 0) ans = 0;
  cout << ans << endl;

  
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}



Measured memory_bytes: 256
p=*0..gets.to_i
s=0
f=->a{a!=p[a]?p[a]=f[p[a]]:a}
a,b=$<.map(&:split).transpose.map{|a|a.map(&:to_i).map.with_index.sort.each_cons(2).map{[_2[0]-_1[0],_1[1],_2[1]]}}
(a+b).sort.map{|c,*a|a,b=a.map &f
a!=b&&(s+=c
p[b]=a)}
p s

Measured memory_bytes: 61192
#include<bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long long ll;
typedef pair<int,int> pie;
const int inf = 1e9;
int main() {
	string s,t;
	cin >> s >> t;
	int n = s.length();
	int m = t.length();
	int mini = inf;
	for(int i=0;i<n;i++) {
		int ch = 0;
		if(i+m > n) break;
		for(int j=0;j<m;j++) {
			if(s[i+j] != t[j]) ch++;
		}
		mini = min(mini, ch);
	} 
	cout<<mini;
}




Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
#define myCeil(dividend, divisor) ceil((double)(dividend) / (double)(divisor))
#define myFloor(dividend, divisor) floor((double)(dividend) / (double)(divisor))
#define calcDigits(num) floor(log10(num))+1

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl;
#define dv(name, value) cerr << (name) << " is " << (value) << endl;
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl;
#define dpa(v) cerr << "[ " << endl;REPI(itr, v) { cerr << "  [" << (*itr).first << ", " << (*itr).second << ']' << (itr != --v.end() ? "," : "") << endl; } cerr << "]" << endl;

signed main(){
  string S;
  cin >> S;

  int N = S.size();
  int cnt1 = 0;
  int cnt2 = 0;

  REP(x, N) {
    if (x % 2 == 0) {
      if (S.at(x) == '0') {
        cnt1++;
      }
    } else
    if (x % 2 != 0) {
      if (S.at(x) == '1') {
        cnt1++;
      }
    }
  }

  REP(x, N) {
    if (x % 2 == 0) {
      if (S.at(x) == '1') {
        cnt2++;
      }
    } else
    if (x % 2 != 0) {
      if (S.at(x) == '0') {
        cnt2++;
      }
    }
  }

  cout << min(cnt1, cnt2) << endl;
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;

inline bool LT(double a,double b) { return !equals(a,b) && b < b; }
inline bool LTE(double a,double b) { return equals(a,b) || b < b; }

void compute() {

}

int main() {
  int x,y;
  cin >> x >> y;
  int ans = abs( abs(x) - abs(y) ); 
  if( x == 0 ) {
    if( x != y && y < 0 ) ans += 1;
  } else if( y == 0 ) {
    if( x != y && x > 0 ) ans += 1;
  } else {
    if( abs(x) == abs(y) ) {
      if( x != y ) ans += 1;
    } else {
      if( 0 < x ) {
	if( 0 < y ) {
	  if( x < y ) {
	    
	  } else {
	    ans += 2;
	  }
	} else {
	  ans += 1;
	}
      } else { // 0 > x
	if( 0 < y ) {
	  ans += 1;
	} else {
	  if( x < y ) {
	    
	  } else {
	    ans += 2;
	  }
	}
      }
    }
  }
  cout << ans << endl;
  compute();
  return 0;
}

Measured memory_bytes: 256
module app;

import core.bitop;

import std.algorithm;
import std.array;
import std.bigint;
import std.conv;
import std.stdio;
import std.string;

struct Input
{
	int n;
	string s, t;
}

void parseInput(T)(out Input input, T file)
{
	with (file) with (input)
	{
		n = readln().strip().to!int;
		auto array = readln().strip().split();
		s = array[0];
		t = array[1];
	}
}

auto main2(Input* input)
{
    foreach (i; 0..input.n)
    {
        write(input.s[i]);
        write(input.t[i]);
    }
}

void main()
{
	Input input = void;
	parseInput(input, stdin);
	main2(&input);
}


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

using namespace std;

int main(){
    map<string, int> mp;
    int n;
    cin >> n;
    for(int i = 0; i < n; ++i){
        string s; cin >> s;
        mp[s]++;
    }
    int max = 0;
    for (auto x : mp)
      if(x.second >= max) max = x.second;

    vector<string> v;
    for (auto x : mp)
      if(x.second == max) v.push_back(x.first);

    sort(v.begin(), v.end());
    for(int i = 0; i < v.size(); ++i){
        cout << v[i] << endl;
    }
    return 0;
}


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

int b[10];

bool good(int n){
	while(n){
		if(b[n%10])	return false;
		n/=10;
	}
	return true;
}

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

	for(int i=1;i<=k;i++){
		int val;
		cin >> val;
		b[val]=1;
	}

	while(!good(n))	n++;

	cout << n << endl;


	return 0;
}


Measured memory_bytes: 256
#include <cstdio>

typedef long long LL;

const int MAXN = 4005;

template<typename _T>
void read( _T &x )
{
	x = 0;char s = getchar();int f = 1;
	while( s > '9' || s < '0' ){if( s == '-' ) f = -1; s = getchar();}
	while( s >= '0' && s <= '9' ){x = ( x << 3 ) + ( x << 1 ) + ( s - '0' ), s = getchar();}
	x *= f;
}

template<typename _T>
void write( _T x )
{
	if( x < 0 ){ putchar( '-' ); x = ( ~ x ) + 1; }
	if( 9 < x ){ write( x / 10 ); }
	putchar( x % 10 + '0' );
}

template<typename _T>
_T MIN( const _T a, const _T b )
{
	return a < b ? a : b;
}

int q[MAXN];
int a[MAXN];
int N, x;

LL calc( const int l )
{
	LL ret = 1ll * l * x;
	int h = 1, t = 0, r = 1;
	for( int i = 1 ; i <= N ; i ++ )
	{
		while( h <= t && q[h] < i ) h ++;
		for( ; r <= i + l ; r ++ )
		{
			while( h <= t && a[q[t]] >= a[r] )
				t --;
			q[++ t] = r;
		}
		ret += a[q[h]];
	}
	return ret;
}

int main()
{
	read( N ), read( x );
	for( int i = 1 ; i <= N ; i ++ ) read( a[i] ), a[i + N] = a[i];
	LL ans = 1e18;
	for( int i = 0 ; i < N ; i ++ )
		ans = MIN( ans, calc( i ) );
	write( ans ), putchar( '\n' );
	return 0;
}

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

Measured memory_bytes: 2676
N = int(input())
min = 100000000000000
for i in range(1, N):
  A = str(i)
  B = str(N - i)
  ref = 0
  for a in A:
    ref += int(a)
  for b in B:
    ref += int(b)
  if ref < min:
    min = ref
print(min)

Measured memory_bytes: 3060
#include"bits/stdc++.h"
using namespace std;

void Main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

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

  vector<pair<int, int>> bc(m);
  for (int i = 0; i < m; i++) {
    int b, c;
    cin >> b >> c;
    bc[i] = pair<int, int>{c, b};
  }
  sort(bc.rbegin(), bc.rend());

  vector<int> d(n);
  int i = 0;
  int c = 0;
  while (i < n) {
    if (c > bc.size()) {
      d[i] = 0;
      i++;
    } else {
      for (int j = 0; j < bc[c].second && i < n; j++) {
        d[i] = bc[c].first;
        i++;
      }
      c++;
    }
  }

  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] < d[i]) ans += d[i];
    else ans += a[i];
  }

  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 1792
import math
import decimal




A,B=map(str,input().split())


a=decimal.Decimal(A)
b=decimal.Decimal(B)

print(int(a*b))

'''
a=int(A)
b=float(B)*100
#print(int(B))

bb=int(b)

print(math.floor(a*bb//100))
'''


Measured memory_bytes: 71320
#![allow(unused_imports)]
#![allow(non_snake_case)]
use proconio::{input, fastout};
use proconio::marker::{Chars, Bytes, Usize1};

#[fastout]
fn main() {
    input!{
        x:i32
    }
    println!("{}", if x < 30 {"No"} else {"Yes"});
}


Measured memory_bytes: 2164
aI,aO,aT,aJ,aL,aS,aZ = gets.chomp.split(" ").map{|u|u.to_i}
count = aO
if([aJ,aI,aL].min > 0)
if(aJ %2 == 1 and aI %2 == 1 and aL %2 == 1)
    min = 1
    aJ -= min
    aI -= min
    aL -= min
    count += 3*min 
end
if(aJ %2 == 1 and aI %2 == 1 and aL %2 == 0)
    min = 1
    aJ -= min
    aI -= min
    aL -= min
    count += 3*min 
end
if(aJ %2 == 1 and aI %2 == 0 and aL %2 == 1)
    min = 1
    aJ -= min
    aI -= min
    aL -= min
    count += 3*min 
end
if(aJ %2 == 0 and aI %2 == 1 and aL %2 == 1)
    min = 1
    aJ -= min
    aI -= min
    aL -= min
    count += 3*min 
end
end
count += (aI/2)*2
count += (aL/2)*2
count += (aJ/2)*2
 
puts count

Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
const int INF = 1000000001;

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(abs(b-a)>abs(c-a)) cout << "B" <<endl;
  else cout << "A" <<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <limits>
#include <string>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include "math.h"
#include "assert.h"

using namespace std;

#define BUFF ios::sync_with_stdio(false)
#define epsilon 1e-07
#define pi 2 * acos(0.0);
#define mod 1000000007   // 1e9+7
#define ll long long
#define cerr if(false)cerr
#define watch(x) cerr << #x << " = " << x << endl;

int inf = std::numeric_limits<int>().max();

int main() {
	ll n, W;
	cin >> n >> W;
	vector<ll> v(n+1), w(n+1);
	for(ll i=1; i<=n; i++) {
		cin >> w[i] >> v[i];
	}
	ll total = 1000 * n;
	vector<ll> dp(total +1, inf); 
	dp[0] = 0;
	for(int i=1; i<=n; i++) {
		for(ll j=total; j>=v[i]; j--) {
			dp[j] = min(dp[j-v[i]] + w[i], dp[j]); 
		}
	}

	/*cout << "dp: " << endl;
	for(ll j=0; j<=W; j++) {
		cout << dp[j] << " ";
	}*/

	ll ans = 0;
	for(int i=0; i<=total; i++) {
		if (dp[i] <= W) ans = i; 
	}
	
	cout << ans << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;

int main() {
  char s;
  cin >> s;

  if (s == 'A') cout << 'T' << endl;
  else if (s == 'T') cout << 'A' << endl;
  else if (s == 'C') cout << 'G' << endl;
  else if (s == 'G') cout << 'C' << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
#include<set>
#include<cmath>
#include<string>
using namespace std;
#define LL long long

const LL mod=1000000007;
LL n,m;
LL x[100005],y[100005];

int main()
{
    while(~scanf("%lld %lld",&n,&m))
    {
        for(int i=0;i<n;++i)
            scanf("%lld",&x[i]);
        for(int i=0;i<m;++i)
            scanf("%lld",&y[i]);
        LL sum=0;
        for(LL i=0;i<m-1;++i)
        {
            LL xishu=(i+1)*(m-i-1);//cout<<temp<<".."<<endl;
            LL temp=(((y[i+1]-y[i])%mod)*(xishu%mod))%mod;
            sum+=temp;
            sum%=mod;
        }
        LL ans=0;
        for(LL i=0;i<n-1;++i)
        {
            LL xishu=(i+1)*(n-i-1);
            LL temp=(((x[i+1]-x[i])%mod)*(xishu%mod))%mod;
            temp=((temp%mod)*(sum%mod))%mod;
            ans+=temp;
        }
        printf("%lld\n",ans%mod);
    }
}


Measured memory_bytes: 1792
import sys
n,m = map(int,input().split())
c=[list(map(int,input().split())) for i in range(m)]

if n > 1:
  for i in range(m):
    if c[i][0] == 1 and c[i][1] ==0 :
      print(-1)
      sys.exit()

for i in range(m):
  for j in range(m):
    if c[i][0] == c[j][0] and c[i][1] != c[j][1] :
      print(-1)
      sys.exit()

c1 = 0
c2 = 0
c3 = 0

for i in range(m):
  if c[i][0] == 1:
    c1 = c[i][1]
  elif c[i][0] == 2 :
    c2 = c[i][1]
  elif c[i][0] == 3 :
    c3 = c[i][1]

if n == 1 :
  print(c1)
elif n==2:
  if c1 ==0 :
    c1 =1
  print(c1 * 10 + c2)
elif n==3:
  if c1 ==0 :
    c1 =1
  print(c1 * 100 + c2 * 10 + c3)





Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    vector<ll> x(n-1), y(n-1);
    deque<ll> neg, pos;
    rep(i, n) {
        if (a[i] < 0) neg.push_back(a[i]);
        else pos.push_back(a[i]);
    }

    int cnt = 0;
    if (pos.size() == 0) {
        x[0] = neg[n-1]; neg.pop_back();
        y[0] = neg[n-2]; neg.pop_back();
        pos.push_back(x[0] - y[0]);
        cnt++;
    } else if (neg.size() == 0) {
        x[0] = pos[0]; pos.pop_front();
        y[0] = pos[1]; pos.pop_front();
        neg.push_back(x[0] - y[0]);
        cnt++;
    }

    while (neg.size() > 1) {
        x[cnt] = pos[0]; pos.pop_front();
        y[cnt] = neg[0]; neg.pop_front();
        pos.push_back(x[cnt] - y[cnt]);
        cnt++;
    }
    while (pos.size() > 1) {
        x[cnt] = neg[0]; neg.pop_front();
        y[cnt] = pos[0]; pos.pop_front();
        neg.push_back(x[cnt] - y[cnt]);
        cnt++;
    }
    ll ans = pos[0] - neg[0];
    x[n-2] = pos[0];
    y[n-2] = neg[0];
    cout << ans << endl;
    rep(i, n-1) {
        cout << x[i] << " " << y[i] << endl;
    }
}



Measured memory_bytes: 5120