akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (A <= C && C <= B) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);

long long dist,X,K,D, ans,ans2;


cin>>X>>K>>D;
dist = abs(X);
ans = dist%(D);
ans2 = abs(ans - D);

long long steps = dist/D;


if( steps >= K)
 ans = dist - K*D;
else 
{
     if((K-steps)%2 == 1)
     ans = ans2;
}

cout<<ans<<endl;

return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)


void solve(long long N, long long M, long long C, std::vector<long long> B, std::vector<std::vector<long long>> A){
    ll cnt = 0;
    rep(i, N){
        ll sum = C;
        rep(j, M){
            sum += A[i][j]*B[j];
        }
        if(sum > 0)
            cnt ++;
    }
    cout << cnt << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    long long C;
    scanf("%lld",&C);
    std::vector<long long> B(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&B[i]);
    }
    std::vector<std::vector<long long>> A(N, std::vector<long long>(M));
    for(int i = 0 ; i < N ; i++){
        for(int j = 0 ; j < M ; j++){
            scanf("%lld",&A[i][j]);
        }
    }
    solve(N, M, C, std::move(B), std::move(A));
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdin = new Scanner( System.in);
		int n=0,a=0,T=0,ans=1;
		double XX=Double.MAX_VALUE;
		n=stdin.nextInt();
		T=stdin.nextInt();
		a =stdin.nextInt();
		for(int i=1;i<=n;i++){
			double ave=0;
			int H=stdin.nextInt();
			ave=T-H*0.006;
			double X=ave-a;
			if(XX*XX>X*X){
				XX=X;
				ans=i;
			}
		}
		System.out.print(ans);
	}
}




Measured memory_bytes: 24276
#include<cstdio>

int translate(char* c)
{
	int sum = -1, mlt = 1;
	for (int i = 0; c[i]; i++)
	{
		if (c[i] == 'A')
			sum += mlt;
		else if (c[i] == 'C')
			sum += 2 * mlt;
		else if (c[i] == 'G')
			sum += 3 * mlt;
		else if (c[i] == 'T')
			sum += 4 * mlt;
		else
			break;
		mlt *= 4;
	}
	return sum;
}

int main()
{
	int n;
	char cmd[16], str[16];
bool *words;

	words = new bool[16777216];
	for (int i = 0; i < 16777216; i++)
		words[i] = false;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%s%s", cmd, str);
		if (cmd[0] == 'i')
			words[translate(str)] = true;
		else
		{
			if (words[translate(str)])
				printf("yes\n");
			else
				printf("no\n");
		}
	}
	delete[] words;
	return 0;
}


Measured memory_bytes: 18564
import collections
n = int(input())
a = [0] + list(map(int,input().split()))

a_pos = [a[i]+i for i in range(1,n+1)]
a_neg = [-a[i]+i for i in range(1,n+1)]
#print(a_pos)
#print(a_neg)

c_pos = collections.Counter(a_pos)
c_neg = collections.Counter(a_neg)
#print(c_pos)
#print(c_neg)

ans = 0
for c in c_pos:
    ans += c_pos[c] * c_neg[c]

print(ans)

Measured memory_bytes: 63272
#include<stdio.h>
 
int main(void)
{
  int goods_number, choose_number;
  int vote[100];
  int clear = 0;
  double sum = 0;
  int i;
  
  scanf("%d %d", &goods_number, &choose_number);
  for(i = 0; i < goods_number; i++){
    scanf("%d", &vote[i]);
    sum += vote[i];
  }
  for(i = 0; i < goods_number; i++) {
     if(vote[i] >= sum / (4 * choose_number)) {
       clear++;
     }
  }
  if(clear >= choose_number){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 1732
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long[] n = Arrays.stream(sc.nextLine().split("")).mapToLong(Long::parseLong).toArray();
		long c = Arrays.stream(n).filter(a -> a == 2).count();
		System.out.println(c);
	}

}


Measured memory_bytes: 27092
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,L,R,a[55],ans1,ans2,cnt1,cnt2;
bool cmp(int a,int b){
	return a>b;
}
int C[55][55];
void init(){
    C[0][0]=1;
    for(int i=1;i<=50;i++){
        C[i][0]=1;
        for(int j=1;j<=i;j++)
        C[i][j]=C[i-1][j]+C[i-1][j-1];
    }
}
signed main(){
    init();
    cin>>n>>L>>R;
    for(int i=1;i<=n;i++) cin>>a[i];
    sort(a+1,a+1+n,cmp);
    for(int i=1;i<=L;i++) ans1+=a[i];
    for(int i=1;i<=n;i++) if(a[i]==a[L]) cnt1++;
    for(int i=1;i<=L;i++) if(a[i]==a[L]) cnt2++;
    if(a[1]==a[L])
        for(int i=L;i<=R;i++) ans2+=C[cnt1][i];
    else ans2=C[cnt1][cnt2];
    printf("%lf\n%lld",(double)ans1/L,ans2);
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int b[50];
int a[50][50];

int n, m, c;

bool ac(int i){
    int sum = 0;
    for (int j = 0; j < m; ++j) {
        sum += a[i][j] * b[j];
    }
    return sum + c > 0;
}

int main() {

    cin >> n >> m >> c;


    for (int i = 0; i < m; i++) cin >> b[i];
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> a[i][j];
        }
    }

    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (ac(i)) cnt++;
    }

    cout << cnt << endl;
}

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

