akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  string X = "keyence";
  bool exist = false;
  
  int count = 0;
  for(int i=0; i<7; i++){
    if(S.at(i) == X.at(i)){
      count++;
    }
    else{
      break;
    }
  }
  int last = 6;
  for(int j=S.size()-1; j>=S.size()-8; j--){
    if(j < 0){
      break;
    }
    if(S.at(j) == X.at(last)){
      count++;
      last--;
    }
    else{
      break;
    }
  }
  
  if(count >= 7){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }

}

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

const int MAXN = 3e5, total = 2e6;
int a[MAXN], segTree[total], ans = 0;

int rangeQuery(int qlow, int qhigh, int low, int high, int pos) {
	if(qlow <= low && high <= qhigh) {
		return segTree[pos];
	}
	if(qlow > high || low > qhigh) {
		return 0;
	}
	int mid = (low+high)/2;
	int val1 = rangeQuery(qlow, qhigh, low, mid, 2*pos+1);
	int val2 = rangeQuery(qlow, qhigh, mid+1, high, 2*pos+2);
	return max(val1, val2);
}

void update(int val, int idx, int low, int high, int pos) {
		if(low == high) {
			segTree[pos] = max(segTree[pos], val);
			return;
		}
		int mid = (low+high)/2;
		if(idx <= mid) {
			update(val, idx, low, mid, 2*pos+1);
		}
		else{
			update(val, idx, mid+1, high, 2*pos+2);
		}
		segTree[pos] = max(segTree[2*pos+1], segTree[2*pos+2]);
	}

