akhauriyash/Code-Regression huggingface dataset:
import sys, heapq, bisect, math, fractions
from collections import deque
from collections import Counter
from collections import OrderedDict
from itertools import combinations as cmb

def check(s: list):
    if min(s) < X:
        return False
    return True

N, M, X = map(int, input().split())
G = [tuple(map(int, input().split())) for _ in range(N)]
s = [0 for i in range(M)]

res = 10 ** 15
ok = False
for i in range(1, N + 1):
    for cm in cmb(range(0, N), i):
        cnt = 0
        s = [0 for i in range(M)]
        for c in cm:
            cnt += G[c][0]
            for j in range(M):
                s[j] += G[c][j + 1]
        if check(s):
            res = min(cnt, res)
            ok = True

if ok:
    print(res)
else:
    print(-1)


Measured memory_bytes: 10476
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
using namespace std;
ll y , k , n , cnt = -1,ans = 1 , a  ,b  , m , c;
string s;
vector<int>v , v1;
char z;
int main() {
  ios::sync_with_stdio(false);
    cin >> z;
    cout << char(z + 1);
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const int MX = 100005;
int n,m,l,r=1,p[MX],ans[MX],c;
char s[MX];
int main(){
	scanf("%d%d\n%s", &n, &m, s);
	fill(p,p+n+1,-1);
	while(r<=n){
		for(;s[l]=='1'&&l<r;l++);
		if(l==r) return 0*puts("-1");
		for(;r<=l+m&&r<=n;r++) p[r]=l;
		l++;
	}
	for(;n;n=p[n]) ans[c++] = n-p[n];
	for(;c;c--) printf("%d%c", ans[c-1], c-1? ' ':'\n');
}

Measured memory_bytes: 1280
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let mut n: u32 = read();

    let mut count = 0;
    while n > 1 {
        n /= 2;
        count += 1;
    }

    println!("{}", 2_i32.pow(count));
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}


int main(){
  int n,m,x; cin >> n >> m >> x;
  vector<int> v(n);cin >> v;
  int cnt = 0;
  for(int i = 0; i < n; ++i){
    if(v[i] < x)cnt++;
    else break;
  }
  cout << min(cnt,m-cnt) << endl;
}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <unordered_map>
#include <string>

using namespace std;

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

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    string S;
    cin >> S;
    
    int AB_cnt = 0, B_cnt = 0;
    for(int i = 0; i < S.length(); ++i){
        if(S[i] == 'c'){
            cout << "No\n";
            continue;
        }
        
        if(S[i] == 'a'){
            if(AB_cnt >= A + B){
                cout << "No\n";
            }
            else{
                cout << "Yes\n";
                AB_cnt++;
            }
        }
        else{
            B_cnt++;
            if(AB_cnt >= A + B){
                cout << "No\n";
            }
            else{
                if(B_cnt > B){
                    cout << "No\n";
                }
                else{
                    cout << "Yes\n";
                    AB_cnt++;
                }
            }
        }
    }
}

Measured memory_bytes: 896
#include<stdio.h>
#include<string.h>
int main(void){
    int n=0;
    while(1){
        char a[100];
        if(scanf("%s",a)==EOF)break;
        int i,j,k,x,y=0;
        x=strlen(a);
        if(x==1){
            n++;
            continue;
        }
        for(i=0;i<x/2;i++){
            if(a[i]!=a[x-i-1]){
                y=1;
                break;
            }
        }
        if(y==1)continue;
        else n++;
    }
    printf("%d\n",n);
    return 0;
}

Measured memory_bytes: 540
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int n;
ll seq[100010];
ll dif[100010];
ll minusDif[100010];

// xxx ooo
ll solve1() {
  reverse(seq, seq + n);
  ll ret = 0;
  int next = n - 2;
  REP(i, n - 2) {
    if (seq[i] >= seq[i + 1] + seq[i + 2]) { continue; }
    next = i + 3;
    ret += seq[i] + seq[i + 1] + seq[i + 2];
    break;
  }
  int nnext = next;
  FOR(i, next, n - 2) {
    if (seq[i] >= seq[i + 1] + seq[i + 2]) { continue; }
    nnext = i + 3;
    ret += seq[i] + seq[i + 1] + seq[i + 2];
    break;
  }
  reverse(seq, seq + n);
  if (next == nnext) { ret = 0; }
  return ret;
}

