akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#include <bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cerr << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int h,w;
bool ok(int i,int j){
    return 1 <= i and i <= h-2 and 1<= j and j <= w-2;
}
int dx[] = {-2,-1,0};
int main(){
    cin >> h >> w;
    map<pii,int>mp;
    int n;
    cin >> n;
    rep(i,n){
        int a,b;
        cin >> a >> b;
        rep(j,3)rep(k,3){
            int aa = a + dx[j];
            int bb = b + dx[k];
            if(ok(aa,bb)){
                mp[{aa,bb}]++;
//                cerr << aa << " " << bb << endl;
            }
        }
    }
    ll ans[10] = {};
    for(auto &x:mp){
//        cerr << x.first.first << " " << x.first.first << " " << x.second << endl;
        ans[x.second]++;
    }
    ans[0] += (ll)(h-2)*(w-2);
    rep(i,9)ans[0] -= ans[i+1];
    rep(i,10){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 56448
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
const ll INF = 1LL << 60;

int main() {
    ll n, m; cin >> n >> m;
    ll ans;
    if (n > 2 && m > 2) {
        ans = n * m - (n * 2 + m * 2 - 4);
    } else if (n == 2 || m == 2) {
        ans = 0;
    } else if (n == 1 && m == 1) {
        ans = 1;
    } else {
        ans = max(n - 2, m - 2);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = [input() for i in range(n)]

AC = 0
WA = 0
TLE = 0
RE = 0

for i in range(n):
  if s[i] == "AC":
    AC += 1
  elif s[i] == "WA":
    WA += 1
  elif s[i] == "TLE":
    TLE += 1
  else:
    RE += 1
    
print("AC x " + str(AC))
print("WA x " + str(WA))
print("TLE x " + str(TLE))
print("RE x " + str(RE))

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

int main() {
    double x1, y1, x2, y2;
    cin >>x1 >>y1 >>x2 >>y2;
    cout <<fixed <<setprecision(10) <<sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)) <<endl;
    return 0;
}


Measured memory_bytes: 3288
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int mex=5001;
#define ll long long 
#define test int t;cin>>t;while(t--)
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(i,a,n) for(int i=a;i<n;i++)
#define rfo(i,a,b) for(int i=a;i>=b;i--)
#define bg begin()
#define en end()
#define fi first
#define se second
#define ub upper_bound
#define lb lower_bound
#define pb push_back
#define veci vector<int>
#define veclli vector<long long int> 
#define all(x) x.begin(),x.end()
#define sci(x) scanf("%d",&x);
#define scc(x) scanf("%c",&x);
#define scs(x) scanf("%s",x);
#define debug(arr,n) for(int i=0;i<n;i++) printf("%d ",arr[i]);
#define sz(x) x.size()
#define loop(x) for(auto it=x.begin();it!= x.end();it++) 
 

ll int power(ll int a,int b)
{
	ll int ans=1,f=a;
	while(b)
	{
		 if(b&1)
		 ans=(ans*f)%mod;
		 b=b>>1;
		 f=(f*f)%mod;
	}
	return ans%mod;
}
int main()
{
  string s;
  cin>>s;
  int k=s[sz(s)-1]-'0';
  if(k==3) cout<<"bon";
  else if(k==1||k==6||k==8||k==0) cout<<"pon";
  else cout<<"hon";
  cout<<endl;
}

Measured memory_bytes: 3624
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args) throws Exception{
	int[] S;
	int[] T;
	int i = 0;
	int j = 0;
	int FOUND = 0;

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	String str_n = br.readLine();
	String str_S = br.readLine();//data_and_key
	String str_q = br.readLine();
	String str_T = br.readLine();//key_stack

	int n = Integer.parseInt(str_n);
	int q = Integer.parseInt(str_q);
	S = new int[n+1];//S[n] = key
	T = new int[q];

	Scanner sc_S = new Scanner(str_S).useDelimiter("\\s* \\s*");
	Scanner sc_T = new Scanner(str_T).useDelimiter("\\s* \\s*");

	while(sc_S.hasNext()){
	    S[i] = sc_S.nextInt();
	    i++;
	}

	while(sc_T.hasNext()){
	    T[j] = sc_T.nextInt();
	    j++;
	}

	FOUND = binarySearch(n,S,q,T);

	System.out.println(FOUND);

	sc_S.close();
	sc_T.close();
	
    }

    private static int binarySearch(int n,int S[], int q, int T[]){
	int FOUND_COUNT = 0;
	
	for(int j=0;j<T.length;j++){
	    int left = 0;
	    int right = n;
	    int key = T[j];
	    
	    while(left<right){
		int mid = (left + right)/2;
		if(S[mid] == key){
		    FOUND_COUNT++;
		    break;
		}
		else if(key < S[mid]) right = mid;
		else left = mid + 1;
	    }
	}
	return FOUND_COUNT;
    }
}



