akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll   long long int
#define T int t; cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define PI 3.141592653589793238462643383

ll hashing(ll x,ll y){
    return (x*1000000 + y);
}

int main(){
   
    fast;
    
    int h,w,m;
    cin>>h>>w>>m;
    
    int r[h+1] = {0},c[w+1] = {0};
    int x,y;
    int rmax = 0,cmax = 0;
    vector<int> xmax,ymax;
    unordered_map<ll,int> vis;

    for(int i=0;i<m;i++){
        cin>>x>>y;
        vis[hashing(x,y)] = 1;
        r[x]++; c[y]++;
    }

    for(int i=1;i<=h;i++){
        rmax = max(rmax,r[i]);
    }
    for(int i=1;i<=w;i++){
        cmax = max(cmax,c[i]);
    }

    
    for(int i=1;i<=h;i++){
        if(r[i] == rmax) xmax.push_back(i);
    }

    for(int i=1;i<=w;i++){
        if(c[i] == cmax) ymax.push_back(i);
    }

    ll ans = rmax + cmax - 1;
    ll temp = 0;
    bool flag = false;
    for(int i=0;i<xmax.size();i++){
        for(int j=0;j<ymax.size();j++){
            temp = r[xmax[i]] + c[ymax[j]];
            if(vis[hashing(xmax[i],ymax[j])] == 1) temp--;
           // cout<<temp<<endl;
            if(temp == ans+1){
                ans++;
                flag = true;
                break;
            }
        }
        if(flag) break;
    }
    std::cout<<ans<<endl;





}

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

int main() {
  int n;
  cin >> n;
  
  vector<int> p(n);
  for(int i = 0; i < n; i++){
    cin >> p.at(i);
    if(p.at(i) == i + 1) p.at(i) = 1;
    else p.at(i) = 0;
  }
  
  int count = 0, ans = 0;
  for(int i = 0; i < n; i++){
    if(p.at(i) == 1) count++;
    else{
      ans += (count + 1) / 2;
      count = 0;
    }
  }
  ans += (count + 1) / 2;
  
  cout << ans << endl;
}

Measured memory_bytes: 640
h,w,k = map(int,input().split())
cake = [input() for _ in range(h)]
ans = [[0]*w for _ in range(h)]

start = 0
for i in range(h):
    if list(cake[i]).count("#") == 0:
        start += 1
    else:
        break

num_c = 1
num_s = 0
st = list(cake[i]).count("#")
for i in range(w):
    ans[start][i] = num_c
    if cake[start][i] == "#":
        num_s += 1
        if num_s == st:
            for j in range(i+1,w):
                ans[start][j] = num_c
            break
        else:
            num_c += 1

for i in range(start):
    ans[i] = ans[start]

for i in range(start+1,h):
    if list(cake[i]).count("#") >= 1:
        num_c += 1
        num_s = 0
        st = list(cake[i]).count("#")
        for j in range(w):
            ans[i][j] = num_c
            if cake[i][j] == "#":
                num_s += 1
                if num_s == st:
                    for k in range(j+1,w):
                        ans[i][k] = num_c
                    break
                else:
                    num_c += 1
    else:
        ans[i] = ans[i-1]
    


for i in ans:
    print(" ".join(map(str,i)))


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

int main() {
  int n;
  int a[210];
  cin >> n;
  rep(i,n){
    cin>>a[i];
  }
  
  int sum = 0;
  
  while(true){
    bool ok = false;
    rep(i,n){
      if(a[i]%2 != 0){
        ok = true;
      }
    }
    if (ok){
      break;
    }
    rep(i,n){
      a[i]/=2;
    }
    sum++;
  }
  cout << sum << endl;
}

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

using namespace std;

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

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

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


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


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

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

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


int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };



//===========================DEBUG======================//
#define XOX 1
vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

//================================================================//



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


int main(){
    #ifndef ONLINE_JUDGE
    // freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
    fast

    ll r;
    cin>>r;
    cout<<fixed<<setprecision(2)<<2*3.1415*r<<endl;
    
}


/*



*/





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


namespace PriRect
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = new string[2];
            //for(int i = 0; i < str.Length; i++){
            while (true)
            {
                str = Console.ReadLine().Split(' ');
                int height = int.Parse(str[0]);
                int weight = int.Parse(str[1]);
                if ((height == 0) && (weight == 0))
                {
                    break;
                }
                for (int i = 0; i < height; i++)
                {
                    for (int k = 0; k < weight; k++)
                    {
                        if (((i % 2 == 0) && (k % 2 == 0) || (i % 2 == 1) && (k % 2 == 1)))
                        {
                         Console.Write("#");
                        }
                        else
                        {
                            Console.Write(".");
                        }
                     } Console.WriteLine("");
                } Console.WriteLine("");
            }
        }
    }
}

Measured memory_bytes: 5292
/*input
-13 3
*/
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pii pair<int,int>
#define pb push_back
#define f first
#define s second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

signed main() {
	IOS;
	int a,b;
	cin>>a>>b;
	cout << max(max(a + b, a - b) , a * b);
return 0;
}


Measured memory_bytes: 256
import sys
from math import sqrt
from collections import Counter, defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7

ma = 0


