akhauriyash/Code-Regression huggingface dataset:
f=lambda:map(int,input().split())
n,m=f()
g = [[] for _ in range(n)]
for _ in range(m):
  a,b=f()
  g[a-1].append(b-1)
  g[b-1].append(a-1)
p = [0]*n
from collections import deque
q = deque([0])

while q:
  v = q.popleft()
  for c in g[v]:
    if p[c]<1:p[c]=v+1;q.append(c)
if 0 in p: print('No')
else: print('Yes',*p[1:],sep='\n')

Measured memory_bytes: 38904
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;

int main() {
	string str;
	cin >> str;
	int cntS = 0, cntN = 0, cntE = 0, cntW = 0;
	FOR (i, str.sz)
		if (str[i] == 'S')
			cntS++;
		else if (str[i] == 'N')
			cntN++;
		else if (str[i] == 'E')
			cntE++;
		else if (str[i] == 'W')
			cntW++;
	if (cntS > 0 && cntN == 0)
		cout << "No" << endl;
	else if (cntS == 0 && cntN > 0)
		cout << "No" << endl;
	else if (cntW > 0 && cntE == 0)
		cout << "No" << endl;
	else if (cntW == 0 && cntE > 0)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_map>
#include<unordered_set>
using namespace std;
typedef long long ll;
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;
#define mul(a,b) a=a*b%mod;

int main(){
  ll n,a,b;
  ll mi=1e17;
  ll sum=0;
  cin>>n;
  for(int i=0;i<n;i++){
      cin>>a>>b;
      sum+=a;
      if(a>b)chmin(mi,b);
  }
  if(mi==1e17)cout<<0<<endl;
  else cout<<sum-mi<<endl;
  return 0;
}


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

using namespace std;
int main() {
  string s;
  cin >> s;
  bool isEasy = true;
  for (int i = 0; i < s.length(); i++) {
    char c = s[i];
    if ((i + 1) % 2 == 1 && !(c == 'R' || c == 'U' || c == 'D')) {
      isEasy = false;
    }
    if ((i + 1) % 2 == 0 && !(c == 'L' || c == 'U' || c == 'D')) {
      isEasy = false;
    }
  }
  cout << (isEasy ? "Yes" : "No") << endl;
  return 0;
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int M, K; cin >> M >> K;
    //2^M-1 >= K >= 1の作り方
    //0 K 0 1 2  ... K-1 K+1 ... 2^M-1 K 2^M-1 ...2 1
    if(K == 0){
        rep(i, (1 << M)) cout << i << " " << i << " ";
        cout << endl;
    }
    else if(M == 1) cout << -1 << endl;
    else if(K >= (1 << M)) cout << -1 << endl;
    else{
        cout << "0 " << K << " 0 ";
        for(int i = 1; i < K; i++) cout << i << " ";
        for(int i = K+1; i < (1 << M); i++) cout << i << " ";
        cout << K << " ";
        for(int i = (1 << M)-1; i > K; i--) cout << i << " ";
        for(int i = K-1; i >= 1; i--) cout << i << " ";
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main()
{
    unsigned long long h,m,n;
    cin >> h;
    int i = 0;
    n = h;
    while(n != 0){
        n /= 2;
        i++;
    }
    m = pow(2,i) - 1;
    cout << m;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <time.h>
#include <vector>

using namespace std;
typedef long long ll;
template <class T = ll>
T in() {
    T x;
    cin >> x;
    return (x);
}
template <class T>
void print(T x) {
    cout << x << "\n";
}
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define reps(x, c) for (auto x : c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a)
#define mp(a, b) make_pair((a), (b))
#define pl pair<ll, ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cerr << #x "=" << (x) << "\n"
#define dbgv(x) \
    cerr << #x << "\n"; \
    reps(y, x) { cerr << y << " "; } \
    cerr << "\n"

int main() {
    ll n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<ll> a;
    if (s[0] == '0') {
        a.pb(0);
    }

    a.pb(1);
    FOR(i, 1, n) {
        if (s[i] == s[i - 1]) {
            a[a.size() - 1]++;
        }
        else {
            a.pb(1);
        }
    }

    vector<ll> b(a.size());
    b[0] = a[0];
    FOR(i, 1, a.size()) { b[i] = a[i] + b[i - 1]; }

    ll ans = 0;

    if (2 * k < a.size() - 1) {
        ans = b[2 * k];
    }
    else {
        cout << b[a.size() - 1] << endl;
        return 0;
    }
    FOR(i, 1, a.size()) {
        if (2 * k + i * 2 <= a.size() - 1) {
            ans = max(ans, b[2 * k + i * 2] - b[i * 2 - 1]);
        }
        else if (2 * k + i * 2 - 1 <= a.size() - 1) {
            ans = max(ans, b[2 * k + i * 2 - 1] - b[i * 2 - 1]);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2164
function main(arg) {
    
    a = arg.split(" ");
    
    C = Math.floor(a[1] / a[0]);
    
    if(C <= a[2]){console.log(C);}
    else{console.log(a[2]);}
    
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <iostream>
#include <stdio.h>
#include <string>

#define MAX_N 50

using namespace std;

int main() {
  string O, E;
  cin >> O >> E;
  if (O.size() == E.size()) {
    for (int i = 0; i < O.size(); ++i) {
      printf("%c", O[i]);
      printf("%c", E[i]);
    }
    printf("\n");
  } else {
    printf("%c", O[0]);
    for (int i = 0; i < E.size(); ++i) {
      printf("%c", E[i]);
      printf("%c", O[i + 1]);
    }
    printf("\n");
  }
}

Measured memory_bytes: 3092
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string &s, char c){vector<string> v;int d=0,f=0;string t;for(char c:s){if(!d&&c==',')v.pb(t),t="";else t+=c;if(c=='\"'||c=='\'')f^=1;if(!f&&c=='(')++d;if(!f&&c==')')--d;}v.pb(t);return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
const ll MOD=1e9+7;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
	int n,m;
	cin>>n>>m;
	vv<int> g(n);
	rep(i,m){
		int x,y;
		cin>>x>>y; --x; --y;
		g[x].pb(y);
		g[y].pb(x);
	}
	vector<int> cs(n,-1);
	int ng=0;
	function<void(int,int)> dfs=[&](int v,int c){
		if(cs[v]>=0){
			if(cs[v]!=c) ng=1;
			return;
		}
		cs[v]=c;
		for(int w:g[v]) dfs(w,1-c);
	};
	dfs(0,0);
	//out(ng,cs,1);
	if(ng){
		cout<<n*(n-1ll)/2-m<<endl;
	}else{
		vector<ll> cnt(2);
		for(int x:cs) cnt[x]++;
		cout<<cnt[0]*cnt[1]-m<<endl;
	}
  return 0;
}


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

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    vector<lint> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    lint ok = INT_MAX, no = 0;
    while (abs(ok - no) > 1) {
        lint mid = (ok + no) / 2;
        lint require = 0;
        for (int i = 0; i < n; i++) {
            lint rem = max(0LL, h[i] - mid * b);
            require += (rem + a - b - 1) / (a - b);
        }
        if (require <= mid) {
            ok = mid;
        } else {
            no = mid;
        }
    }
    cout << ok << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int a[5];
	int b[5];
	int count[5];
	int i = 0;
	int min = 9999999;
	int so = 0;
	int j = 0;
	int gokei =0;
	
	count[0] = count[1] = count[2] = count[3] = count[4] = 0;
	for (i = 0;i < 5; i++){
		scanf("%d", &a[i]);
	}
	for (i = 0; i < 5; i++){
		b[i] = a[i];
	}
	for (i = 0; i < 5; i++){
		while((a[i] % 10) != 0){
			a[i] += 1;
			count[i] += 1;
		}
	}
	for (j = 0;j<5;j++){
		for (i = 0;i<5;i++){
			if (min >= count[i]){
				min = count[i];
				so = i;
			}
		}
		if (min == 124){
			break;
		}
		min = 999;
		if (j == 4){
			gokei += b[so];
		}
		else{
			gokei += a[so];
		}
		count[so] = 124;
	}
	printf("%d\n", gokei);
	return (0);
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    vector<pair<double, int>> amari;
    for (int i = 0; i < 3; ++i) {
        vector<pair<double, int>> v;
        for (int j = 0; j < 8; ++j) {
            int x; double k;
            cin >> x >> k;
            v.emplace_back(k, x);
        }
        sort(v.begin(),v.end());
        for (int j = 0; j < 8; ++j) {
            if(j < 2){
                printf("%d %.2lf\n", v[j].second, v[j].first);
            }else {
                amari.emplace_back(v[j]);
            }
        }
    }
    sort(amari.begin(),amari.end());
    for (int j = 0; j < 2; ++j) {
        if(j < 2){
            printf("%d %.2lf\n", amari[j].second, amari[j].first);
        }
    }
    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
const long long INF = 1LL << 60;

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

int main()
{
    string s; cin >> s;
    int n = s.size();
    for(int i=0;i<n;i++)cout <<"x";
    cout << endl;
}
    

Measured memory_bytes: 256
#if 0

#endif

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int N;
int gx, gy;
int p;
int T[15+10][15+10];
int FL[15+10][15+10];
int FU[15+10][15+10];

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    for (int x = 0; x < 15+10; x++) {
      for (int y = 0; y < 15+10; y++) {
        T[x][y] = (x == 0 && y == 0); FL[x][y] = (x != 0); FU[x][y] = (y != 0);
      }
    }
    cin >> gx >> gy >> p;
    int x1, y1, x2, y2;
    for (int j = 0; j < p; j++) {
      cin >> x1 >> y1 >> x2 >> y2;
      if (x1 == x2)
        FU[max(x1, x2)][max(y1, y2)] = false;
      if (y1 == y2)
        FL[max(x1, x2)][max(y1, y2)] = false;
    }
    for (int x = 0; x <= gx; x++) {
      for (int y = 0; y <= gy; y++) {
        if (!(x == 0 && y == 0)) {
          T[x][y] = (FL[x][y] ? T[x-1][y] : 0) + (FU[x][y] ? T[x][y-1] : 0);
        }
      }
    }
    cout << (T[gx][gy] ? to_string(T[gx][gy]) : "Miserable Hokusai!") << endl;
  }
}



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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        int[] a = sc.IntArray();

        a = a.OrderByDescending(num => num).ToArray();

        for (int i = 0; i < n; i++)
        {
            if (a[i] != n - ((i / 2) + 1) * 2 + 1)
            {
                Console.WriteLine(0);
                return;
            }
        }

        ModInt answer = 1;

        answer *= ModInt.Pow(2, n / 2);

        Console.WriteLine(answer);
    }

    // ModInt
    class ModInt
    {
        public const long Mod = (int)1e9 + 7;

        public long num;

        public ModInt(long n) { num = n; }

        public override string ToString() { return num.ToString(); }
        public static ModInt operator +(ModInt l, ModInt r) { l.num += r.num; if (l.num >= Mod) l.num -= Mod; return l; }
        public static ModInt operator -(ModInt l, ModInt r) { l.num -= r.num; if (l.num < 0) l.num += Mod; return l; }
        public static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }
        public static implicit operator ModInt(long n) { n %= Mod; if (n < 0) n += Mod; return new ModInt(n); }

        public static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }

        public static ModInt Pow(long v, long k)
        {
            long ret = 1;
            for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)
                if ((k & 1) == 1) ret = ret * v % Mod;
            return new ModInt(ret);
        }

        public static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 37192
using System;
public class test
{
	public static void Main()
    {
    	string[] s=Console.ReadLine().Trim().Split(' ');
    	int a=int.Parse(s[0])-int.Parse(s[1])*2;
      	if(a>0)
    		Console.WriteLine(a);
      	else
          	Console.WriteLine(0);
    }
}

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

#define ll long long
#define ld long double
#define ii pair<int ,int >
#define S second
#define F first
#define PI 3.1415926535897932384626
#define SPEED std::ios_base::sync_with_stdio(false);



int main(){
    SPEED
    int a,b,c;
    cin>>a>>b>>c;
    string s="";
    s+='0'+a;
    s+='0'+b;
    s+='0'+c;
    s+=s;
    for(int i=0;i<=2;i++){
        if(s[i]=='5' && s[i+1]=='7' && s[i+2]=='5'){
            cout<<"YES";
            return 0;
        }
    }
    cout<<"NO";

}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using static System.Console;
using static System.Math;
class Program
{

    void Solve()
    {
        var A = io.Int;
        var B = io.Int;
        if (A < 10 && B < 10)
        {
            WriteLine(A * B);
        }
        else
        {
            WriteLine(-1);
        }
    }

    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Program().Stream();
    private void Stream()
    {
        //var exStdIn = new System.IO.StreamReader("stdin.txt");
        //SetIn(exStdIn);
        Solve();
        io.Flush();
    }
}

class SimpleIO
{
    string[] _nextBuffer;
    int _bufferCnt;
    char[] cs = new char[] { ' ', '"', ',' };
    StreamWriter sw = new StreamWriter(OpenStandardOutput())
    {
#if DEBUG
        AutoFlush = true
#else
        AutoFlush = false
#endif
    };
    public SimpleIO()
    {
        _nextBuffer = new string[0];
        _bufferCnt = 0;
        SetOut(sw);
    }
    string Next()
    {
        if (_bufferCnt < _nextBuffer.Length) return _nextBuffer[_bufferCnt++];
        var st = ReadLine();
        while (st == string.Empty) st = ReadLine();
        _nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        _bufferCnt = 0;
        return _nextBuffer[_bufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void Flush() => Out.Flush();
}

Measured memory_bytes: 13140
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
using namespace std;

bool isprime(int p) {
	if (p == 1)return false;
	for (int i = 2; i < p; i++) {
		if (p%i == 0)return false;
	}
	return true;
}

int N;

int main(int argc, char *args[]) {
	cin >> N;
	for (int i = 31; i <= 55555; i += 10) {
		if (isprime(i)) {
			if (i != 31)cout << " ";
			cout << i;
			N--;
		}
		if (N == 0)break;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;


int main() {
  int n; cin >> n;
  vector<string> ans;
  function<void(string, int)> f = [&](string s, int idx) {
    if (idx == n) {
      ans.emplace_back(s);
      return;
    }
    if (s.empty()) {
      f("a", 1);
    } else {
      int c = *max_element(ALL(s)) - 'a';
      REP(i, c + 2) f(s + char('a' + i), idx + 1);
    };
  };
  f("", 0);
  sort(ALL(ans));
  for (const string &s : ans) cout << s << '\n';
  return 0;
}


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

int c[3][3];

void solve() {
  if (((c[0][0]-c[0][1])==(c[1][0]-c[1][1])) && ((c[1][0]-c[1][1])==(c[2][0]-c[2][1]))) {
    if (((c[0][1]-c[0][2])==(c[1][1]-c[1][2])) && ((c[1][1]-c[1][2])==(c[2][1]-c[2][2]))) {
      if (((c[0][2]-c[0][0])==(c[1][2]-c[1][0])) && ((c[1][2]-c[1][0])==(c[2][2]-c[2][0]))) {
        cout << "Yes" << endl;
        return;
      }
    }
  }
  cout << "No" << endl;
}

int main() {
  cin >> c[0][0] >> c[0][1] >> c[0][2];
  cin >> c[1][0] >> c[1][1] >> c[1][2];
  cin >> c[2][0] >> c[2][1] >> c[2][2];
  solve();
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    string s;
    cin >> s;
    stack<char> ans;
    rep(i,s.size()){
        if(s.at(i)!='B'){
            ans.push(s.at(i));
        }else if(ans.empty()){

        }else{
            ans.pop();
        }
    }
    int siz =ans.size();
    stack<char> ans2;
    rep(i,siz){
        // cout <<"kesi";
        ans2.push(ans.top());
        ans.pop();
    }
    rep(i,siz){
        cout << ans2.top();
        ans2.pop();
    }
    cout << endl;
    return 0;
}

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

ll gcd(ll a, ll b){
  if(a%b == 0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
ll count1(ll max, ll c, ll d){
  ll count = 0;
  count = count + max/c + max/d;
  ll lcm = c/gcd(c,d)*d;
  count -= max/lcm;
  return max - count;
}

int main(){
  ll a,b,c,d;
  cin >> a >> b >> c >> d;

  cout << count1(b,c,d)-count1(a-1,c,d) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
    int main(){
      int A,B,X;
      int ans;
      scanf("%d %d %d",&X,&A,&B);
      for(int i=1;i<=10000;i++){
        if(X-A < B*i){
          ans=(X-A)-(B*(i-1));
          break;
        }
      }
      printf("%d",ans);
      return 0;
    }

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define sort stable_sort 
using namespace std;

int _;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int mod=1e9+7;

int n;

inline long long powlog(int x,int t)
{
	long long ans=1;
	while(t--)
	{
		ans *= x;
		ans %= mod;
	} 
	return ans;
}

int main()
{	
	//for(scanf("%d",&_);_;_--)
	scanf("%d",&n);
	printf("%lld\n",((powlog(10,n)-powlog(9,n)-powlog(9,n)+powlog(8,n))%mod+mod)%mod);
	return 0;
}   	         


Measured memory_bytes: 3800
#include <iostream>
#include <iomanip>
#include <string>
 
using namespace std;
 
int main(void){
    while (true){
        int a, b, ans;
        string op;
        cin >> a >> op >> b;
            if (op == "?") break;
        if (op == "+"){
            ans = a + b;
        }
        else if (op == "-"){
            ans = a - b;
        }
        else if (op == "*"){
            ans = a * b;
        }
        else if (op == "/"){
            ans = a / b;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1208
// 169_d.cc
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

map<ll, int> factorize(ll n) {
	map<ll, int> res;
	for (ll i = 2; i*i <= n; i++) {
		while (n % i == 0)
			++res[i], n /= i;
	}
	if (n != 1) res[n]++;
	return res;
}

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

	ll n;
	cin >> n;
	auto mp = factorize(n);

	int ans = 0;
	for (auto p : mp) {
		int x = p.second;
		for (int i = 1; i <= x; i++) {
			ans++;
			x -= i;
		}
	}

	cout << ans << endl;
}

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

int main(void)
{
    int a,b,c[3],i,j,k,n;

    cin >> a >> b;
    c[0]=a+b;
    c[1]=a-b;
    c[2]=a*b;
    sort(c,c+3);
    cout << c[2];

    return 0;
}

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


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string val;
    cin>>val;
    ll cnt=0;
    ll cal=0;
    for(int i=0; i<3; i++){
        if(val[i]=='R'){
            cal++;
            cnt=max(cnt,cal);
        }
        else{
            cal=0;
        }
    }
    cout<<cnt;
    return 0;
}


Measured memory_bytes: 3616
import math
from collections import Counter

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

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

x = a/0.08
x_1 = (a+1)/0.08
y = b/0.1
y_1 = (b+1)/0.1

if is_integer_num(x_1):
    x_li = set(range(math.ceil(x),int(x_1)))
else:
    x_li = set(range(math.ceil(x),math.floor(x_1)))
    
if is_integer_num(y_1):
    y_li = set(range(math.ceil(y),int(y_1)))
else:
    y_li = set(range(math.ceil(y),math.floor(y_1)))

li=x_li&y_li

if list(li) == []:
    print(-1)
else:    
    print(min(li))

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

using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;

long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}

/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  

double eps = .000000001;

int main(){
  prep();
  int n;
  cin >> n;
  int arr[n];
  int a[n];
  int b[n];
  int rank[n];
  for (int i=0; i<n; i++){
      cin >> arr[i];
      arr[i]--;
      rank[arr[i]] = i+2;
  }
  a[0] = 1;
  b[0] = rank[0]-1;
  int vals[n];
  
  for (int i=1; i<n; i++){
      int aval = a[i-1];
      int bval = b[i-1];

      int newsum = rank[i];
      int nexta = aval+1;
      int nextb = bval-1;
      if (newsum < nexta+nextb){
          nextb -= nexta+nextb-newsum;
      }else if (newsum > nexta+nextb){
          nexta += newsum-nexta-nextb;
      }
      a[i] = nexta;
      b[i] = nextb;
  }
  int lowesta = 1000000000;
  for (int i=0; i<n; i++){
      lowesta = min(lowesta, a[i]);
  }
  if (lowesta <= 0){
      lowesta = abs(lowesta)+1;
  }else{
      lowesta = 0;
  }
  int lowestb = 1000000000;
  for (int i=0; i<n; i++){
      lowestb = min(lowestb, b[i]);
  }
  if (lowestb <= 0){
      lowestb = abs(lowestb)+1;
  }else{
      lowestb = 0;
  }
  for (int i=0; i<n; i++){
      a[i] += lowesta;
      b[i] += lowestb;
  }
  for (int i=0; i<n; i++){
      cout << a[i] << " ";
  }
  cout << '\n';
  for (int i=0; i<n; i++){
      cout << b[i] << " ";
  }
  return 0; 
}

Measured memory_bytes: 896
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int result = 0;
		for(int i = 1; i <= N; i++) {
			if((int)Math.floor(Math.log10(i) + 1) % 2 == 1) {
				result++;
			}
		}
		System.out.println(result);
		sc.close();
	}

}
/*
□□□□□■□□□■□□□□□□□
□□□□□■□□□■□□□□□□□
□□□□□■□□□■□□□□□□□
□□□□□■□□□■□□□■■□□
■■■■■■□□□■□■■■□□□
□□□□□■□□□■■■□□□□□
□□□□□■□□□■□□□□□□□
□□□□□■□□□■□□□□□□□
□□□□□■□□□■□□□□□□□
□□□□□■□□□■□□□□□□□
□□□□□■□□□■□□□□□□□
□□□■■■□□□■□□□□□□□
□■■■□■□□□■□□□□□■□
■■□□□■□□□■■□□□■■□
□□□□□■□□□□■■■■■□□
□□□□□■□□□□□□□□□□□
□□□□□□□■□□□□□□□□□
□□□□□□□■□□□□□□□□□
□□□□□□□■□□□□□□□□□
□□□□□□□■□□□□□□□□□
□□□□□□□■□□□□□□□□□
■■■■■■■■■■■■■■■■□
□□□□□□□■□□□□□□□□□
□□□□□□■■■□□□□□□□□
□□□□□□■□■□□□□□□□□
□□□□□□■□■■□□□□□□□
□□□□□■■□□■□□□□□□□
□□□□□■□□□■■□□□□□□
□□□□■■□□□□■■□□□□□
□□□■■□□□□□□■■□□□□
□□■■□□□□□□□□■■□□□
■■■□□□□□□□□□□■■■□
*/

Measured memory_bytes: 21692
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define sz(x) (int)(x).size()
/* --- */
int main() {
	string a, b;
	cin >> a >> b;
	int na = a[0] - '0', nb = b[0] - '0';
	string p = "", q = "";
	while (na--) p += b;
	while (nb--) q += a;
	cout << min(p, q) << '\n';
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,a,b;
	cin>>n>>a>>b;
	if(a>b){
		swap(a,b);
	}
	if((a&1)==(b&1)){
		cout<<(b-a)/2;
		return 0;
	}
	cout<<min(a+((b-a)-1)/2,(n-b+1)+(n-(a+n-b+1))/2);
}

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

using namespace std;

int main()
{
    long long nMax=1e5+5,N, W, d[2][nMax], w[102], v[102];
    cin >> N >> W;
    for(int i=0;i<N;i++)
        cin >> w[i] >> v[i];
    for(int j=1;j<nMax;j++)
        d[1][j]=LLONG_MAX/2;
    d[1][0]=0;
    for(int i=0;i<N;i++)
        for(int j=0;j<nMax;j++)
            if(j>=v[i])
                d[i&1][j]=min(d[i&1^1][j-v[i]]+w[i],d[i&1^1][j]);
            else
                d[i&1][j]=d[i&1^1][j];
    for(int q = nMax-1; q > 0; q--)
        if(d[N&1^1][q] <= W)
            return 0*printf("%i\n",q);
}


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

public class Main {
    static final Scanner sc  = new Scanner(System.in);
    static final int MOD = (int) 1E9 + 7;
    static final int INF = Integer.MAX_VALUE;
    
    public static void main(String[] args) {
        int H = nint();
        int W = nint();
        int[][] count = new int[H+2][W+2];
        char[][] a = nchars2(H, W, 1);
        count[1][1] = 1;
        
        for (int h = 1; h <= H; h++) {
            for (int w = 1; w <= W; w++) {
                if (a[h+1][w] == '.') {
                    count[h+1][w] += count[h][w];
                    count[h+1][w] %= MOD;
                }
                if (a[h][w+1] == '.') {
                    count[h][w+1] += count[h][w];
                    count[h][w+1] %= MOD;
                }
            }
        }
        System.out.println(count[H][W]);
    }
    
    static long max(long... longs) {
        return Arrays.stream(longs).max().getAsLong();
    }
    
    static long min(long... longs) {
        return Arrays.stream(longs).min().getAsLong();
    }

    private static long nlong() {
        return sc.nextLong();
    }

    private static int nint() {
        return sc.nextInt();
    }

    private static String nstr() {
        return sc.next();
    }

    private static char[] nchars() {
        return sc.next().toCharArray();
    }

    private static char[] nchars(int padL, int padR) {
        char[] temp = sc.next().toCharArray();
        char[] ret = new char[temp.length + padL + padR];
        System.arraycopy(temp, 0, ret, padL, temp.length);
        return ret;
    }

    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static char[][] nchars2(int h, int w) {
        return nchars2(h, w, 0);
    }

    private static char[][] nchars2(int h, int w, int pad) {
        char[][] a2 = new char[h + pad * 2][w + pad * 2];
        for (int i = 0; i < h; i++)
            System.arraycopy(nchars(), 0, a2[pad + i], pad, w);
        return a2;
    }
}


Measured memory_bytes: 37664
#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define mp make_pair
#define F(i, a, n, b) for(int i=a;i<n;i+=b)
#define REVF(i, a, b, c) for(int i=a;i>=b;i-=c)
#define REP(i, n) F(i, 0, n, 1)
#define REP1(i, n) F(i, 1, n+1, 1)
#define REV(i, n) REVF(i, n, 0, 1)
#define PTR(it, x) for(auto it=x.begin();it!=x.end();++it)
#define MOD 1000000007

typedef unsigned long long ll;

const int MAX = 2e6 + 5;

int n,p[MAX],dp[MAX],cnt=0;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	dp[0] = 0; dp[1] = 0;
	cin>>n;
	REP(i,n){
		cin>>p[i];
	}
	REP(i,n){
		if(i == 0)
			dp[0] = p[i];
		else{
			if(p[i] >= dp[i-1]){
				dp[i] = dp[i-1];
				cnt++;
			}
			else
				dp[i] = p[i];
		}
	}
	cout<<n-cnt<<endl;
	return 0;
}

Measured memory_bytes: 5120
#include <cstdio>
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
 
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
 
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())
 
#define pb push_back
#define mp make_pair
#define mt make_tuple
 
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

int extgcd(int a, int b, int& x, int& y) {
    int d = a;
    if (b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    }
    else {
        x = 1;
        y = 0;
    }
    return d;
}

int main(void)
{
    int a, b;
    cin >> a >> b;

    int x, y;
    extgcd(a, b, x, y);
    cout << x << " " << y << endl;
     
    return 0;
}

Measured memory_bytes: 1168
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import Counter 
def main():
    N = int(readline())
    A = [int(i) for i in readline().split()]
    d = Counter(A)
    pans = 0
    for v in d.values():
        pans += v*(v-1)//2
    for k in A:
        tmp = pans
        v = d[k]
        tmp -= v*(v-1)//2
        v -= 1
        tmp += v*(v-1)//2 
        print(tmp)
if __name__ == '__main__':
    main()


Measured memory_bytes: 25564
n=int(input())
s=input()
r=s.count("R")
g=s.count("G")
b=s.count("B")
ans=r*g*b
for i in range(n):
    for j in range(n):
        if i+j+j>=n:
            break
        s1=s[i]
        s2=s[i+j]
        s3=s[i+j*2]
        if s1!=s2 and s2!=s3 and s1!=s3:
            ans-=1
print(ans)

Measured memory_bytes: 9136
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] d = new int[k];
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < k; i++) {
            set.add(sc.nextInt());
        }
        boolean isContained = true;
        while (isContained) {
            isContained = false;
            int temp = n;
            while(temp > 0) {
                int mod = temp % 10;
                if (set.contains(mod)) {
                    isContained = true;
                }
                temp /= 10;
            }
            if (!isContained) {
                System.out.println(n);
                return;
            }
            n++;
        }

    }

}

Measured memory_bytes: 20692
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        System.out.println(solve(S));

        sc.close();
    }

    static String solve(String S) {
        return S.replaceAll("2017", "2018");
    }
}

