akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define faster      ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi          acos(-1.0)
#define nl          '\n'

///Library
#define mem(a,b)    memset(a,b,sizeof(a))
#define all(a)      a.begin(),a.end()
#define Sort(x)     sort(x.begin(),x.end())
#define Reverse(x)  reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b)    __gcd(a,b)
#define lcm(a,b)    (a*(b/gcd(a,b)))
#define sq(x)       (x)*(x)

#define for0(a, n)      for(int i=a; i<n; i++)
#define for1(a, n)      for(int i=a; i<=n; i++)
#define rfor0(n, a)     for(int i=n-1; i>=a; i--)
#define rfor1(n, a)     for(int i=n; i>a; i--)

#define min3(a,b,c)        min(a,min(b,c))
#define min4(a,b,c,d)      min(a,min(b,min(c,d)))
#define max3(a,b,c)        max(a,max(b,c))
#define max4(a,b,c,d)      max(a,max(b,max(c,d)))
#define ABS(x)             ((x)<0?-(x):(x))
#define pb                 push_back
#define mod                1000000007
#define end                printf("\n")
#define yes                printf("YES\n")
#define no                 printf("NO\n")

///data type
typedef long long int ll;
typedef unsigned long long int  llu;

int main()
{
    int n;
    cin>>n;
    if(n)
        cout<<0<<nl;
    else cout<<1<<nl;
    return 0;
}


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

