akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define ins insert

#define debug(a) cerr<<(a)<<endl
#define dbrep(a,n) rep(_i,n) cerr<<(a[_i])<<" "; cerr<<endl
#define dbrep2(a,n,m) rep(_i,n){rep(_j,m) cerr<<(a[_i][_j])<<" "; cerr<<endl;}

using namespace std;

template<class A, class B>
ostream &operator<<(ostream &os, const pair<A,B> &p){return os<<"("<<p.fi<<","<<p.se<<")";}
template<class A, class B>
istream &operator>>(istream &is, pair<A,B> &p){return is>>p.fi>>p.se;}

//-------------------------------------------------
//--Sieve of Eratosthenes
//-------------------------------------------------
class Sieve
{
private:
    ::std::vector<bool> prime;
public:
    Sieve(int n):prime(n+1, true){
        prime[0] = prime[1] = false;
        for(int i=2; i*i<=n; i++){
            if (!prime[i]) continue;
            for(int j=i*2; j<=n; j+=i){
                prime[j] = false;
            }
        }
    }
    bool isprime(int x){return prime[x];}
};

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    Sieve sieve((int)1e6);
    int X; cin>>X;
    while(true){
        if (sieve.isprime(X)) break;
        X++;
    }
    cout<<X<<endl;
    return 0;
}


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

int main() {
  int x;
  cin >> x;
  vector<int> divisor;
  for (int i=1; i*i<=x; i++) {
    if (x%i == 0) {divisor.push_back(i); divisor.push_back(x/i);}
  }
  rep(i, 30000) rep(j, divisor.size()) {
    int d = divisor[j];
    int e = x / d;
    ll exp = 5*i*i*i*i - 10*i*i*i*d + 10*i*i*d*d - 5*i*d*d*d + d*d*d*d;
    if (exp == e) {cout << i << " " << i-d << endl; return 0;}
    exp = 5*i*i*i*i + 10*i*i*i*d + 10*i*i*d*d + 5*i*d*d*d + d*d*d*d;
    if (exp == e) {cout << -i << " " << -i-d << endl; return 0;}
    d = -d;
    e = -e;
    if (exp == e) {cout << i << " " << i-d << endl; return 0;}
    exp = 5*i*i*i*i + 10*i*i*i*d + 10*i*i*d*d + 5*i*d*d*d + d*d*d*d;
    if (exp == e) {cout << -i << " " << -i-d << endl; return 0;}
  }
  return 0;
}

Measured memory_bytes: 3548
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<map>
#define sqr(x)(x)*(x)
#define fz1(i,n) for (i=1;i<=n;i++)
#define fd1(i,n) for (i=n;i>=1;i--)
#define fz0g(i,n) for (i=0;i<=n;i++)
#define fd0g(i,n) for (i=n;i>=0;i--)
#define fz0k(i,n) for (i=0;i<n;i++)
#define fd0k(i,n) for (i=(long long)(n-1);i>=0;i--)
#define fz(i,x,y) for (i=x;i<=y;i++)
#define fd(i,y,x) for (i=y;i>=x;i--)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){char ss[len];scanf("%s",ss);(st)=ss;}
using namespace std;
//struct bit{T_ arr[1000005];int lowbit(int x){return x&(-x);}void add(int x,T_ y){for (int i=x;i<=n;i+=lowbit(i)) arr[i]+=y;}T_ query(int x){T_ s=0;for (int i=x;i>0;i-=lowbit(i)) s+=arr[i];return s;}};
//struct seg{struct treedot{int l,r;T_ sum,add;void update(T_ x){sum+=(r-l+1)*x; add+=x;}}c[800005];void pushdown(int id){if (c[id].add){c[id*2].update(c[id].add);c[id*2+1].update(c[id].add);c[id].add=0;}}void pushup(int id){c[id].sum=c[id*2].sum+c[id*2+1].sum;}void build(int id,int l,int r){if (l>r) return;c[id].l=l;c[id].r=r;c[id].sum=0;c[id].add=0;if (l==r) c[id].sum=0;else{int mid=l+(r-l)/2;build(id*2,l,mid);build(id*2+1,mid+1,r);pushup(id);}}void update(int id,int le,int ri,T_ x){if (le>c[id].r||ri<c[id].l) return;if (le<=c[id].l&&c[id].r<=ri) c[id].update(x);else{pushdown(id);update(id*2,le,ri,x);update(id*2+1,le,ri,x);pushup(id);}}T_ query(int id,int le,int ri){if (ri<c[id].l||c[id].r<le) return 0;if (le<=c[id].l&&c[id].r<=ri) return c[id].sum;T_ ans=0;pushdown(id);ans+=query(id*2,le,ri);ans+=query(id*2+1,le,ri);pushup(id);return ans;}};
long long n,m,i,j;
map<long long,char> mp;
string s,t;
void chg(long long x,char y)
{
	if (mp.count(x)&&mp[x]!=y)
	{
		cout<<"-1\n";
		exit(0);
	}mp[x]=y;
}
int main()
{
	cin>>n>>m>>s>>t;
	long long lcm=n/__gcd(n,m)*m;
	fz0k(i,n) chg(i*(lcm/n),s[i]);
	fz0k(i,m) chg(i*(lcm/m),t[i]);
	cout<<lcm<<endl;
	return 0;
}


