akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <math.h>

using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,y;




int main(){
  double a,b,x,xx;
  double ans=0.0;
  cin >> a>>b>>x;
  xx=x/a/a;

  double bx=(b-xx);
  if (0.5*b<=xx){
    cout<<setprecision(10)<<atan2(bx*2.0,a)/3.1415926535897932384*180.0<<endl;
  }else{
    xx=2.0*x/a/b;
    cout<<setprecision(10)<<atan2(b,xx)/3.1415926535897932384*180.0<<endl;
  }
  
  

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

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int a, b, c;
    int i;
    scanf("%d%d%d", &a, &b, &c);
    if(a%b == 0)
        if(c == 0) return !printf("YES\n");
        else return !printf("NO\n");
    else
    {
        for(i = 1; i<b; i++)
            if(a*i%b == c)
                return !printf("YES\n");
    }
    printf("NO\n");
    return 0;
}

Measured memory_bytes: 128
package main

import (
	"fmt"
)

func changeMin(min int, isSmall bool) int {
	if isSmall || min%10 == 0 {
		return min
	} else {
		return min + (10 - (min % 10))
	}
}

func minNumsIndex(nums []int) int {
	var index int
	num := nums[0] % 10
	for i := 1; i < len(nums); i++ {
		n := nums[i] % 10
		if num == 0 || n != 0 && num > n {
			index = i
			num = nums[i] % 10
		}
	}
	return index
}

func main() {
	var a, b, c, d, e int
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	fmt.Scan(&d)
	fmt.Scan(&e)
	minList := []int{a, b, c, d, e}
	minIndex := minNumsIndex(minList)
	allMin := 0
	// fmt.Println("minIndex=", minIndex)
	for i := 0; i < len(minList); i++ {
		allMin += changeMin(minList[i], i == minIndex)
		// fmt.Println("allMin=", allMin)
	}
	fmt.Println(allMin)
}


Measured memory_bytes: 512
n, m, x = map(int, input().split())
a = [int(a) for a in input().split()]

large = []
small = []
for i in a:
    if x < i:
        large.append(i)
    else:
        small.append(i)

print(len(small) if len(small) < len(large) else len(large))

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

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

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


int q;
int dp[100010];
bool sosuu[100010] = {true};

void gen_sosuu(){
  REP(i,100010){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(100000)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<=100000;j++){
      //printf("%d %d %d\n",i*j,i,j);
      sosuu[i*j] =false;
    }
  }
}

int check(int n){
  if(sosuu[n] && sosuu[(n+1)/2]) return 1;
  return 0;
}

int main(){
  scanf("%d",&q);
  gen_sosuu();
  dp[1] = 0;
  dp[3] = check(3);
  for(int i = 5;i<=100000;i+=2){
    dp[i] = dp[i-2] + check(i);
  }
  REP(i,q){
    int l,r;
    scanf("%d %d",&l,&r);
    if(l==1){
      printf("%d\n",dp[r]);
    }else{
      printf("%d\n",dp[r] - dp[l-2]);
    }
  }
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a[101][3];
ll n,k;
ll dp[101][100001];
ll cal(int i,int j)
{
    if(i<=0||j<=0)
    return 0;
    if(dp[i][j]!=-1)
    return dp[i][j];
    ll ans;
    ans=cal(i-1,j);
    if(j>=a[i][1])
    ans=max(ans,cal(i-1,j-a[i][1])+a[i][2]);
    dp[i][j]=ans;
    return ans;
}
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    cin>>a[i][1]>>a[i][2];
    memset(dp,-1,sizeof(dp));
    ll ans;
    ans=cal(n,k);
    cout<<ans;
}



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

