akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#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 rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    ll h,w;cin>>h>>w;
    ll t[h][w];
    rep(i,h)rep(j,w){
        cin>>t[i][j];
        t[i][j]%=2;
    }
    vector<pair<int,int>> p1,p2;
    rep(i,h){
        rep(j,w-1){
            if(t[i][j]%2==1){
                t[i][j+1]++;
                p1.push_back({i,j});
                p2.push_back({i,j+1});
            }
        }
    }
    rep(i,h-1){
        if(t[i][w-1]%2==1){
            t[i+1][w-1]++;
            p1.push_back({i,w-1});
            p2.push_back({i+1,w-1});
        }
    }
    cout<<p1.size()<<endl;
    rep(i,p1.size()){
        cout<<p1[i].first+1<<" "<<p1[i].second+1<<" "<<p2[i].first+1<<" "<<p2[i].second+1<<endl;
    }
}



Measured memory_bytes: 6252
#include <stdio.h>

int main(void){
	int N;
	scanf("%d",&N);
	int i,j;
	long ans;
	char S[11];
	long name[5] = {0};
	for(i=0;i<N;i++){
		scanf("%s",&S);
		if(S[0] == 'M')	name[0]++;
		if(S[0] == 'A')	name[1]++;
		if(S[0] == 'R')	name[2]++;
		if(S[0] == 'C')	name[3]++;
		if(S[0] == 'H')	name[4]++;
	}
	ans = 	name[0]*name[1]*name[2] +
			name[0]*name[1]*name[3] +
			name[0]*name[1]*name[4] +
			name[0]*name[2]*name[3] +
			name[0]*name[2]*name[4] +
			name[0]*name[3]*name[4] +
			name[1]*name[2]*name[3] +
			name[1]*name[2]*name[4] +
			name[1]*name[3]*name[4] +
			name[2]*name[3]*name[4] ;
			
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define LLINF (1e18)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (true)
    {
        int n, m;
        cin >> n >> m;
        if (n == 0 && m == 0)
        {
            break;
        }
        vector<int> q[m + 1];
        for (int i = 0; i < n; i++)
        {
            int d, v;
            cin >> d >> v;
            q[d].push_back(v);
        }
        int ans = 0;
        for (int i = 1; i <= m; i++)
        {
            sort(q[i].rbegin(), q[i].rend());
            ans += q[i][0];
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3140
n = int(input())
A = list(map(int, input().split()))

even = [A[i] for i in range(1, n, 2)]
odd = [A[i] for i in range(0, n, 2)]

if n % 2 == 0:
    ans = even[::-1] + odd
else:
    ans = odd[::-1] + even

print(*ans)


Measured memory_bytes: 26180
def main():
    n, k, *h = map(int, open(0).read().split())
    dp = [float("inf")] * n
    dp[0] = 0
    for i in range(1, n):
        min_j = max(0, i-k)
        dp[i] = min([dp[j] + abs(h[i] - h[j]) for j in range(min_j, i)])
    print(dp[n-1])

main()

Measured memory_bytes: 13876
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
// scanf("%d %d %d %d",&w,&b,&d,&s); %lld
// const double PI=acos(-1.0);

int main(){
    fastIO;
    string s; cin>>s;
    int lim = s.size();
    ll mul=0;
    for(int i=0; i<lim; i++){
		mul+=(s[i]-'0');
	}
	if(mul%9==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}



Measured memory_bytes: 3732
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
int a[2345];
signed main() {
	int n, z, w; cin >> n >> z >> w;
	for (int i = 1; i <= n; i++)cin >> a[i];
	if (n == 1)cout << abs(a[n] - w) << endl;
	else cout << max(abs(a[n] - a[n - 1]), abs(a[n] - w)) << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var str string
	fmt.Scan(&str)
	chars := strings.Split(str, "")

	count := 0
	for _, n := range chars {
		if n == "2" {
			count++
		}
	}
	fmt.Println(count)
}


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

void solve(){
    int n, d; cin >> n >> d;
    int ans = 0;
    ans += n/(2*d+1);
    n = n%(2*d+1);
    if(n!=0) ans++;
    cout << ans << endl;
}

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

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


int main() {
	int N,a;
	cin >> N;
	for (int i = 0; 4*i <= N; i++) {
		a = N - 4*i;
		if (a % 7 == 0) {
			printf("Yes");
			return 0;
		}
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ii>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 1e5 + 2;
ll i,n,k,j,ans;
string s;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n>>k>>s;
    rep(i,0,n){
        j = i + 1;
        while(j < n && s[j] == s[j - 1]) j += 1;
        ans += j - i - 1;
        i = j - 1;
    }
    cout<<min(ans + 2 * k, n - 1);
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
const int mod = 1e9 + 7;

int main(){
    long long a=10,b=9,c=8, n;
    cin >> n;
    for(int i = 0 ; i < n-1; ++i){
        a *= 10; b*= 9; c *= 8;
        a %= mod; b %= mod; c %= mod;
    }
    long long ans = (a+c)%mod;
    ans = (ans-b+mod)%mod;
    ans = (ans-b+mod)%mod;

    if(n == 1) cout << 0;
    else cout << ans;
    return 0;
}

Measured memory_bytes: 3628
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1]*n
        
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
        
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return
        
        if self.parents[x] > self.parents[y]:
            x,y = y,x
            
        self.parents[x] += self.parents[y]
        self.parents[y] = x

n, m = map(int,input().split())

uf = UnionFind(n)

ab = [tuple(map(int,input().split())) for _ in range(m)]

for a,b in ab:
    uf.union(a-1,b-1)

ans = -1
for i in uf.parents:
    ans = min(i,ans)
    
print(-ans)

Measured memory_bytes: 41020
#!/usr/bin/env python3
import sys


YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(w: str):
    print(YES if all(
        w.count(chr(c)) % 2 == 0
        for c in range(ord("a"), ord("z") + 1)
    ) else NO)


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


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr auto INF = INT_MAX >> 1;
constexpr auto LINF = 5000000000000000;
constexpr auto MOD = 1000000007;

int main() {

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

	vi dist(n - 1, 0);

	rep1(i, n)rep1(j, n) {
		if (i >= j)continue;
		int d = min(j - i, abs(i - x) + abs(j - y) + 1);
		dist[d - 1]++;
	}

	rep(i, n - 1)cout << dist[i] << endl;

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int sum=0;
    int ans=1e9;
    for(int i=1;i<=n/2;i++){
        sum=0;
        int x=i;
        int j=n-x;
        while(x>0){
            sum+=x%10;
            x/=10;
        }
        while(j>0){
            sum+=j%10;
            j/=10;
        }
        ans=min(ans,sum);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for(int i=0; i<n; i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  int sum=0;
  for(int i=0;i<n-1;i++){
    sum=sum+vec.at(i);
  }
  sum=sum+vec.at(n-1)/2;
  cout << sum << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1ll<<60;

using namespace std;
typedef pair<int, int> P;

int main(){
    string s; cin >> s;

    int max_count=0;
    int count=0;
    rep(i, s.size()){
        if(s[i]=='A'||s[i]=='T'||s[i]=='G'||s[i]=='C'){
            count++;
            if(max_count<count) max_count=count;
        }
        else count=0;
    }
    out(max_count);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int a[2000001];
int fa[2000001];
int vis[2000001];
bool cmp(int a,int b){return a>b;}
int find(int x){return (fa[x]==x)?x:fa[x]=find(fa[x]);}
multiset<int> s;
signed main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=(1<<n);i++)
		scanf("%d",&a[i]);
	sort(a+1,a+(1<<n)+1,cmp);
	for(int i=2;i<=(1<<n);i++)
		s.insert(a[i]);
	vector<int> v;
	v.push_back(a[1]);

	for(int j=1;j<=n;j++)
	{
		for(int i=0;i<(1<<(j-1));i++)
		{
			multiset<int>::iterator at=s.lower_bound(v[i]);
			if(at==s.begin())
			{
				printf("No");
				return 0;
			}
			--at;
			int x=(*at);
			s.erase(at);
			v.push_back(x);
			//printf("%d\n",(*s.begin()));
		}
	}
	printf("Yes");
	return 0;
}
/*
3
1 0 0 0 0 0 0 0
*/

Measured memory_bytes: 16640
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

const int MAX = 333;
int N, K;
LL H[MAX];
LL dp[MAX][MAX][MAX];

LL calc() {
    LL res = H[0];
    FOR(i, 1, N) {
        res += max(H[i] - H[i - 1], 0LL);
    }
    return res;
}

int main(void) {
    cin >> N >> K;
    REP(i, N) {
        cin >> H[i + 1];
    }

    if (N == K) {
        cout << 0 << endl;
        return 0;
    }
    if (N == K + 1) {
        cout << *min_element(H, H + N) << endl;
        return 0;
    }

    H[0] = 0;
    N++;

    REP(i, MAX) REP(j, MAX) REP(k, MAX) {
        dp[i][j][k] = LLINF;
    }
    dp[1][0][0] = 0;
    FOR(i, 1, N) {
        REP(j, K + 1) {
            REP(k, i + 1) {
                if (dp[i][j][k] == LLINF) continue;

                chmin(dp[i + 1][j][i], dp[i][j][k] + max(H[i] - H[k], 0LL));
                chmin(dp[i + 1][j + 1][k], dp[i][j][k]);
            }
        }
    }

    LL ans = LLINF;
    REP(j, K + 1) REP(k, N) {
        chmin(ans, dp[N][j][k]);
    }
    cout << ans << endl;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    int ans[n] = {0};
    int A[n][m];
    int b[m];
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> A[i][j];
        }
    }
    for (int j = 0; j < m; j++) {
        cin >> b[j];
    }
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            ans[i] += A[i][j] * b[j];
        }
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 3116
#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 forn(i, n) for (ll i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

int cnt = 0;


void solve()
{
	ll n; cin >> n;
	vector<ll> a(n);
	forn(i, n) cin >> a[i];
	ll res = 0;
	for (int i = 0; i < n; ++i)
	{
		while (a[i] % 2 == 0)
		{
			a[i] /= 2;
			res++;
		}
	}
	cout << res;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}


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

int main() {

  int h,w;
  cin >> h >> w;
  
  vector<string> data(h);
  
  for (int i=0; i<h; i++) {
    cin >> data.at(i);
  }
  
  vector<string> data2; 
  for (int i=0; i<h; i++) {
    for (int j=0; j<w; j++) {
      if ( data.at(i).at(j) == '#') {
        data2.push_back( data.at(i) );
        break;
      }
    }
  }
  
  vector<int> ck(w);
  for (int i=0; i<w; i++) {
     for (int j=0; j<data2.size(); j++) {
       if ( data2.at(j).at(i) == '#') {
         ck.at(i) = 1;
         break;
       }
     }
  }
  for (int i=0; i<data2.size(); i++) { 
    for (int j=0; j<w; j++) {
      if ( ck.at(j) == 1) cout << data2.at(i).at(j);
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
N = int(input())

An = list(map(int, input().split()))

sum_of_an = sum(An)

if sum_of_an % 2 == 0:
    half_of_an = sum_of_an / 2
    sum_left_len = 0
    for l in An:
        sum_left_len += l
        if sum_left_len == half_of_an:
            print(0)
            exit(0)
        elif sum_left_len > half_of_an:
            break
min_yen = None
left_len = 0
for (i, l) in zip(range(0, N), An):
    if i == N - 1:
        break

    left_len += l
    if min_yen is None:
        min_yen = abs(sum_of_an - left_len * 2)
    else:
        min_yen = min(min_yen, abs(sum_of_an - left_len * 2))

print(min_yen)


Measured memory_bytes: 26220
# include <iostream>
# include <algorithm>
# include <string>
# include <math.h>
# include <vector>
using namespace std;

int main() {
	
	int N;
	vector<int> t(100100), x(100100), y(100100);
	int flag=0;
	cin >> N;
	
	for (int i = 0;i<N; ++i) {
		cin >> t[i] >> x[i] >> y[i];
		if (((t[i] == abs(x[i]) + abs(y[i])) || (t[i] - abs(x[i]) - abs(y[i]) > 0 && abs(t[i] - abs(x[i]) - abs(y[i])) % 2 == 0))) {
		}
		else {
			flag = 1;
		}
	}
	if (flag == 1) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1408
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

vector<int> a;
vector<int> memo;

bool solve(int k)
{
    if(k == 0)
        return false;
    if(memo[k] != -1)
        return memo[k] != 0;

    bool ans = false;
    for(int x : a){
        if(x <= k && !solve(k-x)){
            ans = true;
            break;
        }
    }

    memo[k] = (ans ? 1 : 0);
    return ans;
}

int main()
{
    int n, k;
    cin >> n >> k;
    a.resize(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];

    memo.assign(k+1, -1);
    if(solve(k))
        cout << "First" << endl;
    else
        cout << "Second" << endl;

    return 0;
}


Measured memory_bytes: 5376
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;

public class Main {

	private BufferedReader br;
	private BufferedWriter bw;
	private StringTokenizer st;
	private int a;
	private int b;
	private int c;
	private int newa;
	private int newb;
	private int newc;
	private int count;

	public static void main(String[] args) throws IOException {
		new Main().start();
	}

	void start() throws IOException {

		br = new BufferedReader(new InputStreamReader(System.in));
		bw = new BufferedWriter(new OutputStreamWriter(System.out));
		st = new StringTokenizer(br.readLine());
		a = Integer.parseInt(st.nextToken());
		b = Integer.parseInt(st.nextToken());
		c = Integer.parseInt(st.nextToken());

		
			newa = a;
			newb = b;
			newc = c;
			count = 0;
			while (newa % 2 == 0 && newb % 2 == 0 && newc % 2 == 0) {
				newa = b / 2 + c / 2;
				newb = a / 2 + c / 2;
				newc = a / 2 + b / 2;
				if((newa==a)&&(newb==b)&&(newc==c)){
					count=-1;
					break;
				}
				a = newa;
				b = newb;
				c = newc;
				count++;
			
		}
		bw.write(count + "");
		bw.flush();
		br.close();
		bw.close();

	}

}


Measured memory_bytes: 21204
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <deque>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
const int inf = 1<<30;
typedef pair<int, int> P;

struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(100005);

int main() {
  int x, y; cin >> x >> y;
  if((x+y) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }
  int n = (x+y) / 3;
  x -= n, y -= n;
  if(x < 0 || y < 0) {
    cout << 0 << endl;
    return 0;
  }
  combination c(x+y);
  mint ans = c(x+y, x);
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 12288
//start of jonathanirvings' template v3.0.3 (BETA)

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<LL> vl;
typedef vector<vl> vvl;

double EPS = 1e-9;
int INF = 1000000005;
long long INFF = 1000000000000000005LL;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};

#ifdef TESTING
  #define DEBUG fprintf(stderr,"====TESTING====\n")
  #define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
  #define debug(...) fprintf(stderr, __VA_ARGS__)
#else
  #define DEBUG 
  #define VALUE(x)
  #define debug(...)
#endif

#define FOR(a,b,c) for (int (a)=(b);(a)<(c);++(a))
#define FORN(a,b,c) for (int (a)=(b);(a)<=(c);++(a))
#define FORD(a,b,c) for (int (a)=(b);(a)>=(c);--(a))
#define FORSQ(a,b,c) for (int (a)=(b);(a)*(a)<=(c);++(a))
#define FORC(a,b,c) for (char (a)=(b);(a)<=(c);++(a))
#define FOREACH(a,b) for (auto &(a) : (b))
#define REP(i,n) FOR(i,0,n)
#define REPN(i,n) FORN(i,1,n)
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
#define SQR(x) ((LL)(x) * (x))
#define RESET(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(),v.end()
#define ALLA(arr,sz) arr,arr+sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr,sz) sort(ALLA(arr,sz))
#define REVERSEA(arr,sz) reverse(ALLA(arr,sz))
#define PERMUTE next_permutation
#define TC(t) while(t--)

inline string IntToString(LL a){
  char x[100];
  sprintf(x,"%lld",a); string s = x;
  return s;
}

inline LL StringToInt(string a){
  char x[100]; LL res;
  strcpy(x,a.c_str()); sscanf(x,"%lld",&res);
  return res;
}

inline string GetString(void){
  char x[1000005];
  scanf("%s",x); string s = x;
  return s;
}

inline string uppercase(string s){
  int n = SIZE(s); 
  REP(i,n) if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
  return s;
}

inline string lowercase(string s){
  int n = SIZE(s); 
  REP(i,n) if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
  return s;
}

inline void OPEN (string s) {
  #ifndef TESTING
  freopen ((s + ".in").c_str (), "r", stdin);
  freopen ((s + ".out").c_str (), "w", stdout);
  #endif
}

//end of jonathanirvings' template v3.0.3 (BETA)

int n,m,a,b;
int p[100005];
vi edge[100005];
bool dah[100005];
set<int> ada;
vi daftar;

void dfs(int now)
{
  if (dah[now]) return;
  dah[now] = 1;
  ada.insert(p[now]);
  daftar.pb(now);
  for (int x : edge[now]) dfs(x);
}

int main()
{
  scanf("%d %d",&n,&m);
  REP(i,n)
  {
    scanf("%d",&p[i]);
    --p[i];
  }
  REP(i,m)
  {
    scanf("%d %d",&a,&b);
    --a; --b;
    edge[a].pb(b);
    edge[b].pb(a);
  }
  int risan = 0;
  RESET(dah,0);
  REP(i,n) if(!dah[i])
  {
    ada.clear();
    daftar.clear();
    dfs(i);
    for (int x : daftar)
    {
      // VALUE(x);
      if (ada.count(x)) ++risan;
    }
  }
  printf("%d\n",risan);
  return 0;
}











Measured memory_bytes: 14328
#include <iostream>
#include <vector>

using namespace std;

const int INF = 1000000007;
static int cost[20][100][100];

int main(){
	int n, m, c, s, g;
	while(cin >> n >> m >> c >> s >> g, n){
		for(int i=0;i<c;i++)
			for(int j=0;j<n;j++)
				for(int k=0;k<n;k++)
					cost[i][j][k] = j==k ? 0 : INF;

		for(int i=0;i<m;i++){
			int x, y, d, e; cin >> x >> y >> d >> e;
			cost[e-1][x-1][y-1] = cost[e-1][y-1][x-1] = min(cost[e-1][y-1][x-1], d);
		}

		for(int l=0;l<c;l++){
			for(int k=0;k<n;k++){
				for(int i=0;i<n;i++)
					for(int j=0;j<n;j++)
						cost[l][i][j] = min(cost[l][i][j], cost[l][i][k]+cost[l][k][j]);
			}
		}

		vector<int> p(c);

		for(int i=0;i<c;i++) cin >> p[i];
		for(int i=0;i<c;i++){
			vector<int> q(p[i]), r(p[i]);
			q[0] = 0;
			for(int j=1;j<p[i];j++) cin >> q[j];
			for(int j=0;j<p[i];j++) cin >> r[j];
			vector<int> dist(q.back()+1); dist[0] = 0;
			for(int j=0;j+1<p[i];j++)
				for(int k=q[j]+1;k<=q[j+1];k++) dist[k] = dist[k-1] + r[j];
			for(int j=0;j<n;j++){
				for(int k=0;k<n;k++){
					if(cost[i][j][k] == INF) continue;
					cost[i][j][k] = (cost[i][j][k] <= q.back() ? dist[cost[i][j][k]] : dist.back() + (cost[i][j][k]-q.back())*r.back());
				}
			}
		}
		for(int i=0;i<n;i++)
			for(int j=0;j<n;j++)
				for(int k=1;k<c;k++) cost[0][i][j] = min(cost[0][i][j], cost[k][i][j]);
		for(int k=0;k<n;k++){
			for(int i=0;i<n;i++)
				for(int j=0;j<n;j++)
					cost[0][i][j] = min(cost[0][i][j], cost[0][i][k]+cost[0][k][j]);
		}
		cout << (cost[0][s-1][g-1]==INF ? -1 : cost[0][s-1][g-1]) << endl;
	}
}

Measured memory_bytes: 1724
n = int(input())
L = [*map(int, input().split())]
M = {}
for l in L:
    if l in M:
        M[l] +=1
    else:
        M[l] = 1
M = list(M.items())
M.sort()
# print(L)
# print(M)
m=len(M)
c=0
for i in range(m):
    for j in range(i+1, m):
        for k in range(j+1, m):
            if M[i][0]+M[j][0] > M[k][0]:
                c += M[i][1] * M[j][1] * M[k][1]
                # print(i,j,k,M[i][0],M[j][0],M[k][0])
                # print(M[i][1],M[j][1],M[k][1])

print(c)


Measured memory_bytes: 9204
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

const int N = 100 * 1000 + 5;

pair <int, int> a[N];
long long pos[N];
int main() {
	long long x = 0;
	int n, l, t;
	cin >> n >> l >> t;
	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
		if (a[i].second == 1) {
			pos[i] = a[i].first + t;
			x += pos[i] / l;
			pos[i] %= l;
		}
		else {
			pos[i] = a[i].first - t;
			if (pos[i] < 0) {
				x -= (-pos[i] - 1) / l + 1;
			}
			pos[i] += 1ll * l * N;
			pos[i] %= l;
		}
	//	cout << i << " " << pos[i] << endl;
	}
	sort(pos, pos + n);
//	cout << x << endl;
	x += 1ll * n * t * 1000;
	x += 1ll * n * n;
	x %= n;
	for (int i = 0; i < n; i++) {
		cout << pos[(i + x) % n] << endl;
	}
	return 0;
}


Measured memory_bytes: 2816
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		// n日間
		int n = scan.nextInt();

		// 宿題の数
		int m = scan.nextInt();

		ArrayList list = new ArrayList();

		//
		for(int i = 0; i < m; i++) {
			list.add(scan.nextInt());
		}

		int s = 0;
		for(int i = 0; i < m; i++) {
			s += (int)list.get(i);
		}

		if(s > n) {
			System.out.println(-1);
		}else {
			System.out.println(n - s);
		}

	}
}

Measured memory_bytes: 38208
import numpy as np

n, m, x = list(map(int, input().split()))
a_list = []
c_list = []
for _ in range(n):
  _a_list = list(map(int, input().split()))
  a_list.append(_a_list[1:])
  c_list.append(_a_list[0])

def ok(a_l):
  if a_l and min(np.sum(a_l, axis=0))>=x:
    return True
  else:
    return False

def dfs(l, i):
  if i==len(a_list) and not ok(l):
    return -1
  elif ok(l):
    return 0
  left = dfs(l+[a_list[i]], i+1)
  right = dfs(l, i+1)
  if left>=0 and right>=0:
    if left + c_list[i]<right:
      return left + c_list[i]
    elif left + c_list[i]>=right:
      return right
  elif left>=0 and right<0:
    return left + c_list[i]
  elif left<0 and right>=0:
    return right
  else:
    return min(left, right)

print(dfs([], 0))

Measured memory_bytes: 27208
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;



int main(){
    int n,m,q;
    cin >> n >> m >> q;
    vector<int> v[n];
    for(int i=0;i<m;i++){
        int l,r;
        cin >> l >> r;
        l--,r--;
        v[l].eb(r);
    }
    for(int i=0;i<n;i++){
        sort(ALL(v[i]));
    }
    for(int i=0;i<q;i++){
        int x,y;
        cin >> x >> y;
        x--,y--;
        int ans=0;
        for(int j=x;j<=y;j++){
            ans+=upper_bound(ALL(v[j]),y)-v[j].begin();
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 2176
import sys
for l in sys.stdin:
  t=l.split()
  l=[]
  for i in t:
    try:
      j=int(i)
      l.append(j)
    except:
      b=l.pop()
      a=l.pop()
      l.append(eval("a"+i+"b"))
  print("{:.6f}".format(l[0]))


Measured memory_bytes: 5628
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iomanip>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<double> vec(n);
    for(int i=0;i<n;i++){
        double x;
        cin >> x;
        vec[i]=x;
    }
    sort(vec.begin(),vec.end());
    double seg = (vec[0]+vec[1])/2;
    for(int i=2;i<n;i++){
        seg =(seg+vec[i])/2;
    }
    cout<<setprecision(10)<<seg<<endl;
}

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

int main()
{
    int N;
    while (true) {
        cin >> N;
        if (N == 0) break;
        vector<long long> n;
        long long t, res = 0;
        while (N--) {
            cin >> t;
            n.push_back(t);
        }
        t = 0;
        sort(n.begin(), n.end());
        for (int i = 0; i < n.size() - 1; i++) {
            t = t + n[i];
            res += t;
        }
        cout << res << endl;
    }

    return 0;
}

Measured memory_bytes: 1348
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;vector<int> vi;
	for(int i=0;i<n;i++)
	{
		int d;
		cin>>d;
		vi.push_back(d);
	}long long sum = 0;
	for(int i=0;i<n;i++)
	{
		if(i!=n-1)
		for(int j=i+1;j<n;j++)
		{
			sum+=vi[i]*vi[j];
		}
	}
	cout<<sum<<endl;
}

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

int main() {
    int N; cin>>N;
    if(N%10==2||N%10==4||N%10==5||N%10==7||N%10==9){
        cout << "hon" << endl;
    }else if(N%10==0||N%10==1||N%10==6||N%10==8){
        cout << "pon" << endl;
    }else{
        cout << "bon" << endl;
    }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF=1e9+7;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<vector<int>> Graph;

int main() {
	int N,M,A,B;
	cin >> N >> M;
	Graph g(N);
	vector<int> r(N);
	vector<bool> s(N,0);
	queue<int> q;

	

	rep(i,M) {
		cin >> A >> B;
		--A, --B;
		g.at(A).push_back(B);
		g.at(B).push_back(A);
	}

	q.push(0);
	s.at(0) = 1;
	while(!q.empty()) {
		int n = q.front();
		q.pop();
		

		for(int x : g.at(n))
			if(!s.at(x)) {
				r.at(x) = n+1;
				s.at(x) = 1;
				q.push(x);
			}

		// rep(i,N-1)
		// 	cout << r.at(i+1) << endl;
		// cout << endl;
	}

	cout << "Yes" << endl;
	rep(i,N-1)
		cout << r.at(i+1) << endl;
}

Measured memory_bytes: 10260
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
using namespace std;


int main()
{
    int a, b;
    cin >> a >> b;
    if (a <= 0 && b >= 0)
    {
        cout << "Zero" << endl;
        return 0;
    }
    if ((a > 0 && b > 0) || (b - a + 1) % 2 == 0)
    {
        cout << "Positive" << endl;
        return 0;
    }
    cout << "Negative" << endl;
    

}



Measured memory_bytes: 256
N = int(input())
P = [int(_) for _ in input().split()]

a = [1] * N
b = [N] + [-1] * (N - 1)

for i, x in enumerate(P):
    a[x - 1] += i
    b[0] += i
    if x < N:
        b[x] -= i

from itertools import accumulate

print(*accumulate(a))
print(*accumulate(b))


Measured memory_bytes: 7032
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=5e5,INF=1e9;
long long ans=0;
int p[N],size[N],mi[N],smx[N],n,to[N],fst[N],nxt[N],mm,siz[N],mx[N];
char st[N];
void ade(int u,int v){to[++mm]=v,nxt[mm]=fst[u],fst[u]=mm;}
void dfs1(int u,int fa)
{
    if(p[u])siz[u]=1,mi[u]=0;
    else mi[u]=INF;
    for(int i=fst[u];i;i=nxt[i])
    {
        int v=to[i];if(v==fa)continue;
        dfs1(v,u);siz[u]+=siz[v];
        if(siz[v])mi[u]=min(mi[u],mx[v]+1);
        if(mx[v]+1>mx[u])smx[u]=mx[u],mx[u]=mx[v]+1;
        else if(mx[v]+1>smx[u])smx[u]=mx[v]+1;
    }
}
void dfs2(int u,int fa)
{
    ans+=max(0,min(mx[u]-1,smx[u]+1)-mi[u]+1);
    for(int i=fst[u];i;i=nxt[i])
    {
        int v=to[i];if(v==fa)continue;
        int g=mx[u]==mx[v]+1?smx[u]+1:mx[u]+1;
        if(siz[1]-siz[v])mi[v]=min(mi[v],g);
        if(g>mx[v])smx[v]=mx[v],mx[v]=g;
        else if(g>smx[v])smx[v]=g;
        dfs2(v,u);
    }
}
int main()
{
    scanf("%d",&n);
    for(int i=2,u,v;i<=n;i++)scanf("%d%d",&u,&v),ade(u,v),ade(v,u);
    scanf("%s",st+1);
    for(int i=1;i<=n;i++)p[i]=st[i]=='1';
    dfs1(1,0),dfs2(1,0);
    cout<<ans+1<<endl;
}

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

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

    set<int> st;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        if(a >= 3200) cnt++;
        else
        st.insert(a / 400);
    }
    cout << (st.size() == 0 ? 1 :st.size() )<< " " << st.size() + cnt << endl;

}

Measured memory_bytes: 256
master_list = list(map(int, input().split(' ')))

sabun = master_list[1] - master_list[0]

if master_list[2] >= sabun:
    next_list = [x for x in range(master_list[0], master_list[1] + 1)]
    print(*next_list, sep='\n')
else:
    a_list = [x for x in range(master_list[0], master_list[0] + master_list[2])]
    b_list = [x for x in range(master_list[1], master_list[1] - master_list[2], -1)]
    last_list = sorted(list(set(a_list) | set(b_list)))
    print(*last_list, sep='\n')


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

#define rep(i,n) for (int i = 0; i< (n); ++i)
#define vvec(m,n) vector<vector<int>> (int(m), vector<int>(n))
#define ALL(a) (a).begin(), (a).end()

using ll = long long;

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    string res;
    if(A+B>C+D) res = "Left";
    else if(A+B==C+D) res = "Balanced";
    else res = "Right";

    cout << res << endl;
}

Measured memory_bytes: 256
using System;

namespace ABC043_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine().ToCharArray();
            var str = "";

            foreach (var c in S)
            {
                if (c == '0' || c == '1')
                {
                    str += c;
                }
                else if (str.Length > 0)
                {
                    str = str.Substring(0, str.Length - 1);
                }
            }

            Console.WriteLine(str);
        }
    }
}


Measured memory_bytes: 13140
n = int(input())
A = [input() for _ in range(n)]
a = int()
b = int()
c = int()
d = int()
for x in range(n):
    if A[x] == "AC":
        a = a+1
    elif A[x] == "WA":
        b = b+1
    elif A[x] == "TLE":
        c = c+1
    elif A[x] == "RE":
        d = d+1
print("AC x",a)
print("WA x",b)
print("TLE x",c)
print("RE x",d)

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

using namespace std;

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

#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=b-1; i>=a; --i)

int gcd(int a,int b){
	return b==0 ? a : gcd(b, a%b);
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s, t;
	cin>>s>>t;
	int a=s.size(), b=t.size();
	REP(i, a){
		if(a-i<b) break;
		REP(j, b){
			if(s[a-1-i-j]!=t[b-1-j] && s[a-1-i-j]!='?') break;
			if(j==b-1){
				REP(k, a-i-b){
					s[k]=='?' ? cout<<'a' : cout<<s[k];
				}
				cout<<t;
				FOR(k, a-i, a){
					s[k]=='?' ? cout<<'a' : cout<<s[k];
				}
				cout<<'\n';
				return 0;
			}
		}
	}
	cout<<"UNRESTORABLE"<<'\n';
	return 0;
}


Measured memory_bytes: 256
function main(input){

    inputArray=input.split(' ');
    A=parseInt(inputArray[0]);
    B=parseInt(inputArray[1]);
    C=parseInt(inputArray[2]);
    K=parseInt(inputArray[3]);
    out=0;
    
    if(A<K){
        K=K-A;
        out=A;
        if(K<=B){
            console.log(out);
        }
        else if(B<K){
            K=K-B;
            out=out-K;
            console.log(out);
        }
    }
    else if(K<=A){
        out=K;
        console.log(out);
    }
}
 
main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(){
	int a;
	cin >> a;
	int num = a / 100;
	int ans = a % 100;
	if(ans <= num * 5){
		printf("1");
	}
	else{
		printf("0");
	}
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a;
  int b=0,c=1,d=1;
  map<int,int> m;
  for(int i=0;i<n;i++){
    cin>>a;
    m[a]=i;
  }
  b=m[1];
  for(int i=2;i<=n;i++){
    if(b<m[i]){
      c++;
    }else{
      d=max(c,d);
      c=1;
    }
    b=m[i];
  }
  d=max(c,d);
  cout<<n-d;
}

Measured memory_bytes: 9600
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const ll mod = 1000000007;

vector<bool> visited;

void dfs(const Graph &G, int v) {
    visited[v] = true;
    for(auto u : G[v]) { 
        if(visited[u]) {
            continue;
        }
        dfs(G, u);
    }
}

int main() {
    int n, m;
    cin >> n >> m;    

    Graph G(n);
    rep(i, m) {
        int x, y, z;
        cin >> x >> y >> z;
        x--;  y--;
        G[x].push_back(y);
        G[y].push_back(x);
    }

    visited.assign(n, false);

    int renketuseibun = 0;  // 連結成分の個数
    rep(i, n) {
        if(visited[i]) {
            continue;
        } 
        dfs(G, i);
        renketuseibun++;
    }
    
    cout << renketuseibun << endl;
    return 0;
}

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

int  main(){
    int N,X,A[150];
    int sum =0,min=10000000;
    cin >> N >> X;
    for (int i=0; i<N; ++i) {
                      cin >> A[i];
                      sum += A[i];
                      if (A[i]<min) {min=A[i];}
        }
    int ans = N+(X-sum)/min;
    cout << ans << endl;    
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        final int K = sc.nextInt();

        final int[] p = new int[N];
        for (int i = 0; i < N; i++) {
            p[i] = sc.nextInt();
        }
        sc.close();

        final ArrayList<Integer> list = new ArrayList<Integer>();
        for (final int t : p)
            list.add(t);

        Collections.sort(list);

        int sum = 0;

        for (int i = 0; i < K; i++) {
            sum += list.get(i);
        }

        System.out.println(sum);

        return;
    }
}

Measured memory_bytes: 38760
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007
#define Vi vector<int>
#define Vl vector<long long>
#define pb(a) push_back(a)

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=10000000000000000001;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct edge{int to,cost;};
struct pos{
	int x,y,cost;
};
char c[1001][1001]={};
int a[1001][1001]={};
int dp[1001][1001]={};

int main() {

	int w,h,n;
	cin>>h>>w>>n;

	int si=0,sj=0;
	rep(i,h){
		rep(j,w){
			cin>>c[j][i];
			if(c[j][i]=='S'){
				sj=j;
				si=i;
				a[j][i]=-1;
			}else if(c[j][i]!='.'&&c[j][i]!='X'){
				a[j][i]=c[j][i]-48;
			}

		}
	}
	queue<pos> que;
	ll total=0;
	for(int i=1; i<n+1; i++){
		pos pos1={sj,si,0};
		que.push(pos1);
		while(!que.empty()){
			pos pos2=que.front();que.pop();
			if(dp[pos2.x][pos2.y]==1)continue;
			if(a[pos2.x][pos2.y]==0&&c[pos2.x][pos2.y]!='.')continue;
			if(a[pos2.x][pos2.y]==i){
				total+=pos2.cost;
				while(!que.empty())que.pop();
				si=pos2.y;
				sj=pos2.x;
				break;
			}
			dp[pos2.x][pos2.y]=1;
			pos pos3={pos2.x+1,pos2.y,pos2.cost+1};
			que.push(pos3);
			pos pos4={pos2.x-1,pos2.y,pos2.cost+1};
			que.push(pos4);
			pos pos5={pos2.x,pos2.y+1,pos2.cost+1};
			que.push(pos5);
			pos pos6={pos2.x,pos2.y-1,pos2.cost+1};
			que.push(pos6);
		}
		rep(j,h)rep(k,w)dp[k][j]=0;
	}
	cout<<total<<endl;

	return 0;
}



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

// dp[si+1][ti+1] := 文字列sのsi文字目かつ文字列tのti文字目までの最長共通部分列
int dp[3030][3030];

// 0: 斜め移動, 1:横移動, 2:縦移動
int memo[3030][3030];

int main() {
  string s,t;
  cin>>s>>t;
  
  for(unsigned int si=0;si<s.size();++si){
    for(unsigned int ti=0;ti<t.size();++ti){
      if(s[si]==t[ti]){
        dp[si+1][ti+1]=dp[si][ti]+1;
        memo[si+1][ti+1]=0;
      }else if(dp[si+1][ti]>dp[si][ti+1]){
        // si-1文字目かつti文字目までの最長共通部分列よりも,
        // si文字目かつti-1文字目までの最長共通部分列の方が長い    
        dp[si+1][ti+1]=dp[si+1][ti];
        memo[si+1][ti+1]=1;
      }else{
        // si-1文字目かつti文字目までの最長共通部分列よりも,
        // si文字目かつti-1文字目までの最長共通部分列の方が長い  
        dp[si+1][ti+1]=dp[si][ti+1];
        memo[si+1][ti+1]=2;
      }
    }
  }



  string ans="";
  int n = dp[s.size()][t.size()];
  int si=s.size(),ti=t.size();

  while(n>0){
    if(memo[si][ti]==0){
      // 斜め移動
      --si; --ti;
      ans+=s[si];
      --n;
    }else if(memo[si][ti]==1){
      // 横移動
      --ti;
    }else{
      // 縦移動
      --si;
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

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

struct edge { int to,cost; };

int main() {
  int N,K;cin>>N>>K;
  set<int> DS;
  REP(i,K) { int d;cin>>d;DS.insert(d); }

  while (true) {
    string tmp = to_string(N);
    bool checker = true;
    REP(i,tmp.size()) {
      if (DS.find(tmp[i]-'0')!=DS.end()) checker = false;
    }
    if (checker) {
      OUT(N);
      break;
    }
    N++;
  }

  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
itsumono = 10 ** 9 + 7
#kaijou = [1]
ruiseki = [0]
ruiseki += [a[0]]

#for i in range(1, n + 1):
#    kaijou += [(kaijou[-1] * i) % itsumono]
for i in range(1, n):
    ruiseki += [ruiseki[-1] + a[i]]

g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, 100003):
    g1.append((g1[-1] * i) % itsumono)
    inverse.append((-inverse[itsumono % i] * (itsumono // i)) % itsumono)
    g2.append((g2[-1] * inverse[-1]) % itsumono)

ruiseki2 = []
ruiseki2 += [ruiseki[-2] - ruiseki[1]]

for i in range(n - 3):
    ruiseki2 += [ruiseki2[-1] + ruiseki2[0] - (ruiseki[i+2] - ruiseki[1]) - (ruiseki[-2] - ruiseki[n-2-i])]


def sum_(n, ruiseki, i):
    num = 0
    if i == 0: #まだなんも選んでない
        num += (ruiseki[n] - ruiseki[i]) * g1[n - i]
    elif i == 1: #左端か右端が1個抜かれてる奴～ｗｗｗ
        num += (ruiseki[n] - ruiseki[i]) * g1[n - i]
        num += (ruiseki[n-i] - ruiseki[0]) * g1[n - i]

    else: #左端からi番目か右端からi番目が抜かれてる奴～ｗｗｗ
        #num += (ruiseki[n] - ruiseki[i]) * kaijou[n] / kaijou[n - i + 1] * kaijou[n - i]
        num += (ruiseki[n] - ruiseki[i]) * g1[n] * g2[n - i + 1] * g1[n - i]
        #num += (ruiseki[n - i] - ruiseki[i - i]) * kaijou[n] / kaijou[n - i + 1] * kaijou[n - i]
        num += (ruiseki[n - i] - ruiseki[i - i]) * g1[n] * g2[n - i + 1] * g1[n - i]

    #左端と右端のが抜かれてる奴～ｗｗｗ　幅がi
        #num += (ruiseki2[i-2]) * kaijou[n] / kaijou[n - i + 2] * kaijou[n - i] * 2
        num += (ruiseki2[i - 2]) * g1[n] * g2[n - i + 2] * g1[n - i] * 2

    return num

ans = 0
for i in range(n):
    ans += sum_(n, ruiseki, i)

print(int(ans) % itsumono)

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

int main()
{
    int n, l, arad[11] = {0}, t;
    scanf("%d%d", &n, &l);
    for(int i = 0; i < l; i++)
    {
        scanf("%d", &t);
        arad[t]++;
    }
    for(int i = n; ; i++)
    {
        int a = i, f = 1;
        while(a)
        {
            if(arad[a%10] > 0)
            {
                f = 0;
                break;
            }
            a /= 10;
        }
        if(f)
        {
            printf("%d", i);
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
Q = int(input())

ans = []
for _ in range(Q):
    A, B = map(int, input().split())

    if A == B:
        ans.append(2 * A - 2)
        continue

    C = (A * B)**0.5
    D = int(C)

    if C.is_integer():
        D -= 1

    F = 2 * D - 1
    if D * (D + 1) >= A * B:
        F -= 1

    ans.append(F)

print(*ans, sep='\n')

Measured memory_bytes: 3188