Measured memory_bytes: 10880
//AtCoder B - OddString
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
    string s;
    string ans;
    cin>>s;
    for(ll i=0;i<s.size();++i){
        if (i%2==0) ans.push_back(s[i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
//https://atcoder.jp/contests/abc141/tasks/abc141_b
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-5.in"); //input.txt
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    string s; cin>>s;    
    bool ans=true;
    REP(i,s.size()){
        ll p=i+1;
        if(p%2==0){
            if (s[i]=='R'){ ans=false; break;}
        }else{
            if (s[i]=='L'){ans=false;break;}
        }
    }
    cout<<(ans?"Yes":"No")<<endl;
    return 0;
}

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

int main () {
  int H, N;
  cin >> H >> N;
  vector<int> A(N);
  int attack = 0;
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
    attack += A.at(i);
  }
  
  if(H > attack){
    cout << "No" << endl;
  }
  
  else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 640
L,R = map(int,input().split())
l = L
m = (L *(L + 1)) % 2019
while l < min (R, L + 2019):
  r = l + 1
  while r <= min (R, L + 2019):
  	n = (l * r) % 2019 
  	m = min(m,n)
  	r = r + 1
  l = l + 1
print(m)  


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

ll dp[1001][10001];
int main() {
  rep(i,1001)rep(j,10001)dp[i][j] = 100100100100;
  int h,n;
  cin>>h>>n;
  vl A(n),B(n);
  rep(i,n){
    cin >> A[i]  >> B[i];
  }
  dp[0][0] = 0;
  rep(i,n){
    rep(j,h+1){
       dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
       if(j-A[i] < 0) dp[i+1][j] = min(dp[i+1][j],B[i]);
      else{
        dp[i+1][j] = min(dp[i+1][j],dp[i][max(0LL,j-A[i])]+B[i]);
        dp[i+1][j] = min(dp[i+1][j],dp[i+1][max(0LL,j-A[i])]+B[i]);
      }
    }
  }
  cout<<dp[n][h]<<endl;
  return 0;
}

Measured memory_bytes: 78592
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <unordered_set>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <map>
#include <ctime>
#include <set>
#define endl '\n'
#define ll unsigned long long
#define mod 1000000007
#define NCONS 100001
#define MACRO(a) for(int a = 1; a < 1001; a++)

using namespace std;

int main(void)
{
	cin.tie(NULL); ios_base::sync_with_stdio(false);
	string S; ll K; cin >> S >> K;
	bool flag = true;
	for (int i = 0; i < S.length(); i++)
	{
		if (S[i] != '1')
		{
			flag = false;
			break;
		}
	}
	if (!flag)
	{
		for (int i = 0; i < S.length(); i++)
		{
			if (i + 1 == K)
			{
				cout << S[i];
				return 0;
			}
			if (S[i] != '1')
			{
				cout << S[i];
				return 0;
			}
		}
	}
	else
	{
		cout << "1";
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <tuple>

#define rep(i,n) for(ll i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;
// cout<<std::fixed<<std::setprecision(10);

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


	return 0;
}

Measured memory_bytes: 256
(x,y,a,b,c),p,q,r=[[*map(int,i.split())]for i in open(0)]
p=sorted(p)[-x:]
q=sorted(q)[-y:]
pq = sorted(p+q)
r.sort(reverse=True)
ans = sum(pq)
for i in range(min(c,x+y)):
    if r[i] > pq[i]:
        ans += r[i] - pq[i]
    else:
        break
print(ans)


Measured memory_bytes: 29984
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;

int main(){
    string a,b,c;
    cin>>a>>b>>c;
    if(a[a.size()-1]==b[0]&&b[b.size()-1]==c[0]){puts("YES");}
    else puts("NO");
    
    
    
    
    
 
return 0;
}


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

using namespace std;

const double TT = 3.141592653589793238462643383279;

int main(){
	double a , b , h , m;
	cin>>a>>b>>h>>m;
	h = (h + m/60) * 30;
	m = m * 6;
	double ang = abs(h - m);
	cout<<fixed << setprecision(13) << sqrt(a*a+b*b - 2*a*b * cos(ang * TT / 180))<<endl;
}

Measured memory_bytes: 4160
s = input()
t = input()
count = []
correct = 0
for i in range(len(s) - len(t) + 1):
  for j in range(len(t)):
    if s[i+j] == t[j]:
      correct += 1
  count.append(correct)
  correct = 0
print(len(t) - max(count))

Measured memory_bytes: 9048
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <tuple>
#include <bitset>
#include <random>
#define REP(i,n) for(int i=0;i<n;i++)
#define INF 100000000000007
using namespace std;
using pii=pair<int,int>;

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    vector<int> count(1000000+10,0);
    REP(i,n){
        cin>>a.at(i);
        count.at(a.at(i))++;
    }
    sort(a.begin(),a.end());
    vector<bool> sieve(1000000+10,true);
    REP(i,n){
        for(int j=2;a.at(i)*j<=a.at(n-1);j++){
            sieve.at(j*a.at(i))=false;
        }
        
    }

    int ans=0;
    REP(i,n){
        if(count.at(a.at(i))<2&&sieve.at(a.at(i))){
            ans++;
        }
    }

    

    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 7552
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <functional>
#include <sstream>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007
#define M 998244353

using namespace std;

int main(){
    lli h,w,a,n;
    vector<lli> data;
    vector<vector<lli>> vvec;
    lli i,j;
    cin>>h>>w>>n;
    rep(i,0,n){
        cin>>a;
        rep(j,0,a){
            data.push_back(i+1);
            if(data.size()==w){
                vvec.push_back(data);
                data.erase(data.begin(),data.end());
            }
        }
    }
    rep(i,0,h){
        if(i%2==1){
            rrep(j,w-1,-1){
                cout<<vvec[i][j];
                if(j==0){
                    cout<<endl;
                }
                else{
                    cout<<" ";
                }
            }
        }
        else{
            rep(j,0,w){
                cout<<vvec[i][j];
                if(j==w-1){
                    cout<<endl;
                }
                else{
                    cout<<" ";
                }
            }
        }
    }
}


Measured memory_bytes: 512
W, H, N = map(int, input().split())
min_x = 0
min_y = 0
w = W
h = H
for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1: min_x = max(min_x, x)
    elif a == 2: w = min(w, x)
    elif a == 3: min_y = max(min_y, y)
    elif a == 4: h = min(h, y)
print((w-min_x)*(h-min_y) if (w-min_x)>0 and (h-min_y)>0 else 0)

Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e15;
const int MOD = 1e9 + 7;
const double PI = 3.14159265358979323846;

signed main() {
	int N;
	cin >> N;
	int ans = 180 * (N - 2);
	cout << ans;
}

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

int main(){
  int n, m;
  cin >> n >> m;
  for(int i=m/n; i>=1; i--){
    if((m-i*n)%i==0){
      cout << i;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n;
	cin >> n;
	vi a(n);
	map<int, int> cnt;
	repn(i, 1, n) cin >> a[i], cnt[a[i]]++;
	repn(i, 1, n + 1) cout << cnt[i] << endl; 
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 13536
#include <bits/stdc++.h>
using namespace std;
int main(){
	int h, w;
	while(cin >> h >> w){
		if(h==0 && w==0)
			break;
		for(int j=1; j<=w; j++)
			cout << '#';
		cout << endl;
		for(int i=2; i<h; i++){
			cout << '#';
			for(int j=2; j<w; j++)
				cout << '.';
			cout << '#' << endl;
		}
		for(int j=1; j<=w; j++)
			cout << '#';
		cout << endl;
		cout << endl;
	}
	return 0;
} 


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll X,D;
ll M[1010];
int P[1010];
vector<int> E[51];

int Y[1010];
ll Z[1010];
int C[51];

ll cost[51][51*51*51+100];
int from[51][51*51*51+100];

bool cmp(int L,int R) {
	return Y[L]*M[R]>Y[R]*M[L];
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>X>>D;
	FOR(i,N) {
		cin>>M[i];
		if(i) {
			cin>>P[i];
			P[i]--;
			E[P[i]].push_back(i);
			Z[i]=D;
		}
		else {
			Z[i]=1<<30;
		}
		C[i]=i;
	}
	
	for(i=N-1;i>=0;i--) {
		Y[i]=1;
		FORR(e,E[i]) {
			Y[i]+=Y[e];
			M[i]+=M[e];
		}
	}
	
	sort(C,C+N,cmp);
	
	FOR(i,N+1) FOR(x,51*51*51+1) cost[i][x]=1LL<<60;
	cost[0][0]=0;
	FOR(i,N) {
		FOR(x,50*50*50+1) {
			for(y=0;y<=min(50,(int)Z[i])&&x+y*Y[i]<=50*50*50;y++) {
				if(cost[i+1][x+y*Y[i]] > cost[i][x]+y*M[i]) {
					cost[i+1][x+y*Y[i]]=cost[i][x]+y*M[i];
					from[i+1][x+y*Y[i]]=y;
				}
			}
		}
	}
	
	ll ma=0;
	FOR(x,50*50*50+1) if(cost[N][x]<1LL<<60) {
		int cnt[51];
		int cur=N;
		y=x;
		while(cur) {
			cnt[cur-1]=Z[cur-1]-from[cur][y];
			y-=from[cur][y]*Y[cur-1];
			cur--;
		}
		
		ll ret=x;
		ll left=X-cost[N][x];
		if(left<0) continue;
		FOR(i,N) {
			ll del=min((ll)(Z[C[i]]-min(50LL,Z[C[i]])),left/M[C[i]]);
			ret+=del*Y[C[i]];
			left-=del*M[C[i]];
		}
		ma=max(ma,ret);
	}
	
	cout<<ma<<endl;
	
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 77696
#include <algorithm>
#include <stdio.h>
using namespace std;
using ull = unsigned long long;
int main() {
	int k;
	ull A[100000];
	scanf("%d", &k);
	for (int i = 0; i < k; i++)
		scanf("%llu", A + i);

	if (A[k - 1] != 2) {
		printf("-1\n");
		return 0;
	}
	ull low = 2, high = 3;
	for (int i = k - 2; 0 <= i; i--) {
		ull low_g = (low + A[i] - 1) / A[i], high_g = high / A[i];
		if (high < low_g * A[i]) {
			printf("-1\n");
			return 0;
		}
		low = low_g * A[i];
		high = (high_g + 1) * A[i] - 1;
	}
	printf("%llu %llu\n", low, high);
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
const double pi=acos(-1.0);
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    int n;
    cin>>n;
    n%=10;
    if(n==2|| n==4 || n==5 || n==7 || n==9) cout<<"hon\n";
    else if(n==0 || n==1 || n==6 || n==8) cout<<"pon\n";
    else cout<<"bon\n";
    return 0;
}

Measured memory_bytes: 3652
import sys
A,B = [int(n) for n in input().split()]
# N = int(input())
S = str(input())
if(S[A] != "-"):
    print("No")
    sys.exit()
S = S[:A] + S[A+1:]
table = [str(n) for n in range(10)]
for s in S:
    if not( s in table):
        print("No")
        sys.exit()
print("Yes")


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

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

  vector<int> a(N);
  int ans = 0;
  rep(i, N) {
    int a;
    cin >> a;
    ans += a;
  }
  ans -= N;

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N = in_n()
    A = list(in_nn())
    Q = in_n()
    t = in_na()
    BC = list(zip(t, t))

    d = defaultdict(int)
    for i in range(N):
        d[A[i]] += 1

    s = 0
    for k, v in d.items():
        s += k * v

    for i in range(Q):
        b, c = BC[i]
        s += d[b] * (c - b)
        d[c] += d[b]
        d.pop(b)

        print(s)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39840
(a,b,c) = input().rstrip().split()
a = int(a)
b = int(b)
c = int(c)

if a <= b <= c:
 print(a,b,c)
elif a <= c <= b:
 print(a,c,b)
elif b <= a <= c:
 print(b,a,c)
elif b <= c <= a:
 print(b,c,a)
elif c<= a <= b:
 print(c,a,b)
else:
 print(c,b,a)

Measured memory_bytes: 6724
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;
 
class Program
 {
        static void Main(string[] args)
        {
          //N,Qの入力を受け取る
          var NQ = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
          var N = NQ[0];
          var Q = NQ[1];
          var adjlist = new List<int>[N+1];
          for(int i = 1;i < adjlist.Length ; ++i){
            adjlist[i] = new List<int>();
          }
          
          //節同士の繋がりを表現
          for(int i = 1; i < N ; ++i){
            var ab = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var a = ab[0];
            var b  = ab[1];
            adjlist[a].Add(b);
            adjlist[b].Add(a);
          }
          

          //操作を保存
          var queries = new Tuple<int,int>[Q];
          for (int i = 0; i < queries.Length; ++i){
            var px = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            queries[i] = Tuple.Create(px[0],px[1]);
          }          
          
          //自分に対しての操作を保存
          var selfPoints = new long[adjlist.Length];
          for(int i = 0; i < queries.Length ; i++){
            selfPoints[queries[i].Item1] += queries[i].Item2;
          }

          //解答を初期化
          var ancestralPoints = new long[adjlist.Length];
          for(int i = 0; i < adjlist.Length ; i++){
            ancestralPoints[i] = long.MinValue;
          }

          //キューに入っているものが次に見に行くものとなる
          var bfs = new Queue<int>();
          bfs.Enqueue(1);
          ancestralPoints[1] = selfPoints[1];
          
          while(bfs.Any())
          {
            int v = bfs.Dequeue();
            for(int j = 0; j < adjlist[v].Count; ++j){
             int u = adjlist[v][j];
             if(ancestralPoints[u] >=0){
              continue;
             }
             ancestralPoints[u] =+ ancestralPoints[v] + selfPoints[u];
             bfs.Enqueue(u);
            }
          }
          Console.WriteLine(string.Join(" ", ancestralPoints.Skip(1)));       
        }
 }
 


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

int main(){
	int h1,h2,k1,k2,a,b,c,d,x = 0,y = 0;
	cin >> h1 >> h2 >> k1 >> k2 >> a >> b >> c >> d;
	x = h1 * a + (int)(h1 / 10) * c + h2 * b + (int)(h2 / 20) * d;
	y = k1 * a + (int)(k1 / 10) * c + k2 * b + (int)(k2 / 20) * d;
	if(x < y) cout << "kenjiro" << endl;
	else if(x > y) cout << "hiroshi" << endl;
	else cout << "even" << endl;
	return 0;
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> vec(n);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    vec[a-1]++;
    vec[b-1]++;
  }
  rep(i,n){
    cout<<vec[i]<<endl;
  }
}

Measured memory_bytes: 3604
g_m=0
g_G=[]
g_cnt=0
A=[]
n = int(input())
for i in range(n):
    A.append(int(input()))
def insertionSort(A,n,g):
    global g_cnt
    for i in range(g,n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j-g
            g_cnt += 1
        A[j+g]=v
    
def shellSort(A,n):
    m=1
    G=[]
    j=1
    for i in range(0,100):
        G.append(j)
        j=3*j+1
    
    while G[m]<=n:
        m+=1
    G=G[:m]
    G.reverse()
    for i in range(0,m):
        insertionSort(A,n,G[i])
    return A,m,G
A,g_m,g_G=shellSort(A,n)
print(g_m)
print(" ".join(map(str,g_G)))
print(g_cnt)
print(*A,sep="\n")

Measured memory_bytes: 53288
# A - Falling Asleep
N = int(input())
s = list(input().split() for i in range(N))
X = str(input())
ans = 0
#print(N,s,X)
#print(s[0][0])
count = 0
for i in range(N):
    if str(s[i][0]) == X:
        break
    else:
        count += 1

#print(count)

for j in range(count+1,N):
    ans += int(s[j][1])

print(ans)

Measured memory_bytes: 38256
def solve():
    ABC = list(sorted(map(int, input().split())))

    # 最初にプラス1で近づける
    A, B, C = ABC[0], ABC[1], ABC[2]

    a, amod = divmod((C-A),2)
    b, bmod = divmod((C-B),2)
    A += a * 2
    B += b * 2

    if C == A and C == B:
        return a + b
    elif C > A and C > B:
        return a + b + 1
    elif C > A and C == B:
        return a + b + 2
    elif C > B and C == A :
        return a + b + 2

def main():
    print(solve())

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
using namespace std;
#define N (1000000000+7)
typedef pair<int,int> P;
typedef long long ll;
int d[1010][1010];
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
int h,w;
char board[1010][1010];
bool check(int i, int j) {
	return (i >= 0) && (i <= h) && (j >= 0) && (j <= w) && (board[i][j] == '.');
}

int main(void){
    int n,sum=0;
    cin>>n;
    vector<int>a(n),number;
    set<int>s;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
        number.push_back(a[i]);
        s.insert(a[i]);
    }
    if(sum==0){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(s.size()==3){
        sum=0;
        if(n%3!=0){
            cout<<"No"<<endl;
            return 0;
        }
        for(auto itr=s.begin();itr!=s.end();++itr){
            sum^=(*itr);
            if(count(number.begin(),number.end(),*itr)!=n/3){
                cout<<"No"<<endl;
                return 0;
            }
        }
        if(sum==0)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        return 0;
    }
    if(s.size()==2){
        sum=0;
        int v[2]={0};
        for(auto itr=s.begin();itr!=s.end();++itr){
            v[sum]=count(number.begin(),number.end(),*itr);
            sum++;
        }
        if(((v[0]==n/3)&&(v[1]==2*n/3))||((v[0]==n/3)&&(v[1]==2*n/3))){
            cout<<"Yes"<<endl;
        }
        else cout<<"No"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 4472
import math
N, D = map(int, input().split())
Z = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N):
  d = math.sqrt(Z[i][0]**2 + Z[i][1]**2)
  if (d <= D):
    ans += 1

print(ans)

Measured memory_bytes: 102596
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vv(T) vector<vector<T>>
#define coa cout << ans << endl; return 0;
using namespace std;
using ll = long long;
template<typename T>
using vec = vector<T>;
template<typename T>
using vvec = vector<vector<T>>;
using qint = queue<int>;
using sint = stack<int>;
using pii = pair<int, int>;


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

    map<int, int> alphabet;
    for(auto c : s){
        alphabet[c]++;
    }
    
    string ans;
    for(char c = 'a'; c <= 'z'; c++){
        if(alphabet[c] == 0){
            ans.push_back(c);
        }
    }

    if(ans.empty()) ans += "None";
    else ans = ans[0];

    coa
}


Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
#define nl '\n' 
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define pii pair <int,int>
ll mod=1000000007;
int main()
{
	fast;
	map<string,int>m;
	m["SAT"]=1;
	m["SUN"]=7;
	m["MON"]=6;
	m["TUE"]=5;
	m["WED"]=4;
	m["THU"]=3;
	m["FRI"]=2;
	string s;cin>>s;
	cout<<m[s];
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

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

	auto N=in();
	auto A=vecin<ll>(N);
	vector<ll> LIS(N,1LL<<60);
	LIS[0] = A[0];
	for(int i=1;i<N;i++){
		auto res = lower_bound(ALL(LIS),A[i]);
		*res = A[i];
	}

	auto res = lower_bound(ALL(LIS),(1LL<<60)-1LL);

	out(distance(LIS.begin(),res));
	return 0;
}



Measured memory_bytes: 4420
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 500005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int n;
    cin >> n;
    int r[SIZE];
    for( int i = 0; i < n; ++i ) {
        int a;
        cin >> a;
        r[a] = i + 1;

    }
    for( int i = 1; i <= n; ++i ) cout << r[i] << " ";
    cout << endl;
    return 0;
}


Measured memory_bytes: 1280
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<cmath>
#include<complex>
#include<utility>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define ALL(C)     (C).begin(),(C).end()
#define mp         make_pair
#define pb         push_back
#define fir first
#define sec second

const int N = 10010;

typedef pair<short,short> pii;

short  isexist[N]={0};
short testcase=0;
int x[N];
vector<pii> inx[N];

int req[N];

void makedata(int n,int *x1,int *x2,int *y1,int *y2,
	      int &px,int *xd,vector<pii> *IN){
  testcase++;
  rep(i,n){
    isexist[x1[i]]=testcase;
    isexist[x2[i]]=testcase;
  }
  rep(i,N)if (isexist[i]==testcase)x[px]=i,IN[px++].clear();

  rep(i,n){
    int j=lower_bound(xd,xd+px,x1[i])-xd;
    while(j < px && xd[j] < x2[i]){
      bool isin=false;
      rep(k,IN[j].size()){
	short Y1 = y1[i],Y2=y2[i];
	short &Y3=IN[j][k].fir;
	short &Y4=IN[j][k].sec;
	if (Y4 <= Y1 || Y2 <= Y3)continue;
	isin=true;
	Y3=min(Y1,Y3);
	Y4=max(Y2,Y4);
	break;
      }
      if (!isin)IN[j].pb(mp(y1[i],y2[i]));
      j++;
    }
  }
}

pair<int,int> solve(int n,vector<pii> *in,int *c){
  int area=0;
  int len=0;
  rep(i,n-1){
    if (in[i].size() == 0)continue;
    sort(in[i].begin(),in[i].end());
    short l=-1,h=-1;
    short width;
    width=c[i+1]-c[i];
    rep(j,in[i].size()){
      short &nowl=in[i][j].fir,&nowh=in[i][j].sec;
      if (nowl > h){
	len+=2*width;
	area+=(nowh-nowl)*width;
      }else if (nowl == h){
	area+=(nowh-nowl)*width;
      }else if (nowh > h){
	area+=(nowh-h)*width;
      }
      l=nowl;
      h=max(h,nowh);
    }
  }
  return mp(area,len);
}

main(){
  int n,q;
  static int x1[N],y1[N],x2[N],y2[N];
  while(cin>>n>>q && n){
    rep(i,n){
      cin>>x1[i]>>y1[i]>>x2[i]>>y2[i];
    }
    int px=0,py=0;
    makedata(n,x1,x2,y1,y2,px,x,inx);
    pair<int,int> ansx=solve(px,inx,x);

    cout << ansx.first << endl;
    if (q == 2){
      px=0;
      makedata(n,y1,y2,x1,x2,px,x,inx);
      pair<int,int> ansy= solve(px,inx,x);      
      cout << ansx.second+ansy.second << endl;
    }
    rep(i,px)inx[i].clear();
  }
  return false;
}

Measured memory_bytes: 1476
#include<stdio.h>
int main()
{
    int seito,a[100][100]={{0}};
    int i,j,k;
    while(scanf("%d",&seito))
    {
        if(seito==0)break;
        for(i=0;i<seito;i++)
        {
            for(;;)
            {
                for(j=0;j<3;j++)
                {
                    scanf("%d",&a[i][j]);
                }
                if(a[i][0]==100||a[i][1]==100||a[i][2]==100)
                {
                    printf("A\n");
                    break;
                }
                else if((a[i][0]+a[i][1])/2>=90)
                {
                    printf("A\n");
                    break;
                }
                else if((a[i][0]+a[i][1]+a[i][2])/3>=80)
                {
                    printf("A\n");
                    break;
                }
                else if((a[i][0]+a[i][1]+a[i][2])/3>=70)
                {
                    printf("B\n");
                    break;
                }
                else if((a[i][0]+a[i][1]+a[i][2])/3>=50&&a[i][0]>=80)
                {
                    printf("B\n");
                    break;
                }
                else if((a[i][0]+a[i][1]+a[i][2])/3>=50&&a[i][1]>=80)
                {
                    printf("B\n");
                    break;
                }
                else
                {
                printf("C\n");
                break;
                }
            }
        }

    }
    return 0;
}

Measured memory_bytes: 632
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;
const int MOD = 1e9+7;

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

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main(){
    int n;cin >> n;
    vector<int> a(n);rep(i,n)cin >> a[i];
    vector<int> b(n);rep(i,n)cin >> b[i];
    vector<int> c(n-1);rep(i,n-1)cin >> c[i];
    int ans = 0;
    for(int i=0;i<n;i++){
        int number = a[i] - 1;
        ans += b[number];
        if(i+1<n && a[i] + 1 == a[i+1])ans += c[a[i] - 1];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n,k,c=gets.split(' ').map(&:to_i)
#h=gets.split(' ').map(&:to_i)
#tajigen = Array.new(4) { Array.new(2,0) }
s=gets.chomp

fast = Array.new(k)
latest = Array.new(k)

u=0
for  i in 0..k-1
    for j in u..n-1
      if s[j]=='o'
        fast[i] = j+1
        u = j+c+1
        break
      end
    end
end

u=0
s.reverse!
for i in 0..k-1
  #for j in (0..u).to_a.reverse #for分で降順　これforのなかで使ったらあかん
  for j in u..n-1
    if s[j] == 'o'
      latest[i] = n-j
      u = j+c+1
      break
    end
  end
end
latest.reverse!
#puts latest
#puts latest
#puts latest
#latest.reverse!
ans=Array.new
=begin
n=0
while n<fast.length
  if latest.include?(fast[n])
    ans.push(fast[n])
  end
  n+=1
end
=end
=begin
p=0
q=0
while p<k && q<k
  if fast[p]==latest[q]
    ans.push(fast[p])
    p+=1
    q+=1
  else
    p+=1
  end
end
=end
#puts fast
for i in 0..k-1
  if fast[i]==latest[i]
    ans << fast[i]
  end
end
=begin
puts ans if !ans.nil?
puts "\n" if ans.nil?
=end


if ans.nil?
  puts s[n]
else
  ans.each do |a|
    puts a
  end
end

#puts s[n]


Measured memory_bytes: 8184
#include<stdio.h>
int main(void)
{
  int num,highest=0;
  scanf("%d",&num);
  int high[num],i;
  for(i=0;i<num;i++)
  {
    scanf("%d",&high[i]);
    if(high[i]>highest) highest=high[i];
  }
  
  int count=0,j,last;
  for(i=0;i<highest;i++)
  {
    last=0;
    for(j=0;j<num;j++)
    {
      if(last==0&&high[j]!=0)
      {
        count++;
        high[j]=high[j]-1;
        last=1;
      }
      else if(last!=0&&high[j]!=0) high[j]=high[j]-1;
      else last=0;
    }
  }
  printf("%d",count);
  return 0;
}

Measured memory_bytes: 128
#abc131c

a,b,c,d=map(int,raw_input().split())

def gcd(a, b):
  if b == 0:
    return a
  return gcd(b, a%b)

def lcm(a, b):
  return a*b//gcd(a,b)

l=lcm(c,d)
print (b-a+1)-((b/c)-(a-1)/c)-((b/d)-(a-1)/d)+((b/l)-(a-1)/l)


Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
struct Edge {
    int to, id;
};

vector<vector<Edge>> G;
vector<int> ans;
void dfs(int v, int c = -1, int p = -1) {
    int k = 1;
    rep(i, G[v].size()) {
        int u = G[v][i].to, ei = G[v][i].id;
        if (u == p) continue;
        if (c == k) k++;
        ans[ei] = k;
        k++;
        dfs(u, ans[ei], v);
    }
}
int main()
{
    int N;
    cin >> N;
    G.resize(N);
    ans = vector<int>(N);

    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(Edge{b, i});
        G[b].push_back(Edge{a, i});
    }

    dfs(0);
    int mx = 0;
    rep(i, N) {
        mx = max(mx, (int)G[i].size());
    }

    cout << mx << endl;
    rep(i, N - 1) {
        cout << ans[i] << endl;
    }
    return 0;
}

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

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

}


Measured memory_bytes: 256
def change(num)
  if !@group[num]
    return
  end
  @group[num] = false
  for i in @arr[num]
    change(i)
  end
end

n,m = gets.split.map(&:to_i)
@arr = Array.new(n){Array.new(0)}
@group = Array.new(n,true)

m.times do |i|
  a,b = gets.split.map(&:to_i)
  a -= 1
  b -= 1
  @arr[a].push(b)
  @arr[b].push(a)
end

cnt = 0

for i in 0...n
  if @group[i]
    cnt += 1
  end
  change(i)
end

puts cnt-1

Measured memory_bytes: 56132
import numpy as np

if __name__ == "__main__":
    N, K = map(int, input().split())
    S = input()
    T = [0]
    if(S[0] == '0') :
        T.append(0)
    T.append(1)
    for i in range(1, N):
        if(S[i] == S[i-1]):
            T[-1] += 1
        else:
            T.append(1)
    for i in range(3 * K):
        T.append(0)
    SIZE = len(T)
    S = [0] * SIZE
    for i in range(1, SIZE):
        S[i] = S[i-1] + T[i]
    #print(T)
    #print(S)
    ans = 0
    for i in range (1, SIZE, 2):
        if(i + 2 * K >= SIZE):
            break
        ans = max(ans, S[i + 2 * K] - S[i-1])
    print(ans)

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

#define rep(i,N) repf(i,0,N)
#define reps(i,N) repfs(i,0,N)
#define repf(i,a,b) for(int i=a;i<b;i++)
#define repfs(i,a,b) for(int i=a+1;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)

#define d(a) if(isDebugMode) cout<<#a<<"="<<a<<"."
#define d2(a,b) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<"."
#define d3(a,b,c) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"."
#define d4(a,b,c,d) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<","<<#d<<"="<<d<<"."
#define da(arr,N){if(isDebugMode){rep(i,N){if(arr[i]==INF)printf("INF ");else cout<<arr[i]<<" ";} cout<<endl;}}
#define da2(arr,N,M){if(isDebugMode)rep(i,N){rep(j,M){if(arr[i][j]==INF)printf(" INF");else printf(" %3d",arr[i][j]);}cout<<endl;}}
#define pb push_back
#define pob pop_back

auto chmax =[](int &a,int b){ a = max(a, b);};
auto chmin =[](int &a,int b){ a = min(a, b);};

typedef long long ll;
typedef pair<int,int> P;
const int INF = 100000000;
const int MOD = 1000000007;
const int dx[4] = { 0, 1, 0,-1};
const int dy[4] = { 1, 0,-1, 0};

bool isDebugMode=1;
//--------------------------------------//
char c;

void solve(){
	cerr<<"fkdjflkjdlkfjewoifjewi;fjoiasjdfjsadflkj"<<endl;
	if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o')
		cout<<"vowel"<<endl;
	else
		cout<<"consonant"<<endl;
}

int main(){
	cin>>c;
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,k; string s,t;
char maze[60][60];
int dis[101][101]; int graph[52][52]; bool vis[52];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

int main() {
	cin >> n;
	cout << 3 * n * n << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    int ar[n+3][m+5];
    char ch;
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++){cin>>ch;
              if(ch=='#')ar[i][j]=0;
              else ar[i][j]=1;
        }

    long long int dp[n+4][m+4];
    memset(dp,0,sizeof(dp));
    for(int i=0;i<n and ar[i][0]!=0;i++)dp[i][0]=1;
    for(int i=0;i<m and ar[0][i]!=0;i++)dp[0][i]=1;

    for(int i=1;i<n;i++)
    {
        for(int j=1;j<m;j++)
        {
            if(ar[i][j]==0){
                dp[i][j]=0;
                continue;
            }
            dp[i][j]=dp[i-1][j]+dp[i][j-1];
            dp[i][j]%=1000000007;
        }

    }


    cout<<dp[n-1][m-1]<<endl;
    return 0;
}


Measured memory_bytes: 15332
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		if (s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21716
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

//幅優先探索のテンプレ.デフォルトではstartからの距離を返す.
//graphは隣接リスト.startは探索開始地点
vector<int> ans;
vector<int> bfs(vector<vector<int>> &graph, int start)
{
	queue<int> todo;
	vector<int> dist(graph.size(),-1);
	dist[start] = 0;
	todo.push(start);
	while(!todo.empty()){
		int now = todo.front();
		todo.pop();
		for (int i=0;i<graph[now].size();i++){
			int nxt = graph[now][i];
			if (dist[nxt] != -1) continue;
			ans[nxt] = now;
			dist[nxt] = dist[now] + 1;
			todo.push(nxt);
		}
	}
	return dist;
}

int main(){
	int n,m;
	cin >> n >> m;
	vector<vector<int>> graph(n);
	ans = vector<int>(n, -1);
	rep(i, m)
	{
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	vector<int> dist = bfs(graph, 0);
	rep2(i,1, n)
	{
		if(ans[i] == -1){
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
	rep2(i,1, n)
	{
		cout << ans[i] + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 10476
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    priority_queue<int> hp;
    for(int i=0;i<n;i++){
        int h;
        cin>>h;
        hp.push(h);
    }
    for(int i=0;i<k&&!hp.empty();i++){
        hp.pop();
    }
    long long ans=0;
    while(!hp.empty()){
        ans+=hp.top();
        hp.pop();
    }
    cout<<ans<<"\n";
    return(0);
}

Measured memory_bytes: 4272
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void 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 if (S == "SAT") {
		cout << 1 << endl;
	}
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(int argc, char* argv[])
{
  int a, b, r, w;
   
  scanf("%d %d", &a, &b);
  if(a < b){
    w = a;
    a = b;
    b = w;
  }
  while(0 < (r = a % b)){
    a = b;
    b = r;
  }
  printf("%d\n", b);
  return(0);
}

Measured memory_bytes: 592