akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#define int long long

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template <class T>
bool chmax(T &a, const T &b) {if (a < b){ a = b; return 1;} return 0;}
template <class T>
bool chmin(T &a, const T &b) {if (a > b){ a = b; return 1;}return 0;}
template <class T>
void printv(vector<T> v) {for (T t : v) {cout << t << " ";}cout << '\n';}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" <<endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main()
{

    string s;
    cin >> s;

    if      (s == "SUN") cout << "7" << endl;
    else if (s == "MON") cout << "6" << endl;
    else if (s == "TUE") cout << "5" << endl;
    else if (s == "WED") cout << "4" << endl;
    else if (s == "THU") cout << "3" << endl;
    else if (s == "FRI") cout << "2" << endl;
    else cout << "1" << endl;

    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
#from sys import stdin
#import math
#from functools import reduce
    
#A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
N = int(input())
#S = list(input())
 
#is_exist = 'Yes'

n = int(N / 1.08)
out = str(n)
#print(N/1.08)
#
if (n*1.08) < N:
    out = ':('
    
if ((n+1)*1.08) < N+1:
    out = str(n+1)

print(out)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    int N;
    int mi = 1001001001;
    cin >> N;
    vector<int> W(N), s(N+1, 0);
    rep(i, N){
        cin >> W[i];
        s[i+1] = s[i]+W[i];
    }
    rep(i, N) mi = min(abs((s[N]-s[i])-s[i]), mi);
    cout << mi << endl;
    return 0;
}


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

using namespace std;

#define rep(i,a,b) for(int i = a; i<int(b);++i)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define trav(a,c) for(auto a: c)

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pii;

int main(){
	cin.sync_with_stdio(false);
	ll n;
	cin>>n;
	vi v(n+1);
	rep(i,0,n){
        cin>>v[i+1];
	}
	ll sum = 0;
	v.push_back(0);
    rep(i,0,n+1) sum+=abs(v[i]-v[i+1]);

    rep(i,1,n+1){
        cout<<sum-abs(v[i-1]-v[i])-abs(v[i+1]-v[i])+abs(v[i-1]-v[i+1])<<endl;
    }
}


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

int main(){
	double v;
	while(cin>>v){
		double y = v*v/19.6;
		for(int i=1; ; i++){
			if(5*(i-1) > y){
				cout << i << endl;
				break;
			}
		}
	}
    return 0;
}

Measured memory_bytes: 3204
#include<iostream>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;

int H, N, A, B, dp[10001];

int main() {
    int H, N, A, B;
    cin >> H >> N;
    
    fill_n(dp + 1, H, 1e9);
    rep(i, N) {
        cin >> A >> B;
        rep(j, H + 1) {
            dp[j] = min(dp[max(j - A, 0)] + B, dp[j]);
        }
    }
    cout << dp[H] << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	int n;
	cin>>n;
	vector<int> a(3*n);
	rep(i, 3*n) cin>>a[i];
	sort(all(a));
	ll res = 0;
	rep(i, n) res += a[n+2*i];
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 1408
from itertools import combinations_with_replacement

N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(Q)]

ans = 0
for A in combinations_with_replacement(range(1,M+1), N):
    pts = 0
    for a, b, c, d in abcd:
        if A[b-1] - A[a-1] == c:
            pts += d
    ans = max(ans, pts)

print(ans)

Measured memory_bytes: 9196
#include<bits/stdc++.h>
 
#define hell                         1000000007
#define hell2                        998244353
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define all(v)                       v.begin(),v.end()
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(ll i=a;i<b;i++)
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'
 
const ll MAX=200005;
const ll SQN=330;
const ll LG=22;
const double PI=atan(1)*4;
using namespace std;

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

    ll n;
    cin >> n;
    ll a[n];
    rep(i,0,n) cin >> a[i];
    sort(a,a+n);
    reverse(a,a+n);
    ll ans=a[0];
    ll pos=1;
    ll cnt=0;
    for(ll i=2;i<n;i++) {
    	ans+=a[pos];
    	cnt++;
    	if(cnt==2) {
    		pos++;
    		cnt=0;
    	}
    }
    ret(ans);
}


Measured memory_bytes: 5208
#AGC031 A Colorful Subsequence
# Answer
N = int(input())
S = input()
alpha = [0]*26
mod = 10**9+7

for n in S:
    num = ord(n)-97
    alpha[num] += 1
    
ans = 1
for i in range(26):
    ans *= (alpha[i]+1)

# ans %= mod
print(ans%mod-1)

Measured memory_bytes: 3188
#include <stdio.h>
#include <string.h>

int check(char x[], char y[]) {
	int retu = 1;
	for (int i = 0; i < strlen(x); ++i) {
		if (x[i] != y[i]) {
			retu = 0;
			break;
		}
	}
	return retu;
}


int main(){
	char memo;
	char s[101];
	char t[101];
	int ans=0;

	scanf("%s", s);
	scanf("%s", t);
	int len = strlen(s);

	for (int i = 0; i < len; ++i) {
		if (check(s, t)) {
			ans = 1;
			break;
		}

		memo = s[0];
		for (int i = 0; i < len - 1; ++i) {
			s[i] = s[i + 1];
		}
		s[len - 1] = memo;

	}


	printf(ans? "Yes" : "No");

	return 0;
}