Measured memory_bytes: 108248
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pairA
#define REP(i,n) for(int i=0;i<(n);i++)
int main()
{
    int m,d;
    cin>>m>>d;
    int cnt=0;
    for(int i=1;i<=m;i++)
    {
        for(int j=20;j<=d;j++)
        {
            if(j%10>=2&&i==(j/10)*(j%10))cnt++;
        }
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 384
var i,n:longint;
    a,b:ansistring;
begin
  readln(a);
  n:=length(a);
  for i:=1 to n do b:=a[i]+b;
  for i:=1 to n do
  if b[i]='b' then b[i]:='d'
  else if b[i]='d' then b[i]:='b'
  else if b[i]='p' then b[i]:='q'
  else b[i]:='p';
  if a=b then writeln('Yes')
  else writeln('No');
end.


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
void print_err() {
	cerr << "\n";
}
template <class T, class... Arg>
void print_err(T x, Arg&&... args) {
	cerr << x << " ";
	print_err(args...);
}
#ifdef local
#define debug(...) print_err(__VA_ARGS__)
#else
#define debug(...)
#endif
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mod 1000000007
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define vl vector<ll>
#define vpll vector<pair<ll,ll>>
#define mll map<ll,ll>
#define mllrev map<ll,ll,greater<int>>
#define ps(x,y) fixed<<setprecision(y)<<x
#define w(t) ll t;cin>>t;while(t--)
#define fo(i,n) for(ll i=0;i<n;++i)
#define foab(i,a,b) for(ll i=a;i<b;++i)
#define inp cin>>
#define pr cout<<
#define fastio ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
class Graph {
public:
	list<ll> *adj_list;
	ll v;
	Graph(ll v) {
		this->v = v;
		adj_list = new list<ll>[v];
	}
	void add_edge(ll u, ll v, bool bidirectional = true) {
		adj_list[u].push_back(v);
		if (bidirectional) {
			adj_list[v].push_back(u);
		}
	}
	void print();
	void connected_compo();
	void dfs(ll v, bool visited[]);
	void bfs(ll v, bool visited[]);
};
void solve() {
	// // http://codeforces.com/problemset/problem/445/A
	// inp n >> m;
	// fo(i, n) {
	// 	fo(j, m) {
	// 		inp ch[i][j];
	// 	}
	// }
	ll n, temp;
	inp n;
	vl vect;
	ll dp[n];
	fo(i, n) {
		inp temp;
		dp[i] = 0;
		vect.pb(temp);
	}
	dp[0] = 0; dp[1] = abs(vect[1] - vect[0]);
	for (ll i = 2; i < n; i++) {
		dp[i] = min(abs(vect[i] - vect[i - 1]) + dp[i - 1], abs(vect[i] - vect[i - 2]) + dp[i - 2]);
	}
	// fo(i, n) {
	// 	cout << dp[i] << " ";
	// }
	cout << dp[n - 1] << endl;
	return ;
}
int main() {
	fastio
#ifdef local
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
	solve();
	return 0;
}
// ll n, m;
// char ch[100][100];
// bool istrue = false;
// ll dx[] = { -1, 1, 0, 0}, dy[] = {0, 0, -1, 1};
// void dfs(ll row, ll col, char ch) {
// 	if (ch[row][col] == 'B' or ch[row][col] == 'W' or ch[row][col] == '-' or istrue) {
// 		return;
// 	}
// 	fo(i, 4) {
// 		if (isvalid(ch, row + dx[i], col + dy[i])) {
// 			if (ch == 'B') {
// 				dfs(row + dx[i], col + dy[i], 'W');
// 			} else if (ch == 'W') {
// 				dfs(row + dx[i], col + dy[i], 'B');
// 			}
// 		}
// 	}
// }

Measured memory_bytes: 5052
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  for(int i = 0; i < S.length(); i++){
  	if(S.at(i) == 'A'){
    	if(S.at(i+1) == 'C' && i+1 != S.length()){
        	cout << "Yes" << endl;
          	break;
        }
    }
    if(i == S.length() - 1){
    	cout << "No" << endl;
    }
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cassert>
#include <random>
using namespace std;
 

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define pb push_back
#define forn(i, n) for (int i = 0; i < n; ++i)
#define int long long

 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
 
 
const int MAXN = 2e5 + 5;
const ll MOD = 998244353;
const ll INF = INT64_MAX;


mt19937 rnd(time(0));


ll pw(ll a, ll x) {
	ll res = 1;
	while (x > 0) {
		if (x & 1) {
			res = (res * a) % MOD;
		}
		a = (a * a) % MOD;
		x >>= 1;
	}
	return res;
}


signed main() {
	int x;
	cin >> x;
	for (int a = -2500; a <= 2500; a++) {
		int b = a * a * a * a * a - x;
		int nb = pow(abs(b), 0.2);
		if (b < 0) {
			nb = -nb;
		}
		if (nb * nb * nb * nb * nb == b) {
			cout << a << " " << nb << "\n";
			return 0;
		}
	}
 	return 0;
}

Measured memory_bytes: 4012
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
  
int main(){
    int a,b;
    cin>>a>>b;
    cout<<max(max(a+a-1,a+b),b+b-1)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  int N,ans=0;
  cin>>N;
  vector<ll> A(N);
  vector<vector<int>> a(N,vector<int>(N));
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){a.at(i).at(j)=-1;}
  }
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    for(int j=0;j<A.at(i);j++){
      int m,n;
      cin>>m>>n;
      a.at(i).at(m-1)=n;
    }
  }
  for(int bit=1;bit<(int)(1<<N);bit++){
    int count=0;
    bool tf=true;
    for(int i=0;i<N;i++){
      if((1<<i)&bit){
        count++;
        for(int j=0;j<N;j++){
          if(a.at(i).at(j)!=-1){
            if(((bit>>j)&1)^a.at(i).at(j)){tf=false;}
          }
        }
      }
    }
    if(tf){ans=max(ans,count);}
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int a, b, i;
  string A[114514] = {};
  cin >> a >> b;
  for(i=0;i<a;i++) {
    cin >> A[i];
  }
  for(i=-2;i<b;i++) {
    cout << "#";
  }
  cout << endl;
  for(i=0;i<a;i++) {
    cout << "#" << A[i] << "#" << endl;
  }
   for(i=-2;i<b;i++) {
    cout << "#";
   }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1152
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextLong() - i - 1;
		}

		java.util.Arrays.sort(a);

		long b = a[n / 2];

		// System.out.println(Arrays.toString(a));

		long result = 0;
		for (int i = 0; i < n; i++) {
			result += Math.abs(a[i] - b);
		}
		System.out.println(result);
	}
}

