akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author __shangu__
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DPartition solver = new DPartition();
        solver.solve(1, in, out);
        out.close();
    }

    static class DPartition {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int[] fa = new int[1000010];
            int qt = 0;
            double eps = 1e-6;
            for (int i = 1; i <= Math.sqrt(m) + eps; ++i) {
                if (m % i == 0) {
                    fa[qt++] = i;
                    fa[qt++] = m / i;
                }
            }
            Arrays.sort(fa, 0, qt);
            for (int i = qt - 1; i >= 0; --i) {
                if (m / fa[i] >= n) {
                    out.println(fa[i]);
                    return;
                }
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

const int mod = 1e9 + 7;

vector<int> divisors(int n) {
    vector<int> res;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i * i != n) {
                res.push_back(n / i);
            }
        }
    }
    sort(res.begin(), res.end());
    return res;
}

int add(int a, int b) {
    return (a += b) >= mod ? a - mod : a;
}

int mul(int a, int b) {
    return 1LL * a * b % mod;
}

template<class... T>
int mul(int a, T... b) {
    return mul(a, mul(b...));
}

int modpow(int a, long long b) {
    int res = 1;
    for (; b > 0; a = mul(a, a), b >>= 1) {
        if (b & 1) {
            res = mul(res, a);
        }
    }
    return res;
}

