akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace AtCoder
{
    class Program
    {
        
        static void Main()
        {
            //ここから

            string s = ReadLineToString();
            int len = s.Length;

            int min = int.MaxValue;

            for(int i = 0; i < len - 2; i++)
            {
                int temp = Math.Abs(int.Parse(s.Substring(i, 3))-753);
                min = min > temp ? temp : min;
            }

            Console.WriteLine(min);
            Console.ReadKey();
        }


        static public void Swap<T>(ref T a,ref T b) { T temp = a;a = b;b = temp; }
        static public long GCD(int a, int b){ return b != 0 ? GCD(b, a % b) : a;}
        static public long LCM(int a, int b){ return (long)a * b / GCD(a, b); }



        
        static public string ReadLineToString(){return Console.ReadLine();}
        static public int ReadLineToInt(){return int.Parse(Console.ReadLine());}
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public string[] ReadLineToStringArray(){return Console.ReadLine().Split(' ').ToArray();}
        static public int[] ReadLineToIntArray(){return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();}
        static public long[] ReadLineToLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<string> ReadLineToStringList(){return Console.ReadLine().Split(' ').ToList();}
        static public List<int> ReadLineToIntList(){return Console.ReadLine().Split(' ').Select(int.Parse).ToList();}
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    }
    
}


Measured memory_bytes: 11220
while(True):
    m,f,e = map(int,input().split())
    if m == -1 and f == -1 and e == -1:
        break
    elif m == -1 or f == -1:
        print('F')
    elif m+f >= 80:
        print('A')
    elif m+f >= 65:
        print('B')
    elif m+f >= 50:
        print('C')
    elif m+f >= 30:
        if e >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')


Measured memory_bytes: 5596
s = int(input())
l = {s}
if s % 2 == 0:
    s //= 2
else:
    s = s * 3 + 1
i = 1
while s not in l:
    l.add(s)
    if s % 2 == 0:
        s //= 2
    else:
        s = s * 3 + 1
    i += 1
else:
    i += 1
