akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
using namespace std;

int main() {
	char S[20];
	string T;
	string p;
	string Q;
	int a = 0;
	int A = 0;
	int b = 0;
	int B = 0;
	int c = 0;
	int C = 0;
	int q, w, z;
	int n = 0;
	int x = 0;
	int y = 0;
	int ans = 0;
	cin >> x >> y;
	if (x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12) {
		x = 1;
	}
	else if (x == 2) {
		x = 2;
	}
	else {
		x = 3;
	}
	if (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12) {
		y = 1;
	}
	else if (y == 2) {
		y = 2;
	}
	else {
		y = 3;
	}
	if (x == y) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}

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

int main() {
  long n,k,ans = 0;
  cin >> n >> k;
  if(k == 0){
    ans = n*n;
    cout << ans << endl;
    return 0;
  }
  for(long b = 1;b <=n;b++){
    if(b-k > 0){
      ans += b-k;
      ans += (n-b)/b*(b-k);
      if((n-b)%b-(k-1) >= 0) ans += (n-b)%b-(k-1);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S=sc.next();
		if(S.equals("SUN")) System.out.println(7);
		if(S.equals("MON")) System.out.println(6);
		if(S.equals("TUE")) System.out.println(5);
		if(S.equals("WED")) System.out.println(4);
		if(S.equals("THU")) System.out.println(3);
		if(S.equals("FRI")) System.out.println(2);
		if(S.equals("SAT")) System.out.println(1);
	}

}


Measured memory_bytes: 21844
#include <iomanip>
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

struct XY {
	double x, y;
};

int N;
vector <XY> pos;

static double calc_maxr(XY center) {
	double maxr = 0.;
	for (int i = 0; i < N; i++) {
		double xd = (center.x-pos[i].x);
		double yd = (center.y-pos[i].y);
		double tmp = xd*xd + yd*yd;
		maxr = max(maxr, tmp);
	}
	return maxr;
}

double searchY(double x) {
	double l = 0, r = 1000;
	for (int i = 0; i < 70; i++) {
		XY p[2];
		p[0].y = (l*2+r*1)/3;
		p[1].y = (l*1+r*2)/3;
		p[0].x = p[1].x = x;

		double dist[2];
		for (int i = 0; i < 2; i++) {
			dist[i] = calc_maxr(p[i]);
		}
		if (dist[0]<dist[1]) {
			r = p[1].y;
		} else if (dist[0]>=dist[1]) {
			l = p[0].y;
		}
	}
	XY xy;
	xy.x = x;
	xy.y = l;
	return calc_maxr(xy);
}


int main(void) {
	cin >> N;
	pos = vector <XY>(N);
	for (int i = 0; i < N; i++) {
		cin >> pos[i].x >> pos[i].y;
	}

	double l = 0, r = 1000;
	for (int i = 0; i < 70; i++) {
		double x[2];
		x[0] = (l*2+r*1)/3;
		x[1] = (l*1+r*2)/3;
		double dist[2];
		for (int i = 0; i < 2; i++) {
			dist[i] = searchY(x[i]);
		}
		if (dist[0]<dist[1]) {
			r = x[1];
		} else if (dist[0]>=dist[1]) {
			l = x[0];
		}
	}
	double ans = sqrt(searchY(l));
	cout << setprecision(10);
	cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <numeric>
#include <cmath>
#include <iostream>
using i64 = long long;
using namespace std;


class ModInt {
public:
  int value;
  static const int mod = 1e9 + 7;
  ModInt() : value(0) {}
  ModInt(int value) {
    this->value = normalize(value);
  }  
  ModInt operator+(ModInt const &other) {
    return ModInt(normalize(this->value + other.value));
  }
  ModInt operator-(ModInt const &other) {
    return ModInt(normalize(this->value - other.value));
  }
  ModInt& operator+=(const ModInt& other) {
      this->value = normalize(this->value + other.value);
      return *this;
}
  int normalize(i64 value) {
    while (value < 0) value += mod;
    value %= mod;
    return value;
  }
};
 
ostream& operator<<(ostream& os, ModInt const &m) {
  os << (m.value);
  return os;
}

const int maxn = 100;
const int maxk = 1e5;
int a[maxn];
ModInt dp[maxn + 1][maxk + 1];
ModInt prefix[maxn + 1][maxk + 1];

int main() {
  int n, K;
  cin >> n >> K;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }

  dp[0][0] = 1;
  
  for (int i = 0; i <= K; i++) 
    prefix[0][i] = 1;

  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= K; j++) {
      int end = j - min(j, a[i]);
      dp[i][j] = prefix[i - 1][j] - (end ? prefix[i - 1][end - 1] : 0);
      prefix[i][j] = (j ? prefix[i][j - 1] : 0) + dp[i][j];
    }
  }
  cout << dp[n][K] << '\n';
}


Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
//typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
int main(){
  int N; cin>>N;
  string s[N];
  map<string, ll> ma;
  rep(i,0,N) cin>>s[i];
  rep(i,0,N) ma[s[i]]++;
  cout<<ma.size()<<endl;
  return 0;
}