Measured memory_bytes: 20948
#include <bits/stdc++.h>
using namespace std;
int main() {
int v[3];
cin>>v[0]>>v[1]>>v[2];
swap(v[0],v[1]);
swap(v[0],v[2]);
cout<<v[0]<<" "<<v[1]<<" "<<v[2]<<endl;
return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>
char eyetest(double sight);
int main(void) {
    int rc[4]={0},lc[4]={0},i;
    double right,left;
    while (scanf("%lf %lf",&right,&left)!=EOF) {
        rc[eyetest(right)-'A']++;
        lc[eyetest(left)-'A']++;
    }
    for (i=0; i<4; i++) printf("%d %d\n",rc[i],lc[i]);
    return 0;
}

char eyetest(double sight) {
    if (sight<0.2) {
        return 'D';
    } else if (sight<0.6) {
        return 'C';
    } else if (sight<1.1) {
        return 'B';
    } else {
        return 'A';
    }
}

Measured memory_bytes: 628
eater::Int->[Char]->[Int]
eater init_num [] = []
eater init_num (cm:rest) = let v = (init_num + (if cm =='I' then 1 else (-1))) in
                           v:(eater v rest)
solver::Int->[Char]->Int
solver v ls = maximum (v:(eater v ls))

main::IO()
main=do
  _<-getLine
  str<-getLine
  print (solver 0 str)

Measured memory_bytes: 508
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		double r = sc.nextDouble();
		double pi = Math.PI;

		double area = pi * r * r;
		double length = 2 * pi * r;

		System.out.printf("%f %f",area, length);

	}

}