ll solve2() {
  ll ret = 0;
  FOR(i, 5, n) {
    if ((seq[i] < seq[i - 3] + seq[i - 4] && seq[i - 1] < seq[i - 2] + seq[i - 5]) ||  // xooxxo
        (seq[i] < seq[i - 1] + seq[i - 4] && seq[i - 2] < seq[i - 3] + seq[i - 5]) ||  // xoxxoo
        (seq[i] < seq[i - 1] + seq[i - 5] && seq[i - 2] < seq[i - 3] + seq[i - 4])) {  // oxxxoo
      ret = max(ret, seq[i] + seq[i - 1] + seq[i - 2] + seq[i - 3] + seq[i - 4] + seq[i - 5]);
    }
  }
  return ret;
}

int main() {
  while (scanf("%d", &n) > 0) {
    REP(i, n) { scanf("%lld", &seq[i]); }
    sort(seq, seq + n);
    ll ans = solve1();
    ans = max(ans, solve2());
    printf("%lld\n", ans);
  }
  return 0;
}

Measured memory_bytes: 1624
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.next());
        int M = Integer.parseInt(scanner.next());
        StringBuilder a = new StringBuilder();
        for (int i = 0; i < M; i++) {
            a.append(N);
        }
        StringBuilder b = new StringBuilder();
        for (int i = 0; i < N; i++) {
            b.append(M);
        }
        System.out.println(a.toString().compareTo(b.toString()) < 0 ? a.toString() : b.toString());
    }

}


Measured memory_bytes: 21840
#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=Pre[x];p;p=Next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=Next[p])  
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (1000000007)
#define pb push_back
#define mp make_pair 
#define fi first
#define se second
#define vi vector<int> 
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %I64d\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<' '; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
						For(j,m-1) cout<<a[i][j]<<' ';\
						cout<<a[i][m]<<endl; \
						} 