Measured memory_bytes: 87356
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    string A[7]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
    string s;
    cin>>s;
    rep(i,7) if(s==A[i]) cout<<7-i;
}

Measured memory_bytes: 256
M = 998244353
N, S = map(int, input().split())

ans = 0
prev = [0]*S
for i, a in enumerate(map(int, input().split()), 1):
  if a > S:
    continue
  prev[0] = i
  ans += prev[S-a]*(N-i+1)
  for j, s in enumerate(prev[:S-a], a):
    prev[j] += s
print(ans%M)


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

int h [100000];

int main()

{
	
	int k,n,b=0;
	cin >> n>> k;
	for (int i=0;i<n;i++)
	{
		cin >> h[i];
		if(h[i]>=k)
			b++;
	}
	
	cout << b;
}


Measured memory_bytes: 640
import java.io.IOException;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO 自動生成されたメソッド・スタブ

		Scanner vd = new Scanner(System.in);
		char[] cd = vd.next().toCharArray();
		int count = 0;
		for(int i=0; i<3;i++) {
			if(cd[i]=='o') count++;
		}
		System.out.println((700+count*100));


	}

}


Measured memory_bytes: 21716
#include<stdio.h>
#define N 500000
int ma;
void sum(int *a,int b)
{
  int i,j,k,xu;
  i=b*2;
  j=b*2+1;

  if(i<=ma &&a[i]>a[b])
    {
      xu=i;
    }
  
      else xu=b;
  if(j<=ma && a[j]>a[xu])
    xu=j;

  if(xu !=b)
    {
      k=a[b];
      a[b]=a[xu];
      a[xu]=k;
      sum(a,xu);

    }
}
void num(int *a)
{
  int zin;
  for(zin=ma/2;zin>=1;zin--)
    sum(a,zin);
}
int main()
{
  int i;
  int a[N];
  scanf("%d",&ma);
  for(i=1;i<=ma;i++)
    {
      scanf("%d",&a[i]);
    }
  num(a);
  for(i=1;i<=ma;i++)
    {
      printf(" %d",a[i]);
    }
  printf("\n");
  return 0;
}
  
      
  
  



Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<tuple<string,int,int>> R(N);
    for(int i=0;i<N;i++){
        string s;
        int p;
        cin>>s>>p;
        get<0>(R.at(i))=s, get<1>(R.at(i))=100-p, get<2>(R.at(i))=i;
    }
    sort(R.begin(),R.end());
    for(int i=0;i<N;i++) cout<<get<2>(R.at(i))+1<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define re register
#define debug printf("Now is Line : %d\n",__LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
//#define int long long
#define D double
#define inf 123456789
#define mod 1000000007
il int read() {
    re int x = 0, f = 1; re char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
#define rep(i , a , b) for(int i = (a) , i##Limit = (b) ; i <= i##Limit ; ++ i)
#define drep(i , b , a) for(int i = (a) , i##Limit = (b) ; i >= i##Limit ; -- i)
#define Next(i, u) for(re int i = head[u]; i; i = e[i].next)
#define mem(k, p) memset(k, p, sizeof(k))
#define lb(x) (x)&(-(x))
#define ls k * 2
#define rs k * 2 + 1
#define maxn 100005
il int Mul(int a, int b) { return 1ll * a * b % mod; }
il int Inc(int a, int b) { return (a += b) >= mod ? a - mod : a; }
il int Dec(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
il int qpow(int a, int b) { int r = 1; while(b) { if(b & 1) r = Mul(r, a); a = Mul(a, a), b >>= 1; } return r; }
int n, m, c, ans;
struct node {
	int x, y;
}e[maxn];
il bool cmp(node a, node b) {
	return a.x < b.x;
}
int main() {
	n = read();
	rep(i, 1, n) e[i].x = read(), e[i].y = read();
	rep(i, 1, n) {
		int pax = e[i].y;
		e[i].y = e[i].x + pax, e[i].x = e[i].x - pax + 1;
	}
	sort(e + 1, e + n + 1, cmp);
	//rep(i, 1, n) cout << e[i].x << ' ' << e[i].y << endl;
	ans = 1, c = e[1].y;
	rep(i, 2, n) {
		if(e[i].x <= c) c = min(c, e[i].y);
		else c = e[i].y, ++ ans;
	} 
	printf("%d", ans);
	return 0;
}

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

bool plindrome(string s,int n)
{
    int half=n/2;
    for(int i=0,j=n-1; i<half; i++,j--)
    {
        if(s[i]!=s[j])
        {
            return false;
        }
    }
    return true;
}

int main()
{
    string s,s1="",s2="";
    cin>>s;
    int n=s.size();
    for(int i=0; i<n; i++)
    {
        if(i <((n-1)/2))
        {
            s1+=s[i];
        }
        else if(i>((n-1)/2))
        {
            s2+=s[i];
        }
    }
    // cout<<s1<<" "<<s2<<endl;
    int n1,n2;
    n1=s1.size();
    n2=s2.size();

    bool ck=plindrome(s,n);
    //cout<<ck<<endl;
    bool ck1=plindrome(s1,n1);
    //cout<<ck1<<endl;
    bool ck2=plindrome(s2,n2);
    //cout<<ck2<<endl;

    if(ck&&ck1&&ck2)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int y,n;
    cin>>y>>n;
    for(int i=0;i<n/10000+1;i++){
        for(int j=0;j<(n-i*10000)/5000+1;j++){
            if((n-i*10000-j*5000)%1000==0 && i+j+(n-i*10000-j*5000)/1000==y){
                cout<<i<<' '<<j<<' '<<(n-i*10000-j*5000)/1000<<endl;
                return 0;
            }
        }
    }
    cout<<"-1 -1 -1"<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	int wns=(n+1)/2;
	double ans=(double)wns/(double)n;
	printf("%.10f\n",ans);
	return 0;
} 

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

int main() {
	int N, K, in;
	long long cnt = 0;
	vector<int> H;
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> in;
		H.push_back(in);
	}
	sort(H.begin(), H.end());
	for (int i = 0; i < N - K; i++)
		cnt += H[i];
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()

int main()
{
    ll n;

    cin>>n;

    ll a[n+2],b[n+3];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
    }
  bool f=false;
    ll cnt=0;

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

        if(a[i]==b[i])cnt++;
        else cnt=0;

        if(cnt==3)f=true;


    }


    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}


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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int xh,xm,yh,ym,k;
	cin>>xh>>xm>>yh>>ym>>k;
	int mmm=60*(yh-xh)+(ym-xm)-k;
	if(mmm<0)mmm=0;
	cout<<mmm<<endl;
	return 0;
} 

Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<vector>

