akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main ( )
{
  int VAR00 , VAR01 , VAR02 , VAR03 ;
  double VAR04 , VAR05 ;
  scanf ( "%d" , & VAR03 ) ;
  double VAR06 [ VAR03 ] , VAR07 [ VAR03 + 1 ] , VAR08 [ VAR03 + 1 ] [ VAR03 + 1 ] , VAR09 [ VAR03 + 1 ] ;
  for ( VAR00 = 0 ; VAR00 < VAR03 ; VAR00 ++ ) fscanf ( stdin , "%lf" , VAR06 + VAR00 ) ;
  fscanf ( stdin , "%lf" , VAR07 ) ;
  VAR08 [ 0 ] [ 0 ] = VAR07 [ 0 ] ;
  VAR09 [ 0 ] = VAR06 [ 0 ] + VAR07 [ 0 ] ;
  for ( VAR00 = 1 ; VAR00 <= VAR03 ; VAR00 ++ ) {
    fscanf ( stdin , "%lf" , VAR07 + VAR00 ) ;
    VAR08 [ VAR00 ] [ VAR00 ] = VAR07 [ VAR00 ] ;
    VAR08 [ VAR00 - 1 ] [ VAR00 ] = VAR06 [ VAR00 - 1 ] + ( VAR07 [ VAR00 - 1 ] + VAR07 [ VAR00 ] ) * 2 ;
    VAR09 [ VAR00 ] = VAR09 [ VAR00 - 1 ] + VAR06 [ VAR00 ] + VAR07 [ VAR00 ] ;
  }

  for ( VAR02 = 1 ; VAR02 < VAR03 ; VAR02 ++ ) {
    for ( VAR00 = 0 ; VAR00 < VAR03 - VAR02 ; VAR00 ++ ) {
      VAR04 = VAR08 [ VAR00 ] [ VAR00 ] + VAR08 [ VAR00 + 1 ] [ VAR00 + VAR02 + 1 ] ;
      for ( VAR01 = VAR00 ; VAR01 < VAR00 + VAR02 ; VAR01 ++ ) {
        VAR05 = VAR08 [ VAR00 ] [ VAR01 + 1 ] + VAR08 [ VAR01 + 2 ] [ VAR00 + 1 + VAR02 ] ;
        if ( VAR04 > VAR05 ) VAR04 = VAR05 ;
      }
      VAR08 [ VAR00 ] [ VAR00 + VAR02 + 1 ] = VAR04 + VAR09 [ VAR00 + VAR02 ] - VAR09 [ VAR00 - 1 ] + VAR07 [ VAR00 + VAR02 + 1 ] ;
    }
  }
  printf ( "%lf\n" , VAR08 [ 0 ] [ VAR03 ] ) ;

  return 0 ;
}


Measured memory_bytes: 3776
import sys

sys.setrecursionlimit(2 * 10 ** 5)

N = int(input())

A = [int(x) for x in input().split()]
A = sorted((a, i) for i, a in enumerate(A))

cache = [[None for i in range(N + 1)] for j in range(N + 1)]


def dp(l, r):
    if l > r:
        return 0
    if cache[l][r] is None:
        a, x = A[r - l]
        cache[l][r] = max(a * abs(x - l) + dp(l + 1, r), a * abs(x - r) + dp(l, r - 1))
    return cache[l][r]


print(dp(0, N - 1))


Measured memory_bytes: 194608
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
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 Tarek
 */
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);
        BProductMax solver = new BProductMax();
        solver.solve(1, in, out);
        out.close();
    }

    static class BProductMax {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long a = in.nextLong();
            long b = in.nextLong();
            long c = in.nextLong();
            long d = in.nextLong();
            long ans1 = a * c;
            long ans2 = a * d;
            long ans3 = b * c;
            long ans4 = b * d;
            long ans = Math.max(Math.max(ans1, ans2), Math.max(ans3, ans4));
            out.println(ans);
        }

    }

    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 long nextLong() {
            return Long.parseLong(next());
        }

    }
}



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

int main() {
    ll N, W;
    cin >> N >> W;
    vector<ll> w(N), v(N);
    rep(i, N) cin >> w[i] >> v[i];

    vector<vector<ll>> dp(N + 1, vector<ll>(1e5 + 1, 1e18));
    dp[0][0] = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= 1e5; j++) {
            if (j - v[i] >= 0)
                dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
            else
                dp[i + 1][j] = dp[i][j];
        }
    }
    // for (auto v : dp) {
    //     for (ll a : v) {
    //         cout << a << " ";
    //     }
    //     cout << endl;
    // }
    ll ans = 0;
    rep(i, 1e5 + 1) {
        if (dp[N][i] <= W) {
            ans = max(ans, (ll)i);
        }
    }
    cout << ans << endl;
}

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


int s;


