akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=998244353;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll Pow(ll n,ll p){
	ll r=1;
	for(;p>0;p>>=1){
		if(p&1) r=(r*n)%mod;
		n=(n*n)%mod;
	}
	return r;
}

const int M=500005;
ll F[M];

void Init(){
	F[0]=1;
	for(int i=1;i<M;i++) F[i]=F[i-1]*i%mod;
}

ll Div(ll n,ll m){
	return n*Pow(m,mod-2)%mod;
}

ll nCk(ll n,ll k){
	return Div(F[n],F[n-k]*F[k]%mod);
}

ll nPk(ll n,ll k){
	return nCk(n,k)*F[k]%mod;
}

int h,w;

int main(){
	Init();
	cin>>h>>w;
	ll res=0;
	if(h>w) swap(h,w);
	for(int i=0;i<=h;i++){
		ll t=nCk(h,i)*nPk(w,i)%mod*Pow(w+1,h-i)%mod*Pow(h+1,w-i)%mod;
		if(i%2==1) (t*=mod-1)%=mod;
		(res+=t)%=mod;
	}
	cout<<res<<endl;
}

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

int N,A,B;
         // 最大 200 個なので余裕を持って 210 に --- 200 以上ならなんでもよいです

int main() {
    cin >> N >> A >> B;
    
    if (N * A < B) cout << N * A << endl;
    else cout << B << endl;
}

Measured memory_bytes: 256
n = int(input())
s = input()
dp = [float("inf") for i in range(n)]
dp[0] = 0
for i in range(1,n):
    if s[i] == "E":
        dp[0] += 1
for i in range(1,n):
    dp[i] = dp[i-1]
    if s[i-1] == "W":
        dp[i] += 1
    if s[i] == "E":
        dp[i] -= 1
print(min(dp))

Measured memory_bytes: 15520
#include <iostream>
 
using namespace std;
 
