akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
vector<int> f(30);
bool kyotu(int a,int b){
  int check =0;
  for(int i=a;i<b-1;i++){
    if(f[i-1]==f[i]) check++;
  }
  if(check == b-a-1) return true;
  return false;
}
bool cubecheck(){
  if(kyotu(1,9)&&kyotu(10,12)&&kyotu(13,15)&&kyotu(16,18)&&kyotu(19,21)&&kyotu(22,30)){
    return true;
  }else{
    return false;
  }
}
void fr(){
  swap(f[13-1],f[18-1]);
  swap(f[9-1],f[24-1]);
  swap(f[7-1],f[22-1]);
  swap(f[8-1],f[23-1]);
  swap(f[10-1],f[12-1]);
}
void ri(){
  swap(f[13-1],f[15-1]);
  swap(f[3-1],f[22-1]);
  swap(f[6-1],f[25-1]);
  swap(f[9-1],f[28-1]);
  swap(f[12-1],f[19-1]);
}

void le(){
  swap(f[1-1],f[24-1]);
  swap(f[4-1],f[27-1]);
  swap(f[7-1],f[30-1]);
  swap(f[10-1],f[21-1]);
  swap(f[16-1],f[18-1]);
}

void ba(){
  swap(f[1-1],f[28-1]);
  swap(f[2-1],f[29-1]);
  swap(f[3-1],f[30-1]);
  swap(f[15-1],f[16-1]);
  swap(f[19-1],f[21-1]);
}
int main(){
  int n;
  cin >> n;
  int q_size;
  for(int j=0;j<n;j++){
   queue< vector<int> > q;
   for(int i=0;i<30;i++){
     cin >>f[i];
   }
   q.push(f);

   for(int l=0;l<8;l++){
     q_size=q.size();

     for(int k=0;k<q_size;k++){
       for(int i=0;i<30;i++){
         f[i]=q.front()[i];
       }
       if(cubecheck()){
         cout << l <<endl;
         break;
       }
       fr();
       q.push(f);
       fr();
       ri();
       q.push(f);
       ri();
       le();
       q.push(f);
       le();
       ba();
       q.push(f);
       ba();
       q.pop();
    }
    if(cubecheck()){
      break;
    }
   }
   if(cubecheck()==0){
     cout << 8 <<endl;
   }
 }
 return 0;
}



Measured memory_bytes: 12688
import sys

input=sys.stdin.readline

H,W,K=map(int,input().rstrip().split())
x1,y1,x2,y2=map(int,input().split())
c=[input().rstrip() for i in range(H)]
s=W*(x1-1)+y1-1
g=W*(x2-1)+y2-1

import heapq
que = []
d = [float("inf")] * (4*H*W)
d[4*s] = 0
heapq.heapify(que)
heapq.heappush(que, (0, 4*s))

while len(que) != 0:
    cost, v = heapq.heappop(que)
    if d[v] < cost: continue

    for j in range(4):
        nv=v-v%4+(v%4+j)%4
        if d[nv]>d[v]-d[v]%K+K*(d[v]%K>0):
            d[nv]=d[v]-d[v]%K+K*(d[v]%K>0)
            heapq.heappush(que,(d[nv],nv))

    i=v//4
    h,w=i//W,i%W
    if v%4==0:
        if h!=0 and c[h-1][w]==".":
            if d[v-4*W]>d[v]+1:
                d[v-4*W]=d[v]+1
                heapq.heappush(que,(d[v-4*W],v-4*W))
    elif v%4==2:
        if h!=H-1 and c[h+1][w]==".":
            if d[v+4*W]>d[v]+1:
                d[v+4*W]=d[v]+1
                heapq.heappush(que,(d[v+4*W],v+4*W))
    elif v%4==1:
        if w!=W-1 and c[h][w+1]==".":
            if d[v+4]>d[v]+1:
                d[v+4]=d[v]+1
                heapq.heappush(que,(d[v+4],v+4))
    else:
        if w!=0 and c[h][w-1]==".":
            if d[v-4]>d[v]+1:
                d[v-4]=d[v]+1
                heapq.heappush(que,(d[v-4],v-4))

ans=d[4*g]
if ans>=10**15:
    print(-1)
