akhauriyash/Code-Regression huggingface dataset:
//fold
#ifndef KHALIL
#include <bits/stdc++.h>
#else
#include "header.h"
#endif
#define endl '\n'
#define mp make_pair
#define tostr(x) static_cast<ostringstream&>((ostringstream()<<dec<<x)).str()
#define rep(i,begin,end) for(auto i = begin;i < end;i++)
#define repr(i,begin,end) for(auto i = begin-1;i >= end;i--)
#define pb push_back
#define sz(a) ((int)(a).size())
#define fi first
#define se second
#define abs(a) ((a) < (0) ? (-1)*(a) : (a))
#define SQ(a) ((a)*(a))
#define eqd(a,b) (abs(a-b)<1e-9)
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename t> t in(t q){cin >> q;return q;}
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v){os << "[";for (int i = 0; i < sz(v); ++i) { os << v[i]; if (i != sz(v) - 1) os << ",";}os << "]";return os;}
template <typename T, typename S>ostream& operator<<(ostream& os, const map<T, S>& v){for (auto it : v)os << "(" << it.first << ":" << it.second << ")";return os;}
template <typename T, typename S>ostream& operator<<(ostream& os, const pair<T, S>& v){os << "(" << v.first << "," << v.second << ")";return os;}
const long double PI = acosl(-1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());
inline int rand(int l,int r){return uniform_int_distribution<int>(l, r)(rng);}
inline ll rand(ll l,ll r){return uniform_int_distribution<ll>(l, r)(rng64);}
//endfold
#define  N  (200005)
#define MOD (1000000000l + 7l)
#define OO (1050000000)
#define OOL (1100000000000000000)

//global
int a,b,c,d;


