akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

using namespace std;

const int mod = 1000000007;
const int N = 10010007;
const int M = 5007;

int fact[N];

inline int mult(int a, int b) {
	return ((ll) a * b) % mod;
}

inline int sum(int a, int b) {
	if (a+b < 0) return a+b+mod;
	if (a+b >= mod) return a+b-mod;
	return a+b;
}

int pw(int x, int y) {

	int ans = 1;
	int deg = x;

	for (int i = 0; i < 30; ++i) {
		if ((1<<i)&y) {
			ans = mult(ans, deg);
		}
		deg = mult(deg, deg);
	}

	return ans;

}

int dp[M][M][2][2];

int C(int n, int k) {
	int x = mult(pw(fact[k], mod-2), pw(fact[n-k], mod-2));
	return mult(fact[n], x);
}

int box[M];

int main(){
#ifdef LOCAL
	freopen("F_input.txt", "r", stdin);
	//freopen("F_output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n, k;
	cin >> n >> k;

	fact[0] = 1;
	for (int i = 1; i < N; ++i) fact[i] = mult(fact[i-1], i);

	dp[0][0][0][0] = 1;

	for (int was = 0; was <= k; ++was) {
		for (int one = 0; one <= k; ++one) {
			for (int start = 1; start >= 0; start--) {
				for (int take = 0; take <= 1; ++take) {

					if (!dp[was][one][start][take]) continue;

					if (start == 0) {
						dp[was+1][one+1][0][1] = sum(dp[was+1][one+1][0][1], dp[was][one][start][take]);

						int have = k-was;

						if (have >= 2) {
							dp[was+2][one][1][0] = sum(dp[was+2][one][1][0], mult(dp[was][one][start][take], have - 1));
							dp[was+2][one+1][1][1] = sum(dp[was+2][one+1][1][1], mult(dp[was][one][start][take], 2*have - 2));
							dp[was+2][one+2][1][1] = sum(dp[was+2][one+2][1][1], mult(dp[was][one][start][take], have-1));
						}
					}

					else {

						int have = k-was;

						dp[was+1][one+1][1][1] = sum(dp[was+1][one+1][1][1], mult(dp[was][one][start][take], have));
						dp[was+1][one][1][take] = sum(dp[was+1][one][1][take], mult(dp[was][one][start][take], have));
						dp[was][one][0][take] = sum(dp[was][one][0][take], dp[was][one][start][take]);
					}

				} 
			}
		}
	}

	int ans = 0;

	int dop = n-k;

	box[0] = 0;
	for (int i = 1; i < M; ++i) {
		if (i > dop) continue;
		box[i] = C(dop-1, i-1);

	}

	for (int i = 0; i < M; ++i) {
		box[i] = mult(box[i], fact[dop]);
	}

	//cout << box[1] << endl;

	//cout << pw(1, 2) << endl;

	//cout << dp[2][2][1][1] << endl;

	//cout << dp[1][1][0][1] << endl;

	for (int i = 0; i <= k; ++i) for (int j = 0; j <= k; ++j) {
		if (!dp[i][j][0][1]) continue;
		if (j > dop) continue;

		int res = dp[i][j][0][1];

		res = mult(res, box[j]);

		res = mult(res, fact[k-i]);
/*
		if (res) {
			cout << res << " " << i << " " << j << endl;
		}
*/
		ans = sum(ans, res);
	}

	cout << ans;





}


Measured memory_bytes: 257468
use std::fmt::{Debug, Display};
use std::io::{self, Read};
use std::str::{self, FromStr};

fn main() {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock().bytes());
    println!("{}",
             if solve(sc.next(), sc.next()) {
                 "Possible"
             } else {
                 "Impossible"
             });
}


fn solve(a: u32, b: u32) -> bool {
    *&[a % 3, b % 3, (a + b) % 3].iter().any(|&x| x == 0)
}


struct Scanner<R: Read> {
    buf: Vec<u8>,
    bytes: io::Bytes<R>,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(bytes: io::Bytes<R>) -> Self {
        Scanner {
            buf: Vec::with_capacity(256),
            bytes: bytes,
        }
    }