using namespace std;

int main(void){

  
  int a;
  string s;
  
  cin >> a >> s;

 


 if(a >= 3200){
  cout << s << endl;
 }else{
  cout <<  "red" << endl;
 }

  return 0;
}



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

int main() {
  int k;
  cin >> k;
  queue<int64_t> q;
  for (int i = 1; i <= 9; i++) q.push(i);
  for (int i = 1; i < k; i++) {
    int64_t x = q.front();
    q.pop();
    if (x % 10 != 0) q.push(10 * x + x % 10 - 1);
    q.push(10 * x + x % 10);
    if (x % 10 != 9) q.push(10 * x + x % 10 + 1);
  }
  cout << q.front() << endl;
}


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


typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;
typedef vector<vll> vvll;


#define F first
#define S second
#define pb push_back
#define mp make_pair

// don't edit before this line 



const ll mod = (ll)1e9 + 7; 



ll n;
vll arr;
ll memo[401][401];
ll su[400];

ll func(int i,int j){

	if(j==i+1)
		return arr[i]+arr[i+1];
	if(i==j)
		return 0;

	if(memo[i][j]!=-1)
		return memo[i][j];
	ll mi=9999999999999;
	for(int x=i;x<j;x++)
	{
		if(i==0)
			mi=min(mi,su[j]+func(i,x)+func(x+1,j));
		else
			mi=min(mi,su[j]-su[i-1]+func(i,x)+func(x+1,j));
	}
	//cout<<mi<<" "<<i<<" "<<j<<"\n";
	return memo[i][j]=mi;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cout.setf(ios::fixed), cout.precision(20);

	cin >> n;
	arr.resize(n);

	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
	}
	su[0]=arr[0];
	for(int i=1;i<n;i++)
	{
		su[i]=arr[i]+su[i-1];
	}

	for(int i=0;i<401;i++)
		for(int j=0;j<401;j++){
			memo[i][j]=-1;
		}
	ll xx = func(0,n-1);
	cout<<xx<<"\n";
	
	return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

ll mod = 998244353;
int N;
vector<pii> p;
int cnt[11234];

ll mod_pow(ll x, ll n, ll mod) {
	if (n == 0) return 1;
	ll res = mod_pow(x * x % mod, n / 2, mod);
	if (n & 1) res = res * x % mod;
	return res;
}

int calcn(int x) { // a*(a-1)/2 = xを満たすxを求める
	int l = 1, r = INF;
	while (r - l > 1) {
		int m = (l + r) / 2;
		if ((ll)m * (m - 1) / 2 <= x) l = m;
		else r = m;
	}
	return l;
}

int main() {
	cin >> N;
	p.resize(N);
	REP(i, N) {
		int a, b;
		scanf("%d %d", &a, &b);
		p[i] = pii(a, b);
	}
	sort(ALL(p));
	
	ll ans = (mod_pow(2, N, mod) - 1 - N + mod) % mod;
	
	REP(i, N) cnt[p[i].fi]++;
	REP(i, 11234) { // x=iの線分
		ll now = (mod_pow(2, cnt[i], mod) - 1 - cnt[i] + mod) % mod;
		ans = (ans - now + mod) % mod;
	}
	
	map<pll, int> m; // (傾き, x=0でのy)*1e8
	REP(i, N) {
		REP(j, i) {
			if (p[i].fi == p[j].fi) continue;
			long double a = (long double)(p[i].se - p[j].se) / (p[i].fi - p[j].fi);
			long double b = p[i].se - a * p[i].fi;
			m[make_pair((ll)round(a * 1e8), (ll)round(b * 1e8))]++;
		}
	}
	
	for (map<pll, int>::iterator it = m.begin(); it != m.end(); ++it) {
		int c = calcn(it->se);
		ll now = (mod_pow(2, c, mod) - 1 - c + mod) % mod;
		ans = (ans - now + mod) % mod;
	}
	
	cout << ans << endl;
	
	
	return 0;
}


Measured memory_bytes: 1536
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<numeric>
#include<math.h>

#define REPS(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

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

	int c = a * pow(10, (int)log10(b) + 1) + b;
	int s = sqrt(c);
	if (c == s * s) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 512
# https://atcoder.jp/contests/abc161/tasks/abc161_b
read n m
n=$((n))
m=$((m))
read a
A=($a)

sum=$((0))
for ((i = 0; i < n; i++)) ; do
  A[i]=$((A[i]))
  sum=$((sum + A[i]))
done
echo $sum >&2