using namespace std;

#define MAX 100000
#define NIL -1

struct Node
{
    int parent, left, right;
};

Node T[MAX];

int depth(int i)
{
    int count = 0;
    int c = i;
    while (T[c].parent != NIL)
    {
        c = T[c].parent;
        count++;
    }
    return count;
}

string nodeType(int i)
{
    if (T[i].parent == NIL)
    {
        return "root";
    }
    else if (T[i].left == NIL)
    {
        return "leaf";
    }
    else
    {
        return "internal node";
    }
}

void printNodeChild(int i)
{
    int c = T[i].left;

    while(c != NIL)
    {
        cout << c;
        c = T[c].right;

        if (c != NIL)
        {
            cout << ", ";
        }
    }
}

void printNodeInfo(int i)
{
    cout << "node " << i << ": ";
    cout << "parent = " << T[i].parent << ",";
    cout << " depth = " << depth(i) << ",";
    cout << " " << nodeType(i) << ",";
    cout << " [";
    printNodeChild(i);
    cout << "]";

    cout << endl;
}

int main()
{
    int n;

    cin >> n;

    for (int i = 0; i < n; i++)
    {
        T[i].parent = T[i].left = T[i].right = NIL;
    }

    for (int i = 0; i < n; i++)
    {
        int id, k, l;

        cin >> id >> k;

        for (int j = 0; j < k; j++)
        {
            int c;
            cin >> c;
            if (j == 0)
            {
                T[id].left = c;
            }
            else
            {
                T[l].right = c;
            }
            l = c;
            T[c].parent = id;
        }
    }

    int root = 0;

    for (int i = 0; i < n; i++)
    {
        if (T[i].parent == NIL)
        {
            root = i;
        }
    }

   for (int i = 0; i < n; i++)
    {
        printNodeInfo(i);
    }

    //cout << root << endl;

    return 0;
}



Measured memory_bytes: 4336
#include <bits/stdc++.h>
#define ll long long
#define ar array
#define nl '\n'
#define AC ios_base::sync_with_stdio(0); cin.tie(NULL);
using namespace std;
const int M = 1e9+7;
const int N = 2*1e5;


int main(){
    AC
    for(int i=0; i<5; i++){
        int x;
        cin>>x;
        if(x==0)
            cout<<i+1<<nl;
    }
}

Measured memory_bytes: 3596
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::str::*;

#[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)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($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")
    };
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let s: String = cin
        .bytes() // Bytes
        .map(|c| c.expect("failed reading char") as char)
        .skip_while(|c| c.is_whitespace()) // c が whitespace である限り skip
        .take_while(|c| !c.is_whitespace()) // c が whitespace でない限り要素を返す
        .collect();
    s.parse().ok().expect("failed parsing")
}

