akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>

using namespace std;

int main(){
  int N;
  string S;
  cin>>N;
  cin>>S;
  for(int i=0;i<S.size();i++){
    S[i]=(S[i]-'A'+N)%26+'A';
  }
  cout<<S<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	int n;ll h;cin>>n>>h;
	ll a[n],b[n],mx=0;
	rep(i,n){
		cin>>a[i]>>b[i];
		mx=max(mx,a[i]);
	}
	sort(b,b+n,greater<ll>());
	ll ans=0;
	rep(i,n){
		if(mx>b[i]) continue;
		else{
			h-=b[i];
			ans++;
			if(h<=0) break;
		}
	}
	if(h>0) ans+=(ceil)((double)h/mx);

	cout<<ans<<"\n";
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
void drawSquare(int w,int h);
int main(int argc, const char * argv[]) {
    int w,h;
    while (1) {
        cin >> w >> h;
        if (w==0&&h==0) {
            break;
        }
        drawSquare(w, h);
    }
    return 0;
}
void drawSquare(int w ,int h){
    for (int i=0; i<w; i++) {
        for (int j=0; j<h; j++) {
            cout <<'#';
        }
        cout<<endl; //改行
    }
    cout<<endl; //改行
}


Measured memory_bytes: 3080
#include<iostream>
using namespace std;
int main(){
  int d,dk,ans;
  while(cin>>d){
    dk = d;
    ans = 0;
    for(int i=1;i<600/d;i++){
      ans += dk*dk*d;
      dk += d;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include<bits/stdc++.h>
#include<vector>
#define fo(i,n) for(long long i=0;i<n;i++)
#define ll long long int
#define inf 999999999999999999
#define pb push_back
#define MOD 1000000007
#define tr(c,it) for(auto it = (c).begin(); it != (c).end(); ++it)
#define fio ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
//cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
 
void SieveOfEratosthenes() 
{ 
    bool prime[10000001];
    memset(prime, true, sizeof(prime)); 
  
    for (ll p=2; p*p<=10000000; p++) 
    { 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (ll i=p*p; i<=10000000; i += p) {
                prime[i] = false; 
            }
        } 
    }  
} 
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a * a);
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
	if(b%a==0)
	   return a;
	return gcd(b%a,a);
}
ll nCrModpDP(ll n, ll r, ll p) 
{ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C));   
    C[0] = 1;
    for (ll i = 1; i <= n; i++) 
    {
        for (ll j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 
ll nCrModp(ll n, ll r, ll p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
   ll ni = n%p, ri = r%p; 
  
   return (nCrModp(n/p, r/p, p) * 
           nCrModpDP(ni, ri, p)) % p; 
} 
int32_t main() 
{
    fio
	ll j,i,n,t,l,r,c,h,k,maxi,d,x;
	cin>>n;
	ll a[n];
	map<ll,ll> m;
	set<ll> s;
	ll ans=0;
	map<ll,ll> freq;
	for(j=0;j<n;j++)
	{
		cin>>a[j];
		if(freq[a[j]]==0)
		s.insert(a[j]);
		m[a[j]]=1;
		freq[a[j]]++;
		
	}
	if(s.size()==0)
	{
		cout<<0;
		return 0;
	}
	tr(s,it)
	{
		c=*it;
		if(m[c]==1)
		{
			if(freq[c]==1)
			ans++;
			for(j=2*c;j<=1000000;j+=c)
		    {
			if(m.find(j)!=m.end())
			{
				m[j]=2;
			}
		    }

		}
		
		
	}
	cout<<ans<<endl;
}



	

		

Measured memory_bytes: 39556
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
       
using namespace std;
       
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
 
// #define MAX 100010
 
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES
 
long long binpow(long long a,long long b)
{
    if (b == 1) return a;
    long long res = binpow(a, b/2)%MOD;
    if (b % 2) return (res*((res*a)%MOD))%MOD;
    else return (res * res)%MOD;
}

long long int fact(long long int a)
{
    if(a==0||a==1)
        return 1;
    long long int ans = 1;
    for(int i=a;i>=1;i--)
        ans = (ans * i)% MOD;
    return ans;
}

long long int ivmod(long long int a)
{
    return binpow(a,MOD-2);
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // #ifndef ONLINE_JUDGE
        // freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    // #endif
    char a,b;
    cin>>a>>b;
    if(a=='H')
    {
        cout<<b;
    }
    else
    {
        if(b=='H')
            cout<<"D";
        else
            cout<<"H";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N = int(input())
K = int(input())
X = list(map(int,input().split()))
distance = 0
for n in range(N):
  if X[n] < K/2:
    distance += X[n]
  else:
    distance += K - X[n]
print(distance*2)
  

Measured memory_bytes: 61912
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
if k%2==0:
    l=k//2
    x=n//l
    if x%2==0:
        ans=2*(x//2)**3
    else:
        ans=(x//2)**3+(x//2+1)**3
else:
    ans=(n//k)**3
print(ans)








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

int main(void){
    int n = 0, k = 0; 
    int ans = 0;

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

    while(n > 0){
        n /= k;
        ans++;
    }

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

    return 0;

} 


Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


void Main(){
    int N;
    cin >> N;
    vec<vec<int> > A(2, vec<int>(N));
    vec<vec<int> > mp(2, vec<int>(N+1));
    REP(i, 2){
        REP(j, N){
            cin >> A[i][j];
        }
    }
    REP(i, N){
        int t = mp[0][i] + A[0][i];
        chmax(mp[0][i+1], t);
        chmax(mp[1][i], t);
    }
    REP(i, N){
        int t = mp[1][i] + A[1][i];
        chmax(mp[1][i+1], t);
    }
    cout << mp[1][N-1]+A[1][N-1] << el;
}



Measured memory_bytes: 256
// -*- coding: utf-8 -*-
// @Date    : 2019-11-09 18:53:35

#include <bits/stdc++.h>
#define greeting cerr << "What's your problem?\n"

using namespace std;
typedef long long ll;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& v)
{
	for(auto i : v)
		os << i << " ";
	return os;
}

template<typename T>
ostream& operator << (ostream& os, const set<T>& v)
{
	for(auto i : v)
		os << i << " ";
	return os;
}

const double pi = acos(-1.0);

#define locala
int main()
{
#ifdef local
	freopen("data.in", "r", stdin);
	freopen("ans.out", "w", stdout);
#endif	
	int a, b, x;
	scanf("%d%d%d", &a, &b, &x);
	double val, ans;
	if(a*a*b/2 < x)
	{
		val = 2.0 * (a*a*b - x) / (a*a*a);
		ans = atan(val);
		ans *= 180.0 / pi;
	}
	else
	{
		val = (2.0 * x) / (b*b*a);
		ans = pi/2 - atan(val);
		ans *= 180.0 / pi;
	}
	printf("%f\n", ans);
	return 0;
}

Measured memory_bytes: 384
A = [list(map(int,input().split())) for n in range(3)]
N = int(input())
B = [int(input()) for n in range(N)]
C = [[0,0,0],[0,0,0],[0,0,0]]
ans = "No"

for i in range(3):
  for j in range(3):
    if A[i][j] in B:
      C[i][j] = 1

for i in range(3):
  if C[i][0]+C[i][1]+C[i][2]==3:
    ans = "Yes"

for i in range(3):
  if C[0][i]+C[1][i]+C[2][i]==3:
    ans = "Yes"

for i in range(3):
  if C[0][0]+C[1][1]+C[2][2]==3 or C[0][2]+C[1][1]+C[2][0]==3:
    ans = "Yes"

print(ans)

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

int main(){
  int n,l; cin>>n>>l;
  int ans=0;
  int min=10e5;
  for (int i=0; i<n; i++){
    ans+=l+i;
    if (abs(l+i)<abs(min)){
      min=l+i;
    }
  }
  cout<<ans-min<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vector<ll> A(N);
  rep(i,N) cin >> A[i];
  ll ans = 0;
  if(N==1)
  {
    ans += A[0] / 2;
  }
  rep(i,N-1)
  {
    if(A[i]+A[i+1]>=2)
    {
      ans += (A[i]+A[i+1])/2;
      if((A[i]+A[i+1])%2==0)
      {
        A[i] = 0;
        A[i+1] = 0;
      }
      else
      {
        if(A[i+1]>0)
        {
          A[i+1] = 1;
          A[i] = 0;
        }
        else
        {
          A[i+1] = 0;
          A[i] = 1;
        }
        
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4056
#include <bits/stdc++.h>
#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)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

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

    cout << "0 0 ";

    ll sq = sqrt(s);

    if(sq*sq==s){
        cout << sq << " 0 0 " << sq;
    }else{
        while((sq+1)*(sq+1)<s){
            sq++;
        }
        ll sq1 = sq;
        ll sq2 = sq;
        if(sq*(sq+1)<s){
            sq1++;
        }
        if(sq1*sq2<s){
            sq2++;
        }
        ll aaa = sq1*sq2 - s;
        cout << sq1 << ' ' << aaa << ' ' << '1' << ' ' << sq2;
        //cout << sq1*sq2-aaa << endl;
    }

    

    cout << endl;
    return 0;
}
 
 
 

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

typedef long long ll;
const ll INF = 1LL<<60, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(v) (v).begin(), (v).end()
#define fi first
#define se second
#define m_p make_pair

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  cin >> s;
  set<char> st;
  map<char, ll> mp; 
  rep(i,4){
    st.insert(s[i]);
    mp[s[i]]++;
  }
  if(st.size()!=2){
    cout << "No" << endl;
    return 0;
  }else{
    rep(i,4){
      if(mp[s[i]]!=2){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


ll c[200010], d[200010];
int main(){
    int m;
    cin >> m;
    rep(i, m) cin >> d[i] >> c[i];

    ll tot = 0, digit = 0;
    rep(i, m) {
        tot += d[i] * c[i];
        digit += c[i];
    }

    cout << digit - 1 + (tot - 1) / 9 << endl;

    return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using namespace std;


int main() {
	int N;
	cin >> N;
	double a = double(N / 2);
	double ans;
	ans = 1 - double(a/N);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	float a;
	float b;
	
	while (scanf("%f %f", &a, &b) != EOF){
	
		if ((a < 35.50) && (b < 71.00)){
			printf("AAA\n");
			}
		else if ((a < 37.50) && (b < 77.00)){
			printf("AA\n");
		}
		else if ((a < 40.00) && (b < 83.00)){
			printf("A\n");
		}
		else if ((a < 43.00) && (b < 89.00)){
			printf("B\n");
		}
		else if ((a < 50.00) && (b < 105.00)){
			printf("C\n");
		}
		else if ((a < 55.00) && (b < 116.00)){
			printf("D\n");
		}
		else if ((a < 70.00) && (b < 148.00)){
			printf("E\n");
		}
		else {
			printf("NA\n");
		}
	}
	
	return (0);
}

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

bool dp[4001][16001];
int x,y,tx,ty,ax[4001],ay[4001];

void dfsx(int t,int n){
	if(dp[t][n+8000]) return;
	if(t<tx){
		dfsx(t+1,n+ax[t]);
		dfsx(t+1,n-ax[t]);
	}
	dp[t][n+8000]=1;
}

void dfsy(int t,int n){
	if(dp[t][n+8000]) return;
	if(t<ty){
		dfsy(t+1,n+ay[t]);
		dfsy(t+1,n-ay[t]);
	}
	dp[t][n+8000]=1;
}

int main()
{
	string s;
	cin>>s>>x>>y;
	bool fx=1;
	for(int i=0;i<s.length();i++){
		if(s[i]=='F'){
			if(fx) ax[tx]++;
			else ay[ty]++;
		}
		else{
			if(fx) fx=0,tx++;
			else fx=1,ty++;
		}
	}
	if(s[s.length()-1]=='F'){
		if(fx) tx++;
		else ty++;
	}
	dfsx(1,ax[0]);
	bool xx=dp[tx][8000+x]?1:0;
	memset(dp,0,sizeof(dp));
	dfsy(0,0);
	bool yy=dp[ty][8000+y]?1:0;
	if(xx&&yy) cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 62976
// Problem : P - Independent Set
// Contest : AtCoder - Educational DP Contest
// URL : https://a...content-available-to-author-only...r.jp/contests/dp/tasks/dp_p?lang=en
// Powered by CP Editor (https://g...content-available-to-author-only...b.com/cpeditor/cpeditor)

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define Ma7moud_7amdy                 \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define Open_Sesame Open()
#define all(v) ((v).begin()), ((v).end())
#define allr(v) ((v).rbegin()), ((v).rend())
#define clr(arr, x) memset(arr, x, sizeof arr)
#define endl "\n"
#define watch(x) cout << #x << " = " << x << endl;
#define RT(x) return cout << (x), 0;
#define Accepted 0
#define INF 0x3f3f3f3f3f3f3f3fLL
typedef long long ll;
typedef vector<int> vi;
const int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
void Open()
{
#ifndef ONLINE_JUDGE 
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
#endif
}
const int mod = ll(1e9 + 7), N = 1e5 + 5;
//“Nobody but you have to believe in your dreams to make them a reality.” ― Germany Kent
int n;
vector<vector<int>>g;
int cnt = 0;
ll mem[N][2];
ll dfs(int node, int par, int lst) {
	ll& ret = mem[node][lst];
	if (~ret)return ret;
	ret = 1;
	for (int nxt : g[node]) {
		ll cur = 0;
		if (nxt != par) {
			cur += dfs(nxt, node, 0) % mod;
			if (lst != 1)
			{
				cur += dfs(nxt, node, 1) % mod;
			}
			ret *= cur % mod;
			ret %= mod;
		}
	}
	return ret;
}
int main()
{
	Ma7moud_7amdy;
	Open_Sesame;
	clr(mem, -1);
	cin >> n;
	g = vector<vector<int>>(n + 1);
	for (int i = 1, u, v; i < n; i++) {
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	ll ans = dfs(1, -1, 1);
	ans += dfs(1, -1, 0);

	cout << ans %mod<< endl;
}


Measured memory_bytes: 19944
#include <bits/stdc++.h>
#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mod 1000000007
// #define mod 998244353
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int x[3];
	cin >> x[0] >> x[1] >> x[2];
	sort(x, x + 3);
	if (x[0] == 5 && x[1] == 5 && x[2] == 7)
	{
		cout << "YES";
	}
	else
	{
		cout << "NO";
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
l = list(map(int,input().split()))
ans = 0
for i in range(n):
    if i != n-1:
        if i+1 == l[i]:
            a = l[i]
            b = l[i+1]
            l[i]=b
            l[i+1]=a
            ans += 1
    else:
        if i+1 == l[i]:
            ans += 1
print(ans)

Measured memory_bytes: 13880
#include <algorithm>
#include <cassert>
#include <iostream>
#include <numeric>
#include <set>
#include <tuple>
#include <vector>
using namespace std;

int main() {
  string s;
  cin >> s;
  vector<int64_t> dp(4);
  dp[0] = 1;
  const int64_t mod = 1000000007;
  for (auto &c : s) {
    vector<int64_t> next_dp(4);
    for (int i = 0; i < 3; ++i) {
      if (((c - 'A') == i) || c == '?') {
        // ignore
        for (int j = 0; j < 4; ++j) {
          next_dp[j] += dp[j];
          next_dp[j] %= mod;
        }
        // use
        next_dp[i + 1] += dp[i];
        next_dp[i + 1] %= mod;
      }
    }
    dp = next_dp;
  }
  cout << dp[3] << endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
    int x;
    char c;
    int f=1;
    while((c=getchar())!='-' && (c>'9' || c<'0'));
    if(c=='-') f=-1,c=getchar();
    x=c^'0';
    while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
    return x*f;
}
inline ll readll(){
    ll x;
    char c;
    int f=1;
    while((c=getchar())!='-' && (c>'9' || c<'0'));
    if(c=='-') f=-1,c=getchar();
    x=c^'0';
    while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
    return x*f;
}
const int maxn=2e5+10;
char s[maxn];
int vis[2][maxn],p[maxn];
int l[maxn],r[maxn],Begin[maxn],Next[maxn<<1],to[maxn<<1],w[maxn<<1],e;
inline void add_edge(int x,int y,int z){
	to[++e]=y;
	Next[e]=Begin[x];
	Begin[x]=e;
	w[e]=z;
}
queue<int> q;
int main(){
	int n=read(),m=read();
	scanf("%s",s+1);
	REP(i,1,m) l[i]=read(),r[i]=read();
	REP(i,1,m){
		vis[s[l[i]]-'A'][r[i]]++,vis[s[r[i]]-'A'][l[i]]++;
		add_edge(l[i],r[i],s[l[i]]-'A'),add_edge(r[i],l[i],s[r[i]]-'A');
	}
	int cnt=n;
	REP(i,1,n){
		if(vis[0][i]>0 && vis[1][i]>0) continue;
		q.push(i),p[i]=1;
	}
	while(!q.empty()){
		int u=q.front();q.pop(),--cnt;
		for(int i=Begin[u];i;i=Next[i]) if(!p[to[i]]){
			--vis[w[i]][to[i]];
			if(!vis[w[i]][to[i]]) q.push(to[i]),p[to[i]]=1;
		}
	}
	printf("%s\n",cnt?"Yes":"No");
    return 0;
}

Measured memory_bytes: 10112
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
#include <unordered_set>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

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

  int32_t X, N;
  cin >> X >> N;
  if ( N == 0) {
    cout << X << endl;
  } else {
    unordered_set<int> P;
    for (int i = 0; i < N; i++) {
      int p;
      cin >> p;
      P.emplace(p);
    }
    for (int i = 0; i <= X; i++) {
      if (!P.count(X - i)) {
        cout << X - i << endl;
        break;
      } else if (!P.count(X + i)) {
        cout << X + i << endl;
        break;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3660
using System;

namespace _6_B
{
    class Program
    {
        static void Main(string[] args)
        {
            bool[] card = new bool[52];
            int n = int.Parse(Console.ReadLine());
            for (int i = 0; i < n; i++)
            {
                string[] x = Console.ReadLine().Split();
                int kigou = 0;
                if (x[0] == "H")
                {
                    kigou = 1;
                }
                if (x[0] == "C")
                {
                    kigou = 2;
                }
                if (x[0] == "D")
                {
                    kigou = 3;
                }
                card[kigou * 13 + int.Parse(x[1]) - 1] = true;
            }
            for(int i=0;i<4;i++)
            {
                for(int j=1;j<=13;j++)
                {
                    if(card[i*13+j-1]==false)
                    {
                        if (i == 0)
                        {
                            Console.WriteLine("S " + j);
                        }
                        if (i == 1)
                        {
                            Console.WriteLine("H " + j);
                        }
                        if (i == 2)
                        {
                            Console.WriteLine("C " + j);
                        }
                        if (i == 3)
                        {
                            Console.WriteLine("D " + j);
                        }
                    }
                }
            }
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9084
#include <cstring>
#include <clocale>
#include <string>
#include <iostream>

std::string ToLower(std::string& s)
{
    std::string r = s;
    for(int i = 0; i < s.size(); ++i){
        r[i] = tolower(s[i]);
    }
    return r;
}
int main()
{
    std::string W;
    std::cin >> W;
    int C = 0;
    while(true){
        std::string Ti;
        std::cin >> Ti;
        if(Ti == "END_OF_TEXT") break;
        if(ToLower(Ti) == W) C++;
        // if(stricmp(Ti.c_str(), W.c_str()) == 0) C++;
    }
    std::cout << C << std::endl;
    return 0;
}

Measured memory_bytes: 3156
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    divisors.sort()
    return divisors

N, P = map(int, input().split())
def prime_factorization(n):
    res = []
    for d in make_divisors(n):
        if d == 1:
            continue
        while n%d==0:
            res.append(d)
            n//=d
    return res

from collections import Counter
pc = Counter(prime_factorization(P))
ans = 1
for k, v in pc.items():
    loop = v//N
    if loop:
        ans *= k ** loop
print(ans)


Measured memory_bytes: 3316
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
typedef pair<int,int> P;
#define F first
#define S second
int N,M,H,K;
int S[1001];
int A[1001][1001];
int T[1001][1001];
int k[1001];
P t[100001];
int main(){
  while(1){
    scanf("%d %d %d %d",&N,&M,&H,&K);
    if(!N && !M && !H && !K) break;
    for(int i=0;i<N;i++) scanf("%d",&S[i]);
    for(int i=0;i<N;i++)
      for(int j=0;j<H;j++)
	A[i][j]=i;
    for(int i=0;i<M;i++){
      int a,b;
      scanf("%d %d",&a,&b);
      a--; b--;
      A[a][b]=a+1;
      A[a+1][b]=a;
      T[a][b]=i;
      T[a+1][b]=i;
    }
    for(int i=0;i<N;i++){
      int next = i;
      for(int j=0;j<H;j++){
	if(A[next][j]<next){
	  t[T[next][j]].F = i;
	  next = A[next][j];	  
	}else if(A[next][j]>next){
	  t[T[next][j]].S = i;
	  next = A[next][j];	  
	} 
      }
      k[i] = S[next];
    }
    int res = 0;
    /*  for(int i=0;i<N;i++)
	printf("%d...%d\n",i,k[i]);*/
    for(int i=0;i<K;i++){
      res += k[i];
    }
    int sum = res;
    for(int i=0;i<M;i++){
      //      printf("change : %d %d\n",t[i].F,t[i].S);
      if(t[i].F < K && K <= t[i].S){
	res = min(res,sum-k[t[i].F]+k[t[i].S]);
	//	printf("after: %d ... %d\n",i,res); 
      } else if(t[i].F >= K && K > t[i].S){
	res = min(res,sum-k[t[i].S]+k[t[i].F]);
	//	printf("after: %d ... %d\n",i,res); 
      } 
    }
    printf("%d\n",res);
  }
}

Measured memory_bytes: 9804
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m,k;
cin>>n>>m>>k;
string str[n];
for(int i=0;i<n;i++)
    cin>>str[i];
int dp[n][m]={};

int cnt=0;
for(int i=0;i<m;i++)
{int ok=0;
    for(int j=0;j<n;j++)
    { if(str[j][i]=='#')
    {
        cnt++;
        ok=1;
        dp[j][i]=cnt;
    }
    else
    {
        if(ok)
        {
            dp[j][i]=dp[j-1][i];
        }
    }
    }
}

for(int i=0;i<m;i++)
{
    for(int j=n-2;j>=0;j--)
    {if(!dp[j][i])
        dp[j][i]=dp[j+1][i];
    }
}
for(int i=0;i<n;i++)
{
    for(int j=1;j<m;j++)
    {
        if(!dp[i][j])
            dp[i][j]=dp[i][j-1];
    }

}
for(int i=0;i<n;i++)
{
    for(int j=m-2;j>=0;j--)
    {
        if(!dp[i][j])
            dp[i][j]=dp[i][j+1];
    }
}
for(int i=0;i<n;i++)
{
    for(int j=0;j<m;j++)
        cout<<dp[i][j]<<" ";
    cout<<endl;
}














    return 0;
}


Measured memory_bytes: 4432
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define print(a) cout << a << endl;
#define cin(x) cin >> x;

int main(){
    //入力の高速化用のコード
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);

 ll n=0, money = 1000;
  cin(n);
  vector<int> price(n);
  REP(i,n){
  cin(price.at(i));
  }
 
  REP(i, n-1){
    if (price.at(i) < price.at(i+1)){
      ll stock = money / price.at(i);
      money +=  (price.at(i+1) - price.at(i)) * stock;
    }
  }

  print(money);
  return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>

int main(void){

  int a, b, c;
  int i=0;

  scanf("%d %d %d", &a, &b, &c);

  do{
    i++;
    if(c==a*i%b){
    puts("YES");
    break;
  }

  if(i==1001)
  puts("NO");

  }while(i!=1001);

return 0;
}


Measured memory_bytes: 128
#ifdef LOCAL_EXEC
#include "include.h"
#else
#include <bits/stdc++.h>
using namespace std;
#define trace(...)
#endif

using LL = long long;

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

	string s; cin >> s;
	int n = s.size();
	vector<int> vals(n + 1, -100);
	s = ">" + s + "<";
	// a[i] s[i+1] a[i + 1]
	vector<int> ids;
	for (int i = 0; i <= n; i++) {
		if (s[i] == '>' && s[i + 1] == '<') {
			vals[i] = 0;
			ids.push_back(i);
		}
	}
	for (int p: ids) {
		for (int i = p + 1; i <= n; i++) {
			if (s[i] != '<') break;
			vals[i] = max(vals[i - 1] + 1, vals[i]);
		}
		for (int i = p - 1; i >= 0; i--) {
			if (s[i + 1] != '>') break;
			vals[i] = max(vals[i + 1] + 1, vals[i]);
		}
	}

	// for (int i: vals) cout << i << ' '; cout << endl;

	LL ans = 0;
	for (int x: vals) ans += x;
	cout << ans << endl;

	return 0;
}



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

int main(void){
  char b;
  cin >> b;
  
  if (b == 'A') {
    cout << 'T' << endl;
  }
  else if (b == 'T') {
    cout << 'A' << endl;
  }
  else if (b =='G') {
    cout << 'C' << endl;
  }
  else {
    cout << 'G' << endl;
  }
  
}

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

using namespace std;
 
/// ----------------------------- (Debug) ------------------------------
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i));}
sim, class b dor(pair < b, c > d) {ris << "(" << d.first << ", " << d.second << ")";}
sim dor(rge<c> d) {*this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]";}
#else
sim dor(const c&) { ris; }
#endif
};
vector<char*> tokenizer(const char* args) {
    char *token = new char[111]; strcpy(token, args); token = strtok(token, ", ");
    vector<char*> v({token});
    while(token = strtok(NULL,", ")) v.push_back(token);
    return reverse(v.begin(), v.end()), v;
}
void debugg(vector<char*> args) { cerr << "\b\b "; }
template <typename Head, typename... Tail>
void debugg(vector<char*> args, Head H, Tail... T) {
    debug() << " [" << args.back() << ": " << H << "] ";
    args.pop_back(); debugg(args, T...);
}
#define harg(...) #__VA_ARGS__
#ifndef ONLINE_JUDGE
#define dbg(...) { debugg(tokenizer(harg(__VA_ARGS__, \b\t-->Line)), __VA_ARGS__, __LINE__); cerr << endl;}
#else
#define dbg(...) { }
#endif
/// -----------------------------------------------------------------------
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi; 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)    
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define sz(x) (int)x.size()
#define REP(i,a,b) for(i=a;i<=b;i++)
#define RAP(i,a,b) for(i=a;i>=b;i--)
#define spa <<" "<<
#define all(x) (x).begin(), (x).end()
ll mod=1e9+7;
const int MX=0x3f3f3f3f;

int main(){
	IOS;
	int a,b;
	cin>>a>>b;
	cout<<a*b;
	return 0;
}

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

#define lli long long int
#define pb push_back
#define in insert
#define pi pair<lli, lli>
#define ps pair<double, string>
#define pib pair<pi, bool>
#define mp make_pair
#define fir first
#define sec second
#define MAXN 1001
#define MAXL 10001
#define mod 1000000007

signed main()
{
  lli a, b, c, k;
  cin >> a >> b >> c >> k;
  lli kk = k;
  if (kk - a <= 0)
  {
    cout << kk << endl;
    return 0;
  }
  kk -= a;
  if (kk - b <= 0)
  {
    cout << a << endl;
    return 0;
  }
  kk -= b;
  cout << a - min(kk, c) << endl;
  return 0;
}

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

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _Ty> static _Ty tp_abs(const _Ty& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _Ty> static _Ty tp_min(_Ty a, _Ty b) {
	return a < b ? a : b;
}
template <class _Ty> static _Ty tp_max(_Ty a, _Ty b) {
	return a > b ? a : b;
}
template<class T> static void get1int(T& a) {
	const char* fmt = " %d";
	if (sizeof(T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class T> static void get2int(T& a, T& b) {
	const char* fmt = " %d %d";
	if (sizeof(T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class T> static void get3int(T& a, T& b, T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static const int EduDp_INF = 1100000000;

static void F_task();

#if 1
int main()
{
	F_task();
	fflush(stdout);
	return 0;
}
#endif

class F_data {
public:
	char c = 0;
	int len = 0;
	int fs = 0;
	int ft = 0;
	bool operator > (const F_data& a) {
		return this->len > a.len;
	}
};

static void F_task()
{
	const int strSize = 3000;
	char szS[strSize + 1] = { 0 };
	char szT[strSize + 1] = { 0 };

	scanf(" %s %s", szS, szT);
	int slen = strlen(szS);
	int tlen = strlen(szT);

	auto dp = new F_data[slen + 1][strSize + 1];

	for (int spos = 0; spos < slen; spos++) {
		std::string cs = "";
		bool add = false;
		for (int tpos = 0; tpos < tlen; tpos++) {
			if (szS[spos] == szT[tpos]) {
				dp[spos + 1][tpos + 1].len = dp[spos][tpos].len + 1;
				dp[spos + 1][tpos + 1].c = szS[spos];
				dp[spos + 1][tpos + 1].fs = spos;
				dp[spos + 1][tpos + 1].ft = tpos;
			}
			else {
				dp[spos + 1][tpos + 1] = tp_max<F_data>(dp[spos + 1][tpos], dp[spos][tpos + 1]);
			}
		}
	}

	std::string lcs = "";
	int fs, ft, nfs, nft;
	nfs = fs = slen;
	nft = ft = tlen;
	int len = dp[slen][tlen].len;
	while (len) {
		fs = nfs;
		ft = nft;
		lcs.insert(lcs.begin(), dp[fs][ft].c);

		nfs = dp[fs][ft].fs;
		nft = dp[fs][ft].ft;
		len--;
	}

	printf("%s\n", lcs.c_str());

	delete[] dp;
}


Measured memory_bytes: 140928
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

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

    if (S.size() % 2 != 0) {
        cout << "No" << endl;
        return 0;
    }
    for (int i = 0; i < S.size() - 1; i += 2) {
        if (S[i] != 'h' || S[i+1] != 'i') {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

long long int EasyPow(long long int x,long long int y,long long int z);

int main(){
 long long int m;
 long long int n;

 scanf("%lld %lld",&m,&n);

 printf("%lld\n",EasyPow(m,n,1000000007));

 return 0;
}

long long int EasyPow(long long int x,long long int y,long long int z){
 //if(y==0)return 1;
 long long int res=1;
 if(y>0){
 res=EasyPow(x,y/2,z); // ????????§?????°???y=0??????????????§
 
 //printf("[%u]\n",res);

 if(y%2==0)res=(res*res)%z;
 else res=(((res*res)%z)*x)%z; // ????????????1*x?????????????????¨?????????
 }
 return res;
 
}

Measured memory_bytes: 596
#include<iostream>
using namespace std;
main(){
  int te;  cin >> te;  while(te--){    int sum=0,data[8];    char temp;
    int state=0;    cin >> temp;    if ( temp == 'A'){      sum+=11;      state++;    }
    else if ( isdigit(temp)) sum+= temp-'0';    else sum+=10;    cin >> temp;    if ( temp == 'A'){
      if ( sum+11 <22){sum+=11;state++;}      else sum+=1;
    }    else if ( isdigit(temp)) sum+= temp-'0';    else sum+=10;    for(int i=0;i<8;i++){      cin >> temp;      if ( temp == 'A')data[i]=1;      else if ( isdigit(temp))data[i] = temp-'0';      else data[i] = 10;    }
    if ( sum == 21){
      puts("blackjack");
      continue;
    }
    for(int i=0;i<8;i++){
      if ( sum <=16  ||(  sum ==17 && state) ){
        if ( data[i] != 1)sum+=data[i];
        if ( data[i] == 1){
          if ( sum+11 <=21){
            sum+=11;
            state++;
          }
          else sum+=1;
        }
      }else break;
      if ( sum > 21){
        if ( state > 0){
          sum-=10;
          state--;
        }else break;
      }else if ( sum ==21)break;
    }
    if ( sum > 21)puts("bust");
    else cout << sum << endl;
  }
}

Measured memory_bytes: 0
import sys
import os
import math
import bisect
import itertools
import collections
import heapq
import queue
import array

# 時々使う
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

# 再帰の制限設定
sys.setrecursionlimit(10000000)


def ii(): return int(sys.stdin.buffer.readline().rstrip())
def il(): return list(map(int, sys.stdin.buffer.readline().split()))
def fl(): return list(map(float, sys.stdin.buffer.readline().split()))
def iln(n): return [int(sys.stdin.buffer.readline().rstrip())
                    for _ in range(n)]


def iss(): return sys.stdin.buffer.readline().decode().rstrip()
def sl(): return list(map(str, sys.stdin.buffer.readline().decode().split()))
def isn(n): return [sys.stdin.buffer.readline().decode().rstrip()
                    for _ in range(n)]


def lcm(x, y): return (x * y) // math.gcd(x, y)


MOD = 10 ** 9 + 7
INF = float('inf')


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

    N = ii()

    ret = 0
    for i in range(1, N):
        ret += (N - 1) // i
    print(ret)


if __name__ == '__main__':
    main()


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

int main()
{
    ll x, y;
    cin >> x >> y;

    if (abs(x- y) <= 1)
        cout << "Brown" << endl;
    else
        cout << "Alice" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 i, j, k, c[3][3], a[3], b[3];
  
  rep(i,3){
    rep(j,3){
      cin >> c[i][j];
    }
  }
  
  for(i=0;i<c[0][0]+1;i++){
    a[0]=i;
    b[0]=c[0][0]-i;
    for(j=0;j<c[1][1]+1;j++){
      a[1]=j;
      b[1]=c[1][1]-j;
      for(k=0;k<c[2][2]+1;k++){
        a[2]=k;
        b[2]=c[2][2]-k;
        if(c[0][1]==i+c[1][1]-j && c[0][2]==i+c[2][2]-k && c[1][0]==j+c[0][0]-i && c[1][2]==j+c[2][2]-k && c[2][0]==k+c[0][0]-i && c[2][1]==k+c[1][1]-j){
          cout << "Yes";
          return 0;
        }
      }
    }
  }
  cout << "No";
}

Measured memory_bytes: 3644
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		//持っているトランプの数
		int intTotal = scan.nextInt();
		int[] arrayS = new int[13];
		int[] arrayH = new int[13];
		int[] arrayC = new int[13];
		int[] arrayD = new int[13];

		//それぞれのマークの配列に１から１３を代入
		for(int i = 1 ;i <= 13;i++){
			arrayS[i-1] = i;
			arrayH[i-1] = i;
			arrayC[i-1] = i;
			arrayD[i-1] = i;
		}

		//要素数がintTotal個の配列を宣言
		//マークと数字を別でとるため * 2
		String[] array = new String[intTotal * 2];

		//intTotal回Scannerで入力されたマークと数字を読み取っていく
		for(int i = 0 ;i < intTotal * 2;i+=2){
			//マークの読み取り
			array[i] = scan.next();
			//数字の読み取り
			array[i + 1] = scan.next();
		}


		//要素数2nでマークを判定、
		for(int i = 0 ;i < intTotal * 2;i+=2){
			//array[2n]が"S"のとき
			if(array[i].equals("S")){

				//マークの配列の数とarray[n+1]の配列を比較
				//同じなら比較したマークの配列の数を０にする
				for(int j = 0 ;j < 13;j++){
					if(arrayS[j] == Integer.parseInt(array[i+1])){
						arrayS[j] = 0;
					}
				}
			}
			//array[2n]が"H"のとき
			if(array[i].equals("H")){
				for(int j = 0 ;j < 13;j++){
					if(arrayH[j] == Integer.parseInt(array[i+1])){
						arrayH[j] = 0;
					}
				}
			}
			//array[2n]が"C"のとき
			if(array[i].equals("C")){
				for(int j = 0 ;j < 13;j++){
					if(arrayC[j] == Integer.parseInt(array[i+1])){
						arrayC[j] = 0;
					}
				}
			}
			//array[2n]が"D"のとき
			if(array[i].equals("D")){
				for(int j = 0 ;j < 13;j++){
					if(arrayD[j] == Integer.parseInt(array[i+1])){
						arrayD[j] = 0;
					}
				}
			}
		}
		//配列が0のものは持っているものなので出力しない
		for(int i = 0; i < 13;i++){
			if(arrayS[i] > 0 ){
				System.out.println("S " + arrayS[i]);
			}
		}
		for(int i = 0; i < 13;i++){
			if(arrayH[i] > 0 ){
				System.out.println("H " + arrayH[i]);
			}
		}
		for(int i = 0; i < 13;i++){
			if(arrayC[i] > 0 ){
				System.out.println("C " + arrayC[i]);
			}
		}
		for(int i = 0; i < 13;i++){
			if(arrayD[i] > 0 ){
				System.out.println("D " + arrayD[i]);
			}
		}
		scan.close();
	}
}



Measured memory_bytes: 26292
#include<bits/stdc++.h>
using namespace std;
string s,b;
int main()
{
    cin>>s;
    int len=s.length();
    b=s;
    reverse(s.begin(),s.end());
    if(len&1)
    {
        cout<<"No"<<endl;
        return 0;
    }
    for(int i=0;i<len;i++)
    {
        if(b[i]=='b')b[i]='d';
        else if(b[i]=='d')b[i]='b';
        else if(b[i]=='p')b[i]='q';
        else b[i]='p';
    }
    if(b==s)
    cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
 } 

Measured memory_bytes: 512
/*
 * How Many Divisors.c
 *
 *  Created on: 2015/02/13
 *
 */
#include <stdio.h>


int main(void){
	int a,b,c,d;
	int i,count=0;

	scanf("%d %d %d",&a,&b,&c);

	for(i=a;i<=b;i++){
		if(c%i==0)count++;
	}
	printf("%d\n",count);

	return 0;
}

Measured memory_bytes: 596
import sys; readline = sys.stdin.readline
from collections import deque


A, B = map(int, readline().split())

def f(a, b):
    if a < b:
        a, b = b, a

    while True:
        if a % b == 0:
            break
        r = a % b
        a, b = b, r
    
    return b

c = f(A, B)

print(A * B // c)

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
main(){
    int A,B,M;
	cin>>A>>B>>M;
	vector<int>a(A),b(B);
	int amin=2e6,bmin=2e6;
    for(auto&p:a){
		cin>>p;
		amin=min(amin,p);
	}
    for(auto&p:b){
		cin>>p;
		bmin=min(bmin,p);
	}
	int ans=amin+bmin;
    for(int i=0;i<M;++i){
        int x,y,c;
		cin>>x>>y>>c;
        ans=min(ans,a[x-1]+b[y-1]-c);
	}
	cout<<ans;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int n,a;
	scanf("%d",&n);
	if(65<=n && n<=90){
		a=1;
	}
	else if(97<=n && n<=122){
		a=2;
	}
	else{
		a=0;
	}
	printf("%d\n",a);
	return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;
typedef long long ll;

bool check_prime(int x) {
    int s = (int) floor(sqrt(x));
    for (int a = 2; a <= s; a++) {
        if (x % a == 0) return false;
    }
    return true;
}

int main() {
    int X;
    cin >> X;
    while (true) {
        if (check_prime(X)) {
            break;
        }
        X += 1;
    }
    cout << X << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define ces(d) cout<<" "<<endl;

int main() {

int N;
map<string,int> color;

cin>>N;

fx(N){
	int k;
	cin>>k;
	if(k<400){
		color["g"]++;
	}else if(k<800){
		color["br"]++;
	}else if(k<1200){
		color["gr"]++;
	}else if(k<1600){
		color["wb"]++;
	}else if(k<2000){
		color["b"]++;
	}else if(k<2400){
		color["y"]++;
	}else if(k<2800){
		color["o"]++;
	}else if(k<3200){
	    color["r"]++;
	}else {
	    color["l"]++;
	}
	
}
int min,max;
if(color["l"]==0){
	min=color.size()-1;
	max=min;
}else{
	min=color.size()-1;
max=min+color["l"];

if(min==0){min=1;}
}

cout<<min<<" "<<max<<endl;

}

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


int main() {
    long long n, ans = 0, x, y,d, dd, dis;
    cin >> n >> d;
    dd = d * d;
    for (int i = 0; i < n; i++) {
        cin >> x >> y;
        dis = x * x + y * y;
        if (dis <= dd) {
            ans++;
        }
    }

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

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

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

	int N; cin >> N;
	vector<vector<pair<int, bool>>> V(N+1);
	for (int i = 1; i <= N; i++) {
		int A; cin >> A;
		for (int j = 0; j < A; j++) {
			int x; bool y; cin >> x >> y;
			V[i].push_back(pair<int, bool>(x, y));
		}
	}

	int M = 1;
	for (int i = 0; i < N; i++) M *= 2;
	int ans = 0;
	for (int i = 0; i < M; i++) {
		bool d[15];
		for (int j = 0; j < N; j++) d[j+1] = (i >> j) & 1;
		bool flag = true;
		// 矛盾がないか確かめる
		for (int j = 1; j <= N && flag; j++) {
			if (d[j]) {
				for (int k = 0; k < V[j].size() && flag; k++) {
					if (V[j][k].second != d[V[j][k].first]) flag = false;
				}
			}
		}

		if (flag) {
			int sum = 0;
			for (int j = 1; j <= N; j++) if (d[j]) sum++;
			ans = max(ans, sum);
		}
	}

	cout << ans << endl;
	

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
#include <numeric>
using namespace std;


typedef long long       ll;
typedef struct edge_ { ll to; ll cost; } edge;
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef vector<edge>    ve;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<vi>		vvi;
typedef vector<ve>      vve;
typedef vector<vc>		vvc;

#define repr(itr, bgn, end) for (ll itr = (ll)bgn; itr < (ll)end; ++itr)
#define rep(itr, end) repr(itr, 0, end)
#define reprrev(itr, bgn, end) for (ll itr = (ll)end - 1; itr >= (ll)bgn; --i)
#define reprev(itr, end) reprrev(itr, 0, end)
#define all(container) container.begin(), container.end()
#define sortall(container) sort(all(container))
#define yn(cond) cond ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(cond) cond ? (cout << "YES" << endl) : (cout << "NO" << endl)

// 定数
#define LLONG_MAX numeric_limits<ll>::max()
#define INT_MAX numeric_limits<int>::max()
constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 15;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;

// よく使うもの
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	for (T& x : vec) os << x << " ";
	return os;
}


int dfs(string s, ll N) {

	ll n = stoll(s);

	if (n > N) return 0;

	bool i3, i5, i7; i3 = i5 = i7 = false;
	while (n > 0) {
		if (n % 10 == 3) i3 = true;
		else if (n % 10 == 5) i5 = true;
		else if (n % 10 == 7) i7 = true;
		n /= 10;
	}

	int ret = 0;
	if (i3 && i5 && i7) ret++;

	ret += dfs(s + "3", N);
	ret += dfs(s + "5", N);
	ret += dfs(s + "7", N);

	return ret;
}


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

	cout << dfs("0", N) << endl;

	return 0;
}

Measured memory_bytes: 256