akhauriyash/Code-Regression huggingface dataset:
#d

def main():
    h,w = map(int,input().split())
    s=[]
    for i in range(h):
        s.append(list(input()) )
    
    l=[[0]*w for _ in range(h)]
    for i in range(h):
        count=0
        for j in range(w):
            if s[i][j] ==".":
                count+=1
            else:
                count=0
            l[i][j]=count
            
    r=[[0]*w for _ in range(h)]
    for i in range(h-1,-1,-1):
        count=0
        for j in range(w-1,-1,-1):
            if s[i][j] ==".":
                count+=1
            else:
                count=0
            r[i][j]=count
                    
    d=[[0]*w for _ in range(h)]
    for j in range(w-1,-1,-1):
        count=0
        for i in range(h-1,-1,-1):
            if s[i][j] ==".":
                count+=1
            else:
                count=0
            d[i][j]=count
                    
    u=[[0]*w for _ in range(h)]
    for j in range(w):
        count=0
        for i in range(h):
            if s[i][j] ==".":
                count+=1
            else:
                count=0
            u[i][j]=count
    
    ans=[[0]*w for _ in range(h)]
    for i in range(h):
        for j in range(w):
            ans[i][j] = l[i][j]+ r[i][j]+ u[i][j]+ d[i][j]-3
    print( max( max(ans[i]) for i in range(h)) )

if __name__ == '__main__':
    main()

Measured memory_bytes: 338952
#include <bits/stdc++.h>
using namespace std;
const int MOD=998244353;
long long pow2(int a,int b){
  long long ans=1;
  while(b>=1){
    ans*=a;
    ans%=MOD;
    b--;
  }
  return ans;
}
int main(){
  int N,S,a;
  cin>>N>>S;
  vector<int> A(0);
  for(int i=0;i<N;++i){
    cin>>a;
    if(a<=S){A.push_back(a);}//Sより大きいのをそもそも除外(部分集合に入るわけないから)
  }
  long long dp[3020][3020];//何乗？
  sort(A.begin(),A.end());//何となくソート(特に意味ないけど自分に分かりやすくするため)
  if(A.size()==0){cout<<0<<endl;return 0;}//そもそも要素が空だったら0を出力(条件を満たすことは不可能だから)
  dp[1][A.at(0)]=1;
  for(int i=1;i<N;++i){dp[i][0]=pow2(2,i);}//定数項は2の指数乗に
  //以下、積のシグマ(2+x^(A.at(i)))を計算していき、x^sの項の係数(答え)を求める
  for(int i=2;i<=N;++i){
    for(int j=0;j<=S;++j){
      if(i-1<(int)A.size()){
        if(j-A.at(i-1)>=0){
          if(dp[i-1][j-A.at(i-1)]>0){
            dp[i][j]+=dp[i-1][j-A.at(i-1)];
            dp[i][j]%=MOD;
          }
        }
      }
      if(j>0){
        dp[i][j]+=dp[i-1][j];
        dp[i][j]%=MOD;
        dp[i][j]+=dp[i-1][j];
        dp[i][j]%=MOD;
      }
    }
  }
  cout<<dp[N][S]%MOD<<endl;
}

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

