akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> A(n), B(n);

    rep(i, 0, n)
        cin >> A[i] >> B[i];

    ll value = 0;
    rep(i, 0, n)
        if ((k|A[i]) == k)
            value += (ll)B[i];

    int base = 1 << 30;
    while (base)
    {
        if ((base & k) == 0)
        {
            base >>= 1;
            continue;
        }

        int mask = (k - base) | (base - 1);
        ll now_value = 0;
        rep(i, 0, n)
            if ((mask|A[i]) == mask)
                now_value += (ll)B[i];

        value = max(value, now_value);
        // cout << now_value << endl;
        base >>= 1;
    }
    cout << value << endl;
    return 0;
}

Measured memory_bytes: 1152
// Copyright 2020 yaito3014
#include <bits/stdc++.h>
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> H(N);
	for(auto&e:H)cin >> e;
	int ans = 0;
	int c = 0;
	for(int i = 0; i < N - 1; ++i)
		if(H[i] >= H[i + 1])ans = max(ans, ++c);
	  else c = 0;
	cout << ans << endl;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void){
    int x,prime[100010]={0},i,j;
    scanf("%d",&x);
    for(i=2;i<x;i++){
        if(prime[i]==0){
            j=i;
            while(j<100010){
                prime[j]=1;
                j+=i;
            };
        };
    };
    while(prime[i]==1){
        i++;
    };
    printf("%d",i);
    return 0;
}


Measured memory_bytes: 512
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

B = [-1] + A + [N + 1]
B = [B[i + 1] - B[i] - 2 for i in range(M + 1)]

total = max(B)
dp = [1, 1] + [0] * (total - 1)
for i in range(total - 1):
    dp[i + 2] = (dp[i + 1] + dp[i]) % (10 ** 9 + 7)
        
ans = 1
for i in range(M + 1):
    ans *= dp[B[i]]
    ans %= 10 ** 9 + 7
print(ans if -1 not in B[1:] else 0)

Measured memory_bytes: 8616
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000


N = int(input())
S = str(input())

x = 0
ans = 0
for i in range(N):
    if S[i] == "I":
        x += 1
    else:
        x -= 1
    ans = max(ans,x)
print(ans)


Measured memory_bytes: 5456
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int dy[4]={1,0,-1,0};
int dx[4]={0,1,0,-1};
vector<vector<int>> graph;

bool sort_sec(const pair<int,int> &a,const pair<int,int> &b){
   if(a.second<b.second){
      return true;
   }
   return false;
}

void swap(int *a,int *b){
   int temp=*a;
   *a=*b;
   *b=temp;
}

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

int main(void){
   long long N,A,B;
   cin>>N>>A>>B;
   if((B-A)%2==0){
      cout<<(B-A)/2<<endl;
   }else{
      cout<<min(N-B,A-1)+1+(B-A-1)/2<<endl;
   }
   return 0;
}


Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	for ; N != 0; N /= 10 {
		if N%10 == 7 {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


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

bool dfs(vector<int>& d, int level, int acc, string& ans)
{
    if (level == d.size()) {
        return acc == 7;
    }
    ans += "+" + to_string(d[level]);
    if (dfs(d, level + 1, acc + d[level], ans)) {
        return true;
    }
    ans.erase(ans.size() - 2, 2);
    ans += "-" + to_string(d[level]);
    if (dfs(d, level + 1, acc - d[level], ans)) {
        return true;
    }
    ans.erase(ans.size() - 2, 2);
    return false;
}

int main()
{
    int n;
    cin >> n;
    vector<int> d{(n/1000)%10, (n/100)%10, (n/10)%10, n%10};
    string ans = to_string(d[0]);
    dfs(d, 1, d[0], ans);
    cout << ans << "=7" << endl;
}

Measured memory_bytes: 256
n,a,b = map(int,raw_input().split())
s = raw_input()

aa = 0
bb = 0
ans = []
for i in range(len(s)):
  if s[i] != "c":
    if s[i] == "a":
      if aa+bb < a+b:
        aa += 1
        ans.append("Yes")
      else:
        ans.append("No")

    if s[i] == "b":
      if aa+bb < a+b and bb < b:
        bb += 1
        ans.append("Yes")
      else:
        ans.append("No")
  else:
    ans.append("No")
for i in ans:
  print i

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

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;   // INFの値は1152921504606846976

ll pow(ll x,ll n, ll m){  // xのn乗 (mod m)
    ll res = 1;
    if(n > 0){
        res = pow(x,n / 2,m);
        if(n % 2 == 0){
            res = (res * res) % m;
        }else{
            res = (((res * res) % mod) * x) % m;
        }
    }
    return res;
}

int main()
{
    ll m,n;
    cin >> m >> n;
    cout << pow(m,n,mod) << endl;;

}


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

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

using VAL = int;
struct WeightedUnionFind {
  int n;
  vector<int> rank, par;
  vector<VAL> diff_weight;
  WeightedUnionFind() {}
  WeightedUnionFind(int n) : n(n), rank(n, 1), par(n), diff_weight(n) {
    iota(par.begin(), par.end(), 0);
  }
  int root(int x) {
    if (x == par[x]) return x;
    int r = root(par[x]);
    diff_weight[x] += diff_weight[par[x]];
    return par[x] = r;
  }
  bool merge(int x, int y, VAL w) {
    int X = root(x), Y = root(y), W = w;
    W += weight(x); W -= weight(y);
    if (X == Y) return diff(x, y) == w;
    if (rank[X] < rank[Y]) swap(X, Y), W = -W;
    rank[X] += rank[Y];
    par[Y] = X;
    diff_weight[Y] = W;
    return true;
  }
  VAL weight(int x) {
    root(x);
    return diff_weight[x];
  }
  VAL diff(int x, int y) {
    return weight(y) - weight(x);
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  int size(int x) {
    return rank[root(x)];
  }
};

int N, M;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> M;
  WeightedUnionFind uf(N);
  bool yes = true;
  for (int i = 0; i < M; i++) {
    int L, R, D;
    cin >> L >> R >> D;
    L--, R--;
    yes &= uf.merge(L, R, D);
  }
  cout << (yes ? "Yes" : "No") << endl;

  return 0;
}

Measured memory_bytes: 1408
#include <iostream>

using namespace std;

int extgcd(int a, int b, int& x, int& y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  const int d = extgcd(b, a % b, y, x);
  y -= (a / b) * x;
  return d;
}

int main() {
  int a, b;
  cin >> a >> b;
  int x, y;
  extgcd(a, b, x, y);
  cout << x << " " << y << endl;
  return 0;
}



Measured memory_bytes: 3080
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <list>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 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 / gcd(a, b) * b;
}*/

int simulate(const string &s, const vector<char> &t, const vector<char> &d, int pos) {
	rep(i, (int)t.size()) {
		if (s[pos] != t[i]) continue;
		if (d[i] == 'L') pos--;
		else pos++;
		if (pos < 0) return 1;
		if (pos >= (int)s.size()) return -1;
	}
	return 0;
}

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

	int n, q;
	cin >> n >> q;
	string s;
	cin >> s;
	vector<char>t(q), d(q);
	rep(i, q) cin >> t[i] >> d[i];

	int left = -1;
	int right = n;
	
	// 左の境界線を探す
	while (right - left > 1) {
		int midL = (right + left) / 2;
		int ok = simulate(s, t, d, midL);
		if (ok == 1) {
			// 右を探す
			left = midL;
		}
		else right = midL;
	}
	// mid = low, right = low + 1 = mid + 1 となっている
	int left_fall = right; // rightのインデックスのゴーレムは落ちない

	// 右の境界線を探す
	left = -1;
	right = n;
	while (right - left > 1) {
		int midR = (right + left) / 2;
		int ok = simulate(s, t, d, midR);
		if (ok == -1) right = midR;
		else left = midR;
	}
	int right_fall = n - 1 - left; // leftのインデックスのゴーレムは落ちない

	cout << n - (left_fall + right_fall) << endl;

	return 0;
}