int main() {
//	freopen("hayfeast.in", "r", stdin);
//	freopen("hayfeast.out", "w", stdout);
	int n, k;
	cin >> n >> k;
	for(int i=0; i<n; i++) {
		cin >> a[i];
	}
	memset(segTree, 0, sizeof(segTree));
	for(int i=0; i<n; i++) {
		int c = max(a[i]-k, 0);
		int best = rangeQuery(c, a[i]+k, 0, MAXN, 0);
		update(best+1, a[i], 0, MAXN, 0);
		ans = max(best+1, ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 12620
#include <iostream>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define MOD 1000000007
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


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


	ll n, a, b;
	cin >> n >> a >> b;
	Array h(n, 0);
	REP(i, n) cin >> h[i];
	sort(all(h), greater<ll>());

	ll k = abs(a - b);

	auto check = [&](ll x)->ll {
		ll sum = 0;
		REP(i, n) {
			ll y = h[i] - b * x;
			if (y>0) {
				sum += y / k;
				if (y % k != 0) sum++;
			}
			if (sum > x) return 0;
		}
		return 1;
	};


	ll l = -1;
	ll r = 1e9 + 1;

	while (l + 1 < r) {
		ll mid = l + r >> 1;
		if (check(mid)) {
			r = mid;
		}
		else {
			l = mid;
		}
	}

	cout << r << endl;

	return 0;
}

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

int main(){
  int a,b;
  int p,m;
  cin >> a >> b;
  p = a * b;
  m = p % 2;
  if ( m == 1 ) {
    cout << "Odd" << endl;
  }
  else {
    cout << "Even" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
#define S set<int>
#define itn int
bool dbg = false;
int N;
int A[303030];

//Template by yosupo
template <uint MD>
struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(_v % MD + MD); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(ull(v) * r.v % MD); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1)
                r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<MOD>;


//Template by yosupo
const int MN = 1'000'000;
Mint fact[MN], iFac[MN];

void first() {
    fact[0] = Mint(1);
    for (int i = 1; i < MN; i++)
        fact[i] = fact[i - 1] * Mint(i);
    iFac[MN - 1] = fact[MN - 1].inv();
    for (int i = MN - 1; i >= 1; i--) {
        iFac[i - 1] = iFac[i] * Mint(i);
    }
    assert(fact[2345] * iFac[2345] == Mint(1));
}
Mint C(int n, int k) {
    if (n < k || k < 0)
        return Mint(0);
    return fact[n] * iFac[k] * iFac[n - k];
}
//int c[100];

void solve() {
    first();
    Mint ans = 0;
    FOR(i, 0, 60) {
        int c = 0;
        int d = 0;
        FOR(k, 0, N) {
            if (A[k] & (1ll << i)) {
                c++;
            } else {
                d++;
            }
        }
        int tmp = (1ll << i);
        Mint Mtmp = tmp;
        ans += (Mtmp)*c * d;
    }
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    FOR(i, 0, N)
    cin >> A[i];
    solve();
    return 0;
}


Measured memory_bytes: 10368
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef long double lb; 

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


int main() {
    ll x,y;
    cin >> x >> y;
    if(x*4 < y || y%2 == 1 || x*2 > y){
        cout << "No" << endl;
        return 0;
    }

    if(y%2 == 0){
        cout << "Yes" << endl;
        return 0;
    }
}


Measured memory_bytes: 3620
N = int(input())

def q(n):
    print(n, flush=True)
    ans = input()
    if ans == 'Vacant': quit()
    return ans

def f():
    lb = 0
    ub = N
    lba = q(lb)
    while ub - lb > 1:
        qry = (lb + ub) // 2
        qa = q(qry)
        if (not ((lb ^ qry) & 1) and lba == qa) or (((lb ^ qry) & 1) and lba != qa):
            lb = qry
            lba = qa
        else:
            ub = qry
f()

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

int main(){

    int A, B, K;
    cin >> A >> B >> K;

    vector<int> ans;
    for(int i = 1; i <= (int)max(A, B); i++){
        if(A % i == 0 && B % i == 0) ans.push_back(i);
    }

    cout << ans[ans.size() - K] << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.* ; 
import java.math.*;
class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner (System.in);
	int n = scan.nextInt();
 	int x = scan.nextInt();
    int z = scan.nextInt();
    List<Integer> l = new ArrayList<>() ;
    l.add(x);
    l.add(z);
    l.add(n);
	Collections.sort(l, Collections.reverseOrder());
    
    String s = l.get(0)+"" ;
    s = s.concat(l.get(1)+"");
    System.out.println(Integer.parseInt(s)+l.get(2));
    
    
    
  }
}


Measured memory_bytes: 20820
#include <stdio.h>
typedef long long ll;
char txt[4];
int gcd(int a, int b){
	return a%b?gcd(b,a%b):b;
}
int main(){
	int SW = 0;
	if(SW == 0){
		scanf("%s",txt);
		bool f = false;
		for(int i=0;i<3;i++) f|=txt[i]=='7';
		printf("%s",f?"Yes":"No");
	}
	else if(SW==1){
		ll N;scanf("%lld",&N);
		ll ret = N*(N+1)/2;
		ret -= 3*(N/3)*(N/3+1)/2;
		ret -= 5*(N/5)*(N/5+1)/2;
		ret += 15*(N/15)*(N/15+1)/2;
		printf("%lld",ret);
	}
	else{
		ll K;scanf("%lld",&K);
		ll sum=0;
		for(ll i=1;i<=K;i++){
			for(int j=1;j<=K;j++){
				for(int k=1;k<=K;k++){
					sum+=gcd(gcd(i,j),k);
				}
			}
		}
		printf("%lld",sum);
	}
}

Measured memory_bytes: 1728
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    long long int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    long long int ans=0;
    for(int i=0;i<k;i++)
    ans+=a[i];
    cout<<ans<<endl;
}


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

long long int N, fact[10010101], ifact[10010101], ans;
constexpr long long int M = 1000000007;

int main(){
    scanf("%lld", &N);
    *fact = 1;
    for(int i = 1; i < N; ++i){
        fact[i] = fact[i - 1] * i % M;
    }
    long long n = M - 2, r = fact[N - 1];
    ifact[N - 1] = 1;
    while(n){
        if(n & 1){
            ifact[N - 1] = ifact[N - 1] * r % M;
        }
        n /= 2;
        r = r * r % M;
    }
    for(int i = N - 1; i > 0; --i){
        ifact[i - 1] = ifact[i] * i % M;
    }
    ans = fact[N - 1] * (N - 1);
    for(int i = N / 2; i < N - 1; ++i){
        ans += M - fact[i] * fact[i - 1] % M * ifact[i * 2 - N] % M;
    }
    ans %= M;
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int n,s;

int F(int deps,int cnt,int sum){
    if(deps == 10){
        if(cnt == n && sum == s)return 1;
        return 0;
    }
    return F(deps + 1,cnt + 1,sum + deps) + F(deps + 1,cnt,sum);
}

int main()
{
    while(1){
        cin >> n >> s;
        if(n == 0 && s == 0)break;
        cout << F(0,0,0) << endl;
    }

}

Measured memory_bytes: 1160
#include <stdio.h>

int main(void)
{
	int n, i, j;
  
	scanf("%d" ,&n);
  
	for (i = 1; i <= 9; i++)
		for (j = 1; j <= 9; j++)
        {
			if (n == i * j)
            {
				puts("Yes");
				return 0;
            }
        }
	puts("No");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <vector>
using namespace std;
 
int main(){
  //入力
  int N;
  cin>>N;
  int ans;
  if(N%2==0){
    ans=(N/2)-1;
  }else{
    ans=(N-1)/2;
  }
  cout<<ans<<endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(3*n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  
  sort(a.begin(), a.begin() + n);
  for (int j = 0; j < (n+2)/3; ++j) a[n] ^= a[j] ^ a[j + n/3] ^ a[j + n/3*2];
  cout << (a[n] ? "No" : "Yes");
  return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX 300003
#define MOD 1000000007
#define INF 1000000000000000

int main(){
  string S;
  cin>>S;
  reverse(S.begin(),S.end());
  int N=S.size();
  vector<ll> A(N+1,0);
  ll res=1;
  for(int i=0;i<N;i++){
    A.at(i+1)=A.at(i)+res*(ll)(S.at(i)-'0');
    A.at(i+1)%=2019;
    res*=10;
    res%=2019;
  }
  sort(A.begin(),A.end());

  ll count=1;
  ll ans=0;
  for(int i=0;i<N;i++){
    if(A.at(i+1)==A.at(i)){
      count++;
    }else{
      ans+=count*(count-1)/2;
      count=1;
    }
  }
  ans+=count*(count-1)/2;
  cout<<ans<<endl;
}


Measured memory_bytes: 5176
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){

    char pat[5] = {"ACGT"};
    string s;
    int count = 0;
    int result = 0;
    bool flg = false;

    cin >> s;

    for (int i = 0; i < s.length(); i++){
        for (int j = 0; j < 5; j++){
            if(s[i] == pat[j]){
                flg = true;
            }
        }
        if(flg){
            count++;
        }else if(result < count){
            result = count;
            count = 0;
        }
        flg = false;
    }
    
    if(result < count){
        result = count;
    }
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define INF 5300000

int main(){

  int t,i,n,p[500],m[500][500];
  int minm=INF,l=0,j=0,k=0,q=0;
 
 scanf("%d",&n);

   for( i = 0; i < n; i++){
    scanf("%d%d",&p[i],&p[i+1]);
  }
  for( i = 1; i <= n; i++){
    m[i][i] = 0;
     
  }
  for( l = 2; l < n+1; l++){
 
    for( i = 1; i<n-l+2; i++){
      j = i+l-1;
      m[i][j] = INF;
 
     for( k = i; k < j; k++){
    q = m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
      
    if(q <= m[i][j]){
      m[i][j] = q;
 
    }
      }
    }
}
  printf("%d\n",m[1][n]);
  return 0;
}

Measured memory_bytes: 796
import java.util.Scanner;

class Main {
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int H = sc.nextInt();
      	int A = sc.nextInt();
      	int count = 0;
      	while(H>0) {
        	H -= A;
          	count++;
        }
      	System.out.println(count);
    }
}

Measured memory_bytes: 23124
#include <iostream>
using namespace std;
int main(void){
 
    int N, Y;
    cin >> N >> Y;
    
    for(int x = 0; x <= N; x++){
        for(int y = 0; y <= N; y++){
            int z = N - (x + y);
            if(10000*x + 5000*y + 1000*z == Y && z >= 0){
                //cout << 10000*x + 5000*y + 1000*z << endl;
                cout << x << " " << y << " " << z << endl;
                return 0;
            }
        }
    }
    
    cout << -1 << " " << -1 << " " << -1 << endl;

    
    
}


Measured memory_bytes: 256
using System;

namespace ITP1_6_B
{
    public partial class Program
    {
        static void Main(string[] args)
        {
            string tarou = Console.ReadLine();
            int n = int.Parse(tarou);
            int[] s = new int[14];
            int[] h = new int[14];
            int[] c = new int[14];
            int[] d = new int[14];

            for (int i = 0; i < n; i++)
            {
                string trump = Console.ReadLine();
                char card = char.Parse(trump.Split(' ')[0]);
                int number = int.Parse(trump.Split(' ')[1]);

                switch(card)
                {
                    case 'S':
                        s[number] = 1;
                        break;
                    case 'H':
                        h[number] = 1;
                        break;
                    case 'C':
                        c[number] = 1;
                        break;
                    case 'D':
                        d[number] = 1;
                        break;
                }
            }
            for (int i = 1; i < 14; i++)
            {
                if(s[i]==0)
                {
                    Console.WriteLine("S {0}", i);
                }
            }
            for (int i = 1; i < 14; i++)
            {
                if (h[i] == 0)
                {
                    Console.WriteLine("H {0}", i);
                }
            }
            for (int i = 1; i < 14; i++)
            {
                if (c[i] == 0)
                {
                    Console.WriteLine("C {0}", i);
                }
            }
            for (int i = 1; i < 14; i++)
            {
                if (d[i] == 0)
                {
                    Console.WriteLine("D {0}", i);
                }
            }
        }
    }
}


Measured memory_bytes: 15880
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    # divisors.sort()
    return divisors

def examC():
    N = I()
    d  = make_divisors(N)
    ans = d[-1]
    print(len(str(ans)))

import sys
import copy
import bisect
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()


Measured memory_bytes: 38640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void conversion(double counts)
{
  std::ostringstream ss;
  ss.precision(12);
  ss << std::fixed << counts;
  std::cout << ss.str() ;
}
int main()
{
    double l;
    cin>>l;
    double f=l/3;

    double e=l-f*3;
    //printf("%0.6f\n",e);
    f=f*f*f;

    if(e>0)
    {
        if(3*e>0.000001)
            f=f+3*e;
    }
    if(e<0)
    {
        if(3*e<-1*0.000001)
            f=f-3*e;
    }
    printf("%0.6f",f);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
const double EPS = 1e-8;
#define EQ(a,b) (abs((a)-(b)) < EPS)
typedef complex<double> P;


int solve(vector<int> &v, vector<int> &cnt){
    SORT(v);
    if(v[0] + v[1] <= v[2]) return -1;
    if(v[0] * v[0] + v[1] * v[1] > v[2] * v[2]) return 1;
    if(v[0] * v[0] + v[1] * v[1] < v[2] * v[2]) return 2;
    return 0;
}

int main() {
  vector<int> v(3), cnt(3, 0);
  for(int i = 0; cin >>v[0] >>v[1] >>v[2]; ++i){
    int r = solve(v, cnt);
    if(r == -1){
      cout <<i;
      REP(i, 3) cout <<" " <<cnt[i];
      cout <<endl;
      break;
    }
    ++cnt[r];
  }
  return 0;
}

Measured memory_bytes: 1216
a, b, c, d = map(int, input())
pm = [1, -1]
op = ["+", "-"]
for i in range(2):
  for j in range(2):
    for k in range(2):
      if a + pm[i]*b + pm[j]*c + pm[k]*d == 7:
        ans = [op[i], op[j], op[k]]
        break
print("".join(map(str, [a, ans[0], b, ans[1], c, ans[2], d, "=", 7])))

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

using namespace std;

#define hash sodnf9843bsd
#define ll long long
#define INF (1<<29)
#define INFF 0x7fffffff
#define LINF (1ll<<60)
#define LINFF 0x7fffffffffffffff
#define PI 3.14159265359
#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define YESNO(ans) cout << (ans?"YES":"NO") << endl
#define prec(x) cout << fixed << setprecision(x)
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define endl '\n'
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

    int n;cin>>n;
    int arr[100005][3] = {};
    _fi(n) cin>>arr[i][0]>>arr[i][1]>>arr[i][2];

    ll dp[100005][3] = {};
    dp[0][0] = arr[0][0];
    dp[0][1] = arr[0][1];
    dp[0][2] = arr[0][2];

    for(int i = 1;i < n;i++){
        dp[i][0] = max(dp[i-1][1]+arr[i][0], dp[i-1][2]+arr[i][0]);
        dp[i][1] = max(dp[i-1][0]+arr[i][1], dp[i-1][2]+arr[i][1]);
        dp[i][2] = max(dp[i-1][0]+arr[i][2], dp[i-1][1]+arr[i][2]);
    }

    cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]}) << endl;

    return 0;
}


Measured memory_bytes: 3840
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef uint64_t u64;
typedef int64_t i64;

#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

static i64 read_int(void){int prev='\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}

void run (void) {
    const u64 n = read_int();
    const u64 w = read_int();
    const u64 mod = 998244353;
    u64 *dp = ALLOC (w + 1, u64);
    u64 ans = 0;
    u64 batch = 34;
    for (u64 i = 0; i < n; i += batch) {
        for (u64 j = i; j < i + batch && j < n; ++j) {
            const u64 a = read_int();
            dp[0] += 1;
            u64 *x = dp + w;
            u64 *y = dp + w - a;
            for (u64 i = a; i <= w; ++i) {
                *x += *y;
                --x;
                --y;
            }
            ans += dp[w] % mod;
        }
        u64 *v = dp;
        for (u64 i = 0; i <= w; ++i) {
            *v %= mod;
            ++v;
        }
    }
    printf ("%" PRIu64 "\n", ans % mod);
}

int main (void) {
    run();
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;

    string s;
    cin>>s;

    int count=0;
    char str0[27] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    char str[54] = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
    for(char word : s){
        //cout < word;
        
        for(int i=0;i<27;i++){
            if(word==str0[i]){
                cout << str[i+n];                
            }
        }
        count++;
    }
   cout << endl; 

    return 0;
}


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

using namespace std;
int main() {
	int n;
	int s[4];
	s[0] = s[1] = s[2] = s[3] = 0;
	string judge;

	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> judge;
		if (judge == "AC") {
			s[0]++;
		}
		else if (judge == "WA") {
			s[1]++;
		}
		else if (judge == "TLE") {
			s[2]++;
		}
		else if (judge == "RE") {
			s[3]++;
		}
	}

	printf("AC x %d\n", s[0]);
	printf("WA x %d\n", s[1]);
	printf("TLE x %d\n", s[2]);
	printf("RE x %d\n", s[3]);
}

Measured memory_bytes: 3720
#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];
    long long ans = n;
    int l = 0;
    for (int i = 1; i <= n; i++) {
        bool flag = false;
        for (int j = l; j < n; j++) {
            if (a[j] == i) {
                ans--;
                l = j + 1;
                flag = 1;
                break;
            }
        }
        if (!flag) {
            break;
        }
    }
    if (ans == n) {
        ans = -1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>

#define rep(i,n) for (long long int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

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

    int ans = 1;
    priority_queue<ll, vector<ll>, greater<ll>> pq;
    pq.push(p[0]);
    for(int i = 1; i < n; i++) {
        if (p[i] < pq.top())
            ans++;
        pq.push(p[i]);
    }

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


Measured memory_bytes: 4084
import collections
n = int(input())
s = [input() for _ in range(n)]
s_count = collections.Counter(s)
print("AC x {}".format(s_count["AC"]))
print("WA x {}".format(s_count["WA"]))
print("TLE x {}".format(s_count["TLE"]))
print("RE x {}".format(s_count["RE"]))

Measured memory_bytes: 16544
//AtCoder ABC112 A - Programming Education
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
int main() {
    ll N; cin>>N;
    if (N==1){
        cout<<"Hello World"<<endl;
    }else{
        ll A,B;
        cin>>A>>B;
        cout<<A+B<<endl;
    }
    return 0;
}

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

using namespace std;

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

  int n, l;
  cin >> n >> l;

  vector<string> v;

  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    v.emplace_back(s);
  }

  sort(begin(v), end(v));
    
  string res;
  for (string s: v) res += s;
  cout << res << "\n";
}


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