def main():
    n, m, q = MI()
    li = [LI() for _ in range(q)]

    m = m + 1
    l = [0] * n

    def f(x, now):
        global ma

        if now == n:
            s = 0
            for abcd in li:
                if l[abcd[1] - 1] - l[abcd[0] - 1] == abcd[2]:
                    s += abcd[3]
            if ma < s:
                ma = s

            return

        for i in range(x, m):
            l[now] = i
            f(i, now + 1)

    f(1, 0)

    print(ma)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9496
N = int(input())
S = str(input())

length_S = len(S)

alpha = [chr(i) for i in range(ord('A'), ord('Z')+1)]

X = ''

for i in range(length_S):
    s = S[i]
    index_alpha = alpha.index(s)

    if index_alpha + N >= 26:
        num = index_alpha + N - 26
        new_s = alpha[num]
    else:
        num = index_alpha + N
        new_s = alpha[num]

    X = X + new_s

print(X)


Measured memory_bytes: 3064
from math import floor, ceil


def solve():
    h, w = map(int, input().split())

    h1 = float(h/2)
    w1 = float(w/2)

    if(h == 1 or w == 1):
        print(1)
        exit()

    if (h % 2 and w % 2 is 0) or (h % 2 and w % 2 is not 0):
        tot = ceil(h1) * ceil(w1) + floor(h1) * floor(w1)
    else:
        if h % 2 is 0:
            tot = h1 * w
        elif w % 2 is 0:
            tot = w1 * h

    print(int(tot))


if __name__ == "__main__":
    solve()


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	static Main instance = new Main();

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int L = scan.nextInt();
		int R = scan.nextInt();
		int d = scan.nextInt();

		//WK変数
		int result = R / d - (L - 1) / d;

		//演算



		//結果出力
		System.out.println(result);
	}
}

Measured memory_bytes: 35636
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AizuOnline
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var n = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
            var N = n[0];
            var W = n[1];

            var p = new int[N, 2];
            foreach (var x in Enumerable.Range(0, N))
            {
                var t = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
                p[x, 0] = t[0];
                p[x, 1] = t[1];
            }
            var dp = new int[N + 1, W + 1];

            for (int i = 0; i <= N; i++)
            {
                for (int j = 0; j <= W; j++)
                {
                    dp[i, j] = int.MinValue;
                }
            }
            dp[0, 0] = 0;
            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    if (dp[i, j] != int.MinValue)
                    {
                        //not selected
                        dp[i + 1, j] = Math.Max(dp[i, j], dp[i + 1, j]);

                        //select
                        if (j + p[i, 1] <= W)
                        {
                            dp[i + 1, j + p[i, 1]] = Math.Max(dp[i, j] + p[i, 0], dp[i, j + p[i, 1]]);
                        }
                    }
                }
            }
            var max = int.MinValue;
            for (int j = 0; j <= W; j++)
            {
                max = Math.Max(dp[N, j], max);
            }
            Console.WriteLine(max);
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 13568
(function() {
    'use strict';

    var lines = [];
    require('readline').createInterface({
      input: process.stdin,
      output: process.stdout
    }).on('line', function(line) {
      lines.push(line);
    });
    process.stdin.on('end', function() {
      //lines.forEach(function(line) {
        //var tokens = line.split(' ').map(Number);
        //    console.log(tokens[0] + ' ' + tokens[1]);
      //}
      //)
      ;

    // ToDo start
      var N = parseInt(lines[0].split(" "))
      var F = []
      var P = []
      for (var i=1 ; i<= N ;i++){
          F[i] = lines[i].split(" ")
      }
      for (var i=1 ; i<= N ;i++){
          P[i] = (lines[i+N]).split(" ")
      }

      var maxuriage = -9999999999999;
    for (i=1;i<Math.pow(2,10);i++ ){
        var plan = dump_int(i)
        var uriage = 0
        for ( var t=1;t<N+1;t++){
          uriage += parseInt(P[t][matchNum(plan,F[t])])
        }
        if ( uriage > maxuriage ){
            maxuriage = uriage ;
//            console.log("plan:" + plan)
//            console.log("uriage:" + maxuriage)
            
        }
    }      

    console.log(maxuriage);
//      console.log( Math.pow(parseInt(lines[0]),2) - parseInt(lines[1])  )
    // ToDo end

    });


})();

function dump_int(i){var s="";while(i){s=(i&1)+s;i>>>=1}return ('0000000000'+s).slice(-10)}

function matchNum(a,b){
    var tlen = 10
    var mnum = 0;
    
    for (var i=0;i<tlen;i++){
        if ( a[i]== b[i] && a[i] =="1" ){
            mnum++;
        }
    }
    return mnum;
}

Measured memory_bytes: 21800
#include <bits/stdc++.h>
#define N 101
#define M 51
using namespace std;
int n,m,l;
double p[N],t[N],d[N];
vector<double> A[N],B[N];

double mem[M][M];
double nCr(int n, int r){
  if(mem[n][r]!=0)return mem[n][r];
  if(r==0||n==r)return 1;
  double a=1;
  for(int i=0;i<r;i++) a*=(n-i)/(i+1.0);
  return mem[n][r]=a;
}

