akhauriyash/Code-Regression huggingface dataset:
import sys,queue,math,copy
from fractions import gcd
input = sys.stdin.readline
LI = lambda : [int(x) for x in input().split()]
LI_2 = lambda : [int(x) / 2 for x in input().split()]

N,M = LI()
A = LI_2()

lcm = 1
for a in A:
    c = gcd(lcm,a)
    if (lcm//c) % 2 == 0:
        print (0)
        exit (0)
    lcm *= (a//c)

print (math.ceil((M//lcm) / 2))

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")
ll dp1[100010];
ll dp2[100010];
int main()
{
	string L;
	cin >> L;
	dp2[0] = 1;
	fx(L.size()) {
		int l = L[x] - '0';
		fy(2) {
			fz(2) {
				int v = y + z;
				if (l>v) {
					dp1[x + 1] += dp1[x] + dp2[x];
				}
				else if (l==y+z) {
					dp1[x + 1] += dp1[x];
					dp2[x + 1] += dp2[x];
				}
				else if(v!=2){
					dp1[x + 1] += dp1[x];
				}
				dp1[x + 1] %= MOD;
				dp2[x + 1] %= MOD;
			}
		}
	}
	ll ans = dp1[L.size()] + dp2[L.size()];
	/*fx(L.size()) {
		//ans += dp1[x + 1]+dp2[x+1];
		doublece(dp1[x + 1] , dp2[x + 1])
		ans %= MOD;
	}*/
	ce(ans%MOD)
    return 0;
}



Measured memory_bytes: 2176
#include<stdio.h>

int gcd(int x, int y)
{
    int z, r;
    
    if(x < y)
    {
        z = x;
        x = y;
        y = z;
    }
    
    while(y > 0)
    {
        r = x % y;
        x = y;
        y = r;
    }
    return x;
}

int main(void)
{
    int x, y;
    scanf("%d %d", &x, &y);
    printf("%d\n", gcd(x, y));
    
    return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>

using namespace std;

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



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

    if((N+1) / 2 >= K){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }

    return 0;

}


Measured memory_bytes: 256
//Never stop trying
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef string str;
typedef long long ll;
#define int ll
typedef double db;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<str> vs;
typedef vector<ld> vd;
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 2e5 + 10;
const int nx[4] = {0, 0, 1, -1}, ny[4] = {1, -1, 0, 0}; //right left down up

template<class T> using V = vector<T>;
template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); } // divide a by b rounded up
constexpr int log2(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))

#define dbg(x) cerr << " - " << #x << " : " << x << endl;
#define dbgs(x,y) cerr << " - " << #x << " : " << x << " / " << #y << " : " << y << endl;
#define dbgv(v) cerr << " - " << #v << " : " << endl << "[ "; for(auto it : v) cerr << it << ' '; cerr << ']' << endl;

void IO() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

vi bit(MX,0);

int get(int i){
	int ans=0;
	while(i){
		ans+=bit[i];
		i-=i&-i;
	}
	return ans;
}

void update(int i,int v){
	while(i<MX){
		bit[i]+=v;
		i+=i&-i;
	}
}


int32_t main() {
	boost; IO();

	int N,K; cin>>N>>K;
	int lk[K],rk[K]; 
	FOR(i,0,K) cin>>lk[i]>>rk[i];

	
	update(1,1);
	FOR(i,2,N+1){
		int ans=0;
		FOR(j,0,K){
			int l=lk[j],r=min(i-1,rk[j]);
			if(r<l) continue;
			ans+=get(i-l);
			ans%=MOD;
			ans-=get(i-r-1); ans%=MOD; ans+=MOD; ans%=MOD;
		}
		update(i,ans);
	}


	cout << get(N)-get(N-1) << endl;




	return 0;
}

/* Careful!!!
	.Array bounds
	.Infinite loops
	.Uninitialized variables / empty containers
	.Order of input

   Some insights:
	.Binary search
	.Graph representation
	.Write brute force code
	.Change your approach
*/


Measured memory_bytes: 4664
# frozen_string_literal: true

n, q = gets.chomp.split.map(&:to_i)
s = gets.chomp.split('')
lr = []
q.times do
  lr.push gets.chomp.split.map(&:to_i)
end
ac = []
flaga = false
count = 0
s.each do |c|
  case c
  when 'A'
    flaga = true
  when 'C'
    if flaga
      flaga = false
      count += 1
    end
  else
    flaga = false
  end
  ac.push count
end
lr.each do |e|
  l = e.first - 1
  r = e.last - 1
  puts (ac[r] - ac[l])
end


Measured memory_bytes: 23860
import java.util.Scanner;
class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力


		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] l = new int[m];
		int[] r = new int[m];
		
		for(int i = 0;i < m;i++){
			l[i] = sc.nextInt();
			r[i] = sc.nextInt();
		}
		
		int keyleft = 0;
		int keyright = Integer.MAX_VALUE;
		
		int ans = 0;
		
		for(int i = 0;i < m;i++){
			if(l[i] > keyright || r[i] < keyleft ){
				System.out.println(0);
				return;
			}
			if(l[i] > keyleft){
				 keyleft = l[i];
			}
			if(r[i] < keyright ){
				keyright = r[i];
			}
		}
		
		System.out.print(keyright-keyleft+1);
		
	}


	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}





}