//vector…可変長、データの大きさに合わせてサイズを変える
//list…双方向リスト、要素を挿入、削除の多いとき
//forward_list
//array…固定長配列
//set…集合
//multiset
//bitset…2進数、固定長ビット列
//map…連想配列、キーと値を関連付ける
//multimap
//deque…双方向リスト
//stack…FILO, 深さ優先探索
//queue…FIFO, 幅優先探索
//priority_queue…格納された最大値から順に取り出す
//pair…二つの値を一組
//tuple…複数の値を一組

template<typename T>
void remove(std::vector<T>& vector, char index) {
    vector.erase(vector.begin() + index);
}

template<class T>
T ma(std::vector<T> &v) {
    T maxi = 0;
    for(auto &i:v) maxi = max(maxi, i);
    return maxi;
}
template<class T>
T mi(std::vector<T> &v) {
    T mini = 0;
    for(auto &i:v) mini = min(mini, i);
    return mini;
}
template <class T>
T pow(T x, T y, T n = numeric_limits<T>::max()) {
    if(y == 0) return 1;
    if(y % 2 == 0) return pow((x * x) % n, y / 2);
    return (x * pow(x, y - 1)) % n;
}

#define rep(i, n, m) for (int i = n; i <= m; i++)
#define Rep(i, n, m) for (int i = m; i >= 1; i--)