#[allow(non_snake_case)]
fn main() {
    input! {
        S:chars,
        T:chars,
    }
    let n = S.len();
    let mut f = false;
    for i in 0..n {
        if S[i] == T[i] {
            continue;
        }
        f = true;
    }
    if !f {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2100
#include<iostream>
#include<queue>
#include<vector>
#include<functional>

using namespace std;

typedef long long ll;

int N;
ll A[100000 + 10];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++)cin >> A[i];

	int pos1 = N;
	for (int i = 0; i < N; i++) {
		if (A[i] == 1) {
			pos1 = i;
			break;
		}
	}

	ll ans = A[0] - 1, nowP = 2;
	for (int i = 1; i < N; i++) {
		if (A[i] < nowP);
		else if (A[i] == nowP)nowP++;
		else {
			ans += (A[i] - 1) / nowP;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
// 
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
//typedef pair<int, int> pair;
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;}
namespace you {
    std::string to_string(char val) {
        return std::string(1, val);
        // return std::string{val};
        // you::to_string(char)
    }
}

int num=pow(10,5)+1;
vector<ll> l(num);
vector<ll> r(num);
vector<ll> ad(num);
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int n;
    cin>>n;
    rep(i,n+1) cin>>ad[i];
    l[n]=ad[n];
    r[n]=ad[n];
    if(n==0){
        if(ad[0]==1) cout<<1<<endl;
        else cout<<-1<<endl;
    }else{
        for(int i=n-1;i>=0;i=i-1){
            l[i]=ll(ceil(l[i+1]/2.0))+ad[i];
            r[i]=r[i+1]+ad[i];
        }
        // rep(i,n+1){
        //     cout<<l[i]<<" "<<r[i]<<endl;
        // }
        bool flag=true;
        ll ans=1;
        ll bef=1; //1つ上の層のノード数
        for(int i=1;i<=n;i++){
            ll max_ba=(bef-ad[i-1])*2; //上から見た時に層iに作れる子の数のmax
            if(max_ba<l[i]){
                flag=false;
                break;
            }
            bef=min(r[i],max_ba);
            ans+=bef;
        }
        if(flag) cout<<ans<<endl;
        else cout<<-1<<endl;
    }
    return 0;
}

Measured memory_bytes: 5504
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        n = I()
        if n == 0:
            break
        a = [LI() for _ in range(n)]
        d = collections.defaultdict(lambda: inf)
        d[0] = 0
        cp = 0
        ct = 0
        r = inf
        for i in range(n):
            p,t = a[i]
            e = collections.defaultdict(lambda: inf)
            for k,ck in list(d.items()):
                if k < 3 and abs(cp-p) * (k+1) + ct <= t:
                    if e[k+1] > ck + abs(cp-p):
                        e[k+1] = ck + abs(cp-p)
                if cp * (k+1) + p + ct <= t:
                    if e[1] > ck + cp + p:
                        e[1] = ck + cp + p
            d = e
            if len(e) == 0:
                r = i + 1
                break
            cp = p
            ct = t

        if r < inf:
            rr.append('NG {}'.format(r))
        else:
            for k,ck in d.items():
                if r > ck + cp:
                    r = ck + cp
            rr.append('OK {}'.format(r))

    return '\n'.join(map(str,rr))


print(main())




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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll r;
    cin >> r;
    cout << r*r << endl;
}

Measured memory_bytes: 3612
/* package whatever; // don't place package name! */
 
import java.util.*;
import java.lang.*;
import java.io.*;
 
import java.util.ArrayList;
import java.util.List;
 
/* Name of the class has to be "Main" only if the class is public. */
class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
	//文字列読込み
	Scanner sc = new Scanner(System.in);

	//結果格納
	int point = 0;
	int runner = 0;
	int out = 0;
	String result;

            sc.nextInt();	//イニング数(何につかうか｡｡｡

	while (sc.hasNext()) {
	            //1行読込み
	            result = sc.next();
	            
		
		if (result.equals("HIT")) {
			runner = runner + 1;
			if (runner > 3) {
				runner = 3;
				point = point + 1;
			}
			//System.out.println(runner + " " + point + " " + out );

		} else if (result.equals("OUT")) {
			out = out + 1;
			if (out > 2) {
				//点を出力
				System.out.println(point);  

				//初期化
				point = 0;
				runner = 0;
				out = 0;
			}
			//System.out.println(runner + " " + point + " " + out );
			
		} else if (result.equals("HOMERUN")) {
			point = point + runner + 1;
			runner = 0;
			//System.out.println(runner + " " + point + " " + out );
			
		} else {
		}

	}
	
	//System.out.println(Math.round(price));         

    }
}


Measured memory_bytes: 25648
#include <iostream>
#include <string>

using namespace std;
int main (){
    string s;
    cin >> s;
    int l=s.size();
    for (int i = 2; i < l; i+=2){
        if(s.substr(0,(l-i)/2) == s.substr((l-i)/2,(l-i)/2)){
            cout << l-i << "\n";
            break;
        }
    }

}

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

#define int long long
#define double long double

#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define ALL(v) (v).begin(), (v).end()

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

using namespace std;

using pi = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vvi = vector<vi>;
using vvb = vector<vb>;