    fn next<T: FromStr>(&mut self) -> T
        where <T as FromStr>::Err: Debug
    {
        self.buf.clear();
        let mut c = self.bytes.next().unwrap().unwrap();
        while c == ' ' as u8 || c == '\n' as u8 {
            c = self.bytes.next().unwrap().unwrap();
        }
        while !(c == ' ' as u8 || c == '\n' as u8) {
            self.buf.push(c);
            c = self.bytes.next().unwrap().unwrap();
        }
        str::from_utf8(&self.buf).unwrap().parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
        where <T as FromStr>::Err: Debug
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<A: FromStr, B: FromStr>(&mut self, n: usize) -> Vec<(A, B)>
        where <A as FromStr>::Err: Debug,
              <B as FromStr>::Err: Debug
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<A: FromStr, B: FromStr, C: FromStr>(&mut self, n: usize) -> Vec<(A, B, C)>
        where <A as FromStr>::Err: Debug,
              <B as FromStr>::Err: Debug,
              <C as FromStr>::Err: Debug
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
        where <T as FromStr>::Err: Debug
    {
        (0..n).map(|_| self.vec(m)).collect()
    }
}


#[allow(dead_code)]
fn print_foreach<T: Display>(answer: &[T]) {
    for x in answer {
        println!("{}", x);
    }
}


#[allow(dead_code)]
fn print_yn(answer: bool, yes: &str, no: &str) {
    println!("{}", if answer { yes } else { no });
}


#[allow(dead_code)]
fn print_or<T: Display>(answer: &Option<T>, or: &T) {
    match *answer {
        Some(ref x) => println!("{}", x),
        None => println!("{}", or),
    }
}


Measured memory_bytes: 4352
S = input()
N = len(S)
C = [0] * N
i = 0
while i < N:
    cnt = 0
    while i < N and S[i] == 'R':
        i += 1
        cnt += 1
    C[i - 1] += cnt // 2 + int(cnt % 2 != 0)
    C[i] += cnt // 2
    while i < N and S[i] == 'L':
        i += 1
i = N - 1
while i >= 0:
    cnt = 0
    while i >= 0 and S[i] == 'L':
        i -= 1
        cnt += 1
    C[i + 1] += cnt // 2 + int(cnt % 2 != 0)
    C[i] += cnt // 2
    while i >= 0 and S[i] == 'R':
        i -= 1
for c in C:
    print(c)


Measured memory_bytes: 9972
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    map<int,int> q;
    int diff;
    rep(i,n){ 
        cin >> diff;
        q[diff]++;
    }

    int m;
    cin >> m;
    rep(i,m){
        cin >> diff;
        if(q[diff] > 0)q[diff]--;
        else{
            
            cout << "NO" << endl;
            return 0;
        } 
    }

    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 11648
[<EntryPoint>]
let main argv =
    let groups = [|[|1;3;5;7;8;10;12|];[|4;6;9;11|];[|2|]|]
    let getGroup n = groups |> Array.findIndex (Array.contains n)
    if (stdin.ReadLine().Split() 
    |> Array.map int 
    |> Array.map getGroup 
    |> Array.distinct 
    |> Array.length
    |> (=) 1) then "Yes" else "No"
    |> stdout.WriteLine
    0

Measured memory_bytes: 12128
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,f[100009],mod=1000000007,dp[100009];
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>b;
	for(c=1; c<=a; c++) cin>>f[c];
	dp[0]=0;
	for(c=1; c<=b; c++){
		for(d=1; d<=a; d++){
			if(c-f[d]>=0&&dp[c-f[d]]==0){
				dp[c]=1;
				break;
			}
		}
	}
	if(dp[b]==1){
		cout<<"First";
	}else{
		cout<<"Second";
	}
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(){
	int X,a,b;
	scanf("%d%d%d",&X,&a,&b);
	int S,D;
	S=X-a;
	D=X-b;
	if(S<0){
		S=S*-1;
	 }
	 if(D<0){
		 D=D*-1;
	 }
	 if(S>D){
		 printf("B");
	 }
	 if(D>S){
		 printf("A");
	 }
	 
	
	
	
	return 0;
}


Measured memory_bytes: 128
I=lambda : list(map(int,input().split()))
n,m= I()
l=I();an=[1]*n
for i in range(m):
  a,b=I()
  if l[a-1]<l[b-1]:
    an[a-1]=0
  elif l[a-1]>l[b-1]:
    an[b-1]=0
  else:
    an[b-1]=an[a-1]=0
print(an.count(1))

Measured memory_bytes: 20128
import java.util.*;

public class Main {
    //Unification
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] A = sc.next().toCharArray();
        System.out.println(helper(A));
        sc.close();
    }

    public static int helper(char[] A) {
        Stack<Character> stack = new Stack<>();
        int res = 0;
        for (char a : A) {
            if (stack.isEmpty()) stack.push(a);
            else {
                if (stack.peek() != a) {
                    stack.pop();
                    res += 2;
                } else stack.push(a);
            }
        }
        return res;
    }
}