Measured memory_bytes: 25400
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  int value = K;
  int result = 1;
  while (true) {
    if (value <= N) {
      value *= K;
      result += 1;
    } else {
      break;
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner obj=new Scanner(System.in);
    int ac=0,wa=0,tl=0,re=0;
    int n=obj.nextInt();
    for(int i=0;i<=n;i++){
      String s=obj.nextLine();
      if(s.equals("AC"))
        ac++;
      else if(s.equals("WA"))
        wa++;
      else if(s.equals("TLE"))
        tl++;
      else if(s.equals("RE"))
        re++;
    }
    System.out.println("AC x "+ac+"\nWA x "+wa+"\nTLE x "+tl+"\nRE x "+re);
}
}

Measured memory_bytes: 61276
cnt = [0 for i in range(26)]
while True:
      try:
            s = input()
      except:
            break
      for i in range(len(s)):
            m = ord(s[i])-ord('A')
            if(m >= 0 and m < 26):
                  cnt[m]+=1
            m = ord(s[i])-ord('a')
            if(m >= 0 and m < 26):
                  cnt[m]+=1
for i in range(26):
      print(chr(i+ord('a')),":",cnt[i])



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

using namespace std;
int n,k;
int ar[100005];
int dp[100005];

int main() {
    //freopen("input.in", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    memset(dp,-1,sizeof dp);
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>ar[i];
    }
    dp[0]=0;
    for(int ind=1;ind<n;ind++){
        int tmp=1e9;
        for(int ik=1;ik<=k;ik++){
            if(ind-ik<0){
                break;
            }
            else{
                tmp=min(tmp,dp[ind-ik]+abs(ar[ind-ik]-ar[ind]));
            }
        }
        dp[ind]=tmp;
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k<=a)
  cout<<k<<"\n";
  else if(k<=a+b)
  cout<<a<<"\n";
  else
  cout<<a-(k-a-b)<<"\n";
  
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const dou pi = 3.14159265358;
const ll mod = 1000000007LL;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;string S;
    cin >> N >> S;
    if(N < 3){
        cout << "0\n";return 0;
    }
    ll U = N * (N - 1) * (N - 2) / 6;
    ll p = 0,Q = U,PcQc = 0;
    ll R = 0,G = 0,B = 0;
    rep(i,N){
        if(S[i] == 'R')R++;
        else if(S[i] == 'G')G++;
        else B++;
    }
    p = R * G * B;
    rep(i,N){
        for(ll j = i + 1;j < N;j++){
            ll k = 2 * j - i;
            if(k < N){
                //cout << i << " " << j << " " << k;
                if(S[i] != S[j] && S[j] != S[k] && S[i] != S[k]){
                    //cout << " " << S[i] << S[j] << S[k];
                    PcQc++;
                }
                //cout << "\n";
            }
        }
    }
    cout << p - PcQc << endl;
    //cout << R <<" "<< G <<" "<< B << "\n";
    //cout << U << " " << Q << endl;
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std; 
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define LINY "YES\n"
#define Liny "Yes\n"
#define LINN "NO\n"
#define Linn "No\n"
#define unordered_map umap
typedef long long ll;
typedef long double ld;
ll min(ll x,ll y){return (x<y ? x:y);}
ll max(ll x,ll y){return (x>y ? x:y);}
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}
bool isPrime(int n){if(n<2){return false;}for(int i=2;i<sqrt(n)+1;i++){if(n%i==0) return false;}return true;}


