akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <climits>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <bitset>
#include <fstream>
#include <tr1/unordered_map>
#include <assert.h>

#define x first
#define y second
#define y0 Y0
#define y1 Y1
#define mp make_pair
#define pb push_back
#define DEBUG(x) cout << #x << " = " << x << endl;

using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

template <typename T> inline int Chkmax (T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline int Chkmin (T &a, T b) { return a > b ? a = b, 1 : 0; }
template <typename T> inline T read ()
{
	T sum = 0, fl = 1; char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
	return sum * fl;
}

inline void proc_status ()
{
	ifstream t ("/proc/self/status");
	cerr << string (istreambuf_iterator <char> (t), istreambuf_iterator <char> ()) << endl;
}

const int MAXN = 3000;
const int MOD = 1e9 + 7;

inline void ADD (int &a, int b) { if ((a += b) >= MOD) a -= MOD; }

int N, Q;
int A[MAXN + 5], pw[MAXN + 5];
int F[MAXN + 5][MAXN + 5];
int lst[MAXN + 5][MAXN + 5];

inline int trans (int i, int x, int y)
{
	if (i == x) return y;
	if (i == y) return x;
	return i;
}

inline void Solve ()
{
	pw[0] = 1;
	for (int i = 1; i <= MAXN; ++i) pw[i] = 2ll * pw[i - 1] % MOD;

	for (int i = 1; i <= N; ++i) for (int j = 1; j <= N; ++j) if (A[i] > A[j])
		F[i][j] = 1;

	for (int t = 1; t <= Q; ++t)
	{
		int x = read<int>(), y = read<int>();

		static pii stk[MAXN * 5 + 5];
		int top = 0;

		for (int i = 1; i <= N; ++i) if (i != x && i != y)
		{
			stk[++top] = mp (x, i), stk[++top] = mp (i, x);
			stk[++top] = mp (y, i), stk[++top] = mp (i, y);
		}

		stk[++top] = mp (x, y), stk[++top] = mp (y, x);

		static int G[MAXN * 5 + 5];

		for (int p = 1; p <= top; ++p)
		{
			int i = stk[p].x, j = stk[p].y;
			int di = trans (i, x, y), dj = trans (j, x, y);

			G[p] = ((LL) F[i][j] * pw[t - lst[i][j] - 1] % MOD + (LL) F[di][dj] * pw[t - lst[di][dj] - 1] % MOD) % MOD;
		}

		for (int p = 1; p <= top; ++p)
		{
			int i = stk[p].x, j = stk[p].y;
			F[i][j] = G[p];
			lst[i][j] = t;
		}
	}

	int ans = 0;
	for (int i = 1; i < N; ++i) for (int j = i + 1; j <= N; ++j)
	{
//		cout << i << ' ' << j << ' ' << F[i][j] << endl;
		F[i][j] = (LL) F[i][j] * pw[Q - lst[i][j]] % MOD;
		ADD (ans, F[i][j]);
	}

	cout << ans << endl;
}

inline void Input ()
{
	N = read<int>(), Q = read<int>();
	for (int i = 1; i <= N; ++i) A[i] = read<int>();
}

int main ()
{

#ifdef hk_cnyali
	freopen("D.in", "r", stdin);
	freopen("D.out", "w", stdout);
#endif

	Input ();
	Solve ();

	return 0;
}



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

using namespace std;

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

    int A,B; cin>>A>>B;
    int ans = B;
    if (A < 13)
        ans /= 2;
    if (A <= 5)
        ans = 0;
    cout << ans << endl;
    
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;

const ll INF = 1LL << 60;
const int MOD = 1e9 + 7;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, b, e) for (int i = (b); i <= (e); i++)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

ll xor_sum(ll n) {
    switch (n % 4) {
        case 0:
            return n;
        case 1:
            return 1;
        case 2:
            return n ^ 1;
        case 3:
            return 0;
    }
}

