akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back
#define fi first
#define be begin()
#define en end()
#define se second

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 1e9;
const ll INFll = 1e18;
ll MOD=1e9+7;

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; } //最大公倍数

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}

int main(){
  ll N,D,A;
  cin>>N>>D>>A;
  vector<pair<ll,ll>> p(N);
  for (ll i(0);i<N;i++){
    cin>>p[i].first>>p[i].second;
  }
  sort(p.begin(),p.end()); 
  ll ans(0); 
  queue<pair<ll,ll>> q;
  ll power(0);
  for (ll i(0);i<N;i++){
    while (!q.empty() && q.front().first < p[i].first){
      power -= q.front().second;
      q.pop();
    }
    ll now_power_cnt = max(0ll,(p[i].second - power*A + A - 1)/A);
    //cout << now_power_cnt << endl;
    if (now_power_cnt) q.push({p[i].first + 2*D,now_power_cnt});
    power += now_power_cnt;
    ans += now_power_cnt;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define hell 1000000007
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define ll long long int
#define pi 3.1415926536
using namespace std;
ll dp[100001];
void digi()
{
	memset(dp,0,sizeof(dp));
	dp[1]=1;
	for(ll i=2;i<100001;i++)
	{
		ll count=0;
		ll x=i;
		while(x)
		{
			x/=10;
			count++;
		}
		if(count%2)
		dp[i]=dp[i-1]+1;
		else
		dp[i]=dp[i-1];
	}
}
void solve()
{ll t,n,k,x,y,z,d=0,p,q,l=INT_MAX,mini=0,prev;
  
  cin>>n;
  vector<ll> v(n);
  for(ll i=0;i<n;i++)
  cin>>v[i];
  for(ll i=1;i<n;i++)
  {
  	if(v[i]>=v[i-1])
  	{
  		if(v[i]-1>=v[i-1])
  		v[i]-=1;
	}
	else
	v[i]-=1;
  }
  for(ll i=1;i<n;i++)
  {
  	if(v[i]<v[i-1])
  	{
  		cout<<"No";
  		return;
	  }
  }
  cout<<"Yes";
}
 
int main()
{
  fast
ll t=1;
 
while(t--)
{solve();
 //cout<<ma<<endl;
}
return 0;}

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

#define INDEXED_SET 0

#if INDEXED_SET
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using indexed_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
//find_by_order(i) - iterator to i-th element
//order_of_key(x) - x's index in the set
#endif

#define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define leading_0s(x) __builtin_clz(x)  //left 0s
#define trailing_0s(x) __builtin_ctz(x) //right 0s
#define count_1s(x) __builtin_popcount(x)
#define parity_1s(x) __builtin_parity(x) // 0 = even, 1 = odd
#define FORI(i,a,b) for (int i = int((a)); i <= int((b)); i++)
#define FORD(i,a,b) for (int i = int((a)); i >= int((b)); i--)
#define F first
#define S second
#define PB push_back
#define MP make_pair

#define endl '\n'
#define MAX 200005

using ll = long long;
using pi = pair<int,int>;
using pll = pair<long,long>;
using vi = vector<int>;
using vll = vector<ll>;
using vpi = vector<pi>;
using vpll = vector<pll>;

const int mod = 1e9 + 7;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;

int main()
{
    FAST_IO;

    int n;
    cin >> n;
    vi v(n);
    for (auto &e:v)
        cin >> e;
    int ans = 0;
    FORI(i,1,n-2)
        ans += ((v[i-1] > v[i] && v[i-1] > v[i+1] && v[i] > v[i+1]) || (v[i+1] > v[i] && v[i+1] > v[i-1] && v[i] > v[i-1]));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#include<iomanip>
#define rep(i,x) for(int i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 1001001001;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}


int main() {
    ll a, b;
    cin >> a >> b;
    if (a == 1 && b == 1)cout << "Draw" << endl;
    else if (a == 1)cout << "Alice" << endl;
    else if (b == 1)cout << "Bob" << endl;
    else {
        if (a < b)cout << "Bob" << endl;
        else if (a == b) cout << "Draw" << endl;
        else cout << "Alice" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

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

	bool ans = true;
	zep(i, 0, s.size()){
		if(s[i] != s[0]){
			ans = false;
		}
	}
	print((ans? "No": "Yes"))
	return 0;
}

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

typedef long long ll;

// f(n, 0) = 0
// f(0, W) = 0
// f(n, W) = f(n - 1, W) -> no elegir
// f(n, W) = f(n - 1, W - weights[n]) + values[n] -> elegir

ll knapsack(ll depth, ll sum, ll maxWeight, ll n, const vector<ll>& weights, const vector<ll>& values, vector<vector<ll>>& memo) {
    if (depth == n) {
        return 0;
    }
    if (memo[depth][sum] != -1) {
        return memo[depth][sum];
    }
    ll ans = knapsack(depth + 1, sum, maxWeight, n, weights, values, memo);
    if (sum + weights[depth] <= maxWeight) {
        ans = max(ans, knapsack(depth + 1, sum + weights[depth], maxWeight, n, weights, values, memo) + values[depth]);
    }
    return memo[depth][sum] = ans;
}

int main() {
    ll n, maxWeight;
    cin >> n >> maxWeight;
    vector<ll> weights(n), values(n);
    vector<vector<ll>> memo(n, vector<ll>(maxWeight + 1, -1));
    for (ll i = 0; i < n; i++) {
        cin >> weights[i] >> values[i];
    }
    ll ans = knapsack(0, 0, maxWeight, n, weights, values, memo);
    cout << ans << "\n";
}

Measured memory_bytes: 82248
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------

void solve(){
}
int main(){
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int x = x2 - x1;
    int y = y2 - y1;
    cout << x1 + x - y << " " <<  y1 + x + y << " " << x1 - y << " " << y1 + x << endl;
    solve();
    return 0;
}



Measured memory_bytes: 256
def main():
    s = input()
    d = {
    'SSS': 0,
    'SSR': 1,
    'SRS': 1,
    'SRR': 2,
    'RSS': 1,
    'RSR': 1,
    'RRS': 2,
    'RRR': 3
    }
    print(d[s])

if __name__ == '__main__':
    main()


Measured memory_bytes: 9028
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;

class Main{


	static	ArrayList<Integer> one ;
	static	ArrayList<Integer> two ;
	static	ArrayList<Integer> three ;
	static	ArrayList<Integer> four ;

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);			//文字の入力
		int N = sc.nextInt();
		long W = sc.nextLong();
		
		one =new  ArrayList<Integer>();
		two =new  ArrayList<Integer>();
		three =new  ArrayList<Integer>();
		four =new  ArrayList<Integer>();

		one.add(0);
		two.add(0);
		three.add(0);
		four.add(0);



		long w0 = 0;

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

			long w = sc.nextLong();
			int v = sc.nextInt();

			if(i == 0){
				w0  = w;
				one.add(v);
			}else{
				if(w == w0){
					one.add(v);
				}else if(w == w0+1){
					two.add(v);
				}else if(w == w0+2){
					three.add(v);
				}else{
					four.add(v);
				}

			}
		}
		Collections.sort(one);
		Collections.sort(two);
		Collections.sort(three);
		Collections.sort(four);

//		for(int i = 0;i < two.size();i++){
//			System.out.println(two.get(i));
//		}
		
		long ans = 0;
		long count = 0;


		for(int i = 0;i < one.size();i++){
			for(int j = 0;j < two.size();j++){
				for(int m = 0;m < three.size();m++){
					for(int f = 0;f < four.size();f++){
						
						if(i*w0 + j*(w0+1) +m*(w0+2)+f*(w0+3) <= W){
						count = sum(i,j,m,f);
						ans = Math.max(ans, count);
						}
					}
				}
			}


		}
		System.out.println(ans);


	}



	static long sum(int onenum,int twonum,int threenum,int fournum){

		long c = 0;
		for(int i = 0;i < onenum;i++){
			c += one.get(one.size()-i-1);
		}
		for(int i = 0;i < twonum;i++){
			c += two.get(two.size()-i-1);
		}
		for(int i = 0;i < threenum;i++){
			c += three.get(three.size()-i-1);
		}
		for(int i = 0;i < fournum;i++){
			c += four.get(four.size()-i-1);
		}

		return c;

	}









}







class MyComparator implements Comparator {

	public int compare(Object obj1, Object obj2) {

		int num1 = (int)obj1;
		int num2 = (int)obj2;

		if(num1 < num2) {
			return 1;
		} else if(num1 > num2) {
			return -1;
		} else{
			return 0;
		}
	}
}




Measured memory_bytes: 25684
N, K = map(int, input().split())
S = input()

bl = []
if S[0] == "0":
    bl.append(0)
bl.append(0)
for i in range(1, N):
    if S[i-1] != S[i]:
        bl.append(i)
bl.append(N)
bl.append(N)

nbl = len(bl)
m = [bl[i+2 * K+1] - bl[i] 
     for i in range(nbl - 2*K-1) if i%2 == 0]
if len(m) == 0:
    print(N)
else:
    print(max(m))

Measured memory_bytes: 8692
import sys
sys.setrecursionlimit(2147483647)

n=int(input())
aa=list(map(int,input().split()))

if n==2:
    print(aa[0],aa[1])
    exit()

aa.sort()

nn=max(aa)

c=0
tmp=10**9

for a in aa:
    if abs(nn/2.0-a)<tmp:
        tmp=abs(nn/2.0-a)
        c=a

print(nn,c)

     


Measured memory_bytes: 86528
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskAtcoder156A {
        public void solve(int testNumber, FastReader in, PrintWriter out) {

            int N, R;
            N = in.nextInt();
            R = in.nextInt();

            if (N < 10) {
                out.println(R + 100 * (10 - N));
            } else
                out.println(R);

        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int n, k;

// 最大積載量P以下で積むことができる荷物の数を返す関数
int maxLoaded(const vector<ll>& L, ll P) {
    int i = 0;
    for (int j = 0; j < k; j++) {
        ll sum = 0;
        while (sum + L[i] <= P) {
            sum += L[i];
            i++;
            if (i == n) return n;
        }
    }
    return i;
}

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

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

    ll left = 0;
    ll right = 100000 * 10000;
    ll mid;
    while (right - left > 1) {
        mid = (left + right)/2;
        int v = maxLoaded(luggages, mid);
        if (v >= n) {
            right = mid;
        } else {
            left = mid;
        }
    }

    cout << right << endl;

    return 0;
}

Measured memory_bytes: 1788
#include<map>
#include<set>
#include<stack>
#include<deque>
#include<queue>
#include<cmath>
#include<bitset>
#include<vector>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<fstream>
#include<iostream>
#include<algorithm>
#define inf 2139062143
#define re register
#define ll long long
#define ull unsigned long long
#define lowbit(x) x&-x
#define Flj(i,a,b) for(int i=(a);i;i=(b))
#define Fze(i,a,b) for(int i=(a);i<(b);i++)
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Fer(i,a,b) for(int i=(a);i>=(b);i--)
#define Fer1(i,a,b) for(int i=(a);i>b;i--)
#define Dfor(i,a,b,k) for(double i=(a);i<(b);i+=k)
#define Qmax priority_queue
#define Qmin priority_queue<int,vector<int>,greater<int> >
using namespace std;
int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
const int maxn = 1e5;
int n, f;
ll ans, a[maxn], b[maxn];
int main(){
	n = read();
	For(i, 1, n) scanf("%lld", &a[i]), a[i] *= 2;
	Fze(i, 1, n){
		if(f) ans -= a[i], f = 0;
		else ans += a[i], f = 1;
		
	}
	b[n] = (a[n] - ans) / 2;
	b[1] = a[n] - b[n];
	For(i, 2, n) b[i] = a[i - 1] - b[i - 1];
	For(i, 1, n) printf("%d ", b[i]);
}

Measured memory_bytes: 2816
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
#include <cstdio>
#include <complex>
#include <cstring>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  loop(i,1,10)loop(j,1,10)cout<<i<<"x"<<j<<"="<<i*j<<endl;
}

Measured memory_bytes: 1116
from collections import defaultdict
N = int(input())
S = input()

cnt = defaultdict(int)
for i in range(N):
    s = S[i]
    cnt[s] += 1

ans = cnt["R"] * cnt["G"] * cnt["B"]

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        if 2 * j - i < N:
            if S[i] != S[j] and S[i] != S[2 * j - i] and S[j] != S[2 * j - i]:
                ans -= 1
        else:
            break

print(ans)



Measured memory_bytes: 9460
/**
 * @author: Mackenzie
**/
#include <bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);Yo sé que algunas cosas están mal, pero precisamente ese toque de prohibido o de rareza, es lo que logra lo que estoy buscando en ese momento, placer.
#else
    fastIO;
#endif
    ll n, k;
    cin >> n >> k;
    vector<pll> v(n);
    forn(i, n) cin >> v[i].F >> v[i].S;
    sort(all(v));
    vector<ll> pre(n);
    pre[0] = v[0].S;
    for (int i = 1; i < n; i++) {
        pre[i] = v[i].S + pre[i - 1];
    }
    int pos = lower_bound(all(pre), k) - pre.begin();
    cout << v[pos].F << endl;
    return 0;
}