Measured memory_bytes: 28272
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int n;
	double p;
	cin >> n;
	if (n%2)
	{
		cout << (n + 1) / 2.0 / n;
	}
	else
	{
		cout << "0.5000000000";
	}
	return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
s = [input() for _ in range(h)]

def bfs(x, y):
    q = []
    dp = {}
    def qpush(x, y, t):
        if 0 <= x < w and 0 <= y < h and s[y][x] != '#' and (x, y) not in dp:
            q.append((x, y))
            dp[(x, y)] = t

    qpush(x, y, 0)
    while len(q) > 0:
        (x, y) = q.pop(0)
        qpush(x + 1, y, dp[(x, y)] + 1)
        qpush(x, y - 1, dp[(x, y)] + 1)
        qpush(x - 1, y, dp[(x, y)] + 1)
        qpush(x, y + 1, dp[(x, y)] + 1)
    return dp.get((x, y), 0)

t = 0
for y in range(h):
    for x in range(w):
        t = max(t, bfs(x, y))
print(t)

Measured memory_bytes: 9164
// problem: "https://atcoder.jp/contests/abc128/tasks/abc128_c"

#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,i,j,k,x;
    cin>>n>>m;

    //int i;
    vector<unordered_set<int>>V(m);
    for(i=0;i!=m;i++)
    {
        //int j,k;
        cin>>k;

        for(j=0;j!=k;j++)
        {
            //int x;
            cin>>x;
            V[i].insert(x-1);
        }
    }

    vector<int>P(m);
    for(i=0;i!=m;i++)
        cin>>P[i];

    // for(j=0;j!=m;j++)
    // {
    //     for(auto it=V[j].begin();it!=V[j].end();it++)
    //         cout<<*it<<' ';
    //     cout<<'\n';
    // }

    int num = 0;
    for(i=0;i!=(int)pow(2,n);i++)
    {
        vector<int>numSwitch(m,0);
        for(j=1,x=0;j<=i;j=j<<1,x++)
        {
            //cout<<(j&i)<<' ';

            if((j&i)!=0)
            {
                //int k;
                for(k=0;k!=m;k++)
                    if(V[k].find(x)!=V[k].end())     // fill it up
                        numSwitch[k]++;
            }
        }

        //cout<<'\n';
        // for(j=0;j!=m;j++)
        //     cout<<numSwitch[j]<<' ';
        // cout<<'\n';


        int c = 0;
        for(j=0;j!=m;j++)
        {
            if((numSwitch[j]-P[j])%2 == 0)
                c++;
            else
                break;
        }

        if(c == m)
            num++;
    }

    cout<<num;

    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
