akhauriyash/Code-Regression huggingface dataset:
/*
   Created by Rahul Goel.
*/

#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
ll mod = 1000000007;
const int INF = 1e9;
const ll LINF = 1e18;

#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(c) (c).begin(), (c).end()
#define pii pair < int, int >
#define vi vector < int >
#define vb vector < bool >
#define vvi vector < vector < int > >
#define vvb vector < vector < bool > >
#define vpii vector < pair < int, int > >
#define vvpii vector < vector < pair < int, int > > >
#define pb push_back
#define f first
#define s second
#define mp make_pair

int main(){
    fastio;
    
    ll n;
    cin >> n;
    ll sum = n*(n+1)/2;
    ll temp = 0;
    for(ll i=1; i<=n; i++)
        if(i%3 == 0 || i%5 == 0)
            temp += i;
    cout << sum - temp << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int N,M,R;
int inf=1e8;
int r[10];
int d[200][200];
int ans;
bool v[10];
vector<int> route;

void dfs(int depth){
  if(depth>=R){
    int temp=0;
    FOR(i,1,R){
      temp+=d[r[route[i]]][r[route[i-1]]];
    }
    // cerr<<temp<<endl;
    ans=min(ans,temp);
    // for(auto i:route)cerr<<i<<" ";
    // cerr<<endl;
  }else{
    REP(i,R){
      if(v[i])continue;
      route.push_back(i);
      v[i]=true;
      dfs(depth+1);
      route.pop_back();
      v[i]=false;
    }
  }
}


int main(){
  cin>>N>>M>>R;
  REP(i,R){
    cin>>r[i];
    r[i]--;
  }
  REP(i,N)REP(j,N)d[i][j]=(i==j?0:inf);
  REP(i,M){
    int a,b,t;
    cin>>a>>b>>t;
    a--;b--;
    d[a][b]=t;d[b][a]=t;
  }
  REP(k,N)REP(i,N)REP(j,N)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);


  ans=inf;
  REP(i,R)v[i]=false;
  dfs(0);
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 632
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {
    string s;
    cin >> s;
    int n = (int)s.size();

    int ans = n + 1, cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] == '0' && i % 2 == 0) ++cnt;
        if (s[i] == '1' && i % 2 == 1) ++cnt;
    }
    ans = min(ans, cnt);

    cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] == '0' && i % 2 != 0) ++cnt;
        if (s[i] == '1' && i % 2 != 1) ++cnt;
    }
    ans = min(ans, cnt);

    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	string s;
	cin >> s;

	int n = s.size();
	int ans = INF;
	rep(i, n - 2) {
		int a = stoi(s.substr(i, 3));
		chmin(ans, abs(a - 753));
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define ll long long
#define rg register
struct ios{
	template<typename TP>
	inline ios operator >> (TP &x)
	{
		TP f=1;x=0;rg char c=getchar();
		for(;c>'9' || c<'0';c=getchar()) if(c=='-') f=-1;
		for(;c>='0' && c<='9';c=getchar()) x=(x<<3)+(x<<1)+(c^'0');
		x*=f;
		return *this;
	}
	template<typename TP>
	inline ios operator << (TP x)
	{
		int top=0,s[66];
		if(x<0) x=-x,putchar('-');
		if(!x) putchar ('0');
		while(x) s[++top]=x%10+'0',x/=10;
		while(top) putchar(s[top--]);
		return *this;
	}
	inline ios operator << (char s)
	{
		putchar(s);
		return *this;
	}
}io;
#define int ll 
const int N=1e5+5;
const int p=998244353;
int n,d[N],cnt[N],ans=1;
inline int pow(int a,int b)
{
	int ans=1;
	for(;b;b>>=1)
	{
		if(b&1) ans=(ll)ans*a%p;
		a=(ll)a*a%p; 
	}
	return ans%p;
}
signed main()
{
	io>>n;bool flag=false;
	for(rg int i=1;i<=n;++i) io>>d[i],++cnt[d[i]];
	for(rg int i=1;i<=n;++i)
		if(cnt[i] && !cnt[i-1]) {puts("0");return 0;}
	if(cnt[0]>1) {puts("0");return 0;}
	if(d[1]!=0) {puts("0");return 0;}
	for(rg int i=1;i<=n;++i)
	{
		if(!cnt[i]) break;
		ans=(ll)ans*pow(cnt[i-1],cnt[i])%p;
	}
	io<<ans;
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef long double ld;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n, m; cin >> n >> m;

	int ans = 0;
	for(int i = 1; i <= floor(sqrt(m)); i++){
		if (m%i==0){
			if (m/i >= n){
				ans = i;
			}
			else{
				break;
			}
			
			if (i >= n){
				ans = m/i;
				break;
			}
		}
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]
N,Q=map(int,input().split())
a=list(map(int,input().split()))
class BIT:
    def __init__(self,len_A):
        self.N = len_A + 10
        self.bit = [0]*(len_A+10)
    # sum(A[0] ~ A[i-1])
    def query(self,i):
        res = 0
        while i:
            res += self.bit[i]
            i -= i&(-i)
        return res
    # A[i] += x
    def update(self,i,x):
        idx = i+1
        while idx < self.N:
            self.bit[idx] += x
            idx += idx&(-idx)
    def __str__(self):
        return f"{self.bit}"
b=BIT(N)
for i in range(N):
    b.update(i,a[i])
for i in range(Q):
    p,q,r=map(int,input().split())
    if p:
        print(b.query(r)-b.query(q))
    else:
        b.update(q,r)

Measured memory_bytes: 132480
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define ARRAY_LENGTH(array) sizeof(array)/sizeof(*array)
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; }
const int INF = 1000100100;

using Graph = vector<vector<ll>>;

int main() {
    ll N, M;
    cin >> N >> M;

    Graph G(N + 1);
    REP(i, M) {
        ll a, b;
        cin >> a >> b;
        G.at(a).emplace_back(b);
        G.at(b).emplace_back(a);
    }

    FOR(i, 1, N + 1) {
        ll ans = G.at(i).size();
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int x, y, z; cin >> x >> y >> z;
    cout << (x-z)/(y+z) << endl;
}

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

using namespace std;

int a,b,c,x,y;

template<typename Drake>
void read(Drake &x){
	x=0;char ch=getchar();bool f=1;
	while(!isdigit(ch)){
		if(ch=='-')f^=1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	x*=(2*f-1);
}

template<typename Drake>
void write(Drake x){
	if(x<0){x=-x;putchar('-');}
	if(x>9)write(x/10);
	putchar(x%10+'0');
}

template<typename Drake>
void writeln(Drake x){
	write(x);
	puts("");
}

void init(){
	int z;
	read(a);read(b);read(c);read(x);read(y);
	if(x>y){
		z=y;
		y=x;
		x=z;
		z=a;
		a=b;
		b=z;
	}
}

int main(){
	init();
	c*=2;
	int ans1=0,ans2=0,ans3=0;
	ans1=c*x+(y-x)*b;
	ans2=a*x+b*y;
	ans3=c*y;
	cout<<min(ans1,min(ans2,ans3))<<endl;
	return 0;
}

Measured memory_bytes: 256
//10のi乗pow(10, i);
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i,n) cin>>p.at(i);
  int count=0;
  for(int i=1;i<n-1;i++){
    int ma= p.at(i);
    int mi= p.at(i);
	for(int j=0;j<3;j++){
      ma = max(ma,p.at(i+j-1));
      mi = min(mi,p.at(i+j-1));
    }
//  cout << "count" << endl;
  if(p.at(i)!=ma && p.at(i)!=mi)count++;
  }

  cout << count << endl;
}


Measured memory_bytes: 256
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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 y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#pragma endregion RegionDefs

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll a[100005];
ll s[100005];

void solve()
{
    COMinit();
    IN(n, k);
    rep(i, n)
    {
        cin >> a[i];
    }
    sort(a, a+n);
    s[0] = 0;
    reps(i, 0, n+1)
    {
        s[i+1] = a[i] + s[i];
    }
    ll sum = 0;
    reps(i, k-2, n-1)
    {
        ll k0 = (s[n]-s[i+1])%MOD;
        ll k1 = (s[n-i-1]-s[0])%MOD;
        sum = (sum + (k0-k1)*COM(i, k-2) % MOD) % MOD;
    }
    cout << sum << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 13824
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <stdio.h>
#include <set>
#include <vector>
using namespace std;


int main(){
    int r, g, b, n;
    cin>>r>>g>>b>>n;
    int ans = 0;
    int i, j, k;
    for(i=0; i*r<=n; i++){
        for(j=0; j*g<=(n-r*i); j++){
            if((n-r*i-j*g)%b==0){
                    ans++;
            }
        }
    }

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

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
int main(){
    char a,b;
    cin>>a>>b;
    if(a=='H'){
        cout<<b<<endl;
    }else{
        if(b=='H')cout<<'D'<<endl;
        else cout<<'H'<<endl;
    }
}

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

using namespace std ;

const int MAX = 1e5 + 10 ;

int arr[MAX] ;
int x , y ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>x>>y ;
	int ans = 100000 * max(0 , 4 - x) ;
	ans += 100000 * max(0 , 4 - y) ;
	if(x == 1 && y == 1)
		ans += 4 * 100000 ;
	return cout<<ans<<"\n" , 0 ;
}		

Measured memory_bytes: 3652
#include <stdio.h>
#include <vector>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    long Q;
    scanf("%ld", &Q);
    std::vector<long> A{0};
    long x;
    scanf("%ld",&x);
    scanf("%ld",&A[0]);
    long B;
    scanf("%ld",&B);
    long min=0;
    long l=1;
    for(long i=1;i<Q;i++){
        long Query[3];
        scanf("%ld",&Query[0]);
        if(Query[0]==1){
            scanf("%ld",&Query[1]);
            scanf("%ld",&Query[2]);
            l++;
            if(l%2==1){
                x=l/2;
                if(Query[1]<A[x-1]){
                    min=min+A[x-1]-Query[1];
                }
                else if(Query[1]>A[x]){
                    min=min+Query[1]-A[x];
                }
            }else{
                x=(l-1)/2;
                min=min+abs(A[x]-Query[1]);
            }
            auto Ait = A.end();
            Ait--;
            if(*Ait<=Query[1]){
                A.push_back(Query[1]);
            }else{
                auto itr = upper_bound(A.begin(),A.end(),Query[1]);
                itr=A.insert(itr,Query[1]);
            }
            B=B+Query[2];
        }else{
            x=(l-1)/2;
            printf("%ld ",A[x]);
            printf("%ld\n",min+B);
        }
        
    }

    return 0;
}

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

int main() {
    long long q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;
    
    long long ans = 0;
    double a = q*4, b = h*2, c = s, e = (double)d/2;
    double mn = min({a, b, c, e});
    if (mn == a) ans = q * 4 * n;
    else if (mn == b) ans = h * 2 * n;
    else if (mn == c) ans = n * s;
    else if (mn == e) {
        ans = (n/2) * d;
        if (n&1) {
            double m = min({a, b, c});
            if (m == a) ans += q * 4;
            else if (m == b) ans += h * 2;
            else if (m == c) ans += s;
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int a;
  cin>>a;
  if(a<105)
    cout<<0<<endl;
  if(a>104&&a<135)
    cout<<1<<endl;
  if(a>134&&a<165)
    cout<<2<<endl;
  if(a>164&&a<189)
cout<<3<<endl;
  if(a>188&&a<195)
    cout<<4<<endl;
  if(a>194)
    cout<<5<<endl;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if ((i % 3 != 0) && (i % 5 != 0)) {
      ans += (long long) i;
    }
  }
  cout << ans << '\n';
  return 0;
}

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

typedef vector <int> VI;

int main( void )
{
	int n; // Ü·ß
	int m; // ³¢±ë

	while ( cin >> n >> m && n && m )
	{
		VI field(n);
		for ( int i = 0; i < n; i++ ) cin >> field[i];
		VI dices(m);
		for ( int i = 0; i < m; i++ ) cin >> dices[i];

		int now = 0;
		int times = 0;
		for ( times = 0; times < m; times++ )
		{
			now += dices[times];
			if ( now >= n - 1 ) break;
			now += field[now];
			if ( now >= n - 1 ) break;
		}
		cout << times + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 0
/*
    ____        __
   / __ \____  / /_  ____ _____ ___
  / /_/ / __ \/ __ \/ __ `/ __ `__ \
 / _, _/ /_/ / / / / /_/ / / / / / /
/_/ |_|\____/_/ /_/\__,_/_/ /_/ /_/
*/
#include<bits/stdc++.h>

typedef long long ll ;

#define pll pair<ll , ll >
#define X   first
#define Y   second
#define mp  make_pair
#define pii pair<int , int>
#define vec vector
#define vpii vector<pair<int , int>>
#define i_n   int i = 0 ; i< n ; i++
#define cn  int n ; cin>>n
#define file_io freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define cina int a[n] ; for(int i = 0 ; i < n ; i++) cin>>a[i]
#define pb push_back

using namespace std;
const int maxn = 1000*100+5 ;
const ll inf = 9223372036854775807 ;


int main()
{
	migmig ;
	int n  , k;
	cin>>n>>k ; 
	 cout<<max( (10 - n) * 100 + k , k) ; 

}
//////
////////
///////////




Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
const long long mod = 1000000007;
long long dp2[500][500], r[500], dp[500][500];
vector<int>X[500];
int N, cnts;
inline long long ncr(long long n, long long r) {
	if (n - r < 0 || r < 0)return 0;
	return dp2[n - r][r];
}
inline long long solve(int p, int q) {
	if (dp[p][q] >= 0)return dp[p][q];
	if (X[p].size() == 0) {
		if (q == 1) { dp[p][q] = 1; return 1; }
		if (q != 1) { dp[p][q] = 0; return 0; }
	}
	if (q == 0)return 0;
	vector<vector<long long>>dp3(N + 1, vector<long long>(N + 1, 0));
	dp3[0][0] = 1; q--;
	int cnt1 = 0;
	for (int i = 0; i < X[p].size(); i++) {
		long long a3[210]; for (int j = 0; j < N + 1; j++)a3[j] = 0;
		for (int j = 0; j < N; j++)a3[j] = solve(X[p][i], j);

		for (int j = 0; j <= cnt1; j++) {
			for (int k = 0; k <= r[X[p][i]] + 1; k++) {
				for (int l = 0; l <= k; l++) {
					int ko = j + l; if (ko > N)break;
					int res = j + k - ko;
					int LL = j - res;
					int RR = k - res;
					if (LL < 0 || RR < 0)continue;
					long long ans1 = dp3[i][j] * a3[k]; ans1 %= mod;
					ans1 *= ncr(LL + RR, RR); ans1 %= mod;
					ans1 *= ncr(ko, res); ans1 %= mod;
					dp3[i + 1][ko] += ans1;
					if (dp3[i + 1][ko] >= mod)dp3[i + 1][ko] -= mod;
					cnts++;
				}
			}
		}
		cnt1 += r[X[p][i]] + 1;
	}
	long long ret = dp3[X[p].size()][q];
	q++;
	dp[p][q] = ret;
	for (int i = 1; i <= N; i++)dp[p][i] = dp3[X[p].size()][i - 1];
	return ret;
}
int main() {
	bool E[500];
	for (int i = 0; i < 500; i++) {
		E[i] = false;
		for (int j = 0; j < 500; j++) {
			dp[i][j] = -1;
			if (i == 0 || j == 0)dp2[i][j] = 1;
			else dp2[i][j] = (dp2[i - 1][j] + dp2[i][j - 1]) % mod;
		}
	}
	cin >> N; int TT = 0;
	for (int i = 0; i < N - 1; i++) {
		int a, b; cin >> a >> b; E[b] = true;
		X[a].push_back(b);
	}
	for (int i = 0; i < N; i++) {
		queue<int>Q; int cnt = 0;
		Q.push(i);
		while (!Q.empty()) {
			cnt++; int a1 = Q.front(); Q.pop();
			for (int j = 0; j < X[a1].size(); j++) {
				Q.push(X[a1][j]);
			}
		}
		cnt--;
		r[i] = cnt;
	}
	for (int i = 0; i < N; i++) { if (E[i] == false)TT = i; }
	long long ans = 0;
	for (int i = 0; i <= N; i++) {
		ans += solve(TT, i); ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11112
N, K = map(int,input().split())
List = [list(map(int,input().split())) for i in range(2*K)]

Newlist = []
for i in range(K):
  Newlist.append(List[2*i+1])

Newlist2 = []
for i in range(K):
  for j in range(len(Newlist[i])):
    Newlist2.append(Newlist[i][j])


print(N-len(set(Newlist2)))

Measured memory_bytes: 9376
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

vector<int> adj[2500], dist(2500);
bool used[2500];


int main(){
	FIO
	
	int n, x, y;
	cin >> n >> x >> y;
	x--;y--;
	adj[x].push_back(y);
	adj[y].push_back(x);
	for(int i = 0; i < n - 1; i++){
		adj[i].push_back(i + 1);
		adj[i + 1].push_back(i);
	}
	map<int, int> cnt;
	for(int i = 0; i < n; i++){
		queue<int> q;
		vector<bool> used(n);
		vector<int> d(n), p(n);
		q.push(i);
		used[i] = true;
		p[i] = -1;
		while (!q.empty()) {
			int v = q.front();
			q.pop();
			for (int u : adj[v]) {
				if (!used[u]) {
					used[u] = true;
					q.push(u);
					d[u] = d[v] + 1;
					p[u] = v;
				}
			}
		}
		for(int j = 0 ; j < n; j++)cnt[d[j]]++;
	}
	for(int i = 1; i <= n - 1; i++)cout << cnt[i] / 2 << '\n';
	return 0; 
}


Measured memory_bytes: 512
//【ライブラリここから】
// 1. 入力の容易化（https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8）
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
//【ライブラリここまで】

fn main() {
    input! {
        x: i64,
        k: i64,
        d: i64
    }
    let remain_count = k - if x >= 0 { x / d } else { (-x) / d };
    let remain_dist = if x >= 0 { x % d } else { (-x) % d };
    if remain_count <= 0 {
        println!("{}", if x >= 0 { x } else { -x } - k * d);
    } else if remain_count % 2 == 1 {
        println!("{}", d - remain_dist);
    } else {
        println!("{}", remain_dist);
    }
}


Measured memory_bytes: 2184
def unite(x,y):
	rx=root(x)
	ry=root(y)
	if rank[rx]<rank[ry]:
		parent[rx]=ry
	else:
		parent[ry]=rx
		if rank[rx]==rank[ry]:
			rank[rx]+=1
def same(x,y):
	return root(x)==root(y)
def root(x):
	if x!=parent[x]:
		x=root(parent[x])
	return x
n,m=map(int,input().split())
parent=list(range(n+m))
rank=[0]*(n+m)
for i in range(n):
	l=list(map(int,input().split()))
	del l[0]
	for x in l:
		unite(n+x-1,i)
for i in range(n-1):
	if root(i)!=root(i+1):
		print("NO")
		exit()
print("YES")


Measured memory_bytes: 19296
#include<iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	int a[10],max=0,sum=0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (max < a[i])
			max = a[i];
		sum += a[i];
	}
	if (sum - max > max)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <algorithm>
 
using namespace std;
 
#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
 
typedef long long ll;
 
const int MOD = 1000000007;
const int INF = 1000000007;
const ll INFLL = 1000000000000000007LL;
 
void solve() {
  string S;
  int Q;
  cin >> S >> Q;
  string head = "";
  string tail = "";
  int R = 0;
  for (int i = 0; i < Q; i++) {
    int T;
    cin >> T;
    if (T == 1) {
      R++;
      swap(head, tail);
    } else {
      int F;
      char C;
      cin >> F >> C;
      if (F == 1) {
        head = head + C;
      } else {
        tail = tail + C;
      }
    }
  }
  for (int i = head.size() - 1; i >= 0; i--) {
  	cout << head[i];
  }
  if (R % 2 == 1) {
  	for (int i = S.size() - 1; i >= 0; i--) {
  	  cout << S[i];
  	}
  } else {
  	for (int i = 0; i < S.size(); i++) {
  	  cout << S[i];
    }
  }
  cout << tail << endl;
}
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // cout << fixed << setprecision(12);
 
  solve();
 
  return 0;
}

Measured memory_bytes: 1424
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)

void chmax(ll& a, ll b) { a = max(a, b); }
void chmin(ll& a, ll b) { a = min(a, b); }

using P = pair<int, int>;

const int MAX_N = 1e5+5;
const int INF = 1001001001;

vector<int> a, ans;
int dp[MAX_N][3];

ll modnum = 1e9+7;

using Graph = vector<vector<int>>;
Graph to(MAX_N);

void dfs(int u, int count=0, int rem=2) {
    if(rem == -1) {
        count++;
        rem = 2;
    }

    if(dp[u][2-rem] <= count) {
        return;
    } else {
        dp[u][2-rem] = count;
    }

    for(auto v : to[u]) {
        dfs(v, count, rem-1);
    }

}

int main() {
    int n,m; cin >> n >> m;
    rep(i, m) {
        int u,v; cin >> u >> v;
        u--; v--;
        to[u].push_back(v);
    }
    int s,t; cin >> s >> t;
    s--; t--;

    rep(i, MAX_N) rep(j,3) dp[i][j] = INF;
    queue<P> que;
    que.emplace(s, 0);
    while(!que.empty()) {
        P p = que.front();
        que.pop();
        if(dp[p.first][p.second%3] > p.second/3) {
            dp[p.first][p.second%3] = p.second/3;
            for(auto u : to[p.first]) {
                que.emplace(u, p.second+1);
            }
        }
    }

    if(dp[t][0] == INF) {
        cout << -1 << endl;
    } else {
        cout << dp[t][0] << endl;
    }

    return 0;
}


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

using namespace std;
typedef long long ll;

const int N = 100010;
int n;
int a[N];

int main() {
    scanf("%d", &n);
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        sum += a[i];
    }
    sort(a, a + n);
    for (int i = n - 1; i >= 0; i--) {
        sum -= a[i];
        if (2 * sum < a[i]) {
            printf("%d\n", n - i);
            return 0;
        }
    }
    assert(false);
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
    string n;
    cin >> n;
    long int i;
    long long int a = 0;
    for (i = 0; i < n.size(); i++)
    {
        a += (n.at(i) - '0');
    }
    if (a % 9 == 0)
    {
        cout << "Yes" << endl;
    }
    else
        cout << "No" << endl;
    
}

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

#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = (int)a; i <= (int)b; ++i)
#define sz(s) (int)s.size()
#define all(v) v.begin(),v.end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll inf = (ll)1e18;
const ll N = (ll)2e5+77;
const ll mod = (ll)1e9+7;

ll n,m,k,l,r,x,y,a[N];

int main() {
    fast;
    cin >> k;
    for1(i, k) cin >> a[i];
    x = y = 2;
    for (int i = k; i > 0; i--) {
        if (y / a[i] - (x - 1) / a[i] == 0) return cout << "-1\n", 0;
        l = (x + a[i] - 1) / a[i] * a[i];
        r = y / a[i] * a[i] + a[i] - 1;
        x = l;
        y = r;
    }
    cout << x << " " << y << endl;
    return 0;
}

Measured memory_bytes: 1024
module M = Map.Make(struct type t = int * int let compare = compare end)

let rec seq a b = if a > b then [] else a :: seq (a+1) b
let (>>=) xs f = List.map f xs |> List.concat

let inc x y m =
  try M.add (x, y) (1 + M.find (x, y) m) m
  with Not_found -> M.add (x, y) 1 m

let () =
  Scanf.scanf "%d %d %d" @@ fun h w n ->
  let a = Array.init n (fun _ -> Scanf.scanf " %d %d" (fun x y -> x, y)) in
  let ret = Array.make 10 0 in
  a |> Array.fold_left (fun m1 (x, y) ->
    seq (max 1 (x-2)) (min (h-2) x) >>= (fun i -> seq (max 1 (y-2)) (min (w-2) y) >>= (fun j -> [(i, j)]))
    |> List.fold_left (fun m2 (i, j) -> inc i j m2) m1
  ) M.empty
  |> M.iter (fun (x, y) v ->
      ret.(v) <- ret.(v) + 1);
  
  let cur = Array.fold_left (+) 0 ret in
  ret.(0) <- (h-2)*(w-2) - cur;
  Array.iter (Printf.printf "%d\n") ret

Measured memory_bytes: 99960
#include <stdio.h>

main(){

  int i, j, n, m, l;
  int e[101][101];

  scanf("%d", &n);

  for(i = 1; i <= n; i++){
    scanf("%d %d", &e[i][0], &m);

    for(j = 1; j <= n; j++){ 
      e[i][j] = 0;
    }
    
    for(j = 1; j <= m; j++){
      scanf("%d", &l);
      e[i][l] = 1;
    }

  }

  for(i = 1; i <= n; i++){
    for(j = 1; j < n; j++){
      printf("%d ", e[i][j]);
    }
    printf("%d\n", e[i][j]);
  }

  return 0;

}

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

int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(NULL);
    int n,i,j;
    cin >> n;
    int arr[n+1][3];
    for(i=1;i<=n;i++){
        for(j=0;j<=2;j++){
            cin >> arr[i][j];
        }
    }
   
    int dp[n+1][3];//val[n][3];
    for(i=0;i<=2;i++){
    dp[0][i]=0;
    dp[1][i]=arr[1][i];
   // val[1][i]=i;
    }
    for(i=2;i<=n;i++){
       dp[i][0] = arr[i][0] + max(dp[i-1][1],dp[i-1][2]);
       dp[i][1] = arr[i][1] + max(dp[i-1][0],dp[i-1][2]);
       dp[i][2] = arr[i][2] + max(dp[i-1][0],dp[i-1][1]);
    }
    
    cout << max(dp[n][0],max(dp[n][1],dp[n][2]));
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int n;
  cin>>n;
  int p[n * n];
  REP(i, n * n) {
    cin>>p[i];
    p[i]--;
  }
  auto valid = [&n](int i, int j) -> bool {
    return 0 <= i && i < n && 0 <= j && j < n;
  };
  auto conv = [&n](int i, int j) -> int {
    return n * i + j;
  };
  int dist[n][n];
  REP(i, n){
    REP(j, n){
      int x = min(i, n - 1 - i);
      int y = min(j, n - 1 - j);
      dist[i][j] = min(x, y);
    }
  }
  /*
  REP(i, n){
    REP(j, n){
      cout << dist[i][j] << ' ';
    }
    cout << endl;
  }
  */
  bool exists[n][n];
  REP(i, n) REP(j, n) exists[i][j] = true;
  int ans = 0;
  typedef pair<int, int> P;
  int dx[] = {1, 0, -1, 0};
  int dy[] = {0, 1, 0, -1};
  REP(num, n * n){
    /*
    REP(i, n){
      REP(j, n){
        cout << dist[i][j] << ' ';
      }
      cout << endl;
    }
    cout << endl;
    */
    int i = p[num] / n;
    int j = p[num] % n;
    exists[i][j] = false;
    ans += dist[i][j];
    //cout << ans << endl;
    queue<P> q;
    q.push(P(i, j));
    while(!q.empty()){
      P p = q.front();
      q.pop();
      int x = p.first, y = p.second;
      REP(k, 4){
        int nx = x + dx[k], ny = y + dy[k];
        if(!valid(nx, ny)) continue;
        if(exists[x][y]){
          if(dist[x][y] + 1 < dist[nx][ny]){
            dist[nx][ny] = dist[x][y] + 1;
            q.push(P(nx, ny));
          }
        }else{
          if(dist[x][y] < dist[nx][ny]){
            dist[nx][ny] = dist[x][y];
            q.push(P(nx, ny));
          }
        }
      }
    }
  }
  cout << ans << endl;   
  return 0;
}

Measured memory_bytes: 5912
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
#define fst first
#define snd second
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
ll a[(ll)(3e5+4)];
int main() 
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	ll n; cin>>n;
	for (ll i=0;i<3*n;i++) cin>>a[i];
	sort(a,a+3*n);
	ll ans=0;
	for (ll x=n;x<3*n;x+=2) {
		ans+=a[x];
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 2560
#include <stdio.h>
int main()
{
   	int n;
   	scanf("%d", &n);
   	char input[n];
   	int flag = 1;
   	scanf("%s", input);
   	if(n % 2 != 0)
   	{
	   puts("No");
	} else
	{
		for (int i = 0; i < n/2;i++)
		{
			if(input[i] != (input[(n/2)+i]))
			{
				flag = 0;
			}
		}
		if(flag == 1)
		{
			puts("Yes");
		} else
		{
			puts("No");
		}
	}
   	
	
	return 0;
} 

Measured memory_bytes: 1640
#include <bits/stdc++.h>
#define dcout cout << fixed << setprecision(15)
#define rep(i, a) for(int i = 0; i < a; i++)
#define arep(i, x) for(auto i : x)
#define all(v) v.begin(), v.end()
#define int long long
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
using namespace std;
signed main() {
    int a;
    cin >> a;
    int i = 1;
    int min = 1000000000001;
    int dis;
    while(i <= sqrt(a) + 1) {
        if(a % i == 0) {
            dis = (a / i - 1) + (i - 1);
            if(min > dis) min = dis;
        }
        i++;
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include<math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i =0; i < (int)(n); i++)



int main() {
    double R;
    cin >> R;
    
    cout << R * 6.283185307179 << endl;
    
    return 0;
}

Measured memory_bytes: 3744
#include <cstdio>

const int MN = 100005;

int N, A[3][MN], B[MN];
int bit[MN];
inline void Add(int i) { for (; i; i -= i & -i) bit[i] ^= 1; }
inline int Qur(int i) { int s = 0; for (; i <= N; i += i & -i) s ^= bit[i]; return s; }

int main() {
	scanf("%d", &N);
	for (int j = 0; j < 3; ++j)
		for (int i = 1; i <= N; ++i)
			scanf("%d", &A[j][i]);
	int p1 = 0, p2 = 0;
	for (int i = 1; i <= N; ++i) {
		if (A[1][i] % 3 != 2 || A[0][i] + A[2][i] != 2 * A[1][i]) return puts("No"), 0;
		int x = A[1][i] / 3 + 1;
		if ((A[0][i] + 2) / 3 != x || ((B[i] = x) ^ i) & 1) return puts("No"), 0;
		if (A[0][i] == x * 3) (i & 1 ? p2 : p1) ^= 1;
	}
	for (int i = 1; i <= N; i += 2)
		p1 ^= Qur(B[i]), Add(B[i]);
	for (int i = 1; i <= N; ++i) bit[i] = 0;
	for (int i = 2; i <= N; i += 2)
		p2 ^= Qur(B[i]), Add(B[i]);
	puts(p1 || p2 ? "No" : "Yes");
	return 0;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define int long long int
#define rep(i,a,b)	for(i=a;i<b;i++)
using namespace std;
vector<vector<int> >adj(100005);
int in[100005];
bool vis[100005];
int dist[100005];
void dfs(int x)
{
	if(vis[x])	return;
	vis[x]=true;
	for(auto i: adj[x]){
		if(!vis[i]){
			dfs(i);
		}
	}
	for(auto i: adj[x]){
		dist[x]=max(dist[i],dist[x]);
	}
	if(adj[x].size()!=0)	dist[x]++;
}
int32_t main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	
	int n,m;
	cin >> n >> m;
	int x,y;
	for(int i=0;i<100005;i++){
		in[i]=0;
		dist[i]=0;
		vis[i]=false;
	}
	for(int i=1;i<=m;i++){
		cin >> x >> y;
		adj[x].push_back(y);
		in[y]++;
	}
	for(int i=1;i<=n;i++){
		if(in[i]==0 && !vis[i]){
			dfs(i);
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		// cout << dist[i] <<" ";
		ans=max(ans,dist[i]);
	}
	cout << ans ;


	return 0;
}

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

int main()
{
  int N,x,cnt=0;
  cin >> N;
  for(int i=0;i<N;i++) {
    cin>>x;
    int c=0;
    while(x%2==0) {
      c++;
      x/=2;
    }
    if (c==0) break;
    if(cnt==0 || c<cnt) cnt = c;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define rep(x, a, b) for(int x = (a); x <= (b); ++x)
#define rop(x, a, b) for(int x = (a); x < (b); ++x)
#define per(x, a, b) for(int x = (a); x >= (b); --x)
using namespace std;
typedef long long LL;
typedef double DB;
LL x;
__int128 n, a[100005], b[100005], as, T;
int main() {
	scanf("%lld", &x);
	n = x;
	rep(i, 1, n) {
		scanf("%lld", &x);
		b[i] = x;
		a[i] = b[i] - b[i - 1];
	}
	rep(i, 1, n) as = as + a[i] * (n - i + 1);
	if((as % (n * (n + 1) / 2) + (n * (n + 1) / 2)) % (n * (n + 1) / 2)) {puts("NO"); return 0;}
	as = as / (n * (n + 1) / 2);
	rep(i, 2, n) {
		if(as < a[i]) {puts("NO"); return 0;}
		if(as % n != (a[i] % n + n) % n) {puts("NO"); return 0;} 
	}
	int T = 0;
	rep(i, 2, n) {
		T = T - a[i];
	}
	if(as < T) {puts("NO"); return 0;}
	puts("YES"); 
	return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>

using namespace std;

int main() {
	string s;
	long long k;
	cin >> s >> k;
	char l = '1';
	for(int i = 0;i < k;i++) {
		if(s[i] != l) {
			l = s[i];
			break;
		}
	}
	cout << l << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import fractions


def main():
    A, B, C, D = map(int, input().split())

    num_C = B // C - (A - 1) // C
    num_D = B // D - (A - 1) // D
    lcm = C * D // fractions.gcd(C, D)
    num_CD = B // lcm - (A - 1) // lcm

    ans = (B - A + 1) - num_C - num_D + num_CD
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 5048
A = input()

# 文字列において、全ての文字が大文字かどうか判定するには str.isupper() 
# 文字列において、全ての文字が小文字かどうか判定するには str.islower()

ans = ''
if A.isupper(): ans = 'A'
else: ans = 'a'

print(ans)

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

int combination(int x) {
    if (x <= 1) {
        return 0;
    }
    int ret = 1;
    for(int i = 1; i <= x; i++) {
        ret *= i;
        if(i <= x-2) {
            ret /= i;
        }
    }
    return ret / 2;
}

int main() {
    int n, m;
    cin >> n >> m;
    cout << combination(n) + combination(m);
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	N = 3;
	vector<int>v(N);
	for (int i = 0; i < N; i++)cin >> v[i];
	sort(v.begin(), v.end());
	cout << v.back() - v.front() << endl;
	return 0;
}

Measured memory_bytes: 256
if __name__=="__main__":
    n = input()
    A = input()
    B = input()
    C = input()
    ans = 0
    for a, b, c in zip(A, B, C):
        if a != b and a != c and b != c:
            ans += 2
        elif a == b and b == c :
            pass
        else:
            ans += 1
    print(ans)

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

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);

    for(int i = 0; i < N; i++){
        cin >> A.at(i);
    }
    
    reverse(A.begin(), A.end());

    string sep = "";
    for(int i = 0; i < N; i++){
        cout << sep << A.at(i);
        sep  = " ";
    }
    cout << endl;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_s(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

#define MOD 1000000007

int main() {
  int h, n;
  cin >> h >> n;
  int attack = 0;
  rep(i, n) {
    int a;
    cin >> a;
    attack += a;
  }

  if (attack >= h) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

}


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


int main(){
	long long x, y;
	cin >> x >> y;
	
	long long ans = 1;

	while(y - (x + x) >= 0){
		ans++;
		x = x * 2;
	
	}
	
	cout << ans << endl;




	return 0;
}



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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int a, b;
    cin >> a >> b;
    cout << (a < 10 && b < 10 ? a * b : -1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll mod = 1000000007;

const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}



int main() {
  ll n,k;
  cin >> n >> k ;

  // vector<ll> a(n,0);

  // cin >> a;

  ll ans = n-k+1;



  cout << ans << endl;

}







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

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

using namespace std;

int main() {

	string N;
	string M;

	cin >> N;
	cin >> M;
	
	for (SINT32 i = 0; i < N.length()+1; i++) {
		if (N == M) {
			cout << "Yes" << endl;
			return 0;
		}
		N = N[N.length()-1] + N.substr(0,N.length()-1);
	}

	cout << "No" << endl;
	return 0;
}

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

//	// DATA.emplace_back(BUF);	//後ろに追加

//  DATA.erase(std::unique(DATA.begin(), DATA.end()), DATA.end());

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

// 	vector<pair<int,pair<int,int>>> DATA(M);
//	cin >> DATA[i].first;
//	cin >> DATA[i].second.first;
//	cin >> DATA[i].second.second;


//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
  int n,d,x;
  cin >> n >> d >> x;
  int a[n];
  
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }

  int sum = x;

  for(int i = 0; i < n; i++) {
    int count = 0;
    while(count*a[i]+1 <= d) {
      count++;
    }
    sum += count;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3632
void main(){
	long h, a;
	readf("%d %d", &h, &a);
	writeln( h%a==0? h/a: h/a+1);
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


Measured memory_bytes: 2736
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) v.erase(unique(ALL(v)), v.end())
#define bit(i) (1LL<<i)
#define sz(v) ((LLI)(v).size())

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}


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

  int N;
  while(cin >> N){
    vector<int> x(N); cin >> x;
    int L; cin >> L;
    
    vector<vector<int>> next(20, vector<int>(N));

    REP(i,N){
      next[0][i] = upper_bound(ALL(x), x[i]+L) - x.begin() - 1;
    }


    FOR(i,1,20){
      REP(j,N){
	next[i][j] = next[i-1][next[i-1][j]];
      }
    }

    REP(i,20) dump(next[i]);


    auto func =
      [&](int a, int b){
	int ret = 0;
	int cur = a;

	while(1){
	  if(next[0][cur] >= b){
	    ++ret;
	    break;
	  }

	  FOR(i,1,20){
	    if(next[i][cur] >= b){
	      ret += (1<<(i-1));
	      dump(i);

	      cur = next[i-1][cur];
	      break;
	    }
	  }
	}

	return ret;
      };

    int Q; cin >> Q;
    REP(i,Q){
      int a,b; cin >> a >> b;
      --a, --b;
      if(a>b) swap(a,b);
      dump(a,b);

      int ans = func(a,b);
      
      cout << ans << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 10744
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v)   (v).begin(),(v).end()
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
template<class Type> void join(const Type &a){for(auto elem:a)cout<<elem<<' ';cout<<endl;}

int main(){
	int n,k;
	cin>>n>>k;
	
	int ans=0;
	rep(i,n){
		int a;
		cin>>a;
		if(a>=k) ans++;
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>

using namespace std;

int main() {
  set<char> s;
  map<char, int> counts;
  string S;
  cin >> S;
  for (int i = 0; i < 4; ++i) {
    s.insert(S[i]);
    counts[S[i]] += 1;
  }
  if (s.size() == 2) {
    bool happy = true;
    for (auto ch : s) {
      if (counts[ch] != 2) {
	happy = false;
	break;
      }
    }
    if (happy) cout << "Yes" << endl;
    else cout << "No" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256