akhauriyash/Code-Regression huggingface dataset:
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    S=list(input())
    K=I()
    K-=1
    s=S[K]
    for i in range(N):
        if S[i]!=s:
            S[i]="*"
            
    print(''.join(map(str, S)))

main()


Measured memory_bytes: 61868
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
using Graph = vector<vector<int>>;
using Graph_Wei = vector<vector<pair<int,int>>>;
using ll = long long;
const long long INF = 1LL<<60; // 仮想的な無限大の値
vector<bool> seen;

Graph G;


int main() {
    string s;
    string t;
    cin >> s >> t;
    for(int i=0;i < s.size();i++){
        cout << s[i];
        if(i < t.size()) cout << t[i];
    }
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int64_t MOD=1000000007;
int main() {
  int N,ans=0;
  cin>>N;
  vector<int> A(N);
  vector<bool> div(1000002,true);
  rep(i,N) cin>>A.at(i);
  sort(A.begin(),A.end());
  rep(i,N){
    int64_t k=A.at(i),l=2;
    if(div.at(k)){
      while(k*l<=1000001){
        div.at(k*l)=false;
        l++;
      }
    }
    if(i>0&&k==A.at(i-1)) div.at(k)=false;
  }

  rep(i,N){
    if(div.at(A.at(i))) ans++;
  } 
  cout<<ans;     
}


Measured memory_bytes: 4048
#include <iostream>
#include <set>
using namespace std;
int main(){
  string s;
  set<char> right;
  string rs ="yuiophjklnm";

  for( int i=0;i<(int)rs.length();i++ )
    right.insert( rs[i] );


  while( cin>>s && s!="#" ){
    bool isR = right.find( s[0] )!=right.end(), bu;
    int ans=0;

    for( int i=1;i<(int)s.length();i++ ){
      bu = right.find( s[i] )!=right.end();
      if( isR!=bu ){
	isR=bu; ans++;
      }
    }

    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
n = int(input())
s = list(input())
ans = "".join(s)

f = True
while f:
    f = False
    l = [True] * len(s)
    ns = []
    for i in range(len(s)-1):
        if (s[i] == "(") and (s[i + 1] == ")"):
            l[i], l[i + 1] = False, False
            f = True

    for i in range(len(s)):
        if l[i]:
            ns.append(s[i])

    s = ns.copy()

cnt = [0, 0]
for c in s:
    cnt[c == "("] += 1

print("(" * cnt[0] + ans + ")" * cnt[1])


Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

char s[100010];
ll n;
int main(){
	scanf("%s",s);
	n=strlen(s);
	ll ans=0;
	ll rest=n;
	ll cnt=0;
	
	rep(i,0,n){
		rest--;
		if(s[i]=='1'){
			ans+=pom(2,cnt,MOD)*pom(3,rest,MOD);
			ans%=MOD;
			cnt++;
		}
	}
	
	ans+=pom(2,cnt,MOD);
	printf("%lld",(ans+MOD)%MOD);
}

Measured memory_bytes: 256
import sys
import math


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()

z = {():0}
ans = 0

def combinations(n, r):
    if n < r:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(n):
    c = [0]*123
    s = input()
    for j in range(len(s)):
        c[ord(s[j])] += 1
    try:
        z[tuple(c)] += 1
    except:
        z[tuple(c)] = 1

for i in z:
    ans += combinations(z[i],2)

print(ans)

Measured memory_bytes: 115456
#include <iostream>
#include <queue>
#include <string>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
	int n;
	cin >> n;
	while(n--) {
		deque<char> q;
		bool ch[26] = {};
		string s;
		cin >> s;
		q.push_back(s[0]);
		ch[s[0]-'a'] = 1;
		int ren = (s.length()-1)/3;
		rep2(i,1,ren+1) {
			if(s[i*3-2] == '<' && !ch[s[i*3]-'a']) {
				q.push_front(s[i*3]);
				ch[s[i*3]-'a'] = 1;
			} else if(s[i*3-1] == '>' && !ch[s[i*3]-'a']) {
				q.push_back(s[i*3]);
				ch[s[i*3]-'a'] = 1;
			}
		}
		for(char c : q) {
			cout << c;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1204
N,A,B,C = list(map(int, input().split()))
X = [A,B,C]
ANS = []

flg = True
D = []
pat = {'AB':[0,1], 'BC':[1,2], 'AC':[0,2]}

for i in range(N):
  l = input()
  D.append(pat[l])
  
for i in range(N):
  ai, bi = D[i]
  an, bn = D[i+1] if i < N-1 else [0,1] # nanndemoyoi

  if X[ai] == 0 and X[bi] == 0:
    flg = False
    break
  elif X[ai] == 0:
    ANS.append(ai)
    X[ai] += 1
    X[bi] -= 1
  elif X[bi] == 0:
    ANS.append(bi)
    X[bi] += 1
    X[ai] -= 1
  else:
    if ai == an or ai == bn:
      pl, mi = ai, bi
    else:
      pl, mi = bi, ai
    # 先読みで使う方
    ANS.append(pl)
    X[pl] += 1
    X[mi] -= 1
      
if not flg:
  print('No')
else:
  print('Yes')
  dd = {0:'A', 1:'B', 2:'C'}
  for ans in ANS:
    print(dd[ans])
    



Measured memory_bytes: 10680
from fractions import gcd


def main():
    n, m = map(int, input().split())
    s = input()
    t = input()

    g = gcd(n, m)

    def f(x):
        ret = ""
        for i in range(0, len(x), len(x) // g):
            ret += x[i]

        return ret

    if f(s) == f(t):
        ans = n * m // g
    else:
        ans = -1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 5340
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    string S; cin >> S;
    if (S[0] == 'R' && S[1] == 'R' && S[2] == 'R') {
        cout << 3 << endl;
    }
    else if (S[0] == 'R' && S[1] == 'R' && S[2] != 'R') {
        cout << 2 << endl;
    }
    else if (S[0] != 'R' && S[1] == 'R' && S[2] == 'R') {
        cout << 2 << endl;
    }
    else if (S[0] != 'R' && S[1] != 'R' && S[2] != 'R') {
        cout << 0 << endl;
    }
    else {
        cout << 1 << endl;
    }
}

Measured memory_bytes: 3620
#include<iostream>
#include<vector>
#include<string>
#include <algorithm>
#include <queue>
#include <climits>
#include<cmath>
#include <sstream>
#include <iomanip>

bool sort_pair( std::pair< int64_t, std::string > origin, std::pair< int64_t, std::string > another )
{
    return origin.first < another.first;
}


int main()
{

    int a,c,d;
    
    std::cin>> a;
    std::cin>> c;

    int64_t b = 0;

    for( int i = 0; i < a; i++ )
    {
        std::cin>> d;

        if( c <= d )
        {
            b += 1;
        }
    }

    std::cout<< b;
}


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

#define sz(x) (int)(x.size())
#define FOR(i,L,R) for(int i = L; i <= R; i++)
#define int long long

const int N = 2e5 + 2, inf = 1e18;

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

    int n;
    cin >> n;
    cout << (n == 0);    
}


Measured memory_bytes: 3584
using System;
using System.Collections.Generic;
using System.Linq;
//using System.Numerics;
class Program
{       
    public void Slove()
    {
        var inputs = Console.ReadLine().Split();
        int n = int.Parse(inputs[0]);
        int k = int.Parse(inputs[1]);
        int indexOfOne = Array.IndexOf(Console.ReadLine().Split(), "1");
        int count = (indexOfOne - 1) / (k - 1);
        count += (n - (count * (k - 1) + k) + (k - 2)) / (k - 1) + 1;
        System.Console.WriteLine(count);
    }
    
    static void Main(string[] args)
    {
        new Program().Slove();
    }
}


Measured memory_bytes: 18656
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a, b, c, d = MAP()
print(max(a * b , c * d))

Measured memory_bytes: 5148
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
//#define PI 3.14159265358979

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
int dfs(vector< vector< int > > &G, int x, int p, int &d) {
	int m1 = 0, m2 = 0;
	rep(i, G[x].size()) {
		int j = G[x][i];
		if (j == p)
			continue;
		int tmp = dfs(G, j, x, d);
		if (tmp > m1) {
			m2 = m1;
			m1 = tmp;
		} else if (tmp > m2) {
			m2 = tmp;
		}
	}
	chmax(d, m1 + m2);
	//cout << x << " " << m1 << " " << m2 << endl;
	return m1 + 1;
}
signed main() {
	cin >> N;
	vector< vector< int > > G(N);
	rep(i, N - 1) {
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	int d = 0;
	dfs(G, 0, -1, d);
	++d;
	vector< int > dp(d + 1);
	dp[0] = 0;
	dp[1] = 1;
	for (int i = 2; i <= d; i++) {
		if (i == 2)
			dp[i] = 0;
		else {
			if (dp[i - 1] == 0 || dp[i - 2] == 0)
				dp[i] = 1;
			else
				dp[i] = 0;
		}
	}
	//cout << d << endl;
	string ans = dp[d] ? "First" : "Second";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 27776
#include <iostream>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

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

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

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

    int minX = 0, maxX = w, minY = 0, maxY = h;
    REP(i, n) {
        int x, y, a;
        cin >> x >> y >> a;
        if (a == 1) chmax(minX, x);
        if (a == 2) chmin(maxX, x);
        if (a == 3) chmax(minY, y);
        if (a == 4) chmin(maxY, y);
    }

    if (minX > maxX || minY > maxY) cout << 0 << '\n';
    else cout << (maxX - minX) * (maxY - minY) << '\n';
    return 0;
}

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

int main() {
  int input_num = 0;
  cin >> input_num;

  int ac = 0;
  int wa = 0;
  int tle = 0;
  int re_ = 0;
  string s = "";
  getline(cin, s);
  for (int i = 0; i < input_num; i++) {
    getline(cin, s);
    if (s == "AC") {
      ac++;
    }
    if (s == "WA") {
      wa++;
    }
    if (s == "TLE") {
      tle++;
    }
    if (s == "RE") {
      re_++;
    }
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re_ << endl;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define ll long long
#define M 1000000007
#define N 410
using namespace std;

ll n,k,a[N],dp[N][N];

int main()
{
    cin>>n; FOR(i,1,n+1) cin>>a[i],a[i]+=a[i-1],dp[i][i]=0;
    FOR(i,1,n)
    {
        FOR(j,1,n-i+1)
        {
            dp[j][j+i]=LONG_MAX;
            FOR(k,j,j+i)
            {
                dp[j][j+i]=min(dp[j][j+i],a[j+i]-a[j-1]+dp[j][k]+dp[k+1][j+i]);
            }
        }
    }
    cout<<dp[1][n]<<'\n';

    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 1; i < (n); i++) 
#define out(n) cout << n << endl;

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

    int first = n/10;
  first = first*10;
  first = n-first;

    if(first == 3){
        ans = "bon";
    }else if(first == 0 or first == 1 or first == 6 or first == 8){
        ans = "pon";
    }else{
        ans = "hon";
    }

    out(ans)
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t meke_tuple
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a));reverse(all(a))
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (ll)(a.size())
#define ENDL cout<<endl
#define debg(a) cout<<#a<<" "<<a<<endl;
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define show(a) rep(ghf,SZ(a)){rep(kjh,SZ(a[ghf])){cout<<(a[ghf][kjh]<10?" ":"")<<a[ghf][kjh]<<" ";}ENDL;}
#define out(a) cout<<(a)<<endl
#define fi first
#define se second
#define Vec vector
#define P pair
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
typedef long long ll;
typedef string str;
typedef vector<ll> V;
typedef pair<ll,ll> Pi;
typedef vector<Pi> VP;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int max(int a,int b){if(a>b)return a; return b;}
int min(int a,int b){if(a>b)return b; return a;}
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

void add(ll&a,const ll&b){
  a+=b;
  if(a>MOD)a-=MOD;
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll h,w,k;
  cin>>h>>w>>k;
  k--;

  VV(ll,dp,h+1,w,0);
  dp[0][0]=1;

  rep(high,h){
    rep(bit,(1<<(w-1))){

      // 1が二つ連続しているのはNG
      bool ng=false;
      rep(i,w-2)
        if((bit>>i)%4==3)ng=true;
      if(ng)continue;

      // bitが立っていたら、すなわち横に移動するなら移動する
      V perm(w);
      rep(i,w)perm[i]=i;
      rep(i,w-1)
        if((bit>>i)&1)swap(perm[i],perm[i+1]);

      rep(i,w)
        add(dp[high+1][perm[i]],dp[high][i]);

    }
  }
  
  out(dp[h][k]);
  
  
  
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int n;
    cin >> n;
    char s[n];
    vector<int> ct;
    ct.push_back(0);
    for(int i= 0;i < n;i++){
        cin >> s[i];
        if(i >= 1 &&s[i] == 'E')ct[0]++;
    }
    for(int i = 1;i < n;i++){
        if(s[i-1] == 'W' && s[i] == 'E')ct.push_back(ct[i-1]);
        else if(s[i-1] == 'E' && s[i] == 'E')ct.push_back(ct[i-1]-1);
        else if(s[i-1] == 'W' && s[i] == 'W')ct.push_back(ct[i-1]+1);
        else if(s[i-1] == 'E' && s[i] == 'W')ct.push_back(ct[i-1]);
    }
    int min = *min_element(ct.begin(), ct.end());
    cout << min << endl;
    return 0;
}


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

#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
#define all(v) (v).begin() , (v).end()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using pii = pair<int , int>;
using pll = pair<long long , long long>;

//プロトタイプ宣言
void faster(void);
template <class T>
T gcd(T , T);
template <class T>
T get_digent(T);
template <class T>
T POW(T , T);


int main(){
  faster();
  int n,r;
  cin >> n >> r;
  if(n>=10) cout << r ;
  else cout << r + 100*(10-n);
}


























//同期解除
void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

//ユークリッドの互除法
template <class T>
T gcd(T a, T b) {
  return (b ? gcd(b, a%b) : a);
} 

//桁数取得
template <class T>
T get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} 

//べき乗計算
template <class T>
T POW(T x, T y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} 



Measured memory_bytes: 256
#include<stdio.h>

int main(){
   int N,M;
   int A[10000];
   int i;
   int count = 0;

   scanf("%d %d",&N,&M);

   for(i = 0;i<M;i++){
      scanf("%d",&A[i]);
      count += A[i];
   }
   if(count>N){
      printf("-1");
   }else{
      printf("%d",N-count);
   }
   return 0;
}
   

Measured memory_bytes: 1768
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {
	
	int l, r;
	scanf("%d%d", &l, &r);
	ll ans = LINF;
	for (int i = l; i <= r; ++i) {
		for (int j = i + 1; j <= r; ++j) {
			ans = min(ans, ((ll)i * j) % 2019);
			if (ans == 0)break;
		}
		if (ans == 0)break;
	}
	printf("%lld\n", ans);

	Please AC;
}

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

using namespace std;
using ll = long long;
using P = pair<int, ll>;

int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<int>> g(N);
	for (int i = 0; i < M; ++i) {
		int u, v;
		cin >> u >> v;
		g[u - 1].push_back(v - 1);
	}
	int s, t;
	cin >> s >> t;
	--s;
	--t;

	ll res = 1e18;
	vector<vector<bool>> used(N, vector<bool>(3, false));
	used[s][0] = true;
	deque<P> que;
	que.push_back(P(s, 0LL));
	while (!que.empty()) {
		P p = que.front();
		que.pop_front();

		int u = p.first;
		ll cost = p.second;
		if (u == t && cost % 3 == 0) {
			res = min(res, cost / 3);
			continue;
		}
		for (int i = 0; i < g[u].size(); ++i) {
			ll key = (cost + 1) % 3;
			if (used[g[u][i]][key]) { continue; }
			used[g[u][i]][key] = true;
			que.push_back(P(g[u][i], cost + 1));
		}
	}

	if (res == 1e18) { cout << -1 << endl; }
	else { cout << res << endl; }

	return 0;
}


Measured memory_bytes: 12800
# -*- coding: utf-8 -*-
N,Q=map(int, input().split())
s = input();
charList=list(s);
AClist=[0]*N;

for i in range(N-1):
 if charList[i]=='A' and charList[i+1]=='C':
  AClist[i+1]=AClist[i]+1;
 else:
  AClist[i+1]=AClist[i];

result=[0]*Q;
for i in range(Q):
 l, r = map(int, input().split())
 result[i]=AClist[r-1]-AClist[l-1];
 if result[i]<0:
  result[i]=0;
for i in range(Q):
 print(result[i]);


Measured memory_bytes: 11076
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
#define SEGMAX 131072
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int n;

	cin>>n;

	vc s(n);
	vb ans(n);

	bool flag=false;

	rep(i, n) cin>>s[i];


	rep(k, 4){
		ans[0]=k/2; ans[1]=k%2;
		repr(i, 1, n){
			if(ans[i]&&s[i]=='o'||!ans[i]&&s[i]=='x'){
				ans[(i+1)%n]=ans[i-1];
			}else{
				ans[(i+1)%n]=!ans[i-1];
			}
		}
		bool flag2=true;
		rep(i, n){
			if(s[i]=='o'){
				if(ans[i]){
					if(ans[(i-1+n)%n]!=ans[(i+1)%n]){
						flag2=false;
						break;
					}
				}else{
					if(ans[(i-1+n)%n]==ans[(i+1)%n]){
						flag2=false;
						break;
					}
				}
			}else{
				if(ans[i]){
					if(ans[(i-1+n)%n]==ans[(i+1)%n]){
						flag2=false;
						break;
					}
				} else{
					if(ans[(i-1+n)%n]!=ans[(i+1)%n]){
						flag2=false;
						break;
					}
				}
			}
		}
		if(flag2){
			flag=true; break;
		}
	}

	if(flag){
		rep(i, n){
			if(ans[i]){
				cout<<'S';
			}else{
				cout<<'W';
			}
		}
		cout<<endl;
	}else{
		cout<<-1<<endl;
	}
}

Measured memory_bytes: 512
import java.util.Arrays;
import java.util.Scanner;

public class Main 
{
	static int n, m, r;
	static int[] tar;
	static long[][] dis;
	static long INF = 100000100000100000l;
	static long score = INF;
	
	static void go(int state, long tra, int pos)
	{
		if(state == allmask)
		{
			score = Math.min(score, tra);
			return;
		}
		for(int i = 0; i < r; i++)
		{ 
			if((mask[i] & state) <= 0)
			{ //not visited yet, go to tar[i]
				if(state == 0)
					go(state + mask[i], tra, tar[i]);
				else
					go(state + mask[i], tra + dis[pos][tar[i]], tar[i]);
			}
		}
	}
	
	static int[] mask = new int[8];
	static int allmask = 0;

	public static void main(String[] args) 
	{
		int curm = 1;

		Scanner sc = new Scanner(System.in);
		
		n = sc.nextInt();
		m = sc.nextInt();
		r = sc.nextInt(); //targets
		tar = new int[r];
		dis = new long[n][n];
		
		for(int i = 0; i < 8; i++)
		{
			if(i<r)
				allmask+=curm;
			mask[i] = curm;
			curm *= 2;
		}		
		for(int i = 0; i < r; i++)
			tar[i] = sc.nextInt()-1;
		
		for(int i = 0; i < n; i++)
			for(int j = 0; j < n; j++)
				dis[i][j] = i==j?0:INF;
		
		for(int i = 0; i < m; i++)
		{
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
			long d = sc.nextLong();
			dis[a][b] = d;
			dis[b][a] = d;
		}
		
		for(int k = 0; k < n; k++)
			for(int i = 0; i < n; i++)
				for(int j = 0; j < n; j++)
				{
					dis[i][j] = Math.min(dis[i][j], dis[i][k] + dis[k][j]);
				}
		
		go(0, 0, 0);
		
		System.out.println(score);
	}

}


Measured memory_bytes: 47688
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

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

typedef long long ll;
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 int dy[] = { 0, 0, 1, -1 };
//const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);

vector<ll> a, b;

int main()
{
	ll n,m;
	ll ans1,ans2;
	cin >> n >> m;
	ans1 = n * (n - 1) / 2;
	ans2 = m * (m - 1) / 2;
	cout << ans1+ans2 << endl;

	return 0;
}


Measured memory_bytes: 256
s = str(input())
S = []
for c in s:
    S.append(c)
    
count = 0
maxcount = 0
for i in range(len(S)):
    if (S[i] == "A")or(S[i] == "T")or(S[i] == "G")or(S[i] == "C"):
        count += 1
    else:
        count = 0
    if (maxcount < count):
        maxcount = count



print(maxcount)

Measured memory_bytes: 3064
N = int(input())
P = list(map(int,input().split()))
L = [False]*N
for i in range(N):
  if P[i] == i+1:
    L[i] = True
ans = 0
i = 0
while i < N:
  if L[i]:
    if i<N-1 and L[i+1]:
      ans+=1
      i+=1
    else:
      ans+=1
  i+=1
print(ans)

Measured memory_bytes: 84660
#define taskname "test"

#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)x.size()
#define fi first
#define se second
#define int long long

typedef long long lli;
typedef pair<int, int> pii;

const int maxn = 1e9;

void read_input()
{

}

bool ask(int x, int flag)
{
    if(flag)
    {
        while(x <= maxn)
            x *= 10LL;
    }
    cout << "? " << x << endl;
    char c;
    cin >> c;
    return c == 'Y';
}

int get1()
{
    int low = 1, high = 10;
    int x;
    while(low <= high)
    {
        int mid = (low + high) / 2;
        x = 1;
        for(int i = 1; i <= mid; ++i) x *= 10LL;
        --x;
        if(ask(x, 0)) high = mid - 1;
        else low = mid + 1;
    }
    return low;
}

int get2()
{
    int low = 1, high = 10;
    int x;
    while(low <= high)
    {
        int mid = (low + high) / 2;
        x = 1;
        for(int i = 1; i < mid; ++i) x *= 10LL;
        if(ask(x, 0)) low = mid + 1;
        else high = mid - 1;
    }
    return high;
}

void solve()
{
    int len = -1;
    int cur = 0, ans = -1;
    for(int i = 1; i < 11; ++i)
    {
        int low = (i == 1 ? 1 : 0), high = 9;
        while(low <= high)
        {
            int mid = (low + high) / 2;
            if(ask(cur * 10 + mid, 1)) high = mid - 1;
            else low = mid + 1;
        }
        low = min(9LL, low);
        if(!ask(cur * 10 + low, 0)) --low;
        cur = cur * 10 + low;
        if(i == 1)
            len = (low < 9 ? get1() : get2());
        if(i == len)
        {
            ans = cur;
            break;
        }
    }
    cout << "! " << ans << endl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    solve();
}



Measured memory_bytes: 3732
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <iostream>
#include <limits>
#include <queue>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<pair<int, int>> vii;
typedef stringstream ss;
const int mii = numeric_limits<int>::min();
const int mai = numeric_limits<int>::max();
const ll mil = numeric_limits<long long>::min();
const ll mal = numeric_limits<long long>::max();

#define REP(i, a, b) for(long long i=a; i<b; ++i)
#define RREP(i, a, b) for(long long i=a; i>b; --i)
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

int main(int argc, char **argv) {
    ll x, y, a, b, c;
    cin >> x>>y>>a>>b>>c;
    ll p[100001] = {0};
    ll q[100001] = {0};
    ll r[100001] = {0};

    REP(i, 0, a) {
        cin >> p[i];
    }
    REP(i, 0, b) {
        cin >> q[i];
    }
    REP(i, 0, c) {
        cin >> r[i];
    }

    sort(p, p+a, greater<ll>());
    sort(q, q+b, greater<ll>());
    sort(r, r+c, greater<ll>());

    vector<ll> e;


    REP(i, 0, x)
        e.PB(p[i]);

    REP(i, 0, y)
        e.PB(q[i]);

    REP(i, 0, min(x+y, c))
        e.PB(r[i]);

    sort(e.begin(), e.end(), greater<ll>());

    ll tot = 0;
    REP(i, 0, x+y)
        tot += e[i];

    cout << tot <<endl;

    return 0;
}

Measured memory_bytes: 8816
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=m-1; i>=n; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x,n/2)%MOD;
  return x%MOD*POW(x,n-1)%MOD;
}

