akhauriyash/Code-Regression huggingface dataset:
// in the name of Allah
// Ya Ali!
#include <bits/stdc++.h>
using namespace std;

typedef long long ll ;
typedef long double ld ;

const ll maxn = 60 ;
const ll INF = 1e18 ;

#define f first
#define s second

ll n , adj[maxn][maxn] , p[maxn][maxn] , tmp[maxn][maxn] , k , mod = 1e9 + 7;

void mul(ll a[maxn][maxn] , ll b[maxn][maxn])
{
  for(int i = 1 ; i <= n ; i ++)
    for(int j = 1 ; j <= n ; j ++)
     tmp[i][j] = 0 ;

  for(int i = 1 ; i <= n ; i ++)
    for(int j = 1 ; j <= n ; j ++)
     for(int z = 1 ; z <= n ; z ++)
        tmp[i][j] = (tmp[i][j] + ((a[i][z]*1ll*b[z][j])%mod))%mod ;

   for(int i = 1 ; i <= n ; i ++)
    for(int j = 1 ; j <= n ; j ++)
     p[i][j] = tmp[i][j]%mod ;
}

void poww()
{
  for(int i = 1 ; i <= n ; i ++)
    for(int j = 1 ; j <= n ; j ++)
     p[i][j] = adj[i][j] ;

  ll maxbit = 0;
  for(int i = 63 ; i >= 0 ; i --){
    if(k & (1ll<<i)){
        maxbit = i ;
        break ;
    }
  }

  for(int i = maxbit-1 ; i >= 0 ; i --){
    mul(p , p) ;
    if(k&(1ll<<i))mul(p,adj) ;
  }
}

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

 cin >> n >> k ;
 for(int i = 1 ; i <= n ; i ++)
    for(int j = 1 ; j <= n ; j ++)
     cin >> adj[i][j] ;

 poww();

 ll ans = 0 ;
 for(int i = 1 ; i <= n ; i ++)
    for(int j = 1 ; j <= n ; j ++)
        ans = (ans+(p[i][j]%mod))%mod ;

 cout << ans%mod ;


    return 0;
}


Measured memory_bytes: 384
R1=range(-2,3)
R2=range(-1,2)
A1=[(x,y) for x in R1 for y in R1 if 3<x**2+y**2<6]
A2=[(x,y) for x in R2 for y in R2]
def fi(): return map(int,raw_input().split(" "))
def f(x,y,i):
  A=[A1,A2][i>0]
  return set([(x+dx,y+dy) for dx,dy in A if 0<=x+dx<10 and 0<=y+dy<10])

while 1:
  xf,yf=fi()
  if yf==xf==0: break
  n=input()
  PA=fi()
  FA=set([(xf,yf)])
  for i in range(n*2)[::2]:
    SA=f(PA[i],PA[i+1],1)
    tmp=set([])
    for xf,yf in FA: tmp=tmp|(SA&f(xf,yf,0))
    FA=tmp
  print ["NA","OK"][len(FA)>0]

Measured memory_bytes: 4284
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
	int H, W;
	cin >> H >> W;

	vector<string> board;
	inputVector(board, H);

	int cnt[26];
	memset(cnt, 0, sizeof cnt);

	rep(y, H) rep(x, W) cnt[board[y][x] - 'a']++;

	rep(y, (H + 1) / 2) rep(x, (W + 1) / 2) {
		int num = 4;
		if (H % 2 == 1 && y == H / 2) num /= 2;
		if (W % 2 == 1 && x == W / 2) num /= 2;
		if (num < 4) continue;

		int maxArg = -1;
		int maxVal = 0;
		rep(i, 26) {
			if (cnt[i] > maxVal) {
				maxVal = cnt[i];
				maxArg = i;
			}
		}
		cnt[maxArg] -= num;
	}
	rep(y, (H + 1) / 2) rep(x, (W + 1) / 2) {
		int num = 4;
		if (H % 2 == 1 && y == H / 2) num /= 2;
		if (W % 2 == 1 && x == W / 2) num /= 2;
		if (num == 4) continue;

		int maxArg = -1;
		int maxVal = 0;
		rep(i, 26) {
			if (cnt[i] > maxVal) {
				maxVal = cnt[i];
				maxArg = i;
			}
		}
		if (maxVal < num) {
			cout << "No" << endl;
			return 0;
		}
		cnt[maxArg] -= num;
	}

	rep(i, 26) {
		if (cnt[i]) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

    return 0;
}


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

int main() {
	int q;cin>>q;
	map<string,int> mp;
	mp["zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"]++;
	
	while(q--){
		int query;string key;cin>>query>>key;
		if(query==0){
			int x;cin>>x;
			mp[key]=x;
		}else if(query==1){
			cout<<mp[key]<<endl;
		}else if(query==2){
			mp[key] = 0;
		}else{
			string r;cin>>r;
			for(auto it=mp.lower_bound(key);it!=mp.upper_bound(r);++it){
				if((*it).second == 0) continue;
				cout<<((*it).first) << " " << ((*it).second)<<endl;
			}
		}
	}
  return 0;
}



Measured memory_bytes: 27748
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	vector<int> A(5);
	REP(i, 5) cin >> A[i];
	
	REP(i, 5) {
		if (A[i] == 0) {
			cout << i + 1 << endl;
			return 0;
		}
	}
	return 0;
}


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

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

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <string>
#include <map>