int main() {
    cin >> s;
    unordered_set<ll> st;
    ll x = s;
    int ans = 1;
    while (!st.count(x)) {
        st.insert(x);
        ans++;
        x = (x % 2 == 0)? x / 2 : 3 * x + 1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
def main():
  import sys
  input=sys.stdin.buffer.readline
  h,w=map(int,input().split())
  s=[c>>3for _ in range(h)for c in input()[:w]]
  dp=[10001]*h*w
  dp[0]=5-s[0]
  for i in range(1,w):
    dp[i]=dp[i-1]+(s[i-1]^s[i])
  for i in range(w,h*w,w):
    dp[i]=dp[i-w]+(s[i-w]^s[i])
  for i in range(1,h):
    for j in range(1,w):
      k=i*w+j
      t=dp[k-1]+(s[k-1]^s[k])
      u=dp[k-w]+(s[k-w]^s[k])
      if t>u:t=u
      dp[k]=t
  print(dp[-1]+1>>1)
main()

Measured memory_bytes: 3188
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
 
const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

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

    vector<ll> a(n), b(n), c(n);
    rep(i, n)cin >> a[i];
    rep(i, n)cin >> b[i];
    rep(i, n)cin >> c[i];

    sort(ALL(a));
    sort(ALL(b));
    sort(ALL(c));

    ll cnt_b[100010] = {};
    rep(i, n){
        ll pos_c = upper_bound(ALL(c), b[i]) - c.begin();
        cnt_b[i] = n-pos_c;
    }

    for(ll i = n-2; i >= 0; --i)cnt_b[i] += cnt_b[i+1];

    ll ans = 0;
    rep(i, n){
        ll pos_b = upper_bound(ALL(b), a[i]) - b.begin();
        ans += cnt_b[pos_b];
    } 

    cout << ans << endl;
}

Measured memory_bytes: 3328
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<climits>
#define gc getchar()
#define N 200010
#define lint long long
using namespace std;
inline int inn()
{
	int x,ch;while((ch=gc)<'0'||ch>'9');
	x=ch^'0';while((ch=gc)>='0'&&ch<='9')
		x=(x<<1)+(x<<3)+(ch^'0');return x;
}
int a[N];
int main()
{
	int n=inn();lint ans=0ll;
	for(int i=1;i<=n;i++) a[i]=inn();
	for(int i=1;i<n;i++)
		if(a[i+1]-a[i]>1) return !printf("-1\n");
	if(a[1]) return !printf("-1\n");
	for(int i=1;i<=n;i++)
		if(a[i+1]!=a[i]+1) ans+=a[i];
	return !printf("%lld\n",ans);
}

Measured memory_bytes: 1024
def main():
    N, A, B = map(int, input().split())
    H = [int(input()) for _ in range(N)]
    left = 1
    right = max(H)
    while right - left > 1:
        t = (right + left) // 2
        c = 0
        for h in H:
            x = h - B * t
            if 0 >= x:
                continue
            c += x // (A - B)
            if x % (A - B):
                c += 1
        if c > t:
            left = t
        else:
            right = t
    print(right)


main()


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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int po[11];

int main(){
  int x;
  REP(i,3){
    cin>>x;
    po[x]++;
  }
  puts((po[5]==2&&po[7]==1)?"YES":"NO");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	
	int a; string s;
	cin >> a >> s;
	cout << (a >= 3200 ? s : "red") << '\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
using namespace std;

const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  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;
  }
};
template<class T> bool chmin(T& a,T b);
template<class T> bool chmax(T& a,T b);

mint dp1[310][90010];
mint dp2[310][90010];
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);
    int n;cin >> n;
    vector<int> a(n);
    int sum = 0;
    for(int i = 0;i < n;i++){
        cin >> a[i];
        sum += a[i];
    }
    int half = (sum + 1)/2;
    mint all = (mint)3;all = all.pow(n);
    
    //cout << "all : " << all.x << '\n';
    dp1[0][0] = (mint)2;
    dp1[0][a[0]] = (mint)1;
    for(int i = 1;i < n;i++){
        for(int j = 0;j <= sum;j++){
            dp1[i][j] += (mint)2*dp1[i-1][j];
            if(j >= a[i])dp1[i][j] += dp1[i-1][j-a[i]];
        }
    }
    mint dis1 = 0;
    for(int j = half;j <= sum;j++){
        dis1 += (mint)3 * dp1[n-1][j];
        all -= (mint)3 * dp1[n-1][j];
    }
    //cout << "dis1 : " << dis1.x << '\n';
    dp2[0][0] = dp2[0][a[0]] = (mint)1;
    for(int i = 1;i < n;i++){
        for(int j = 0;j <= sum;j++){
            dp2[i][j] += dp2[i-1][j];
            if(j >= a[i])dp2[i][j] += dp2[i-1][j-a[i]];
        }
    }
    if(sum %2 == 0){
        all += (mint)3 * dp2[n-1][half];
    }
    cout << all.x << '\n';
    return 0;
}

///////////////////////////////////////////////////////////
template<class T> bool chmin(T& a,T b){
    if(a > b){a = b;return true;}else return false;
}
template<class T> bool chmax(T& a,T b){
    if(a < b){a = b;return true;}else return false;
}


Measured memory_bytes: 436352
#include <stdio.h>

int width,height;
char program[20][24];

char visited[20][20][16][4];

#define DIR_UP 0
#define DIR_LEFT 1
#define DIR_RIGHT 2
#define DIR_DOWN 3

const int dxy[4][2]={
	{0,-1},{-1,0},{1,0},{0,1}
};