struct Union{
  vector<ll> par;
  Union(ll a){
  par=vector<ll>(a,-1);
  }
  ll find(ll a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(ll a,ll b){
    return (find(a)==find(b));
  }
  ll size(ll a){
    return -par[find(a)];
  }
  void unite(ll a,ll b){
    ll c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
ll Nagaemon1;
void swap(ll i,ll j){
  Nagaemon1=i;
  i=j;
  j=Nagaemon1;
}
int main(void){
    int a,b;
    cin >> a >> b;
    cout << a*b;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
LL facctorialMethod(int k);
int main(){
    LL x,x_cnt,kin,ans;
    cin >> x;
    kin = 100;
    x_cnt = 0;

    while(kin < x){
//わからん
//        kin = floor(kin * 1.01);
        kin += kin / 100;
        x_cnt++;
//        cout << "kin :" << kin << endl;
//        cout << "x_xnt :" << x_cnt << endl;
    }

    ans = x_cnt;
    cout << ans << endl;

    return 0;
}

LL facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i){
        sum *= i;
    }
    return sum;
}


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

int main(){
    int N;
    cin >> N;
    // digit check;
    int tmp = N;
    int sum = 0;
    int remain;
    while(true){
        remain = tmp % 10;
        sum += remain;
        tmp /= 10;
        if(tmp == 0) break;
    }
    if(N % sum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
// BEGINNING WITH NAME OF ALMIGHTY GOD ALLAH
// AUTHOR:: MOHAMMAD FAISAL
// ATCODER BEGINNERS PROBLEMS 
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.flush();
	vector<int> a;
  	int x;
    while(cin >> x)
      a.push_back(x);
    sort(a.begin(),a.end());
  	cout<<a[0]+a[1];
	return 0;
	// Bye Bye 2019
}

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

#define MOD_1_000_000_007 (1000000007LL)
#define LINF (1LL<<60)
#define rep(i, n)   for (long long i = 0; i <  (long long)(n); i++)
#define rep1(i, n)  for (long long i = 1; i <  (long long)(n); i++)
#define rep2(i, n)  for (long long i = 2; i <  (long long)(n); i++)
#define rep0c(i, n) for (long long i = 0; i <= (long long)(n); i++)
#define rep1c(i, n) for (long long i = 1; i <= (long long)(n); i++)
#define rep2c(i, n) for (long long i = 2; i <= (long long)(n); i++)
#define repc0(n, i) for (long long i = (long long)(n); i >= 0; i--)
#define repc1(n, i) for (long long i = (long long)(n); i >= 1; i--)
#define repc2(n, i) for (long long i = (long long)(n); i >= 2; i--)

namespace solver {
  using namespace std;
  typedef long long ll;

  ll N, M, A[100010];

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

  ll lcm(ll a, ll b) {
    ll c = gcd(a, b);
    return a / c * b;
  }

  void init() {
    scanf("%lld %lld", &N, &M);
    rep(i, N) scanf("%lld", A+i);
  }

  void solve() {
    ll acc = A[0]/2;
    rep1(i, N) {
      acc = lcm(A[i]/2, acc);
      if(acc > M) {
        printf("0\n");
        return;
      }
    }
    rep(i, N) if ((acc/(A[i]/2))%2==0) {
      printf("0\n");
      return;
    }
    ll ans = 0;
    ll a = M/acc;
    if(a%2) ans = (a+1)/2;
    else ans = a/2;
    printf("%lld\n", ans);
  }
}

int main() {
  solver::init();
  solver::solve();
  return 0;
}


Measured memory_bytes: 1024
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, x int
	fmt.Scan(&n, &x)
	ar := make([]int, n)
	sum := 0
	for i := range ar {
		fmt.Scan(&ar[i])
		sum += ar[i]
	}
	sort.Ints(ar)
	t := (x - sum) / ar[0]
	fmt.Println(n + t)
}


Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
int  box[4];
int main()
{
	int a, b, c, d;
	
	cin >>a>>b>>c>>d;
	if(fabs(a-b)<=d)
		box[1]=1;
	if(fabs(b-c)<=d)
		box[2]=1;
	if(fabs(a-c)<=d)
		box[3]=1;
	if(box[1]==box[2] && box[1]==1)
		box[3]=1;
	if(box[3]==1)
		cout << "Yes";
	else
		cout << "No";
	
}

Measured memory_bytes: 256
S = list(input())
N = len(S)
m = []
l = []
for i in range(N-1):
    if S[i] == 'R' and S[i+1] == 'L':
        m.append(i)
    if S[i] == 'L' and S[i+1] == 'R':
        l.append(i)

l.append(N)

ans = [0] * N
j = 0
for i in range(len(S)):
    if i <= l[j]:
        if abs(i-m[j]) %2 == 0:
            ans[m[j]] += 1
        else:
            ans[m[j]+1] += 1

        if i == l[j]:
            j += 1


print(*ans)


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

template<typename T>
T get_value(std::istream& is);

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

  vector<int> v(get_value<size_t>(cin));
  const auto use_count {get_value<size_t>(cin)};
  for (auto& e: v)
    cin >> e;
  sort(v.begin(), v.end(), greater<int>{});


  cout << accumulate(v.begin(), next(v.begin(), use_count), 0) << '\n';
  return 0;
}

template<typename T>
inline T get_value(std::istream& is)
{
  T v;
  is >> v;
  return v;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
Int dp[111][1111];

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  Int l,n,m,x;
  while(cin>>l>>n>>m>>x,l){
    string st;
    vector<Int> se(n),ss(n);
    vector<Int> e(m),s(m);
    for(Int i=0;i<n;i++) cin>>st>>se[i]>>ss[i];
    for(Int i=0;i<m;i++) cin>>st>>e[i]>>s[i];
    
    const Int INF = 1e9;
    for(Int i=0;i<111;i++)
      for(Int j=0;j<1111;j++)
	dp[i][j]=-INF;

    dp[0][0]=0;
    for(Int k=0;k<m;k++)
      for(Int i=m;i>=0;i--)
	for(Int j=l;j>=0;j--)
	  chmax(dp[i+1][j+e[k]],dp[i][j]+s[k]);
    
    vector<Int> dp2(l+1,-INF);
    for(Int i=x;i<=m;i++)
      for(Int j=0;j<=l;j++)
	chmax(dp2[j],dp[i][j]);

    for(Int j=1;j<=l;j++) chmax(dp2[j],dp2[j-1]);

    Int ans=-INF;
    for(Int i=0;i<n;i++){
      if(se[i]>l) continue;
      chmax(ans,dp2[l-se[i]]+ss[i]);
      for(Int j=0;j<i;j++){
	if(se[i]+se[j]>l) continue;
	chmax(ans,dp2[l-(se[i]+se[j])]+ss[i]+ss[j]);
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 4036
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <time.h>
int main(){
    long long i,n,d,x,y,ans=0;
    scanf("%lld %lld",&n,&d);
    for(i=0; i<n; i++){
        scanf("%lld %lld",&x,&y);
        if(x*x+y*y<=d*d)ans++;
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 1732
import sys
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()))

a=LIST()
if a[1]<=a[3]:
    print((a[2]-a[0])*60+(a[3]-a[1])-a[-1])
else:
    print((a[2]-a[0]-1)*60+(a[3]-a[1]+60)-a[-1])




Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define all(v) v.begin(),v.end()
#define PI acos(-1)
#define EPS 1e-15


int main() {
	string a, b;
	cin >> a >> b;	
	reverse(all(a));
	if(a == b)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;


signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin >> s;
    cout << s.substr(0, 3) << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int comb(int x) {
    return x * (x - 1) / 2;
}

int main() {
    int n, m;
    cin >> n >> m;
    cout << comb(n) + comb(m) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cassert>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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; }

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

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

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

  int n; cin >> n;
  string s; cin >> s;
  int k; cin >> k;
  rep(i, n) {
    if (s[i] != s[k-1]) {
      s[i] = '*';
    }
  }
  cout << s << endl;
}

Measured memory_bytes: 256
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n,k] <- getIntList
    ps <- sort <$> getIntList
    print . sum $ take k ps

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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> in(n, vector<int>(3));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> in[i][j];
    } 
  }
  vector<vector<int>> dp(n + 1, vector<int>(3, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (j == k) continue;
        dp[i + 1][k] = max(dp[i + 1][k], in[i][k] + dp[i][j]); 
      }
    }
  } 
  cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << "\n";
  return 0;
}