int main() {
	int n;
	cin >> n;
	int64_t t[n + 1]{}, x[n + 1]{}, y[n + 1]{};
	for (int i = 1; i <= n; i++) {
		cin >> t[i] >> x[i] >> y[i];
	}
	for (int i = 1; i <= n; i++) {
		int64_t dist = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
		int64_t time = t[i] - t[i - 1];
		if (time < dist || (time - dist) % 2) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 2560
s=input()
n=int(input())
l=""
for i in range(len(s)):
    f=(26+ord("a")-ord(s[i]))%26
    if n>=f:n-=f;l+="a"
    else:l+=s[i]
    if n==0:print(l+s[i+1:]);exit()
print(l[:-1]+chr(ord(l[-1])+n%26))

Measured memory_bytes: 3572
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

//gcd,lcm,べき,二進展開
//組み合わせ、mod計算
//最短路問題、bit、union find

///////////////////////////



	
int main() {
	ll n;
	ll x[MAX], y[MAX];

	cin >> n;

	repn(i, n) {
		cin >> x[i];
		y[i] = x[i];
	}

	sort(y + 1, y + n + 1, greater<ll>());

	ll med = y[(n + 1) / 2];

		repn(i, n) {
			if (x[i] < med) { cout << y[n / 2]<<endl; }
			else { cout << y[n / 2 + 1]<<endl; }
		}

	system("PAUSE");
}

Measured memory_bytes: 9720
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
int main(){
    int n;
    cin >> n;
    vector <int> a(n);
    for (size_t i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    int alice = 0;
    int bob = 0;
    for (size_t i = 0; i < a.size(); i++)
    {
        if(i%2==0) alice+=a[i];
        else bob+=a[i];
    }
    cout << alice - bob << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int n,m;
int a,b,c;
int ans;
int g[60][60];
vector<int> v(60);

void dfs(int x){
  for(int k=0;k<n;k++){
    if(g[x][k]>0 && g[x][k]!=c){
      if(v[k]==0){
	v[k]=1;dfs(k);
      }
    }
  }
}
int main(){
  cin>>n>>m;ans=0;
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      g[i][j]=0;
  for(int i=1;i<=m;i++){
    cin>>a>>b;
    g[a-1][b-1]=i;g[b-1][a-1]=i;
  }
  for(int i=1;i<=m;i++){
    c=i;
    fill(v.begin(),v.end(),0);
    v[0]=1;
    dfs(0);
    if(count(v.begin(),v.begin()+n,1)!=n){
      ans++;
    } 
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
arr = gets.strip.split(" ").map!(&:to_i)
w = arr[0]
h = arr[1]
x = arr[2]
y = arr[3]

result = (w * h) / 2.0
if(x*2 == w && y*2 == h) then
  ways = 1
else
  ways = 0
end
printf("%f %d\n", result, ways)

Measured memory_bytes: 1788
#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<utility>
#include<cctype>
using namespace std;

#define ull unsigned long long
#define ll long long
#define rep(i,j) for(int i=0;i<j;++i)
#define loop(i,a,j) for(int i=a;i<j;++i)
#define mpi(it,table,T,E) for(map<T,E>::iterator it = table.begin();it!=table.end();++it)
#define PI 3.141592654
/*
ifstream fin("input.txt");
ofstream fout("output.txt");
#define cin fin
#define cout fout
*/

double mat[11]; 

double solve(int n){
	if( n == 1)return mat[1];
	if( n % 2 == 0){
		return mat[n] =  solve(n-1)*2.0;
	}
	return mat[n] = solve(n-1)/3.0;
}

int main(){
	double a ;
	while(scanf("%lf",&a) != EOF){
		memset(mat,0,sizeof(mat));
		mat[1] = a;
		solve(10);
		loop(i,1,11)mat[0] += mat[i];
		printf("%.8lf\n",mat[0]);
	}
	return 0;
}

Measured memory_bytes: 1236
#include<stdio.h>
void swap(int *a, int *b){
    int c;
    c = *a; *a = *b; *b = c;
}
int main(){
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if(a > b)  swap(&a,&b); 
    if(b > c){
        swap(&b,&c);
        if(a > b){
            swap(&a,&b);
        }
    }
    printf("%d %d %d\n", a, b, c);
    return 0;
}


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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

string table[12]={"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"};

int N,M;
int T[50010];
int S[50010];

bool dfs(int n,int m){
    if(m==M)return N-n<=2;
    if((N-n+1)/2>M-m+1)return false;
    if(n>0&&(T[n-1]+11)%12==S[m]&&dfs(n-1,m+1))return true;
    if(n+1<N&&T[n+1]==S[m]&&dfs(n+1,m+1))return true;
    if(n+2<N&&(T[n+2]+1)%12==S[m]&&dfs(n+2,m+1))return true;
    return false;
}

void solve(){
    cin>>N>>M;
    string hoge;
    rep(i,N){
        cin>>hoge;
        T[i]=find(table,table+12,hoge)-table;
    }
    rep(i,M){
        cin>>hoge;
        S[i]=find(table,table+12,hoge)-table;
    }

    if(dfs(-1,0))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

signed main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int T;cin>>T;
    while(T--)solve();
    return 0;
}

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

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

lli gcd(lli a, lli b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

int main () {
    int N;
    cin >> N;
    vector<lli> T(N);
    REP (i, 0, N) cin >> T[i];
    lli ans = 1;
    REP (i, 0, N) {
        ans = ans / gcd(ans, T[i]) * T[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N,K=map(int,input().split())
A=list(map(int,input().split()))

F=[-1]*N
l=0
prev=0
while True:
  if F[prev]!=-1:
    break
  
  if l==K:
    print(prev+1);exit()
  F[prev]=l
  l+=1
  prev=A[prev]-1
  #print(l,prev)
l = (K-F[prev])%(l-F[prev])
#print(l)
for i in range(l):
  prev=A[prev]-1
print(prev+1)


Measured memory_bytes: 92180
import collections, itertools, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    N, K = LI()
    xy = [LI() for _ in range(N)]

    # x, y全ての重複あり組み合わせに対して含まれる点の個数を算出する

    x_cnt = collections.Counter([i[0] for i in xy])
    x_coordinate = list(x_cnt.keys())
    x_coordinate.sort()
    # len_x_c = len(x_coordinate)
    y_cnt = collections.Counter([i[1] for i in xy])
    y_coordinate = list(y_cnt.keys())
    y_coordinate.sort()
    len_y_c = len(y_coordinate)

    ans = INF
    for xl, xh in itertools.combinations(x_coordinate, 2):
        # 4番目の辺の探索は、個数条件を満たしたら終了していよい
        for i in range(len_y_c - 1):
            yl = y_coordinate[i]
            for j in range(i + 1, len_y_c):
                yh = y_coordinate[j]
                cnt = len([(i, j) for i, j in xy if xl <= i <= xh and yl <= j <= yh])
                if cnt >= K:
                    ans = min((xh - xl) * (yh - yl), ans)
                    break

    print(ans)

if __name__ == '__main__':
    resolve()


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

int main() {
  ll n, a, b; cin >> n >> a >> b;
  ll m = (a+b)/2, ans = 0;
  ans = max(abs(a-m),abs(b-m));
  if ((b-a)%2 == 1) ans += min(abs(1-a),abs(n-b));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3640
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class ABeginner {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n, r; cin >> n >> r;
      if (n >= 10) {
        cout << r << endl;
      } else {
        cout << r + 100 * (10 - n) << endl;
      }

    }
};

signed main() {
  ABeginner solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;



public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = null;

		double xa, ya, ra, xb, yb, rb;
		try {
			line = br.readLine();
			line.trim();
			int N = Integer.parseInt(line);
			for(int i = 0; i < N; i++){
				line = br.readLine();
				line.trim();
				
				String[] words = line.split("\\s");
				xa = Double.parseDouble(words[0]);
				ya = Double.parseDouble(words[1]);
				ra = Double.parseDouble(words[2]);
				xb = Double.parseDouble(words[3]);
				yb = Double.parseDouble(words[4]);
				rb = Double.parseDouble(words[5]);

				int ans = -1;
				double distance = Math.sqrt(Math.pow(xa - xb, 2) + Math.pow(ya - yb, 2));
				
				if(distance > ra + rb) ans = 0;
				else if(ra > distance + rb) ans = 2;
				else if(rb > distance + ra) ans = -2;
				else ans = 1;
				System.out.println(ans);

			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

Measured memory_bytes: 15104
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
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 Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define REP(i,n) for(int i=0;i<n;i++)
#define pb push_back


// vectorの中身をcout << vs;で表示
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v)
{
    o << "{";
    for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i];
    o << "}";
    return o;
}

int cost(int a, int b, int c) {
	return abs(a - b) + abs(b - c);
}

int main(void) {
	// cin, coutの結びつきを解除し、速くする
	cin.tie(0);
   	ios::sync_with_stdio(false);

	int a, b, c;
	cin >> a >> b >> c;
	vi vs;

	vs.pb(cost(a, b, c));
	vs.pb(cost(a, c, b));
	vs.pb(cost(b, a, c));
	vs.pb(cost(b, c, a));
	vs.pb(cost(c, a, b));
	vs.pb(cost(c, b, a));

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

	cout << vs.at(0) << endl;
}



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

#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define REP(i, n) for(int i=1; i<=(int)(n); i++)

using namespace std;

int main(){
    int a;
    string s;

    cin >> a;
    cin >> s;

    if (a < 3200){
        cout << "red" << endl;
    }else{
        cout << s << endl;
    }

    return 0;
}



Measured memory_bytes: 764
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int K = scanner.nextInt();
    int sum = 0;
    for(int i = 1;i < K + 1;i++){
      for(int j = 1;j < K + 1;j++){
        for(int k = 1;k < K + 1;k++){
          sum = sum + gcd(gcd(i,j),k);
        }
      }
    }
    System.out.println(sum);
  }
  
  static int gcd(int a,int b){
    if(b == 0)
      return a;
    
    return gcd(b,a % b);
  }
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define ASSERT(expr...) assert((expr))

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;
using ll = long long;

constexpr i64 INF = 1010000000000000017LL;

constexpr i64 MOD = 1000000007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

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

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

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

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

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

ll mod_pow(ll x, ll n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        return mod_pow(x * x % MOD, n / 2) % MOD;
    } else {
        return x * mod_pow(x, (n - 1)) % MOD;
    }
}

ll mod_pow_r(ll x, ll n) {
    if (x == 0) return 0;
    if (n == 0) return 1;

    ll ret = 1;
    while (n) {
        if (n & 1) ret = ret * x % MOD;
        x = x * x % MOD;
        n /= 2;
    }
    return ret;
}

ll factorial(ll n) {
    ll ret = 1;
    REP(i, n) {
        ret *= (i + 1);
        ret %= MOD;
    }
    return ret;
}

ll combination(ll n, ll r) {
    if (n < 0 || n < r || r < 0) return 0;
    ll fn = factorial(n);
    ll fr = factorial(r);
    ll fn_r = factorial(n-r);

    ll d = (mod_pow(fr, MOD - 2) * mod_pow(fn_r, MOD - 2)) % MOD;
    ll u = fn % MOD;
    return u * d % MOD;
}

void solve() {
    string s, t; cin >> s >> t;
    cout << t + s;
}

signed main() {
    solve();
    return 0;
}   

Measured memory_bytes: 256
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

t = inp[0].prime_division
ans = 0
t.each do |a|
  n = 1
  while n <= a[1]
    ans += 1
    a[1] -= n
    n += 1
  end
end
p ans


Measured memory_bytes: 14424
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
inline int read(){
	char c=getchar();int t=0,f=1;
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
int n,h[maxn];
int main(){
	n=read();
	for(int i=1;i<=n;i++){
		h[i]=read();
	}
	int ans=0,r;
	for(int l=1;l<=n;l=r){
		r=l+1;
		for(;r<=n;r++){
			if(h[r]>h[r-1]){
				break;
			}
		}
		ans=max(ans,r-l-1);
	//	printf("%d %d\n",l,r);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int sum=0;
  
  int l[N], r[N];
  for(int i=0; i<N; i++){
    cin >> l[i] >> r[i];
  }
  
  for(int i=0; i<N; i++){
    sum += r[i] - l[i] + 1;
  }
  
  cout << sum << endl;
}

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

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

    string s;
    cin >> s;

    int len = s.length();

    for(int i = 0; i < len; i++){
        int k = s[i] + n;
        if(k > 90){
            k = 65 + (k - 91);
        }
        s[i] = char(k);
    }

    cout << s << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N,R; cin>>N>>R;
  cout<<R+100*max(0ll,10-N)<<endl;
  }



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

int main(){
	char n[4];
	for (int i = 0; i < 4; i++){
		cin >> n[i];
	}
	
	bool valid = true;
	for (int i = 1; i < 3; i++){
		if (n[i] != n[0]){
			valid = false;
		}
	}
	
	bool valid2 = true;
	for (int i = 2; i < 4; i++){
		if (n[i] != n[1]){
			valid2 = false;
		}
	}
	
	if (valid or valid2){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	return 0;
}

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

int main() {
  char b;
  cin >> b;
   if (b == 'A') {
     cout << 'T' << endl;
   }
  else if (b == 'T') {
    cout << 'A' << endl;
  }
  else if ( b == 'C') {
    cout << 'G' << endl;
  }
  else cout << 'C' << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi >
#define vvvi vector<vvi >
#define pii pair<int,int>
#define INF 1e9
#define MOD 1e9+7
typedef long long llong;
using namespace std;

int main(){
	int n;
	cin>>n;
	
	vi e(1e5+1,0),o(1e5+1,0);
	REP(i,n){
		int v;
		cin>>v;
		if(i%2) o[v]++;
		else e[v]++;
	}
	
	int nume,numo,cnte=0,cnte2=0,cnto=0,cnto2=0;
	for(int i=1;i<=100000;++i){
		if(e[i]>cnte){
			cnte2=cnte;
			cnte=e[i];
			nume=i;
		}else if(e[i]>cnte2){
			cnte2=e[i];
		}
		
		if(o[i]>cnto){
			cnto2=cnto;
			cnto=o[i];
			numo=i;
		}else if(o[i]>cnto2){
			cnto2=o[i];
		}
	}
	
	if(nume!=numo) cout<<n-(cnte+cnto)<<endl;
	else cout<<n-max(cnte+cnto2,cnte2+cnto)<<endl;
}//解説解答参考.

Measured memory_bytes: 1024
<?php
  $n = trim(fgets(STDIN));
  $arr1 = explode(" ",trim(fgets(STDIN)));
  $arr2 = explode(" ",trim(fgets(STDIN)));
  $arr3 = explode(" ",trim(fgets(STDIN)));
  $sat = 0;
  for($i=0;$i<$n;$i++) {
    $sat += $arr2[$i];
    if($i<$n-1 && $arr1[$i+1]-$arr1[$i] == 1) {
        $sat += $arr3[$arr1[$i]-1];
    }
  }
  echo $sat;

Measured memory_bytes: 4604
import numpy as np
H, W = list(map(int, input().split()))
count = 0
s = np.array([['d']*(W+2)]*(H+2))

for i in range(1, H+1):
    mojiretu = input()
    for j in range(1, W+1):
        s[i][j] = mojiretu[j-1]


def handan():
    for i in range(1, H+1):
        for j in range(1, W+1):
            if s[i][j] == '#':
                if (s[i-1][j] == ('.' or 'd')) and (s[i+1][j] == ('.' or 'd')) and (s[i][j-1] == ('.' or 'd')) and (s[i][j+1] == ('.' or 'd')):
                    return 'No'
    return 'Yes'

print(handan())

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

#define M 1000000007
#define MM 998244353 
#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define PI 3.1415926536
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
//RNG based on mersenne_twister 
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }


int _runtimeTerror_()
{
	int n;
	cin>>n;
	ll ans=0;
	for(int i=1;i<=n;++i)
	{
		if(i%3==0 || i%5==0 )continue;
		ans+=i;
	}
	cout<<ans<<endl;
	return 0;
}

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#ifdef runSieve
		sieve();
	#endif
	#ifdef NCR
		initialize();
	#endif
	int TESTS=1;
	//cin>>TESTS;
	while(TESTS--)
		_runtimeTerror_();
	cerr<<"\n"<<_time_;
	return 0;
}


Measured memory_bytes: 3812
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        exit()
    for y in range(h):
        if y % 2 == 0:
            for x in range(w):
                if x % 2 == 0:
                    print('#', end='')
                else:
                    print('.', end='')
            print('')
        if y % 2 == 1:
            for x in range(w):
                if x % 2 == 0:
                    print('.', end='')
                else:
                    print('#', end='')
            print('')
    print()


Measured memory_bytes: 7008
#include <bits/stdc++.h>
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nuintptr)
	
using namespace std;


typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;

 
const int MAX = 1e6+10;
const ll inf = 1e9+10;



ll es[MAX];

int main(){
	fastio;
	ll x,y,n,dif=1000000000,ans;
	cin>>x>>n;
	if(n==0){
		cout<<x<<endl;
		return 0;
	}
	f(i,0,n){
		cin>>y;
		es[y]=1;
	}
	ans = 0, dif = x;
	f(i,1,102){
		if(!es[i]){
			if(dif>abs(x-i))
				dif=abs(x-i),ans=i;
		}
	}
	cout<<ans<<endl;
}	

Measured memory_bytes: 3636
import java.util.*;

public class Main {

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

		while(sc.hasNext()){
			int[] a = new int[12];
			String s = sc.next();
			int sum = 0;
			int count = 0;
			int start = 0;
			for(int j=0;j<11;j++){
				start = count;
				while(s.substring(count,count+1).compareTo(",")!=0){
					count++;
				}
				a[j] = Integer.valueOf(s.substring(start,count));
				sum += a[j];
				count++;
			}
			sum -= a[10];
			a[11] = Integer.valueOf(s.substring(count,s.length()));
			double d = (double)a[10]/(a[10]+a[11]);
			d *= sum;
			
			sum = 0;
			for(int j=0;j<10;j++){
				sum += a[j];
				if(sum>=d){
					System.out.println(j+1);
					break;
				}
			}
		}
	
	}
}

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

using namespace std;

typedef long long int64;

const int mod = 1e9 + 7;

int main()
{
  char c;
  cin >> c;
  if(string("aeiou").find(c) != string::npos) cout << "vowel" << endl;
  else cout << "consonant" << endl;
}

Measured memory_bytes: 256
s = list(input())
al = [chr(i) for i in range(97, 97+26)]
ans = []

for a in al:
    c = 0
    if s.count(a) == 0:
        continue
    temp = s.copy()
    while not all(i == a for i in temp):
        c += 1
        n_temp = temp.copy()
        for n, j in enumerate(temp):
            if n == 0 and j == a:
                continue
            elif j == a:
                n_temp[n-1] = a
        temp = n_temp[:len(temp)-1]
    ans.append(c)
print(min(ans))

Measured memory_bytes: 3064
s = input()
old = ''
sample = [chr(i) for i in range(97, 97+26)]
if len(s) == 26:
    for i, s1 in enumerate(s[::-1]):
        if i != 0 and s1 < old[-1]:
            out = s[:len(s)-i-1] + min([o for o in old if o > s1])
            print(out)
            exit()
        old += s1
    print(-1)
else:
    print(s + min(set(sample)-set(s)))

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


int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return 1;
  return gcd(y, x % y);
}
//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  int x, a;
  cin >> x >> a;
  if(x >= a) cout << 10 << endl;
  else cout << 0 << endl;
}


/*





















*/


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

#define fi  first
#define se second
#define pb(x)       push_back(x)
#define mp(a,b)  make_pair(a,b);
#define sz(a)  ((int)(a).size())
#define all(x) x.begin(),x.end()

#define ff(i,a,b) for(ll i=a;i<=b;++i)

#define de(a) cout << #a << " = " << a << endl;
#define dd(a) cout << #a << " = " << a << "  ";

#define INF 0x3f3f3f3f
#define mem(a,b)   memset(a,b,sizeof(a))
#define file freopen("in.txt","r",stdin)
#define jkl ios::sync_with_stdio(false);cin.tie(0);
/*********************************************/
int main() {
	int a,b;
	cin >> a >> b;
	int l=abs(a+b);
	if(l%2==0) cout << l/2;
	else cout << "IMPOSSIBLE";
	cout << endl; 
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do smth instead of nothing and stay organized
*/


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

int main(){
  int n;
  cin>>n;
  unordered_map<int,int> a,b;
  for(int i=0;i<n;i++){
    int j;
    cin>>j;
    if(i%2==0){
      if(a.count(j))
        a[j]++;
      else
        a[j]=1;
    }
    else{
      if(b.count(j))
        b[j]++;
      else
        b[j]=1;
    }
  }
  pair<int,int> j,k,l,p;
  for(auto &i:a){
    if(j.second<i.second){
      k=j;
      j=i;
    }
    else if(k.second<i.second)
      k=i;
  }
  for(auto &i:b){
    if(l.second<i.second){
      p=l;
      l=i;
    }
    else if(p.second<i.second)
      p=i;
  }
  if(j.first!=l.first)
    cout<<n-j.second-l.second<<endl;
  else if(k.second+l.second<j.second+p.second)
    cout<<n-j.second-p.second<<endl;
  else
    cout<<n-k.second-l.second<<endl;
}

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

using ll=long long;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, m;
  cin >> n >> m;
  if(n < m) swap(n,m);
  if(n == 1 && m == 1) cout << 1 << endl;
  else if (m == 1) cout << n-2 << endl;
  else cout << (n-2)*(m-2) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	 int b, d;
	 cin >> b >> d;
	 int t[b];
	 long long p = -1, k = -1, z = 0;
	 for(int i = 0; i < b; i++)
	 {
	 	cin >> t[i];
	 	if(k < t[i])
	 	{
	 		z += (k-p);
	 		p = t[i];
	 		k = t[i] + d;
		}
		if(k >= t[i])
		{
			k = t[i] + d;
		}
	 }
	 z += (k-p);
	 cout << z << endl;
}


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

#define rep(i, j, n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.end()
#define inf 1e9
#define Puts(x) puts(x? "YES":"NO")
const int mod = 1e9 + 7;

typedef pair<int, int> pi;
typedef long long i64;

template <class T = int> using vt = vector<T>;
template <class T = int> using vvt = vector<vector<T>>;

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

  int n, t;
  cin >> n >> t;
  int cost = 1e9;
  rep(i, 0, n) {
    int c, x;
    cin >> c >> x;
    if(t >= x) {
      cost = min(cost, c); 
    }
  }
  if(cost == 1e9) cout << "TLE\n";
  else cout << cost << endl;
}


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


int main(void) {
    int n, Y;
    cin >> n >> Y;
    int x = -1;
    int y = -1; 
    int z = -1;
    rep(i, n){
        rep(j, n){
            if(i + j > n)break;
            int k = n - i - j;
            if(Y == 10000*i + 5000*j + 1000*k){
                x = i;
                y = j;
                z = k;
            }
            
        }
    }
    printf("%i %i %i",x,y,z);
            
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i, MAT.size()){
    REP(j, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(void){
      return;
    };
    HOGE(CLASS1 key, CLASS2 value){
      this->key = key;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N, K;
  cin >> N >> K;
  vector<HOGE<ll, ll>> hoge(N);
  REP(i, N){
    ll x, y;
    cin >> x >> y;
    HOGE<ll, ll> tmp(x, y);
    hoge[i] = tmp;
  }

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

  ll ans = INFLL;
  FOR(k, K, N+1){
    FOR(i, 0, N-k+1){
      ll y_dist = hoge[i+k-1].value - hoge[i].value;
      vll xs(k);
      FOR(j, 0, k){
        xs[j] = hoge[i+j].key;
      }
      sort(xs.begin(), xs.end());
      ll x_dist_min = INFLL;
      FOR(j, 0, k-K+1){
        x_dist_min = min(x_dist_min, xs[j+K-1]-xs[j]);
      }
      ans = min(ans, x_dist_min*y_dist);
    }
  }

  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 256
from sys import exit
n,x=map(int,input().split())

l=tuple(map(int,input().split()))
d=[0 for i in range(n+2)]


for i in range(n):
    
    d[i+1]=d[i]+l[i]
    if d[i+1]>x:
        print(i+1)
        exit()
print(n+1)


Measured memory_bytes: 40304
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>

#define Rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())

#define eb emplace_back
#define dbg(x) cout<<#x" = "<<((x))<<endl
#define fs first
#define sc second
     
using namespace std;
     
     
typedef long long ll;
typedef pair<ll, ll> P;
     
     
int main(){
  string N;

  cin >> N;

#ifdef DEBUG
  cout << "N=" << N << endl;
#endif

  for(size_t i = 0; i < N.length(); ++i){
    if(N[i] == '1') N[i] = '9';
    else N[i] = '1';
  }

  cout << N << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
using namespace std;
int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    int arr[3] = { a, b, c };
    
    sort(arr, arr + 3);
    cout << arr[0] <<  " " << arr[1] << " " << arr[2] << endl;
    return 0;
}


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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  string s;cin>>s;


  for(char c='a';c<='z';c++){
    int t = count(s.begin(), s.end(), c);
    if(t%2==1){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;

  return 0;
}


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

using namespace std;

int b_collats_sub(int n) {
	return (n & 0x1) == 0x1 ? (3 * n + 1) : (n >> 1);
}

void b_collats_problem(void) {
	int s;
	cin >> s;
	int i = 1;
	int ai;
	int before_ai;
	bool m[1000000] = { false };
	while (true) {
		if (i == 1)ai = s;
		else {
			before_ai = ai;
			ai = b_collats_sub(before_ai);
			if (m[ai]) break;	
		}
		m[ai] = true;
		i++;
	}

	cout << i << endl;
}

int main()
{
    b_collats_problem();

    return 0;
}


Measured memory_bytes: 4548
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#define FOR(x, z, y) for(int x = (z); y; x++)
#define rep(x, y) for(int x = 0; x < (y); x++)
#define all(x) x.begin(), x.end()
#define len(x) (sizeof(x) / sizeof(x[0]))
#define split_str(str, sp_word) istringstream stream(str); string res; FOR(cnt, 0, getline(stream,res,sp_word))
#define scanln(x) fgets(x, sizeof x, stdin)
#define down_queue(x) priority_queue<x>
#define up_queue(x) priority_queue<x, vector<x>, greater<x>>
#define i_str(x) atoi(x.c_str())
typedef long long ll;
using namespace std;

int main(){
  string A,B;
  cin >> A >> B;
  if(A.length() != B.length()){
    int a = A.length(),b = B.length();
    if(a > b) puts("GREATER");
    else if( a < b) puts("LESS");
  }else{
    if(A > B) puts("GREATER");
    else if(A < B) puts("LESS");
    else puts("EQUAL");
  }

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int room[4][3][10] = {0};
    int n, b, f, r, v;
    int i, j, k;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%d %d %d %d", &b, &f, &r, &v);
        room[b - 1][f - 1][r - 1] += v;
    }
    
    for (i = 0; i < 4; i++)
    {
        for (j = 0; j < 3; j++)
        {
            for (k = 0; k < 10; k++)
            {
                printf(" %d", room[i][j][k]);
            }
            printf("\n");
        }
        
        if(i < 3) {
            printf("####################\n");
        }
    }
    
    return 0;
}

Measured memory_bytes: 612
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int a[3];
    for (int i=0;i<3;i++){
        cin>>a[i];
    }
    sort(a,a+3);
    cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
    return 0;
}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;


signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int A, B, C, D;
  cin >> A >> B;

  if(A % 4 == 0) C = 0;
  else if(A % 4 == 3) C = A;
  else if(A % 4 == 2) C = 1;
  else if(A % 4 == 1) C = A - 1;

  if(B % 4 == 0) D = B;
  else if(B % 4 == 3) D = 0;
  else if(B % 4 == 2) D = B + 1;
  else if(B % 4 == 1) D = 1;

  int ans = C^D;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
static const int N = 100;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
int a[N][N];
int t = 0;
int color[N], check[N], finish[N];
void dfs(int u) {
  t++;
  check[u] = t;
  color[u] = GRAY;
  for (int i = 0; i < n; i++) {
    if (a[u][i] == 0) continue;
    if (color[i] == WHITE) {
      dfs(i);
    }
  }
  color[u] = BLACK;
  finish[u] = ++t;
}

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) a[i][j] = 0;
  }

  for (int i = 0; i < n; i++) {
    int u, k;
    cin >> u >> k;
    u--;
    for (int j = 0; j < k; j++) {
      int v;
      cin >> v;
      v--;
      a[u][v] = 1;
    }
  }

  for (int i = 0; i < n; i++) {
    color[i] = WHITE;
  }
  for (int i = 0; i < n; i++) {
    if (color[i] == WHITE) {
      dfs(i);
    }
  }
  for (int i = 0; i < n; i++) {
    cout << i + 1 << " " << check[i] << " " << finish[i] << endl;
  }
}


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

int main(){
  string S, T;
  cin >> S >> T;
  string A="";
  for(int i=0; i<S.size(); i++){
    int p=A.size();
    int e=0;
    for(int j=0; j<p; j++){
      if(S.at(i)==A.at(j)){
        S.at(i)='a'+j;
        e=1;
        break;
      }
    }
    if(e==0){
      A.push_back(S.at(i));
      S.at(i)='a'+p;
    }
  }
  A="";
  for(int i=0; i<T.size(); i++){
    int p=A.size();
    int e=0;
    for(int j=0; j<p; j++){
      if(T.at(i)==A.at(j)){
        T.at(i)='a'+j;
        e=1;
        break;
      }
    }
    if(e==0){
      A.push_back(T.at(i));
      T.at(i)='a'+p;
    }
  }
  if(S==T){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 776
from collections import defaultdict
from bisect import bisect_right

N, K = map(int, input().split())
*A, = map(int, input().split())

dd = defaultdict(list)
for i, j in enumerate(A):
    dd[j].append(i)

pos = 0
loop = 1
# l = []
cic = defaultdict(list)

while pos < N:
    num = A[pos]
    
    pp = bisect_right(dd[num], pos)
    if pp < len(dd[num]):
        pos = dd[num][pp]+1
    else:
        pos = dd[num][0]+1            
        loop += 1
    cic[loop].append(pos)

pos = cic[K%loop][0] if cic[K%loop] else 0
ans = []
while pos < N:
    num = A[pos]
    pp = bisect_right(dd[num], pos)
    if pp < len(dd[num]):
        pos = dd[num][pp]+1
    else:
        ans.append(num)
        pos += 1
print(*ans)


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , "; logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */

int main(){
    int n; cin >> n; out(n/3);
}

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

int main(){
    int n, m;
    int a[101][101]={};
    cin >> n >> m;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            a[i][m] += a[i][j]; 
        }
    }
    for (int j = 0; j < m; j++){
        for (int i = 0; i < n; i++){
            a[n][j] += a[i][j];
        }
        a[n][m] += a[n][j];
    }
    for (int i = 0; i < n+1; i++){
        for (int j = 0; j < m; j++){
            cout << a[i][j] << " ";
        }
        cout << a[i][m] << endl;
    }
}


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

const int INF = (1<<28);
int N;
char A[555][555];
bool F[555];

int calc(int R){
  int cnt = 0;
  int ec = 0;
  int pc = 1-F[R];
  for(int j=0;j<N;j++){
    ec++;
    if( A[R][j] == '.' ){
      cnt++;      
    } else {
      bool cf = true;
      for(int i=0;i<N;i++)
        if( A[i][j] == '.' ) cf = false;
      if( cf ) ec--;
    }
  }
  //cout << R << " : " << cnt << " + " << ec << " + " << pc << endl;
  return cnt + ec + pc;
}


bool check(){
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++) if( A[i][j] == '.' ) return false;
  }
  return true;
}

void view(){
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++) cout << A[i][j] << " ";
    cout << endl;
  }
}

