akhauriyash/Code-Regression huggingface dataset:
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define st first
#define nd second

using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set =
	tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
#define shandom_ruffle random_shuffle
 
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;

const int kMaxSize = 1e6;

int n;
int answer[kMaxSize];
int pwr3;
int cur_digs[kMaxSize];
int ans_digs[kMaxSize];

string Reduce(string T) {
	string ans;
	for (char ch : T) {
		if (ch == 'R') {
			ans += ch;
		} else if (!ans.empty() && ans.back() == 'S') {
			ans.pop_back();
		} else {
			ans += ch;
		}
	}
	return ans;
}

void PutAns() {
	int from = 0, to = 0;
	for (int i = n - 1; i >= 0; --i) {
		from = from * 3 + cur_digs[i];
		to = to * 3 + ans_digs[i];
	}
	answer[from] = to;
}

void Solve(int digit, string T) {
	if (digit == n) {
		return PutAns();
	}

	for (int d : {0, 1, 2}) {
		int cur_d = d;
		string next_t;
		for (char ch : T) {
			if (ch == 'S') {
				next_t += ch;
				if (cur_d) { cur_d = 3 - cur_d; }
			} else {
				++cur_d;
				if (cur_d == 3) {
					next_t += ch;
					cur_d = 0;
				}
			}
		}

		cur_digs[digit] = d;
		ans_digs[digit] = cur_d;
		Solve(digit + 1, Reduce(next_t));
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(11);
	cerr << fixed << setprecision(6);

	string T;
	cin >> n >> T;
	T = Reduce(T);

	pwr3 = 1;
	for (int i = 0; i < n; ++i) {
		pwr3 *= 3;
	}

	Solve(0, T);
	for (int i = 0; i < pwr3; ++i) {
		cout << answer[i] << " ";
	}
	cout << "\n";
}


Measured memory_bytes: 6988
#include <stdio.h>

int main()
{
        int n, num = 0;
        long long a[100010], sma = 1000000000000, sum = 0;
        scanf("%d", &n);
        for (int i = 0; i < n; i++)
        {
                scanf("%lld", &a[i]);
                if (a[i] < 0)
                {
                        num++;
                        a[i] *= -1;
                }
                if (sma > a[i])
                {
                        sma = a[i];
                }
                sum += a[i];
        }
        if (num % 2 == 1)
        {
                sum -= 2 * sma;
        }
        printf("%lld\n", sum);
}

Measured memory_bytes: 896
#include <stdio.h>
#include <stdlib.h>

int main()
{
        int number = 0, count = 0, count_iner = 0;
        int list[100], tmp = 0, swap_operation = 0;

        scanf("%d", &number);
        while ( count < number )
        {
                scanf("%d", &list[count]);
                count = count + 1;
        }

        count = 0;
        for ( count = 0 ; count < number ; count = count + 1 )
        {
                for ( count_iner = number - 1 ; count_iner > count ; count_iner = count_iner - 1 )
                {
                        if ( list[count_iner] < list[count_iner -1 ] )
                        {
                                tmp = list[count_iner];
                                list[count_iner] = list[count_iner - 1];
                                list[count_iner - 1] = tmp;
                                swap_operation = swap_operation + 1;
                        }
                }
        }

        count = 0;
        while ( count < number )
        {
                if ( count == number -1 )
                {
                        printf("%d", list[count] );
                }
                else
                {
                        printf("%d ", list[count]);
                }
                count = count + 1;
        }

        printf("\n%d\n", swap_operation);
        return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
ll mod;
 
ll powimod(ll x,ll n,ll mod){
    ll res=1;
    while(n){
        if(n&1) res=(res*x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return res;
}
 
ll powi(ll x,ll n){
    ll res=1;
    while(n){
        if(n&1) res*=x;
        x*=x;
        n>>=1;
    }
    return res;
}
 
vector<int> z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r)
            z[i] = min (r - i + 1, z[i - l]);
        while (i + z[i] < n && s[z[i]] == s[i + z[i]])
            ++z[i];
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }
    return z;
}
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
  int x,y;
  cin>>x>>y;
  if(y&1) cout<<"No";
  else
  {
    y/=2;
    if(y>=x&&2*x>=y) cout<<"Yes";
    else cout<<"No";
  }
}

