akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
  
int main(void)
{
    double a,b,c,d,e,f,x,y;
  
    while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF) {
        y=(a*f-c*d)/(a*e-b*d);
        x=(c-b*y)/a;
        printf("%.3f %.3f\n",x,y);
    }
    return 0;
}

Measured memory_bytes: 652
N, P = map(int,input().split())

def calc(n):
  num = {}
  e, i = 0, 2
  while i**2 <= n:
    while n%i == 0:
      n //= i
      e += 1
    if(e > 0):
      num[i] = e
    i += 1
    e = 0
  return num

if(N == 1):
  print(P)
  exit()
elif(P == 1):
  print(1)
  exit()
else:
  cnt = 1
  for k, v in calc(P).items():
    if(v >= N):
      cnt *= k ** (v//N)
  print(cnt)

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

vector<int> tab;

int main()
{
//	freopen("input.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,k;
	cin>>n>>k;
	for (int i=0;i<n;i++)
	{
		int a;
		cin>>a;
		tab.push_back(a);
	}
	sort(tab.begin(),tab.end());
//	reverse(tab.begin(),tab.end());
	int cnt=0;
	for (int i=0;i<n;i++)
	{
		if (k<0) break;
		cnt+=(tab[i]<=k);
		k-=tab[i];
	}
	cnt-=(k>0);
	cout<<cnt<<"\n";
}

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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const double PI = acos(-1);
const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;


vector<string> split(const string &s, char delim) {
    vector<string> elems;
    string item;
    for (char ch: s) {
        if (ch == delim) {
            if (!item.empty())
                elems.push_back(item);
            item.clear();
        }
        else {
            item += ch;
        }
    }
    if (!item.empty())
        elems.push_back(item);
    return elems;
}


int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    string s;
    cin >> s;
    ll k;
    cin >> k;
    rep(i, sz(s)){
        if(s[i] != '1'){
            if(i >= k){
                print(1);
                return 0;
            } else {
                print(s[i]);
                return 0;
            }
        }
    }
    print(1);




}