int main() {
  int n; cin >> n;
  string s; cin >> s;
  map<char,int> l,r;
  int ans = 0, cnt = 0;
  rep(i,n) r[s[i]]++;
  rep(i,n-1) {
    if (!l.count(s[i])) cnt++;
    l[s[i]]++;
    r[s[i]]--;
    if (r[s[i]] == 0) cnt--;
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;

  
  
  
  
  
  
  
  
  
  
  
  
  
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define digit(x) floor(log10(x))+1
#define mod 1000000007
#define endl "\n"
#define int long long
typedef long double ld;
typedef vector<vector<int> > matrix;
typedef vector<int> arr;
typedef vector<string> vs;
typedef vector<pair<int,int> > pv;
#define test() int t;cin>>t;while(t--)
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define ROF(i,a,b) for(int i=a;i>=b;--i)
#define all(x) x.begin(),x.end()
#define debug(x) cerr << #x << " is " << x << endl;
int bx[]={0,0,1,-1,1,-1,-1,1};
int by[]={1,-1,0,0,1,-1,1,-1};
//=================================================================//
int dp[10001][101][2];
string s;
int D;
int solve(int pos,int sum, int tight) {
    if(pos==s.length()) {
        return (sum%D)==0;
    }

    int &ans = dp[pos][sum][tight];
    if(ans != -1) return ans;

    int res = 0;
    int end = (tight) ? (s[pos]-'0') : 9;
    for(int i=0; i<=end; i++) {
        (res += (solve(pos+1,(sum+i)%D, tight&(i==end))%mod)%mod);
    }
    return ans = res%mod;
}


#undef int
int main(){
#define int long long 
    fast;
    cin>>s>>D;
    memset(dp, -1, sizeof dp);
    int ans = solve(0,0,1);
    cout<<(ans-1+mod)%mod<<endl;
    return 0;
}

Measured memory_bytes: 16896
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define float long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define endl '\n'
#define pii pair<int, int>
#define tii tuple<int, int, int>
#define min3(a,b,c) min(a, min(b, c))
#define max3(a,b,c) max(a, max(b, c))
#define all(x) x.begin(), x.end()
#define fill(a,b) memset(a, b, sizeof(a))
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

signed main()
{

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

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

	int n,k; cin>>n>>k;
	int arr[n];
	for(int i=0;i<n;i++) cin>>arr[i];
	sort(arr,arr+n);
	int ans=0;
	for(int i=0;i<k;i++) ans+=arr[i];
	cout<<ans<<endl;

}

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


int main(){
    int N;
    cin>>N;
    int p[5000];
    for(int i = 0;i < N;i++)cin>>p[i];
    int min_sum = 20000;
    for(int i = 0;i <= p[0];i++){
        int q[5000];
        for(int j = 0;j < N;j++){
            q[j] = p[j];
        }
        int sum= i;
        q[0] -= i;
        for(int j= 0;j <= N-2;j++){
            if(q[j] <= 0)continue;

            sum+=q[j]*2;
            q[j+1] -= q[j];
        }

        if(q[N-1]>0)sum += q[N-1];
        min_sum = min(min_sum,sum);
    }
    cout<<min_sum<<endl;
    return 0;
}


Measured memory_bytes: 3148
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let mut a: Vec<i32> = (0..3).map(|_| input()).collect();
    a.sort();
    println!(
        "{}",
        if a[0] == 5 && a[1] == 5 && a[2] == 7 {
            "YES"
        } else {
            "NO"
        }
    );
}


Measured memory_bytes: 4352
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}
	int size(int a) {
		return par[root(a)];
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

int main() {
	llint n, q;
	cin >> n;
	hei(llint) a(n);
	map<llint, llint> S;
	llint z = 0;
	rep(i, 0, n) {
		cin >> a[i];
		S[a[i]]++;
		z += a[i];
	}
	cin >> q;
	hei(llint) ans(q);
	rep(i, 0, q) {
		llint b, c;
		cin >> b >> c;
		z -= ((b - c) * S[b]);
		S[c] += S[b];
		S[b] = 0;
		ans[i] = z;
	}
	rep(i, 0, q)cout << ans[i] << endl;
	return 0;

}

Measured memory_bytes: 10388
#include<iostream>

int main(void){
	int n, m;
	std::cin >> n >> m;
	int A[n][m], b[m] , y[n];
	
	for (int i=0; i < n; i++){ 
		for (int j = 0; j < m; j++) {
			std::cin >> A[i][j];
		}
		y[i] = 0;
	}
	
	for (int k = 0; k < m; k++){
		std::cin >> b[k];
	}
	
	
	for (int i=0; i < n; i++){ 
		for (int j = 0; j < m; j++) {
			y[i] +=  A[i][j]*b[j];
		}
	}
	
	for (int k = 0; k < n; k++){
		std::cout << y[k] << std::endl;
	}
	
	return 0;
}

Measured memory_bytes: 1200
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

input = sys.stdin.readline

# N個整数
x, y, z, k = list(map(int, input().split()))

# 1整数
# n = int(input())

# 空白区切りリスト整数
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ll = [0] * 1000001
count = 0
for i in a:
    for j in b:
        ll[count] = i + j
        count += 1
ll.sort(reverse=True)

ll = ll[0:3000]
c.sort(reverse=True)

lll = [0] * 3000001
count = 0
for i in ll:
    for j in c:
        lll[count] = i + j
        count += 1
lll.sort(reverse=True)

for i in range(k):
    print(lll[i])

# 空白区切り文字列
# t, d = input().split()


Measured memory_bytes: 98496
#!/usr/bin/env python

from sys import stdin, stderr

def main():
   K = int(stdin.readline())

   A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

   print(A[K-1])

   return 0

if __name__ == '__main__': main()


Measured memory_bytes: 2568
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(pair<int,int>a, pair<int,int>b) {
	if (a.first == b.first) {
		return a.second > b.second;
	}
	else {
		return a.first < b.first;
	}
}

int main() {
	int a, b, e;
	cin >> a >> b >> b >> b >> b >> e;
	if (e < b - a) {
		cout << ":(" << endl;
	}
	else {
		cout << "Yay!" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
S = input()

count = 0
for i, si in enumerate(S):
    if i % 2 == 0 and si != '0':
        count += 1
    if i % 2 == 1 and si != '1':
        count += 1

mi = count

count = 0
for i, si in enumerate(S):
    if i % 2 == 0 and si != '1':
        count += 1
    if i % 2 == 1 and si != '0':
        count += 1

print(min(mi, count))

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

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int a, b;
  cin >> a >> b;
  int ans = 0;
  for (int i=0; i<2; ++i) {
    ans += max(a, b);
    (a>b ? a : b)--;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*; 
import java.io.*;

public class Main {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));

        
        int S = nextInt();
        int W = nextInt();
 

        if(W>=S){
            System.out.println("unsafe");
        }
        else{
            System.out.println("safe");
        }


    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}

Measured memory_bytes: 32744
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
    @SuppressWarnings("deprecation")
	public static void main(String[] args) throws FileNotFoundException {

//    	File file = new File("src/in.txt");

        //コード
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);

    	int L = sc.nextInt();

//    	BigDecimal POWL3 = new BigDecimal(L*L*L);
//
//    	BigDecimal ts = new BigDecimal(27);
//
//    	BigDecimal V = POWL3.di

    	int POWL3 = L*L*L;
    	double V = (double)POWL3/27;

    	System.out.println(String.format("%.8f", V));

    }

}

Measured memory_bytes: 21844
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)