const int INF = 1e16;
const int MOD = 1e9+7;

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; }

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    string s; cin >> s;
    REP(i, s.length())
    {
        if(s[i] == '7')
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const LL mod = 1e9 + 7;
const int N = 200005;
struct Node {
    int x, y;
};
bool cmp(const Node &p1, const Node &p2) {
    return (LL)p1.x * (p2.y + 1) > (LL)p2.x * (p1.y + 1);
}

LL f[30];
LL pre[N];
int main() {
    int n, T;
    scanf("%d%d", &n, &T);
    vector<Node> a;
    vector<int> b;
    for (int i = 0; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        if (x == 0) {
            b.push_back(y);
        } else {
            a.push_back({x, y});
        }
    }
    sort(b.begin(), b.end());
    for (int i = 0; i < b.size(); i++) {
        pre[i] = (i >= 1 ? pre[i - 1] : 0) + b[i] + 1;
    }
    sort(a.begin(), a.end(), cmp);
    a.insert(a.begin(), {0, 0});
    memset(f, 0x3f, sizeof f);
    f[0] = 0;
    for (int i = 1; i < a.size(); i++) {
        for (int j = 29; j >= 1; j--) {
            if (f[j - 1] <= T)
                f[j] = min(f[j], f[j - 1] + 1 + a[i].x * (f[j - 1] + 1) + a[i].y);
        }
    }
    int ans = 0;
    for (int j = 0; j < 30; j++) {
        if (f[j] > T) break;
        int t = j + upper_bound(pre, pre + b.size(), T - f[j]) - pre;
        ans = max(ans, t);
    }
    cout << ans << endl;
    return 0;
}


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

class Vector2 {
public:
  double x, y;

  Vector2(): x(0), y(0) {}
  Vector2(double x, double y): x(x), y(y) {}

  Vector2 operator+(Vector2 p) { return Vector2(x + p.x, y + p.y); }
  Vector2 operator-(Vector2 p) { return Vector2(x - p.x, y - p.y); }
  Vector2 operator*(double t) { return Vector2(x * t, y * t); }
  Vector2 operator/(double t) { return Vector2(x / t, y / t); }
  double dot(Vector2 p) { return x * p.x + y * p.y; }
  double det(Vector2 p) { return x * p.y - y * p.x; }
  double norm2() { return x * x + y * y; }
  double norm() { return sqrt(norm2()); }
  Vector2 normalize() { return Vector2(x / norm(), y / norm()); }
};
using Point2 = Vector2;

class LineSegment2 {
public:
  Point2 p1, p2;

  LineSegment2() {}
  LineSegment2(Point2 p1, Point2 p2): p1(p1), p2(p2) {}
};

using Polygon2 = vector<Vector2>;

Point2 lines_intersect_point(Point2 a, Point2 b, Point2 c, Point2 d) {
  Vector2 u = b - a;
  Vector2 v = d - c;
  double p1 = u.y, q1 = -u.x, r1 = -u.det(a);
  double p2 = v.y, q2 = -v.x, r2 = -v.det(c);
  double det = p1 * q2 - p2 * q1;
  double x = (r1 * q2 - r2 * q1) / det;
  double y = (r2 * p1 - r1 * p2) / det;
  return Point2(x, y);
}

LineSegment2 slide(LineSegment2 l, double d) {
  Vector2 v = (l.p2 - l.p1).normalize();
  Vector2 n = Vector2(-v.y, v.x);
  Vector2 m = (l.p1 + l.p2) / 2;
  Vector2 p1 = m + n * d;
  Vector2 p2 = p1 + v;
  return LineSegment2(p1, p2);
}

Polygon2 cut(Polygon2 &P, LineSegment2 l) {
  Polygon2 poly;
  REP(i, 0, P.size()) {
    Point2 p1 = P[i], p2 = P[(i + 1) % P.size()];
    if ((l.p2 - l.p1).det(p1 - l.p1) >= 0) {
      poly.push_back(p1);
    }
    if ((l.p2 - l.p1).det(p1 - l.p1) * (l.p2 - l.p1).det(p2 - l.p1) < 0) {
      poly.push_back(lines_intersect_point(l.p1, l.p2, p1, p2));
    }
  }
  return poly;
}

bool ok(Polygon2 &P, double d) {
  Polygon2 poly(P);
  REP(i, 0, P.size()) {
    Vector2 p1 = P[i], p2 = P[(i + 1) % P.size()];
    LineSegment2 l = slide(LineSegment2(p1, p2), d);
    poly = cut(poly, l);
  }
  return poly.size() > 0;
}

double solve(Polygon2 P) {
  double l = 0, h = 1e10;
  REP(i, 0, 100) {
    double m = (l + h) / 2;
    if (ok(P, m)) l = m;
    else h = m;
  }
  return l;
}

int main(void) {
  for (ll N; cin >> N, N;) {
    Polygon2 P(N);
    REP(i, 0, N) cin >> P[i].x >> P[i].y;
    printf("%.15lf\n", solve(P));
  }
}


Measured memory_bytes: 3180
import java.util.Scanner;

class Watch {
	private int _sec;
	
	public Watch() {
		_sec = 0;
	}
	
	public Watch(int sec) {
		_sec = sec;
	}
	
	public String getTime() {
		int h = getHour();
		_sec -= h * 3600;
		int m = getMinute();
		_sec -= m * 60;
		int s = _sec;
		return h + ":" + m + ":" + s;
	}
	private int getHour() {
		
		return _sec / 3600;
	}
	public int getMinute() {
		return _sec / 60;
	}
	
}
public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);
		System.out.println(new Watch(scan.nextInt()).getTime());
	}

}



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

using namespace std;



int main(){
 
   int a,b;

   cin>>a>>b;

   if(a>b){ 
       
       while(a--){
           cout<<b;
       }
   }
   else{
       while(b--){
           cout<<a;
       }
   }
    cout<<"\n";
    return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >>c;
  int d = a+b;
  int e = b+c;
  int f = c+a;
  if(d <= e && d <= f) cout << d << endl;
  else if(e <= d && e <= f ) cout << e << endl;
  else cout << f << endl;
}

Measured memory_bytes: 256
N = int(input())
H = [int(i) for i in input().split()]
max_cnt = 0
cnt = 0 
for i in range(N - 1, 0, -1):
    if H[i - 1] >= H[i]:
        cnt += 1
    else:
        cnt = 0
    max_cnt = max(max_cnt, cnt)
    
print(max_cnt)

Measured memory_bytes: 14252
S = gets.chomp
T = gets.chomp
s_len = S.length
t_len = T.length
max_count = 0
for i in 0..(s_len - t_len)
  match_count = 0
  extracted_str = S[i,t_len]
  for i2 in 0..(t_len-1)
    if extracted_str[i2] == T[i2]
      match_count += 1
    end
  end
  max_count = [match_count,max_count].max
end
puts t_len - max_count

Measured memory_bytes: 14260
# include<iostream>
# include<algorithm>

using namespace std;

int main(void){
  int n, cnt=0;
  cin >> n;
  int p[n+1] = {};
  for(int i=1; i<=n; i++)
    cin >> p[i];
  for(int i=1; i<n-1; i++){
    // cout << p[i] << p[i+1] << p[i+2] << endl;
    if(p[i+1] != max({p[i], p[i+1], p[i+2]}) && p[i+1] != min({p[i], p[i+1], p[i+2]}))
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from itertools import accumulate


def read():
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    return N, A


def solve(N, A):
    A.sort()
    # Aの左側をすべて取り込む (S[x-1])
    # Aの右側を取り込めるところまで取り込む
    S = list(accumulate(A))
    ans = 1
    for i in range(N-2, -1, -1):
        if S[i] * 2 >= A[i+1]:
            ans += 1
        else:
            break
    return ans


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))