int main(){
  ll D,G; cin>>D>>G;
  ll p[D];
  ll c[D];
  ll s = 0;
  REP(i,D){
    cin >> p[i] >> c[i];
    s += p[i];
  }
  
  ll hands_min = s;
  for(ll i=0;i<pow(2,D);i++){
    ll temp = i;
    ll score = 0;
    ll hands = 0;
    ll pmax = D-1;
    REPR(j,D-1){
      if(temp&1){
        score += p[j]*100*(j+1)+c[j];
        hands += p[j];
        if(pmax==j){ --pmax;}
      }
      temp = temp>>1;
    }
    if(score<G && pmax>=0){
      ll dif = G-score;
      ll k = (pmax+1)*100;
      ll h_amari = dif/k + (dif%k>0);
      if(h_amari<=p[pmax]){hands += h_amari;}
      else{continue;}
    }
    if(hands<hands_min) hands_min = hands;
  }
  cout<<hands_min<<"\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int         long long
#define ull 		unsigned long long
#define ll 			long long
#define M 			1000000007
#define pb 			emplace_back
#define p_q 		priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios	    	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp 			make_pair
#define lb 			lower_bound
#define ub			upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)	for(ll int i=0;i<n;i++) a[i]=0;
#define cset(a)		__builtin_popcountll(a)
#define hell 		(ull)1e9
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
int n;
bool a[22][22];
int dp[22][1<<21];
int solve(int pos,int mask)
{
	if(pos==n)
	{
		return (mask==((1<<n)-1));
	}
	int &ans=dp[pos][mask];
	if(ans!=-1)
		return ans;
	ans=0;
	rep(i,0,n)
	{
		if(!a[pos][i]) continue;
		if(mask&(1<<i)) continue;
		int nmask=mask|(1<<i);
		ans=(ans+solve(pos+1,nmask))%M;
	} 
	return ans;
}
signed main(void)
{ios 
	memset(dp,-1,sizeof dp);
	cin>>n;
	rep(i,0,n)
	rep(j,0,n)
	cin>>a[i][j];
	cout<<solve(0,0)<<endl;
}

Measured memory_bytes: 360704
#include<bits/stdc++.h>
using namespace std;
struct Node{
   int l,r;
}a[100000+10];
bool cmp(Node a,Node b)
{
    if(a.r==b.r)
        return a.l<b.l;
    return a.r<b.r;
}
int main()
{
    int n,m;scanf("%d%d",&n,&m);
    for(int i = 1;i<=m;++i)
        cin>>a[i].l>>a[i].r;
    sort(a+1,a+1+m,cmp);
    int sum = 1;
    int mi = a[1].r;
    //cout<<mi;
    for(int i = 2;i<=m;++i)
    {
        if(a[i].l>=mi)
        {
            mi = a[i].r;
            sum++;
        }
    }
    cout<<sum<<'\n';
}


Measured memory_bytes: 1024
s = list(raw_input())
K = input()
for i in xrange(len(s)):
    if 123-ord(s[i]) <= K and s[i] != 'a':
        K-=123-ord(s[i])
        s[i] = 'a'
if K > 0:
    s[-1] = chr((ord(s[-1])%97+K%26)%26+97)
print ''.join(s)

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

/*
// ordered_set 
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
# define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
 
using namespace std;
 
typedef long long                                        ll;
typedef long double                                      ld;
typedef pair <int, int>                                  pii;
typedef pair <pii, int>                                  ppi;
typedef pair <int, pii>                                  pip;
typedef pair <pii, pii>                                  ppp;
typedef pair <ll, ll>                                    pll;
 
# define A                                               first
# define B                                               second
# define endl                                            '\n'
# define sep                                             ' '
# define all(x)                                          x.begin(), x.end()
# define kill(x)                                         return cout << x << endl, 0
# define SZ(x)                                           int(x.size())
# define Sort(x)                                         sort(all(x))
# define InTheNameOfGod                                  ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
 
ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));}

//const ll md = 1e9 + 7;//998244353;
const int xn = 1e3 + 10;
const int xm = -20 + 10;
const int SQ = 320;
const int sq = 320 + 10;
const int inf = 1e9 + 10;
const ll INF = 1e18 + 10;
const int Md = 1e9 + 7;
const int TM = 3;
const int Base = 257;

ll n, num[xn], mx = 1, res[2], last, first = inf;
bool mark[xn], flag;
vector <int> vec;

int main(){
    InTheNameOfGod;
    
    cin >> n;
    for (int i = 1; i <= n; ++ i) cin >> num[i];
    for (int i = 1; i <= n; ++ i) if (num[i] > 0) res[i % 2] += num[i];
    flag |= res[1] > res[0];
    for (ll i = 1; i <= n; ++ i) if (i % 2 == flag && num[i] > 0) mark[i] = true, last = i, first = min(first, i);
    if (!last){
    	for (int i = 2; i <= n; ++ i) if (num[i] > num[mx]) mx = i;
    	cout << num[mx] << endl << n - 1 << endl;
    	for (int i = n; i > mx; -- i) cout << i << endl;
    	for (int i = 0; i < mx - 1; ++ i) cout << 1 << endl;
    	return 0;
	}
	cout << res[flag] << endl;
	for (int i = n; i > last; -- i) vec.push_back(i);
	for (int i = 1; i < first; ++ i) vec.push_back(1);
	for (int i = first + 2; i <= last; i += 2){
		if (mark[i]) vec.push_back(2);
		else vec.push_back(3);
	}
	cout << SZ(vec) << endl;
	for (int x : vec) cout << x << endl;
	
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
k, lights = [], []
for i in range(M):
    tmp = [int(j) for j in input().split()]
    k.append(tmp[0])
    lights.append(tmp[1:])
p = [int(i) for i in input().split()]

ans = 0
for switch in range(0, 2**N):
    flag = True
    for i in range(M):
        s = 0
        for j in range(k[i]):
            s += (switch >> (lights[i][j] - 1)) & 0b1
        if s % 2 != p[i]:
            flag = False
    if flag:
        ans += 1

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>
 
using namespace std;
 
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
 
typedef long long ll;
int const inf = 1<<29;
 
constexpr int MOD = 1e9+7;
 
namespace graph { // not verified
 
constexpr int MaxV = 1010;
 
struct scc {
 
  int V = MaxV;
  vector<int> G[MaxV];
  vector<int> rG[MaxV];
  vector<int> vs;
  vector<bool> used;
  vector<int> comp;
  int SCCGraphSize;
 
  scc(): V(MaxV) { comp.resize(MaxV); }
  scc(int V_): V(V_) { comp.resize(MaxV); }
 
  void add_edge(int from, int to) {
    G[from].push_back(to);
    rG[to].push_back(from);
  }
 
  void dfs(int v) {
    used[v] = 1;
    for(auto e: G[v]) {
      if(!used[e]) dfs(e);
    }
    vs.push_back(v);
  }
 
  void rdfs(int v, int k) {
    used[v] = 1;
    comp[v] = k;
    for(auto e: rG[v]) {
      if(!used[e]) rdfs(e, k);
    }
  }
 
  void solve() {
    used.clear(); used.resize(MaxV);
    vs.clear();
    for(int i = 0; i < V; i++) {
      if(!used[i]) dfs(i);
    }
    used.clear(); used.resize(MaxV);
    int k = 0;
    for(int i = vs.size() - 1; i >= 0; i--) {
      if(!used[vs[i]]) rdfs(vs[i], k++);
    }
    SCCGraphSize = k;
  }
 
};
 
}
 
vector<vector<int>> tree;
ll dp[1010];
 
ll solve(int curr, int par) {
  ll& ret = dp[curr];
  if(ret + 1) return ret;
  ret = 1;
  for(auto e: tree[curr]) {
    if(e == par) continue;
    ret *= solve(e, curr);
    ret %= MOD;
  }
  (ret += 1) %= MOD;
  return ret;
}
 
int main() {
 
  int N, M; cin >> N >> M;
  graph::scc scc_graph(N);
  rep(i, M) {
    int S, D; cin >> S >> D; S --, D --;
    scc_graph.add_edge(S, D);
  }
 
  scc_graph.solve();
 
  auto& K = scc_graph.SCCGraphSize;
  auto& g = scc_graph.G;
  auto& comp = scc_graph.comp;
 
  tree.resize(K);
  int deg[1010] = {};
 
  rep(i, N) {
    for(auto e: g[i]) {
      if(comp[i] == comp[e]) continue;
      tree[comp[e]].push_back(comp[i]);
      deg[comp[i]] ++;
    }
  }
 
  rep(i, K) {
    sort(tree[i].begin(), tree[i].end());
    tree[i].erase(unique(tree[i].begin(), tree[i].end()), tree[i].end());
  }
 
  minus(dp);
 
  ll ans = 1;
 
  rep(i, K) if(deg[i] == 0 && dp[i] < 0) {
    ans *= solve(i, -1);
    ans %= MOD;
  }
 
  cout << ans << endl;
   
  return 0;
}

Measured memory_bytes: 3312
/*  I'm a mess, I'm a loser                  */
/*  I'm a hater, I'm a user                  */
/*  I'm a mess for your love, it ain't new   */
/*  I'm obsessed, I'm embarrassed            */
/*  I don't trust no one around us           */
/*  I'm a mess for your love, it ain't new   */

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
             tree_order_statistics_node_update>
    indexed_set;
ll mod=1000000007;
int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
ll t=1;
//cin>>t;
while(t--)
{


ll a;
cin>>a;
float b;
cin>>b;


ll k=((b*100)+0.1);


cout<<(ll)((a*k)/100)<<endl;
}
return 0;
}