double DP(){
  double dp[N][M]={};
  for(int i=0;i<=m;i++)dp[0][i]=A[0][m-i]*B[0][i]*nCr(m,i);
  
  for(int i=1;i<n;i++)
    for(int j=0;j<=m;j++)
      for(int k=0;k<=m;k++)
	if(d[0]+j*t[0]<d[i]+k*t[i]) 
	  dp[i][j]+=dp[i-1][j]*A[i][m-k]*B[i][k]*nCr(m,k);

  double res=0;
  for(int i=0;i<=m;i++)res+=dp[n-1][i];
  return res;
}

int main(){
  cin>>n>>m>>l;
  for(int i=0;i<n;i++){
    cin>>p[i]>>t[i]>>d[i];
    p[i]/=100;
    d[i]=l/d[i];
    
    A[i].resize(m+1),B[i].resize(m+1);
    A[i][0]=B[i][0]=1;
    for(int j=1;j<=m;j++){
      A[i][j]=A[i][j-1]*(1-p[i]);
      B[i][j]=B[i][j-1]*p[i];
    }
  }
  
  for(int i=0;i<n;i++){
      printf("%.10f\n",DP());
      swap(p[0],p[i+1]);
      swap(t[0],t[i+1]);
      swap(d[0],d[i+1]);    
      swap(A[0],A[i+1]);    
      swap(B[0],B[i+1]);    
  }
  return 0;
}

Measured memory_bytes: 3380
#include <bits/stdc++.h>
#define ref(i, n) for (int i = 0; i < n; i++)
using namespace std;

int main()
{
    int X, A;
    cin >> X >> A;

    if (X < A)
        cout << 0 << endl;
    else if (X >= A)
        cout << 10 << endl;

    return 0;
}

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

int bigmod(int a,int b,int M)
{
    if(b==0)
        return 1%M;
    int x=bigmod(a,b/2,M);
    x=(x*x)%M;
    if(b%2==1)
        x=(x*a)%M;
    return x;
}

int main()
{
    string s,t;
    cin>>s>>t;
    int a=s.size();
    int ar[27],ar1[27];
    for(int i=0;i<27;i++)
    {
        ar[i]=0;
        ar1[i]=0;
    }
    for(int i=0;i<a;i++)
    {
        ar[s.at(i)-'a']++;
        ar1[t.at(i)-'a']++;
    }
//    for(int i=0;i<27;i++)
//        cout<<ar[i]<<" "<<ar1[i]<<endl;
    sort(ar,ar+27);
    sort(ar1,ar1+27);
    int count=0;
    for(int i=26;i>=0;i--)
    {
//        if(ar[i]!=0&&ar1[i]!=0)
//            cout<<ar[i]<<" "<<ar1[i]<<endl;
        if(ar[i]==ar1[i])
            continue;
        else
        {
            cout<<"No"<<endl;
            count=1;
            break;
        }
    }
    if(count==0)
        cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 776
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
			final String str = reader.readLine();

			final String sp[] = str.split(" ");
			int A = Integer.parseInt(sp[0]);
			int B = Integer.parseInt(sp[1]);
			String result;
			if (8 < A || 8 < B) {
				result = ":(";
			} else {
				result = "Yay!";
			}
			System.out.println(result);
		}
	}
}

Measured memory_bytes: 21204
#N,Tの取得
l = list(map(int, input().split()))
N = l[0]
T = l[1]

#秒のリストを取得
tl = list(map(int, input().split()))

sw = 0 #スイッチオンオフの管理
bt = 0 #直前のスイッチを押した時間
gt = 0 #秒数総和
for i, t in enumerate(tl):
    if sw == 1 and t - bt > T:
        sw = 0 #全快スイッチを押してからT秒経過していたら、スイッチオフ
    if sw == 0:
        gt += T #スイッチオフの時はT秒追加
    else:
        gt += t - bt  #スイッチがオンのとき、前回からの経過時間を加算
    bt = t
    sw = 1 #スイッチオン。
        

print(str(gt))

Measured memory_bytes: 25200
def selection_sort(A):
    count = 0
    for i in range(len(A)):
        min_j = i
        for j in range(i, len(A)):
            if A[j] < A[min_j]:
                min_j = j
        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            count += 1
    return A, count

if __name__ == '__main__':
    n = int(input())
    array, count = selection_sort(list(map(int, input().split())))
    print(' '.join(map(str, array)))
    print(count)

Measured memory_bytes: 6724
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,K,m,f;cin>>A>>B>>C>>K;
  m=max({A,B,C});f=m;
  for(int i=0;i<K;i++)f*=2;
  cout<<A+B+C-m+f<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>(b);i--)
#define pb push_back

typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int nl = 1001;

ll dp[nl][nl];
ll fac[nl], inv_fac[nl];
int N, A, B, C, D;