Measured memory_bytes: 2560
package main

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

func main() {
	sc := newInputScanner(true, 1024)
	L := sc.nextInt()
	side := float64(L) / 3
	volume := side * side * side
	fmt.Println(fmt.Sprintf("%.12f", volume))
}

type inputScanner struct {
	*bufio.Scanner
}

func newInputScanner(enabledScanWords bool, sizeInKB int) *inputScanner {
	scanner := bufio.NewScanner(os.Stdin)
	if enabledScanWords {
		scanner.Split(bufio.ScanWords)
	}
	capacity := sizeInKB * 1024
	buf := make([]byte, capacity)
	scanner.Buffer(buf, capacity)
	return &inputScanner{
		Scanner: scanner,
	}
}

func (inputSc *inputScanner) nextInt() int {
	i, e := strconv.Atoi(inputSc.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (inputSc *inputScanner) nextUInt64() uint64 {
	i, e := strconv.ParseUint(inputSc.nextStr(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func (inputSc *inputScanner) nextStr() string {
	inputSc.Scan()
	return inputSc.Text()
}

type debuggable struct {
}

const (
	DEBUG_ON = false
)

func (d *debuggable) debug(f func()) {
	if DEBUG_ON {
		f()
	}
}


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

using namespace std;

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl

int main(){
    char a,b;
    cin>>a>>b;
    cout<<((a==b)?'H':'D')<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys

n = int(input())
ans = 1
ass = input().split(" ")

for b in ass:
	a = int(b)
	if ans == -1:
		if a == 0:
			ans = 0
	else:
		ans *= a
		if ans > 1000000000000000000:
			ans = -1;
		
print(ans)


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

#define int long long

using namespace std;

const int N = 100;
const int inf = 2*N;

int n, m;
string t[N];
int dyn[N][N];
bool v[N][N];

int f(int l, int c) {
  if(l == n-1 && c == m-1)
    return 0;
  if(v[l][c])
    return dyn[l][c];
  v[l][c] = 1;
  int a = inf, b = inf;
  if(l < n-1)
    a = f(l+1, c) + (t[l][c] != t[l+1][c]);
  if(c < m-1)
    b = f(l, c+1) + (t[l][c] != t[l][c+1]);
  return dyn[l][c] = min(a, b);
}

signed main() {
  cin >> n >> m;
  for(int i=0; i<n; i++)
    cin >> t[i];
  cout << (f(0, 0) + (t[0][0] == '#') + (t[n-1][m-1] == '#'))/2 << endl;
  /*for(int i=0; i<n; i++)
    for(int j=0; j<m; j++)
      cout << dyn[i][j] << " \n"[j == m-1];*/
  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(a <= b){
            if(c <= a){
                System.out.println(c + " " + a + " " + b);
            }else if(c <= b){
                System.out.println(a + " " + c + " " + b);
            }else{
                System.out.println(a + " " + b + " " + c);
            }
        }else if(a >= b){
            if(c <= b){
                System.out.println(c + " " + b + " " + a);
            }else if(c <= a){
                System.out.println(b + " " + c + " " + a);
            }else{
                System.out.println(b + " " + a + " " + c);
            }
        }
    }
}


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using f64 = double;
using f80 = long double;

#define FOR(v, a, b) for(i64 v = (a); v < (b); ++v)
#define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(i64 v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T> void pout(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void pout(const T &value, const Args&... args){std::cout << value << " ";pout(args...);}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  int X, Y, A, B, C;
  while(cin >> X >> Y >> A >> B >> C){
    vector<i64> p(A), q(B), r(C);
    cin >> p >> q >> r;

    sort(RALL(p));
    sort(RALL(q));
    sort(RALL(r));

    priority_queue<i64, vector<i64>, greater<i64>> pp, qq;

    REP(i,X) pp.emplace(p[i]);
    REP(i,Y) qq.emplace(q[i]);

    for(auto v : r){
      auto a = pp.top();
      auto b = qq.top();

      if(v - a > v - b){
        if(v - a > 0){
          pp.pop();
          pp.push(v);
        }
      }else{
        if(v - b > 0){
          qq.pop();
          qq.push(v);
        }
      }
    }

    i64 ans = 0;

    while(pp.size()){
      ans += pp.top(); pp.pop();
    }

    while(qq.size()){
      ans += qq.top(); qq.pop();
    }
    
    pout(ans);
  }


  return 0;
}


Measured memory_bytes: 4852
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	for (;;) {
		int N, Q; cin >> N >> Q;
		if (N == 0 && Q == 0) break;
		vector<string> s(N);
		vector<ll> a(N), b(N);
		for (int i = 0; i < N; i++)
			cin >> s[i] >> a[i] >> b[i];
		while (Q--) {
			ll x; cin >> x;
			bool flag = false;
			for (int i = 0; i < N; i++) {
				if (x >= b[i] - a[i] + 1 && x <= b[i]) {
					cout << s[i] << ' ' << x - (b[i] - a[i]) << endl;
					flag = true;
					break;
				}
			}
			if (!flag) cout << "Unknown" << endl;
		}
	}
}

Measured memory_bytes: 1292
#include <bits/stdc++.h>
#define MAX (ll)(3e5 + 7)
#define INF (ll)(1e5 + 7)
#define MOD (ll)(1e9 + 7)
#define PI (double)(3.14159265)
#define IO ios_base :: sync_with_stdio (false);
#define LOG 20

using namespace std;
using ll = long long;

int main () {
	ll n;
	cin >> n;
	ll ar[n], cc[n + 1] = {};
	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		cin >> ar[i];
		cc[ar[i]]++;
	}
	for (ll i = 1; i <= n; i++) {
		ans += (cc[i] * (cc[i] - 1)) / 2;
	}
	for (ll i = 0; i < n; i++) {
		cout << ans - cc[ar[i]] + 1 << "\n";
	}
}


Measured memory_bytes: 5760
#答えを決め打つと最小で何回やる必要があるかわかるので二分探索ができる
n,k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

l = 0
r=10**9+1

while l+1<r do
    m = (l+r)>>1
    cnt = 0
    for x in a do
        cnt += (x-1)/m
    end
    if cnt>k then l=m else r=m end
end

puts r

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

int main()
{
    while (true) {
        int N, M, T;
        cin >> N >> M >> T;
        vector<int> a(N);
        for (int i = 0; i < N; i++) {
            cin >> a[i];
        }
        int sum = a[0] - M;
        for (int i = 0; i < N - 1; i++) {
            if (a[i + 1] - a[i] > 2 * M) {
                sum += a[i + 1] - a[i] - 2 * M;
            }
        }
        sum += max(0, T - a[N - 1] - M);
        cout << sum << endl;
        break;
    }
    return 0;
}

Measured memory_bytes: 3116
#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];
	int count=0;
	for(int i=0; i< n;i++)
		if(a[i] == i+1) {
			count++;
			i++;
		}
	cout << count << endl;
}



Measured memory_bytes: 640
#include<stdio.h>
int main(){
	int x,i,j,k,N,H[101],count=1;
	x = 1;
	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%d", &H[i]);
	}
	for (j = 1; j < N; j++) {
		for (k = j - 1; k >=0; k--) {
			if (H[j] < H[k]) {
				x = 0;
				break;
			}
		}
		if(x==1)
		count += 1;
		x = 1;
	}
	printf("%d\n", count);
	return 0;
}

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