int main(){
    int A,B,C,D;
    cin >>A>>B>>C>>D;
    if(A+B>C+D){
        cout <<"Left"<<endl;
    }
    if(A+B==C+D){
        cout<<"Balanced"<<endl;
    }
    if(A+B<C+D){
        cout<<"Right"<<endl;
    }

return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp(a, b) make_pair(a, b)
#define pb(t) push_back(t)
#define ft first
#define sc second
#define pt(num) cout << num << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;


int main(void) {
    ll N, K;
    cin >> N >> K;
    ll i;
    P s[MAX];
    ll clr[MAX]={};
    
    for(i=0; i<N; i++) cin >> s[i].sc >> s[i].ft;
    sort(s, s+N);
    reverse(s, s+N);
    
    priority_queue<P> q;
    ll ans=0;
    ll t=0;
    ll kind=0;
    
    for(i=0; i<K; i++) {
        q.push(P(-s[i].ft, s[i].sc));
        t+=s[i].ft;
        clr[s[i].sc]++;
        if(clr[s[i].sc]==1) kind++;
    }
    chmax(ans, t+kind*kind);

    for(i=K; i<N; i++) {
        P u=q.top();
        
        while(q.size() && clr[u.sc]==1) {
            q.pop();
            
            if(q.empty()) {
                pt(ans);
                return 0;
            }
            
            u=q.top();
        }
        
        if(clr[s[i].sc]==0) {
            q.pop();
            clr[u.sc]--;
            q.push(P(-s[i].ft, s[i].sc));
            t+=u.ft; t+=s[i].ft;
            clr[s[i].sc]++; kind++;
            chmax(ans, t+kind*kind);
        }
        
    }

    pt(ans);
}




Measured memory_bytes: 4852
#include<iostream>
#include<vector>
using namespace std;
int main(){
    string s; 
    vector<char> ans_list;

    cin >> s;
    for(int i=0;i<s.size();i++){
        if(s.at(i) == '0'){
            ans_list.push_back('0');
        }else if(s.at(i) == '1'){
            ans_list.push_back('1');
        }else if(s.at(i) == 'B'){
            if(ans_list.size() > 0){
                ans_list.pop_back();
        }
    }
    }
    for(int i=0;i<ans_list.size();i++){
        cout << ans_list[i];
    }
    return 0;
}


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

int main() {
	string a,b;
	cin >> a >> b;
// A>BのときGREATER
// A<BのときLESS
// A=BのときEQUALと出力
	string k = "EQUAL";
	if(a.size() > b.size())
	{
		k = "GREATER";
	}
	else if(a.size() < b.size())
	{
		k = "LESS";
	}
	else
	{
		for(int i = 0;i < a.size();i++)
		{
			if(a.at(i) > b.at(i))
			{
				k = "GREATER";
			}
			else if(a.at(i) < b.at(i))
			{
				k = "LESS";
			}
			if(k != "EQUAL")
			{
				break;
			}
		}
	}
	cout << k << endl;
	return 0;
}


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

int sum;
int ma = -1;

int main()
{
    int a;
    for(int i = 0;i < 3;i++)
    {
        cin >> a;
        sum += a;

        ma = max(ma,a);
    }

    cout << sum - ma << endl;
    return 0;
}

Measured memory_bytes: 256
n,m,c=map(int,input().split())
B=list(map(int,input().split()))
ans=0
for i in range(n):
  temp=0
  A=list(map(int,input().split()))
  for a,b in zip(A,B):
    temp+=a*b
  if temp+c>0:
    ans+=1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1e+9
#define MOD 1000000007
using namespace std;


int main(){
    int A,B,T;
    cin >> A>> B >> T;
    cout<<(T/A)*B<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) (a*a)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

int main() {
	int a, b;
	cin >> a >> b;
	if (a == b)cout << "Draw" << endl;
	else if (a == 1)cout << "Alice" << endl;
	else if (b == 1)cout << "Bob" << endl;
	else if (a > b)cout << "Alice" << endl;
	else cout << "Bob" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
        var a = scan.nextLine().split(" ").map{ it.trim().toInt() }.toTypedArray()
        var i =1
        for(x in a)
        {
            if(x==0)
            {
                println(i)
                break
            }
            i++
        }
}


Measured memory_bytes: 38416
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M=2050,mod=924844033;

int fac[M],rfac[M],a[M],b[M],n,k,i,s;

int mul(int a,int b)
{
	return a*(ll)b%mod;
}
int ad(int a,int b)
{
	return(a+b)%mod;
}
int de(int a,int b)
{
	return(a-b)%mod;
}

int pow(int a,int b)
{
	int s=1;
	while(b)
	{
		if(b&1)s=mul(s,a);
		a=mul(a,a);
		b>>=1;
	}
	return s;
}
int rev[M],N,iN;
void pre(int n)
{
	int i,k;
	for(N=1,k=0; N<n; N<<=1)k++;
	for(i=0; i<N; i++)rev[i]=(rev[i>>1]>>1)|((i&1)<<(k-1));
	iN=pow(N,mod-2);
}
void ntt(int*a,int on)
{
	int i,j,k,t,w,wn;
	for(i=0; i<N; i++)
	{
		if(i<rev[i])swap(a[i],a[rev[i]]);
	}
	for(i=2; i<=N; i<<=1)
	{
		wn=pow(5,on==1?(mod-1)/i:mod-1-(mod-1)/i);
		for(j=0; j<N; j+=i)
		{
			w=1;
			for(k=0; k<i>>1; k++)
			{
				t=mul(w,a[i/2+j+k]);
				a[i/2+j+k]=de(a[j+k],t);
				a[j+k]=ad(a[j+k],t);
				w=mul(w,wn);
			}
		}
	}
	if(on==-1)
	{
		for(i=0; i<N; i++)a[i]=mul(a[i],iN);
	}
}

int C(int n,int k)
{
	return n<k?0:mul(fac[n],mul(rfac[k],rfac[n-k]));
}

int main()
{
	scanf("%d%d",&n,&k);
	fac[0]=1;
	for(i=1; i<=n; i++)fac[i]=mul(fac[i-1],i);
	rfac[n]=pow(fac[n],mod-2);
	for(i=n; i>0; i--)rfac[i-1]=mul(rfac[i],i);
	pre(n+1);
	for(i=0; i<=n; i++)
	{
		a[i]=C(n/k-i,i);
		b[i]=C(n/k+1-i,i);
	}
	ntt(a,1);
	ntt(b,1);
	for(i=0; i<N; i++)a[i]=mul(pow(a[i],(k-n%k)*2),pow(b[i],n%k*2));
	ntt(a,-1);
	for(i=0; i<=n; i++)(s+=(i&1?-1:1)*mul(fac[n-i],a[i]))%=mod;
	printf("%d",(s+mod)%mod);
}

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

using namespace std;

int main( )
{	
    int n;
    int maxProfit = 1-1000000000;
    int Ri = 2000000000;
	ios::sync_with_stdio( false );
    cin>>n;
    
    vector<int> R(n);
    vector<int>::iterator itr = R.begin( );
    vector<int>::iterator itrE = R.end( );
    
    for( ; itr!=itrE; itr++ ) {
    	cin>>*itr;
        if( maxProfit < *itr - Ri ) {
       		maxProfit = *itr - Ri;
       	}
       	if( *itr < Ri ) {
    		Ri = *itr;
    	}
    }    

    cout<<maxProfit<<endl;
	
	return 0;
}

Measured memory_bytes: 1796
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <time.h>
#include <algorithm>
#include <set>
#include <map>
#define ll long long
using namespace std;

int A[1111];
ll S[2222222];

bool HasBit(ll x, int pos) {
    return ((x>>pos)&1);
}

int main() {
    int N,K;
    cin>>N>>K;
    for(int i=1;i<=N;i++)
        cin>>A[i];
    int sz=0;
    for(int i=1;i<=N;i++) {
        ll summ = 0;
        for(int j=i;j<=N;j++) {
            summ += A[j];
            S[sz++]=summ;
        }
    }
    
    
    for(int b=61;b>=0;b--) {
        
        int ct=0;
        for(int i=0;i<sz;i++) {
            if (HasBit(S[i],b)) {
                ct++;
            }
        }
        if (ct >= K) {
            int nsz=0;
            for(int i=0;i<sz;i++) {
                if (HasBit(S[i],b)) {
                    S[nsz++]=S[i];
                }
            }
            sz=nsz;
        }
    }
    
    if (sz == 0) {
        cout << 0 << endl;
        return 0;
    }
    
    ll ans = S[0];
    for(int i=1;i<sz;i++)
        ans &= S[i];
    
    cout << ans << endl;
    
    
    
    
    
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
using namespace std;
#define IOS {ios :: sync_with_stdio(false); cin.tie(0);cout.tie(0); }
#define F first
#define S second
#define pb push_back
typedef long double ld;
#define deci(n) cout << fixed << setprecision(n);
typedef long long ll;

#define mem0(x)  memset(x,0,sizeof(x));
#define mem1(x)  memset(x,1,sizeof(x));
#define memm1(x) memset(x,-1,sizeof(x));
#define all(a) a.begin(), a.end()
#define pll pair<ll, ll>
#define bits(x) __builtin_popcount(x)
#define fori(n)  for (ll i = 0; i < n; i++)
#define fori2(n) for(ll i=1;i<=n;i++)
#define forj(n)  for (ll j = 0; j < n; j++)
#define forj2(n) for(ll j=1;j<=n;j++)
#define fork(n)  for (ll k = 0; k < n; k++)
#define fork2(n) for(ll k=1;k<=n;k++)
#define vll vector <ll>
#define mll map <ll, ll>
#define vpll vector <pll>
const ll md = 1e9 + 7;

#define BSET(a, p) ((a) | (1ll << (p)))
#define BCHK(a, p) ((a) & (1ll << (p)))
#define BXOR(a, p) ((a) ^ (1ll << (p)));
#define BREM(a, p) (BCHK(a, p)?(BXOR(a, p)):(a))
#define BSHO(a, N) (bitset<N>(a))
// const ll N = 100005;
// ll fac[N] = {1};
// #define calfac for(ll i=1  ;i<N;i++) fac[i] = (fac[i-1]*i)%md;
// ll C[N+1][M+1]; 
// void  ncr(){
//     ll n = N,k = M; 
//     for (ll i = 0; i <= n; i++) { 
//         for (ll j = 0; j <= min(i, k); j++) { 
//             if (j == 0 || j == i)  C[i][j] = 1; 
//             else C[i][j] = C[i - 1][j - 1] +  C[i - 1][j]; 
//         } 
//     } 
// } 


#define RBTTYPE int
#define ordered_set tree<RBTTYPE, null_type, less<RBTTYPE>, rb_tree_tag,tree_order_statistics_node_update> 
// Ordered set docs:
// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}
ll modInv(ll a)
{
    return pow(a,md-2);
}
 
// ll nCr(ll n,ll r)
// {
//     return (fac[n]*modInv((fac[r]*fac[n-r])%md))%md;
// }

 
ll po(ll x,ll n){
    if(n==0) return 1;
    if(n%2==1) return (x*po(x,n-1));
    else {
        ll k=po(x,n/2);
        return (k*k);
    }
}
 
ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
}
 
int32_t main(){
    IOS;
    ll a,b,n,i,j,x;
    cin >> a >> b >> n;
    if(n==1 || b==1){
        cout << (a*n)/b - a*(n/b) <<"\n";
    }
    else {
        if(n<b || n%b==b-1) x = n;
        // if(n%b==0) x = n-1;
        else x = n - n%b - 1;
        cout << (x*a)/b - a*(x/b) <<"\n";
    }


} 

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c; cin >> a >> b >> c;
  cout << (a+b>=c ? "Yes" : "No") << endk;
  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000

ll gcm(ll a,ll b);

int main(){
  int n;
  cin >> n;
  vint A(n);
  rep(i,n) cin >> A[i];
  vint dist(n);
  rep(i,n) dist[i] = A[i]-(i+1);
  sort(dist.begin(),dist.end());
  ll judge = dist[n/2];
  ll ans = 0;
  rep(i,n) ans += (ll)abs((dist[i] - judge));
  cout << ans << endl;
}






Measured memory_bytes: 1792
#include <stdio.h>

int main(void) {
	int a, b, s, r, n;
	char c;
	s = r = n = 0;
	while(scanf("%d%c%d\n", &a, &c, &b) == 3) {
		s = s + a * b;
		r = r + b;
		n++;
	}
	
	printf("%d\n%d\n", s, (int)((0.0+r)/n + 0.5));
	
	return 0;
}

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

using namespace std;

# define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pll;

# define S second
# define F first
# define kill(x) return(cout << x << endl, 0)
# define debug(x) cerr<< #x << " : " << x << endl
# define ddebug(x, y) cerr<< #x << " : " << x  << ", " << #y << " : " << y << endl
# define sz(s) (int)s.size()
# define sq(x) (x) * (x)
# define PB(x) push_back(x)
# define smax(x, y) (x) = max((x), (y))
# define smin(x, y) (x) = min((x), (y))
# define all(x) x.begin(), x.end()
# define SP fixed << setprecision(10)

const int MAXN = 100 * 1000 + 10;
int n, a[2 * MAXN],
    mini;

bool b(int y)
{
	return (a[y] >= mini);
}

bool good()
{
	for (int i = 0; i < n; i ++)
	{
		if (b(n - 1 - i) == b(n - 1 - i - 1))
			return b(n - 1 - i);
		if (b(n - 1 + i) == b(n - 1 + i + 1))
			return b(n - 1 + i);
	}
	return b(n - 1) ^ (n & 1 ^ 1);
}

int bs()
{
	int l = 0, r = 2 * n + 1;
	while (r - l > 1)
	{
		int mid = (r + l) / 2;
		mini = mid;
		if (good())
			l = mid;
		else
			r = mid;
	}
	return l;
}

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

	cin >> n;
	for (int i = 0; i < 2 * n - 1; i ++)
		cin >> a[i];

	cout << bs() << endl;

	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	string s; cin>>s;
	vector<string> W{"SUN","MON","TUE","WED","THU","FRI","SAT"};
	rp(i,0,W.size()){
		if(s==W[i]){
			ote(7-i);
			return 0;
		}
	}
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll ,ll );
ll mod_add(ll ,ll );
ll mod_mul(ll ,ll );
ll mod_div(ll ,ll );
void make_fact(ll );
void make_invfact(ll );