#define INF 1e9
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))

int main(void){
	char S[5];
	scanf("%s",S);
	char a=S[0],b=S[1],c=S[2],d=S[3];
	bool ok=false;
	if(a==b && c==d && a!=c)ok=true;
	if(a==c && b==d && a!=d)ok=true;
	if(a==d && b==c && a!=b)ok=true;
	if(ok)printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 128
def create_groups(H):
    F = "{:0" + str(H) + "b}"
    ret = set()
    for n in range(2 ** H):
        g = create_group(F.format(n))
        ret.add(tuple(g))
    return list(sorted(ret))


def create_group(s):
    ret = []
    n = 0
    for i in range(len(s)):
        if i == 0:
            ret.append(0)
        else:
            if s[i-1] == s[i]:
                ret.append(n)
            else:
                n += 1
                ret.append(n)
    return ret

# assert(create_group("0000") == [0,0,0,0])
# assert(create_group("0011") == [0,0,1,1])
# assert(create_group("0010") == [0,0,1,2])

# print(len(create_groups(10)))

def solve(H, W, K, fields):
    ans = H * W + 1
    for g in create_groups(H):
        M = len(set(g))
        s = [0 for _ in range(M)]
        tans = M - 1
        for w in range(W):
            for h in range(H):
                if fields[h][w] == "1":
                    s[g[h]] += 1
            if any([a > K for a in s]):
                s = [0 for _ in range(M)]
                tans += 1
                for h in range(H):
                    if fields[h][w] == "1":
                        s[g[h]] += 1
            if any([a > K for a in s]):
                tans = H * W + 1
                break
        ans = min(ans, tans)
    return ans
#
# assert(solve(3, 3, 1, ["111", "111", "111"]) == 4)
# assert(solve(1, 1, 1, ["1"]) == 0)
# assert(solve(2, 1, 1, ["1", "1"]) == 1)
# assert(solve(1, 2, 1, ["11"]) == 1)
# assert(solve(1, 2, 1, ["11"]) == 1)
# assert(solve(3, 5, 4, ["11100", "10001", "00111"]) == 2)
# assert(solve(3, 5, 8, ["11100", "10001", "00111"]) == 0)
# assert(solve(4, 10, 4, ["1110010010", "1000101110", "0011101001", "1101000111"]) == 3)

# print(slowsolve(5, 11, "33883"))
# print(solve(5, 11, "33883"))

if __name__ == "__main__":
    H, W, K = tuple(map(int, input().split(" ")))
    fields = []
    for _ in range(H):
        fields.append(input())
    print(solve(H, W, K, fields))


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


int main(void) {
    using namespace std;

    long n;
    cin >> n;

    vector<vector<long>> d(n, vector<long>(n));
    for(int i=0; i<n; i++)
        for(int j=0; j<n; j++)
            cin >> d[i][j];

    long r = 0;
    for(int i=0; i<n; i++)
        for(int j=0; j<n; j++) {
            bool found = false;

            for(int k=0; k<n; k++)
                if(d[i][j] > d[i][k] + d[k][j]) {
                    cout << -1 << endl;
                    return 0;
                }
                else
                    found |= (k != i && k != j) && (d[i][j] == d[i][k] + d[k][j]);

            if(!found) r += d[i][j];
        }

    cout << r/2 << endl;
}


Measured memory_bytes: 1024
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <string>
#include <limits.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <typeinfo>
#include <stdlib.h>
#include <stack>
#include <queue>
#include <type_traits>

#define ll long long
#define ld long double

using namespace std;



int main(){
	ll n, a, sum1=0, sum2=0, max, cur;
	cin >> n;
	ll a1[n], a2[n];
	for(ll i=0; i<n; i++){
		cin >> a;
		sum1 += a;
		a1[i] = sum1;

	}
	for(ll i=0; i<n; i++){
		cin >> a;
		sum2 += a;
		a2[i] = sum2;
	}
	max = a1[0] + a2[n-1];
	for(ll i=1; i<n; i++){
		cur = a1[i] + (a2[n-1] - a2[i-1]);
		if(max < cur){
			max = cur;
		}
	}
	cout << max << endl;

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
using data=pair<ll,ll>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}
ll ncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r)plus=plus*(n-i)/(i+1);
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}