ll POW2(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW2(x*x,n/2);
  return x*POW2(x,n-1);
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll KAI2(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI2(m-1);
}

ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll COM2(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI2(m)/KAI2(n)/KAI2(m-n);
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

int main()
{
  ll a,b,c;
  cin >> a >> b >> c;
  if(a==b&&b==c)printf("Yes");
  else printf("No");
}

Measured memory_bytes: 768
/*{{{*/
#include "bits/stdc++.h"
using namespace std;

#define MT make_tuple
#define all(x) begin(x), end(x)
#define putchar(x) cout << (x)
static int fastio = [](){ ios_base::sync_with_stdio(false); cin.tie(0); cout.precision(17); return 0; }();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<typename ...T> string format(const string& fmt, T&&... args) {
    size_t sz = snprintf(nullptr, 0, fmt.c_str(), args...) + 1;
    unique_ptr<char[]> buf(new char[sz]);
    snprintf(buf.get(), sz, fmt.c_str(), args...);
    return string(buf.get(), buf.get() + sz - 1);
}

template<class T> struct rge { T b, e; auto begin() const { return b; } auto end() const { return e; } };
template<class T> rge<T> range(T i, T j) { return rge<T>{i, j}; }
template<class T> auto dud(T* x) -> decltype(cerr << *x, 0);
template<class T> char dud(...);

struct debug {
#ifdef LOCAL
    debug(int line) {
        if(line) cerr << "LINE(" << line << ") -> ";
    }
    template<class T> typename enable_if<sizeof dud<T>(0) != 1, debug&>::type operator<<(T i) {
        cerr << boolalpha << i; return * this;
    }
    template<class T> typename enable_if<sizeof dud<T>(0) == 1, debug&>::type operator<<(T i) {
        return *this << range(begin(i), end(i));
    }
    template<class T, class U> debug& operator<<(pair<T, U> d) {
        return *this << "(" << d.first << ", " << d.second << ")";
    }
    debug& operator<<(tuple<>&) { return *this << "()"; };
    template<class ...T> debug& operator<<(tuple<T...> d) {
        *this << "("; debug_tuple<sizeof...(T), 0>(d);
        return *this << ")";
    }
    template<size_t L, size_t I, class T> void debug_tuple(const T& t) {
        *this << (I == 0 ? "" : ", ") << get<I>(t);
        if(I + 1 < L) debug_tuple<L, (I + 1) % L>(t);
    }
    template<class T> debug & operator <<(rge<T> d) {
        *this << "[";
        for(auto it = d.b; it != d.e; ++it)
            *this << (it != d.b ?  ", " : "") << *it;
        return *this << "]";
    }
    debug& operator<<(ostream&(*pf)(std::ostream&)) {
        cerr << pf; return *this;
    }
#else
    debug(int) {}
    template<class T> debug& operator<<(T&&) { return *this; }
    debug& operator<<(ostream&(*)(std::ostream&)) { return *this; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ << ": " << (__VA_ARGS__) << "] "

#define debug0()  debug(__LINE__)
#define debug1(x) debug(0)
#define GET_MACRO(_0, _1, NAME, ...) NAME
#define debug(...) GET_MACRO(_0, ##__VA_ARGS__, debug1, debug0)(__VA_ARGS__)
/*}}}*/
using LL = long long;

const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const LL LLINF = 0x3f3f3f3f3f3f3f3f;
const int MAX_N = 200005;

void solve(int) {
    LL A, V;
    LL B, W;
    LL T;
    cin >> A >> V >> B >> W >> T;
    if(A < B and B + W * T <= A + V * T) {
        cout << "YES" << endl;
    } else if(B < A and A - V * T <= B - W * T) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

int main() {
    int T = 1;
    //cin >> T;
    for(int i = 1; i <= T; ++i) {
        solve(i);
    }
    return 0;
}


Measured memory_bytes: 3656
# -*- coding: utf-8 -*-

def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))

N,K = input_multiple_number()

isTaz = [True]*N

for i in range(K):
	d = int(input())
	a = input_multiple_number_as_list()
	for _a in a:
		isTaz[_a-1] = False

ans = 0
for i in range(N):
	if isTaz[i] == True:
		ans += 1

print(ans)

Measured memory_bytes: 9204
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  queue<pair<int, int>> que;
  if (n%2) {
    rep(i, n) rep(j, i) {
      if (i+j+2 != n)
        que.push({j+1, i+1});
    }
  } else {
    rep(i, n) rep(j, i) {
      if (i+j+2 != n+1)
        que.push({j+1, i+1});
    }
  }
  cout << que.size() << endl;
  while (!que.empty()) {
    int a, b;
    tie(a, b) = que.front();
    que.pop();
    cout << a << ' ' << b << endl;
  }
  return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
#define INF = 1000000000;
#define LLINF = 1LL << 62;
#define mod = 1000000007;
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; }

int main() {
    int n;
    cin >> n;
    VI d(n);
    FOR(i, n){
        cin >> d[i];
        d[i] /= 10;
    }

    int f = 0;
    eFOR(i, min(n - 1, f))chmax(f, i + d[i]);
    int b = n - 1;
    for (int i = n - 1; i >= max(0, b); i--)chmin(b, i - d[i]);
    cout << (f >= n - 1 && b <= 0 ? "yes" : "no") << endl;
}



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

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

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;


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

	int n;
	cin>>n;

	map<string,int> mp;

	vector<string> vs;

	int cnt =0;
	for(int i=0; i<n; i++){
		string tmp;
		cin>>tmp;

		mp[tmp]++;
/*		vs.push_back(tmp);*/

		cnt = max(cnt,mp[tmp]);

	}

	for(auto e : mp){
		if(e.second == cnt)
		cout<<e.first/*<<e.second*/<<endl;
	}
/*
	sort(vs.begin(),vs.end());

	for(auto e: vs){
		cout<<e<<endl;
	}*/



}


Measured memory_bytes: 23808
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 100010;

int main(){
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d\n", a<6 ? 0 : a<=12 ? b/2 : b);
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n;
	double v;
	double t;
	double y;
	
	while(scanf("%lf", &v) != EOF){
		n = 0;
		t = v / 9.8;
		y = 4.9 * t * t;
		do{
			n++;
		}while(y > 5 * n - 5);
		
		printf("%d\n", n);
	}
	return 0;
}

Measured memory_bytes: 628
#include<cstdio>
using namespace std;

int main(){
  int n,x,y,u,v,l,r,mid;
  long long s[10100],p;
  for(int i=0;i<=10001;i++)s[i] = i*i;

  while(scanf("%lld%d",&p,&n),(p||n)){
    x = n; y = u = v = 1;
    for(int i=1;i<=n;i++){
      if(s[n]<p*s[i]){
	if(s[u]*s[i]<s[n]*s[v]){u = n; v = i;}
      }else{
	l = 1, r = n+1;
	while(r-l>1){
	  mid = (l+r)/2;
	  if(s[mid]<p*s[i])l = mid;
	  else r = mid;
	}
	if(s[u]*s[i]<s[l]*s[v] && s[l]<p*s[i]){u = l; v = i;}
	if(s[x]*s[i]>s[r]*s[y] && s[r]>p*s[i]){x = r; y = i;}
      }
    }
    printf("%d/%d %d/%d\n",x,y,u,v);
  }
}

Measured memory_bytes: 1104
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  int N, M; cin >> N >> M;
  vector<int> A(N);
  double sum = 0;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
    sum += A[i];
  }
  sort(A.rbegin(), A.rend());
  if (A[M-1] < sum/(4*M)) cout << "No" << endl;
  else                    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)
