akhauriyash/Code-Regression huggingface dataset:
import java.io.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {


		int H=nextInt();
		int W=nextInt();
		String[][] C = new String[H][];
		for(int i=0;i<H;i++){
			C[i]=nextStrings();
		}

		for(int i=0;i<H;i++){
			for(int k=0;k<2;k++){
				for(int j=0;j<C[i].length;j++){
					System.out.print(C[i][j]);
				}
				System.out.println();
			}
		}
	}




	public static String[] toStringArray(String s){
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for(int i=0;i<tmp.length;i++){
			tmp[i]=String.valueOf(c[i]);
		}
		return tmp;
	}
	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


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

int main(){
  string S;
  cin>>S;
  int ans=0;
  int s = S.size()/2;
  for(int i = 0;i<s;i++){
    if(S.at(i)!=S.at(S.size()-1-i))ans++;
  }
    cout<<ans;
}


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

using namespace std;

constexpr int64_t MOD = 1'000'000'007;

int main(void) {
    int N, M;
    cin >> N >> M;
    if(N > M) swap(N, M);

    if(N+1 < M) {
        cout << 0 << endl;
    } else {
        vector<int64_t> factrial(M+1);
        factrial[0] = 1;
        for(int i=1; i<=M; i++) {
            factrial[i] = (factrial[i-1] * i) % MOD;
        }
        int64_t ans = (factrial[N] * factrial[M]) % MOD;
        if(N == M) ans = (ans * 2) % MOD;
        cout << ans << endl;
    }
    return 0;
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll n,m;
  cin >> n >> m;
  if(n==m)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, m, k) = getLongs()
    val a = getLongs()
    val b = getLongs()

    var sum = 0L
    var i = 0
    while (i < a.size && sum + a[i] <= k) {
        sum += a[i]
        i++
    }

    var best = i
    var j = 0

    while (i >= 0) {
        while (j < b.size && sum + b[j] <= k) {
            sum += b[j]
            j++
        }

        best = Math.max(best, i + j)

        if (i == 0) break
        i--
        sum -= a[i]
    }
    println(best)
}

fun getInt() = readLine()!!.toInt()
fun getInts() = readLine()!!.split(" ").map { it.toInt() }
fun getLong() = readLine()!!.toLong()
fun getLongs() = readLine()!!.split(" ").map { it.toLong() }


Measured memory_bytes: 81820
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    if (a * b  % 2 == 0) {
      System.out.println("Even");
    } else {
      System.out.println("Odd"); 
    }
  }
}

Measured memory_bytes: 22740
#include <bits/stdc++.h> 
using namespace std; 
  
void sieve(int n) 
{ 
 
    bool prime[101005]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=101005; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=101005; i += p) 
                prime[i] = false; 
        } 
    } 
  	for(int i = n ; i < 101005 ; i++)
	{
		// cout << prim[i] << endl;
		if(prime[i]){ cout << i << endl; break;}
	}
    
} 
int main()
{
	int n;
	cin >> n;
	sieve(n);
}

Measured memory_bytes: 384
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
for i in range(H):
    S[i] = "."+S[i]+"."
S.insert(0,"."*(W+2))
S.append("."*(W+2))
flag = 0
for i in range(1,H+1):
    for j in range(1,W+1):
        if S[i][j]=="#" and S[i][j+1]=="." and S[i-1][j]=="." and S[i][j-1]=="." and S[i+1][j]==".":
            flag = 1
            break
    if flag==1:break
if flag==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 65220
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Point{

    final double x;
    final double y;

    Point( final double x, final double y ) {
	this.x = x;
	this.y = y;
    }    
}

class Main {

    public static void main( final String[] args ) {

	final Scanner stdin = new Scanner( System.in );

	ArrayList<Point> list = new ArrayList<Point>();
	
	while ( stdin.hasNextLine() ) {

	    String[] input = stdin.nextLine().split( "," );
	    final double x = Double.parseDouble( input[0] );
	    final double y = Double.parseDouble( input[1] );
	    list.add( new Point( x, y ) );
	}

	double ans = 0.0;
	for ( int i = 1; i < list.size() - 1; i++ ) {
	    final Point p1 = list.get( 0 );
	    final Point p2 = list.get( i );
	    final Point p3 = list.get( i + 1 );

	    final double d12 = dist( p1, p2 );
	    final double d23 = dist( p2, p3 );
	    final double d31 = dist( p3, p1 );
	    ans += area( d12, d23, d31 );
	}
	System.out.println( ans );
    }

    static double area( double d1, double d2, double d3 ) {
	final double s = ( d1 + d2 + d3 ) / 2.0;
	return sqrt( s * ( s - d1 ) * ( s - d2 ) * ( s - d3 ) );
    }

    static double dist( Point p1, Point p2 ) {
	return sqrt( pow( p1.x - p2.x, 2.0 ) + pow( p1.y - p2.y, 2.0 ) );
    }
}

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