Measured memory_bytes: 27336
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long M = sc.nextLong();
    long ans = 0;
    if(2 * N <= M) {
      ans = N;
      M -= 2 * N;
      ans += M / 4;
    } else {
      ans = M / 2;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21972
#include<stdio.h>
#include<stdlib.h>
int main(){
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  if(abs(a-c)<=d || (abs(a-b)<=d && abs(c-b)<=d))
    puts("Yes");
  else
    puts("No");
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

int main(){
    string str, ans;
    cin >> str;
    rep(i, str.size()){
        if(str[i] == '0' || str[i] == '1'){
            ans += str[i];
        } else {
            if(ans.size()) ans.pop_back();
        }
    }
    cout << ans << "\n";
    return 0;
}

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

int main(int argc, const char * argv[]) {
    // insert code here...
    int x,y,z[1001],x1;
    double n,p1[1000],p2[1000],p3,p4,p6,o1,o2;
    while(1){
        for(y=1;y<=x;y++){
            z[y]=0;
            p1[y]=0;
            p2[y]=0;
        }
        x=0;y=0;x1=0;o1=0;o2=0;n=0;p3=0;p4=0;p6=0;
        scanf("%d",&x);
            if(x==0){
                break;
            }
        for(y=1;y<=x;y++){
            scanf("%d",&z[y]);
            x1+=z[y];
        }
        o1=x;
        o2=x1;
        n=o2/o1;
        for(y=1;y<=x;y++){
            p1[y]=z[y]-n;
            p2[y]=p1[y]*p1[y];
            p3+=p2[y];
            
        }
        p4=p3/x;
        p6=sqrt(p4);
        printf("%f\n",p6);

    }


    return 0;

}



Measured memory_bytes: 2048
N, M = gets.split(' ').map(&:to_i)
def fibonacci1(n)
  return 0 if n < 0
  return n if n < 3
  a, b = 1, 1
  n.times { a, b = b, a + b }
  a % 1000000007
end

if M == 0
  puts fibonacci1(N)
  exit
end

steps, start = 1, 0
M.times do |i|
  a = gets.to_i
  if a == start
    puts 0
    exit
  elsif a - 1 != start
    steps *= fibonacci1((a - 1) - start) % 1000000007
  end
  start = a + 1
  if i == M - 1 && start != N
    steps *= fibonacci1(N - start) % 1000000007
  end
end
puts steps % 1000000007


Measured memory_bytes: 21756
// Ref : https://book.mynavi.jp/ec/products/detail/id=35408

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int n, pos;
vector<int> pre, in, post;

void rec(int l, int r) {
	if (l >= r) return;
	int root = pre[pos++];
	int m = distance(in.begin(), find(in.begin(), in.end(), root));
	rec(l, m);
	rec(m + 1, r);
	post.push_back(root);
}

void solve() {
	pos = 0;
	rec(0, pre.size());
	for (int i = 0; i < n; i++) {
		if ( i ) cout << " ";
		cout << post[i];
	}
	cout << endl;
}

int main() {
	int cache;
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> cache;
		pre.push_back(cache);
	}

	for (int i = 0; i < n; i++) {
		cin >> cache;
		in.push_back(cache);
	}

	solve();

	return 0;
}


Measured memory_bytes: 3168
n, y = map(int, input().split())

ans = "-1 -1 -1"

for man in range(n + 1):
    for go in range(n - man + 1):
        sen = n - (man + go)
        if man * 10000 + go * 5000 + sen * 1000 == y:
            ans = "{} {} {}".format(man, go, sen)
print(ans)

Measured memory_bytes: 40812
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
    int i,j;
    vector<vector<int>> data(3, vector<int>(3));
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            int c;
            cin >> c;
            data.at(i).at(j) = c ;
        }
    }
    // c のデータを二重のvector に格納
    vector<int> A(3);
    vector<int> B(3);
    // a,bは自然数であるという仮定の下
    bool judge_1 =false;
    bool judge_2 =false;
    bool judge_3 =false;
    for(int i=0;i<=100;i++){
        for(int j=0;j<=100;j++){
            for(int k=0;k<=100;k++){
                A.at(0)=i;
                A.at(1)=j;
                A.at(2)=k;
                B.at(0)= data.at(0).at(0) - A.at(0);
                B.at(1)= data.at(0).at(1) - A.at(0);
                B.at(2)= data.at(0).at(2) - A.at(0);
                if( B.at(0) != data.at(1).at(0) - A.at(1)){
                    continue;
                }
                else if( B.at(0) != data.at(2).at(0) - A.at(2)){
                    continue;
                }
                else if( B.at(1) != data.at(1).at(1) - A.at(1)){
                    continue;
                }
                else if( B.at(1) != data.at(2).at(1) - A.at(2)){
                    continue;
                }
                else if( B.at(2) != data.at(1).at(2) - A.at(1)){
                    continue;
                }
                else if( B.at(2) != data.at(2).at(2) - A.at(2)){
                    continue;
                }
                else{
                    judge_1= true;
                }
            }
            if(judge_1){
                judge_2 = true;
                break;
            }
        }
        if(judge_2){
            judge_3 = true;
            break;
        }
        
    }
    if(judge_3){ cout << "Yes" << endl;}
    else{ cout << "No" << endl;}
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
const ll Mod=1000000007;
const ll INF=999999999999999999;
const ll NN=(ll)(1e7+5);
int mod(string s,int a) 
{ 
    int ans=0; 
    for (int i=0;i<s.length();i++) 
         ans=(ans*10+(int)s[i]-'0')%a; 
    return ans; 
}
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
ll sieve[NN];
void build()
{
    memset(sieve,0,sizeof(sieve));
    ll i,j;
    for(i=1;i<NN;i++)
     for(j=i;j<NN;j+=i)
      sieve[j]++;
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
    build();
   //cout<<sieve[16]<<"\n";
   while(TT--)
   {
       ll n,i,ans=0;
       cin>>n;
       for(i=1;i<=n;i++)
        ans+=i*sieve[i];
       cout<<ans;       
   }
}

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

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

int main() {

    vector<int> T(3);
    cin >> T[0] >> T[1] >> T[2];

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

    cout << T[0]+T[1] << endl;

    return 0;
}


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

using namespace std;

int main()
{
    string s ;
    cin>>s ;
    int x = 0 ;
    for(int i = 2 ; i < s.size()-1 ; ++i)
        x += (s[i] == 'C');
    if(x == 1 && s[0] == 'A')
    {
       int cnt = 0 ;
       for(int i = 0 ; i < s.size() ; ++i)
       {
           if(s[i] >= 'A' && s[i] <= 'Z')
            cnt++;
       }
       if(cnt == 2)
        cout<<"AC";
       else
        cout<<"WA";
    }
    else
        cout<<"WA";
    return 0 ;
}


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