typedef long long ll;
typedef unsigned long long ull;

int gcd(int x, int y) {
    if (x < y) swap(x, y);
    return !y ? x : gcd(x % y, y);
}

using Graph = vector<vector<int>>;

template <class T, class S>
class Edge {
  T to;  //辺の行き先
  S weight;  //辺の重み

public:
  Edge(T t, S w) : to(t), weight(w) {}
};

int ansi = 0;
ll ansl = 0;
double ansd = 0.0;


int main() {
  int a, b;
  cin >> a >> b;
  if (a > 8 || b > 8) {
    cout << ":(" << endl;
  } else {
    cout << "Yay!" << endl;
  }
}


Measured memory_bytes: 256
n=int(input())
A=list(map(int,input().split()))
q=int(input())
dic={i+1:0 for i in range(10**5)}
for a in A:
  dic[a]+=1

s=sum(A)

for i in range(q):
  b,c=map(int,input().split())
  nom=dic[b]
  dic[c]+=nom
  dic[b]=0
  s+=nom*(c-b)
  print(s)
  

Measured memory_bytes: 24396
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <limits>
#include <utility>
#include <algorithm>
#include <tuple>
#include <limits>

typedef long long ll;

int main(int argc, char *argv[])
{
    ll n, k;
    std::vector<ll> a;

    // 入力
    std::cin >> n >> k;

    a.resize(n);

    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }

    for (int i = k; i < n; i++) {
        if (a[i - k] < a[i]) {
            std::cout << "Yes" << std::endl;
        } else {
            std::cout << "No" << std::endl;
        }
    }

    return 0;
}