int solve(){
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++)
      if( A[i][j] == '#' ) F[j] = true;  
  int res = INF;
  for(int i=0;i<N;i++){
    res = min( res, calc(i) );
  }
  return res;
}

int main(){
  cin >> N;
  
  bool rf = true;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      cin >> A[i][j];
      if( A[i][j] == '#' ) rf = false;
    }
  }
  if( rf  ) {
    cout << -1 << endl; return 0;
  } else {
    cout << solve() << endl;
  }
}


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

int main() {
    int n; cin >> n;
    string s; cin >> s;
    vector<int> e(n);
    vector<int> w(n);
    for (int i = 0; i < n; i++) {
        if (s[i] == 'W') {
            if (i == 0) w[i] = 1;
            else w[i] = w[i-1] +1;
        } 
        else {
            if (i != 0) w[i] = w[i-1];
        }
    }
    for (int i = n-1; 0 <= i; i--) {
        if (s[i] == 'E') {
            if (i == n-1) e[i] = 1;
            else e[i] = e[i+1] +1;
        }
        else {
            if (i != n-1) e[i] = e[i+1];
        }
    }
    int ans = 100100100;
    for (int i = 0; i < n; i++) {
        if (i == n-1) {
            ans = min(ans, w[i-1]);
        }
        else if (i == 0) {
            ans = min(ans, e[i+1]);
        }
        else {
            ans = min(ans, e[i+1] + w[i-1]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 6152
#include<stdio.h>

int main(void){
 int N;
 scanf("%d",&N);
 int A[N];
 int cnt=0,dice=0;
 for(int i=0;i<N;i++) scanf("%d",&A[i]);   
 for(int i=0;i<N;i++){
    if(A[i]==1) cnt+=1;
    else if(A[i]==0){
        if(dice<cnt+1) dice=cnt+1;
        cnt=0;
    }
 }
 if(dice<cnt+1) dice=cnt+1;
 printf("%d\n",dice);
 return(0);
}


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

int main(){
    int n;
    cin>>n;
    vector<int> a(3*n);
    rep(i,3*n) cin>>a[i];
    sort(a.rbegin(),a.rend());
    ll ans = 0; int i=1;
    while(n){
        ans += a[i];
        i+=2;
        n--;
    }
    cout<< ans << endl;
    
    return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>
int main(){
    int w,h,x,y,r;
    int isout=1;
    scanf("%d%d%d%d%d",&w,&h,&x,&y,&r);
    if((x-r)<0||(y-r)<0||(x+r)>w||(y+r)>h){
    }else{
        isout=0;
    }
    printf("%s\n",isout?"No":"Yes");
    return 0;
}

Measured memory_bytes: 1012
function Main(input) {
   var ab = input.split(" ");
   var a = parseInt(ab[0]);
   var b = parseInt(ab[1]);
   var seki = a*b;
   if (seki % 2 === 0) {
       console.log('Even');
   } else {
       console.log('Odd');
   }


}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main() {
  string S;
  cin >> S;
  
  if (S == "a" || S == "i" || S == "u" || S == "e" || S == "o") {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" <<endl;
  }
}

Measured memory_bytes: 256