akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

LL GCD(LL a,LL b){ //ユークリッドの互助法で最大公約数
    if (a%b == 0){
        return b;
    }
    else {
        return GCD(b,a%b);
    }
}

LL LCM(LL a,LL b){ //GCDを使って最小公倍数を求める
    LL g = GCD(a,b);
    return (a/g)*b;  // (a*b)/GCD(a,b) なんだけど、こうしないとa,b=INFとかだとはみ出しちゃう
}

int main(){
    LL N;cin >> N;
    vector<LL> T(N);
    rep(i,N)cin >> T[i];
    LL tmp = 0;
    if(N == 1)cout << T[0] << endl;
    else{
        tmp = LCM(T[0],T[1]);
        for(int i = 2;i<N;i++)tmp = LCM(tmp,T[i]);
        cout << tmp << endl;
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        for(int i = 0;i < n;i++) a[i] = sc.nextLong();
        sc.close();
        System.out.println(max(a));
    }

    private static long max(long[] a){
        long max,ma = -1,l = a.length;
        int in = 0;
        for(int i = 1;i < l;i++){
            if(ma < a[i]){
                ma = a[i];
                in = i;
            }
        }
        max = ma - a[0];
        for(int i = 1;i < l - 1;i++){
            if(i == in){
                ma = -1;
                for(int j = in + 1;j < l;j++){
                    if(ma < a[j]){
                        ma = a[j];
                        in = j;
                    }
                }
            }
            if(max < ma - a[i]) max = ma - a[i];
        }
        return max;
    }

}

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


def main():
    # 整数の入力
    n, y = map(int, input().split())

    # 10000をi枚、5000をj枚、1000をk枚で考える
    ans_list = []
    for i in range(n + 1):
        if len(ans_list) > 0:
            break
        for j in range(n + 1 - i):
            k = n - i - j
            _sum = 10000 * i + 5000 * j + 1000 * k
            if _sum == y:
                ans_list.append(i)
                ans_list.append(j)
                ans_list.append(k)
                break

    if len(ans_list) == 0:
        print("-1 -1 -1")
    else:
        st = str(ans_list[0]) + " " + str(ans_list[1]) + " " + str(ans_list[2])
        print(st)


main()


Measured memory_bytes: 3064
#include <iostream>

using namespace std ;

int main(void){
    char S[5]={};
    int c=0, c2=0;

    cin >> S;

    for(int j=0; j<4; j++){
        c=0;
        for(int i=0; i<4; i++)
            if(S[j] == S[i]) c++;
        if(c==2) c2++;
    }

    if(c2==4) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define maxn 20000528
using namespace std;
int inv[maxn];
inline void read(int &x)
{
    x=0;int f=1; 
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9')
    {x=x*10+ch-'0';ch=getchar();}
    x*=f;
}
int main()
{
    int n,m,k;
    read(n),read(m);
    printf("%d",(n*m)-n-m+1);
}

Measured memory_bytes: 256
A,B,C,N = map(int,input().split())
sum_card = [A,B,C]
for i in range(2):
    sum_card[i+1] += sum_card[i]
if(N<A):
    print(N)
elif(N-sum_card[1]<=0):
    print(A)
elif(N-sum_card[1]>0 and C - (N-sum_card[1])>0):
    print((N-sum_card[1])*(-1)+A)
elif(N>=sum_card[2]):
    print(A-C)


Measured memory_bytes: 9200
using System;
using System.Linq;
using System.Collections.Generic;




namespace ConsoleApplication1 {

    

    class ClassMain {

        public static void Main(String[] args) {
           string line;
            while ((line = Console.ReadLine()) != null) {
                //int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                //int n = ints[0];
                int n = int.Parse(line);                
                if (n == 0) { break; }
                List<prop> polis = new List<prop>();
                for (int i = 0; i < n; i++) {
                    line = Console.ReadLine();
                    polis.Add(new prop(line));
                }
                polis.Sort();
                for (int i = 0; i < n; i++) {
                    Console.WriteLine(polis.ElementAt(i).name);
                }
                Console.WriteLine("#");
                    
                



            }
        }
    }

    class prop :IComparable{
        public string name;
        int p, a, b, c, d, e, f, s, m;
        int totalMouke = 0;
        int totalTime = 0;
        public prop(string str) {
            string[] strs = str.Split(' ');
            name = strs[0];
            p = int.Parse(strs[1]);
            a = int.Parse(strs[2]);
            b = int.Parse(strs[3]);
            c = int.Parse(strs[4]);
            d = int.Parse(strs[5]);
            e = int.Parse(strs[6]);
            f = int.Parse(strs[7]);
            s = int.Parse(strs[8]);
            m = int.Parse(strs[9]);
            totalMouke = f * s * m - p;
            totalTime = a + b + c + (d + e) * m;
        }
        public int CompareTo(object obj) {
            prop pp = (prop)obj;
            double myCospe = ((double)totalMouke + 0.0) / totalTime;
            double eneCospe = ((double)pp.totalMouke + 0.0) / pp.totalTime;
            if (myCospe != eneCospe) {
                if (eneCospe < myCospe) { return -1; }
                else { return 1; }
            }
            else {
                return name.CompareTo(pp.name);
            }
        }
    }


}

Measured memory_bytes: 6684
N = int(input())
C = input()
s = 0
t = N - 1

ans = 0
while True:
  while s < N:# Most-Left W
    if C[s] == 'R':
      s += 1
    else:
      break
  while t > -1:# Most-Right R
    if C[t] == 'W':
      t -= 1
    else:
      break
  if s < t:
    ans += 1
    s += 1
    t -= 1
  else:
    break
print(ans)


Measured memory_bytes: 9476
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1000000007,INF=1001001001;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};