Measured memory_bytes: 11264
# 083_a
A,B,C,D=map(int,input().split())
if (1<=A and A<=10)and(1<=B and B<=10)and(1<=C and C<=10)and(1<=D and D<=10):
    L=A+B
    R=C+D
    if L>R:
        print('Left')
    elif L==R:
        print('Balanced')
    elif L<R:
        print('Right')


Measured memory_bytes: 9152
//B - Echo
#include <iostream>
#include <string>
#include <vector>
using namespace std;
//Nが奇数ならばS = T + Tとはならない.
//char S[], T[]を用意する.
//文字列全体を長さ(N / 2)の文字列に分割し,それぞれS, Tとする.
//S == Tか？
int main() {
	int N; cin >> N;
	if (N % 2 != 0) {
		cout << "No" << endl;
		return 0;
	}
	string S; cin >> S;
	vector<char>T(N / 2), U(N / 2);
	for (int i = 0; i < N / 2; i++) {
		T.at(i) = S.at(i);
	}
	for (int i = N / 2; i < N; i++) {
		U.at(i - (N / 2)) = S.at(i);
	}
	if (T == U) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=1e5+10;
int gcd(int n,int m)
{
	if(n==0)
		return m;
	else
		return gcd(m%n,n);
}
int dp[N][4];
int a[N][4];
int n;
int32_t main()
{
	
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=3;j++)
			cin>>a[i][j];
	}
	dp[1][1]=a[1][1];
	dp[1][2]=a[1][2];
	dp[1][3]=a[1][3];
	for(int i=2;i<=n;i++)
	{
		for(int j=1;j<=3;j++)
		{
			if(j==1)
			{
				dp[i][j]=max(dp[i-1][2],dp[i-1][3])+a[i][j];
			}
			else if(j==2)
			{
				dp[i][j]=max(dp[i-1][1],dp[i-1][3])+a[i][j];
			}
			else
			{
				dp[i][j]=max(dp[i-1][1],dp[i-1][2])+a[i][j];
			}
		}
	}
	cout<<max({dp[n][1],dp[n][2],dp[n][3]})<<endl;

}

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

