akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N, w = 0, S;
    scanf("%d",&N);
    for(int i = 1; 1; i++){
		N -= i;
		if(N<=0){
			S=i;
			break;
		}
	}
	int SS[S+1][S];
	if(!N){
		printf("Yes\n");
		printf("%d\n", S+1);
		for(int i = 0; i < S+1; i++){
			printf("%d ", S);
			for(int j = 0; j < i; j++){
				SS[i][j] = SS[j][i-1];
				printf("%d ", SS[i][j]);
			}
			for(int j = i; j < S; j++){
				w++;
				SS[i][j] = w;
				printf("%d ", w);
			}
			printf("\n");
		}
	}else printf("No");
}
	


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

int main() {
  int N;
  cin >> N;
  
  int64_t ans;
  
  if (N == 0) {
    ans = 2;
  } else if (N == 1) {
    ans = 1;
  } else {
    ans = 1;
    int64_t preans = 2;
    int64_t tmp = 0;
    for (int i = 0; i < N - 1; i++) {
      tmp = ans;
      ans = ans + preans;
      preans = tmp;
    }
  }
  
  cout << ans << endl;
}

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

typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) (in),(in)+(K)

#define INF 1e18
#define MOD 1000000007
#define SIZE 10005
#define PI 	3.14159265358979323846

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; } //最小公倍数

char input(){
  char a;
  cin >> a;
  return a;
}

int main(){
  cout << fixed << setprecision(16);
  long double n;
  cin >> n;
  cout << (int)((n+1)/2)/n << endl;
}

Measured memory_bytes: 256
n = int(input())
s1 = input()
s2 = input()
mod = 10**9+7
if s1[0]==s2[0]:
  ans = 3
  pre = '-'
  i = 1
else:
  ans = 6
  pre = '|'
  i = 2
while i<n:
  if s1[i]==s2[i]:
    if pre=='-':
      ans *= 2
      ans %= mod
    pre = '-'
    i += 1
  else:
    if pre=='-':
      ans *= 2
      ans %= mod
    else:
      ans *= 3
      ans %= mod
    pre = '|'
    i += 2
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;
using namespace std;
 
int L[MAX/2+2],R[MAX/2+2];
 
llong merge(int A[],int n,int left,int mid,int right)
{
    int i,j,k;
    llong cnt=0;
    int n1=mid-left;
    int n2=right-mid;
    for(i=0;i<n1;++i)L[i]=A[left+i];
    for(i=0;i<n2;i++)R[i]=A[mid+i];
    L[n1]=R[n2]=SENTINEL;
    i=j=0;
    for(k=left;k<right;k++)
    {
        if(L[i]<=R[j])
        {
            A[k]=L[i++];
        }
        else
        {
            A[k]=R[j++];
            cnt+=n1-i;// =mid+j-k-1
        }
    }
    return cnt;
}
 
llong mergeSort(int A[],int n,int left,int right)
{
    int mid;
    llong v1,v2,v3;
    if(left+1<right)
    {
        mid=(left+right)/2;
        v1=mergeSort(A,n,left,mid);
        v2=mergeSort(A,n,mid,right);
        v3=merge(A, n, left, mid, right);
        return v1+v2+v3;
    }
    else return 0;
}
 
int main()
{
    int A[MAX],n,i;
     
    while(scanf("%d",&n)==1)
    {
        for(i=0;i<n;i++)scanf("%d",&A[i]);
        llong ans=mergeSort(A,n,0,n);
        printf("%lld\n",ans);
    }
     
}

Measured memory_bytes: 4272
# >0<
s = input()
if s[0] ==">":
    s = "<"+s
if s[-1]=="<":
    s = s +">"
#末端の処理
l=len(s)
upp = 0
dwn = 0
ans = 0
U = []
D = []
for i in range(l):
    if s[i] == "<":
        if dwn:
            D.append(dwn)
            ans += dwn*(dwn+1)//2
            dwn = 0
        upp+=1
    else:
        if upp:
            U.append(upp)
            ans += upp*(upp+1)//2
            upp=0
        dwn += 1
ans += dwn*(dwn+1)//2
for i in range(len(D)):
    ans -= min(U[i],D[i])
print(ans-1)


Measured memory_bytes: 53888
#include <bits/stdc++.h>
#define fp(i, l, r) for(register int i = (l); i <= (r); ++i)
#define fp(i, l, r) for(register int i = (l); i >= (r); --i)
#define il inline
#define MAXN (int)5e3 + 50 