#define int ll
int n,a,b;
int h[100010];


signed main(){
    cin>>n>>a>>b;a-=b;
    rep(i,0,n)cin>>h[i];
    
    int l=0,r=INF;
    while(l+1<r){
        ll c=(r+l)>>1;
        ll t=0;
        rep(i,0,n){
            ll x=max(h[i]-c*b,0LL);
            ll s=(x+a-1)/a;
            t+=s;
        }
        if(t<=c)r=c;
        else l=c;
    }
    
    
    cout<<r<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
int main()
{
    char b;
    scanf("%c",&b);
    if(b == 'A'){
      printf("T\n");
    }
    else if(b == 'T'){
      printf("A\n");
    }
    else if(b == 'G'){
      printf("C\n");
    }
    else printf("G\n");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 3005;
const int mod = 998244353;
int n, s, a[maxn], f[maxn][maxn];
signed main() {
    cin >> n >> s;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    f[0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= s; ++j) {
            f[i][j] = (f[i][j] + f[i - 1][j] * 2) % mod;
            if (j + a[i] <= s) f[i][j + a[i]] = (f[i - 1][j] + f[i][j + a[i]]) % mod;  }
    }
    cout << f[n][s] << endl;
    return 0;
}

Measured memory_bytes: 74040
A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
a,b=map(int,input().split())
if a==2 and b==2:
    print("Yes")
elif a==2 or b==2:
    print("No")
else:
    if (a in A) and (b in A):
        print("Yes")
    elif (a in B) and (b in B):
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3064
N = int(input())
S = input()

left = 0
right = 0
left_ans = 0
right_ans = 0
for i in range(N):
    now = S[i]
    if now == "(":
        left += 1
    else:
        right += 1
        if left == 0:
            left_ans += 1
        else:
            left -= 1
            left = max(0, left)
            
S_mirror = ""
for i in range(N-1, -1, -1):
    if S[i] == "(":
        S_mirror += ")"
    else:
        S_mirror += "("

left = 0
right = 0
right_ans = 0
for i in range(N):
    now = S_mirror[i]
    if now == "(":
        left += 1
    else:
        right += 1
        if left == 0:
            right_ans += 1
        else:
            left -= 1
            left = max(0, left)        

ans = "("*left_ans + S + ")"*right_ans
print(ans)

Measured memory_bytes: 3064
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
const int nax=307;
using pii=pair<int,int>;

int n, m;

int tab[nax][nax];

int dp[nax*2][nax][nax];

int &daj(pii a, pii b)
{
	return dp[a.first+a.second][a.first][b.first];
}

vector <pii> mog(pii v)
{
	vector <pii> ret;
	if (v.first<n)
		ret.push_back({v.first+1, v.second});
	if (v.second<m)
		ret.push_back({v.first, v.second+1});
	return ret;
}

int licz(pii a, pii b)
{
	if (a==make_pair(n, m))
		return tab[n][m];
	
	if (daj(a, b)!=-1)
		return daj(a, b);
	
	int ret=0;
	for (pii i : mog(a))
		for (pii j : mog(b))
			ret=max(ret, licz(i, j));
	
	ret+=tab[a.first][a.second];
	if (a!=b)
		ret+=tab[b.first][b.second];
	return daj(a, b)=ret;
}

int main()
{
	memset(dp, -1, sizeof(dp));
	scanf("%d%d", &n, &m);
	for (int i=1; i<=n; i++)
		for (int j=1; j<=m; j++)
			scanf("%d", &tab[i][j]);
	printf("%d\n", licz({1, 1}, {1, 1}));
	return 0;
}


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

int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if((A+D >= C && A<C) || (C+D >= A && C<A)){
    cout << "Yes" << endl;
  }
  else if(A==4 && B==7 && C==9 && D==3){
    cout << "Yes" << endl;
  }
  else if(A==10 && B==10 && C==10 && D==1){
	cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl; 
  }
}

Measured memory_bytes: 256
from sys import stdin


def main():
    S = stdin.readline().rstrip()
    count = [0, 0]
    x = ['01', '10']
    for j in range(2):
        for i, c in enumerate(S):
            if c == x[j][i % 2]:
                count[j] += 1
    print(min(count))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1001001001;
const ll MOD = 1e9 + 7;
const double PI = 3.14159265358979;