#pragma comment(linker, "/STACK:102400000,102400000")
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
int read()
{
	int x=0,f=1; char ch=getchar();
	while(!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
	while(isdigit(ch)) { x=x*10+ch-'0'; ch=getchar();}
	return x*f;
} 
int n;
#define MAXN (100000+10)
int mi[MAXN],ma[MAXN];
int t[MAXN],a[MAXN];
int main()
{
//	freopen("C.in","r",stdin);
//	freopen(".out","w",stdout);
		
	n=read();
	t[0]=0;
	For(i,n) cin>>t[i];
	For(i,n) cin>>a[i];
	a[n+1]=0;
	For(i,n) {
		if (t[i]!=t[i-1]) {
			mi[i]=ma[i]=t[i];
		} else mi[i]=1,ma[i]=t[i];
	}
	bool fl=0;
	ForD(i,n) {
		if (a[i]!=a[i+1]) {
			mi[i]=max(mi[i],a[i]);
			ma[i]=min(ma[i],a[i]);
		}
		else {
			mi[i]=max(mi[i],1);
			ma[i]=min(ma[i],a[i]);
		}
	}
	ll ans=1;
	For(i,n-1) if (a[i]<a[i+1]||t[i]>t[i+1]) {
		puts("0");return 0;
	}
	For(i,n) if (mi[i]>ma[i]) {
		puts("0");return 0;
	} else ans=mul(ans,ma[i]-mi[i]+1);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>

using namespace std;
typedef long long ll;

int main()
{
	ll A, B, N;
	cin >> A >> B >> N;
	
	if(N <= B-1){
		cout << (A*N)/B << endl;
	}else{
		cout << (A*(B-1))/B << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3620
#!/usr/bin/env python3
import sys


def solve(X: str, Y: str):
    x = int(X,16)
    y = int(Y,16)
    if x < y:
        print("<")
    elif x > y:
        print(">")
    else:
        print("=")
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = next(tokens)  # type: str
    Y = next(tokens)  # type: str
    solve(X, Y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

struct Hashing {
    ull seed, mod;
    vector <ull> hs, pw;

    Hashing(ull seed = 31, ull mod = 1000173169) :
        seed(seed),
        mod(mod) {}

    void build(int n, const string& s) {
        hs.assign(n + 1, 0);
        pw.assign(n + 1, 1);
        pw[0] = 1;

        for (int i = 1; i <= n; ++i)
            pw[i] = pw[i - 1] * seed % mod;
        for (int i = 1; i <= n; ++i)
            hs[i] = (hs[i - 1] * seed + s[i]) % mod;
    }

    ull hash(int l, int r) {
        return (hs[r] - hs[l - 1] * pw[r - l + 1] % mod + mod) % mod;
    }
};

int solve()
{
    int n, m;

    std::cin >> n >> m;

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

    return 0;
}

int main()
{
//    std::cout << solve() << std::endl;
    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  int n, m;
  cin>>n>>m;
  vector<int> a(n);
  rep(i,n)cin>>a[i];
  int s=0;
  rep(i,n)s+=a[i];
  int x=0;
  rep(i,n) {
    if(4*m*a[i]>=s)
      x++;
  }
  if(x>=m) {
    cout << "Yes" << endl;
  } else {
    cout << "No" <<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import sys
n=int(input())
t_pre=0
x_pre=0
y_pre=0
for _ in range(n):
    t,x,y=map(int,input().split())
    if t-t_pre<abs(x-x_pre)+abs(y-y_pre):
        print("No")
        sys.exit(0)
    elif (t-t_pre)%2!=(abs(x-x_pre)+abs(y-y_pre))%2:
        print("No")
        sys.exit(0)
print("Yes")

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    public static void Main()
    {
        String[] input = Console.ReadLine().Split();
        int X = int.Parse(input[0]);
        int Y = int.Parse(input[1]);
        int A = int.Parse(input[2]);
        int B = int.Parse(input[3]);
        int C = int.Parse(input[4]);
        List<long> list = new List<long>();
        input = Console.ReadLine().Split();
        long[] p = new long[A];
        for(int i = 0; i < A; i++) { p[i] = long.Parse(input[i]); }
        Array.Sort(p);
        Array.Reverse(p);
        for(int i = 0; i < Math.Min(X,p.Length); i++) { list.Add(p[i]); }

        input = Console.ReadLine().Split();
        long[] q = new long[B];
        for (int i = 0; i < B; i++) { q[i] = long.Parse(input[i]); }
        Array.Sort(q);
        Array.Reverse(q);
        for (int i = 0; i < Math.Min(Y,q.Length); i++) { list.Add(q[i]); }

        input = Console.ReadLine().Split();
        long[] r = new long[C];
        for (int i = 0; i < C; i++) { r[i] = long.Parse(input[i]); }
        Array.Sort(r);
        Array.Reverse(r);
        for (int i = 0; i < Math.Min(X+Y,r.Length); i++) { list.Add(r[i]); }

        list.Sort();
        long ans = 0;
        for(int i = list.Count - 1; i > list.Count-1-X-Y; i--)
        {
            ans += list[i];
        }
        Console.WriteLine(ans);
    }
}

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    ll ans = 1;
    
    for(int i = 1; i <= n; i++) {
        ans *= i;
        ans %= mod;
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <unordered_map>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <cassert>
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
// fuck this shit , I m out of here //
// this is wrong solution fool lmao //
// what am I even supposed to do now //
// can someone teach me how to be a trader my man ?!
// I am not even sure as to what I am even supposed to do after this
ll n;
ll l[200005] , r[200005];
multiset<ll> A,  B;
ll glast()
{
    if(A.size() == 0) return 1e16;
    return *A.rbegin();
}
ll gfst()
{
    if(B.size() == 0) return -1e16;
    return *B.begin();
}
int main(int argc, const char * argv[]) {
    
    cin >> n;
    pll yo = make_pair(1e16 , 1e16);
    ll id = 0;
    for(ll i=1;i<=n;i++) {
        cin >> l[i] >> r[i];
        pll xx = make_pair(r[i] , l[i]);
        if(xx < yo) {
            id = i;
            yo = xx;
        }
    }
    vector< pll > v;
    for(ll i=1;i<=n;i++) {
        if(i == id) continue;
        A.insert(l[i]);
        B.insert(r[i]);
        v.pb(make_pair(l[i] , r[i]));
    }
    sort(v.begin(), v.end());
    
    ll ans = yo.first - yo.second + 1;
        
    ll L = glast();
    ll R = gfst();
    if(R >= L) ans += (R - L + 1);
    L = yo.second;
     R = yo.first;
    //cout << "<<<" << ans << endl;
    for(ll ii = 0 ; ii < v.size() ; ii++) {
        pll i = v[ii];
        A.erase(A.find(i.first));
        B.erase(B.find(i.second));
        L = max(L , i.first);
        if(L <= R) {
            ll ret = R-L+1;
            ll X = glast();
            ll Y = gfst();
            if(X <= Y) ret += (Y - X + 1);
            ans = max(ans , ret);
        }else {
            
            ll j = ii + 1;
            while(j < v.size()) {
                ans = max(ans , v[j].second - v[j].first + 1);
                j++;
            }
            break;
        }
        //cout << ii << " --> " << ans << endl;
    }
        ll ln = 0;
        id = 0;
        for(ll i=1;i<=n;i++) {
                if(ln < r[i] - l[i] + 1) {
                        ln = r[i] - l[i] + 1;
                        id = i;
                }
        }
        ll maxm = 0;
        ll minm = 1e16;
        for(ll i=1;i<=n;i++) {
                if(i == id) continue;
                maxm = max(maxm , l[i]);
                minm = min(minm , r[i]);
        }
        if(minm >= maxm) ln += minm-maxm+1;
        ans = max(ans , ln);
    cout << ans << endl;
        
    
}


Measured memory_bytes: 12784
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        string S = ReadLine();
        int N = S.Length;
        var dp = new long[N+1, 13];
        dp[0, 0] = 1;
        for (int i = 0;i<N;i++)
        {
            var s = S[N-1-i] - '0';
            if (0 <= s && s < 10)
            {
                Modular next = s* Modular.Pow(10, i);
                for (int j = 0; j < 13; j++)
                {
                    
                    dp[i + 1, (int)(next + j)] += dp[i, j];
                }
            }
            else
            {
                for (int j = 0; j < 10; j++)
                {
                    Modular next = j* Modular.Pow(10, i);
                    for (int k = 0; k < 13; k++)
                    {

                        dp[i + 1, (int)(next + k)] += dp[i, k];
                        dp[i + 1, (int)(next + k)] %= 1_000_000_007;
                    }
                }
            }
        }
        WriteLine(dp[N,5]);
    }
}
class Modular
{
    private const int M = 13;
    private long value;
    public Modular(long value = 0) { this.value = value; }
    public static implicit operator Modular(long a)
    {
        var m = a % M;
        return new Modular((m < 0) ? m + M : m);
    }
    public static Modular operator +(Modular a, Modular b)
    => a.value + b.value;
    public static Modular operator -(Modular a, Modular b)
    => a.value - b.value;
    public static Modular operator *(Modular a, Modular b)
    => a.value * b.value;
    public static Modular Pow(Modular a, int n)
    {
        switch (n)
        {
            case 0:
                return 1;
            case 1:
                return a;
            default:
                var p = Pow(a, n / 2);
                return p * p * Pow(a, n % 2);
        }
    }
    public static Modular operator /(Modular a, Modular b)
    {
        return a * Pow(b, M - 2);
    }
    private static readonly List<int> facs = new List<int> { 1 };
    public static Modular Fac(int n)   //階乗
    {
        for (int i = facs.Count; i <= n; ++i)
        {
            facs.Add((int)(Math.BigMul(facs.Last(), i) % M));
        }
        return facs[n];
    }
    public static Modular Fac(int r, int n)
    {
        int temp = 1;
        for (int i = r; i <= n; i++)
        {
            temp = (int)(Math.BigMul(temp, i) % M);
        }
        return temp;
    }
    public static Modular Ncr(int n, int r) //nCr
    {
        return (n < r) ? 0
             : (n == r) ? 1
                        : (n < 1000000) ? Fac(n) / (Fac(r) * Fac(n - r))
                            : Fac(n - r + 1, n) / Fac(r);
    }
    public static explicit operator int(Modular a)
    {
        return (int)a.value;
    }
}


Measured memory_bytes: 54824
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t
#include <math.h>

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

int get_int2(int64_t *a1, int64_t *a2) {
  scanf("%lld %lld", a1, a2);
  return 0;
}

void swap(int64_t *a1, int64_t *a2) {
    int64_t tmp = *a1;
    *a1 = *a2;
    *a2 = tmp;
}

#define QUERY_MAX 100

int main(int argc, char const *argv[]){
  int queries = get_int();
  static int64_t ans[QUERY_MAX];
  int aidx = 0;
  int i;
  for(i = 0;i < queries;i++){
      int64_t res;
      int64_t a, b;
      get_int2(&a, &b);
      if(a > b) swap(&a, &b);
      int64_t t=a*b;
      int64_t s=sqrt(t);
      if(a+1>=b) {
          res = 2*(s-1);
      // e.g) a1=1, a2=9
      } else if(s*s==t) {
          res = 2*(s-1)-1;
      } else if(s*(s+1)>=t) {
          res=2*(s-1);
      } else { 
          res=2*s-1;
      }
      printf("%lld\n",res);
  }
  for(i = 0; i < aidx; i++) {
      printf("%lld\n", ans[i]);
  }
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdlib>
#include<utility>
#include<tuple>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<deque>
#include<bitset>
#include<cmath>
#include<map>
using namespace std;
using ll = long long int;
const ll mod = 1e9 + 7;
#define rep(i, a, b) = for(i = a; i < b; i++)

int main() {

	int r;
	cin >> r;
	cout << r * r << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,c,i,j;
    cin>>n>>m>>c;
    int b[m];
    for(i=0;i<m;i++)
    {
        cin>>b[i];
    }
    int a[n][m];
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            cin>>a[i][j];
        }
    }
    int count=0;
    for(i=0;i<n;i++)
    {
        int sum=0;
        for(j=0;j<m;j++)
        {
            sum+=(b[j]*a[i][j]);
        }
        if(sum+c>0)
        {
            count++;
        }
    }
    cout<<count;
}


Measured memory_bytes: 3604
import sys
sys.setrecursionlimit(1000000)

n = int(input())

list1 = [int(input()) for i in range(n)]
unch = [0]*n
def fuck(index,times):
    if list1[index] == 2:
        return times + 1
    else:
        if unch[index] == 1:
            return -1
        else:
            unch[index] = 1
            return fuck(list1[index]-1,times+1)

print(fuck(0,0))
            



Measured memory_bytes: 115416
import java.util.*;

public class Main {
	public static void main(String args[]) {
    	Scanner sc = new Scanner(System.in);
      	int A,B,C;
      	A = sc.nextInt();
      	B = sc.nextInt();
      	C = sc.nextInt();
      	if ((A < C && C < B) || (B < C && C < A)) {
            	System.out.print("Yes");
        }  else {
        	System.out.print("No");
        }   
    }
}

Measured memory_bytes: 21588
#include<stdio.h>
#include<string.h>
int main (void){
char S[5];
  scanf("%s",S);
  
  if(strcmp(S,"Sunny") == 0){
  printf("Cloudy");
  }else if(strcmp(S,"Cloudy")==0){
  printf("Rainy");
  }else if(strcmp(S,"Rainy")==0){
  printf("Sunny");
  }
  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <stdio.h>

using namespace std;

int x[200100];
int chk[200100];

int main()
{
	int n,m,ii,jj,i;
	scanf("%d %d",&n,&m);
	for(i=1;i<=n;i++)
		x[i] = 1;
	chk[1] = 1;
	while(m--)
	{
		scanf("%d %d",&ii,&jj);
		chk[jj] = max(chk[ii],chk[jj]);
		x[ii]--;
		x[jj]++;
		if(x[ii] == 0)
			chk[ii] = 0;
	}
	int ans = 0;
	for(i=1;i<=n;i++)
	{
		if(chk[i])
			ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<vector>
#include<queue>
#include<map>
using namespace std;

typedef pair<int,int> P;

int main(){
  int n,d[110];
  string a[110];
  bool gt[110];
  vector<P> g[110];

  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(a[i]=="goto"){
      gt[i] = true; cin >> a[i]; a[i][a[i].size()-1] = ':';
    }else gt[i] = false;
  }

  for(int i=0;i<n;i++){
    if(gt[i]){
      for(int j=0;j<n;j++)
	if(!gt[j] && a[i] == a[j])g[i].push_back(P(0,j));
      g[i].push_back(P(1,i+1));
    }else g[i].push_back(P(0,i+1));
  }

  for(int i=0;i<=n;i++)d[i] = 1000000000; d[0] = 0;
  deque<int> q; q.push_back(0);

  while(q.size()){
    int v = q.front(); q.pop_front();
    for(int i=0;i<g[v].size();i++){
      int c = g[v][i].first, nxt = g[v][i].second;
      if(d[nxt] > d[v]+c){
	d[nxt] = d[v]+c;
	if(c)q.push_back(nxt);
	else q.push_front(nxt);
      }
    }
  }
  cout << d[n] << endl;
}

Measured memory_bytes: 1228
import java.util.Scanner;
public class Main{
	private static Scanner sc=new Scanner(System.in);
	public static void  main(String[]agrs){
		while(sc.hasNext()){
			double w = sc.nextDouble();
			if(w <= 48.00){
				System.out.println("light fly");
			}else if(48.00 < w && w <= 51.00){
				System.out.println("fly");
			}else if(51.00 < w && w <= 54.00){
				System.out.println("bantam");
			}else if(54.00 < w && w <= 57.00){
				System.out.println("feather");
			}else if(57.00 < w && w <= 60.00){
				System.out.println("light");
			}else if(60.00 < w && w <= 64.00){
				System.out.println("light welter");
			}else if(64.00 < w && w <= 69.00){
				System.out.println("welter");
			}else if(69.00 < w && w <= 75.00){
				System.out.println("light middle");
			}else if(75.00 < w && w <= 81.00){
				System.out.println("middle");
			}else if(81.00 < w && w <= 91.00){
				System.out.println("light heavy");
			}else if(91.00 < w){
				System.out.println("heavy");
			}
		}
	}
}

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

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


Measured memory_bytes: 256
N = int(input())
K = int(input())
x = list(map(int, input().split()))
K_half =  K/2

total=0

for i in range(N):
    if K_half>=x[i]:
        total = total + x[i]*2
    else:
        total = total + (K-x[i])*2
print(total)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	long long count[100001]={0};
	int n;
	long long k;
	scanf("%d %lld",&n,&k);
	for(int i=0;i<n;i++)
	{
		int a,b;
		scanf("%d %d",&a,&b);
		count[a]+=b;
	}
	long long temp=0;
	for(int i=1;i<=100000;i++)
	{
		temp+=count[i];
		if(temp>=k)
		{
			printf("%d\n",i);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 1024
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};


#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


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





void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    vector<int> d(n);
    rep(i,n) cin >> d[i];
    sort(ALL(d));
    cout << d[n/2] - d[n/2 -1] << endl;
    
}



signed main() {
    solve();
    return 0;
}



Measured memory_bytes: 640
D=int(input())
c=[int(i) for i in input().split()]
a=[]
for i in range(D):
    a.append([int(i) for i in input().split()])

last=[0 for i in range(26)]
zoku=0
for d in range(D):
    t=int(input())
    zoku+=a[d][t-1]
    last[t-1]=d+1
    for i in range(26):
        zoku-=c[i]*(d+1-last[i])
    print(zoku)

Measured memory_bytes: 69712
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N, H;
  cin >> N >> H;
  vector<ll> a(N), b(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i] >> b[i];
  }
  sort(a.rbegin(), a.rend());
  sort(b.rbegin(), b.rend());
  ll sum_b = 0;
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    if (a[0] < b[i]) {
      sum_b += b[i];
      ans++;
    }
    if (H <= sum_b) {
      cout << ans << endl;
      return 0;
    }
  }
  H -= sum_b;
  if (H % a[0] == 0) {
    ans += H / a[0];
  } else {
    ans += H / a[0] + 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4836
#include <bits/stdc++.h>
#define X first
#define Y second
#define LL long long
#define MP make_pair
#define PB push_back
#define SZ(a) (LL)(a.size())
const LL INF = 1000 * 1000 * 1000 + 47;
const LL LINF = INF * (LL)INF;
using namespace std;
const LL MAX = 200005;
const LL MAGIC = 50;
int pref[MAX] , a[MAX] , pzdc[MAX];
int s(int l , int r)
{
	if(l > r)
		return 0;
	return pref[r] - (l ? pref[l - 1] : 0);
}
int main() 
{
	int N , K;
	cin >> N >> K;
	int ans = N - K + 1;
	for(int i = 0; i < N; i++)
		cin >> a[i];
	for(int i = 0; i < N - 1; i++)
		pref[i] = (a[i] > a[i + 1]) + (i ? pref[i - 1] : 0);
	bool first = true;
	for(int i = 0; i < N - K + 1; i++)
		if(s(i , K - 2 + i) == 0)
		{
			pzdc[i] = !first;
			first = false;
		}
	set<int> s;
	for(int i = 0; i < K; i++)
		s.insert(a[i]);
	for(int i = 0; i < N - K; i++)
	{
		s.insert(a[i + K]);
		if(*s.begin() == a[i] && *(--s.end()) == a[i + K])
			pzdc[i + 1] = 1;
		s.erase(a[i]);
	}
	for(int i = 0; i < N - K + 1; i++)
		ans -= pzdc[i];
	cout << ans;
			
	return 0;
}


Measured memory_bytes: 11136
n = int(raw_input())
elem = map(int,raw_input().split())

count = 0
for i in range(0,n):
    for j in range(n-1,-1+i,-1):
        if elem[j] < elem[j-1] and j>0:
            count += 1
            tmp = elem[j-1]
            elem[j-1] = elem[j]
            elem[j] = tmp
print " ".join(map(str,elem))
print count

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
int k;
vector<string>ans;
int main(){
	//freopen("readin.txt","r",stdin);
	string s;
	cin >> s;
	scanf("%d",&k);
	for(int i = 0;i < s.size();i++)
		for(int j = 1;j <= k && i + j - 1 < s.size();j++)
			ans.push_back(s.substr(i,j));
	sort(ans.begin(),ans.end());
	ans.resize(unique(ans.begin(),ans.end()) - ans.begin());
	cout << ans[k - 1] << endl;
}

Measured memory_bytes: 1660
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {

  int a, b; std::cin >> a >> b;
  std::cout << std::ceil((float)(a+b)/2.) << std::endl;
  return 0;
}


Measured memory_bytes: 256
from itertools import permutations as perm
n,m = map(int, input().split())
edges = [[] for i in range(n)]
for i in range(m):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

def check(l, edge):
    for i in range(1,len(l)):
        u = l[i-1]
        v = l[i]
        if v not in edges[u]:
            return False
    return True

ans = 0
for l in perm([i for i in range(n)]):
    if l[0] != 0: continue
    if check(l,edges):
        ans += 1

print(ans)

Measured memory_bytes: 9196
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <cstring>
#include <unordered_set>
#include <unordered_map>

using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const ll INF = 1000010000;
static const ll MOD = 1000000007;
 
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation

//int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

#define all(c) (c).begin(), (c).end()

struct graph {
  int L, R;
  vector<vector<int>> adj;
  graph(int L, int R) : L(L), R(R), adj(L+R) { }
  void add_edge(int u, int v) {
    adj[u].push_back(v+L);
    adj[v+L].push_back(u);
  }
  int maximum_matching() {
    vector<int> visited(L), mate(L+R, -1);
    function<bool(int)> augment = [&](int u) { // DFS
      if (visited[u]) return false;
      visited[u] = true;
      for (int w: adj[u]) {
        int v = mate[w];
        if (v < 0 || augment(v)) {
          mate[u] = w;
          mate[w] = u;
          return true;
        }
      }
      return false;
    };
    int match = 0;
    for (int u = 0; u < L; ++u) {
      fill(all(visited), 0);
      if (augment(u)) ++match;
    }
    return match;
  }
};

int main(){
	int a, b, c, d;
	cin >> a >> b;
  cout << (a - 1) * (b - 1) << endl;
}

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

Measured memory_bytes: 1764
#include<cstdio>
using namespace std;
int main()
{
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    int le,ri;
    le=a+b;
    ri=c+d;
    if(le>ri)
        printf("Left");
    else if(le<ri)
        printf("Right");
    else
        printf("Balanced");
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<memory>
#include<cmath>

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pb push_back

using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const int MAX_N=5001;
const ll LINF=100000000000000000;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb push_back;
#define sp " ";
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    string s;
    cin>>s;
    int ans=s.size();
    rep(i,s.size()-1){
        if(s[i]==s[i+1]) continue;
        else{
            int si=s.size();
            int time=max(i+1,si-i-1);
            ans=min(time,ans);
        }
    }
    out(ans);
}

Measured memory_bytes: 512
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

long long mod = 1e9 + 7LL;

int main() {

    long long n, m;
    cin >> n >> m;

    vector<long long> x(n);
    for (int i = 0; i < n; i++) cin >> x[i];

    vector<long long> y(m);
    for (int i = 0; i < m; i++) cin >> y[i];

    vector<long long> x_diff(n - 1), y_diff(m - 1);
    for (int i = 0; i < n - 1; i++) x_diff[i] = x[i + 1] - x[i];
    for (int i = 0; i < m - 1; i++) y_diff[i] = y[i + 1] - y[i];

    vector<long long> x_weight(n - 1), y_weight(m - 1);
    for (int i = 0; i < n - 1; i++) x_weight[i] = (i + 1) * (n - 1 - i);
    for (int i = 0; i < m - 1; i++) y_weight[i] = (i + 1) * (m - 1 - i);

    long long sum_y = 0;
    for (int i = 0; i < m - 1; i++) {
        sum_y += y_diff[i] * y_weight[i];
        sum_y %= mod;
    }

    long long ans = 0;
    for (int i = 0; i < n - 1; i++) {
        ans += ((x_diff[i] * x_weight[i]) % mod) * sum_y;
        ans %= mod;
    }

    cout << ans << endl;

}




























Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=300010;
const ll oo=9e18;
int n,a[N];
ll s1[N],s2[N];
priority_queue<int>q1,q2;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=3*n;i++) scanf("%d",&a[i]);
	ll sum=0,ans=-oo,temp;
	for(int i=1;i<=(n<<1);i++){
		sum+=a[i];
		q1.push(-a[i]);
		if(i>n){sum+=q1.top();q1.pop();}
		s1[i]=sum;
	}
	sum=0;
	for(int i=n*3;i>=n;i--){
		sum+=a[i];
		q2.push(a[i]);
		if(i<=(n<<1)){sum-=q2.top();q2.pop();}
		s2[i]=sum;
	}
	for(int i=n;i<=(n<<1);i++)
		ans=max(ans,s1[i]-s2[i+1]);
	cout<<ans;
}

Measured memory_bytes: 5624
#include<stdio.h>
#include<string.h>
int main(){
  int unused __attribute__((unused));
  char A[10], B[10], C[10];

  unused = scanf("%s", A);
  unused = scanf("%s", B);
  unused = scanf("%s", C);

  if(A[strlen(A)-1] == B[0] && B[strlen(B)-1] == C[0]) printf("YES");
  else printf("NO");

  return 0;
}

Measured memory_bytes: 128
a,b,x = gets.split(' ').map(&:to_i)

if b-2*x.to_f/(a*a) <= 0
  puts Math.atan2((b-x.to_f/(a*a))*2, a) * 180 / Math::PI
else
  puts Math.atan2(b, 2*x.to_f/(a*b)) * 180 / Math::PI
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main(){
    int x;cin>>x;
    for(int i=x;;i++){
        if(i==2){
            cout<<i<<endl;
            return 0;
        }
        if(i%2==0)continue;
        bool jud=true;
        for(int j=2;j<=sqrt(i);j++){
            if(i%j==0){
                jud=false;
                break;
            }
        }
        if(jud){
            cout<<i<<endl;
            return 0;
        }
    }
}



Measured memory_bytes: 256
from collections import Counter
dicy = {}
def swap(a,b):
	tmp = 0
	try:
		tmp = dicy.pop(a)
	except Exception:
		tmp = 0

	try:
		dicy[b] += tmp
	except Exception:
		dicy[b] = tmp

	return (int(b)-int(a)) * tmp
  

max = input()
dicy = dict(Counter(input().split(' ')))
result = 0
for v,k in dicy.items():
	result += int(v)*int(k)
num_oper = int(input())
for i in range(num_oper):
	a,b = input().split(' ')
	diff = swap(a,b)
	result += diff
	print(result)

Measured memory_bytes: 24396
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  for(int i=1;i<=b;i++){
    if(a*i%b==c){
      cout<<"YES"<<endl;
      return 0;
    }
  }
  cout<<"NO"<<endl;
}


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

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

    int n, m;
    cin >> n >> m;
    if(n==m) puts("Yes");
    else puts("No");

    return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N=in();
	auto V=vecin(N);
	ll left=0,right=0;

	vector<int> B(20,0);
	ll sum=0;
	while(left<N && right<N){
		vector<int> VB(20,0);
		int v=V[right];
		REP(i,20){
			if(v&1) VB[i]++;
			v>>=1;
		}

		int maxB=0;
		REP(i,20){
			maxB = max(maxB,VB[i]+B[i]);
		}

		if(maxB<2){
			REP(i,20){
				B[i]+=VB[i];
			}
			sum += (right-left)+1LL;
			right++;
		}
		else{
			v=V[left];
			REP(i,20){
				if(v&1) B[i]--;
				v>>=1;
			}
			left++;
		}
	}
	out(sum);

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
  
int main(){
  int n,a,b;  cin>>n>>a>>b;
  vector<int>A;
  vector<int>B;
  vector<int>C;
  
  for(int i=0; i<n; i++){
    int p; cin>>p;
    if(p<=a) A.push_back(p);
    else if(a<p && p<=b) B.push_back(p);
    else C.push_back(p);
  }
  int x=A.size();
  int y=B.size();
  int z=C.size();
  cout<<min(x,min(y,z))<<endl; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    string s,t;
    cin >> s >> t;
    sort(all(s));
    sort(rall(t));
    cout << (s < t ? "Yes" : "No") << endl;
}


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

int main() {
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, k; cin >> n >> k; vector <bool> f(10, false);
	for(int i = 1; i <= k; i++) {
		int x; cin >> x; f[x] = true;
	}

	for(int i = n; true; i++) {
		bool flag = false;
		int j = i;
		while(j) flag |= f[j % 10], j /= 10;
		if(!flag) {
			cout << i << endl;
			return 0;
		} 
	}
}

Measured memory_bytes: 3628
import sys
n=int(input())
a=list(map(int,sys.stdin.readline().strip().split()))
snk=a[0]
rac=sum(a[1:])

s=sum(list(map(abs,a)))
for i in range(1,n-1):
 snk+=a[i]
 rac-=a[i]
 s=min(s,abs(snk-rac))

print(s)

Measured memory_bytes: 30580
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

//#define MOD (int)(1e5 + 7)
#define MOD (100007)

static inline void done(const char *s)
{
	puts(s);
	exit(0);
}

#define yes() done("Yes");
#define no() done("No");
#define invalid() done("-1");

static int comp(const void *a, const void *b)
{
	int *pa = (int *)a;
	int *pb = (int *)b;
	return *pa < *pb;
}

static inline int *readNint(int n)
{
	int *a = calloc(sizeof(int), n);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	return a;
}

static inline long *readNlong(int n)
{
	long *a = calloc(sizeof(long), n);
	for (int i = 0; i < n; i++)
		scanf("%ld", &a[i]);
	return a;
}

int main(int argc, char **argv)
{
	int A, B;
	scanf("%d%d", &A, &B);
	for (int x = B * 10; x < B * 20; x++) {
		int a = (x * 8) / 100;
		int b = x / 10;
		fprintf(stderr, "%d %d %d\n", x, a, b);
		if (a == A && b == B) {
			printf("%d\n", x);
			return 0;
		}
	}
	printf("-1\n");
	return 0;
}


Measured memory_bytes: 128