akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created: 日  1/13 21:06:07 2019

# Usage
#
"""
import sys

def get_input():
    i = input().split(" ")
    return [int(x) for x in i]

def solve(i):
    ch =i.count(1) * i.count(7) * i.count(9) * i.count(4) 
    if ch > 0:
        print("YES")
    else:
        print("NO")

if __name__ == '__main__':
    solve(get_input())


Measured memory_bytes: 3060
N = int(input())
S = [int(i) for i in input().split()]

answer = 0
isExsistOdd = False

while True:
    for i in S:
        if i % 2 != 0:
            isExsistOdd = True
            break
    if isExsistOdd:
        break
    for i in range(N):
        S[i] /= 2
    answer += 1

print(answer)


Measured memory_bytes: 2940
def combination(total, selected):
    foo = 1
    for i in xrange(selected):
        foo *= total-i
        foo /= i+1
    return foo

def process(a, p):
    odds = 0
    even = 0
    for x in a:
        if (x%2)==0:
            even += 1
        else:
            odds += 1
    foo = 0
    for i in xrange(p, odds+1, 2):
        foo += combination(odds, i)
    foo *= 1<<even
    return foo

def main():
    n, p = [int(x) for x in raw_input().strip().split()]
    a = [int(x) for x in raw_input().strip().split()]
    print process(a, p)

if __name__ == '__main__':
    main()

Measured memory_bytes: 2692
#include <iostream>
#include <string>

using namespace std;

int main() {
	int n, m;
	string s[17] = {"Man", "Oku", "Cho", "Kei", "Gai", "Jo", "Jou", "Ko", "Kan",
					"Sei", "Sai", "Gok", "Ggs", "Asg", "Nyt", "Fks", "Mts"};
	while(cin >> n >> m) {
		if (n == 0 && m == 0) {
			break;
		}
		int d[18] = {0};
		d[0] = n;
		for (int i = 1; i < m; i++) {
			for (int j = 0; j < 18; j++) {
				d[j] *= n;
			}
			int p = 0;
			for (int j = 0; j < 18; j++) {
				d[j] += p;
				p = d[j]/10000;
				d[j] %= 10000;
			}
		}
		for (int i = 17; i >= 0; i--) {
			if (d[i] > 0) {
				cout << d[i];
				if (i != 0) {
					cout << s[i-1];
				} 
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
import sys
import math
import itertools as it
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n = i()
s = [input() for _ in range(n)]
s.sort()
ss = list(set(s))
ss.sort()
a = [0]*len(ss)
i = 0
j = 0
while n-1 > i:
    if s[i] == s[i+1]:
        a[j] += 1
        i += 1
    else:
        i += 1
        j += 1
m = max(a)
for k in range(len(a)):
    if m == a[k]:
        print(ss[k])


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

int main() {
	int N; cin >> N;
	vector<int64_t> L(N+1);
	L.at(0) = 2;
	L.at(1) = 1;
	for (int i = 2; i <= N; i++)
	{
		L.at(i) = L.at(i - 1) + L.at(i - 2);
	}
	cout << L.at(N) << endl;
}

Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <utility>
#include <algorithm>
#include <map>
#include <cassert>
using namespace std;

const int maxn = 1e5 + 5;
int n, k, h[maxn], cost[maxn];

int main() {
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> h[i];
    for (int i = 1; i < n; i++) cost[i] = 1e9;
    cost[0] = 0;
    for (int i = 1; i < n; i++) {
        for (int j = 1; j <= min(i, k); j++) {
            cost[i] = min(cost[i], cost[i - j] + abs(h[i] - h[i - j]));
        }
    }
    cout << cost[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main() {
	int A, B, C, K;
	cin >> A >> B >> C >> K;
	if (K <= A) {
		cout << K << endl;
	}
	else if (K <= A + B) {
		cout << A << endl;
	}
	else {
		cout << A - (K - A - B) << endl;
	}
}

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){
    string S;
    string T;
    int N;

    cin >> S >> T;
    cin >> N;

    int s_s, s_e, t_s, t_e;

    int S_asum[1000000+1];
    S_asum[0] = 0;
    for(int j=1;j<=S.length();j++){
        S_asum[j] = S_asum[j-1] + S[j -1] - 'A' + 1;
    }
    int T_asum[1000000+1];
    T_asum[0] = 0;
    for(int j=1;j<=T.length();j++){
        T_asum[j] = T_asum[j-1] + T[j -1] - 'A' + 1;
    }

    for(int i=0;i<N;i++){

        cin >> s_s >> s_e >> t_s >> t_e;
        int s_tmp = 0;
        int t_tmp = 0;

        s_tmp = S_asum[s_e] - S_asum[s_s-1];
        t_tmp = T_asum[t_e] - T_asum[t_s-1];

        string ans = "NO";
        if((s_tmp - t_tmp) % 3 == 0){
            ans = "YES";
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 5376
#include <iostream>

using namespace std;

int main(){
  string str;
  int i, j = 1, n;
  cin >> n;
  cin >> str;
  
  for(i = 0 ; i < n-1 ; i++){
    if(str[i] != str[i+1]){
		j++;
    }
  }

  cout << j << endl;

  return 0;
}

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

public class Main{
	
	static final Scanner s=new Scanner(System.in);
	
	public static void main(String[] __){
		int[] ar=new int[26];
		for(char c:s.next().toCharArray())
			ar[c-'a']++;
		System.out.println(Arrays.stream(ar).anyMatch(i->i%2==1)?"No":"Yes");
	}
}

Measured memory_bytes: 26708
#include<iostream>
#include<cstdio>
#include<complex>
#include<cmath>
#include<algorithm>
#include<utility>
#include<stack>
using namespace std;

pair<int,int> P[100000];
int ANS[100000];
int numa=0;

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

  int x,y;
  for(int i=0;i<n;i++){
    cin >> x >> y;
    P[i]=make_pair(y,x);
  }

  sort(P,P+n);
  ANS[0]=0;
  ANS[1]=1;
  numa=2;

  int s,e,t,x1,x2,y1,y2;
  for(int i=2;i<n;i++){
    s=numa;
    e=0;
    while(s-e>1){
      t=(s+e)/2;
      y1=P[ANS[t-1]].first-P[ANS[t]].first;
      x1=P[ANS[t-1]].second-P[ANS[t]].second;
      y2=P[i].first-P[ANS[t]].first;
      x2=P[i].second-P[ANS[t]].second;
      if(x1*y2-x2*y1<=0)e=t;
      else s=t;
    }
    numa=s+1;
    ANS[s]=i;
  }
  /*
 for(int i=0;i<numa;i++){
    cout << P[ANS[i]].second <<
      " " << P[ANS[i]].first << endl;
  }
  */
  ANS[s+1]=n-2;
  numa++;
  int half=s;
  for(int i=n-3;i>=0;i--){
    s=numa;
    e=half;
    while(s-e>1){
      t=(s+e)/2;
      y1=P[ANS[t-1]].first-P[ANS[t]].first;
      x1=P[ANS[t-1]].second-P[ANS[t]].second;
      y2=P[i].first-P[ANS[t]].first;
      x2=P[i].second-P[ANS[t]].second;
      if(x1*y2-x2*y1<=0)e=t;
      else s=t;
    }
    numa=s+1;
    ANS[s]=i;
  }
  
  cout << numa-1 << endl;
  for(int i=0;i<numa-1;i++){
    cout << P[ANS[i]].second <<
      " " << P[ANS[i]].first << endl;
  }
}



  

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, b, x;
    cin >> a >> b >> x;
    ll res = (b/x) - (a/x);
    //cout << b / x << endl;
   // cout << a / x << endl;
    if(a%x == 0){
        res++;
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void) {
  int n;
  int data[100][100];

  while(1) {
    cin >> n;
    if(n == 0) break;
    for(int i = 0; i < n; i++) {
      for(int j = 0; j < n; j++) {
	cin >> data[i][j];
      }
    }

    data[n][n] = 0;
    for(int i = 0; i < n; i++) {
      data[i][n] = 0;
      for(int j = 0; j < n; j++) {
	data[i][n] += data[i][j];
      }
      data[n][n] += data[i][n];
    }
    for(int j = 0; j < n; j++) {
      data[n][j] = 0;
      for(int i = 0; i < n; i++) {
	data[n][j] += data[i][j];
      }
    }
    
    for(int i = 0; i <= n; i++) {
      for(int j = 0; j <= n; j++) {
	printf("%5d", data[i][j]);
      }
      cout << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        for(int i=1;;i++){
            int x = sc.nextInt();

            if(x==0){
                break;
            }else{
                System.out.printf("Case %d: %d\n",i,x);
            }
        }

        sc.close();
        }
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

int c[3][3];

int main() {
    rep(i, 3) rep(j, 3) cin >> c[i][j];

    rep(i, 3) {
        int j = (i + 1) % 3;
        if (c[i][0] - c[j][0] != c[i][1] - c[j][1] || c[i][0] - c[j][0] != c[i][2] - c[j][2]) {
            cout << "No" << endl;
            return 0;
        }
    }

    rep(i, 3) {
        int j = (i + 1) % 3;
        if (c[0][i] - c[0][j] != c[1][i] - c[1][j] || c[0][i] - c[0][j] != c[2][i] - c[2][j]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#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 SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main() {
    int n;
    int x[101];

    cin >> n;
    REP(i, n) {
        cin >> x[i];
    }

    ll res = INF;
    FOR(i, 1, 100) {
        ll tot = 0;
        REP(j, n) {
            tot += pow(i - x[j], 2);
        }
        res = min(res, tot);
    }
    cout << res << endl;
    return 0;
}

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

int main() {
   int n,m,x,y;
   cin >> n >> m >> x >> y;
   int l=-110,r=110;
   rep(i,n){
      int xi; cin >> xi;
      l=max(xi,l);
   }
   rep(i,m){
      int yi; cin >> yi;
      r=min(yi,r);
   }
   if(l<r&&r>x&&l<y)
   cout << "No War" << endl;
   else 
   cout << "War" << endl;
}

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

using namespace std;
typedef vector<int> VI;
typedef long long LL;
typedef pair<int,int> PI; 
typedef pair<LL,LL> PLL;
typedef unsigned long long ULL;
typedef pair<double,double> PD;

#define FOR(x, b, e) for(int x = b; x<= (e); x++)
#define FORD(x, b, e) for(int x = b; x>= (e); x--)
#define REP(x, n) for(int x = 0; x<(n); ++x)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(x) ((int)(x).size())

#define PB push_back
#define IN insert
#define ST first
#define ND second
#define INF 2000000011
#define MOD 1000000007

#define MAXSIZE 100010
int n;
int tab[MAXSIZE];
int dp[MAXSIZE];

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	cin>>n;
	FOR(i,1,n)
		cin>>tab[i];
	
	dp[2]=abs(tab[1]-tab[2]);
	
	FOR(i,3,n)
		dp[i]=min(dp[i-1]+abs(tab[i]-tab[i-1]),dp[i-2]+abs(tab[i]-tab[i-2]));
	
	cout<<dp[n];
	
	return 0;
}


Measured memory_bytes: 1024
import java.util.*;
import static java.util.Arrays.*;

public class Main {

	int[] xs, ys;

	void run(){
		Scanner in = new Scanner(System.in);
		for(;;){
			int N = in.nextInt();
			if(N == 0) return ;
			xs = new int[N];
			ys = new int[N];
			for(int i=0; i<N; i++){
				xs[i] = in.nextInt();
			}
			for(int i=0; i<N; i++){
				ys[i] = in.nextInt();
			}
			System.out.println(solve()?"Yes":"No");
		}
	}

	boolean solve(){
		int N = xs.length;
		int px = 0, qx = N-1;
		int py = 0, qy = N-1;
		int putX = 0, putY = 0;
		sort(xs);
		sort(ys);
		for(;;){
			int X = qx - px + 1, Y = qy - py + 1;
			if(X>0 && xs[px] == putY){
				px++;
			}
			else if(X>0 && xs[qx] == Y + putY){
				qx--;
				putX++;
			}
			else if(Y>0 && ys[py] == putX){
				py++;
			}
			else if(Y>0 && ys[qy] == X + putX){
				qy--;
				putY++;
			}
			else{
				return X==0 && Y==0;
			}
		}
	}

	public static void main(String args[]){
		new Main().run();
	}
}

Measured memory_bytes: 12000
void main() {
	auto N = ri;
	auto A = readAs!(int[]);
	auto L = new int[](N);
	auto R = new int[](N);

	L.front = A.front;
	R.back = A.back;
	foreach(i; 1..N) {
		L[i] = gcd(L[i-1], A[i]);
	}
	foreach_reverse(i; 0..N-1) {
		R[i] = gcd(R[i+1], A[i]);
	}
	ulong res;
	foreach(i; 0..N) {
		if(i == 0) { res = R[1]; continue; }
		if(i == N-1) { res = max(res, L[N-2]); continue; }
		res = max(res, gcd(L[i-1], R[i+1]));
	}
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 4392
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for(i=0;i<VMAX;i++)
    C[i]=0;
  for(i=0;i<n;i++){
    scanf("%d",&A[i+1]);
    C[A[i+1]]++;
  }
  for(i=1;i<=VMAX;i++)
    C[i]=C[i]+C[i-1];
  for(j=1;j<=n;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=1;i<=n;i++){
    if(i>1)printf(" ");
    printf("%hu",B[i]);
  }
  printf("\n");
  return 0;
}



Measured memory_bytes: 9624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/agc037_a.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  string S;
  cin >> S;

  int N = S.size();

  vector<int> g(N);
  set<char> s = {S[0], S[1], S[2]};

  g[0] = 1;
  g[1] = S[0] == S[1] ? 1 : 2;
  g[2] = S[1] == S[2] ? 2 : g[1] + 1;

  repi(i, 3, N) {
    if (S[i] != S[i - 1]) {
      g[i] = g[i - 1] + 1;
    } else {
      g[i] = g[i - 3] + 2;
    }
  }

  cout << g[N - 1] << endl;
}

Measured memory_bytes: 4392
#include <stdio.h>

int main(){
  int a, b, c, d, e;
  
  scanf("%d %d %d %d %d\n", &a, &b, &c, &d, &e);
  
  if(a==0){
    printf("1\n");
  }else if(b==0){
    printf("2\n");
  }else if(c==0){
    printf("3\n");
  }else if(d==0){
    printf("4\n");
  }else{
    printf("5\n");
  }
  
  return 0;
}


Measured memory_bytes: 1620
# coding:utf-8
n, m = map(int, input().split())
h = list(map(int, input().split()))
peak = [0] * n
load = [0] * n
ans = 0

for i in range(m):
    a, b = map(int, input().split())
    load[a - 1] += 1
    load[b - 1] += 1
    if h[a - 1] > h[b - 1]:
        peak[a - 1] += 1
    elif h[b - 1] > h[a - 1]:
        peak[b - 1] += 1

# print(peak)
# print(load)

for i in range(n):
    if peak[i] == load[i] and peak[i] != 0:
        ans += 1

ans += load.count(0)
print(ans)


Measured memory_bytes: 19912
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
ll mod                = 1e9 + 7;
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int main(){
	int n;
	ll ans=0LL;
	cin >>n;
	V a(n);
	cin >> a;

	rep(i, n) { ans += a[i];
		ans %= mod;
	}
	ans *= ans;
	ans %= mod;
	rep(i, n) { ans -= a[i] * a[i];
		ans %= mod;
		ans += mod;
		ans %= mod;
	}
	cout<<ans*modinv(2,mod)%mod<<endl;
}

Measured memory_bytes: 4836
while True:
    x = list(map(int,input().split(' ')))
    if x[0] + x[1] + x[2] == -3:
        break
    elif x[0] == -1 or x[1] == -1:
        print('F',end='\n')
    elif x[0] + x[1] >= 80:
        print('A',end='\n')
    elif x[0] + x[1] >= 65 and x[0] + x[1] < 80:
        print('B', end='\n')
    elif x[0] + x[1] >= 50 and x[0] + x[1] < 65:
        print('C', end='\n')
    elif x[0] + x[1] >= 30 and x[0] + x[1] < 50 and x[2] < 50:
       print('D', end='\n')
    elif x[0] + x[1] >= 30 and x[0] + x[1] < 50 and x[2] >= 50:
        print('C', end='\n')
    elif x[0] + x[1] < 30:
        print('F', end='\n')



Measured memory_bytes: 5604
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  k = min(k, n);
  long long sum = 0;
  for (int i = 0; i < n - k; i++) {
    sum += arr[i];
  }
  cout << sum <<  endl;
  return 0;
}


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

int x[1000][5];//0=left,1=right,2=parent,3=sibling;

void S1(int u){
	if(u==-1){
		return;
	}
	cout<<' '<<u;
	S1(x[u][0]);
	S1(x[u][1]);
}

void S2(int u){
	if(u==-1){
		return;
	}
	S2(x[u][0]);
	cout<<' '<<u;
	S2(x[u][1]);
}

void S3(int u){
	if(u==-1){
		return;
	}
	S3(x[u][0]);
	S3(x[u][1]);
	cout<<' '<<u;
}

int main(){
	memset(x,-1,sizeof(x));
	int n,a,c;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;
		cin>>x[a][0]>>x[a][1];
		x[x[a][0]][2]=a;
		x[x[a][1]][2]=a;
		x[x[a][0]][3]=x[a][1];
		x[x[a][1]][3]=x[a][0];
	}
	cout<<"Preorder"<<endl;
	for(int i=0;i<n;i++){
		if(x[i][2]==-1){
			c=i;
			break;
		}
	}
	S1(c);cout<<endl;
	cout<<"Inorder"<<endl;
	S2(c);cout<<endl;
	cout<<"Postorder"<<endl;
	S3(c);cout<<endl;
	return 0;
}



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

#define REP(i,n) for(int i=0;i<n;i++)
typedef long long int lli;
typedef pair<int, int> P;

lli dp[100002];

int main() {
    lli n, k;
    cin >> n >> k;
    lli h[n+1];
    for (int i = 1; i <= n; i++) {
        cin >> h[i];
    }

    dp[1] = 0;
    dp[2] = abs(h[2]-h[1]);
    for (lli i = 3; i <= n; i++) {
        lli cost = LLONG_MAX;
        for (int j=1; j <= k; j++) {
            if (i-j <= 0)
                continue;
            cost = min(cost, dp[i-j]+abs(h[i-j]-h[i]));
        }
        dp[i] = cost;
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 1792
N = int(input())
adj = [[] for i in range(N)]
for _ in range(N - 1):
    u, v = map(int, input().split())
    adj[u-1].append(v-1)
    adj[v-1].append(u-1)

parents = [-1] * N

q = [0]
while q:
    nex = q.pop()
    for v in adj[nex]:
        if v and parents[v] == -1:
            parents[v] = nex
            q.append(v)

out = N
for i in range(1, N):
    p = parents[i]
    if p < i:
        out += (i - p) * (N - i)
    else:
        out += (i + 1) * (p - i)
print(out)


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

using namespace std;

struct P{
  int a,b;
  string c;
  
  P(int a,int b,string c) : a(a),b(b),c(c) {}
  bool operator < (const P &p)const{
    if(a != p.a){
      return a > p.a;
    }else{
      return b < p.b;
    }
  }
};

int main(){
  string str,s;
  map<string,string> mp;
  mp["e"] = "egg";
  mp["c"] = "chicken";
  cin >> str;
  for(int i = 0 ; i < (int)str.size() ; i++){
    if(str[i] == 'e'){
      i += 2;
      s += 'e';
    }else{
      i += 6;
      s += 'c';
    }
  }
  int size = s.size();
  if(size == 1){
    cout << mp[s] << endl;
  }else{
    vector<P> vec;
    string tmp; tmp += s[0];
    for(int i = 1 ; i < size ; i++){
      if(s[i-1] == s[i]){
        vec.push_back(P(tmp.size(),i,tmp));
        tmp = "";
      }
      tmp += s[i];
    }
    if(!tmp.empty()){
      vec.push_back(P(tmp.size(),size,tmp));
      tmp = "";
    }
    sort(vec.begin(),vec.end());
    tmp += vec[0].c[vec[0].c.size()-1];
    cout << mp[tmp] << endl;
  }
  return 0;
}

Measured memory_bytes: 1236
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<time.h>
#include<ctime>
#include<functional>
#define int long long
#define INT INT_MAX
#define LONG LLONG_MAX
#define f(i,n) for(int i=0;i<(n);i++)
#define P pair<int,int>
typedef long long ll;
using namespace std;

char mutu(int a,int b) {
	if (a > b) return '>';
	else return '<';
}

signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b && b == c && !(a % 2 || b % 2 || c % 2)) puts("-1");
	else {
		int n = 0;
		while (!(a%2||b%2||c%2)) {
			int x = a, y = b, z = c;
			a = (y + z) / 2;
			b = (x + z) / 2;
			c = (y + z) / 2;
			n++;
		}
		cout << n << endl;
	}
	getchar();
	getchar();
	return 0;
}

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

public class Main {
	public static void main(String args[]) throws IOException {
		Scanner scanner = new Scanner(System.in);
		int length = scanner.nextInt();
		int side = scanner.nextInt();
		System.out.println(length * side + " " + ((length * 2) + (side * 2)));
	}
}

Measured memory_bytes: 17320
#include <iostream>
using namespace std;
int main(void){
    string s, t;
    cin >> s >> t;
    for(int i=0; i<s.size(); i++){
        if(s.at(i)!=t.at(i)){
            printf("No");
            return 0;
        }
    }
    if(t.size()==s.size()+1){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 3688
# define _CRT_SECUREj_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) (x).begin(),(x).end()
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<":"<<x<<endl;
# define EPS 1e-12
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
typedef long long lint;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
const int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }

const int M = 100010;


int main()
{
	lint ans = 0;
	lint n;
	lint a[M] = {};
	cin >> n;
	FORI(i, 1, n + 1)
	{
		cin >> a[i];
	}

	FORI(i, 1, n)
	{
		if (a[i] % 2 && a[i + 1])
		{
			ans++;
			a[i]--;
			a[i + 1]--;
		}
	}

	FORI(i, 1, n + 1)
	{
		ans += a[i] / 2;
	}

	cout << ans << endl;
}

Measured memory_bytes: 1024
// D

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
//最大公約数
ll gcd(ll a,ll b) {
  if (b == 0){
    return a;
  }
  return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}

int main(){
  ll N,M,A[100000],B[100000] = {0};
  cin>>N>>M;
  for (int i(0);i<N;i++){
    cin>>A[i];
    int x = A[i]/2;
    while (x%2==0){
      B[i]++;
      x/=2;
    }
  }
  for (int i(1);i<N;i++){
    if (B[i] != B[i-1]){
      cout << 0 << endl;
      return 0;
    }
  }
  //cout << "aaa" << endl;
  ll t;
  if (N==1) t = A[0]/2;
  else {
    t = lcm(A[0]/2,A[1]/2);
    for (int i(2);i<N;i++){
      t = lcm(t,A[i]/2);
      if (t>M){
        cout << 0 << endl;
        return 0;
      }
    }
    //cout << t << endl; 
  }
  cout << (M / t + 1)/2 << endl;;
  return 0;
}


Measured memory_bytes: 1792
n = int(input())
alist = [int(input()) for _ in range(n)]

import copy
alist_copy = copy.copy(alist)

alist_copy.sort()
max_value = alist_copy[-1]
next_value = alist_copy[-2]
for a in alist:
    if a == max_value:
        print(next_value)
    else:
        print(max_value)

Measured memory_bytes: 19128
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using ii = pair<int, int>;
template <class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

// debug
template <class T> ostream& operator<<(ostream &s, vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream &s, vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream &s, pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }

struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
constexpr int MOD = 1000000007;
// *************** TEMPLATE END *************** 

signed main() {
  int n, D; cin >> n >> D;
  int acc = 0;
  REP (i, n) {
    int a; cin >> a;
    acc ^= (a - 1) % (D + 1);
  }
  cout << (acc ? "First" : "Second") << endl;
}



Measured memory_bytes: 3192
class Game
  def initialize
    @card_num = 0
    @a_cards = []
    @b_cards = []
    @a_total = 0
    @b_total = 0
  end

  def input card_num
    @card_num = card_num
    card_num.times do
      a,b = gets.chomp.split(' ').map{|x|x.to_i}
      @a_cards << a
      @b_cards << b
    end
  end

  def exec
    @card_num.times do |idx|
      if @a_cards[idx] > @b_cards[idx]
        @a_total = @a_total + @a_cards[idx] + @b_cards[idx]
      elsif @a_cards[idx] < @b_cards[idx]
        @b_total = @b_total + @a_cards[idx] + @b_cards[idx]
      else
        @a_total += @a_cards[idx]
        @b_total += @b_cards[idx]
      end
    end
  end

  def print
    puts "#{@a_total} #{@b_total}"
  end
end

class AllGame
  def initialize
    @game_num = 0
    @games = []
  end

  def input
    loop do
      card_num = gets.chomp.to_i
      return @game_num if card_num == 0
      game = Game.new
      game.input card_num
      @games << game
      @game_num += 1
    end
  end

  def exec
    @games.each do |game|
      game.exec
    end
  end

  def print
    @games.each do |game|
      game.print
    end
  end

  attr_accessor :games
end

all_game = AllGame.new
all_game.input
all_game.exec
all_game.print

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

using namespace std;
using   ll=long long;

#define fast            ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define endl            "\n"
#define pb              push_back
#define mp              make_pair
#define F               first
#define S               second
#define int             long long int
#define pll                pair<int , int>

#define ALL(v)          v.begin(),v.end()
#define ALLR(v)         v.rbegin(),v.rend()
#define pii             3.14159265358979323
#define inf             LLONG_MAX
#define ones(x)         __builtin_popcount(x)
#define fill(a,b)       memset(a,b,sizeof(a))
#define mod             1000000007
#define hell            998244353

ll mod_pow(ll a,ll b,ll m)
{
    ll res = 1;
    while(b)
    {
        if(b&1)
        {
            res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a)
{
    return mod_pow(a , mod-2 , mod);
}

void solve()
{
	int d , t , s;
	
	cin >> d >> t >> s;
	
	if(d/s + (d%s>0) <= t) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}

signed main() {
    fast;

    int t = 1;
   
    //cin >> t;

    while(t--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3580
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    char s[4];

    scanf("%s", s);

    int a = 0;
    
    a += (s[0] == '1');
    a += (s[1] == '1');
    a += (s[2] == '1');

    printf("%d\n", a);

    return 0;
}

Measured memory_bytes: 1608
#include<stdio.h>
int main()
{
    int i,j,n,h;
    char card[200],copy[200];

    while(1)
    {
        scanf("%s",&card);
        if(card[0]=='-')break;  
        scanf("%d",&n);
        while(n--)
        {
            scanf("%d",&h);
            for(i=0;i<h;i++)
            {
                copy[i]=card[i];
            }
            for(j=0;i<strlen(card);i++,j++)
            {
                card[j]=card[i];
            }
            for(i=0;i<h;i++,j++)
            {
                card[j]=copy[i];
            }
        }
        printf("%s\n",card);
    }
}



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

public class Main {

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double[] pArr = new double[n];
        for (int i = 0; i < n; i++) {
            pArr[i] = sc.nextDouble();
        }

        // dp[i][j] ... コインをiマイ投げて、jマイ表が出る確率
        double[][] dp = new double[n + 1][n + 1];
        dp[0][0] = 1;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                dp[i + 1][j + 1] = dp[i + 1][j + 1] + dp[i][j] * pArr[i];
                dp[i + 1][j] = dp[i + 1][j] + dp[i][j] * (1 - pArr[i]);
            }
        }
//        debug(dp);
        double ans = 0;
        for (int i = n; i > n / 2; i--) {
            ans += dp[n][i];
        }
        System.out.println(ans);
    }


    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 122868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    ll N;
    cin >> N;
    bool check = false;
    ll k;
    for (ll i = 1; i < 1000; i++) {
        if(i * (i+1) / 2 == N){
            check = true;
            k = i;
        }
    }
    k++;
    ll l;
    if(check){
        Yes();
        printf("%lld\n", k);
        for (ll i = 0; i < k; i++) {
            printf("%lld ", k-1);
            for (ll j = i*(i-1) / 2 + 1; j <= i*(i+1) / 2; j++) {
                printf("%lld ", j);
            }
            l = 1;
            for (ll j = i*(i+1) / 2 + i + 1; j <= N; l++) {
                printf("%lld ", j);
                j = (i+l)*((i+l)+1) / 2 + i + 1;
            }
            printf("\n");
        }
    }
    else{
        No();
    }

}

Measured memory_bytes: 3728
N, x = gets.split.map(&:to_i)
xs = gets.split.map(&:to_i)

x_min = xs.min

xs.map! { |v| v - x_min }
x -= x_min

gcd = 0
xs.each do |xx|
  gcd = gcd.gcd(xx)
end

puts gcd.gcd(x)

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

#define o(output) cout << output << endl

using namespace std;

string s,t,u;
int a,b,c,d;
int l[13]={0,1,3,1,2,1,2,1,1,2,1,2,1};
char A,B,C;
priority_queue<int,vector<int>,greater<int> >small;

int main(){
  cin >>a>>B>>c;
  if(B=='+')o(a+c);
  else o(a-c);
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long unsigned int ll;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N, 0);
  int a;
  for (int i = 0; i < N; ++i) {
    cin >> a;
    A[a - 1]++;
  }
  sort(A.rbegin(), A.rend());
  int ans = 0;
  for (int i = K; i < N; ++i) {
    ans += A[i];
  }

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


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

int main(){
  int n,m,k,i,j;
  cin >> n >> m >> k;
  for(i=0;i<=n;i++){
    for(j=0;j<=m;j++){
      if(i*j+(n-i)*(m-j)==k){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3616
n = int(input())
line = input()
L = [int(x) for x in line.split()]

flags = [False] * n
loops = []

S = sorted(L)
for idx, x in enumerate(L):
    k = S.index(x)
    if flags[k]:
        continue
    if k == idx:
        flags[k] = True
        continue

    ws = []
    while x not in ws:
        flags[k] = True
        ws.append(x)
        x = L[k]
        k = S.index(x)
    loops.append(ws)

cost = 0
for ws in loops:
    n = len(ws)
    a = sum(ws) + (n - 2) * min(ws)
    b = sum(ws) + min(ws) + (n + 1) * min(L)
    cost += min(a, b)

print(cost)

Measured memory_bytes: 5640
#include <bits/stdc++.h>
using namespace std;
#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define endl '\n'
#define MOD 1000000007
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define dbg(x) cout << #x << "  " << x << endl;
 
ll power(ll base, ll exp) 
{ll res=1;while(exp>0) {if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return res;}
ll mod(ll a, ll b) {return (a % b + b) % b;}
ll powerm(ll base,ll exp,ll mod) 
{ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
 
struct custom_hash 
{
    static uint64_t splitmix64(uint64_t x) 
	{
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const 
	{
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
/* DSU 
int find_set(int v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}
void make_set(int v) {
    parent[v] = v;
    rank[v] = 0;
}
void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (rank[a] < rank[b])
            swap(a, b);
        parent[b] = a;
        if (rank[a] == rank[b])
            rank[a]++;
    }
}
*/ 
int main()
{  
	fast; 
	ll n; cin>>n;
	cout << (1000 -  n % 1000) % 1000 << endl;
	return 0;
}

Measured memory_bytes: 3608
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
using namespace std;
#define loop(i,a,b) for(int i = a; i < b; i++)
#define rep(i,a) loop(i,0,a)
#define shosu(x) fixed<<setprecision(x)
typedef long long ll;

int main()
{	
		ll i,o,t,j,l,s,z;
		cin>>i>>o>>t>>j>>l>>s>>z;
		ll ans=0;
		
		ans+=o;
		int flg=0;
		if(i>0&&j>0&&l>0){
				ll m=min(min(i,j),l);
				i-=m;
				j-=m;
				l-=m;
				ans+=3*m;
				flg++;
		}
		if(i>=2)
				ans+=i/2*2;
		if(j>=2)
				ans+=j/2*2;
		if(l>=2)
				ans+=l/2*2;
		i=i%2;j=j%2;l=l%2;
		if((i*j || i*l || j*l) &&flg)
				ans++;
		
		cout<<ans<<endl;
		
		return 0;
}



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

using namespace std;

const double EPS = 1e-8, PI = acos(-1);

inline bool eq(double a, double b) { return fabs(b - a) < EPS; }

using Point = complex< double >;

istream &operator>>(istream &is, Point &p) {
  double a, b;
  is >> a >> b;
  p = Point(a, b);
  return is;
}

ostream &operator<<(ostream &os, Point &p) {
  os << fixed << setprecision(10) << p.real() << " " << p.imag();
}

Point rotate(double theta, const Point &p) {
  return Point(cos(theta) * p.real() - sin(theta) * p.imag(), sin(theta) * p.real() + cos(theta) * p.imag());
}

double radian_to_degree(double r) {
  return (r * 180.0 / PI);
}

double degree_to_radian(double d) {
  return (d * PI / 180.0);
}

double get_angle(const Point &a, const Point &b, const Point &c) {
  const Point v(b - a), w(c - b);
  double alpha = atan2(v.imag(), v.real()), beta = atan2(w.imag(), w.real());
  if(alpha > beta) swap(alpha, beta);
  double theta = (beta - alpha);
  return min(theta, 2 * acos(-1) - theta);
}

namespace std {
  bool operator<(const Point &a, const Point &b) {
    return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag();
  }
}


struct Line {
  Point a, b;

  Line() {}

  Line(Point a, Point b) : a(a), b(b) {}

  Line(double A, double B, double C) // Ax + By = C
  {
    if(eq(A, 0)) a = Point(0, C / B), b = Point(1, C / B);
    else if(eq(B, 0)) b = Point(C / A, 0), b = Point(C / A, 1);
    else a = Point(0, C / B), b = Point(C / A, 0);
  }

  friend ostream &operator<<(ostream &os, Line &p) {
    return os << p.a << " to " << p.b;
  }

  friend istream &operator>>(istream &is, Line &a) {
    return is >> a.a >> a.b;
  }
};

struct Segment : Line {
  Segment() {}

  Segment(Point a, Point b) : Line(a, b) {}
};

double dot(const Point &a, const Point &b) {
  return real(a) * real(b) + imag(a) * imag(b);
}

Point projection(const Line &l, const Point &p) {
  double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
  return l.a + (l.a - l.b) * t;
}

Point reflection(const Line &l, const Point &p) {
  return p + (projection(l, p) - p) * 2.0;
}

int main() {
  Line l;
  cin >> l;
  int Q;
  cin >> Q;
  while(Q--) {
    Point p;
    cin >> p;
    p = reflection(l, p);
    cout << fixed << setprecision(10) << p.real() << " " << p.imag() << endl;
  }
}



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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            long sum = 0;
            long ba = 0;
            for(var i=0;i<S.Length;i++)
            {
                if (S[i] == 'B') ba+=i;
            }
            var cnt = S.Count(c => c == 'B');
            for(var i=0;i<cnt;i++)
            {
                sum += S.Length-1-i;
            }
            Console.WriteLine(sum - ba);
        }
    }
}

Measured memory_bytes: 11744
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,l;
    cin>>n>>m>>l;
    vector<vector<long long>> a(n,vector<long long>(m,0));
    vector<vector<long long>> b(m,vector<long long>(l,0));
    vector<vector<long long>> c(n,vector<long long>(l,0));
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<m;i++){
        for(int j=0;j<l;j++){
            cin>>b[i][j];
        }
    }    
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            for(int k=0;k<m;k++){
                c[i][j]+=a[i][k]*b[k][j];
            }
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            if(j==l-1)cout<<c[i][j]<<endl;
            else cout<<c[i][j]<<" ";
        }
    }
}


Measured memory_bytes: 3152
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

  char tmp;
  set<char> s;
	for(int i=0;i<N;i++){
      cin >> tmp;
      s.emplace(tmp);
    }
  for(auto &e:s) cerr<<e<<endl;
  if(s.size()==3) cout << "Three\n";
  else cout<<"Four\n";
      

	return 0;
}


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

// プロトタイプ宣言
void vdPushBack(int **ppiList, int *piTail);
void vdDump(int **piList, int *iTail);
void vdClear(int *piTail);

// 整数を保持するn個のリストに対し、以下の操作を行う
// ・pushBack(t, x):Atの末尾にxを挿入
// ・dump(t):Atを出力
// ・clear(t):Atを空にする
int main()
{
    int **ppiList;   // 全データが入る2次元配列
    int *piTail;     // 各末尾が入る配列
    int iNumOfList;  // リスト長
    int iNumOfQuery; // 命令数
    int iQuery;      // 命令
    int iCount;      // counter
    // In: リスト長, 命令数
    scanf("%d %d", &iNumOfList, &iNumOfQuery);
    // ポインタ配列を動的確保
    ppiList = (int **)malloc(sizeof(int *) * iNumOfList);
    // 末尾配列を動的確保
    piTail = (int *)malloc(sizeof(int *) * iNumOfList);
    for (iCount = 0; iCount < iNumOfList; iCount++)
    {
        // 末尾配列を0初期化
        piTail[iCount] = 0;
        // ポインタ配列から延びる最大iNumOfQuery分のメモリを確保
        ppiList[iCount] = (int *)malloc(sizeof(int) * iNumOfQuery);
    }

    // 命令数分繰り返し
    for (iCount = 0; iCount < iNumOfQuery; iCount++)
    {
        // In: 命令, リスト番号
        scanf("%d", &iQuery);
        switch (iQuery)
        {
        case 0:
            vdPushBack(ppiList, piTail);
            break;
        case 1:
            vdDump(ppiList, piTail);
            break;
        case 2:
            vdClear(piTail);
            break;
        default:
            break;
        }
    }

    // 配列の各要素を解放
    for (iCount = 0; iCount < iNumOfList; iCount++)
    {
        free(ppiList[iCount]);
    }
    // ポインタ配列を解放
    free(ppiList);
    // 末尾配列を解放
    free(piTail);

    return 0;
}

// 配列の末尾に要素を挿入する関数
void vdPushBack(int **ppiList, int *piTail)
{
    int iArg; // 引数x
    int iListNum; // リスト番号t
    // In: リスト番号, 末尾に挿入する値
    scanf("%d %d", &iListNum ,&iArg);
    // 末尾に値を代入
    ppiList[iListNum][piTail[iListNum]] = iArg;
    // 末尾を移動
    piTail[iListNum]++;

    return;
}

// 配列の全要素を出力する関数
void vdDump(int **ppiList, int *iTail)
{
    int iListNum; // リスト番号t
    int iCount; // counter
    // In: リスト番号
    scanf("%d", &iListNum);

    for (iCount = 0; iCount < iTail[iListNum]; iCount++)
    {
        // 末尾は後ろに空白が入らない
        if (iCount == iTail[iListNum] - 1)
        {
            printf("%d", ppiList[iListNum][iCount]);
        }
        else
        {
            printf("%d ", ppiList[iListNum][iCount]);
        }
    }
    printf("\n");

    return;
}

// 配列の要素を空にする関数
void vdClear(int *piTail)
{
    int iListNum; // リスト番号t
    // In: リスト番号
    scanf("%d", &iListNum);
    // 配列の末尾を先頭にすることで要素クリア
    piTail[iListNum] = 0;

    return;
}


Measured memory_bytes: 7524
N = int(input())
H = list(map(int, input().split()))

ans = 0
tmp = 0
before = H[0]
for i in range(1, N):
    if before >= H[i]:
        tmp += 1
        before = H[i]
    else:
        ans = max(ans, tmp)
        tmp = 0
        before = H[i]

print(max(ans,tmp))

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

int main() {
	ll a, b;
	cin >> a >> b;
	string ans;
	if (a < b) {
		for (ll i = 0; i < b; ++i) {
			ans += to_string(a);
		}
	}
	else {
		for (ll i = 0; i < a; ++i) {
			ans += to_string(b);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

const int Mod = 1000000007;

int main()
{
	int i, H, W;
	char a[1002][1002] = {};
	scanf("%d %d", &H, &W);
	for (i = 1; i <= H; i++) scanf("%s", &(a[i][1]));
	
	int j;
	long long dp[1002][1002] = {};
	for (i = 1, dp[1][1] = 1; i <= H; i++) {
		for (j = 1; j <= W; j++) {
			if (a[i][j+1] == '.') dp[i][j+1] = (dp[i][j+1] + dp[i][j]) % Mod;
			if (a[i+1][j] == '.') dp[i+1][j] = (dp[i+1][j] + dp[i][j]) % Mod;
		}
	}
	printf("%lld\n", dp[H][W]);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 10552
use std::io;


fn main() {
    let (a, b, c, d) = {
        let i = read::<isize>();
        (i[0], i[1], i[2], i[3])
    };

    if ((a - b).abs() <= d && (b - c).abs() <= d) || (a - c).abs() <= d {
        println!("Yes");
    } else {
        println!("No");
    }
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352