int main() {
  int N;
  string color;
  cin >> N;
  for (int i = 0; i < N; i++){
    cin >> color;
    if (color == "Y") {
      cout << "Four" << endl;
      break;
    }
    else if ( i == N - 1){
      cout << "Three" << endl;
    }
  }
}



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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
using Graph = vector<vector<ll>>;
#define all(x) (x).begin(), (x).end() //string の sort とかはこれ
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

const ll MOD = 1000000007;
const ll INF = 1e18; //1*10^18
const double PI = 3.14159265;
const ll MAX = 1e6;
long long fac[MAX], finv[MAX], inv[MAX];

int ctoi(char c)
{
  if (c >= '0' && c <= '9')
  {
    return c - '0';
  }
  return 0;
}

ll gcd(ll x, ll y) { return (x % y) ? gcd(y, x % y) : y; }
//最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//最小公倍数

ll powll(ll a, ll n)
{ //O(log n)
  ll res = 1;
  while (n > 0)
  {
    if (n & 1) //(n & 1)=(n % 2 !=0)
    {
      res = res * a;
    }
    a = a * a;
    n >>= 1; //(n & 1)=(n % 2 !=0)
  }
  return res;
}

ll modpow(ll a, ll n, ll mod) //O(log n)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1) //(n & 1)=(n % 2 !=0)
    {
      res = res * a % mod;
    }
    a = a * a % mod;
    n >>= 1; //(n>>=1)=(n/2)
  }
  return res;
}

int ReturnDigit(ll num)
{
  string number = to_string(num);
  return number.length();
}