int main(){
string S;
  cin>>S;
  int answer=0;
  for(int i=0; i<S.size(); i++){
  if(S.at(i) == '+'){
  answer++;
  }
  else{
  answer--;
  }
  }
  cout << answer <<endl;
}

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

using namespace std;

char s[100000+10];
int len;

int main()
{
    cin>>s;
    len=strlen(s);
    for(int i=0;i<=len-1;i=i+2)
    {
        cout<<s[i];
    }
    return 0;

}


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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  ll cnt = 0;
  ll now = 0;
  REP(i, n) {
    int a; cin >> a;
    if(a == 0) {
      cnt += now / 2;
      now = 0;
    } else {
      now += a;
    }
  }
  cnt += now / 2;

  cout << cnt << endl;


}
























Measured memory_bytes: 256
N, A, B = map(int, input().split())
if not (B - A) % 2:
    print((B - A)//2)
else:
    if B - 1 > N - A:
        b = N - A + 1
        a = N - B + 1
        A = a
        B = b

    if B-A == 1:
        print(B-1)

    else:
        print(-(-(B-A)//2) + A - 1)

Measured memory_bytes: 3060
N = int(input())
ABs = [list(map(int, input().split())) for _ in range(N)]

rlt = 0
for ab in ABs[::-1]:
  ext = (ab[0]+rlt) % ab[1]
  if ext != 0:
    rlt += (ab[1] - ext)
    
print(rlt)

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

int main(void)
{
	string A, B;
	cin >> A >> B;

	if (A.length() > B.length()) {
		while (B.length() < A.length()) {
			B = "0" + B;
		}
	} else {
		while (A.length() < B.length()) {
			A = "0" + A;
		}
	}

	if (strcmp(A.c_str(), B.c_str()) > 0) {
		cout << "GREATER" << endl;
	} else if (strcmp(A.c_str(), B.c_str()) < 0) {
		cout << "LESS" << endl;
	} else {
		cout << "EQUAL" << endl;
	}
	
	return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<ll>;


int main()
{
	ll N, K;
	cin >> N >> K;

	map<int, ll> mp;

	for (int i = 0; i < N; ++i)
	{
		int a, b;
		cin >> a >> b;

		if (mp.count(a))
		{
			mp[a] += b;
		}
		else
		{
			mp[a] = b;
		}
	}

	for (auto & n : mp)
	{
		K -= n.second;
		if (K <= 0)
		{
			cout << n.first << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 4224
#include <iostream>/*{{{*/
#include <bits/stdc++.h>
#define REP(i, x) for(int i = 0; i < (int)(x); i++)
#define REPS(i,x) for(int i = 1; i <= (int)(x); i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x,y) memset(x,y,sizeof(x))
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define PB(a) push_back(a)
#define debug(x) cerr << __LINE__ << ": " << #x << " -> " << x << '\n'
#define INF 999999999
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};/*}}}*/

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

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

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
char s[200010];
int cnt[26];
int main () {
    scanf("%s",s+1);
    for(int i=1;s[i];i+=1) cnt[s[i]-'a'] += 1;
    LL ans = strlen(s+1); ans = ans * (ans-1) / 2;
    for(int i=0;i<26;i+=1) ans -= (LL)cnt[i] * (cnt[i]-1) / 2;
    cout << ans+1;
}


Measured memory_bytes: 384
#include<iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
  long double a,b,x;
  cin >> a>>b>>x ;
  long double menseki,n,angle,j1,j2;
  cout << std::fixed;
  j1=x/a;
  j2=a*b/2;
  //水の量は半分以上
  if(j1>=j2){
     menseki=a*b-j1;
     n=menseki*2/a;
     angle=atan(n/a);
  }
    
  //半分以下 
  else{
    menseki=j1;
    n=menseki*2/b;
    angle=atan(b/n);
  }
  cout << setprecision(10)<<angle*180/M_PI;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,s1,s2,s3,a[303];
double f[303][303][303];
#define AC ios::sync_with_stdio(0),cin.tie(0);
int main(){
	AC
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]==1)s1++;
		if(a[i]==2)s2++;
		if(a[i]==3)s3++;
	}
	f[0][0][0]=0;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			for(int k=0;k<=n;k++){
				if(i)f[i][j][k]+=(f[i-1][j+1][k])*i/(i+j+k);
				if(j)f[i][j][k]+=(f[i][j-1][k+1])*j/(i+j+k);
				if(k)f[i][j][k]+=(f[i][j][k-1])*k/(i+j+k);
				if(i||j||k)f[i][j][k]+=(double)n/(i+j+k);
			}
		}
	}
	cout<<fixed<<setprecision(14)<<f[s3][s2][s1]<<endl;
	return 0;
}


Measured memory_bytes: 219388
n = int(input())
 
if  n <= 9:
    print(n)
elif 10 <= n <= 99:
    print(9)
elif 100 <= n <= 999:
    print(n-99+9)
elif 1000 <= n <= 9999:
    print(909)
elif 10000 <= n <= 99999:
    print(n-9999+909)
elif n == 100000:
    print(90909)

Measured memory_bytes: 3060
import java.util.Scanner;

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

                	for (int i = 1; i <= 5; i++) {
                		int x = scan.nextInt();
                		if (x == 0) {
                			System.out.println(i);
                			break;
                		}
                	}

                	scan.close();

        }
}