int main() {
	int n;
	scanf("%d", &n);
	if(n%10 == n % 1000 / 100) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
map<string,bool> q;
string a,b;
int main()
{
	int n;
	cin>>n;
	n--;
	cin>>b;
	a=b;
	q[a]=1;
	while(n--)
	{
		cin>>b;
		if(q[b])
		{
			cout<<"No";
			return 0;
		}
		else
		{
			q[b]=1;
		}
		if(b[0]!=a[a.size()-1])
		{
			cout<<"No";
			return 0;
		}
		a=b;
	}
	cout<<"Yes";
}


Measured memory_bytes: 256
import java.util.*;
import java.math.BigInteger;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int noc=sc.nextInt(), i=0, n=noc;
		BigInteger t = BigInteger.ZERO;
		int[] a = new int[noc];
		while (noc-->0) a[i++] = sc.nextInt();
		for (i=0; i<n-1; i++) {
			if (a[i]>a[i+1]) {
				t = t.add(new BigInteger(""+(a[i]-a[i+1])));
				a[i+1]=a[i];
			}
		}
		System.out.println(t);
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

}


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

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

    vector<int> a(n);
    for (int &x : a) cin >> x;
   
    double res = 0;
    for (int x : a) res += 1.0 / x;
   
    cout << 1.0 / res << endl;
}

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

int		main() {
	int N;
	int M;

	cin >> N >> M;
	vector<int> vec(N);
	for (int i = 0; i < M; i++)
	{
		int a;
		int b;

		cin >> a >> b;
		vec.at(a - 1)++;
		vec.at(b - 1)++;
	}
	for (int i = 0; i < N; i++)
		cout << vec.at(i) << endl;
}