int runProgram(int x,int y,int mem,int dir) {
	int isStop=0;
	int i;
	if(x<0)x=width-1;
	if(x>=width)x=0;
	if(y<0)y=height-1;
	if(y>=height)y=0;
	if(visited[x][y][mem][dir])return visited[x][y][mem][dir]-1;
	visited[x][y][mem][dir]=1;
	if(isdigit(program[y][x])) {
		isStop=runProgram(x+dxy[dir][0],y+dxy[dir][1],program[y][x]-'0',dir);
	} else {
		switch(program[y][x]) {
			case '<':
				isStop=runProgram(x-1,y,mem,DIR_LEFT);
				break;
			case '>':
				isStop=runProgram(x+1,y,mem,DIR_RIGHT);
				break;
			case '^':
				isStop=runProgram(x,y-1,mem,DIR_UP);
				break;
			case 'v':
				isStop=runProgram(x,y+1,mem,DIR_DOWN);
				break;
			case '_':
				if(mem==0) {
					isStop=runProgram(x+1,y,mem,DIR_RIGHT);
				} else {
					isStop=runProgram(x-1,y,mem,DIR_LEFT);
				}
				break;
			case '|':
				if(mem==0) {
					isStop=runProgram(x,y+1,mem,DIR_DOWN);
				} else {
					isStop=runProgram(x,y-1,mem,DIR_UP);
				}
				break;
			case '?':
				isStop|=runProgram(x-1,y,mem,DIR_LEFT);
				isStop|=runProgram(x+1,y,mem,DIR_RIGHT);
				isStop|=runProgram(x,y-1,mem,DIR_UP);
				isStop|=runProgram(x,y+1,mem,DIR_DOWN);
				break;
			case '.':
				isStop=runProgram(x+dxy[dir][0],y+dxy[dir][1],mem,dir);
				break;
			case '@':
				isStop=1;
				break;
			case '+':
				isStop=runProgram(x+dxy[dir][0],y+dxy[dir][1],(mem==15)?0:(mem+1),dir);
				break;
			case '-':
				isStop=runProgram(x+dxy[dir][0],y+dxy[dir][1],(mem==0)?15:(mem-1),dir);
				break;
		}
	}
	visited[x][y][mem][dir]+=isStop;
	return isStop;
}

int main(void) {
	int i;
	scanf("%d%d",&height,&width);
	for(i=0;i<height;i++)scanf("%s",program[i]);
	puts(runProgram(0,0,0,DIR_RIGHT)?"YES":"NO");
	return 0;
}

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

int main (void){
  
  int R; cin >> R;
  
  if(R < 1200){
    
    cout << "ABC" << endl;
    
  }else if(R >= 1200 && R < 2800){

    cout << "ARC" << endl;
    
  }else{
    
    cout << "AGC" << endl;
    
  }
  
  return 0;
  
}


Measured memory_bytes: 256
from bisect import bisect

Q = int(input())
xs = [-10 ** 10, 10 ** 10]
min_index = 0
minimum = 0
for _ in range(Q):
    s = input()
    if s[0] == '1':
        a, b = map(int, s[2:].split())
        index = bisect(xs, a)
        xs.insert(index, a)
        # f(xs[min_index]) == minimum を成立させるために調整。
        if min_index >= index:
            min_index += 1 
        minimum += abs(xs[min_index] - a) + b
        # min_indexがminを与えるように調整。minimumも同時に調整。
        if min_index < (len(xs) - 1) // 2:
            minimum += ((len(xs) % 2) - 2) * (xs[min_index + 1] - xs[min_index])
            min_index += 1
        elif min_index > (len(xs) - 1) // 2:
            minimum += (len(xs) % 2) * (xs[min_index - 1] - xs[min_index])
            min_index -= 1
    else:
        print(xs[min_index], minimum)


Measured memory_bytes: 83932
from collections import deque
N,M=map(int,input().split())
tr=[[] for _ in range(N)]
for _ in range(M):
    a,b=map(int,input().split())
    tr[a-1].append(b-1)
    tr[b-1].append(a-1)
ans=[-1]*N
q=deque([0])
v=[True]*N
x=[True]*N
while q:
    t=q.popleft()
    if v[t]:
        v[t]=False
        for j in tr[t]:
            if x[j]:
                x[j]=False
                ans[j]=t
                q.append(j)
print('Yes')
for i in range(1,N):
    print(ans[i]+1)

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

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

    int ans = 0;
    for (int i = 1; i < S.size(); ++i) {
        if (S[i-1] != S[i]) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3740
#include<stdio.h>
int main()
{
    int a,b,sum,temp,count=0,count_1=1;

   // scanf("%d%d",&a,&b);
  // if()
    while( (scanf("%d %d",&a,&b))!=EOF)
    {
        //if(count_1>0)
           // break;
         //count_1++;


         if(a<=1000000&&b<=1000000)
         {
            sum=a+b;
            temp=sum;
            //count=0;
            while(temp!=0)
             {
                 sum/=10;
                 temp=sum;
                 count++;
             }
             printf("%d\n",count);
               //count=0;
         }
        count=0;
        //count1=0;
         if(count_1>200)
            break;
                 count_1++;



    }
     //printf("count_1=%d",count_1);

    return 0;
}

Measured memory_bytes: 600
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')
fact = [i for i in range(4 * 10 ** 5 + 1)]
fact[0] = 1
for i in range(4 * 10 ** 5):
    fact[i + 1] *= fact[i]
    fact[i + 1] %= mod

def combination_mod(n, k, mod):
    """ power_funcを用いて(nCk) mod p を求める """
    """ nCk = n!/((n-k)!k!)を使用 """
    if n < 0 or k < 0 or n < k:
        return 0
    if n == 0 or k == 0:
        return 1
    a = fact[n] % mod
    b = fact[k] % mod
    c = fact[n - k] % mod
    return (a * pow(b, mod - 2, mod) * pow(c, mod - 2, mod)) % mod

#solve
def solve():
    n, k = LI()

    if n <= k:
        print(combination_mod(2 * n - 1, n, mod))
    else:
        if k == 1:
            print(n * (n - 1))
        else:
            ans = 1
            for i in range(1, k + 1):
                ans += combination_mod(n - 1, n - i - 1, mod) * combination_mod(n, i, mod)
                ans %= mod
                # print(ans)
            print(ans)

    return


#main
if __name__ == '__main__':
    solve()


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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

    int q = x/100;
    int r = x%100;

    cout<<(r<=q*5)<<endl;
    return 0;
}