ll inv(int n, int m){
  int _n = n % m;
  int _m = m;
  int div, mod;
  int l[2] = {1, 0};
  int r[2] = {0, 1};
  int _[2];
  ll ret;
  bool b = true;
  while (_n > 1){
    b = ! b;
    div = _m / _n;
    mod = _m % _n;
    if ( mod < 0){
      div -= 1;
      mod += _n;
    }
    _m = _n;
    _n = mod;
    l[0] += div*r[0];
    l[1] += div*r[1];
    _[0] = r[0];
    _[1] = r[1];
    r[0] = l[0];
    r[1] = l[1];
    l[0] = _[0];
    l[1] = _[1];
  }
  ret = r[1];
  if(!b)ret *= -1;
  ret %= m;
  if(ret < 0)ret += m;
  return ret;
}
void set_fac(){
  fac[0] = 1;
  inv_fac[0] = 1;
  FOR(i, 1, nl){
    fac[i] = fac[i - 1] * i % MOD;
    inv_fac[i] = inv_fac[i - 1] * inv(i, MOD) % MOD;
  }
  return;
}
ll powMod(int a, int n, int m){
  ll pro = 1, tmp = a;
  for(; n > 0; n >>= 1){
    if(n & 1) pro = (pro * tmp) % m;
    tmp = tmp * tmp % m;
  }
  return pro;
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int _j;

  cin >> N >> A >> B >> C >> D;
  set_fac();
  FOR(i, 0, nl){
    FOR(j, 0, nl){
      dp[i][j] = 0;
    }
  }
  FOR(i, 0, B + 1){
    dp[i][0] = 1;
  }
  FOR(i, A, B+1){
    FOR(j, 0, N + 1){
      dp[i][j] = dp[i - 1][j];
      FOR(k, C, D + 1){
        _j = j - k * i;
        if(_j < 0)break;
        dp[i][j] += dp[i - 1][_j] * fac[j] % MOD * inv_fac[_j] % MOD * powMod(inv_fac[i], k, MOD) % MOD * inv_fac[k];
        dp[i][j] %= MOD;
      }
    }
  }
  cout << dp[B][N] << endl;
  return 0;
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
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);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}


template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};




int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3, greater<int>());
    cout << a[0]*10+a[1]+a[2] << endl;





    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

void chenge(double a[100000][3],int i,int j){
    double n;
    n = a[i][0]; a[i][0]=a[j][0]; a[j][0]=n;
    n = a[i][1]; a[i][1]=a[j][1]; a[j][1]=n;
    n = a[i][2]; a[i][2]=a[j][2]; a[j][2]=n;
}

int pertition(double a[100000][3],int left,int right){
    int i,j,k;
    k=left-1;
    for(i=left;i<right-1;i++){
        if(a[i][2]>=a[right-1][2]){
            k++;
            chenge(a,i,k);
        }
    }
    chenge(a,k+1,right-1);
    return k+1;
}

void quicksort(double a[100000][3],int left,int right){
    int mid;
    if(left+1<right){
        mid = pertition(a,left,right);
        quicksort(a,left,mid);
        quicksort(a,mid+1,right);
    }
}

int main(void){
    int n,w,i;
    double a[100000][3];
    double k;
    scanf("%d %d",&n,&w);
    for(i=0;i<n;i++){
        scanf("%lf %lf",&a[i][0],&a[i][1]);
        a[i][2]=a[i][0]/a[i][1];
    }
    quicksort(a,0,n);
    k=0;i=0;
    while(w>0&&i<n){
        if(a[i][1]>w){
            k+=a[i][2]*w;
            w=0;
        }else{
            k+=a[i][0];
            w-=a[i][1];
        }
        i++;
    }
    printf("%.9f\n",k);
}


Measured memory_bytes: 4040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define all(v) v.begin(),v.end()
#define PI acos(-1)
#define EPS 1e-15



int main() {
	int n;
	cin >> n;
	int mn = 100;
	for(int i = 0; i < n; i++){
		ll x;
		cin >> x;
		int c = 0;
		while(x % 2 == 0)
			c++, x /= 2;
		mn = min(c, mn);
	}

	cout << mn << endl;
	return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn = 200100;
typedef __int128 ll;
const ll oo = ((ll)1 << 100);
void out(ll x)
{
	if(x > 9)
		out(x / 10);
	cout << (int)(x % 10);
}
void in(ll &x)
{
	string s;
	cin >> s;
	x = 0;
	for(int i = 0; i < s.size(); i ++)
		x = x * 10 + s[i] - '0';
}
ll x[maxn] = {0}, h[maxn] = {0};
ll m;
int n;
ll ans = oo;
void work(int k)
{
	ll sum = (n + k) * m + (h[n] - h[n - k]) * 2;
	//cout << sum << endl;
	ll j = 0;
	int i;
	for(i = n - k + 1; i >= 1; i -= k)
	{
		j ++;
		sum += (h[i + k - 1] - h[i - 1]) * (j + j + 1);
		//cout << i << " " << i + k - 1 << " " << j << " " << sum << endl;
		//cout << h[i + k - 1] << " " << h[i - 1] << endl;
	}
	j ++;
	i += k - 1;
	sum += h[i] * (j + j + 1);
	ans = min(ans, sum);
}
int main()
{
	std::ios::sync_with_stdio(false);
	cin >> n;
	in(m);
	for(int i = 1; i <= n; i ++)
	{
		//cin >> x[i];
		in(x[i]);
		h[i] = h[i - 1] + x[i];
	}
	//work(1);
	
	for(int k = 1; k <= n; k ++)
		work(k);
	out(ans);
	cout << endl;	
	return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define int long long
#define rep(i, l, r) for(register int i = l;i <= r; ++ i)
int MAXN = 100010;
inline int read()
{
	register char cc = getchar(); register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - 48; cc = getchar();}
	return cn * flus;
}
signed main()
{
	int x = read();
	for(register int i = -1000; ; ++ i)
	{
		for(register int j = -1000; j <= 1000; ++ j)
		{
			//printf("i = %d j = %d \n",i,j);
			if(i * i * i * i * i - j * j * j * j * j == x)
			{
				printf("%lld %lld \n",i,j);
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
using ll = long long;

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x(x % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) {
      x -= mod;
    }
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) {
      x -= mod;
    }
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) {
      return 1;
    }
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) {
      a *= *this;
    }
    return a;
  }

  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) { return mint(*this) /= a; }
};