int main() {
    int n, K;
    cin >> n >> K;
    vector<int> ds = divisors(n);
    vector<int> dp(ds.size());
    for (int i = 0; i < ds.size(); i++) {
        dp[i] = modpow(K, (ds[i] + 1) / 2);
        for (int j = 0; j < i; j++) {
            if (ds[i] % ds[j] == 0) {
                dp[i] = add(dp[i], mod - dp[j]);
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < ds.size(); i++) {
        if (ds[i] % 2 == 0) {
            ans = add(ans, mul(dp[i], ds[i], (mod + 1) / 2));
        } else {
            ans = add(ans, mul(ds[i], dp[i]));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>
#include <iomanip>
#include <map>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(nullptr);
#define fix(n) fixed << setprecision(n)
#define ALL(v) v.begin(),v.end()

#define PI 3.14159265358979323846;

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;


int main(void){
    FAST_IO
    ll x;
    cin >> x;

    ll n = 100;
    ll count = 0;
    while(n < x){
        n += n / 100;
        count++;
    }
    
    cout << count << endl;
}

Measured memory_bytes: 3084
#include<stdio.h>
int main()
{
    int i,n;

    scanf("%d",&n);

    if(n>=1 && n<=20){
    long long f=1;
    for(i=1;i<=n;i++)
        {
        f=f*i;
        }

    printf("%lld\n",f);
    }

    return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int small_ans(int n, vi d){
	vi cnt(12);
	cnt[0]++;
	rep(i, n) cnt[d[i]]++;
	if(cnt[0] > 1) return 0;
	for(int i = 1; i < 12; i++) if(cnt[i] > 2) return 0;
	return 1;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n;
	vi d(n); rep(i, n) cin >> d[i];
	
	if(n >= 12){ // ans <= 1
		cout << small_ans(n, d) << endl;
		return 0;
	}
	
	int ans = 0;
	rep(bit, 1 << n){
		vi v(1);
		rep(i, n) v.pb(bit >> i & 1 ? d[i] : (24 - d[i]) % 24);
		sort(all(v));
		int mn = 24;
		rep(i, v.size()){
			int diff = abs(v[i] - v[(i + 1) % v.size()]);
			mn = min(mn, min(diff, 24 - diff));
		}
		ans = max(ans, mn);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100000

int A[MAX], n;

int partition(int p, int r) {
  int x, i, j, t;
  x = A[r];
  i = p-1;
  for(j=p; j<r; j++) {
    if(A[j] <= x) {
      i++;
      t=A[i]; A[i]=A[j]; A[j]=t;
    }
  }
  t=A[i+1]; A[i+1]=A[r]; A[r]=t;
  return i+1;
}

int main(void) {
  int i, q;

  scanf("%d", &n);
  for(i=0; i<n; i++) scanf("%d",&A[i]);
  q = partition(0,n-1);

  for(i=0; i<n; i++) {
    if(i) printf(" ");
    if(i==q) printf("[");
    printf("%d",A[i]);
    if(i==q) printf("]");
  }
  printf("\n");

  return 0;
}


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

using namespace std;

int main() {
    while (true) {
        int sum;
        cin >> sum;
        if (sum == 0) break;
        for (int i = 0; i < 9; ++i) {
            int cost;
            cin >> cost;
            sum -= cost;
        }
        cout << sum << '\n';
    }
    return 0;
}


Measured memory_bytes: 3076
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <numeric>
#include <queue>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
#define vein(v, n)                                                             \
    for(int i = 0; i < n; i++) {                                               \
        cin >> v[i];                                                           \
    }
using namespace std;
typedef long long ll;
// const long long INF = 1LL << 60;
const long long INF = 2147483647; // 2^31-1
int N;
vector<ll> v;
void update(int i, ll x) {
    i += N - 1;
    v[i] = x;
    while(i > 0) {
        i = (i - 1) / 2;
        v[i] = min(v[i * 2 + 1], v[i * 2 + 2]);
    }
}

ll query(int a, int b, int k, int l, int r) {
    //[a,b)区間について
    // ノード k （区間 [l, r) 担当）が答える
    if(r <= a || l >= b) {
        return INF;
    }
    if(a <= l && r <= b) {
        return v[k];
    } else {
        ll c1 = query(a, b, 2 * k + 1, l, (l + r) / 2);
        ll c2 = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return min(c1, c2);
    }
}

int main() {
    int n, q;
    cin >> n >> q;
    N = 1;
    while(N < n) {
        N *= 2;
    }
    v.assign(2 * N - 1, INF);
    vector<ll> cs(q);
    vector<pair<ll, ll>> nums(q);

    rep(i, 0, q) { cin >> cs[i] >> nums[i].first >> nums[i].second; }
    rep(i, 0, q) {
        if(cs[i] == 0) {
            update(nums[i].first, nums[i].second);
        } else {
            cout << query(nums[i].first, nums[i].second + 1, 0, 0, N) << endl;
        }
    }
}


Measured memory_bytes: 7240
#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> // fixed, setprecision 
#include <math.h> // double sqrt
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    vector<int>L(m);
    vector<int>R(m);
    rep(i,m)cin>>L[i]>>R[i];
    int maxl=0,minr=100001;
    rep(i,m){maxl=max(maxl,L[i]);minr=min(minr,R[i]);}
    int i=0;

   if(maxl<=minr)cout<<minr-maxl+1;
   else cout<<0;
   return 0;
}

Measured memory_bytes: 1024
SEL = 0
A = [[int(j) for j in input().split(' ')] for i in range(3)]
N = int(input())
for _ in range(N):
  b = int(input())
  for i in range(3):
    for j in range(3):
      if b == A[i][j]:
        A[i][j] = SEL
 
if (A[0][0] == A[0][1] == A[0][2] == SEL or
    A[1][0] == A[1][1] == A[1][2] == SEL or
    A[2][0] == A[2][1] == A[2][2] == SEL or 
    A[0][0] == A[1][0] == A[2][0] == SEL or
    A[0][1] == A[1][1] == A[2][1] == SEL or
    A[0][2] == A[1][2] == A[2][2] == SEL or
    A[0][0] == A[1][1] == A[2][2] == SEL or
    A[0][2] == A[1][1] == A[2][0] == SEL):
  print('Yes')
else:
  print('No')

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

using namespace std;
int n;
pair<int,int> jobs[200005];

bool cmp(const pair<int,int> &a,const pair<int,int>& b)
{
    return a.second < b.second;
}

int main()
{
    scanf("%d",&n);int a,b;
    for(int i=0;i<n;++i)
    {
        scanf("%d%d",&jobs[i].first,&jobs[i].second);
    }
    sort(jobs,jobs+n,cmp);
    long long now = 0;
    bool ok = true;
    for(int i=0;i<n;++i)
    {
        now += jobs[i].first;
        if(now>jobs[i].second)
        {
            ok = false;break;
        }
    }
    if(ok)printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
	#define se second
	#define endl "\n"
	#define pii pair<int, int>
	#define vi vector<int> 
	#define vvi vector<vi>
	#define REP(i,n) for(int i=0;i<n;i++)
	#define FOR(i,a,b) for(int i=a;i<=b;i++)
	#define FORR(i,a,b) for(int i=a;i>=b;i--)
	#define ALL(c) (c).begin(),()c.end() 

	#define PI 3.14159265358979323846
	const int N = 500 + 10;  
   

   int sum;
   void solve() {
	    int a,b;
        cin>>a>>b;
        
        if(a>=13)
         sum=b;
        else if(a>=6 && a<=12)
         sum=b/2;
       
       
       cout<<sum; 
          
         
	  
	   }
   
   
   
      int32_t main() {
	    cool;
	    int t=1;
	    while(t--)
	       solve();
	       
	       
	       return 0;	   
	   }


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

 int main() {
   int N; cin >> N;
   int a[N];
   int ans = 0;
   for (int i = 0; i < N; i++) {
     cin >> a[i];
     ans += a[i] - 1;
   }
   cout << ans << endl;
   return 0;
 }


Measured memory_bytes: 256
def solve():
    N = int(input())
    S = input()
    C = [c for c in S]

    left = 0
    right = len(C) -1
    ans = 0
    while left < right:
        while left < right and C[left] == 'R':
            left += 1
        while left < right and C[right] == 'W':
            right -= 1
        if left < right:
            C[left] = 'R'
            C[right] = 'W'
            ans += 1
            left += 1
            right -= 1
    print(ans)

if __name__ == "__main__":
    solve()

Measured memory_bytes: 10900
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int t[105];
int d[105];
int p[105];
int x[105];
int res[105];
int32_t main(){
	int n;cin>>n;
	for(int i=1;i<=n;i++) cin>>t[i];
	int sum = accumulate(t+1,t+n+1,0);
	int m;cin>>m;
	for(int i=1;i<=m;i++){
		cin>>p[i]>>x[i];
		res[i]=sum-t[p[i]]+x[i];
	}
	for(int i=1;i<=m;i++) cout<<res[i]<<"\n";
}


Measured memory_bytes: 256
//哇哈哈哈哈哈哈哈哈哈哈哈
/*宇宙最强程序
  the best system in space
  */
//下面请欣赏本人临时作诗一首
//《登鹳雀楼》 
#include <iostream>
#include <float.h>
#include <cfloat>
#include <string>
#include <ctype.h>
#include <algorithm>
#include <errno.h>
#include <cerrno>
#include <assert.h>
#include <cassert> 
#include <map>
#include <memory.h>
#include <cctype>
#include <ctype.h>
#include <math.h>
#include <vector> 
#include <cstdio> 
#include <set>
#include <string.h>
#include <stdio.h>
#include <new>
#include <memory>
#include <cmath>
#include <queue>
#include <cstring>
//白日依山尽 
#define ll long long
#define fo(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define br break
#define ct continue
#define pb push_back
#define mp make_pair 
#define pi 3.141592653589793238462643383279502884197169
#define F first
#define S second
#define pii pair<int,int>  
#define em empty()
#define vei vector<int>
#define ves vector<string>
#define qui queue<int> 
#define qu queue
//黄河入海流 
using namespace std;
int main()
{int a;
 cin>>a;
 string s;
 cin>>s;
 int b;
 cin>>b;
 //欲穷千里目 
 if(s=="+")
 cout<<a+b<<endl;
 else
 cout<<a-b<<endl; 
 system("pause");
 return 0;
}
 //更上一层楼 

Measured memory_bytes: 504
#include <bits/stdc++.h>
    using namespace std;
     
    int main(){
    	string A,B;cin>>A>>B;
    	A=A+B;
    	int G=stoi(A);
    	for(int i=1;i<=1000;i++){
    		if(i*i==G) {
    			cout<<"Yes"<<endl;
    			return 0;
    		}
    	}
    	cout<<"No"<<endl;
    	return 0;
    }

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
  string S;
  cin >> S;
  if (S == "AAA" || S == "BBB") {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int N;
  cin >> N;
  int A[N];
  long long base(0);
  for(int i = 0 ; i < N ; ++i)
  {
    cin >> A[i];
  }
  for(int i = 1 ; i < N ; ++i)
  {
    if (A[i] < A[i-1])
    {
      base += A[i-1] - A[i];
      A[i] = A[i-1];
    }
  }
  cout << base << endl;
  return 0;
}

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

int main() {
  int N,K;
  cin>>N>>K;
  
  vector<int> vec(N);
  for (int i=0;i<N;i++) {
    cin >> vec.at(i);
  }
  int A=0;
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  for (int i=0;i<K;i++) {
    A+=vec.at(i);
  }
cout << A << endl;    
}


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

const int N = 101010;
typedef long long ll;

inline char get(void) {
	static char buf[100000], *S = buf, *T = buf;
	if (S == T) {
		T = (S = buf) + fread(buf, 1, 100000, stdin);
		if (S == T) return EOF;
	}
	return *S++;
}
template<typename T>
inline void read(T &x) {
	static char c; x = 0;
	for (c = get(); c < '0' || c > '9'; c = get());
	for (; c >= '0' && c <= '9'; c = get()) x = x * 10 + c - '0';
}

long long n, L, T, bg, dis, delta, f1;
int x[N], w[N];
int f[N], ans[N];

int main(void) {
	read(n); read(L); read(T);
	for (int i = 1; i <= n; i++) {
		read(x[i]); read(w[i]);
		if (w[i] == 1) f[i] = (x[i] + T) % L;
		else f[i] = (x[i] - T % L + L) % L;
	}
	f1 = f[1]; T <<= 1;
	sort(f + 1, f + n + 1);
	for (int i = 2; i <= n; i++)
		if (w[i] ^ w[1]) {
            if (w[1] == 1) dis = T - x[i] + x[1] - 1;
			else dis = T - L + x[i] - x[1] - 1;
			delta += (dis < 0 ? 0 : (dis / L + 1));
		}
	if (w[1] == 2) delta = (n - delta % n) % n;
	bg = delta % n + 1;
	if (w[1] == 1) f1 = upper_bound(f + 1, f + n + 1, f1 - 1) - f;
	else f1 = upper_bound(f + 1, f + n + 1, f1) - f - 1;
//	f1 = lower_bound(f + 1, f + n + 1, f1) - f;
	for (int i = 1; i <= n; i++) {
		ans[bg] = f[f1];
		bg = bg % n + 1;
		f1 = f1 % n + 1;
	}
	for (int i = 1; i <= n; i++) printf("%d\n", ans[i]);
	return 0;
}

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

int main() {
    string s; cin >> s;
    string ans;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '0') ans += s[i];
        else if (s[i] == '1') ans += s[i];
        else {
            if (ans.empty()) continue;
            else ans.erase(ans.end() - 1);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned int;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define all(c) c.begin(),c.end()
#define si(x) int(x.size())
#define pb emplace_back
#define fs first
#define sc second
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<class T,class U> void chmax(T& x, U y){if(x<y) x=y;}
template<class T,class U> void chmin(T& x, U y){if(y<x) x=y;}
template<class T> void mkuni(V<T>& v){sort(all(v));v.erase(unique(all(v)),v.end());}
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
void dmpr(ostream& os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ~ ";
	dmpr(os,args...);
}
#define shows(...) cerr << "LINE" << __LINE__ << " : ";dmpr(cerr,##__VA_ARGS__)
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) void(0)
#define dump(x) void(0)
#define shows(...) void(0)
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);

	ll x; cin >> x;
	cout << (x/11)*2 + (x%11 ? 1 : 0) + (x%11>6 ? 1 : 0) << endl;
}


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



int main() {
	int n;
	cin >> n;
	ll dp[90];
	dp[0] = 2, dp[1] = 1;
	for(int i = 2; i <=n; i++){
		dp[i] = dp[i-1] + dp[i-2];
	}
	cout << dp[n] << endl;
	return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int wcount = 0;
  int rr = 0;
  rep(i, n) if (s[i] == 'W') wcount++;
  rep(i, wcount) if (s[n-i-1] == 'R') rr++;
  cout << rr << endl;
  
  return 0;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

int main()
{
  vecint v(3);
  cin>>v[0]>>v[1]>>v[2];
  sort(ALL(v));
  if (v[2] != v[0]) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int p, q, r; cin >> p >> q >> r;
  cout << min({p + q, q + r, p + r}) << '\n';
  return 0;
}


Measured memory_bytes: 896
import math
N,D=map(int,input().split())
l=[]
anss=0
for i in range(N):
  a=list(map(int,input().split()))
  l.append(a)
for i in range(N):
  for j in range(i+1,N):
    ans=0
    for k in range(D):
      ans+=(l[i][k]-l[j][k])**2
    if (ans**0.5)%1==0:
      anss+=1
print(anss)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
typedef vector<int> vi;
typedef vector<double> vd;
 
double mypow(double b ,int e){
      if(e == 0) return 1;
      if(e%2==0)
            return mypow( b*b, e/2 );
      else
            return mypow( b*b, e/2 ) * b;
}
 
int main(){
 
 
      int N,M,L; cin >> N >> M >> L ;
      if(N==1){
            cout << 1.0 << endl;
            return 0;
      }
      vector<vd> prob(N,vd(M+1,0.0));
      vector<vd> dist(N,vd(M+1,0.0));
 
      vd p(N),t(N),v(N);
      for(int i=0; i<N; i++) cin >> p[i] >> t[i] >> v[i];
 
      // PRE PROCESS
      for(int i=0; i<N; i++){
            dist[i][0] = (double)L / v[i];
            for(int j=1; j<=M; j++){
                  dist[i][j] = dist[i][j-1] + t[i];
            }
      }
      for(int i=0; i<N; i++)
            prob[i][0] = mypow((100-p[i])/100,M);
      for(int i=0; i<N; i++){
            for(int j=1; j<=M; j++){
                  if(p[i] != 100)
                        prob[i][j] = (prob[i][j-1] * (p[i]/100)) / ((100-p[i])/100);
                  else
                        prob[i][j] = 1.0;
            }
      }
      double comb = 1;
      for(int j=1; j<=M; j++){
            comb = comb * (M - j + 1) / j; 
            for(int i=0; i<N; i++){
                  prob[i][j] *= comb;
            }
      }
       
      vector<vd> sum = prob;
      for(int i=0; i<N; i++){
            for(int j=M-1; j>=0; j--){
                  sum[i][j] += sum[i][j+1];
                  if(sum[i][j] > 1) sum[i][j] = 1;
            }
      }
 
      vector<vd> ans = prob;
      for(int i=0; i<N; i++){
            for(int j=0; j<=M; j++){
                  for(int k=0; k<N; k++){
                        if(i==k) continue;
                        int id = upper_bound(dist[k].begin(),dist[k].end(), dist[i][j]) - dist[k].begin();
                        if(id > M) ans[i][j] = 0.0;
                        else       ans[i][j] *= sum[k][id];
 
                  }
            }
      }
 
      for(int i=0; i<N; i++){
            double tmp = 0.0;
            if(p[i] == 100) tmp = ans[i][M];
            else
                  for(int j=0; j<=M; j++)
                        tmp += ans[i][j];
            if(tmp > 1) tmp = 0;
            printf("%.10f\n",tmp);
      }
                         
}

Measured memory_bytes: 3392
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

ll solve(ll n,ll x,ll sum){
  if(sum==1){
    return 1;
  }
  if(x==1){
    return 0;
  }else if(x<=(sum-3)/2+1){
    return solve(n-1,x-1,(sum-3)/2);
  }else if(x==(sum-3)/2+2){
    return solve(n-1,(sum-3)/2,(sum-3)/2)+1;
  }else if(x==sum){
    return 2*solve(n-1,(sum-3)/2,(sum-3)/2)+1;
  }else{
    return solve(n-1,(sum-3)/2,(sum-3)/2)+1+solve(n-1,x-2-(sum-3)/2,(sum-3)/2);
  }
}

int main()
{
  ll N,X;
  cin >> N >> X;

  ll sum=1;
  REP(i,N){
    sum=2*sum+3;
  }

  cout << solve(N,X,sum) << endl;
}

Measured memory_bytes: 256
// a program which judges whether given three integers, a, b, and c, are a < b < c

import java.util.Scanner

fun main(args:Array<String>){
  val a:Int
  val b:Int
  val c:Int
  val read = Scanner(System.`in`)

  // read three integers
  a = read.nextInt()
  b = read.nextInt()
  c = read.nextInt()

  read.close()

  if( judge(a, b, c) )
    println("Yes")
  else
    println("No")
}


// a function for judging whether given three integers, a, b, and c, are a < b < c
// return value: a < b < c -> true  not a < b < c -> false
fun judge(a:Int, b:Int, c:Int):Boolean{
  if( a < b && b < c )
    return true
  else
    return false
}



Measured memory_bytes: 25640
#include <stdio.h>
#include <string.h>

int main()
{
    int n, i, ret;
    int Taro = 0, Hanako = 0;
    char Card_Taro[128], Card_Hanako[128];

    scanf("%d",&n);
    for(i = 0; i < n; i++)
    {
        scanf("%s %s", Card_Taro, Card_Hanako);
        ret = strcmp(Card_Taro, Card_Hanako);
        if(ret < 0) Hanako += 3;
        if(ret == 0)
        {
            Taro++;
            Hanako++;
        }
        if(ret > 0) Taro+= 3;
    }
    printf("%d %d\n", Taro, Hanako);
    return 0;
}



Measured memory_bytes: 2748
#include <iostream>

int main(){
   std::string S;
   std::cin >> S;

   for(int i=0; i<3; ++i){
      if(S[i]==S[i+1]) {
	 std::cout << "Bad" << std::endl;
	 return 0;
      }
   }
   std::cout << "Good" << std::endl;

   return 0;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N, M;
bool G[701][701];
int colors[701], dp[701][701];
std::vector<P> ps;

bool dfs(int v, int c, int (&n)[2]){
    colors[v] = c;
    n[c] += 1;

    for(int w=1;w<=N;++w){
        if(w == v){
            continue;
        }

        if(G[v][w] == 0){
            if(colors[w] == -1){
                unless(dfs(w, !c, n)){
                    return false;
                }
            }else if(colors[w] == c){
                return false;
            }
        }
    }

    return true;
}

int rec(int i, int s1, int s2){
    if(i == ps.size()){
        return s1 * (s1 - 1) / 2 + s2 * (s2 - 1) / 2;
    }

    if(dp[i][s1] != -1){
        return dp[i][s1];
    }

    int a, b;
    std::tie(a, b) = ps[i];

    return dp[i][s1] = std::min(rec(i + 1, s1 + a, s2 + b), rec(i + 1, s1 + b, s2 + a));
}

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

    std::cin >> N >> M;

    for(int i=0;i<M;++i){
        int A, B;
        std::cin >> A >> B;

        G[A][B] = G[B][A] = 1;
    }

    memset(colors, -1, sizeof(colors));

    for(int i=1;i<=N;++i){
        if(colors[i] == -1){
            int n[2] = {0, 0};
            unless(dfs(i, 0, n)){
                std::cout << -1 << std::endl;
                return 0;
            }
            ps.emplace_back(n[0], n[1]);
        }
    }

    memset(dp, -1, sizeof(dp));

    int mn = rec(0, 0, 0);
    std::cout << mn << std::endl;
}


Measured memory_bytes: 2688
import java.util.Scanner;


public class Main {
	public final static int celebrateYear = 1000;
	public final int celebrateMonth = 1;
	public final int celebrateDay = 1;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			int year = sc.nextInt();
			int month = sc.nextInt();
			int day = sc.nextInt();
			int ret = countDay(year,month,day);
			System.out.println(ret+1);
		}
	}
	
	public static int countDay(int year,int month,int day){
		int r = 0;
		for(int i= year+1; i <celebrateYear; i++){
			if(lsBigYear(i) == false){
				for(int j = 1; j <= 10; j++){
					if(j % 2 == 0)r += 19;
					else r += 20;
				}
			}
			else{
				for(int j = 1; j <= 10; j++){
					r += 20;
				}
			}
		}
		r += countDayInFirstYear(year,month,day);
		return r;
	}
	
	public static int countDayInFirstYear(int year,int month,int day)
	{
		int r = 0;
		if(lsBigYear(year) == true){
			r = 20 - day;
			for(int i = month + 1; i <= 10; i++){
				r += 20;
			}
		}else{
			if(month % 2 == 0)r += 19 - day;
			else r += 20 - day;
			for(int i = month + 1; i <= 10; i++){
				if(i % 2 == 0) r += 19;
				else r += 20;
			}
		}
		return r;
	}
	public static boolean lsBigYear(int year){
		if(year % 3 == 0) return true;
		else return false;
	}
}

Measured memory_bytes: 12000
n,k = map(int,input().split())
mod = 10**9+7

l = [0]*(k+1)

for i in range(k,0,-1):
  m = k//i
  l[i] += pow(k//i,n,mod)
  for j in range(2,m+1):
    l[i] -= l[i*j]

ans = 0
for i in range(k+1):
  ans += i*l[i] % mod
  ans %= mod
print(ans)

Measured memory_bytes: 11224
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
As = [list(map(int, input().split())) for _ in range(N)]

ans = 0

for A in As:
  score = 0
  for i in range(M):
    score += A[i]*B[i]
  if score + C > 0:
    ans += 1

print(ans)

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

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
#define F first
#define S second



int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("b.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	int n;
	cin >> n;
	string s;
	cin >> s;

	int ans = 0;
	for (int i = 0; i < 10; ++i)
		for (int j = 0; j < 10; ++j)
			for (int k = 0; k < 10; ++k)
			{
				vector<int> v = { i, j, k };
				int p = 0;
				for (auto x : s)
				{
					if (x-'0' == v[p]) ++p;
					if (p == 3)
					{
						++ans;
						break;
					}
				}
			}

	cout << ans << "\n";

	return 0;
}


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

int main() {
  int A,B,C,D,libra;
  cin >> A >> B >> C >> D;
  libra = A+B-C-D;
  if(libra > 0){
    cout << "Left" << endl;
  }else if(libra == 0){
    cout << "Balanced" << endl; 
  }else{
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()
#define ALL(s) (s).begin(), (s).end()
using namespace std;
typedef long long unsigned int llu;
typedef long long ll;


int main (){
  int n,q;
  while (cin >> n){
    int S[100000];

    REP(i,n){
      int s;
      cin >> s;
      S[i] = s;
    }

    cin >> q;
    int ans = 0;
    REP(i,q){
      int t;
      cin >> t;
      int left = 0;
      int right = n;
      while(left < right){
	int mid = (left + right) / 2;
	if(S[mid] == t){
	  ans++;
	  break;
	}else{
	  if(S[mid] < t){
	    left = mid + 1;
	  }else{
	    right = mid;
	  }
	}
      }
    }

    cout << ans << endl;
  }

  return 0;
}



Measured memory_bytes: 3416
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

// ナップサック

// 品物がN個しかなかったら、価値の最大は V_MXAX * N だと思ってたので
// jのループを1000*Nまでにしてたがなぜか通らなかった

ll N, W;
ll w[101], v[101];
ll dp[101][100001]; // dp[i][j] : i番目までの商品で価値j持って帰る際の最小の重さ

void input() {
	cin >> N >> W;
	for (int i = 1; i <= N; i++) cin >> w[i] >> v[i];
	for (int j = 0; j <= 100000; j++) dp[0][j] = LLINF;
}

void solve() {
	dp[0][0] = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j <= (1000*N); j++) {
			if (j >= v[i]) dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v[i]] + w[i]);
			else dp[i][j] = dp[i - 1][j];
		}
	}

	int ans = 0;
	for (int j = 0; j <= (1000*N); j++) {
		if (dp[N][j] <= W) {
			// 持って帰れる
			ans = j;
		}
	}
	cout << ans << endl;
}

int main() {
	input();
	solve();

	return 0;
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    string S;
    cin >> S;
    int Q;
    cin >> Q;
    int tn = 0;
    string pre, suf;
    REP(i, Q){
        int t;
        cin >> t;
        if(t==1){
            tn++;
        }else{
            int f;char c;
            cin >> f >> c;
            if(tn&1){
                if(f==2) pre.pb(c);
                else suf.pb(c);
                // if(f==2) S = c+S;
                // else S = S+c;
            }else{
                if(f==1) pre.pb(c);
                else suf.pb(c);
                // if(f==1) S = c+S;
                // else S = S+c;
            }
        }
    }

    if(tn&1){
        reverse(ALL(S));
        reverse(ALL(suf));
        pr(suf + S + pre);
    }else{
        reverse(ALL(pre));
        pr(pre + S + suf);
    }
}

Measured memory_bytes: 1348
#include<iostream>
#include<cstring>
#include<algorithm>


using namespace std;

const long long inf= 1e10+ 123;
const int mx=1e5+123;
int dp[mx], h[mx], n, k;

int solve( int i)
{
    if(i==n)
        return 0;

    if(dp[i]!= -1)
        return dp[i];


    int ret= inf;

    for(int j=1; j<=k; j++)
    {
        if(i+j<=n)
            ret= min(ret, (abs(h[i]- h[i+j])+ solve(i+j)));
    }


    return dp[i]= ret;
}

int main()
{
    memset(dp, -1, sizeof(dp));

    cin>> n >> k;
    for(int i=1; i<=n; i++)
        cin>> h[i];

    cout<< solve(1)<< endl;

    return 0;
}



Measured memory_bytes: 12132
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,string>;
using Map = map<string,ll>;



int main(){
    ll N;
    cin >> N;
    vector<vector<ll>> count(10, vector<ll>(10, 0));
    for(ll i=1;i<N+1;i++){
        string S=to_string(i);
        ll siz=S.size();
        ll a=S.at(0)-'0',b=S.at(siz-1)-'0';
        count[a][b]++
    ;}
    ll ans=0;
    for(int i=1;i<10;i++){
     for(int j=1;j<10;j++){
         ans+=count[i][j]*count[j][i]
     ;}
    ;}
    cout<<ans<<endl;

return 0;
}  



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

int main(int argc, char* argv[]) {
	ll n, k, sum = 0;
	cin >> n >> k;
	ll NumberSumsFromLeft[200005] = {};
	ll NumberSumsFromRight[200005] = {};
	ll mod= 1000000007;
	for (ll i = 0; i <= n; i++)
	{
		sum += i;
		sum %= mod;
		NumberSumsFromLeft[i] = sum;
		//cout << sum << endl;

	}
	sum = 0;
	//cout << endl;

	for (ll i = n; i >= 0; i--)
	{
		sum += i;
		NumberSumsFromRight[n-i] = sum;
		sum %= mod;
		//cout << sum << endl;

	}
	sum = 0;
	//cout << endl;

	for (ll i = k-1; i <= n; i++)
	{
		//ll TmpSumMin = 0;
		//ll TmpSumMax = 0;
		//for (int j = n; j > n - i; j--)
		//{
		//	TmpSumMax += j;
		//}
		//for (int j = 0; j < i; j++)
		//{
		//	TmpSumMin += j;
		//}
		//sum += NumberSumsFromRight[i] - NumberSumsFromLeft[i] + 1;
		sum -= NumberSumsFromLeft[i];
		if (sum<0)
		{
			sum += mod;
		}
		sum += NumberSumsFromRight[i] + 1;
		sum %= mod;
		//cout << sum << endl;
		//cout << sum << endl;
		//cout << NumberSumsFromRight[i] << endl;
		//cout << NumberSumsFromLeft[i] << endl;
		//cout << sum << endl;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 6764
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{


	class Program
	{
		static void Main(string[] args)
		{
			var N = int.Parse(Console.ReadLine());

			var inputList = Console.ReadLine().Split(' ').Select(int.Parse).Where(x => x % 2 == 0);

			if(inputList.Any())
			{
				if(inputList.All(x => x % 3 == 0 || x % 5 == 0))
				{
					Console.WriteLine("APPROVED");
				}
				else
				{
					Console.WriteLine("DENIED");
				}
			}
			else
			{
				Console.WriteLine("APPROVED");
			}
			
		}


	}
}

Measured memory_bytes: 13396
#include <stdio.h>

void bubble(int a[5]){
    int i,j,tmp;
    
    for(i=0;i<4;i++){
        for(j=0;j<4-i;j++){
            if(a[j]>a[j+1]){
                tmp=a[j];
                a[j]=a[j+1];
                a[j+1]=tmp;
            }
        }
    }
}

int CheckFour(const int a[5]){
    if(a[0]==a[3] || a[1]==a[4]){
        return 1;
    }
    return 0;
}

int CheckThree(const int a[5]){
    if(a[0]==a[2] || a[1]==a[3] || a[2]==a[4]){
        return 1;
    }
    return 0;
}

//int CheckThree(const int a[5]){
//    if(((a[0]==a[2])&&(a[2]!=a[3])) || ((a[1]==a[3])&&( (a[0]!=a[1])||(a[3]!=a[4]) )) || ((a[2]==a[4])&&(a[1]!=a[2]))){
//        
//    
//}

int CheckPair(const int a[5]){
    int i,cnt=0;
    
    for(i=0;i<4;i++){
        if(a[i]==a[i+1]){
            cnt++;
        }
    }
    return (cnt);
}

int CheckStraight(const int a[5]){
    int i;
    
    if(a[0]==1){
        for(i=1;i<4;i++){
            if(a[i+1]!=a[i]+1)break;
            if(i==3 && a[i+1]==a[i]+1) return 1;
        }
    }
    //for(i=0;i<5;i++){
    //    b[i]=a[i];
    //    if(b[i]>=10)b[i]-=13;
    //}
    //bubble(b);
    
    for(i=0;i<4;i++){
        if(a[i+1]!=a[i]+1)break;
        if(i==3 && a[i+1]==a[i]+1) return 1;
    }
    return 0;
}

int main(void){
    int a[5]={};
    
    while(scanf("%d,%d,%d,%d,%d",&a[0],&a[1],&a[2],&a[3],&a[4]) != EOF){
        bubble(a);

        if(CheckFour(a))puts("four card");
        else if(CheckThree(a)){
            if(CheckPair(a)==3)puts("full house");
            else if(CheckPair(a)==2)puts("three card");
        }
        else if(CheckPair(a)==2)puts("two pair");
        else if(CheckPair(a)==1)puts("one pair");
        else if(CheckStraight(a))puts("straight");
        else puts("null");
    }
    return 0;
}

Measured memory_bytes: 580
H, W = map(int, input().split())
s_list = []
for i in range(H):
    s_list.append(input())
check = [[False for _ in range(W)] for _ in range(H)]
move_x = [1, 0, -1, 0]
move_y = [0, 1, 0, -1]
import sys
sys.setrecursionlimit(10**9)

def dfs(i, j):
    check[i][j] = True

    if s_list[i][j] == "#":
        cnt[0] += 1
    else:
        cnt[1] += 1

    for m in range(4):
        next_i = i + move_y[m]
        next_j = j + move_x[m]
        if 0 <= next_i < H and 0 <= next_j < W  and s_list[i][j] != s_list[next_i][next_j] \
                and not check[next_i][next_j]:
            dfs(next_i, next_j)


ans = 0
for i in range(H):
    for j in range(W):
        cnt = [0] * 2
        dfs(i, j)
        ans += cnt[0] * cnt[1]
print(ans)



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


int main() {
    ll n,a,b,c;
    cin>>n;
    vector<vector<ll>> v(n,vector<ll>(3));
    for(int i=0;i<n;i++){
        cin>>v[i][0]>>v[i][1]>>v[i][2];
    }
    ll dp[n][3];
    dp[n-1][0]=v[n-1][0];
    dp[n-1][1]=v[n-1][1];
    dp[n-1][2]=v[n-1][2];
    for(int i=n-2;i>=0;i--){
        dp[i][0]=max(dp[i+1][1],dp[i+1][2])+v[i][0];
        dp[i][1]=max(dp[i+1][0],dp[i+1][2])+v[i][1];
        dp[i][2]=max(dp[i+1][0],dp[i+1][1])+v[i][2];
        //cout<<dp[i+1][0]<<" "<<dp[i+1][1]<<" "<<dp[i+1][2]<<"\n";
    }
    cout<<max(dp[0][0],max(dp[0][1],dp[0][2]))<<"\n";
}

Measured memory_bytes: 11172
import { isRegExp } from "util";

class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;

  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n:number):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n:number):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
  f(roop:number, callback:any){
    for(let i=0;i<roop;i++){
      callback(i);
    }
  };
  Yes(){
    console.log('Yes');
  }
  No(){
    console.log('No');
  }
  YES(){
    console.log('YES');
  }
  NO(){
    console.log('NO');
  }
}
const m = () => {
  const o = new AtCoder();
  let s = o.s()
  if(s==='AAA' || s==='BBB'){
    o.No()
  }else{
    o.Yes()
  }
}
m();

Measured memory_bytes: 7372
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]

lis = set(s)
ans = 0

for i in lis:
    x = s.count(i) - t.count(i)
    ans = max(ans,x)
print(ans)

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

 int n;
 int a, A[100];
 int all=1, bad=1;

 int main(){
 
   cin >> n;

    for ( int i = 0; i < n; i++ ) cin >> A[i];
    for ( int i = 0; i < n; i++) {
     all *= 3;
     if (A[i] %2 == 0) bad *= 2;
    }
    cout << all-bad << endl;  
  
 return 0;
}

Measured memory_bytes: 256
a, b, c = map(int, input().split())
k = int(input())

if b > a:
  multiplier = 2 ** k
  if c * multiplier > b:
    ans = 'Yes'
  else:
    ans = 'No'
else:
  while b <= a:
    b *= 2
    k -= 1
  multiplier = 2 ** k
  if c * multiplier > b:
    ans = 'Yes'
  else:
    ans = 'No'

print(ans)


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

int main(){
    int n, q;
    cin >> n;
    int s[n];
    for(int i=0; i<n; ++i){
        cin >> s[i];
    }
    cin >> q;
    int t[q];
    for(int i=0; i<q; ++i){
        cin >> t[i];
    }
    
    int count = 0;
    for(int i=0; i<q; ++i){
        for(int j=0; j<n; ++j){
            if (s[j] == t[i]){
                ++count;
                break;
            }
        }
    }
    
    cout << count << endl;
}

Measured memory_bytes: 1200