ll node[100001];

void init(){
  rep(i,100001) node[i]=i;
}

ll root(ll idx){
  if( node[idx]==idx ) return idx;
  else return node[idx]=root( node[idx] );
}

void unite(ll x,ll y){
  auto rx=root(x);
  auto ry=root(y);
  node[ry] = rx;
}

bool same(ll x,ll y){
  return root(x)==root(y);
}

int main(void){

  ll n,m;
  cin>>n>>m;

  vector<ll> x(m);
  vector<ll> y(m);
  vector<ll> z(m);

  init();

  rep(i,m) cin>>x[i]>>y[i]>>z[i];

  rep(i,m) unite( x[i],y[i] );

  set<ll> se;

  rep1(i,n){
    auto r=root(node[i]);
    //cout << r << endl;
    se.insert( r );
  }

  cout << se.size() << endl;

  return 0;

}

ll mod_pow(ll x,ll r){
  if(r==0) return 1;
  else if(r==1) return x%mod;
  else if(r%2==0){
    ll t=mod_pow(x,r/2)%mod;
    return t*t %mod;
  } 
  else{
    ll t=mod_pow(x,r/2)%mod;
    ll k= t*t %mod;
    return k*x%mod;
  } 
}
ll mod_add(ll a,ll b){
  return (a+b)%mod;
}