int main(void){
	int n;
	bool f=false;
	while(cin>>n){
		if (f) cout<<endl;
		else f = true;
		int in[5];
		in[0] = n / 10000	% 10;
		in[1] = n / 1000	% 10;
		in[2] = n / 100		% 10;
		in[3] = n / 10	 	% 10;
		in[4] = n / 1 		% 10;
//		for(int i = 0 ;  i < 5 ; i ++)cout<<int(in[i])<<" ";
		for(int i = 0 ; i < 5 ; i ++)
			if(in[i]<5)cout<<"*";
			else cout<<" ";
		cout<<endl;
		for(int i = 0 ; i < 5 ; i ++)
			if(in[i]>=5){cout<<"*";in[i]-=5;}
			else cout<<" ";
		cout<<endl;
		
		for(int i = 0 ; i < 5 ; i ++)
			cout<<"=";
		cout<<endl;
		
		for(int i = 0 ; i < 5 ; i ++)
			if(in[i]==0)cout<<" ";
			else cout<<"*";
		cout<<endl;
		for(int i = 0 ; i < 5 ; i ++)
			if(in[i]==1)cout<<" ";
			else cout<<"*";
		cout<<endl;
		for(int i = 0 ; i < 5 ; i ++)
			if(in[i]==2)cout<<" ";
			else cout<<"*";
		cout<<endl;
		for(int i = 0 ; i < 5 ; i ++)
			if(in[i]==3)cout<<" ";
			else cout<<"*";
		cout<<endl;
		for(int i = 0 ; i < 5 ; i ++)
			if(in[i]==4)cout<<" ";
			else cout<<"*";
		cout<<endl;
	}
}

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

#if DEBUG && !ONLINE_JUDGE
  #include "header.h"
#else
  #define debug(args...)
#endif

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long lli;
typedef long double ld;

#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x).size()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(auto i=(a);i<b;i++)

#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007
void preprocess(void) {
  return;
}
string ar[850];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  preprocess();
  int H, W, K; cin>>H>>W>>K;
  int px = -1, py = -1;
  rep(i,1,H+1) {
    cin>>ar[i];
    ar[i] = "#" + ar[i];
    rep(j,1,W+1) {
      if(ar[i][j] == 'S') {
        px = i;
        py = j;
      }
    }
  }
  queue<ii> q;
  q.push({px, py});
  map<ii, int> dis, vis;
  dis[{px, py}] = 0;
  int ans = MOD;
  vector<ii> moves = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
  vis[{px, py}] = 1;
  while(!q.empty()) {
    ii a = q.front();
    debug(a);
    q.pop();
    debug(a);
    ans = min(ans, (min(min(a.fi - 1, -a.fi + H), min(a.se - 1, -a.se + W)) + K-1)/(K) + 1);
    debug(ans);
    if(dis[{a.fi, a.se}] == K) {
      continue;
    }
    for(auto x: moves) {
      ii y = {a.fi + x.fi, a.se + x.se};
      //debug(y);
      if(y.fi > H || y.fi < 0 || y.se > W || y.se < 0) continue;
      if(ar[y.fi][y.se] == '#') continue;
      if(!vis[y]) {
        vis[y] = 1;
        q.push({y.fi, y.se});
        if(dis[{y.fi, y.se}] != 0) dis[{y.fi, y.se}] = min(dis[{a.fi,a.se}] + 1, dis[{y.fi, y.se}]);
        else dis[{y.fi, y.se}] = dis[{a.fi, a.se}] + 1;
      }
    }
  }
  cout<<ans<<endl;
}



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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

const int INF=1e9;
const int MOD=1e9+7;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

int main()
{
	for(vs ss(8);cin>>ss[0];){
		repi(i,1,8) cin>>ss[i];
		
		map<string,int> f;
		rep(i,8) if(!f.count(ss[i])) f.insert(mp(ss[i],f.size()));
		
		vi a(8);
		rep(i,8) a[i]=f[ss[i]];
		sort(all(a));
		
		set<vi> res;
		do{
			vi b=a;
			rep(_,2){
				rep(_,4){
					b=min(b,vi({a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]}));
					b=min(b,vi({a[0],a[4],a[5],a[1],a[3],a[7],a[6],a[2]}));
					b=min(b,vi({a[0],a[3],a[7],a[4],a[1],a[2],a[6],a[5]}));
					rotate(0+begin(a),1+begin(a),4+begin(a));
					rotate(4+begin(a),5+begin(a),8+begin(a));
				}
				reverse(all(a));
			}
			res.insert(b);
		}while(next_permutation(all(a)));
		
		cout<<res.size()<<endl;
	}
}

Measured memory_bytes: 1404
x,y,z,k=map(int,input().split())
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
c=[int(x) for x in input().split()]

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

s=list()

for l in range(x):
  if l>k:
    break 
  for m in range(y):
    if l*m>k:
      break
    for n in range(z):
      if l*m*n>k:
        break
      s.append(a[l]+b[m]+c[n])
 