Measured memory_bytes: 976
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

#define MAXN (1 << 20)

int a[MAXN];
int b[MAXN];
int n, k;

void naive() {
	for (int i = 0; i < k; i++) {
		for (int j = 0; j < n; j++) {
			b[j] = 0;
		}
		vector<int> lleft;
		vector<int> rright;
		for (int j = 0; j < n; j++) {
			lleft.push_back(max(0, j - a[j]));
			rright.push_back(min(n, j + a[j] + 1));
		}
		sort(lleft.begin(), lleft.end());
		sort(rright.begin(), rright.end());
		lleft.push_back(MAXN);
		rright.push_back(MAXN);
		int cur = 0;
		int lpos = 0;
		int rpos = 0;
		for (int j = 0; j < n; j++) {
//			for (int t = max(0, j - a[j]); t <= min(j + a[j], n - 1); t++) {
//				b[t]++;
//			}
			while (lleft[lpos] == j) {
				lpos++;
				cur++;
			}
			while (rright[rpos] == j) {
				rpos++;
				cur--;
			}
			b[j] = cur;
		}
		bool done = true;
		for (int j = 0; j < n; j++) {
			a[j] = b[j];
			if (a[j] != n) {
				done = false;
			}
		}
		if (done) {
			return;
		}
	}
}