int main() {

	int A, B;
	scanf("%d %d", &A, &B);

	char Grid[100][100];
	rep(y, 100) rep(x, 100) {
		if (!x) Grid[y][x] = '.';
		else if (x == 99) Grid[y][x] = '#';
		else if (y % 2) Grid[y][x] = '#';
		else Grid[y][x] = '.';
	}

	rep(a, A-1) {
		Grid[a / 40 * 2][a % 40 * 2 + 1] = '#';
	}
	rep(b, B-1) {
		Grid[100 - b / 40 * 2 - 1][(b % 40 + 1) * 2] = '.';
	}

	printf("100 100\n");
	rep(y, 100) {
		rep(x, 100) {
			printf("%c", Grid[y][x]);
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())
 
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll, ll> P;
//const int MAX=;
 
int main(){
	int N;
	cin>>N;
	ll x[50], y[50];
	rep(i,N)cin>>x[i]>>y[i];
	
	int ans=N;
	rep(i,N)rep(j,N)if(i<j){
		ll dx=x[i]-x[j];
		ll dy=y[i]-y[j];
		int sc=0;
		rep(k,N)rep(l,N)if(x[k]-x[l]==dx && y[k]-y[l]==dy)sc++;
		ans=min(ans, N-sc);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import Foundation

let n = Int(readLine()!)!
let scanner = Scanner(string: readLine()!)

var acc = 0
var min = scanner.scanInt()!

for _ in 1..<n {
  let num = scanner.scanInt()!

  if min > num {
    acc += min - num
  } else {
    min = num
  }
}

print(acc)


Measured memory_bytes: 16608
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect
import itertools


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    pict = inputs
    new_pict = []

    for row in pict:
        new_pict.append(row)
        new_pict.append(row)
    return new_pict


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    [N, M] = string_to_int(input())
    ret = solve(inputs(N))
    for r in ret:
        print(r)


Measured memory_bytes: 38384
N = int(input())
l = [int(x) for x in input().split()]
l.sort()
def binary_search(list, item):
    low = 0
    high = len(list) - 1
    if item > list[-1]:
        return high
    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            return mid
        if guess > item:
            high = mid -1
        else:
            low = mid + 1
    if list[mid] > item:
        return mid - 1
    else:
        return mid
ans = 0
for i in range(N-1):
    for j in range(i,N-1):
        b = binary_search(l,l[i] + l[j+1]-1)
        while True:
            if b == len(l)-1:
                break
            elif l[b] == l[b+1]:
                b = b+1
            else:
                break
        ans += max(0,b-(j+1))
print(ans)

Measured memory_bytes: 50648
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<queue>
#include<functional>
#include<numeric>

using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w;
	cin >> h >> w;
	vector<vector<int>> a(h, vector<int>(w));
	for (auto& e : a) {
		for (auto& f : e) {
			cin >> f;
		}
	}
	vector<string> ans;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			int k = (i % 2 == 0) ? j : w - j - 1;
			if (a[i][k] % 2 == 0) continue;
			if (j == w - 1) {
				if (i == h - 1) break;
				a[i + 1][k]++;
				ans.push_back(to_string(i+1) + " " + to_string(k+1) + " " + to_string(i + 1+1) + " " + to_string(k+1));
				continue;
			}
			int next = (i % 2 == 0) ? k + 1 : k - 1;
			a[i][next]++;
			ans.push_back(to_string(i+1) + " " + to_string(k+1) + " " + to_string(i+1) + " " + to_string(next+1));
		}
	}
	cout << ans.size() << endl;
	for (auto& e : ans) {
		cout << e << endl;
	}
	return 0;
}

Measured memory_bytes: 11892
import java.util.*;

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

Measured memory_bytes: 19924
#include <cstdio>
#include <string>
#include <iostream>

using namespace std;


int main() {

    int n;
    string s;

    cin >> n;
    cin >> s;

    int ans = 0;

    for (int i=0; i < 1000; i++) {
        int match = 0;
        string s_i = to_string(i);
        if (i < 10) {
            s_i = "00" + s_i;
        } else if (i < 100) {
            s_i = "0" + s_i;
        }
        for (int j=0; j < n; j++) {
            if (s[j] == s_i[match]) {
                match++;
            }
            if (match == 3) {
                ans++;
                break;
            }
        }
    }

    printf("%d", ans);

}


Measured memory_bytes: 256
###############################################################################

from bisect import bisect_left as binl

def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return map(int, input_tuple)


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


###############################################################################


def main():
    n, m = intin()
    ablist = intinl(n)
    ablist = [(a, b) for a, b in ablist]

    ablist.sort()

    count = 0
    yen = 0
    for a, b in ablist:
        if count + b >= m:
            yen += a * (m - count)
            count = m
            break
        yen += a * b
        count += b

    print(yen)


if __name__ == '__main__':
    main()


Measured memory_bytes: 83544
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

int main()
{
    ios_base::sync_with_stdio(0);
    string a;
    cin >> a;
    int n = a.size();
    int pyt = 0;
    for (int i = 0; i < n; ++i)
        if (a[i] == '?')
            ++pyt;
    vector<ll> pot3(n + 1);
    pot3[0] = 1;
    for (int i = 1; i <= n; ++i)
        pot3[i] = (pot3[i - 1] * 3) % MOD;
    vector<ll> prefA(n);
    for (int i = 0; i < n; ++i)
    {
        prefA[i] = 0;
        if (a[i] == 'A')
            ++prefA[i];
        if (i - 1 >= 0)
            prefA[i] += prefA[i - 1];
    }
    vector<ll> sufC(n);
    for (int i = n - 1; i >= 0; --i)
    {
        sufC[i] = 0;
        if (a[i] == 'C')
            ++sufC[i];
        if (i + 1 < n)
            sufC[i] += sufC[i + 1];
    }
    vector<ll> prefpyt(n);
    for (int i = 0; i < n; ++i)
    {
        prefpyt[i] = 0;
        if (a[i] == '?')
            ++prefpyt[i];
        if (i - 1 >= 0)
            prefpyt[i] += prefpyt[i - 1];
    }
    vector<ll> sufpyt(n);
    for (int i = n - 1; i >= 0; --i)
    {
        sufpyt[i] = 0;
        if (a[i] == '?')
            ++sufpyt[i];
        if (i + 1 < n)
            sufpyt[i] += sufpyt[i + 1];
    }

    ll odp = 0;
    for (int i = 0; i < n; ++i)
    {
        if (a[i] == 'B')
        {
            if (prefA[i] >= 1 && sufC[i] >= 1)
                odp = (odp + prefA[i] * sufC[i] * pot3[pyt]) % MOD;
            if (prefA[i] >= 1 && sufpyt[i] >= 1 && pyt - 1 >= 0)
                odp = (odp + prefA[i] * sufpyt[i] * pot3[pyt - 1]) % MOD;
            if (prefpyt[i] >= 1 && sufC[i] >= 1 && pyt - 1 >= 0)
                odp = (odp + prefpyt[i] * sufC[i] * pot3[pyt - 1]) % MOD;
            if (prefpyt[i] >= 1 && sufpyt[i] >= 1 && pyt - 2 >= 0)
                odp = (odp + prefpyt[i] * sufpyt[i] * pot3[pyt - 2]) % MOD;
        }
        if (a[i] == '?')
        {
            if (prefA[i] >= 1 && sufC[i] >= 1 && pyt - 1 >= 0)
                odp = (odp + prefA[i] * sufC[i] * pot3[pyt - 1]) % MOD;
            if (prefA[i] >= 1 && sufpyt[i] >= 2 && pyt - 2 >= 0)
                odp = (odp + prefA[i] * (sufpyt[i] - 1) * pot3[pyt - 2]) % MOD;
            if (prefpyt[i] >= 2 && sufC[i] >= 1 && pyt - 2 >= 0)
                odp = (odp + (prefpyt[i] - 1) * sufC[i] * pot3[pyt - 2]) % MOD;
            if (prefpyt[i] >= 2 && sufpyt[i] >= 2 && pyt - 3 >= 0)
                odp = (odp + (prefpyt[i] - 1) * (sufpyt[i] - 1) * pot3[pyt - 3]) % MOD;
        }
    }
    cout << odp;
    return 0;
}


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

using namespace std;

int main()
{
   int n;
   long long a[100100];
   while(scanf("%d",&n)==1)
   {
       int i,s=0,r;
   for(i=0;i<n;i++)
    scanf("%lld",&a[i]);
   for(i=0;i<n;i++)
   {
       int t=a[i];
       r=t/2;
       while(r*2==t)
       {
           s++;t=r;r=t/2;
       }
   }
   printf("%d\n",s);
   }

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;

void sort(int *x, int *y)
{
	int temp;
	temp = *x;
	*x = *y;
	*y = temp;
}

int main(void)
{
	int n, r;
	while(cin >> n >> r && n!=0 && r != 0)
	{	
		vector<int> A(n);
		for(int i = 0;i < n; i++)
		{
			A[i] = n - i;
		}

		int p, c;

		for(int i = 0; i < r; i++)
		{
			cin >> p >> c;
			vector<int> B(p);
			
			int j = 0;
			for(int i = 0; i < p-1;i++)
				B[i] = A[i];

			for(int i = p-1; i < p+c-1; i++)
				sort(&A[i], &A[i-(p-1)]);

			for(int i = c; i < c+p-1;i++)
				A[i] = B[i-c];
		}
		cout << A[0] << endl;
	}
	return 0;
}


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

int main(){
int n,m;
  cin>>n>>m;
  vector<int>a(m);
  for(int i=0;i<m;i++)cin>>a[i];
  int sum=0;
  for(auto t:a){
    sum+=t;
    if(sum>n) {cout<<-1<<endl; return 0;}
  }
  int diff=n-sum;
  cout<<diff<<endl;
  return 0;
}

Measured memory_bytes: 3656
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			Map<String, Integer> map = new HashMap<String, Integer>();
			for (int i = 0; i < n; i++) {
				String tmp = change(sc.next());
				if (map.containsKey(tmp)) {
					map.put(tmp, map.get(tmp)+1);
				} else {
					map.put(tmp, 1);
				}
			}
			long result = 0;

			for (String str : map.keySet()) {
				result += calc(map.get(str));
			}
			System.out.println(result);
		}
	}

	private static long calc(long num) {
		return (num * (num - 1)) / 2;
	}

	private static String change(String str) {
		char[] arr = str.toCharArray();
		Arrays.sort(arr);
		return new String(arr);
	}
}