Measured memory_bytes: 3628
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto s = readln.chomp, n = s.length;
  foreach_reverse(i; 1..n/2) {
    if (s[0..i] == s[i..i*2]) {
      writeln(i*2);
      break;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9+7;

int main() {
    int n; cin >> n;
    cout << n*800-(n/15)*200 << endl;
}

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

int A, B, C;

int main() {
    cin >> A >> B >> C;
    string ans = "No";
    if (A <= C && C <= B) {
        ans = "Yes";
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        String[] s = new String[n];
        for (int i = 0; i < n; i++) {
            s[i] = sc.next();
        }
        Arrays.sort(s);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            sb.append(s[i]);
        }
        System.out.println(sb.toString());
    }
}

Measured memory_bytes: 37480
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>

using namespace std;
typedef long long ll;

int n, a, b, d;
vector<int> h;

bool isOK(ll num) {
  ll cnt = 0;
  for (int i = 0; i < h.size(); i++) {
    ll p = h[i] - num * b;
    if (p > 0) {
      cnt += p / d;
      if (p % d) {
        cnt++;
      }
    }
  }
  return cnt <= num;
}

ll binary_search() {
  ll left = -1;
  ll right = h[h.size() - 1] + 1e9;
  
  while (right - left > 1) {
    ll mid = left + (right - left) / 2;
    if (isOK(mid)) right = mid;
    else left = mid;
  }
  return right;
}

int main()
{
  cin >> n >> a >> b;
  h.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  d = a - b;
  sort(h.begin(), h.end());
  cout << binary_search() << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

int		main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll n, point;
	string s;
	map<string, vector<pii>> guide;
	cin >> n;
	rep2(i, 1, n + 1) {
		cin >> s >> point;
		guide[s].push_back(make_pair(point, i));
		sort(rall(guide[s]));
	}
	for (auto v : guide) {
		for (auto p : v.second) {
			cout << p.second << "\n";
		}
	}
}


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

using namespace std;

int main(void){

    int n;

    cin >> n;

    vector<int> x(n), y(n), z(n);

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

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

    for(int i = 0;i < n;i++){
        z[i] = -(x[i] - y[i]);
    }

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

    for(int i = 0;i < n;i++){
        z[i] *= -1;
    }
    
    int tmp = 0;

    for(int i = 0;z[i] > 0;i++){
        tmp += z[i];
    }

    cout << tmp << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
using namespace std;
int average(int a,int b,int c,int d,int e){
	return (a+b+c+d+e)/5;
}
int main() {
	int i=0;
	int stu[5];
	int heikin;
	while(i<5){
		scanf("%d", &stu[i]);
		stu[i] = max(40, stu[i]);
		i++;
	}
	heikin = average(stu[0], stu[1], stu[2], stu[3], stu[4]);
	printf("%d\n", heikin);
	return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    for(int T = 0; T < t ; T++){
        ll n;
        cin >> n;
        if(n%1000!=0)
            std::cout << 1000 - n%1000 << std::endl;
        else
            cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 3612
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-13;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
char str[5][5];
int main(){
	//int a,b;scanf("%d%d",&a,&b);
	scanf("%s%s%s",str[0],str[1],str[2]);
	printf("%c%c%c\n",str[0][0],str[1][1],str[2][2]);
}

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

int main(){
  int N,ans=0;
  cin>>N;
  vector<long long int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
    ans += vec.at(i)-1;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

double ki;

int main() {
	int n; cin >> n;
	
	REP(i, 1, n + 1) {
		if (i % 2 == 1) {
			ki += 1.00000000000;
		}
	}
		cout <<ki / n << endl; 
	
	return 0;
}

Measured memory_bytes: 256
//tanzim bin nasir
#include<bits/stdc++.h>
typedef long long ll;
#define ff first
#define ss second
using namespace std;
void fast()
{
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    else
    gcd(b,a%b);
}
ll lcd(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}
int main()
{
    string a,b;
    cin>>a>>b;
    int j=0,ans=b.size(),sum=b.size();
    for(int i=0;i<=a.size()-sum;i++)
    {
      int k=i;
      int temp=0;
      for(int j=0;j<b.size();j++,k++)
      {
          if(a[k]==b[j])
            temp++;
          ans=min(ans,sum-temp);
      }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3628
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

//素因数分解
vector<int> primes,prime;
class PRPRPR{
public:
  PRPRPR(int PRIME_MAX){
    prime.resize(PRIME_MAX);
    for(int i=2;i<PRIME_MAX;i++)if(!prime[i]){
	primes.pb(i);
	for(int j=i*2;j<PRIME_MAX;j+=i)
	  prime[j]=1;
      }
  }
} prprprpr(2200);

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int n;
  cin>>n;
  vector<ll> a(n);
  rep(i,n) cin>>a[i];
  unordered_map<ll,pll> cnts;
  for(ll x:a){
    ll key=1,co=1;
    for(int p:primes){
      if(x%p) continue;
      int cnt=0;
      while(x%p==0){
	++cnt;
	x/=p;
      }
      cnt%=3;
      if(!cnt){
	continue;
      }else if(cnt==1){
	key*=p;
	co*=1ll*p*p;
      }else{
	key*=1ll*p*p;
	co*=p;
      }
    }
    if(x>1){
      ll tmp=sqrt(x);
      ll f=0;
      reps(i,-1,2) if((tmp+i)*(tmp+i)==x) f=tmp+i;
      if(f){
	key*=x;
	co*=f;
      }else{
	key*=x;
	co*=x*x;
      }
    }
    cnts[key].Y=co;
    ++cnts[key].X;
  }
  auto tmp=cnts;
  ll re=0;
  for(auto p:tmp) if(p.X!=1 && cnts[p.Y.Y]<p.Y) re+=p.Y.X;
  //for(auto p:tmp) if(p.X!=1 && cnts[p.Y.Y]<p.Y) cout<<p;
  re+=!!cnts[1].X;
  cout<<re<<endl;
  return 0;
}


Measured memory_bytes: 18120
#include <iostream>

using namespace std;

int main()
{
    int a[] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};

    int x, y;
    cin >> x >> y;

    if (a[x] == a[y]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

using namespace std;

int main(){
    int N;
    cin >> N;
    long long a[N], b[N], c[N];
    for(int i = 0; i < N; i++){
        cin >> a[i] >> b[i] >> c[i];
    }

    long long dp[N][3]; // dp[i][j] := i-1日目にjを選んだ時のi日目までの幸福度の最大値
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for(int i = 1; i < N; i++){
        dp[i][0] = max(dp[i-1][1], dp[i-1][2])+a[i];
        dp[i][1] = max(dp[i-1][2], dp[i-1][0])+b[i];
        dp[i][2] = max(dp[i-1][0], dp[i-1][1])+c[i];
    }

    cout << max({dp[N-1][0], dp[N-1][1], dp[N-1][2]}) <<endl;


    return 0;
}

Measured memory_bytes: 4992
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define all(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
const int INF = 1 << 28;
const ll INFL = (ll)1 << 58;
ll mod = (int)1e9 + 7;

//.....................
const int MAX = (int)2e5 + 5;

char s_[MAX];
int n, m;
double board[20][20];

double dfs(int reached) {
	static int used;
	static double dp[1 << 17][20];
	static bool done[1 << 18][20];
	if (done[used][reached] == true) {
		return dp[used][reached];
	}
	double res = 0.0;
	if (reached == n) {
		return 1.0;
		if (test) cerr << "!";
	}
	rep(i, m) {
		if ((used >> i) & 1) continue;
		used |= 1 << i;
		double res_i = 0.0;
		double keep_win_p = 1.0;
		REP(j, reached, n) {
			res_i += dfs(j) * keep_win_p * (1.0 - board[i][j]);
			if (test) dump(dfs(j));
			keep_win_p *= board[i][j];
		}
		res_i += keep_win_p;
		chmax(res, res_i);
		used ^= 1 << i;
	}
	done[used][reached] = true;
	return dp[used][reached] = res;
}

void solve() {
	// m = atoi(s_);
	cin >> m;
	cin >> n;
	rep(i, m) rep(j, n) cin >> board[i][j];
	cout << dfs(0) << endl;
}

signed main() {
	int T = 10;
	cout << fixed << setprecision(15);
	rep(i, T) {
		// if (scanf("%s", s_) == EOF) break;
		solve();
		break;
	}
	return 0;
}

Measured memory_bytes: 14788
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return a % 1000000007;
}

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


int main(){
  ll n,m; cin >> n >> m; ll sum = 0;
  rep(i,m){ ll x; cin >> x; sum += x; }
  
  if(n >= sum) cout << n - sum << endl;
  else cout << -1 << endl;
}


Measured memory_bytes: 3596
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>

using namespace std;
typedef long long ll;

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

int main() {

    ll n;
    cin >> n;
    ll p[n];
    rep(i,n) cin >> p[i];
    ll out = 0;
    for(int i=1;i<n-1;i++){
        if((p[i]>p[i-1]&&p[i]<p[i+1])||(p[i]<p[i-1]&&p[i]>p[i+1])) out++;
    }
    cout << out << endl;
    return 0;
}


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

#define debug(x) cerr << "-------- [ " << (#x) << " ] = " << x << endl
//#define bjq

using namespace std;

map<string, int> h;

int main() {
#ifdef bjq
	freopen(".in", "r", stdin);
	freopen(".out", "w", stdout);
#endif

	int n; string s;
	cin >> n;
	while (n--) {
		cin >> s;
		h[s]++;
	}
	printf("AC x %d\n", h["AC"]);
	printf("WA x %d\n", h["WA"]);
	printf("TLE x %d\n", h["TLE"]);
	printf("RE x %d\n", h["RE"]);

	return 0;
}



Measured memory_bytes: 3724
# -*- coding: utf-8 -*-
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
import copy
import math
sys.setrecursionlimit(10**6)

# lis_of_lis = [[] for _ in range(N)]


def zz(): return list(map(int, sys.stdin.readline().split()))


def z(): return int(sys.stdin.readline())


def S(): return sys.stdin.readline()[:-1]


def C(line): return [sys.stdin.readline() for _ in range(line)]


s = S()
t = S()
set_s = set(s)
set_t = set(t)
if (set_t <= set_s) is False:
    print(-1)
    exit()
alphabet2index = defaultdict(list)
for i, alphabet in enumerate(s):
    alphabet2index[alphabet].append(i+1)
ans = 0
pos = 0
prev_pos = 0
base = 0
n = -1
c = 0
for _t in t:
    n = s.find(_t, n+1)
    if (n == -1):
        c += 1
        n = s.find(_t)
ans = n + c*len(s) + 1
"""

    ng_flg = True
    while ng_flg:
        pos_lis = alphabet2index[_t]
        i = 0
        while len(pos_lis) > i:
            if (pos_lis[i] >= pos):
                pos = pos_lis[i]
                ans += (pos_lis[i]-prev_pos)
                # print(pos_lis[i], prev_pos, )
                prev_pos = pos
                ng_flg = False
                break
            i += 1
        else:
            prev_pos = pos - len(s)
            # print(prev_pos)
            # print('base', base)
            pos = 0
    """
print(ans)


Measured memory_bytes: 14008
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
    return (a.second<b.second);
}

int main()
{
    ios;
    int n;
    cin>>n;
    string s,s1="",s2="";
    cin>>s;
    if(n%2)
    {
        cout<<"No"<<endl;
        return 0;
    }
    for(int i=0;i<(n/2);i++)
        s1+=s[i];
    for(int i=n/2;i<n;i++)
        s2+=s[i];
        if(s2==s1)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;


}














Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

int main(){
  int n,m;
  cin >> n >> m;
  vs A(n), B(m);
  rep(i,n) cin >> A[i];
  rep(i,m) cin >> B[i];

  bool ok = false;
  rep(sy,n-m+1){
    rep(sx,n-m+1){
      bool match = true;
      rep(i,m){
	rep(j,m) match &= (A[sy+i][sx+j] == B[i][j]);
      }
      ok |= match;
    }
  }

  cout << (ok ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
from collections import defaultdict
from collections import Counter

n = int(input())
d = defaultdict(int)
S = list(input())
for s in S:
    d[s] += 1

for _ in range(n - 1):
    c = Counter(list(input()))
    for key, values in d.items():
        c_value = c.get(key, 0)
        d[key] = min(d[key], c_value)
# print(d)
d = dict(d)
new_S = []
for key, value in d.items():
    new_S += [key] * value
new_S = sorted(new_S)
# print(new_S)
ans = ''.join(new_S)
print(ans)


Measured memory_bytes: 3316
#include <iostream>

using namespace std;

int main()
{
    int N; cin>>N;
    int *A; A = new int[N];
    for(int i=0;i<N;i++){
        cin >> A[i];
    }

    for(int i=0;i<N;i++){
        if(A[i]%2==0){
            if(A[i]%3!=0 && A[i]%5!=0){
                cout << "DENIED";
                return 0;
            }
        }
    }

    cout << "APPROVED";

    return 0;
}

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

#define ll long long int

using namespace std;

int main() {
    ll h, w, k;
    cin >> h >> w >> k;
    vector<vector<char>> S(h, vector<char>(w));
    for (auto & row : S) for (auto & c: row) cin >> c;
    //for (ll i = 0; i < h; ++i ) {
    //    for (ll j = 0; j < w; ++j) {
    //        cerr << S[i][j];
    //    }
    //    cerr << endl;
    //}

    ll res = 1LL<<60;

    for (ll bit = 0; bit < (1LL<<(h-1LL)); ++bit) {
        vector<ll> ord(h, 0);
        ll n = 0;
        for (ll i = 0; i < h-1; ++i) {
            if (!(bit & (1LL<<i))) {
                ord[i+1] = ord[i];
            } else {
                ord[i+1] = ord[i] + 1;
                ++n;
            }
        }

        ll add = 0;
        vector<ll> nums(n+1, 0);
        bool gok = true;
        for (ll j = 0; j < w; ++j) {
            vector<ll> one(n+1, 0);
            bool needCut = false;
            for (ll i = 0; i < h; ++i) {
                if (S[i][j]=='1') {
                    ++one[ord[i]];
                    ++nums[ord[i]];
                }
                if (one[ord[i]] > k) {
                    gok = false;
                    break;
                }
                if (nums[ord[i]] > k) {
                    needCut = true;
                }
            }
            //for (ll i = 0; i < h; ++i) {
            //    if (i != 0) cerr << ",";
            //    cerr << one[ord[i]];
            //}
            //cerr << endl;
            if (needCut) {
                ++add;
                nums = one;
            }
            if (!gok) break;
        }
        //cerr << n << "," << add << ":" << gok << endl;
        if (gok) {
            res = min(res, n + add);
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int l1,l2;
  char s1[100],s2[100],s3[100];
  scanf("%s %s %s",s1,s2,s3);
  l1=strlen(s1);
  l2=strlen(s2);
  if(s1[l1-1]==s2[0]&&s2[l2-1]==s3[0])cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(M)]
x = set()
y = set()
for a, b in L:
    if a == 1:
        x.add(b)
    if b == N:
        y.add(a)
if len(x & y) > 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int a, b, c;
  cin >> a >> b >> c;

  int ans = 0;
  int m1 = min({a, b, c});
  int m3 = max({a, b, c});
  int m2 = a + b + c - (m1 + m3);

  // m1 <= m2 <= m3

  if ((m1 & 1) == (m2 & 1))
  {
    ans = (m2 - m1) / 2;
    ans += m3 - m2;
  }
  else if ((m1 & 1) == (m3 & 1))
  {
    ans = (m3 - m1) / 2;
    ans += (m3 - m2) / 2 + 2;
  }
  else if ((m2 & 1) == (m3 & 1))
  {
    ans = (m3 - m2) / 2;
    ans += (m3 - m1) / 2  + 2;
  }
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int n,l,a[250],ans,res,sum;
int main()
{
    cin>>n>>l;
    for(int i=1;i<=n;i++)a[i]=l+i-1,sum+=a[i];
    ans=1e9;
    for(int i=1;i<=n;i++){
        int tot=0;
        for(int j=1;j<=n;j++){
            if(j!=i)tot+=a[j];
        }
        if(abs(tot-sum)<ans){
            ans=abs(tot-sum);
            res=tot;
        }
    }
    cout<<res<<endl;
    return 0;
}

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

ll N;
vector<ll> A;

int main(void){
    
    cin >> N;
    for(ll i = 1; i <= N; ++i){
        ll n;
        cin >> n;
        A.push_back(n - i);
    }
    sort(A.begin(), A.end());
    
    ll ans = LONG_MAX, C = N / 2;
    for(ll c = C - 1; c < C + 1; ++c){
        ll sum = 0;
        for(ll i = 1; i <= N; ++i) sum += abs(A[i - 1] - A[c]);
        ans = min(ans, sum);
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 2420
from itertools import accumulate

n = int(input())
A = list(map(int, input().split()))
AA = list(accumulate([0] + A))
ans = 10 ** 20
for i in range(1, n):
    temp1 = AA[i]
    temp2 = AA[-1] - temp1
    delta = abs(temp1 - temp2)
    ans = min(delta, ans)
print(ans)


Measured memory_bytes: 30672
N, M = map(int, input().split())
A = list(map(int,input().split()))
A.sort()
bc = []
for i in range(M):
    bc.append(list(map(int, input().split())))
bc.sort(key=lambda x:x[1], reverse=True)

ans = 0

BC = bc[0]
bc_i = 0
ans += sum(A)
for i in range(len(A)):
    
    if BC[1] > A[i]:
        ans += BC[1] - A[i]
        BC[0] -= 1
    
    if BC[0] == 0:
        if bc_i == len(bc) - 1:
            break
        else:
            bc_i += 1
            BC = bc[bc_i]
        
print(ans)

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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s,t;
	cin>>s>>t;
	ll ct=0;
	// sort(s.begin(),s.end());
	// sort(t.begin(),t.end());
	for(ll i=0;i<s.size();i++)
	{
		if(s[i]!=t[i]) ct++;
	}
	cout<<ct;
	return 0;
}

Measured memory_bytes: 3876
/// However long the night,
///     The dawn will break
/// ICPC next year

#include<bits/stdc++.h>
using namespace std ;
const int N = 1e5+5 ;

unsigned long long l ,a ,b ,mod ;

typedef vector<unsigned long long> vll ;
typedef vector<vll> vvll ;
#define Sz(matrix ,n ,m) matrix.assign(n, vll(m));
vvll matrixMult(vvll matA, vvll matB) {
	vvll ret(matA.size(), vll(matB[0].size()));
	for (int i = 0; i < ret.size(); i++)
		for (int j = 0; j < ret[0].size(); j++)
			for (int k = 0; k < matA[0].size(); k++) {
				ret[i][j] += (matA[i][k] * matB[k][j]) % mod;
				ret[i][j] = (ret[i][j]%mod+mod)%mod;
			}
	return ret;
}
vvll matrixPower(vvll mat, unsigned long long p) {
	if (p == 1) return mat;
	if (p % 2 == 1)
		return matrixMult(mat, matrixPower(mat, p - 1));
	vvll cur = matrixPower(mat, p / 2);
	return matrixMult(cur, cur);
}

int main(){
    cin >> l >> a >> b >> mod ;
    unsigned long long ans = 0 ,cur = a ;
    for(unsigned long long L=1;l;L*=10){
        if(L<=cur/10) continue ;

        vvll base ,multi ;
        Sz(base,1,3) ;
        base[0][0] = ans%mod ;
        base[0][1] = cur%mod ;
        base[0][2] = b%mod ;

        Sz(multi,3,3) ;
        multi[0][0] = L%mod*10%mod ;
        multi[1][0] = multi[1][1] = multi[2][1] = multi[2][2] = 1 ;

        unsigned long long cnt = (L*10-1 - cur)/b+1 ;
        cnt = min(cnt ,l);

        l -= cnt ;

        ans = matrixMult(base ,matrixPower(multi ,cnt))[0][0] ;

        cur += cnt*b ;
    }
    cout << ans%mod ;
    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << (i) << "\n"

#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()

int gcd(int a, int b) {
  if (b==0) return a;
  return gcd(b,a%b);
}
 
signed main() {
    int a,b,c,d;
    std::cin >> a >> b >> c >> d;
    a--;
    int sum = b/c+b/d-b/(c*d/gcd(c,d))-(a/c+a/d-a/(c*d/gcd(c,d)));
    print(b-a-sum);
  return 0;
}


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

using ll = long long;
using db = double;
using pll = pair < ll, ll >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define pb push_back
#define mp make_pair
#define fastIo() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;

int main(){
	ll k, a, b; cin >> k >> a >> b;
	string ans = "NG";
	for(ll i = a; i <= b; i++) {
		if(i % k == 0) ans = "OK";
	}
	cout << ans << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;


int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int N, M; cin >> N >> M;
  set<int> fromOne;
  vector<int> toN;
  for (int i = 0; i < M; i++) {
    int a, b; cin >> a >> b;
    if (a == 1) fromOne.insert(b);
    if (b == N) toN.push_back(a);
  }
  for (int x : toN) {
    if (fromOne.count(x) > 0) {
      cout << "POSSIBLE\n";
      return 0;
    }
  }
  cout << "IMPOSSIBLE\n";


  return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  if (k * 2 - 1 <= n)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var nk = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var ar = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var dic = new Dictionary<int, int>();
        for (var i = 0; i < nk[0]; i++)
            if (dic.ContainsKey(ar[i])) dic[ar[i]]++;
            else dic[ar[i]] = 1;
        var vals = dic.Values.OrderBy(v => v).ToArray();
        var res = 0;
        for (var i = 0; i < dic.Keys.Count-nk[1]; i++)
            res += vals[i];
        WriteLine(res);
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 43976
#include <bits/stdc++.h>
#include <string>
#include <cmath>
using namespace std;
int main()
{
	string a, b;
	cin >> a >> b;
	int ans = 0;
	int i =0;
	while (a[i])
	{
		if(a[i] != b[i])
			ans++;
		i++;
	}

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

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
int main(){
	string data[6]={"pre-meiji","meiji","taisho","showa","heisei"};
	int year[5]={18680908,19120730,19261225,19890108};
	bool f[5];
	int y,m,d;
	while(cin>>y>>m>>d){
		int date=y*10000+m*100+d;
		if(date<year[0]){
			cout<<data[0]<<endl;
		}else{
			for(int i=1;i<=3;i++){
				if(year[i-1]<=date&&date<year[i]){
					cout<<data[i]<<" "<<y-(year[i-1]/10000)+1<<" "<<m<<" "<<d<<endl;
				}
			}
			if(date>=year[3])cout<<data[4]<<" "<<y-(year[3]/10000)+1<<" "<<m<<" "<<d<<endl;
		}
	}
}

Measured memory_bytes: 1204
S = input()
k = int(input())
l = len(S)

one = []
check = set()

for s in S:
    if s not in check:
        one.append(s)
        check.add(s)

ans = set()
one.sort(reverse=True)
for i in range(5):
    if not one:
        break
    first = one.pop()
    ans.add(first)
    for j, s in enumerate(S):
        if s == first:
            length = 1
            while j+length < l and length < 5:
                length += 1
                string = S[j: j+length]
                ans.add(string)
        else:
            continue

ans = list(ans)
ans.sort()
print(ans[k-1])

Measured memory_bytes: 3316
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        long a = Long.parseLong(sc.next());
        long b = Long.parseLong(sc.next());
        String ans = "Positive";
        
        if ((a > 0 && b < 0)
                || (a < 0 && b > 0)
                || (a == 0)
                || (b == 0)) {
            ans = "Zero";
        } else if (a < 0 && (a + b) % 2 == 0) {
            ans = "Negative";
        }

        out.println(ans);
        
        out.flush();
    }
}

Measured memory_bytes: 23636
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <bitset>
#include <iomanip>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define reppe(i,a,b) for(int i = (int)(a) ; i <= (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repme(i,a,b) for(int i = (int)(a) ; i >= (int)(b) ; --i)

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    float R; cin >> R;
    cout << setprecision(12) << R * 6.28318530717958623200 << endl;

}


Measured memory_bytes: 3784
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(b%a == 0) {
			System.out.println(a+b);
		}
		else {
			System.out.println(b-a);
		}
		
		
		
    }

}

Measured memory_bytes: 21844
#include <cassert>
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0))return 0;
  long long x = 1;
  while (b > 0) {
    if (b & 1)x = (mod!=-1)?(x * a) % mod:x*a;
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

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

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

  ll n,x;
  std::cin>>n>>x;
  
  std::vector<ll> l(n);
  rep(i,0,n)std::cin>>l[i];
  
  ll sum=0,cnt=0;
  while(sum<=x){
    cnt++;
    if(cnt<=n)sum+=l[cnt-1];
    else break;
  }

  std::cout<<cnt<<"\n";

  return 0;
}



Measured memory_bytes: 256
import string
n = int (input())
s = input()
az = string.ascii_lowercase

ans = []

for i in range(1,n):
     count = 0
     before = s[:i]
     after = s[i:]
     for j in az:
         if j in before and j in after:
              count +=1
     ans.append(count)
print(max(ans))

Measured memory_bytes: 3832
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>

using namespace std;

int main() {
    
    vector<int> v(3);
    int k;
    
    for(int i=0;i<3;i++){
        cin >> v[i];
    }
    
    cin >> k;
    
    int max = *max_element(v.begin(),v.end());
    
    int ans=0;
    for(int i=0;i<3;i++){
        ans += v[i];
    }
    
    ans += max * pow(2,k) - max;
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<cstring>

using namespace std;

int main(){
for(int x=0;x>=0;x++){
	char r[5];
	char a[5];
	char z[2]="0";
	cin>>r>>a;
	if((strcmp(r,z)==0)&&(strcmp(a,z)==0)){
		break;
	}
	int h=0,b=0;
	for(int i=0;i<=3;i++){
			for(int j=0;j<=3;j++){
				if(r[i]==a[j]){
					b++;
					if(i==j){
						h++;
					}
				}
			}
	}
	b=b-h;
	cout<<h<<' '<<b<<'\n';
}
	return 0;
}

Measured memory_bytes: 1140
#include<bits/stdc++.h>
#define inc(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef long long LL;
const LL mx=1e5+7,mod=998244353;
LL ret;LL n,lck[4],in[4],cnt,w[mx<<2];
void read()
{
	char c=getchar();
	while(c!='R'&&c!='B'&&c!='G')c=getchar();
	while(c=='R'||c=='B'||c=='G')
	{w[++cnt]=((c=='R')?0:((c=='G')?1:2));c=getchar();}
	return;
}
int main()
{
	scanf("%lld",&n);read();
	ret=1;n=n;cnt=0;
	inc(i,1,3*n)
	{
		if(lck[w[i]])
		{
			ret=lck[w[i]]*ret%mod;
			lck[w[i]]--;
			continue;
		}
		if(in[(w[i]+1)%3])
		{
			ret=ret*in[(w[i]+1)%3]%mod;
			in[(w[i]+1)%3]--;
			lck[(w[i]+2)%3]++;
			continue;
		}
		if(in[(w[i]+2)%3])
		{
			ret=ret*in[(w[i]+2)%3]%mod;
			in[(w[i]+2)%3]--;
			lck[(w[i]+1)%3]++;
			continue;
		}
		ret=ret*(n-cnt++)%mod;
		in[w[i]]++;
	}
	printf("%lld\n",ret);
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>

using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	if (b % 2 != 0){
		cout << "No";
		return 0;
	}
	if (b/2 - a >= 0 && 2 * a - b / 2 >= 0) cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 3616
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		String ph = new String();

		
			while(sc.hasNext()) {
				ph = sc.nextLine();
				System.out.printf("%s\n", PokerHand(ph));
			}
	}

	private static String PokerHand(String ph) {
		String[] pkh = new String[5];
		int[] pkh_cnvIntger = new int[5];
		String hndnm = "null";
		Map<Integer, Integer> mapHand = new HashMap<>();
		int cnt = 0;
		boolean isStraight = true;
		int firstRankcnt = 0;
		int secondRankcnt = 0;
		
		pkh = ph.split(",");
		for (int i = 0; i < 5; i++) {
			pkh_cnvIntger[i] = Integer.parseInt(pkh[i]);
			cnt = 1;
				if (mapHand.containsKey(pkh_cnvIntger[i])) {
					cnt = mapHand.get(pkh_cnvIntger[i]) + 1;
				} 
			mapHand.put(pkh_cnvIntger[i], cnt);
		}
	
		for (int i = 1; i <= 13; i++) {
			if (mapHand.containsKey(i)) {
				if (mapHand.get(i) > firstRankcnt ) {
					secondRankcnt = firstRankcnt;
					firstRankcnt = mapHand.get(i);
				} else if ( mapHand.get(i) >secondRankcnt){
					secondRankcnt = mapHand.get(i);
				}
			}
		}
		
		//System.out.println(mapHand);
		
		if (firstRankcnt >= 4) {
			hndnm = "four card";
		} else if (firstRankcnt == 3) {
			if (secondRankcnt == 2) {
				hndnm = "full house";
			} else {
				hndnm = "three card";
			}
		} else if (firstRankcnt == 2) {
			if (secondRankcnt == 2) {
				hndnm = "two pair";
			} else {
				hndnm = "one pair";
			}
		} else {
			hndnm = null;
		}
		
		Arrays.sort(pkh_cnvIntger);
		for (int i = 1; i < 5; i++) { // ストレート
			if (pkh_cnvIntger[i] - pkh_cnvIntger[i - 1] != 1) {
				isStraight = false;
				break;
			}
		}
		if (pkh_cnvIntger[0] == 1 && pkh_cnvIntger[1] == 10 && pkh_cnvIntger[2] == 11 && pkh_cnvIntger[3] == 12 && pkh_cnvIntger[4] == 13) { 
			isStraight = true;
		}
		
		if (isStraight == true) hndnm = "straight";
		
		return hndnm;
	}

}



Measured memory_bytes: 26176
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { let mut $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { let $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
fn main() {
    input! { n, k, mut l: [usize; n] };
    l.sort_by_key(|ll| -(*ll as isize));
    let ans: usize = l.into_iter().take(k).sum();
    println!("{}", ans);
}


Measured memory_bytes: 4352
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Debug.Trace
import Data.List
import Control.Monad
import Data.Ord
import qualified Data.IntSet as IS

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

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



main :: IO ()
main = do
    s <- getLine
    putStrLn $ if length (nub s) == 1 then "No" else "Yes"



Measured memory_bytes: 380
#import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
def main():
    A,B,C,D = map(int, input().split())
    turn = 0
    while A>0 and C>0:
        if turn == 0:
            C -= B
        else:
            A -= D
        turn = (turn+1)%2
    
    if C <= 0:
        print('Yes')
    else:
        print('No')

main()


Measured memory_bytes: 9176
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = float("inf")
for i in range(A[0],A[-1]+1):
  tmp = 0
  for j in range(N):
    tmp += (i - A[j]) ** 2
  ans = min(ans,tmp)
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>

using namespace std;

int main(){
  int N;
  cin >> N;
  int f=0;
  int n=N;
  while(n>=1){
    f+=n%10;
    n/=10;
  }
  if(N%f==0)  cout << "Yes" << endl;
  else  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n, i;

	scanf("%d", &n);

	i = n / 2;

	if (n % 2 >= 1) //片面印刷が出る場合をカウントする
	{
		i = i + 1;
	}

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

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

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

    int x,y;
    cin >> x >> y;

    int a=((4*x)-y)/2;
    int b=(y-(2*x))/2;

    if ((a<0)||(b<0))
    {
        cout << "No" << endl;
        return 0;
    }

    if (((a+b)==x)&&(((2*a)+(4*b))==y))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <math.h>
#include <array>
#include <map>
using namespace std;
#define ll long long;
#define N 200010
class UF
{
public:
  int parent[N],rank[N],size[N];
  UF(int n)
  {
    for(int i=0;i<=n;i++)
      {
	parent[i]=i;
	rank[i]=0;
	size[i]=1;
      }
  }

  int find(int x)
  {
    if(parent[x]==x)
      return x;
    else
      return parent[x]=find(parent[x]);
  }

  bool same(int x,int y)
  {
    return find(x)==find(y);
  }

  void merge(int x,int y)
  {
    x=find(x);
    y=find(y);
    if(x==y) return;
    if(rank[x]<rank[y])
      {
	parent[x]=y;
	size[y]+=size[x];
      }
    else
      {
	parent[y]=x;
	size[x]+=size[y];
	if(rank[x]==rank[y])
	  {
	    rank[x]++;
	  }
      }

    return;
  }
  int getSize(int x)
  {
    return size[find(x)];
  }
};

map<pair<int,int>,int> tb;
int main(void)
{
  int n,k,l,fs,sc;
  cin >> n >> k >> l;
  UF uf1(n);
  UF uf2(n);
  for(int i=0;i<k;i++)
    {
      cin >> fs >>sc;
      uf1.merge(fs-1,sc-1);
    }
  for(int i=0;i<l;i++)
    {
      cin >> fs >> sc;
      uf2.merge(fs-1,sc-1);
    }
  for(int i=0;i<n;i++)
    {
      tb[make_pair(uf1.find(i),uf2.find(i))]++;
    }
  for(int i=0;i<n;i++)
    {
      cout << tb[make_pair(uf1.find(i),uf2.find(i))] << " ";
    }
  cout << endl;
  return 0;
}


Measured memory_bytes: 16768
#include <cstdio>
#include <algorithm>
int N, C, K, a[100001], O;
int main()
{
	scanf("%d%d%d", &N, &C, &K);
	for (int i = 1; i <= N; i++)
		scanf("%d", a + i);
	std::sort(a + 1, a + N + 1);
	for (int i = 1; i <= N; i = std::min(i + C, int(std::upper_bound(a + i, a + N + 1, a[i] + K) - a)))
		O++;
	printf("%d\n", O);
	return 0;
}


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


int main(){

    int n;
    cin >> n;
    
    int ans = 0;
    int maxi = -1;
    for(int i = 1; i <= n; i++) {
        
        int num = i;
        int cnt = 0;
        while(num%2 == 0){
            num /= 2;
            cnt++;
        }
        if(cnt > maxi){
            ans = i;
            maxi = cnt;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256