int main() {
    ll A, B;
    cin >> A >> B;

    ll ans = xor_sum(A-1) ^ xor_sum(B);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import numpy as np

A = np.zeros(10001, dtype=np.bool)
A[0] = 1
N = int(input())
for _ in range(N):
    s = int(input())
    A[s:] = np.logical_or(A[s:], A[:-s])

A[10::10] = 0
answer = A.nonzero()[0].max()
print(answer)


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

// #LIB#

using namespace std;
using ll = long long;
#define double long double
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#ifdef ONLINE_JUDGE
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');
#endif

int main() {
  ll n, k;
  cin >> n >> k;
  ll en = (n - 1) * (n - 2) / 2 - k;
  if (en < 0) {
    cout << -1 << endl;
    return 0;
  }
  cout << n - 1 + en << endl;
  repr(i, 1, n) cout << n << " " << i << endl;
  repr(i, 1, n) repr(j, i + 1, n) {
    if (en-- <= 0) goto end;
    cout << i << " " << j << endl;
  }
end:
  0;
}


Measured memory_bytes: 3616
#include <iostream>
using namespace std;
int a, b, c, d, e, f, w[6005]={1}, s[3035]={1}, mw, ms;
double mr;
int main() {
	int i, j;
	cin>>a>>b>>c>>d>>e>>f;
	for(i=0; i<f; i++) {
		if(w[i]) w[i+a*100] = w[i+b*100] = 1;
		if(s[i]) s[i+c] = s[i+d] = 1;
	}
	mw = a*100;
	for(i=100; i<f; i+=100) if(w[i]) {
		for(j=0; i+j<=f && j<=i/100*e; j++) if(s[j]) {
			if(j*(100+e) > e*(i+j)) break;
			if(1.*j/(i+j) > mr) {
				mr = 1.*j/(i+j);
				mw = i+j;
				ms = j;
			}
		}
	}
	cout<<mw<<' '<<ms;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int n;
long long a[200005];
int main(){
  std::cin>>n;
  for(int i=0;i<n;++i)
    std::cin>>a[i];
  
  for(int i=n-1;i>=0;i-=2)
    std::cout<<a[i]<<' ';
  for(int i=(n%2==0?0:1);i<=n-1;i+=2){
    std::cout<<a[i];
    if(i+2>n-1)
      std::cout<<std::endl;
    else
      std::cout<<' ';
  }
  
  return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
main(){
  int n;
  string s;
  cin>>n>>s;
  int cntw=0,cnte=0;
  for(int i=0;i<s.size();++i){
    if(s[i]=='E') ++cnte;
    else ++cntw;
  }
  int changee=cnte;
  int changew=0;
  int minc=1000000;
  for(int i=0;i<s.size();++i){
    minc=min(minc,abs(changew+changee));
    if(s[i]=='W'){
      changew++;
    }else changee--;
  }
    minc=min(minc,abs(changew+changee));
  cout<<minc<<endl;
  return 0;
}


Measured memory_bytes: 900
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>

int main()
{
	int n, k;
	scanf("%d %d", &n, &k);
	int ans = 0;
	while (n > 0)
	{
		n /= k;
		ans += 1;
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class CVacation {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int[] inf = new int[3];
            int[] dp = new int[3];
            for (int i = 0; i < N; ++i) {
                inf[0] = in.nextInt();
                inf[1] = in.nextInt();
                inf[2] = in.nextInt();
                int[] newday = new int[3];
                for (int j = 0; j < 3; j++) {
                    for (int k = 0; k < 3; k++) {
                        if (j != k) {
                            newday[k] = Math.max(newday[k], dp[j] + inf[k]);
                        }
                    }
                }
                for (int j = 0; j < 3; j++) {
                    dp[j] = newday[j];
                }
            }
            int ans = 0;
            for (int i = 0; i < 3; i++) {
                ans = Math.max(ans, dp[i]);
            }
            out.print(ans);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 27448
while True:
  a, b = map(int, input().split())
  if a == b == 0:
    break

  for i in range(a):
    if i % 2 == 0:
      for j in range(b):
        if j % 2 == 0:
          print('#', end = '')
        else:
          print('.', end = '')
      print()
    else:
      for j in range(b):
        if j % 2 == 0:
          print('.', end = '')
        else:
          print('#', end = '')
      print()
  print()


Measured memory_bytes: 7004
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
#include<unordered_map>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tuple<int,int> tii;
#define rep(i,n) for(int i=0;i<(n);i++)  
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV int(1e9+7)
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
/* Coding Space*/
int main(){
  ll n; cin >> n;
  vector<ll> a(3*n);
  rep(i,3*n)cin >> a[i];
  vector<ll> left_sum;
  ll lsum = 0;
  {
  priority_queue<int,vi,greater<int>> pq;
  rep(i,3*n){
    if((int)pq.size() < n)
      pq.push(a[i]),lsum += a[i];
    else{
      pq.push(a[i]);
      ll t = pq.top(); pq.pop();
      lsum -= t;
      lsum += a[i];
    }
    left_sum.pb(lsum);
  }
  }
  priority_queue<int,vi>pq;
  vector<ll> right_sum(3*n);
  ll rsum = 0;
  while(!pq.empty()) pq.pop();
  for(int i = 3*n-1; i >= 0; i--){
    if((int)pq.size() < n)
      pq.push(a[i]),rsum += a[i];
    else{
      pq.push(a[i]);
      ll t = pq.top(); pq.pop();
      rsum -= t;
      rsum += a[i];
    }
    right_sum[i] = rsum;
  }
  ll ans = -LLINF;
  for(int i = n; i < 2*n+1; i++){
    ans = max(ans,left_sum[i-1] - right_sum[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 9832
#include<stdio.h>

int main(){
  int a,b;
  char op;
  while(1){
    scanf("%d %c %d",&a,&op,&b);
    if(op=='+'){
      printf("%d\n",a+b);
    }
    else if(op=='-'){
      printf("%d\n",a-b);
    }
    else if(op=='*'){
      printf("%d\n",a*b);
    }
    else if(op=='/'){
      printf("%d\n",a/b);
    }
    else if(op=='?'){
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 2032
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n,k;
  cin>>n>>k;
  for(ll i=0;i<=n;i++){
    for(ll j=0;j<=n-i;j++){
      ll g=n-i-j;
      if(i*1000+j*5000+g*10000==k){
        cout<<g<<" "<<j<<" "<<i<<endl;
        return 0;
      }
    }
  }
  cout<<"-1 -1 -1"<<endl;
}

Measured memory_bytes: 256
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let mut c: Vec<usize> = Vec::new();
    for _ in 0..n {
        let a: usize = scan(tokens);
        if c.is_empty() || c[c.len() - 1] >= a {
            c.push(a);
        } else if c[0] < a {
            c[0] = a;
        } else {
            let mut i = 0;
            let mut j = c.len() - 1;
            while i + 1 < j {
                let k = (i + j) / 2;
                if c[k] >= a {
                    i = k;
                } else {
                    j = k;
                }
            }
            c[j] = a;
        }
    }
    println!("{}", c.len());
}


Measured memory_bytes: 8444
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);
    sort(a.begin(),a.end());
    pair<int,int> ans;
    ans.first = a.at(n-1);
    double x = INF;
    rep(i,n-1){
        if(x>abs((double)a.at(i) - (ans.first/2.0))){
        x = abs((double)a.at(i) - (ans.first/2.0));
        ans.second = a.at(i);
        }
    }
    cout << ans.first << " " << ans.second << endl;
}

Measured memory_bytes: 640
#!/usr/bin/env python3
import sys, math, fractions, itertools

MOD = 1000000007  # type: int

f = [1]

def solve(N: int, M: int):
    if abs(N - M) == 1:
        print((f[N]*f[M]) % MOD)
    elif N == M:
        print(2 * (f[N]*f[M]) % MOD)
    else:
        print(0)
    return


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

    for i in range(1, 200000):
        f.append(f[-1] * i % MOD)
    solve(N, M)

if __name__ == '__main__':
    main()


Measured memory_bytes: 13148
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int mod=1e9+7;
const int maxn=2e5+7;
ll qpow(ll a,ll b)
{
  ll ans=1;
  while(b)
  {
    if(b&1)
      ans=ans*a%mod;
    a=a*a%mod;
    b>>=1;
  }
  return ans;
}
ll C(ll a,ll b)
{
  ll ans=1;
  for(int i=1;i<=a;i++)
  {
    ans=ans*i%mod;
  }
  ll res=1;
  for(int i=1;i<=b;i++)
    res=res*i%mod;
    ll ant=1;
  for(int i=1;i<=a-b;i++)
  {
    ant=ant*i%mod;
  }
  ans=ans*qpow(res,mod-2)%mod*qpow(ant,mod-2)%mod;
    return ans;
}
int a[55];
int main()
{
   ios::sync_with_stdio(0); cin.tie(0);
   int n;
    cin>>n;
  string s;
  cin>>s;
  int sum=1;
  for(int i=1;i<n;i++)
  {
    if(s[i]==s[i-1])
      continue;
    else sum++;
  }
  cout<<sum<<endl;

}


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

const int maxn = 100010;
int n;
vector<int> G[maxn];

int main() {
    scanf("%d", &n);
    for (int i = 1, u, v; i < n; i++) {
        scanf("%d %d", &u, &v);
        G[u].push_back(v), G[v].push_back(u);
    }
    function<int(int, int)> solve = [&](int v, int fa) {
        int s = 0;
        for (int u : G[v]) if (u ^ fa) {
            s += solve(u, v);
        }
        return s >= 2 ? s : s ^ 1;
    };
    printf("%s\n", solve(1, 0) ? "First" : "Second");
    return 0;
}

Measured memory_bytes: 5888
s = str(input())
k=int(input())



if len(s)==1:
    if k<2:
        ans = 0
    else:
        ans = k//2
elif len(s)==2:
    if s[0]==s[1]:
        ans = k
    else:
        ans = 0
else:
    sset = set()
    for i in range(len(s)):
        sset.add(s[i])
    if len(sset)==1:
        llen = len(s)*k
        ans = llen//2
        
    else:
        if k <= 2:
            ans = 0
            bef = ""
            befchen = False
            trignum = 0
            s = s+s
            for i in range(len(s)):
                now = s[i]
                if bef==now:
                    if befchen == False:
                        ans += 1
                        befchen = True
                        trignum = i
                if  befchen == True:
                    if trignum == i-1:
                        befchen = False
                bef = now

        elif k >=3:
            ans = 0
            fans = 0
            sans = 0
            tans = 0
            s2 = s+s+s
            bef = ""
            befchen = False
            trignum = 0
            for i in range(len(s2)):
                now = s2[i]
                if bef==now:
                    if befchen == False:
                        
                        if i <=len(s)-1:
                            fans +=1
                        elif i >=2*len(s):
                            tans +=1
                        else:
                            sans+=1
                        
                        befchen = True
                        trignum = i
                if  befchen == True:
                    if trignum == i-1:
                        befchen = False
                bef = now
                
            ans = fans+tans+(k-2)*sans
            

print(ans)  

Measured memory_bytes: 38384
import bisect

N = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0
for i in range(N-2):
    a = L[i]
    for j in range(i+1, N-1):
        b = L[j]
        ans += bisect.bisect_left(L, a+b) - j - 1

print(ans)


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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    int N, K; cin >> N >> K;
    vector<ll> h(N);
    for (int i = 0; i < N; i++) {
        cin >> h.at(i);
    }
    sort(h.begin(), h.end());
    ll ans = inf;
    for (int i = 0; i < N - K + 1; i++) {
        ll dist = h.at(i + K - 1) - h.at(i);
        ans = min(ans, dist);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n,p;
  cin >> n >> p;
  map<ll,ll> c;
  ll res = 1;
  for(int i = 2;i <= sqrt(p);i++){
    while(p % i == 0){
      c[i]++;
      p /= i;
    }
    res *= pow(i,c[i] / n);
  }
  res *= pow(p,1 / n);
  cout << res << endl;
}

Measured memory_bytes: 29712
N,T = map(int,input().split())
Cost_Time = []

for i in range(N):
  c,t = map(int,input().split())
  Cost_Time.append([c,t])
  
Cost_Time.sort()
ans = -1
for i in range(N):
  if(Cost_Time[i][1]<=T):
    ans = Cost_Time[i][0]
    break
    
if(ans == -1):
  print('TLE')
else:
  print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <set>

using namespace std;

int main()
{
    int n;
    cin >> n;
    set<string> s;
    for (int i = 0; i < n; i++)
    {
        string val;
        cin >> val;
        s.insert(val);
    }
    cout << (s.size() == 3 ? "Three" : "Four") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,h[100010];
    cin>>n;
    for(int i=0;i<n;i++)
    {
    	cin>>h[i];
	}
	int now=INT_MAX,maxx=0,thisone=0;
	for(int j=0;j<n-1;j++)
	{
		thisone=0;
		int under=j;
		while(h[under]>=h[under+1]&&under<n-1)
		{
			thisone++;
			under++;
		}
    	j=under;
		maxx=max(thisone,maxx);
	}
	cout<<maxx;
    return 0;
}

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

int m = 0;

class Dice{
public:
int n, face[6];

void scan(){
  for( int i = 0; i < 6; i++){
    cin >> face[i];
  }
}

void move1(){
     n = face[1];
     face[1] = face[2];
     face[2] = face[4];
     face[4] = face[3];
     face[3] = n;
}	      

void move2(){
     n = face[0];
     face[0] = face[4];
     face[4] = face[5];
     face[5] = face[1];
     face[1] = n;
}	 

void move3(){
     n = face[0];
     face[0] = face[2];
     face[2] = face[5];
     face[5] = face[3];
     face[3] = n;
}	 

};

void serch(Dice p1, Dice p2){
  for( int s = 0; s < 4; s++){
    m = 0;
    for( int i = 0; i < 4; i++){
      m = 0;
      for( int j = 0; j < 4; j++){
        m = 0;
        for( int k = 0; k < 6; k++){
          if( p1.face[k] != p2.face[k] ) break;
          m += 1;
        }
        if( m == 6 ) break;
        p1.move1();
      }
      if( m == 6 ) break;
      p1.move2();
   } 
   if( m == 6 ) break;
   p1.move3();
 }

}           

int main(){
  Dice p[100];
  int n;
  cin >> n;

  for( int i = 0; i < n; i++){
    p[i].scan();
  }
  
  for( int i = 1; i < n; i++){
    m = 0;
    for( int j = 0; j < i; j++){
      m = 0;
      serch(p[i], p[j]);
      if( m == 6 ) break;
    }
    if( m == 6 ) break;
  }

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

  return 0;
}

Measured memory_bytes: 3096
# back and force
ln = list(map(int, input().split(' ')))
disX = ln[2] - ln[0]
disY = ln[3] - ln[1]
output=''
u='U'
d='D'
r='R'
l='L'
#　一周め
for i in range(disY):
    output+= u
for i in range(disX):
    output+= r
for i in range(disY):
    output+= d
for i in range(disX):
    output+= l
#2週め
output+= l+u
for i in range(disY):
    output+= u
for i in range(disX):
    output+= r
output+= r+d +r+d
for i in range(disY):
    output+= d
for i in range(disX):
    output+= l
output+= l+u
print(output)

Measured memory_bytes: 3064
#include <stdio.h>
#include <limits.h>

int max(int a, int b)
{
  return a < b ? b : a;
}

int main(void)
{
  int A, B, C, X, Y, ans = INT_MAX;
  scanf("%d%d%d%d%d", &A, &B, &C, &X, &Y);
  for(int c = 0; c <= 100000; c++){
    int price = A*max(X-c, 0) + B*max(Y-c, 0) + C*2*c;
    if(price < ans)
      ans = price;
  }
  printf("%d\n", ans);
}


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];

    sort(A.begin(), A.end());
    int res = 0, pre = 0, cnt = 0;
    for (int i = 0; i < N; i++) {
        if (A[i] == pre) {
            cnt++;
        } else {
            if (cnt >= pre) {
                res += cnt - pre;
            } else {
                res += cnt;
            }
            cnt = 1;
        }
        pre = A[i];
    }

    if (cnt >= pre) {
        res += cnt - pre;
    } else {
        res += cnt;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640
def main():
    n = int(input())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))

    if sum(a) < sum(b):
        print(-1)
        return

    sub = []
    t = 0
    cnt = 0
    for i in range(n):
        if a[i] < b[i]:
            cnt += 1
            t += b[i] - a[i]
        else:
            sub.append(a[i]-b[i])

    if cnt == 0:
        print(0)
        return

    ans = cnt
    i = 0
    sub.sort(reverse=True)
    while t > 0:
        ans += 1
        t -= sub[i]
        i += 1
    print(ans)








if __name__ == '__main__':
    main()


Measured memory_bytes: 18356
import sys
sys.setrecursionlimit(10**7)
k = int(input())
ans = []

def rec(s, dig):
    if dig >= 10:
        ans.append(int("".join(map(str, s))))
        return
    
    if sum(s) == 0:
        for i in range(10):
            rec(s + [i], dig+1)
        return

    p = s[-1]
    if p != 0: rec(s + [p-1], dig+1)
    rec(s + [p], dig+1)
    if p != 9: rec(s + [p+1], dig+1)

rec([0], 0)
print(ans[k])


Measured memory_bytes: 11032
public class Hello{
    public static void Main(){
        // Your code here!
        var data2=0;
        var data1=0;
        var data3=0;
        var det=0;
        var max=0;
        var min=1000;
        while(true){
            data1=int.Parse(System.Console.ReadLine());  
            if(data1==0) {
                break;
            }
            data2=0;
            data3=0;
            max=0;
            min=1000;
            for(int i=0;i<data1;i++){
                det=int.Parse(System.Console.ReadLine());  
                data2+=det;
                data3++;
                if(max<det){
                    max=det;
                }
                if(min>det){
                    min=det;
                }
            }
            System.Console.WriteLine((data2-max-min)/(data3-2));
        }
        
       
    }
}


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

int N;
void dfs(int rest,int prev,vector<int>&vec){
    if(rest==0){
        for(int i=0;i<vec.size();i++){
            if(i)cout<<" ";
            cout<<vec[i];
        }
        cout<<endl;
        return;
    }
    for(int i=min(rest,prev);i>0;i--){
        vec.push_back(i);
        dfs(rest-i,i,vec);
        vec.pop_back();
    }
}

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

    while(cin>>N,N){
        vector<int>step;
        dfs(N,N,step);
    }
}

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

#define MX 3000

int n;
long double res, tab[MX+5], dp[MX+5][MX+5];

int main( )
{
	cin>>n;
	for( int i=1; i<=n; i++ )
		cin>>tab[i];

	dp[0][0]=1;

	for( int i=1; i<=n; i++ )
	{
		for( int j=0; j<=i; j++ )
		{
			dp[i][j]=dp[i-1][j]*(1-tab[i]);
			if( j!=0 ) dp[i][j]+=dp[i-1][j-1]*tab[i];
			//cout<<i<<" "<<j<<" "<<dp[i][j]<<"\n";
		}
	}

	for( int j=(n/2)+1; j<=n; j++ )
		res+=dp[n][j];

	cout<<setprecision(10)<<res<<"\n";

}


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

using namespace std;
using ll = long long;

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

    int n, cnt = 0;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i) cin >> a[i];

    for(int i = 0; i < n; ++i) {
        auto itr_min = min_element(a.begin() + i, a.end());
        if(a.begin() + i != itr_min) {
            swap(a[i], *itr_min);
            cnt++;
        }
    }

    for(int i = 0; i < n; ++i) {
        printf("%d", a[i]);
        printf(i == n - 1 ? "\n" : " ");
    }
    printf("%d\n", cnt);

    return 0;
}


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

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;

    int x, n;
    if (a > b) {
        x = b;
        n = a;
    }
    else {
        x = a;
        n = b;
    }

    for (int i = 0; i < n; i++) {
        cout << x;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int N;
    int A[210];
    scanf("%d",& N);
    for(int i=0;i<N;i++) scanf("%d", &A[i]);
    int res=10000000;
    for(int i=0;i<N;i++){
        int c=0;
        while(A[i] % 2 == 0){
            A[i]/=2;
            c++;
        }
        if(res>c) res=c;
    }
    printf("%d\n", res);
    
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int x11[60],x22[60],y11[60],y22[60];
int main(){
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        cin>>x11[i]>>x22[i];
    }
    for(int i=1;i<=m;i++)
    {
        cin>>y11[i]>>y22[i];
    }

    for(int i=1;i<=n;i++)
    {
        int max=1000000000;
        int k;
        for(int j=1;j<=m;j++)
        {
            int juli=abs(x11[i]-y11[j])+abs(x22[i]-y22[j]);
            if(juli<max)
			{
                max=juli;
                k=j;
            }
        }
        cout<<k<<endl;
    }
} 

Measured memory_bytes: 256
# import sys
import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
    # combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
# mod = 998244353
INF = 1<<50

def readInt():
    return list(map(int,input().split()))

def main():
    a,b,c = readInt()
    k = int(input())
    res = 0
    while b<=a:
        b *= 2
        res += 1
    while c<=b:
        c *= 2
        res += 1
    if res<=k:
        print("Yes")
    else:
        print("No")
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 9152
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 200005
#define pb push_back
#define vit vector<int>::iterator
typedef pair<int,int> pii;
map<int,int>M;
vector<int> V[MAX];
int A[MAX];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>A[i];
    for(int i=1;i<=(n-k);i++){
        if(A[i+k]>A[i])
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 9116
#include <iostream>

using namespace std;

int main()
{

   int a,b;
   cin>>a>>b;
   if(a>b){
    for(int i=0;i<a;i++)
        cout<<b;
    }
    else{
for(int i=0;i<b;i++)
        cout<<a;
    }
    return 0;}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  sort(a,a+n);
  cout<<a[n/2]-a[(n/2)-1];
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define YEET ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pll pair<long long, long long>
#define ll long long
#define f first
#define s second
#define mod 1000000007

using namespace std;

bool cmp(pll a, pll b)
{
    return a.second < b.second;
}

int n;
vector<pll> v;

int main()
{
    cin>>n;
    v.resize(n);
    for (int i=0;i<n;++i)
		cin>>v[i].first>>v[i].second;
    sort(v.begin(),v.end(),cmp);
    bool ok=true;
    ll sum = 0;
    for(int i=0;i<n;++i)
	{
        sum+=v[i].first;
        if(sum > v[i].second)
			ok = false;
    }
    if(ok)
		cout<<"Yes"<<"\n";
    else
		cout<<"No"<<"\n";
		return 0;
}


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

#define INF 1.1e9
#define LINF 9223372036854775807
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()

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

int K,N;
ll x[50],y[50];
vector<ll> vx,vy;

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

	cin>>N>>K;
	REP(i,N) {
		cin>>x[i]>>y[i];
		vx.push_back(x[i]);
		vy.push_back(y[i]);
	}
	sort(ALL(vx)); sort(ALL(vy));
	ll ans=(vx[N-1]-vx[0])*(vy[N-1]-vy[0]);
	REP(i,N) {
		FOR(j,i+1,N) {
			REP(k,N) {
				FOR(l,k+1,N) {
					int cnt=0;
					REP(m,N) {
						if(x[m]>=vx[i]&&x[m]<=vx[j]&&y[m]>=vy[k]&&y[m]<=vy[l]) cnt++;
					}
					if(cnt>=K) ans=min(ans,(vx[j]-vx[i])*(vy[l]-vy[k]));
				}
			}
		}
	}
	cout<<ans<<endl;

	return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define UNIQUE(c) sort(ALL(c)), c.erase(unique(ALL(c)), c.end())

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N; cin >> N;
  vector<int> A(N), B(N);
  REP(i, N) cin >> A[i];
  REP(i, N) cin >> B[i];

  int ans = 0;
  REP(i, 29) {
    vector<int> mod_B(N);
    REP(j, N) mod_B[j] = B[j] % (1 << (i+1));

    sort(ALL(mod_B));

    int cnt = 0;
    for (int a : A) {
      a %= (1 << (i+1));
      int left = (1 << i) - a, right = (1 << (i+1)) - a;
      cnt += lower_bound(ALL(mod_B), right) - lower_bound(ALL(mod_B), left);
      left = 3 * (1 << i) - a, right = (1 << (i+2)) - a;
      cnt += lower_bound(ALL(mod_B), right) - lower_bound(ALL(mod_B), left);
    }
    if (cnt % 2) ans += 1 << i;
  }
  cout << ans << endl;

  return 0;
}


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

/* short names and const
using ll = long long;
using vll = vector<long long>;
using df = vector<vector<long long>>;
df data(n, vector<long long>(m));
const int MOD = 1e9 + 7;
const long long INF = 1e18;
*/

/* Boost!
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
using boost::algorithm::split; // split(result, s, boost::is_any_of(","));
#include <boost/algorithm/string/join.hpp>
using boost::algorithm::join; // string s = join(arr, "");
#include <boost/algorithm/string/replace.hpp>
using boost::algorithm::replace_all; // replace_all(s, "AtCoder", "A");
#include <boost/range/algorithm.hpp> // boost::sort(arr)
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
*/

/* print(arr)
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}
*/

/* fast cin and precise cout
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  getline(cin, s);
  cout << fixed << setprecision(15);
*/

/* sum function
int sum(vector<int> &arr) {
  int res = accumulate(arr.begin(), arr.end(), 0);
  return res;
}
*/

int main() {
  map<char, char> dic;
  dic['A'] = 'T';
  dic['C'] = 'G';
  dic['G'] = 'C';
  dic['T'] = 'A';
  char b;
  cin >> b;
  cout << dic[b] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int pay;
  pay=N/1000;
  
  if(N%1000==0){
    cout << 0 << endl;
  }
  else{
  cout << (pay+1)*1000-N << endl;
  }
}




Measured memory_bytes: 3604
#!usr/bin/env python3

import sys


def main():
    # S: spades
    # H: hearts
    # C: clubs
    # D: diamonds
    card_deck = {'S': [], 'H': [], 'C': [], 'D': []}
    card_symbols = ['S', 'H', 'C', 'D']

    n = int(sys.stdin.readline())
    for i in range(n):
        lst = [card for card in sys.stdin.readline().split()]
        card_deck[lst[0]].append(lst[1])

    for i in card_symbols:
        for card in range(1, 14):
            if not str(card) in card_deck[i]:
                print(i, card)


if __name__ == '__main__':
    main()

Measured memory_bytes: 7692
from itertools import compress, product

s = input()
n = len(s)

indices = range(1, n)
index_maskss = product((0,1), repeat=n-1)
indicess = ([0]+list(compress(indices, masks))+[n] for masks in index_maskss)
ijss = (zip(indices, indices[1:]) for indices in indicess)
sums = (sum(int(s[i:j]) for i, j in ijs) for ijs in ijss)
 
print(sum(sums))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define deb(x) cout<<#x<<" "<<x<<endl;
#define print(arr,n) for(int i=0;i<n;++i) { cout<<arr[i]<<" "; } cout<<endl;
#define ub(x,el) upper_bound(x.begin(),x.end(),el) - x.begin()
#define lb(x,el) lower_bound(x.begin(),x.end(),el) - x.begin();
#define bs(x,el) binary_search(x.begin(),x.end(),el)
#define MOD 1000000007
#define finish return 0
using namespace std;
typedef long long int ll;
ll mod(ll x) { return x%MOD; }
ll power(ll x,ll y, ll p) { ll res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x) % p;   } return res; } 
ll mod(ll num, ll den){ return mod(mod(num) * power(den,MOD-2,MOD)); }
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n;
	cin>>n;
	ll a = n/3;
	ll b = n/5;
	ll c = n/15;
	ll num1 = (3*(a*(a+1)))>>1;
	ll num2 = (5*(b*(b+1)))>>1;
	ll num3 = (15*(c*(c+1)))>>1;
	ll temp = num1+num2-num3;
	ll ans = (n*(n+1))>>1;
	ans-=temp;
	cout<<ans<<endl;
	
	
}

Measured memory_bytes: 3652
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;



int main() {
	int n, k; cin >> n >> k;
	string s; cin >> s;
	string t = "ABCabc";
	rep(i, 0, 3)if (s[k - 1] == t[i])s[k - 1] = t[i + 3];
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
# vim: set fileencoding=utf-8:


def main():
    A, B, C = raw_input().split()
    a = int(A + B) + int(C)
    b = int(A + C) + int(B)
    c = int(B + A) + int(C)
    d = int(B + C) + int(A)
    e = int(C + B) + int(A)
    f = int(C + A) + int(B)
    print(max(a, b, c, d, e, f))


if __name__ == "__main__":
    main()


Measured memory_bytes: 2568
#include <iostream>
#include <algorithm>
using namespace std;
 
int main()
{
	int n; cin >> n;
	int p[n]; for (int i = 0; i < n; i++) cin >> p[i];
        int sum = 0;
	
	sort(p, p + n);
	reverse(p, p + n);
	
	sum += (p[0] / 2);
	for (int i = 1; i < n; i++) sum += p[i];
	
	cout << sum << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,m,a[100];
    int i,sum = 0;
    int count = 0;
    scanf("%d %d",&n,&m);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        sum = sum + a[i];
    }
    for(i=0;i<n;i++){
        if(sum <= a[i]*4*m){
          count++;
        }
    }
    if(count >= m){
        printf("Yes");
    }
    else printf("No");
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
#define endl "\n"
using namespace std;
const ll N=500010;

ll f(ll a,ll d,ll n)
{
    ll ans=(n*(2*a+(n-1)*d))/2;
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;
    cin>>n;
    ll ans=n*(n+1)/2;
    ll i;
    i=n/3;
    ans-=f(3,3,i);
    i=n/5;
    ans-=f(5,5,i);
    i=n/15;
    ans+=f(15,15,i);
    cout<<ans;

    return (0);
}


Measured memory_bytes: 3688
def main():
  #n = int(input())
  #s = list(input())
  #s = input().split()
  k,n = list(map(int,input().split()))
  a = list(map(int,input().split()))
  #a = input().split()
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = 0
  count = 0
  lis = []
  a.append(k+a[0])
  for i in range(n):
    b = a[i+1] - a[i]
    lis.append(b)
  lis.sort()
  print(k-lis[-1])
  

if __name__ == '__main__':
  main()

Measured memory_bytes: 26444
# coding: utf-8
n,k=map(int,input().split())
a=list(map(int,input().split()))
dp=[None for i in range(k+1)]
dp[0]=False
for i in range(k+1):
    f=False
    for x in a:
        if i-x<0:
            continue
        if dp[i-x]==True:
            dp[i]=False
            break
    else:
        dp[i]=True
print('First' if not dp[-1] else 'Second')

    

Measured memory_bytes: 3864
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>

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

int main() {
    ll P,Q,R;
    cin >> P >> Q >> R;
    cout << min(P+Q,min(P+R,Q+R)) << endl;

    return 0;
}

Measured memory_bytes: 384
#include <cstdio>
const int MAXS = 20;
const int MAXW = 3;
const char* W[] = {
  "Sunny", "Cloudy", "Rainy"
};
char S[MAXS];

int solve() {
  for (int i = 0; i < MAXW; ++i) {
    if (S[0] == W[i][0]) {
      return (i + 1) % MAXW;
    }
  }
  return 0;
}

int main() {
  scanf(" %s", S);
  puts(W[solve()]);
  return 0;
}

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

class Program
{
    static string InputPattern = "Input3";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("5");
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("100");
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int N = int.Parse(InputList[0]);

        decimal Val = 100000 / 1000;
        for (int I = 1; I <= N; I++) {
            Val = Math.Ceiling(Val * 1.05M);
        }
        Console.WriteLine(Val * 1000);
    }
}

Measured memory_bytes: 5700
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
typedef pair<int,int> P;
struct edge{int to, id;};
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mod 1000000007

using graph = vector<vector<ll>>;

int main(){
    ll n,k;
    cin >> n >> k;
    ll a[n];
    rep(i,n){
        ll temp;
        cin >> temp;
        a[i] = temp;
    }
    for(ll i = k+1; i <= n; i++){
        if(a[i-1] > a[i-k-1]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 5184
n,m=map(int,input().split()) 
lst_b=[] 
lst_c=[] 
while(True): 
    b=n//m 
    c=n%m 
    lst_b.append(b) 
    lst_c.append(c) 
    n=b 
    if b==0: 
    	print(len("".join(map(str,lst_c[::-1])))) 
    	break      

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i <= n; i++)
template<class T> inline int chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline int chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<29;
const ll LINF = 1LL<<58;
const int mod = 1000000007;

int main(){
    int n;
    cin >> n;
    ll s = 0, ans = 0;
    map<ll, int> mp; mp[0] = 1;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        s += a;
        ans += mp[s];
        mp[s]++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 12800
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = 0
g = 0
h = 0
i = 0
j = 0
for k in range(9):
    if (a + f) % 10 != 0:
        f += 1
    if (b + g) % 10 != 0:
        g += 1
    if (c + h) % 10 != 0:
        h += 1
    if (d + i) % 10 != 0:
        i += 1
    if (e + j) % 10 != 0:
        j += 1
print(a+b+c+d+e+f+g+h+i+j-max(f,g,h,i,j))

Measured memory_bytes: 3064
using System;

class program
{
    static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');
        int W = int.Parse(str[0]);
        int H = int.Parse(str[1]);
        int x = int.Parse(str[2]);
        int y = int.Parse(str[3]);
        int r = int.Parse(str[4]);

        if (x >= r && y >= r)
        {
            if (x <= (W-r) && y <= (H-r))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 9000
c=[]
for i in range(3):
    c.append([int(x) for x in list(input().split())])

if c[0][1]-c[0][0]==c[1][1]-c[1][0]==c[2][1]-c[2][0] and c[0][2]-c[0][1]==c[1][2]-c[1][1]==c[2][2]-c[2][1] and c[1][0]-c[0][0]==c[1][1]-c[0][1]==c[1][2]-c[0][2] and c[2][0]-c[1][0]==c[2][1]-c[1][1]==c[2][2]-c[1][2]:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int N;
  cin >> N;
  vector<int> H(N);
  rep(i, N) cin >> H[i];
  int count = 0;
  
  rep(i, N){
    bool can = true;
    rep(j, i){
      if(H[j] > H[i]){
        can = false;
        break;
      }
    }
    if(can) count++;
  }
  cout << count << endl;
  return 0;
}


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

int main(){
  int a,b;

  scanf(" %d %d",&a,&b);

  if(a<b){
    if(a==1){
      cout << "Alice" << endl;
    }else{
      cout << "Bob" << endl;
    }
  }else if(a>b){
    if(b==1){
      cout << "Bob" << endl;
    }else{
      cout << "Alice" << endl;
    }
  }else{
    cout << "Draw" << endl;
  }

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef unsigned long long ll;

bool isPrime(ll n) {
	if (n == 1) return false;
	if (n == 2) return true;
	if (n % 2 == 0) return false;
	for (ll i = 3; i * i <= n; i+=2) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

int main() {
	ll a, d, n;
	while (cin >> a >> d >> n, a + d + n != 0) {
		int count = 0;
		do {
			if (isPrime(a) == true) {
				count ++;
				if (count == n) {
					cout << a << endl;
					break;
				}
			}
			a += d;
		} while (true);
	}
	return 0;
}

Measured memory_bytes: 1148
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
#define endl '\n'
#define first F
#define second S
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	string s, t; 
	cin>>s>>t;
	int tam = s.size(), ans=0;
	for(int i=0; i<tam; i++){
		if(s[i]!=t[i])ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3756
N,*A = map(int, open(0).read().split())
group = [0] * 3
ans = 1
for x in A:
    ans = (ans*group.count(x)) % 1000000007
    if ans == 0:
        print(0)
        break
    else:
        group[group.index(x)] += 1
else:
    print(ans)

Measured memory_bytes: 19972
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"0":"10")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int x, a;
    cin >> x >> a;
    yorn(x < a)
    return 0;
}

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

struct node {
  int num;
  int count;
};

bool node_cmp(const struct node &p, const struct node &q) {
  return p.count < q.count;
}

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

  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }

  map<int, int> odd;
  map<int, int> even;

  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      even[v[i]]++;
    } else {
      odd[v[i]]++;
    }
  }

  int sum = 0;
  for (auto var : even) {
    sum += var.second;
  }
  vector<node> even_v;
  for (auto var : even) {
    struct node tmp;
    tmp.num = var.first;
    tmp.count = sum - var.second;
    even_v.push_back(tmp);
  }

  sum = 0;
  for (auto var : odd) {
    sum += var.second;
  }
  vector<node> odd_v;
  for (auto var : odd) {
    struct node tmp;
    tmp.num = var.first;
    tmp.count = sum - var.second;
    odd_v.push_back(tmp);
  }

  sort(even_v.begin(), even_v.end(), node_cmp);
  sort(odd_v.begin(), odd_v.end(), node_cmp);

  int output = 0;
  if (odd_v[0].num == even_v[0].num) {
    output =
        min(odd_v[0].count + even_v[1].count, odd_v[1].count + even_v[0].count);
    if (output == 0) {
      output = n / 2;
    }

  } else {
    output = odd_v[0].count + even_v[0].count;
  }

  cout << output << endl;
  return 0;
}


Measured memory_bytes: 9280