Measured memory_bytes: 54184
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	private void doIt() {
		Scanner sc = new Scanner(System.in);

		final int MAX = 1000000;
		boolean [] isprime = new boolean[MAX+1];
		int [] acc = new int[MAX+1];
		Arrays.fill(isprime, true);
		for(int i = 2; i <= MAX; i++){
			acc[i] = acc[i-1];
			if(isprime[i]){
				acc[i]++;
				for(int j = i * 2; j <= MAX; j += i){
					isprime[j] = false;
				}
			}
		}

		while(true){
			int n = sc.nextInt();
			if(n == 0){
				break;
			}
			int sum = 0;
			int [][] data = new int[n][2];
			for(int i=0; i < n ;i++){
				int p = sc.nextInt();
				int m = sc.nextInt();
				int max = p+m;
				int min = p-m;
				data[i][0] = Math.max(min, 2);
				data[i][1] = Math.min(Math.max(max, 2), 1000000);
			}
			for(int i=0; i < n ;i ++){
				int pat = acc[data[i][1]] - acc[data[i][0]- 1];
				sum += pat - 1;
			}
			System.out.println(sum);
		}
	}

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

}

Measured memory_bytes: 17000
using namespace std;

#include <stdio.h>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <algorithm>

#define int long long
#define double long double
typedef pair<int, int> ii;
typedef vector<int> vi;