ll knapsack(ll wt[],ll val[],ll W,int i,int n,ll ans)
{
   ll dp[n+1][W+1];
    for(int i=0;i<=n;i++)
    {
        
        for(int j=0;j<=W;j++)
        {
            if(i==0 || j==0)
                dp[i][j]=0;
            else if(j-wt[i-1]>=0)
                dp[i][j] = max(dp[i-1][j],val[i-1]+dp[i-1][j-wt[i-1]]);
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    return dp[n][W];
}

int main()
{
	ll N,W;
    cin>>N>>W;
    ll wt[N],val[N];
    for(int i=0;i<N;i++)
    {
        cin>>wt[i]>>val[i];
    }
    cout<<knapsack(wt,val,W,N-1,N,0)<<endl;
	return 0;
}

Measured memory_bytes: 79104
#include <iostream>
using namespace std;
int main(){
  string s,t;
  cin >> s >> t;
  string u;
  int a,b;
  cin >> a >> b;
  cin >> u;
  if(u==s){
    a--;
  }
  else{
    b--;
  }
  cout << a << " " << b ;
  return 0;
}


Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

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; }


int sum(int x) {
	int res = 0;
	for (int i = 1; i <= x; ++i) {
		res += i;
	}
	return res;
}

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

	vector<double> expected_value;
	rep(i, n) {
		double cal = 0;
		double sum_ = sum(p[i]);
		cal = sum_ / p[i];
		expected_value.push_back(cal);
	}
	vector<double> cumulative_sum(n + 1);
	cumulative_sum[0] = 0;
	for (int i = 1; i <= n; i++) {
		cumulative_sum[i] = expected_value[i-1] + cumulative_sum[i-1];
	}
	
	double ans = -1.0;
	for (int i = k; i <= n; ++i) {
		ans = max(ans, (cumulative_sum[i] - cumulative_sum[i-k]));
	}
	cout << std::fixed << std::setprecision(7) << ans << endl;
	return 0;
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

constexpr int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
constexpr int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b && b == c) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
const int MAXINT = 1e9;
int matrix[MAXN][4], dp[MAXN][4];
int main ()
{
    int n, last ; cin >> n;
    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= 3; ++j)
            cin >> matrix[i][j], dp[i][j] = matrix[i][j];
    for(int i = 1; i <= n; ++i){
        for(int j = 1; j <= 3; ++j){
            for(int k = 1; k <= 3; ++k){
                if(k == j) continue;
                dp[i + 1][k] = max(dp[i + 1][k] , dp[i][j] + matrix[i + 1][k]) ;
            }
        }
    }
    cout << max(dp[n][1], max(dp[n][2], dp[n][3]));
    return 0;
}
///dp[i] += (dp[i - 1] < dp[i - 2]) ? dp[i - 1] + abs(h[i - 1] - h[i]) : dp[i - 2] + abs(h[i - 2] - h[i]);


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