Measured memory_bytes: 3544
#include <iostream>

using namespace std;

int main()
{
    int sum;
    int price, num;
    int cnt;
    double ave;
    char ch;

    sum = ave = cnt = 0;
    while (cin >> price >> ch >> num) {
        sum += (price * num);
        ave += num;
        cnt++;
    }
    cout << sum << '\n' << (int)((ave / cnt) + 0.5) << endl;
    
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
using namespace std;
int n,m,a[1001][1001];
int ans[1000001][5],tot;
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;++i)
		for (int j=1;j<=m;++j) scanf("%d",&a[i][j]);
	for (int i=1;i<=n;++i)
	{
		for (int j=1;j<m;++j)
			if (a[i][j]%2)
				ans[++tot][1]=i,ans[tot][2]=j,ans[tot][3]=i,ans[tot][4]=j+1,a[i][j+1]++;
		if (i!=n&&a[i][m]%2) ans[++tot][1]=i,ans[tot][2]=m,ans[tot][3]=i+1,ans[tot][4]=m,a[i+1][m]++;
	}
	printf("%d\n",tot);
	for (int i=1;i<=tot;++i) printf("%d %d %d %d\n",ans[i][1],ans[i][2],ans[i][3],ans[i][4]);
}

Measured memory_bytes: 10240
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