Measured memory_bytes: 14428
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pi;
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);
#define f first
#define s second

const int maxn = 100010;

int x,t,n;

int32_t main() {
   cin >> n >> x >> t;
   cout << (int) (ceil((double) n / x) * t);
    
   
}


Measured memory_bytes: 3596
#include<string.h>


int main(void){


int num,i,count,sum;


char number[1001];


char*str;


while(1){


scanf("%s",number);


i=0;


sum=0;


str=&number;


count=(int)strlen(str);


if(number[0]=='0'){


if(count==1){


break;


}


}


while(i<count){


num=number[i]-'0';


sum=sum+num;


i++;


}


printf("%d\n",sum);


}


return 0;



}

Measured memory_bytes: 536
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>

#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007

using namespace std;
int main(void){
  int n;
  cin >> n;
  int ans[4]={0,0,0,0};
  rep(i,n){
    string s;
    cin >> s;
    if(s == "AC") ans[0]++;
    if(s == "WA") ans[1]++;
    if(s == "TLE") ans[2]++;
    if(s == "RE") ans[3]++;
  }

  cout << "AC x " << ans[0] << endl;
  cout << "WA x " << ans[1] << endl;
  cout << "TLE x " << ans[2] << endl;
  cout << "RE x " << ans[3] << endl;
  return 0;
}


Measured memory_bytes: 3632
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
#from decimal import *

N = INT()
A = LIST()

if 0 in A:
	print(0)
	exit()

ans = 1
for x in A:
	ans *= x
	if ans > 10**18:
		print(-1)
		exit()

print(ans)

Measured memory_bytes: 23312
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <queue>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    long long h,w,k,ans,MOD=1000000007,a=1,b=1;
    cin>>h>>w>>k;
    if(k<2){
    	cout<<1;
    	return 0;
    }
    vector<string>grid(h);
    rep(i,h)cin>>grid[i];
    long long it=0,iy=0,ot=0,oy=0,m=0;
    rep(i,h)rep(j,w){
    	if(grid[i][j]=='#'){
    		m++;
    		if(grid[(i+1)%h][j]=='#'){
    			if(i==h-1)ot++;
    			else it++;
    		}
    		if(grid[i][(j+1)%w]=='#'){
    			if(j==w-1)oy++;
    			else iy++;
    		}
    	}
    }
    long long c=modpow(m,k-1,MOD);
    if(ot&&oy)ans=1;
    else if(m==oy||m==ot)ans=c;
    else if(ot==0&&oy==0)ans=c;
    else if(ot==0&&oy>0){
    	a=(m-oy-iy)*c;
    	a%=MOD;
    	b=iy*modpow(oy,k-1,MOD);
    	b%=MOD;
    	ans=(a+b)*modpow(m-oy,MOD-2,MOD);
    	ans%=MOD;
    }
    else if(oy==0&&ot>0){
    	a=(m-ot-it)*c;
    	a%=MOD;
    	b=it*modpow(ot,k-1,MOD);
    	b%=MOD;
    	ans=(a+b)*modpow(m-ot,MOD-2,MOD);
    	ans%=MOD;
    }
    cout<<ans;
	return 0;
}


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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

void ALLOUT_NUMBER(vector<ll> V)
{
    ll N = V.size();
    for(ll i=0;i<N;i++)
    {
        cout << V[i];
        if(i<N-1) cout << ' ';
    }
    cout << endl;
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

void Ans(string s)
{
    cout << s[0] << s[1] << s[2] << endl;
}

int main()
{
    string s;
    cin >> s;

    Ans(s);

    return 0;
}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    vector<vector<int64_t>> lrs(n + 1, vector<int64_t>(n + 1));
    for (auto i : irange(0L, m)) {
        int64_t l, r;
        cin >> l >> r;

        ++lrs[l][r];
    }

    for (auto i : irange(0L, n)) {
        for (auto j : irange(0L, n + 1)) {
            lrs[i + 1][j] += lrs[i][j];
        }
    }

    for (auto i : irange(0L, n)) {
        for (auto j : irange(0L, n + 1)) {
            lrs[j][i + 1] += lrs[j][i];
        }
    }

    for (auto _ : irange(0L, Q)) {
        int64_t p, q;
        cin >> p >> q;

        cout << lrs[n][q] - lrs[p - 1][q] << "\n";
    }
}

Measured memory_bytes: 2944
#include<iostream>
#include<string.h>
#include<set>
using namespace std;

int N,M;
char s[200001];
set<int> A_child[200001];
set<int> B_child[200001];

bool bad[200001];

void dfs(int node){
    // cout << "DFS: " << node << endl;
    bad[node] = true;
    for (set<int>::iterator it = A_child[node].begin();it!=A_child[node].end();it++){
        int child = *it;
        if (!bad[child]){
            if (s[node-1]=='A'){
                A_child[child].erase(node);
            }else{
                B_child[child].erase(node);
            }
            if (node==2){

            }
            if (A_child[child].size()<=0||B_child[child].size()<=0)
                dfs(child);
        }

    }

    for (set<int>::iterator it = B_child[node].begin();it!=B_child[node].end();it++){
        int child = *it;
        if (!bad[child]){
            if (s[node-1]=='A'){
                A_child[child].erase(node);
            }else{
                B_child[child].erase(node);
            }

            if (A_child[child].size()<=0||B_child[child].size()<=0)
                dfs(child);
        }
    }

}