int main(){
  ll i,j=0,k=0,N,A,B,cnt=0,ans=0,bf,smcnt=1,ansplus=1,f=1;
  cin>>N>>A>>B;
  vec v(N),slist;
  rep(i,N)cin>>v[i];
  vrsort(v);

  bf=v[0];
  rep1(i,N){
    if(bf==v[i]){
      smcnt++;
    }else{
      slist.push_back(smcnt);
      smcnt=1;
    }
    bf=v[i];
  }
  slist.push_back(smcnt);
  rep(i,A)ans+=v[i];
  cout<<fixed<<(double(ans)/double(i))<<endl;
  i=0;
  while(i+slist[j]<A)i+=slist[j++];

  For(k,A,B+1){
    if(k-i>slist[j])break;
    cnt+=ncr(slist[j],k-i);
    if(j>0)break;
  }
  if(!cnt)cnt++;
  cout<<cnt<<endl;

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <iostream>
#define maxn 100009
#define maxm
#define PS system("pause");
using namespace std;
int a[maxn],n,T;
int b[maxn];
vector<int>c;
bool cmp(int a,int b){
	return a>b;
}
int main(){
	cin>>n>>T;
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	int ans=0;
	int cur=0;
	int mi=1e9+1;
	for(int i=1;i<=n;i++){
		if(a[i]-mi>cur){
			cur=a[i]-mi;
			ans=1;
		}
		else if(a[i]-mi==cur){
			ans++;
		}
		mi=min(a[i],mi);
	}
	printf("%d\n",ans);
	return 0;
}	

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0; i<N; i++){
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  cout << A.at(N-1)-A.at(0) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

#define MAXN 3000

long S[2][MAXN][MAXN];
int T[2][MAXN][MAXN];
int A[MAXN];

long deque ( int n, int m, int p)
{
	if ( T[p][n][m] == 1 ) return S[p][n][m];

	long tmp1,tmp2;
	if ( p == 0 ) {
		tmp1 = deque(n+1, m, 1)+A[n];
		tmp2 = deque(n,m-1,1)+A[m];
		T[p][n][m] = 1;
		return S[p][n][m] = (tmp1 > tmp2 ) ? tmp1:tmp2;
	} else {
		tmp1 = deque(n+1,m,0)-A[n];
		tmp2 = deque(n,m-1,0)-A[m];
		T[p][n][m] = 1;
		return S[p][n][m] = (tmp1 < tmp2 ) ? tmp1:tmp2;
	}
}

int main(void)
{
	int n,i,j;

	scanf("%d", &n);
	for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
	for ( i = 0; i < n; i++ ) {
		for ( j = 0; j < n; j++ ) T[0][i][j] = T[1][i][j] = 0;
	}
	for ( i = 0; i < n; i++ ) {
		S[0][i][i] = A[i], T[0][i][i] = 1;
		S[1][i][i] = -A[i], T[1][i][i] = 1;
	}

	printf("%ld\n",deque(0,n-1,0));

	return 0;
}


Measured memory_bytes: 211328
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
a,b,c,d = readInts()
x1 = a * c
x2 = a * d
x3 = b * c
x4 = b * d
print(max(x1,x2,x3,x4))


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

int main()
{
int N;scanf("%d",&N);
int D,X;scanf("%d %d",&D,&X);
int ans=0;
vector<int> A(N);for(int i=0;i<N;i++)scanf("%d\n",&A[i]);
for(int i=0;i<N;i++)
{
  int d=D;d--;
  ans+=d/A[i]+1;
}
ans+=X;
printf("%d\n",ans);
}

Measured memory_bytes: 256