struct uf {
private:
	vector<int> par, ran;
public:
	void init(int n) {
		par.resize(n, 0);
		ran.resize(n, 0);
		rep(i, n) {
			par[i] = i;
		}
	}
	int find(int x) {
		if (par[x] == x)return x;
		else return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x), y = find(y);
		if (x == y)return;
		if (ran[x] < ran[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (ran[x] == ran[y])ran[x]++;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};
void solve() {
	int n, m; cin >> n >> m;
	uf u; u.init(n+1);
	rep(i, m) {
		int x, y, z; cin >> x >> y >> z; x--; y--;
		u.unite(x, y);
	}
	int ans = 0;
	rep(i, n) {
		if (!u.same(n, i))ans++;
		u.unite(n, i);
	}
	cout << ans << endl;
}

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

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int W, H;
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
int main()
{
    while (1) {
        cin >> W >> H;
        if (W == 0 && H == 0) break;
        vector<vector<int>> maze(H * 2 + 1, vector<int>(W * 2 + 1, 0));
        rep(i, W * 2 + 1) {
            maze[0][i] = 1; maze[H * 2][i] = 1;
        }
        rep(i, H * 2 + 1) {
            maze[i][0] = 1; maze[i][W * 2] = 1;
        }
        
        rep(i, 2 * H - 1) {
            int k;
            if (i % 2 == 0) {
                rep(j, W - 1) {
                    cin >> k;
                    maze[i + 1][(j + 1) * 2] = k;
                }
            }
            else {
                rep(j, W) {
                    cin >> k;
                    maze[i + 1][j * 2 + 1] = k;
                }
            }
        }

        queue<P> que;
        vector<vector<int>> d(H * 2 + 1, vector<int>(W * 2 + 1, -1));
        que.push(P(1, 1)); //(x, y)
        d[1][1] = 1;
        int gx = W * 2 - 1, gy = H * 2 - 1;
        while (!que.empty()) {
            P p = que.front(); que.pop();
            if (p.first == gx && p.second == gy) break;
            rep(i, 4) {
                int tx = dx[i] + p.first, ty = dy[i] + p.second;
                if (maze[ty][tx] == 1) continue;
                if (d[ty + dy[i]][tx + dx[i]] != -1) continue;
                d[ty + dy[i]][tx + dx[i]] = d[p.second][p.first] + 1;
                que.push(P(tx + dx[i], ty + dy[i]));
            }
        }
        cout << (d[gy][gx] == -1 ? 0 : d[gy][gx]) << endl;


    }

    return 0;
}


Measured memory_bytes: 3032
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>
#include <cmath>

inline void read(int & x)
{
	x = 0;
	int k = 1;
	char c = getchar();
	while (!isdigit(c))
		if (c == '-') c = getchar(), k = -1;
		else c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ 48),
		c = getchar();
	x *= k;
}

int n, w, ans;
double t, x, now = 99999999.9;

signed main()
{
	read(n), std::cin >> t, read(w);
	for (int i = 1; i <= n; ++i) 
	{
		std::cin >> x;
		if (fabs(t - 0.006 * x - w) < now) ans = i, now = fabs(t - 0.006 * x - w);
	}
	printf("%d", ans);
}



Measured memory_bytes: 256
use proconio::marker::Chars;
use proconio::{fastout, input};
use std::collections::HashMap;

#[fastout]
fn main() {
    input! {s: Chars};

    let mut map = HashMap::new();

    for i in s.iter() {
        let count = map.entry(i).or_insert(0);
        *count += 1;
    }

    let mut flag = true;

    for (_, value) in map {
        if value != 2 {
            flag = false;
            break;
        }
    }

    if flag && s.len() == 4 {
        println!("Yes")
    } else {
        println!("No")
    }
}


Measured memory_bytes: 2168
import itertools

n, a, b, c = map(int, input().split())
_l = [int(input()) for i in range(n)]

cl = ('A', 'B', 'C', 'N')

result = 1e10
for pattern in itertools.product(*[cl]*n):
    wands = {'A': 0, 'B': 0, 'C': 0}
    point = 0
    for i, char in enumerate(pattern):
        if char != 'N':
            if wands[char] != 0:
                point += 10
            wands[char] += _l[i]
    if min(wands.values()) > 0:
        point += abs(wands['A'] - a) + abs(wands['B'] - b) + abs(wands['C'] - c)
        if point < result:
            result = point

print(result)


Measured memory_bytes: 3064
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=[0]*(n+1)
for i in range(1,n+1):
    d[i]=d[i-1]+l[i-1]
    if d[i]>x:
        print(i)
        break
else:
    print(n+1)

Measured memory_bytes: 3064
from sys import stdin,stdout
from collections import defaultdict
import math
#input=stdin.readline
#def print(x):stdout.write(str(x)+'\n')
s=input()
if s=='RRR':
    print(3)
elif 'RR' in s:
    print(2)
elif 'R' in s:
    print(1)
else:
    print(0)

Measured memory_bytes: 9304
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    n--;
    vector<int> p(n),q(n),r(n);
    for(int i=0;i<n;i++){
        cin>>p[i]>>q[i]>>r[i];
    }
    for(int i=0;i<n;i++){
        int c=0;
        for(int j=i;j<n;j++){
            if(c<q[j])c=q[j];
            else {
                //cout<<p[j]<<q[j]<<r[j]<<((c-q[j]+r[j]-1)/r[j])*r[j]<<"WWW"<<endl;
                c=((c-q[j]+r[j]-1)/r[j])*r[j]+q[j];
            }
            c+=p[j];
            //cout<<c<<"W"<<endl;
        }
        cout<<c<<endl;
    }
    cout<<0<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main()
{
	int n;
	scanf("%d",&n);
	int x[101];
	int y[101];
	for(int i=0;i<n;i++)
	{
		scanf("%d",&x[i]);
	}
	for(int i=0;i<n;i++)
	{
		scanf("%d",&y[i]);
	}
	double sum=0;
	int a;
	for(int i=0;i<n;i++)
	{
		a=x[i]-y[i];
		if(a>=0)
		sum+=a;
		else
		sum-=a;
	}
	printf("%lf\n",sum);
	sum=0;
	double b;
	for(int i=0;i<n;i++)
	{
		b=x[i]-y[i];
		b=pow(b,2);
		sum+=b;
	}
	sum=sqrt(sum);
	printf("%.20lf\n",sum);
	sum=0;
	for(int i=0;i<n;i++)
	{
		b=x[i]-y[i];
		b=pow(b,3);
		if(b>=0)
		sum+=b;
		else
		sum-=b;
	}
	sum=pow(sum,1.0/3);
	printf("%.20lf\n",sum);
	sum=0;
	for(int i=0;i<n;i++)
	{
		b=x[i]-y[i];
		if(b<0)
		b=-b;
		if(b>sum)
		sum=b;
	}
	printf("%.20lf\n",sum);
	return 0;
} 


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

int main() {
  int a,b,ans;
  cin >> a >> b;
  ans = a*b;
  cout << ans <<endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

#define Pr(f,...) fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

const int N=2005,M=2005,P=1e9+7;

int mul(int a,int b){ return 1ll*a*b%P; }
int add(int a,int b){ a+=b; return (a>=P?a-P:a); }
int sub(int a,int b){ a-=b; return (a<0?a+P:a); }

int n,m,k,f[2][N],ans;

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	freopen("dat.in","r",stdin);
	//freopen("my.out","w",stdout);
#endif
	//n ones and m zeros 
	read(n),read(m),read(k); 
	swap(n,m),--m,--k;
	rep(i,0,n)f[0][i]=1;
	rep(i,1,n+m){
		int s=0,c=i&1,p=!c; 
		memset(f[c],0,sizeof(f[c]));
		rep(j,1,n){
			f[c][j]=sub(f[p][j],j>=(k+1)?f[p][j-k-1]:0);
			int l=k*i-j;
			if(j%k==n%k&&j<=n&&l<=m&&l%k==m%k){
				ans=add(ans,f[c][j]); 
			}
			f[c][j]=s=add(s,f[c][j]); 
		}
	}
	printf("%d\n",ans); 
	return 0; 
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

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

ll add(ll a, ll b, ll m = MOD){ return (a%m + b%m+2*m)%m;}

ll mul(ll a, ll b, ll m = MOD){ return ((a%m+m)*(b%m+m))%m;}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

const int N = 40;
const int MAX = 4800000;
const int E = 26;

int n;
int nodos = 1;
char s[N];
char act[N];
int trie[MAX][E];
map<ii,int> frequency[MAX];

void insert(int q1, int q2){
	int pos = 0;
	for(int i=0; i<n; i++){
		int next = act[i]-'a';
		if(!trie[pos][next]) trie[pos][next] = nodos++;
		pos = trie[pos][next];
	}
	frequency[pos][mp(q1,q2)]++;
}

int query(int q1, int q2){
	int pos = 0;
	for(int i=0; i<n; i++){
		int next = act[i]-'a';
		if(!trie[pos][next]) return 0;
		pos = trie[pos][next];
	}
	return frequency[pos][mp(q1,q2)];
}

int main(){
	ri(n);
	scanf("%s",s);
	for(int mask=0; mask<1<<n; mask++){
		int p = 0;
		for(int j=n-1; j>=0; j--){
			if((mask>>j)&1) continue;
			act[p++] = s[j];
		}
		for(int j=0; j<n; j++){
			if((mask>>j)&1){
				act[p++] = s[j];
			}
		}
		act[n] = '\0';
		insert(n-__builtin_popcount(mask),__builtin_popcount(mask));
	}
	ll ans = 0LL;
	for(int mask=0; mask<1<<n; mask++){
		int p = 0;
		for(int j=0; j<n; j++){
			if((mask>>j)&1){
				act[p++] = s[j+n];
			}
		}
		for(int j=n-1; j>=0; j--){
			if((mask>>j)&1) continue;
			act[p++] = s[j+n];
		}
		act[n] = '\0';
		ans += query(__builtin_popcount(mask),n-__builtin_popcount(mask));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 373504
#include<iostream>
using namespace std;
long long N, A[87], CurrentMoney=1000;

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


Measured memory_bytes: 3604
N, C = [int(_) for _ in input().split()]
xv = [[int(_) for _ in input().split()] for i in range(N)]

def solve(N, C, xv):
    
    from itertools import accumulate

    xs = [0] + [_[0] for _ in xv] + [C]
    vs = [0] + [_[1] for _ in xv] + [0]
    xs_rev = [C - x for x in xs[::-1]]
    vs_rev = vs[::-1]

    ts = accumulate(vs)
    txs = [t - x for x, t in zip(xs, ts)]
    maxtxs = list(accumulate(txs, max))

    ts_rev = accumulate(vs_rev)
    txs_rev = [t - x for x, t in zip(xs_rev, ts_rev)]
    maxtxs_rev = list(accumulate(txs_rev, max))

    return max(
        max(tx - xs_rev[i] + maxtxs[N - i] for i, tx in enumerate(txs_rev[:-1])),
        max(tx - xs[i] + maxtxs_rev[N - i] for i, tx in enumerate(txs[:-1]))
    )

print(solve(N, C, xv))


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

int main() {
	int N, M;
	cin >> N >> M;
	int H[100100];
	bool isHighest[100100];
	int count = 0;

	for (int i = 0; i < N; i++) {
		isHighest[i] = true; //道がでていない場合もよい展望台になるから
	}
	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}
	for (int i = 0; i < M; i++) {
		int A, B;
		int heightA, heightB;
		cin >> A >> B;
		heightA = H[A - 1];
		heightB = H[B - 1];

		if (heightA > heightB) {
			isHighest[B - 1] = false;
		}
		else if (heightA < heightB) {
			isHighest[A - 1] = false;
		}
		else {
			isHighest[A - 1] = false;
			isHighest[B - 1] = false;
		}

	}
	
	for (int i = 0; i < N; i++) {
		if (isHighest[i] == true) {
			count++;
		}
	}

	cout << count;

	return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;
vector<ll> x,y,h;

struct ANS {
    ll x,y,h;
    ANS(){};
    ANS(ll x, ll y, ll h):x(x),y(y),h(h){}
};


ANS calc() {
    if (x.size()==1) return ANS(x[0],y[0],h[0]);
    for (ll i = 0; i < 101; ++i) {
        for (ll j = 0; j < 101; ++j) {
            ll H = abs(x[0]-i)+abs(y[0]-j)+h[0];
            bool ok = true;
            for (int k = 0; k < x.size(); ++k) {
                if (h[k] != H-abs(x[k]-i)-abs(y[k]-j)) {
                    ok = false;
                    break;
                }
            }
            if (ok) return ANS(i,j,H);
        }
    }
    return ANS(-1,-1,-1);
}

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    rep(i,n) {
        ll a,b,c; cin>>a>>b>>c;
        if (c==0) continue;
        x.push_back(a); y.push_back(b); h.push_back(c);
    }
    ANS ans = calc();
    printf("%lld %lld %lld\n",ans.x,ans.y,ans.h);
    return 0;
}

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

using namespace std;
int main(){
  string N;
  cin >> N;
  if(N=="Sunny"){cout<<"Cloudy"<<endl;
                }
  if(N=="Cloudy"){cout<<"Rainy"<<endl;
                 }
  if(N=="Rainy"){cout<<"Sunny"<<endl;
                }
}

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

ll N;
ll ans = 0;

bool isValid(ll x){
  bool san = false,go = false, nana = false;
  while(x>0){
    int d = x%10;
    if(d==3){
      san = true;
    }
    if(d == 5){
      go = true;
    }
    if(d == 7){
      nana = true;
    }
    x /= 10;
  }
  return san&&go&&nana;
}

void dfs(ll A){
  if(A>N){
    return;
  }
  if(isValid(A)) ans++;
  dfs(A*10+3);
  dfs(A*10+5);
  dfs(A*10+7);
}

int main(){
  cin >> N;
  dfs(0);
  cout << ans << endl;
}

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

f = 1
c = 0
while f:
    f = 0
    for i in range(1, n)[::-1]:
        if A[i - 1] > A[i]:
            A[i - 1], A[i] = A[i], A[i - 1]
            c += 1
            f = True

print(*A)
print(c)



Measured memory_bytes: 5608
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
	string s, t;
	cin >> s >> t;
	int cnt = 0;
	for (int i = 0; i < 3; i++)
		if (s[i] == t[i])
			cnt++;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n, x, i=0;
  int a, b, c;
  while (1) {
    scanf("%d %d", &n, &x);
    if (n == 0 && x == 0) {
      break;
    }
    for (a = 1; a <= n; a++) {
      for (b = a + 1; b <= n; b++) {
        c = x - a - b;
        if (b < c && c <= n) {
          i++;
        }
      }
    }
    printf("%d\n", i);
    i=0;
  }
}

Measured memory_bytes: 2640
Imports System.Text
Imports System.String
Imports System
Imports System.Math

Module Module1

    Sub Main()
        Dim ans As String = ""
        Dim input As Long = CInt(Console.ReadLine)

        Dim fivehundred As Integer = CInt(Math.Floor(input / 500))
        Dim fiveyens As Integer = CInt(Math.Floor(CInt(input Mod 500) / 5))

        Console.WriteLine((fivehundred * 1000) + (fiveyens * 5))

        Console.ReadKey()
    End Sub


End Module

Measured memory_bytes: 11220
short*p,v[][99];main(c,n,m,i,y){for(;m=scanf("%d %[^\n] %[^\n]",&n,v,v+1)*n;printf(m>n?"NA\n":"%d\n",m))for(i=2;i--;m=c)for(c=0,y=n-1;p=y+v[c+i&1],c<m&y>0;)y-=y==n|*p&2?-1:*p&p[-1]&1?1:!++c+2;}

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

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

void solve()
{
	int n;
	cin>>n;
	
	if(n>=30)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

//	int t;
//	cin>>t;
//	while(t--)
//	{
//		solve();
//	}

	solve();

	return 0;
}

Measured memory_bytes: 3620
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int[] array = new int[5];
		array[0] = a;
		array[1] = b;
		array[2] = c;
		array[3] = d;
		array[4] = e;
		int[] sort = new int[5];
		sort[0] = a % 10 == 0 ? 10 : a % 10;
		sort[1] = b % 10 == 0 ? 10 : b % 10;
		sort[2] = c % 10 == 0 ? 10 : c % 10;
		sort[3] = d % 10 == 0 ? 10 : d % 10;
		sort[4] = e % 10 == 0 ? 10 : e % 10;
		Arrays.sort(sort);
		int modMin = sort[0];
		int ans = 0;
		boolean done = false;
		for(int i = 0 ; i < 5 ; i++) {
			if(array[i] % 10 == modMin && !done) {
				ans += array[i];
				done = true;
			} else {
				ans += array[i];
				if(array[i] % 10 != 0) {
					ans += (10 - array[i] % 10);
				}
			}
		}

		System.out.println(ans);
		sc.close();

	}

}


Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <map>
#include <utility>