Measured memory_bytes: 3748
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
 
	while(kbd.hasNext()) {
	    int n = kbd.nextInt();
	    int a = kbd.nextInt();
	    int b = kbd.nextInt();
	    int c = kbd.nextInt();
	    int x = kbd.nextInt();
	    if(!(n==0 && a==0 && b==0 && c==0 && x==0)){
		solve(n, a, b, c, x);
	    }
	}
    }
 
    static void solve(int n, int a, int b, int c, int x){
	int f=0;//テ」ツ?凝」ツ?凝」ツ?」テ」ツ?淌」ツδ陛」ツδャテ」ツδシテ」ツδ?ヲツ閉ー
	int[] r = new int[n];  //テ」ツδェテ」ツδシテ」ツδォテ、ツケツアテヲツ閉ーテ」ツ?ョテゥツ?催・ツ按?
	int i;   //テ、ツスツ愿ヲツ・ツュテァツ板ィ
	for(i=0; i<n; i++){      //テ、ツケツアテヲツ閉ーテヲツ板セテ」ツつ甘ィツセツシテ」ツつ?
	    r[i] = kbd.nextInt();
	}
 
	i=0;
	while(f<=10000 && i<n){
	    if(r[i]==x){
		i++;
	    }
	    x = (a*x+b)%c;
	    f++;
	}
	
	if(i==n){
	    System.out.println(f-1);
	}
	else{
	    System.out.println("-1");
	}
    }
}