Measured memory_bytes: 3660
def F_0(n):
    if n%2 == 0:
        if (n//2)%2 == 0:
            return n
        else:
            return n+1
    else:
        if ((n-1)//2)%2 == 0:
            return 1
        else:
            return 0

if __name__ == '__main__':
    A, B = map(int, input().split())
    
    A_bi = bin(F_0(A-1))[2:]
    B_bi = bin(F_0(B))[2:]
    
    answer=[]
    
    if len(A_bi) > len(B_bi):
        A_bi, B_bi = B_bi, A_bi
        
    max_len = len(B_bi)
    pad = max_len - len(A_bi)
    A_bi = '0'*pad + A_bi
    
    for i in range(max_len):
        
        if A_bi[i] == B_bi[i]:
            answer.append('0')
        else:
            answer.append('1')
        
    print(int(''.join(answer), 2))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <bitset>

using namespace std;

int gcd(int n, int m) {
    if (n == 0) return m;
    return gcd(m % n, n);
}

int bit_count(int i) {
    i = i - ((i>>1) & 0x55555555);
    i = (i & 0x33333333) + ((i>>2) & 0x33333333);
    i = (i + (i>>4)) & 0x0f0f0f0f;
    i = i + (i>>8);
    i = i + (i>>16);
    return i & 0x3f;
}

bool n_bit(int i, int n) {
    return (i >> n) & 1;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<bool>> switches(m, vector<bool>(n, false));

    for (int i = 0; i < m; ++i) {
        int k;
        cin >> k;
        for (int j = 0; j < k; ++j) {
            int s;
            cin >> s;
            switches[i][s-1] = true;
        }
    }

    vector<int> p(m);
    for (int i = 0; i < m; ++i) {
        cin >> p[i];
    }

    int ans = 0;
    for (int i = 0; i < pow(2, n); ++i) {
        bool ok = true;

        for (int j = 0; j < m; ++j) {
            int sum = 0;

            for (int k = 0; k < n; ++k) {
                if (switches[j][k] && n_bit(i, k)) sum++;
            }

            if (sum % 2 != p[j]) {
                ok = false;
                break;
            }
        }

        if (ok) ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_20190707_1
{    class Program
    {
        static void Main(string[] args)
        {
            string N = Console.ReadLine();

            long answer = 0;

            for(int i = 0; i < N.Length; i++)
            {
                answer += int.Parse(N[i].ToString());
            }

            if(answer % 9 == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

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

using namespace std;

const int MOD = 1e9 + 7;
const long long INF = 1e18;
const int MaxN = 3e3 + 13;
const int MaxH = 1e5 + 15;

int H, W, N;
vector <pair<int, int> > walls;

int f[MaxH * 2];
int rf[MaxH * 2];

int cnk(int n, int k)
{
    int d = (long long) rf[k] * rf[n - k] % MOD;
    return (long long) f[n] * d % MOD;
}

int bpow(int a, int b)
{
    int res = 1;
    while(b)
    {
        if(b & 1)
            res = (long long) res * a % MOD;
        a = (long long) a * a % MOD;
        b >>= 1;
    }
    return res;
}

void fillFact()
{
    f[0] = rf[0] = f[1] = rf[1] = 1;
    for(int i = 2; i < MaxH * 2; ++i)
    {
        f[i] = (long long) f[i - 1] * i % MOD;
        rf[i] = bpow(f[i], MOD - 2);
    }
}

int numberOfWays(int x, int y)
{
    return cnk(x - 1 + y - 1, x - 1);
}

void sub(int & x, int y)
{
    x -= y;
    if(x < 0)
        x += MOD;
}

int dp[MaxN];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);

    cin >> H >> W >> N;
    walls.resize(N);
    for(auto & x : walls)
        cin >> x.first >> x.second;

    walls.push_back(make_pair(H, W));
    ++N;

    fillFact();

    sort(walls.begin(), walls.end());

    for(int i = 0; i < N; ++i)
    {
        dp[i] = numberOfWays(walls[i].first, walls[i].second);
        for(int j = 0; j < i; ++j)
            if(i != j)
                if(walls[j].first <= walls[i].first && walls[j].second <= walls[i].second)
                {
                    sub(dp[i], (long long) dp[j] * numberOfWays(walls[i].first - walls[j].first + 1, walls[i].second - walls[j].second + 1) % MOD);
                }
    }

    cout << dp[N - 1] << '\n';

    return 0;
}



Measured memory_bytes: 1920
import java.util.Scanner;

public class Main {

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

        int a = s.nextInt();
        int b = s.nextInt();

        if (a == b) {
            System.out.println(a * 2);
        } else {
            System.out.println(Math.max(a, b) * 2 - 1);
        }
    }
}

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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
using namespace std; 

int n, m, q;
v2_int Sum;

int main(void)
{
    int h, w;
    cin >> h >> w;

    v2_int a(h, v_int(w));
    
    irep(i, h) {
        irep(j, w) {
            cin >> a[i][j];
        }
    }
    
    v_int x, y, x2, y2;
    int ans = 0;
    irep(i, h-1) {
        irep(j, w) {
            if(a[i][j]%2 != 0) {
                ans++; 
                a[i+1][j]++;
                x.push_back(i+1);
                y.push_back(j+1);
                x2.push_back(i+2);
                y2.push_back(j+1);
            }
        }
    }

    irep(j, w-1) {
        if(a[h-1][j] % 2 != 0) {
            ans++;
            a[h-1][j+1]++;
            x.push_back(h);
            y.push_back(j+1);
            x2.push_back(h);
            y2.push_back(j+2);
        }
    }
    
    printf("%d\n", ans);
    irep(i, ans) {
        printf("%d %d %d %d\n", x[i], y[i], x2[i], y2[i]);
    }

    return 0;
}
/** tcoder **/


Measured memory_bytes: 5224
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
  
int max(int a, int b);
  
/* Returns length of LCS for X[0..m-1], Y[0..n-1] */
int lcs( char *X, char *Y, int m, int n )
{
   int L[m+1][n+1];
   int i, j;
  
   /* Following steps build L[m+1][n+1] in bottom up fashion. Note
      that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] */
   for (i=0; i<=m; i++)
   {
     for (j=0; j<=n; j++)
     {
       if (i == 0 || j == 0)
         L[i][j] = 0;
  
       else if (X[i-1] == Y[j-1])
         L[i][j] = L[i-1][j-1] + 1;
  
       else
         L[i][j] = max(L[i-1][j], L[i][j-1]);
     }
   }
    
   /* L[m][n] contains length of LCS for X[0..n-1] and Y[0..m-1] */
   return L[m][n];
}
  
/* Utility function to get max of 2 integers */
int max(int a, int b)
{
    return (a > b)? a : b;
}
  

int main()
{
  char X[1001], Y[1001];
  int m, n, Z[151], k, i;
 
  scanf("%d", &k);
  for(i = 0;i < k;i++){
    scanf("%s %s", X, Y);
    m = strlen(X);
    n = strlen(Y);
    Z[i] = lcs( X, Y, m, n );
  }
 
  for(i = 0; i < k; i++) printf("%d\n", Z[i]);
 
  return 0;
}

Measured memory_bytes: 4516
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 2000000009
#define mod 1000000007
using namespace std;

int main()
{ 


    fast;

    ll k,x;
    cin>>k>>x;

    ll q=1000000;

    ll lt=max(x-k+1,-q);
    ll rt=min(x+k-1,q);

    for(ll i=lt;i<=rt;i++)
      cout<<i<<" ";
   
  
  }

Measured memory_bytes: 256
d,g = map(int,input().split())
P = [0]*d
C = [0]*d
for i in range(d):
    P[i],C[i] = map(int,input().split())

ans = float('inf')
for i in range(2**d):
    tmp = 0
    res = 0
    for j in range(d):
        if ((i>>j)&1):
            tmp+=C[j]+(j+1)*100*P[j]
            res+=P[j]
    if tmp<g:
        for j in range(d-1,-1,-1):
            if not ((i>>j)&1):
                if tmp>=g:
                    break
                if tmp+(j+1)*100*P[j]<=g:
                    tmp+=(j+1)*100*P[j]
                    res+=P[j]
                else:
                    for p in range(P[j]):
                        if tmp>=g:
                            break
                        tmp+=(j+1)*100
                        res+=1
    ans = min(ans,res)
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define endl '\n'
#define INF (1 << 21)
const int MOD = 1000000007;
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  string b, w;
  int bc = 0, wc = 0;

  cin >> s;
  
  for(int i = 0;i < s.size();i++){
    if(i % 2 == 0){
      b += '0';
      w += '1';
    }else{
      b += '1';
      w += '0';
    }
  }

  for(int i = 0;i < s.size();i++){
    if(s[i] != b[i]){
      bc++;
    }else if(s[i] != w[i]){
      wc++;
    }
  }

  cout << min(bc, wc) << endl;
  return 0;
}



Measured memory_bytes: 720
N = int(input())

max_a = int(N ** 0.5)+2
cnt = 0
for a in range(1, max_a):
  for b in range(a, N+1):
    if a*b >= N:
      break
    elif a == b:
      cnt += 1
    else:
      cnt += 2
        

print(cnt)
    

Measured memory_bytes: 65860
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
// run : ctrl + c 

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



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

    int x,y,z;
    cin>>x>>y>>z;
    int n = x+y+z;
    ll a[n],b[n],c[n];
    array<ll,3> v[n];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
        v[i] = {b[i] - a[i],c[i],a[i]};
    }
    sort(v,v+n);
    ll pre[n]={}, pos[n]={};
    priority_queue<ll> pq;
    for(int i=0;i<x;i++){
        pq.push(v[i][1] - v[i][2]);
        pre[i] = v[i][2];
        if(i) pre[i] += pre[i-1];
        //cerr << pre[i] << endl;
    }
    for(int i=x;i<x+z;i++){
        pq.push(v[i][1] - v[i][2]);
        ll p = pq.top();
        pq.pop();
        pre[i] += v[i][2];
        pre[i] += pre[i-1] + p;
        //cerr << pre[i] << endl;
    }
    while(pq.size()) pq.pop();
    for(int i=0;i<y;i++){
        pq.push(v[n-1-i][1] - (v[n-1-i][0]+v[n-1-i][2]));
        pos[n-1-i] = v[n-1-i][0] + v[n-1-i][2];
        if(i) pos[n-1-i] += pos[n-i];
    }
    for(int i=y;i<z+y;i++){
        pq.push(v[n-1-i][1] - (v[n-1-i][0] + v[n-1-i][2]));
        ll p = pq.top();
        pq.pop();
        pos[n-1-i] = v[n-1-i][0] + v[n-1-i][2];
        pos[n-1-i] += pos[n-i] + p;
    }
    ll ans = 0;
    for(int i=x-1;i<x+z;i++){
        cerr << pre[i] << " " << pos[i+1] << endl;
        if(chmax(ans,pre[i]+pos[i+1])){
            //cerr << i << " " << ans << " " << pre[i] << " " << pos[i+1] << endl;
        }
    }
    cout << ans << endl;



}

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

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};


int main(){
  int N,M;
  cin>>N>>M;
  UnionFind uf(N);
  int a,b;
  for(int i=0;i<M;i++){
    cin>>a>>b;
    a--;b--;
    uf.unite(a,b);
  }
  int ans=0;
  for(int i=0;i<N;i++){
    ans=max(ans,uf.size(i));
  }
  cout<<ans<<endl;
  return 0;
}

 


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

int P[10010];
void init(int N);
int  root(int a);
bool is_same_set(int a,int b);
void unite(int a,int b);

int main() {
  int n,q;
  cin >> n >> q;
  init(n);
  for (int i=0;i<q;++i) {
    int com,x,y;
    cin >> com >> x >> y;
    if (com==0) unite(x,y);
    else if (com==1) cout << is_same_set(x,y) << endl;
  }
}

void init(int N) {
  for (int i=0;i<N;++i) P[i] = i;
}

int root(int a) {
  if (P[a]==a) return a;
  return (P[a]=root(P[a]));
}

bool is_same_set(int a,int b) {
  return root(a)==root(b);
}

void unite(int a,int b) {
  P[root(a)] = root(b);
}

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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)
#define fi first
#define se second