using namespace std;


int main()
{
  int H,W,D,Q;
  cin >> H >> W >> D;
  vector <int> Ax(H*W+1);
  vector <int> Ay(H*W+1);
  int tmp;  
  for( int i=0;i<H;i++ )
    for( int j=0;j<W;j++ )
      {
	cin >> tmp;
	Ax[tmp] = i;
	Ay[tmp] = j;
      }
  cin >> Q;
  
  vector<int>cost(H*W+1, 0);
  for( int i=0;i<D;i++ )
    {
      tmp=0;
      for( int j=i+1;j<H*W+1;j+=D)
	{
	  cost[j] = tmp;
	  if(j+D<W*H+1)
	    tmp += abs(Ax[j+D]-Ax[j])+abs(Ay[j+D]-Ay[j]);
	}
    }


  int L,R;
  for( int q=0;q<Q;q++ )
    {
      int ans = 0;    
      cin >> L >> R;
      cout << cost[R]-cost[L] << endl;
    }
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include<string.h>
using namespace std;
using namespace __gnu_pbds;
using ll = long long int;
#define INF             1e14
#define dd              double
#define MOD             1000000007
#define my_sizeof(type) ((char *)(&type+1)-(char*)(&type)) 
#define nl              cout<<endl
#define fill(a,val)     memset(a,val,sizeof(a))
#define mp              make_pair
#define endl            "\n"
#define pb              push_back
#define ff              first    
#define ss              second
#define SIZE            200005
#define all(v)          v.begin(),v.end()
#define s(ar,n)         sort(ar,ar+n)
#define rs(ar,n)        sort(ar, ar+n, greater<ll>()) 
#define oa(a,n)         for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n)         for(ll i=0;i<n;i++)cin>>a[i];
#define maxa(ar,N)      *max_element(ar,ar+N)
#define mina(ar,N)      *min_element(ar,ar+N)
#define fastio()        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define printclock      cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
  
ll logtwo(ll n){
    if(n==1)
        return 0;
    return logtwo(n/2)+1;
}
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}
signed main()
{
    fastio();   
   
    long long  n;
    float m,s;
    cin>>n>>m;
    s = n*m;
    m = floor(s);
    cout<<m;
   
    
}