using namespace std;

bool inj(string const& s, string const& t) {
  int n = s.size();
  map<char, char> table;
  for (int i = 0; i < n; i++) {
    if (table.count(s[i]) && table[s[i]] != t[i]) {
      return false;
    }
    table[s[i]] = t[i];
  }
  return true;
}


int main() {
  string s, t;
  cin >> s >> t;
  map<char, char> table;
  cout << ((inj(s, t) && inj(t, s)) ? "Yes" : "No") << endl;
}


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

int main() {
  int a, b, t;
  cin >> a >> b >> t;
  int c = a;
  int sum = 0;
  while (c <= t+0.5) {
    c = c + a;
    sum = sum + b;
  }

  cout << sum << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int dp[100005];
int main(){
    string s;
    cin >> s;
    if(s.size()<=3)puts("ABC");
    else puts("ABD");
}

Measured memory_bytes: 256
A,B = input().split()
A = int(A)
ans = 0
cnt = 0
for s in B:
    if(s=='.'):
        continue
    else:
        s = int(s)
        ans += A * (10**(2-cnt)) * s
        cnt += 1

ans = ans//100
#print(type(ans))
print(ans)

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

const int _ = 3e5 + 7 , MOD = 998244353;
char str[_];

int main(){
	int ans = 1 , N; int cnt[3] = {};
	scanf("%d %s" , &N , str + 1);
	for(int i = 3 * N ; i ; --i){
		int num = (str[i] == 'R' ? 0 : (str[i] == 'G' ? 1 : 2));
		int flg = 0;
		for(int j = 0 ; j < 3 ; ++j) flg += (j != num && cnt[j] > cnt[num]);
		if(flg == 0) ++cnt[num];
		else if(flg == 1){
			for(int j = 0 ; j < 3 ; ++j)
				if(j != num && cnt[j]){
					ans = 1ll * ans * (cnt[j] - cnt[num]++) % MOD;
					break;
				}
		}
		else{
			int mn = MOD;
			for(int j = 0 ; j < 3 ; ++j)
				if(j != num){
					mn = min(mn , cnt[j]); --cnt[j];
				}
			ans = 1ll * ans * mn % MOD;
		}
	}
	for(int i = 1 ; i <= N ; ++i) ans = 1ll * ans * i % MOD;
	cout << ans;
	return 0;
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */

int main(){
    ii2(a,b); ii2(c,d);

    int tak = (c+b-1)/b;
    int aok = (a+d-1)/d;
    if(tak <= aok) out("Yes");
    else out("No");
}

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer ccc;
  ccc=nil->next;
  while(ccc!=nil && ccc->key!=key){
    ccc=ccc->next;
  }
  return ccc;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  if(t==nil)
    return;
  t->prev->next=t->next;
  t->next->prev=t->prev;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  deleteNode(nil->prev);
}

void delete(int key){
  deleteNode(listSearch(key));
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++;
      }
      size--;
    }
  }

  printList();
  return 0;
}



Measured memory_bytes: 33112
scores = [[],[]]
score_sums = [0, 0]
scores.each_with_index do |s, i|
  10.times do
    s << gets.to_i
  end
  s.sort! {|a, b| b <=> a }
  3.times do |x|
    score_sums[i] += s[x]
  end
end

puts score_sums.join ' '

Measured memory_bytes: 6092
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a;
    cin>>a;
    if(a<1200){
        cout<<"ABC"<<endl;
    }else if(1200<=a&&a<2800){
        cout<<"ARC"<<endl;
    }else{
        cout<<"AGC"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] n = sc.next().toCharArray();
		sc.close();
		out.println((n[1]==n[2])&&(n[0]==n[1]||n[2]==n[3])?"Yes":"No");
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(v) for(int k=head[v];k;k=e[k].ne)
#define v e[k].t
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
typedef pair<ll,ll> pa;
const int N=500+5,M=1e7+5,INF=1e9,mod=1e9+7;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);}
il void gen(){freopen("data.in","w",stdout);}
int n,m;
char s[N][N],a1[N][N],a2[N][N];
int main(){
	read(n,m);
	rep(i,1,n)scanf("%s",s[i]+1);
	rep(i,1,n)rep(j,1,m){
		a1[i][j]=a2[i][j]='.';
		if(j==1)a1[i][j]='#';else 
		if(j==m)a2[i][j]='#';else
		if(i&1)a1[i][j]='#';else a2[i][j]='#';
		if(s[i][j]=='#')a1[i][j]=a2[i][j]='#';
	}
	rep(i,1,n)printf("%s\n",a1[i]+1);
	puts("");
	rep(i,1,n)printf("%s\n",a2[i]+1);
}