int n;
int t[102];
int v[102];
int dp[202][40003];
int tab[40003];
int sum;
//double x[102];
//double speed[102];
int INF = 1000000000;

int compute(int time, int speed) {
    if (speed < 0 || speed > 200) return -INF;
    if (time == sum) {
        if (speed == 0) return 0;
        else return -INF;
    }
    if (dp[speed][time] != -1) return dp[speed][time];
    int index = tab[time];
    if (speed > v[index]) return -INF;
    
    int ans = -INF;
    if (speed < v[index]) ans = max(ans, compute(time + 1, speed + 1));
    ans = max(ans, compute(time + 1, speed));
    if (speed > 0) ans = max(ans, compute(time + 1, speed - 1));
    ans += speed;
    //printf("%lld %lld %lld: %lld\n", index, speed, time, ans);
    return dp[speed][time] = ans;
}
/*
double maxSpeed(double speed, int index) {
    double ans = (double) min(speed + t[index], (double) v[index]);
    int cnt = 0;
    for (int i = index + 1; i < n; i++) {
        cnt += t[i - 1];
        x[index] = min(x[index], cnt - ans + v[i]);
    }
    cnt = 0;
    for (int i = index + 1; i < n; i++) {
        cnt += t[i - 1];
        double tmp = (cnt + speed + v[i]) / 2.;
        if (tmp < ans) {
            ans = tmp;
            x[index] = tmp - speed;
        }
    }
    return ans;
} */

signed main() {
    //freopen("out.txt", "w", stdout);
    scanf("%I64d", &n);
    sum = 0;
    for (int i = 0; i < n; i++) {
        scanf("%I64d", &t[i]);
        t[i] *= 2;
        //x[i] = (double) INF;
        for (int j = sum; j < sum + t[i]; j++) {
            tab[j] = i;
        }
        sum += t[i];
    }
    for (int i = 0; i < n; i++) {
        scanf("%I64d", &v[i]);
        v[i] *= 2;
    }
    
    for (int i = 0; i <= 201; i++) {
        for (int j = 0; j <= 40001; j++) {
            dp[i][j] = -1;
        }
    }
    /*
    t[n] = 0; v[n] = 0;
    n++; */
    
    /*
    for (int i = 0; i < n; i++) {
        speed[i] = maxSpeed((i == 0) ? 0: min(speed[i - 1], (double) v[i]), i);
    }
    
    double ans = 0; */
    
    /*for (int i = 0; i < n; i++) {
        cout << speed[i] << " " << x[i] << "\n";
    } */
    
    /*
    double curSpeed = 0;
    for (int i = 0; i < n - 1; i++) {
        double diff = speed[i] - curSpeed;
        if (diff > 0) ans += diff * diff / 2. + curSpeed * diff; // first triangle
        curSpeed = speed[i];
        //cout << ans << "\n";
        if (min(x[i], (double) t[i]) > diff) {
            ans += (min(x[i], (double) t[i]) - diff) * speed[i]; // second triangle
        }
        //cout << ans << "\n";
        if (x[i] < t[i]) {
            ans += (t[i] - x[i]) * (t[i] - x[i]) / 2. + (t[i] - x[i]) * (speed[i] - (t[i] - x[i]));
            curSpeed = curSpeed - (t[i] - x[i]);
        }
        //cout << ans << "\n";
    } */
    
    //cout << compute(0, 0) / 4. << "\n";
    printf("%.20lf\n", compute(0, 0) / 4.);
}