Measured memory_bytes: 3800
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

type kakko struct {
	str string
	min int
	max int
}

func main() {
	N := getStdinInt()
	F := make([]kakko, 0, N)
	L := make([]kakko, 0, N)
	for i := 0; i < N; i++ {
		s := getStdin()
		min, max := minmaxKakko(s)
		if min >= 0 {
			F = append(F, kakko{s, min, max})
		} else {
			L = append(L, kakko{s, min, max})
		}
	}
	sort.Slice(F, func(i, j int) bool { return F[i].min < F[j].min })
	sort.Slice(L, func(i, j int) bool { return L[i].max > L[j].max })

	K := make([]kakko, N)
	for i := 0; i < len(F); i++ {
		K[i] = F[i]
	}
	for i := 0; i < len(L); i++ {
		K[i+len(F)] = L[i]
	}

	first := -1
	last := -1
	for i := 0; i < len(K); i++ {
		if K[i].str[0] == '(' {
			first = i
			break
		}
	}
	for i := len(K) - 1; i >= 0; i-- {
		if first != i && K[i].str[len(K[i].str)-1] == ')' {
			last = i
			break
		}
	}

	if first == -1 || last == -1 {
		fmt.Printf("No\n")
		return
	}

	//S := ""
	stack := 0
	//S += K[first].str
	for n := 0; n < len(K[first].str); n++ {
		if K[first].str[n] == '(' {
			stack++
		} else if K[first].str[n] == ')' {
			stack--
		}
		if stack < 0 {
			fmt.Printf("No\n")
			return
		}
	}
	for i := 0; i < len(K); i++ {
		if first == i || last == i {
			continue
		}
		//S += K[i].str
		for n := 0; n < len(K[i].str); n++ {
			if K[i].str[n] == '(' {
				stack++
			} else if K[i].str[n] == ')' {
				stack--
			}
			if stack < 0 {
				fmt.Printf("No\n")
				return
			}
		}
	}
	//S += K[last].str
	for n := 0; n < len(K[last].str); n++ {
		if K[last].str[n] == '(' {
			stack++
		} else if K[last].str[n] == ')' {
			stack--
		}
		if stack < 0 {
			fmt.Printf("No\n")
			return
		}
	}

	//if okKakko(S) {
	if stack == 0 {
		fmt.Printf("Yes\n")
	} else {
		fmt.Printf("No\n")
	}
}