#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;
static const ll MAX_L = (ll)1 << 62;

ll a[100001] = {};
ll s[100001] = {};

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

int main() {
	ll n, x; cin >> n >> x;
	a[0] = x;
	repe(i, 1, n) cin >> a[i];

	sort(a, a + n + 1);
	reverse(a, a + n + 1);

	repe(i, 1, n) {
		s[i - 1] = abs(a[i] - a[i - 1]);
	}

	sort(s, s + n);
	reverse(s, s + n);

	ll minV = MAX_L;
	rep(i, 0, n) {
		ll x = gcd(s[i + 1], s[i]);
		minV = min(minV, x);
	}
	cout << minV << endl;

	return 0;
}

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


int main () {
    long long  a,v;cin >>a>>v;
    long long b,w;cin >>b>>w;
    long long t;cin >>t;

    long long dis=abs(a-b);
    if(t*(v-w)>=dis)cout <<"YES"<<endl;
    else cout <<"NO"<<endl;
}

Measured memory_bytes: 3624
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        String S = sc.next();
        
        List<Integer> hs0 = new ArrayList<>();
        List<Integer> hs1 = new ArrayList<>();
        
        if( S.charAt(0) == '0' ) hs1.add(0);
        int count0 = 0;
        int count1 = 0;        
        for(int i = 0; i < N; i++){
            if( S.charAt(i) == '0' ){
                if(count1 > 0) hs1.add(count1);
                count1 = 0;
                count0++;
            }else{
                if(count0 > 0) hs0.add(count0);
                count0 = 0;
                count1++;
            }
            
            if( i == N -1 ){
                if(count0 > 0) hs0.add(count0);
                if(count1 > 0) hs1.add(count1);
            }
            
        }
        if( S.charAt(N-1) == '0' ) hs1.add(0);
        
        if( hs0.size() <= K ){
            System.out.println(N);
            return;
        }
        
        long maxSum = 0;
        for(int i = 0; i < K; i++){
            if(i == 0){
                maxSum += hs1.get(i) + hs0.get(i) + hs1.get(i+1);
            } else {
                maxSum += hs0.get(i) + hs1.get(i+1);
            }
        }
        
        long sum = maxSum;
        for(int i = 0; i < hs0.size()-K; i++){
            sum += hs0.get(K+i) + hs1.get(K+1+i);
            sum -= hs0.get(i) + hs1.get(i);
            maxSum = Math.max(maxSum, sum);
        }
        
        System.out.println(maxSum);
        
    }
}