ll mod_mul(ll a,ll b){
  return (a*b)%mod;
}

ll mod_div(ll a,ll b){
  return mod_mul(a,mod_pow(b,mod-2));
}

void make_fact(ll n){
  fac[0]=1;
  rep(i,n){
    fac[i+1]=mod_mul(fac[i],i+1);
  }  
}

void make_invfact(ll n){
  invfac[n]= mod_pow( fac[n] ,mod-2);
  for(int i=n-1;i>=0;i--){
    invfac[i]=mod_mul(invfac[i+1],i+1);
  }

}

Measured memory_bytes: 8064
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	var res = make([]int, n, n)

	// for i := 0; i < n; i++ {
	// 	fmt.Println(res[i])
	// }
	for i := 0; i < m; i++ {
		var a, b int
		fmt.Scan(&a, &b)
		a--
		b--
		res[a]++
		res[b]++
	}
	for i := 0; i < n; i++ {
		fmt.Println(res[i])
	}
}


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

struct UnionFind {
    std::vector<int> par;
    std::vector<int> sizes;

    UnionFind(int n) : par(n), sizes(n, 1) {
        for (int i = 0; i < n; i++)
            par[i] = i;
    }

    int find(int x) {
        return x == par[x] ? x : par[x] = find(par[x]);
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);

        if (x == y)
            return;

        if (sizes[x] > sizes[y])
            std::swap(x, y);

        par[x] = y;
        sizes[y] += sizes[x];
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }

    int size(int x) {
        return sizes[find(x)];
    }
};

int main() {
    std::string s, t;
    std::cin >> s >> t;

    int m = s.size(), n = t.size();

    while (s.size() < m + n) s += s;

    std::vector<int> table(n + 1);

    {
        table[0] = -1;
        table[1] = 0;

        int i = 2, j = 0;
        while (i <= n) {
            if (t[i - 1] == t[j])
                table[i++] = ++j;
            else if (j > 0)
                j = table[j];
            else
                table[i++] = 0;
        }
    }

    UnionFind uf(m);

    {
        int i = 0, j = 0;
        while (i < m) {
            if (s[i + j] == t[j]) {
                if (++j < n) continue;

                if (uf.same(i, (i + n) % m)) {
                    std::cout << "-1\n";
                    return 0;
                }

                uf.unite(i, (i + n) % m);
            }
            
            i = i + j - table[j];
            if (j > 0) j = table[j];
        }
    }

    int ans = 0;
    for (int i = 0; i < m; i++)
        ans = std::max(ans, uf.size(i) - 1);
    std::cout << ans << "\n";
}

Measured memory_bytes: 8648
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  char A,B; cin>>A>>B;
  char ans='H';
  if(A=='H'){
    if(B=='D')
      ans='D';
  }
  else{
    if(B=='H')
      ans='D';
  }
  cout<<ans<<endl;
  }


Measured memory_bytes: 256
#include<stdio.h>
#define M 100005
#define N -1

struct Node{ int p, l, r;};
struct Node t[M];
int n, H, d[M];

int Depth(int u){
  int x = 0;
  for(; t[u].p != N ;x++) u = t[u].p;
  return x;
}