int main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	naive();
	for (int i = 0; i < n; i++) {
		cout << a[i] << " ";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 7692
#include <iostream>
#include <stdio.h>
#include <string>
#include <cmath>
using namespace std;

int main() {
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;
    if (u == s) cout << a - 1 <<" "<< b  << endl;
    else cout << a <<" "<< b - 1 << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

ll a[100000];
int main() {
	ll n; scanf("%lld", &n);
	rep(i, n)scanf("%lld", &a[i]);
	ll k = accumulate(a, a + n, 0LL);
	if (k % ((1 + n)*n / 2)) {
		puts("NO"); return 0;
	}
	k /= (1 + n)*n / 2;
	ll t = k;
	rep(i, n) {
		ll d = a[(i + 1) % n] - a[i] - t;
		if (d > 0) {
			puts("NO"); return 0;
		}
		if (d < 0) {
			if (-d%n != 0 || k < -d / n) {
				puts("NO"); return 0;
			}
			k -= -d / n;
		}
	}
	if (k)puts("NO");
	else puts("YES");
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

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

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

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  lint n;
  cin>>n;
  lint result=0;
  for(int i=1;i<=n;i++){
    if(i%3!=0&&i%5!=0){
      result+=i;
    }
  }
  cout<<result<<endl;

  return 0;
}




Measured memory_bytes: 3640
#include<bits/stdc++.h>
 
#define REP(i,s,N) for (int i=s;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


int main(){
	int A,B,M;
	cin >> A >> B >> M;
	vector<int> a(A);
	vector<int> b(B);
	REP(i,0,A){
		cin >> a.at(i);
	}
	REP(i,0,B){
		cin >> b.at(i);
	}
	

	
	int a_m = *min_element(a.begin(),a.end());
	int b_m = *min_element(b.begin(),b.end());
	
	int c_min = a_m + b_m;
	
	REP(i,0,M){
		int x_tmp,y_tmp,c_tmp;
		cin >> x_tmp >> y_tmp >> c_tmp;
		int min_tmp = a.at(x_tmp-1)+b.at(y_tmp-1) - c_tmp;
		c_min = min(c_min,min_tmp);
	}
	
	cout << c_min << endl;

}

Measured memory_bytes: 1024
import java.util.*;

public class Main {

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


	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int c[] = new int[n];
		int s[] = new int[n];
		int f[] = new int[n];
		for(int i=0; i<n-1; i++) {
			c[i]=sc.nextInt();
			s[i]=sc.nextInt();
			f[i]=sc.nextInt();
		}

		ArrayList<Long> ans = new ArrayList<>();
		for(int i=0; i<n; i++) {
			long t = 0;
			t += s[i];
			t += c[i];
			for(int j=i+1; j<n-1; j++) {
				if(t<s[j]) {
					t= s[j];
				}else if(t%f[j]!=0) {
					t += f[j]-(t%f[j]);
				}
				t += c[j];
			}
			ans.add(t);
		}
		for(int i=0; i<n; i++) {
			System.out.println(ans.get(i));
		}
		sc.close();
	}
}


Measured memory_bytes: 39032
n = int(input())
x = list(map(int, input().split()))

sumlist = []

if len(set(x)) == 1:
    print(0)
else:
    for i in range(1, max(max(x), n)):
        s = 0
        for j in range(n):
            s += (x[j] - i) ** 2
        sumlist.append(s)

    if sumlist == []:
        print((x[0] - n) ** 2)
    else:
        print(sorted(sumlist)[0])


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repr(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<(int)(n);i++)
#define INF 99999999999999

    /*Solve*/

int main(){
    ll n;
    cin >> n;
    ll a[100010];
    bool ninc=1,ndec=1;
    int res=1;
    
    rep(i,n){
        ll b;
        cin >> b;
        a[i]=b;
        if(i>0){
            if(a[i-1]<a[i]){
                ninc=0;
            }
            if(a[i-1]>a[i]){
                ndec=0;
            }
        }
        if(ninc==0 && ndec==0){
            res++;
            ninc=1;ndec=1;
        }
    }
    cout << res;
}

Measured memory_bytes: 1024
import java.util.Scanner;

class Main {
    public static void main(String[] args){
    	
    	//
        Scanner sc = new Scanner(System.in);
        //??????????????????
        String s = sc.nextLine();
        String p = sc.nextLine();
        
        s=s+s;
        //
        if(s.indexOf(p)!=-1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 26220
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public static void Main(string[] args)
	{
		//string[] b = Input();
		string k = Console.ReadLine();
		for(int i = 1; i < k.Length; i++)
		{
			if(k[i] == k[i-1])
			{
				Console.WriteLine("Bad");
				return;
			}
		}
		Console.WriteLine("Good");
		
	}

	
	public static string[] Input()
	{
		return Console.ReadLine().Split(' ');
	}

	
	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

	
}



Measured memory_bytes: 13140
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include<cfloat>
#include<cstdio>
#define all(c) (c).begin(),(c).end()
#define curr(P,i) P[(i)%P.size()]
#define next(P,i) P[(i+1)%P.size()]
#define prev(P,i) P[(i+P.size()-1)%P.size()]


using namespace std;

typedef double Real;

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

int sgn(Real a, Real b=0){return a<b-EPS?-1:a>b+EPS?1:0;}
Real sqr(Real a){return sqrt(max(a,(Real)0));}

struct Point{  
  Real add(Real a, Real b){
    if(abs(a+b) < EPS*(abs(a)+abs(b)))return 0;
    return a+b;
  }

  Real x, y;
  Point(){}
  Point(Real x,Real y) : x(x) , y(y){}

  Point operator + (Point p){return Point(add(x,p.x), add(y,p.y));}
  Point operator - (Point p){return Point(add(x,-p.x), add(y,-p.y));}
  Point operator * (Real d){return Point(x*d,y*d);}
  Point operator / (Real d){return Point(x/d,y/d);}
  bool operator == (Point p){return !sgn(dist(p));}
  bool operator < (Point p)const{return (p.x!=x)?x<p.x:y<p.y;}
  Real norm(){return sqr(x*x+y*y);}
  Real dist(Point a){return (*this-a).norm();}
  Real dot(Point a){return x*a.x+y*a.y;}
  Real cross(Point a){return x*a.y-y*a.x;}
  //点pを中心に角度r(radius)だけ半時計回りに回転する
  Point rotate(Real r,Point p = Point(0,0)){
    Real ta=cos(r)*(x-p.x)-sin(r)*(y-p.y)+p.x;
    Real tb=sin(r)*(x-p.x)+cos(r)*(y-p.y)+p.y;
    return Point(ta,tb);
  }
  Real arg(){
    if(sgn(x)>0)return atan(y/x);
    if(sgn(x)<0)return atan(y/x)+PI;
    if(sgn(y)>0)return PI/2;
    if(sgn(y)<0)return 3*PI/2;
    return 0;
  }
};

//a -> b -> c
int ccw(Point a, Point b, Point c) {
  b = b-a; c = c-a;

  if (b.cross(c) > 0)   return +1;       // counter clockwise
  if (b.cross(c) < 0)   return -1;       // clockwise
  if (b.dot(c) < 0)     return +2;       // c--a--b on line
  if (b.norm() < c.norm()) return -2;    // a--b--c on line
  return 0;                              // a--c--b on line
}

struct Circle{
  Point p;
  Real r;
  Circle(){}
  Circle(Point p, Real r) : p(p) , r(r){}
  
  /*
    Verified. AOJ 1132
    2円の交点を求める
  */
  vector<Point> intersectionPoints(Circle b){
    vector<Point> res;
    Point tmp=p-b.p;
    if(tmp.norm()>pow(r+b.r,2))return res;

    Real L=p.dist(b.p);
    Real C=atan2(b.p.y-p.y,b.p.x-p.x);
    Real a=acos((L*L+r*r-b.r*b.r)/(2*L*r));

    res.push_back(Point(p.x+r*cos(C+a), p.y+r*sin(C+a)));
    res.push_back(Point(p.x+r*cos(C-a), p.y+r*sin(C-a)));
    return res;
  }
};

int main(void){

  Circle a,b;

  cin >> a.p.x >> a.p.y >> a.r;
  cin >> b.p.x >> b.p.y >> b.r;

  vector<Point> res=a.intersectionPoints(b);
  sort(all(res));
  printf("%.8f %.8f %.8f %.8f",res[0].x,res[0].y,res[1].x,res[1].y);
  cout << endl;

  return 0;
}

Measured memory_bytes: 1328
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define int long long
#define mod 1000000007
using namespace std;
inline int read(){
	int f=1,ans=0;char c;
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();}
	return ans*f;
}
int n,m,k,ans;
int Qsum(int a1,int an){
	if(a1>an) return 0;
	return ((a1+an)*(an-a1+1)/2)%mod;
}
int ksm(int a,int b){
    int ans=1;
    while(b){
        if(b&1) ans*=a,ans%=mod;
        a*=a,a%=mod;
        b>>=1;
    }
    return ans;
}
int C(int a,int b){
    int s1=1,s2=1;
    for(int i=a;i>=a-b+1;i--) s1*=i,s1%=mod;
    for(int i=b;i>=1;i--) s2*=i,s2%=mod;
    return ((s1%mod)*ksm(s2,mod-2)%mod)%mod;
}
int lucas(int a,int b){
    if(b==0) return 1;
    return (C(a%mod,b%mod)*lucas(a/mod,b/mod))%mod;
}
signed main(){
	n=read(),m=read(),k=read();
	int Num=lucas((n*m)-2,k-2)%mod;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			int G=0;
			G+=(((n-i+1)*Qsum(1,m-j))%mod)+((n-i)*Qsum(1,j-1))%mod;G%=mod;
			G+=m*Qsum(1,n-i);G%=mod; 
			ans+=(G*Num);ans%=mod; 
		}
	}printf("%lld\n",ans);
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
m = 1000
k = 0
i=0
while i < n:
    f=1
    for j in range(i + 1, n):
        if a[i] < a[j]:
            f=0
            k += m // a[i]
            m %= a[i]
            m += a[j] * k
            k=0
            i = j
        else:
            break
    if f:
        i += 1
print(m)

Measured memory_bytes: 61896
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#define ll long long
using namespace std;
vector<pair<ll,ll>> sushi;
int N,K;
signed main(){
  cin >> N >> K;
  sushi.resize(N);
  for(int i = 0; i < N;i++){
    cin >> sushi[i].second >> sushi[i].first;
  }
  sort(sushi.begin(),sushi.end(),greater<pair<ll,ll>>());
  stack<ll> s;
  vector<bool> eaten(N + 1,false);
  ll typ = 0;
  ll sum = 0;
  for(int i = 0;i < K;i++){
    sum += sushi[i].first;
    if(not eaten[sushi[i].second]){
      typ++;
      eaten[sushi[i].second] = true;
    }
    else{
      s.emplace(sushi[i].first);
    }
  }

  ll ans = sum + typ * typ;
  for(int i = K;i<N;i++){
    sum += sushi[i].first;
    if(not eaten[sushi[i].second]){
      typ++;
      eaten[sushi[i].second] = true;
    }
    else{
      s.emplace(sushi[i].first);
    }

    if(s.empty()){
      break;
    }
    sum -= s.top();
    s.pop();
    ans = max(ans,sum + typ * typ);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2176
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

S = str(input())

if S == "ABC":
    print("ARC")
else:
    print("ABC")

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

int main() {
    int n,k;
    string s;
    cin >> n >> s >> k;
    char c=s[k-1];
    char ans[n];
    for(int i=0;i<n;i++){
        if(c==s[i]){
            ans[i]=c;
        }
        else{
            ans[i]='*';
        }
    }
    for(int i=0;i<n;i++){
        cout<<ans[i];
    }
}

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

namespace ABC137_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = ab[0];
            var b = ab[1];
            var mx = Math.Max(a + b, a - b);
            mx = Math.Max(mx, a * b);

            Console.WriteLine(mx);

        }
    }
}