class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
}




Measured memory_bytes: 83036
#include<iostream>
#include<string>
using namespace std;
int main() {
	string s;
	while (cin >> s){
		string str;
		if (s.size() % 2 == 0) {
			for (int i = 0; i < s.size(); i += 2){
				if (s[i] == '1') {
					if (s[i + 1] == '1')str += 'a';
					else if (s[i + 1] == '2')str += 'b';
					else if (s[i + 1] == '3')str += 'c';
					else if (s[i + 1] == '4')str += 'd';
					else if (s[i + 1] == '5')str += 'e';
					else {
						str = "NA";
						goto NA;
					}
				}
				else if (s[i] == '2') {
					if (s[i + 1] == '1')str += 'f';
					else if (s[i + 1] == '2')str += 'g';
					else if (s[i + 1] == '3')str += 'h';
					else if (s[i + 1] == '4')str += 'i';
					else if (s[i + 1] == '5')str += 'j';
					else {
						str = "NA";
						goto NA;
					}
				}
				else if (s[i] == '3') {
					if (s[i + 1] == '1')str += 'k';
					else if (s[i + 1] == '2')str += 'l';
					else if (s[i + 1] == '3')str += 'm';
					else if (s[i + 1] == '4')str += 'n';
					else if (s[i + 1] == '5')str += 'o';
					else {
						str = "NA";
						goto NA;
					}
				}
				else if (s[i] == '4') {
					if (s[i + 1] == '1')str += 'p';
					else if (s[i + 1] == '2')str += 'q';
					else if (s[i + 1] == '3')str += 'r';
					else if (s[i + 1] == '4')str += 's';
					else if (s[i + 1] == '5')str += 't';
					else {
						str = "NA";
						goto NA;
					}
				}
				else if (s[i] == '5') {
					if (s[i + 1] == '1')str += 'u';
					else if (s[i + 1] == '2')str += 'v';
					else if (s[i + 1] == '3')str += 'w';
					else if (s[i + 1] == '4')str += 'x';
					else if (s[i + 1] == '5')str += 'y';
					else {
						str = "NA";
						goto NA;
					}
				}
				else if (s[i] == '6') {
					if (s[i + 1] == '1')str += 'z';
					else if (s[i + 1] == '2')str += '.';
					else if (s[i + 1] == '3')str += '?';
					else if (s[i + 1] == '4')str += '!';
					else if (s[i + 1] == '5')str += ' ';
					else {
						str = "NA";
						goto NA;
					}
				}
				else {
					str = "NA";
					goto NA;
				}
			}
		}
		else{
			str = "NA";
			goto NA;
		}
	NA:cout << str << endl;
	}
}

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

const int MAX_H = 50, MAX_W = 50;

int h, w;
int c[MAX_H][MAX_W];
int dp[MAX_H][MAX_W];

int solve(int i, int j)
{
    if (dp[i][j] >= 0)
        return dp[i][j];

    int ans;
    if (i == 0 && j == 0)
        ans = c[i][j];
    else if (i == 0)
        ans = solve(i, j - 1) + c[i][j];
    else if (j == 0)
        ans = solve(i - 1, j) + c[i][j];
    else
        ans = min(solve(i, j - 1), solve(i - 1, j)) + c[i][j];

    return dp[i][j] = ans;
}

/*
int solve(int h, int w)
{
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (i == 0 && j == 0)
                dp[i][j] = c[i][j];
            else if (i == 0)
                dp[i][j] = dp[i][j - 1] + c[i][j];
            else if (j == 0)
                dp[i][j] = dp[i - 1][j] + c[i][j];
            else
                dp[i][j] = min(dp[i][j - 1], dp[i - 1][j]) + c[i][j];
        }
    }
    return dp[h - 1][w - 1];
}
*/

int main()
{
    cin >> h >> w;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            char ch;
            cin >> ch;
            c[i][j] = ch - '0';
        }
    }

    fill(&dp[0][0], &dp[MAX_H][0], -1);
    cout << solve(h - 1, w - 1) << endl;
    //fill(&dp[0][0], &dp[MAX_H][0], 0);
    //cout << solve(h, w) << endl;
}

Measured memory_bytes: 1184
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

 
//FUNCTION
 