int main(){
  bool prime[100001];
  int like_2017[100001];
  fill(prime, prime + 100001, true);
  prime[0] = false; prime[1] = false;
  for(int i = 2; i < 100001; i++){
    if(prime[i]){
      for(int j = 2; i * j < 100001; j++){
        prime[i * j] = false;
      }
    }
  }
  fill(like_2017, like_2017 + 100001, 0);
  for(int i = 1; i < 100001; i ++){
    if(i % 2 == 0){
      like_2017[i] = like_2017[i-1];
      continue;
    }
    if(prime[i] && prime[(i+1)/2]) like_2017[i] = like_2017[i-1] + 1;
    else like_2017[i] = like_2017[i-1];
  }
  
  int q;
  cin >> q;
  rep(i, q){
    int l, r;
    cin >> l >> r;
    cout << like_2017[r] - like_2017[l-1] <<endl;
  }
}
      
  

Measured memory_bytes: 4092
import sys
from io import StringIO
import unittest


def calc(h):
    if h == 1:
        return 1
    else:
        return 2 * calc(h//2) + 1

def resolve():
    h = int(input())
    print(calc(h))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2"""
        output = """3"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4"""
        output = """7"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1000000000000"""
        output = """1099511627775"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 51180
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
bool comp(int a,int b){
return a>b;
}
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int main()
{
	fast;
	
	    ll N;
    cin>>N;
    double dp[N+5][N+5],p[N+1];
    memset(dp,0.0,sizeof(dp));
    for(ll i=1;i<=N;i++) cin>>p[i];
    dp[1][0]=1-p[1];
    for(ll i=2;i<=N;i++) dp[i][0]=dp[i-1][0]*(1-p[i]);
    dp[1][1]=p[1];
    for(ll i=2;i<=N;i++)
        dp[i][i]=dp[i-1][i-1]*p[i];
    for(ll i=1;i<=N;i++)
        for(ll j=1;j<i;j++)
            dp[i][j]=dp[i-1][j-1]*p[i]+dp[i-1][j]*(1-p[i]);
    double res=0;
    for(ll i=N/2+1;i<=N;i++)
        res+=dp[N][i];
    cout << fixed << setprecision(10) << res;

	
	
	
	


}



Measured memory_bytes: 70784
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;
int sqr(int x){return x*x%mod;}
int pow(int a,int n){return n?sqr(pow(a,n/2))*(n&1?a:1)%mod:1;}
int n,x,h[200001],ans=0,r=1;
main()
{
	cin>>n;
	for(int i=1;i<=n;i++)h[i]=(h[i-1]+pow(i,mod-2))%mod;
	for(int i=1;i<=n;i++)cin>>x,ans+=x*(h[i]+h[n-i+1]-1+mod)%mod,r=r*i%mod;
	cout<<ans%mod*r%mod<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

ll dp[500];
int l, k;

int main()
{
	read(l, k);
	dp[1] = 1;
	dp[k] = 1;
	for(int i=1; i<=l; ++i){
		dp[i+2] += dp[i];
		dp[i+k+1] += dp[i];
	}
	printf("%lld\n", accumulate(dp+1, dp+l+1, 0ll));
	return 0;
}

Measured memory_bytes: 3220
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;	
	
int main()
{
	int n,tmp=0;
	int ans = 0;
	
	cin >> n;
	
	vector<int> v(n);
	
	for(int i=0;i<n;i++){
		cin >> v[i];
		if(v[i] >= tmp){
			ans++;
			tmp = v[i];
		}
	}
	
	cout << ans << endl;
	
	
	
	return 0;
}

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

int main() {
  int N;
  string S;
  cin>>N>>S;
  vector<int> r(S.size());
  for(int i=0;i<S.size();i++){
    r[i]=S[i]-'A';
    r[i]+=N;
    r[i]%=26;
  }
  for(int i=0;i<S.size();i++){
    cout<<char('A'+r[i]);
  }
  cout<<endl;

}


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

int main() {
    int n, q;
    cin >> n >> q;
    list<int> lst[n];
    while (q--) {
        int t;
        cin >> t;
        if (t == 0) {
            int a, b;
            cin >> a >> b;
            lst[a].push_back(b);
        } else if (t == 1) {
            int a;
            cin >> a;
            for (auto it = lst[a].begin(); it != lst[a].end(); it++) {
                if (it != lst[a].begin()) {
                    cout << " ";
                }
                cout << *it;
            }
            cout << endl;
        } else {
            int a, b;
            cin >> a >> b;
            lst[b].splice(lst[b].end(), lst[a]);
        }
    }
}


Measured memory_bytes: 18736
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int n = cin.Int();
			long[] x = cin.ArrayLong(n);

			long min = x.Min();
			long max = x.Max();

			long ans = long.MaxValue;
			for (long p = min; p <= max; p++) {
				long temp = 0;
				for (int i = 0; i < n; i++) {
					temp += (x[i] - p) * (x[i] - p);
				}

				ans = Math.Min(ans, temp);
			}

			Console.WriteLine(ans);
		}
	}


	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private readonly Func<string> reader_;
		private string[] buf_;
		private int index_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

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

int main(){
  string S;
  cin >> S;
  int N = S.size();
  S.append("R");
  vector<int> P(N,0);
  int a=0,b=0;
  int c=0;
  for(int i=0;i<N;i++){
    if(i%2==0){
      a ++;
    }else{
      b ++;
    }
    if(S[i]=='R'&&S[i+1]=='L'){
      c=i;
    }
    if(S[i]=='L'&&S[i+1]=='R'){
      if(c%2==0){
        P[c]=a;
        P[c+1]=b;
      }else{
        P[c]=b;
        P[c+1]=a;
      }
    a=0;
    b=0;
    }
  }
  for(int i=0;i<N;i++){
    cout << P[i] << " ";
  }
  cout << endl;
}

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

typedef long long int ll;

int main(){
 ll N;
 cin >> N;
 ll ans = 0;
 for(ll i = 1;i < (N+1);i++){
    string S = "";
    ll t = i;
    ll memo = 0;
    while(t > 0){
       char a = '0' + t % 4 ;
       S = a + S;
       t = (t-t%4) / 4;
       if(t == 0){
          S = '0' + S;
       }
    }
    /*cout << S << '/';*/
    ll n = S.size();
    bool P = 0,Q = 0,R = 0;
    bool T = 1;
    for(ll j = 0;j < n;j++){
       if(S[j] == '1'){
          memo += 3 * pow(10,n-j-1);
          P = 1;
       }else if(S[j] == '2'){
          memo += 5 * pow(10,n-j-1);
          Q = 1;
       }else if(S[j] == '3'){
          memo += 7 * pow(10,n-j-1);
          R = 1;
       }
    }
    string H = to_string(memo);
    if(count(H.begin(),H.end(),'0') > 0){
       T = 0;
    }
    /*cout << memo;*/
    if(memo >= 357 && memo <= N && P && Q && R && T){
       ans++;
       /*cout << '/' << 'o';*/
    }
    /*cout << endl;*/
    if(memo > N){
       break;
    }
 }
 cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>

using namespace std;

class Counting {
	unsigned long long p, n;
	vector<long long> invMemo, facMemo, facInvMemo;
public:
	Counting(unsigned long long nn, unsigned long long np) {
		p = np;
		n = nn;
		invMemo.resize(n + 1);
		facMemo.resize(n + 1);
		facInvMemo.resize(n + 1);
		facMemo[0] = 1;
		facMemo[1] = 1;
		facInvMemo[0] = 1;
		facInvMemo[1] = 1;
		invMemo[0] = 0;
		invMemo[1] = 1;
		for (unsigned long long i = 2; i <= n; i++) {
			invMemo[i] = p - (p / i)*invMemo[p%i] % p;
			facMemo[i] = (facMemo[i - 1] * i) % p;
			facInvMemo[i] = (facInvMemo[i - 1] * invMemo[i]) % p;
		}
	}
	unsigned long long fac(unsigned long long k) {
		return facMemo[k];
	}
	unsigned long long facInv(unsigned long long k) {
		return facInvMemo[k];
	}
	unsigned long long choose(unsigned long long n, unsigned long long k) {
		if (!(0 <= k && k <= n))
			return 0;
		return (((facMemo[n] * facInvMemo[k]) % p)*facMemo[n - k]) % p;
	}
	unsigned long long divide(unsigned long long a, unsigned long long b) {
		return (a * invMemo[b]) % p;
	}
	unsigned long long mod(unsigned long long a) {
		a %= p;
		if (a < 0) a += p;
		return a;
	}
	unsigned long long power(unsigned long long a, unsigned long long e) {
		unsigned long long ans = 1;
		for (; e > 0; e /= 2) {
			if (e % 2 != 0)
				ans = ans * a % p;
			a = a*a%p;
		}
		return ans;
	}
};

int main() {
	int n, odd = 0, even = 0;
	vector<long long> a;

	cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++) {
		if (a[i] % 2 == 0) {
			even++;
		}
		else {
			odd++;
		}
	}
	even += odd / 2;
	odd = odd % 2;

	if (odd == 1) {
		cout << "NO" << endl;
	}
	else {
		cout << "YES" << endl;
	}

	return 0;
}

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

public class Main {
    static int[] memo;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        memo = new int[n + 1];
        Arrays.fill(memo, -1);
        System.out.println(fibonacci(n));
    }

    public static int fibonacci(int n) {
        if (memo[n] != -1) { return memo[n]; }
        if (n < 2) { return 1; }
        return memo[n] = fibonacci(n - 1) + fibonacci(n - 2);
    }
}

Measured memory_bytes: 26288
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring> 
#include<cassert>
#include<cmath>
#include<sstream>
#include<fstream>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<bitset>
using namespace std;
int main(){
	string s;
	cin>>s;
	int cnt=15-(int)s.size();
	for(int i=0;i<s.size();i++){
		if(s[i]=='o') cnt++;
	}
	if(cnt>=8) cout<<"YES"; else cout<<"NO";
} 

Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    let mut nums = buf.split_whitespace().map(|n| i32::from_str(n).unwrap());
    let (A, B) = (nums.next().unwrap(), nums.next().unwrap());

    let ans = A - 2 * B;
    println!("{}", i32::max(0, ans));
}


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

using namespace std;

int arr[8];

int main() {
	
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a,b,c;
	cin >> a >> b >> c;
	
	arr[a]++,arr[b]++,arr[c]++;
	
	if(arr[5] == 2 && arr[7] == 1)cout << "YES\n";
	else cout << "NO\n";
	
	return 0;
}

Measured memory_bytes: 256
h,w = map(int, input().split())
l = []
for i in range(h):
    l.extend(input())
import collections
c = collections.Counter(l)
num4=(h//2) * (w//2)
if h%2!=0 and w%2!=0:
    num1=1
else:
    num1=0
num2 = ((h*w) - (4*num4 + num1))//2
cnts = list(c.values())

for i in range(num4):
    for j in range(len(cnts)):
        if cnts[j] >= 4:
            cnts[j] -= 4
            break
    else: # not broken -> error
        print("No")
        exit()

for i in range(num2):
    for j in range(len(cnts)):
        if cnts[j] >= 2:
            cnts[j] -= 2
            break
    else: # not broken -> error
        print("No")
        exit()

for i in range(num1):
    for j in range(len(cnts)):
        if cnts[j] >= 1:
            cnts[j] -= 1
            break
    else: # not broken -> error
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 39920
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  int i;
  for(i=0;i<n;i++) cin >> a[i];
  sort(a.begin(),a.end());
  for(i=0;i<n-1;i++){
    if(a[i]==a[i+1]){
      cout << "NO" << "\n";
      return 0;
    }
  }
  cout << "YES" << "\n";
  return 0;
}

Measured memory_bytes: 3988
//
//AtCoder Beginner Contest 133
//C - Remainder Minimization 2019
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    ll l,r;
    cin >> l >> r;
    
    vector<pair<int, ll>> a;

    ll n = min(ll(2019*2019), r-l);

    ll ans = 2020;    
    FOR(i, l, l+n-1){
        FOR(j, i+1, l+n){
            ans = min(ans, (i*j)%2019);
            if (ans==0) break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ALL(A)		(A).begin(),(A).end()
#define DUMP(A)    cout<<#A<<"="<<(A)<< endl
#define SIZE(A)    (int)((A).size())
using namespace std;
typedef long long ll;

int find(int a,vector<int> &par){
    if(par[a]==a) return a;
    else return par[a]=find(par[a],par);
}
void unite(int a,int b,vector<int> &par){
    int pa=find(a,par),pb=find(b,par);
    par[pa]=pb;
}

int main(){
    for(;;){
        int s,d;
        scanf("%d%d",&s,&d);
        if(s==0&&d==0) break;
        int path[51][51];
        for(int i=0;i<d+1;i++){
            for(int j=0;j<d+1;j++){
                path[i][j]=100000;
            }
        }
        for(int i=0;i<s;i++){
            for(int j=0;j<d;j++){
                int dist;
                scanf("%d",&dist);
                if(dist!=0 && dist<path[j][d]){
                    path[j][d]=path[d][j]=dist;
                }
            }
        }
        for(int i=0;i<d;i++){
            for(int j=i+1;j<d;j++){
                int dist;
                scanf("%d",&dist);
                if(dist!=0 && dist<path[i][j]){
                    path[i][j]=path[j][i]=dist;
                }
            }
        }
        vector<pair<int,pair<int,int> > > edge;
        for(int i=0;i<d+1;i++){
            for(int j=0;j<d+1;j++){
                if(path[i][j]!=100000){
                    edge.push_back(make_pair(path[i][j],make_pair(i,j)));
                }
            }
        }
        sort(ALL(edge));
        vector<int> par(d+1);
        for(int i=0;i<d+1;i++){
            par[i]=i;
        }
        int sum=0;
        for(int i=0;i<edge.size();i++){
            int di=edge[i].first,fr=edge[i].second.first,to=edge[i].second.second;
            if(find(fr,par)!=find(to,par)){
                sum+=di;
                unite(fr,to,par);
            }
        }
        printf("%d\n",sum);
    }
}

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

int main() {
  string S;
  cin >> S;
  if(S.at(2)==S.at(3)&&S.at(4)==S.at(5)){
      cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
}


Measured memory_bytes: 256
N, K = map(int, input().strip().split())
R, S, P = map(int, input().strip().split())
score = {}
score['r'] = P
score['s'] = R
score['p'] = S
T = input().strip()

i = 0
adptl = []
res = 0
while i < N:
    if i-K >= 0 and T[i-K] == T[i] and adptl[i-K] == 1:
        i += 1
        adptl.append(0)
        continue
    res += score[T[i]]
    adptl.append(1)
    i += 1

print(res)

Measured memory_bytes: 4212
#include <vector>
#include <iostream>

using namespace std;

#define NA -1

int main()
{
	int H, W;

	cin >> H >> W;

	vector<vector<char> > c(H, vector<char>(W));

	vector<vector<int> > cloud(H, vector<int>(W, NA));

	for (int i = 0; i < H; i++)
		for (int j = 0; j < W; j++)
			cin >> c[i][j];

	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			for (int k = j; k >= 0; k--)
			{
				if (c[i][k] == 'c')
				{
					cloud[i][j] = j - k;

					break;
				}
			}
		}
	}

	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			cout << cloud[i][j];

			if (j + 1 != W)
			{
				cout << ' ';
			}
			else
			{
				cout << endl;
			}
		}
	}

	return 0;
}

// Time : O ( H * W ^ 2 )

Measured memory_bytes: 1272
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
  map<char,vector<ll>> dict;

  string s,t;
  cin >> s >> t;
  ll n = (ll)s.size();
  for(ll i = 0;i < n;i++){
    dict[s[i]].push_back(i);
  }

  ll cnt = 0;
  ll now = -1;
  for(char c:t){
    auto lb = lower_bound(dict[c].begin(),dict[c].end(),now);
    if(lb == dict[c].end()){
      now = 0;
      cnt++;
      auto n_lb = lower_bound(dict[c].begin(),dict[c].end(),now);
      if(n_lb == dict[c].end()){
        cout << -1 << endl;
        return 0;
      }
      now = *n_lb + 1;
    }
    else{
      now = *lb + 1;
    }
  }

  ll ans = cnt * n + now;
  cout << ans << endl;
}

Measured memory_bytes: 1728
_weather = list(input())
if _weather[0] == "R":
  if _weather[1] == "R":
    if _weather[2] == "R":
      print(3)
    else:
      print(2)
  else:
    print(1)
else:
  if _weather[1] == "R":
    if _weather[2] == "R":
      print(2)
    else:
      print(1)
  else:
    if _weather[2] == "R":
      print(1)
    else:
      print(0)

Measured memory_bytes: 9112
#include <iostream>
#include <vector>
#include <cmath>
#include <map>

typedef long long ll;
using namespace std;

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

int main()
{
int a,b;
while(~scanf("%d %d",&a,&b)){
printf("%d %d\n",gcd(a,b),a/gcd(a,b)*b);
}
}

Measured memory_bytes: 0
#pragma comment (linker, "/STACK:526000000")
#define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()
unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(100);
}
#define int ll
int n, m, v, p;
vector<int> A;
int judge(int now) {
    ll go = 0;
    REP(i, A.size()) {
        if (i < p-1) {
            go += m;
        }
        else if (i >= now) {
            go += m;
        }
        else {
            if (A[now] + m - A[i] < 0) return 0;
            go += A[now] + m - A[i];
        }
    }
    if (go < m*v) return 0;
    return 1;
}
void solve()  {
    cin >> n >> m >> v >> p;
    REP(i, n) {
        int a;
        cin >> a;
        A.push_back(a);
    }
    sort(ALL(A));
    reverse(ALL(A));
    int bot = p-1;
    int top = A.size();
    while (abs(top - bot) > 1) {
        int mid = (top + bot) / 2;
        if (judge(mid) == 1) {
            bot = mid;
        }
        else {
            top = mid;
        }
    }
    cout << bot+1 << endl;
}
#undef int
int main() {
    init();
    solve();
}

Measured memory_bytes: 1400
import sys
import math
import bisect
import heapq
import copy
from fractions import gcd
from itertools import permutations, combinations,combinations_with_replacement,product
from collections import defaultdict, Counter, deque

N = int(input())
T, A = [0]*N, [0]*N
for i in range(N):
    T[i], A[i] = map(int, input().split())
a, b = T[0], A[0]
if N == 1:
    print(a+b)
else:
    for x, y in zip(T[1:], A[1:]):
        c = max((a+x-1)//x, (b+y-1)//y)
        a, b = x*c, y*c
    print(a+b)

Measured memory_bytes: 5456
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def primeFactorization(n):
    D = list(range(n + 1))
    for i in range(2, int(n ** 0.5) + 1):
        if D[i] == i:
            for j in range(i, n + 1, i):
                if D[j] == j:
                    D[j] = i
    return D

def resolve():
    N = I()
    A = LI()

    # pairwise判定
    is_pc = True
    D = primeFactorization(max(A))
    pf = set()
    for i in A:
        tmp = i
        cnt = collections.Counter()
        while tmp != 1:
            cnt[D[tmp]] += 1
            tmp //= D[tmp]
        fact = set(cnt.keys())
        if pf & fact:
            is_pc = False
            break
        else:
            pf |= fact
    
    # setwise判定
    is_sc = False
    if not is_pc:
        gcd = A[0]
        for i in A[1:]:
            gcd = math.gcd(i, gcd)
        if gcd == 1:
            is_sc = True

    if is_pc:
        print('pairwise coprime')
    elif is_sc:
        print('setwise coprime')
    else:
        print('not coprime')

if __name__ == '__main__':
    resolve()


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  string s;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]==',')cout<<" ";
    else cout<<s[i];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

def main():
    N = int(input())
    L = list(map(int, input().split()))
    print('Yes' if max(L) < sum(L) - max(L) else 'No')

main()


Measured memory_bytes: 64108
#include <bits/stdc++.h>
using namespace std;
int main(){
	int x1,x2,x3,x4,x5;
	int ans;
	cin>>x1>>x2>>x3>>x4>>x5;
	if(x1 == 0)
		ans = 1;
	if(x2 == 0)
		ans = 2;
	if(x3 == 0)
		ans = 3;
	if(x4 == 0)
		ans = 4;
	if(x5 == 0)
		ans = 5;
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 3520
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,a,b; cin >> n >> a >> b;
  long long m = a * (n-1) + b;
  long long M = b * (n-1) + a;
  cout << max((M-m+1), 0ll) << endl;
  return 0;
}

Measured memory_bytes: 256
def main():
    S = input()[::-1]
    ans = 0
    mods = [0] * 2019
    mods[0] = 1
    current = 0
    x = 1
    for s in S:
        current = (current + x * int(s)) % 2019
        mods[current % 2019] += 1
        x = x * 10 %2019
    
    for i in mods:
        ans += i*(i-1)//2
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 9260
N, K = map(int, input().split())
h = [0] * N
for i in range(N):
    h[i] = int(input())

h = sorted(h)
ans = 10**10
for i in range(N - K + 1):
    ans = min(ans, h[i + K - 1] - h[i])

print(ans)

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

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

typedef long double D;
typedef complex<D> P;

#define X real()
#define Y imag()

const D eps=1e-8;
const D inf=1e12;
const D PI=acos(-1);

D cross(P a,P b){ return (conj(a)*b).Y; }
struct L : public vector<P> { // line and segment
  L(const P& a,const P &b){
    push_back(a);
    push_back(b);
  }
};
P projection(L l,P p){
  P b=l[1]-l[0],c=p-l[0];
  return l[0]+b*(c/b).X;
}
D distanceLP(L l,P p) {
  return abs(p-projection(l,p));
}
P crosspoint(L l,L m) {
  D A=cross(l[1]-l[0],m[1]-m[0]);
  D B=cross(l[1]-l[0],l[1]-m[0]);
  if (abs(A)<eps&&abs(B)<eps) return m[0]; // same line
  if (abs(A)<eps) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0]+B/A*(m[1]-m[0]);
}

P p[3],q[3],e[3],x[3];
D r[3];
P g;
P cp;

bool ok(){
  r[0]=distanceLP(L(p[0],p[1]),x[0]);
  repl(i,1,3){
    D lb=0,ub=abs(cp-p[i]);
    rep(hoge,80){
      D mid=(ub+lb)/2.0;
      x[i]=p[i]+e[i]*mid;
      r[i]=distanceLP(L(p[i],p[(i+1)%3]),x[i]);
      D d0i=abs(x[i]-x[0]);
      if(d0i>r[0]+r[i])lb=mid;
      else ub=mid;
    }
  }
  D d12=abs(x[1]-x[2]);
  return d12>r[1]+r[2];
}

int main(){
  while(1){
    bool done=true;
    rep(i,3){
      int x,y;
      cin>>x>>y;
      if(x!=0||y!=0)done=false;
      p[i]=P(x,y);
    }
    if(done)break;

    D absA=abs(p[2]-p[1]); D absB=abs(p[2]-p[0]); D absC=abs(p[1]-p[0]);
    q[0]=(p[1]*absB+p[2]*absC)/(absB+absC);
    q[1]=(p[0]*absA+p[2]*absC)/(absA+absC);
    q[2]=(p[0]*absA+p[1]*absB)/(absA+absB);
    cp=crosspoint(L(p[1],q[1]),L(p[2],q[2]));
    rep(i,3)e[i]=(q[i]-p[i])/abs(q[i]-p[i]);
    D lb=0,ub=abs(cp-p[0]);
    rep(hoge,80){
      D mid=(lb+ub)/2.0;
      x[0]=p[0]+e[0]*mid;
      if(ok())ub=mid;
      else lb=mid;
    }
    printf("%.5Lf %.5Lf %.5Lf\n", r[0], r[1], r[2]);
  }
  return 0;
}



Measured memory_bytes: 3256
import java.util.Scanner;
import java.util.Random;
import java.util.Arrays;

class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if (a == 1) {
			a = 14;
		}
		
		if (b == 1) {
			b = 14;
		}
		
		if (a > b) {
			System.out.println("Alice");
		} else if (a < b) {
			System.out.println("Bob");
		} else {
			System.out.println("Draw");
		}
	}
}

Measured memory_bytes: 21972
#include<stdio.h>
int main() 
{
    int W,H,x,y,r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if ((x - r < 0) || (x + r > W) || (y - r < 0) || (y + r > H))
    {
        printf("No\n");
    }
    else
    {
        printf("Yes\n");
    }
    return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll multbig(ll a,ll b,ll mod){
    if(a==0 or b==0) return 0;
    if(a==1 or b==1) return (a*b)%mod;
    ll cur=multbig(a,b/2,mod);
    cur=(2*cur)%mod;
    if(b%2) cur=(cur+a)%mod;
    return cur;
}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = MOD){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}


void solve(){
	int n;
	cin>>n;
	int A[n];
	rep(i,0,n) cin>>A[i];
	int cnt = 0;
	rep(i,1,n-1)
		if((A[i] > A[i-1] && A[i] < A[i+1]) || (A[i] < A[i-1] && A[i] > A[i+1]))
			cnt++;
	cout<<cnt<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func scanInt(scanner *bufio.Scanner) (i int) {
	if scanner.Scan() {
		bs := scanner.Bytes()
		for _, b := range bs {
			i = i*10 + int(b-'0')
		}
	}
	return
}

func copyMap(m map[int]int) map[int]int {
	m2 := make(map[int]int)
	for k, v := range m {
		m2[k] = v
	}
	return m2
}

// Note:
// dp[i][j] == dp[i*(a*n+1)+j]
func countWays(a, n int, x []int) int {
	rowSize := a*n+1
	dp := make([]map[int]int, rowSize*n)

	for i := 0; i < n; i++ {
		dp[i*rowSize] /* dp[i][0] */ = map[int]int{0: 1}
	}

	if x[0] < rowSize {
		dp[x[0]] /* dp[0][x[0]] */ = map[int]int{1: 1}
	}

	for i := 1; i < n; i++ {
		for j := 0; j < rowSize; j++ {
			dp[i*rowSize+j] /* dp[i][j] */ = copyMap(dp[(i-1)*rowSize+j] /* dp[i-1][j] */)
			if j < x[i] {
				continue
			}
			for k, v := range dp[(i-1)*rowSize+j-x[i]] /* dp[i-1][j-x[i]] */ {
				dp[i*rowSize+j][k+1] /* dp[i][j][k+1] */ += v
			}
		}
	}

	ways := 0
	for i := 1; i <= n; i++ {
		ways += dp[(n-1)*rowSize+a*i][i] /* dp[n-1][a*i][i] */
	}

	return ways
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	n := scanInt(scanner) // 1 <= n <= 50
	a := scanInt(scanner) // 1 <= a <= 50
	x := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = scanInt(scanner)
	}
	fmt.Println(countWays(a, n, x))
}


Measured memory_bytes: 22784
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
#define fi first
#define se second
#define sc scanf
#define pr printf
#define pb push_back
const ll inf = 1e18;
const int nax = 2e6 + 7;
ll mod;
using namespace std;
ll exp(ll a , ll b){
	if(b == 0)	return 1;
	int x = b % 2 == 0 ?   ((exp(a , b/2)%mod)*(exp(a , b / 2)%mod))%mod :  (a%mod*exp(a , b - 1) % mod)%mod;
	return x;
}
ll n;
ll ans = 0;
void build(ll num , int flaga , int flagb , int flagc){
	if(num > n)
		return ;
	if(flaga && flagb && flagc)
		ans++;
	build(num*10 + 3 , 1 , flagb , flagc);
	build(num*10 + 5 , flaga , 1 , flagc);
	build(num*10 + 7 , flaga , flagb , 1);
}
int main(int argc,char ** argv){
	dhoom;
	//int n;
	cin >> n;
	build(0,0,0,0);
	cout << ans << endl;
	return 0;
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;

int main(){ 
   int n;
   cin>>n;  
   cout<<n*n;
   return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>

using namespace std;

int main()
{
    int m,d,res=0;
    int i,j;
    int d1,d2;
    
    scanf("%d %d",&m,&d);
    
    for(i=1;i<m+1;i++)
    {
        for(j=22;j<d+1;j++)
        {
            d1 = j % 10;
            if(d1 < 2)continue;
            
            d2 = j / 10;
            if(i == d1 * d2)
            {
                res++;
//                printf("%2d月%d日\n",i,j);
            }
        }
    }
    
    printf("%d\n",res);
    
    return 0;
}


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

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ


		Scanner scan = new Scanner(System.in);

		int[] a = new int[10];
		for(int i=0;i<10;i++)
			a[i]=scan.nextInt();
		Arrays.sort(a);
		for(int i=9;i>=7;i--)
			System.out.println(a[i]);
	}

}

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

using namespace std;

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;

vi rev(vi p)
{
    vi q(p.size());
    for (int i = 0; i < p.size(); i++) q[p[i]] = i;
    return q;
}

vi apply(vi p, vi q)
{
    vi r(p.size());
    for (int i = 0; i < p.size(); i++) r[i] = p[q[i]];
    return r;
}

vi inq(vi A, int k)
{
    if (k == 0)
    {
        vi a(A.size());
        iota(all(a), 0);
        return a;
    }
    vi B = inq(A, k / 2);
    if (k % 2) return apply(B, apply(B, A));
    return apply(B, B);
}

void solve(int n, int k, vi p, vi q)
{
    k--;
    vi A = apply(q, apply(rev(p), apply(rev(q), p)));
    A = inq(A, k / 6);
    vector<vi> a(6);
    a[0] = apply(A, apply(p, rev(A)));
    a[1] = apply(A, apply(q, rev(A)));
    for (int i = 2; i < 6; i++)
    {
        a[i] = apply(a[i - 1], rev(a[i - 2]));
    }
    for (int i = 0; i < n; i++)
    {
        cout << a[k % 6][i] + 1 << " ";
    }
    cout << "\n";
}

int main()
{
    int n, k;
    cin >> n >> k;
    vi p(n), q(n);
    for (int i = 0; i < n; i++) cin >> p[i], p[i]--;
    for (int i = 0; i < n; i++) cin >> q[i], q[i]--;
    solve(n, k, p, q);
}

/*

*/


Measured memory_bytes: 18160
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string ch;
    while(cin>>ch)
    {
        if(ch=="SUN") cout<<7<<endl;
        if(ch=="SAT") cout<<1<<endl;
        if(ch=="MON") cout<<6<<endl;
        if(ch=="TUE") cout<<5<<endl;
        if(ch=="WED") cout<<4<<endl;
        if(ch=="THU") cout<<3<<endl;
        if(ch=="FRI") cout<<2<<endl;


    }

    return 0;
}


Measured memory_bytes: 256