s.sort(reverse=True)
for i in range(k):
  print(s[i])


Measured memory_bytes: 112344
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,nn) for(int i=0;i<nn;i++)
#define MOD 1000000007
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}



struct four{
  int u,d,r,l;
};

int main(){
  int h,w;
  cin >> h >> w;
  string s[2010];
  FOR(i,h){
    cin >> s[i];
  }

  four n[2010][2010];
  FOR(i,h){
    FOR(j,w){
      if(s[i][j]=='#'){
        n[i][j].l=0;
      }else{
        if(j==0)n[i][j].l=1;
        else n[i][j].l=n[i][j-1].l+1;
      }
      if(s[i][w-j-1]=='#'){
        n[i][w-j-1].r=0;
      }else{
        if(j==0){
          n[i][w-j-1].r=1;
        }else{
          n[i][w-j-1].r=n[i][w-j].r+1;
        }
      }
      if(s[i][j]=='#'){
        n[i][j].u=0;
      }else{
        if(i==0){
          n[i][j].u=1;
        }else{
          n[i][j].u=n[i-1][j].u+1;
        }
      }

      if(s[h-i-1][j]=='#'){
        n[h-i-1][j].d=0;
      }else{
        if(i==0){
          n[h-i-1][j].d=1;
        }else{
          n[h-i-1][j].d=n[h-i][j].d+1;
        }
      }
      
    }
  }
  int ans=0;
  FOR(i,h){
    FOR(j,w){
      chmax(ans,max(1,n[i][j].l+n[i][j].r+n[i][j].u+n[i][j].d-3));
    }
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 67328
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int main() {
    long long n;
    cin >> n;
    long long ans = 0;
    vector<long long > a(n);
    rep(i,n) a.at(i) = i+1;
    rep(i,n){
        if(a.at(i) % 3 == 0|| a.at(i) % 5 == 0){
            continue;
        }
        else ans+=i+1;
    }
    cout << ans << endl;

}


Measured memory_bytes: 11080
#include<stdio.h>
int main(){
  int f[1000]={2,3};
  int n,m,i,j,c,r[1000],t;
  for(i=2;i<1000;i++)f[i]=(f[i-1]+f[i-2])%1001;
  while(scanf("%d %d",&n,&m)!=EOF){
    for(i=0;i<n;i++){
      r[i]=i;
      for(j=i;j;j--){
	if(f[r[j-1]]>f[r[j]]){
	  t=r[j-1];
	  r[j-1]=r[j];
	  r[j]=t;
	}
      }
    }
    for(i=c=1;i<n;i++){//printf("%d\n",f[r[i]]);
      if(f[r[i]]-f[r[i-1]]>=m)c++;
    }
    printf("%d\n",c);
  }
  return 0;
}

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

int main(void){
    ll L;
    int n;
    cin >> L >> n;
    vector<ll> xr(n+2),xl(n+2),sumr(n+2),suml(n+2);
    rep1(i,n) cin >> xr[i];
    xr[n+1] = L;
    rep(i,n+2) xl[n+1-i] = L - xr[i];
    rep1(i,n+1) {
        sumr[i] = sumr[i-1] + xr[i]*2;
        suml[i] = suml[i-1] + xl[i]*2;
    }
    ll res = 0;
    rep(r,n+1){
        int l = n - r;
        res = max({res,
            suml[l] - suml[max(l-r-1,0)] + sumr[r] - sumr[max(r-l,0)] - xl[l],
            sumr[r] - sumr[max(r-l-1,0)] + suml[l] - suml[max(l-r,0)] - xr[r]
        });
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 6528
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<stack>
using namespace std;
int dp[11000000];
int need1[50],need2[50];
int put[11000000],go[11000000][22];
int n,m,k;
int main()
{     int i,j,p,q,a,b,c;
      scanf("%d%d%d",&n,&m,&k);
      for(i=1;i<=k;i++){
      	scanf("%d%d%d",&a,&b,&c);
      	a--,b--;
      	need1[a]|=(1<<b);
      	need2[a]|=(1<<b)*c;
      }
      n--;
      //memset(go,-1,sizeof(go));
      memset(put,-1,sizeof(put));
      for(i=0;i<(1<<n);i++){
      	 for(j=0;j<n;j++)
      	    go[i][j]=-1;
      	 int num=0;
         for(j=0;j<n;j++)
            if(i&(1<<j)){
              if(j>0&&!(i&(1<<(j-1)))){
                go[i][num]=i^(1<<j)^(1<<(j-1));
              }
              num++;
            }
      }
      for(i=0;i<(1<<n);i++)
         for(j=n-1;j>=0;j--){
            if((i&(1<<j)))continue;
            put[i]=i^(1<<j);
            break;
		 }
      dp[0]=1;
      for(i=0;i<m;i++){
         for(j=0;j<(1<<n)-1;j++)
		    if(put[j]){
              dp[put[j]]+=dp[j];
              dp[put[j]]%=1000000007;
         }
         for(p=0;p<n;p++)
            for(j=(1<<n)-1;j>=0;j--)
			   if(go[j][p]!=-1){
                 dp[go[j][p]]+=dp[j],
                 dp[go[j][p]]%=1000000007;
               }
         for(j=0;j<(1<<n);j++)
            if((j&need1[i])!=need2[i])
              dp[j]=0;
      }
      int ans=0;
      for(i=0;i<(1<<n);i++)
         ans+=dp[i],
         ans%=1000000007;
      printf("%d\n",ans%1000000007);
	  return 0;
}


Measured memory_bytes: 94464
def main4():
    N = int(input())
    S = input()

    R = set()
    G = set()
    B = set()

    for i in range(len(S)):
        if   S[i] == "R":
            R.add(i)
        elif S[i] == "G":
            G.add(i)
        elif S[i] == "B":
            B.add(i)

    ans = 0
    for r in R:
        for g in G:
            a, b = sorted([r, g])
            tmp = len(B)

            if ((b + a) % 2 == 0) and ((b + a) // 2) in B:
                tmp -= 1

            if (2*a - b) in B:
                tmp -= 1

            if (2*b - a) in B:
                tmp -= 1

            ans += tmp
                
    print(ans)

if __name__ == "__main__":
    main4()

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int n;
    cin >> n;
    int ans = 1e9;

    int x[n];
    rep(i, n) cin >> x[i];

    for (int p = 1; p <= 100; p++)
    {
        int sum = 0;
        rep(i, n)
            sum += (x[i] - p) * (x[i] - p);

        ans = min(ans, sum);
    }

    OP(ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <functional>
#include <cmath>
#include <cstdint>
#include <mutex>
#include <thread>
#include <bitset>


using namespace std;



int main(void)
{
	long long x;
	cin >> x;

	vector<long long> n;
	
	for (int i = 0; pow(i, 5) < 9223372036854775807; i++)
	{
		n.push_back(i);
		n.push_back(-i);
	}

	for (int i = 0; i < 12418; i++)
	{
		for (int j = 0; j < 12418; j++)
		{
			if (i == j)
				continue;
			if (n[i] == n[j])
				continue;

			if (x == pow(n[i], 5.0) - pow(n[j], 5.0))
			{
				cout << n[i] << " " << n[j];
				return 0;
			}
		}
	}


	return 0;
}


Measured memory_bytes: 4364
/*
 * author :Sadik Hassan(_sad_)
 *
*/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include "bits/stdc++.h"
using namespace std;
using   ll =          long long;
using   ld =          long double;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define MP            make_pair
#define PI            (acos(-1.0))
#define rep1(i,n)     for(int i=1;i<=n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define SZ(s)         (int)s.size()
#define all(x)        (x).begin(), (x).end()
#define rall(x)       (x).rbegin(), (x).rend()
#define w(t)          int t;cin>>t;while(t--)
#define TSU(s)        transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSL(s)        transform(s.begin(),s.end(),s.begin(),::tolower);
#define _SAD()     	  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cout<<fixed<<setprecision(3);

typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = (int)2e5+5;
const ll MOD =(ll)1e9+7;
const ll INF = (ll)1e18+5;
const int nn=1e5+5;

int main()
{
    _SAD()
    int a,b,c;
    cin>>a>>b>>c;
    if(b*c>=a)cout<<"Yes"<<nl;
    else cout<<"No"<<nl;
    return 0;
}


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


int main(){
	int n,x,a,sum=0,cnt=1;
	cin >> n >> x;
	for(int i=0;i<n;i++){
		cin >> a;
		sum+=a;
		if(sum>x) break;
		cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <map>
using namespace std;

map<int, vector<int>> A;
int color[100001];

void assignColor(int u, int currentColor) {
    queue<int> Q;
    Q.push(u);
    color[u] = currentColor;
    int current;
    while(!Q.empty()) {
        current = Q.front();
        Q.pop();
        vector<int>::iterator it = A[current].begin();
        while(it != A[current].end()) {
            if (color[*it] == 0) {
                Q.push(*it);
                color[*it] = currentColor;
            }
            it++;
        }
    }
}

int main() {
    int n, m;
    cin >> n >> m;

    int u1, u2;
    for (int i = 0; i < m; i++) {
        cin >> u1 >> u2;
        A[u1].push_back(u2);
        A[u2].push_back(u1);
    }

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

    int c = 1;
    for (int i = 0; i < n; i++) {
        if (color[i] == 0) {
            assignColor(i, c);
            c++;
        }
    }

    int q, start, target;
    cin >> q;
    for (int i = 0; i < q; i++) {
        cin >> start >> target;

        if (color[start] == color[target]) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }
}



Measured memory_bytes: 14436
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin >> N >> M;
    vec<int> WA(N),AC(N);
    for(int i=0;i<M;i++){
        int p;
        string S;
        cin >> p >> S;
        p--;
        if(S=="WA"){
            if(!AC[p]) WA[p]++;
        }else{
            AC[p] = 1;
        }
    }
    int ac = 0,pe = 0;
    for(int i=0;i<N;i++){
        ac += AC[i];
        if(AC[i]) pe += WA[i];
    }
    cout << ac << " " << pe << endl;
}

Measured memory_bytes: 1024
N = int(input())

xyh = []
not_zero = -100
flag_zero = True

for i in range(N):
    x,y,h = map(int,input().split())
    if h > 0 and flag_zero:
        not_zero = i
        flag_zero = False
    xyh.append([x,y,h])

for i in range(101):
    for j in range(101):

        Cx = i
        Cy = j
        H = xyh[not_zero][2] + abs(Cx-xyh[not_zero][0]) + abs(Cy-xyh[not_zero][1])
        ans = True

        for x,y,h in xyh:
            tmp_h = h+abs(Cx-x)+abs(Cy-y)
            if h>0:
                if tmp_h != H:
                    ans = False
                    break
            else:
                if H - abs(Cx-x) -abs(Cy-y) > 0:
                    ans = False
                    break
            
        if ans:
            print(Cx,Cy,H)
            exit() 
            

Measured memory_bytes: 3064
H, W = map(int, input().split())
grid = []
for _ in range(H):
    grid.append([s for s in input()])
    
left = [[0 for _ in range(W)] for _ in range(H)]
right = [[0 for _ in range(W)] for _ in range(H)]
up = [[0 for _ in range(W)] for _ in range(H)]
down = [[0 for _ in range(W)] for _ in range(H)]

for h in range(H):
    for w in range(W):
        if grid[h][w] == ".":
            if w == 0:
                left[h][w] = 1
            else:
                left[h][w] += left[h][w - 1] + 1

for h in range(H):
    for w in range(W)[::-1]:
        if grid[h][w] == ".":
            if w == W - 1:
                right[h][w] = 1
            else:
                right[h][w] += right[h][w + 1] + 1
            
for w in range(W):
    for h in range(H):
        if grid[h][w] == ".":
            if h == 0:
                up[h][w] = 1
            else:
                up[h][w] += up[h - 1][w] + 1
                
for w in range(W):
    for h in range(H)[::-1]:
        if grid[h][w] == ".":
            if h == H - 1:
                down[h][w] = 1
            else:
                down[h][w] += down[h + 1][w] + 1
                
ans = -10000
for h in range(H):
    for w in range(W):
        ans = max(ans, up[h][w] + down[h][w] + right[h][w] + left[h][w] - 3)
print(ans)

Measured memory_bytes: 314632
#include"bits/stdc++.h"
using namespace std;
int main(){
	int n;
	cin>>n;
	string a,b;
	cin>>a>>b;
	int ans=0;
	for(int i=0;i!=n;++i){
		if(a.substr(i)==b.substr(0,n-i))
			ans=max(ans,n-i);
	}
	cout<<2*n-ans;
}


Measured memory_bytes: 256
def main():
    N,C=map(int,input().split())
    stc=[0]*N
    for i in range(N):
        abc=list(map(int,input().split()))
        stc[i]=abc

    a=[0]*(C+1)
    stc.sort(key=lambda x:(x[2],x[0]))
    c=1
    for i in range(N):
        while stc[i][2]!=c:
            c+=1
        if stc[i][2]==c:
            a[c]+=1
    for i in range(1,C+1):
        a[i]+=a[i-1]
    
    table=[0]*(2*10**5+2)
    for i in range(C):
        for j in range(a[i],a[i+1]):
            if j==a[i]:
                table[stc[j][0]*2-1]+=1
                table[stc[j][1]*2]-=1
            else:
                if stc[j-1][1]==stc[j][0]:
                    table[stc[j][0]*2]+=1
                    table[stc[j][1]*2]-=1
                else:
                    table[stc[j][0]*2-1]+=1
                    table[stc[j][1]*2]-=1                    
    M=0
    for i in range(len(table)):
        if 0<i:
            table[i]+=table[i-1]
    for i in range(len(table)):
        if M<table[i]:
            M=table[i]
    print(M)
if __name__=="__main__":
    main()

Measured memory_bytes: 35500
import java.util.Scanner

object Main {

  def solve2(N: Int, M: Int): (Int, Int) = {
    if (N < M)
      solve2(M, N)
    else if (M == 0)
      (N, 0)
    else {
      val ret = solve2(M, N % M)
      (ret._1, ret._2 + 1)
    }
  }

  def solve(sc: => Scanner): Unit = {
    val N, M = sc.nextInt
    if (N != 0 && M != 0) {
      val ans = solve2(N, M)
      println(ans._1 + " " + ans._2)
      solve(sc)
    }
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

Measured memory_bytes: 51556
#include <iostream>

using namespace std;

int main(){

    int n, k;
    cin >> n >> k;

    int res = 1;

    for (int i = 0; i < n; i++){
        if (res < k){
            res *= 2;
        } else {
            res += k;
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};
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;
    if(s=="ARC") cout << "ABC" << endl;
    else cout << "ARC" << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll x, ll y) {
	ll res = 1;
	for (ll i = 0; i < y; i++) res = res * x % mod;
	return res;
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

int main() {
	int x, y, z;
	cin >> x >> y >> z;
	swap(x, y);
	swap(x, z);
	cout << x << " " << y << " " << z << endl;
	return 0;
}

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


int main() {
  int N,M;
  cin >>N >> M;
  vector<bool> K(N,false);
  vector<int> A(N,0);
  int ac =0;
  int wa = 0;
  for(int i=0;i<M;i++){
   int  P;
    string S;
    cin >> P >>S;
    if(K[P] == false && S =="WA") A[P]++;
    else if(K[P] == false && S == "AC"){
     ac++;
      wa += A[P];
      K[P] = true;
    }
  }
  printf("%d %d",ac,wa);
}




Measured memory_bytes: 640
using System;
using System.Linq;

namespace abc100_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = (int)Math.Pow(100, x[0]);
            Console.WriteLine(x[1] == 100 ? n * (x[1] + 1) : n * x[1]);
        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define H_MAX 50
#define W_MAX 50

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

namespace patch {
  template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
}

int main() {
	int b[5];
	cin >> b[0] >> b[1] >> b[2] >> b[3] >> b[4];
	int check = 4;
	int min = 10;
	rep(i,5) {
		if(b[i] % 10 != 0){
			if(min > b[i] % 10) {
				check = i;
				min = b[i] % 10;
			}
		}
	}

	int ans = 0;

	rep(i,5) {
		int count = 0;
		if(i == check) continue;
		while(b[i] > 10) {
			b[i] -= 10;
			count++;
		}
		ans += count*10 + 10;
	}
	ans += b[check];

	cout << ans << endl;

  return 0;
}
 


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()


def main():
	n,k=MI()
	V=LI()

	ans=0

	for a in range(min(n+1,k+1)):
		for b in range(min(n-a+1,k-a+1)):
			S=[]
			S+=V[:a]
			S+=V[n-b:]
			S.sort()
			tmp=sum(S)
			cnt=max(0,k-a-b)
			for i in range(min(a+b,cnt)):

				if S[i]<0:
					tmp-=S[i]
				else:
					break
			ans=max(ans,tmp)
	print(ans)










if __name__ == "__main__":
	main()


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if(n == 2){
        long long a, b;
        cin >> a >> b;
        cout << (max(a, b) - min(a, b)) << endl;
        cout << max(a, b) << " " << min(a, b) << endl;
        return 0;
    }
    vector<long long> v(n);
    long long ans = 0;
    for(int i = 0; i < n; i++){
        cin >> v[i];
        ans += abs(v[i]);
    }
    sort(v.begin(), v.end());
    bool ex1 = false, ex2 = false;
    if(v[0] >= 0){
        ans -= abs(v[0]) + abs(v[1]);
        ans += abs(v[0] - v[1]);
        ex1 = true;
    }
    if(v[n-1] < 0){
        ans -= abs(v[n-1]) + abs(v[n-2]);
        ans += abs(v[n-1] - v[n-2]);
        ex2 = true;
    }
    cout << ans << endl;
    if(ex1){
        cout << v[0] << " " << v[1] << endl;
        v[0] -= v[1];
    }
    if(ex2){
        cout << v[n-1] << " " << v[n-2] << endl;
        v[n-1] -= v[n-2];
    }
    for(int i = 1; i < n-1; i++){
        if(ex1 && i == 1) continue;
        if(ex2 && i == n-2) continue; 
        if(v[i] < 0){
            cout << v[n-1] << " " << v[i] << endl;
            v[n-1] -= v[i];
        }
        else{
            cout << v[0] << " " << v[i] << endl;
            v[0] -= v[i];
        }
    }
    cout << v[n-1] << " " << v[0] << endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  if( N < 10 ){
    cout << N << endl;
  }else if( N < 100 && N >= 10 ){
    cout << 9 << endl;
  }else if( N < 1000 && N >= 100 ){
    cout << 9 + ( N - 99 ) << endl;
  }else if( N < 10000 && N >= 1000 ){
    cout << 909 << endl;
  }else if( N < 100000 && N >=10000 ){
    cout << 909 + ( N - 9999 ) << endl;
  }else if( N == 100000 ){
    cout << 90909 << endl;
  }
  
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
char ch;
int m,n;
scanf("%d\n",&n);
int card[4][13]={0};
for(int i=0; i<n; i++){
    scanf("%c %d\n",&ch,&m);
    if(ch=='S'){
        card[0][m-1]=m;
            }else if(ch=='H'){
                card[1][m-1]=m;
            }else if(ch=='C'){
                card[2][m-1]=m;
            }else{
                card[3][m-1]=m;
            }
}
for (int i=0; i<4; i++){
for (int j=0; j<13; j++){
    if(card[i][j]==0){
    if(i==0){
        printf("S %d\n",j+1);
    }else if(i==1){
        printf("H %d\n",j+1);
    }else if(i==2){
        printf("C %d\n",j+1);
    }else{
        printf("D %d\n",j+1);
    }
    }
    }
}
return 0;
}


Measured memory_bytes: 2104
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  long long a,b,k;
  cin >> a >> b >> k;

  if(a > k)
  {
    a -= k;
  }
  else
  {
    long long j = k - a;
    a = 0;
    if(b > j)
    {
      b -= j;
    }
    else
    {
      b = 0;
    }
  }
  
  cout << a << " " << b;
  

  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}

Measured memory_bytes: 256
#pragma comment(linker,"/stack:16777216")
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7fffffff
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define forr(a,n) for(int a=n;a>=1;a--)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define repr(a,n) for(int a=n-1;a>=0;a--)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0x3f,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

int main(int argc,char** argv){
	ll a,b,c;
	cin>>a>>b>>c;
	if(c-a-b<0){
		cout<<"No";return 0;
	}
	
	if(2ll*a*b<a*a+b*b+c*c-2ll*a*c-2ll*b*c)cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main()
{
  string s;
  cin >> s;
  vector<vector<long long>> dp(s.size()+1,vector<long long>(13, 0));
  long long i,j,k;
  vector<long long> up = {1,10,9,12,3,4};
  i = s.size()-1;
  if(s.at(i) != '?')
    {
      dp.at(1).at(s.at(i)-'0') = 1;
    }
  else
    {
      for(k = 0; k < 10; k++)
      {
        dp.at(1).at(k) = 1;
      }
    }
  long long count = 1;
  for(i = s.size()-2; i >= 0; i--)
  {
    if(s.at(i) != '?')
    {
      for(j = 0; j < 13; j++)
      {
        dp.at(s.size()-i).at((j+(s.at(i)-'0')*up.at(count%6))%13) += dp.at(s.size()-i-1).at(j);
      }
    }
    else
    {
      for(k = 0; k < 10; k++)
      {
        for(j = 0; j < 13; j++)
        {
          dp.at(s.size()-i).at((j+k*up.at(count%6))%13) += dp.at(s.size()-i-1).at(j);
        }
      }
    }
    for(j = 0; j < 13; j++)
    {
      dp.at(s.size()-i).at(j) %= 1000000007;
    }
    count++;
  }
  cout << dp.at(s.size()).at(5) << endl;
}

Measured memory_bytes: 13696
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e,n,ans = 0;
  string s,ss,sss;
  cin>>a;
  a%=10;
  if(a ==3){
    cout<<"bon"<<endl;
  }else if(a == 0||a==1||a==6||a==8){
    cout<<"pon"<<endl;
  }else cout<<"hon"<<endl;
  return 0;
}

Measured memory_bytes: 3652
def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    ans = 0
    MOD = 10**9+7
    for i in range(n):
        cnt = 0
        for j in range(i):
            if a[i] > a[j]:
                cnt += 1
        ans += cnt * ((k-1)*k//2) % MOD
        ans %= MOD
        cnt = 0
        for j in range(i+1, n):
            if a[i] > a[j]:
                cnt += 1
        ans += cnt * (k*(k+1)//2) % MOD
        ans %= MOD
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
n=int(input())
num_list=[]
top1=0
top2=0
for i in range(n):
    num_list.append(int(input()))
    if top1<num_list[i]:
        top1=num_list[i]
    elif top2<num_list[i]:
        top2=num_list[i]
for j in range(n):
    if num_list[j]==top1:
        print(top2)
    else:
        print(top1)


Measured memory_bytes: 12512
import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n;
        n = input.nextInt();
        int[][][] cube = new int[4][3][10];
        int b,f,r,v;
        for (int i = 0; i < n; i++){
            b = input.nextInt() - 1;
            f = input.nextInt() - 1;
            r = input.nextInt() - 1;
            v = input.nextInt();
            cube[b][f][r] += v;
        }
        for (int i = 0; i < 4; i++){
            for (int j = 0; j < 3; j++){
                for (int k = 0; k < 10; k++){
                    System.out.printf(" %d",cube[i][j][k]);
                }
                System.out.printf("\n");
            }
            if (i != 3){
                System.out.println("####################");
            }
        }
    }
}


Measured memory_bytes: 29944
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<stdio.h>

using namespace std;

int ans, Jcou, Ocou, Icou;
char letter, target='A';


int main(){

	while(1){
		scanf("%c", &letter);
		if(letter == '\n'){break;}

		if(target == 'A' && letter == 'J'){
			Jcou = 1;
			Ocou = 0;
			Icou = 0;
			target = 'J';
		}

		else if(target == 'J'){
			if(letter == 'J'){
				Jcou++;
			}
			else if(letter == 'O'){
				Ocou++;
				target = 'O';
			}
			else if(letter == 'I'){
				target = 'A';
			}
		}

		else if(target == 'O'){
			if(letter == 'J'){
				target = 'J';
				Jcou = 1;
				Ocou = 0;
				Icou = 0;
			}
			else if(letter == 'O'){
				Ocou++;
			}
			else if(letter == 'I'){
				if(Jcou < Ocou){
					target = 'A';
				}
				else{
					target = 'I';
					Icou++;
					if(Ocou == Icou){
						ans = max(ans, Icou);
						target = 'A';
					}
				}
			}
		}

		else if(target == 'I'){
			if(letter == 'J'){
				if(Ocou<=Icou){
					ans = max(ans, Ocou);
					target = 'J';
					Jcou = 1;
					Ocou = 0;
					Icou = 0;
				}
				else{
					target = 'J';
					Jcou = 1;
					Ocou = 0;
					Icou = 0;
				}
			}
			else if(letter == 'O'){
				if(Ocou <= Icou){
					ans = max(ans, Ocou);
					target = 'A';
				}
				else{
					target = 'A';
				}
			}
			else if(letter == 'I'){
//				cout << "I in" << endl;
				Icou++;
				if(Ocou==Icou){
					ans = max(ans, Icou);
					target = 'A';
				}
			}
		}

//		cout << Jcou << " " << Ocou << " " << Icou << " " << endl;

	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1156
#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, t;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    string u;
    cin >> u;
    if (u == s) a--;
    else b--;
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
//参考 :https://www.hamayanhamayan.com/entry/2017/12/04/034531
#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()
#define print(x)        cout << (x) << endl
#define printa(x)       REP(i, x.size()) cout << x[i] << endl
typedef pair<ll, ll>    P;

int imos[30][100005];

int main() {
    int n, c;
    cin >> n >> c;


    REP(i, n) {
        int x, y, z;
        cin >> x >> y >> z;
        x--, z--;
        imos[z][x]++;
        imos[z][y]--;
    }

    REP(i, c) REPN(j, 1, 100005) imos[i][j] += imos[i][j-1];
    REP(i, c) REP(j, 100005) if(imos[i][j] >= 2) imos[i][j] = 1;

    int ans = 0;
    REP(i, 100005) {
        int tmp = 0;
        REP(j, c) tmp += imos[j][i];
        ans = max(ans, tmp);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 11904
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i

ans = 0
(0..a).each do |i|
    (0..b).each do |j|
        (0..c).each do |k|
            if (i*500 + j*100 + k*50) == x
                ans = ans + 1
                break
            end
        end
    end
end
puts ans

Measured memory_bytes: 1788
#include <iostream>
#include <iomanip>
#include <cmath>
int main() {
    unsigned long long n, k; std::cin >> n >> k;
    double d = 0.0;
    for (unsigned long long i = 1; i <= n; i++) {
        unsigned long long s = i;
        int c = 0;
        while (s < k) {
            s*=2;
            c++;
        }
        d += 1.0 / std::pow(2, c) / n;
    }

    std::cout << std::fixed << std::setprecision(15) << d << std::endl;
    return 0;
}

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

int n;

bool is_prime(int n) {
    if (n == 2) return true;
    
    if (n < 2 || n % 2 == 0) return false;
    
    int i = 3;
    while (i <= sqrt(n)) {
        if (n % i == 0) return false;
        i += 2;
    }
    
    return true;
}

int main() {
    cin >> n;
    int prime_cnt = 0;
    for (int i = 0; i < n; i++) {
        int num; cin >> num;
        if (is_prime(num)) prime_cnt++;
    }
    
    cout << prime_cnt << endl;
    
    return 0;
}


Measured memory_bytes: 3088
#include<algorithm>
#include<array>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<iso646.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>

#define FOR(counter,initial_value,condition) for(int counter = initial_value; counter < condition;counter++)

int main()
{
	int a, b;
	std::cin >> a >> b;
	if (a + b >= 10) std::cout << "error" << std::endl;
	else std::cout << a + b << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//????????????????????????????????????
void Check(const string& str){
  string strparent=str;
  int gap=1;
  while(strparent.find("the")==(string::npos)&&
        strparent.find("this")==(string::npos)&&
        strparent.find("that")==(string::npos)){
    for(int i=0;i<str.length();i++){
      if(!isalpha(str[i]))continue;//" "
      //strparent[i]=(gap+str[i]-'a')%26+'a';
      strparent[i]=(gap+str[i])%26+'a';
    }
    gap++;
  }
  cout<<strparent<<endl;
}

int main(){
  string str;
  while(getline(cin,str)){
    Check(str);
  }
}

Measured memory_bytes: 3184
// use procontools::prelude::*;
use proconio::input;
macro_rules! p {
    ($x:expr) => {
        println!("{}", $x);
    };
}

fn main() {
    input! {
        a:u64,b:u64,n:u64
    }
    let x = (b - 1).min(n);
    p!(a * x / b);
}


Measured memory_bytes: 2116