istream& operator>>(istream& is, mint& a) {
  return is >> a.x;
}
ostream& operator<<(ostream& os, const mint& a) {
  return os << a.x;
}

struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    fact[0] = 1;
    for (int i = 1; i < n; i++) {
      fact[i] = fact[i - 1] * i;
    }
    ifact[n] = fact[n].inv();
    for (int i = n; 1 <= i; i--) {
      ifact[i - 1] = ifact[i] * i;
    }
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) {
      return 0;
    }
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

int main() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  mint ans = 1;
  rep(i, n) ans *= 10;
  mint tmp = 1;
  rep(i, n) tmp *= 9;
  ans -= tmp;
  ans -= tmp;
  tmp = 1;
  rep(i, n) tmp *= 8;
  ans += tmp;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("03")
#pragma GCC optimize ("unroll-loops")
#define ll long long
#define ms(a,b) memset(a,b,sizeof(a))
#define endl '\n'
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define mpp(a,b,c) make_pair(a,make_pair(b,c))
#define fi first
#define se second
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define repp(a,b,c) for(int a=b;a>=c;a--)
ll arra[100100],arrb[100100],arrc[100100];
ll memo[100100][3]={0};
ll n,res;

ll dp(ll idx,ll before){
	if(idx>n)return 0;
	else if(memo[idx][before])return memo[idx][before];
	else if(before==1){
		ll temp;
		temp = max( dp(idx+1,2)+arrb[idx], dp(idx+1,3)+arrc[idx] );
		return memo[idx][before] = temp;
	}else if(before==2){
		ll temp;
		temp = max( dp(idx+1,1)+arra[idx], dp(idx+1,3)+arrc[idx] );
		return memo[idx][before] = temp;		
	}else if(before==3){
		ll temp;
		temp = max( dp(idx+1,1)+arra[idx], dp(idx+1,2)+arrb[idx] );
		return memo[idx][before] = temp;		
	}else if(before==0){
		ll temp;
		temp = max( dp(idx+1,1)+arra[idx], dp(idx+1,2)+arrb[idx]);
		temp = max( temp,dp(idx+1,3)+arrc[idx]);
		return memo[idx][before] = temp;
	}
}

int main(){
/////////////////////////////////////////////
//	ios_base::sync_with_stdio(0);
//	cin.tie(0); cout.tie(0);
/////////////////////////////////////////////
	cin >> n;
	rep(i,1,n){
		cin >> arra[i] >> arrb[i] >> arrc[i];
	}
	res = dp(1,0);
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 9600
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;

#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define repd(i, n) for (ll i = n - 1; i >= 0; i--)
#define all(x) x.begin(), x.end()

ll n, k, m, M = 1e9 + 7;

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

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

    int a, b;
    cin >> a >> b;

    int num = 0, sum = 1;
    while(sum < b) {
        sum += a - 1;
        num++;
    }

    cout << num << endl;
}

Measured memory_bytes: 3644
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}

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

signed main(void)
{
  string s;
  cin >> s;
  s[3] = '8';
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())

lst = [0]*26

for _ in range(H):
  s = input()
  for c in s:
    lst[ord(c)-ord('a')] += 1
  
cnt1 = 0
cnt2 = 0
for i in lst:
  if i%2 != 0:
    cnt1 += 1
  elif i%4 != 0:
    cnt2 += 1
    
if cnt1 > 1:
  print('No')
  exit()
  
if H%2 == 0 and W%2 == 0:
  if cnt1 > 0 or cnt2 > 0:
    print('No')
  else:
    print('Yes')
elif H%2 == 1 and W%2 == 0:
  if cnt1 > 0 or cnt2 > W//2:
    print('No')
  else:
    print('Yes')
elif H%2 == 0 and W%2 == 1:
  if cnt1 > 0 or cnt2 > H//2:
    print('No')
  else:
    print('Yes')