else:
    print(ans//K+(ans%K>0))

Measured memory_bytes: 221336
import sys
H, W = map(int, input().split())
s = [input() + "." for _ in range(H)]
s.append("." * W)
d = ((0, 1), (1, 0), (0, -1), (-1, 0))

for h in range(H):
    for w in range(W):
        if s[h][w] == "#":
            if all([s[h + dh][w + dw] == "." for dh, dw in d]):
                print("No")
                sys.exit()
print("Yes")


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/14  Problem: 054_abc_c / Link: https://abc054.contest.atcoder.jp/tasks/abc054_c?lang=en ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N,M;

LL ans = 0LL;

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

	cin >> N>>M;
	VVI G(N, VI(N,0));
	FOR(i, 0, M) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		G[a][b] = 1;
		G[b][a] = 1;
	}
	VI root;
	FOR(i, 1, N)root.push_back(i);

	do	{
		int pos = 0;
		int ok = 1;
		FOR(i,0,SZ(root)) {
			if (G[pos][root[i]]) {
				pos = root[i];
			}
			else {
				ok = 0;
				break;
			}
		}
		if (ok)ans++;


	} while (next_permutation(ALL(root)));

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

void solver(ll x, ll k, ll d) {
  x = abs(x);
  ll c = x / d + (x%d > 0);

  if (k < c) {
    COUT(x - k*d);
    return;
  }

  // if x <= k*d
  if ( (k-c) % 2 == 0 ) {
    COUT( abs(x- d*c) );
  } else {
    COUT( abs(x- d*(c-1)) );
  }

  return;
}

int main() {
  IOS;
  ll x,k,d;
  cin >> x >> k >> d;
  solver(x,k,d);

  return 0;
}

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

#include <assert.h>    // LON
#include <math.h>    // sqrt()


using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;


