akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
        using namespace std;
        #define ll long long int
        #define pb push_back
        #define mk make_pair
        #define ft first
        #define sc second
        #define ppb pop_back
        #define sz size
        #define forn(i,a,n) for(i=a;i<n;i++)
        #define M 998244353 
        #define inf 2e18
 
        int main() {
 
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        
        string s;
        cin>>s;
        string r=s;
        ll fl=0,fl1=0;
        reverse(r.begin(),r.end());
        if(s==r)
            { fl=1; }
        ll n=s.length();
        string s1 = s.substr(0,(n-1)/2);
        r = s1;
        reverse(r.begin(),r.end());
        if(s1==r){fl1=1;}
        string s2 = s.substr((n+1)/2);
        r = s2;
        reverse(r.begin(),r.end());
        if(s2==r && fl && fl1)
            cout<<"Yes";
        else
            cout<<"No";
        // cout<<s1<<" "<<s2;


        return 0;
        }

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L
#define PI 3.141592653589793238462643383279502884L

#define long long long int

using std::vector;
using std::map;
using std::set;
using std::string;
using std::pair;
using std::cin;
using std::cout;
using std::cerr;

// @author: pashka

int main() {
    std::ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> d(n + 1);
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        d[x] = d[x - 1] + 1;
    }
    int res = 0;
    for (int i = 1; i <= n; i++) {
        res = std::max(res, d[i]);
    }
    cout << n - res;

    return 0;
}

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

using namespace std;

int main()
{
    int N;

    cin >> N;

    multiset <int> m;
   for ( int i = 0; i < N; i ++ ) {
        int a;
        cin >> a;
        
        auto itr = m.lower_bound(a);
        if ( itr == m.begin() ) {
            m.insert( a ); 
        } else {
            itr --;
            m.erase( itr );
            m.insert( a );
        }
    }

//    for ( auto itr = m.begin(); itr != m.end(); itr ++ ) {
//        cout << *itr << endl;
//    }

    cout << m.size() << endl;

    return 0;
}

Measured memory_bytes: 4992
def main():
  n=int(input())
  s=t=input()
  a=0
  for i in range(n):
    c=0
    for v,w in zip(s,t):
      if v==w:c+=1
      else:c=0
      if c>i:break
      if c>a:a=c
    t=t[1:]
  print(a)
main()

Measured memory_bytes: 45464
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define trav(a,x) for(auto &a:x)
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

const ll MOD = 1e9+7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin >> s;
    int d;
    cin >> d;
    int full = 0;
    vector<ll> last(d);
    int n = s.size();
    rep(i,0,n) {
        vector<ll> next(d);
        int digit = s[i]-'0';
        rep(x,0,digit) ++next[(full+x)%d];
        full = (full+digit)%MOD;
        rep(j,0,d) {
            rep(k,0,10) {
                next[(j+k)%d] = (next[(j+k)%d]+last[j])%MOD;
            }
        }
        swap(next,last);
    }
    ll ans = last[0];
    if(full%d==0) ++ans;
    --ans;
    ans = (ans+MOD)%MOD;
    cout << ans << "\n";
} 


Measured memory_bytes: 256
import std.stdio;
import std.array;