int main(void){
    cin >> N >> M >> s;
    int a,b;
    for (int i=1;i<=M;i++){
        cin >> a >> b;

        if (s[a-1]=='A'){

            A_child[b].insert(a);
        }
        else{ 
            B_child[b].insert(a);
        }
        if (s[b-1]=='A') {
            A_child[a].insert(b);
        }else{ 
            B_child[a].insert(b);
        }    
    }

    //first delete
    memset(bad,false, sizeof(bad));
    for (int i=1;i<=N;i++){
        if (!bad[i]&&(B_child[i].size()<=0||A_child[i].size()<=0)){
            dfs(i);
            // cout << "Case Happen!: " << i  << endl;
            // cout << B_child[i].size() << " " << A_child[i].size() << endl;
            
        }
    }
    // for (int i=1;i<=N;i++){
    //     if (bad[i])
    //     dfs(i);
    // }

    for (int i=1;i<=N;i++){
        if (!bad[i]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 40320
#modの掛け算

def modmal(a,b,mod): #a*bをmodを法にして求める

    return a * b % mod


#modの割り算

def moddiv(a,b,mod): #a/bをmodを法にして求める

    return (a * pow(b,mod-2)) % mod


#逆元

def inverse(a,mod): #aのmodを法にした逆元を返す
    return pow(a,mod-2)



#modのn!と、n!の逆元を格納したリストを返す(拾いもの)
#factorialsには[1, 1!%mod , 2!%mod , 6!%mod… , n!%mod] が入っている
#invsには↑の逆元が入っている

def modfac(n, MOD):
 
    f = 1
    factorials = [1]
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
    return factorials, invs


def modnCr(n,r,mod,fac,inv): #上で求めたfacとinvsを引数に入れるべし

    return fac[n] * inv[n-r] * inv[r] % mod

    

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

mod = 998244353
fac,inv = modfac(N,mod)
ans = 0

for i in range(K // A + 1):

    if i * A <= K and (K-i*A) % B == 0:
        j = (K-i*A)//B

        
        if i > N or j > N:
            continue
        
        ans += modnCr(N,i,mod,fac,inv) * modnCr(N,j,mod,fac,inv)
        ans %= mod

print (ans)


Measured memory_bytes: 61296
#include <cstdio>
#include <map>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)

//------------------------------------------------------------------------------
typedef long long ll;
typedef pair<ll, ll> P;

const int MOD = 1000000007;

ll N;
map<P, ll> cache;

int func(ll S, ll X);

int func2(ll S, ll X) {
  if (S == 0 && X == 0) return 1;
  int ret = func(S / 2, X / 2);
  if (S >= 1 && X >= 1) {
    ret = (ret + func((S - 1) / 2, (X - 1) / 2)) % MOD;
  }
  if (S >= 2) {
    ret = (ret + func((S - 2) / 2, X / 2)) % MOD;
  }
  return ret;
}

int func(ll S, ll X) {
  P SX = P(S, X);
  if(cache.find(SX) == cache.end()) {
    cache[SX] = func2(S, X);
  }
  return cache[SX];
}

void solve() {
  int ans = func(N, N);
  printf("%d\n", ans);
}

void input() {
  scanf("%lld", &N);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<map>
#include<queue>
#include<set>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
int n,a;
int main(){
	scanf("%d",&n);
	for(a=1;a*a<=n;a++);
	a--;
	printf("%d\n",a*a);
	return 0;
}

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

int main(){
  
  int H,W;
  string S[60];
  int cnt=0;
  bool flag=true;

  cin >> H >> W;
  for(int i=0; i<H; i++) cin >> S[i];

  for(int i=0; i<H; i++)
    for(int j=0; j<W; j++)
      if(S[i][j]=='#'){
        cnt=0;
        for(int k=-1;k<=1;k++)
          for(int l=-1;l<=1;l++)
            if(0<=i+k && i+k<H && 0<=j+l && j+l<W)
              if(S[i+k][j+l] == '#' && ((k==0 && l != 0) || (l==0 && k != 0))  )
                cnt++;
        if(cnt==0)
          flag=false;
      }

  if(flag) cout << "Yes" << endl;
  else     cout << "No"  << endl;

  return 0;
}


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

int main() {
int A,B;
cin >> A >> B;
if (A==1&&B==3||A==1&&B==5||A==1&&B==7||A==1&&B==8||A==1&&B==10||A==1&&B==12||A==3&&B==5||A==3&&B==7||A==3&&B==8||A==3&&B==10||A==3&&B==12||A==5&&B==7||A==5&&B==8||A==5&&B==10||A==5&&B==12||A==7&&B==8||A==7&&B==10||A==7&&B==12||A==8&&B==10||A==8&&B==12||A==10&&B==12||A==4&&B==6||A==4&&B==9||A==4&&B==11||A==6&&B==9||A==6&&B==11||A==9&&B==11){
  cout << "Yes" << endl;
} else {
  cout << "No" << endl;
}
}


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

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}
//void ret_digit(int a){rep(i, count_digit(a)){Dig[i]=a%10;a/=10;}}

int main(void){
 
    int a, b, h, m;
    double hs, ms, sa, ans;

    scanf("%d%d%d%d", &a, &b, &h, &m);
    
    ms=m*6;
    hs=h*30+0.5*m;
    
    
    sa=fabs(ms-hs);
    sa=sa*M_PI/180;
    
    ans=a*a+b*b-2*a*b*cos(sa);
    
    printf("%.10lf", pow(ans, 0.5));

    return 0;
}



Measured memory_bytes: 2728