akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

int MOD;

template<typename T>
struct Mint{
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(long long k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }

  static Mint add_identity(){return Mint(0);}
  static Mint mul_identity(){return Mint(1);}

  Mint inv(){return pow(MOD-2);}

  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}

  Mint operator+(Mint a) const{return Mint(v)+=a;}
  Mint operator-(Mint a) const{return Mint(v)-=a;}
  Mint operator*(Mint a) const{return Mint(v)*=a;}
  Mint operator/(Mint a) const{return Mint(v)/=a;}

  Mint operator-() const{return v?Mint(MOD-v):Mint(v);}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  bool operator <(const Mint a)const{return v <a.v;}

  static Mint comb(long long n,int k){
    Mint num(1),dom(1);
    for(int i=0;i<k;i++){
      num*=Mint(n-i);
      dom*=Mint(i+1);
    }
    return num/dom;
  }
};
template<typename T>
ostream& operator<<(ostream &os,Mint<T> m){os<<m.v;return os;}

//INSERT ABOVE HERE

const int MAX = 5050;

using M = Mint<int>;
M dp[MAX]={};

signed main(){
  int n;
  cin>>n>>MOD;

  dp[n]=M(1);
  for(int k=0;k<=(n-1)/2;k++)
    for(int j=n;j>=k+1;j--)
      dp[j-(k+1)]+=dp[j];

  for(int k=0;k<=n/2-1;k++)
    for(int j=n;j>=k+1;j--)
      dp[j-(k+1)]+=dp[j];

  M ans{0};
  for(int k=1;k<=n;k++) ans+=dp[k];

  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <map>
#include <queue>

#define REP(i, n) for(ll i = 0; i < (n); i++)
#define INF 1e16
#define MOD 1e9 + 7

using namespace std;
using ll = long long;

class dinic
{
private:
	ll inf;  // 初期化に使う値
	struct edge {
		ll to, cap, rev;
	};
	vector<vector<edge>> list;  // グラフの隣接リスト
	vector<ll> level;    // sからの距離
	vector<ll> iter;     // どこまで調べ終わったか
public:
	dinic(ll n, ll infinity = 1e16);    // nは頂点の数、infinityは初期化に使う値
	void add_edge(ll from, ll to, ll cap); // fromからtoへ容量capの辺をはる
	void bfs(ll s);  // sからの最短距離を求める
	ll dfs(ll v, ll t, ll f);   // 増加パスをdfsで探す
	ll max_flow(ll s, ll t);   // sからtへの最大流を求める
};

dinic::dinic(ll n, ll infinity) {
	list.resize(n);
	level.resize(n);
	iter.resize(n);
	inf = infinity;
}

void dinic::add_edge(ll from, ll to, ll cap) {
	edge e = { to, cap, (ll)list[to].size() };
	list[from].push_back(e);
	e = { from, 0, (ll)list[from].size() - 1 };
	list[to].push_back(e);
}

void dinic::bfs(ll s) {
	for (ll i = 0; i < level.size(); i++) {
		level[i] = -1;
	}
	queue<ll> que;
	level[s] = 0;
	que.push(s);
	while (!que.empty()) {
		ll v = que.front(); que.pop();
		for (auto &x : list[v]) {
			if (x.cap > 0 && level[x.to] < 0) {
				level[x.to] = level[v] + 1;
				que.push(x.to);
			}
		}
	}
}

ll dinic::dfs(ll v, ll t, ll f) {
	if (v == t)return f;

	for (ll &i = iter[v]; i < list[v].size(); i++) {
		edge &e = list[v][i];
		if (e.cap > 0 && level[v] < level[e.to]) {
			ll d = dfs(e.to, t, min(f, e.cap));
			if (d > 0) {
				e.cap -= d;
				list[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

ll dinic::max_flow(ll s, ll t) {
	ll flow = 0;

	for (;;) {
		bfs(s);
		if (level[t] < 0)return flow;

		for (ll i = 0; i < iter.size(); i++) {
			iter[i] = 0;
		}

		ll f;
		while ((f = dfs(s, t, inf)) > 0) {
			flow += f;
		}
	}
}

int main() {
	ll n;
	cin >> n;
	dinic dic(n + 2, 1e18);
	ll sum = 0;
	REP(i, n) {
		ll a;
		cin >> a;
		if (a >= 0) {
			dic.add_edge(0, i + 1, 0);
			dic.add_edge(i + 1, n + 1, a);
			sum += a;
		}
		else {
			dic.add_edge(0, i + 1, -a);
			dic.add_edge(i + 1, n + 1, 0);
		}
	}
	for (ll i = 1; i <= n / 2; i++) {
		for (ll j = i * 2; j <= n; j += i) {
			dic.add_edge(i, j, INF);
		}
	}
	cout << sum - dic.max_flow(0, n + 1) << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int n;
    cin >> n;
    int c = 0;
    for(int i = 1; i <= n; i++){
        if(i&1)c++;
    }
    double ans = (double)c / n;
    printf("%.10lf\n", ans);
}

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

const int INF = 1e9;

int main() {
  long long n,k;
  cin>>n>>k;
  long long a[n];
  for(int i=0; i<n; i++) cin>>a[i];

  int num1[50];
  for (int i=0; i<50; i++) num1[i] = 0;

  for (int i=0; i<n; i++) {
    long long b = a[i];
    int cnt = 1;
    while (b > 0) {
      if (b & 1) {
        ++num1[cnt];
      }
      b = b >> 1;
      ++cnt;
    }
  }

  long long x = 0;
  long long ans = 0;
  for (int i=49; i>=1; i--) {
    long long tmp = pow(2, i - 1);
    if (num1[i] < n - num1[i] && x + tmp <= k) {
      x += tmp;
      ans += tmp * (n - num1[i]);
    } else {
      ans += tmp * num1[i];
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
    int n, y;
    scanf("%d %d", &n, &y);
    int i, j;
    int man = -1, gosen = -1, sen = -1;
    
    for(i=0;i<=n;i++){
        for(j=0;j<=n-i;j++){
            if(i*10000 + j*5000 + 1000*(n-i-j) == y){
                man = i;
                gosen = j;
                sen = n - i- j;
            }
        }
    }
    
    printf("%d %d %d", man, gosen, sen);
    return 0;
}


Measured memory_bytes: 128
n,ma,mb = gets.chomp.split(" ").map(&:to_i)
dp = Array.new(500).map{Array.new(500)}
dp[0][0] = 0
n.times do
  a,b,c = gets.chomp.split(" ").map(&:to_i)
  400.downto(0) do |i|
    400.downto(0) do |j|
      if dp[i][j]
        if dp[i+a][j+b]
          dp[i+a][j+b] = [dp[i+a][j+b],dp[i][j]+c].min
        else
          dp[i+a][j+b] = dp[i][j]+c
        end
      end
    end
  end
end
ans = 4001
for i in 1..[400/ma,400/mb].min
  if dp[ma*i][mb*i]
    ans = [ans,dp[ma*i][mb*i]].min
  end
end
if ans == 4001
  puts "-1"
else
  puts ans
end

Measured memory_bytes: 3836
#include <iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    int ans = 0;
    int cnta = 0;
    int cntb = 0;
    int cnt = 0;
    for(int i = 0; i < N; i++){
        string s;
        cin >> s;
        for(int j = 1; j < s.size(); j++){
            if(s[j] == 'B' && s[j-1] == 'A') ans++;
        }
        if(s[0] == 'B' && s[s.size()-1] == 'A'){
            cnt++;
        }else if(s[0] == 'B'){
            cntb++;
        }else if(s[s.size()-1] == 'A'){
            cnta++;
        }
    }
    if(cnt > 0) ans += (cnt-1);
    if(cnta > 0 && cnt > 0) {
        ans++;
        cnta--;
    }
    if(cntb > 0 && cnt > 0) {
        ans++;
        cntb--;
    }
    ans += min(cnta, cntb);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long 
#define debug(x) cout << #x << " " << x << endl; 
using namespace std;

int inf = 1e14;

int n,m;
int dp[20000];

int call(int x)
{
	if(x == m)return 1;
	if(x > m)return inf;
	if(x <= 0)return inf;
	if(dp[x] != -1)return dp[x];
	debug(x);
	int cc2 = 1+ call(x-1);
	int cc = 1+ call(x*2);
	dp[x] = 0;
	return dp[x] = max(cc,cc2); 
}

int32_t main()
{
	////freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	cin >> n >> m;
	cout << ((n*3)+m)/2;

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
  ll n;
  cin>>n;
  ll sum=0;
  for(int i=0;i<n;i++){
    ll d;cin>>d;
    sum+=d;
  }
  cout<<sum-n<<"\n";
}

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

int main() {
  int N;
  cin >> N;
  if(N%10 == 7 || N%100/10 == 7 || N/100 == 7){
        cout << "Yes" << endl;  
  }
  else cout << "No" << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#define REP(i, a) for (int i = 0; i < (a); i++)
#define REPR(i, a) for (int i = (int)(a) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (int)(b) - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<long long>;
using vvl = vector<vl>;
using vs = vector<string>;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &a) { cout << a << ' '; }
void br() { putchar('\n'); }

void to(long long *x, long long y) {
  *x = min(*x, y);
}

int main() {
  int N = si();
  long long R = sl();
  long long L = sl();
  vi A(N);
  REP(i, N) A[i] = si();
  static long long dp[5001][5001];
  REP(i, 5001) REP(j, 5001) dp[i][j] = 1e18;
  dp[0][0] = 0;
  REP(i, N) {
    REP(j, N+1) {
      if (j < A[i]) {
        to(&dp[i+1][A[i]], dp[i][j]);
        to(&dp[i+1][j], dp[i][j] + R);
      }
      if (A[i] < j) {
        to(&dp[i+1][j], dp[i][j] + L);
      }
    }
  }
  long long ans = 1e18;
  REP(i, N+1) to(&ans, dp[N][i]);
  cout << ans << '\n';
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 8;
int n, m, r, a, b, c, ans;
int R[N];
int e[210][210];

int main() {
    ans = 1e9;
    memset(e, 0x3f, sizeof e);
    cin >> n >> m >> r;
    for (int i = 0; i < r; ++i) {
        cin >> R[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> a >> b >> c;
        e[a][b] = c;
        e[b][a] = c;
    }
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            for (int k = 1; k <= n; ++k) {
                e[j][k] = min(e[j][k], e[j][i] + e[i][k]);
            }
        }
    }
    sort(R, R + r);
    do {
        int sum = 0;
        for (int i = 0; i < r - 1; ++i) {
            sum += e[R[i]][R[i + 1]];
        }
        ans = min(ans, sum);
    } while (next_permutation(R, R + r));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3820
#include <iostream>
#include <string>
#include <stdio.h>

using namespace std;

int main()
{
    int H, W;
    cin >> H >> W;
    while((H != 0) || (W != 0)){
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if((i + j) % 2 == 0){
                    cout << "#";
                } else {
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
        cin >> H >> W;
    }
 
//  cout <<  << endl;
//  printf("%f\n",x);
}



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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;

using namespace std;

int power(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

bool vowel(char c)
{
    return(c=='a' or c=='e' or c=='i' or c=='o' or c=='u' or c=='A' or c=='E' or c=='I' or c=='U' or c=='O');
}

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);

    int n;
    cin>>n;

    string s;
    map <string,int> mp;
    loop(i,0,n)
    {
        cin>>s;
        mp[s]++;
    }

    cout<< "AC x "<<mp["AC"]<< "\n";
    cout<< "WA x "<<mp["WA"]<< "\n";
    cout<< "TLE x "<<mp["TLE"]<< "\n";
    cout<< "RE x "<<mp["RE"];


    return 0;
}


Measured memory_bytes: 3664
import sys
from operator import itemgetter
read = sys.stdin.read


def main():
    N, *AB = map(int, read().split())
    A = AB[::2]
    B = AB[1::2]
    ab = [a + b for a, b in zip(A, B)]
    ab, A, B = zip(*sorted(zip(ab, A, B), key=itemgetter(0), reverse=True))

    print(sum(A[::2]) - sum(B[1::2]))


if __name__ == '__main__':
    main()

Measured memory_bytes: 33068
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;

/*
char* reverse(string s);

int main() {
	string str;
	cin >> str;
	
	val = reverse(str);
	
	cout << val << endl;
}

char* reverse(string s) {
	int size = s.length;
	char* val = new char[size];
	for(int i = 0; i < size; ++i) {
*/

int main() {
	string str;
	cin >> str;
	reverse(str.begin(), str.end());
	
	cout << str <<endl;
}

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

int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n){
        cin >> a.at(i);
    }
    
    string s ="APPROVED";
    rep(i, n){
        if(a.at(i)%2 == 0){
            if(a.at(i)%3 != 0 && a.at(i)%5 != 0) s = "DENIED";
        }
    }
    
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CAXBC solver = new CAXBC();
        solver.solve(1, in, out);
        out.close();
    }

    static class CAXBC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int ans = 0;
            for (int i = 1; i < n; i++) {
                ans += (n - 1) / i;
            }

            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 35800
import sys
from collections import deque

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = [deque([(i, x) for x in lr()]) for i in range(1, N+1)]
day = 0
candidate = set()
match = 0
for i in range(N):
    c = A[i][0]
    candidate.add(c)

while candidate:
    day += 1
    used = set()
    next = set()
    for a, b in candidate:
        if a in used or b in used:
            continue
        if A[b-1][0] == (b, a):
            match += 1
            A[a-1].popleft()
            A[b-1].popleft()
            if A[a-1]:                
                next.add(A[a-1][0])
            if A[b-1]:
                next.add(A[b-1][0])
            used.add(a)
            used.add(b)
    if match == N * (N-1) // 2:
        break
    candidate = next
    if not used:
        print(-1); exit()

print(day)
# 10


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


int main(){
  string s;
  cin >> s;
  cout << count(ALL(s), '1') << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
  
int main () {
  int n, m, count=0;
  cin >> n >> m;
  vector<int> a(m);
  rep(i,n) {
    int k;
    cin >> k;
    rep(j,k) {
      int A;
      cin >> A;
      a.at(A-1)++;
    }
  }
  rep(i,m) {
    if(a.at(i) == n)
      count++;
  }
    cout << count;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int A, B, C;
		Scanner scanner = new Scanner(System.in);

		A = scanner.nextInt();
		B = scanner.nextInt();
		C = scanner.nextInt();

		if(A == B && B == C && C == A)
			System.out.println("Yes");
		else
			System.out.println("No");

	}

}

Measured memory_bytes: 23764
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int dp[3005][3005];
void solve(string X, string Y){
    int m = (int)X.size();
    int n = (int)Y.size();
    
    rep(i,m+1)rep(j,n+1){
        if (i == 0 || j == 0){
            dp[i][j] = 0;
        }
        else if (X[i-1] == Y[j-1]){
            dp[i][j] = dp[i-1][j-1] + 1;
        }
        else{
            dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }
    int index = dp[m][n];
    string res;
    int i = m, j = n;
    while (i > 0 && j > 0){
        if (X[i-1] == Y[j-1]){
            res+= X[i-1];
            i--; j--; index--;
        }
        else if (dp[i-1][j] > dp[i][j-1]){
            i--;
        }
        else{
            j--;
        }
    }
    reverse(res.begin(),res.end());
    if(res.size())cout << res << endl;
}
int main(){
    string x,y;
    cin >> x >> y;
    solve(x,y);
    return 0;
}

Measured memory_bytes: 35456
#include<iostream>
using namespace std;
int main(){
	string s,t,u;
	cin >> s >> t >> u;
	int turn=0;
	int si=0,ti=0,ui=0;
	while(1){
		if(turn=='a'-'a'){
			if(si==s.length()){
				cout << 'A' << endl;
				break;
			}
			turn=s[si]-'a';
			si++;
		}
		if(turn=='b'-'a'){
			if(ti==t.length()){
				cout << 'B' << endl;
				break;
			}
			turn=t[ti]-'a';
			ti++;
		}
		if(turn=='c'-'a'){
			if(ui==u.length()){
				cout << 'C' << endl;
				break;
			}
			turn=u[ui]-'a';
			ui++;
		}
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {

//	パターン1（SとKを比べて場合分け）
//	入力の読み込み
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		String S = sc.next();
		if(S.length() <= K) {
			System.out.print(S);
		}
		else {
			System.out.print(S.substring(0,K) + "...");
		}



//	パターン2（Kまで1文字ずつ表示）
//		for(int i=0 ; i<K ; i++) {
//			System.out.print(S.charAt(i));
//		}
//		System.out.print("...");
	
	}
}


Measured memory_bytes: 26984
#include <stdio.h>

int main() {
	char c;
	scanf("%s" , &c);

	if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
		printf("vowel");
	} else {
		printf("consonant");
	}
	return 0;
}

Measured memory_bytes: 128
from sys import exit
def main():
  A, B = map(int, input().split())
  
  if A % B == 0:
    print(A)
    exit()
  elif B % A == 0:
    print(B)
    exit()
  elif A == B :
    print(A)
    exit()
    
  large = 0
  small = 0
  if A > B:
    large = A
    small = B
  else:
    large = B
    small = A
    
  i = 2
  while True:
    if (large * i) % small == 0:
      print(large * i)
      exit()
    i += 1
  
  
  
  
  
main()

Measured memory_bytes: 8880
import java.util.Scanner;

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

		long w = sc.nextLong();
		long h = sc.nextLong();
		long x = sc.nextLong();
		long y = sc.nextLong();

		if (x == (double) w / 2 && y == (double) h / 2)
			System.out.println((double) (w * h) / 2 + " " + 1);
		else
			System.out.println((double) (w * h) / 2 + " " + 0);
	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};

int main(){
  ll N,sum=0,cnt=0;
  cin>>N;
  ll A[N];
  for(ll i=0;i<N;i++){
    cin>>A[i];
    if(A[i]<0) cnt++;
    else if(A[i]==0) cnt=N+1;
    sum+=abs(A[i]);
    A[i]=abs(A[i]);
  }
  sort(A,A+N);
  if(cnt>N||cnt%2==0) cout<<sum<<endl;
  else cout<<sum-A[0]*2<<endl;
}


Measured memory_bytes: 1024
import java.lang.*;
import java.io.*;
import java.util.*;

class Main{
	public static void main(String args[]) throws FileNotFoundException{
		Scanner sc=new Scanner(System.in);
		String buf=sc.nextLine();
		
		String[] sbuf=buf.split(" ");
		int n=Integer.parseInt(sbuf[0]);
		int k=Integer.parseInt(sbuf[1]);
		sbuf=sc.nextLine().split(" ");
		
		int[] num=new int[sbuf.length];
		for(int i=0; i<sbuf.length; i++){
			num[i]=Integer.parseInt(sbuf[i]);
		}
		
		int a=1;
		int sub=k-1;
		n-=k;
		
		
		while(n>=sub){
			n-=sub;
			
			a+=1;
		}
		
		System.out.println( (n>0)? a+1: a);
	}

	static void disp(long[] data){
		for(int i=0; i<data.length; i++){
				System.out.printf("%d ",data[i]);
		}
			System.out.println();
	}
}


Measured memory_bytes: 49048
#include <bits/stdc++.h>
using namespace std;
const int mod = 7 + 1e9;
int h, w, dp[1000][1000]={};
bool grid[1000][1000];
int f(int i = 0 , int j = 0 )
{
    if( i == h || j == w || grid[i][j] )
        return 0;
    if( i == h-1 && j == w-1)
        return 1;
    int &d = dp[i][j];
    if( d != -1 ) return d;
    return d = (f(i+1,j)%mod + f(i,j+1)%mod)%mod;
}
int main()
{
    memset(dp,-1,sizeof dp);
    cin >> h >> w;
    for(int i=0;i<h;++i)
        for(int j=0;j<w;++j)
        {
            char t; cin >> t;
            grid[i][j] = t == '.' ? 0 : 1 ;
        }
    cout << f();
    return 0;
}

Measured memory_bytes: 5248
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N=int(input())
fact=factorization(N)
if fact[0][0]==1:
    fact=fact[1:]
ans=0
for i in range(len(fact)):
    n= 1
    while n*(n+1)//2<=fact[i][1]:
        n+=1
    ans+=n-1

print(ans)


Measured memory_bytes: 9488
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define NFOR(i,a,b) for(ll i = (ll)(a); i >= (ll)(b); --i)
#define rep(i, a) for (ll i = 0; i < a; i++)
#define endl "\n"
#define fi first
#define se second
#define MOD 1000000007
#define inf 1e12
#define pb push_back
#define Case cout<<"Case #"<<++cas<<": ";
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) v.begin(),v.end()

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;

#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const multiset<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}

void solve() {
	ll n, k;
	cin >> n >> k;
	vl h(n);
	rep(i, n) cin >> h[i];
	vl dp(n, inf);
	dp[0] = 0;
	FOR(i, 1, n - 1) 
		FOR(j, 1, min(k, i))
			dp[i] = min(dp[i], dp[i-j] + abs(h[i-j] - h[i]));
	cout << dp[n-1] << endl;
}

int main()
{
    fastio;
    ll t  = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}


Measured memory_bytes: 1792
//Abhinav ---IIIT_A
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define f(i,x,n) for(int i=x;i<(int)n;++i)
#define vpii vector<pair<int,int>>
#define vi vector<int>
#define mpii map<pair<int,int>,int>
#define mpivpii map<int,vector<pair<int,int>>>
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define mpi map<int,int>
#define vvi vector<vector<int>>
#define vvvi vector<vvi>
ld pie=3.141592653589;
int mod=1e9+7;

bool Compare(pair<int,int> a, pair<int,int> b)
{
    int l1=a.ss-a.ff+1;
    int l2=b.ss-b.ff+1;
    if(l1!=l2) return l1>l2;
    return a.ff > b.ff;
}
std::priority_queue<pii, std::vector<pii>, std::function<bool(pii, pii)>> pq(Compare);


void solve(){
  string s; cin>>s;
  int mx=0,curr=0;
  f(i,0,3){
    if(s[i]=='R') ++curr;
    else curr=0;
    mx=max(mx,curr);
  }
  cout<<mx;
  
}


int32_t main(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
  int t=1; //cin>>t;
  while(t--) solve();
  return 0;
}
// check for overflows dummy !!!


Measured memory_bytes: 3612
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int A[] = new int[N];
		int cnt = 0;
		int sum = 0;
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			sum += A[i];
		}
		
		for(int i = 0; i < N; i++) {
			if(A[i] * 4 * M >= sum) {
				cnt++;
			}
		}
		
		if(cnt >= M) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21844
/*
    Problem 93
    https://atcoder.jp/contests/s8pc-3/tasks/s8pc_3_b
*/
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* class */
class pazzle {
    public:
    int H, W, K, ans;
    vector<vector<int> > v;
    pazzle (int H, int W, int K, vector<vector<int> > v)
    : H(H), W(W), K(K), v(v) {}
    bool del() {
        int ret = false;
		for (int i = 0; i < H; i++) {
            int L = 0;
            for (int j = 0; j <= W; j++) {
				if (v[i][j] != v[i][L] || v[i][j] == -1) {
					if (j - L >= K) {
                        ret = true;
						for (int k = L; k < j; k++) { ans += v[i][k]; v[i][k] = -1; }
					}
					L = j;
				}
			}
		}
        return ret;
    }
    void move() {
        for (int i = 0; i < W; i++) {
            vector<int> u;
            for (int j = H - 1; j >= 0; j--) if (v[j][i] != -1) u.push_back(v[j][i]);
            for(int j = 0; j < H; j++) v[j][i] = -1;
            for (int j = 0; j < u.size(); j++) v[H - 1 - j][i] = u[j];
        }
    }
    void setAns() { ans = 0; }
    ll gameStart() {
        ll ret = 0;
        move();
        setAns();
        for (int i = 0; del(); i++){
            move();
            ret += pow(2, i) * ans;
            setAns();
        }
        return ret;
    }
};
/* constant */
const int INF = (1 << 30);
/* global variables */
/* function */
/* main */
int main(){
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> vs(H);
    for (int i = 0; i < H; i++) cin >> vs[i];
    vector<vector<int> > v(H, vector<int> (W + 1, -2));
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) {
        if (vs[i][j] == '.') v[i][j] = -1;
        else v[i][j] = vs[i][j] - '0';
    }
    if (K >= 4) {
        cout << 0 << '\n';
        return 0;
    }
    ll ans = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            // if (i != 3 || j != 2) continue; // XXX
            int tmp = v[i][j];
            v[i][j] = -1;
            pazzle P = pazzle(H, W, K, v);
            ans = max(ans, P.gameStart());
            v[i][j] = tmp;
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
char s[200010]; 
int a,b,c;
int main(){
	scanf("%s",s+1);
	for(int i=1;i<=3;i++){
		if(s[i]=='a') a++;
		if(s[i]=='b') b++;
		if(s[i]=='c') c++;
	}
	if(a==1&&b==1&&c==1) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e+18
#define int long long
using namespace std;

class Set{
	public:
	int sum = 0;
	multiset<int> st;
	void insert(int x){
		st.insert(x);
		sum += x;
	}
	void erase(int x){
		st.erase(st.lower_bound(x));
		sum -= x;
	}
	int popback(){
		int x = *(st.rbegin());
		erase(x);
		return x;
	}
	int popfront(){
		int x = *(st.begin());
		erase(x);
		return x;
	}
};

signed main(){
	int q,cnt = 0,sum = 0;
	Set low,up;
	cin >> q;
	for(int i = 0;i < q;i++){
		int t;
		cin >> t;
		if(t == 1){
			int a,b;
			cin >> a >> b;
			sum += b;
			if(cnt % 2 == 0) low.insert(a);
			else up.insert(a);
			up.insert(low.popback());
			low.insert(up.popfront());
			cnt++;
		}else{
			int mid = *(low.st.rbegin());
			cout << mid << " " << up.sum - low.sum + (cnt % 2 ? mid : 0) + sum << endl;
		}
	}
}

Measured memory_bytes: 9600
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let h: usize = sc.read();
    let w: usize = sc.read();
    let a: usize = sc.read();
    let b: usize = sc.read();
    let mut ans = vec![vec![0; w]; h];
    for i in 0..h {
        for j in 0..w {
            if i < b && j < a {
                ans[i][j] = 1;
            }
            if i >= b && j >= a {
                ans[i][j] = 1;
            }
        }
    }

    for i in 0..h {
        for j in 0..w {
            print!("{}", ans[i][j]);
        }
        println!();
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

int main(){

    int N;
    cin >> N;

    vector<long long> H(N, 0);
    for(int i = 0; i < N; i++){
        cin >> H.at(i);
    }

    for(int i = 0; i < N-1; i++){
        if(H.at(i) < H.at(i+1)){
            H.at(i+1) = H.at(i+1) - 1;
        }
    }

    int flag = 0;
    for(int i = 0; i < N-1; i++){
        if(H.at(i) > H.at(i+1)){
            flag = 1;
        }
    }

    if(flag == 1){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 1024
use std::env;
use std::io::*;
use std::str::*;
use std::mem;
use std::collections::HashMap;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}
fn read_char() -> char {
    let c = read::<String>();
    let c = c.chars().collect::<Vec<char>>();
    c[0]
}
fn read_String_Vec() -> Vec<char> {
    let S = read::<String>();
    S.chars().collect::<Vec<char>>()
}

fn vecchar_to_String(Vs: Vec<char>) -> String {
    let mut S = String::new();
    for i in 0..Vs.len() {
        S.push(Vs[i]);
    }
    S
}

/*
A : 65
Z : 90
a : 97
z : 122
*/

/*
let N = read::<i32>();
let S = read::<String>();
let S = read_String_Vec();
let C = read_char();
*/

/*
 .to_string() : * -> String
 &*S          : String -> &str
*/

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();

    let N = read::<i32>();
    let mut sum = 0;
    for i in 0..N {
        let l = read::<i32>();
        let r = read::<i32>();
        sum += r-l+1;
    }

    println!("{}", sum);
}


Measured memory_bytes: 4352
#include <iostream>
using namespace std;
int main() {
    string s,t;
    cin >> s >> t; //これで２行分読める.
    t.pop_back(); //末尾の文字列を消去.
    if(s==t) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}



Measured memory_bytes: 3596
# # 1 <= K <= 10^6
# K = int(input())
# max_K = pow(10,6)
#
# import math
#
# #最大公約数
# for i in range(0,)
# math.gcd(101, 7777)
#
#
# row = ''
# for i in range(0,max_K):
#     row = row + '7'
#     n_row = int(row)
#     print(n_row)
#
#     if n_row % K == 0:
#         print(i + 1)
#         break
#     elif i == max_K:
#         print("-1")

k = int(input())
if k==1 or k==7:
  print(1)
elif k%2==0:
  print(-1)
else:
  cnt = 1
  pre = 7
  while(True):
    surp = (pre*10+7)%k
    cnt += 1
    if surp==0:
      break
    if cnt>1000000:
      cnt = -1
      break
    pre = surp
  print(cnt)

Measured memory_bytes: 9116
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair

using ll = long long;
using namespace std;
ll x, y, z, l, m, n, r, q, k;

void solve() {
    cin>>x>>y>>z;
    if(y*z>=x) cout<<"Yes"<<'\n';
    else cout<<"No"<<'\n';

}

int main() 
{
    std::ios::sync_with_stdio(false); \
        std::cin.tie(NULL);
    int test;
    test = 1;
    while (test--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<char>());
    if(s < t) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
k,n = map(int,raw_input().split())
a = map(int,raw_input().split())
b = []
for i in range(1,len(a)):
	b.append(a[i] - a[i-1])
b.append(min(a[-1] - a[0], k - a[-1] + a[0]))
print(k - max(b))

Measured memory_bytes: 20440
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  int cnt=0,count=0;
  cin >> s;
  for(int i=2;i<s.size()-1;i++)if(s[i]=='C')cnt++;
  for(int i=0;i<s.size();i++)if(isupper(s[i]))count++;
  if(cnt==1 && s[0]=='A' && count==2)cout << "AC" << endl;
  else cout << "WA" << endl;
}
  

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

#define rep(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumlate(all(a),0)
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

main(){
  int n,h; cin >> n >> h;
  vi a(n),b(n);
  int maxai=0,maxbi,i;
  rep(j,n){
    cin >> a[j] >> b[j];
    if(a[j] > maxai){
      maxai = a[j];
      i = j;
      maxbi = b[j];
    }
  }
  sort(all(b));
  int count = 0;
  int j = n-1;
  while(1){
    //cout << h << endl;
    if(h <= 0){
      cout << count << endl;
      break;
    }
    if(b[j] > maxai){//投げる
      h -= b[j];
      j--;
      count++;
    }else{//投げるより切る
      h -= maxai;
      count++;
    }
  }
}


Measured memory_bytes: 1024
import sys
from collections import deque
input = sys.stdin.readline
n = int(input())
ab = [list(map(int, input().split(' '))) for i in range(n-1)]
graph = [[] for i in range(n+1)]
parent = [0 for i in range(n+1)]
root = 1
order = []
que = deque([root])
for a,b in ab:
    graph[a].append(b)
    graph[b].append(a)
while que:
    x = que.pop()
    order.append(x)
    for y in graph[x]:
        if parent[x] == y:
            continue
        parent[y] = x
        que.append(y)
print(max([len(i) for i in graph]))
color = [0 for i in range(n+1)]
cnt = [0 for i in range(n+1)]
ng = [0 for i in range(n+1)]
for x in order:
    if x == 1:
        continue
    px = parent[x]
    color[x] = cnt[px]+1
    if color[x] == ng[px]:
        color[x] += 1
    cnt[px] = color[x]
    ng[x] = color[x]
for a,b in ab:
    if parent[a] == b:
        p = b
        c = a
    else:
        p = a
        c = b
    print(color[c])

Measured memory_bytes: 40080
/* src: (6 lines)

A, B, H, M = inputInt(), inputInt(), inputInt(), inputInt()
M /= 60.0
H = (H + M) / 12.0
dx = cos(M * 2 * M_PI) * B - cos(H * 2 * M_PI) * A
dy = sin(M * 2 * M_PI) * B - sin(H * 2 * M_PI) * A
printf("%.20f\n", sqrt(dx*dx+dy*dy))

*/

//#define NDEBUG

#include <cassert>
#include <vector>
#include <deque>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

const char*inputCLineOrWord(int mode){static char buf[2097152];static int bufLen=sizeof(buf);static int bufPos=sizeof(buf);static bool canReadFlag=true;static bool crFlag=false;static bool enterFlag=false;if(canReadFlag&&(enterFlag?bufLen<=bufPos:(int)sizeof(buf)<=bufPos+bufPos)){if(0<bufLen-bufPos){memmove(buf,buf+bufPos,bufLen-bufPos);bufLen-=bufPos;}else{bufLen=0;}char*result=fgets(buf+bufLen,sizeof(buf)-bufLen,stdin);canReadFlag=(result!=NULL);if(result!=NULL){int n=strlen(result);enterFlag=(n!=(int)sizeof(buf)-1-bufLen||(1<=bufLen+n&&buf[bufLen+n-1]=='\n'));bufLen+=n;}bufPos=0;}if(mode==0){int pos=bufPos;while(true){char c=buf[pos];if(c==32){buf[pos++]='\0';break;}else if(c==10){if(crFlag){crFlag=false;if(bufPos==pos){pos=++bufPos;continue;}}buf[pos++]='\0';break;}else if(c==13){crFlag=true;buf[pos++]='\0';break;}else if(c==0){break;}++pos;}const char*ret=buf+bufPos;bufPos=pos;while(true){char c=buf[bufPos];if(c==32||c==10||c==13){++bufPos;}else{break;}}return ret;}else if(mode==1){int pos=bufPos;while(true){char c=buf[pos];if(c==10){if(crFlag){crFlag=false;if(bufPos==pos){pos=++bufPos;continue;}}buf[pos++]='\0';break;}else if(c==13){crFlag=true;buf[pos++]='\0';break;}else if(c==0){break;}++pos;}const char*ret=buf+bufPos;bufPos=pos;if(crFlag){while(true){char c=buf[bufPos];if(c==13){++bufPos;crFlag=false;break;}else{break;}}}return ret;}else if(mode==2){return bufLen<=bufPos?NULL:buf+bufPos;}assert(false);return NULL;}const char*inputCWord(){return inputCLineOrWord(0);}int inputInt(){return atoi(inputCWord());}
// generated code (by mmlang) :

int A;
int B;
double H;
double M;
double dx;
double dy;

int main() {
    {
        const auto & $c1 = inputInt();
        const auto & $c2 = inputInt();
        const auto & $c3 = inputInt();
        const auto & $c4 = inputInt();
        tie(A, B, H, M) = tuple<int, int, int, int>($c1, $c2, $c3, $c4);
    }
    M /= 60.0;
    H = (H + M) / 12.0;
    dx = cos(M * 2 * M_PI) * B - cos(H * 2 * M_PI) * A;
    dy = sin(M * 2 * M_PI) * B - sin(H * 2 * M_PI) * A;
    printf("%.20f\n", sqrt(dx * dx + dy * dy));
    return 0;
}


Measured memory_bytes: 2432
W, H, x, y = map(int, input().split())
result1 = float( W * H / 2 )

result2 = 0
if ( W % 2 == 0 and H % 2 == 0) and ( int(W / 2) == x and int(H / 2) == y):
    result2 = 1

print(result1, result2)


Measured memory_bytes: 2940
import java.io.*;
import java.util.*;
import java.math.*;
 
class Main {
    public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static PrintWriter pw = new PrintWriter(System.out);
    public static String line;
    public static StringTokenizer st;
    public static ArrayList<ArrayList<Integer>> adjList;
    public static int[] dx = {-1, 0, 1, 0, -1, 1, 1, -1, 0};
    public static int[] dy = {0, 1, 0, -1, 1, 1, -1, -1, 0};
    public static int INF = 0x3f3f3f3f;
    public static int MOD = 1000000007;
    public static long LINF = 0x3f3f3f3f3f3f3f3fL;

    public static void main(String[] args) throws Exception {
        int N = Integer.parseInt(br.readLine());
        int[] cnt = new int[N];
        st = new StringTokenizer(br.readLine());
        for (int i = 0; i < N; i++) {
            int n = Integer.parseInt(st.nextToken());
            if (i == 0 && n != 0) {
                pw.println(0);
                pw.close(); 
                return;
            } 
            cnt[n]++;
        }

        if (cnt[0] != 1) {
            pw.println(0);
            pw.close();
        }
        // System.out.println(Arrays.toString(cnt));
        long ans = 1;
        for (int i = 1; i < N; i++) {
            for (int j = 0; j < cnt[i]; j++) {
                ans = (ans * cnt[i-1]) % 998244353;
            }
        }
        pw.println(ans);
        pw.close(); 
        br.close();
    }
}

class Pair implements Comparable<Pair>{
    public int x;
    public int y;

    Pair(int _x, int _y){
        x = _x;
        y = _y;
    }
 
    public String toString(){
        return x + " " + y;
    }

    public int compareTo(Pair p){
        if (x != p.x) return x < p.x ? -1 : 1;
        if (y != p.y) return y < p.y ? -1 : 1;
        return 0;
    }
}

Measured memory_bytes: 35596
#include<bits/stdc++.h> 
#define p 1000000007
#define ll long long
using namespace std; 

ll power(ll x, ll y) 
{ 
	ll res = 1; 

	x = x % p; 
  while (y > 0) 
	{ 
		if (y & 1) 
			res = (res*x) % p; 
		y = y>>1; 
		x = (x*x) % p; 
	} 
	return res; 
} 
ll modInverse(ll n) 
{ 
	return power(n, p-2); 
} 
 
ll nCrModPFermat(ll n, ll r) 
{ 
  r = min(r,n-r);
if (r==0) 
	return 1; 
	ll num = 1;
  	ll den = 1;
	for (ll i=0 ; i<r; i++){ 
		num = ((num%p)*((n-i)%p))%p;
      	den = ((den%p)*((i+1)%p))%p;
    }
  return (num* modInverse(den)%p) % p;
}  
int main() 
{
	ll n, a,b;
  	cin>>n>>a>>b;
  	ll ans = power(2,n) - 1;
  	ans = (ans - nCrModPFermat(n,a) - nCrModPFermat(n,b));
  ans = ans%p;
  	if(ans<0)ans+=p;
  	cout<<ans<<endl;
	return 0; 
} 


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

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


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

vector<int> calc(int n) {
    vector<int> a;
    while (n > 0) {
        a.push_back(n % 8);
        n /= 8;
    }
    return a;
}

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) return 0;

        vector<int> a = calc(n);
        for (int i = a.size() - 1; i >= 0; i--) {
            if (0 <= a[i] && a[i] <= 3) {
                cout << a[i];
            } else if (a[i] == 4) {
                cout << 5;
            } else {
                cout << a[i] + 2;
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 3124
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int loopNum = scanner.nextInt();
		for (int i = 0; i < loopNum; i++) {
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			int c = scanner.nextInt();

			if (isTriangle(a, b, c)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}

	private static boolean isTriangle(int a, int b, int c) {
		if (a >= b && a >= c) {
			return a * a == b * b + c * c;
		} else {
			if (b >= c) {
				return b * b == a * a + c * c;
			} else {
				return c * c == a * a + b * b;
			}
		}
	}
}

Measured memory_bytes: 21608
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 100000

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

const double PI = 3.141592653589793;
const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

int main(){
    int N;
    cin >> N;
    int count = 0;
    for(int i = 0;  i < N; i++){
        int l,r;
        cin >> l >> r;
        count += r - l + 1;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, P, *A = map(int, read().split())

A = [x & 1 for x in A]

if A.count(1):
    x = pow(2, N - 1)
else:
    x = pow(2, N)
    if P:
        x = 0
print(x)

Measured memory_bytes: 8996
import java.util.Scanner;


public class Main {

	static long dp[][];
	static Scanner sc;
	static int num;
	static int[] array;	
	
	public static void main(String[] args) {
	
		new Main();
	
	}
	
	Main(){
		sc = new Scanner(System.in);
		num = sc.nextInt();
		array = new int[num];
		
		for(int i=0; i<num; i++){
			array[i] = sc.nextInt();
		}
		
		dp = new long[num][21];
		
		dp[0][array[0]] =1;
		
		for(int i=1; i<num-1; i++){
			for(int j=0; j<21; j++){
				if(j+array[i]<21)
					dp[i][j+array[i]] = dp[i][j+array[i]]+dp[i-1][j];
				if(j-array[i]>=0){
					dp[i][j-array[i]] = dp[i][j-array[i]]+dp[i-1][j];
				}
			}
		}
		System.out.println(dp[num-2][array[num-1]]);
	}
}

Measured memory_bytes: 18116
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <tuple>
#include <random>
#include <map>
using namespace std;

const double pi = acos(-1);
#define nyan cout << "(=^•ω•^=)" << endl;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop while(true)
#define YN(f) f?cout<<"YES"<<endl:cout<<"NO"<<endl;
#define yn(f) f?cout<<"Yes"<<endl:cout<<"No"<<endl;

int n;
bool ans;

signed main(){
	cin>>n;
	rep(i,n){
		int a;cin>>a;
		if(a%2!=0)ans=true;
	}
	if(ans)cout<<"first"<<endl;
	else cout<<"second"<<endl;
	return 0;
}


Measured memory_bytes: 256