void print(int u){
  int i, c;
  printf("node %d: ", u);
  printf("parent = %d, ", t[u].p);
  printf("depth = %d, ", d[u]);

  if ( t[u].p == N ) printf("root, ");
  else if ( t[u].l == N ) printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  for(i = 0, c = t[u].l; c != N; i++, c = t[c].r){
    if (i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
}

main(){
  int i, j, s, v, c, l;
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) t[i].p = t[i].l = t[i].r = N;

  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &v, &s);
    for ( j = 0; j < s; j++ ){
      scanf("%d", &c);
      if ( j == 0 ) t[v].l = c;
      else t[l].r = c;
      l = c;
      t[c].p = v;
    }
  }

  H = 0;
  for ( i = 0; i < n; i++ ){
    d[i] = Depth(i);
    if ( d[i] > H ) H = d[i];
  }

  for ( i = 0; i < n; i++ ) print(i);
  return 0;
}


Measured memory_bytes: 4164
#include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <tuple>
#include <queue>
#include <vector>
#include <cmath>
#include <random>
#include <math.h>
#include <random>



#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define rREP(i, n) for(int (i) = (n) - 1; (i) >= 0; --(i))
#define ALL(TheArray) TheArray.begin(), TheArray.end()

using lli = long long int;
using pii = std::pair<int, int>;

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

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



constexpr int MAX_BIT = 5001;
std::vector<int> A;
std::vector<std::bitset<MAX_BIT>> S, T;


int main(void){
    // 入力部
    int n, k; scanf("%d%d", &n, &k);
    A.resize(n); REP(i, n) scanf("%d", &A[i]);

    // 実行部
    S.resize(n+1), T.resize(n+1);
    REP(i, n){S[i].reset(); T[i].reset();}

    S[0][0] = true; T[0][0] = true;
    REP(i, n){
        for(int x = 0; x < k; ++x){
            if(S[i][x]){
                S[i+1][x] = true;
                if(x + A[i] < k) S[i+1][x+A[i]] = true;
            }
            if(T[i][x]){
                T[i+1][x] = true;
                if(x + A[n-i-1] < k) T[i+1][x+A[n-i-1]] = true;
            }
        }
    }

    // 確認 + 出力
    int noNeed = 0;

    // X[i] := i 未満の数
    std::vector<int> X(k+1);
    REP(i, n){
        // k - ai ≤ m + X < k <==> k - ai - m < X < k - m
        X[0] = 0;
        // 考えるべきは a + b = n - 1
        for(int x = 1; x <= k; ++x){
            X[x] = X[x-1] + (T[n-i-1][x-1] ? 1 : 0);
        }
        bool flag = false;
        for(int x = 0; x < k; ++x) if(S[i][x]){
            int cnt = X[k-x] - X[std::max(k-x-A[i], 0)];
            if(cnt > 0){
                flag = true;
                break;
            }
        }
        if(not flag) noNeed++;
    }

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



    return 0;
}

/* (考察パート)
    1, aiが不要でない <=> ∃ S ⊂ [n] and i ∈ S  s.t. k - ai ≤ ∑_{S\{i}} aj < k
    2, 左で作れる数字 : 右で作れる数字を持っていればとける
    DP[x][y] := 先頭x枚を用いて得られる値の集合
    DQ[x][y] := 後半x枚を用いて得られる値の集合
    ===> boolで管理できる


*/

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

int A[100]; 
int n;

void ShowArray() 
{
    for (int i = 0; i < n; i++) 
    {
        if (i) cout << " ";
        cout << A[i];
    }
    cout << endl;
}

void SWAP(int i, int j) 
{
    int t = A[i];
    A[i] = A[j];
    A[j] = t;
}

void BubbleSort() 
{
    int cnt = 0;
    for (int i = 0; i < n-1; i++) 
    {
        for (int j = n-1; j > i; --j)
        {
            if (A[j] < A[j-1])
            {
                SWAP(j, j-1);
                cnt ++;
            }
        }
    }

    ShowArray();
    cout << cnt << endl;
}

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

    BubbleSort();

    // ShowArray();
}


Measured memory_bytes: 3088
// problem: "https://atcoder.jp/contests/abc154/tasks/abc154_b"

#include<bits/stdc++.h>

using namespace std;

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

    int i;
    for(i=0;i!=s.size();i++)
        s[i] = 'x';

    cout<<s;

    return 0;
}


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

int main() {
  
  int num1=0, num2=0, num3=0;
  
  cin >> num1 >> num2 >> num3;
  
  int sum=0;
  
  sum = num1 + num2 + num3;
  
  if(sum<=21) {
    
    cout << "win" << endl;
    
  } else if(22<=sum) {
    
    cout << "bust" << endl;
    
  }
  
  return 0;
  
}

Measured memory_bytes: 256
#include <math.h>
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX / 2)
const int MGN = 10;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using psi = pair<string, int>;


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

  int N; cin >> N;
  vi L(N); REP(i,N) cin >> L[i];

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

  int cnt = 0;
  REP(i,N-2) {
    FOR(j,i+1,N-1) {
      FOR(k,j+1,N) {
        if (L[i] + L[j] > L[k]) cnt++;
        else break;
      }
    }
  }

  int ans = cnt;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <algorithm>
#define llint long long

using namespace std;

int N, S, W, Q;
llint a[100005];
llint sum[100005];
pair<llint, int> p[100005];