using namespace std; 

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";} 
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}
template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int ans = 0;
int n,m;

void dfs(v2_int g, v_bool seen, int node, int cnt) 
{
    bool ok = true;
    irep(i, n) {
        if(!seen[i]) { ok = false; }
    }

    if(ok && cnt == n) { ans++; return; }

    for(int i = 0; i < g[node].size(); i++) {
        int to = g[node][i];
        if(seen[to]) { continue; }
        seen[to] = true;
        dfs(g, seen, to, cnt+1);
        seen[to] = false;
    }
    return ;
}

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

    v2_int g(n, v_int(n));
    irep(i, m) {
        int a,b;
        cin >> a >> b;
        g[a-1].push_back(b-1);
        g[b-1].push_back(a-1);
    }
    
    v_bool seen(n,false);
    seen[0] = true;
    dfs(g, seen, 0, 1);
    cout << ans << endl;
    return 0;
}

/*atcoder*/


Measured memory_bytes: 3616
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


inf = float('inf')


# globals
N, K = 0, 0
A = []


def set_inputs():
    global N, K, A
    N, K = get_li()
    A = get_li()
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    k = K - 1
    print(1 + ((N - K) + k - 1) // k)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return zip(*(
        [t(x) for t, x in zip(types, input().split())]
        for _ in range(n)
    ))