else:
  if cnt2 > (H//2 + W//2):
    print('No')
  else:
    print('Yes')

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

int main(){

    string N;

    cin>>N;

    long long cnt=0;

    for(int i=0;i<N.length();i++){
        cnt+=(N[i]-'0');    
    }

    if(cnt%9==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;

}

Measured memory_bytes: 3724
#include<stdio.h>
#include<stdlib.h>

int main()
{
  int i, j, minj, N, *A, temp, count=0;

  scanf("%d", &N);

  A = malloc( N * sizeof(int));

  for( i=0; i<N; i++ ) scanf("%d", &A[i]);
    
  for( i=0; i<N; i++ )
    {
      minj = i;

      for( j=i; j<N; j++ )
	{
	  if( A[j] < A[minj] ) minj = j;
	}

      if( minj != i)
	{
	  temp = A[i];
	  A[i] = A[minj];
	  A[minj] = temp;
	  count++;
	}
    }

  for( i=0; i<N; i++ )
    {
      printf("%d", A[i]);
      if( i == N-1 )
	{
	  printf("\n");
	  break;
	}
      printf(" ");
    }

  printf("%d\n", count);

  free( A );

  return 0;
}

  



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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

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

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

#define B 'B'
#define W 'W'

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    int N;
    string S;
    cin >>N>>S;

    vector<ll> dan(2*N);
    ll ans=1,hpl=1;
    if(S[0]=='W'){
        cout<<0<<endl;
        return 0;
    }
    dan[0]=1;

    bool isnb=true;
    repd(i,1,2*N){
        if(S[i-1]==S[i]){
            if(isnb){
                //down
                if(isnb)dan[i]=dan[i-1];
                else dan[i]=dan[i-1]-1;
                isnb=false;
                ans*=dan[i];ans%=mod;
            }else{
                //up
                if(isnb)dan[i]=dan[i-1]+1;
                else dan[i]=dan[i-1];
                isnb=true;
                hpl++;
            }
        }else{
            if(isnb){
                //up
                dan[i]=dan[i-1]+1;
                hpl++;
            }else{
                //down
                dan[i]=dan[i-1]-1;
                ans*=dan[i];ans%=mod;
            }
        }
    }

    if(dan[2*N-1]!=1 || isnb){
        cout<<0<<endl;
        return 0;
    }
    for(ll i=hpl;hpl>=2;hpl--) ans*=hpl,ans%=mod;


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

Measured memory_bytes: 2196
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <climits>
using Graph = vector<vector<int>>;
const double PI = 3.14159265358979323846;
#define int long long


signed main() {

	const int SIZE = 300;

	int D, T, S;
	cin >> D >> T >> S;

	string ans = "No";

	if (D <= T*S) {
		ans = "Yes";
	}
	
	cout << ans << endl;

	cin >> ans;

	return 0;


}



Measured memory_bytes: 3624
/*
    mdsaqib
*/

#include <bits/stdc++.h>
#define int long long
#define all(c) (c).begin(),(c).end()
#define endl '\n'
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
using namespace std;

signed main(){
    fast;
    int n,m,x;
    cin >> n >> m >> x;
    vector <vector<int>> A(n,vector<int> (m,0));
    vector <int> C(n,0);
    for(int i=0;i<n;i++){
        cin >> C[i];
        for(int j=0;j<m;j++){
            cin >> A[i][j];
        }
    }
    vector <int> S(m);
    for(int i=0;i<m;i++){
        int sum=0;
        for(int j=0;j<n;j++){
            sum+=A[j][i];
        }
        S[i]=sum;
    }
    for(int i=0;i<m;i++){
        if(S[i]<x){
            cout << "-1" << endl;
            return 0;
        }
    }
    int mn=1e9;
    for(int zz=1;zz<=(1<<n);zz++){
        bitset <16> I(zz);
        vector <int> SS(m,0);
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(I[i]==1){
                    SS[j]+=A[i][j];
                }
            }
        }
        bool b=true;
        for(int i=0;i<m;i++){
            if(SS[i]<x){
                b=false;
                break;
            }
        }
        if(b){
            int sum=0;
            for(int i=0;i<n;i++){
                if(I[i]==1){
                    sum+=C[i];
                }
            }
            mn=min(mn,sum);
        }
    }
    cout << mn;
}


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

using namespace std;

int main()
{
    int n;

    cin >> n;

    while(n!=0) {
        int m;
        int ans=0;
        string s;

        cin >> m;
        cin >> s;

        string ioi="I";

        for(int i=0; i<n; ++i) {
            ioi=ioi+'O'+'I';
        }

        for(int i=0; i+2*n+1<m; ++i) {
            if(s.substr(i,2*n+1)==ioi) ++ans;
        }


        cout << ans << endl;


        cin >> n;
    }

    return 0;
}

Measured memory_bytes: 3928
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define rn(i,n) for(int i=1;i<=n;i++)
#define ll long long
const ll mod=1e9+7;

int N,A,B,C;
vector<int> l;
int cnt=0,cnta=0,cntb=0,cntc=0;
int def(int cur,int a,int b,int c){
  if(cur==N){
    if(min(min(a,b),c)!=0){
      return abs(a-A)+abs(b-B)+abs(c-C)-30;
    }else{
      return 100000;
    }

  }
//  cnt++;
  int retn=def(cur+1,a,b,c);
  //cout<<"cnt "<<cnt<<" cur "<<cur<<" retn "<<retn<<endl;
  int reta=def(cur+1,a+l[cur],b,c)+10;
  //cnta++;
  //cout<<"cnta "<<cnta<<" cur "<<cur<<" reta "<<reta<<endl;
  int retb=def(cur+1,a,b+l[cur],c)+10;
  //cntb++;
  //cout<<"cntb "<<cntb<<" cur "<<cur<<" retb "<<retb<<endl;
  int retc=def(cur+1,a,b,c+l[cur])+10;
  //cntc++;
  //cout<<"cntc "<<cntc<<" cur "<<cur<<" retc "<<retc<<endl;
  return min(min(retn,reta),min(retb,retc));
}