Measured memory_bytes: 256
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char **argv) {
  int n;
  scanf("%d", &n);
  printf("%d\n", (n + 1) / 2);
  return EXIT_SUCCESS;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <vector>

using namespace std;

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

#define INF 1000000000
#define F first
#define S second
#define forn(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)

using namespace std;


int main(){
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if(a%2 == 1 || b % 2 == 1 || c % 2 == 1){
		printf("0\n");
		return 0;
	}
	if(a == b && b == c){
		printf("-1\n");
		return 0;
	}
	int cnt = 0;
	while(a%2 == 0 && b % 2 == 0 && c % 2 == 0){
		cnt++;
		int x = (b+c)/2;
		int y = (a+c)/2;
		int z = (a+b)/2;
		a = x;
		b = y;
		c = z;
	}
	printf("%d\n", cnt);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define min(...) minn(__VA_ARGS__)
#define max(...) maxx(__VA_ARGS__)
#define stringio() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
char _;
typedef long long ll;
typedef pair<int,int> pii;
template<typename t>constexpr const t minn(const t x,const t y){return x<y?x:y;}
template<typename t,typename ...r>constexpr const t minn(const t x,const r ...xs){return minn(x,minn(xs...));}
template<typename t>constexpr const t maxx(const t x,const t y){return x>y?x:y;}
template<typename t,typename ...r>constexpr const t maxx(const t x,const r ...xs){return maxx(x,maxx(xs...));}
template <typename t> void scan (t& x) {do{while((x=getchar_unlocked())<'0'); for(x-='0'; '0'<=(_=getchar_unlocked()); x=(x<<3)+(x<<1)+_-'0');}while(0);}
template <typename t, typename ...r> void scan (t& x, r&... xs) {scan(x); scan(xs...);}
const int MAXN = 100005;
set<char> s;
int main() {
	for (int i = 0; i < 4; i++) s.insert(getchar_unlocked());
  	printf (s.size() == 2 ? "Yes\n" : "No\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
                                        #include<iostream>
                                        #include<cstdio>
                                        #include<vector>
                                        #include<queue>
                                        #include<map>
                                        #include<cstring>
                                        #include<string>
                                        #include <math.h>
                                        #include<algorithm>
                                    //    #include <boost/multiprecision/cpp_int.hpp>
                                        #include<functional>
                           //     #define int long long
                                        #define inf  1000000007
                                        #define pa pair<int,int>
                                        #define ll long long
                                        #define pal pair<double,pa>
                                        #define ppa pair<int,int>
                                        #define ppap pair<pa,pa>
                                        #define ssa pair<string,int>
                                        #define  mp make_pair
                                        #define  pb push_back
                                        #define EPS (1e-10)
                                        #define equals(a,b) (fabs((a)-(b))<EPS)
                                  #define VI vector<int>
                                        using namespace std;
                                        
                                  class pas{
                                    	public:
                                    	int x,y;
                                    	pas(int x=0,int y=0):x(x),y(y) {}
                                    	pas operator + (pas p) {return pas(x+p.x,y+p.y);}
                                    	pas operator - (pas p) {return pas(x-p.x,y-p.y);}
                                    	pas operator * (int a) {return pas(x*a,y*a);}
                                    	pas operator / (int a) {return pas(x/a,y/a);}
                                    //	double absv() {return sqrt(norm());}
                                    	int norm() {return x*x+y*y;}
                                    	bool operator < (const pas &p) const{
                                    		return x != p.x ? x<p.x: y<p.y;
                                    	}
                                    	bool operator == (const pas &p) const{
                                    		return x==p.x && y==p.y;
                                    	}
                                    };

           signed main(){
        
           	string s;
           	cin>>s;
           	int a[30]={0};
           	for(auto c:s)a[c-'a']++;
           	for(int i=0;i<26;i++)if(a[i]>1){
           		cout<<"no"<<endl;
           		return 0;
           	}
           	cout<<"yes"<<endl;
           	
           	return 0;
           	
           	
           }
             

Measured memory_bytes: 256
#include <iostream>

using namespace std;

string s = "qwertasdfgzxcvb";
int main() {
	string str;
	while ( cin >> str, str != "#" ) {
		if (str.size() == 0) cout << 0 << endl;
		else {
			int ans = 0;
			bool prev = false;
			for (int i = 0; i < str.size(); ++i) {
				if ((s.find(str[i], 0) != -1) ^ prev) {
					if (i) ++ans;
				}
				prev = s.find(str[i], 0) != -1;
			}
			cout << ans << endl;
		}
	}
}

Measured memory_bytes: 1188
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

int solve()
{
    int N, M;

    std::cin >> N >> M;

    vector<vector<int>> graph(N);

    for (int i = 0; i < M; ++i) {
        int s, t;
        cin >> s >> t;
        --s;
        --t;

        graph[s].push_back(t);
        graph[t].push_back(s);
    }

    vector<int> parent(N, -1);
    vector<bool> visited(N, false);
    queue<int> q;
    q.push(0);
    visited[0] = true;
    int counter = 0;

    while (!q.empty()) {
        int room = q.front();
        q.pop();
        counter++;

        for (int child : graph[room]) {
            if (!visited[child]) {
                visited[child] = true;
                parent[child] = room;
                q.push(child);
            }
        }
    }

    if (counter != N)
        cout << "No" << endl;
    else {
        cout << "Yes\n";

        for (int i = 1; i < N; ++i)
            cout << (parent[i] + 1) << '\n';
    }

    return 0;
}

int main()
{
//    std::cout << solve() << std::endl;
    solve();

    return 0;
}

Measured memory_bytes: 10116
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
using ll = long long;

inline bool bit(ll x, int b) { return (x >> b) & 1; }

constexpr int SZ = 100000;
constexpr int prs = 10;
ll pre[1 << prs][SZ + 1];

int main() {
  int N;
  cin >> N;
  vector<int> V(N + 1), W(N + 1);
  REP(i, N) cin >> V[i + 1] >> W[i + 1];
  FOR(i, 1, min(N + 1, 1 << prs)) {
    if (i != 1) copy(pre[i / 2], pre[i / 2] + SZ + 1, pre[i]);
    for (int j = SZ; j >= W[i]; --j)
      pre[i][j] = max(pre[i][j], pre[i][j - W[i]] + V[i]);
    REP(j, SZ) pre[i][j + 1] = max(pre[i][j + 1], pre[i][j]);
  }
  int Q;
  cin >> Q;
  while (Q--) {
    int v, L;
    cin >> v >> L;
    if (v < (1 << prs)) {
      cout << pre[v][L] << "\n";
    } else {
      int lvl = 32 - __builtin_clz(v) - prs;
      ll ans = 0;
      REP(b, 1 << lvl) {
        int w = 0;
        ll va = 0;
        REP(i, lvl) {
          if ((b >> i) & 1) {
            w += W[v >> i];
            va += V[v >> i];
          }
          if (w > L) break;
        }
        if (w <= L) ans = max(ans, pre[v >> lvl][L - w] + va);
      }
      cout << ans << "\n";
    }
  }
  return 0;
}


Measured memory_bytes: 804488
//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var one = nextIntArray();
	var A = one[0];
	var B = one[1];
	var output = [A+B, A-B, A*B];
	myout(Math.max.apply(null,output));
}


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

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

    int ans = 0;
    int frag = 0;

    if(L >= 0){
        L++;
        for(int i = 1; i < N; i++){
            ans += L;
            L++;
        }
    }else{
        for(int i= 0; i < N; i++){
            if(L == 0){
                L++;
                frag = 1;
                continue;
            }
            ans += L;
            L++;
        }

        if(frag == 0){
            L--;
            ans -= L;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

main()

{
    long long int S, Y, M;

    scanf("%lld",&S);
    Y = S / 100;
    M = S % 100 ;

    if( ((Y>=1)&&(Y<=12)) &&
            ((M>=1)&&(M<=12)) )
    {
        printf("AMBIGUOUS\n");
    }

    else if(Y >= 1 && Y <= 12)
    {
        printf("MMYY\n");
    }

    else if(M >= 1 && M<=12)
    {
        printf("YYMM\n");
    }

    else
    {
        printf("NA\n");
    }
    
    return 0;
}


Measured memory_bytes: 1620
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

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

using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

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

    int n, x, t;
    cin >> n >> x >> t;

    int res = n/x;
    if (n%x >= 1) res++;
    res*=t;
    wcout << res << "\n";
}

Measured memory_bytes: 3612
import java.io.*;
import java.util.*;
 
public class Main{
	
 
	public void solve(){
		while(true){
			int H = nextInt();
			if(H == 0) break;
			int[][] board = new int[H][5];
			for(int i = 0; i < H; i++){
				for(int j = 0; j< 5; j++){
					board[i][j] = nextInt();
				}
			}
			boolean erased = true;
			int score = 0;
			while(erased){
				erased = false;
				for(int i = 0; i < H; i++){
					int c = 0;
					int len = 0;
					for(int j = 0; j < 5; j++){
						if(board[i][j] == c){
							len++;
						}else{
							if(len >= 3 && c != 0){
								for(int k = 0; k < len; k++){
									board[i][j - 1 - k] = -1;
									score += c;
								}
								erased = true;
								
							}
							c = board[i][j];
							len = 1;
							
						}
					}

					if(len >= 3&& c != 0){
						for(int k = 0; k < len; k++){
							board[i][4 - k] = -1;
							score += c;
						}
						erased = true;
					}
				}
				for(int j = 0; j < 5; j++){
					int c = H - 1;
					for(int i = H - 1; i >= 0; i--){
						if(board[i][j] != -1){
							int tmp = board[i][j];
							board[c][j] = tmp;
							c--;
						}
					}
					for(int i = c; i >= 0; i--){
						board[i][j] = 0;
					}
				}
			}
			out.println(score);
		}
	}
	
	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	
	
	
	public static int nextInt(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;
	}
	
	public static long nextLong(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}
	public static String next(){
		int c;
		while(!isAlNum(c = read())){}
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	
	
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
}

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

#define int long long

signed main() {
  int N, M;
  while ( cin >> N >> M, N ) {
    vector<pair<int, pair<int, int> > > logs(M);
    for ( int i = 0; i < M; i++ ) {
      cin >> logs[i].first >> logs[i].second.first >> logs[i].second.second;      
    }
    
    sort(logs.begin(), logs.end());

    bool infected[20000] = {};
    infected[0] = true;
    for ( int i = 0; i < M; i++ ) {
      auto path = logs[i].second;
      int s = path.first, t = path.second;
      s--; t--;
      if ( infected[s] ) infected[t] = true;
    }

    int ans = 0;
    for ( int i = 0; i < N; i++ ) ans += infected[i];
    cout << ans << endl;
  }
  
  return 0;
}



Measured memory_bytes: 3760
import java.io.*;
import java.util.StringTokenizer;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer s =new StringTokenizer(in.readLine(), " ");
		
		int x = Integer.parseInt(s.nextToken());
		int y = Integer.parseInt(s.nextToken());
		
		int c = Math.abs(Math.abs(x) - Math.abs(y));
		
		if(x < 0 && y < 0){
			if(x >= y)
				c += 2;
		}
		if( x >= 0 && y >= 0){
			if(y == 0){
				c--;
			}
			if(x > y){
				c += 2;
			}
		}
		
		if(x >= 0 && y < 0 || x < 0 && y > 0) c++;
		
		System.out.println(c);
	}
}


Measured memory_bytes: 21204
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<string>


using namespace std;

int main(void)
{
	string str;
	cin >> str;
	int i;
	for (i = 0; i < 19; i++)
	{
		if (i == 5 || i == 13)
		{
			cout << ' ';
		}
		else
		{
			cout << str[i];
		}
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define fir first
#define sec second
#define mod 998244353
#define int long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
inline int min(int x,int y,int z){return min(x,min(y,z));}
inline int max(int x,int y,int z){return max(x,max(y,z));}
inline int add(int x,int y){return x+y>=mod?x+y-mod:x+y;}
inline int add(int x,int y,int z){return add(add(x,y),z);}
inline int sub(int x,int y){return x-y<0?x-y+mod:x-y;}
inline int mul(int x,int y){return 1LL*x*y%mod;}
inline int mul(int x,int y,int z){return mul(mul(x,y),z);}
map<int,int> f;
int a,b,c,d;
int dfs(int x)
{
	if(x==0) return 0;
	if(f[x]) return f[x];
	int res=INF;
	if((__int128)d*x<res) res=d*x;
	int l=x/2;
	if(l!=x) res=min(res,(x-l*2)*d+a+dfs(l));
	l=x/2+1;
	if(l!=x) res=min(res,(l*2-x)*d+a+dfs(l));
	l=x/3;
	if(l!=x) res=min(res,(x-l*3)*d+b+dfs(l));
	l=x/3+1;
	if(l!=x) res=min(res,(l*3-x)*d+b+dfs(l));
	l=x/5;
	if(l!=x) res=min(res,(x-l*5)*d+c+dfs(l));
	l=x/5+1;
	if(l!=x) res=min(res,(l*5-x)*d+c+dfs(l));
	return f[x]=res;
}
void work()
{
	f.clear();
	int n=read();
	cin>>a>>b>>c>>d;
	cout<<dfs(n)<<endl;
}
signed main()
{
	int T=read();
	while(T--) work();
	return 0;
}




Measured memory_bytes: 4868
h,w=gets.split.map(&:to_i)
s=[]
h.times do |i|
  s << gets.chomp
end
h.times do |i|
  w.times do |j|
    if s[i][j]=="#"
      unless (i>0&&s[i-1][j]=="#")||(j>0&&s[i][j-1]=="#")||(i<h-1&&s[i+1][j]=="#")||(j<w-1&&s[i][j+1]=="#")
        puts "No"
        exit
      end
    end
  end
end
puts "Yes"
exit

Measured memory_bytes: 1916
I = input().split(" ")
N = int(I[0])
Y = int(I[1])
a = "-1 -1 -1"
for m in range(N+1):
    for g in range(N-m+1):
        if m * 10000 + g * 5000 + (N-m-g) * 1000 == Y:
            a = str(m) + " " + str(g) + " " + str((N-m-g))
            break
    if a != "-1 -1 -1":
        break         

print(a)

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

using namespace std;

int main()
{
    int a , b , t , T , sum = 0;

    cin >> a >> b >> t;

    T = a;

    while(T < t + 0.5)
    {

        T += a;

        sum += b;
    }

    cout << sum << endl;


    return 0;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    a = [int(x) for x in input().split()]

    a.sort(reverse = True)

    Alice, Bob = 0, 0

    for turn in range(0, len(a), 2):
        Alice += a[turn]

    for turn in range(1, len(a), 2):
        Bob += a[turn]

    print(Alice - Bob)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
import numpy as np

A, B, H, M = map(int, input().split())

# なす角を求める
deg_H = (H+ M/60)*(360/12)
deg_M = M*(360/60)
theta = deg_H - deg_M

if abs(theta) >= 180:
  if theta > 0:
    theta = deg_M + (360-deg_H)
  else:
    theta = deg_H + (360-deg_M)
else:
  theta = abs(theta)

C2 = A**2 + B**2 - 2*A*B*np.cos(np.deg2rad(theta))

print(np.sqrt(C2))

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

int main(){
    int N=0,K=0;
    cin>>N;
    int tmp;

    string ans="";


    while(N!=0){
        if(N%2!=0){
            N--;
            ans="1"+ans;

        }else ans="0"+ans;

        N/=-2;

    }
    if (ans == "") ans = "0";


    cout<<ans<<endl;

}

Measured memory_bytes: 256
#include "bits//stdc++.h"
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
int e[10][10];
int main() {
	int d, w;
	while (cin >> d >> w, d) {
		for (int i = 0; i < d; i++) {
			for (int j = 0; j < w; j++) {
				cin >> e[i][j];
			}
		}
		int ans = 0;
		for (int y1 = 0; y1 < d; y1++) {
			for (int x1 = 0; x1 < w; x1++) {
				for (int y2 = y1 + 2; y2 < d; y2++) {
					for (int x2 = x1 + 2; x2 < w; x2++) {
						int min_out = 1 << 30;
						int max_in = 0;
						for (int y = y1; y <= y2; y++) {
							for (int x = x1; x <= x2; x++) {
								if (y == y1 || y == y2 || x == x1 || x == x2) {
									min_out = min(min_out, e[y][x]);
								}
								else {
									max_in = max(max_in, e[y][x]);
								}
							}
						}
						if (min_out <= max_in) continue;
						int sum = 0;
						for (int y = y1; y <= y2; y++) {
							for (int x = x1; x <= x2; x++) {
								if (!(y == y1 || y == y2 || x == x1 || x == x2)) {
									sum += min_out - e[y][x];
								}
							}
						}
						ans = max(ans, sum);
					}
				}
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
const int N=200005;
int n,a[N];
int b[N];
int check(int k){
	for (int i=1;i<n*2;i++)
		b[i]=a[i]>k;
//	for (int i=1;i<n*2;i++)
//		printf("%d",b[i]);
	int m=n;
	int L=m,R=m;
	while (L>1&&b[L]!=b[L-1])
		L--;
	while (R<n*2-1&&b[R]!=b[R+1])
		R++;
	if (L==m||R==m)
		return b[m];
	if (b[L]==b[R])
		return b[L];
	return m-L>R-m?b[R]:b[L];
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<n*2;i++)
		scanf("%d",&a[i]);
	int L=1,R=n*2-1,mid,ans=R;
	while (L<=R){
		mid=(L+R)>>1;
		if (!check(mid))//printf(" ret = 0\n"),
			R=mid-1,ans=mid;
		else//	printf(" ret = 1\n"),
			L=mid+1;
	}
	printf("%d",ans);
	return 0;
}

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

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

const int maxn = 1e5 + 5;

int gcd(int a, int b){
    return b == 0 ? a : gcd(b, a % b);
}

bool solve(vector<int> a){
    ll sum = 0;
    int n = a.size();
    for(auto v : a){
        sum += v;
    }
    if(a[0] == 1){
        if((sum - n) & 1){
            return true;
        }else{
            return false;
        }
    }else{
        if((sum - n) & 1){
            return true;
        }else{
            int odd = 0;
            int pos = 0;
            for(int i = 0;i < n;i++){
                if(a[i] & 1){
                    odd++;
                    pos = i;
                }
            }
            if(odd == 1){
                a[pos]--;
                vector<int> b;
                int g = a[0];
                for(int i = 1;i < n;i++){
                    g = gcd(g, a[i]);
                }
                for(int i = 0;i < n;i++){
                    b.push_back(a[i] / g);
                }
                return !solve(b);
            }else{
                return false;
            }
        } 
    }
}


int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    ll sum = 0;
    vector<int> a;
    for(int i = 1;i <= n;i++){
        int u;
        cin >> u;
        a.push_back(u);
    }
    sort(a.begin(), a.end());
    if(solve(a)){
        cout << "First" << endl;
    }else{
        cout << "Second" << endl;
    }
    return 0;
}


Measured memory_bytes: 19192
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef long double ld;
typedef vector<ll>VI;
typedef pair<int,int>P;
#define VV(T) vector<vector<T>>
#define sz(x) int(x.size())
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i,n) for (ll i=(ll)n-1;i>=0;i--)
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX6 1001001//6
#define MAX7 10010010//7
#define SENTINEL 2000000000//9
#define INF 1<<30
#define INFTY 1LL<<60
#define MAX_INT INT_MAX
#define Endl '\n'
#define CLR(mat) memset(mat, 0, sizeof(mat))
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}//最大公約数
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}//最小公倍数
template<class T> bool contain(const std::string& s, const T& v) {
   return s.find(v) != std::string::npos;
}
const int MOD = 1000000007;

inline ll mod_add(ll a,ll b){return (a+b)%MOD;}
inline ll mod_sub(ll a,ll b){return (a+MOD-b)%MOD;}
inline ll mod_mul(ll a,ll b){return ((a%MOD)*(b%MOD))%MOD;}
inline ll mod_pow(ll x,ll n,ll mod=(ll)MOD){ll res=1;while(n>0){
if(n&1)res=res*x%mod;
x=x*x%mod;n>>=1;}return res;}
inline ll mod_inv(ll x){return mod_pow(x,MOD-2);}
inline ll mod_div(ll a, ll b){return mod_mul(a,mod_inv(b));}
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17
//push_back -> emplace_back

int main(){
    ll n;cin>>n;
    ll ans=0;
    for(int a=1;a<n;a++){
        ans+=(n-1)/a;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,a,b;cin >> n >> a >> b;
	string s;cin >> s;
	int sum=0,cnt=0;
	vector<bool> ans(n);
	rep(i,n){
		if(s.at(i)=='a'){
			if(sum<a+b){
				ans.at(i)=true;
				sum++;
			}
		}
		else if(s.at(i)=='b'){
			if(sum<a+b && cnt<b){
				ans.at(i)=true;
				sum++;
				cnt++;
			}
		}
	}
	rep(i,n){
		if(ans.at(i)) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

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

int main() {
    int a[3][3],b[4][4];
    int n;
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>a[i][j];
        }
    }
        for(int i=0;i<4;i++){
        for(int j=0;j<4;j++){
            b[i][j]=0;
        }
    }
    
    cin>>n;
    
    int l[n];
    for(int i=0;i<n;i++){
        cin>>l[i];
    }
    
        for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<n;k++)
            if(l[k] == a[i][j]){
                b[i][j]=1;
                b[i][3]+=1;
                b[3][j]+=1;
            }
        }
    }
    int c=0;
    
        for(int i=0;i<4;i++){
        for(int j=0;j<4;j++){
            if(b[3][j]==3 || b[i][3]==3){
                c = 1;
                break;
            }
        }
    }
    if(b[0][0]+b[1][1]+b[2][2]==3 || b[2][0]+b[1][1]+b[0][2]==3){
        c = 1;
    }
    
    if(c == 1){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yes(){
    cout << "Yes" << endl;
}

void no (){
    cout << "No" << endl;
}

ll cel (ll a, ll b){
    if (a % b == 0) return a / b;
    else return a / b + 1;
}

ll gcds(ll a, ll b){
    ll c = a % b;
    while (c != 0){
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

int main() {
    int n; cin >> n;
    ll ni = 0LL;
    ll wa = 0LL;
    rep(i,n){
        ll a; cin >> a;
        ni += a * a % mod;
        ni %= mod;
        wa += a;
        wa %= mod;
    }
    ll ans = wa * wa - ni + mod;
    ans %= mod;
    if (ans % 2LL == 0) cout << ans / 2LL << endl;
    else cout << (ans+mod) / 2LL << endl;
}


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

#define int long long
#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define mod 1000000007
#define show(n) cerr<<#n<<" = "<<n<<endl
#define showp(n) cerr<<n.fs<<", "<<n.sc<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showsp(n) for(auto z:n){cerr<<z.fs<<" "<<z.sc<<", "}cerr<<endl

#define yes printf("Yes\n")
#define no printf("No\n")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

const int INF=1LL<<55;

int n;
int a[1000001],b[1000001];
int v;

void ume(){
    REP(i,1,1000001){
        a[i]=b[i]=i;
        for(int j=0;;j++){
            v=j*(j+1)*(j+2)/6;
            if(i-v<0) break;
            a[i]=min(a[i], a[i-v]+1);
            if(v&1) b[i]=min(b[i],b[i-v]+1);
        }
    }
}

void solve(){
    
    cout<<a[n]<<" "<<b[n]<<endl;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ume();
    while(cin>>n,n){
        solve();
    }

    return 0;
}


Measured memory_bytes: 18756
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;

int main(){
    string s,t;
    cin>>t>>s;
    int ans=1000000;
    for(int i=0;i<=t.length()-s.length();i++){
        int y=0;
        for(int j=0;j<s.length();j++){
            if(s[j]!=t[i+j]){
                y++;
            }
        }
        ans=min(ans,y);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
vec v[5];
bool u[600010];
int c[5],nedge,too[500010],ans[600010],hed[600010],nxt[500010],dep[600010],n,x,y;
void ae(int x,int y){
	nxt[++nedge]=hed[x];
	hed[x]=nedge;
	too[nedge]=y;
}
void dfs(int x,int l){
	dep[x]=dep[l]+1;
	for (int i=hed[x];i;i=nxt[i]){
		int y=too[i];
		if (y==l) continue;
		dfs(y,x);
	}
}
void R(){
	FOR(i,1,n) u[ans[i]]=1;
	int t=1;
	FOR(i,1,n)if (!ans[i]){
		while (u[t]) ++t;
		ans[i]=t;
		++t;
	}
}
int main(){
	cin>>n;
	FOR(i,2,n){
		getint(x),getint(y);
		ae(x,y),ae(y,x);
	}
	dfs(1,0);
	FOR(i,1,n) v[dep[i]%2].pb(i);
	FOR(i,1,n) c[i%3]++;
	if (c[2]>SZ(v[0])){
		FOR(i,0,SZ(v[0])-1){
			ans[v[0][i]]=i*3+3;
			u[i*3+3]=1;
		}
		R();
	}
	else if (c[1]>SZ(v[1])){
		FOR(i,0,SZ(v[1])-1){
			ans[v[1][i]]=i*3+3;
			u[i*3+3]=1;
		}
		R();
	}
	else{
		FOR(i,0,c[2]-1){
			ans[v[0][i]]=i*3+2;
			u[i*3+2]=1;
		}
		FOR(i,0,c[1]-1){
			ans[v[1][i]]=i*3+1;
			u[i*3+1]=1;
		}
		R();
	}
	FOR(i,1,n) printf("%d ",ans[i]);
	return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        string[] input;
        int[] inputer;
        int node;
        int u = 0;
        int k = 0;
        int[,] a = new int[n, n];


        for (int i = 0; i < n; i++)
        {
            input = Console.ReadLine().Split(' ');
            inputer = Array.ConvertAll(input, int.Parse);

            u = inputer[0];   //注目する頂点
            k = inputer[1];   //頂点数


            for (int j = 0; j < k; j++)
            {             
                node = inputer[j + 2];            
                a[u - 1, node - 1] = 1;
            }
        }

        for(int i = 0; i < n; i++)
        {
            for(int j = 0; j < n; j++)
            {
                if(j == n - 1)
                {
                    Console.WriteLine(a[i, j]);
                }
                else
                {
                    Console.Write(a[i, j] + " ");
                }         
            }
        }

    }
}



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

int main(){
    int k;
    cin >> k;
    vector<string> a(k), b(k);
    for(int i = 0; i < k; i++)  cin >> a[i];
    for(int i = 0; i < k; i++)  cin >> b[i];
    int iso = 0, nak = 0;
    for(int i = 0; i < k; i++){
        int isobad = (iso==0&&a[i][0]=='k');
        int nakbad = (nak==0&&b[i][0]=='k');
        if(isobad+nakbad == 1){
            cout << (isobad ? "Nakajima" : "Isono") << "-kun" << endl;
            return 0;
        }else if(isobad+nakbad == 2){
            iso = nak = 0;
        }else{
            if(a[i][0]=='k' && b[i][0]=='k'){
                if(iso==nak){
                    iso = nak = 0;
                }else{
                    cout << (iso > nak ? "Isono" : "Nakajima") << "-kun" << endl;
                    return 0;
                }
            }else if(a[i][0]=='k'){
                if(iso==5 || b[i][0]=='t'){
                    cout << "Isono-kun" << endl;
                    return 0;
                }else{
                    iso = 0;
                }
            }else if(b[i][0]=='k'){
                if(nak==5 || a[i][0]=='t'){
                    cout << "Nakajima-kun" << endl;
                    return 0;
                }else{
                    nak = 0;
                }
            }else{
                if(a[i][0]=='t')    iso++;
                if(b[i][0]=='t')    nak++;
                if(iso > 5) iso = 5;
                if(nak > 5) nak = 5;
            }
        }
    }
    cout << "Hikiwake-kun" << endl;
    return 0;
}


Measured memory_bytes: 3232
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        x: usize,
        n: usize,
        p: [usize; n],
    }

    if !p.contains(&x) {
        println!("{}", x);
        return;
    }
    for i in 1..200 {
        let val1 = x - i;
        let val2 = x + i;
        if !p.contains(&val1) {
            println!("{}", val1);
            return;
        }
        if !p.contains(&val2) {
            println!("{}", val2);
            return;
        }
    }
}


Measured memory_bytes: 2156
#include <stdio.h>
#include <math.h>
int prime(int );

int main(){

  int n,m,i,ans = 0;

  scanf("%d\n",&n);

  for(i = 0;i < n;i++){

    scanf("%d",&m);
    if(m == 2) ans++;
    if(prime(m) == 1){
      // printf("m = %d\n",m);
      ans++;
    }
  }
  printf("%d\n",ans);
  return 0;
}
  int prime(int in){

    int i,j;
    if(in % 2 == 0) return 0;
    for(i = 3;i <= sqrt(in);i+=2){
      if(in % i == 0) return 0;
    }
    return 1;
  }

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
vector<int> road[200001];

int main(void){
  int n, m;
  cin >> n >> m;
  for(int i=0;i<m;++i){
    int a, b;
    cin >> a >> b;
    road[a].push_back(b);
    road[b].push_back(a);
  }
  for(int i=0;i<road[1].size();++i){
    int now = road[1][i];
    for(int j=0;j<road[now].size();++j){
      if(road[now][j]==n){
        cout << "POSSIBLE" << endl;
        return 0;
      }
    }
  }
  cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 12016
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


double calc_e()
{
	int n, m;
	cin >> n >> m;
	double s = 0, empty_r = 1;
	for (int i = 0; i < m; ++i)
	{
		double v, r;
		cin >> v >> r;
		s += v * r;
		empty_r -= r;
	}
	return s / (1 - empty_r);
}
int main()
{
	ios::sync_with_stdio(false);

	double my_max = -1;
	int t;
	cin >> t;
	while (t--)
		max_swap(my_max, calc_e());

	double hancho = calc_e();
	if (my_max - hancho > 1e-7)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}

Measured memory_bytes: 0
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
char c;

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

  cin >> c;
  char d = c+1;
  cout << d << "\n";
  return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
H = list(map(int,input().split()))
AB = []
D = [[]for _ in range(N+1)]
count = 0
for i in range(M):
    AB.append(list(map(int,input().split())))

for i in AB:
    D[i[0]].append(i[1])
    D[i[1]].append(i[0])

for i in range(1,N+1):
    hantei = 0
    fur = D[i]
    for j in fur:
        if H[i-1] <= H[j-1]:
            hantei = 1
            break
    if hantei == 0:
        #print(i)
        count += 1

print(count)

Measured memory_bytes: 107972