if __name__ == '__main__':
    main()


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

int main()
{
  int n,c,i;
  string s;
  cin>>n;
  cin>>s;
  char ch=s[0];
  c=1;
  for(i=1;i<n;i++)
  {
      if(s[i]!=ch)
      {
          c++;
          ch=s[i];
      }
  }
  cout<<c<<endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<pair<int ,int> > p(n);
    int x[n];
    int l[n];
    for(int i = 0;i < n; i++){
        int a,b;
        cin >> a;
        cin >> b;
        x[i] = a;
        l[i] = b;
        p[i] = make_pair(a + b, i);
    }
    sort(p.begin(),p.end());
    int cnt = 1;
    int max = p[0].first;
    for(int i = 1; i < n; i++){
        if(max <= x[p[i].second] - l[p[i].second]){
            max = p[i].first;
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1000000000; //
const ll LINF = (ll) 4000000000000000000; //
const ll MOD = (ll) 1000000007; //
const double PI = 3.1415926535898; //

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define NP(v) next_permutation(v.begin(),v.end())

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

int main() {
    int n;
    cin >> n;
    ll a[n + 1];
    rep2(i, n) cin >> a[i];
    a[0] = 0;
    a[n + 1] = 0;
    ll dist[n + 1];
    ll sub[n + 1];

    rep3(i, n) {
        dist[i] = abs(a[i + 1] - a[i]);
    }
    
    ll sum = 0;
    rep3(i, n) sum += dist[i];

    rep2(i, n) {
        sub[i] = - dist[i - 1] - dist[i] + abs(a[i + 1] - a[i - 1]);
    }
    
    rep2(i, n) {
        cout << sum + sub[i] << endl;
    }

    return 0;
}


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

int main() {
  string a, b;
  cin >> a >> b;
  string c = a+b;
  int d = stoi(c);
  if(int(sqrt(d))*int(sqrt(d))==d) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3660
import random
from copy import deepcopy

d = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for _ in range(d)]

ans = []

for i in range(d):
    ans.append(s[i].index(max(s[i]))+1)

def score(l):
    lastd = [0]*26
    point = 0
    for j,k in enumerate(l):
        kk = k-1
        point += s[j][kk]
        lastd[kk] = j+1
        for l in range(26):
            point -= c[l]*(j+1-lastd[l])
    return point

ma = score(ans)

def random_search():
    global ans,ma
    li = deepcopy(ans)
    D = random.randrange(0,d,1)
    Q = random.randrange(0,26,1)
    li[D] = Q+1
    if score(li) > ma:
        ans = deepcopy(li)
        ma = score(li)

for i in range(10000):
    random_search()

for i in ans:
    print(i)

Measured memory_bytes: 83960
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define maxn 105
int main(void)
{
	int a[maxn],b[maxn],x,n;
	while(~scanf("%d%d",&x,&n))
	{
		memset(b,0,sizeof(b));
		for(int i=0;i<n;++i)
		{
			scanf("%d",&a[i]);
			b[a[i]]++;
		}
		int p=x;
		for(int i=0;;i++)
		{
			if(b[p-i]==0)
			{
				p-=i;
				break;
			}
			if(b[p+i]==0)
			{
				p+=i;
				break;
			}
		}
		printf("%d\n",p);
	}
	
	
	return 0;
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
//mistyさんコードを参考に勉強
int main(){
  string s0="",s1,s2=""; //s0は前、s1は真ん中、s2は後
  int n,q,f;
  char c;
  bool flag=0;//0なら順番、1なら逆順
  cin>>s1>>n;
  
  for (int i=0; i<n; i++){
    cin>>q;
    if(q==1){
      flag=!flag;
    }else{
      cin>>f>>c;
      if(!flag){ //順番
        if (f==1){
          s0 =s0+c;
        } else {
          s2=s2+c;
        }
        //(f==1?s0:s2)+=c;
      } else { //逆順
        (f==2?s0:s2)+=c;
      }
    }
  }
  if(!flag){
    reverse(s0.begin(),s0.end());
    cout<<s0+s1+s2;  
  }else{
    reverse(s0.begin(),s0.end());
    string s3=s0+s1+s2;
    reverse(s3.begin(),s3.end());
	cout << s3;
  }
}

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

int main(void)
{
    string s;
    cin >> s;
    if(s.length()%2==1){
        cout << "No" << endl;
        return 0;
    }
    for(int i=0; i<s.length(); i++)
    {
        if(i%2==0 && s[i]!='h')
        {
            cout << "No" << endl;
            return 0;
        }
        if (i%2==1 && s[i]!='i')
        {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll N; cin >> N;
	set<ll> ans;
	for (ll x = 2; x * x <= N; ++x) {
		ll C = N;
		bool found = false;
		while (C) {
			if (C == 1) break;
			if ((C - 1) % x == 0) {
				ans.insert(x);
				if (N == C) ans.insert((C-1)/x);
			}
			if (C % x) break;
			C /= x;
		}
		if (C == 1) ans.insert(x);
	}
	
	if (N > 2) ans.insert(N-1);
	ans.insert(N);
	print(ans.size());
}

Measured memory_bytes: 384
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int p = sc.nextInt();
        char[] c = sc.next().toCharArray();
        int[] a = new int[n];
        for(int i=0; i<n; i++) {
            a[i] = c[n-1-i]-'0';
        }

        long res = 0;
        if(p == 2 || p == 5) {
            for(int i=0; i<n; i++) {
                if(a[i] % p == 0) {
                    res += n - i;
                }
            }
            System.out.println(res);
            return;
        }

        int[] s = new int[n];
        s[0] = a[0] % p;
        int base = 1;
        int[] rem = new int[p];
        rem[0] = 1;
        rem[s[0]] ++;
        for(int i=1; i<n; i++) {
            base *= 10;
            base %= p;
            s[i] = (s[i-1] + base * a[i]) % p;
            rem[s[i]]++;
        }
        for(int i=0; i<p; i++) {
            long r = rem[i];
            res += r * (r-1) / 2;
        }
        System.out.println(res);
    }

}




Measured memory_bytes: 30372
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}

int main(void){

  int n,l;
  scanf("%d %d", &n, &l);
  char s[n][l+1];
  for (int i = 0; i < n; i++) {
    scanf("%s", s[i]);
  }
  qsort(s, n, sizeof(s[0]), cmp_s);
  for (int i = 0; i < n; i++) {
    printf("%s", s[i]);
  }
  printf("\n");

  return 0;
}

Measured memory_bytes: 128
import qualified Data.Vector.Unboxed as U
import qualified Data.ByteString.Char8 as C
import Data.List
import Data.Maybe
import qualified Data.IntMap as IM

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

main :: IO ()
main = do
    [n,p] <- r'

    let a +% b = (a + b) `rem` p
    let a *% b = (a * b) `rem` p
    let b ^% e = powAux (b `rem` p) e 1 `mod` p
            where
                powAux _ 0 ac = ac
                powAux b e ac = powAux (b*b `rem` p) (e `quot` 2)
                    (if odd e then b*ac `rem` p else ac)

    s <- getLine

    let fc = U.sum $ U.imap (\i d -> if read [d] `rem` p == 0 then i+1 else 0) $ U.fromList s
    let rems = scanr (+%) 0 $ map (`rem` fromIntegral p) $ zipWith (*%) [10 ^% x | x<-[n-1,n-2..0] ] $ map (read.pure) $ s

    if gcd 10 p == p then print fc
        else print $ sum $ snd $ mapAccumR (\mp a ->  (IM.alter (\x->case x of Nothing -> Just 1; Just y -> Just (y+1) ) a mp, fromMaybe 0 (IM.lookup a mp)) ) IM.empty rems


Measured memory_bytes: 271996
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int main(){
	bool x[100]={};
	int N,M;
	cin>>N>>M;
	rep(i,M){
		int a,b;
		cin>>a>>b;
		rep(j,b) x[(a+j)%N]=1;
	}
	int ans[101]={};
	int s=-1;
	rep(i,N) if(!x[i]) s=i;
	if(s==-1){
		cout<<N<<" "<<1<<endl;
		return 0;
	}
	int now=0;
	rep(i,N){
		int p=(s+i)%N;
		if(x[p]) now++;
		else{
			if(now>0) ans[now]++;
			now=0;
		}
	}
	if(now>0) ans[now]++;
	for(int i=N;i>0;i--){
		if(ans[i]) cout<<i<<" "<<ans[i]<<endl;
	}
}


Measured memory_bytes: 1164
import sys
input = sys.stdin.readline

X,Y,Z,K = map(int,input().split())
A = sorted(list(map(int,input().split())),reverse=True)
B = sorted(list(map(int,input().split())),reverse=True)
C = sorted(list(map(int,input().split())),reverse=True)

res = []

for a in A:
    for b in B:
        res.append(a+b)

res.sort(reverse=True)

res = res[:K]
ans = []

for ab in res:
    for c in C:
        ans.append(ab+c)
    
ans.sort(reverse=True)
ans = ans[:K]

for a in ans:
    print(a)

Measured memory_bytes: 155196
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
using namespace std;


const long long INF = 1LL << 30;
int cost[1000000];

int main() {
	int N, K;

	cin >> N >> K;

	for (int i=0; i<1000000; i++) {
		cost[i] = INF;
	}
	cost[0] = 0;

	vector<int> H(N);
	for (int i=0; i<N; i++) {
		cin >> H.at(i);
	}

	for (int i=0; i<N; i++) {
		for(int k=1; k<=K; k++){
			if(i+k < N) {
				int c = cost[i] + abs(H.at(i) - H.at(i + k));

				if(c < cost[i+k]) cost[i+k] = c;
			}
		}
	}

	cout << cost[N-1];


}


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


using namespace std;


const int MAXN = 3000 + 3;



int n, a[MAXN];
vector<int> v, g[MAXN];




bool dfs(int v, int p = -1) {
    bool ret = false;
    for (auto u : g[v])
        if (u != p && a[u] < a[v])
            ret |= !dfs(u);
    return ret;
}







int main() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 1; i < n; i++) {
        int u, v;
        cin >> u >> v;
        g[--u].push_back(--v), g[v].push_back(u);
    }
    for (int i = 0; i < n; i++)
        if (dfs(i))
            cout << i + 1 << ' ';
    return 0;
}

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


int main() {
    int n,m;
    cin >> n>>m;
    vector<ll> h(n);
    rep(i,n) {
        cin >> h.at(i);
    }
    vector<vector<int>> load(n);
    rep(i,m){
        int a,b;
        cin >>a>>b;
        a--;b--;
        load[a].push_back(b);
        load[b].push_back(a);
    }

    int cnt=0;
    rep(i,n){
        if(load[i].size()==0) {
            cnt++;
        }else{
            ll mx =h.at(i);
            bool singi = true;
            rep(j,load[i].size()){
                //ここイコールいるかどうか
                if (mx <= h.at(load[i].at(j))) {
                    singi = false;
                    break;
                }
            }
            if (singi){
                cnt++;
            }
        }
    }
    cout << cnt << endl;

    return 0;
}


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

int main(){
  int a,b,n;
  cin >> a >> b >> n;
  vector< int > s(n),f(n);
  for(int i=0;i<n;i++){
    cin >> s.at(i) >> f.at(i);
  }

  vector< int > p(1001,0);

  for(int j=0;j<n;j++){
    p.at(s.at(j)) += 1;
    p.at(f.at(j)) -= 1;
  }

  int judge=0;
/*  vector< int > sum(1002);
  sum.at(0) = 0;
  for(int i=1;i<1002;i++) sum.at(i) += sum.at(i-1)+p.at(i);
  if(sum.at(b+1)-sum.at(a+1) > 0) judge=1;
*/
  for(int i=1;i<1001;i++) p.at(i) += p.at(i-1);
  for(int i=a;i<b;i++){
    if(p.at(i) > 0) judge = 1;
  }

  cout << judge << endl;
}



Measured memory_bytes: 3124
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
using namespace std;
list<ll> graph[200005];
bool vis[200005]={0};
ll dfs(ll p){
	if(vis[p])return 0;
	vis[p]=1;
	ll ans=0;
	for(auto i=graph[p].begin();i!=graph[p].end();i++){
		ans+=dfs(*i);
	}
	return ans+1;
}
int main(){
	ll n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		ll a,b;
		cin>>a>>b;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	ll ans=0;
	for(int i=1;i<=n;i++){
		if(!vis[i])ans=max(ans,dfs(i));
	}
	cout<<ans;

}


Measured memory_bytes: 27244
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;

long long GCD(long long a, long long b) {
    if(b == 0)
        return a;
    else
        return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
    long long g = GCD(a, b);
    return a / g * b;
}
int N;
vector<vector<pair<int, int>>> pol;
int solve(int i, vector<int> ve) {
    if(i != N) {
        // cut<<"A"<<i<<endl;
        ve[i] = 1;
        int a = solve(i + 1, ve);
        ve[i] = 0;
        int b = solve(i + 1, ve);
        return max(a, b);
    } else {

//        cout << "B" << i << "ve:";

        bool m = true;
        int ret = 0;
        rep(i, 0, N) {
            // cout << ve[i];
            if(ve[i] == 0) {
                continue;
            } else {
                ret++;
                rep(j, 0, pol[i].size()) {
                    if(ve[pol[i][j].first] != pol[i][j].second) {
                        m = false;
                        break;
                    }
                }
            }
        }
        if(m) {
            // cout << "ok" << endl;
            return ret;
        } else {
            // cout << "ng" << endl;
            return 0;
        }
    }
    
}
int main() {
    cin >> N;
    rep(i, 0, N) {
        int A;
        cin >> A;
        vector<pair<int, int>> t;
        rep(i, 0, A) {
            pair<int, int> p;
            cin >> p.first >> p.second;
            p.first--;
            t.push_back(p);
        }
        pol.push_back(t);
    }
    vector<int> v(N + 1);

    cout << solve(0, v) << endl;
}


Measured memory_bytes: 256
N=int(input())
F=[[int(i) for i in input().split()] for  _ in range(N)]
P=[[int(i) for i in input().split()] for  _ in range(N)]

max_x=-10**10
for i in range(2**10):
    if i == 0 : continue
    joi=[1 if ((i & 2**j)!=0) else 0 for j in range(10) ]
    x=0
    for j in range(N):
        x+=P[j][sum([1 for k in range(10) if (F[j][k]==1) and (joi[k]==1)])]
    if max_x<=x:
        max_x=x
print(max_x)



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

long long conv(int* num, vector<int> & perm) {
	long long res = 0;
	for(int i = 0; i < perm.size(); i++) {
		res += num[i] * perm[i];
	}
	return res;
}

int fact(int n) {
	if(n == 0) return 1;
	return n * fact(n-1);
}

void factor(string str, int *arr, int *m) {
	int add = 1;
	reverse(str.begin(), str.end());
	for(int i = 0; i < str.size(); i++) {
		arr[m[str[i]]] += add;
		add *= 10;
	}
}

int main() {
	int n;
	while(cin >> n, n) {
		vector<string> ss(n);
		int mcnt = 0;
		int m[256];
		for(int i = 0; i < 256; i++) m[i] = -1;

		for(int i = 0; i < n; i++) cin >> ss[i];
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < ss[i].size(); j++) {
				if(m[ss[i][j]] < 0) m[ss[i][j]] = mcnt++;
			}
		}
		vector<int> v(10);
		for(int i = 0; i < 10; i++) v[i] = i;
		int res = 0;

		const int div = fact(10-mcnt);
		int left[10] = {};
		int right[10] = {};
		for(int i = 0; i < n-1; i++) factor(ss[i], left, m);
		factor(ss[n-1], right, m);
		do {
			bool f = false;
			for(int i = 0; i < n; i++) {
				if(v[m[ss[i][0]]] == 0 && ss[i].size() > 1)
					f= true;
			}
			if(f) continue;
			if(conv(right, v) == conv(left, v)) {
				res++;
			}
		} while(next_permutation(v.begin(), v.end()));
		cout << res / div << endl;
	}
}