Measured memory_bytes: 128
import java.lang.Math.max
import java.lang.Math.min

fun main(args: Array<String>) {
    abc075b()
}

fun abc075b() {
    val (h, w) = readLine()!!.split(" ").map { it.toInt() }
    val sList = (1..h).map { readLine()!!.toCharArray() }

    val answer = sList.mapIndexed { y, list ->
        list.mapIndexed { x, c ->
            if (c == '#') c.toString() else {
                val square = sList.slice(max(0, y - 1)..min(y + 1, h - 1))
                    .map { it.slice(max(0, x - 1)..min(x + 1, w - 1)) }
                square.map { it.count { it == '#' } }.sum().toString()
            }
        }.joinToString("")
    }

    println(answer.joinToString(System.lineSeparator()))
}


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

int main(void){
    int n, minv, maxv;
    cin >> n;
    int R[n];
    for(int i=0; i<n; i++){
        cin >> R[i];
    }
    minv = R[0];
    maxv = R[1] - R[0];
    for(int i=1; i<n; i++){
        maxv = max(R[i] - minv, maxv);
        minv = min(R[i], minv);
    }
    
    cout << maxv << endl;

    return 0;
    
}

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

using namespace std;
typedef long long ll;


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

int main()
{
    ios_base::sync_with_stdio(0);

    ll k;
    cin >> k;

    if (k % 2 == 0) cout << "-1";
    else {
        ll x = 0;
        ll p = 0;
        bool f = 0;

        while (x < 1000001) {
            p = (p + (7*bigmod(10,x,k))%k) % k;
            p%=k;
            x++;
            if (p%k == 0) {
                f = 1;
                cout << x;
                break;
            }
        }

        if (!f) cout << "-1";

    }


    return 0;
}