Measured memory_bytes: 65536
#include <bits/stdc++.h>
using namespace std;
#define reset(a,b) memset(a,b,sizeof(a))
typedef long long LL;
struct edge
{
	LL u,v;
}e[200001];
LL fir[100001],nex[200001];
queue<LL>f,s,tmp;
int main()
{
	LL n,x,y,i,j,k,pain;
	bool find=false;
	LL a[100001];
	reset(a,-1);
	reset(fir,-1);
	reset(nex,-1);
	cin>>n;
	for(i=0;i<n-1;i++)
	{
		scanf("%lld%lld",&x,&y);
		if(fir[x]!=-1)
			nex[i]=fir[x];
		fir[x]=i;
		e[i].u=x;	e[i].v=y;
		if(fir[y]!=-1)
			nex[i+n-1]=fir[y];
		fir[y]=n+i-1;
		e[i+n-1].u=y;	e[i+n-1].v=x;
	}
	f.push(1);	s.push(n);
	a[1]=1;	a[n]=0;
	n-=2;
	if(n==0)	{puts("Snuke");	find=true;	return 0;}
	x=y=0;
	while(n>0&&!find)
	{
		pain=0;
		while(!f.empty()&&!find)
		{
			i=f.front();
			i=fir[i];
			f.pop();
			k=nex[i];
			if(a[e[i].v]==-1)	
			{
				a[e[i].v]=1;
				pain++;
				n--;
				if(n==0)	{find=true;	break;}
				tmp.push(e[i].v);
			}
			while(k!=-1&&!find)
			{
				if(a[e[k].v]==-1)	
				{
					a[e[k].v]=1;
					pain++;
					n--;
					if(n==0)	{find=true;	break;}
					tmp.push(e[k].v);
				}
				k=nex[k];
			}
		}
		f=tmp;
		while(!tmp.empty())	tmp.pop();
		x+=pain;
		pain=0;
		while(!s.empty()&&!find)
		{
			i=s.front();
			i=fir[i];
			s.pop();
			k=nex[i];
			if(a[e[i].v]==-1)	
			{
				a[e[i].v]=0;
				pain++;
				n--;
				if(n==0)	{find=true;	break;}
				tmp.push(e[i].v);
			}
			while(k!=-1&&!find)
			{
				if(a[e[k].v]==-1)	
				{
					a[e[k].v]=0;
					pain++;
					n--;
					if(n==0)	{find=true;	break;}
					tmp.push(e[k].v);
				}
				k=nex[k];
			}
		}
		s=tmp;
		while(!tmp.empty())	tmp.pop();
		y+=pain;
	}
	if(x>y)	puts("Fennec");
	else puts("Snuke");
	return 0;
}

Measured memory_bytes: 6656
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
//#define int long long
#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << " \n"[i==(int)v.size()-1]
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;
//int dx[4] = { 0,0,-1,1 }, dy[4] = { 1,-1,0,0 };


void solve() {
	int N; cin >>  N;
	int K; cin >> K;
	vector<int>A(N);
	REP(i, N) {
		cin >> A[i];
	}
	FOR(i, K, N) {
		if (A[i] > A[i - K])print("Yes");
		else print("No");
	}
}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;
	//cin >> q;
	//while (q--)
	solve();

}


Measured memory_bytes: 3992
import scala.math.ceil

object Main {
  val sc = new java.util.Scanner(System.in)

  def sin(n: Int): Seq[Int] = Seq.fill(n)(sc.nextInt())

  def iin(): Int = sc.nextLine().toInt

  def main(args: Array[String]): Unit = {
    val n, k = sc.nextDouble()

    println( if(ceil(n / 2) >= k) "YES" else "NO" )
  }
}

Measured memory_bytes: 27320
import math
n, a, b = map(int, input().split())
list_enemy = [int(input()) for _ in range(n)]
list_enemy.sort(reverse=True)

diff_dam = a - b
min_a = math.ceil(list_enemy[-1] / a)
max_a = math.ceil(list_enemy[0] / b)
while max_a - min_a > 1:
  mid_a = min_a + (max_a - min_a) // 2
  count = 0
  for one_enemy in list_enemy:
    rest_h = one_enemy - (b * mid_a)
    if rest_h > 0:
      count += math.ceil(rest_h / diff_dam)
    else:
      break
  if count <= mid_a:
    max_a = mid_a
  else:
    min_a = mid_a
print(max_a)

Measured memory_bytes: 7508
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
      
      //入力
      int X =sc.nextInt();//動物の総数
      int Y =sc.nextInt();//足の総数
      
      //鶴と亀がそれぞれ何匹いるか(鶴基準)
      //組み合わせできるか
      for(int i =0; i<=X; i++){
      	
        if(((2*i)+4*(X-i))==Y){
          
        	System.out.println("Yes");
         	 return;
        }
      }
        	System.out.println("No");
    }
}  
    

Measured memory_bytes: 35788
#include <iostream>
using namespace std;
int main(void){
  int n;
  cin >> n;
  
  int ans = 0;
  if(n == 1||n == 2||n == 4)
    ans = 1;
  
  int p = 0;
  
  while(1){
    if(n % 2 == 0){
      n = n / 2;
      p++;
    }
    else{
      n = n * 3 + 1;
      p++;
    }
    if(n == 4)
      break;
  }
  
  if(ans)
    cout << 4 << endl;
  else
   cout << p+4 << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int W, H, x, y, r, i;
  scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
  i = 0;
  if ( x < r ) i++ ;
  if ( y < r ) i++ ;
  if ( x + r > W ) i++ ;
  if ( y + r > H ) i++ ;
  if( i==0 )  printf ("Yes\n");
  else printf ("No\n");
  return 0;
}



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

void fnOutput(const vector<int> &argviSort, int argiSortCnt)
{
  for (int i = 0; i < argviSort.size(); i++)
  {
    if (i) cout << " ";
    cout << argviSort[i];
  }
  cout << endl;
  cout << argiSortCnt << endl;
}