int main(){
  cin>>N>>A>>B>>C;
  l.resize(N);
  r(i,N){
    cin>>l.at(i);
  }

  cout<<def(0,0,0,0)<<endl;

  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#include<bitset>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

bool isOK(int a[],int index,int key){
    if(a[index] >= key){
        return true;
    }else{
        return false;
    }
}

int binary_search(int a[],int n,int key){
    int left = -1;
    int right = n;

    while(right-left>1){
        int mid = left + (right - left)/2;
        if(isOK(a,mid,key)){
            right = mid;
        }else{
            left = mid;
        }
    }
    return right;
}



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

    int count = 0;

    rep(i,n-2){
        if(s[i]=='A' && s[i+1] == 'B' && s[i+2] == 'C'){
            count++;
        }
    }

    cout << count << endl;
    return 0;
}

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

using namespace std;

int main()
{
    long long int i, j, a, b, c, n;
    set<int> s;

    cin >> n;
    for(i=1; i<=n; i++)
    {
        cin >> a;

        if(s.count(a))
            s.erase(a);
        else
            s.insert(a);

    }
    cout << s.size();
}


Measured memory_bytes: 8144
#include<bits/stdc++.h>
using namespace std;
#define  ll long long int
main()
{
    ll a,b,c,d;
     cin>>a>>b>>c>>d;
     if((a+b)==(c+d))
        cout<<"Balanced"<<endl;
     else if((a+b)>(c+d))
        cout<<"Left"<<endl;
     else
        cout<<"Right"<<endl;
}


Measured memory_bytes: 3532
#include<stdio.h>
  #define N 100000
  int search(int A[],int n,int key){
    int left=0,right=n,mid;
    while (left<right){
      mid=(left+right)/2;
      if(A[mid]==key){
        return mid;
      }else if(key<A[mid]){
        right=mid;
      }else{
        left=mid+1;
      }
    }
    return 0;
  }
  int main(){
    int i,num,A[N+1],q,key,sum=0;
    scanf("%d",&num);
    for(i=0;i<num;i++){
      scanf("%d",&A[i]);
    }
    scanf("%d",&q);
    for(i=0;i<q;i++){
      scanf("%d",&key);
      if(search(A,num,key))sum++;
    }
    printf("%d\n",sum);
    return 0;
  }



Measured memory_bytes: 2148
let () =
  let w = read_line () in
  let rec loop count =
    let t' = read_line () in
    if t' = "END_OF_TEXT" then count
    else
      let t = String.lowercase t' in
      let w_len, t_len = String.length w, String.length t in
      let rec crawl w_i t_i count skip =
        if t_i < t_len then
          if w_i < w_len then
            if t.[t_i] = ' ' then crawl 0 (t_i+1) count false
            else if w.[w_i] = t.[t_i] && not skip then crawl (w_i+1) (t_i+1) count false
            else crawl 0 (t_i+1) count true
          else
            let count' = if t.[t_i] = ' ' then count + 1 else count in
            crawl 0 t_i count' true
        else if w_i = w_len then count + 1 else count
      in
      loop (crawl 0 0 count false)
  in
  print_int @@ loop 0;
  print_string "\n";
;;


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