Measured memory_bytes: 3616
#include<stdio.h>
int main(void)
{
	char c;
	scanf("%c",&c);
	if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u'){
		printf("vowel\n");
	}
	else{
		printf("consonant\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#define mask_type __int128
#define mod 1000003
int head[1000003], nxt[5000010];
int to1[5000010];
mask_type to2[5000010];
int val[5000010], tot;
#ifdef __cplusplus
extern "C" {
#endif
__attribute__((always_inline, optimize(3)))
__inline__ void set(int len, mask_type mask, int v) {
  int p = (mask + (mask_type(len) << 120)) % mod, i;
  for (i = head[p]; i; i = nxt[i])
    if (to1[i] == len && to2[i] == mask) {
      val[i] = v;
      return;
    }
  to1[tot] = len, to2[tot] = mask, val[tot] = v;
  nxt[tot] = head[p], head[p] = tot ++;
}
__attribute__((always_inline, optimize(3)))
__inline__ int get(int len, mask_type mask) {
  int p = (mask + (mask_type(len) << 120)) % mod, i;
  for (i = head[p]; i; i = nxt[i])
    if (to1[i] == len && to2[i] == mask) return val[i];
  return -1;
}
#ifdef __cplusplus
}
#endif
#undef mod
#define mod 998244353
#ifdef __cplusplus
extern "C" {
#endif
__attribute__((always_inline, optimize(3)))
__inline__ int add(int x, const int &y) {
  return (x += y) >= mod ? x - mod : x;
}
__attribute__((always_inline, optimize(3)))
__inline__ int mul(const int &x, const int &y) {
  return 1LL * x * y - 1LL * x * y / mod * mod;
}
#ifdef __cplusplus
}
#endif
int dfs(int len, mask_type mask) {
  if (!len) return 1;
  if (~get(len, mask)) return get(len, mask);
  int res = dfs(len - 1, mask >> 1);
  (mask & 1) && (res = add(res, res));
  for (int i = 1; i <= len; ++ i) {
    mask_type nmask = (mask_type(1) << i) - 1 & mask;
    for (int j = i << 1; j <= len; j += i) {
      nmask &= (mask >> j - i);
      res = add(res, mul(dfs(i, nmask), dfs(len - j, mask >> j)));
    }
  }
  set(len, mask, res);
  return res;
}

int main() {
  static char str[105] = { }; scanf("%s", str);
  mask_type mask = 0; int len = strlen(str);
  for (int i = len; ~-- i; ) (mask <<= 1) |= str[i] - '0';
  return printf("%d\n", dfs(len, mask)) & 0;
}


Measured memory_bytes: 11904
N=int(input())
AB=sorted([list(map(int, input().split())) for _ in range(N)])
CD=sorted([list(map(int, input().split())) for _ in range(N)])

paira=-1
pairb=-1
ans=0

for i in range(N):
	tempcd=CD[i]
	for h in range(len(AB)):
		tempab=AB[h]
		if tempab[0]<tempcd[0] and tempab[1]<tempcd[1]:
			if pairb<tempab[1]:
				paira=tempab[0]
				pairb=tempab[1]
				pairnum=h
	if paira!=-1 and pairb!=-1:
		ans+=1
		AB.pop(pairnum)
		paira=-1
		pairb=-1

print(ans)
			
	

Measured memory_bytes: 9184
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 2000000000
#define PI 3.1415926

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

typedef long long ll;
// #define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int a[5], ans = 0, mn = -1;
  REP(i, 5){
    cin >> a[i];
    ans += 10*((a[i]+9)/10);
    mn = max(mn, 10*((a[i]+9)/10)-a[i]);
  }
  cout << ans-mn << endl;

  return 0;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
p=list(map(int,input().split()))
if n==k:
    print((sum(p)+k)/2)
else:
    ans=(sum(p[:k])+k)/2
    res=ans
    for i in range(n-k):
        res+=(p[k+i]-p[i])/2
        ans=max(ans,res)
    print(ans)

Measured memory_bytes: 25060
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
#define TE 2e5
using namespace std;
using ll = long long;
using ldb = long double;

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

long long mypow(long long k, long long n) {
	long long temp = 1;

	k = k % DIV;
	while (n) {
		if (n % 2) temp = temp * k % DIV;
		k = k * k % DIV;
		n = n / 2;
	}
	return temp % DIV;
}

int main() {
	int N; cin >> N;
	map<tuple<int, ll, ll>, int> cnt;
	ll zab = 0, za = 0, zb = 0;
	for (int i = 0; i < N; i++) {
		ll a, b; cin >> a >> b;
		if (a == 0 && b == 0)zab++;
		else if (a == 0) za++;
		else if (b == 0)zb++;
		else {
			ll co = gcd(abs(a), abs(b));
			tuple<int, ll, ll> temp;
			if ((a / abs(a)) * (b / abs(b)) >= 0) get<0>(temp) = 1;
			else get<0>(temp) = -1;
			get<1>(temp) = abs(a) / co, get<2>(temp) = abs(b) / co;
			cnt[temp]++;
		}
	}

	ll a1 = 1;
	map<tuple<int, ll, ll>, bool> his;
	for (auto x : cnt) {
		his[x.first] = true;
		tuple<int, ll, ll> pr;
		get<0>(pr) = (-1) * get<0>(x.first), get<1>(pr) = get<2>(x.first), get<2>(pr) = get<1>(x.first);
		if (his[pr])continue;
		his[pr] = true;
		ll  temp = (mypow(2, x.second) + mypow(2, cnt[pr]) - 1) % DIV;
		a1 *= temp;
		a1 %= DIV;
	}

	a1 *= (mypow(2, za) + mypow(2, zb) - 1) % DIV;
	a1 %= DIV;
	a1 += zab;
	a1 %= DIV;
	cout << (a1 - 1+DIV)%DIV << endl;
}


Measured memory_bytes: 65964
#include<stdio.h>
int main(void){
  int N,A[1001],i;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<N;i++){
    if(A[i]%2==0){
      if(A[i]%3!=0&&A[i]%5!=0){
        printf("DENIED");
        return 0;
      }
    }
  }
    if(i==N)printf("APPROVED");
    return 0;
  }

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
const int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

typedef unsigned long long ull;
typedef std::pair<int,int> P;

bool compare(const P& lp, const P& rp){
    if(lp.second == rp.second){
        return lp.first > rp.first;
    }
    return lp.second < rp.second;
}

int main(){
    int N;
    std::cin >> N;

    std::vector<P> V;
    REP(i, N){
        int a, v;
        std::cin >> a >> v;
        V.push_back({a, v});
    }

    std::sort(V.begin(), V.end(), compare);

    std::cout << V[N-1].first << " " << V[N-1].second << std::endl;
}

Measured memory_bytes: 1204
import java.util.Scanner;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int temp = Integer.parseInt(sc.next());
            if ((i + 1) % 2 != 0 && temp % 2 != 0) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35528
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
#define PI acos(-1)
#define oo LLONG_MAX
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*

*/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  ll N;
  cin >> N;
  bool zoro = false;
  ll tmp = 0;
  rep(i, N){
    ll d, e;
    cin >> d >> e;
    if (d == e){
      tmp++;
      if (tmp >= 3)
        zoro = true;
    }
    else 
      tmp = 0;
  }
  if (zoro)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
#define int long long int
#define vi vector<int>
#define vvi vector<vi>
#define read(a)  for(int i = 0; i < n; i++) cin >> a[i];
#define print(a)  for(int i = 0; i < n; i++) cout << a[i] << " ";
#define pb push_back
#define pql priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define pqlv priority_queue<vi>
#define pqsv priority_queue<vi, vvi, greater<vi>>
// #define endl '\n'
#define N 200005
#define MOD 1000000007

vvi adj;

signed main() {
    int t = 1;
    // cin >> t;
    while(t--) {
        int n, m;
        cin >> n >> m;
        adj.clear();
        adj.resize(n + 1);
        while(m--) {
            int a, b;
            cin >> a >> b;
            adj[a].pb(b);
            adj[b].pb(a); 
        }
        queue<vi> q;
        vi dist(n + 1, -1);
        vi par(n + 1, -1);
        q.push({ 1, 0 });
        while(!q.empty()) {
            auto f = q.front();
            q.pop();
            int u = f[0], d = f[1];
            for(int v : adj[u]) {
                // cout << v << " " << u << endl;
                if(dist[v] == -1) {
                    par[v] = u;
                    q.push({ v, d + 1 });
                    dist[v] = d + 1;
                }
            }
        }
        bool ans = true;
        for(int i = 2; i <= n; i++) {
            if(dist[i] == -1)   ans = false;
        }
        ans ? cout << "Yes" : cout << "No";
        cout << endl;
        for(int i = 2; i <= n; i++) {
            cout << par[i] << endl;
        }
    }
} 

Measured memory_bytes: 18176
using System;

namespace Keyence2020
{
	class Program1
	{
		static void Main(string[] args)
		{
			int h = int.Parse(Console.ReadLine());
			int w = int.Parse(Console.ReadLine());
			int n = int.Parse(Console.ReadLine());
			int p = 0;
			int t = h > w ? h : w;  //大きい方を取る

			p = (int)Math.Ceiling((decimal)n / t);

			Console.WriteLine(p);
		}
	}
}


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

int main() {
	long long n, m; cin >> n >> m;
	vector<pair<long long, long long>> d(n);
	for (int i = 0; i < n; i++)
	{
		long long a, b;
		cin >> a >> b;
		d[i] = make_pair(a, b);
	}
	sort(d.begin(), d.end());

	long long res = 0;
	int i = 0;
	while (m > 0)
	{
		long long buy = min(m, d[i].second);
		res += d[i].first * buy;
		m -= buy;
		i++;
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 4796
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String a = sc.next();
		String b = sc.next();
		String msg = null;

		if (a.length() > b.length()) {
			msg = "GREATER";
		} else if (a.length() < b.length()) {
			msg = "LESS";
		} else {
			msg = "EQUAL";
			for (int i = 0; i < a.length(); i++) {
				if (a.charAt(i) > b.charAt(i)) {
					msg = "GREATER";
					break;
				} else if (a.charAt(i) < b.charAt(i)) {
					msg = "LESS";
					break;
				}
			}

		}

		System.out.println(msg);
	}
}

Measured memory_bytes: 21972
#include <stdio.h>
#include <math.h>

#define PI 3.141592653589793

int main()
{
	double a, b, c, s, C;
	double S, L, h; 
	
	scanf("%lf%lf%lf", &a, &b, &C);
	c = sqrt(a*a + b*b - 2*a*b*cos(C*PI/180));
	L = a+b+c;
	s = L/2;
	S = sqrt(s*(s-a)*(s-b)*(s-c));
	h = 2*S/a;
	printf("%.8lf\n%.8lf\n%.8lf\n", S, L, h);
	return 0;
}



Measured memory_bytes: 2056
#include <iostream>
#include <string>
#include <queue>
using namespace std;

struct process {
	string name;
	int time;
};

int main() {
	int n,time,limit,stamp=0;
	process temp;
	string proc;
	queue<process> todo,finish;
	cin >> n >> limit;
	for(int i=0; i<n; ++i) {
		cin >> proc >> time;
		temp.name = proc;
		temp.time = time;
		todo.push(temp);
	}
	while(!(todo.empty())) {
		temp=todo.front();
		todo.pop();
		if(temp.time>limit) {
			stamp+=limit;
			temp.time-=limit;
			todo.push(temp);
		} else {
			stamp+=temp.time;
			temp.time=stamp;
			finish.push(temp);
		}
	}
	for(int i=0; i<n; ++i) {
		temp=finish.front();
		finish.pop();
		cout << temp.name << " " << temp.time << endl;
	}
	return 0;
}

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

template<typename T>
class CHT{
    typedef pair<T, T> Pair;
    
private:
    vector<Pair> lines;
    bool isMonotonicX;
    function<bool(T l, T r)> comp;

public:
    CHT(bool flagX=false, function<bool(T l, T r)> compFunc=greater<T>())
        :isMonotonicX(flagX), comp(compFunc){
    }

    bool check(Pair l1, Pair l2, Pair l3){
        if(l1 < l3) swap(l1, l3);
        return (l3.second - l2.second) * (l2.first - l1.first) >= (l2.second - l1.second) * (l3.first - l2.first);
    }

    void add(T a, T b){
        Pair line(a, b);
        while(lines.size() >= 2 && check(*(lines.end()-2), lines.back(), line)){
            lines.pop_back();
        }
        lines.emplace_back(line);
    }

    T f(int i, T x){
        return lines[i].first*x + lines[i].second;
    }

    T f(Pair line, T x){
        return line.first*x + line.second;
    }

    T get(T x){
        if(isMonotonicX){
            static int head = 0;
            while(lines.size()-head>=2 && comp(f(head, x), f(head+1, x))){
                head++;
            }
            return f(head, x);
        }else{
            int low = -1, high = lines.size()-1;
            while(high-low>1){
                int mid = (high+low)/2;
                (comp(f(mid, x), f(mid+1, x)) ? low : high) = mid;
            }
            return f(high, x);
        }
    }
};

int main(){
    int N;
    int64_t H[200000];
    int64_t C;
    cin >> N >> C;
    for(int i=0; i<N; i++) cin >> H[i];

    CHT<int64_t> cht;
    cht.add(-2*H[0], H[0]*H[0]);
    for(int i=1; i<N; i++){
        int64_t result = cht.get(H[i]) + H[i]*H[i] + C;
        if(i==N-1){
            cout << result << endl;
            return 0;
        }
        cht.add(-2*H[i], result + H[i]*H[i]);
    }
    return 0;
}

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

int main(){
    int n; cin>>n;
    string a,b,c;
    cin>>a >>b >>c;
    int ans=0;
    for(int i=0;i<n;i++){
        if(a[i]==b[i]&&b[i]==c[i])continue;
        if(a[i]==b[i]||b[i]==c[i]||c[i]==a[i])ans++;
        else ans+=2;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
bool calc (string n){
    long long int sum =0;
    while(n[0] != '\0'){
            sum+= n[0]- 48;
            n=n.substr(1);
    }
    if (sum%9 == 0){
        return true;
    }
    return false;
}
int main(){
    string n;

    getline(cin, n);

    if (calc(n)==true){
        cout <<"Yes";
    }
    else{
         cout <<"No" ;
    }
   
}

Measured memory_bytes: 3928
#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>//系统快排必加
#include<cmath>
#include<queue>
#include<bitset>
#define lowbit(x) x&(-x)
using namespace std;
int main()
{
   char a[200];
   gets(a);
   bool x=false;
   for(int i=0;i<strlen(a);i++)
   {  
	 if(a[i]=='C')
       x=true;
     if(a[i]=='F'&&x==true)
     {
       cout<<"Yes";
       return 0;
     }
   }
   cout<<"No";
   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

int ans, cnt;

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

	string S;
	cin >> S;

	int Q;
	cin >> Q;

	bool revflg = true; // true:普通 false:逆方向
	string sf = ""; // 先頭に追加する文字
	string sl = ""; // 末尾に追加する文字

	rep(i, Q) {
		int t;
		cin >> t;
		if (t == 1) {
			revflg = !revflg;
		}
		else {
			int f;
			cin >> f;

			char c;
			cin >> c;

			if (f == 1) {
				if (revflg) {
					sf.push_back(c);
				}
				else {
					sl.push_back(c);
				}

			}
			else {
				if (revflg) {
					sl.push_back(c);
				}
				else {
					sf.push_back(c);
				}

			}
		}
	}

	if (revflg) {
		reverse(sf.begin(), sf.end());
		cout << sf + S + sl << endl;
	}
	else {
		reverse(sl.begin(), sl.end());
		reverse(S.begin(), S.end());
		cout << sl + S + sf << endl;
	}

	return 0;
}

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

int main() {
	int n; cin >> n;
	vector<int>a(n);
	for (int i = 0; i < n; i++)cin >> a.at(i);
	vector<bitset<40>>ans(n);
	//ans.at(0)を求める
	bitset<40>sig(0);
	for (int i = 1; i < n; i++) {
		bitset<40>abit(a.at(i));
		sig = sig ^ abit;
	}
	ans.at(0) = sig;
	//ドミノ
	for (int i = 1; i < n; i++) {
		bitset<40>a1(a.at(i));
		bitset<40>a1m1(a.at(i - 1));
		ans.at(i) = ans.at(i - 1) ^ a1 ^ a1m1;
	}
	for (int i = 0; i < n; i++)cout << ans.at(i).to_ulong() << endl;
}

Measured memory_bytes: 5480
//
//  選択ソート
//  (昇順に並び替え)
//
#include <iostream>

void swap(int& a, int& b) {
    int tmp = a;
    a = b;
    b = tmp;
}
int selectionSort(int* a, int n) {
    int count = 0;
    // 配列の中から最小値を探し、
    // 前から順に格納する。
    for (int i = 0; i < n; i++) {
        int min = i;
        for (int j = i; j < n; j++) {
            if (a[j] < a[min])
                min = j;
        }
        if (i < min) {
            swap(a[i], a[min]);
            count++;
        } // i == minであれば入れ替える必要がない
    }
    return (count);
}

int main() {
    int count = 0;

    int n;
    std::cin >> n;

    int* a = new int[n];
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    
    count = selectionSort(a, n);

    for (int i = 0; i < n; i++) {
        std::cout << a[i];
        if (i == n - 1)
            std::cout << std::endl;
        else
            std::cout << " ";
    }
    std::cout << count << std::endl;

    delete a;
    return (0);
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define rep(i, a, n) for(long long i = (a); i < (n); i++)
using namespace std;
using ll = long long;
constexpr ll NIL = -1;

struct Node { ll parent, left, right, depth; };
Node T[100005];

void set_depth(ll u, ll d){
    Node& cur = T[u];
    cur.depth = d;
    if(cur.right != NIL) set_depth(cur.right , d);
    if(cur.left != NIL) set_depth(cur.left, d + 1);
}

void print(ll id){
    Node cur = T[id];
    printf("node %ld: parent = %ld, depth = %ld, ", id, cur.parent, cur.depth);

    if(cur.parent == NIL) cout << "root, ";
    else if(cur.left == NIL) cout << "leaf, ";
    else cout << "internal node, ";

    cout << "[";
    for(ll c = cur.left; c != NIL; c = T[c].right){
        cout << c << ((T[c].right == NIL) ? "" : ", ");
    }
    cout << "]" << endl;
}

int main(){
    ll n; cin >> n;
    memset(T, -1, 100005*sizeof(Node));

    rep(i, 0, n){
        ll id, k; cin >> id >> k;
        rep(j, 0, k){
            ll c, l; cin >> c;
            if(!j) T[id].left = c;
            else T[l].right = c;
            l = c;
            T[c].parent = id;
        }
    }

    ll root;
    rep(i, 0, n) if(T[i].parent == NIL) root = i;

    set_depth(root, 0);

    rep(i, 0, n) print(i);

    return 0;
}


Measured memory_bytes: 9384
n = int(input())
a = input()
b = input()
c = input()
a = list(a)
b = list(b)
c = list(c)

ans = 0
for x, y, z in zip(a, b, c):
    if x == y and y == z:
        pass
    elif x == y or y == z or z == x:
        ans += 1
    else:
        ans += 2

print(ans)

Measured memory_bytes: 3060
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int a,b;
		cin>>a>>b;
		string sa;
		for(ll int i=0;i<a;i++)
		{
			char c='0'+b;
			sa+=c;
		}
		string sb;
		for(ll int i=0;i<b;i++)
		{
			char c='0'+a;
			sb+=c;
		}
		cout<<min(sa,sb);
	}
	return 0;
}

Measured memory_bytes: 256
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

D, N = list(map(int, sys.stdin.readline().split()))

if N == 100:
    N += 1
print(100 ** D * N)



Measured memory_bytes: 13672
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
	int x, a, b;
	cin >> x >> a >> b;
	if(abs(x-a) < abs(x-b))cout << 'A';
	else cout << 'B';
	cout << endl;
	return 0;
}


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

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

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

int main(){
    ll n;
    cin >> n;
    VL t(n), a(n);
    rep(i,n) cin >> t[i] >> a[i];

    ll T = t[0], A = a[0];
    rep(i,n-1){
        int j = i+1;
        ll u1, u2, T1, T2, A1, A2;
        u1 = (T + t[j] - 1)/t[j];
        u2 = (A + a[j] - 1)/a[j];
        T1 = t[j] * u1;
        T2 = t[j] * u2;
        A1 = a[j] * u1;
        A2 = a[j] * u2;
        
        bool f1 = T1 >= T && A1 >= A;
        bool f2 = T2 >= T && A2 >= A;
        if(f1 && f2){
            T = min(T1, T2);
            A = min(A1, A2);
        }else if(f1){
            T = T1; A = A1;
        }else{
            T = T2; A = A2;
        }
    }
    cout << T+A << endl;
    return 0;
}

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

using namespace std;

int main(void){
	int n,m;
	cin>>n>>m;
	
	vector<int> a(n);
	
	
	int all = 0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		all+=a[i];
	}
	
	int count=0;
	
	
	for(int i=0;i<n;i++){
		if(a[i]>=(float)all*((float)1/((float)4*(float)m))){
			count++;
		}
	}
	
	if(count>=m){
		cout<<"Yes";
	}else{
		cout<<"No";
	}
	
	return 0;
}

