akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;
const int INF = 1<<29;
const double EPS = 1e-8;
//typedef vector<int> vec;
typedef vector<char> vec;
typedef vector<vec> mat;
typedef pair<int,int> P;
struct edge{int to,cost;};

struct State{
    int t,get,y,x;
};
const int dx[] = {0,0,1,-1};
const int dy[] = {1,-1,0,0};

bool visited[100][(1<<10)][20][20];

int main(){
    int w, h;
    while(cin >> w >> h, w){
        mat field(h, vec(w));
        int sx,sy;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                cin >> field[i][j];
                if(field[i][j]=='P'){
                    sx = j; sy = i;
                }
            }
        }

        int de_sum[(1<<10)];
        fill(de_sum, de_sum+(1<<10), 0);
        int n;
        cin >> n;
        int st_i[10], et_i[10];
        fill(st_i,st_i+10,INF);
        fill(et_i,et_i+10,-INF);
        for(int i=0;i<n;i++){
            int go, de, st, et;
            scanf("%d%d%d%d", &go, &de, &st, &et);
            st_i[go] = st; et_i[go] = et;
            for(int j=1;j<(1<<10);j++){
                if((j>>go)&1){
                    de_sum[j] += de;
                }
            }
        }

        memset(visited, 0, sizeof(visited));
        queue<State> que;
        que.push((State){0,0,sy,sx});
        int ans = 0;
        while(que.size()){
            State p = que.front(); que.pop();
            //printf("p.t=%d p.get=%d p.y=%d p.x=%d\n",p.t,p.get,p.y,p.x);
            for(int j=0;j<4;j++){
                int ny = p.y + dy[j], nx = p.x + dx[j];
                if(ny<0||h<=ny||nx<0||w<=nx)continue;
                if('0'<=field[ny][nx]&&field[ny][nx]<='9'){
                    int g_i = field[ny][nx] - '0';
                    if(st_i[g_i] <= p.t && p.t < et_i[g_i]){
                        p.get |= (1<<g_i);
                    }
                }
            }
            if(visited[p.t][p.get][p.y][p.x]) continue;
            visited[p.t][p.get][p.y][p.x] = true;
            ans = max(ans, de_sum[p.get]);
            for(int i=0;i<4;i++){
                int ny = p.y + dy[i], nx = p.x + dx[i];
                if(ny<0||h<=ny||nx<0||w<=nx) continue;
                if(field[ny][nx]=='.'||field[ny][nx]=='P'){
                    if(p.t+1<100&&!visited[p.t+1][p.get][ny][nx]){
                        que.push((State){p.t+1, p.get, ny, nx});
                    }
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 42968
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
// #define endl '\n'
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define rf(i,a,b) for(int i=a;i>=b;i--) 
#define fast_io ios_base::sync_with_stdio(0);
#define show(x) cout<<x<<endl;
#define pret(x) cout<<x<<endl; return 0;
#define disp(x) cout<<x<<" ";
#define let(x,y) cout<<x<<" "<<y<<endl;
const int maxn=5e5+5;

int fen[maxn];		//1-based indexing
int n,q;

void update(int p,int val){		//increase the value of a[p] by val
	for(int i = p;i <= n;i += i & -i)
		fen[i] += val;
}
int sum(int p){		//a[1]+a[2]...a[p]
	int ans = 0;
	for(int i = p;i;i -= i & -i)
		ans += fen[i];
	return ans;
}

vi color[maxn];
int a[maxn],ans[maxn], whichColor[maxn];

int32_t main(){
    fast_io;
    cin>>n>>q;
    vector<pair<pair<int, int> ,int > > v;
    for (int i = 1; i <= n; ++i)
    {
    	cin>>a[i];
    	color[a[i]].emplace_back(i);
    }
    // show("Fdsa");
    fo(i, 1, n) {
    	reverse(color[i].begin(), color[i].end());
    	if(!color[i].empty()){
    		whichColor[color[i].back()] = i;
    		update(color[i].back(), 1);
    	}
    }
    // show("Fdsa");
    for (int i = 0; i < q; ++i)
    {
    	int l,r;
    	cin>>l>>r;
    	v.push_back({{l,r},i});
    }
    sort(v.begin(), v.end());
    int prev = 1;
    // show("Fdsa");
    for(const auto &it:v){
    	// show("Fdsa");
    	int l = it.first.first;
    	int r = it.first.second;
    	int id = it.second;
    	while(prev < l){
    		int curr = whichColor[prev];
    		update(prev, -1);
    		color[curr].pop_back();
    		if(!color[curr].empty()){
    			whichColor[color[curr].back()] = curr;
    			update(color[curr].back(), 1);
    		}
    		prev++;
    	}
    	ans[id] = sum(r);
    }
    for (int i = 0; i < q; ++i)
    {
    	show(ans[i]);
    }
    return 0;
}

Measured memory_bytes: 44916
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
	int h,n,w,i;
	int ans = 0;
	cin>>h>>w>>n;
	
	for( i = 0;i * max( h , w ) < n ; i++){}
	
	cout<<i;
}


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

int n, k;
int v[50];

signed main() {
	int i, j, l;

	cin >> n >> k;
	rep(i, n) cin >> v[i];

	int ans = 0;
	rep(i, n + 1) {
		rep(j, n + 1) {
			if (i + j > n || i + j > k) continue;

			vector<int> vec;
			rep(l, i) vec.push_back(v[l]);
			rep(l, j) vec.push_back(v[n - 1 - l]);
			sort(vec.begin(), vec.end());

			rep(l, k - (i + j)) {
				if (l >= vec.size()) break;
				if (vec[l] >= 0) break;
			}

			int sumV = 0;
			for (; l < vec.size(); l++) {
				sumV += vec[l];
			}
			ans = max(ans, sumV);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iomanip>
#include <string>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
	string a, b;
	cin >> a >> b;
	if (a > b) {
		cout << ">" << endl;
	}
	else {
		if (a == b) {
			cout << "=" << endl;
		}
		else {
			cout << "<" << endl;
		}
	}
	return 0;
}

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

int main()
{
    string s;
    cin >> s;
    int ans = 700;
    for (int i = 0; i < 3; ++i)
    {
        if (s[i] == 'o')
            ans += 100;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
"use strict";

function main(input){
  const args= input.split('\n');
  const N= args[0];
  const d= args.slice(1, args.length-1);

  console.log(d.filter((n,i)=>d.indexOf(n)===i).length);

}
main(require('fs').readFileSync('/dev/stdin','utf8'));


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

template<typename T> map<T,int> prime_factor(T n){
    map<T,int> res;
    for (T i=2;i*i<=n;++i){
        while (n%i==0){
            ++res[i]; n/=i;
        }
    }
    if (n!=1) res[n]=1;
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N; cin >> N;
    map<ll,int> m=prime_factor(N);
    int ans=0;
    for (auto p:m){
        int x=p.second;
        int lb=0,ub=1e9;
        while(ub-lb>1){
            int mid=(ub+lb)>>1;
            ((ll)mid*(mid+1)/2<=x?lb:ub)=mid;
        }
        ans+=lb;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD = 1e9+7;
using P=pair<ll,ll>;
ll gcd(ll a,ll b){//aとbの最大公約数を返す//計算量は0(log(max(a,b))
  if(a%b==0){return b;}
  else{return gcd(b,a%b);}
}
ll lcm(ll a,ll b){//aとbの最小公倍数を返す//計算量は0(log(max(a,b))
  return a*b/gcd(a,b);
}
ll mod_pow(ll x,ll y){//x^yを返す//計算量は0(log(y))
  ll tmp=x,res=1;
  while(y){
    if(y%2){res=res*tmp%MOD;}
    y>>=1;
    tmp=tmp*tmp%MOD;
  }
  return res;
}
ll nature(ll a){//絶対値を返す
  if(a>=0){return(a);}
  else{return(-1*a);}
}
ll prime(ll a){//素数なら1を返す//計算量は0(sqrt(a))
  if(a==2){return 1;}
  else if(a%2==0 || a==1){return 0;}
  for(ll i=3;i*i<=a;i+=2){if(a%i==0){return 0;}}
  return 1;
}
int main(){
  ll N,K;
  cin>>N>>K;
  vector<ll> A(N);
  for(ll i=0;i<N;i++){
    cin>>A.at(i);
  }
  for(ll i=K;i<N;i++){
    if(A.at(i-K)<A.at(i)){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }
}

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

int main() {
    string s,t;
    cin>>s>>t;
    string ans = "Yes";
    for(int i=0;i<s.size();i++){
        if(s[i]!=t[i]){
            ans = "No";
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3600
import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n ;i++){
            a[i] = stdIn.nextInt();
        }
        int max = 0;
        int max2 = 0;
        for(int i = 0 ; i < n ;i++) {
            if(a[i] > max) {
                max2 = max;
                max = a[i];
            }else if(a[i] > max2) {
                max2 = a[i];
            }
        }
        for(int i = 0;i < n;i++) {
            if(a[i] < max){
                System.out.println(max);
            }else {
                System.out.println(max2);
            }
        }

    }
}

Measured memory_bytes: 107580
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector <ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <vector<ll>> vv;
typedef vector <string> vs;
typedef vector <char> vc;
 
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;
 
#define Endl endl
 
 
/*--------------------template--------------------*/
 
 
int main() {
    cin >> s;
    if (s[0] == s[1] && s[1] == s[2]) {
        cout << "Yes" << endl;
    } else if (s[1] == s[2] && s[2] == s[3]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
 
}

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

int main() {
  int N, K, x = 0, y = 0;
  cin >> N >> K;
  
  for (int i = 0; i < N; i++) {
	cin >> x;
    if (x < abs(x-K)) {
      y += 2 * x;
    } else {
      y += 2 * abs(x-K);
    }
  }
  cout << y << endl;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int k,t,count = 0,Max = 0;
    cin >> k >> t;
    vector<int> a(t);
    rep(i, t){
        cin >> a[i];
        Max = max(a[i], Max);
        count += a[i];
    }
    if (Max > (k + 1)/2) {
        cout << Max + Max - count - 1 << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<long long> A(N);
  long long y = 0;
  for(int i = 0; i < N; ++i)
    cin >> A[i], y ^= A[i];
  int idx = 0;
  for(auto &a : A) a &= ~y;
  for(int i = 60; i >= 0; --i){
    int k = -1;
    for(int j = idx; j < N; ++j){
      if((A[j]>>i)&1){
        k = j;
        break;
      }
    }
    
    if(k >= 0){
      swap(A[idx],A[k]);

      for(int j = 0; j < N; ++j){
        if(j == idx) continue;
        if((A[j]>>i)&1)
          A[j] ^= A[idx];
      }
      ++idx;
    }
  }
  // for(auto a : A)
  //   cerr << (bitset<60>)a << endl;
  long long x = 0;
  for(int i = 0; i < N; ++i){
    x ^= A[i];
    // if((x^A[i]) > x) x ^= A[i];
  }
  y ^= x;
  cerr << x << " " << y << endl;
  cout << x+y << endl;
}


Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int a,b,c,a2,b2,c2,ans=0;cin>>a>>b>>c;
    if(a==b&&b==c&&a%2==0)ans=-1;
    else{
        while(a%2==0&&b%2==0&&c%2==0){
            ans++;
            a2=b/2+c/2;
            b2=a/2+c/2;
            c2=a/2+b/2;
            a=a2;b=b2;c=c2;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3636
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int a, b;
    cin >> a >> b;
    if(a - 2*b > 0){
        cout << a- 2*b;
    }
    else
    {
        cout << 0;
    }
    cout << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        string S = cin.nextString();

        for (int i = 1; i < S.Length; i++)
        {
            if (S[i] == S[i - 1])
            {
                Console.WriteLine("Bad");
                return;
            }
        }
        Console.WriteLine("Good");
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}



Measured memory_bytes: 11092
N = int(input())
xy = []
for i in range(N):
    t = []
    A = int(input())
    for l in range(A):
        t.append(list(map(int,input().split())))
    xy.append(t)
ans = 0
for i in range(2**N):
    p = []
    for l in range(N):
        if ((i >> l) & 1) == 1:
            p.append(1)
        else:
            p.append(0)
    c = 0
    if sum(p) > ans:
        for l in range(N):
            if p[l] != 0:
                for j in xy[l]:
                    if p[j[0] - 1] != j[1]:
                        c = 1
        if c == 0 and p != [1,1,1]:
            ans = sum(p)
print(ans)


Measured memory_bytes: 46172
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define rep(i,e) for(int i=0;i<(e);++i)

int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  s[--k] += 'a'-'A';
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n';
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 MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int h, n;
    cin >> h >> n;
    vector<int> a(n);
    vector<int> b(n);
    int mx = 0;
    REP(i, n) {
        cin >> a[i] >> b[i];
        chmax(mx, a[i]);
    }

    vector<int> dp(h + mx + 10, INF);
    dp[0] = 0;
    REP1(i, h + mx + 9) REP(j, n) {
        if (i - a[j] >= 0) chmin(dp[i], dp[i - a[j]] + b[j]);
    }

    int ans = INF;
    FOR (i, h, h + mx + 9) if (dp[i] != INF) {
        chmin(ans, dp[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
// Why am I so dumb? :c
#include<bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

const int MAXN = (int)1e5 + 5;

int arr[MAXN];

int d[MAXN];

bool ans;

ll sum;

int n;

void solve() {
    scanf("%d", &n);
    ll subt = n * (n + 1ll) / 2;

    for (int i = 1; i <= n; ++i) {
        scanf("%d", &arr[i]);
        sum += arr[i];
    }

    for (int i = 1; i < n; ++i) {
        d[i] = arr[i + 1] - arr[i];
    }

    d[n] = arr[1] - arr[n];

    if (sum % subt) {
        printf("NO\n");
        return;
    }

    sum /= subt;
    ans = 1;

    for (int i = 1; i <= n; ++i) {
        ll cur = sum - d[i];
        ans &= (cur >= 0 && cur % n == 0);
    }

    printf(ans ? "YES\n" : "NO\n");
}

int main() {
    int tt = 1;

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

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const ll INF = 1e18;
#define pu push
#define pb push_back
#define mp make_pair
#define print(x) cout << (x) << endl;
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define SORT(x) sort(x.begin(),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define fi first
#define sc second

int main() {
    ll A, B, N;
    cin >> A >> B >> N;
    if (N>=(B-1)) {
        cout << A*(B-1)/B << endl;
    } else {
        cout << A*N/B << endl;
    }
}

Measured memory_bytes: 3632
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

res = []
x, y, z, K = na()
a_li = na()
b_li = na()
c_li = na()
list.sort(a_li, reverse=True)
list.sort(b_li, reverse=True)
list.sort(c_li, reverse=True)
for i in range(x):
    for j in range(y):
        for k in range(z):
            if (i + 1) * (j + 1) * (k + 1) <= K:
                res.append(a_li[i] + b_li[j] + c_li[k])
            else:
                break
list.sort(res, reverse=True)
for i in range(K):
    print(res[i])

Measured memory_bytes: 8692
#include<bits/stdc++.h>
using namespace std ;
#define ll long long int 
#define pb push_back 

ll dp[100000] , visi[100000] ;

std::vector<vector<ll>> graph(100000),rev(100000) ;
    

ll doi(ll i )
{
    if(visi[i]==1 )
    return dp[i] ;
    else{
        ll m = 0 ;
        if(!graph[i].empty()){
        for(auto j: graph[i])
        {
            
            m = max(doi(j ) , m ) ;
        
           
        }
        m++ ;
        }
        
        
        
        visi[i] =1 ;
        dp[i] = m ;
        
        return m;
    }
}

int main()
{
    ll m , n ;
    cin >> n >> m;
    for(ll i =0 ; i <m ; i++)
{
    ll a ,b ;
    cin>>a >>b ;
    a-- ;b-- ;
    rev[a].pb(b) ;
    graph[b].pb(a) ;
    
}


m = 0 ;
vector<ll>s ;
for( ll i =0 ; i< n ;i++)
{
    if(rev[i].empty())
    {
        s.pb(i) ;
    }
}

for(auto i : s)
{
    m = max(doi(i) , m) ; 
}
std::cout <<  m  << std::endl;

return 0 ;
}

Measured memory_bytes: 17408
import java.util.Scanner;
import java.math.*;


/**
 * @author kawakami
 *
 */
/**
 * @author kawakami
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner as = new Scanner(System.in);
		
	       
		double r,t,s;

	       
        
        r = as.nextDouble();
           
           
        s=3.141592653589*r*r;
        t=2.0*3.141592653589*r;
        
        BigDecimal ros = new BigDecimal(s);
        BigDecimal rot = new BigDecimal(t);
        
        ros=ros.setScale(6,BigDecimal.ROUND_HALF_UP);
        rot=rot.setScale(6,BigDecimal.ROUND_HALF_UP);

        System.out.println(ros+" "+rot);           


	}

}

Measured memory_bytes: 28196
#include <bits/stdc++.h>
#define MODNum 1000000007
#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    ll N, K, ans;
    cin >> N >> K;
    ll minNum, maxNum;
    ans = 0;
    for ( ll i = K; i <= N + 1; i++ ){
        minNum = 0;
        maxNum = 0;
        ll  minNum = ( i - 1 ) * i / 2;
        ll  maxNum = i * ( N + N - i + 1 ) / 2;
        ans += maxNum - minNum + 1;
        ans %= MODNum;
        //cout << i << " " << minNum << " " << maxNum << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>

int main(){
  int ret,color;
  int b = 0,w = 0;
  int now = 0;
  while(1){
    ret = scanf("%c",&color);
    if(ret == EOF || color == '\n') break;
    if(now == 0){
      if(color == '0') b++;
      else if(color == '1') w++;
      now = 1;
    }else if(now == 1){
      if(color == '1') b++;
      else if(color == '0') w++;
      now = 0;
    }
  }
  int answer = b;
  if(b > w) answer = w;
  printf("%d\n",answer);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a,b,c,k;
   cin>>a>>b>>c>>k;
   while(k&&a>=b)
   {
     k--;
     b*=2;
   }
    while(k&&b>=c)
   {
     k--;
     c*=2;
   }
  if(a<b&&b<c)
    cout<<"Yes";
  else
     cout<<"No";
  return 0;
}

Measured memory_bytes: 3624
from bisect import bisect_left, bisect_right

N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))


ans = 0
for i in range(N):
  la = bisect_left(A, B[i])
  rc = N - bisect_right(C, B[i])
  ans += la * rc
  
print(ans)

Measured memory_bytes: 23232
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
vector<ull> rolling_hash(string s,ull b = 1e9+7){
  vector<ull> res;
  res.push_back(0);
  REP(i,(ll)s.size()){
    ull tmp = b * res.back();
    tmp += s[i];
    res.push_back(tmp);
  }
  return res;
}
ull power(ull a,int n){
  ull res = 1,r = a;
  for (; n > 0;n>>=1,r*=r) res *= (n & 1? r:1);
  return res;
}
int main(){
  int n,m;
  string s,q;
  cin >> n >> m;
  cin >> s;
  unordered_set<ull> gr;
  auto hash = rolling_hash(s);
  int l = 0,r = 0;
  REP(i,m){
    cin >> q;
    if(q == "R++") r++;
    else if(q == "L++") l++;
    else if(q == "R--") r--;
    else if(q == "L--") l--;
    gr.insert(hash[r+1]-hash[l]*power((ull)MOD,r+1-l));
  }
  cout << gr.size() << endl;
}



Measured memory_bytes: 19644
#include <bits/stdc++.h>
using namespace std;
int main() {
    int k;
    cin>>k;
    int sum=0;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int l=1;l<=k;l++){
                sum+=__gcd(__gcd(i,j),l);

            }
        }
    }
    cout<<sum<<endl;
}

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

int main()
{
    int N;
    cin >> N;
    int divisorCount = 0;
    int result =0;
    for(int i = 1; i <= N; ++i)
    {
        for(int j = 1; j <= i; ++j)
            {
            if(i % j ==0)
            {
                divisorCount++;
            }
        }

        if(divisorCount == 8 && i %2 == 1)
        {
            result++;
        }

        divisorCount = 0;
    }

    cout << result << endl;

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define maxn 100
typedef long long ll;
const double eps = 1e-6;
double L;
double fun(double y)
{
    double x = (L-y)/2;
    return x*y*(L-x-y);
}
int main(void)
{
    cin>>L;

    double l = 0, r = L;
    double mid, mmid;
    while(l + eps < r)
    {
        mid = (l+r)/2.0;
        mmid = (mid + r)/2.0;
        double mid_val = fun(mid);
        double mmid_val = fun(mmid);
        if(mid_val > mmid_val)
            r = mmid;
        else l = mid;
    }
    printf("%.12lf\n",fun(l));
    return 0;
}


Measured memory_bytes: 256
using System;

class MyClass
{
    public static void Main(string[] args)
    {
        var str1 = Console.ReadLine();
        var str2 = Console.ReadLine();
        if ((str1 + str1).Contains(str2))
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 19768
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  prllf("%d",x);
#define pl(x)  prllf("%lld",x);
#define pf(x)  prllf("%.10lf",x);
#define ps(x)  prllf("%s",x);
#define en() prllf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define mod 100000007
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}
ll prime[1000000];bool visprime[10000000];
void sieve(){ll k=0;for(ll i=2;i*i<=1000000;i++){for(ll j=i*i;j<=1000000;j+=i){visprime[j]=true;}}for(ll i=2;i<=1000000;i++){if(visprime[i]==false) prime[k++]=i;}}


int main()
{

    int n;
    cin>>n;
    vector<int>arr(n);
    for(int i=0;i<n;i++)
        cin>>arr[i];
    sor(arr);
    double temp=arr[0];
    double ans=0.0;
    for(int i=1;i<n;i++)
    {

        ans=(temp+arr[i])*1.0/2.0;
      //  cout<<ans<<endl;
        temp=ans;
    }



    printf("%.5f\n",ans);



}
























Measured memory_bytes: 256
import java.util.Scanner;

//Palindromic Anagram
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		long[] f = new long[21];
		f[0] = 1;
		for(int i=1;i<21;i++)f[i]=f[i-1]*i;
		char[] s = sc.next().toCharArray();
		int N = s.length;
		int[] c = new int[26];
		for(char r:s)c[r-'a']++;
		int odd = 0;
		long res = 0;
		for(int i=0;i<26;i++)odd+=c[i]%2;
		if(N%2==0){
			if(odd==0){
				res = f[N/2];
				for(int i=0;i<26;i++)if(c[i]!=0)res/=f[c[i]/2];
			}
		}
		else {
			if(odd==1){
				for(int i=0;i<26;i++)if(c[i]%2==1)c[i]--;
				res = f[(N-1)/2];
				for(int i=0;i<26;i++)if(c[i]!=0)res/=f[c[i]/2];
			}
		}
		System.out.println(res);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq

#Union-Find
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())



#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
ans = 0

#print(AB)

for i in range(M):
  uf = UnionFind(N)
  for j in range(M):
    if(i==j):
      pass
    else:
      uf.union(AB[j][0]-1, AB[j][1]-1)
  #print(uf.size(0))
  if(uf.size(0)!=N):
    ans += 1

print(ans)


Measured memory_bytes: 41324
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    S = input()
    L = len(S)
    ans = 'NO'
    for i in range(0,8):
        s = S[:i] + S[L-7+i:]
        if s == 'keyence':
            ans = 'YES'
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1<<15;
int n,m,c[15][15];
int p[N],dp[N][15];
void init()
{
	memset(p,0,sizeof(p));
	for(int i=0;i<(1<<n);i++)
		for(int j=0;j<n;j++)
			dp[i][j]=-1;
	for(int i=0;i<(1<<n);i++)
	{
		for(int j=0;j<n;j++)
		{
			if(((i>>j)&1)==0)
				continue;
			for(int k=j+1;k<n;k++)
			{
				if(((i>>k)&1)==0)
					continue;
				p[i]+=c[j][k];
			}
		}
	}
}
int main()
{
	while(cin>>n>>m)
	{
		int sum=0; 
		int u,v,w;
		memset(c,0,sizeof(c));
		while(m--)
		{
			scanf("%d%d%d",&u,&v,&w);
			u--,v--;
			c[u][v]=c[v][u]=w;
			sum+=w;
		}

        
		init();
		dp[1][0]=0;
		for(int i=0;i<(1<<n);i++)
		{
			for(int j=0;j<n;j++)
			{
				if(dp[i][j]==-1)
					continue;
				int x=(((1<<n)-1)^i)|(1<<j);	//y is some subset of x
				for(int y=x;y>=0;y--)
					y&=x,dp[i|y][j]=max(dp[i|y][j],dp[i][j]+p[y]);	
					
				for(int k=0;k<n;k++)
				{
					if((i>>k)&1)
						continue;
					if(c[j][k]==0)
						continue;
					dp[i|(1<<k)][k]=max(dp[i|(1<<k)][k],dp[i][j]+c[j][k]);
				}
			}
		}
		int ans=1e9;
		for(int i=0;i<(1<<n);i++)
			ans=min(ans,sum-dp[i][n-1]);
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 2304
#pragma comment(linker,"/stack:16777216")
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7fffffff
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define forr(a,n) for(int a=n;a>=1;a--)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define repr(a,n) for(int a=n-1;a>=0;a--)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0x3f,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

int n;
ll a[410],s[410];
ll dp[410][410];
ll getsum(int l,int r){
	return s[r+1]-s[l];
}
int main(int argc,char** argv){
	cin>>n;
	rep(i,n){
		cin>>a[i];
	}
	rep(i,n){
		s[i+1]=s[i]+a[i];
		//cout<<i+1<<" "<<s[i+1]<<endl;
	}
	rep(i,n-1){
		dp[i][i+1]=a[i]+a[i+1];
	}
	for(int l=3;l<=n;l++){
		for(int i=0;i<=n-l;i++){
			int j=i+l-1;
			ll cur=getsum(i,j);
			dp[i][j]=LLINF;
			for(int k=i;k<j;k++){
				//cout<<i<<" "<<k<<" "<<j<<" "<<dp[i][k]<<" "<<dp[k+1][j]<<" "<<cur<<endl;
				dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+cur);
			}
		}
	}
	cout<<dp[0][n-1]<<endl;
	return 0;
}

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

int main() {
  int l;
  cin >> l;
  vector<int> digits;
  while (l > 0) {
    digits.push_back(l % 2);
    l /= 2;
  }
  int n = digits.size();
  int m = n * 2 - 3;
  for (int d : digits) {
    m += d;
  }
  cout << n << " " << m << "\n";
  for (int ni = 1; ni < n; ni++) {
    cout << ni << " " << ni + 1 << " " << 0 << "\n";
    cout << ni << " " << ni + 1 << " " << (1 << (ni - 1)) << "\n";
  }
  int offset = 1 << (n - 1);
  for (int ni = n - 2; ni >= 0; ni--) {
    if (digits[ni]) {
      cout << ni + 1 << " " << n << " " << offset << "\n";
      offset += (1 << ni);
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define test() ll t;cin>>t;while(t--)
#define MOD 1000000007
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)

int main() {
    SPEED;
    //CODE
	ll n,W;
	cin>>n>>W;
	ll w[n],v[n];
	for(ll i=0;i<n;i++) cin>>w[i]>>v[i];
	ll dp[n+1][W+1]={0};
	for(ll i=0;i<=n;i++){
		for(ll j=0;j<=W;j++){
			if(i==0||j==0){
				dp[i][j]=0;
			}
			else{
				if(w[i-1]<=j){
					dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
				}
				else{
					dp[i][j]=dp[i-1][j];
				}
			}
		}
	}
	cout<<dp[n][W];
	return 0;
}


Measured memory_bytes: 79104
# A
ans_string = "AKIHABARA"
n = len(ans_string)

S = input()
ans_list = ["AKIHABARA", "AKIHABAR", "AKIHABRA", "AKIHABR", 
            "AKIHBARA", "AKIHBAR", "AKIHBRA", "AKIHBR", 
            "KIHABARA", "KIHABAR", "KIHABRA", "KIHABR", 
            "KIHBARA", "KIHBAR", "KIHBRA" ,"KIHBR"
            ]
if S in ans_list:
    ans = "YES"
else:
    ans = "NO"
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
//小数点以下　cout << fixed << setprecision(10) << num << endl;

int main(){
    int x,y;
    cin >> x >> y;
    ll ans = 0;
    if(x==1) ans += 300000;
    if(x==2) ans += 200000;
    if(x==3) ans += 100000;
    if(y==1) ans += 300000;
    if(y==2) ans += 200000;
    if(y==3) ans += 100000;
    if(x==1 && y == 1) ans+=400000;
    cout << ans;
}



Measured memory_bytes: 256
#include<stdlib.h>
int int_cmp(const int *a, const int *b){
  if (*a < *b)
    return (-1);
  else if (*a > *b)
    return (1);
  return (0);} 
int main () {
int f[1001];
int F[1001];
int N,i,V,d,count;
N=1001;
f[0]=2;
f[1]=3;
for(i=2;i<1001;i++){f[i]=f[i-1]+f[i-2];f[i]=f[i]%N;}
for(;~scanf("%d%d",&V,&d);){
  count = 1;
  for(i=0;i<V;i++)F[i]=f[i];
  qsort(F,V,sizeof(int),(int(*)(const void*, const void*))int_cmp);
  for(i=1;i<V;i++)
    if( F[ i] - F[ i - 1] > d - 1)
      count++;
  printf( "%d\n" , count);
 }
 return 0;
}

Measured memory_bytes: 644
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
	long n;
	cin >> n;
	vector<long long> a(n,0),b(2*n+10,-1);
	for(long i=0;i<n;i++){
		cin >> a[i];
	}
	bool d=false;
	for(long i=0;i<n;i++){
		if(i%2==0){
			b[n+i]=a[i];
			d=false;
		}else{
			b[n-i]=a[i];
			d=true;
		}
	}
	if(d==true){
		for(long i=0;i<b.size();i++){
			if(b[i]>=0){
				cout << b[i] << " ";
			}
		}
	}else{
		for(long i=b.size()-1;i>=0;i--){
			if(b[i]>=0){
				cout << b[i] << " ";
			}
		}
	}
	cout << endl;
	return 0;
}


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

using namespace std;

vector<string> v;
int n;
vector<string> ab;

bool util(int i, int a, int b, int c){
    if(a<0 || b<0 || c<0)
        return false;
    if(i>=n)
        return true;
    bool ans=false;
    if(v[i]=="AB"){
        ab.push_back("B");
        ans|=util(i+1, a-1, b+1, c);
        if(ans)
            return true;
        ab.pop_back();
        ab.push_back("A");
        ans|=util(i+1, a+1, b-1, c);
        if(ans)
            return true;
        ab.pop_back();
    }
    else if(v[i]=="AC"){
        ab.push_back("C");
        ans|=util(i+1, a-1, b, c+1);
        if(ans)
            return true;
        ab.pop_back();
        ab.push_back("A");
        ans|=util(i+1, a+1, b, c-1);
        if(ans)
            return true;
        ab.pop_back();
    }
    else{
        ab.push_back("C");
        ans|=util(i+1, a, b-1, c+1);
        if(ans)
            return true;
        ab.pop_back();
        ab.push_back("B");
        ans|=util(i+1, a, b+1, c-1);
        if(ans)
            return true;
        ab.pop_back();
    }
    return ans;
}

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

	int a, b, c;
	cin >> n >> a >> b >> c;

	v=vector<string>(n);
	for(int i=0; i<n; i++)
        cin >> v[i];

    if(util(0, a, b, c)){
        cout << "Yes" << endl;
        for(auto i: ab)
            cout << i << endl;
    }
    else
        cout << "No" << endl;

	return 0;
}


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

int main(){
  int N;
  cin>>N;
  map<string, int> gacha;
  int count=0;
  for(int i=0; i<N; i++){
    string S;
    cin>>S;
    if(!gacha.count(S)){
      gacha[S]=1;
      count++;
    }
  }
  cout<<count<<endl;
}
 

Measured memory_bytes: 19256
#include<iomanip>
#include <string>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
#define nin(n) int n; cin >> n;
#define kin(k) int k; cin >> k;

int main() {
  int k,n;
  cin >> k >> n;
  for(int i=k*(-1)+1;i<k;i++){
    cout << n+i << " ";
  }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int n;
int G[100005];
int P[100005], S[100005];

int main(){
  	
  	scanf("%d",&n);
  	for ( int i = 1; i <= n; i++ ) scanf("%d",&G[i]);
  	for ( int i = 1; i <= n; i++ ){
  		P[i] = __gcd(P[i-1],G[i]);	
	}
	for ( int i = n; i >= 1; i-- ){
		S[i] = __gcd(S[i+1],G[i]);
	}
	
	int ans = 0;
	for ( int i = 1; i <= n; i++ ){
		ans = max( ans, __gcd(P[i-1], S[i+1]));
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		
		int val = scan.nextInt();
		int val2 = val;
		val = scan.nextInt();
		
		System.out.print(val * val2 + " ");
		System.out.println(val + val + val2 + val2);	
	}
}

Measured memory_bytes: 17156
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 100;
typedef long long ll;

int main(){
	int n;
	cin >> n;
	int flag = 0;
	for (int i = 1;i <= n; i++){
		int x;
		cin >> x;
		if (x % 2 != 0)
			continue;
		else{
			if (x % 3 != 0 && x % 5 != 0)
				flag = 1;
		}
	}
	if (flag)
		cout << "DENIED" << endl;
	else
		cout << "APPROVED" << endl;
	return 0;
}

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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    int a, b, c, d, n, x, y;
    string s, t;


    auto Yes = [&](bool t){
        cout << (t ? "Yes" : "No") << endl;
    };
    auto YES = [&](bool t){
        cout << (t ? "YES" : "NO") << endl;
    };
    auto tri = [&](bool t, string a, string b){
        cout << (t ? a : b) << endl;
    };

    cin >> s;
    for(int i = 0; i < 4; ++i)
        cout << s[i];
    cout << " ";
    for(int i = 4; i < 12; ++i)
        cout << s[i];
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;

map<int, int> prime_factor(int n) {
    map<int, int> prime;
    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            prime[i]++;
            n /= i;
        }
    }
    if (n != 1) prime[n] = 1;
    return prime;
}

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

    map<int, int> res = prime_factor(n);
    cout << n << ": ";
    for (auto itr = res.begin(); itr != res.end(); itr++) {
        if (++itr == res.end()) {
            --itr;
            rep(i, itr->second - 1) {
                cout << itr->first << " ";
            }
            cout << itr->first;
        }
        else {
            --itr;
            rep(i, itr->second) {
                cout << itr->first << " ";
            }
        }
    }
    cout << endl;
    return 0;
}


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

int main(){
  string S;
  cin >> S;
  int a=0;
  if(S[0] == 'o') ++a;
  if(S[1] == 'o') ++a;
  if(S[2] == 'o') ++a;
  cout << 100*a + 700 << endl;
}

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


int main(){
    int N; cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    int num = 0;
    rep(i, N){
        if(a[i] == num + 1){
            num = a[i];
        }
    }
    if(num == 0){
        cout << -1 << endl;
        return 0;
    }
    cout << N - num << endl;
}

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

const int mod=1000000007;
int n,a[200005],sum[200005];
typedef long long ll;
ll ans;

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

Measured memory_bytes: 5388
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define MAXC(c, x) (c = max(c, x))
#define MINC(c, x) (c = min(c, x))

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

const ll INF = 1e9;

int main() {
#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);
	ll n, m; cin >> n >> m;
	vvl g(n);
	REP(i, n + m - 1) {
		ll a, b; cin >> a >> b;
		a--, b--;
		g[a].push_back(b);
	}

	vl visited(n, false);
	function<void(ll)> dfs = [&](ll cur) {
		visited[cur] = true;
		for (auto next : g[cur]) {
			if (!visited[next]) dfs(next);
		}
		return;
	};
	ll root = -1;
	REP(i, n) {
		if (!visited[i]) {
			root = i;
			dfs(i);
		}
	}

	vl ans(n, -1);
	visited = vl(n, false);
	function<void(ll)> dfs2 = [&](ll cur) {
		for (auto next : g[cur]) if (!visited[next]) {
			dfs2(next);
		}
		for (auto next : g[cur]) if (!visited[next]) {
			visited[next] = true;
			ans[next] = cur;
		}
		return;
	};
	dfs2(root);
	REP(i, n) cout << (ans[i] + 1) << endl;
}


Measured memory_bytes: 14064
s = input()
if s != s[::-1]:
    print('No')
    exit(0)
n = len(s)
ss = s[:(n-1)//2]
#print(ss)
if ss != ss[::-1]:
    print('No')
    exit(0)
sss = s[(n+3)//2-1:]
#print(sss)
if sss!=sss[::-1]:
    print("No")
    exit(0)
print("Yes")


Measured memory_bytes: 3060
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF=10**9

def search(now, a, b, c):
  if now == N:
    return abs(A-a) + abs(B-b) + abs(C-c) if min(a, b, c) > 0 else INF
  MP0 = search(now+1, a, b, c)
  MP1 = search(now+1, a+l[now], b, c) + 10
  MP2 = search(now+1, a, b+l[now], c) + 10
  MP3 = search(now+1, a, b, c+l[now]) + 10
  return min(MP0, MP1, MP2, MP3)

print(search(0,0,0,0)-30)

Measured memory_bytes: 3064
#include <stdio.h>
#define N 100

void printA(int *A,int n){
	int i;
	for(i=0;i<n;i++){
		printf("%d",A[i]);
		if(i!=n-1)printf(" ");
		else printf("\n");
	}
}

void bubbleSort(int *A,int n){
	int j,flag,tmp;
	int count = 0;
	flag = 1;
	while(flag){
		flag = 0;
		for(j=n-1;j>0;j--){
			if(A[j]<A[j-1]){
				tmp = A[j];
				A[j] = A[j-1];
				A[j-1] = tmp;
				count++;
				flag = 1;
			}
		}
	}
	printA(A,n);
	printf("%d\n",count);
}

int main(){
	int n;
	int i;
	int A[N];

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}

	bubbleSort(A,n);

	return 0;
}

Measured memory_bytes: 1820