Measured memory_bytes: 12000
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(S: str):
    ret = 'x' * len(S)
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


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

string s;

int main() {
  cin >> s;
  if(s.size() % 2 == 1) {
    cout << "No" << endl;
    return 0;
  }
  for(int i = 0; i < (int)s.size() - 1;) {
    if(s[i] == 'h' && s[i + 1] == 'i')
      i += 2;
    else {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
  return 0;
}

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

int n,m,l;
vector<int> a,b,c;
bool input(){
  a=b=c=vector<int>(20,0);
  cin>>n>>m>>l;
  if(n==0&&m==0&&l==0)return false;
  for(int i=0;i<l;i++){
    string tmp;
    cin>>tmp;
    switch(tmp[0]){
      case 'a':
        a[tmp.size()-1]++;
        break;
      case 'b':
        b[tmp.size()-1]++;
        break;
      case 'c':
        c[tmp.size()-1]++;
        break;
    }
  }
  return true;
}
typedef long long ll;
ll nCk(int n,int k){
  if(n<k){
    return 0;
  }
  ll res = 1;
  for(int i=n-k+1;i<=n;i++)res*=i;
  for(int i=1;i<=k;i++)res/=i;
  return res;
}


bool check_sub(vector<int> h,int ai,int bi,int ci){
  vector<int> need(20,0);
  for(int i=0;i<a.size();i++){
    need[h[ai]+i] += a[i];
    need[h[bi]+i] += b[i];
    need[h[ci]+i] += c[i];
  }
  vector<int> now(20,0);
  for(int i=0;i<h.size();i++){
    now[h[i]]++;
  }
  for(int i=0;i<need.size();i++){
    if(need[i]>now[i])return false;
    if(now[i]>n)return false;
  }
  return true;
}

bool check(vector<int> h){
  for(int i=0;i<h.size();i++){
    for(int j=0;j<h.size();j++){
      for(int k=0;k<h.size();k++){
        if(check_sub(h,i,j,k))return true;;
      }
    }
  }
  return false;
}

ll count(vector<int> h,int b){
  vector<int> now(20,0);
  for(int i=0;i<h.size();i++){
    now[h[i]]++;
  }
  ll res = 1;
  for(int i=0;i<now.size();i++){
    res*=nCk(n,now[i]);
  }
  const int arr = m - (h[h.size()-1]-b+1) + 1;
  res *= nCk(arr,b+1);
  return res;
}

vector<int> hands;
ll req(int n,int b){
  if(!(hands[n]<m))return 0;
  if(n==hands.size()-1){
    if(check(hands)){
      return count(hands,b);
    }else{
      return 0;
    }
  }
  ll res = 0;
  hands[n+1] = hands[n];
  res += req(n+1,b);
  hands[n+1] = hands[n]+1;
  res += req(n+1,b);
  hands[n+1] = hands[n]+2;
  res += req(n+1,b+1);
  return res;
}
ll solve(){
  hands = vector<int>(l);
  hands[0]=0;
  return req(0,0);
}


int main(){
  while(input()){
    long long ans = solve();
    cout<<fixed<<setprecision(10)<<((double)ans)/nCk(n*m,l)<<endl;
  }
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;

const int  mod = 1e9 + 7;
const int e = 2000 + 69;
const int base = 311;

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


int main()
{

     ll n;
     cin >> n;
     cout << n/2 + n%2;
}


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

int main() {
  string S;
  cin >> S;
  int A,B;
  A = S.size();
  B = A/2;
  int count = 0;
  for(int i = 1; i < B+1; i++){
      if(S.at(i-1) != S.at(A-i)){
          count++;
      }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#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;

const int S = 444;
int dp[S][S];

int main(){
  int n,ma,mb;
  cin >> n >> ma >> mb;

  memset(dp,-1,sizeof(dp));
  dp[0][0] = 0;
  rep(i,n){
    int a,b,c;
    cin >> a >> b >> c;
    rrep(j,S){
      if(j+a >= S) continue;
      rrep(k,S){
	if(k+b >= S) continue;
	if(dp[j][k] < 0) continue;
	if(dp[j+a][k+b]<0 or dp[j+a][k+b] > dp[j][k] + c){
	  dp[j+a][k+b] = dp[j][k] + c;
	}
      }
    }
  }

  int ans = -1;
  rep(j,S){
    rep(k,S){
      if(j!=0 and k!=0 and j*mb == k*ma){
	if(dp[j][k]<0) continue;
	if(ans < 0 or ans > dp[j][k]) ans = dp[j][k];
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>
#include <cctype>
#include <cmath>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */
const int INF = 1 << 30;
const int MAX = 500000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
struct Node {
    Node *parent, 
         *left, 
         *right;
    int key;
};

Node *root, *NIL;

/* function */
void insert(int value);
Node* find_bin_tree(int target);
void preorder(Node* v);
void inorder(Node* v);

/* main */
int main(){

    // main
    int n, val;
    cin >> n;
    string man;
    for (int i = 0; i < n; i++) {
        cin >> man;
        if (man == "print") {
            inorder(root); cout << '\n';
            preorder(root); cout << '\n';
        }
        else {
            cin >> val;
            if (man == "insert") {
                insert(val);
            }
            else {
                Node* ret_node = find_bin_tree(val);
                if (ret_node != NIL)
                    cout << "yes" << '\n';
                else
                    cout << "no" << '\n';
            }
        }
    }

}

Node* find_bin_tree(int target) {

    Node* x = root;
    while (x != NIL) {
        if (target == x->key) {
            return x;
        }
        else if (target < x->key) {
            x = x->left;
        }
        else {
            x = x->right;
        }
    }
    return x;
}

void insert(int value) {

    // init Node
    Node* z = new Node();
    z->parent = NIL;
    z->left = NIL;
    z-> right = NIL;

    Node* y = NIL;  // parent of x(root)
    Node* x = root; // root of 'T'

    while (x != NIL) {
        y = x; // set parent
        if (value < x->key) {
            x = x->left;
        }
        else {
            x = x->right;
        }
    }

    z->parent = y;
    z->key = value;

    if (y == NIL) {  // 'T' is empty
        root = z;
    }
    else if (value < y->key) {
        y->left = z;  // z is y's left
    }
    else if (value > y->key) {
        y->right = z;  // z is y's right
    }
}

void preorder(Node* v) {
    if (v != NIL) {
        cout << ' ' << v->key;
        preorder(v->left);
        preorder(v->right);
    }

}

void inorder(Node* v) {
    if (v != NIL) {
        inorder(v->left);
        cout << ' ' << v->key;
        inorder(v->right);
    }
}



Measured memory_bytes: 21904
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;

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

long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}


int main(){
    int N;
    cin >> N;
    int i;
    int a = 1;
    for(i=0;i<=100000;i++){
        if(int(i*1.08)==N){
            cout << i << endl;
            a = 0;
            break;
        }
    }
    if(a==1)cout <<":(" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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

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) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

template<int mod>
struct Modint{
    int x;
    Modint():x(0){}
    Modint(int64_t y):x((y%mod+mod)%mod){}

    Modint &operator+=(const Modint &p){
			if((x+=p.x)>=mod)
				x -= mod;
			return *this;
		}

		Modint &operator-=(const Modint &p){
			if((x+=mod-p.x)>=mod)
				x -= mod;
			return *this;
		}

		Modint &operator*=(const Modint &p){
			x = (1LL * x * p.x) % mod;
			return *this;
		}

		Modint &operator/=(const Modint &p){
			*this *= p.inverse();
			return *this;
		}

		Modint operator-() const { return Modint(-x); }
		Modint operator+(const Modint &p) const{
			return Modint(*this) += p;
		}
		Modint operator-(const Modint &p) const{
			return Modint(*this) -= p;
		}
		Modint operator*(const Modint &p) const{
			return Modint(*this) *= p;
		}
		Modint operator/(const Modint &p) const{
			return Modint(*this) /= p;
		}

		bool operator==(const Modint &p) const { return x == p.x; }
		bool operator!=(const Modint &p) const{return x != p.x;}

		Modint inverse() const{//非再帰拡張ユークリッド
			int a = x, b = mod, u = 1, v = 0;
			while(b>0){
				int t = a / b;
				swap(a -= t * b, b);
				swap(u -= t * v, v);
			}
			return Modint(u);
		}

		Modint pow(int64_t n) const{//繰り返し二乗法
			Modint ret(1), mul(x);
			while(n>0){
				if(n&1)
					ret *= mul;
				mul *= mul;
				n >>= 1;
			}
			return ret;
		}

		friend ostream &operator<<(ostream &os,const Modint &p){
			return os << p.x;
		}
};

using modint = Modint<mod>;


void solve()
{
	ll x;
	cin>>x;
	for(ll i=1;;++i){
		if(i*360%x==0){
			cout<<(i*360)/x;
			return;
		}
	}
}

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


Measured memory_bytes: 3576
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,m = readInts()
cnt = 0
if m //2 >= n:
    cnt += n
    m -= n * 2
else:
    cnt += m//2
    n -= m//2
    m -= m
cnt += m//4 # if のとき
print(cnt)


Measured memory_bytes: 3316
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int H,W,K;
    cin >> H >> W >> K;
    int sx,sy,gx,gy;
    cin >> sy >> sx >> gy >> gx;
    sx--;sy--;gx--;gy--;
    vector<string> G(H);
    for(int i=0; i<H; i++) cin >> G[i];
    queue<P> que;
    que.emplace(sy,sx);
    vector<vector<int>> dist(H,vector<int> (W,inf));
    dist[sy][sx] = 0;
    while(que.size()){
        int y,x;
        tie(y,x) = que.front();
        que.pop();
        for(int d=0; d<4; d++){
            for(int k=1; k<=K; k++){
                ll ny = y + dy[d] * k;
                ll nx = x + dx[d] * k;
                if(ny<0 || ny>=H || nx<0 || nx>=W) break;
                if(G[ny][nx] == '@') break;
                if(dist[ny][nx] <= dist[y][x]) break;
                if(dist[ny][nx] == inf){
                    dist[ny][nx] = dist[y][x] + 1;
                    que.emplace(ny,nx);
                }
            }
        }
    }
    if(dist[gy][gx] == inf){
        cout << -1 << "\n";
    }else{
        cout << dist[gy][gx] << "\n";
    }
    return 0;
}

Measured memory_bytes: 12132
str_list = list(input())
for i in range(len(str_list)):
    str_list.pop()
    if len(str_list) % 2==0:
        if str_list[:(int(len(str_list)/2))] == str_list[-(int(len(str_list)/2)):]:
            print(len(str_list))
            break
        else:
            pass
    else:
        pass

Measured memory_bytes: 3060
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 1000000000;
const int mod = 1e9+7;
const int maxn = 2e5+5;
int num[maxn]; 
int main() {
	ll n;
	cin>>n;
	for(ll i=0;i<1000;i++){
		for(ll j=0;j<=1000;j++){
			ll p1 = i*i*i*i*i;
			ll p2 = j*j*j*j*j;
			if(p1+p2==n){
				cout<<i<<" "<<j*(-1LL)<<endl;
				return 0;
			}else if(p1-p2==n){
				cout<<i<<" "<<j<<endl;
				return 0;
			}
		}
	}
    return 0;
}



Measured memory_bytes: 3624
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}

int main() {
	llint n, m;
	cin >> n >> m;
	vpllint lr(m);
	rep(i, m) {
		cin >> lr[i].first >> lr[i].second;
	}
	llint l = 1, r = n;
	rep(i, m) {
		l = max(l, lr[i].first);
		r = min(r, lr[i].second);
	}
	if (r - l + 1 < 0)cout << 0 << endl;
	else cout << r - l + 1 << endl;
	return 0;
}


Measured memory_bytes: 1792
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    h, w = list(map(int, readline().split()))
    a = [[True] * w for _ in range(h)]
    ql = collections.deque()
    for i in range(h):
        s = list(str(readline().rstrip().decode('utf-8')))
        for j in range(w):
            if s[j] == "#":
                ql.append([0, i, j])
                a[i][j] = False
    while ql:
        cost, x, y = ql.popleft()
        for xv, yv in ((x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)):
            if 0 <= xv < h and 0 <= yv < w:
                if a[xv][yv]:
                    ql.append([cost + 1, xv, yv])
                    a[xv][yv] = False
    print(cost)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 145628
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;
#define ll long long

int main(){

    int n; cin >> n;

    ll a[n+1], b[n];
    for(int i=0; i<=n; i++){
        cin >> a[i];
    }
    for(int i=0; i<n; i++){
        cin >> b[i];
    }

    ll ans = 0;
    for(int i=0; i<n; i++){
        if(a[i] <= b[i]){
            b[i] -= a[i];
            ans += a[i];
            a[i] = 0;
            if(a[i+1] <= b[i]){
                b[i] -= a[i+1];
                ans += a[i+1];
                a[i+1] = 0;
            }
            else{
                a[i+1] -= b[i];
                ans += b[i];
                b[i] = 0;
            }
        }
        else{
            a[i] -= b[i];
            ans += b[i];
            b[i] = 0;
        }

        // cout << a[0] << " " << a[1] << " " << a[2] << endl;
    }

    cout << ans;

    return 0;
}

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

int color[200000];

int n,m;
vector<vector<int>> v(200000);
/*
bool dfs(int nn, int pre, int c){
    for(int x:v[nn]){
        if(x==pre) continue;
        if(color[x]==-1) color[x]=1-c;
        //if(color[x]!=c) continue;
        if(color[x]==c) return false;
        
        if(!dfs(x,nn,color[x])) return false;
    }

    return true;
}*/

bool dfs(int vv,int c){
    color[vv]=c;
    for(auto x:v[vv]){
        if(color[x]==c) return false;
        if(color[x]==0 && !dfs(x,-c)) return false;
    }
    return true;
}


signed main(){
    cin >> n >> m;
    memset(color,0,sizeof(color));
    rep(i,m){
        int aa,bb;
        cin >> aa >> bb;
        v[aa-1].push_back(bb-1);
        v[bb-1].push_back(aa-1);
    }

    //color[0]=0;
    rep(i,n){
        if(color[i]==0){
            if(!dfs(i,1)){
                cout << ((n*(n-1))/2)-m << endl;
                return 0;
            }
        }
    }


    int white=0;
    int black=0;
    rep(i,n){
        if(color[i]==1) white++;
        else black++;
    }
    //cout << white << black << endl;
    cout << white*black-m << endl;
    


    


}

Measured memory_bytes: 10624
#include<cstdio>
#include<algorithm>
int g[101][101],a[1000],b[1000],c[1000];
int const infty=10000000;
int main(){
  int n,m,answer=0;
  scanf("%d%d",&n,&m);
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      g[i][j]=infty;
    }
  }
  for(int i=0;i<m;i++){
    scanf("%d%d%d",&a[i],&b[i],&c[i]);
    g[a[i]][b[i]]=g[b[i]][a[i]]=c[i];
  }
  for(int k=1;k<=n;k++){
    for(int i=1;i<=n;i++){
      for(int j=1;j<=n;j++){
        g[i][j]=std::min(g[i][k]+g[k][j],g[i][j]);
      }
    }
  }
  for(int i=0;i<m;i++){
    bool use=false;
    for(int j=1;j<=n;j++){
      if(j==a[i]||j==b[i]){
        if(c[i]==g[a[i]][b[i]])use=true;
      }else if(g[a[i]][j]==c[i]+g[b[i]][j])use=true;
    }
    if(!use)answer++;
  }
  printf("%d",answer);
  return 0;
}

Measured memory_bytes: 256
/*@author hussein zayed ;
    ___  ___
   |\  \|\  \
   \ \  \_\  \
    \ \   ___ \USSEIN
     \ \  \\ \ \
      \ \__\\ \_\
       \|__| \|__|
****************************************
*/

#include <bits/stdc++.h>
using namespace std;
#define fr for(int i=0;i<n;++i)
#define fr1 for(int i=1;i<=n;++i)
#define cinA for(int i=0;i<n;++i){cin>>arr[i];}
#define cinA1 for(int i=1;i<=n;++i){cin>>arr[i];}
#define coutA for(int i=0;i<n;++i){cout<<arr[i]<<" ";}
#define ll long long
#define lnarray sizeof(arr)/sizeof(*arr)
#define vi vector<int>
#define vs vector<string>
void Fast()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
inline int RD()
{
    int i ;
    cin>>i;
    return i;
}

inline float RF()
{
    float i ;
    cin>>i;
    return i;
}

inline double RDO()
{
    double i ;
    cin>>i;
    return i;
}

inline string RS()
{
    string i ;
    cin>>i;
    return i;
}

inline ll RLL()
{
    ll i ;
    cin>>i;
    return i;
}

int cm[200000];

ll sumSet(ll n)
{
    return (1ll*n*(n+1))/2;
}
string s;


bool isPrime(int n)
{
    if(n==1)
        return false;
    for(int i=2; i*i<=n; ++i)
    {
        if(n%i==0)
            return false;
    }
    return true;
}
int sumDigit(int n){
int sum =0;
  while (n != 0)
    {
        sum+= + n % 10;
        n = n / 10;
    }
    return sum;
}

ll power2(int n){
  ll ans=(1<<n);
  return ans;
}

ll sumpow2(ll n){
 ll sum=(n*(n+1)*(2*n-1))/6;
 return sum;
}
char arr[101][101];
int main(){
    Fast();
//freopen("output.txt" , "w" , stdout);
//freopen("wall.in" , "r" , stdin);



   int a=RD(),n;
   n=a/15;
   cout<<(a*800)-(n*200);

}


Measured memory_bytes: 256