int main()
{
    int n,c=0,i,k;
    cin>>n>>k;
    for(i=0;i<n;i++)
    {
      int x;
      cin>>x;
      if(x>=k)
        c++;
    }
  	cout<<c;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 5;
int n;
int a[N];
ll pw2[35];
map <int, int> mp;

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i], mp[a[i]]++;
    sort(a + 1, a + n + 1);
    pw2[0] = 1;
    for(int i = 1; i < 32; i++) pw2[i] = 2ll * pw2[i - 1];
    int ans = 0;
    for(int i = n; i >= 1; i--) {
        if(mp[a[i]]) {
            int p = lower_bound(pw2, pw2 + 32, a[i]) - pw2;
            if(a[i] == pw2[p]) ++p;
            --mp[a[i]];
            if(mp[pw2[p] - a[i]]) {
                --mp[pw2[p] - a[i]];
                ++ans;
            }
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 19840
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;



int main(){
  ios_base::sync_with_stdio(false);

  int x1, x2;
  int y1, y2;
  int xx, yy;

  cin >> x1 >> y1 >> x2 >> y2;

  xx = x1 - x2;
  yy = y1 - y2;
  
  //cout << xx << " " << yy << endl;
  
  xx *= -1; 
  
  x1 += yy;
  x2 += yy;
  y1 += xx;
  y2 += xx;
  
  //cout << xx << " " << yy << endl;
  
  cout << x2 << " " << y2 << " " << x1 << " " << y1 << endl;

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 505 
using namespace std;
int h,w,a[N][N],pos[N];
bool vis[N][N],is[N][N];
struct Node
{
	int a,b,c,d;
};
vector<Node> q;
int main()
{
    cin>>h>>w;
    for(int i=1;i<=h;i++)
	{
        for(int j=1;j<=w;j++) cin>>a[i][j];
        for(int j=1;j<w;j++)
		{
			if(a[i][j]&1)
			{
				a[i][j+1]++;
				q.push_back((Node){i,j,i,j+1});
			}
		}
    }
    for(int i=1;i<h;++i)
	{
		if(a[i][w]&1)
		{
			a[i+1][w]++;
			q.push_back((Node){i,w,i+1,w});
		}
	}
    cout<<q.size()<<'\n';
    for(int i=0;i<q.size();++i) cout<<q[i].a<<' '<<q[i].b<<' '<<q[i].c<<' '<<q[i].d<<'\n';
    return 0;
}

Measured memory_bytes: 5232
// C++ program to Find Number of digits
// in base b.
#include <iostream>
#include <math.h>
#define int long long
using namespace std;

// function to print number of
// digits
void findNumberOfDigits(long n, int base)
{
	// Calculating log using base
	// changing property and then
	// taking it floor and then
	// adding 1.
	int dig = (int)(floor( log(n) /
						log(base)) + 1);

	// printing output
	cout << dig<<endl;
}

// Driver method
int32_t main()
{
	// taking inputs
	int n,base;
  cin>>n>>base;

	// calling the method
	findNumberOfDigits(n, base);
	return 0;
}

// This code is contributed by Manish Shaw
// (manishshaw1)


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
signed main()
{
   SPEED;
   int s,w;
   cin>>s>>w;
   if(w>=s)
   {
       cout<<"unsafe";
   }
   else
   {
       cout<<"safe";
   }
}

Measured memory_bytes: 3652
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

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

#define endl '\n'

const int max4 = 10004;
const int maxx = 100005;
const int max6 = 1000006;
const int lg5 = 17;

const int INF = 2 * 1000000007;
const long long INFLL = 4LL * 1000000000 * 1000000000;

/***************/

int powmod (int a, int b, int mod) {
    int res = 1; a %= mod;
    for (; b; b >>= 1) {
        if (b & 1) {
            res = 1LL * res * a % mod;
        }
        a = 1LL * a * a % mod;
    }
    return res;
}

int gcd (int a, int b) {
    while (b > 0) {
        int t = a % b;
        a = b, b = t;
    }
    return a;
}

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

int is_prime (int n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

/******Don't forget to use long long when needed!!******/

int arr[maxx];
int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n;
    cin >> n; n *= 2;
    for (int i = 1; i <= n; i++) {
        cin >> arr[i];
    }
    sort(arr + 1, arr + n + 1);
    int res = 0;
    for (int i = 1; i <= n; i += 2) {
        res += arr[i];
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

a,b,c = m()

if a + b + c >= 22:
    print("bust")
else:
    print("win")


Measured memory_bytes: 38256
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

void pr(int n){
    int ans=0;
    vector<bool> prime;
    for(int i=0;i<=n;i++){
        prime.push_back(true);
    }
    prime[0]=prime[1]=false;

    for(int i=2;i<=n;i++){
        if(prime[i]){
            for(int j=2;j*i<=n;j++){
                prime[i*j]=false;
            }
        }
    }
    for(int i=2;i<=n;i++){
        if(prime[i]){
            ans++;
        }
    }
    printf("%d\n",ans);
}


int main(){
    int n;
    while(scanf("%d",&n)!=EOF){
        pr(n);
    }
    return 0;
}

Measured memory_bytes: 1324
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
using namespace std;
typedef long long int ll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define FOREQ(i, a, b) for (int i = (a); i <= (b); i++)
#define REPEQ(i, n) FOREQ(i, 0, n)

int main()
{
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<int>());

    if (s < t)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int 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(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define LLI long long int
using namespace std;
template <typename T> using V = vector<T>;
template <typename T, typename U> using P = pair<T,U>;
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;}

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

  LLI n,a,b; cin >> n >> a >> b;

  vector<int> ans(n);

  if(a+b > n+1 || a*b < n){
    cout << -1 << endl;
    return 0;
  }

  REP(i,a) ans[i] = n-a+i+1;

  int k = 0;
  for(int i=a; i<n;){
    if(n-i >= b-1){
      REP(j,b-1){
	ans[i+j] = k+b-1-j;
      }
      k += b-1;
      i += b-1;
    }else{
      int t = n-i;
      REP(j,t){
	ans[i+j] = k+t-j;
      }
      break;
    }
  }
  
  join(cout, ALL(ans));
  
  return 0;
}


Measured memory_bytes: 3328
D = int(input())
c = list(map(int, input().split()))
s = []
for i in range(D):
  s.append(list(map(int, input().split())))
  
sdictlist = []
sdictlistsorted = []
for i in range(D):
  onedict = {}
  for j in range(26):
    onedict[j] = s[i][j]
  sdictlist.append(onedict)
  onesorteddict = sorted(onedict.items(), key=lambda x:x[1], reverse=True)
  sdictlistsorted.append(onesorteddict)

lenpastmax = 22 #26まで設定できる
#26 -> 145419
#25 -> 18657778
#24 -> 40796238
#23
pastlist = []
for i in range(D):
  j = 0
  while(sdictlistsorted[i][j][0] in pastlist):
    j += 1
  print(sdictlistsorted[i][j][0]+1)
  pastlist.append(sdictlistsorted[i][j][0])
  if(len(pastlist)==lenpastmax):
    pastlist.pop(0)


Measured memory_bytes: 10484