Measured memory_bytes: 4844
#include "bits/stdc++.h"

using namespace std;

int main() {
	string s;
	cin >> s;

	if (s[0] != s[1] && s[1] != s[2] && s[2] != s[0])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string btos(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  ll h,w;cin>>h>>w;
  ll ans=0;
  if(h==1||w==1){
    ans=1;
  }else{
    ans=(h/2)*w;
    if(h%2!=0){
      ans+=(w+1)/2;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String a = scan.next();
        if ('A' <= a.charAt(0) && a.charAt(0) <= 'Z') {
            System.out.println("A");
        } else {
            System.out.println("a");
        }
    }
}


Measured memory_bytes: 35648
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main() {

	int n;
	cin>>n;

	if(n==1)cout<<"Yes"<<endl;
	else if(n%2==0&&n/2<10)cout<<"Yes"<<endl;
	else if(n%3==0&&n/3<10)cout<<"Yes"<<endl;
	else if(n%4==0&&n/4<10)cout<<"Yes"<<endl;
	else if(n%5==0&&n/5<10)cout<<"Yes"<<endl;
	else if(n%6==0&&n/6<10)cout<<"Yes"<<endl;
	else if(n%7==0&&n/7<10)cout<<"Yes"<<endl;
	else if(n%8==0&&n/8<10)cout<<"Yes"<<endl;
	else if(n%9==0&&n/9<10)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
	int n, T;
	cin >> n >> T;
	int res = -1;
	for (int i = 0; i < n; i++) {
		int c, t;
		cin >> c >> t;
		if (t <= T) {
			if (res == -1 || res > c) {
				res = c;
			}
		}
	}
	if (res == -1) {
		cout << "TLE";
	} else {
		cout << res;
	}
	cout << endl;
}


Measured memory_bytes: 3640
#include<stdio.h>
int main()
{
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  int k;
  scanf("%d",&k);
  if(a<b&&b<c)
  {
    printf("Yes");
  }else{
    while(k--)
    {
      if(a>=b)
      {
        b=b*2;
      }else if(b>=c){
        c=c*2;
      }

     }
    	if(a<b&&b<c)
  		{
    		printf("Yes");
  		}else{
          printf("No");
        }
    }
    return 0;
}


Measured memory_bytes: 1724
#include <iostream>
#include <vector>
using namespace std;
int n , vis[1000];
#define ll long long 
vector <int> g[1000];
void dfs ( int x ){
	vis[x]++ ;
	for(int i=1 ; i<=g[x].size() ; i++ ){
		int u=g[x][i];
		if(vis[u]==2 ){
			printf("%d" , i );
			exit(0);
		}
	}
}
ll a[200010];
int main() {
	ll n;
	cin>>n;
	ll cnt=0;
	ll now=1;
	for(ll i=0;i<n;i++){
		cin>>a[i];
		if(a[i]!=now){
			cnt++;
		}
		else{
			now++;
		}
	}
	if(n==cnt){
		cout << -1;
		return 0;
	}
	cout << cnt;
	// your code goes here
	return 0;
}
int maa() {
	scanf("%d" , &n );
	for(int a  , i=1 ; i<=n ;i++ ){
		scanf("%d" , &a );
		g[i].push_back(a);
	}
	for(int i=1 ; i<=n ;i++ ){
		dfs(i) ; 
	}
	return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);

bool isPrime[20000005];


int main(){
	FAST_IO
	
	int N, M; cin >> N >> M;
	
	cout << (1900 * M + (N - M) * 100) * pow(2, M) << "\n";
	
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long k = sc.nextLong();
        long[] a = new long[n];
        long[] b = new long[m];
        long[] asum = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
            if (i == 0) {
                asum[i] += a[i];
            } else {
                asum[i] += asum[i - 1] + a[i];
            }
        }
        long[] bsum = new long[m];
        for (int i = 0; i < m; i++) {
            b[i] = sc.nextLong();
            if (i == 0) {
                bsum[i] += b[i];
            } else {
                bsum[i] += bsum[i - 1] + b[i];
            }
        }
        int aend = 0;
        for (int i = 0; i < n; i++) {
            if (asum[i] > k) {
                break;
            }
            aend = i + 1;
        }
        int bend = 0;
        for (int i = 0; i < m; i++) {
            if (bsum[i] > k) {
                break;
            }
            bend = i + 1;
        }
        int ans = Math.max(aend, bend);
        int j = 0;
        for (int i = aend - 1; i >= 0; i--) {
            while (j < bend - 1 && asum[i] + bsum[j + 1] <= k) {
                j++;
            }
            if (j == bend - 1 && asum[i] + bsum[j] > k) {
                break;
            }
            if (asum[i] + bsum[j] <= k) {
                ans = Math.max(i + j + 2, ans);
            }
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 68184
#include <stdio.h>

int main()
{
	char b;
	scanf("%c", &b);
	
	if( b == 'A' )	printf("T");
	
	else if( b == 'T' )	printf("A");

	else if( b == 'G' ) printf("C");
	
	else	printf("G");


	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int getroot(VEC(int)& roots, int i)
{
    if (roots[i] == i)
        return i;
    return roots[i] = getroot(roots, roots[i]);
}

void merge(VEC(int)& roots, VEC(int)& sizes, int x, int y)
{
    int rx = getroot(roots, x), ry = getroot(roots, y);
    if (rx == ry)
        return;

    if (sizes[rx] > sizes[ry]) {
        roots[ry] = rx;
    } else if (sizes[rx] < sizes[ry]) {
        roots[rx] = ry;
    } else {
        sizes[rx]++;
        roots[ry] = rx;
    }
}

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N, K, L;
    cin >> N >> K >> L;
    VEC(int) rootA(N), sizeA(N, 1);
    VEC(int) rootB(N), sizeB(N, 1);
    FOR(i, 0, N)
        rootA[i] = rootB[i] = i;

    FOR(i, 0, K) {
        int p, q;
        cin >> p >> q;
        p--;q--;
        merge(rootA, sizeA, p, q);
    }

    FOR(i, 0, L) {
        int p, q;
        cin >> p >> q;
        p--;q--;
        merge(rootB, sizeB, p, q);
    }

    map<int, VEC(int)> groups;
    FOR(i, 0, N)
        groups[getroot(rootA, i)].push_back(i);

    VEC(int) both(N);
    FOR(i, 0, N)
        if (getroot(rootA, i) == i) {
            map<int, vector<int> > bRoots;
            for(int node : groups[i])
                bRoots[getroot(rootB, node)].push_back(node);

            for(auto& pr : bRoots) {
                VEC(int)& gp = pr.second;
                int neighbors = gp.size();
                for(int node : gp)
                    both[node] = neighbors;
            }
        }

    FOR(i, 0, N)
        cout << both[i] << " ";
    cout << endl;
    return 0;
};


Measured memory_bytes: 24540
N = int(input())
A = list(map(int,input().split()))
   
A.sort()

check=[0]*N

for idx in range(N%2,N,2):
    check[idx]=idx+1
    check[idx+1]=idx+1

ans=0

if check == A:
    if N % 2 == 0:
        ans=(2**(N//2))%(10**9+7)
    elif N % 2 != 0:
        ans=(2**((N-1)//2))%(10**9+7)
    
print(ans)


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

int main() {
    char c[4];
    for(int i = 0; i < 4; ++i)
        cin >> c[i];
    
    for(int i = 0; i < 3; ++i)
        if(c[i] == c[i + 1]) { cout << "Bad"; return 0; }
    
    cout << "Good";
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll > P;
typedef pair<P,ll>Q;

int main(void){
    ll n,k;
    cin>>n>>k;
    double ans = 0.0;
    for(ll i=1;i<=n;i++){
        ll tmp = i;
        double p = (double)1/n;
        while(true){
            if(tmp>=k)break;
            else{
                tmp*=2;
                p = (double)p/2.0;
            }
        }
        ans+=p;
    }
    printf("%.15lf",ans);
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K, AB):
    ans = 0
    for i in range(K.bit_length()-1, -2, -1):
        mask = K
        if i > -1:
            if mask & 1 << i:
                mask -= 1 << i
            else:
                continue
        for j in range(i):
            mask |= 1 << j
        cand = 0
        v = 0
        for a, b in AB:
            if (a | mask) == mask:
                cand += b
                v |= a
        assert v <= K
        ans = max(ans, cand)
    return ans



def main():
    N, K = read_int_n()
    AB = [read_int_n() for _ in range(N)]
    print(slv(N, K, AB))


if __name__ == '__main__':
    main()


Measured memory_bytes: 29892
# B - Distance
def main():
    n, d = map(int, input().split())
    cnt = 0

    for _ in range(n):
        x, y = map(int, input().split())
        
        if (x**2+y**2)**0.5 <= d:
            cnt += 1
    else:
        print(cnt)


if __name__ ==  "__main__":
    main()

Measured memory_bytes: 9644
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0LL)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;}
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}


bool isOk(ll key,ll value){
  return key >= value;
}

ll binary_search(vector<ll> a,ll key){
  ll ok = a.size()-1;
  ll ng = 0;

  while(abs(ok - ng) > 1){
    ll mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}

bool isPrime(ll n) {
	for (int i = 2; n >= i * i; ++i) {
		if(!(n % i))return false;
	}
  return true;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  ll a, b, c, x, y;
  cin>>a>>b>>c>>x>>y;
  ll ans = INFL;
  for (int i=0; i<=max(2*x, 2*y); i+=2) {
    ll na = max(x - i / 2, 0ll);
    ll nb = max(y - i / 2, 0ll);
    ans = min(a * na + b * nb + c * i, ans);
  }
  print(ans);
  return 0;
}

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

#define N 100010

int n;
int arr[N];
int x;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main()
{
	while (scanf("%d%d", &n, &x) != EOF)
	{
		for (int i = 1; i <= n; ++i) scanf("%d", arr + i);
		for (int i = 1; i <= n; ++i) arr[i] = abs(x - arr[i]);
		int res = arr[1];
		for (int i = 2; i <= n; ++i) res = gcd(res, arr[i]);
		printf("%d\n", res);
	}
	return 0;
}


Measured memory_bytes: 640
# C - : (Colon)

import math

a,b,h,m = map(int,input().split())

s = 3600*h + 60*m
radh = ((s/(60*60*12))-int(s/(60*60*12)))*2*math.pi
radm = ((s/(60*60))-int(s/(60*60)))*2*math.pi

c = math.sqrt(a**2+b**2-2*a*b*math.cos(radh-radm))

print(c)


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

signed main(){
	int a,b,c;cin>>a>>b>>c;
	cout<<max({a*10+b+c,a+b*10+c,a+b+c*10})<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <functional>
#include <queue>
#include <cmath>

using namespace std;

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

int N, K;

int Sum[200010];
map<int, int> counter;

int f(int a)
{
	a += K * 1000000000;
	return a % K;
}

signed main()
{
	cin >> N >> K;

	int ans = 0;

	rep1(i, N) {
		cin >> Sum[i];
		Sum[i] += Sum[i-1];
		Sum[i] %= K;
	}

	rep(i, N+1) {
		if (i - K >= 0) counter[f(Sum[i - K] - (i - K))]--;
		ans += counter[f(Sum[i] - i)];
		counter[f(Sum[i] - i)]++;
	}

	cout << ans << endl;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll n;
  cin >> n;
  vl a(n);
  ll count = 0;
  rep(i, n){
    cin >> a[i];
    if((i+1)%2==1&&a[i]%2==1){
      count++;
    }
  }
  print(count);
}


Measured memory_bytes: 3596
#include <stdio.h>
#include <ctype.h>

int main(void)
{
	char ch;
	while(1){
		scanf("%c", &ch);
		if(isupper(ch)) {
			ch = ch + 32;
		} else if(islower(ch)) {
			ch = ch - 32;
		}
		printf("%c",ch);
    		if ( ch == '\n' ) break;
	}	
	return 0;
}

Measured memory_bytes: 524
N = int(input())
items = []
for i in range(N):
    items.append(tuple(map(int, input().split())))


res = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        x1, y1 = items[i]
        x2, y2 = items[j]
        res.append((x1-x2, y1 -y2))

ans = 0
tar = list(set(res))
for t in tar:
    cnt = 0
    for i in range(N):
        x, y = items[i]
        for j in range(N):
            if i == j:
                continue
            x2, y2 = items[j]
            if x - t[0] == x2 and y - t[1] == y2:
                cnt += 1
                break
    ans = max(ans, cnt)
print(N - ans)


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

class Program
{
    static void Main()
    {
        var N = Int32.Parse(Console.ReadLine());
        var A = new int[N];
        for (int i = 0; i < N; ++i) {
            A[i] = Int32.Parse(Console.ReadLine());
        }

        var orderedA = A.OrderByDescending(x=>x).ToArray();
        var ans = new int[N];

        for (int i=0;i<N;++i) ans[i] = A[i] == orderedA[0] ? orderedA[1] : orderedA[0];

        foreach (var a in ans) Console.WriteLine(a);
    }
}


Measured memory_bytes: 25044
N,M = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
set_N = set([i for i in range(1, N+1)])
for j in range(M):
    A,B = [int(i) for i in input().split()]
    if H[A-1]<H[B-1]:
        if A in set_N:
            set_N.remove(A)
    elif H[A-1]>H[B-1]:
        if B in set_N:
            set_N.remove(B)
    else:
        if A in set_N:
            set_N.remove(A)
        if B in set_N:
            set_N.remove(B)
print(len(set_N))

Measured memory_bytes: 23680
#include <iostream>
#include <vector>
#include <queue>
#include <string>
using namespace std;

int main(){
	int N,K;
	string S;
	cin >> N >> K;
	cin >> S;
	if(S[K-1]=='A'){
		S[K-1]='a';
	}	
	else if(S[K-1]=='B'){
		S[K-1]='b';
	}	
	else if(S[K-1]=='C'){
		S[K-1]='c';
	}	
	cout << S;
	cin >> N;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <climits>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

int main(int argc, char const* argv[])
{
  string s;
  cin >> s;
  if(s.size() < 4){
    cout << "No" << endl;
    return 0;
  }
  if(s.substr(0, 4) == "YAKI")cout << "Yes" << endl;
  else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256