Measured memory_bytes: 1536
/*
             much pretests
        ▄              ▄    
        ▌▒█           ▄▀▒▌   wow vectors
        ▌▒▒█        ▄▀▒▒▒▐   
       ▐▄█▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐        heckin_TLE
     ▄▄▀▒▒▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐   
   ▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌   
  ▐▒▒▒▄▄▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▀▄▒▌      beautiful graphs
  ▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐  
 ▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌ 
 ▌░▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌  wow cp
▌▒▒▒▄██▄▒▒▒▒▒▒▒▒░░░░░░░░▒▒▒▐ 
▐▒▒▐▄█▄█▌▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▒▒▒▌        much time
▐▒▒▐▀▐▀▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▒▐ 
 ▌▒▒▀▄▄▄▄▄▄▀▒▒▒▒▒▒▒░▒░▒░▒▒▒▌     very memory
 ▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒▒▄▒▒▐  
  ▀▄▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒▄▒▒▒▒▌  
    ▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀   much loops
      ▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀     
         ▀▀▀▀▀▀▀▀▀▀▀▀     
         bugs do me a bamboozle
*/

#include<bits/stdc++.h>
#define int 			long long
#define fi 				first
#define sc 				second
#define pii 			pair<int,int>
#define vi 				vector<int>
#define mii 			map<int,int>
#define msi 			map<string,int>
#define si 				set<int>
#define mlem			main
#define all(v) 			v.begin(),v.end()
#define sz(v)  			int((v).size())
#define rep(i,a,b)    	for(int i=a;i<b;i++)
#define dep(i,a,b)    	for(int i=a;i>=b;i--)
#define isinarr(i,n) 	((i>=0)?((i<n)?1:0):0)
#define pb 				push_back
#define ppb 			pop_back
#define lb 				lower_bound
#define ub 				upper_bound
#define hell 			1000000007
#define PI 				3.14159265
#define mp 				make_pair
#define inparr(a,n) 	rep(i,0,n)cin>>a[i];
#define strwspaces(s) 	getline(cin,s)
#define give(x,y) 		cout<<x<<" "<<y<<endl;
#define setp(n) 		cout<<fixed<<setprecision(n);
#define endl   			'\n'
#define inp(n) 			int n;cin>>n;
#define inps(s) 		string s;cin>>s;
#define setmem(inde,k) 	memset(inde,k,sizeof(inde))
#define tr(a,m) 		for(auto a=m.begin();a!=m.end();a++)
using namespace std;

int i,j,k,l;

void woof()
{
	inp(n);
	int ans=0;
	rep(i,1,n+1)
	{
		ans+=(n/i);
		if(i*(n/i)==n)
			ans--;
	}
	cout<<ans<<endl;
} 



signed mlem()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--)
        woof();
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

int n;
vector<pair<int, int>> vec[1000];

vector<int> u, r;

using P = pair<int, int>;