using namespace std;

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

	vector<int> aji(n);

	int i = 1;
	for (auto&& x : aji)
	{
		x = l + i - 1;
		i++;
	}

	int ans = 1e9;
	int sa = 1e9;

	for (int i = 0; i < n; i++)
	{
		int Nnum = accumulate(aji.begin(), aji.end(), 0);
		int N_num = Nnum - aji[i];
		
		if (sa > abs(Nnum - N_num))
		{
			sa = abs(Nnum - N_num);
			ans = N_num;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8

@njit((i8,i8,i8[:],i8[:]), cache=True)
def main(H,N,A,B):
  INF = 1<<30
  dp = np.full(H+1,INF,np.int64)
  dp[0] = 0
  for i in range(N):
    for h in range(A[i],H):
      dp[h] = min(dp[h],dp[h-A[i]]+B[i])
    dp[H] = min(dp[H],min(dp[H-A[i]:H]+B[i]))
  ans = dp[-1]
  return ans

H, N = map(int, input().split())
A = np.zeros(N,np.int64)
B = np.zeros(N,np.int64)
for i in range(N):
  A[i],B[i] = map(int, input().split())
print(main(H,N,A,B))

Measured memory_bytes: 106720
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws IOException {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        int h = Integer.valueOf(mylist.get(0));
        int w = Integer.valueOf(mylist.get(1));
        int n = Integer.valueOf(mylist.get(2));

        System.out.println(n % Math.max(h, w) == 0 ? n / Math.max(h, w) : (n / Math.max(h, w)) + 1);

    }

}

Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const bool debug = 0;
//-----------------------------------------------//

pii input(bool f) {
	int a, b;
	scanf("%d %d", &a, &b);
	a++; b++;
	return pii(a, b * (f ? -1 : 1));
}

int main() {
	int N;
	pii p[200];
	cin >> N;
	REP(i, N) p[i] = input(0);
	REP(i, N) p[i+N] = input(1);
	
	sort(p, p + 2*N);
	
	int cnt[201] = {};
	int ans = 0;
	REP(i, 2*N) {
		if (p[i].se > 0) cnt[p[i].se]++;
		else {
			for (int j = -p[i].se - 1; j > 0; j--) {
				if (cnt[j]) {
					ans++;
					cnt[j]--;
					break;
				}
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#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 h, w;
vector<string> s(100);
    
int main(){
    cin >> h >> w;
    rep(i,h) cin >> s[i];
    int DP[h][w];
    if (s[0][0]=='.') DP[0][0] = 0;
    else DP[0][0] = 1;
    rep(i,h){
        rep(j,w){
            if (i==0 && j==0){
                continue;
            } else if (i==0){
                DP[i][j] = DP[i][j-1] + ((s[i][j]!=s[i][j-1]) ? 1 : 0);
            } else if (j==0){
                DP[i][j] = DP[i-1][j] + ((s[i][j]!=s[i-1][j]) ? 1 : 0);
            } else{
                DP[i][j] = min(DP[i][j-1]+(s[i][j]!=s[i][j-1] ? 1 : 0), 
                               DP[i-1][j]+((s[i][j]!=s[i-1][j]) ? 1 : 0));
            }
        }
    }

    int ans;
    ans = ceil(double(DP[h-1][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 sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n - 1];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            b[i] = sc.nextInt();
        }
        for (int i = 0; i < n - 1; i++) {
            c[i] = sc.nextInt();
        }
        int result = 0;
        for (int i = 0; i < n; i++) {
            result += b[a[i] - 1];
            if (i >= 1 && a[i] - a[i - 1] == 1) {
                result += c[a[i - 1] - 1];
            }
        }
        System.out.println(result);
    }

}


Measured memory_bytes: 21972
#include <cstdio>

using namespace std;

char litere[5];

int main()
{
    char ch;
    int len = 0;
    scanf("%c", &ch);
    while(ch != '\n'){
        len++;
        litere[len] = ch;
        scanf("%c", &ch);
    }
    bool ok = 0;
    for(int i = 1; i < len; i++){
        if(litere[i] == 'A' && litere[i + 1] == 'C'){
            ok = 1;
            break;
        }
    }
    if(ok)
        printf("Yes");
    else
        printf("No");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;

int main()
{
    int  a=0,c=0,i=0,n=0,j=0;
    int aa[100]={};
    cin >> n;
    for(i=0;i<n;i++){
        cin >> aa[i];
    }

    for(i=0;i<n-1;i++){
        a=i;
        for(j=i+1;j<n;j++){
            if(aa[j]<aa[a])a=j;
        }
        if(i!=a){
            swap(aa[i],aa[a]);
            c++;
        }
    }
    for(i=0;i<n;i++){
        cout << aa[i];
        if(i<n-1){
            cout << ' ';
        }
    }
    cout << endl;
    cout << c << endl;
    //cout << b;
}

Measured memory_bytes: 1164
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		int E = C/B;
		int F = A/D;
		if( C%B!=0 ){
			E++;
		}
		if( A%D!=0 ){
			F++;
		}
		if( E<=F ){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 35780
import sys
input = sys.stdin.readline

N = int(input())
h_arr = list(map(lambda h: int(h), input().split()))
count = 0
moves = []

for n in range(1,N):
    if h_arr[n-1] >= h_arr[n]:
        count +=1
    else:
        moves.append(count)
        count = 0
moves.append(count)

print(max(moves))


Measured memory_bytes: 14252
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

int main() {
    size_t n;
    scanf("%zu", &n);

    vector<int> A(n);
    for (size_t i=0; i<n; ++i)
        scanf("%d", &A[i]);

    set<int> sum;

    for (size_t i=0; i<(1u<<n); ++i) {
        int s=0;
        for (size_t j=0; j<n; ++j) {
            if (1<<j & i)
                s += A[j];
        }
        sum.insert(s);
    }

    size_t q;
    scanf("%zu", &q);

    for (size_t i=0; i<q; ++i) {
        int m;
        scanf("%d", &m);

        printf("%s\n", sum.count(m)? "yes":"no");
    }

    return 0;
}

Measured memory_bytes: 2736
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

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

    auto f = [&](int64_t k) {
        return (k + x) / x;
    };

    cout << f(b) - f(a - 1) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; i++)
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int main()
{
    ll n;
    cin >> n;
    vector<ll> std_cnt(26, 110);
    rep(i, n)
    {
        string s;
        cin >> s;
        int sn = s.length();
        vector<ll> cnt(26, 0);
        // count the number of alphabets in each s
        rep(j, sn)
        {
            cnt[s[j] - 'a']++;
        }
        // find the minimum number of alphabets in each s
        rep(j, 26)
        {
            std_cnt[j] = min(std_cnt[j], cnt[j]);
        }
    }

    string ans = "";
    // for each alphabets
    rep(i, 26)
    {
        // print as many times as std_cnt[i] has
        rep(j, std_cnt[i])
        {
            ans += (char)(i + 'a');
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define double long double
#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,sse")
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        if (i % 2 == 1 && x % 2 == 1) {
            cnt++;
        }
    }
    cout << cnt << '\n';

    fflush(stdout);
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <climits>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N;
	cin>>N;
	vector<int> A(N);
	vector<int> B(N);
	for(int i=0;i<N;i++) cin>>A[i];
	for(int i=N;i>=1;i--){
		int tmp=0;
		for(int j=1;;j++){
			if(i*j>N) break;
			tmp+=B[i*j-1];
		}
		if(A[i-1]%2==0){
			if(tmp%2==1) B[i-1]=1;
		}else if(A[i-1]%2==1){
			if(tmp%2==0) B[i-1]=1;
		}
	}
	int sum=0;
	for(int i=0;i<N;i++){
		if(B[i]==1) sum++;
	}
	cout<<sum<<endl;
	for(int i=0;i<N;i++){
		if(B[i]==1) cout<<i+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
const int maxn=100005;
int a[maxn],ans,n;
bool b_sch(int s){
	int l=1,r=n+1;
	while(l<r){
		int mid=(l+r)/2;
		if(a[mid]>s) r=mid;
		else if(a[mid]==s) return true;
		else l=mid+1;
	}
	return false;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	int q;
	cin>>q;
	while(q--){
		int sch;
		cin>>sch;
		if(b_sch(sch)==true) ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3452
#include <iostream>
using namespace std;
int main(void){
    int i=0;
    int j=0;
    int temp=0;
    int ans=0;
    char a[10];
    
    while(i<10){
        cin >> a[i];
        i++;
    }
    
    while(j<i){
        if(a[j]=='A'||a[j]=='C'||a[j]=='G'||a[j]=='T'){
            temp=temp+1;
        }
        else{
            if(temp>=ans){
                ans = temp;
                temp=0;
            }
        }
        j++;
    }
    
    if(temp>=ans){
                ans = temp;
                temp=0;
            }
    
    cout << ans << endl;
    
}

Measured memory_bytes: 256
A, B, C, D = input()
ops = ('+', '-')

for op1 in ops:
	for op2 in ops:
		for op3 in ops:
			if eval(A+op1+B+op2+C+op3+D+'==7'):
				print(A+op1+B+op2+C+op3+D+'=7')
				exit()

Measured memory_bytes: 3060
eval'K,X,Y='+`dd`.split*?,
l=1
x,y,*s=X.abs,Y.abs
d=x+y
x,y=y,x if f=x<y
K%2-d%2<0&&p(-1)+exit
d!=K&&(l+=[~-d/K,1].max
l+=1&d-K*l
v=K>(t=K*l-d>>1)?0:t-t=K
a=K-t
2.upto(l){s.<<f ?[-t,a]:[a,-t]
a+=q=[x+v-a,K].min
t-=K-q})
puts l,s.map{|a,b|[a*=X<=>0.1,b*=Y<=>0.1]},X,Y

Measured memory_bytes: 40320
N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(Q)]
res = 0

def dfs(A):
    global res
    if len(A) == N:
        tmp = 0
        for a, b, c, d in abcd:
            if A[b-1] - A[a-1] == c:
                tmp += d
        if tmp > res:
            res = tmp
        return

    if len(A) == 0:
        d = 1
    else:
        d = A[-1]

    for i in range(d, M+1):
        dfs(A + [i])

dfs([])
print(res)

Measured memory_bytes: 9244
//DPL_1D
#include <iostream>
#include <algorithm>
using namespace std;
 
static const int MAX=100000;
int n,A[MAX+1],L[MAX];

int lis(){
 L[0]=A[0];
 int length=1;
 for(int i=1;i<n;i++){
  if(L[length-1]<A[i]){
   L[length++]=A[i];
  }else{
   *lower_bound(L,L+length,A[i])=A[i];
  }
 }
 return length;
}

int main(){
 cin>>n;
 for(int i=0;i<n;i++) cin>>A[i];
 cout<<lis()<<endl;
 return 0;
}

Measured memory_bytes: 1940
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

cnt = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
  done = [0 for _ in range(W)]
  for j in range(W):
    if S[i][j] == "#":
      continue
    if done[j]:
      continue
    l = 0
    while j + l < W:
      if S[i][j + l] == "#":
        break
      l += 1
    for k in range(l):
      cnt[i][j + k] += l
      done[j + k] = 1

for j in range(W):
  done = [0 for _ in range(H)]
  for i in range(H):
    if S[i][j] == "#":
      continue
    if done[i]:
      continue
    l = 0
    while i + l < H:
      if S[i + l][j] == "#":
        break
      l += 1
    for k in range(l):
      cnt[i + k][j] += l
      done[i + k] = 1

ans = 0
for i in range(H):
  for j in range(W):
    ans = max(ans, cnt[i][j] - 1)
print(ans)

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

int main() {
	int n, m;
	cin >> n >> m;
	int a, b;
	int ans[51];
	for (int i = 0; i < 50; i++) {
		ans[i] = 0;
	}
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		ans[a-1]++; ans[b-1]++;
	}
	for (int i = 0; i < n; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
vector<int>g[110000];
int v[110000];
int ans[110000];
int sz;
void dfs(int a){
	v[a]=1;
	int cnt=0;
	ans[sz++]=a;
	int tmp=0;
	for(int i=0;i<g[a].size();i++){
		if(v[g[a][i]]==0){
			dfs(g[a][i]);
			cnt++;
			if(a&&cnt==1)return ;
			
			if(cnt==2){
				reverse(ans,ans+tmp);
				return;
			}
			tmp=sz;
		}
	}
	return ;
}
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<b;i++){
		int p,q;
		scanf("%d%d",&p,&q);
		p--;q--;
		g[p].push_back(q);
		g[q].push_back(p);
	}
	dfs(0);
	printf("%d\n",sz);
	for(int i=0;i<sz;i++){
		if(i)printf(" ");
		printf("%d",ans[i]+1);
	}
	printf("\n");
}

Measured memory_bytes: 13056
/* In the name of Allah */
#include<bits/stdc++.h>
using namespace std;

map<long long, long long> mp;
long long ans;
int cost[6];

void f(long long n, long long cur) {
	if (cur >= ans || (mp.count(n) && mp[n] <= cur))
		return;
	mp[n] = cur;
	if ((ans - cur) / cost[1] >= n)
		ans = cur + cost[1] * n;
	for (auto x: {2, 3, 5}) {
		f(n / x, cur + cost[x] + (n % x) * cost[1]);
		f(n / x + 1, cur + cost[x] + (x - n % x) * cost[1]);
	}
}

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

	int t;
	cin >> t;
	while (t--) {
		long long n;
		cin >> n >> cost[2] >> cost[3] >> cost[5] >> cost[1];
		ans = 1e11, f(n, 0), mp.clear(), cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 4680
s = str(input())

if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
    print('Yes')

elif s[0] == s[2] and s[1] == s[3] and s[0] != s[1]:
    print('Yes')

elif s[0] == s[3] and s[1] == s[2] and s[0] != s[1]:
    print('Yes')

else:
    print('No')

Measured memory_bytes: 3064
#include <stdio.h>
#define N 10000
#define Q 500
main(){
  int array1[N],array2[Q],i,j,c=0,n,m;

  scanf("%d%",&n);
  for(i=0;i<n;i++){
    scanf("%d%",&array1[i]);
  }

  scanf("%d%",&m);
  for(j=0;j<m;j++){
    scanf("%d%",&array2[j]);
  }

  for(i=0;i<m;i++){
    for(j=0;j<n;j++){
      if(array2[i]==array1[j]){
	c++;
	break;
      }
    }
  }

  printf("%d\n",c);
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	long long int n;
	int count=0;
	int min=11;
	int max_num;
	cin >> n;
	int sq = sqrt(n);
	for (long long int i = sq; i >0; i--) {
		if (n % i == 0) {
			max_num = max(n / i, i);
			while (max_num>=1) {
				count++;
				max_num=max_num / 10;
			}
				min = count;
				break;
		}
		count = 0;
	}
	cout << min;

}

Measured memory_bytes: 256