//SOLVE
void solve(void)
{
  string str;
  cin>>str;
  reverse(ALL(str));
  int WC = 0;
  int ANS= 0 ;
  for (int i = 0; i < str.size(); i++)
  {
    if(str[i] == 'W')WC++;
    else ANS += WC;
  }
  cout<<ANS<<endl;
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


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

int main() {
	string x, y;
	cin >> x >> y;

	for (int i = 0; i < (int) x.size(); i++) {
		string z = "";
		for (int j = (int) x.size() - 1 - i; j <= (int) x.size() - 1; j++) {
			z += x[j];
		}

		for (int j = 0; j < (int) x.size() - i - 1; j++) {
			z += x[j];
		}
		if (z == y){
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)


void solve(long long N){
    cout << "ABC" << N << endl;
}

int main(){

    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>
#include<sstream>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cout << '\n';}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << '[' << *it << " = " << a << "]  ";
    err(++it, args...);
}

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<lli, lli> tii;
typedef tuple<lli, lli, lli> tiii;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;


void solve(){
	char a,b; cin>>a>>b;
	int ac=a-'0', bc=b-'0';
	string sa="",sb="";
	rep(i,ac) sa+=b;
	rep(i,bc) sb+=a;
	cout<<((sa>sb)?sb:sa);

}

int main(){
	fast_io
	int tc=1;
	//cin>>tc;
	while(tc--){solve();}
	return 0;
}

Measured memory_bytes: 256
import itertools
N = int(input())
A = [[int(_) for _ in input().split()] for _ in range(N)]
ans = sum(sum(a) for a in A) // 2
seen = set()
for i in range(N):
    for j in range(i + 1, N):
        for k in range(N):
            if A[i][j] > A[i][k] + A[j][k]:
                print(-1)
                exit()
            elif k == i or i == j or j == k:
                continue
            elif A[i][j] == A[i][k] + A[j][k]:
                ans -= A[i][j]
                break
print(ans)


Measured memory_bytes: 44508
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define umap unordered_map
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
    if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
    }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




//———————UnionFind木   UF uf(n);——————————————————————————

struct UF {
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    UF(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void reset(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool same(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

//—————————————————————————————————————————————————



int main() {
  int n,m;
  cin >>n>>m;
  
  vector<int> p(n);
  rep(i,n){
  cin>>p[i];
  }
  
  UF uf(n);
    
  rep(i,m){
  ll x,y;
  cin>>x>>y;
    uf.unite(x-1,y-1);
  }
  
  int ans=0;
  
  rep(i,n){
    if(uf.root(i)==uf.root(p[i]-1)) ans++;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 2176
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long ans = 1;
        long chk = ans;
        while(chk < n){
            ans++;
            chk += ans;
        }
        System.out.println(ans);
    }
    
}

Measured memory_bytes: 23764
#include<stdio.h>
#include<string.h>

int main(){
    char s[1000];
    char t[1000];

    gets(s);
    gets(t);

    int ls=strlen(s);
    int lt=strlen(t);

    int mcount=0;

    for(int i=0;i<ls-lt+1;i++){
        int count=0;
        for(int j=0;j<lt;j++){
            if(s[i+j]==t[j])count++;
        }
        if(count>mcount)mcount=count;
    }

    printf("%d",lt-mcount);

}

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


string s;

void read() {
    int dummy;
    cin >> dummy >> s;
}


void work() {
    int ans = 0;
    int L = 0, R = s.size() - 1;
    while (L < R) {
        if (s[L] == 'W') {
            while (L < R && s[R] == 'W') --R;
            if (L == R) break;
            swap(s[L++], s[R--]);
            ++ans;
        } else {
            ++L;
        }
    }
    cout << ans << endl;
}


int main() {
    read();
    work();
    return 0;
}


Measured memory_bytes: 3736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define MAX 100000
void inarray(int a[], int n){
    for(int i = 0; i < n; i++) cin >> a[i];
}

int main(){
    int n; ll k; cin >> n >> k;
    int a[n]; inarray(a,n);
    ll ans =0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i == j) continue;
            if(a[i] > a[j]){
                if(i < j){
                    ans += k * (k+1)/2;
                    ans %= mod;
                }else{
                    ans += k * (k-1)/2;
                    ans %= mod;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, std::less<>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//*/998244353;
const int base = 2187;
const double eps = 1e-9;
const int N = 500'000;
const int LOGN = 19;

int n, m, k;

void solve(int) {
  string s, t;
  cin >> n >> s >> t;
  for (int i = 0; i < n; ++i) {
    cout << s[i] << t[i];
  }
  cout << '\n';
}

void precalc() {
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i) {
    solve(i);
  }
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


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


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)

ll gcd(ll a, ll b){
  ll x;
	while(a!=b){
    if(b==0)break;
    a=a%b;
    x=b;
    b=a;
    a=x;
  }
  return a;
}

//計算量はsqrt(N)
template<typename T>
vector<T> Divisors(T n)
{
    vector<T> result;

    T boundary = sqrt(n);

    for (T i = 1; i <= boundary; i++) {
        if (n % i == 0) {
            result.push_back(i);
            if(i != (n / i) && i * i != n)
                result.push_back(n/i);
        }
    }
    sort(result.begin(),result.end());
    return result;
}

//素数かどうかを判定するO(sqrt(n))
bool is_prime(ll n){
	for(ll i=2; i*i<=n; i++){
		if(n%i==0) return false;
	}

	return true;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b;
    cin>>a>>b;
    ll x = gcd(a,b);
    vector<ll> v = Divisors(x);
    ll ans = 0;
    FOR(i,0,v.size()){
      if(is_prime(v[i])) ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <fstream>
#include <iterator>
// #include "prettyprint.hpp"

using namespace std;
using ll = long long;

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

    vector<pair<ll, ll>> BA(N);
    for (int i = 0; i < N; i++)
    {
        int a, b;
        cin >> a >> b;
        BA[i] = make_pair(b, a);
    }

    sort(BA.begin(), BA.end());
    // cout << BA << endl;

    int now = 0;
    for (int i = 0; i < N; i++)
    {
        now += BA[i].second;
        if (BA[i].first < now)
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3328
S = input()

cA = S[0:1] == "A"
cC = False
if(S[2:-1].count("C") == 1):
    A = S[1:2] + S[2:-1].replace("C", "") + S[-1:]
    # print(S)
    cC = A.islower()
if(cA and cC):
    print("AC")
else:
    print("WA")

Measured memory_bytes: 3060
import numpy as np
N = int(input())
AB = []
for i in range(N):
    AB.append(list(map(int,input().split())))
AB = np.array(AB)
scores = np.argsort(np.sum(AB,axis=1))[::-1]
# diff = np.zeros(1).astype("int64")
ascore = AB[scores[0::2]][:,0].sum()
bscore = AB[scores[1::2]][:,1].sum()
print(ascore-bscore)

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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> c(n), v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    for (int i = 0; i < n; i++) cin >> c[i];

    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (v[i] > c[i]) ans += v[i] - c[i];
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  int trees[N-1];
  for (int i=0; i < N; ++i) {
    cin >> trees[i];
  }

  sort(trees, trees + N, greater<int>());
  int min = 1000000000;
  for (int i=0; i<N-K+1; ++i) {
    int a;
    a = trees[i] - trees[i+K-1];
    if (a < min) {
      min = a;
    }
  }
  cout << min << endl; 
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
    str s;cin>>s;
    int a=s.size()-2;

    cout<<s[0]<<a<<s[s.size()-1]<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <cstdio>
#include <math.h>
using namespace std;

#define ll long long
#define vecint vector<int>
#define listint list<int>
#define Pii pair<int, int>

#define REP(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define print(a) cout << a << endl

#define MOD 1000000007
#define NIL -1


int main(){
  int N,K,X,Y;
  cin>>N>>K>>X>>Y;
  ll ans=0;
  if(N<=K){
    ans+=N*X;
  }else{
    ans+=K*X+Y*(N-K);
  }
  print(ans);
  return 0;
}


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

const int nax = 5e5+5;
vector<long long> ft(nax, 0);
int n;

int LSBOne(int x) {
	return x&(-x);
}

void modify(int p, int v) {
	//for(st[p+=n] += v;p>0;p>>=1) st[p>>1] = st[p] + st[p^1];
	for(int i = p; i <= n; i += LSBOne(i)) ft[i] += v; 
}

long long sum(int l) {
	long long ans = 0;
	for(int i = l; i > 0; i -= LSBOne(i)) ans += ft[i];
	return ans;
}

int main() {
	int q, a, b, t;
	cin >> n >> q;
	for(int i = 0; i < n; i++) {
		cin >> a;
      	modify(i+1, a);
	}
	//ft[0] = 0;
	//for(int i = 1; i < n; i++) ft[i] = ft[i-1] + arr[i];
	while(q--) {
		cin >> t >> a >> b;
		if(!t) {
			modify(a+1, b);
		}
		else cout << sum(b) - sum(a) << endl;
	}
	return 0;
}


Measured memory_bytes: 8220
#include <iostream>
#include <string>
#include <vector>

bool input(std::string& num);
int plus(std::string num);
void output(std::vector<int> answer);

int main()
{
	std::vector<int> answer;
	std::string num;
	while (input(num))
	{
		answer.emplace_back(plus(num));
	}
	output(answer);
}

bool input(std::string& num)
{
	std::cin >> num;
	if (num != "0")
	{
		return true;
	}
	else
	{
		return false;
	}
}

//再帰を使ってみたかった
//int plus(int num, int sum)
//{
//	if (num == num % 10) return sum+num;
//	return plus(num/10, sum+num%10);
//}

int plus(std::string num)
{
	const char* cstr = num.c_str();
	size_t size = num.size();
	int sum = 0;
	for (int i = 0; i < size; i++)
	{
		sum += cstr[i]-'0';
	}
	return sum;
}

void output(std::vector<int> answer)
{
	for (auto sum : answer)
	{
		std::cout << sum << std::endl;
	}
}




Measured memory_bytes: 3144
<?php

fscanf(STDIN, "%d %d", $a, $b);

$total = $a + $b;

if ($a % 3 ===0 || $b % 3 === 0 ||  $total % 3 === 0) {
    echo 'Possible';
} else {
    echo 'Impossible';
}


?>

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

using namespace std;

string s;
int N, sol, a[100005];

int main() {
    ios_base::sync_with_stdio(false);
    cin >> N;
    for (int i = 1; i <= N; ++i) {
        int x, y;
        cin >> x >> y;
        a[x]++;
        a[y + 1]--;
    }
    
    for (int i = 1; i <= 100000; ++i) {
        a[i] += a[i - 1];
    }

    for (int i = 1; i <= 100000; ++i) {
        if (a[i] > 0) {
            ++sol;
        }
    }
    
    
    cout << sol << '\n';
    return 0;
}


Measured memory_bytes: 640
import collections

n = int(input())

s = []
for i in range(n):
  s.append(input())
  
s_colle = collections.Counter(s)

print('AC x ' + str(s_colle['AC']))
print('WA x ' + str(s_colle['WA']))
print('TLE x ' + str(s_colle['TLE']))
print('RE x ' + str(s_colle['RE']))

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

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int main(){
  int N;
  cin >> N;
  vector<int> v(N);
  rep(i, N){
    v.at(i) = (i+1);
  }
  vector<int> P(N), Q(N);
  rep(i, N){
    int a;
    cin >> a;
    P.at(i) = a;
  }
  rep(i, N){
    int a;
    cin >> a;
    Q.at(i) = a;
  }
  int a, b, count = 0;
  do{
    count++;
    if(P == v){
      a = count;
    }
    if(Q == v){
      b = count;
    }
  }while(next_permutation(all(v)));
  cout << abs(a - b) <<endl;
}
  

Measured memory_bytes: 256
def differ_by_1bit(n,end):
    if n==1:
        return [0,1]
    list=differ_by_1bit(n-1,0)
    for i in range(len(list)):
        q=list[i]//2**end
        r=list[i]%2**end
        list[i]=q*2**(end+1)+r
    list2=[2**end+list[-i-1] for i in range(len(list))]
    return list+list2

def differ_by_1bit_all(n):
    if n==1:
        return [0,1]
    if n%2==1:
        list1=differ_by_1bit_all(n-1)
        list2=differ_by_1bit(n-1,n-2)
        list2=[list2[i]^(2**(n-1)+2**(n-2)-1) for i in range(len(list2))]
        return list1+list2
    else:
        list1=differ_by_1bit(n-1,n-2)
        list1=[list1[i]<<1 for i in range(len(list1))]
        list2=differ_by_1bit_all(n-1)
        list2=[(list2[i]<<1)^(2**(n-1)+1) for i in range(len(list2))]
        return list1+list2

def convert(n,table):
    res=0
    for i in range(len(table)):
        if n>>i &1==1:
            res+=2**table[i]
    return res

def differ_by_1bit_free(n,end):
    T=[]
    F=[]
    for i in range(n):
        if end>>i &1==1:
            T.append(i)
        else:
            F.append(i)
    t=len(T)
    f=len(F)
    if t==n:
        return differ_by_1bit_all(n)
    list1=differ_by_1bit(f,0)
    list2=differ_by_1bit_all(t)
    res=[]
    for i in range(2**t):
        if i%2==0:
            res+=list1
        else:
            res+=list1[::-1]
    for i in range(2**n):
        res[i]=convert(res[i],F)
    for i in range(2**t):
        c=convert(list2[i],T)
        for j in range((2**f)*i,(2**f)*(i+1)):
            res[j]=res[j]^c
    return res

N,A,B=map(int,input().split())
test=B^A
check=0
for i in range(N):
    if test>>i &1==1:
        check+=1
if check%2==0:
    print("NO")
else:
    ans=differ_by_1bit_free(N,test)
    for i in range(len(ans)):
        ans[i]=ans[i]^A
    print("YES")
    print(*ans)

Measured memory_bytes: 11584
x = int(input())
line = []
for i in range(1, x+1):
    count = 0
    if i%2 == 0:
        continue
    for j in range(1, i+1):
        if i%j == 0:
            count += 1
    if count == 8:
        line.append(i)
print(len(line))

Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int x = sc.nextInt();

    if(400 <= x && x <= 599){
      System.out.println(8);
    }else if(600 <= x && x <= 799){
      System.out.println(7);
    }else if(800 <= x && x <= 999){
      System.out.println(6);
    }else if(1000 <= x && x <= 1199){
      System.out.println(5);
    }else if(1200 <= x && x <= 1399){
      System.out.println(4);
    }else if(1400 <= x && x <= 1599){
      System.out.println(3);
    }else if(1600 <= x && x <= 1799){
      System.out.println(2);
    }else if(1800 <= x && x <= 1999){
      System.out.println(1);
    }
    
  }
}

Measured memory_bytes: 35684
import sys
sys.setrecursionlimit(10**7+1)

N,M = map(int,input().split())
V = [i for i in range(N)]
E =[[] for i in range(N)]
for _ in range(M):
    a,b = map(int,input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)
visited = [False for _ in range(N)]
def dfs(v,parent,origin):
    visited[v] = True
    for e in E[v]:
        if e == parent:
            continue
        if visited[e]:
            continue
        V[e] = origin
        dfs(e,v,origin)

for i in range(N):
    if visited[i]:
        continue
    dfs(i,-1,i)
count = 0
for i,v in enumerate(V):
    if i==v:
        count+=1

print(count-1)





Measured memory_bytes: 53536
N = int(input())
Vlist = list(map(int, input().split()))
Clist = list(map(int, input().split()))

X = 0
Y = 0
for i in range(N):
    if Vlist[i] > Clist[i]:
        X += Vlist[i]
        Y += Clist[i]
print(X - Y)

Measured memory_bytes: 3060
/* Aditya0412 */
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
//#define pop pop_back
#define mp make_pair
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpl vector < pll >
#define fi first
#define sz size 
#define len length 
#define se second 
//const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=1000000+6;
#define M_PI           3.14159265358979323846
void inp(ll *arr,ll n)
{
  for(int i=0;i<n;i++)
    cin>>arr[i];
}
int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //  #ifndef ONLINE_JUDGE
    //   freopen ("INPUT.txt" , "r" , stdin);
    //   freopen ("OUTPUT.txt", "w" , stdout);
    // #endif 
      ll ans=0;
      ll n;
      cin>>n;
      for(int i=1;i<=n;i++)
      	if(i%3!=0 and i%5!=0)
      		ans+=i;
      	cout<<ans;
} 

Measured memory_bytes: 3640
import sys
input = sys.stdin.readline
read = sys.stdin.read
import numpy as np

n = int(input())
A = np.array(read().split(), dtype=np.int64)
m = 30
C = np.zeros(m, dtype=bool)
used = np.zeros(n, dtype=bool)
x = 0
for a in A:
  x ^= a
for i in range(m):
  idx = np.where(A>>i & 1)
  if np.any(~used[idx]):
    C[i] = True
  used[idx] = True
total = 0
ans = 0
for i in range(m-1, -1, -1):
  if (x>>i & 1) ^ total:
    if C[i]:
      ans += 1
      total ^= 1
    else:
      print(-1)
      break
else:
  print(ans)

Measured memory_bytes: 24656
#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 n, k;
  cin >> n >> k;
  vector<int> p(n), c(n);
  rep(i, n) {
    cin >> p.at(i);
    p.at(i)--;
  }
  rep(i, n) cin >> c.at(i);

  ll ans = -1e18 - 1;
  rep(si, n) {
    // 周期を求める
    int cycle = 0;
    ll loopPoint = 0;
    int current = si;
    while (true) {
      int next = p.at(current);
      loopPoint += c.at(next);
      cycle++;
      if (si == next) break;
      current = next;
    }

    // 最大値を求める
    ll tmp = 0;
    current = si;
    rep(i, cycle) {
      if (i >= k) break;
      int next = p.at(current);
      tmp += c.at(next);
      ll sum = tmp;
      if (loopPoint > 0) {
        sum += (k - i - 1) / cycle * loopPoint;
      }
      ans = max(ans, sum);
      current = next;
    }
  }

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

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long int test;//10 9 10 10
	set<string> se;
	string s;
	cin>>test;
	while(test--)
	
	{
			cin>>s;
			se.insert(s);
	
	}
		cout<<se.size()<<endl;
	return 0;
}

Measured memory_bytes: 19252
#include <iostream>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iomanip>
#include <climits>

using namespace std;

int main(){
	string A,B,C;
	int a,b,c;
	cin >> A >> B >> C;
	a = A.length();
	b = B.length();
	c = C.length();
	if(A[a-1] == B[0] && B[b-1] == C[0]){
		cout << "YES" << endl;
	}else{cout << "NO" << endl;}
	return 0;
}

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

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

	sort(p,p+n);
	int ans = 0;
	for (int i = 0; i < k; i++) {
		ans += p[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
fn main() {
    let hw = read_vec::<u64>();
    let h = hw[0];
    let w = hw[1];

    if h == 1 || w == 1 {
        println!("1");
        return
    }

    let (odd, even) = {
        if w % 2 == 0 {
            (w / 2, w / 2)
        } else {
            ((w / 2) + 1, w / 2)
        }
    };

    let ret = {
        if h % 2 == 0 {
            odd * (h / 2) + even * (h / 2)
        } else {
            odd * (h / 2 + 1) + even * (h / 2)
        }
    };
    println!("{}", ret);
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
vector<long long int>vec[100003];
queue<long long int>que;
long long  ind[100003] = {0};
long long  dp[100003] = {0};

int main()
{
    long long N,M,x,y,ans = 0;
    cin >> N >> M;
    while(M--)
    {
        cin >> x >> y;
        vec[x].push_back(y);
        ind[y]++;
    }
    for(int i = 1 ; i<=N ;i++)
    {
        if(!ind[i]){que.push(i);}
    }
    while(!que.empty())
    {
        int index = que.front();
        que.pop();
        ans = max(ans, dp[index]);
        for(int i = 0 ; i < vec[index].size() ; i++)
        {
            dp[vec[index][i]] = max(dp[vec[index][i]] ,dp[index] + 1);
            ind[vec[index][i]]--;
            if(!ind[vec[index][i]])que.push(vec[index][i]);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 7296
S=str(input())
Q=int(input())
which=0
front=""
back=""
for i in range(Q):
    a=list(map(str,input().split()))
    if a==["1"]:
        which+=1
        which%=2
        continue
    else:
        if which==0:
            if a[1]=="1":
                front=a[2]+front
            if a[1]=="2":
                back+=a[2]
        if which==1:
            if a[1]=="1":
                back+=a[2]
            if a[1]=="2":
                front=a[2]+front

S=front+S+back
if which==1:
    print(S[::-1])
if which==0:
    print(S)

Measured memory_bytes: 4616
#include <bits/stdc++.h>
using namespace std;
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define dforr(i, a, b) for(int i = (int)(b-1); i >= (a); i--)
#define dforn(i, n) dforr(i, 0, n)
#define db(v) cerr << #v << " = " << v << endl
#define pb push_back
#define sz(x) ((int)x.size())
#define ff first
#define ss second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
const int MAXN = 100500;

struct coso{ int val, id; bool cond;};
bool operator<(coso a, coso b){ return a.val < b.val;}

int n, A[MAXN], B[MAXN];
vector<coso> V;

bool IL[MAXN], IR[MAXN];
vector<int> L, R, BT;
bool bad(){
    L.clear(); R.clear();
    forn(i, MAXN)IL[i] = IR[i] = 0;
    forn(i, n){
        if(V[i].cond) IR[V[i].id] = true;
        else IL[V[i].id] = true;
    }
    forn(i, n){
        if(IL[i] && IR[i]) return false;
        if(IL[i])L.pb(i);
        if(IR[i])R.pb(i);
    }
    return sz(L) && sz(R);
}

int main(){
//	freopen("input.txt", "r", stdin);
	while(scanf("%d", &n) >= 1){
        forn(i, n){
            scanf("%d %d", &A[i], &B[i]);
            V.pb({A[i], i, 0}); V.pb({B[i], i, 1});
        }
        sort(V.begin(), V.end());
        ll sum = 0; forn(i, n) sum += V[i].val;
        if(bad()){
            assert(sz(L) + sz(R) == n);
            if(V[n-1].id == V[n].id){
                ll sum1 = sum + V[n].val - V[n-2].val;
                ll sum2 = sum + V[n+1].val - V[n-1].val;
                sum = min(sum1, sum2);
            }
            else sum = sum + V[n].val - V[n-1].val;
        }
        printf("%lld\n", sum);
    }
	return 0;
}


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

int main(void) {
 int N, A, B, C, D;
  string S;
  cin >> N >> A >> B >> C >> D;
  cin >> S;
  
  A--;B--;C--;D--;
  
  int flag = true;

  int end = C;
  if (C < D) {
    end = D;
  }
  for(int i = A; i + 1 <= end; i++) {
   if(S[i] == '#' && S[i+1] == '#') {
     flag = false;
     break;
   }
  }
  
  if(flag == false) {
   cout << "No" << endl; return 0; 
  }
  
  if( C > D ) {
   flag = false;
   for(int i = B; i <= D ; i++) {
    if(S[i-1] == '.' && S[i] == '.' && S[i+1] == '.') {
      flag = true;
      break;
    }
   }
  }
  if(flag == false) {
   cout << "No" << endl; return 0; 
  }
  
  
  cout << "Yes" << endl;
  
 return 0; 
}

Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

template<typename t1, class t2>
void input(t1 count,t2 array) {
	for(t1 i = 0;i < count;i++) {
		cin >> array[i];
	}
}

template<typename t1, class t2>
void output(t1 count,t2 array) {
	for(t1 i = 0;i < count;i++) {
		cout << array[i];
		if(i != count - 1) cout << " ";
	}
	cout << endl;
}

int n,s[10000],t[500],q,c;

bool exists(int x) {
	for(int i = 0;i < n;i++) if(s[i] == x) return true;
	return false;
}

int main(int argc,char** argv) {
	cin >> n;
	input(n,s);
	cin >> q;
	input(q,t);
	for(int i = 0;i < q;i++) {
		if(exists(t[i]))c++;
	}
	cout << c << endl;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
#include <math.h>
#include <float.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

const int MOD = 1000000007;

vector<bool> pushed(100005, false);
vector<int> a;
int N;
int ans = -1;

void dfs(int button, int count=0){
    if (pushed[button]) return;
    if (button == 1) {
        ans = count; return;
    }
    pushed[button] = true;
    dfs(a[button], count+1);

}

int main(){
    cin >> N;
    a.assign(N, 0);
    rep(i,N) {
        int b; 
        cin >> b;
        a[i] = --b;    
    }
    dfs(0);

    cout << ans << endl;
}

Measured memory_bytes: 3788
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <bitset>
#include <complex>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;


int main(){
    int N;
    cin >> N;
    ll A[100000];
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    ll num[100000]={};
    num[0]=3;
    
    ll ans=1;
    for(int i=0; i<N; i++){
        if(num[A[i]]==0){
            ans=0;
        }else if(num[A[i]]==3){
            num[A[i]]--;
            num[A[i]+1]++;
            ans *= (ll)3;
            ans %= MOD;
        }else if(num[A[i]]==2){
            num[A[i]]--;
            num[A[i]+1]++;
            ans *= (ll)2;
            ans %= MOD;
        }else if(num[A[i]]==1){
            num[A[i]]--;
            num[A[i]+1]++;
        }
    }
    
    cout<<ans<<endl;
    return 0;
    
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using pq = priority_queue<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -MOD * MOD;
const long double pi = 3.141592653589793;
int main() { // 問題文はしっかり読め!!!
	int n, m, x;
	cin >> n >> m >> x;
	V val(n);
	VV a(n, V(m));
	rep(i, n) {
		cin >> val[i];
		rep(j, m) {
			cin >> a[i][j];
		}
	}
	int ans = upper;
	rep(bit, 1 << n) {
		vector<bool> buy(n, false);
		rep(i, n) {
			if (bit & (1 << i)) buy[i] = true;
		}
		V wa(m, 0);
		int tmp = 0;
		rep(i, n) {
			if (buy[i]) {
				tmp += val[i];
				rep(j, m) {
					wa[j] += a[i][j];
				}
			}
		}
		bool ok = true;
		rep(i, m) {
			if (wa[i] < x) ok = false;
		}
		if (ok) chmin(ans, tmp);
	}
	if (ans == upper) cout << -1 << endl;
	else cout << ans << endl;
	return 0;
}

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

left = 0
right = 0
max_len = 0

while left < n:
    if right == n - 1:
        max_len = max(max_len, right - left)
        break

    if h[right] >= h[right + 1]:
        right += 1
    else:
        max_len = max(max_len, right - left)
        left = right + 1
        right = left

print(max_len)


Measured memory_bytes: 15020
#include<stdio.h>
   double W,H,x,y;
   double e;
   int main()
   {
   while(scanf("%lf%lf%lf%lf",&W,&H,&x,&y)!=EOF)
	  {
	  e=W*H/2;
	  printf("%lf ",e);
	  if(x==W/2&&y==H/2)
	  printf("1\n");
	  else
	  printf("0\n");
      }
   }

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ull unsigned long long
using namespace std;

const int mod = 1e9+7;
int main() {
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  int n,m;
  cin>>n>>m;
  int a;
  priority_queue<int> q;
  for(int i=0;i<n;i++) cin>>a,q.push(a);
  while(m--) {
    int price = q.top();
    q.pop();
    q.push(price>>1);
  }
  ull sum = 0;
  while(!q.empty())
    sum+=q.top(),q.pop();
  cout<<sum;
  cout<<"\n";
  return 0;
}

Measured memory_bytes: 892
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

int main(){
  
  long long int N, M, tmp1, tmp2;
  std::vector<long long int> s, c;
  scanf("%lld%lld", &N, &M);

  for(long long int i = 0; i < M; i++){
    scanf("%lld%lld", &tmp1, &tmp2);
    s.push_back(tmp1-1);
    c.push_back(tmp2);
  }

  std::vector<long long int> number(N);
  long long int contradiction = 0;

  for(long long int i = 0; i < N; i++){
    number[i] = -1;
  }

  for(long long int i = 0; i < M; i++){
    if(number[s[i]] == -1){
      number[s[i]] = c[i];
    }
    else{
      if(number[s[i]] != c[i]){
        contradiction = 1;
        break;
      }
    }
  }

  // print answer
  std::cerr << "Answer:" << std::endl;
  if(contradiction){
    std::cout << -1 << std::endl;
  }
  else if(N > 1 && number[0] == 0)
  {
    std::cout << -1 << std::endl;
  }
  else if(N == 1 && M == 0){
    std::cout << 0 << std::endl;
  }
  else{
    if(number[0] == -1){
      std::cout << 1;
    }
    else{
      std::cout << number[0];
    }
    for(long long int i = 1; i < N; i++){
      if(number[i] == -1){
        std::cout << 0;
      }
      else{
        std::cout << number[i];
      }
    }std::cout << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!

n, m = map(int, input().split())
a = list(map(int, input().split()))

l = []
for _ in range(m):
    l.append(list(map(int, input().split())))
    
l = sorted(l, key=lambda x:x[1], reverse=True)

top_n = []
flag = False
for bi, ci in l:
    for _ in range(bi):
        if len(top_n) < n:
            top_n.append(ci)
        else:
            flag = True
    if flag:
        break
a.extend(top_n)

print(sum(sorted(a, reverse=True)[:n]))

Measured memory_bytes: 36812