int main(){
	//fold
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << setprecision(10);
	//endfold
	string s;
	cin >> s;
	rep(i,0,sz(s)){
		if(s[i] == 'N') a++;
		if(s[i] == 'S') b++;
		if(s[i] == 'E') c++;
		if(s[i] == 'W') d++;
	}
	if((a && !b) || (!a && b) || (c && !d) || (!c && d)){
		cout << "No";
	}else{
		cout << "Yes";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    vector<int> bon = {3};
    vector<int> pon = {0, 1, 6, 8};
    int N;
    cin >> N;
    N %= 10;
    auto check = [&](vector<int> x) {
        if (count(x.begin(), x.end(), N)) return true;
        return false;
    };
    if (check(bon)) puts("bon");
    else if (check(pon)) puts("pon");
    else puts("hon");
    return 0;
}

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

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll n, m;
	cin >> n >> m;
	if(n % 3 == 0 || m % 3 == 0){
		cout << 0 << endl;
		return 0;
	}
	ll ans = 1e18;
	for(ll i = max(1LL, (n / 2) - 1); i <= min(n - 1, (n / 2) + 1); i++){
		for(ll j = 1; j < m; j++){
			ll a = 1LL * i * j;
			ll b = 1LL * (n - i) * j;
			ll c = 1LL * (m - j) * n;
			ans = min(ans, max({abs(a - b), abs(a - c), abs(b - c)}));
		}
	}
	swap(n, m);
	for(ll i = max(1LL, (n / 2) - 1); i <= min(n - 1, (n / 2) + 1); i++){
		for(ll j = 1; j < m; j++){
			ll a = 1LL * i * j;
			ll b = 1LL * (n - i) * j;
			ll c = 1LL * (m - j) * n;
			ans = min(ans, max({(ll)abs(a - b), (ll)abs(a - c), (ll)abs(b - c)}));
		}
	}
	ans = min(ans, min(m, n));
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

using namespace std;

using ll = long long;
using db = double;
using vi = vector<int>;
#define pb push_back
#define fir first
#define sec second

const int maxn = 3000; 

int n, k; 
vi e[maxn]; 
int ans, sum; 

void dfs(int x, int f, int d) {
	if (d <= k/2) ans++; 
	if (d == k/2+1) sum++; 
	for (auto i : e[x]) 
		if (i != f) dfs(i,x,d+1); 
}

int main() {
	cin>>n>>k; 
	for (int i = 1; i < n; ++i) {
		int a, b; 
		cin>>a>>b; 
		e[a].pb(b); 
		e[b].pb(a); 
	}
	int maxans = 0; 
	for (int i = 1; i <= n; ++i) {
		ans = 1; 
		int maxsum = 0; 
		for (auto j : e[i]) {
			sum = 0; 
			dfs(j, i, 1); 
			if (k % 2 == 1) maxsum = max(maxsum, sum); 
		}
		maxans = max(maxans, ans+maxsum); 
	}
	cout<<n-maxans<<endl; 
}


Measured memory_bytes: 512
n=int(input())
a=[list(map(int,input().split())) for _ in range(n-1)]
ans=[]
for i in range(n):
    now=0
    for j in range(i,n-1):
        c,s,f=a[j]
        if s==now:
            k=0
        elif s>now:
            k=s-now
        else:
            if now%f!=0:
                k=f-now%f
            else:
                k=0
        now+=c+k
    print(now)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define vi vector<int>
#define pb push_back
#define ff first
#define ss second
#define forn(i,n) for(int i=0;i<n;i++)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)

void solve() {
	string s, t;
	cin >> s >> t;
	int n = s.size();
	int m = t.size();


	int ans = INT_MAX;
	for (int st = 0; st <= (n - m); st++) {
		int cnt = 0;
		for (int i = 0; i < m; i++) {
			if (s[i + st] != t[i])
				cnt++;
		}
		ans = min(ans, cnt);
	}

	cout << ans << endl;








}

int32_t main() {

	fastio;

#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif

	// int t; cin >> t;/
	int t = 1;

	while (t--) {
		solve();
	}

	return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;

void solve() {
	string str_1; cin >> str_1;
	string str_2; cin >> str_2;
	string prev_str1 = str_1;
	string prev_str2 = str_2;
	reverse(str_1.begin(), str_1.end());
	reverse(str_2.begin(), str_2.end());
	string ans = "NO";
	if (prev_str1.compare(str_2) == 0 && prev_str2.compare(str_1) == 0) {
		ans = "YES";
	}
	cout << ans << endl;
	return;
}

int main() {
	solve();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << #x << ':' << (x) << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

constexpr ll mod = 1000000007;
const int sz = 1 << 20;

ll modpow(ll a, ll b, ll m = mod) {
	ll ans = 1;
	a %= m;
	while (b) {
		if (b & 1) ans = ans * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return ans;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	ll n;
	cin >> n;
	vector<ll> a(4), b(4);
	rep(i, 3) cin >> a[i];
	rep(i, 3) cin >> b[i];
	a[3] = b[3] = 1;
	vector<ll> dp(n + 1);
	rep(i, n + 1) {
		rep(j, 4) {
			if (i >= a[j]) chmax(dp[i], dp[i - a[j]] + b[j]);
		}
	}
	ll val = dp[n];
	vector<ll> dp2(val + 1);
	rep(i, val + 1) {
		rep(j, 4) {
			if (i >= b[j]) chmax(dp2[i], dp2[i - b[j]] + a[j]);
		}
	}
	cout << dp2[val] << '\n';
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int Tc; cin >> Tc;
  while(Tc--) {
    bool f = 0;
    string S; cin >> S;
    while(S.size() > 1) {
      S = to_string(S[0] + S[1] - 2 * '0') + S.substr(2);
      f ^= 1;
    }
    cout << vector<string>{"Audrey", "Fabre"}[f] << " wins.\n";
  }
  
  return 0;
}

Measured memory_bytes: 3236
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int dp[20100];
int a[1010],b[1010];
int main()
{
	int h,n,out=1001001001;cin>>h>>n;
	rep(i,n) cin>>a[i]>>b[i];
	rep(i,20050) dp[i]=out;dp[0]=0;
	rep(i,h+1) rep(j,n){
		dp[i+a[j]]=min(dp[i+a[j]],dp[i]+b[j]);
	}
	REP(i,h,20020) out=min(out,dp[i]);
	cout<<out<<endl;
}


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

const int maxn = 500009;
int f[maxn], last, n;
char s[maxn];

int main(){
	scanf("%d%s", &n, s+1);
	for (int i=3; i<=n; i++){
		f[i] = f[i-1];
		if (s[i-2] == '1' && s[i-1] == '0' && s[i] == '1'){
			last = i;
			for (int j=i-2; s[j] != '0' && j; j--)
				f[i] = max(f[i], f[j-1] + i-j-1);
		}
		if (s[i] == '0') last = 0;
		if (last) f[i] = max(f[i], f[last-3] + i-last+1);
	}
	printf("%d\n", f[n]);
	return 0;
}

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

int main()
{
    int a;
    int b;
    int c;

    cin >> a >> b >> c;

    if((a + b) >= c)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long min = Long.MAX_VALUE;
		for (int i = 0; i < 5; i++) {
			long x = sc.nextLong();
			if (min > x) {
				min = x;
			}
		}
		long time = (n + min - 1) / min + 4;
		System.out.println(time);
	}
}


Measured memory_bytes: 25684
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define VI(a,n) vi a(n); rep(i,n)cin>>a[i]
#define sq(n) (n)*(n)

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    vi a(n),b(n);
    vector<pi> c(n);
    rep(i,n){
        cin>>a[i]>>b[i];
        c[i]=mp(a[i]+b[i],i);
    }
    sort(all(c),greater<pi>());
    int st=0,sa=0;
    rep(i,n){
        if(i%2==0){
            st+=a[c[i].se];
        }
        else{
            sa+=b[c[i].se];
        }
    }
    cout<<st-sa<<endl;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=2;
ll powmod(ll a,ll n){
 ll res=1;
 while(n){
  if(n&1) res=res*a%mod;
  a=a*a%mod;
  n>>=1;
 }
 return res;
}
int main(){
 string s;
 cin >> s;
 int n=s.size();
 vector<int> cnt(n);
 vector<int> l(n),r(n);
 int steps=0;
 l[n-1]=n-1;
 for(int i=n-2;i>=0;i--){
  if(s[i]=='L') l[i]=i;
  else {
   l[i]=l[i+1];
   int cur=(steps-(l[i]-i-1)%2+2)%2;
   if(cur==0) cnt[l[i]-1]++;
   else cnt[l[i]]++;
  }
 }
 // for(int i=0;i<n;i++){
 //  cout << cnt[i] << ' ';
 // }
 // cout << endl;
 r[0]=0;
 for(int i=1;i<n;i++){
  if(s[i]=='R') r[i]=i;
  else{
   r[i]=r[i-1];
   int cur=(steps-(i-r[i]-1)%2+2)%2;
   if(cur==0){
    // cout << "i: " << i << endl;
    // cout << "r[i]+1: "<< r[i]+1 << endl;
    cnt[r[i]+1]++;
   }
   else {
    // cout << "i: " << i << endl;
    // cout << "r[i]: "<< r[i] << endl;
    cnt[r[i]]++;
   }
  }
 }
 // for(int i=0;i<n;i++){
 //  cout << l[i] << " ";
 //  cout << r[i] << " ";
 //  cout << endl;
 // }
 for(int i=0;i<n;i++) cout << cnt[i] << " " ;
 cout << endl;
 return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(){
  int d, k;  scanf("%d %d", &d, &k);
  int ans = 1;
  for(int i=0; i<d; i++)
    ans *= 100;
  ans *= k;
  if(k == 100)  ans *= 1.01;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
S = input()
S_len = len(S) - 1
p = []
for i in range(2 ** S_len):
    tmp = bin(i)[2::]
    while len(tmp) < S_len:
        tmp = "0" + tmp
    p.append(str(tmp))

sum = 0
for i in p:
    if len(p) == 1:
        sum = S
        break
    P = list(i)
    tmp = int(S[0])
    cnt = 1
    for j in P:
        if j == "0":
            tmp *= 10
            tmp += int(S[cnt])
        else:
            sum += tmp
            tmp = int(S[cnt])
        cnt += 1
    sum += tmp
print(sum)

Measured memory_bytes: 39664
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;


int main(int argc, char* argv[])
{
    int n,c,k;
    scanf("%d%d%d", &n, &c, &k);
    vector<int> a(n);
    int i;
    for(i=0; i<n; i++) {
        scanf("%d", &a[i]);
    }
    sort(a.begin(), a.end());

    int curr=a[0];
    int currid=0;
    int cnt=0;
    for(i=1; i<n; i++) {
        if(a[i]>curr+k || i>=currid+c ) {
            cnt++; curr=a[i]; currid=i;
        }
    }
    printf("%d\n", cnt+1);

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  int cnt0 = 0, cnt1 = 0, cnt2 = 0;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    int cnt = 0;
    while (a % 2 == 0) {
      ++cnt;
      a /= 2;
    }
    if (cnt == 0) {
      ++cnt0;
    } else if (cnt == 1) {
      ++cnt1;
    } else {
      ++cnt2;
    }
  }
  bool res = (cnt0 <= cnt2) || (cnt0 == cnt2 + 1 && cnt1 == 0);
  cout << (res ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int n;
    cin >> n;
    int m = n/2;

    double ans;
    if(n%2 == 0) {
        ans = 0.5;
    }
    else {
        ans = (double)(m+1)/(double)n;
    }

    printf("%.7f\n", ans);
    return 0;
}

Measured memory_bytes: 764
n = int(input())
*v, = map(int, input().split())

c = 0
for i in range(n):
    for j in range(n-1, i, -1):
        if v[j] < v[j-1]:
            v[j], v[j-1] = v[j-1], v[j]
            c += 1

print(" ".join([str(_v) for _v in v]))
print(c)



Measured memory_bytes: 5608
A,B=gets.split.map(&:to_i)

a1=(A*(100.0/8)).ceil
a2=((A+1)*(100.0/8)).floor
b1=B*10
b2=(B+1)*10


if a1>=b1 && a1<b2
  puts a1
elsif b1>=a1 && b1<a2
  puts b1
else
  puts -1
end


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

using namespace std;

#define MAX_V 1145
typedef pair<int, int> pii;
typedef long long ll;
const ll MOD = ((1e9) + 7);

int N, cmp[MAX_V];
bool used[MAX_V];
vector<int> G[MAX_V], rG[MAX_V], vs;

void add_edge(int from, int to)
{
    G[from].push_back(to);
    rG[to].push_back(from);
}

void dfs(int v)
{
    used[v] = 1;
    for (int i = 0; i < (int)G[v].size(); i++) {
	if (!used[G[v][i]]) {
            dfs(G[v][i]);
        }
    }
    vs.push_back(v);
}

void rdfs(int v, int k)
{
    used[v] = 1;
    cmp[v] = k;
    for (int i = 0; i < (int)rG[v].size(); i++) {
	if (!used[rG[v][i]]) {
            rdfs(rG[v][i], k);
        }
    }
}

int scc()
{
    memset(used, 0, sizeof(used));
    vs.clear();
    for (int v = 0; v < N; v++) {
	if (!used[v]) {
            dfs(v);
        }
    }
    memset(used, 0, sizeof(used));
    int k = 0;
    for (int i = vs.size() - 1; i >= 0; i--) {
	if (!used[vs[i]]) {
            rdfs(vs[i], k++);
        }
    }
    return k;
}

vector<int> nG[MAX_V];

ll solve(int v)
{
    ll res = 1;
    for (int i = 0; i < (int)nG[v].size(); i++) {
        res *= solve(nG[v][i]);
        res %= MOD;
    }
    res += 1;
    return res % MOD;
}

int main()
{
    int M, a, b;
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        cin >> a >> b; a--; b--;
        add_edge(a, b);
    }
    
    auto K = scc();
    
    set<pii> st;
    int deg[MAX_V] = {};
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < (int)G[i].size(); j++) {
            int from = cmp[i], to = cmp[G[i][j]];
            if (from != to && st.count(pii(from, to)) == 0) {
                st.insert(pii(from, to));
                nG[to].push_back(from);
                deg[from]++;
            }
        }
    }
    
    ll res = 1;    
    for (int i = 0; i < K; i++) {
        if (deg[i] == 0) {
            res *= solve(i);
            res %= MOD;
        }
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3344
[r, g, b, n] = [int(i) for i in input().split()]

ans = 0
for i in range( n//r+ 1):
    for j in range(n//g + 1):
            tmp =  n - r * i - g * j
            if tmp >= 0:
                if tmp % b == 0:
                    ans += 1
            else:
                break
print(ans)

Measured memory_bytes: 3060
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		long n = sc.nextLong();
		
		// 計算
		long result = 0;
		if(n%2 == 1){
		    System.out.println(result);
		    return;
		}
		long k = 10;
		while(k <= n){
		    result += n/k;
		    k *= 5;
		}

		// 出力
		System.out.println(result);
	}
}




Measured memory_bytes: 21972
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let mut a: Vec<usize> = it.map(|s| s.parse().unwrap()).collect();
    a.sort();
    a.dedup();
    if a.len() == n {
        println!("YES");
    } else {
        println!("NO");
    }
}

fn main() {
    run();
}

Measured memory_bytes: 10492
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
	static final int MAX = 2_147_483_646; // intMax 
	static final int INF = 1_000_000_000; // 10^9  
	public static void main(String[] args) throws Exception{
		hayami saori = new hayami();
		String[] n = saori.nextHayami().split("");
		int ans = 0;
		for(int i = 0;i < n.length;i++){
			if(n[i].equals("2"))ans++;
		}
		System.out.println(ans);
		saori.close();
	}
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
int a[1005],cnt=0;
int main()
{
	vector<int>v[105];
	int n,k;
	cin>>n>>k;
	for(int i=0;i<k;i++)
	{
		int x;
		cin>>x;
		for(int i=0;i<x;i++)
		{
			cin>>a[i];
			v[a[i]].push_back(x);
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(v[i].size()==0)
			cnt++;
	}
	cout<<cnt<<endl;

	return 0;
}

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

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

    if(s=="000"){
        cout << 0 << endl;
    }
    if(s=="001"){
        cout << 1 << endl;
    }
    if(s=="010"){
        cout << 1 << endl;
    }
    if(s=="011"){
        cout << 2 << endl;
    }
    if(s=="100"){
        cout << 1 << endl;
    }
    if(s=="101"){
        cout << 2 << endl;
    }
    if(s=="110"){
        cout << 2 << endl;
    }
    if(s=="111"){
        cout << 3 << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM 1000000000;
#define mod MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
int main(){
    ll n, m; cin >> n >> m;
    ll a[200001], b[200001], c[200001] = {};
    bool flg = false;
    for(ll i = 0; i < m; i++){
        cin >> a[i] >> b[i];
        if(a[i] == 1){
            c[b[i]-1]++;
        }
        if(b[i] == n){
            c[a[i]-1]++;
        }
    }
    for(ll i = 0; i < n; i++){
        if(c[i] == 2){
            flg = true;
        }
    }
    if(flg) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
    return 0;
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    string S, T; cin >> S >> T;
    int res = 0;
    rep(i,S.size()){
        if(S[i] != T[i]){
            res++;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3816
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N]; 


void solve()
{
    ll a;
    cin>>a;

    string b;
    cin>>b;

    ll c = (b[0] - '0')*100 + (b[2] - '0')*10 + (b[3] - '0');

    cout<<(a*c)/100<<endl;

}

int main()
{

    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)
    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        // cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

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


ll k;
double l,r,p,e,t;

double dfs(int cnt, double low, double up){
    double mid = (low+up)/2.0;
    if(cnt==k){
        if(mid>=t-e && mid <= t+e) return 1.0;
        else return 0.0;
    }
    if(low >= t-e && up <= t+e) return 1.0;
    if(low >= t+e || up <= t-e) return 0.0;
    double ret = 1.0;
    if(mid>=t) ret = (1.0-p) * dfs(cnt+1,low,mid) + p*dfs(cnt+1,mid,up);
    else ret = (1.0-p)*dfs(cnt+1,mid,up) + p*dfs(cnt+1,low,mid);
    //cerr << cnt << " " << low << " " << up << " " << ret << endl;
    return ret;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    cin>>k>>l>>r>>p>>e>>t;
    cout << dfs(0,l,r) << endl;
        

}


Measured memory_bytes: 3312
/*
 * atcoder/dp_2nd/g.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
#include <queue>

using namespace std;

#define ll long long
#define MOD 10e9+7

#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

const int MAX = 10e5+100;
int N, M;
vector<int> G[MAX];
vector<int> G_INV[MAX];
int indeg[MAX] = {0};
int sorted[MAX] = {0};
int dp[MAX] = {0};

void input() {
  cin >> N >> M;
  int u, v;
  loop(n,0,M) {
    cin >> u >> v;
    u--;v--;
    G[u].push_back(v);
    G_INV[v].push_back(u);
    indeg[v]++;
  }
}

void tsort() {
  queue<int> Q;
  int index = 0;
  for (int u=0; u<N; u++) {
    if (indeg[u] == 0) {
      Q.push(u);
      sorted[index++] = u;
    }
  }

  while (Q.size()) {
    int u = Q.front(); Q.pop();
    for (auto &&v: G[u]) {
      if (--indeg[v] == 0) {
        sorted[index++] = v;
        Q.push(v);
      }
    }
  }
}

void dump() {
  for (int i=0; i<N; i++) cout << sorted[i] << " ";
  cout << endl;
}

void solve() {
  tsort();
  dp[sorted[N-1]] = 0;
  int max_ = 0;
  for (int i=N-1; i>=0; i--) {
    int v = sorted[i];
    for (auto &&u: G_INV[v]) {
      chmax(dp[u], dp[v] + 1);
      chmax(max_, dp[u]);
    }
  }
  cout << max_ << endl;
}

int main() {
  // cout.precision(15);
  input();
  solve();
  return 0;
}


Measured memory_bytes: 63488
n = gets.chomp.to_i
taro_point = 0
hanako_point = 0
n.times {
    taro,hanako = gets.chomp.split(" ")
    if taro < hanako
        hanako_point += 3
    elsif taro > hanako
        taro_point += 3
    else
        hanako_point += 1
        taro_point += 1
    end
}
print(taro_point," ",hanako_point,"\n")

Measured memory_bytes: 8852
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); } bool DEBUG = 0; 
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

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

void solve(){
    int h = scan!int, w = scan!int;
    bool[][] bf = new bool[][](h);
    foreach(i; 0 .. h) bf[i] = scan.map!(c => c == '#').array;
    log("bf:");
    if(DEBUG) foreach(bq; bf) bq.print;
    long infty = (h + w) * 2;

    long[][] xf = new long[][](h, w);
    foreach(i; 0 .. h) foreach(j; 0 .. w){
        xf[i][j] = infty;
        if(i > 0){
            if(bf[i][j]) xf[i][j].lowerTo(xf[i - 1][j] + (bf[i - 1][j]? 0: 1));
            else xf[i][j].lowerTo(xf[i - 1][j]);
        }
        if(j > 0){
            if(bf[i][j]) xf[i][j].lowerTo(xf[i][j - 1] + (bf[i][j - 1]? 0: 1));
            else xf[i][j].lowerTo(xf[i][j - 1]);
        }
        if(i == 0 && j == 0){
            if(bf[i][j]) xf[i][j] = 1;
            else xf[i][j] = 0;
        }
    }
    log("xf:");
    if(DEBUG) foreach(xq; xf) xq.print;

    xf[h - 1][w - 1].writeln;
}




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



int main(){


  while(1){

    string s;
    int i;
    stack <char> stack;
    bool ans = 1;
   //cin テ」ツ?ッテァツゥツコテァツ卍ステ」ツ?ァテァツオツづ」ツつ湘」ツつ?

    getline(cin, s);
    if(s == ".") break;
    
    stack.push('a');

    for(i = 0 ; i < s.size(); i++){
      if(s[i] == '(' || s[i] == '['){
	stack.push(s[i]);
      }
      if(s[i] == ')'){
	//	cout << "IN ";
	if(stack.top() == '('){
	  //	  cout << "IN "<< stack.top();
	  stack.pop();
	}else{
	  ans = 0;
	  break;
	}
      }
      if(s[i] == ']'){ 
      	if(stack.top() == '['){
	  stack.pop();
	}else{
	  ans = 0;
	  break;
	}
      }      
    }
    
    if(stack.top() != 'a') ans = 0;

    if(ans == 1 ) cout << "yes" << endl;
    else cout << "no" << endl;  
    
  }
  return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  string S;
  cin >> S;
  REP(i, 1, S.size()) {
    if(S[i] == S[i-1]) {
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m; cin >> n >> m;
    vector< vector<int> > s(m);
    for(int i=0;i<m;++i){
        int k; cin >> k;
        s[i].resize(k);
        for(int j=0;j<k;++j){
            int a; cin >> a;
            a--;
            s[i][j] = a;
        }
    }
    vector<int> p(m);
    for(int i=0;i<m;++i) cin >> p[i];
    int ans = 0;
    for(int bit=0;bit<(1<<n);++bit){
        bool flag=true;
        vector<int> ct(m,0);
        for(int i=0;i<n;++i){
            if(bit & (1<<i)){//swtch番号(i)がonの時
                for(int j=0;j<m;++j){
                    auto itr = find(s[j].begin(),s[j].end(),i);
                    if(itr==s[j].end()) continue;
                    ct[j]++;
                }
            }
        }
        for(int j=0;j<m;++j){
            if(ct[j]%2!=p[j]){
                flag=false;
                break;
            }
        }

        if(flag) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int[][] a=new int[3][3];
		for(int i=0; i<3; i++){
			for(int j=0; j<3; j++){
				a[i][j]=sc.nextInt();
			}
		}
		int n=sc.nextInt();
		boolean[][] ch=new boolean[3][3];
		for(int i=0; i<n; i++){
			int b=sc.nextInt();
			for(int j=0; j<3; j++){
				for(int t=0; t<3; t++){
					if(a[j][t]==b){
						ch[j][t]=true;
					}
				}
			}
		}
		for(int i=0; i<3; i++){
			boolean tmp=true;
			for(int j=0; j<3; j++){
				if(!ch[i][j]){
					tmp=false;
				}
			}
			if(tmp){
				System.out.println("Yes");
				return;
			}
		}
		for(int i=0; i<3; i++){
			boolean tmp=true;
			for(int j=0; j<3; j++){
				if(!ch[j][i]){
					tmp=false;
				}
			}
			if(tmp){
				System.out.println("Yes");
				return;
			}
		}
		boolean tmp=true;
		for(int i=0; i<3; i++){
			if(!ch[i][i]){
				tmp=false;
			}
		}
		if(tmp){
			System.out.println("Yes");
			return;
		}
		tmp=true;
		for(int i=0; i<3; i++){
			if(!ch[i][2-i]){
				tmp=false;
			}
		}
		if(tmp){
			System.out.println("Yes");
			return;
		}
		System.out.println("No");
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
int n,pos[110][110],vis[110],g[110];
vector<int> e[110];
ll ans,cnt;
void dfs(int x,int depth){
	g[depth]=max(g[depth],(int)e[x].size()-1);
	vis[x]=1;
	for(int v:e[x]) if(!vis[v]) dfs(v,depth+1);
}
int main(){
	read(n);
	if(n==2){
		cout<<1<<' '<<2<<'\n';
		return 0;
	}
	for(int i=1;i<n;i++){
		int x,y;read(x);read(y);
		e[x].push_back(y);
		e[y].push_back(x);
		pos[x][y]=pos[y][x]=1;
	}
	ans=cnt=1e18;
	for(int i=1;i<=n;i++)
		for(int j=i;j<=n;j++)
			if(i==j||pos[i][j]){
				memset(vis,0,sizeof(vis));
				memset(g,0,sizeof(g));
				vis[i]=vis[j]=1;
				dfs(i,1);dfs(j,1);
				if(i==j) g[1]++;
				else g[1]*=2;
				ll now=1,ansn=0;
				for(int i=1;i<=n;i++)
					if(g[i]) now*=g[i];
					else{ansn=i;break;}
				if(ansn<ans) ans=ansn,cnt=now;
				else if(ansn==ans) cnt=min(cnt,now);
			}
	cout<<ans<<' '<<cnt<<'\n';
	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<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
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;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	
	int k;cin>>k;
	ll ans=0;
	if(k%7==0){
	    k/=7;
	}
	set<int> se;
	ll bai=1;
	ll hoge=0;
	bool ok=true;
	while(1){
	    ans++;
	    hoge+=bai%k;
	    hoge%=k;
	    //cout<<hoge<<"hoge"<<endl;
	    //cout<<bai<<"bai"<<endl;
	    if(hoge==0){
	        break;
	    }
	    if(se.count(hoge)){
	        ok=false;
	        break;
	    }else{
	        se.insert(hoge);
	    }
	    bai=(bai%k)*10;
	    //if(ans==999982){}
	    
	}
	if(ok){
	    cout<<ans<<endl;
	}else{
	    cout<<-1<<endl;
	}
	return 0;
}


Measured memory_bytes: 50528
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;

main(){
    int x,y;
    cin>>x>>y;
    if(y&1) cout<<"No";
    else{
        if(y>=(2*x) && y<=(4*x)) cout<<"Yes";
        else cout<<"No";
    }
}

Measured memory_bytes: 3624
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}
int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
int r;
  cin>>r;
  cout<<r*r;
  
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


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

using namespace std;

int main() {
	int A, B;
	cin >> A >> B;

	if (B == 1) {
		cout << 0 << endl;
		return 0;
	}
	int ans = 1;
	B -= A;
	--A;
	while (B > 0) {
		B -= A;
		++ans;
	}
	cout << ans << endl;

	return 0;
}


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

using namespace std;

typedef long long ll;

ll a[100010], sum[100010], sum2[100010];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		sum[i + 1] = a[i];
		if (a[i] > 0) sum2[i + 1] = a[i];
	}

	for (int i = 1; i <= N; i++) {
		sum[i] += sum[i - 1];
		sum2[i] += sum2[i - 1];
	}

	ll ans = 0;
	for (int i = 0; i <= N - K; i++) {
		ans = max(ans, sum2[N] - sum2[i + K] + sum2[i] + max(sum[i + K] - sum[i], 0LL));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
char a[20],b[20],c[20];
int main()
{
    cin>>a>>b>>c;
    if (a[strlen(a)-1]==b[0] && b[strlen(b)-1]==c[0]) printf("YES\n");
    else printf("NO\n");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y,h=0;
  cin >> x >> y;
  if(x==1){
    h=h+300000;
  }
  if(x==2){
    h=h+200000;
  }
  if(x==3){
    h=h+100000;
  }
  if(y==1){
    h=h+300000;
  }
  if(y==2){
    h=h+200000;
  }
  if(y==3){
    h=h+100000;
  }
  if(x==1&&y==1){
    h=h+400000;
  }
  cout << h << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;    
int main()
{
    ll n, s, z = 1;
    cin>>n;
    ll ar[n];
    for(ll i = 0; i<n; i++)
    {
        cin>>ar[i];
    }
    s = ar[0];
    for(ll i = 1; i<n; i++)
    {
        if(s>ar[i])
        {
        	z++;
            s = ar[i];
        }
    }
    cout<<z<<endl;
    return 0;
}

Measured memory_bytes: 5196
#include<iostream>
#include<algorithm>
#include<cmath>
typedef long long ll;
#define inf 0x3f3f3f3f
using namespace std;
int main()
{
    int a,b,i,j,m,n,q,p,w=0;
    cin>>a>>b;
    double aa=a,bb=b;
    for(i=1;i<=1250;i++)
    {
    	q=i*1.0*0.08;
    	p=i*1.0*0.1;
    	if(q==a&&p==b)
    	{
    		w=1;
    		cout<<i;
    		break;
		}
	}
	if(w==0)cout<<-1;
	return 0;
 } 

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int X, Y, S;
int solve() {
	int maximum = 0;
	for (int i = 1; i < S; i++) {
		for (int j = S; j >= i; j--) {
			if ((int)(i*(100 + X) / 100) + (int)(j*(100 + X) / 100) == S) {
				if ((int)(i*(100 + Y) / 100) + (int)(j*(100 + Y) / 100) > maximum) {
					maximum = (int)(i*(100 + Y) / 100) + (int)(j*(100 + Y) / 100);
				}
			}
		}

		
	}
	return maximum;
}
int main(){
	 while (cin >> X >> Y >> S && X > 0) {
		 cout << solve() << endl;
		
	}
	
}


Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  int x,v,ans=1;cin>>x;
  for(int i=2;i<=sqrt(x);i++){
    v=i;
    while(v<=x){
      ans = max(v,ans);
      v*=i;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
for _ in range(int(input())):
    a = readline().strip()
    b = readline().strip()
    indices = []
    for cb in b:
        bgn_idx = 0
        for i, cur_idx in enumerate(indices):
            chr_idx = a.find(cb, bgn_idx) + 1
            if not chr_idx:
                break
            if chr_idx < cur_idx:
                indices[i] = chr_idx
            bgn_idx = cur_idx
        else:
            chr_idx = a.find(cb, bgn_idx) + 1
            if chr_idx:
                indices.append(chr_idx)
    print(len(indices))


Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    sort(s.begin(),s.end());
    s.erase(unique(s.begin(),s.end()),s.end());
    for(char c = 'a'; c <='z'; c++){
        bool isFound = false;
        for(int i = 0; i < s.length(); i++){
            if(s[i]==c){
                isFound = true;
                break;
            }
        }
        if(isFound==false){
            cout << c << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int MOD = 1000000007;

int main(void){
    int N; cin >> N;
    int d[N]; for(int i = 0; i < N; i++) cin >> d[i];
    
    int ans = 0;
    for(int i = 0; i < N; i++){
        for(int j = i+1; j < N; j++){
            ans += d[i] * d[j];
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0 }, dy[] = { 0,1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑


int main() {
	while (1) {
		int a, b, ans;
		char c;
		cin >> a >> c >> b;
		if (c == '?') { break; }
		switch (c) {
		case '+':
			ans = a + b;
			break;
		case '-':
			ans = a - b;
			break;
		case '*':
			ans = a * b;
			break;
		case '/':
			ans = a / b;
			break;
		}
		cout << ans << endl;
	}
}


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

int num_of_div(int n){
  int ret = 0;
  for(int i = 1 ; i <= n ; i++){
    if(n % i == 0) ret++;
  }
  return ret;
}

int main(){
  
  int N;
  cin >> N;
  int res = 0;
  for(int i = 1 ; i <= N ; i++){
    if(num_of_div(i) == 8 && i % 2 == 1){
      res++;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
int iinf=1<<30;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll poc(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,m;cin>>n>>m;
    vector<int> v[n];
    rep(i,0,m){
        int a,c;cin>>a>>c;
        a--;
        c--;
        v[a].push_back(c);
        v[c].push_back(a);
    }
    queue<int> q;
    bool used[n];
    fill(used,used+n,false);
    used[0]=true;
    int ans[n];
    q.push(0);
    while(q.size()>0){
        int now=q.front();q.pop();
        rep(i,0,v[now].size()){
            int ne=v[now][i];
            if(used[ne])continue;
            ans[ne]=now;
            q.push(ne);
            used[ne]=true;
        }
    }
    cout<<"Yes"<<endl;
    rep(i,1,n)cout<<ans[i]+1<<endl;
}



Measured memory_bytes: 10564