int main() {

    ll n;
    cin >> n;

    ll b4 = 0;
    ll b2 = 0;
    ll k = 0;
    rep(i, n) {
        ll a;
        cin >> a;
        if (a % 4 == 0) {
            b4++;
        } else if (a % 2 == 0) {
            b2++;
        } else {
            k++;
        }
    }

    ll b4_r = b4 + 1;
    ll k_r = k - b4;
    if (b4_r < k) {
        cout << "No" << endl;
        return 0;
    }

    b4_r -= k;


    if (b2 == 1 && b4_r == 0) {
        cout << "No" << endl;
        return 0;
    }

    if (k_r > 0 && b2 > 0) {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    int main()
    {
    ll n,a,b;
    cin>>a>>b;
    ll cnt = 0;
    ll x =a;
    for( int i = 1 ; i <= 10000 ; i++)
    {
     
     x = a*pow(2,i-1);
    if(x<=b) cnt++;
    else break;
    }
    cout<<cnt;
    return 0;
    }

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

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

    int n; cin >> n;
    std::vector<int> b(n-1); rep(i,n-1) cin >> b[i];

    int val = 0;

    rep(i,n){
        if(i==0) val += b[0];
        else if(i==n-1) val += b[n-2]; 
        else {
            val+=min(b[i-1],b[i]);
        }
    }
    cout << val << endl;


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void){
    long long int n,sum;
    long int i,j;
    int DB[1000000];
    // Your code here!
    scanf("%lld",&n);
    //printf("%lld",n);
    sum = 1;
    for(i=2;i<=((n));i++){
    //for(i=2;i<=(sqrt(n));i++){
        for(j=2;j<=(n/i);j++){
            //printf("add %ld %ld \n",i,j);
            sum = sum + i*j;
        }
    }
    sum = sum + (2 + n)*(n-1);
    
    printf("%lld",sum);
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
int x;
int main(){
	cin>>x;
	int i;
	ll sum=0;
	for(i=1;i<1e9;i++){
		sum+=i;
		if(sum>=x){
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
double eps=1e-10;
  
struct C{
  P p;
  double r;
  C(P p,double r=1):p(p),r(r){}
};
  
int getState(C a,C b){
  double dist=abs(a.p-b.p);
  if(dist>a.r+b.r+eps)return 4;
  if(dist>a.r+b.r-eps)return 3;
  if(dist>abs(a.r-b.r)+eps)return 2;
  if(dist>abs(a.r-b.r)-eps)return 1;
  return 0;
}
  
int main(){
  double ax,ay,ar,bx,by,br;
  cin>>ax>>ay>>ar>>bx>>by>>br;
  cout<<getState(C(P(ax,ay),ar),C(P(bx,by),br))<<endl;
  return 0;
}

Measured memory_bytes: 3280
N,Y=map(int,input().split())
answer=(-1,-1,-1)
for x in range(N+1):
    for y in range(N-x+1):
        z=N-x-y
        if 0<=z<=2000 and 10000*x+5000*y+1000*z==Y:
            answer=(x,y,z)
            break
    else:
        continue
    break
print(*answer)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001; // > 10^9
const int MOD = (int)1e9 + 7;
const ll INFLL = 1001001001001001001;  // > 10^18
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {
    
    ll n; cin >>n;
    vector<ll> l(n); rep(i,n) cin >> l[i];

    sort(l.begin(), l.end());

    ll ans = 0;
    for (ll a = 0; a < n; a++) {
        for (ll b = a + 1; b < n; b++) {
            ll ok1 = n;
            ll ng1 = b;
            while (abs(ok1-ng1)>1) {
                ll mid1 = (ok1+ng1)/2;
                if (max(l[a]-l[b], l[b]-l[a]) < l[mid1]) {
                    ok1 = mid1;
                } else {
                    ng1 = mid1;
                } 
            }
            ll ok2 = b;
            ll ng2 = n;
            while (abs(ok2-ng2)>1) {
                ll mid2 = (ok2+ng2)/2;
                if (l[a]+l[b] > l[mid2]) {
                    ok2 = mid2;
                } else {
                    ng2 = mid2;
                } 
            }
            if (ok2 > b && ok1 < n && ok2 >= ok1) {
                ans += (ok2 - ok1 + 1);
            } 
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

}

use input::*;

fn main() {
    let n: usize;
    input!(n);
    let mut v1 = Vec::new();
    let mut v2 = vec![Vec::new(); 2];
    //let mut graph=HashMap::new();
    v1.push(str2vec(&input_line_str()));
    v1.push(str2vec(&input_line_str()));

    v2[0].push(v1[0][0]);
    v2[1].push(v1[1][0]);
    let mut prev0 = v2[0][0];
    let mut prev1 = v2[1][0];

    for z in 1..n {
        if prev0 != v1[0][z] && prev1 != v1[1][z] {
            v2[0].push(v1[0][z]);
            v2[1].push(v1[1][z]);
        }
        prev0 = v1[0][z];
        prev1 = v1[1][z];
    }

    let mut ans;
    let mut prev0 = v2[0][0];
    let mut prev1 = v2[1][0];
    if prev0 == prev1 {
        ans = 3_usize;
    } else {
        ans = 6;
    }
    for z in 1..v2[0].len() {
        if prev0 != prev1 && v2[0][z] != v2[1][z] {
            ans *= 3;
            ans %= 1_000_000_007;
        } else if !(prev0 != prev1 && v2[0][z] == v2[1][z]) {
            ans *= 2;
            ans %= 1_000_000_007;
        }

        prev0 = v2[0][z];
        prev1 = v2[1][z];
    }
    p(ans);
}

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

int main(){
  while(1){
	int H,W;
	cin >> H >> W;
	if(H==0 && W==0) break;
	
	for(int i=0; i<H; i++){
	  for(int j=0; j<W; j++){
	    if(i==0 || i==H-1 || j==0 || j==W-1) cout<<"#";
	    else cout <<".";
	  }
	  cout << endl;
	}
	cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3012
import java.util.*
import kotlin.math.floor

val sc = Scanner(System.`in`)

fun main(args: Array<String>) {

    val A = sc.nextLong().toDouble()
    val B = sc.nextLong().toDouble()
    val N = sc.nextLong().toDouble()

    val x = if(N < B - 1) N else B - 1
    val ans = floor(A * x / B) - A * floor(x / B)
    println(ans.toInt())
}



Measured memory_bytes: 36512
#include <iostream>

using namespace std;

int main()
{
    int a,b,x,sum;
    cin>>a>>b;
    sum=a+b;
    if(sum%2==0)
    {
        cout<<sum/2;
    }
    else if(sum%2!=0)
    {
        x=a+b+1;
        cout<<x/2;
    }
}

Measured memory_bytes: 3604
import java.util.*;

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

		List<Integer> list = new ArrayList<Integer>();
		list.add(Integer.parseInt(nums[0]));
		list.add(Integer.parseInt(nums[1]));
		list.add(Integer.parseInt(nums[2]));

		Collections.sort(list);
		StringBuilder sb = new StringBuilder();
		int size = list.size();
		int i = 0;
		while(true){
			sb.append(list.remove(0));
			i++;
			if(i == size) break;
			sb.append(" ");
		}
		
		System.out.println(sb);
	}
}

Measured memory_bytes: 17272
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define Rep(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SMALLPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const int inf=1000000007;
const int mod=1000000007;
void chmin(auto &a,auto b){if(b<a)a=b;}
void chmax(auto &a,auto b){if(a<b)a=b;}
int main(){
  string s;cin>>s;
  int n=s.size();
  vi bdp(13);
  if(s[0]=='?')rep(i,10)bdp[i]++;
  else bdp[s[0]-'0']++;
  Rep(i,1,n){
    vi dp(13);
    if(s[i]=='?'){
      rep(j,13){
        rep(k,10){
          dp[(j*10+k)%13]+=bdp[j];
          dp[(j*10+k)%13]%=mod;
        }
      }
    }
    else{
      rep(j,13){
        dp[((s[i]-'0'+10*j))%13]+=bdp[j];
        dp[((s[i]-'0'+10*j))%13]%=mod;
      }
    }
    bdp=dp;
  }
  cout<<(bdp[5])%mod<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int mod=1000000007;
int main()
{
	int n,i;
	cin>>n;
	int a[n],b[n],c[n],dp[n][3];
	for(i=0;i<n;i++)
	cin>>a[i]>>b[i]>>c[i];
	dp[0][0]=a[0],dp[0][1]=b[0],dp[0][2]=c[0];
	for(i=1;i<n;i++)
	{
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	return 0;
}

Measured memory_bytes: 2560
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
char s[200002],t[200002];
map<char,char>ms,mt;
int main()
{
	scanf("%s%s",s,t);
	int len=strlen(s);
	for(int i=0;i<len;i++)
		if(ms[s[i]]&&ms[s[i]]!=t[i])
		{
			printf("No");
			return 0;
		}
		else	if(mt[t[i]]&&mt[t[i]]!=s[i])
				{
					printf("No");
					return 0;
				}
				else	if(!ms[s[i]]&&!mt[t[i]])
				{
					ms[s[i]]=t[i];
					mt[t[i]]=s[i];
				}
	printf("Yes");
}

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

int main() {
	string s;
	cin >> s;
	vector<string> v = {"Sunny", "Cloudy", "Rainy"};

	if (s == v[0]) cout << v[1] << endl;
	if (s == v[1]) cout << v[2] << endl;
	if (s == v[2]) cout << v[0] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    ll dp[n][k+1];
    for(int x = 0; x <= a[0]; ++x)
        dp[0][x] = 1;
    for (int x = a[0] + 1; x <= k; ++x)
        dp[0][x] = 0;
    for (int i = 1; i < n; ++i) {
        dp[i][0] = dp[i-1][0];
        for (int x = 1; x <= k; x++)
            dp[i][x] = ((dp[i][x-1] + dp[i-1][x])%mod- (x-a[i]-1>=0?dp[i-1][x-a[i]-1]:0))%mod;
    }
    cout << (dp[n-1][k] + mod) % mod;
    return 0;
}


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


int main() {
  int L;
  cin >> L;
  printf("%.10f\n", (double)L * L * L / 27);
  return 0;
}


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

int main() {
  string s;
  cin >> s;
  bool a = true;
  for(int i=0; i<s.size(); i++){
    if(s[i]=='R'){
      if(i%2==1){
        a = false;
      }
    }
    if(s[i]=='L'){
      if(i%2==0){
        a = false;
      }
    }
  }
  
  if(a == true)cout <<"Yes" <<endl;
  else cout << "No"<< endl;
}

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

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

fn main() {
    let n = read::<usize>();
    if n == 1 {
        println!("Hello World");
    } else {
        let a = read::<usize>();
        let b = read::<usize>();
        println!("{}", a + b);
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n;
    cin>>n;
    if(n<1000)
        cout<<1000-n<<endl;
    else
    {
        int mod =n%1000;
        if(mod==0)
            cout<<0<<endl;
        else
            cout<<1000-mod<<endl;
    }

    return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>
#include <math.h>
#define N 500001

typedef struct{
  double x;
  double y;
}P;


void kock(int n,P p1,P p2){
  P s,u,t;
  if(n==0)return;
  s.x=(2*p1.x+1*p2.x)/3;
  s.y=(2*p1.y+1*p2.y)/3;
  t.x=(2*p2.x+1*p1.x)/3;
  t.y=(2*p2.y+1*p1.y)/3;
  u.x=(t.x-s.x)*cos(M_PI/3)-(t.y-s.y)*sin(M_PI/3)+s.x;
  u.y=(t.x-s.x)*sin(M_PI/3)+(t.y-s.y)*cos(M_PI/3)+s.y;

  kock(n-1,p1,s);
  printf("%lf %lf\n",s.x,s.y);
  kock(n-1,s,u);
  printf("%lf %lf\n",u.x,u.y);
  kock(n-1,u,t);
  printf("%lf %lf\n",t.x,t.y);
  kock(n-1,t,p2);
}


int main(){
  int n,i;
  P p1={0,0},p2={100,0};

  scanf("%d",&n);
  printf("%lf %lf\n",p1.x,p1.y);
  kock(n,p1,p2);
  printf("%lf %lf\n",p2.x,p2.y);
  return 0;
}



Measured memory_bytes: 2108
n=int(input())
a=0
b=0
l=[]
for i in range(n):
  c=int(input())
  l.append(c)
a=max(l)
L=sorted(l)
b=L[-2]
for i in range(n):
  if l[i]==a:
    print(b)
  else:
    print(a)

Measured memory_bytes: 19104
#include<iostream>
#include<string>
using namespace std;
int x[1000000];
int Gcd(int a, int b)
{
    if(b == 0)
    return a;
    return Gcd(b, a % b);
}
int abs(int a)
{
	if(a<=0)
	return -a;
	else
	return a;
}
int main()
{
	int m,n;
	cin>>m>>n;
	for(int i=1;i<=m;i++)
	cin>>x[i];
	int o=abs(x[1]-n);
	int ans=o;
	for(int i=2;i<=m;i++)
	{
		int o=abs(x[i]-n);
		ans=Gcd(ans,o);
		
	}
	cout<<ans;
 } 

Measured memory_bytes: 640
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

using ll = long long;
using ull = unsigned long long;

int main() {
    int h, n, a, sum = 0;
    cin >> h >> n;
    while (n--) {
        cin >> a;
        sum += a;
    }
    if (sum >= h)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>

using namespace std;

const int mod = 1000000007;

class inverse {
    public:
    inverse(int n, int mod);
    ~inverse();
    long long get_inv(int x);
    long long get_fact(int x);
    long long get_invfact(int x);
    long long get_comb(int x, int y);
    
    private:
    int mod;
    long long* inv;
    long long* fact;
    long long* invfact;
};

inverse::inverse(int n, int mod) : mod(mod) {
    inv = (long long *)malloc(sizeof(long long) * (n + 1));
    fact = (long long *)malloc(sizeof(long long) * (n + 1));
    invfact = (long long *)malloc(sizeof(long long) * (n + 1));
    inv[1] = 1;
    for (int i = 2; i <= n; i++) inv[i] = inv[mod % i] * (mod - mod / i) % mod;
    fact[0] = invfact[0] = 1;
    for (int i = 1; i <= n; i++) fact[i] = fact[i - 1] * i % mod;
    for (int i = 1; i <= n; i++) invfact[i] = invfact[i - 1] * inv[i] % mod;
}

inverse::~inverse() {
    free(inv);
    free(fact);
    free(invfact);
}

long long inverse::get_inv(int x) {
    return inv[x];
}

long long inverse::get_fact(int x) {
    return fact[x];
}

long long inverse::get_invfact(int x) {
    return invfact[x];
}

long long inverse::get_comb(int x, int y) {
    return fact[x] * invfact[y] % mod * invfact[x - y] % mod;
}

int main() {
    int h, w, k, i;
    long long ans = 0;
    
    scanf("%d %d %d", &h, &w, &k);
    
    inverse inv(h + w, mod);
    
    for (i = 1; i <= k; i++) {
        ans += k - i + 1;
        ans += (long long)h * w * 2 % mod * (i - 1) % mod * inv.get_inv(h + w) % mod * inv.get_inv(h + w - 1) % mod * (k - i + 1) % mod;
    }
    
    ans += k;
    ans %= mod;
    ans = ans * inv.get_fact(h + w) % mod * inv.get_invfact(h + w - k) % mod;
    
    printf("%lld\n", ans);
    
    return 0;
}


Measured memory_bytes: 468992
#include<iostream>
#include<string>
#include<map>
using namespace std;

int main() {
    string s;
    cin >> s;
    if (s == "keyence") {
        cout << "YES" << endl;
        return 0;
    }
    for (int i = 1; i <= s.length(); i++) {
        for (int j = 0; j < s.length() - i; j++) {
            //cout << s.substr(0, i) << ' ' << s.substr(i, j) <<  ' ' << s.substr(i + j, s.length() - i - j) << endl;
            if (s.substr(0, i) + s.substr(i + j, s.length() - i - j) == "keyence") {
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
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()
{
    int K, N;
    cin >> N >> K;
    map<int, int>d;
    for (int i=0; i<N; i++) {
        int n;
        cin >> n;
        if (d.count(n) > 0) {
            d[n] = d[n] + 1;
        } else {
            d[n] = 1;
        }
    }

    vector<int> vec;
    for (auto a : d) {
        vec.emplace_back(a.second);
    }

    sort(vec.begin(), vec.end());
    int size_ = vec.size();
    int m = max(size_ - K, 0);
    int sousa = 0;
    for (int i=0; i<m; i++) {
        sousa += vec[i];
    }

    cout << sousa << endl;
    return 0;
}

Measured memory_bytes: 13616
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	int n;
	cin>>n;
	int a[n],b[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	b[0] = 0,b[1] = abs(a[0]-a[1]);
	for(int i = 2;i<n;i++)
		b[i] = min(b[i-1]+abs(a[i]-a[i-1]),b[i-2]+abs(a[i]-a[i-2]));
	cout<<b[n-1]<<endl;
		
	
    return 0;
}


Measured memory_bytes: 4320
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int n;
    string s;
    cin >> n >> s;
    int cnt = 0;
    rep(i,s.size()-2){
        if(s.substr(i,3) == "ABC")cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
// const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int a, b;
    string op;
    cin >> a;
    cin >> op;
    cin >> b;
    if(op == "+"){
        cout << a + b << endl;
    }
    else if(op == "-"){
        cout << a - b << endl;
    }
    return 0;
}

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

#define int long long
const int N=200000;
int n;
int a[N+1];
int buc[N+1];

signed main()
{
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i],buc[a[i]]++;
	int ans=0;
	for(int i=1;i<=n;i++)ans+=buc[i]*(buc[i]-1)/2; 
	for(int i=1;i<=n;i++)cout<<ans-(buc[a[i]]-1)<<"\n";
	return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    int N;
    std::cin >> N;
    if (N % 2 == 0) {
        N = N / 2;
    } else {
        N = (N + 1) / 2;
    }
    std::cout << N << std::endl;
    return 0;
}

Measured memory_bytes: 256
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int main() {
    int k,s;
    cin >> k >> s;

    ll ans = 0;

    rep(i, k+1) {
        rep(j, k+1) {
            int z = s-i-j;
            if(z>=0 && z<=k) ans++;
        }
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long maxn=1e5+5;
const long long inf=0x3f3f3f3f;
vector<long long> p(maxn),c(maxn);
vector<long long> s;
long long tot=0;
void dfs(long long x,long long ed)
{
	x=p[x];
	s.push_back(c[x]);
	tot+=c[x];
	if(x==ed)
		return ;
	dfs(x,ed);
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    long long n,k;
    cin>>n>>k;
    for(long long i=0;i<n;i++)
    {
    	cin>>p[i];
    	--p[i];
	}
	for(long long i=0;i<n;i++)
		cin>>c[i];
	long long ans=-inf;
	for(long long si=0;si<n;si++)
	{
		long long x=si;
		s.clear();
		tot=0;
		dfs(x,si);
		long long l=s.size();
		long long t=0;
		for(long long i=0;i<l;i++)
		{
			t+=s[i];
			if(i+1>k)
				break;
			long long now=t;
			if(tot>=0)
			{
				long long e=(k-(i+1))/l;
				now+=tot*e;
			}
			if(ans<now)
				ans=now;
		}
	}
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5012
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`

					`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	n := nextInt()
	m := nextInt()

	r := map[int][]int{}
	for i := 0; i < m; i++ {
		a := nextInt() - 1
		b := nextInt() - 1

		if val, ok := r[a]; ok {
			r[a] = append(val, b)
		} else {
			r[a] = []int{b}
		}
		if val, ok := r[b]; ok {
			r[b] = append(val, a)
		} else {
			r[b] = []int{a}
		}
	}

	p := 0
	sign := make([]int, n)
	sign[0] = -1
	que := [][]int{}
	for i := 0; i < len(r[p]); i++ {
		que = append(que, []int{p, r[p][i]})
	}
	count := 0

	for {
		pop := que[0]
		que = que[1:]
		p = pop[1]
		if sign[p] == 0 {
			sign[p] = pop[0] + 1
			count++

			for i := 0; i < len(r[p]); i++ {
				if sign[r[p][i]] == 0 {
					que = append(que, []int{p, r[p][i]})
				}
			}
		}

		if len(que) == 0 {
			break
		}
	}

	if count == n-1 {
		fmt.Fprintln(out, "Yes")
		for i := 1; i < n; i++ {
			fmt.Fprintln(out, sign[i])
		}
	} else {
		fmt.Fprintln(out, "No")
	}

	//	fmt.Fprintln(out, "[DEBUG]]", a)
	//fmt.Fprintln(out, ans)
}

//------------------------------------------------------------------------------

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}
func minInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}


Measured memory_bytes: 42912
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<30;
 
int main(void) {
    ll n, t;
    cin >> n >> t;
    vector<ll> a(n), b(n);
    REP(i, n) cin >> a[i] >> b[i];
 
    vector<ll> v0;
    vector<PII> v1;
    REP(i, n) {
        if(a[i] == 0) v0.push_back(b[i]);
        else v1.emplace_back(a[i], b[i]);
    }
 
    sort(ALL(v1), [](PII l, PII r){
        return r.first * (l.second + 1) < l.first * (r.second + 1);
    });
 
    vector<vector<ll>> dp(v1.size()+1, vector<ll>(30, INF));
    dp[0][0] = 0;
    REP(i, v1.size()) REP(j, 30) {
        chmin(dp[i+1][j], dp[i][j]);
        if(j >= 1) chmin(dp[i+1][j], dp[i][j-1] + 1 + v1[i].first * (dp[i][j-1] + 1) + v1[i].second);
    }
 
    v0.push_back(0);
    sort(ALL(v0));
    FOR(i, 1, v0.size()) v0[i] += v0[i-1]+1;
 
    dump(dp[v1.size()]);
    dump(v0);
 
    ll ret = 0;
    REP(i, 30) {
        // dp[v1.size()][i] + v0[j] <= T である最大のj
        ll idx = upper_bound(ALL(v0), t - dp[v1.size()][i]) - v0.begin() - 1;
        dump(t-dp[v1.size()][i], idx);
        if(idx >= 0) chmax(ret, i + idx);
    }
    cout << ret << endl;
 
    return 0;
}

Measured memory_bytes: 61804
#include <stdio.h>
#define MAX 100

int main(){

	int n,P[MAX][MAX],Num,Count,X,i,j;

	scanf("%d",&n);
	for( i = 0; i < n; i++){
		for( j = 0; j < n; j++){
			P[i][j] = 0;
		}
	}

	for( i = 0; i < n; i++){
		scanf("%d",&Num);
		scanf("%d",&Count);
			for( j = 0; j < Count; j++){
				scanf("%d",&X);
				P[Num-1][X-1] = 1;
		}
	}

	for( i = 0; i < n; i++){
		for( j = 0; j < n; j++){
			if(j == n-1) printf("%d",P[i][j]);
			else printf("%d ",P[i][j]);
		}
		printf("\n");	
	}

	return 0;
}

Measured memory_bytes: 636
/*
 * AOJ-Volume0-0022
 */
#include <iostream>
#include <limits.h>
#include <vector>
#include <cstdio>

using namespace std;

typedef long long ll;

/*
 * Find maximum sum.
 *   array: number list
 */
ll findMaximumSum(vector<int> &array){
  ll sumValue = array[0];
  ll maxValue = array[0];
  int length = array.size();

  for(int i = 1; i < length; i++){
    ll value = array[i];

    if(sumValue < 0){
      sumValue = value;
    }else{
      sumValue += value;
    }

    if(maxValue < sumValue){
      maxValue = sumValue;
    }
  }

  return maxValue;
}

void solve(int n){
  vector<int> a(n);

  for(int i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }

  cout << findMaximumSum(a) << endl;
}

int main(){
  int n;

  while(cin >> n){
    if(n == 0) break;

    solve(n);
  }

  return 0;
}

Measured memory_bytes: 1252
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    if a + b >= 10:
        print("error")
    else:
        print(a + b)
    return

#B
def B():
    s = S()
    if len(s) == len(set(s)):
        print("yes")
    else:
        print("no")
    return

#C
def C():
    return

#D
def D():
    return


#Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 38512
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#define INF 1000000000
#define MOD 1000000007
#define mod(x) ((x % MOD) + MOD) % MOD
#define MAX_N 100001

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

int main() {
  ll N, A, B;
  ll d[MAX_N];
  cin >> N >> A >> B;
  ll cur, pre;
  for (ll i = 0; i < N; i++) {
    cin >> cur;
    if (i != 0) {
      d[i] = cur - pre;
    }
    pre = cur;
  }

  ll cost = 0;

  for (ll i = 0; i < N; i++) {
    if (d[i] * A < B) {
      cost += d[i] * A;
    } else {
      cost += B;
    }
  }

  cout << cost << endl;

  return 0;
}


Measured memory_bytes: 1024
using System;

public class Program
{
	public static void Main (string [] args)
	{
		var ss = new StreamScanner ();
		//---------------------------------
		var res = new int [26];
		while (true) {
            var cr = ss.Next<string>();
			if (cr == null || cr == "EOF") break;

			foreach (var c in cr.ToLower ()) {
				if (char.IsLetter (c)) res [c - 'a']++;
			}
		}

		for (var i = 0; i < res.Length; i++) {
            Console.WriteLine ((char)(i + 'a') + " : " + res [i]);
		}
		//---------------------------------
	}
}

public class StreamScanner
{
	private readonly char [] _c = { ' ' };
	private int _index = -1;
	private string [] _input = new string [0];
	private readonly System.IO.StreamReader _sr = new System.IO.StreamReader (Console.OpenStandardInput ());

	public T Next<T> ()
	{
		if (_index == _input.Length - 1) {
			_index = -1;
			while (true) {
				string rl = _sr.ReadLine ();
				if (rl == null) {
					if (typeof (T).IsClass) return default (T);
					return (T)typeof (T).GetField ("MinValue").GetValue (null);
				}
				if (rl != "") {
					_input = rl.Split (_c, StringSplitOptions.RemoveEmptyEntries);
					break;
				}
			}
		}
		return (T)Convert.ChangeType (_input [++_index], typeof (T), System.Globalization.CultureInfo.InvariantCulture);
	}

	public T [] Next<T> (int x)
	{
		var ret = new T [x];
		for (var i = 0; i < x; ++i) ret [i] = Next<T> ();
		return ret;
	}

	public T [] [] Next<T> (int x, int y)
	{
		var ret = new T [y] [];
		for (var i = 0; i < y; ++i) ret [i] = Next<T> (x);
		return ret;
	}
}

Measured memory_bytes: 9316
import java.util.Scanner;

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

        int N = scan.nextInt();
        scan.nextLine();
        int AC = 0;
        int WA = 0;
        int TLE = 0;
        int RE = 0;

        for (int i=0; i < N; i++){
            String inputTmp = scan.nextLine();
            if (inputTmp.equals("AC")) {
                AC ++;
            }else if (inputTmp.equals("WA")){
                WA ++;
            }else if (inputTmp.equals("TLE")){
                TLE ++;
            }else if (inputTmp.equals("RE")){
                RE ++;
            }
        }

        System.out.println("AC x " + AC);
        System.out.println("WA x " + WA);
        System.out.println("TLE x " + TLE);
        System.out.println("RE x " + RE);
    }
}


Measured memory_bytes: 60528
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

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

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	A, B, Q := sc.nextInt(), sc.nextInt(), sc.nextInt()
	S := sc.nextIntSlice(A)
	T := sc.nextIntSlice(B)
	X := sc.nextIntSlice(Q)
	for i := 0; i < Q; i++ {
		x := X[i]
		a1, okA1 := search(x, S)
		a2, okA2 := search2(x, S)
		b1, okB1 := search(x, T)
		b2, okB2 := search2(x, T)
		da1, da2, db1, db2 := abs(x-a1), abs(x-a2), abs(x-b1), abs(x-b2)
		ans := INF
		if okA1 && okB1 {
			ans = min(ans, max(da1, db1))
		}
		if okA2 && okB2 {
			ans = min(ans, max(da2, db2))
		}
		if okA1 && okB2 {
			ans = min(ans, min(da1, db2)*2+max(da1, db2))
		}
		if okA2 && okB1 {
			ans = min(ans, min(da2, db1)*2+max(da2, db1))
		}
		fmt.Fprintln(wtr, ans)
	}
}

func search(key int, a []int) (int, bool) {
	ng := len(a)
	ok := -1
	for abs(ok-ng) > 1 {
		mid := (ok + ng) / 2
		// 西をさがす
		if a[mid] <= key {
			ok = mid
		} else {
			ng = mid
		}
	}
	if ok == -1 {
		return 0, false
	} else {
		return a[ok], true
	}
}

func search2(key int, a []int) (int, bool) {
	ng := -1
	ok := len(a)
	for abs(ok-ng) > 1 {
		mid := (ok + ng) / 2
		// 東をさがす
		if a[mid] >= key {
			ok = mid
		} else {
			ng = mid
		}
	}
	if ok == len(a) {
		return 0, false
	} else {
		return a[ok], true
	}
}


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

using namespace std;

typedef long long lint;
int main(void)
{
  lint N, M;
  cin >> N >> M;
  vector<pair<lint, lint> > vp(N);
  for(int i = 0; i < N; i++){
    cin >> vp[i].first >> vp[i].second;
  }

  sort(vp.begin(), vp.end());
  int i = 0;
  lint sum = 0;
  while(1){
    //cout << vp[i].first << " " << vp[i].second << endl;
    lint n = vp[i].second;
    if(M <= n){
      sum += vp[i].first * M;
      break;
    }
    else{
      sum += vp[i].first * n;
      M -= n;
      i++;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t N, M;
  cin >> N >> M;
  if(N > M){
    int64_t tmp = N;
    N = M;
    M = tmp;
  }
  
  if(N >=2){
    cout << (N-2)*(M-2) << endl;
  }
  else if(M == 1){
    cout << 1 << endl;
  }
  else{
    int64_t x = 0;
    cout << max(x,M-2) << endl;
  }
  
}

Measured memory_bytes: 256
import java.util.*;

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

        int X = 0;
        int Y = 0;
        

        for(int i = 0;i < N;i++){
            jew[i] = sc.nextInt();
        }

        for(int i = 0;i < N ;i++){
            val[i] = sc.nextInt();
        }

        for(int i = 0;i < N;i++){
            if(jew[i] < val[i]){
                jew[i] = 0;
                val[i] = 0;
            }
            X += jew[i];
            Y += val[i];
        }

        int ans = X-Y;
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
/**
 * @Author:      G_bg
 * @DateTime:    2019-08-10 20:05:05
 * @Description: 
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const double PI = 3.1415926535898;
const double E = 2.718281828459;
const int INF = 0x7fffffff;
const int mod = 1e9+7;
const int maxn = 1e5+10;
int main(int argc, const char *argv[]) {
    ios::sync_with_stdio(0);cin.tie(0);
    int k,x;cin >> k >> x;
    for(int i = max(x-k+1,-1000000);i <= min(x+k-1,1000000);++i)
        cout << i << " ";
    cout << endl;
    //system("pause");
    return 0;
}

Measured memory_bytes: 256