Measured memory_bytes: 256
import numpy as np
import itertools

N,M,Q=map(int,input().split())
abcd=[]

for q in range(Q):
  array=list(map(int,input().split()))
  abcd.append(array)

all = list(itertools.combinations_with_replacement(range(1,M+1), N))

MAX=0

for al in all:
  sum=0
  for a,b,c,d in abcd:
    if al[b-1] - al[a-1] == c:
      sum += d
  MAX=max(sum,MAX)
  
print(MAX)

Measured memory_bytes: 39416
#include <iostream>
#include <stdio.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
using namespace std;


int main(void)
{
	map<lli, int> mp;
	int N; cin >> N;
	rep(i, 0, N) {
		lli tmp; cin >> tmp;
		mp[tmp]++;
	}

	int ans = 0;
	map<lli, int>::iterator it;
	for (it = mp.begin(); it != mp.end(); it++) {
		//cout << it->second << endl;
		if (it->second % 2 == 1)ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
template<class A, class B> ostream& operator <<(ostream& out, const pair<A, B> &p) {
    return out << "(" << p.first << ", " << p.second << ")";
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}

string S;
int N;
const int maxn = 1000005;
LL dp[maxn][2];
LL dfs(int idx, int flag) {
    if (dp[idx][flag] >= 0) return dp[idx][flag];
    int num = S[idx] - '0' + flag;
    if (idx == N - 1) return min(num, 10 - num + 1);
    return dp[idx][flag] = min(num + dfs(idx + 1, 0), 10 - num + dfs(idx + 1, 1));
}

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

    string s;
    cin >> s;
    N = (int)s.size();
    S = s;
    memset(dp, -1, sizeof(dp));
    cout << dfs(0, 0) << '\n';

    return 0;
}


Measured memory_bytes: 64924
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
 
typedef long long LL;
const int V = 2e5 + 5;
const int N = 1e6;
const LL mod = 924844033;
const LL g = 5;
 
struct edge {
  int nxt, to;
} e[V << 1];
LL fac[N], inv[N], a[N], b[N], c[N];
int pos[N], fir[V], sz[V], cnt = 0, n;
 
inline void addedge(int x, int y) {
  e[++ cnt] = (edge) { fir[x], y  };
  fir[x] = cnt;
}
 
inline LL pow(LL x, LL exp) {
  LL r = 1; x %= mod;
  exp = (exp + mod - 1) % (mod - 1);
  for (; exp; exp >>= 1, x = x * x % mod)
    if (exp & 1) r = r * x % mod;
  return r;
}
 
inline void pre(int n) {
  int t = n >> 1;
  for (int i = fac[0] = 1; i < n; i ++) {
    fac[i] = fac[i - 1] * i % mod;
    pos[i] = (pos[i >> 1] >> 1) ^ (t * (i & 1));
  }
  a[n - 1] = inv[n - 1] = pow(fac[n - 1], mod - 2);
  for (int i = n - 1; i; i --) a[i - 1] = inv[i - 1] = inv[i] * i % mod;
}
 
inline void dfs(int x, int fa) {
  sz[x] = 1;
  for (int i = fir[x]; i; i = e[i].nxt)
    if (e[i].to != fa) {
      dfs(e[i].to, x);
      sz[x] += sz[e[i].to];
      b[sz[e[i].to]] --;
    }
  if (x != 1) b[n - sz[x]] --;
}
 
inline void NTT(LL *a, int n, LL t) {
  for (int i = 0; i < n; i ++)
    if (pos[i] < i) swap(a[pos[i]], a[i]);
  LL x, y, per, cur;
  for (int i = 2, ii = 1; i <= n; i <<= 1, ii <<= 1) {
    per = pow(g, t * (mod - 1) / i);
    for (int j = 0; j < n; j += i) {
      cur = 1;
      for (int k = j; k < j + ii; k ++) {
        x = a[k];
        y = cur * a[k + ii] % mod;
        a[k] = x + y;
        if (a[k] >= mod) a[k] -= mod;
        a[k + ii] = x - y;
        if (a[k + ii] < 0) a[k + ii] += mod;
        cur = cur * per % mod;
      }
    }
  }
  if (t == -1) {
    LL I = pow((LL)n, mod - 2);
    for (int i = 0; i < n; i ++) a[i] = a[i] * I % mod;
  }
}
 
int main() {
  scanf("%d", &n);
  for (int i = 1, x, y; i < n; i ++) {
    scanf("%d%d", &x, &y);
    addedge(x, y); addedge(y, x);
  }
  int k = 1;
  for (; k <= n; k <<= 1);
  k <<= 1;
  pre(k);
  dfs(1, 0); b[n] = n;
  for (int i = 0; i < k; i ++) {
    b[i] = b[i] * fac[i] % mod;
    if (b[i] < 0) b[i] += mod;
  }
  reverse(b + 1, b + n + 1);
  for (int i = n + 1; i <= k; i ++) a[i] = b[i] = 0;
  NTT(a, k, 1);
  NTT(b, k, 1);
  for (int i = 0; i < k; i ++) a[i] = a[i] * b[i] % mod;
  NTT(a, k, -1);
  for (int i = n; i > 0; i --)
    printf("%lld\n", a[i] * inv[n - i + 1] % mod);
  return 0;
}

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

using namespace std;
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
typedef int64_t ll;

int main()
{
	int zn;
	cin >>zn;
	rep(i,zn){
		int s;
		cin >> s;
		printf("Case %d:\n", i+1);
		rep(j, 10){
			s = (s*s / 100) % 10000;
			printf("%d\n", s);
		}
	}
	
	

}



Measured memory_bytes: 3236
#include<bits/stdc++.h>
#define lson l, mid
#define rson mid+1, r
#define PII pair<int, int>
#define Size(x) (int)(x.size())
using namespace std;
typedef long long LL;
//const int MOD = 1e9+7;
const auto INF = 0x3f3f3f3f;
const int N = 1e2+5;

LL a[N], b[N];

int main() {
    int n;
    scanf("%d", &n);
    for(int i=1; i<=n; i++) {
        scanf("%lld", &a[i]);
    }
    LL answer = 0;
    while(1) {
        LL temp = 0;
        bool flag = false;
        for(int i=1; i<=n; i++) {
            b[i] = 0;
            if(a[i] >= n) {
                flag = true;
                answer += a[i]/n;
                b[i] += a[i]/n;
                temp += a[i]/n;
                a[i] %= n;
            }
        }
        if(!flag)
            break;
        for(int i=1; i<=n; i++) {
            a[i] += temp - b[i];
        }
    }
    printf("%lld\n", answer);
}



Measured memory_bytes: 256
#include<stdio.h>

main(){
  int i,n,top,k,v[101];
  int a[101][101],j;

  for(i=0;i<101;i++){
    for(j=0;j<101;j++){
      a[i][j]=0;
    }
  }
  
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d",&top,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v[j]);
      a[top-1][v[j]-1]=1;
    }
  }
  
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%d", a[i][j]);
      if(j!=n-1)
	printf(" ");
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 644
data class Node(val id: Int, val edges: List<Int>, var dest: Int = -1, var visited: Boolean = false)