void fnBubbleSort(vector<int> &argviSort, int &argiSortCnt)
{
  int ixToBeSorted = 0;
  bool bSorting = true;

  while (bSorting == true)
  {
    bSorting = false;
    for (int i = argviSort.size() - 1; i > ixToBeSorted; i--)
    {
      if (argviSort[i] < argviSort[i - 1])
      {
        bSorting = true;
        swap(argviSort[i], argviSort[i - 1]);
        argiSortCnt++;
      }
    }
    ixToBeSorted++;
  }
}

int main()
{
  int iSortCnt = 0;
  vector<int> viSort;
  int iMaxSize;
  
  cin >> iMaxSize;
  for (int i = 0; i < iMaxSize; i++)
  {
    int iNum;
    cin >> iNum;
    viSort.push_back(iNum);
  }

  fnBubbleSort(viSort, iSortCnt);
  fnOutput(viSort, iSortCnt);

  return 0;
}

Measured memory_bytes: 1220
#include<iostream>
using namespace std;
typedef long long LL;

int k[100001][2];
int main() {
	int n;
	cin >> n;
	for (int i = 0;i < n;i++)cin >> k[i][0] >> k[i][1];

	LL ans = 0;
	for (int i = n - 1;i > -1;i--) {
		LL a = k[i][0] + ans;
		LL b=( k[i][1] - (a%k[i][1]));
		if (b != k[i][1])ans += b;
	}
	cout << ans << endl;
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
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 ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int h, w, a[505][505];
vector<pair<int,int>> l, r;

signed main() {
	cin >> h >> w;
	rep(i,h) rep(j,w) {
		cin >> a[i][j];
		a[i][j] %= 2;
	}
	rep(i,w) rep(j,h-1) if (a[j][i]) {
		(a[j+1][i] += a[j][i]) %= 2;
		l.push_back({j+1,i+1}), r.push_back({j+2,i+1});
	}
	rep(i,w-1) if (a[h-1][i]) {
		(a[h-1][i+1] += a[h-1][i]) %= 2;
		l.push_back({h,i+1}), r.push_back({h,i+2});
	}
	cout << l.size() << endl;
	rep(i,l.size()) cout << l[i].fi << ' ' << l[i].se << ' ' << r[i].fi << ' ' << r[i].se << endl;
}


Measured memory_bytes: 5228
e1,e2,e3,e4=map(int,input().split())
if (e1==e2 and e3==e4):
    print('yes')
elif (e1==e3 and e2==e4):
    print('yes')
elif (e1==e4 and e2==e3):
    print('yes')
else:
    print('no')


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,i,j,k,a,jm,km;
  long long int P,Q,R,S,Pm,Qm,Rm,Sm,DPQ,DRS,ans,dif;
  
  ans = 200000000000000;
  cin >> N; 
  vector<long long int> F(N+1);
  F.at(0)=0;
  for(i=0;i<N;i++){
    cin >> a;
    F.at(i+1) = F.at(i)+a;
  }
  jm = 1;
  km = 3;
  for(i=2;i<N-1;i++){
    DPQ = 200000000000000;
    DRS = 200000000000000;
    for(j=jm;j<i;j++){
      P = F.at(j) - F.at(0);
      Q = F.at(i) - F.at(j);
      if(abs(P-Q)<DPQ){
        DPQ = abs(P-Q);
        jm = j;
        Pm = P;
        Qm = Q;
      }
      if(P>Q) break;
    }
    for(k=km;k<N;k++){
      R = F.at(k) -F.at(i);
      S = F.at(N) - F.at(k);
      if(abs(R-S)<DRS){
        DRS = abs(R-S);
        km = k;
        Rm = R;
        Sm = S;
      }
      if(R>S) break;
    }
    dif = max(max(Pm,Qm),max(Rm,Sm))-min(min(Pm,Qm),min(Rm,Sm));
    if(dif < ans) ans = dif;
  }
  cout << ans << endl;      
  return 0;
}

Measured memory_bytes: 1920
def my_pow(base, n, mod):
    if n == 0:
        return 1
    x = base
    y = 1
    while n > 1:
        if n % 2 == 0:
            x *= x
            n //= 2
        else:
            y *= x
            n -= 1
        x %= mod
        y %= mod
    return x * y % mod

N = int(input())
D = list(map(int, input().split()))
dmax = max(D)
MOD = 998244353
cnt = [0] * (10 ** 5 + 1)
for d in D:
    cnt[d] += 1

if D[0] or cnt[0] != 1:
    print(0)
    exit()
ans = cnt[0]
for i in range(1, dmax + 1):
    now = my_pow(cnt[i - 1], cnt[i], MOD)
    ans *= now
    ans %= MOD
print(ans)

Measured memory_bytes: 20848
a = list(map(int,input().split()))
if a[0] > a[1]:
    a[0], a[1] = a[1], a[0]
if a[1] > a[2]:
    a[1], a[2] = a[2], a[1]
if a[0] > a[1]:
    a[0], a[1] = a[1], a[0]
print(*a)


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mode        998244353
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.14159265358979323

ll dp[3003][3003];