num=$((0))
for ((i = 0; i < n; i++)) ; do
  if [ $((4*m*A[i])) -ge $((sum)) ] ; then
    num=$((num + 1))
  fi
done
echo $num >&2

if [ $((num)) -ge $((m)) ] ; then
  echo "Yes"
else
  echo "No"
fi



Measured memory_bytes: 376
import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
  xs <- f
  unless (all (== 0) xs) $ do
    solve xs <$> f >>= print
    main
  where
    f = map read <$> words <$> getLine

solve :: [Int] -> [Int] -> Int
solve [n, a, b, c, x] ys =
  let rs = unfoldr f (0, x)
  in g ys rs
  where
    f (i, x) = Just ((i, x), (i + 1, (a * x + b) `mod` c))
    g [] ((i,_):_) = i - 1
    g (y:ys) ((i,r):rs)
      | i > 10000 = (-1)
      | y == r = g ys rs
      | otherwise = g (y:ys) rs



Measured memory_bytes: 5068
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,l,r) for(int i=l;i<=r;i++)
int main()
{  // freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n+1][3];

    for(int i=1;i<=n;i++)
      cin>>a[i][0]>>a[i][1]>>a[i][2];


    ll int dp[n+1][3];

    dp[1][0]=a[1][0];
    dp[1][1]=a[1][1];
    dp[1][2]=a[1][2];
     for(int i=2;i<=n;i++)
      {
            dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
            dp[i][1]=max(dp[i-1][2],dp[i-1][0])+a[i][1];
            dp[i][2]=max(dp[i-1][0],dp[i-1][1])+a[i][2];
      }
      cout<<max(dp[n][0],max(dp[n][1],dp[n][2]))<<endl;
    return 0;
}

Measured memory_bytes: 3840
n, k = [int(i) for i in input().split()]
S = input()

result = 0
unmatch_count = 0

pre = ""

init_flag = 1
for LR in S:
    if init_flag == 1:
        pre = LR
        init_flag = 0
        continue
    if pre == LR:
        result += 1
    pre = LR

unmatch_count = n - result - 1
if k*2 < unmatch_count:
    result += k*2
else:
    result += unmatch_count
print(result)

Measured memory_bytes: 3316
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;
//ここから