print(i)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll N,K;
    cin >> N >> K;
    ll ans = 0;
    for (ll i = K + 1; i <= N; i++){
        if (K == 0){
            ans--;
        }
        if (N % i < K){
            ans += (N / i) * (i - K);
        }
        else{
            ans += (N / i) * (i - K);
            ans += (N % i - K + 1);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template
// union find
class union_find {
public:
    int n;
    vector<int> parent, rnk, num;
    
    union_find(int n) : n(n), parent(n), rnk(n, 0), num(n, 1) {rep(i, n) parent[i] = i; }
    
    int root(int x){ return (parent[x] == x) ? x : root(parent[x]); }
    
    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if (x == y) {
            return;
        }
        if (rnk[x] < rnk[y]) {
            parent[x] = y;
            num[y] += num[x];
        }
        else{
            parent[y] = x;
            num[x] += num[y];
            if (rnk[x] == rnk[y]) {
                rnk[x]++;
            }
        }
        n--;
    }
    
    bool same(int x, int y) {return root(x) == root(y);}
    
    int count(int x){ return num[root(x)]; }
};

struct node {
    int ind, num;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    union_find uf(N + 1);
    rep(i, M) {
        int x, y;
        cin >> x >> y;
        uf.unite(x, y);
    }
    
    int ans = 0;
    rep(i, N) {
        if(uf.same(A[i], i + 1)) ans++;
    }
    output(ans);
    
    
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <iostream>

#define N 10

using namespace std;

int main(void) {
    int r, D, x_2000, new_x_2000, i = 0;

    cin >> r >> D >> x_2000;

    for (; i < N; i++) {
        new_x_2000 = r * x_2000 - D;
        cout << new_x_2000 << endl;
        x_2000 = new_x_2000;

    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll ans[100009];
struct ss
{
    ll v;
    ll pos;
}a[100009];
const bool com(const ss &a,const ss&b)
{
    if(a.v>b.v)return 1;
    else if(a.v==b.v)
    {
        return a.pos<b.pos;
    }
    return 0;
}
 int main()
{
    ll n;
    scanf("%lld",&n);
    for(ll i=1;i<=n;i++)
    {
        scanf("%lld",&a[i].v);
        a[i].pos=i;
    }
    sort(a+1,a+1+n,com);
    /*for(ll i=1;i<=n;i++)
    {
        cout<<a[i].v<<" "<<a[i].pos<<endl;
    }*/
    a[n+1].v=0;
    ll tmp=1;
    ll num=a[1].pos;
    for(ll i=2;i<=n+1;i++)
    {
        if(a[i].v==a[i-1].v)tmp++;
        else
        {
            ans[num]+=(a[i-1].v-a[i].v)*tmp;
            tmp++;
        }
        if(a[i].pos<num)
        {
            num=a[i].pos;
        }
    }
    for(ll i=1;i<=n;i++)
    {
       printf("%lld\n",ans[i]);
    }
}


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

namespace Rectangle
{
    class Program
    {
        static void Main(string[] args)
        {
            //入力
            string n = Console.ReadLine();  // ユーザーの入力した整数を読み込む
            //スペースで分割
            string[] arr = n.Split(' ');

            //int型に変換
            int a = int.Parse(arr[0]);

            int b = int.Parse(arr[1]);

            //面積と周の長さを計算
            //答えを表示
            Console.WriteLine(a*b　+" "+ (a+b+a+b));
        }
    }
}



Measured memory_bytes: 15760
#include <vector>
#include <iostream>
using namespace std;
int n, a, b, v[3009]; vector<int> g[3009];
bool solve(int pos, int pre) {
	bool win = false;
	for (int i : g[pos]) {
		if (i == pre) continue;
		if (v[pos] > v[i] && !solve(i, pos)) win = true;
	}
	return win;
}
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> v[i];
	for (int i = 1; i < n; i++) {
		cin >> a >> b; a--, b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (solve(i, -1)) {
			if (cnt++) cout << ' ';
			cout << i + 1;
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 384
import sys
input = sys.stdin.readline
import math

def skill_up(bit,m,x,c,a):

    acc_m = 10**9 + 1

    for can,acc_u in aaa(bit,m,x,c,a):
        if can < acc_m and all([s >= x for s in acc_u]):
            acc_m = can
    if acc_m > 10**9:
        return -1
    else:
        return acc_m

def aaa(bit,m,x,c,a):
    mx = 2**bit
    for i in range(1,mx):
        acc_u = [0] * m
        can = 0
        for b in range(bit):
            r = i & (1 << b)
            #print(x,type(x))
            if r != 0:
                v = int(math.log2(r))
                #print(i,(1 <<b ),v,c[v])
                for j in range(m):
                    acc_u[j] += a[v][j]
                can += c[v]
        #print(can,acc_u)
        #print(all([s >= 10 for s in acc_u]))
        yield can,acc_u

if __name__ == "__main__":
    n,m,x = map(int,input().split())
    c = []
    a = []
    for i in range(n):
        ca = list(map(int,input().split()))
        c.append(ca[0])
        a.append(ca[1:])

    #print(bit_check(n,m,x,c,a))
    print(skill_up(n,m,x,c,a))


Measured memory_bytes: 9252
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

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

  long long ans = 0;
  int a = 0,N = S.size();
  for(int i = 0;i < N-1;i++) {
    if(S.at(i) == 'A') a++;
    if(S.substr(i,2) == "BC") {
      ans += a;
      i++;
      continue;
    }

    if(S.at(i) != 'A' && S.substr(i,2) != "BC") a = 0;

  }

  cout << ans << endl;

}


Measured memory_bytes: 640
#include <stdio.h>

int main(){
	int a,b,c;
  	scanf("%d%d%d",&a,&b,&c);
  	int max = a;
  if(max<=b){
    max=b;
  }
  if(max <= c){
    max=c;
  }
  printf("%d\n",a+b+c-max);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
    int n;
    scanf("%d", &n);
    if(n % 10 == 3) {
        printf("bon\n");
    }
    else if(n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8) {
        printf("pon\n");
    }
    else {
        printf("hon\n");
    }
    return 0;
}

Measured memory_bytes: 2084
#include "bits/stdc++.h"

#define REP(i,num) for(ll i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){ T x; cin >> x; return (x); }
template<typename T=ll,typename C=vector<T>>
C vecin(int N){ C x(N);REP(i,N){ x[i]=in<T>(); }return move(x); }

void vout(){ cout << endl; }
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){ cout << ' ' << h;vout(forward<Tail>(t)...); }
void out(){ cout << endl; }
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){ cout << h;vout(forward<Tail>(t)...); }

template<typename T>
bool chmax(T& a,T b){ if(a<b){ a=b;return true; }return false; }
template<typename T>
bool chmin(T& a,T b){ if(a>b){ a=b;return true; }return false; }

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

	auto N=in(),K=in();
	auto V=vecin(N);
	
	ll maxV=0;
	REP(i,min(K+1,N+1)){
		// i個取り出す内、左からl個、右からi-l個取る
		for(int l=0;l<=i;l++){
			ll C=0;
			priority_queue<ll,vector<ll>,greater<ll>> Q;
			for(int j=0;j<l;j++){
				Q.push(V[j]);
				C += V[j];
			}
			for(int j=0;j<i-l;j++){
				Q.push(V[N-1-j]);
				C += V[N-1-j];
			}
			maxV = max(maxV,C);
			// K-i回まで不要なものを捨てる
			for(int k=0;k<K-i && !Q.empty();k++){
				ll X = Q.top();
				Q.pop();
				C -= X;
				maxV = max(maxV,C);
			}
		}
	}
	out(maxV);
	return 0;
}


Measured memory_bytes: 256
/*Mrc01*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#define ll long long 
#define ull unsigned long long 
#define f(i,x,n) for(ll int i=x;i<n;i++) 
#define re(j,x,n) for(ll int j=x;j>=n;j--)
#define f1(k,x,n) for(ll int k=x;k<=n;k++)
#define endl "\n"
#define mp make_pair
#define pb push_back
#define bit(x, i) (x >>(i - 1) & 1ll)
#define MAX 1000001
const int mod=1000000007;
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<ll int,ll int>,null_type, less<pair<ll int,ll int>>, rb_tree_tag,tree_order_statistics_node_update> 
      new_data_set;
vector<ll int > v[1000100],check;
ll int a[1000010],vis[1000100]; 

void solve()
{  
    ll int l;
    cin>>l;
   double ans=0.0,a,b,c;
   ans=(double(l*l*l/27.0));
   cout<<fixed<<setprecision(10)<<ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // ll int t;
    //  cin>>t;
    // while(t--)
    { 
       solve();
    }
}


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

int main() {
  string s;
  cin >> s;
  
  if(s == "SUN") cout << 7 << endl;
  else if(s == "MON") cout << 6 << endl;
  else if(s == "TUE") cout << 5 << endl;
  else if(s == "WED") cout << 4 << endl;
  else if(s == "THU") cout << 3 << endl;
  else if(s == "FRI") cout << 2 << endl;
  else if(s == "SAT") cout << 1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int digit(int,long long);
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	for(int u=1;u<100;u++){
		if(a*u%b==c){
			cout<<"YES"<<endl;
			break;
			}
		else if(a*u%b==0){
			cout<<"NO"<<endl;
			break;
		}
	}
}
int digit(int n,long long dig){
	return n%(dig*10)/dig;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    std::ios::sync_with_stdio(false); cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    ll a, b;
    vector<ll> jobs[100001];
    for(int i=0;i<n;++i){
        cin >> a >> b;
        jobs[a].push_back(b);
    }

    priority_queue<ll> que;
    ll ans = 0;
    for(int i=m-1;i>=0;--i) {
        for(ll j: jobs[m-i]) {
            que.push(j);
        }
        if(!que.empty()) {
            ans += que.top(); 
            que.pop();
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 5632
#include <bits/stdc++.h>
#include<iostream>
using namespace std;
 
int main() {
  	int a,b;
  	string s;
  	cin >> a >> s >> b;
  	if(s == "+"){
		cout << a+b;
    }else{
		cout << a- b;
    }
      

}
   


Measured memory_bytes: 3604
#include<stdio.h>
#define MAX 44
int fib(int);
 int F[MAX];
int main(){
  int n,fibo,i;
  scanf("%d",&n);
  for(i=0;i<MAX;i++){
    F[i]=0;
  }
 
  fibo=fib(n);
  
  printf("%d\n",fibo);
  return 0;
  
}
int fib(int n){
  
  if(n==0 || n==1){
    return F[n]=1;
  }
  if(F[n]!=0)return F[n];
  
  return F[n]= (fib(n-2)+fib(n-1));
}




Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
int  main(){
        long long  n, w; cin>>n>>w;
        long long wt[10000],val[10000];
        for(int i=1;i<=n;i++)cin>>wt[i]>>val[i];
        long long  dp[n+1][w+1];
        memset(dp, 0, sizeof(dp));
        for(int i=1; i<n+1; i++){
        	for(int j=0; j<w+1; j++){
                        dp[i][j]=dp[i-1][j];
        		if(j>=wt[i])dp[i][j]=max(dp[i][j], val[i]+dp[i-1][j-wt[i]]);
        		
        	}
        }
        cout<<dp[n][w]<<endl;     
}

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

int main(){
   int N, M;
   cin >> N >> M;
   map<int, vector<string>> map;
   for (int i=0; i<M; i++){
      int key;
      string S;
      cin >> key >> S;
      map[key].push_back(S);
   }
   int wacnt = 0;
   int wacnt2 = 0;
   int accnt = 0;
   for (auto x : map){
      for (string s : x.second){
         //cout << s << endl;
         if (s == "WA"){
            wacnt++;
         } else{
            accnt++;
            wacnt2 += wacnt;
            wacnt = 0;
            break;
         }
      }
      wacnt = 0;
   }
   cout << accnt << " " << wacnt2 << endl;
}



Measured memory_bytes: 15872
import collections
import math
import operator as op
from functools import reduce
import numpy as np
import math
import bisect
import heapq


MOD = 1000000007


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():
    L = get_input(int)

    print(L**3 / 3**3)


if __name__ == '__main__':
    main()


Measured memory_bytes: 23200
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector <int>
#define vl vector <ll>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define MOD 1000000007
ll power(ll a, ll b) { //a^b
	ll res = 1;
	a = a % MOD;
	while (b > 0) {
		if (b & 1) {res = (res * a) % MOD; b--;}
		a = (a * a) % MOD;
		b >>= 1;
	}
	return res;
}

ll gcd(ll a, ll b) {return (b == 0) ? a : gcd(b, a % b);}

int main() {
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll d, t, s;
	cin >> d >> t >> s;
	if (s * t >= d)
		cout << "Yes\n";
	else
		cout << "No\n";
}


Measured memory_bytes: 3604
#include<iostream>

using namespace std;

int main(){
  int A,B,C,X; cin >> A >> B >> C >> X;
  
  int cnt = 0;
  
  for(int i = 0; i <= A; i++){
    for(int j = 0; j <= B; j++){
      for(int k = 0; k <= C; k++){
        if( 500*i + 100*j + 50*k == X){ cnt++;}}}}
  
  cout << cnt << endl; return 0;}

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

long long int gcd(long long int x, long long int y)
{
	if (y == 0) { return x; }
	return gcd(y, x % y);
}

int main(void)
{
	int a, b;
	cin >> a >> b;
	if (a == b) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
	return 0;
}


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

int main() {
    int n, ans = 0;
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        if(to_string(i).size()%2 == 1) ans++;
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
import Data.List

main = do
    [a, b] <- map read . words <$> getLine :: IO [Int]
    s <- getLine :: IO String
    putStrLn $ if length s == (a+b+1) 
             && all (\c -> c /= '-') (take a s)
             && (s!!a) == '-'
             && all (\c -> c /= '-') (drop (a+1) s) 
        then "Yes" else "No"

Measured memory_bytes: 508
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

void dfs(vector<int> &x, vector<int> &y, vector<int> &result, int &ans, int n){
    
    int len = (int)x.size();
    if(n == 0){
        int tmp = 0;
        // 個数数え挙げて ans を更新
        vector<pair<int, int>> vp;
        for(int i = 0; i < len; i++){
            for(int j = i + 1; j < len; j++){
                if(result[i] == result[j]){
                    vp.push_back({i, j});
                }
            }
        }
        
    
        for(int i = 0; i < (int)vp.size(); i++){
            for(int j = i + 1; j < (int)vp.size(); j++){
                
                int x1 = x[vp[i].first] - x[vp[i].second];
                int y1 = y[vp[i].first] - y[vp[i].second];
                
                int x2 = x[vp[j].first] - x[vp[j].second];
                int y2 = y[vp[j].first] - y[vp[j].second];
                if(x1 * y2 - x2 * y1 == 0) tmp++;
            }
        }
        ans = max(ans, tmp);

    }else{
        
        int u = 0;
        for(int i = 0; i < len; i++){
            if(result[i] == -1){
                u = i;
                break;
            }
        }

        for(int v = u + 1; v < len; v++){
            if(result[v] != -1) continue;
            result[u] = n;
            result[v] = n;
            dfs(x, y, result, ans, n - 2);
            result[u] = -1;
            result[v] = -1;
        }
    }
}

signed main(){
    
    int n; cin >> n;
    vector<int> x(n);
    vector<int> y(n);
    for(int i = 0; i < n; i++) cin >> x[i] >> y[i];
    vector<int> result(n, -1);

    int ans = 0;
    dfs(x, y, result, ans, n);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(long int I=X;I<Y;I++)
#define INF 1e9+7
using namespace std;

long int pow2[] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144};

int main(){
  vector<pair<string,string> > p1,p2;
  long int N;
  long int ans=0;
  string S1,S2;
  cin >> N >> S1;
  S2 = S1.substr(N,N);
  S1 = S1.substr(0,N);
  FOR(i,0,N/2)swap(S2[i],S2[N-i-1]);
  long int perm = pow2[N];
  FOR(i,0,perm){
    string s1="",s2="";
    FOR(j,0,N){
      if(pow2[j] & i)s1+=S1[j];
      else s2+=S1[j];
    }
    p1.push_back(make_pair(s1,s2));
  }
  FOR(i,0,perm){
    string s1="",s2="";
    FOR(j,0,N){
      if(pow2[j] & i)s1+=S2[j];
      else s2+=S2[j];
    }
    p2.push_back(make_pair(s1,s2));
  }
  sort(p2.begin(),p2.end());
  for(auto x:p1)ans+=upper_bound(p2.begin(),p2.end(),x)-lower_bound(p2.begin(),p2.end(),x);
  cout << ans << endl;
}


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

int main(){
    int n,x;
    int sum=0;
    int mi=inf;
    cin >> n >>x;
    rep(i,n){
        int m;
        cin >> m;
        sum+=m;
        mi=min(mi,m);
    }
    x-=sum;
    cout << n+x/mi << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#define MAX_N 210
using namespace std;

int N;
int coox[MAX_N], cooy[MAX_N];
bool f[MAX_N][MAX_N], vis[MAX_N];
int match[MAX_N];
int res;

bool dfs (int);

int main () {
    scanf("%d", &N);
    for (int i = 1;i <= 2 * N; ++i) scanf("%d%d", coox + i, cooy + i);
    for (int i = 1;i <= N; ++i)
	for (int j = N + 1;j <= 2 * N; ++j)
	    if (coox[i] < coox[j] && cooy[i] < cooy[j]) {
		f[i][j - N] = true;
	    }

    for (int i = 1;i <= N; ++i) {
	memset(vis, false, sizeof(vis));
	if (dfs(i)) res++;
    }
    printf("%d\n", res);
    return 0;
}

bool dfs (int x) {
    for (int i = 1;i <= N; ++i) {
	if (!f[x][i] || vis[i]) continue;
	vis[i] = true;
	if (!match[i] || dfs(match[i])) {
	    match[i] = x;
	    return true;
	}
    }
    return false;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,c,k,i=0;
 	cin>>a>>b>>c>>k;
  
  	if(k%2!=0){
		cout<<b-a<<endl;
    }else{
		cout<<a-b<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a[200000];
  int n,k;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=k;i<n;i++){
    if(a[i]>a[i-k]){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 4412
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    double a, b, x, ans;
    cin >> a >> b >> x;
    if (x >= a * a * b / 2) {
        ans = atan(2 * b / a - 2 * x / (a * a * a)) / M_PI * 180;
    }
    else {
        ans = atan(a * b * b / (2 * x)) / M_PI * 180;
    }
    cout << setprecision(12) << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
      
      int N =sc.nextInt();
 
      //偶数を見つけだす
      for(int i=0;i<N;i++){
        int A =sc.nextInt();
        if(A % 2==0){
 
        //3か5で割り切れるか
         if(A%3!=0&&A%5!=0){
           System.out.print("DENIED");
           
           return;
        }
        }
      }
           System.out.print("APPROVED");
 }
}

Measured memory_bytes: 22868
#include <algorithm>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e8;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

signed main() {
  string s;
  int y, m, d;
  while (1) {
    cin >> s;
    if (s == "#") break;
    cin >> y >> m >> d;
    if (y < 31 || (y == 31 && m < 5)) {
      cout << s << ' ' << y << ' ' << m << ' ' << d << endl;
    } else {
      cout << "?" << ' ' << y - 30 << ' ' << m << ' ' << d << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3220
from sys import stdin
import sys

l = stdin.readline().rstrip().split(' ')
A = list(map(int, input().split()))
B = list(map(int, input().split()))
k = int(l[2])
n = int(l[0])
m = int(l[1])

sum = 0
a = [0]
for i in range(n):
    sum += A[i]
    a.append(sum)
sum = 0

b = [0]
for i in range(m):
    sum += B[i]
    b.append(sum)
#print(b)

ans = 0
j = m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)

Measured memory_bytes: 47268
#include<bits/stdc++.h>
using namespace std;
static const int64_t mod=1000000007;
int64_t f(int64_t x,int64_t y){
if(y==0)
  return 1;
  else if(y%2==0)
    return (f(x,y/2)*f(x,y/2))%mod;
  else
    return (f(x,y/2)*((x*f(x,y/2))%mod))%mod;
}
int main(){
int N;
  cin>>N;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  map<int64_t,int>M;
  for(int i=0;i<N;i++){
  int64_t n=A.at(i);
    int64_t X=n;
    for(int64_t j=2;j*j<=n;j++){
    if(X%j==0){
    int a=0;
      while(X%j==0){X/=j; a++;}
    
    if(M.count(j)){
    if(M.at(j)<a) M.at(j)=a;
    }else
      M[j]=a;
    }
    
    }if(X!=1){ if(!M.count(X)){
    
      M[X]=1;
    }}
      
    }int64_t lcm=1;
  for(auto p:M){
  auto k=p.first;
    	auto v=p.second;
    lcm=(lcm*f(k,v))%mod;
  }int64_t ans=0;
  for(int i=0;i<N;i++){
  int64_t x=A.at(i);
    ans=(ans+lcm*f(x,mod-2))%mod;
  }cout<<ans<<endl;
   return 0;
}



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

int main()
{
    int H, W;
    cin >> H >> W;
    vector<vector<char>> grid = vector<vector<char>>(H, vector<char>(W, 0));
    vector<bool> isEmptyRow = vector<bool>(H, true);
    vector<bool> isEmptyCol = vector<bool>(W, true);
    int i, j;
    for(i = 0; i < H; ++i) {
        for(j = 0; j < W; ++j) {
            cin >> grid[i][j];
            if( grid[i][j] == '#' ) {
                isEmptyRow[i] = false;
                isEmptyCol[j] = false;
            }
        }
    }

    for(i = 0; i < H; ++i) {
        if( isEmptyRow[i] ) continue;
        for(j = 0; j < W; ++j) {
            if( isEmptyCol[j] ) continue;
            cout << grid[i][j];
        }
        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 256
function Main(input) {
  input = input.replace(/\n/g, ' ').split(" ");
  var a = input[0].slice(0,1);
  var b = input[0].slice(1,2);
  var c = input[0].slice(2,3);
  if(a==b && b==c && a=="R"){
    console.log(3);
  }else if(a==b && a=="R"){
    console.log(2);
  }else if(b==c && b=="R"){
    console.log(2);
  }else if(a=="R" || b=="R" || c=="R"){
    console.log(1);
  }else{
    console.log(0);
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29684
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N = I()
A = LI()
for i in range(N):
    A[i] = (A[i],i)
A.sort()

print(*[A[i][1]+1 for i in range(N)])


Measured memory_bytes: 92596
N=gets.to_i
h=Hash.new(0)
gets.chomp.split.map(&:to_i).each do |i|
  h[i]+=1
end
if h[0] == N
  puts "Yes"
elsif N%3!=0
  puts "No"
elsif h[0]==N/3 && h.size==2
  puts "Yes"
elsif h.size==3
  h.each do |k,v|
    if v==N/3
    else
      puts "No"
      exit
    end
  end
  a = h.to_a
  if (a[0][0] ^ a[1][0] ^ a[2][0]) == 0
    puts "Yes"
  else
    puts "No"
  end

else
  puts "No"
end

Measured memory_bytes: 12684
#include <stdio.h>
#include <string.h>
using namespace std;
int main(void){
    char str1[200], str2[200],str3[200];
    scanf("%s %s", str1, str2);
    strcpy(str3,str1);
    
    if(strlen(str2)!=1){
        strcat(str1, str3);
    }
    //printf("%s %s\n", str1, str2);
    
    if (strstr(str1, str2) == NULL ) printf("No\n");
    else printf("Yes\n");

}



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

typedef long long int ll;
ll dp[109][100009];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll n,W;
	cin>>n>>W;
	ll w[1000],v[1000],i,j;
	
	for(i=0;i<n;i++)
	cin>>w[i]>>v[i];
	
	for(i=0;i<109;i++)
	{
		for(j=0;j<100009;j++)
		dp[i][j]=INT_MAX;
	}
	
	for(i=0;i<109;i++)
	dp[i][0]=0;
	
	for(i=1;i<=n;i++)
	{
		for(j=0;j<100009;j++)
		{
			if(j-v[i-1]>=0)
			dp[i][j]= min(dp[i][j],dp[i-1][j-v[i-1]]+w[i-1]);
			
			dp[i][j]=min(dp[i][j],dp[i-1][j]);
		}
	}
	ll ans=0;
	for(i=0;i<100009;i++)
	{
		if(dp[n][i]<=W)
		ans=i;
	}
	cout<<ans;
}


Measured memory_bytes: 85504
#include<iostream>
#include<algorithm>
using namespace std;
int main ()
{
    int x[3],y=0,i,z;
    for(i=0;i<3;i++)
        cin >> x[i];
    sort(x,x+3);
    if((x[1]-x[0])%2==0)
    {
        y=(x[1]-x[0])/2+(x[2]-x[1]);
        cout << y;
        return 0;
    }
    else
    {
        x[2]=x[2]+1;
        x[0]=x[0]+1;
        y=(x[1]-x[0])/2+(x[2]-x[1])+1;
        cout << y;
        return 0;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,a,flg;
  cin>>h>>a;
  for(int i=0;i>=0;i++){
    h-=a;
    flg++;
    if(h<=0){
      cout<<flg<<endl;
      break;
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>

using namespace std;
int main()
{
  int out,change,in_;
  cin>>in_;
  if(in_ % 1000 ==0)
  {
	cout<<0;
  }
  else
  {
    out = in_/1000 + 1;
    change = out* 1000 - in_;
    cout<<change;
  }
  return 0;
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    int ans;
    if(a == b) {
        ans = c;
    } else {
        if(a == c) {
            ans = b;
        } else {
            ans = a;
        }
    }

    cout << ans << endl;

}


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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

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

    char a;
    cin >> a;

    if (a == 'A') { cout << 'T' << endl; }
    if (a == 'T') { cout << 'A' << endl; }
    if (a == 'C') { cout << 'G' << endl; }
    if (a == 'G') { cout << 'C' << endl; }

    return 0;
}

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

int main() {
  int MOD = 998244353;
  int N; cin >> N;
  vector<int> D(N, 0);
  int d_max = 0;
  for (int i = 0; i < N; i++) {
    int d; cin >> d;
    if (i == 0 && d != 0) {
      cout << 0 << endl;
      return 0;
    }
    d_max = max(d_max, d);
    D.at(d)++;
  }
  long long ans = 1;
  for (int i = 0; i <= d_max; i++) {
    if (i == 0) {
      if (D.at(0) != 1) {
        cout << 0 << endl;
        return 0;
      }
      continue;
    }
    if (D.at(i) == 0) {
      cout << 0 << endl;
      return 0;
    }
    if (i == 1) continue;
    for (int j = 0; j < D.at(i); j++) {
      ans = ans * D.at(i-1);
      ans %= MOD;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long intS
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    double t,x;
    
    cin >> t >> x;
    
    printf("%.10lf\n",t/x);
    
    
    
//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
c = 0
C = 1

for i in range(1,N):
  d = A[i] - A[i-1]
  if c == 0:
    c = d
  elif c*d < 0:
    C += 1
    c = 0
print(C)

Measured memory_bytes: 14224
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            int N = in.nextInt();
            Map<String, Integer> map = new TreeMap<>();
            int max = 0;
            for (int i = 0; i < N; i++) {
                String S = in.next();
                Integer val = map.get(S);
                if (val == null) {
                    map.put(S, 1);
                    if (max <= 1) {
                        max = 1;
                    }
                }
                else {
                    map.put(S, val + 1);
                    if (max <= val + 1) {
                        max = val + 1;
                    }
                }
            }
            for (String key : map.keySet()) {
                if (map.get(key) == max) {
                    out.println(key);
                }
            }
        }
    }
}

Measured memory_bytes: 77624
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



string s;
int n;

signed main() {
	cin >> s;
	n = s.size();
	rep(i,n) reps(j,i,n+1) {
		string t = s.substr(0,i) + s.substr(j);
		if (t=="keyence") return cout << "YES" << endl, 0;
	}
	cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

int gcd(int m, int n) {
  while (n)
    std::swap(m%=n, n);

  return m;
}

int main() {
  int N, K;
  scanf("%d %d", &N, &K);

  int a_max, a_gcd;
  scanf("%d", &a_max);
  a_gcd = a_max;

  for (int i=1; i<N; ++i) {
    int a;
    scanf("%d", &a);
    a_max = std::max(a_max, a);
    a_gcd = gcd(a_gcd, a);
  }

  if (!(K % a_gcd == 0 && K <= a_max))
    printf("IM");

  printf("POSSIBLE\n");
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
#define pb push_back
#define fi first
#define se second
const ll mod = 1e9+7;
const int N = 2e6+6;
void solve(){
	int n; 
	cin>>n; 
	vector<int>v(n);
	int a,b; 
	cin>>a>>b; 
	for(int i=0;i<n;i++)cin>>v[i];
	int c[3]={};
	for(int i=0;i<n;i++){
		if(v[i]<=a)c[0]++;
		else if(v[i]<=b)c[1]++;
		else c[2]++;
	}
	cout<<min({c[0],c[1],c[2]})<<endl;
	
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


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

#define MAXN (200010)
#define ll long long
#define lowbit(x) ((x) & (-(x)))

int n;
ll k, a[MAXN];
ll b[MAXN], c[MAXN], cnt[MAXN];

int main(){
	scanf("%d%lld", &n, &k);
	for(int i = 1; i <= n; ++ i){
		scanf("%lld", a + i);
		a[i] -= k;
		a[i] += a[i - 1];
	}
	
	for(int i = 1; i <= n; ++ i){
		b[i + 1] = a[i];
	}
	b[1] = 0;
	++ n;
	std::sort(b + 1, n + b + 1);
	
	int m = std::unique(b + 1, n + b + 1) - b - 1;
	for(int i = 1; i <= n; ++ i){
		c[i] = std::lower_bound(b + 1, m + b + 1, a[i - 1]) - b;
	}
	
	ll ans = 0;
	for(int i = 1; i <= n; ++ i){
		
		for(int j = c[i]; j; j -= lowbit(j)) ans += cnt[j];
		for(int j = c[i]; j <= m; j += lowbit(j)) cnt[j] ++;
		
	}
	printf("%lld\n", ans);
	
	
	return 0;
}

Measured memory_bytes: 6528
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define TLong long long 

// abs(n)
int abs(int n){
	if(n < 0)	n *= -1;
	return n;
}

// gcd(a,b)
int gcd(int a,int b){
	int ret;
	ret = (b == 0) ? a : gcd(b, a % b);
}

// lcm(a.b)
int lcm(int a,int b){
	return (a * b) / gcd(a,b);
}

// qsort(array, size, sizeof(int),comp);
int comp(const int *a,const int *b){
	return (*a - *b);
}

// append(array,*size,addNum)
void append(int *array,int *size,int num){
	realloc(array, sizeof(int) * (*size + 1));
	array[(*size)] = num;
	++(*size);
}

// pop(array,*size) & nongetpop(array,*size)
int pop(int *array,int *size){
	int temp = array[(*size - 1)];
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
	return temp;
}

int main(void){
  char instr[11],outstr[11]="";
  scanf("%s",instr);
  for(int i = 0; i < strlen(instr); ++i){
    if(instr[i] == 'B') outstr[strlen(outstr) - 1] = '\0';
    else outstr[strlen(outstr)] = instr[i];
  }
  printf("%s",outstr);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b;
	cin>>a>>b;
	cout<<((a<10&&b<10)?a*b:-1)<<endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main () {

    int n, u, k, v, M[100][100], i, j;

    cin >> n;
    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
            M[i][j] = 0;
        }
    }

    for (i = 0; i < n; i++) {
        cin >> u >> k;
        u--;
        for (j = 0; j < k; j++) {
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
            if (j != 0) {
                cout << " ";
            }
            cout << M[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

using namespace std;

#define FOR(a,b) for(int a=0;a<b;a++)
#define F0R(a,b,c) for(int a = b; a<=c; a++)
#define f first
#define s second
#define m0(x) memset(x,0,sizeof(x))

typedef pair<int,int> pi;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pi> vpi;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    long double r; cin >> r;
    cout << 6.283185307179586232*r << endl;
    return 0;
}


Measured memory_bytes: 3756
n,k = map(int,input().split())
su = [True for i in range(n)]
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in range(d):
        su[a[j]-1] = False
count = 0
for i in range(n):
    if su[i]:
        count+=1
print(count)

Measured memory_bytes: 9192
#include <stdio.h>
int main(void){
    int w,n,i,a,b,temp;
    scanf("%d %d",&w,&n);
    int num[w+1];
    for(i=1;i<=w;i++) num[i]=i;
    for(i=0;i<n;i++){
        scanf("%d,%d",&a,&b);
        temp=num[a];
        num[a]=num[b];
        num[b]=temp;
    }
    for(i=1;i<=w;i++) printf("%d\n",num[i]);
    return 0;
}

Measured memory_bytes: 596
//replace ai by a0=a1^...^an
//a1^a2^....^ai-1^a0^ai+1^....^an=ai!:swap a0 and ai
//2nd operation just replace some aj by ai:swap a0(=ai) and aj
//now xor=ai^aj^ai=aj
//3rd operation just replace some ak by aj
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
struct kk
{
	int num,id;
}a[100010],b[100010];
int fa[100010],n,i,c[100010];
bool cmp1(kk A,kk B){return A.num<B.num||(A.num==B.num&&A.id<B.id);}
bool cmp2(kk A,kk B){return A.id<B.id;}
int find(int x)
{
	if (x==fa[x]) return x;
	return fa[x]=find(fa[x]);
}
void unit(int x,int y)
{
	int a=find(x),b=find(y);
	if (a!=b) fa[a]=b;
}
int main()
{
	scanf("%d",&n);
	a[0].num=0;b[0].num=0;
	a[0].id=0;b[0].id=0;
	int i;
	for (i=1;i<=n;i++)
	{
		scanf("%d",&a[i].num);
		a[0].num^=a[i].num;
		a[i].id=i;
	}
	for (i=1;i<=n;i++) 
	{
		scanf("%d",&b[i].num);
		b[0].num^=b[i].num;
		b[i].id=i;
	}
	sort(a,a+n+1,cmp1);sort(b,b+n+1,cmp1);
	for (i=0;i<=n;i++)
	{
		if (a[i].num!=b[i].num)
		{
			printf("-1\n");
		    return 0;
		}
	}
	//离散化
	int now=0;
	for (i=0;i<n;i++)
	{
		if (a[i].num!=a[i+1].num)
		{
			a[i].num=now;
			now++;
		}
		else a[i].num=now;
	}
	a[n].num=now; 
	now=0;
	for (i=0;i<n;i++)
	{
		if (b[i].num!=b[i+1].num)
		{
			b[i].num=now;
			now++;
		}
		else b[i].num=now;
	}
	b[n].num=now; 
	for (i=0;i<=now;i++) fa[i]=i;
	sort(a,a+n+1,cmp2);sort(b,b+n+1,cmp2);
	int ans=0;
	for (i=1;i<=n;i++) 
	  if (a[i].num!=b[i].num) 
	  {
	  	unit(a[i].num,b[i].num);
	  	ans++;
	  }
	memset(c,0,sizeof(c));
	for (i=0;i<=now;i++) c[find(i)]++;
	for (i=0;i<=now;i++) 
	{
		if (c[i]>=2) ans++;
	}
	if (c[find(a[0].num)]>=2) ans--;
	printf("%d\n",ans);
}

Measured memory_bytes: 4096
#include <iostream>
#include <algorithm>
#include <vector>
#include <regex>
#define pb push_back
using namespace std;

int main() {
	int a, b,temp=0,t;
	cin >> a >> b;
	for(int i =0;i<b;i++){
      cin >> t;
      temp=temp+t;
    }
  	if(temp>=a){
    cout <<"Yes";
    }
  	else{
    cout << "No";
    }
	return 0;
}


Measured memory_bytes: 256
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
li = []

for i in range(n) :
    word = s[i]
    li.append(s.count(word) - t.count(word))
x = max(li)
if x <= 0 :
    print(0)
else :
    print(x)

Measured memory_bytes: 3064
n=int(input())
s=list(input())
ans=s.count('R')*s.count('G')*s.count('B') #1番目の条件を満たすものの総数は(Rの個数)*(Gの個数)*(Bの個数)
for i in range(n): #判定を簡単にするためR:=1,G:=2,B:=4と置き換えておく (i<j<K)
    if s[i]=='R':
        s[i]=1
    elif s[i]=='G':
        s[i] = 2
    elif s[i]=='B':
        s[i]=4
for i in range(n): #すべての(i,j) (i<j)について(i,j,2*j-i)が1番目の条件を満たし、かつ2番目の条件を満たさないかを判定する
    for j in range(i+1,n):
        k=2*j-i
        if k>=n: #k>=nのとき、そのような組を取ることはできない
            continue
        if s[i]+s[j]+s[k]==7: #i番目の数とj番目の数とk番目の数の和が7になるとき、(i,j,2*j-i)は1番目の条件を満たし、かつ2番目の条件を満たさないので、1番目の条件を満たすものの総数から1を引く
            ans-=1
print(ans)

Measured memory_bytes: 9168
#include <bits/stdc++.h>
using namespace std;
const int Maxn=605,mod=1e9+7;
int p[Maxn],g[Maxn],f[Maxn][Maxn],cnt[Maxn][Maxn];
int main(){
    int n,k,ans=0;cin>>n>>k;
    g[0]=1;
    for(int i=2;i<=2*n;i+=2)g[i]=1ll*g[i-2]*(i-1)%mod;
    for(int i=1;i<=k;i++){
        int x,y;cin>>x>>y;
        p[x]=y;p[y]=x;
    }
    for(int i=1;i<=2*n;i++)
        for(int j=i;j<=2*n;j++)
            cnt[i][j]=cnt[i][j-1]+(!p[j]);
    for(int len=1;len<=2*n;len++)
        for(int l=1,r=len;r<=2*n;l++,r++){
            bool succ=true;
            for(int k=l;k<=r;k++)
                if(p[k]&&(p[k]<l||p[k]>r))
                    succ=false;
            if(!succ)continue;
            f[l][r]=g[cnt[l][r]];
            for(int k=l+1;k<r;k++)
                f[l][r]=(f[l][r]-1ll*f[l][k]*g[cnt[k+1][r]])%mod;
            ans=(ans+1ll*f[l][r]*g[cnt[1][l-1]+cnt[r+1][2*n]])%mod;
        }
    cout<<(ans+mod)%mod<<"\n";
    return 0;
}

Measured memory_bytes: 3072