fun main(args: Array<String>) {
    val nodeList = List(readLine()?.toInt() ?: 0) {
        val input = readLine()?.split(" ".toRegex())?.map(String::toInt) ?: listOf()
        Node(input[0], input.subList(2, 2 + input[1]))
    }
    Bfs(nodeList).print()
}

class Bfs(private val nodeList: List<Node>) {
    init {
        bfs()
    }

    fun print() {
        println(
            nodeList.joinToString("\n") {
                "${it.id} ${it.dest}"
            }
        )
    }

    private fun bfs() {
        var dest = 0
        var sameTimeNodes = listOf(nodeList.first())
        while (sameTimeNodes.isNotEmpty()) {
            val nodes = arrayListOf<Node>()
            sameTimeNodes.forEach { node ->
                if (node.dest == -1 || node.dest > dest) {
                    node.dest = dest
                }
                nodes.addAll(nodeList.filter { !it.visited && node.edges.contains(it.id) })
            }
            sameTimeNodes.forEach {
                it.visited = true
            }
            sameTimeNodes = nodes
            dest++
        }
    }
}


Measured memory_bytes: 60320
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,t;
    cin>>n>>t;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    int ans=0;
    for(int i=1;i<n;i++)
    {
        if((a[i]-a[i-1])>=t)
        ans+=t;
        else 
        ans+=a[i]-a[i-1];
    }
    ans+=t;
    cout<<ans<<endl;
}