void solve(){
  int n;
  cin>>n;
  string s=to_string(n);
  int sum=0;
  rep(i,s.size()){
    sum+=s[i]-'0';
  }
  if(n%sum==0)cout<<"Yes";
  else cout<<"No";
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


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

int main()
{
  int N;
  cin >> N;
  cout << endl;
  
  int *list;
  list = new int[N];
  
  for(int i=0; i<N; i++)
  {
    cin >> list[i];
  }
  
  int count = 0;
  
  while(true)
  {
    bool oe=false;
  	for(int i=0; i<N; i++)
 	{
      if(list[i]%2!=0) 
      {
        oe = true;
      }
    }
    
    if(oe) break;
    
    for(int i=0; i<N; ++i)
    {
      list[i]/=2;
    }
    count++;
  }
  
  cout << count << endl;
  
  delete [] list;
  
  return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
inline int read(){
	char c=getchar();while (c!='-'&&(c<'0'||c>'9'))c=getchar();
	int k=1,kk=0;if (c=='-')c=getchar(),k=-1;
	while (c>='0'&&c<='9')kk=kk*10+c-'0',c=getchar();return kk*k;
}using namespace std;
void write(int x){if (x)write(x/10),putchar(x%10+'0');}
void writeln(int x){if (x<0)putchar('-'),x=-x;write(x);if (x==0)putchar('0');puts("");}
char s[1000000];
int l,x,y,xx,yy,zz,dd,z1[10000],d1,z2[10000],d2,f[100000],g[100000],sum;
int main(){
	scanf("%s",&s);l=strlen(s);x=read();y=read();
	for (int i=0;i<l;i++){
		if (s[i]=='F'){
			if (dd==1)yy++;
			if (dd==2)xx++;
			if (dd==0)zz++;
		}else {
			if (dd==1)z2[++d2]=yy,yy=0;
			if (dd==2)z1[++d1]=xx,xx=0;
			dd++;if (dd>2)dd-=2;
		}
	}if (dd==1)z2[++d2]=yy,yy=0;
	if (dd==2)z1[++d1]=xx,xx=0;f[zz+10000]=1;sum=zz;for (int i=1;i<=d1;i++){
		sum+=z1[i];for (int j=-sum;j<=sum;j++)g[j+10000]=f[j-z1[i]+10000]|f[j+z1[i]+10000];
		for (int j=-sum;j<=sum;j++)f[j+10000]=g[j+10000];
	}if (!f[x+10000]){puts("No");return 0;}
	memset(f,0,sizeof(f));f[0+10000]=1;sum=0;for (int i=1;i<=d2;i++){
		sum+=z2[i];for (int j=-sum;j<=sum;j++)g[j+10000]=f[j-z2[i]+10000]|f[j+z2[i]+10000];
		for (int j=-sum;j<=sum;j++)f[j+10000]=g[j+10000];
	}if (!f[y+10000]){puts("No");return 0;}puts("Yes");
}


Measured memory_bytes: 768
#include<iostream>
#include <string.h>
#include<stdio.h>
#include <math.h>
using namespace std;

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

	if (a >= b) {
		for (int i = 0; i < a; i++) {
			cout << b;
		}
	}
	else {
		for (int i = 0; i < b; i++) {
			cout << a;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

#include<cmath>
#include<string>
#include <algorithm> 

using namespace std;

# define p(s) cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) cout << (j ? "Yes" : "No") << endl;

string lpad(string l,int s,int n){
    string temp = to_string(n);
    string res = "";
    int loop = s - temp.size();
    while(loop--) res+=l;

    return res+temp;
}

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

    if(a>b) res = a+a-1;
    else if(a==b) res = a*2;
    else res = b+b-1;

    p(res)
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>
#include<tuple>
//#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define REPR(i,s,n) for(int i=(s);i>=(n);--(i))
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define fi first
#define se second
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
typedef vector<P> vP;
using Edge = pair<int, ll>;
using Graph = vector<vector<Edge> >;
const ll mod = 1e9 + 7;
ll dx[4] = { 1,0,-1,0 };
ll dy[4] = { 0,1,0,-1 };

void printvll(vll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) cout << v[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}
void printvvll(vvll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) {
		rep(j, v[i].size()) {
			cout << v[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void prints(string s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) cout << s[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}

void printvs(vs s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) {
		rep(j, s[i].size()) {
			cout << s[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Yes(bool x) {
	if (x) cout << "Yes\n";
	else cout << "No\n";
}

void YES(bool x) {
	if (x) cout << "YES\n";
	else cout << "NO\n";
}

void yes(bool x) {
	if (x) cout << "yes\n";
	else cout << "no\n";
}

void Yay(bool x) {
	if (x) cout << "Yay!\n";
	else cout << ":(\n";
}
ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}



ll  d, n, r, l, k, ans = 0, ret = M;
bool flag = false, flag2 = false, flag3 = false;
string s,t;

ll solve(char c) {
	string w = s;
	rep(i, M) {
		if (w.empty()) return i;
		if (w == string(w.length(), c)) return i;
		string nw = "";
		rep(i, w.size() - 1) {
			if (w[i] == c || w[i + 1] == c) nw += c;
			else nw += w[i];
		}
		w = nw;
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> s;
	string alp = "abcdefghijklmnopqrstuvwxyz";
	for (auto a : alp) {
		ret = min(ret, solve(a));
	}
	cout << ret << endl;
	return 0;
}

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

int main()
{
    string s; cin>>s;
    int k = s.length();
    int rem = 15 - k;
    int w=0;
    for(int i=0;i<k;i++) if(s[i]=='o') w++;

    if(w + rem >= 8)cout<<"YES";
    else cout<<"NO";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;

bool dp[100200];

int main()
{
    int n;
    cin >> n;
    ll a[n+1];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    a[n] = 0;
    ll ans = 0;
    for(int i = 0; i < n; i++){
        ans += (a[i]/2);
        a[i] %= 2;
        if(a[i] == 1 && a[i+1] > 0){
            a[i+1]--;
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, string *argv[]){
  string s;
  cin >> s;

  int cnt = 0;
  int maxCnt = 0;
  for(int i = 0; i < s.length(); i++){
    if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
      cnt++;
    }else{
      if(cnt > maxCnt){
        maxCnt = cnt;
      }
      cnt = 0;
    }
  }
  if(cnt > maxCnt) cout << cnt << endl;
  else cout << maxCnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

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

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int n;
	cin>>n;
	vector<int> t(n),x(n),y(n);
	for (int i = 0; i < n; i++)
	{
		cin>>t[i]>>x[i]>>y[i];
	}
	int prev_x=0,prev_y=0,prev_t=0;;
	for (int i = 0; i < n; i++)
	{
		int dist = abs(prev_x-x[i]) + abs(prev_y-y[i]);
		int time = t[i]-prev_t;
		if(dist > time){
			cout<<"No"<<endl;
			return 0;
		}else{
			if((dist%2==0 && time%2!=0) || (dist%2!=0 && time%2==0)){
				cout<<"No"<<endl;
				return 0;
			}
		}
		prev_x = x[i];
		prev_y = y[i];
		prev_t = t[i];
	}
	cout<<"Yes"<<endl;
	
	
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main() {
  int n; cin >> n;
  vi arr(n);
  rep(i,n) cin >> arr[i];

  int ans = 4e6+1;
  for (int i=-100; i<=100; ++i) {
    int tmp = 0;
    rep(j,n) tmp += (int)pow(arr[j]-i, 2);
    ans = min(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

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

	int n;
	cin >> n;

	vector<vector<int>> a(2, vector<int>(n));
	rep(i, 2) {
		rep(j, n) {
			cin >> a[i][j];
		}
	}

	vector<vector<int>> dp(2, vector<int>(n, 0));
	dp[0][0] = a[0][0];
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < n; j++) {
			if (i == 0) chmax(dp[i + 1][j], dp[i][j] + a[i + 1][j]);
			if (j < n - 1) chmax(dp[i][j + 1], dp[i][j] + a[i][j + 1]);
		}
	}

	out(dp[1][n - 1]);

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
char s[5];
int main(){
	scanf("%s",s);
	fo(i,0,2) s[i]=10-(s[i]-'0')+'0';
	fo(i,0,2) putchar(s[i]);putchar('\n');
}

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

int main(){
    double a,b,t;
    ll ans = 0;
    cin >> a >> b >> t;
    for(int i = 1; i*a < t+0.5 ; ++i ){
        ans += b;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){

  int a, b, c;
  int tmp;

  cin >> a >> b >> c;

  if(a > b){
    tmp = a;
    a = b;
    b = tmp;
  }
  if(b > c){
    tmp = b;
    b = c;
    c = tmp;
  }
  if(a > b){
    tmp = a;
    a = b;
    b = tmp;
  }

  cout << a <<" "<< b <<" "<< c << endl;

  return 0;
}

Measured memory_bytes: 3076
#include <iostream>
using namespace std;
int main(){
    int x;
    cin>>x;
    int h = x/3600;
    int temp_x = x%3600;
    int m = temp_x/60;
    int s = temp_x%60;
    cout<<h<<":"<<m<<":"<<s<<endl;
    return 0;
}


Measured memory_bytes: 3096
//                          **********  YATIN KWATRA  ********** 

//AC bakshi Rabha

#include <bits/stdc++.h>
#define ll                      long long 
#define ull                     unsigned long long 
#define FIO                     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl                    "\n"
#define fo(i,a,b)               for(int i = a; i<=b ; i++)
#define rfo(i,a,b)              for(int i = a; i>=b ; i--)
#define vii                      vector<int>
#define vll                     vector<ll>
#define pq                      priority_queue
#define uom                      unordered_map                
#define all(v)                  v.begin(),v.end()
#define mp                      make_pair
#define pb                      push_back
#define pob                     pop_back
#define ff                      first
#define ss                      second
#define pii                     pair<int,int> 
#define pll                     pair<long,long>
#define mll                     map<ll,ll>
#define mii                     map<int,int>
#define vvii                    vector<vii>
#define vvll                    vector<vll>
#define mod                     1000000007
#define pi                      3.1415926535897932384626433832795
// #define node                    Node

using namespace std;

void INPUT() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

}

#define ld long double
void solve()
{ 
       ll n;
       ld m;
       cin >> n >> m;

       ll ans = (ld)(m*n + 0.001);
       
       cout << ans << endl;
    
 }   
int main() {
    
    FIO
    INPUT();
    
    int t;
    t = 1;
 //   cin >> t;
    
    while(t--)
    {
       solve();
    }
    return 0;
}


Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef queue<int> qi;
typedef queue<ll> ql;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define pq priority_queue
#define rep(i,n) for (int i=0;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define INF 2000000009
#define init(x) memset(x,0,sizeof(x))
int a[4];
int main()
{
	ios::sync_with_stdio(false);
	scanf("%1d%1d%1d%1d",a,a+1,a+2,a+3);
	for (int i2=-1;i2<2;++i2) for (int i3=-1;i3<2;++i3)
	for (int i4=-1;i4<2;++i4) {
		if (!(i2&&i3&&i4)) continue;
		if (a[0]+a[1]*i2+a[2]*i3+a[3]*i4==7){
			printf("%d%c%d%c%d%c%d=7",a[0],i2>0? '+':'-',a[1],i3>0? '+':'-',a[2],i4>0? '+':'-',a[3]);
			return 0;
		}
	}
}

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

#define REP(i, N) for(int (i)=0; (i) < (N); (i)++)
#define PER(i, N) for(int (i)=(N)-1; (i) >= 0; (i)--)

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

int a[MAX];

int main(){
    int n, m; cin >> n >> m;
    int sum = 0;
    REP(i, n) {
        cin >> a[i];
        sum += a[i];
    }

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

    double p = 1.0/(4.0*m);
  	int cnt = 0;
    REP(i, n){
        double x = a[i]/(sum*1.0);
        if(x >= p) cnt++;
    }

    if(cnt >= m) cout << "Yes\n";
    else cout << "No\n";
    
    return 0;
}

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

int main(){
  int n;
  cin>>n;
  vector <pair<int,int>> tasks;
  rep(i,n){
    int a,b;
    cin >> a >> b;
    tasks.emplace_back(b,a); // 締め切り、所要時間
  }

  sort(tasks.begin(), tasks.end()); 
  int sum = 0;
  bool isyes= 1;
  for(auto v: tasks){
    sum += v.second; //aの所要時間をsumに足していく
    if(sum > v.first){//sumが締め切りより大きいならば
      isyes = 0;//締め切りに間に合わないのでNo(false)にする
      break;
    }
  }
  cout << (isyes ? "Yes": "No") << endl;
  return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int k;
    cin >> k;
    while (a >= b && k > 0) {
        b *= 2;
        k--;
    }
    while (b >= c && k > 0) {
        c *= 2;
        k--;
    }
    if (a < b && b < c) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}




int main(void) {

	lli A, B, X;

	cin >> X;

	for (A = -2000; A <= 2000; A++) {
		for (B = -2000; B <= 2000; B++) {
			lli x = pow(A, 5) - pow(B, 5);

			if (x == X) {
				cout << A << " " << B << endl;
				return 0;
			}

		}
	}


	return 0;
}


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

int func(int a, int b){
	if (a % 2 == 1){
		return b;
	}else{
		return func(a/2,b+1);
	}
}

int main(){
	int N;
	cin >> N;
	vector< int > A(N);
	for(int i=0; i<N; i++){
		cin >> A[i];
	}
	int sum = 0;
	for(int i=0; i<N; i++){
		if(A[i] % 2 == 0){
			// cout  << func(A[i], 0) << endl;
			sum += func(A[i], 0);
		}
	}
	cout << sum << endl;


}



Measured memory_bytes: 256
H, W, A, B = (int(i) for i in input().split())

#H, W, A, B = (10, 7, 3, 4)
#H, W, A, B = (2, 3, 1, 1)

def mycomb(n,r):
    return (factorials[n] * pow(factorials[r],MOD-2,MOD) % MOD) * pow(factorials[n-r],MOD-2,MOD) % MOD

MOD = int(1e9 + 7)

factorials = []
factorials.append(1)
for i in range(1, W + H):
    factorials.append((factorials[i - 1] * i) % MOD)

r = 0
for i in range(H - A):
    combination = mycomb(B-1+i, B-1) * mycomb(W+H-B-i-2, W-B-1)
    r += int(combination)

print(r%MOD)


Measured memory_bytes: 11032
#include <iostream>
#include <iomanip>
#include <cassert>

#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <limits>
#include <queue>
#include <unordered_map>
#include <list>
#include <set>
using namespace std;

using ll = long long;

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

template<typename T>
constexpr T gcd(T a, T b)
{
	if (a < b) swap(a, b);

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

int main()
{
	int N;
	cin >> N;

	vector<int> A(N);
	rep(i, N)
	{
		cin >> A[i];
	}

	int ans = A[0];
	rep(i, N)
	{
		ans = gcd(ans, A[i]);
	}

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

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

using ll = long long;
using namespace std;

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  bool ch = false;
  int aa = a, bb = b, cc = c;
  for (int x = 0; x <= k; x++) {
    for (int y = 0; y <= k; y++) {
      int z = k - x - y;
      if (z < 0) {
        continue;
      }
      for (int xx = 0; xx < x; xx++) {
        aa = aa * 2;
      }
      for (int yy = 0; yy < y; yy++) {
        bb = bb * 2;
      }
      for (int zz = 0; zz < z; zz++) {
        cc = cc * 2;
      }
      if (bb > aa && cc > bb) {
        ch = true;
        break;
      }
      aa = a;
      bb = b;
      cc = c;
    }
  }
  if (ch) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 5000;

int main(void){
    string S;
    ll K;
    ll answer;

    cin >> S >> K;
    ll N = S.size();
    set<string> ar;
    
    rep(i, N){
        For(j, i, N){
            string sb = S.substr(i, j - i + 1);
            if ((ll)ar.size() < K || sb < *ar.rbegin()) ar.insert(sb);
            else break;
            while((ll)ar.size() > K) ar.erase(prev(ar.end()));
        }
    } 

    cout << *ar.rbegin() << endl;

    return 0;
}

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

vector<int> g[111111 * 3];
int d[111111 * 3];
int main() {
	int n, m, s, t;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		for (int j = 0; j < 3; j++)
			g[u * 3 + j].push_back(v * 3 + (j + 1) % 3);
	}
	cin >> s >> t;
	s *= 3, t *= 3;
	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> q;
	q.emplace(0, s);
	fill(d, d + n * 3 + 3, 1e9);
	d[s] = 0;
	while (!q.empty() && q.top().second != t) {
		int u = q.top().second;
		q.pop();
		for (int v : g[u]) {
			int l = d[u] + 1;
			if (d[v] > l)
				q.emplace(d[v] = l, v);
		}
	}
	cout << (q.empty() ? -1 : d[t] / 3) << endl;
	return 0;
}



Measured memory_bytes: 18560
import java.util.*;

public class Main {
  public static void main(String[] args) {
    String line = new Scanner(System.in).nextLine();
    int zeros = 0;
    int ones = 0;
    for (int ix = 0; ix < line.length(); ix++) {
      if (line.charAt(ix) == '0') {
          zeros++;
        } else if (line.charAt(ix) == '1') {
          ones++;
        }
    }
    
    System.out.println(2 * Math.min(zeros, ones));
  }
}


Measured memory_bytes: 27824
k = int(input())
def gcd1 (a, b):
    while True:
        if (a < b):
            a, b = b, a
        c = a%b
        if (c == 0):
            return (b)
        else:
            a = b
            b = c

def gcd2 (a, b, c):
    tmp = gcd1(a, b)
    ans = gcd1(tmp, c)
    return (ans)

count = 0
for i in range(k):
    for j in range(i, k):
        for l in range(j, k):
            tmp = gcd2(i + 1, j + 1, l + 1)
            if (i == j == l):
                count = count + tmp
            elif (i == j or j == l):
                count = count + tmp*3
            else:
                count = count + tmp*6
print(count)


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

class Dice
{
private:
  int number[6], q;
  int order, temporary;

public:
  void SetData()
  {
    for(int i = 0; i < 6; i++)
    {
      cin >> number[i];
    }
    cin >> q;
  }

  void Rotation(int a,int b, int c, int d)
  {
    a--;
    b--;
    c--;
    d--;

    temporary = number[a];
    number[a] = number[d];
    number[d] = number[c];
    number[c] = number[b];
    number[b] = temporary;
  }

  int OrderAnswer()
  {
    cin >> order;

    if(order == number[1])
    {
      Rotation(1, 5, 6, 2);
    }
    if(order == number[2])
    {
      Rotation(1, 4, 6, 3);
    }
    if(order == number[3])
    {
      Rotation(1, 3, 6, 4);
    }
    if(order == number[4])
    {
      Rotation(1, 2, 6, 5);
    }
    if(order == number[5])
    {
      Rotation(1, 2, 6, 5);
      Rotation(1, 2, 6, 5);
    }

    cin >> order;

    if(order == number[2])
    {
      Rotation(3, 2, 4, 5);
    }
    if(order == number[3])
    {
      Rotation(4, 2, 3, 5);
    }
    if(order == number[4])
    {
      Rotation(5, 3, 2, 4);
      Rotation(5, 3, 2, 4);
    }

    return number[2];
  }

  void Conclusion()
  {
    for(int i = 0; i < q; i++)
    {
      cout << OrderAnswer() << endl;
    }
  }
};

int main()
{
  Dice dice;

  dice.SetData();
  dice.Conclusion();

  return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////
 
int main(){fastio
    ll x;cin>>x;
    bool dp[7][x+1];
    memset(dp,false,sizeof(dp));
    dp[0][0]=true;
    rep(i,100,105){
        ll k=i-99;
        rep(j,0,x){
            dp[k][j]=dp[k-1][j];
            if(j-i>=0)dp[k][j]|=dp[k][j-i];
        }
    }
    /*for(ll i=0;i<=x;i++){
        cout<<dp[i]<<" ";
    }*/
    cout<<dp[6][x]<<endl;
    
    return 0;
}


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

typedef struct{
  int parent;
  int left;  //左の子
  int right; //右の子
}Node;

int getDepth(Node**, int);
int getHeight(Node**, int);
int getSibling(Node**, int);
int getDegree(Node**, int);

main(){
  int n, i, id, depth, height, sibling, degree;
  Node **tree;

  scanf("%d", &n);
  tree = (Node**)malloc(sizeof(Node*)*n);
  for(i=0; i<n; i++){
    tree[i] = (Node*)malloc(sizeof(Node));
    tree[i]->parent = -1;
  }

  for(i=0; i<n; i++){
    scanf("%d", &id);
    scanf("%d%d", &tree[id]->left, &tree[id]->right);
    if(tree[id]->left != -1){
      tree[tree[id]->left]->parent = id;
    }
    if(tree[id]->right != -1){
      tree[tree[id]->right]->parent = id;
    }
  }

  for(i=0; i<n; i++){
    depth = getDepth(tree, i);
    height = getHeight(tree, i);
    sibling = getSibling(tree, i);
    degree = getDegree(tree, i);
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i, tree[i]->parent, sibling, degree, depth, height);
    
    if(depth == 0) printf("root\n");
    else if(degree == 0) printf("leaf\n");
    else printf("internal node\n");

    }

  return 0;
}

int getDepth(Node **nodes, int p){
  if(nodes[p]->parent == -1) return 0;
  else{
    return 1 + getDepth(nodes, nodes[p]->parent);
  }
}

int getHeight(Node **nodes, int p){
  int right=0, left=0;

  if(nodes[p]->left != -1){
    left = 1 + getHeight(nodes, nodes[p]->left);
  }
  if(nodes[p]->right != -1){
    right = 1 + getHeight(nodes, nodes[p]->right);
  }

  return ((right >= left) ? right : left);
}

int getSibling(Node **nodes, int p){
  int parent = nodes[p]->parent;

  if (parent == -1) return -1;
  else if(nodes[parent]->left != p) return nodes[parent]->left;
  else return nodes[parent]->right;
}

int getDegree(Node **nodes, int p){
  int res = 0;
  
  if(nodes[p]->right != -1) res++;
  if(nodes[p]->left != -1) res++;

  return res;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int ans=0;
	char ch=getchar();
	while(!isdigit(ch))ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
	return ans;
}
int main(){
	int a=read(),b=read(),c=read();
	printf("%d",max(max(a,b),c)-min(min(a,b),c));
	return 0;
}

Measured memory_bytes: 256
from numpy import cumsum

N = int(input())
L = list(map(int, input().split()))

all = sum(L)
cum = list(cumsum(L))

ans = float('inf')
for i in range(N-1):
    tmp = abs(cum[i]-(all-cum[i]))
    ans = min(ans, tmp)
print(ans)

Measured memory_bytes: 34204
import itertools
import math

n,d = map(int,input().split())
x = [list(map(int,input().split())) for i in range(n)]
q = list(itertools.combinations(range(n),2))
cnt = 0
for i in range(len(q)):
    ans = 0
    for j in range(d):
        ans += (x[q[i][0]][j] - x[q[i][1]][j])**2
    ans = math.sqrt(ans)
    if ans == int(ans):
        cnt += 1

print(cnt)

Measured memory_bytes: 9056
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#include <cassert>
//#include <numeric>
#pragma warning(disable:4996) 
 
typedef long long ll;
typedef unsigned long long ull;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
const long long MOD = 998244353;

using namespace std;

ll dp[3005][3005];

void solve()
{
    int n, S;
    scanf("%d%d", &n, &S);

    vector<int> a(n);
    int i,j;
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }

    dp[0][0] = 1;
    for (i = 0; i < n; i++) {
        for (j = 0; j <= S; j++) {
            if (dp[i][j] == 0) continue;
            dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD;

            int j2 = j + a[i];
            if (j2 <= S) {
                int mult = 1;
                if (j == 0) mult = mult * (i+1) %MOD;
                if (j2 == S) mult = mult * (n - i) %MOD;
                dp[i + 1][j2] = (dp[i + 1][j2] + dp[i][j] * mult) % MOD;
            }
        }
    }
    printf("%lld\n", dp[n][S]);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        //printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}



Measured memory_bytes: 70656
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

    double t, x;
    cin >> t >> x;

    cout << setprecision(11) << t / x << endl;

    return 0;
}

Measured memory_bytes: 256
n, m=map(int, input().split())
a=set()
d={}
pena=0
for i in range(m):
    p, s=input().split()
    if s=="AC" and int(p) not in a:
        a.add(int(p))
        if p in d:
            pena+=d.pop(p)
    else:
        if p in d:
            d[p]+=1
        else:
            d[p]=1
print(len(a), pena)

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

int main() {
  int N;
  cin>>N;
  int Z=0,A=0;
  for(int i=0;i<N;i++){
    int a,b;
    cin>>a>>b;
    if(a==b){
      A++;
    }
    else{
      A=0;
    }
    if(A==3){
      Z=1;
      break;
    }
  }
  if(Z){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
		using namespace std;
		typedef long long ll;
		#define PI 3.14159265358979
		#define EPS 1e-8
		#define mod  998244353
		#define fi first
		#define se second
		#define mp make_pair
		#define pb push_back
		#define endl "\n"
			 
		const ll INF=1e15;	
		const int N=2e5+50;
		 

		 
		long long binpow(long long a, long long b, long long m) {
			a %= m;
			long long res = 1;
			while (b > 0) {
				if (b & 1)
					res = res * a % m;
				a = a * a % m;
				b >>= 1;
			}
			return res;
		}
		
		ll modinverse(ll a,ll m)
		{
			return binpow(a,m-2,m);
		}
		
		
		int main()
		{
			ios_base::sync_with_stdio(false);
			cin.tie(NULL);cout.tie(0);
			
			ll a,b,c,d;
			cin>>a>>b>>c>>d;
			ll dp[3005][3005];
			
			for(ll i=0;i<=c;i++)
			{
				for(ll j=0;j<=d;j++)
				{
					dp[i][j]=0;
				}
			}
			dp[a][b]=1;
			
			for(ll i=a;i<=c;i++)
			{
				for(ll j=b;j<=d;j++)
				{
					if(i==a && j==b)
						{dp[i][j]=1;
						continue;}
					
					dp[i][j]=dp[i-1][j]*j;
					dp[i][j]%=mod;
					dp[i][j]+=dp[i][j-1]*i;
					dp[i][j]%=mod;
					
					dp[i][j]-=(dp[i-1][j-1]*(i-1))%mod * (j-1) %mod;
					dp[i][j]+=mod;
					dp[i][j]%=mod;
				}
			}
			cout<<dp[c][d];
			
		}
			
			
		


Measured memory_bytes: 73984
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n;cin>>n;
  double p=0;
  double q=0;
  rep(i, 1, n+1){
    if (i%2==0) p++;
    if (i%2==1) q++;
  }
  printf("%.8f", q/(p+q));
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256