akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <map>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define FORr(i, j, k) for(int i = j; i >= k; ++i)
#define repr(i, j) FOR(i, j, 0)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;

int main() {
	int W, a, b;
	scanf("%d %d %d", &W, &a, &b);
	if (a > b) {
		a -= W;
		(b - a >= 0) ? printf("%d\n", 0) : printf("%d\n", a - b);
	}
	else {
		a += W;
		(a - b >= 0) ? printf("%d\n", 0) : printf("%d\n", b - a);
	}
	return 0;
}

Measured memory_bytes: 256
class UFTree:
    def __init__(self, N):
        self.nodes = [Node(i) for i in range(N)]
        self.N = N

    def find_max_child_num(self):
        result = 0
        for i in range(self.N):
            result = max(result, self.nodes[i].child_num)
        return result

class Node:
    def __init__(self, ID):
        self.ID = ID
        self.parent = None
        self.child_num = 0
        self.rank = 1

    def get_root(self):
        if self.parent is None:
            return self
        
        return self.parent.get_root()

    def concat(self, another):
        sr = self.get_root()
        ar = another.get_root()

        # is in a same tree.
        if sr.ID == ar.ID:
            return

        if sr.rank > ar.rank:
            parent, child = sr, ar
        else:
            parent, child = ar, sr

        parent.child_num += child.child_num + 1
        parent.rank = max(parent.rank, child.rank + 1)
        child.parent = parent

N, M = map(int, input().split())
tree = UFTree(N)

AB = []
for i in range(M):
    l = list(map(int, input().split()))
    AB.append(l)

for i in range(M):
    a, b = AB[i][0], AB[i][1]
    a -= 1;
    b -= 1;

    tree.nodes[a].concat(tree.nodes[b])

print(tree.find_max_child_num() + 1)


Measured memory_bytes: 129296
import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

struct P {
    int a, b;
    int x, y;
    int opCmp(const ref P p) const {
        return b - p.b;
    }
}

void main() {
    int n, m, h, k;
    while (scanf("%d %d %d %d\n", &n, &m, &h, &k), n || m || h || k) {
        int[] ps;
        foreach (i; 0 .. n) {
            int p;
            scanf("%d\n", &p);
            ps ~= p;
        }
        P[] ss;
        foreach (i; 0 .. m) {
            int a, b;
            scanf("%d %d\n", &a, &b);
            a--; b--;
            ss ~= P(a, b);
        }
        ss = ss.sort.array;
        int[] xs = new int[n];
        foreach (i; 0 .. n) xs[i] = i;
        foreach (i; 0 .. m) {
            int x = ss[i].a,
                y = ss[i].a + 1;
            ss[i].x = xs[x];
            ss[i].y = xs[y];
            swap(xs[x], xs[y]);
            //swap(ps[x], ps[y]);
        }
        int[] _ps = ps.dup;
        foreach (i; 0 .. n) {
            ps[xs[i]] = _ps[i];
        }
        int t = 0;
        foreach (i; 0 .. k) {
            t += ps[i];
        }
        int ans = t;
        foreach (i; 0 .. m) {
            int x = ss[i].x,
                y = ss[i].y;
            if (0 <= x && x < k) {
                if (0 <= y && y < k) continue;
                else ans = min(ans, t - ps[x] + ps[y]);
            } else if (0 <= y && y < k) {
                ans = min(ans, t - ps[y] + ps[x]);
            }
        }
        ans.writeln;
    }
}

Measured memory_bytes: 6452
//************************
//*  Date: 1.8.2018      *
//*  Problem:            *
//*  Author: xuziyuan    * 
//************************

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

string s;

void die()
{
	puts("WA");
	exit(0);
}

int main()
{
	cin>>s;
	if(s[0]!='A') die();
	if(s.size()<4) die();
	int c=0;
	for(int i=2;i<s.size()-1;i++) if(s[i]=='C') c++;
	if(c!=1) die();
	//cout<<s[1]<<s[s.size()-1];
	if(isupper(s[1])||isupper(s[s.size()-1])) die();
	puts("AC");
	rt0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
map<int, int> mp;
using Graph = vector<vector<int>>; 
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

// ^= -> ビットごとの排他的論理和を計算する

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	int cnt = 0;
	int ans = 0;
	rep(i, s.size()) {
		if (s.at(i) == 'A' || s.at(i) == 'C' || s.at(i) == 'G' || s.at(i) == 'T') {
			cnt++;
		}
		else {
			ans = max(ans, cnt);
			cnt = 0;
		}
	}
  ans = max(ans,cnt);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a,cnt=0,cnt1=0,cnt2=0,cnt3=0,cnt4=0,cnt5=0,cnt6=0,cnt7=0,ans=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        if(a>=1&&a<=399&&cnt==0)
        {
            cnt=1;
        }
        else if(a>=400&&a<=799&&cnt1==0)
        {
            cnt1=1;
        }
        else if(a>=800&&a<=1199&&cnt2==0)
        {
            cnt2=1;
        }
        else if(a>=1200&&a<=1599&&cnt3==0)
        {
            cnt3=1;
        }
        else if(a>=1600&&a<=1999&&cnt4==0)
        {
            cnt4=1;
        }
        else if(a>=2000&&a<=2399&&cnt5==0)
        {
            cnt5=1;
        }
        else if(a>=2400&&a<=2799&&cnt6==0)
        {
            cnt6=1;
        }
        else if(a>=2800&&a<=3199&&cnt7==0)
        {
            cnt7=1;
        }
        else if(a>=3200&&a<=4800)
        {
            ans++;
        }
    }
    if((cnt+cnt1+cnt2+cnt3+cnt4+cnt5+cnt6+cnt7)==0)
    {
        cout<<1<<" "<<ans<<endl;
        return 0;
    }
    cout<<(cnt+cnt1+cnt2+cnt3+cnt4+cnt5+cnt6+cnt7)<<" "<<(cnt+cnt1+cnt2+cnt3+cnt4+cnt5+cnt6+cnt7+ans)<<endl;
}


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

        if (n > m) {
            System.out.println("No");
        }else if (m == n) {
            System.out.println("Yes");
        }else System.out.println("Invalid");
    }
}