void solve()
{
       ll n;
       cin>>n;
       vector<ll>a(n);
       rep(i,0,n) cin>>a[i];
       for(ll l=n-1; l>=0; l--){
              for(ll r=l; r<n; r++){
                     if(l==r) dp[l][r] = a[l];
                     else{
                            dp[l][r] = max(a[l] - dp[l+1][r], a[r] -dp[l][r-1]);
                     }
              }
       }
       cout<<dp[0][n-1]<<endl;
}



int main() {
	ll T = 1;
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


Measured memory_bytes: 70016
using System;
using System.Collections;
using System.Linq;
class Pogram{
    static void Main(){
        string[] s = Console.ReadLine().Split(' ');
        int n, m;
        n = int.Parse(s[0]);
        m = int.Parse(s[1]);
        int[] ans = new int[n];
        for (int i = 0; i < m; i++){
            s = Console.ReadLine().Split(' ');
            int a, b;
            a = int.Parse(s[0]) - 1;
            b = int.Parse(s[1]) - 1;
            ans[a]++;
            ans[b]++;
        }
        for (int i = 0; i < n; i++)
            Console.WriteLine(ans[i]);
    }
}

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

int gcd(int a, int b);
unsigned int lcm(int a, int b);

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

	int a=num[0];
	for(int i=1; i<n; i++){
		a = lcm(a, num[i]);
	}
	cout << a << endl;
	return 0;
}

int gcd(int a, int b){
	int d, e, f;

	if(a>=b){ d=a; e=b; }
	else { d=b; e=a; }
	f=e;
	while(1){
		if(d%f==0) return f;
		f=d % e;
		d=e;
		e=f;
	}
}

unsigned int lcm(int a, int b){
	int c=gcd(a,b);
	unsigned int d;
	d=a;
	d /= c;
	d *= b;
	return d;
}

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

int main(){
  const int Amax= 1e9;
  int N,K,S;
  cin >> N >> K >> S;

  if(S < Amax){
    for(int i=0; i<K; i++){
      cout << S <<" ";
    }
    for(int i=K; i<N; i++){
      cout << Amax <<" ";
    }
  }
  else{
    for(int i=0; i<K; i++){
      cout << S <<" ";
    }
    for(int i=K; i<N; i++){
      cout << 1 <<" ";
    }
  }
}

Measured memory_bytes: 1280
r, c = map(int, input().split())

rc = []
for i in range(r):
  cs=[int(num) for num in input().split()]
  cs.append(sum(cs))
  rc.append(cs)

lrc = []
for i in range(c):
  score = 0
  for j in range(r):
    score += rc[j][i]
  lrc.append(score)
lrc.append(sum(lrc))  
rc.append(lrc)

for i in range(r+1):
  for j in range(c+1):
    if j == c:
      print(str(rc[i][j]))
    else :
      print(str(rc[i][j]) + " ", end="")
    


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

int main() {
	int i,j,k,d[5],f[3];
	while (cin >> d[0]) {
		f[0]=f[1]=f[2]=k=0;
		if (d[0]==0) break;
		f[d[0]-1]=1;
		for (i=1;i<5;i++) { cin >> d[i]; f[d[i]-1]=1;}
		for (i=0;i<3;i++) if (f[i]==1 && f[(i+1) % 3]==1) break;
		if  ((f[0]==1 && f[1]==1 && f[2]==1) || i==3) k=3;
		for (j=0;j<5;j++) {
			if (k!=3) { if (d[j]==i+1) k=1; else k=2;}
			cout << k << endl;
		}
	} 
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    int N, x;
    cin >> N >> x;
    if (x == 1 || x == 2*N-1) cout << "No" << endl;
    else {
        vector<int> p(2*N,0), c(2*N,0);
        if (min((2*N-1)-x+1, x) == x) {
            for (int i = 1; i<=2*x-1; i++) {
                p[N-(x-i)] = i;
                c[i] = 1;
            }
        } else {
            for (int i = 2*N-1; i>=2*x-(2*N-1); i--) {
                p[N-(x-i)] = i;
                c[i] = 1;
            }
        }
        auto itrc = c.begin()+1;
        while (*itrc != 0) itrc++;
        for (auto itr = p.begin()+1; itr != p.end(); itr++) {
            if (*itr != 0) continue;
            else {
                *itr = distance(c.begin(), itrc);
                *itrc = 1;
                while (*itrc != 0) itrc++;
            }
        }
        cout << "Yes" << endl;
        for (auto itr = p.begin()+1; itr != p.end(); itr++) {
            cout << *itr << endl;
        }
    }

    return 0;
}

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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using ull = unsigned long long;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
//constexpr int INF = 1001001001;
constexpr ll INF = 1001001001001001001ll;
constexpr double EPS = 1e-10;
using number = long long;


int main() {
    int n; cin >> n;
    for (int i = 1; i < 10; i++) {
        if (n <= 111 * i) {
            cout << 111 * i << endl;
            break;
        }
    }
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll X,Y;
int ret;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>X>>Y;
	ret=0;
	while(X<=Y) {
		ret++;
		X<<=1;
	}
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 768