Measured memory_bytes: 35504
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
            String line = sc.nextLine();
            StringBuilder answer = new StringBuilder();
            int length = line.length();
            for(int i = 0;i < length;i++){
                char ch = line.charAt(i);
                if(Character.isLowerCase(ch)==true){
                    answer.append(Character.toUpperCase(ch));
                }else{
                    answer.append(Character.toLowerCase(ch));
                }
            }
            System.out.println(answer);
        }
    }
}


Measured memory_bytes: 26172
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;
  long long int ans=1;
  for(int i=0;i<n;i++){
	  long long int a;
    cin >> a;
	if(log10(abs(a))+log10(abs(ans))>18){
		ans=-1;}
	  ans = ans*a;  
	  if(ans == 0){
		  break;
		  }
	  else if(ans>1000000000000000000){
		  ans=-1;
		  }
     }
	 if(ans<0)ans=-1;

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


Measured memory_bytes: 4024
#include<cstdio>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<cstring>

class Que{
    public:
        Que(){
            bottom = 0;
            top = 0;
            n = 0;
        };
        int n;
        void enque(int a, char* b){
            top++;
            v.push_back(a);
            w.push_back(b);
            n++;
        };
        int deque1(){
            n--;
            bottom++;
            return v[bottom - 1];
        };
        char* deque2(){
            return w[bottom - 1];
        };

    private:
        std::vector<int> v;
        std::vector<char*> w;
        int bottom;
        int top;
};

int main(){
    int n, q, p;
    int time = 0;
    scanf("%d %d", &n, &q);
    Que Q = Que();
    
    for(int i = 0; i < n; i++){
        char* buf = new char[10];
        scanf("%s", buf);
        scanf("%d", &p);
        Q.enque(p, buf);
    }

    
    while(Q.n != 0){
        int value = Q.deque1();
        char* name = Q.deque2();
        if(value > q){
            value -= q;
            time += q;
            Q.enque(value, name);
        }else{
            time += value;
            printf("%s %d\n", name, time);
        }
    }
    return 0;
}


Measured memory_bytes: 6888
#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 mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__",", __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

map<int, double> memo;

double solve(int x, int y, int z, int turn, int joker){
  if(x+y+z==0){
    if(joker==1) return 0;
    else return 1;
  }
  int idx = (((x*100+y)*100+z)*3+turn)*3+joker;
  if(memo.count(idx)==1) return memo[idx];
//  dbg(x,y,z,turn,joker);
  double ans=0;
  if(turn==0){
    if(x+y+(joker==0) == 0) return solve(x,y,z,1,joker);
    int total = x+z+(joker==2);
    if(total==0){
      if(y==0){
        if(joker==0) ans = 1;
        else ans = 0;
      }
      else ans = solve(0,y-1,0,1,joker);
    }
    else {
      if(x>0) ans += x*solve(x-1, y, z, 1, joker);
      if(z>0) ans += z*solve(x, y+1, z-1, 1, joker);
      if(joker==2) ans += solve(x,y,z,1,0);
      ans /= (double)total;
    }
  }
  else if(turn==1){
    if(y+z+(joker==1) == 0) return solve(x,y,z,2,joker);
    int total = x+y+(joker==0);
    if(total==0){
      if(z==0){
        if(joker==1) ans=0;
        else ans=1;
      }
      else {
        if(joker==1) ans = solve(0,0,z-1,2,joker);
        else ans = (solve(0,0,z,2,1) + z*solve(0,0,z-1,2,2)) / (z+1.0);
      }
    }
    else {
      if(x>0) ans += x*solve(x-1,y,z+1,2,joker);
      if(y>0) ans += y*solve(x,y-1,z,2,joker);
      if(joker==0) ans += solve(x,y,z,2,1);
      ans /= (double)total;
    }
  }
  else if(turn==2){
    if(x+z+(joker==2) == 0) return solve(x,y,z,0,joker);
    if(y+z+(joker==1) == 0) ans = 1;
    else if(z>0) ans = solve(x,y,z-1,0,joker);
    else if(y>0) ans = solve(x+1,y-1,z,0,joker);
    else if(joker==1) ans = solve(x,y,z,0,2);
  }
//  else assert(false);
  return memo[idx]=ans;
}

int main(){
  int n;
  cin>>n;
  vector<int> vec(n,0);
  int joker=-1;
  rep(i,3){
    int m; cin>>m;
    rep(j,m){
      int d; cin>>d;
      if(d==0) joker=i;
      else {
        d--;
        vec[d] ^= (1<<i);
      }
    }
  }
//  assert(joker!=-1);

  int x=0,y=0,z=0;
  rep(i,n){
    if(vec[i]==5) x++;
    else if(vec[i]==3) y++;
    else if(vec[i]==6) z++;
//    else if(vec[i]!=0) assert(false);
  }

  printf("%.8f\n", solve(x,y,z,0,joker));

  return 0;
}

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

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