Measured memory_bytes: 23764
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

int main(){
    int a,b,c; cin >> a >> b >> c;
    int k; cin >> k;
    int cnt = 0;
    while(b <= a){
        if(cnt == k) break;
        b *= 2;
        cnt++;
    }
    while(c <= b){
        if(cnt == k) break;
        c *= 2;
        cnt++;
    }
    if(a < b && b < c) cout << "Yes" << endl;
    else cout << "No" << endl;
} 



Measured memory_bytes: 3632
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define pb push_back
#define lp(j, n)  for(int j=0; j<(int)(n); ++j)
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v)   ((v).begin()), ((v).end())
#define sz(v)    ( (int)((v).size()) )
#define F first
#define S second
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int,string> > vpii;
typedef map<int, int> mii;
const ll N=1e5+5;
ll arr[N],A[N]  ;
bool visited[N]={};
int cnt[N]={};
bool f;
int main()
{
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  int mx=max(a,max(b,c));
  int sum=abs((a+b+c)-mx);
  while(k--)
  {
    mx=2*mx;
  }
  cout<<sum+mx;
go;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e6+1;
const int mod=1e9+7;
ll fastexp(ll base,ll exp){
	base%=mod;
	ll ans=1;
	while(exp>0){
		if(exp&1){
			ans*=base;
			ans%=mod;
		}
		base*=base;
		base%=mod;
		exp/=2;
	}
	return ans;
}
ll gcd(ll a,ll b){
	if(b==0) return a;
	return gcd(b,a%b);
}
int main() {
	string str;
	cin >> str;
	if(str == "Sunny"){
		cout << "Cloudy";
	}
	else if (str == "Cloudy"){
		cout << "Rainy";
	}
	else 
		cout << "Sunny";
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

class union_find {
    private:
        vector<int> par;
        vector<int> ran;
        vector<ll> size;
    public:
        union_find(int n);
        int find(int x);
        void unite(int x, int y);
        bool same(int x, int y);
        ll show_size(int x);
};

union_find::union_find(int n){
    par.resize(n);
    ran.resize(n);
    size.resize(n);
    rep(i,n) par[i] = i;
    rep(i,n) ran[i] = 0;
    rep(i,n) size[i] = 1;
};

int union_find::find(int x) {
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
};

void union_find::unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x == y) return;
    ll t = show_size(x)+show_size(y);
    size[x] = size[y] = t;
    if(ran[x] < ran[y]){
        par[x] = y;
        //size[y] += size[x];
    }
    else{
        par[y] = x;
        //size[x] += size[y];
        if(ran[x] == ran[y]) ran[x]++;
    }
};

ll union_find::show_size(int x) {
    if(par[x] == x) return size[x];
    return show_size(par[x] = find(par[x]));
}

bool union_find::same(int x, int y) {
    return (find(x) == find(y));
};

const int INF = 1e9;
int dist[205][205];