// テーブルを作る前処理
void COMinit() //MODは素数じゃないとだよ！！
{
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++)
  {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k)
{
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct UnionFind
{
  vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

  UnionFind(int N) : par(N)
  { //最初は全てが根であるとして初期化
    for (int i = 0; i < N; i++)
      par[i] = i;
  }

  int root(int x)
  { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (par[x] == x)
      return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y)
  {                   // xとyの木を併合
    int rx = root(x); //xの根をrx
    int ry = root(y); //yの根をry
    if (rx == ry)
      return;     //xとyの根が同じ(=同じ木にある)時はそのまま
    par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
  }

  bool same(int x, int y)
  { // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

int main()
{
  // COMinit();
  // srand((unsigned int)time(NULL));//--> rand()
  ll i, j, l, ans = 0;
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  a = min(a, k);
  k = max(k - a, 0ll);
  b = min(b, k);
  k = max(k - b, 0ll);
  c = k;
  ans = a + -1 * c;
  cout << ans << endl;
}


Measured memory_bytes: 3552
#include <cstdio>
#include <algorithm>
#include <iostream>
//#include <cassert>
using namespace std;

const int N = 10000;
typedef long long ll;

int prime[N] , tot;
void Init() {
//	vis[0] = vis[1] = true;
	static bool vis[N];
	for(int i = 2 ; i < N ; ++i) {
		if(!vis[i]) prime[tot++] = i;
		for(int j = 0 ; j < tot && prime[j] * i < N ; ++j) {
			vis[prime[j] * i] = true;
			if(i % prime[j] == 0) break;
		}
	}
}

int n ;
ll ans[505][505];

template<typename T> T __lcm(T x , T y) {return x / __gcd(x , y) * y ;}
bool valid(int x , int y) {return x > 0 && y > 0 && x <= n && y <= n;}

int main() {
//	freopen("atcoder.txt" , "w" , stdout);
	Init();
	cin >> n;
	if(n == 2) {
		puts("2 3");
		puts("5 4");
		return 0;
	}
	int l = 0 , r = 2 * n - 1 - ((n ^ 1) & 1), cur = 0;
	
	for(int lim = (n & 1) ? (n - 1) : (n - 2) , d = -lim ; d <= lim ; d += 2 , cur ? (cur = 0 , ++l) : (cur = 1 , --r))
		for(int i = max(1 , 1 + d) ; i <= min(n , n + d) ; ++i)
			ans[i][i - d] = cur ? prime[l] : prime[r];	
	for(int d = 2 ; d <= 2 * n ; d += 2 , cur ? (cur = 0 , ++l) : (cur = 1 , --r))
		for(int i = max(1 , d - n) ; i <= min(n , d - 1) ; ++i)
			ans[i][d - i] *= cur ? prime[l] : prime[r];
	
//	assert(l == r + 1);
//	ll max_val = 0;
	for(int i = 1 ; i <= n ; ++i , putchar('\n'))
		for(int j = 1 ; j <= n ; ++j) {
			if((i + j) & 1) {
				ans[i][j] = 1;
				if(valid(i - 1 , j)) ans[i][j] = __lcm(ans[i][j] , ans[i - 1][j]);
				if(valid(i + 1 , j)) ans[i][j] = __lcm(ans[i][j] , ans[i + 1][j]);	
				if(valid(i , j - 1)) ans[i][j] = __lcm(ans[i][j] , ans[i][j - 1]);
				if(valid(i , j + 1)) ans[i][j] = __lcm(ans[i][j] , ans[i][j + 1]);
				ans[i][j]++;	
			}
			printf("%lld " , ans[i][j]);
//			max_val = max(max_val , ans[i][j]);
		}
//	fprintf(stderr , "max_val = %lld\n" , max_val);
	return 0;
}

Measured memory_bytes: 5592
#import sys
MOD = 10 ** 9 + 7
#input = sys.stdin.readline
import math

import itertools

#import bisect

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default


#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]
def main():
    k,x = map(int, input().split())
    print("Yes") if k*500>=x else print("No")




if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#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)

int main(){
    int x,a,b;cin>>x>>a>>b;
    if(abs(x-a)<abs(x-b)){
        cout<<"A"<<endl;
    }else{
        cout<<"B"<<endl;
    }
    return 0;
}

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

string FILENAME = "template";
#define io ifstream fin(FILENAME + ".in"); ofstream fout(FILENAME + ".out")
#define fwrite(X) fout << X;
#define fwriteln(X) fout << X << endl;

#define forl(V, N) for(int V = 0; V < N; V++)
#define fore(E, X) for(auto &E:X)
#define print(X) cout << X
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
#define rem(X) X.top(); X.pop()
#define mid(A, B) ((A+B) / 2)
#define setmin(A, B) A = min(A, B)
#define setmax(A, B) A = max(A, B)
#define graph unordered_map<int, unordered_set<int>>
#define vi vector<int>
#define pb push_back
#define ll long long

ll dp[200001][201];

int main () {
    forl(i, 200001) fill(dp[i], dp[i]+201, -1);
    dp[0][0] = 0;
    int N, W;
    cin >> N >> W;
    vector<ll> weight(N), price(N);
    for(int i = 0; i < N; i++) cin >> weight[i] >> price[i];
    forl(i, N) {
        forl(j, W+1) {
            if(dp[j][i] == -1) continue;
            if(j+weight[i] <= W) setmax(dp[j+weight[i]][i+1], dp[j][i]+price[i]);
            setmax(dp[j][i+1], dp[j][i]);
        }
    }
    ll ans = 0;
    forl(i, W+1) setmax(ans, dp[i][N]);
    println(ans);
}

Measured memory_bytes: 314368
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int gcd(int a,int b)
{
   	if(a<b)swap(a,b);
   	if(a%b)return(gcd(b,a%b));
	else return(b);
}


int main()
{
	int n,sum=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			for(int k=1;k<=n;k++)
			{
				sum+=gcd(gcd(i,j),k);
			}
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



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

int A = 0, B = 0, C = 0, K = 0, S = 0, T = 0, W = 0, N = 0;
int n = 0;
double ar = 0, br = 0, cr = 0;
int answer = 0;

string c;
string sA, strB;
vector<string> city;
vector<int> population;


void input() {
	CI c;
	
}

int main(void) {
	
	int HIT = 0;
	int OUT = 0;
	bool HOMERUN = false;
	int point = 0;

	CI n;
	REP(i, n) {
		while (true) {
			CI c;
			if (c == "HIT") {
				HIT++;
			}
			if (c == "OUT") {
				OUT++;
			}
			if (c == "HOMERUN") {
				HOMERUN = true;
			}

			if (HIT == 4) {
				point++;
				HIT--;
			}
			if (HOMERUN == true) {
				point += HIT + 1;
				HIT = 0;
				HOMERUN = false;
			}
			if (OUT == 3) {
				HIT = 0;
				OUT = 0;
				break;
			}
		}
		CO point E
		point = 0;
	}
	

	return 0;
}

Measured memory_bytes: 1208
//learned from Yukly
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
    int n;cin>>n;
    vector<vector<vector<vector<ll>>>> dp(n+1,vector<vector<vector<ll>>>(4,vector<vector<ll>>(4,vector<ll>(4,0))));
    dp[0][3][3][3]=1;//全文字tなら影響ないからここに1入れとくと楽
    rep(i,n){
        rep(j,4){
            rep(k,4){
                rep(l,4){
                    rep(m,4){
                        if(k==0&&l==1&&m==2)    continue;       //AGC
                        else if(k==0&&l==2&&m==1)   continue;   //ACG
                        else if(k==1&&l==0&&m==2)   continue;   //GAC
                        else if(j==0&&l==1&&m==2)   continue;   //A?GC
                        else if(j==0&&k==1&&m==2)   continue;   //AG?C
                        dp[i+1][k][l][m]=(dp[i+1][k][l][m]+dp[i][j][k][l])%mod;
                    }
                }
            }
        }
    }
    ll ans=0;
    rep(i,4){
        rep(j,4){
            rep(k,4){
                ans=(ans+dp[n][i][j][k])%mod;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#define llint unsigned long long
#define h 1000000007

using namespace std;

string s, t;
int nums[4005][26], numt[4005][26];
llint Hash[26][4005];
llint hbeki[4005];
vector<llint> vect;

int main(void)
{
  cin >> s >> t;
  int lens = s.size(), lent = t.size();
  s = "#" + s;
  t = "#" + t;

  hbeki[0] = 1;
  for(int i = 1; i < 4005; i++){
    hbeki[i] = hbeki[i-1] * h;
  }

  for(int i = 1; i <= lens; i++){
    for(int j = 0; j < 26; j++) nums[i][j] = nums[i-1][j];
    nums[i][s[i]-'a']++;
  }
  for(int i = 1; i <= lent; i++){
    for(int j = 0; j < 26; j++) numt[i][j] = numt[i-1][j];
    numt[i][t[i]-'a']++;
  }

  for(int i = 0; i < 26; i++){
    llint x = 0;
    for(int j = 0; j < 4005; j++){
      x *= h;
      x += i + 'a';
      Hash[i][j] = x;
    }
  }

  for(int l = 1; l <= lent; l++){
    for(int r = 1; r <= lent; r++){
      if(l > r) continue;
      llint sum = 0;
      for(int i = 0; i < 26; i++){
        int n = numt[r][i] - numt[l-1][i];
        sum += Hash[i][n];
        sum *= hbeki[n];
      }
      vect.push_back(sum);
    }
  }
  sort(vect.begin(), vect.end());

  llint ans = 0;
  for(llint l = 1; l <= lens; l++){
    for(llint r = 1; r <= lens; r++){
      if(l > r) continue;
      llint sum = 0;
      for(int i = 0; i < 26; i++){
        int n = nums[r][i] - nums[l-1][i];
        sum += Hash[i][n];
        sum *= hbeki[n];
      }
      if(sum == *lower_bound(vect.begin(), vect.end(), sum)){
        ans = max(ans, r-l+1);
      }
    }
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 70360
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}

int main(){
  int a; string s; cin>>a>>s;
  cout << (a>=3200? s:"red");
}

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

int main(){
	string s;
  int a = 0, b = 0;
  
  cin >> s;
  for(int i = 0; i < s.size(); i++){
  	if(s[i] == 'A') a += 1;
       else b += 1;
  }
  
  if(a > 0 && b > 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, b, n) for (int i = b; i <= n; ++i)

using namespace std;

void solve(int N) {
  int ans(0);
  FOR(i, 1, N) {
    int n(0);
    FOR(j, 1, i) {
      if (i % j == 0)
	n++;
    }
    if (n == 8)
      ans++;
    i++;
  }
  cout << ans << endl;
}

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

  int N;
  cin >> N;

  solve(N);

  return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;



int main(){
    int a, b, ans=0;
    cin >> a >> b;
    int m = min(a, b);
    int M = max(a, b);
    rep(i, M){
        ans += pow(10, i) * m;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime,random
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

A,B,C = inpl()
if A < C < B or B < C < A:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 5612
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
    int a,b,C;
    cin >> a >> b >> C;
    double S,L,h,rad;
    double PI = acos(-1);
    rad = C * PI / 180;
    h = b * sin(rad);
    S = a * h * 1.0 / 2;
    double cc = pow(a,2) + pow(b,2) * 1.0 - 2 * a * b * cos(rad) * 1.0;
    L = a + b + sqrt(cc);
    printf("%lf %lf %lf\n", S, L, h);
    return 0;
}


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

int res = 1000000000;
int n,a,b,c;
vector <int> v;

void dfs(int x,int y,int z,int idx,int spell)
{
	if(idx==n)
	{
		if(x>0 && y>0 && z>0)
		{
			if(spell<3)
			{
				res = min(res,abs(x-a)+abs(y-b)+abs(z-c));
			}
			else
			{
				res = min(res,abs(x-a)+abs(y-b)+abs(z-c) + (spell-3)*10);
			}
		}
		return;
	}
	dfs(x,y,z,idx+1,spell);
	dfs(x+v[idx],y,z,idx+1,spell+1);
	dfs(x,y+v[idx],z,idx+1,spell+1);
	dfs(x,y,z+v[idx],idx+1,spell+1);
}
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int t;
	cin >> n >> a >> b >> c;

	for(int i=0;i<n;i++)
	{
		cin >> t;
		v.push_back(t); 
	}

	dfs(0,0,0,0,0);

	cout << res << '\n';

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 1000005
#define ll long long
#define mod 1000000007
int fac[N],f[N],s[N],n,H,D;
int main()
{
	scanf("%d%d%d",&n,&H,&D);fac[0]=1;
	for(int i=1;i<=n;i++)fac[i]=(ll)fac[i-1]*i%mod;
	int sum=0;
	for(int i=1;i<=n;i++)(sum+=fac[i])%=mod;
	for(int i=1;i<=H;i++)
	{
		if(i<=D)f[i]=(fac[n]+(ll)s[i-1]*sum)%mod;
		else f[i]=(ll)(s[i-1]-s[i-D-1])*sum%mod;
		s[i]=(s[i-1]+f[i])%mod;
	}
	// for(int i=1;i<=H;i++)f[i]=(ll)(s[i-1]-(i<=D?0:s[i-D-1]))*fac[n]%mod,s[i]=(s[i-1]+f[i])%mod;
	printf("%d\n",(f[H]+mod)%mod);
}

Measured memory_bytes: 11904
(n, m) = gets.chomp.split(' ').map(&:to_i)

v = []
n.times do |i|
  (a, b) = gets.chomp.split(' ').map(&:to_i)
  v.push({:a => a, :b => b})
end
v.sort!{|x, y| x[:a] <=> y[:a]}

s = 0
t = 0
v.each do |vi|
  if t >= m then
    break
  end
  
  if vi[:b] >= (m - t) then
    s += vi[:a] * (m - t)
    t += (m - t)
  else
    s += vi[:a] * vi[:b]
    t += vi[:b]
  end
end

puts s.to_s

Measured memory_bytes: 32376
#include<string.h>
#include<stdio.h>
int main(){
	
	char s[169], t[169];
	char box;
	int i, j, flag=0, len, x, y;
	
	gets(s);
	gets(t);
	len = strlen(s);
	
	
	
	for(j=0; j<len; j++){
		box = s[len-1];	
		for(i=len-2; i>=0; i--){
			
			s[i+1]= s[i];
		}
		s[0]= box;
	
	if(strcmp(s, t)==0 ){
			printf("Yes\n");
			return 0;
		}
	else{
			flag++;
	}
}

	if(flag<len){
			printf("Yes\n");
		}
		else{
			printf("No\n");
		}
		
		
return 0;	
}

Measured memory_bytes: 128
import fractions
n=int(input())
A=list(map(int,input().split()))
gd=1
tmp=A[0]
for i in range(n-1):
    gd=fractions.gcd(A[i+1],A[i])
    tmp*=A[i+1]
lcm=tmp//gd
lcm-=1
ans=0
for a in A:
    ans+=lcm%a

print(ans)

Measured memory_bytes: 5436
def main():
    SA = input()
    SB = input()
    SC = input()

    users = {
        "a": {"s": SA, "n": len(SA), "turn": 0},
        "b": {"s": SB, "n": len(SB), "turn": 0},
        "c": {"s": SC, "n": len(SC), "turn": 0},
    }

    name = "a"
    while True:
        user = users[name]

        user["turn"] += 1
        if user["turn"] > user["n"]:
            print(name.upper())
            return

        turn = user["turn"]
        name = user["s"][turn - 1]


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
class abc165_b{
  public static void Main(){
    ulong k = ulong.Parse(Console.ReadLine());
    ulong l = 100;
    ulong i=0;
    while(true){
      if(l >= k){
        break;
      }
      l+=l/100;
      i++;
    }
    Console.WriteLine(i);
  }
}


Measured memory_bytes: 17592
n=int(input())
h = [input() for d in range (n)]
alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
list=[]


for k in range(26):
    m=50
    for i in range (n):
         x =h[i].count(alphabet[k])
         m =min(x,m)
    list.append(alphabet[k]*m)

print(''.join(list))



Measured memory_bytes: 38768
using System;
using System.Collections.Generic;

namespace cswork
{
    class Program
    {
        public Program() { }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        void Omame()
        {
            cin = new Scanner();
            int n = cin.nextInt();
            int m = cin.nextInt();

            bool[,] d = new bool[n, n];
            for (int i = 0; i < m; i++)
            {
                int a = cin.nextInt() - 1;
                int b = cin.nextInt() - 1;
                d[a, b] = true;
                d[b, a] = true;
            }

            Permutation(0, n, n);

            int ans = 0;
            for (int i = 0; i < permList.Count; i++)
            {
                bool addFlag = true;
                int now = permList[i][0];

                if (now != 0)
                {
                    continue;
                }

                for (int j = 1; j < n; j++)
                {
                    int next = permList[i][j];
                    if (!d[now, next])
                    {
                        addFlag = false;
                        break;
                    }
                    now = next;
                }

                if (addFlag) ans++;
            }

            Console.WriteLine(ans);
        }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

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

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();

            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next();
        }

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

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

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

Measured memory_bytes: 230956
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int n;
    cin >> n;
    vector<string> w(n);
    rep(i,n)cin >> w.at(i);
    bool flag=true;
    rep(i,n-1){
        if(w.at(i).at(w.at(i).size()-1)!=w.at(i+1).at(0)) flag=false;
    }
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            if(w.at(i)==w.at(j))flag=false;
        }
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,c,i,s,r,l;
  int d[101];
  while(1){
    scanf("%d",&n);
    if(!n)break;
    for(i=0;i<n;i++){
      scanf("%d",&d[i]);
    }
    scanf("%d",&s);
    c=0;
    r=0;
    l=i-1;
    while(1){
      i=(r+l)/2;
      c++;
      if(d[i]==s)break;
      else{
	if(d[i]<s){
	  r=i+1;
	}
	else{
	  l=i-1;
	}
      }//printf("%d %d\n",r,l);
      if(r>l)break;
    }
    printf("%d\n",c);
  }
  return 0;
}

Measured memory_bytes: 596
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		for(int i = 0; i < n; i++){
		    x[i] = sc.nextInt();
		    y[i] = x[i];
		}
		Arrays.sort(y);
		
		// 計算
		int l = y[n/2 - 1];
		int r = y[n/2];
		
		// 出力
		for(int i = 0; i < n; i++){
		    if(x[i] <= l){
		        System.out.println(r);
		    }else{
		        System.out.println(l);
		    }
		}
		
	}

}




Measured memory_bytes: 89544
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e9+5;
int32_t main(){
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    int n;
    cin>>n;
    vector<int> h(n);
    for(int i = 0; i < n; i++) cin>>h[i];
    vector<int> dp(n,INF);
    dp[0] = 0;
    for(int i = 0; i < n; i++){
        for(int j : {i+1,i+2}){
            if(j<n){
                dp[j] = min(dp[j],dp[i]+abs(h[j]-h[i]));
            }
        }
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    ll a, b;
    cin >> a >> b;
    if(a == b){
        cout << a << endl;
        return 0;
    }
    if(b - a == 1){
        cout << (a ^ b) << endl;
        return 0;
    }
    
    ll res = 0;
    if(a % 2 == 0){
        if(b % 2 != 0){
            res = ((b - a + 1) / 2) % 2;
        }
        else{
            res = b--;
            res ^= ((b - a + 1) /2) % 2;
        }
    }
    else{
        res = a++;
        if(b % 2 != 0){
            res ^= ((b - a + 1) / 2) % 2;
        }
        else{
            res ^= b--;
            res ^= ((b - a + 1) / 2) % 2;
        }
    }
    cout << res << endl;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

li x[22][22];
li n, d;

inline bool check(li i, li j) {
    li num = 0;
    rep(k, d) {
        li diff = abs(x[i][k] - x[j][k]);
        num += diff * diff;
    }
    li sq = sqrt(num);
    return (sq * sq == num);
}

int main() {
    cin >> n >> d;
    rep(i, n) {
        rep(j, d) {
            cin >> x[i][j];
        }
    }

    li res = 0;
    rep(i, n) {
        repp(j, i + 1, n) {
            if (check(i, j)) {
                res++;
            }
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

ans = 0
n = inp()
s = input()

ls = len(s)
if s[:ls//2] == s[ls//2:]:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)

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

int main() {
	ll i, j, k, l, test, n, sum=0;
	cin >> n;

	sum = n % 500;
	ll val = n / 500;
	val *= 1000;
	sum /= 5;

	val += sum*5;
	cout << val;
}

Measured memory_bytes: 256