Measured memory_bytes: 27884
#include <iostream>
#include <algorithm>
#include <queue>
#include <cassert>
#include <set>
using namespace std; typedef long long ll; const int MINF=-1e9; typedef pair<int,int> P;

int main() {
  ll a,b,c; cin>>a>>b>>c;
  ll an=1e18;
  an=min(an,a*b*(c%2));
  an=min(an,a*(b%2)*c);
  an=min(an,(a%2)*b*c);
  cout<<an<<endl;
}

Measured memory_bytes: 256
n = gets.to_i
people = []
n.times { people << gets.chomp }
counts = { "M" => 0, "A" => 0, "R" => 0, "C" => 0, "H" => 0 }
people = people.select { |item| ["M", "A", "R", "C", "H"].include?(item[0]) }

people.each do |e|
  counts[e[0]] += 1
end

sum = 0
counts.values.combination(3).to_a.each do |combi|
  sum += combi.inject(:*)
end

puts sum


Measured memory_bytes: 11004
h, w = map(int, input().split())
hw = [input() for _ in range(h)]
dp = [[1000]*w for _ in range(h)]
if hw[0][0] == "#":
    dp[0][0] = 1
else:
    dp[0][0] = 0

for i in range(h):
    for j in range(w):
        if i > 0:
            if hw[i][j] == "#" and hw[i-1][j] == ".":
                dp[i][j] = min(dp[i][j], dp[i-1][j] + 1)
            else:
                dp[i][j] = min(dp[i][j], dp[i-1][j])
        if j > 0:
            if hw[i][j] == "#" and hw[i][j-1] == ".":
                dp[i][j] = min(dp[i][j], dp[i][j-1] + 1)
            else:
                dp[i][j] = min(dp[i][j], dp[i][j-1])