void warchall_floyd(int N){
    rep(k,N)rep(i,N){
        if(dist[i][k] == INF) continue;
        rep(j,N){
            if(dist[k][j] == INF) continue;
	        chmin(dist[i][j], dist[i][k]+dist[k][j]);
        }
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<string> s(n);
    union_find uf(2*n);
    rep(i,n)rep(j,n){
        char c;
        cin >> c;
        if(c == '1'){
            dist[i][j] = 1;
            uf.unite(i, j+n);
            uf.unite(i+n, j);
        }
        else dist[i][j] = INF;
        dist[i][i] = 0;
    }
    rep(i,n){
        if(uf.same(i, i+n)){
            cout << -1 << endl;
            return 0;
        }
    }
    warchall_floyd(n);
    int dia = 0;
    rep(i,n)rep(j,n){
        if(dist[i][j] != INF) chmax(dia, dist[i][j]);
    }
    cout << dia + 1 << endl;
    return 0;
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s, n) for(int i = s; i < n; ++i)
#define rep(i, n)		 REP(i, 0, n)
#define SORT(c)			 sort((c).begin(), (c).end())
#define IINF	INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long				ll;
typedef pair <int, int> ii;
 
/*
struct point{
	ll x;
	ll y;
	point(){x = 0;y = 0;}
	point(ll x, ll y):x(x), y(y){}
};
*/

int main() {
	
	ll n, k;
	cin >> n >> k;
	
	map<ll, ll> mp;
	
	rep(i, n){
		ll a, b;
		cin >> a >> b;
		mp[a] += b;
	}
	
	ll cnt = 0;

	for(auto it = mp.begin(); it != mp.end(); ++it){
		cnt += it->second;
		if(cnt >= k){
			cout << it->first << endl;
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 4224
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
# Written by NoKnowledgeGG @YlePhan
 
#import math
#mod = 10**9+7
 
 
 
def main():
  n = int(input())
  d = [int(input()) for _ in range(n)]
  d = set(d)
  print(len(d))
if __name__ == '__main__':
  main()

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

#define F                   first
#define S                   second
#define int                 long long int
#define pb                  push_back
#define mp                  make_pair
#define pii                 pair<int,int>
#define vi                  vector<int>
#define mii                 map<int,int>
#define pqb                 priority_queue<int>
#define pqs                 priority_queue<int,vi,greater<int> >
#define mod                 1000000007
#define endl                '\n'
#define rep(i,a,b)            for(int i=a;i<b;i++)
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int power(int n, int p) {
    if (p == 1) {
        return n % mod;
    }
    if (p == 0) {
        return (int)1;
    }
    if (p & 1) {
        return (n % mod * (power(n, (p - 1) / 2) % mod * power(n, (p - 1) / 2) % mod) % mod) % mod;
    }
    else {
        return (power(n, (p) / 2) % mod * power(n, (p) / 2) % mod) % mod;

    }

}
void solve() {
    int n;
    cin >> n;
    int ans = (2 * (power(9, n))) % mod;
    ans = (ans - power(8, n) + mod)%mod;
    ans = (power(10, n) - ans + mod) % mod;
    cout << (ans+mod) % mod << endl;
}
int32_t main()
{
    c_p_c();
    solve();


    return 0;
}

Measured memory_bytes: 3624
from itertools import combinations
n, k = map(int, input().split())

m = (n-2)*(n-1)//2
if k > m:
    print(-1)
    exit()

E = []
for i in range(2, n+1):
    E.append((1, i))
E_add = list(combinations(range(2, n+1), 2))
for i in range(m-k):
    E.append(E_add[i])

print(len(E))
for e in E:
    print(*e)

Measured memory_bytes: 43248
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long int;using ld = long double;using P = pair<ll,ll>;const int MOD = (int)1e9+7;const string rt = "\n";const string sp = " ";/* 最大公約数 */template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}/* UnionFind */template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};/* コンビネーション */template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}/* 多次元ベクター */template<class T>vector<T> mvec(size_t a){return vector<T>(a);}template<class T, class... Ts>auto mvec(size_t a, Ts... ts){return vector<decltype(mvec<T>(ts...))>(a, mvec<T>(ts...));}/* テスト関数 */void test(ll n){cout << "test" << n << endl;}/* 小数点以下 */void fixsp(ll n){cout << fixed << setprecision(n);}void defsp(ll n){cout << defaultfloat << setprecision(n);}/* 重み付きUnionFind */struct WUnionFind {vector<int> par;vector<int> rank;WUnionFind(int n = 1) {init(n);}void init(int n = 1) {par.resize(n); rank.resize(n);for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;}int root(int x) {if (par[x] == x) {return x;}else {int r = root(par[x]);return par[x] = r;}}bool issame(int x, int y) {return root(x) == root(y);}bool merge(int x, int y) {x = root(x); y = root(y);if (x == y) return false;if (rank[x] < rank[y]) swap(x, y);if (rank[x] == rank[y]) ++rank[x];par[y] = x;return true;}};/* IO高速化 */void fastio(){ios::sync_with_stdio(false);cin.tie(NULL);}
/* ここからコード開始 */

int main(){
  fastio;
  ll N;
  cin >> N;
  vector<ll> a;
  rep(i, 0, N){
    ll A;
    cin >> A;
    a.push_back(A);
  }
  sort(all(a));
  ll sum{};
  rep(i, 0, N){
    sum = sum ^ a[i];
  }
  if(sum != 0){
    cout << "No" << rt;
  }
  else if(a[0] == a[N/3-1] && a[N/3] == a[2*N/3-1] && a[2*N/3] == a.back()){
    cout << "Yes" << rt;
  }
  else{
    cout << "No" << rt;
  }
}

Measured memory_bytes: 1400
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>

#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,n) for(int i=0;i<(n); i++)

using namespace std;
const int MAX = 100005;
const int INF=1e9+7;
typedef long long ll;


ll dp[105][MAX] = {0};
int main(){
	cin.tie(0);
    ios::sync_with_stdio(0); //この2行はより速度を向上させる
	// 追加２, 以降 cin の入力元が 'input.txt' になる
	//提出時に消す！！
	//std::ifstream in("sample.txt");
	//std::cin.rdbuf(in.rdbuf());

	int N,W;
	cin >> N >> W;

	vector<ll> w(N),v(N);
	rep(i,N) cin >> w[i] >> v[i];

	for(int i=0;i<N;i++){
		for(int j=0;j<=W;j++){
			dp[i+1][j]=dp[i][j];
			if(j-w[i] >= 0){
				dp[i+1][j] = max(dp[i+1][j], dp[i][j-w[i]]+v[i]);
			}
		}
	}
	cout << dp[N][W] << endl;

	return 0;
}


Measured memory_bytes: 79360
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<double> A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  for(int i=1;i<N;i++){
    A.at(N-i-1)=(A.at(N-i-1)+A.at(N-i))/2;
    A.pop_back();
    int j=N-i-1;
    while(j>=1&&A.at(j)>A.at(j-1)){
      swap(A.at(j),A.at(j-1));
           j--;
           }
  }
           cout<<A.at(0)<<endl;
}