Measured memory_bytes: 4392
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int a,b,n;
  cin>>a>>b>>n;
  int x=min(n,b-1);
  cout<<(a*x)/b-a*(x/b)<<endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a > c)
        swap (a, c);
    if (a > b)
        swap(a, b);
    if (b > c)
        swap(b, c);
    cout << a << " " << b << " " << c << endl;
}



Measured memory_bytes: 3088
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>

using namespace std;

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

    vector<int> P;

    int ma = 0;
    int mp;

    for(int i = 0; i < N; i++){
        int p;
        cin >> p;

        P.push_back(p);

        if(p > ma){
            ma = p;
            mp = i;
        }
    }

    int sum = 0;

    for(int i = 0; i < N; i++){
        if(i == mp){
            sum += (P[i]/2);
        }else{
            sum += P[i];
        }
    }

    cout << sum << endl;

    return 0;
}

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

int main(int argc, char const *argv[])
{
    int z[5]; int x;
    z[1]=z[2]=z[3]=z[4]=0;
    for(int i=0;i<6;++i) {
        cin >> x;
        ++z[x];
    }
    bool flg=true;
    for(int i=1;i<=4;++i) {
        //cout << flg << " " << z[i] << " " << (z[i]<3) << endl;
        flg = flg&(z[i]<3);
    }
    cout << (flg?"YES":"NO") << endl;

    return 0;
}