Measured memory_bytes: 13396
<?php
fscanf(STDIN, "%d", $m);

while ($m--) {
  $str = rtrim(fgets(STDIN));
  $ans = array();
  
  for ($i = 1; $i < strlen($str); $i++) {
    $a = substr($str, 0, $i);
    $b = substr($str, $i);
    $ans[$a . $b] = 1;
    $ans[strrev($a) . $b] = 1;
    $ans[$a . strrev($b)] = 1;
    $ans[strrev($a) . strrev($b)] = 1;
    $ans[$b . $a] = 1;
    $ans[strrev($b) . $a] = 1;
    $ans[$b . strrev($a)] = 1;
    $ans[strrev($b) . strrev($a)] = 1;
  }
  
  print count($ans) . "\n";
}

Measured memory_bytes: 6732
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
using namespace std;

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


const int BIG_NUM = 1e8;

int main() {
	double a, b, h, m;

	cin >> a >> b >> h >> m;

	double th = ((h + m / 60) / 12) * M_PI * 2;
	double tm = (m / 60) * M_PI * 2;


	double td = abs(th - tm);

	cout <<fixed<< setprecision(10) << sqrt(a * a + b * b - 2 * a * b * cos(td));

}

Measured memory_bytes: 4208
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<list>
#define MOD 1000000007LL
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
int main() {
    string s;
    cin>>s;
    int n=s.length();
    vector<int> a;
    for(int i=0;i<n-1;i++){
        a.push_back(0);
    }
    ll ans=0;
    for(int i=0;i<=n-1;i++){
        if(i!=0){a[0]=1;}
        sort(a.begin(),a.end());
        do{
            ll sum=s[0]-'0';
            for(int j=1;j<n;j++){
                int b=s[j]-'0';
                if(a[j-1]==1){
                    ans+=sum;
                    sum=b;
                }else{
                    sum*=10;
                    sum+=b;
                }
            }
            ans+=sum;
        }while(next_permutation(a.begin(),a.end()));
        sort(a.begin(),a.end());
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
// not able to submit:(((((((((((((((
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fill(a,v) memset(a,v,sizeof(a))
#define d1(a) cout << a << "\n"
#define d2(a,b) cout << a << " " << b << "\n"
#define d3(a,b,c) cout << a << " " << b << " " << c << "\n"
#define d4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << "\n"
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;
bool fun(int n , int k){
	while(n >= k){
		while(n % k ==0)  n/=k;
		if(n >= k)  n%= k;
		else break;
	}
	return(n == 1);
}

int32_t main(){
	fast;
	int n;
	cin >> n;
	set<int>s;
	for(int i=2 ; i*i <= n ; i++){
		if(n % i == 0){
			if(fun(n , i))s.insert(i);
			if(fun(n , n/i))s.insert(n/i);
		}
	}
	int m = n - 1;
	for(int i=2 ; i*i <= m ; i++){
		if(m % i == 0){
			if(fun(n , i))s.insert(i);
			if(fun(n , m/i))s.insert(m/i);
		}
	}
	int ans  = sz(s) + 2;
	if(n == 2)  ans = 1;
	cout << ans;
}


Measured memory_bytes: 256
/******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/
import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		long k = sc.nextLong();
		long sum = 0;
		if(a >= k)
		{
		    sum = sum + 1 * k;
		}
		else
		{
		    k = k - a;
		    sum = sum + 1 * a;
		}
		k = k - b;
		if(k >= 1)
		{
		    if(c >= k)
		    {
		        sum = sum + (-1) * k;
		    }
		    else
		    {
		        k = k - c;
		        sum = sum + (-1) * c;
		    }
		}
		System.out.println(sum);
    }
}

Measured memory_bytes: 35896
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;
using Graph = vector<vector<int>>;

bool comp(pair<int, int> A, pair<int, int> B){
  return A.second < B.second;
}

signed main(){
  int N, M;
  cin >> N >> M;
  vector<pair<int, int>> task(M);
  for( int i = 0; i < M; i++ ){
    int A, B;
    cin >> A >> B;
    task.at(i) = {A, B};
  }
  sort(task.begin(), task.end(), comp);

  int ans = 0;
  int now = 0; //何番目の橋を取り除いたか
  for( int i = 0; i < M; i++ ){
    if( now >= task.at(i).first ) continue;
    now = task.at(i).second-1;
    ans++;
  }
  cout << ans << endl;

}


Measured memory_bytes: 1920
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#define  go return 0
#define pb push_back
#include<utility>
#include <algorithm>
#include<iterator>
typedef long long ll;
typedef double db;
#define lp1(i, n)  for(int i=0; i<(int)(n); ++i)
#define lp2(i, n)  for(int i=1; i<=(int)(n); ++i)
#define lp3(j, m)  for(int j=0; j<(int)(m); ++j)
#define all(v)   ((v).begin()), ((v).end())
#define sz(v)    ( (int)((v).size()) )
typedef vector<int> vi;
const int N=1e5+5;
int arr[N];
int main(){

 int n,arr[N],sum=0,count=0;
 cin>>n;
lp1(i,n)
cin>>arr[i];
for(int i=0 ; i<n ; i++)
{
    for(int j=i+1 ; j<n ; j++)
    {
        sum+=(arr[i]*arr[j]);
    }

}
cout<<sum;

go;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n;
	int in[100];
	int i, j;
	int ans;
	
	while (1){
		scanf("%d", &n);
		
		if (n == 0)break;
		
		for (i = 0; i < n; i++){
			scanf("%d", &in[i]);
		}
		
		ans = 0;
		for (i = 0; i < n - 1; i++){
			for (j = 0; j < n - i - 1; j++){
				if (in[j] > in[j + 1]){
					in[j] += in[j + 1];
					in[j + 1] = in[j] - in[j + 1];
					in[j] -= in[j + 1];
					
					ans++;
				}
			}
		}
		
		printf("%d\n", ans);
	}
	
	return (0);
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
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());
  cout << a[n-1]-a[0] << endl;
}

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

int main() {
  int X;
  cin >> X;
  if (X >= 30) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

void with_map(vector<int> arr,int n)
{
    map<int,int> count;
    int ans = 0;

    for(int i=0; i<n; i++){
        count[arr[i]]++;
    }
     for(auto u: count){
        if(u.second >= u.first) ans += u.second - u.first;
        else ans += u.second;
    }
    cout<<ans<<endl;
}

int main()
{
    int n;
    cin>>n;
    vector<int> arr(n);
    for(int i=0; i<n; i++){
        cin>>arr[i];
    }
    with_map(arr,n);
    return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;

// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

int main() 
{
	int N;
	cin >> N;
	int i;
	vector<int> A(N);
	rep(i, N) cin >> A[i];

	sort(ASC(A));

	cout << abs(A[N - 1] - A[0]) << endl;
}


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

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define sort(vvv) sort(vvv.begin(),vvv.end())
#define rvs(vvv) reverse(vvv.begin(),vvv.end())

using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	int ans = 0;
	ff(i, 0, 3) {
		if (s[i] == t[i])ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
def rle(str)

  n = str.size
  ret = []

  last = str[0]
  cnt = 0
  str += "\n"

  for i in 0 .. n
    if str[i] == last
      cnt += 1
    else
      ret << [last, cnt]
      last = str[i]
      cnt = 1
    end
  end

  return ret
end

n = gets.to_i
str = gets.chomp

puts rle(str).size


Measured memory_bytes: 14332
#include<iostream>
using namespace std;
int64_t N,X;
#define LAYER(L) ((1LL<<(L+2))-3LL)
#define PATTY(L) ((1LL<<(L+1))-1LL)
int64_t solve(int N,int64_t X){
    if(X==1LL)return (N==0?1LL:0LL);
    if(X<=1LL+LAYER(N-1))return solve(N-1,X-1LL);
    if(X==1LL+LAYER(N-1)+1LL)return PATTY(N-1)+1LL;
    if(X<=1LL+LAYER(N-1)+1LL+LAYER(N-1))return PATTY(N-1)+1LL+solve(N-1,X-2-LAYER(N-1));
    else return PATTY(N-1)*2+1LL;
}
int main(void){
    cin>>N>>X;
    cout<<solve(N,X)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int     main(void)
{
    int n[3];
    int i;
    int j;
    int tmp;

    tmp = 0;
    scanf("%d %d %d", &n[0], &n[1], &n[2]);
    i = -1;
    while (++i < 3)
    {
        j = -1;
        while (++j < 2)
        {
            if (n[j] > n[j + 1])
            {
                tmp = n[j];
                n[j] = n[j + 1];
                n[j + 1] = tmp;
            }

        }
    }
    printf("%d %d %d\n", n[0], n[1], n[2]);
    return (0);
}



Measured memory_bytes: 2004
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int32_t, int32_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

int32_t neighbours[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};

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

  int32_t N;
  cin >> N;
  vector<int32_t> S(N);
  int32_t total_sum = 0;
  for (int32_t i = 0; i < N; ++i) {
    cin >> S[i];
    total_sum += S[i];
  }
  int32_t result = 0;
  if (total_sum % 10 > 0) {
    result = total_sum;
  } else {
    sort(S.begin(), S.end());
    for (int32_t i = 0; i < N; ++i) {
      if (S[i] % 10 > 0) {
        result = total_sum - S[i];
        break;
      }
    }
  }
  cout << result << endl;

  return 0;
}


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

using namespace std;

struct TRAMP{
	char mark;
	int number;
};

int main(){
	int n,min;
	char buf[3];
	scanf("%d",&n);

	TRAMP selectArray[n],bubbleArray[n];

	for(int i = 0; i < n; i++){
		scanf("%s",buf);
		selectArray[i].mark = buf[0];
		selectArray[i].number = buf[1] - '0';
		bubbleArray[i] = selectArray[i];
	}

	for(int i = n-1; i >= 0; i--){
		for(int j = 0; j < i; j++){
			if(bubbleArray[j].number > bubbleArray[j+1].number) swap(bubbleArray[j], bubbleArray[j+1]);
		}
	}

	for(int i = 0; i < n-1; i++){
		min = i;
		for(int j = i+1; j < n; j++){
			if(selectArray[j].number < selectArray[min].number){
				min = j;
			}
		}
		if(i != min){
			swap(selectArray[i],selectArray[min]);
		}
	}

	for(int i = 0; i < n-1; i++) printf("%c%d ",bubbleArray[i].mark,bubbleArray[i].number);
	printf("%c%d\n",bubbleArray[n-1].mark,bubbleArray[n-1].number);
	printf("Stable\n");
	for(int i = 0; i < n-1; i++) printf("%c%d ",selectArray[i].mark,selectArray[i].number);
	printf("%c%d\n",selectArray[n-1].mark,selectArray[n-1].number);

	int p;
	for(p=0; p < n; p++){
		if(selectArray[p].number != bubbleArray[p].number || selectArray[p].mark != bubbleArray[p].mark)
			break;
	}
	if(p == n){
		printf("Stable\n");
	}else{
		printf("Not stable\n");
	}

	return 0;
}



Measured memory_bytes: 2752
N=int(input())
A=list(map(int,input().split()))
a_1=sum(A)
count=0
for i in range(0,len(A)-1):
    if A[i]>A[i+1]:
        A[i+1]=A[i]
    else:
        A[0]=A[0]
        A[i+1]=A[i+1]
a_2=sum(A)
print(a_2-a_1)
        
    

Measured memory_bytes: 32312
T = [s for s in input().strip()]

total_sum = 0
pre = T[0]
if pre == "D":
    total_sum = 1
elif pre == "?":
    total_sum = 1
    T[0] = "D"
    pre = "D"

for i in range(1, len(T)):
    now = T[i]
    if now == "D" and pre == "P":
        total_sum += 2
        pre = "D"
    elif now == "D" and pre == "D":
        total_sum += 1
        pre = "D"
    elif now == "?" and pre == "D":
        total_sum += 1
        pre = "D"
        T[i] = "D"
    elif now == "?" and pre == "P":
        total_sum += 2
        pre = "D"
        T[i] = "D"
    else:
        pre = now

print("".join(T))

Measured memory_bytes: 10948
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i = 0; i < n; i++)
typedef long long ll;
// Welcome to my source code!

int parent(int i) { return i/2; }
int left(int i) { return 2*i; }
int right(int i) { return 2*i+1; }

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

    for (int i = 1; i <= H; i++) {
        cout << "node " << i << ": key = " << A[i] << ", ";
        if (parent(i) >= 1) cout << "parent key = " << A[parent(i)] << ", ";
        if (left(i) <= H) cout << "left key = " << A[left(i)] << ", ";
        if (right(i) <= H) cout << "right key = " << A[right(i)] << ", ";
        cout << endl;
    }
}


Measured memory_bytes: 3124
N = int(input())
t = list(map(int,input().split()))
v = list(map(int,input().split()))

v.append(0)
interval = 0.5
total_t = sum(t)
now_t = 0
now_v = 0
T = [sum(t[:i]) for i in range(1,N+1)]
now_n = 0
d = 0
d_int = 0
while now_t < total_t:
	nxt_t, nxt_v = T[now_n], v[now_n + 1]
	delta_t, delta_v = nxt_t - now_t, nxt_v - now_v
	rest_t = [T[i]-now_t for i in range(N)]
	if now_v < v[now_n]:
		if delta_t + delta_v == 0:
			a = -1
		else:
			a = 1
	elif now_v == v[now_n]: 
		if delta_t + delta_v == 0:
			a = -1
		else:
			a = 0
	for i in range(N):
		rest = rest_t[i]
		if rest > 0:
			d_v = now_v - v[i+1]
			if rest == d_v:
				a = -1

	d_int += 2 * int(now_v * 2) + a
	d += now_v * interval + 1/2 * a * interval * interval
	now_t += interval
	now_v += a * interval
	if now_t == T[now_n]:
		now_n += 1

print(d)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> l(2*n);
    rep(i, 2*n)cin >> l[i];
    sort(all(l));
    ll ans = 0;
    rep(i, n){
        ans += l[2*i];
    }
    cout << ans << endl;
}   

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
#define LLINF 2000000000000000
#define MOD 1000000007
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
#define int long long

signed main(){
	int n,m;
	cin >> n >> m;
	if(n==m){
		int ans = 1;
		LOOP1(i,n){
			LOOP(j,2){
				ans*=i;
				ans%=MOD;
				// cerr << ans << endl;
			}
		}
		ans*=2;
		ans%=MOD;
		cout << ans << endl;
	}else if(n+1==m || m+1==n){
		int ans = 1;
		LOOP1(i,n){
			ans*=i;
			ans%=MOD;
			// cerr << ans << endl;
		}
		LOOP1(i,m){
			ans*=i;
			ans%=MOD;
			// cerr << ans << endl;
		}
		cout << ans << endl;
	}else{
		cout << 0 << endl;
	}
}


Measured memory_bytes: 256
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<bits/stdc++.h>
using namespace std;

//for loop関係
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

//略記
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

using ll = long long;
using P = pair<int,int>;
using itn = int;

//定数
const int INF = 1<<30;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

//Degree <-> Radian
double toRad(double d){ double rad; rad=d*PI/180; return rad; }
double toDegree(double rad){ double d; d=rad*180/PI; return d; }
//The least common multiple : lcm
ll lcm(int a,int b){ return a*b/__gcd(a,b); }
//素数判定
bool isPrime(int n){
    int i; 
    if(n<2) return 0;
    else if(n==2) return 1;
    if(n%2==0) return 0;
    for(i=3;i*i<=n;i+=2) if(n%i==0) return 0;
    return 1;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    string s,t;
    cin >> n >> s >> t;
    string ans="";
    rep(i,0,n){
        ans+=s[i];
        ans+=t[i];
    }
    cout << ans ENDL;
    return 0;
}

Measured memory_bytes: 3584
n = int(input())
h = list(map(int, input().split()))

cur = h[-1]
i = n - 2
flg = True
while i >= 0:
    if h[i] <= cur + 1:
        cur = min(cur, h[i])
    else:
        flg = False
        break
    i -= 1

print('Yes' if flg else 'No')


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

using namespace std;

long long n;
int x2;

int main()
{
    scanf("%lld",&n);
    if(n < 1000000001)
        printf("0 0 1 0 0 %lld\n",n);
    else
    {
        int q = sqrt(n - 1000000);
        x2 = (q + 1) * (q + 1) - n;
        printf("0 0 1 %d %d %d\n",q + 1,q + 1,x2);
    }
    return 0;
}


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

using namespace std;

#define MOD 1000000007
typedef unsigned long long ULL;
typedef long long LL;
bool checker(LL a, LL b){
    if( abs(a) < abs(b)){
        return true;
    }else{
        return false;
    }
}
bool rchecker(LL a, LL b){
    return !checker(a,b);
}
bool MinusCheck(int mem_of_plus, int mem_of_minus, int K){
    if( mem_of_plus + mem_of_minus - mem_of_minus % 1 < K){
        return true;
    }
    
    if( mem_of_plus == 0 && K % 2 == 1){
        return true;
    }
    return false;
}
int main(){
    LL *A;
    LL *minus;
    LL *plus;
    LL *calc;
    int mem_of_plus,mem_of_minus,mem_of_calc;
    int K,N;
    int i,j,pos;
    LL ans;
    LL a;
    int count;
    LL bef;
    cin >> N >> K;
    A = new LL[N];
    plus = new LL[N];
    minus = new LL[N];
    calc = new LL[N];

    mem_of_plus = mem_of_minus = 0;
    for(i=0;i<N;i++){
        cin >> a;
        if( a >= 0 ){
            plus[mem_of_plus++] = a;
        }else{
            minus[mem_of_minus++] = a;
        }
        A[i] = a;
    }
    ans = 1;
    if( N == K){
        for(i=0;i<N;i++){
            ans *= A[i];
            ans %= MOD;
            if( ans < 0 ){
                ans += MOD;
            }
       }
       cout << ans << endl;
       return 0;
    }
    //どうあがいてもマイナス
    if( 
        MinusCheck(mem_of_plus, mem_of_minus, K) == true ){
        ans = 1;
        sort(A,A+N,checker);
        for(i=0;i<K;i++){
            ans = ans * A[i];
            ans %= MOD;
            if( ans < 0 ){
                ans += MOD;
            }
        }
    }else{
        sort(minus,minus+mem_of_minus);
        sort(plus,plus + mem_of_plus,std::greater<LL>());
        if(K % 2 == 1){
            i=2;
        }else{
            i=1;
        }
        mem_of_calc = 0;
        for(;i<mem_of_plus;i+=2){
            calc[mem_of_calc++] = plus[i-1] * plus[i];
        }
        for(i=1;i<mem_of_minus;i+=2){
            calc[mem_of_calc++] = minus[i-1] * minus[i];
        }
        sort(calc,calc + mem_of_calc,std::greater<LL>());
        if(K % 2 == 1){
            ans = plus[0];
        }else{
            ans = 1;
        }
        for(i=0;i<K/2;i++){
            ans = ans * (calc[i] % MOD);
            ans %= MOD;
            if( ans < 0 ){
                ans += MOD;
            }
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12); // debuged
    int T;
    T = 1;
    while (T--) solve();
}

void solve() {
    int x, a;
    cin >> x >> a;
    cout << (x < a ? 0 : 10) << endl;
}


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

using namespace std;

#define ll long long
#define ini(arr, val) memset(arr, (val), sizeof(arr))
#define loop(i,n)  for(ll i=0; i<n; i++)
#define loop1(i,n)  for(ll i=1; i<=n; i++)

#define all(a)      (a).begin(),(a).end()
#define dupli(a)     unique(all(a)),(a).end()
#define exist(s,e)  (s.find(e)!=s.end())
#define dbg(x)  cout << #x << " is " << x << endl;
#define pt(x) cout<<x<<"\n"
#define pts(x) cout<<x<<" "

#define mp make_pair
#define pb push_back
#define F first
#define S second


#define inf (int)1e9
#define eps 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007


#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test   int t; cin>>t; while(t--)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef set<int> si;

typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<pll> vpll;
typedef vector<vl> vvl;
typedef map<ll,ll> mll;
typedef set<ll> sl;


//////////////////////////////////////////////////////////////////////////////////////////
//                      main starts
//////////////////////////////////////////////////////////////////////////////////////////
int const lmt=1e5+5;


int main(){

    ll a=0,b=0,c=0,d=0;
    string s;
    test{
    	cin>>s;
    	if(s=="AC") a++;
    	else if(s=="WA") b++;
    	else if(s=="TLE") c++;
    	else d++;
    }
    cout<<"AC"<<" "<<"x"<<" "<<a<<endl;
    cout<<"WA"<<" "<<"x"<<" "<<b<<endl;
    cout<<"TLE"<<" "<<"x"<<" "<<c<<endl;
    cout<<"RE"<<" "<<"x"<<" "<<d<<endl;




    
    

}


/*

// 

*/

Measured memory_bytes: 3624
from collections import deque

if __name__ == '__main__':
    n, k = list(map(int, input().split(" ")))
    p = list(map(int, input().split(" ")))

    d = deque([0])
    for i in range(n):
        d.append(d[i] + p[i])

    # print(d)

    max_sum = 0
    rangeN = n - k + 1

    for i in range(rangeN):
        sum_d = d[i + k] - d[i]
        if max_sum < sum_d:
            max_sum = sum_d
    # print(max_sum)

    # r_array = [sum(p[i:i + k]) for i in range(rangeN)]
    print((max_sum / 2) + (k * 0.5))

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

int main(){
        int H;
        int N;
        cin>>H>>N;
        int skill[N]={0};
        
        for(int i=0;i<N;i++){
            cin>>skill[i];  //=A[i];
            H-=skill[i];
            



        }
        if(H<=0){
                cout<<"Yes";
            }
            else cout<<"No";{ 
        }

}

Measured memory_bytes: 640