void main(){
	int p, q;
	while (readf("%d %d\n", &p, &q)) {
		ulong[int] position;
		string ans;
		while (!(p in position)) {
			position[p] = ans.length;
			p *= 10;
			ans ~= (p / q) + '0';
			p %= q;
		}
		if (ans.back == '0' && ans.length-1 == position[p]) {
			ans.popBack();
			writeln(ans);
			continue;
		}
		writeln(ans);
		for (int i = 0; i < ans.length; i++) {
			if (i < position[p]) write(" ");
			else write("^");
		}
		writeln();
	}
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */



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

    string s; cin >> s;
    int n = s.size();

    int ans = 0;
    rep(i, n/2) if(s[i] != s[n-1-i]) ++ans;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<functional>
#include<utility>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>

const auto MOD = 1000000007;

using namespace std;

int n, m;
string s;

int main() {
	char a;
	cin >> a;
	char b=a;

	for (int i = 0; i < 3; i++)
	{
		cin >> a;
		if (a == b){cout << "Bad" << endl;
		return 0;
		}
		b = a;
	}
	cout << "Good" << endl;
}

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

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <int> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
#define o_set tree<ii, null_type,less<ii>, rb_tree_tag,tree_order_statistics_node_update>
#define graph vector<vi>
#define Mod 1000000007
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define T int t;cin>>t;rep(i,t)



void solve() {

    int n;
    cin >> n;
    string str;
    int arr[4] = {0};
    rep(i, n){
        cin >> str;
        if (str == "AC")
            arr[0]++;
        else if (str == "WA")
            arr[1]++;
        else if (str == "TLE")
            arr[2]++;
        else if (str == "RE")
            arr[3]++;
    }
    
    cout << "AC x "<< arr[0] << "\n";
    cout << "WA x "<< arr[1] << "\n";
    cout << "TLE x "<< arr[2] << "\n";
    cout << "RE x "<< arr[3] << "\n";

    
 }

int main()
{
    fastio;
    // T
    solve();
    //code
    return 0;
}


Measured memory_bytes: 3644
from collections import deque
import sys
def main():
    readline = sys.stdin.readline
    write = sys.stdout.write
    def root(x):
        if x == p[x]:
            return x
        p[x] = y = root(p[x])
        return y
    def unite(x, y):
        px = root(x)
        py = root(y)
        if px < py:
            p[py] = px
        else:
            p[px] = py

    N = int(readline())
    *C, = map(int, readline().split())
    M = int(readline())
    *p, = range(N)
    G = [[] for i in range(N)]
    G0 = [[] for i in range(N)]
    for i in range(M):
        a, b = map(int, readline().split()); a -= 1; b -= 1
        G[a].append(b)
        G[b].append(a)
        ca = C[a]; cb = C[b]
        if ca < cb:
            G0[a].append(b)
        elif cb < ca:
            G0[b].append(a)
    for v in range(N):
        ws = G[v]
        if not ws:
            continue
        ws.sort(key = C.__getitem__)
        c = C[v]
        prv = ws[0]; pw = C[prv]
        if C[prv] == c:
            unite(v, prv)
        for w in ws[1:]:
            cw = C[w]
            if pw == cw:
                unite(prv, w)
            else:
                G0[prv].append(w)
            if cw == c:
                unite(v, w)
            prv = w; pw = cw

    G1 = [[] for i in range(N)]
    deg = [0]*N
    for v in range(N):
        pv = root(v)
        for w in G0[v]:
            pw = root(w)
            if pv != pw:
                G1[pv].append(pw)
                deg[pw] += 1

    que = deque()
    D = [0]*N
    for i in range(N):
        if root(i) != i:
            continue
        if deg[i] == 0:
            que.append(i)
            D[i] = 1
    while que:
        v = que.popleft()
        d = D[v]
        for w in G1[v]:
            deg[w] -= 1
            if deg[w] == 0:
                que.append(w)
            D[w] = max(D[w], d+1)
    for i in range(N):
        if root(i) == i:
            continue
        D[i] = D[root(i)]
    write("%d\n" % sum(D))
main()


Measured memory_bytes: 64292
from fractions import gcd
from functools import reduce
from sys import stdin

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

while(True):
    n = int(stdin.readline())
    if not n: break
    s = [list(map(int,stdin.readline().split())) for _ in range(n)]
    lcmde = lcm_list([r[1] for r in s])
    lcmnu = lcm_list([r[0]*lcmde//r[1] for r in s])
    print("\n".join( str(lcmnu*r[1]//lcmde//r[0]) for r in s))



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


int main(){
  int n; cin >> n;
  vector<pair<int, int>> v;
  for(int i = 2; i <= n; i++){
    bool sosu = true;
    for(int j = 0; j < v.size(); j++){
      int x = v[j].first, y = i;
      while(y % x == 0){
        sosu = false;
        v[j].second++;
        y /= x;
      }
    }
    if(sosu) v.push_back(make_pair(i, 2));
  }

  int over5 = 0, over3 = 0, over15 = 0, over25 = 0, over75 = 0;
  rep(i, v.size()){
    if(v[i].second >= 75) over75++;
    if(v[i].second >= 25) over25++;
    if(v[i].second >= 15) over15++;
    if(v[i].second >= 5) over5++;
    if(v[i].second >= 3) over3++;
  }
  int ans = over75;
  ans += over25 * (over3 - 1);
  ans += over15 * (over5 - 1);
  ans += (over5 * (over5 - 1)) / 2 * (over3 - 2);
  cout << ans << endl;

  /*rep(i, v.size()){
    cout << v[i].first << " " << v[i].second << endl;
  }*/
  return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include<map>

using namespace std;


long long N,i,j,k,A[1000000]={0},B[1000000]={0},C[3],n,ans;


int main()
{
  cin >> N;
  ans=1;
  A[0]=3;
  for(i=0;i<N;i++)
  {
    cin >> n;
    ans=(ans*A[n])%1000000007;
    A[n]--;
    A[n+1]++;

  }
  
  cout <<ans;

    
  return 0;
}

Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>

using namespace std;

long long ans = 1;
int n;
int c[1005];

int main()
{
    scanf("%d", &n);
    for(int i = 2; i <= n; i++)
    {
        int p = i;
        for(int j = 2; p > 1; j++) {
            while(p % j == 0)
            {
                p /= j;
                c[j]++;
            }
        }
    }
    for(int i = 2; i <= n; i++)
    {
        ans *= (c[i] + 1);
        ans %= 1000000007;
    }
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<ll> a(n);
	ll sum=0;
	rep(i,n){
		cin>>a[i];
		sum^=a[i];
	}
	rep(i,n){
		cout<<(sum^a[i])<<endl;
	}
}

Measured memory_bytes: 4732
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

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

  int n; cin >> n;
  vector<int> a(n);
  rep(i, n) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  
  vector<int> b;
  int k = n/2;
  if (n%2 == 0) {
    for(int i=1; i<=k; i++) {
      b.push_back(2*i-1);
      b.push_back(2*i-1);
    }
  } else {
    b.push_back(0);
    for(int i=1; i<=k; i++) {
      b.push_back(2*i);
      b.push_back(2*i);
    }
  }

  if(a != b) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = 1;
  for(int i=1; i<=k; i++) {
    ans *= 2;
    ans %= mod;
  }
  cout << ans << endl;
}

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

int main() {
	int n; cin >> n;
  	string s1, s2; cin >> s1 >> s2;
  
  	for(int i = 0; i < n; i++) {
    	cout << s1[i] << s2[i];
    }
  	cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <list>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long LL;

int main(){
  string S;
  cin >> S;
  list<char> c;
  REP(i, S.size()) {
    c.push_back(S[i]);
  }
  int Q;
  cin >> Q;
  int mode = 0;
  REP(i, Q) {
    int op;
    cin >> op;
    if(op == 1) {
      mode ^= 1;
    } else {
      int F;
      char C;
      cin >> F >> C;
      if(((F-1) ^ mode) == 0) {
        c.push_front(C);
      } else {
        c.push_back(C);
      }
    }
  }
  if(mode == 0) {
    for(auto itr = c.begin(); itr != c.end(); ++itr) {
      cout << *itr;
    }
  } else {
    for(auto itr = c.rbegin(); itr != c.rend(); ++itr) {
      cout << *itr;
    }
  }
  cout << endl;
}

Measured memory_bytes: 11392
#include<iostream>

using namespace std;

int main(){
  string S;
  
  cin >> S;
  
  for(int i=0; i<3; i++){
    if(S[i] == S[i+1]){
      cout << "Bad" << endl;
      return 0;
    }
  }
  
  cout << "Good" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cassert>
using namespace std;

#define INF (1<<29)
#define MAX 55

typedef pair<int, int> P;

int N, D;
int cost[MAX][MAX];
P dp[MAX][MAX]; // dp[何泊目][泊まってるホテル] := (宿泊代の合計, 移動回数)

bool isValid(int p, int m, vector<int> path){
  int sum = 0;
  int move = 0;
  for(int i = 0 ; i < (int)path.size() ; i++) sum += cost[i][path[i]];
  for(int i = 1 ; i < (int)path.size() ; i++){
    if(path[i] != path[i-1]) move++;
  }
  if(p == sum && move == m) return true;
  else return false;
}

int main(){
  cin >> N >> D;
  for(int i = 0 ; i < N ; i++)
    for(int j = 0 ; j < D ; j++) cin >> cost[j][i];
  
  for(int i = 0 ; i < MAX ; i++)
    for(int j = 0 ; j < MAX ; j++) dp[i][j].first = dp[i][j].second = INF;
  
  vector<int>  paths[MAX][MAX];
  for(int j = 0 ; j < N ; j++){
    dp[0][j] = P(cost[0][j], 0);
    vector<int> p;
    paths[0][j].push_back(j);
  }
  
  for(int i = 1 ; i < D ; i++){
    for(int k = 0 ; k < N ; k++){
      for(int j = 0 ; j < N ; j++){
	
	P next = dp[i-1][k];	  
	next.first += cost[i][j];
	if(j != k) next.second += 1;	  
	
	vector<int> path;
	path = paths[i-1][k];
	path.push_back(j);
	
	if(dp[i][j] >= next){
	  dp[i][j] = min(dp[i][j], next);
	  paths[i][j] = path;
	}
      }
    }
  }

 for(int i = 1 ; i < D ; i++){
    for(int k = N-1 ; k >= 0 ; k--){
      for(int j = N-1 ; j >= 0 ; j--){
	
	P next = dp[i-1][k];	  
	next.first += cost[i][j];
	if(j != k) next.second += 1;	  
	
	vector<int> path;
	path = paths[i-1][k];
	path.push_back(j);
	
	if(dp[i][j] >= next){
	  dp[i][j] = min(dp[i][j], next);
	  paths[i][j] = min(paths[i][j], path);
	}
      }
    }
  }
  
  /*
  for(int i = 0 ; i < D ; i++){
    for(int j = 0 ; j < N ; j++){
      cout << " (" << dp[i][j].first << ", " << dp[i][j].second << ") "; 
    }
    cout << endl;
  }
*/
  P ans;
  ans.first = ans.second = INF;
  for(int j = 0 ; j < N ; j++) ans = min(ans, dp[D-1][j]);
  
  cout << ans.first << ' ' << ans.second << endl;
    
  vector<int> ans_path;
  
  for(int j = 0 ; j < N ; j++){
    if(dp[D-1][j] == ans){
      if(!isValid(ans.first, ans.second, paths[D-1][j])) continue;	
      if(ans_path.size() == 0) ans_path = paths[D-1][j];
      else ans_path = min(ans_path, paths[D-1][j]);
    }
  }
  
  if(ans_path.size() == 0) assert(false);
  for(int i = 0 ; i < ans_path.size() ; i++){
    cout << ans_path[i]+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 1604
#include <bits/stdc++.h>
 
using namespace std;
 
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
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; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
long long MOD = 1000000007;


template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 
int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
 
long long lcm (int a, int b){
    return  (long long) a*b /gcd(a,b);
}

long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }

long long dp[200100];

int main(){
    int N;
    cin >> N;

    double ans = 0.0;
    rep(i,N){
        double x;
        string u;
        cin >> x >> u;

        if(u == "BTC"){
            x *= 380000.0;
        }
        ans += x;
    }

    cout << fixed << setprecision(10) << ans  << endl;
}



Measured memory_bytes: 3764
ary = Array.new(10){ Array.new(10, 0) }
loop do
	s = gets
	if !s then
		break
	end
	(x, y, size) = s.split(",").map{|v| v.to_i}
	dx = Array.new(); dy = Array.new();
	if size == 1 then
		dx = [0, -1, 0, 1, 0]; dy = [-1, 0, 0, 0, 1]
	elsif size == 2 then
		dx = [-1, 0, 1, -1, 0, 1, -1, 0, 1]; dy = [-1, -1, -1, 0, 0, 0, 1, 1, 1]
	else
		dx = [0, -1, 0, 1, -2, -1, 0, 1, 2, -1, 0, 1, 0]; dy = [-2, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 2]
	end
	dx.size.times do |i|
		tmpx = dx[i] + x; tmpy = dy[i] + y;
		if tmpx >= 10 || tmpx < 0 || tmpy >= 10 || tmpy < 0 
			next
		end
		ary[tmpx][tmpy] += 1
	end
end

c = 0
m = 0

ary.each {|a|
	m = [m, a.max].max
	c += a.count(0)
}

puts c, m

Measured memory_bytes: 6108
N, A, B = gets.split(' ').map(&:to_i)
seq = gets.strip.split('')

inter = 0
exter = 0
seq.each do |s|
  if s == 'a'
    if inter + exter < A + B
      puts 'Yes'
      inter += 1
    else
      puts 'No'
    end
  elsif s == 'b'
    if inter + exter < A + B && exter < B
      puts 'Yes'
      exter += 1
    else
      puts 'No'
    end
  else
    puts 'No'
  end
end

Measured memory_bytes: 9852
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    cout << max(0LL, c - min(c, a-b)) << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        String a = String.valueOf(A);
        String b = String.valueOf(B);
        StringBuilder ab = new StringBuilder();
        for (int i = 0; i < A; i++) {
            ab.append(b);
        }
        StringBuilder ba = new StringBuilder();
        for (int i = 0; i < B; i++) {
            ba.append(a);
        }
        System.out.println(ab.toString().compareTo(ba.toString()) < 0 ? ab.toString() : ba.toString());
    }

}



Measured memory_bytes: 21588
#include <stdio.h>

int main(void) {
    int H, W;
    int i, j;

    while(1){
        scanf("%d %d", &H, &W);

        if(H == 0 && W == 0){
            break;
        }

        for(i = 0; i < H; i++){
            for(j = 0; j < W; j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    string a, b;
    cin >> a >> b;
    if (a.size() > b.size())cout << "GREATER"; else if (a.size() < b.size()) cout << "LESS";
    else {
        for (auto &&i: irange(0LL, (ll)a.size())){
            if (a.at(i)>b.at(i)){cout << "GREATER";return 0;} else if (a.at(i) < b.at(i)) {cout << "LESS"; return 0;}
        }
        cout << "EQUAL" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <functional>

using namespace std;
const double PI = 3.14159265358979323846;

int main()
{
	int R;
	double L;
	cin >> R;

	L = double(PI * R * 2);

	printf("%.2f",L);
	return 0;
}

Measured memory_bytes: 3720
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>
#include<limits>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1e9 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main(){
 double l;
 cin>>l;
 double hen=l/3;
 cout<<fixed;
 cout<<setprecision(10)<<(l/3)*(l/3)*(l/3)<<endl;
}

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

using namespace std;

int main() {
    int a, b, c, x, y, z;
    cin >> a >> b >> c;

    if (a & 1 || b & 1 || c & 1)
        cout << 0 << endl;

    else if (a == b && b == c)
        cout << -1 << endl;

    else {
        int ans = 0;
        while (true) {
            if (a & 1 || b & 1 || c & 1)
                break;
            x = a;
            y = b;
            z = c;
            a = (y + z) / 2;
            b = (z + x) / 2;
            c = (x + y) / 2;
            ans += 1;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
using System;

namespace ABC127C
{
    class Program
    {
        static void Main(string[] args)
        {
            var NM = Console.ReadLine().Trim().Split(' ');
            var N = int.Parse(NM[0]);
            var M = int.Parse(NM[1]);

            var min = 0;
            var max = N;

            for (var i = 0; i < M; i++)
            {
                var LR = Console.ReadLine().Trim().Split(' ');
                var L = int.Parse(LR[0]);
                var R = int.Parse(LR[1]);

                if (L > max || R < min)
                {
                    Console.WriteLine(0);
                    return;
                }

                if (L > min)
                    min = L;

                if (R < max)
                    max = R;
            }

            Console.WriteLine(max - min + 1);
        }
    }
}

Measured memory_bytes: 15292
#include <bits/stdc++.h>
#define ll long long
#define ld double
#define F first
#define S second
#define sz size
#define pb push_back

using namespace std;

const int MAXN = 1e6 + 5;
const int inf = 1e9 + 7;
const ll INF = 1e18;

int a, b, k;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> a >> b >> k;
    for (int i = min(a, b); i >= 1; i--) {
        if (a % i == 0 && b % i == 0) {
            k--;
            if (k == 0) {
                cout << i;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, [graph1; $len:expr]) => {{
        let mut g = vec![vec![]; $len];
        let ab = read_value!($next, [(usize1, usize1)]);
        for (a, b) in ab {
            g[a].push(b);
            g[b].push(a);
        }
        g
    }};
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => (read_value!($next, usize) - 1);
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        read_value!($next, [$t; len])
    }};
    ($next:expr, $t:ty) => ($next().parse::<$t>().expect("Parse error"));
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        d: i64, t: i64, s: i64,
    }
    puts!("{}\n", if d <= t * s { "Yes" } else { "No" });
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 2244
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
	cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	cout << head;
	if (sizeof...(tail) != 0) cout << " ";
	print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
	for (auto& a : vec) {
		cout << a;
		if (&a != &vec.back()) cout << " ";
	}
	cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
	for (auto& vec : df) {
		print(vec);
	}
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int a, b, c, x;
	cin >> a >> b >> c >> x;
	//if (a > 0) a++;
	//if (a > 0) b++;
	//if (a > 0) c++;
	int ans = 0;
	REP(i, c + 1)
	{
		//if (x < 500 * i)
		//	break;
		REP(j, b + 1)
		{
			//if (x < 500 * i + 100 * j)
			//	break;
			REP(k, a + 1)
			{
				if (x == 500 * k + 100 * j + 50 * i)
					ans++;
				//else if (x < 500 * i + 100 * j + 50 * k)
				//	break;
			}
		}
	}
	print(ans);
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
    
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,r;
    cin>>n>>r;
    cout<<r + 100*(max((ll)0,10-n))<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
ll INF = 1e18;

int main() {
  //
  string n;
  cin >> n;
  int ans = (n.size() - 1) * 9 + (n[0] - '0') - 1;
  int tmp = 0;
  bool all9 = true;
  rep(i, n.size()) {
    if (n[i] != '9') all9 = false;
    tmp += n[i] - '0';
  }
  if (all9) {
    cout << 9 * n.size() << endl;
  } else {
    cout << max(ans, tmp) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int S;
  scanf("%d", &S);

  int h, m, s, R;
  h = S / 3600;
  R = S - h * 3600;
  m = R / 60;
  R = R -m * 60;
  s = R;
  printf("%d:%d:%d\n", h, m, s);
  return 0;
}

Measured memory_bytes: 2740
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <string>
#include <set>
#define MOD 1000000007

using namespace std;

int main() {
	int N; cin >> N;
	vector<int> nos(N);
	for (int i = 0; i < N; i++) cin >> nos[i];
	nos.push_back(0);
	long long int total = 0;
	int prev = 0;
	for (int i = 0; i < N; i++) {
		total += abs(prev - nos[i]);
		prev = nos[i];
	}
	total += abs(prev);

	prev = 0;
	for (int i = 0; i < N; i++) {
		long long curr = total;
		curr -= abs(prev - nos[i]);
		curr -= abs(nos[i] - nos[i + 1]);
		curr += abs(nos[i + 1] - prev);
		cout << curr << endl;
		prev = nos[i];
	}
}

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

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

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(1e5) + 5;
const double EPS = 1e-8;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
string dir[] = {"R", "D", "L", "U"};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

int main() {
    ll n,m;
    cin >> n >> m;
    if(abs(n-m)>1){
        cout << 0 << endl;
    }
    else{
        ll x = 1, y = 1;
        REP(i,n)x = x * (i+1) % MOD;
        REP(i,m)y = y * (i+1) % MOD;
        if(n==m)cout << x*y*2%MOD << endl;
        else cout << x*y%MOD << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>

using namespace std;
#define SAY_YES cout<<"YES"<<endl;
#define SAY_Yes cout<<"Yes"<<endl;
#define SAY_NO cout<<"NO"<<endl;
#define SAY_No cout<<"No"<<endl;
#define IFYES(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;} 
#define IFYes(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;} 
#define IFyes(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"yes"<<endl;}else{cout<<"no"<<endl;} 
#define DEBUG_OUTPUT_ARRAY(XXX,ONE) for(int i=0;i<(ONE);i++){cout<<"DEBUG: i = "<<i<<" -> "<<XXX[i]<<endl;}
#define DEBUG_OUTPUT_ARRAY2(XXX,ONE,TWO) for(int i=0;i<(ONE);i++){cout<<"<<< i = "<<i<<" >>>"<<endl;for(int j=0;j<(TWO);j++){cout<<"DEBUG: j = "<<j<<" -> "<<XXX[i][j]<<endl; } }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX,ONE,TWO) for(int i=0;i<(ONE);i++){cout<<i<<"  ";for(int j=0;j<(TWO);j++){cout<<XXX[i][j]<<" "; } cout<<endl;}

typedef pair<long long int,long long int> pll;


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int n,D,m,d[150050]={},k[100050],A[100050],B[100050],C[100050],res=0;
int main() {
	cout << fixed << setprecision(18);
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    for(int i=0;i<n;i++){
        cin>>B[i];
    }
    for(int i=0;i<n;i++){
        cin>>C[i];
    }
    sort(A,A+n);
    sort(C,C+n);

    for(int i=0;i<n;i++){
        
        long long int ng=-1,ok=n,mid;
        while(ok-ng>1){
            mid=(ok+ng)/2;
            if(A[mid]<B[i]){ng=mid;}
            else{ok=mid;}
        }

        long long int ng2=-1,ok2=n,mid2;
        while(ok2-ng2>1){
            mid2=(ok2+ng2)/2;
            if(C[mid2]>B[i]){ok2=mid2;}
            else{ng2=mid2;}
        }
        res+=(ng+1)*(n-ok2);
        //cout<<ng<<" "<<n-ok2<<endl;
    }
    
    
    cout<<res<<endl;
} 


Measured memory_bytes: 4352
n = gets.to_i

# クラスってかこの程度なら構造体で充分なんだがな!!!!!!!!!!!!!!!!!!!!!!!!!!!
class Tree
  attr_accessor :id, :parent, :depth, :tree_type, :childs
  def initialize
    @childs = []
    @parent = -1
    @depth = 0
  end
end
trees = {}
# 数がわかっているので初期化
n.times do |i|
  tree = Tree.new()
  tree.id = i
  trees[i] = tree
end

# 単にdepthを深くしていくやつ
def rec(par, childs, target)
  if childs.size > 0
    childs.each do |c|
      target[c].parent = par
      target[c].depth = target[par].depth + 1
      rec(c, target[c].childs, target)
    end
  end
end

n.times do
  t = gets.chomp.split.map(&:to_i)
  myid = t[0]
  mychilds = []
  if t[1] > 0
    mychilds = t[2, t[1]]
  end
  trees[myid].childs = mychilds
  # 再帰的にdepthとparentを更新
  rec(myid, mychilds, trees)
end

# root、internal node、leaf
trees.each do |t|
  if t[1].parent == -1
    t[1].tree_type = "root"
  elsif t[1].childs.size.zero?
    t[1].tree_type = "leaf"
  else
    t[1].tree_type = "internal node"
  end
end

# 出力
n.times do |i|
  puts "node #{trees[i].id}: parent = #{trees[i].parent}, depth = #{trees[i].depth}, #{trees[i].tree_type}, [#{trees[i].childs.map(&:to_s).join(', ')}]"
end


Measured memory_bytes: 41988
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    String[] S=scan.nextLine().split("");
    int count=0;
    for(int i=0;i<S.length/2;i++){
      if(!(S[i].equals(S[S.length-1-i]))){
        count++;
      }
    }
    System.out.println(count);
  }
}

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

int main()
{
	int cnt[26] = {0};
	string S;
	cin >> S;
	int ans = 0;
	for (int i = 0; i < 4; i++) {
	    cnt[S[i] - 'A']++;
	    if (cnt[S[i] - 'A'] == 2) ans++;
	}
	if (ans == 2) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define forn(i, n) for (llong i = 0ll; i < (llong) n; ++i)
#define fornn(i, l, r) for (llong i = (llong) l; i < (llong) r; ++i)
#define size(x) ((int) (x.size()))
 
using namespace std;
 
typedef long long llong;
const llong inf = (llong) 1e+9 + 7ll;
const llong linf = (llong) 1e+18 + 7ll;
const long double eps = (long double) 1e-9;
const long double pi = acosl((long double) -1.0);
const int alph = 26;

mt19937 mrand(random_device{} ()); 

template<typename T, typename U> inline llong umin(const T& a, const U& b) { return a < b ? a : b; }
template<typename T, typename U> inline llong umax(const T& a, const U& b) { return a > b ? a : b; }
 
static char buff[(int) 2e6 + 17]; // reads std::string
const int maxn = (int) 2e5 + 17;

int n, m, nn, mm;
int a[600][600];

bool read()
{
	if (scanf("%d %d %d %d", &n, &m, &nn, &mm) != 4)
		return false;

	return true;
}

void solve()
{
	llong sum = 0;
	int x = 1000000000 / (nn * mm);

	forn (i, n)
		forn (j, m)
		{
			if ((i + 1) % nn == 0 && (j + 1) % mm == 0)
				a[i][j] = -(nn * mm - 1) * x - 1;
			else
				a[i][j] = x;

			sum += a[i][j];
		}

	if (sum > 0)
	{
		printf("Yes\n");

		forn (i, n)
		{
			forn (j, m)
				printf("%d ", a[i][j]);

			printf("\n");
		}
	}
	else
		printf("No\n");
}

int main()
{
#if SEREZHKA
	freopen("file.in", "r", stdin);
#endif
 
	while (read())
		solve();
 
	return 0;
}


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

using namespace std;
  
struct process{
    char c[100];
    int t;
};

int main(){
    long time = 0;
    queue<process> process_schedule; 
    unsigned int num_process, max_time;
    scanf("%d %d",&num_process,&max_time);
    process input_process;

    Rep(i,num_process){
        scanf("%s %d",input_process.c,&input_process.t);
        if(input_process.t <= max_time){
            time += input_process.t;
            printf("%s %ld\n",input_process.c, time);
        }else{
            time += max_time;
            input_process.t -= max_time;
            process_schedule.push(input_process);
        }
    }
    while(true){
        if(process_schedule.empty()) break;
        process current_process = process_schedule.front();
        process_schedule.pop();
        if(current_process.t <= max_time){
            time += current_process.t;
            printf("%s %ld\n",current_process.c, time);
        }else{
            time += max_time;
            current_process.t -= max_time;
            process_schedule.push(current_process);
        }
        
    }


    return 0;
}


Measured memory_bytes: 4880
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <utility>
#include <cmath>
#include <stdlib.h> 
#include <stdio.h>
#include <iterator>
#include <chrono>
#include <iomanip>
#include <set>
#include <map>
#include <list>
#include <iterator>
#include <deque>
#include <stack>
#include <queue>
#include <fstream>
#include <limits>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <sstream>
#include <random>
#include <cassert>

using namespace std;
#define ffor(n) for(int i = 0; i < n; i++)
#define fffor(n) for(int j = 0; j < n; j++)
int INF = 1e9 + 7;

long long total, maximum, len, total_maximum;

void dfs(int node, vector <int> & visited, vector <int>& next, vector <int>& cost) {
	if (visited[node] == 1) return;
	len++;
	visited[node] = 1;
	total += cost[node];
	dfs(next[node], visited, next, cost);
}

long long dfs3(int node, vector <int>& next, vector <int>& cost, int steps) {
	if (steps <= 0) return 0;
	return max((long long)0, cost[node] + dfs3(next[node], next, cost, steps - 1));
}

void dfs2(int node, vector <int>& visited, vector <int>& next, vector <int>& cost, int steps) {
	if (visited[node] == 2) return;
	visited[node] = 2;
	maximum = max(maximum, dfs3(node, next, cost, steps));
	total_maximum = max(total_maximum, dfs3(node, next, cost, len));
	dfs2(next[node], visited, next, cost, steps);
}


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

	long long ans = -INF;
	long long n, k, x;
	cin >> n >> k;
	vector <int> next(n), cost(n); vector <int> visited(n);
	ffor(n) {
		cin >> x;
		next[i] = x - 1;
	}
	ffor(n) cin >> cost[i];
	for (auto e : cost) ans = max(ans, (long long)e);

	ffor(n) {
		if (visited[i]) continue;
		total = 0, maximum = 0, len = 0, total_maximum = 0;
		dfs(i, visited, next, cost);
		dfs2(i, visited, next, cost, k % len);
		if (total_maximum == 0) {
			maximum = -INF;
			total_maximum = -INF;
		}
		ans = max({ ans, maximum, maximum + (k / len) * total });
		if (k >= len) ans = max({ ans, total_maximum, ((k / len) - 1) * total + total_maximum });
	}
	cout << ans;
}





/*
C:\Users\User\Desktop\comp_programming\final_straw_after_this_im_switching_to_vs_code\final_straw_after_this_im_switching_to_vs_code.cpp
*/

Measured memory_bytes: 3876
#include<stdio.h>
long long int min(long long int a, long long int b)
{
	if (a < b)
		return a;
	return b;
}
long long int max(long long int a, long long int b)
{
	if (a > b)
		return a;
	return b;
}
int main()
{
	long long int n;
	scanf("%lld", &n);
	long long int i;
	long long int u[200005], v[200005];
	for (i = 0; i < n - 1; i++)
		scanf("%lld %lld", &u[i], &v[i]);
	long long int ans = n * n * (n + 1) / 2;
	for (i = 0; i < n - 1; i++)
		ans -= min(u[i], v[i]) * (n - max(u[i], v[i]) + 1);
	for (i = 0; i < n; i++)
	{
		ans -= i * (i + 1) / 2;
		ans -= (n - i) * (n - i - 1) / 2;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 4836
<?php
$N = trim(fgets(STDIN));

$ans = 0;
for($i=105;$i<=$N;$i=$i+2){
  $div = 0;
  for ($k=1;$k<=$i;$k++){
    if ($i%$k==0){
      $div++;
    }
  }
if($div == 8){
  $ans++;
}
}
echo $ans;

Measured memory_bytes: 3576
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;

signed main(){
	cin>>N;
	int ans=0;
	for(int i=1;i<=N;i++){
		string s=to_string(i);
		if(s.size()%2==1){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;
#define reverse(s) reverse(s.begin(),s.end())
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
int main(){
    ll a,b,v,w,t;
    cin >> a >> v >> b >> w >> t;

    if(a>b){
        for(int i=0;i<t;i++){
            a -= v; b -= w;
            if(a<=b){
                cout << "YES" << endl;
                return 0;
            }
        }
    }else{
        rep(i,t){
            a += v; b+= w;
            if(a>=b){
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 3676