int main() {


  int a[100];
  int n;
  cin >> n;
  for(int i=0 ; i<n ; i++)
    cin >> a[i];
  
  qsort(a,n,sizeof(int),compare_int);

  int sum = 0;
  bool turn = true;
  for(int i=0 ; i<n ; i++){
    if(turn)
      sum += a[i];
    else
      sum -= a[i];
    turn = !turn;	
  }

  cout << sum << endl;
  
  return 0;
}



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

int main() {
ll n;
cin >> n;
vector<ll> a (n,0);
vector<ll>count(n+1,0);
vector<ll> combi (n+1,0);

rep(i,n)
{ll b;
  cin>>b;
  a.at(i)=b;
  count.at(b)++;
}

ll sum=0;
rep(i,n+1)
{ll c=count.at(i);
  if(c>=2){
  combi.at(i)= c*(c-1)/2;
  }
 sum+=combi.at(i);
}

//ここまでで、ボールが全部あった時、同じ整数同士でなんこ作れるかわかる

rep(i,n)
{ll num=a.at(i);// 
 //まず、総数から自分の整数の数を引く
 ll ans = sum - combi.at(num);

 //そして、自分抜きでその整数について再計算し、総数に足す
  ll counter=count.at(num);
  if(counter>=3)//もし、２こ以下なら、自分が減ることで1つになって組みを作れない
  {counter--;//まず一個減らして、残りの数を考える　counter C 2
  ans+=counter*(counter-1)/2;
  }
cout << ans << endl;
}

return 0;
}


Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
    
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
    
#define int long long
#define double long double
    
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
    
#define ff first
#define ss second
#define mp make_pair
         
#define pb push_back
#define endl "\n" 
         
#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)    

#define bp __builtin_popcountll
#define inf 3e15
    
const int N=2e5+5;
const int MAXN=2e5+5;
const int M=1e9+7;
void solve()
{
	int n,aa,bb;
	cin>>n>>aa>>bb;
	int f1=0,f2=0,f3=0;
	int a[n];
	f(i,0,n-1){
		cin>>a[i];
		if(a[i]<=aa)
		f1++;
		else if(a[i]>bb)
		f3++;
		else
		f2++;
	}
	int ans=min(f1,min(f2,f3));
	cout<<ans;
}
signed main()  
{
	FAST
    int t=1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++)
    {
    	// cout<<"Case #"<<tc<<": ";
    	solve();
    }
}