Measured memory_bytes: 256
a, b = map(int, input().split())

def calc(n):
    if len(n) == 1:
        return True
    elif n[0] == n[-1]:
        n = n[1:-1]
        return calc(n)
    else:
        return False

count = 0

for i in range(a, b+1):
    i = str(i)
    if calc(i):
        count += 1

print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	#define int long long 
	//using namespace std;
	signed main()
	{
		std::ios::sync_with_stdio(false);
		int n;
		cin>>n;
		int sum = 0 ; 
		for(int i=1;i<=n;++i)
		{
			if(i%3!=0 and i%5!=0)
				sum += i ;
		}
		cout<<sum ; 
		return 0;
	}


Measured memory_bytes: 3692
S=input()
N=[0]*len(S)
count_r = 0
count_l = 0
start_index=0
a='R'
def f(r,l):
    if (r+l) % 2 ==0:
        return (r+l) //2 ,(r+l) //2
    elif r % 2 ==0:
        return (r+l) //2 ,(r+l) //2 +1
    elif r % 2 ==1:
        return (r+l) //2 +1 ,(r+l) //2
for i in range(len(S)):
    #print(N)
    if S[i] == 'R' and S[i] == a:
        count_r += 1
    elif S[i] =='L' and S[i] !=a:
        count_l += 1
    elif S[i] =='L' and S[i] ==a:
        count_l += 1
    elif S[i] =='R' and S[i] !=a :
        #print(i,count_r,count_l,i-count_l-1,i-count_l)
        N[i-count_l-1], N[i-count_l]=f(count_r,count_l)
        count_r = 1
        count_l = 0
    a = S[i]
    
    
N[i-count_l], N[i-count_l+1] = f(count_r,count_l)
#print(i,count_r,count_l)
print(*N)

Measured memory_bytes: 6400
// ボール: 区別あり, 箱：区別なし, 入れ方: 1 個以上
// スターリング数
// S(n, k) = s(n - 1, k - 1) + k * S(n - 1, k)
#include <iostream>
using namespace std;
const int MOD = 1000000007;
const long long MAXN = 1010;
long long S[MAXN][MAXN] = {};

void star_init() {
  S[0][0] = 1;
  for(int n = 1; n < MAXN; n++) {
    for(int k = 1; k < MAXN; k++) {
      S[n][k] = S[n - 1][k - 1] + k * S[n - 1][k];
      S[n][k] %= MOD;
    }
  }
}

int main() {
  
  star_init();
  int n, k; cin >> n >> k;
  cout << S[n][k] << endl;
  return 0;
}



Measured memory_bytes: 11072