func minmaxKakko(s string) (int, int) {
	stack := 0
	max := math.MinInt32
	min := math.MaxInt32
	for i := 0; i < len(s); i++ {
		if s[i] == '(' {
			stack++
			if stack > max {
				max = stack
			}
		}
		if s[i] == ')' {
			stack--
			if stack < min {
				min = stack
			}
		}
	}
	return min, max
}

func okKakko(s string) bool {
	if s[0] == ')' || s[len(s)-1] == '(' {
		return false
	}

	stack := 0
	for i := 0; i < len(s); i++ {
		if s[i] == '(' {
			stack++
		}
		if s[i] == ')' {
			stack--
		}
		if stack < -1 {
			return false
		}
	}

	if stack == 0 {
		return true
	}
	return false
}

func getStdin() string {
	sc.Scan()
	return sc.Text()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}


Measured memory_bytes: 67376
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
  ll A, B;
  cin >> A >> B;
  
  ll ans = 0;
  ll q = (B-A+1)%4;
  if(A%2 == 0 && B%2 == 1){
    for(int i=0; i<q; i++){
      ans ^= (A+i);
    }    
  }else if(A%2 == 0){
    if(q == 1) ans ^= B;
    else{
      ans = (B-2) ^ (B-1) ^ B;
    }
  }else if(A%2 == 1 && B%2 == 0){
    if(q == 0) ans = A ^ (B-2) ^ (B-1) ^ B;
    else ans = A ^ B;
  }else{
    if(q == 1) ans = A;
    else ans = A ^ (A+1) ^ (A+2);
  }
  cout << ans << endl;
  
}

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

int main (){
  int a;
  cin >> a;
  int b[110];
  for(int i =0;i<a;i++){
    cin >> b[i];
  }
  sort(b,b+a);
  
  int c,e;
   c = 1;
   e = b[0];
  
  for(int i =0;i<a;i++){
    
    if( b[i] > e){
      e = b[i];
      c ++;
    }
  }
  
  cout << c << endl;
}
      
  
 


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

int main() {
  int n,x,a=0,M=100000,m[100];
  cin >> n >> x;
  for (int i=0; i<n; i++){
    cin >> m[i];
    a += m[i];
    if(m[i]<M)
      M = m[i];
  }

  cout << n + (x-a)/M << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,sum=0;
cin >> a >> b >> c >> d;
while(a>0 && c>0)
{
    if(sum==0)
    {
        c=c-b;
        sum=1;
    }
    else{
        sum=0;
        a=a-d;

    }






}
if(c<=0)
    cout << "Yes" << endl;
else
    cout << "No" << endl;





}


Measured memory_bytes: 3592
exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

def dfs(i,ng,par)
  color = 1
  @t[i].each do |a|
    next if a[0] == par
    color += 1 if color == ng
    dfs(a[0],color,i)
    @ans[a[1]] = color
    color += 1
  end
  @c = big(@c,color)
end

@c = 0
n = inp[0]
@ans = na(n-1)
d = []
@t = na2(n+1,0)
(n-1).times{ |i|
  l,r = inp
  @t[l].push([r,i])
  @t[r].push([l,i])
}
dfs(1,1e20,1e20)
p @c-1
puts @ans

Measured memory_bytes: 139580