bool c1(const P &a, const P &b) {
    return make_pair(a.second, a.first) < make_pair(b.second, b.first);
}
bool c2(const P &a, const P &b) {
    return make_pair(a.first - a.second, a.first) <
           make_pair(b.first - b.second, b.first);
}
bool c3(const P &a, const P &b) {
    return make_pair(a.first + a.second, a.first) <
           make_pair(b.first + b.second, b.first);
}

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

    ll ans = inf;

    cin >> n;
    rep(i, n) {
        int a, b;
        char c;
        cin >> a >> b >> c;
        vec[c].emplace_back(a, b);
    }

    sort(ALL(vec['D']));
    sort(ALL(vec['L']), c1);

    for(auto p : vec['U']) {
        auto it = lower_bound(ALL(vec['D']), p);
        if(it != vec['D'].end() && it->first == p.first)
            chmin(ans, (it->second - p.second) * 5);
    }
    for(auto p : vec['R']) {
        auto it = lower_bound(ALL(vec['L']), p, c1);
        if(it != vec['L'].end() && it->second == p.second)
            chmin(ans, (it->first - p.first) * 5);
    }

    sort(ALL(vec['D']), c2);
    sort(ALL(vec['L']), c2);

    for(auto p : vec['R']) {
        auto it = lower_bound(ALL(vec['D']), p, c2);
        if(it != vec['D'].end() && it->first - it->second == p.first - p.second)
            chmin(ans, (it->first - p.first) * 10);
    }
    for(auto p : vec['U']) {
        auto it = lower_bound(ALL(vec['L']), p, c2);
        if(it != vec['L'].end() && it->first - it->second == p.first - p.second)
            chmin(ans, (it->first - p.first) * 10);
    }

    sort(ALL(vec['U']), c3);
    sort(ALL(vec['L']), c3);

    for(auto p : vec['R']) {
        auto it = lower_bound(ALL(vec['U']), p, c3);
        if(it != vec['U'].end() && it->first + it->second == p.first + p.second)
            chmin(ans, (it->first - p.first) * 10);
    }
    for(auto p : vec['D']) {
        auto it = lower_bound(ALL(vec['L']), p, c3);
        if(it != vec['L'].end() && it->first + it->second == p.first + p.second)
            chmin(ans, (it->first - p.first) * 10);
    }

    if(ans == inf)
        cout << "SAFE" << endl;
    else
        cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5784
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a;
    cin>>a;
    int cOUNT=0;
    for(int i=0;i<a.size();i++){
        if(a[i]=='C'){
            cOUNT=1;
        }
        if(a[i]=='F'&&cOUNT==1){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

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

int main(){
    string s;
    getline(cin,s);

    int len=s.size();
    for(int i=0; i<len; i++){
        if(s[i]>=65 && s[i]<=90) s[i]=tolower(s[i]);
        else s[i]=toupper(s[i]);
    }

    cout<<s<<endl;
    return 0;
}



Measured memory_bytes: 3216
#pragma GCC optimize("Ofast")
 #pragma GCC optimization ("unroll-loops")
 #include<bits/stdc++.h>
 using namespace std;
 #define gcd(a,b) __gcd(a,b)
 #define pb push_back
 #define DRACO ios_base::sync_with_stdio(false);cin.tie(NULL);
 #define ll long long int
 #define GO ll t; cin>>t; while(t--)
 #define mod  1000000007
 #define vect vector<long long int>
 #define fore(p) for(auto& x:p)
 #define bins binary_search
 #define vecti vector<int>::iterator
 #define bitout __builtin_popcount
 #define all(x) x.begin(),x.end()
 #define allr(x) x.rbegin(), x.rend()
 #define PY 3.141592653589793238
 #define F first
 #define S second
 int main() 
 {   DRACO
     ll i,j,k,l,n,m;
     cout.precision(10);
     //GO
     {   ll a, b , c, d;
         cin >> a >> b >> c >> d;
         ll ans;
         if(a <= 0 && b <=0)
         {
         	if(c <= 0 && d <= 0)
         		ans = a*c;
         	else if(c <= 0 && d > 0)
         		ans = c*a;
         	else 
         		ans = b*c;
         }
         else if(a <= 0 && b > 0)
         {
         	if(c <= 0 && d <= 0)
         		ans = a*c;
         	else if(c <= 0 && d > 0)
         		ans = max(a*c,b*d);
         	else 
         		ans = b*d;
         }
         else
         {
         	if(c <= 0 && d <= 0)
         		ans = a*d;
         	else if(c <= 0 && d > 0)
         		ans = b*d;
         	else 
         		ans = b*d;
         }
         
         cout<< ans;
     }
 return 0;
 }
 //check the corner cases(n==1)
 //try checking in reverse order
 //check your logic again

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

int main() {
  int N, P[200000];
  int minv = 0;
  int ans=0;

  cin >> N;
  for (int i=0;i<N;i++) {
    cin >> P[i];
  }
  for (int i = 0; i < N; i++) {
    if (i == 0) {
      minv = P[0];
    }
    if (minv >= P[i]) {
      minv = P[i];
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
  char c;
  cin >> c;
  if (c == 'a') {cout << "vowel" << endl;}
  else if (c == 'e') {cout << "vowel" << endl;}
  else if (c == 'i') {cout << "vowel" << endl;}
  else if (c == 'o') {cout << "vowel" << endl;}
  else if (c == 'u') {cout << "vowel" << endl;}
  else {cout << "consonant" << endl;}
}

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

#define fi first
#define se second
#define ep emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

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

constexpr ll MOD = 1000000007;

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

  ll n, m; cin >> n >> m;
  ll ans = 0;

  ans += 1900 * m;
  ans += 100 * (n - m);

  cout << ans * pow(2, m) << endl;

  return (0);
}


Measured memory_bytes: 4164
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	for i := len(s); i < 15; i++ {
		s = s + "o"
	}
	if strings.Count(s, "o") >= 8 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    cout << fixed << setprecision(10) << (double)((n+1)/2) / n << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a = scan.nextInt();
		int b = scan.nextInt();
		int i = 0;
		int sum = 0;
		for(i = 1; i <= n; i++) {
			int i1 = i/10000;
			int i2 = (i - (i1 * 10000)) / 1000;
			int i3 = (i - (i1 * 10000) - (i2 * 1000)) / 100;
			int i4 = (i - (i1 * 10000) - (i2 * 1000) - (i3 * 100)) / 10;
			int i5 = (i - (i1 * 10000) - (i2 * 1000) - (i3 * 100)) % 10;
			int sum2 = i1 + i2 + i3 + i4 + i5;
			if(a <= sum2 && sum2 <= b) {
				sum = sum + i;
			}
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 22100
#include <iostream>  
#include <cstdio>  
#include <algorithm>
#define N 500001
using namespace std;
long long ti=0;
long long a[N];
long long b[N];
void m(long long a[],long long b[], int l, int m, int e)
{
    int i = l, j=m+1, k = l;
    while(i!=m+1 && j!=e+1)
    {
        if(a[i] > a[j]){
        	b[k++] = a[j++];
        	ti+=m-i+1;
		}
            
        else
            b[k++] = a[i++];
    }
    while(i != m+1)
        b[k++] = a[i++];
    while(j != e+1)
        b[k++] = a[j++];
    for(i=l; i<=e; i++)
        a[i] = b[i];
}
void msort(long long a[], long long b[], int l, int e)
{
    int mi;
    if(l < e)
    {
        mi = (l + e) / 2;
        msort(a, b, l, mi);
        msort(a, b, mi+1, e);
        m(a, b, l, mi, e);
    }
}
 
int main() { 
	long long n;
	cin>>n;
	for(long long i=0;i<n;i++){
		cin>>a[i];
	}
	msort(a,b,0,n-1);
	cout<<ti<<endl;
    return 0;  
} 

Measured memory_bytes: 6208
array_length = gets.to_i
array_value = gets.split(" ").map(&:to_i)

def selectionSort(array, length)
    
    exchange_ct = 0
    
    for i in 0..(length - 1) do
        
        minj = i
    
        for j in i..(length - 1) do
            
            if array[j] < array[minj]
                
                minj = j
                
            end
        end
        
        
        exchange_ct += 1  if i != minj
        
        
        array[i], array[minj] = array[minj], array[i]
    end
    
    exchange_ct
end

exchange_ct = selectionSort(array_value, array_length)

puts array_value.join(" ")
puts exchange_ct
    


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


int main(){
    ll i,n,m;
    priority_queue<int> que;
    cin >> n >> m;

    rep(i,n){
        ll a;
        cin>>a;
        que.push(a);
    }

    ll s;
    while(m > 0) {
        s = que.top() ; 
        que.pop();
        que.push(s/2);
        m = m-1;
    }
    ll ans = 0;
    while (!que.empty()) {
        ans += que.top();
        que.pop();
    }
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 892
fun main(args: Array<String>) {

    var (a, b) = readLine()!!.split(" ").map(String::toInt)

    var num = 0
    for (i in 1..2) {
        if (a > b) {
            num += a
            a -= 1
        } else {
            num += b
            b -= 1
        }
    }
    println(num)
}




Measured memory_bytes: 37956
#include <stdio.h>

int main() {
    int i;
    int N, K, h[1000000];
    int ans = 0;

    scanf("%d %d", &N, &K);
    for(i = 0; i < N; i++) {
        scanf("%d", &h[i]);
        if (h[i] >= K) ans++;
    }

    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 2304
n = int(input())
a = [int(x) for x in input().split()]

dp = [0] * (n + 1)

dp[0] = 0
dp[1] = abs(a[0] - a[1])

for i in range(2, n):
    dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]),
            dp[i - 2] + abs(a[i] - a[i - 2]))

print(dp[n - 1])

Measured memory_bytes: 13928
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Stack;

public class Main {
	
	public static void main(String[] args) {
		new Main().solve();
	}
	int MAX=1000002;
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int L=sc.nextInt();
		int[]a=new int[N];
		for(int i=0;i<N;i++) {
			a[i]=sc.nextInt();
		}
		int last=-1;
		for(int i=0;i<N-1;i++) {
			if(a[i]+a[i+1]>=L) {
				last=i;
				break;
			}
		}
		if(last==-1) {
			System.out.println("Impossible");
			return;
		}else {
			System.out.println("Possible");
			for(int i=0;i<last;i++) {
				System.out.println(i+1);
			}
			for(int i=N-1;i>last+1;i--) {
				System.out.println(i);
			}
			System.out.println(last+1);
		}
	}
}

Measured memory_bytes: 63884
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A, B = [], []
for i in range(N):
    a, b = MAP()
    A.append(a)
    B.append(b)

cnt = 0
for i in range(1, N+1):
    if (A[N-i] + cnt) % B[N-i] != 0:
        cnt += B[N-i] - (A[N-i] + cnt) % B[N-i]
print(cnt)


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

#define rep(i,x,y) for(int (i)=(x);i<(y);(i)++)

int main()
{
	int x, y, sum;
	
	while (true) {
		cin >> x >> y >> sum;
		if (x == 0 && y == 0 && sum == 0) {
			break;
		}

		int maxsum = 0;
		rep(i, 1, sum + 1) {
			rep(j, 1, sum + 1) {
				if (i*(100 + x) / 100 + j*(100 + x) / 100 > sum) {
					break;
				}
				if (i*(100 + x) / 100 + j*(100 + x) / 100 == sum) {
					maxsum = max(i*(100 + y) / 100 + j*(100 + y) / 100, maxsum);
				}
			}
		}
		cout << maxsum << endl;
	}

	return 0;
}

Measured memory_bytes: 3016
// Created by ...Lusifer
#include<bits/stdc++.h>
using namespace std;
 
#define pb 		push_back
#define mp 		make_pair
#define prior   priority_queue
#define MOD 	1000000007
#define INF64 	(long long)1e18
#define INF 	(int)1e9
#define PI 		3.1415926535897932384626433832795 
#define ll      long long
#define ld		long double
#define ret     return
#define NUM 	1000001
const int SIZE = 2e5+4;
void fastio(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

void solveTest(){
	int n,m;
	cin>>n>>m;
	int a[m+1] = {0};
	for(int i=0;i<n;i++){
		int k;
		cin>>k;
		for(int j=0;j<k;j++){
			int x;
			cin>>x;
			a[x]++;
		}
	}
	int cnt=0;
	for(int i=1;i<=m;i++){
		if(a[i]==n){
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return ;
}
 
int main(){
	fastio();

	int t=1;
	//cin>>t;
	while(t--){
		solveTest();
 
	}
	return 0;
}

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

using namespace std;

int main() {
  int n, x;
  cin >> n >> x;
  
  vector<int> a;
  for (int i = 0; i < n; ++i) {
    int val;
    cin >> val;
    a.push_back(val);
  }
  
  sort(a.begin(), a.end());
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] > x) {
      cout << ans << "\n";
      return 0;
    }
    
    x -= a[i];
    ans++;
  }
  
  if (x == 0) {
    cout << ans << "\n";
  } else {
    cout << ans - 1 << "\n";
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#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 rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)

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

    int N,K; cin >> N >> K;
    ld ans = 0;
    rep1(i,N+1){
        int cnt = 0;
        int X = i;
        while(X <= K-1){
            X *= 2;
            cnt++;
        }
        ans += (ld) pow(0.5, cnt)/N;
    }
    cout << setprecision(15) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
//DEFINE and TYPEDEF--------------------------------------------------------------
 
#define timeKyaHorhaH 1.0 * clock() / CLOCKS_PER_SEC
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

#define FORG(i,a,n) for(lld i=a;i<n;i++) //for - general
#define FORZ(i,n) for(lld i=0;i<n;i++) //for - zero
#define FORGI(i,a,n,inc) for(lld i=a;i<n;i+=inc) //for - general incremental
#define FORZI(i,n,inc) for(lld i=0;i<n;i+=inc) //for - zero incremental
#define DEBUG(x) cerr<<(#x)<<" is "<<(x)<<"\n" //to debug values of variables
#define ZINDA cerr<<"\nIdhar-ich hai apun!!\n"; //to debug if code reached that point
#define SPEEDUP ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
 
#define SORTall(m) sort(m.begin(),m.end());
 
#define st first
#define nd second
#define mkp make_pair
#define pb push_back
#define endl '\n'
#define mod 1000000007
 
typedef long long int lld;
typedef unsigned long long int ulld;
 
lld power(lld b, lld e)
{
    if(e==0)
        return 1;
    if(e%2==1)
        return b*power(b*b,(e-1)/2);
    else
        return power(b*b,e/2);
}
 
lld power(lld b, lld e, lld m)
{
	if(e==0)
		return 1;
	if(e%2==1)
		return b*power(((b%m)*(b%m))%m,(e-1)/2,m)%m;
	else
		return power(((b%m)*(b%m))%m,e/2,m)%m;
}
 
int nDig(lld n)
{
	if(n<0) 
		n*=-1;
	if(n==0)
		return 1;

    return floor(log10(n) + 1);
}

//endl : changed to '\n', to flush comment that definition
//--------------------------------------------------------------------------------

void swagWaalaFunction()
{
	lld n;
	cin>>n;

	while(n)
	{
		if(n%10==7)
		{
			cout<<"Yes";
			return;
		}
		n/=10;
	}

	cout<<"No";
	return;
}

int main()
{
    SPEEDUP;
 	lld t=1;
 	//cin>>t;

 	while(t--)
 		swagWaalaFunction();
	
	// cerr<<"\n"<<timeKyaHorhaH; 	
 	return 0;
}

Measured memory_bytes: 3700
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
int main()
{
    // freopen("A.01.in", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    char c;
    scanf("%c", &c);
    for (short i = 65; i <= 90; i++)
    {
        if (c == i)
        {
            printf("%c", 'A');
            return 0;
        }
    }
    printf("%c", 'a');
    return 0;
}

Measured memory_bytes: 3692
/*******************************************************************************/
//
//2????????´??°a,b??¨1???????????????op?????????????????§a op b????¨??????????????????°??????
//
//Input  :a op b
//		  op ??? '?' ?????¨??? ??\???????????????
//Output :?¨????????????????????????????
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_4_C&lang=jp
/*******************************************************************************/

#include<stdio.h>

#define MAX 20000
#define MIN 0

int main()
{
	int a,b;
	char c,enter;
	
	while( scanf("%d %c %d%c", &a, &c, &b, &enter)==4 )
	{
		if((a>=MIN) && (a<=MAX) && (b>=MIN) && (b<=MAX))
		{
			if(c=='+') printf("%d\n", a+b);
			else if(c=='-') printf("%d\n", a-b);
			else if(c=='*') printf("%d\n", a*b);
			else if((c=='/') && (b!=0)) printf("%d\n", a/b);
			else if(c=='?') break;
			else return -1;
		}
		else
		{
			/* ERROR */
			return -1;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1780
#include<bits/stdc++.h>
using namespace std;
int main() {
	int s=0,b,c=0,m,n,a[2000];
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++) scanf("%d",&a[i]),s+=a[i];
	int p = s/(4*m);
	for(int i=0;i<n;i++) {
		if(a[i]*4*m>=s) c++;
	}	
	if(c>=m) printf("Yes");
	else printf("No");
}

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

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    vector<string> str(n);
    rep(i,n) cin >> str[i];
    int table[51][26] = {0};
    string alp = "abcdefghijklmnopqrstuvwxyz";

    rep(i,n){
        rep(j,str[i].length()){
            int num = (int)(str[i][j] - 'a');
            table[i][num]++;
        }
    }

    vector<int> mindata(26,1000);
    rep(i,26){
        rep(j,n){
            mindata[i] = min(mindata[i],table[j][i]);
        }
    }
    rep(i,26){
        rep(j,mindata[i]){
            cout << alp[i];
        }
    }

cout << endl;
    return 0;
}

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


int main() {
    int N;
    cin>>N;
    char S[N];
    rep(i,N)cin>>S[i];
    rep(i,N){
        if(S[i]=='Y'){
            cout<<"Four"<<endl;
            return 0;
        }
    }
    cout<<"Three"<<endl;
}

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

int main()
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in("in.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int A, B, C;

    cin >> A >> B >> C;

    int remain = A - B;

    if (C < remain)
    {
        cout << 0;
    }
    else {
        cout << C - remain;
    }

    return 0;
}


Measured memory_bytes: 256
from collections import deque
s = input()
q = int(input())
num = 0
ans = deque(s)

for _ in range(q):
  query = list(input().split())
  if len(query) == 1:
    num += 1
  else:
    if int(query[1]) == 1:
      if num%2 == 0:        
        # 先頭
        ans.appendleft(query[2])
      else:
        ans.append(query[2])
    else:
      if num%2 == 0:
        # 後方
        ans.append(query[2])
      else:
        ans.appendleft(query[2])     

if num%2 == 0:
  print(''.join(ans))
else:
  ans.reverse()
  print(''.join(ans))

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

int main() {
  
  int a,b,c,d;	cin >> a >> b >> c >> d;
  int e=(a+d-1)/d;
  int f=(c+b-1)/b;
  if(e>=f){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


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

int main() {
  int n, c, k; cin >> n >> c >> k;
  const int N = n, C = c, K = k;
  vector<int> t(N);
  rep (i, N)
    cin >> t.at(i);
  sort(t.begin(), t.end());
  const int FINTIME = t.back();
  int bus=0, member=0, dt=0, start=t.front();
  rep (i, N) {
    dt = t.at(i) - start;
    if (member >= C || i==N-1 || dt > K) { //満員||最後||時間切れ→発車
      if (i == N-1 && (member >= C || dt > K)) {//最後に満員または時間切れで+1
        bus ++;
      }
      bus ++; member = 1; start = t.at(i);
    }
    else {//乗せる→次へ
      member ++;
    }
    
  }
  cout << bus << endl;
  return 0;
}


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

int main(){

    long long  m;
    long long k,n;
    m=0;
    n=0;
    scanf("%lld",&k);
    if(k%2==0||k%5==0){
        n=-1;
        printf("%lld",n);
        return 0;
    }else{
    while(1){
        m=(m*10+7)%k;
        n+=1;
        if(m %k  ==0){

            printf("%lld",n);
            return 0;
        }
    }
    }
    return EXIT_SUCCESS;
}


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

int main(){
    int x, n;
    cin >> x >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    for(int i=0; i<100; i++){
        auto result=find(a.begin(), a.end(), x-i);
        if(result == a.end()){
            cout << x-i << endl;
            return 0;
        }
        else{
            auto res=find(a.begin(), a.end(), x+i);
            if(res == a.end()){
                cout << x+i << endl;
                return 0;
            }
        }
    }
    return 0;
}


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

const int MAX = 1e6;

vector<pair<int,int> >adj[MAX];
int arr[MAX],dist[MAX];
void dfs(int src,int last,int d)
{
    dist[src]=d;
    for(int i=0; i<adj[src].size(); i++)
    {
        int child=adj[src][i].first;
        int cost=adj[src][i].second;
        //if(child==last)
          //  continue;
        if(dist[child]==MAX)
            dfs(child,src,d+cost);
        else  if(dist[child]!= dist[src]+cost)
        {
            cout<<"No"<<endl;
            exit(0);
        }
    }
}
int main()
{
       int n,m;
    cin>>n>>m;
    for(int i=0; i<=n; i++)
        dist[i]=MAX;
    while(m--)
    {
        int u,v,x;
        cin>>u>>v>>x;
        adj[u].push_back({v,x});
        adj[v].push_back({u,-x});
    }

    for(int i=1; i<=n; i++)
        if(dist[i]==MAX)
            dfs(i,0,0);

    cout<<"Yes"<<endl;

    return 0;
}


Measured memory_bytes: 37344
from collections import Counter
from bisect import bisect_right

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a



def main():
    N = int(input())

    nums = [0] * 42
    nums[1] = 1
    for i in range(1, 41):
        nums[i+1] = nums[i] + (i+1)
    
    factor = prime_factorize(N)
    c = Counter(factor)
    ans = 0

    for val in c.values():
        idx = bisect_right(nums, val)
        ans += idx - 1
    print(ans)

if __name__ == "__main__":
    main()



Measured memory_bytes: 9476
from collections import deque

n = int(input())
que = deque([],n)

for _ in range(n):
	command = input()

	if command == "deleteFirst":
		que.pop()
		continue

	if command == "deleteLast":
		que.popleft()
		continue

	command, value = command.split()
	value = int(value)

	if command == "insert":
		que.append(value)
		continue

	if command == "delete":
		if value in que:
			que.reverse()
			que.remove(value)
			que.reverse()

print(*(list(que)[::-1]))


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

#define pii pair<int, int>
#define pll pair<LL, LL>
#define F first
#define S second
#define B begin()
#define E end()
#define MOD 1000000007
#define itt iterator
#define ritt reverse_iterator
#define LL long long

#define PI (4 * atan(1))

using namespace std;

char s[100005], dream[6], dreamer[8], erase[6], eraser[7], bef5[6], bef6[7], bef7[8];
int len;
bool ok[100005];

int main()
{
	// freopen("D:\\Computer\\test.in", "r", stdin);
	// freopen("D:\\Computer\\test.out", "w", stdout);

	dream[0] = dreamer[0] = 'd';
	dream[1] = dreamer[1] = 'r';
	dream[2] = dreamer[2] = 'e';
	dream[3] = dreamer[3] = 'a';
	dream[4] = dreamer[4] = 'm';
	dreamer[5] = 'e';
	dreamer[6] = 'r';
	erase[0] = eraser[0] = 'e';
	erase[1] = eraser[1] = 'r';
	erase[2] = eraser[2] = 'a';
	erase[3] = eraser[3] = 's';
	erase[4] = eraser[4] = 'e';
	eraser[5] = 'r';
	dream[5] = dreamer[7] = erase[5] = eraser[6] = '\0';
	bef5[5] = bef6[6] = bef7[7] = '\0';

    scanf("%s", s);
    len = strlen(s);
    ok[0] = true;
    for(int i = 0; i < len; ++i)
    {
    	for(int j = 0; j < 4; ++j)
    		bef5[j] = bef5[j+1];
    	for(int j = 0; j < 5; ++j)
    		bef6[j] = bef6[j+1];
    	for(int j = 0; j < 6; ++j)
    		bef7[j] = bef7[j+1];
    	bef5[4] = bef6[5] = bef7[6] = s[i];
    	if(i >= 4)
    	{
    		if(strcmp(bef5, dream) == 0 && ok[i - 4])
    			ok[i + 1] = true;
    		if(strcmp(bef5, erase) == 0 && ok[i - 4])
    			ok[i + 1] = true;
    	}
    	if(i >= 5)
    	{
    		if(strcmp(bef6, eraser) == 0 && ok[i - 5])
    			ok[i + 1] = true;
    	}
    	if(i >= 6)
    	{
    		if(strcmp(bef7, dreamer) == 0 && ok[i - 6])
    			ok[i + 1] = true;
    	}
    }
    if(ok[len])
    	printf("YES");
    else
    	printf("NO");
    return 0;
}



Measured memory_bytes: 384
x,y,a,b,c=[int(i) for i in input().split()]

red_list=[int(i) for i in input().split()]
green_list=[int(i) for i in input().split()]
non_col_list=[int(i) for i in input().split()]

red_list.sort()
green_list.sort()
non_col_list.sort()

eat_red=[]
eat_green=[]
for i in range(x):
    eat_red.append(red_list.pop())
for i in range(y):
    eat_green.append(green_list.pop())


ans_list=eat_green+eat_red+non_col_list
ans_list.sort()
ans=0
for i in range(x+y):
    ans+=ans_list.pop()

print(ans)

Measured memory_bytes: 29444
#include<iostream>
#include<queue>
#include<limits>
// #include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<cmath>
#include<math.h>
#include<iomanip>  
#include<deque> 
#include<stack>
#include<string> 
#include<string.h>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#define ll long long
#define tc(t)  while(t--)
#define V vector
#define Vp vector< pair<int,int> >
#define pb push_back
#define UM unordered_map
#define IT iterator
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define PQ priority_queue
#define _FI ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

 char ar[140000];
vector<ll> SieveOfEratosthenes(ll n) 
{ 
  vector<ll> result;
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
    int count=1;
    for (ll p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        {  
            for (ll i=p*p; i<=n; i += p) 
                {
                  prime[i] = false; 
                }
            count++;
        } 
    } 
  
    for (ll p=2; p<=n; p++) 
       if (prime[p]) 
          {
            result.push_back(p);
          }
    return result;
}



vector<ll> Divisors (ll n)
{
  vector<ll> res;
  for(ll i=1;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      if(n/i==i)
      {
        res.pb(i);
      }
      else
      {
        res.pb(i);
        res.pb(n/i);
      }
    }
  }

  return res;
}

ll Div(ll n)
{
  for(ll i=2;i<=sqrt(n);i++)
  {
    if(n%i==0)
      return i;
  }
  return n;
}

int a[4][2]={ {1,0}, {1,-1}, {1,1}, {2,0} } ;
bool validPoint(int x,int y, int N)
{
    return (x>=0 && x<N && y>=0 && y<N);
}

 
int main()
{
  _FI 

  string a,b;
  cin>>a;
  int n=a.length();
  for(int i=0;i<n;i++)
    cout<<"x";
  

  return 0;
}















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

const int MAXN = 100000;

int main() {
	int n;
	long long m;
	cin >> n >> m;
	long long a[MAXN + 1];
	a[0] = 0;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	sort(a + 1, a + n + 1);
	long long left = a[1] * 2, right = a[n] * 2 + 1;
	auto count = [&](long long x) {
		long long result = 0;
		for (int i = 1, j = n; j > 0; j--) {
			while (i <= n && a[i] + a[j] < x) {
				i++;
			}
			result += n + 1 - i;
		}
		return result;
	};
	while (left < right) {
		long long mid = (left + right) / 2;
		if (count(mid) <= m) {
			right = mid;
		}
		else {
			left = mid + 1;
		}
	}
	long long finalCount = count(left);
	for (int i = 1; i <= n; i++) {
		a[i] += a[i - 1];
	}
	long long result = 0;
	for (int i = 1, j = n; j > 0; j--) {
		while (i <= n && a[i] - a[i - 1] + a[j] - a[j - 1] < left) {
			i++;
		}
		result += a[n] - a[i - 1] + (a[j] - a[j - 1]) * (n - i + 1);
	}
	cout << result + (m - finalCount) * (left - 1) << endl;
	return 0;
}

Measured memory_bytes: 1024