int main(void)
{
	while(1){
		cin >> N >> S >> W >> Q;
		if(N == 0 && S == 0 && W == 0 && Q == 0) break;
		
		int g = S;
		for(int i = 0; i < N; i++){
			a[i] = (g/7) % 10;
			if(g%2 == 0) g = (g/2);
			else g = (g/2) ^ W;
		}
		reverse(a, a+N+1);
		
		if(Q == 2 || Q == 5){
			llint ans = 0, cnt = 0;
			for(int i = 1; i <= N; i++){
				if(a[i] % Q == 0) cnt++;
				if(a[i] != 0) ans += cnt;
			}
			cout << ans << endl;
			continue;
		}
			
		llint s = 0, mul = 1;
		for(int i = 1; i <= N; i++){
			s += (a[i] * mul) % Q;
			s %= Q;
			sum[i] = s;
			mul *= 10;
			mul %= Q;
		}
		
		for(int i = 0; i <= N; i++){
			p[i] = make_pair(sum[i], i);
		}
		sort(p, p+N+1);
		
		llint ans = 0, prev = -1, cnt;
		for(int i = 0; i <= N; i++){
			if(prev == p[i].first){
				if(a[p[i].second] != 0) ans += cnt;
				cnt++;
			}
			else{
				prev = p[i].first;
				cnt = 1;
			}
		}
		
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 6176
n = int(input())
gap = []
for i in range(n):
    ai, bi = [int(_) for _ in input().split()]
    gap.append([ai+bi, ai, bi])

gap_sorted = sorted(gap, reverse=True)

res = 0
for j in range(n):
    if j % 2 == 0:
        res += gap_sorted[j][1]
    else:
        res -= gap_sorted[j][2]

print(int(res))

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

int main(){
    int n,sum,med;
    cin>>n;
    int t[n];
    sum = 0;
    for(int i = 0;i<n;++i){
        cin>>t[i];
        sum += t[i];
    }
    med = round((double)sum/n);
    sum = 0;
    for(int i = 0;i<n;++i){
        sum += (t[i]-med)*(t[i]-med);
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<vector>
#include<queue>
#include<tuple>
#include<functional>
using namespace std;

const int INF = 100000000 + 1;

struct Data {
    int level, numbers;
    Data(const int l, const int n) :level(l), numbers(n) {}
};

vector<Data> bfs(const vector<vector<int>>& office, const int Y, const int X) {
    typedef tuple<int, int, int> Node;

    const int H = office.size();
    const int W = office.front().size();
    const int NEXT[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};

    vector<Data> result;
    vector<vector<bool>> visited(H, vector<bool>(W, false));
    priority_queue<Node, vector<Node>, greater<Node>> q;
    int level = 1;
    int count = 0;

    result.push_back(Data(0, 0));
    q.push(Node(1, Y, X));
    q.push(Node(INF, H, W));
    visited[Y][X] = true;

    while(!q.empty()) {
        int l, y, x;
        tie(l, y, x) = q.top();
        q.pop();

        if(l > level) {
            result.push_back(Data(level, count));
            level = l;
        }

        ++count;

        for(const auto d: NEXT) {
            int ny = y + d[0];
            int nx = x + d[1];
            if(ny < 0 || H <= ny || nx < 0 || W <= nx) continue;
            if(visited[ny][nx]) continue;
            visited[ny][nx] = true;
            q.push(Node(office[ny][nx], ny, nx));
        }
    }

    return result;
}

int main() {
    int R;
    while(cin >> R, R) {
        int W[2], H[2], X[2], Y[2];
        vector<vector<int>> office[2];
        for(int k = 0; k < 2; ++k) {
            cin >> W[k] >> H[k] >> X[k] >> Y[k];
            office[k].resize(H[k], vector<int>(W[k]));
            for(int i = 0; i < H[k]; ++i) for(int j = 0; j < W[k]; ++j) cin >> office[k][i][j];
        }

        vector<Data> data[2];
        for(int k = 0; k < 2; ++k) data[k] = bfs(office[k], --Y[k], --X[k]);

        int answer = INF;
        int b = data[1].size() - 1;
        for(int a = 0; a < data[0].size(); ++a) {
            if(data[0][a].numbers + data[1][b].numbers < R) continue; 
            while(0 < b && data[0][a].numbers + data[1][b].numbers >= R) --b;
            if(data[0][a].numbers + data[1][b].numbers >= R) answer = min(answer, data[0][a].level + data[1][b].level);
            if(b < data[1].size() - 1)                       answer = min(answer, data[0][a].level + data[1][b + 1].level);
        }

        cout << answer << endl;
    }
}

Measured memory_bytes: 5952
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N, M;
    cin >> N >> M;
    VEC(VEC(int)) Out(N);

    FOR(i, 0, M) {
        int s, t;
        cin >> s >> t;
        s--; t--;
        Out[s].push_back(t);
    }

    VEC(double) E(N);
    E[N - 1] = 0.0;

    for (int i = N - 2;i >= 0; i--) {
        int n = Out[i].size();
        double ret = 1.0;
        for (int v : Out[i])
            ret += 1.0 / n * E[v];
        E[i] = ret;
    }

    double ret = E[0];

    for (int i = N - 2;i >= 0; i--) {
        VEC(double) E2(ALL(E));
        double esum = 0, eout = 0;
        for (int v : Out[i]) {
            eout = max(eout, E2[v]);
            esum += E2[v];
        }

        if (Out[i].size() == 1)
            E2[i] = 1e80;
        else
            E2[i] = 1 + 1.0 / (Out[i].size() - 1) * (esum - eout);

        for (int j = i - 1;j >= 0; j--) {
            double ret = 1.0;
            for (int v : Out[j])
                ret += 1.0 / (Out[j].size()) * E2[v]; 
            E2[j] = ret;
        }

        ret = min(ret, E2[0]);
    }

    cout << fixed << setprecision(7) << ret << endl;
    return 0;
};


Measured memory_bytes: 1408
// Shinchan Loves Coding :)))
#include<bits/stdc++.h>
#include<map>
#include<set>
#include<stack>
using namespace std;

#define night_rider ios::sync_with_stdio(false);cin.tie(NULL);
#define int long long int
#define double long double
#define en "\n"
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> pii;
bool secdes(const pair<int,int>&a , const pair<int,int>&b){if(a.se==b.se){return a.fi>b.fi;}else{return a.se>b.se;}}//second descending !
bool sir(const pair<int,int>&a , const pair<int,int>&b){if(a.fi==b.fi){return a.se>b.se;}else{return a.first>b.first;}}//first descending !
bool bysec(const pair<int,int>&a , const pair<int,int>&b){if(a.se==b.se){return a.fi<b.fi;} else{return a.se<b.se;}}//second ascending !

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/

const int no=3e6+5;
const int modulo=1e9+7;
const int inf=1e18+9;
const int N=1001;
int a[no]={},H[no]={},c[no]={},d[no]={},mat[N][N]={{0}};
stack<int> S;
stack<int> ma;

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/

int poww(int x, int y, int modulo) {x %= modulo;int res=1;while (y > 0) {if (y & 1){res = res * x % modulo;}x = x * x % modulo;y >>= 1;}return res;}

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/
vector<int> adj[no];
int used[no],ans;

void solve(){
    int n,p,q,m;
    cin>>n;
    int g=0;
    for(int i=0 ; i<n; i++) {
        cin>>a[i];
        g=__gcd(g,a[i]);
    }
    if(g>1) {
        cout<<"not coprime";
    }
    else {
        map<int,int> mapp;
        for(int i=0 ; i<n ; i++) {
            int k=a[i];
            for(int j=2 ; j*j<=k ; j++) {
                if(k%j==0) {
                    while(k%j==0) {
                        k/=j;
                    }
                    if(mapp[j]==0) mapp[j]=1;
                    else {
                        cout<<"setwise coprime";
                        return ;
                    }
                }
            }
            if(k>1) {
                if(mapp[k]==0) mapp[k]=1;
                else {
                    cout<<"setwise coprime";
                    return ;
                }
            }
        }
        cout<<"pairwise coprime";
    }
}

void runn(){
        #ifndef ONLINE JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif
    }

signed main()
{
    night_rider
    //runn();
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 81736
from math import gcd
def readinput():
    n=int(input())
    a=list(map(int,input().split()))
    return n,a

def main(n,a):
    ans=gcd(a[0],a[1])
    for i in range(2,n):
        ans=gcd(ans,a[i])
    return ans

if __name__=='__main__':
    n,a=readinput()
    ans=main(n,a)
    print(ans)


Measured memory_bytes: 20384
n,k = gets.split(" ").map(&:to_i)
s = gets.chomp

a = s.split('0').map(&:length)
b = s.split('1').map(&:length)
a.delete(0)
b.delete(0)

c = []
c << 0 if s[0] == '0'
while !a.empty? || !b.empty? do
  if s[0] == '1'
    c << a.shift
    c << b.shift unless b.empty?
  else
    c << b.shift
    c << a.shift unless a.empty?
  end
end
c << 0 if c.size % 2 == 0

r = [0]
c.size.times do |i|
  r[i + 1] = r[i] + c[i]
end

ans = 0
add = 2 * k + 1
0.step(by: 2, to: c.size - 1) do |i|
  left = i
  right = [(i + add), c.size].min
  tmp = r[right] - r[left]

  ans = [tmp, ans].max
end

puts ans


Measured memory_bytes: 12104
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
   
	if(N%2!=0){
      System.out.println(N/2+1);
    }else{
		System.out.println(N/2);
    }
}
}

Measured memory_bytes: 21332
n = int(input())
floar = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]
for i in range(n):
    b,f,r,v = map(int,input().split())
    floar[b-1][f-1][r-1] += v
for i in range(4):
    if(i != 0):
        print('#'*20)
    for j in range(3):
        print(' ',end="")
        print(*floar[i][j])



Measured memory_bytes: 5624
#include <stdio.h>

int main(){
  int H,W,h,w;
  scanf("%d %d\n%d %d",&H,&W,&h,&w);
  int all,paint;
  all = H * W;
  paint = h * W + H * w - h * w;
  printf("%d\n",all-paint);
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main(){
  int m = 0;
  int n = 0;
  char a[100][100] = {};
  char b[100][100] = {};
  int i = 0;
  int j = 0;
  int k = 0;
  int l = 0;
  int flag = 0;
  int success = 0;
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++){
    scanf(" %s",a[i]);
  }
  //
  for(i=0;i<m;i++){
    scanf(" %s",b[i]);
  }
  //
  for(i=0;i+m<=n;i++){
    for(j=0;j+m<=n;j++){
      flag = 1;
      for(k=0;k<m;k++){
        for(l=0;l<m;l++){
          if(b[k][l] != a[i+k][j+l]){
            flag = 0;
          }
        }
      }
      if(flag){
        success = 1;
      }
    }
  }
  if(success){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}
    
      
  
  

Measured memory_bytes: 128
import math
A,B,H,M = map(int,input().split())

def hourToMin(hour,minu):
  out = hour + (minu/60)
  return out*5
 
H = hourToMin(H,M)  
dif =  H-M
cos = math.cos(math.radians(dif*6))
ans = (A**2+B**2-2*A*B*cos)**0.5

print(ans)



Measured memory_bytes: 9500
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a,b;cin>>a>>b;
  int cnt = 1;
  while(true){
  	a *= 2;
    if(a > b)break;
    else cnt++;
  }
  cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
n,m = map(int,input().strip().split())
ls = list(map(int,input().strip().split()))
dic = defaultdict(list)
for _ in range(m):
    a,b = map(int,input().strip().split())
    dic[a].append(b)
    dic[b].append(a)

ans = 0
for i in range(1,n+1):
    f = 0
    obse_node = ls[i-1]
    for values in dic[i]:
        if ls[values-1]>=obse_node:
            f = 1
            break
    if f==0 or len(dic[i])==0:
        ans += 1
print(ans)


Measured memory_bytes: 36784
use std::collections::HashSet;
use std::io::*;
use std::str::FromStr;

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

fn main() {
    let n: usize = read();
    let mut dict = HashSet::new();
    for _ in 0..n {
        let action: String = read();
        let word: String = read();
        if action == "insert" {
            dict.insert(word);
        } else {
            if dict.contains(&word) {
                println!("yes");
            } else {
                println!("no");
            }
        }
    }
}



Measured memory_bytes: 31488
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
inline int read()
{
	int x = 0 , f = 1; char ch = getchar();
	while(ch < '0' || ch > '9')	{if(ch == '-')	f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
const int N = 3e3 + 5;
const double pi = 3.14159265358979323846;
int n , L;
double t[N];
int main()
{
	n = read(); L = read();
	for(int i = 1;i <= n;i ++) t[i] = read();
	double ansx = 0 , ansy = 0;
	for(int i = 1;i <= n;i ++) for(int j = i + 1;j <= n;j ++)
	{
		int cnt = j - i - 1;
		double tmp = pi * (t[i] + t[j]) / L;
		ansx += cos(tmp) * (n - 2 * cnt - 2) , ansy += sin(tmp) * (n - 2 * cnt - 2);
	}
	ansx /= 1ll * n * (n - 1) * (n - 2) / 6;
	ansy /= 1ll * n * (n - 1) * (n - 2) / 6;
	printf("%.12f %.12f\n",ansx,ansy);
	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++)

int main(){
  
  int N; cin >> N;
  vector<int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  vector<int> index(N);
  iota(index.begin(), index.end(), 0);
  
  sort(index.begin(), index.end(), [&](int x, int y){return A[x] < A[y];});
  
  for(auto i:index){
    cout << i+1 << " ";
  }
  cout << endl;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
map<ll,list<ll>> mp;
void addEdge(ll u,ll v){
    mp[u].push_back(v);
}
ll dp[100001];
ll findTheDistance(ll s){
    if(mp[s].size()==0)
        return dp[s]=0;
    if(dp[s]!=-1)
        return dp[s];
    dp[s]=0;
    for(auto i:mp[s])
        dp[s]=max(dp[s],1+findTheDistance(i));
    return dp[s];
}
int main(){
    ll n,m;
    cin>>n>>m;
    memset(dp,-1,sizeof(dp));
    for(ll i=0;i<m;i++){
        ll u,v;
        cin>>u>>v;
        addEdge(u,v);
    }
    ll maximum=INT_MIN;
    for(ll i=1;i<=n;i++){
        maximum=max(maximum,findTheDistance(i));
    }
    cout<<maximum;
}

Measured memory_bytes: 13824
#include <stdio.h>
int main(void){
    // Your code here!
    char S[10];
    int i;
    for(i=0;i<10;i++){
        scanf("%s",&S[i]);
        if(i==0){
        if(S[0]=='S'){
            printf("Cloudy");
        }else if(S[0]=='C'){
            printf("Rainy");
        }else if(S[0]=='R'){
            printf("Sunny");
        }
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    int h = 0, w = 0;
    cin >> h >> w;
    vector<string> in(h+1);
    for (int i=1; i<h+1; i++) {
        cin >> in.at(i);
    }
    for (int i=1; i<=2*h; i++) {
        cout << in.at((i+1)/2) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>
#include <bitset>

using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()

int main()
{
	int X;
	cin >> X;
	cout << (X >= 30 ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 3632
package main

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

func main() {

	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	in := sc.Text()
	val := strings.Split(in, " ")

	a, _ := strconv.Atoi(val[0])
	b, _ := strconv.Atoi(val[1])

	d := (int)(a / b)
	r := a % b
	f := float64(a) / float64(b)

	fmt.Printf("%v %v %.5f", d, r, f)

}



Measured memory_bytes: 1112