Measured memory_bytes: 256
function Main(input) {
  input = input.split("\n");
  A = parseInt(input[0].split(" ")[0]);
  B = parseInt(input[0].split(" ")[1]);
  C = parseInt(input[0].split(" ")[2]);
  N = new Array(A,B,C);
  N.sort(function(a,b){return b-a});
  if((N[0]-N[2])%2==0&&(N[0]-N[1])%2==0){
  ans=Math.floor((N[0]-N[2])/2)+Math.floor((N[0]-N[1])/2);
  }else if(((N[0]-N[2])%2==0&&(N[0]-N[1])%2==1)||((N[0]-N[2])%2==1&&(N[0]-N[1])%2==0)){

  ans=Math.floor((N[0]-N[2])/2)+Math.floor((N[0]-N[1])/2)+2;
  }else{
    ans=Math.floor((N[0]-N[2])/2)+Math.floor((N[0]-N[1])/2)+1;
    
  }


  console.log('%s', ans);
}
  
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main(){
    int a,b,c,d;cin >> a >> b >> c >> d;
    if(a+b > c+d)cout << "Left" << endl;
    else if(a+b == c+d)cout << "Balanced" << endl;
    else cout << "Right" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iterator>
#include<math.h>
#define ll long long
#define INF 0x3f3f3f3f
#define inf  0x3ffffffffffff
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int  maxn=8000009;
const double pi = acos(-1.0);
const int N=40010;
using namespace std;
const ll mod=1e9+7;
map<ll,ll>mp;
int a[200000];
int main()
{
   int n;
   ll sum=0;
   cin>>n;
   for(int i=1;i<=n;i++)
   {
       cin>>a[i];
      mp[i+a[i]]++;
   }
   for(int i=1;i<=n;i++)
    sum+=mp[i-a[i]];
   cout<<sum<<endl;
    return 0;
}

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

namespace AtTest.ABC_143
{
    class B
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] ds = ReadInts();
            int sum = ds.Sum();
            int res = 0;
            for (int i = 0; i < n; i++) res += (sum - ds[i]) * ds[i];
            WriteLine(res/2);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

string solve (int n) {

    for (int a = 0; a <= n/4; a++) {
        for (int b = 0; b <= n/7; b++) {
            if (a * 4 + b * 7 == n) {
                return "Yes";
            }
        }
    }

    return "No";
}

int main () {

    int N;
    cin >> N;

    cout << solve(N) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)

const int N_MAX = 200000;
const int T_MAX = 1000000000;

int N, T;
int t[N_MAX];

void solve() {
  int ans = 0;
  int f = 0, g = 0;
  REP(i, N) {
    if (t[i] > g) {
      ans += g - f;
      f = t[i];
    }
    g = t[i] + T;
  }
  ans += g - f;
  printf("%d\n", ans);
}

void input() {
  scanf("%d%d", &N, &T);
  REP(i, N) scanf("%d", t + i);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 896
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<vector>
using namespace std;

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//infinity
#define INTINF 2000000000
#define LONGINF 2000000000

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
	char a[4];
	int x[4];
	cin >> a[0] >> a[1] >> a[2] >> a[3];
	REP(i, 4) x[i] = a[i] - '0';
	
	if(x[0]+x[1]+x[2]+x[3] ==7)
		cout << x[0] << '+' << x[1] << '+' << x[2] << '+' << x[3] << "=7" << endl;
	else if(x[0]+x[1]+x[2]-x[3] ==7)
		cout << x[0] << '+' << x[1] << '+' << x[2] << '-' << x[3] << "=7" << endl;
	else if(x[0]+x[1]-x[2]+x[3] ==7)
		cout << x[0] << '+' << x[1] << '-' << x[2] << '+' << x[3] << "=7" << endl;
	else if(x[0]+x[1]-x[2]-x[3] ==7)
		cout << x[0] << '+' << x[1] << '-' << x[2] << '-' << x[3] << "=7" << endl;
	else if(x[0]-x[1]+x[2]+x[3] ==7)
		cout << x[0] << '-' << x[1] << '+' << x[2] << '+' << x[3] << "=7" << endl;
	else if(x[0]-x[1]+x[2]-x[3] ==7)
		cout << x[0] << '-' << x[1] << '+' << x[2] << '-' << x[3] << "=7" << endl;
	else if(x[0]-x[1]-x[2]+x[3] ==7)
		cout << x[0] << '-' << x[1] << '-' << x[2] << '+' << x[3] << "=7" << endl;
	else if(x[0]-x[1]-x[2]-x[3] ==7)
		cout << x[0] << '-' << x[1] << '-' << x[2] << '-' << x[3] << "=7" << endl;
	return 0;
}


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

int main() {
	char X,Y,CUP='A';
	while(scanf("%c,%c",&X,&Y)!=EOF){
		if(CUP==X){
			CUP=Y;
		}else if(CUP==Y){
			CUP=X;
		}
	}
	cout<<CUP<<endl;
}

Measured memory_bytes: 3236
(defun main ()
  (let* ((n (read))
         (ps (coerce (loop repeat n collect (read)) 'vector))
         (mins (make-array n)))
    (setf (aref mins 0) (aref ps 0))
    (loop for i from 1 below n
          do (setf (aref mins i) (min (aref mins (- i 1))
                                      (aref ps i))))
    (princ (loop for i from 0 below n
                 counting (>= (aref mins i) (aref ps i))))))
(main)


Measured memory_bytes: 61800
#include <iostream>
#include <vector>
#include <cmath>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <queue>

using namespace std;
typedef long long ll;
using P = pair<ll,ll>;

int main() {
    ll N;
    cin >> N;
    vector<P> A,B;
    for(int i=0;i<N;i++){
        ll a,b;cin >> a >> b;
        A.push_back(P(a,b));
    }
    for(int i=0;i<N;i++){
        ll a,b;cin >> a >> b;
        B.push_back(P(a,b));
    }
    sort(A.rbegin(),A.rend());
    sort(B.rbegin(),B.rend());

    ll ans=0;
    for(int i=0;i<N;i++){
        auto tmpa=A[i];
        priority_queue<P,vector<P>,greater<P>> que;
        for(int j=0;j<N;j++){
            if(tmpa.first>=B[j].first) break;
            else if(tmpa.second<B[j].second){
                que.push(P(B[j].second,j));
            }
        }
        if(!que.empty()){
            auto tmp=que.top();
            B.erase(B.begin()+tmp.second);
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

int t, n;

int main(int argc, char const *argv[]) {
    // code
    char s[10];
    scanf("%s", s);
    int n = strlen(s);
    for (int i=0; i<n; ++i)
        for (int j=i+1; j<n; ++j) {
            if (s[i] != s[j]) {
                puts("Yes");
                return 0;
            }
        }
    puts("No");
    return 0;
}


Measured memory_bytes: 256
import math
import sys
import collections

# imgur.com/Pkt7iIf.png

def getdict(n):
    d = {}
    if type(n) is list:
        for i in n:
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    else:
        for i in range(n):
            t = ii()
            if t in d:
                d[t] += 1
            else:
                d[t] = 1
    return d
def cdiv(n, k): return n // k + (n % k != 0)
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(map(int, input().split()))
def lcm(a, b): return abs(a*b) // math.gcd(a, b)

a, b = mi()
print(max(a*b, a-b, a+b))

Measured memory_bytes: 38256
def main():
    from itertools import accumulate
    h, w, d = map(int, input().split())

    a = [0] * (h * w + 1)
    b = [0] * (h * w + 1)
    for i in range(1, h + 1):
        l = map(int, input().split())
        for j, k in enumerate(l, 1):
            a[k] = i
            b[k] = j

    c = [0] * (h * w + 1)
    for i in range(d + 1, h * w + 1):
        c[i] = c[i - d] + abs(a[i] - a[i - d]) + abs(b[i] - b[i - d])

    q = int(input())
    res = []
    for _ in range(q):
        l, r = map(int, input().split())
        res.append(c[r] - c[l])

    ans = '\n'.join(map(str, res))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 26244
#include<iostream>

using namespace std;

const int N=2e5+10;
int a[N];
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=k+1;i<=n;i++){
		if(a[i]>a[i-k]) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 4372
import java.util.Scanner;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String n = sc.nextLine();

		while(!n.equals("-")){
		    int shuffle_count = Integer.parseInt(sc.nextLine());
		    Queue<Character> cards = new ArrayDeque<>();
		    
		    for(char card: n.toCharArray()){
		        cards.add(card);
		    }
		    
		    for (int i = 0; i < shuffle_count; i++){
		        int shuffle_cards = Integer.parseInt(sc.nextLine());
		        
		        for (int l = 0; l < shuffle_cards; l++){
		            cards.add(cards.poll());
		        }
		    }
		    
		    for (Character card: cards){
		        System.out.print(card);
		    } 
		    
		    System.out.println();
		    
		    n = sc.nextLine();
		}
	}
}


Measured memory_bytes: 26232
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if (a == b) {
			System.out.println(c);
		} else if (a == c) {
			System.out.println(b);
		} else {
			System.out.println(a);
		}

		sc.close();
	}
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

class Point {
    public:
        double x, y;

    Point(double x = 0, double y = 0): x(x), y(y) {}

    Point operator+ (Point p) { return Point(x + p.x, y + p.y); }
    Point operator- (Point p) { return Point(x - p.x, y - p.y); }
    Point operator* (double a) { return Point(x * a, y * a); }
    Point operator/ (double a) { return Point(x / a, y / a); }

    double norm() { return x * x + y * y; }
    double abs() { return sqrt(norm()); }

    bool operator< (const Point &p) const {
        return x != p.x ? x < p.x : y < p.y;
    }
    bool operator== (const Point &p) const {
        return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
    }
};
struct Segment { Point p1, p2; };
typedef Point Vector;
typedef Segment Line;
typedef vector<Point> Polygon;

class Circle {
    public:
        Point c;
        double r;
        Circle(Point c = Point(), double r = 0.0): c(c), r(r) {}
};

double dot(Vector v1, Vector v2) {
    return v1.x * v2.x + v1.y * v2.y;
}

double cross(Vector v1, Vector v2) {
    return v1.x * v2.y - v1.y * v2.x;
}

Point project(Segment s, Point p) {
    Vector base = s.p2 - s.p1;
    double r = dot(p - s.p1, base) / base.norm();
    return s.p1 + base * r;
}

Point reflect(Segment s, Point p) {
    Point x = project(s, p);
    return p + (x - p) * 2;
}

int main() {
    double x0, y0, x1, y1;
    cin >> x0 >> y0 >> x1 >> y1;
    Point p0(x0, y0), p1(x1, y1);

    int q; cin >> q;
    vector<Point> ps;
    rep(i, q) {
        double x, y; cin >> x >> y;
        ps.push_back(Point(x, y));
    }

    rep(i, q) {
        Point p2 = ps[i];
        Vector a = p1 - p0;
        Vector b = p2 - p0;
        string ans = "";
        if (cross(a, b) > EPS) ans = "COUNTER_CLOCKWISE";
        else if (cross(a, b) < -EPS) ans = "CLOCKWISE";
        else if (dot(a, b) < -EPS) ans = "ONLINE_BACK";
        else if (a.norm() < b.norm()) ans = "ONLINE_FRONT";
        else ans = "ON_SEGMENT";
        cout << ans << endl;
    }
}



Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define N 100000+10

using namespace std;

typedef long long ll;

int main()
{
    int a[N];
    int n,x;
    while(cin>>n)
    {
        memset(a,0,sizeof(a));
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&x);
            if(x==i)
                a[i]=1;
        }
        int ans=0,cnt=0;
        int i=1;
        while(i<=n)
        {
            if(a[i]==0)
            {
                i++;
                ans+=(cnt+1)/2;
                cnt=0;
                continue;
            }
            while(a[i]==1)
                cnt++,i++;
        }
        ans+=(cnt+1)/2;
        cout<<ans<<endl;
    }
    return 0;
}


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

int main(){
	long long a,b,c,k;
	cin >> a >> b >> c >> k;
	while(b <= a && k){
		k--;
		b *= 2;
	}

	while(c <= b && k){
		k--;
		c *= 2;
	}

	if(c > b && b > a)
		cout << "Yes";
	else
		cout << "No";
}


Measured memory_bytes: 3644
n=int(input())
a=list(map(int,input().split()))
m=1 
l=1
for i in range(1, n) : 
    if (a[i]<=a[i-1]) : 
            l=l+1 
    else : 
        if (m<l): 
            m=l 
        l=1
if (m<l) : 
    m=l 
print(m-1)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

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

    vector<ll> as, ss;
    as.push_back(1000);
    ss.push_back(0);

    rep(i, n - 1) {
        if (v[i] == v[i + 1])continue;
        else if (v[i] > v[i + 1]) {
            ll t = ss.back() * v[i];
            as.push_back(as.back() + t);
            ss.push_back(0);
        } else {
            ll t = as.back() / v[i];
            as.push_back(as.back() - t * v[i]);
            ss.push_back(ss.back() + t);
        }
    }

    ll t = v.back() * ss.back();
    as.push_back(as.back() + t);
    ss.push_back(0);

    ll ans = *max_element(as.begin(), as.end());
    cout << ans << endl;

}


Measured memory_bytes: 3636
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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 DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, c; cin >> a >> b >> c;
    if (c - a - b < 0) cout << "No\n";
    else if (4 * a * b < (c - a - b) * (c - a - b)) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 256