Measured memory_bytes: 256
import sys

def PNO():
    print("No")
    sys.exit(0)

def PYES():
    print("Yes")
    sys.exit(0)



n, a, b, c, d = list(map(int, input().split()))
s = str(input())
a -= 1
b -= 1
c -= 1
d -= 1

ac = str(s[a:c])
##################
#print(ac)
if (ac.find("##") != -1):
    PNO()

bd = str(s[b:d])
##################
#print(bd)
if (bd.find("##") != -1):
    PNO()

if (c > d):
    bdd = str(s[b-1:d+2])
    ##################
    #print(bdd)
    if (bdd.find("...") == -1):
        PNO()

PYES()

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<array>

struct bit_vector{
  using u32 = uint32_t;
  using u64 = uint64_t;

  static constexpr u32 ws = 64;
  
  std::vector<u64> data;
  std::vector<u32> acml;

  inline u64 pow2(u32 x)const{
    return 1ull<<x;
  }
  inline u64 least_nbits(u32 n)const{
    return (1ull<<n)-1;
  }
  inline u32 popcount(u64 x)const{
    #ifdef __GNUC__
      return __builtin_popcountll(x);
    #else
      x -= x >> 1 & 0x5555555555555555;
      x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
      x = x + (x >> 4) & 0x0F0F0F0F0F0F0F0F;
      return x * 0x0101010101010101 >> 56 & 0x7f;
    #endif
  }

  bit_vector(){}
  bit_vector(std::vector<bool> const& a){
    u32 sz = a.size()/ws + 1;
    data.assign(sz,0);
    acml.assign(sz,0);
    for(u32 i=0;i<a.size();++i)if(a[i])data[i/ws]|=pow2(i%ws);
    for(u32 i=1;i<sz;++i)acml[i]=acml[i-1]+popcount(data[i-1]);
  }
  inline u32 prefix_sum(u32 i)const{
    return acml[i/ws]+popcount(data[i/ws]&least_nbits(i%ws));
  }
  u32 rank(u32 l,u32 r)const{
    return prefix_sum(r)-prefix_sum(l);
  }
  bool operator[](u32 i)const{
    return (data[i/ws]>>i%ws)&1;
  }
  u32 select(u64 k)const{
    if(acml.back()+popcount(data.back())<k)return -1;
    u32 l=0,r=acml.size();
    while(r-l>1){
      u32 m = l+r >> 1;
      (k<acml[m]?r:l) = m;
    }
    k -= acml[l];
    const u64& base = data[l];
    u32 idx = ws*l;
    l=0,r=ws;
    while(r-l>1){
      u32 m = l+r >> 1;
      (k<popcount(base&least_nbits(m))?r:l) = m;
    }
    return idx+r;
  }
};

struct wavelet_matrix{
  using u32 = uint32_t;
  using u64 = uint64_t;

  static constexpr u32 N = 64;

  std::array<bit_vector,N> data;
  std::array<u32,N> partition;

  wavelet_matrix(){}
  template<class T>
  wavelet_matrix(std::vector<T> a){
    u32 n = a.size();
    for(int b=N;b-->0;){
      std::vector<u64> b0,b1;
      std::vector<bool> tmp(n);
      for(int i=0;i<n;++i){
        tmp[i]=(static_cast<u64>(a[i])>>b)&1;
        (static_cast<u64>(a[i])>>b&1?b1:b0).push_back(a[i]);
      }
      data[b] = bit_vector(tmp);
      partition[b] = b0.size();
      auto itr = std::copy(b0.begin(),b0.end(),a.begin());
      std::copy(b1.begin(),b1.end(),itr);
    }
  }
  u32 prefix_rank(u64 v,u32 r){}
  u32 rank(u64 v,u32 l,u32 r){}
  u64 operator[](u32 k){
    u64 ak = 0;
    for(u32 i=N;i-->0;){
      if(data[i][k]){
        ak |= data[i][k]<<i;
        k = partition[i]+data[i].rank(0,k);
      }else{
        k = k-data[i].rank(0,k);
      }
    }
    return ak;
  }
};

int main(){
  using namespace std;
  int n;
  cin>>n;
  vector<int> a(n);
  for(auto& ai:a)cin>>ai;

  wavelet_matrix mat(a);
  for(int i=n;i-->0;){
    cout<<mat[i]<<" \n"[i==0];
  }
}


Measured memory_bytes: 3152
using System;
using static System.Console;
using static System.Math;
using System.Linq;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] tmp = ReadLine().Split(' ').Select(int.Parse).ToArray();
            int A = tmp[0];
            int B = tmp[1];
            int T = tmp[2];

            WriteLine(T / A * B);
        }
    }
}