print(dp[h-1][w-1])

Measured memory_bytes: 9280
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    def f(n):
        a = LI()

        def search(s,t):
            n2 = 4
            d = collections.defaultdict(lambda: inf)
            d[s] = 0
            q = []
            heapq.heappush(q, (0, s))
            v = collections.defaultdict(bool)
            while len(q):
                k, u = heapq.heappop(q)
                if v[u]:
                    continue
                v[u] = True
                if u == t:
                    return k

                vd = k + 1
                for i in range(n):
                    for j in range(i+1,n):
                        uv = tuple(u[:i] + u[i:j+1][::-1] + u[j+1:])
                        if v[uv]:
                            continue
                        if d[uv] > vd:
                            d[uv] = vd
                            if vd < 4:
                                heapq.heappush(q, (vd, uv))

            return d

        r1 = search(tuple(a), tuple(range(1,n+1)))
        if isinstance(r1, int):
            return r1
        r2 = search(tuple(range(1,n+1)), tuple(a))
        r = n - 1
        for k,v in r1.items():
            t = v + r2[k]
            if r > t:
                r = t

        return r


    while 1:
        n = I()
        if n == 0:
            break
        rr.append(f(n))
        # print('rr', rr[-1])
        break

    return '\n'.join(map(str,rr))


print(main())



Measured memory_bytes: 121184