Measured memory_bytes: 2980
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
 
using namespace std;
using ll = long long;
 
void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }
 
#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)
 
// constexpr int MOD = 1e9+7;
 
int main(void){
    Cin(string, s, t);
  	unordered_map<string, int> x;
  	cin >> x[s] >> x[t];
  	Cin(string, u);
  	x[u] --;
  	Cout(x[s], " ", x[t]);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

int main(){
   int d, n;
   cin >> d >> n;
   if(n < 100){
      cout << n*(int)pow(100,d) << endl;
   }
   else{
      cout << 101*(int)pow(100,d) << endl;
   }
   return 0;
}

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

using namespace std;

#define ll long long




void solve() {

	int a;
	string s;
	cin >> a >> s;
	if(a >= 3200) {
		cout << s;
	}
	else {
		cout << "red";
	}	

	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	solve();

	return 0;
}

Measured memory_bytes: 3628
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int K=sc.nextInt();
        int d[]=new int[K];
        boolean have[]=new boolean[N];
        int sum=0;
        for(int i=0;i<K;i++){
            d[i]=sc.nextInt();
            for(int j=0;j<d[i];j++){
                int temp=sc.nextInt();
                if(have[temp-1] == false){
                    have[temp-1]=true;
                }
            }
        }
        for(int i=0;i<N;i++){
            if(have[i] == false){
                sum++;
            }
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 46148
#!/usr/bin/env python3

S = input()
N = len(S)
a = S[: int((N - 1) / 2)]
b = S[int((N + 3) / 2) - 1 :]
ans = "Yes" if S == S[::-1] and a == a[::-1] and b == b[::-1] else "No"

print(ans)


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define MP make_pair
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define fst first
#define snd second

#define INF 1000000

int t(int x) { return x*(x+1)*(x+2)/6; }

int dp[1000010];

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

  Vi one, two, odd;
  for (int i = 1; t(i) <= 1000000; i++) {
    one.push_back(t(i));
    if (t(i)%2) odd.push_back(t(i));
  }

  for (int a : one) {
    for (int b : one) {
      two.push_back(a+b);
    }
  }
  sort(ALL(two));

  REP(i, 1000001) dp[i] = INF;
  dp[0] = 0;
  REP(i, 1000000) {
    for (int a : odd) {
      if (i+1-a < 0) break;
      dp[i+1] = min(dp[i+1-a]+1, dp[i+1]);
    }
  }  

  while (1) {
    int n;
    cin >> n;
    if (n == 0) break;

    if (n == *lower_bound(ALL(one), n)) {
      cout << 1;
    } else if (n == *lower_bound(ALL(two), n)) {
      cout << 2;
    } else {
      bool flag = false;
      for (int a : one) {
	if (n - a == *lower_bound(ALL(two), n - a)) {
	  flag = true;
	  break;
	}
      }
      if (flag) {
	cout << 3;
      } else {
	for (int a : two) {
	  if (n - a == *lower_bound(ALL(two), n - a)) {
	    flag = true;
	    break;
	  }
	}
	cout << (flag ? 4 : 5);
      }
    }

    cout << ' ' << dp[n] << endl;

  }    
  return 0;
}

Measured memory_bytes: 5264
#include <bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);

#define endl '\n'
#define D(x) cout << #x << " = " << (x) << endl;

int main() { IO;
  vector<long long> v(4);
  long long n;

  for (auto &x : v) {
    cin >> x;
  }

  cin >> n;
  n *= 4;

  for (int i = 1; i < v.size(); ++i) {
    v[i] = min(v[i], 2 * v[i - 1]);
  }

  long long yen = 0;
  for (int index = 3; index >= 0; --index) {
    int liter = (1 << index);
    long long k = n / liter;
    yen += k * v[index];
    n -= k * liter;
  }

  cout << yen << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
 
int main(){
  int n;
  scanf("%d", &n);

  double a[n];
  for(int i=0; i<n; i++){
    scanf("%lf", &a[i]);
  }
  
  double ans = 0;
  for(int i=0; i<n; i++){
    ans += 1 / a[i];
  }
  printf("%lf\n", 1/ans);
  
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define hackcyborg shresth_walia
#define ll  long long
#define int long long
#define ld  long double
#define pb push_back
#define mod 998244353
#define M_PI 3.141592653589
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll binpow(ll a,ll b,ll m=mod) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%m ;
        a = (a * a)%m ;
        b >>= 1;
    }
    return res;
}
main()
{   IO
     ll a[5];
     for(int x=0;x<5;x++)
        cin>>a[x];
     ll ans=0;
     for(int x=0;x<5;x++)
        if(a[x]==0)
          ans=x+1;
     cout<<ans;
}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s; cin>>s;
	for(auto i:s)
	{
		if(i=='9') cout<<'1';
		else cout<<'9';
	}
	cout<<"\n";
	return 0;
}

Measured memory_bytes: 256