Measured memory_bytes: 13268
import java.util.Scanner;
public class Main{
public static void main(String[] args){
try (Scanner sc = new Scanner(System.in)) {
int n = sc.nextInt();
int[] a = new int[n];
for(int i = 0; i<a.length; i++){
a[i] = sc.nextInt();
}
String delimiter = "";
for(int i = a.length - 1; i>=0; i--){
System.out.print(delimiter);
System.out.print(a[i]);
delimiter = " ";
}
System.out.println();
}
}
}


Measured memory_bytes: 26420
s=input()
n=len(s)
l=[]
l.append(s[0])
i=1
k=0
while i < n:
    j=1

    if i==n-1 and l[k]==s[n-1]:
        break
    while l[k] == s[i:i+j]:
        j += 1

    l.append(s[i:i+j])
    i += j
    k += 1


print(k+1)


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

int main() {
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;
	if (0 <= x - r&&x + r <= w && 0 <= y - r&&y + r <= h)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3088
import java.util.*; 
import java.io.*;
 
public class Main {
	
	public static void solve(InputReader in) {
		int n = in.readInt();
		Queue<Long> q = new LinkedList<>();
		ArrayList<Long> list = new ArrayList<>(); 
		for(long i = 1; i<=9; i++) {
			q.add(i); 
			list.add(i);
		}
		 
		for(long i = 0; true; i++) {
		   long x = q.poll(); 
		   long y = 0;
		   if(x % 10 != 0) {
			   y = 10 * x + (x%10) -1;
			   q.add(y);
			   list.add(y); 
		   }
		   y = 10*x + (x%10);
		   q.add(y); 
		   list.add(y); 
		   
		   if(x % 10 != 9) {
			   y = 10*x + (x%10) + 1;
			   q.add(y);
			   list.add(y); 
		   }
		  
		   if(n <= q.size()) {
			   System.out.println(list.get(n-1)); 
			   return; 
		   }
		}
	}
	
	
    public static void main(String[] args) {
    	InputReader in = new InputReader(System.in); 
    	int t = 1;
    	while(t-- > 0) {
    		solve(in); 
    	}
    }
}

class InputReader{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	 public InputReader(InputStream stream) {
		this.stream = stream;
	}

     public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

     public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

     public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

     public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
     public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
     
     public String next() {
		return readString();
	}
    
     public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 45072
/**
 *    author:  tourist
 *    created: 20.11.2019 14:09:37       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  auto Ask = [&](long long x) {
    cout << "? " << x << endl;
    string u;
    cin >> u;
    return (u == "Y");
  };
  int n = (int) 1e9;
  if (Ask(n)) {
    long long m = 10;
    while (!Ask(m - 1)) {
      m *= 10;
    }
    cout << "! " << m / 10 << endl;
  } else {
    while (!Ask(n)) {
      n /= 10;
    }
    int low = n, high = n * 10 - 1;
    while (low < high) {
      int mid = (low + high) >> 1;
      if (Ask(10LL * mid)) {
        high = mid;
      } else {
        low = mid + 1;
      }
    }
    cout << "! " << low << endl;
  }
  return 0;
}


Measured memory_bytes: 596
#include <stdio.h>

int main( void ){
	int student[ 31 ] = { 0 };
	int i, t;
	for( i = 0; i < 28; i++ ){
		scanf( "%d", &t );
		student[ t ] = 1;
	}
	for( i = 1; i <= 30; i++ ){
		if(!student[ i ]){ printf( "%d\n", i ); }
	}

	return 0;
}

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

#define dlog(str) cout << "====" << str << endl;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define REP2(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

LLI modpow(int p) {
    LLI s = 1;
    REP(i, p) { s = s * 2 % MOD; }
    return s;
}

int main() {
    int N;
    cin >> N;
    vector<int> v(N);
    REP(i, N) { cin >> v[i]; }
    SORT(v);
    if(N % 2 == 0) {
        bool valid = true;
        REP(i, N / 2) {
            if(v[i * 2] != i * 2 + 1 || v[i * 2 + 1] != i * 2 + 1) {
                valid = false;
                break;
            }
        }
        if(valid) {
            cout << modpow(N / 2);
        } else {
            cout << 0;
        }
    } else {
        bool valid = true;
        if(v[0] != 0) {
            valid = false;
        }
        REP(i, N / 2) {
            if(v[i * 2 + 1] != i * 2 + 2 || v[i * 2 + 2] != i * 2 + 2) {
                valid = false;
                break;
            }
        }
        if(valid) {
            cout << modpow(N / 2);
        } else {
            cout << 0;
        }
    }
    return 0;
}

Measured memory_bytes: 640
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var str = ReadLine();
        var substr = ReadLine();
        var q = substr.Length-1;
        var last = -1;
        for(var i = 0; i < str.Length - substr.Length+1; i++)
        {
            var s = str.Substring(i, substr.Length);
            var isCle = true;
            for(var j = 0; j < substr.Length; j++)
            {
                if (s[j] != '?' && s[j] != substr[j]) isCle = false;
            }
            if (isCle) last = i;
        }
        if(last!=-1)
        str = str.Substring(0, last) + substr + str.Substring(last+substr.Length);
        WriteLine(last!=-1?str.Replace('?', 'a'): "UNRESTORABLE");
    }
}

Measured memory_bytes: 13140
import java.util.*;
public class Main {
   public static void main(String args[]){
      //declaration and initialization
      Scanner sc = new Scanner(System.in);
      String input[];
      
      //reading the intput
      input = sc.nextLine().split(" ",0);
      
      //variables for each problem
      int time;
      int hour;
      int min;
      int sec;
      
      //assginment
      time = Integer.parseInt(input[0]);
            
      //calculation
      
      hour = time/3600;
      time -= hour * 3600;
      
      min = time/60;
      sec = time%60;
                  
     //output
      System.out.println(hour + ":" + min + ":" + sec);
      
      
      
   }//main
      
}//class

Measured memory_bytes: 26176
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO                       \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
#define pb push_back
#define ll long long

struct Q
{
	ll x, y;
	ll operator*(Q b)
	{
		// cout << x << " "<< y<<endl;
		// cout << b.y << " "<< b.x << endl;
		return (x * b.y - y * b.x);
	}
	void read()
	{
		cin >> x >> y;
	}
	Q operator-(Q b)
	{
		return {x - b.x, y - b.y};
	}
	double operator%(Q b)
	{
		return sqrt(pow(x - b.x, 2) + pow(y - b.y, 2));
	}
};
int main()
{
	FAST_IO
	ll a ,b;
	cin >>a >>b;
	if (500*a >= b){
		cout << "Yes"<<endl;
	}
	else {
		cout << "No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void inp(vector <ll> &a,int n)
{
    for(int i=0;i<n;i++)
    cin>>a[i];
}
void out(int a[],int n)
{
    for(int i=0;i<n;i++)
    cout<<a[i]<<" ";
    cout<<endl;
}
void change(int b[],int n,vector <int> &f,vector <int> &s)
{
    while(f.size()&&s.size())
    {
        int fi=f[f.size()-1];
        f.pop_back();
        int si=s[s.size()-1];
        s.pop_back();
        swap(b[fi],b[si]);
    }
    return;
}
int changef(int a[],int b[],int n,vector <int> &rem,int ele)
{
    for(int i=0;i<n&&rem.size();i++)
    {
        if(a[i]!=ele&&b[i]!=ele)
        {
            swap(b[i],b[rem[rem.size()-1]]);
            rem.pop_back();
        }
    }
    if(rem.size()!=0)
        return 0;
    return 1;
}
void solve()
{
  int n;
  cin>>n;
  int a[n],b[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  for(int i=0;i<n;i++)
    cin>>b[i];
  vector <int> itos[n+1];
  vector <int> etos;
  unordered_map <int,int> m;
  for(int i=0;i<n;i++)
  {
     if(a[i]==b[i])
     {
         itos[a[i]].push_back(i);
         if(m[a[i]]==0)
         {
             etos.push_back(a[i]);
         }
         m[a[i]]++;
     }
  }
  if(etos.size()==0)
  {
      cout<<"Yes"<<endl;
      out(b,n);
      return;
  }
  if(etos.size()>1)
  {
    int rem=etos[etos.size()-1];
    etos.pop_back();
    while(etos.size()!=0)
    {
        int temp=etos[etos.size()-1];
        etos.pop_back();
        change(b,n,itos[temp],itos[rem]);
        if(itos[temp].size()==0&&itos[rem].size()==0)
        {
            if(etos.size()==0)
            {
                cout<<"Yes"<<endl;
                out(b,n);
                return;
            }
            else{
                rem=etos[etos.size()-1];
                etos.pop_back();
            }
        }
        else if(itos[temp].size()==0)
        {}
        else{rem=temp;}

    }
    etos.push_back(rem);
  }
  int x=changef(a,b,n,itos[etos[etos.size()-1]],etos[etos.size()-1]);
  if(x==0)
    cout<<"No"<<endl;
  else{
    cout<<"Yes"<<endl;
    out(b,n);
    return;
  }
 return;
}
int main() {
    ll t=1;
    //cin>>t;
    while(t--)
    {
       solve();
    }
	return 0;
}


Measured memory_bytes: 24832
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>

using namespace std;


int main() {
	int i, j, k;
	int 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;
	}





	getchar();
	getchar();
	return 0;
}

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

int main() {
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i=0; i<s.size(); ++i) {
        if(s[i] != t[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3808
n,x,y = map(int, input().split())
ans = [0]*(n-1)

for i in range(n):
    for j in range(1,n-i):
        d = min(j, abs(x-1-i)+abs(y-1-(i+j))+1)
        ans[d-1] += 1

for m in range(n-1):
    print(ans[m])

Measured memory_bytes: 3444
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int A = sc.nextInt();
		int B = sc.nextInt();
		String U = sc.next();

		if(S.equals(U))
		A -= 1;
		else if(T.equals(U))
		B -= 1;

		System.out.println(A + " " + B);

	}
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
#define MAX 999999999

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

typedef long long ll;

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

    int n;
    cin >> n;

    vector<int> nums(n);
    rep(i, n) cin >> nums[i];

    vector<int> flowers(n, 0);
    int l = 0, r = 0, cnt = 0;
    while(true){
        rep(i, n){
            if(flowers[i] < nums[i]){
                l = i;
                break;
            }
        }

        repi(i, l, n){
            if(flowers[i] < nums[i]) r = i+1;
            else{
                repi(j, l, r){
                    flowers[j] ++;
                }
                if(r != l) cnt ++;
                l = i+1;
                r = i+1;
            }
        }

        if(r - l > 0){
            repi(j, l, r){
                flowers[j] ++;
            }
            cnt ++;
            l = 0;
            r = 0;
        }

        bool flag = true;
        rep(i, n) flag = flowers[i] == nums[i] && flag;
        if(flag) break;
    }

    cout << cnt << endl;
}

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

int main() {
  int q;
  while(cin>>q, ~q) {
    double x = (double)q/2.;
    while(true) {
      if (abs(x*x*x - q) < 0.00001*q) break;
      x = x - (x*x*x-q)/(3*x*x);
    }
    printf("%.6f\n", x);
  }
}

Measured memory_bytes: 1192
# C - Align
N = int(input())
A = [0]+[int(input()) for _ in range(N)]
A = sorted(A)
ans = 0
if N%2==0:
    i = 1
    while i<N//2:
        ans -= 2*A[i]
        i += 1
    ans -= A[i]
    i += 1
    ans += A[i]
    i += 1
    while i<=N:
        ans += 2*A[i]
        i += 1
else:
    i = 1
    while i<N//2:
        ans -= 2*A[i]
        i += 1
    ans -= A[i]
    i += 1
    ans -= A[i]
    i += 1
    while i<=N:
        ans += 2*A[i]
        i += 1
    tmp = 0
    A = [0]+sorted(A[1:], reverse=True)
    i = 1
    while i<N//2:
        tmp += 2*A[i]
        i += 1
    tmp += A[i]
    i += 1
    tmp += A[i]
    i += 1
    while i<=N:
        tmp -= 2*A[i]
        i += 1
    ans = max(ans,tmp)
print(ans)

Measured memory_bytes: 85096
#include <cstdio>
#include <algorithm>

typedef long long ll;
typedef long double ldb;

int n;
ldb d, x;

int main() {
	double dd, xx;
	scanf("%d%lf%lf", &n, &dd, &xx); d = dd, x = xx;
	
	ldb ans = 0;
	for (int i = n; i; --i) {
		ans += d + (i * 2 - 1) * x / 2;
		
		d = (d * (i * 2 + 2) + x * 5) / (i * 2);
		x = (i * 2 + 4) * x / (i * 2);
	}
	
	printf("%.12f\n", (double)ans);
	
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve() {
		UL N, X; cin >> N >> X;
		if (X == 1) { cout << "No" << endl; return; }
		if (X == 2 * N - 1) { cout << "No" << endl; return; }
		cout << "Yes" << endl;
		UL p = 1;
		rep(i, 2 * N - 1) {
			if (i == N - 2) { cout << X + 1 << endl; }
			else if (i == N - 1) { cout << X << endl; }
			else if (i == N) { cout << X - 1 << endl; }
			else {
				if (p == X - 1) p = X + 2;
				cout << p << endl;
				p++;
			}
		}
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 1536
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read bytes") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let c:usize = read();
    let k:usize = read();
    let mut t:Vec<usize> = (0..n).map(|_| read()).collect();
    t.sort();
    let mut sum = 0;
    let mut start = 0;
    for i in 0..n {
        if t[start] + k < t[i] || i - start + 1 > c  {
            start = i;
            sum += 1;
        }
    }
    sum += 1;
    println!("{}", sum);
}

Measured memory_bytes: 3116
def fill(ans,cols,count,w,row):
    prev = -1
    for col in range(len(cols)):
        curr_col = cols[col]
        for j in range(prev+1,curr_col+1):
            ans[row][j] = count
        count += 1
        prev = curr_col

    count -= 1
    for j in range(prev,w):
        ans[row][j] = count

    count += 1
    return count

def findBerry(row,w):
    #print(row,w)
    cols = []
    for i in range(w):
        if row[i] == '#':
            cols.append(i)

    return cols

def solve(cake,h,w,k,ans):
    count = 1
    rows = []
    for row in range(h):
        cols = findBerry(cake[row],w)
        if not cols:
            if len(rows) == row:
                rows.append(row)
            else:
                for col in range(w):
                    ans[row][col] = ans[row-1][col]
        else:
            count = fill(ans,cols,count,w,row)

    rows.reverse()
    for row in rows:
        for col in range(w):
            ans[row][col] = ans[row+1][col]

def main():
    cake = []
    h,w,k = map(int,input().split())
    for i in range(h):
        row = input()
        cake.append(row)

    ans = [[0 for i in range(w)] for j in range(h)]
    solve(cake,h,w,k,ans)

    for i in ans:
        for j in i:
            print(j,end = ' ')

        print()


main()


Measured memory_bytes: 7592
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
    int n,x;
    int p = 0,a;
    int count = 0;

    cin >> n >> x;

    while(p <= x && count <= n){
        cin >> a;
        p += a;
        count++;
    }

    cout << count;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

int P[1000004] = {0};

string S, T;
int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N, M, K;
	cin >> N >> M >> K;

	for(int i=0; i<=N; i++){
		for(int j=0; j<=M; j++){
			int c = i*j + (N-i)*(M-j);
			P[c] = 1;
		}
	}
	P[0] = 1;
	if(P[K] == 1){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}



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

int main(void){
  int n, q, cnt = 0;
  std::vector<int> S;
  
  std::cin >> n;
  for (int i = 0; i < n; i++) S.push_back([]{int v; std::cin >> v; return v; }());
  
  std::cin >> q;
  for (int i = 0; i < q; i++) {
    int v;
    std::cin >> v;
    for (auto itr = S.begin(); itr != S.end(); itr++) {
      if (*itr == v) {
        cnt++;
        break;
      }
    }
  }
  
  std::cout << cnt << std::endl;
  
  return 0;
}

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

int main()
{
    int n; cin >> n;
    vector<int> D(n);
    for (int i = 0; i < n; i++)
    {
        int a, b; cin >> a >> b;
        if (a == b) D[i] = 1;
    }
    bool sol = false;
    for (int i = 2; i < n; i++)
    {
        if (D[i-2] == 1 && D[i-1] == 1 && D[i] == 1)
        {
            sol = true; break;
        }
    }
    if (sol) cout << "Yes" << '\n';
    else cout << "No" << '\n';
}


Measured memory_bytes: 3628
/*
 * Problem Description: Graph II - Single Source Shortest Path I
 * Category: Graph/Dijkstra
 * Author: Khan
 * Date: 22th October, 2017
 */

#include <iostream>

using namespace std;

static const int MAX = 1000;
static const int INF = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

void dijkstra()
{
    int u, minv;
    int d[MAX], color[MAX];

    for (int i = 0; i < n; ++i)
    {
        d[i] = INF;
        color[i] = WHITE;
    }

    d[0] = 0;
    color[0] = GRAY;
    while(true)
    {
        minv = INF;
        u = -1;
        for (int i = 0; i < n; ++i)
        {
            if(minv > d[i] && color[i] != BLACK)
            {
                u = i;
                minv = d[i];
            }
        }
        if(u == -1)
            break;
        color[u] = BLACK;
        for (int v = 0; v < n; ++v)
        {
            if(color[v] != BLACK && M[u][v] != INF)
            {
                if(d[v] > d[u] + M[u][v])
                {
                    d[v] = d[u] + M[u][v];
                    color[v] = GRAY;
                }
            }
        }
    }

    for(int i = 0; i < n; ++i)
        cout << i << " " << (d[i] == INF ? -1 : d[i]) << endl;
}

int main(int argc, char const *argv[])
{
    //freopen("sample.txt", "r", stdin);
    cin >> n;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            M[i][j] = INF;
    int k, c, u, v;
    for (int i = 0; i < n; ++i)
    {
        cin >> u >> k;
        for (int j = 0; j < k; ++j)
        {
            cin >> v >> c;
            M[u][v] = c;
        }
    }
    dijkstra();
    return 0;
}

Measured memory_bytes: 3404
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n) 
{ v = vector<T>(n); for (lli i=0; i<n; ++i) cin >> v[i]; }
template<class T, class U> void read_n(vector<pair<T, U>>& v, size_t n)
{ v = vector<pair<T, U>>(n); 
  for (lli i=0; i<n; ++i) cin >> v[i].first >> v[i].second; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

struct E { 
  lli to, d;
  E(lli to, lli d) : to(to), d(d) {}
};
lli n, m;
vector<vector<E>> v;
vector<bool> vi;
vector<lli> x;

bool dfs(lli from, lli d) {
  if (vi[from]) return d == x[from];
  vi[from] = true;
  x[from] = d;
  for (auto&& e : v[from]) {
    if (!dfs(e.to, d + e.d)) return false;
  }
  return true;
}

int main() {
  cin >> n >> m;
  v = decltype(v)(n+1);

  for (lli i=0; i<m; ++i) {
    lli l, r, d;
    cin >> l >> r >> d;
    v[l].emplace_back(r, d);
    v[r].emplace_back(l, -d);
  }
  init_n(vi, n+1, false);
  init_n(x, n+1, 0);
  lli res = true;
  for (lli i = 1; i <= n; ++i) {
    res = res && dfs(i, x[i]);
  }
  cout << (res ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 15616
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, a, b, co[100009], k;
vector<pair<int, int> > vec[100009];
bool vis[100009];

void fun(int i, int from)
{
	int cur = k;
	vis[from] = true;
	for (int j = 0; j < (int)vec[i].size(); j++) {
        if (co[vec[i][j].se] == co[from]) continue;
		if (cur == co[from]) cur--;
		co[vec[i][j].se] = cur;
		cur--;
	}
	for (int j = 0; j < (int)vec[i].size(); j++) {
		if (!vis[vec[i][j].se]) {
			fun(vec[i][j].fi, vec[i][j].se);
		}
	}
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		cin >> a >> b;
		vec[a].pb({ b, i + 1});
		vec[b].pb({ a, i  + 1});
	}
	for (int i = 1; i <= n; i++) {
		k = max(k, (int)vec[i].size());
	}
  	co[0] = -1;
	fun(1, 0);
	cout << k << E;
	for (int i = 1; i < n; i++) {
		cout << co[i] << E;
	}
	//system("pause");
	return 0;
}


Measured memory_bytes: 7552