akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define Yes "Yes"
#define No "No"
#define DEFAULT LL ans=solve();\
 	if(ans==NONE){\
 	}else{\
 		cout << ans << endl;\
 	}
#define YESNO three(solve(),(OUT(YES),1),(OUT(NO),0))
#define YesNo three(solve(),OUT(Yes),OUT(No))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b-1);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,zero,b)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define all ALL
#define pb emplace_back
#define eb pb
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef tuple<int, int, int, int> tapu;
typedef vector<tapu> Vtapu;
typedef priority_queue<pr, Vpr > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 5e5 + 1000;
const int SIZE2 = 5010;
const int SIZE3 = 430;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p998 = 998244353;
const LL p107 = 1000000007;
const LL p = p107;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
const LL NONE=-2;
#define endl "\n"
ut N, M,K,  Q, D, H, W;
VI edges[SIZE];
LL vals[SIZE], answer = zero;
LL A[SIZE],B[SIZE],C[SIZE];
LL imos[SIZE];
LL solve(){
	cin >> N >> K;
	EFOR(i,1,N){
		cin >> A[i];
	}
	MN(K,200);
	REP(k,K){
		EFOR(i,1,N){
			imos[max(1,i-A[i])]+=1;
			imos[i+A[i]+1]-=1;
		}
		EFOR(i,1,N){
			A[i]=A[i-1]+imos[i];
			imos[i]=0;
		}
	}
	VI ans;
	EFOR(i,1,N) ans.pb(A[i]);
	outputVI(ans);
	return NONE;
}
 signed main() {
 
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	LL T=1;

	REP(i,T){
		DEFAULT;

	}
	
//	YesNo;
//	YESNO;
//	three(solve(),OUT("First"),OUT("Second"));
	//cin >> N;
	return 0;
 
}


Measured memory_bytes: 19108
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF (1<<29)
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int p){
	for(int i=2;i<=sqrt(p);i++){
		if(!p%i)return false;
	}
	return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b==1)return a%MOD;
    if(b%2)return modpow(a,b-1)*a%MOD;
    else return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int comb(int a,int b){
    if(b==0||a==b)return 1;
    if(b==1)return a%MOD;
    return (comb(a-1,b-1)+comb(a-1,b))%MOD;
}
// Library End !
signed main(){
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    int x3,y3,x4,y4;
    x3=x2+(y1-y2);
    y3=y2+(x2-x1);
    x4=x3+(y2-y3);
    y4=y3+(x3-x2);
    cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<endl;
	return 0;
}


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

using namespace std;

int main(void)
{
	int n, m, x;
	cin >> n >> m >> x;
	int c[n];
	int a[n][m];
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}

	vector<int> prices;

	for (unsigned int i = 0; i < pow(2, n); i++) {
		int u[m];
		fill(u, u+m, 0);
		int price = 0;
		for (int j = 0; j < n; j++) {
			int buy = (i>>j)&1;
			if (buy == 1) {
				for (int k = 0; k < m; k++) {
					u[k] += a[j][k];
				}
				price += c[j];
			} else {
			}
		}

		bool ok = true;
		for (int j = 0; j < m; j++) {
			if (u[j] < x)
				ok = false;
		}
		if (ok)
			prices.push_back(price);
	}
	if (prices.empty())
		cout << -1 << endl;
	else {
		sort(prices.begin(), prices.end());
		cout << prices[0] << endl;
	}
	return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int N;
  cin >> N;
  
  vector<vector<int64_t>> XY(N, vector<int64_t>(2));
  for (int i = 0; i < N; i++) {
    cin >> XY.at(i).at(0) >> XY.at(i).at(1);
    
  }
  double sum = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      sum += sqrt((XY.at(i).at(0) - XY.at(j).at(0)) * (XY.at(i).at(0) - XY.at(j).at(0)) + (XY.at(i).at(1) - XY.at(j).at(1)) * (XY.at(i).at(1) - XY.at(j).at(1)));                         
    }                                                                   
  }
  cout << fixed << setprecision(16);
  
  cout << (sum * 2 ) / N << endl;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
int main(){
    string s;
    cin>>s;
    
    string ans;
    int n=s.size();
    rep(i,n){
        if(s.at(i)=='B'&&ans.size()!=0) ans.pop_back();
        else if(s.at(i)!='B') ans+=s.at(i);
    }
    
    cout<<ans<<endl;
}


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

typedef long long ll;

ll N, A, ans;

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

    ans = 1e18;
    for(int i = 0; i < 50; i++) {

        ll s = 1, e = 1e18;
        ll x;
        while(s <= e) {
            ll m = (s + e)>>1;

            ll q = m / (i + 1);
            ll r = m % (i + 1);

            if(q == 0) {
                s = m + 1;
                continue;
            }

            ll mul = 1;
            bool ok = false;
            for(int j = 0; j < i + 1; j++) {
                if(j < r) {
                    if((N + q) / (q + 1) <= mul) {
                        ok = true;
                        break;
                    }
                    mul *= (q + 1);
                }
                else {
                    if((N + q - 1) / q <= mul) {
                        ok = true;
                        break;
                    }
                    mul *= q;
                }
            }
            if(ok) {
                x = m;
                e = m - 1;
            }
            else s = m + 1;
        }
        ans = min(ans, x + A*i);
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++) //これでiやjを定義しなくていいらしい
using namespace std;

int main(){
  vector<int> x(5);

  rep(i,5){
    cin >> x[i];
    if(x[i]==0){
      cout << i+1 << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3588
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int W=sc.nextInt();
		int a=sc.nextInt();
		int b=sc.nextInt();
		
		if(a<b){
			if(b-(a+W)<0)System.out.println(0);
			else System.out.println(b-a-W);
		}else{
			if(a-(b+W)<0)System.out.println(0);
			else System.out.println(a-b-W);
		}
		
	}

}


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

int main() {
  int64_t n,k,q;
  cin>>n>>k>>q;
  vector<int64_t> a(q);
  vector<int64_t> point(n,k-q);
  for(int i=0;i<q;i++){
    cin>>a.at(i);
  }
  for(int i=0;i<q;i++){
    point.at(a.at(i)-1)+=1;
  }
  for(int i=0;i<n;i++){
    if(point.at(i)>0){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }
}

Measured memory_bytes: 2176
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <queue>
#include <stack>
#include <climits>
using namespace std;

typedef long long ll;
#define pb push_back

#define rep(i, n) for (int i=0;i<(n);++i)
#define rep2(i, s, n) for (int i=s;i<(n);++i)
#define rev(i, n) for (int i=(n);i>0;--i)
#define INF (1e9+1e9)

int main() {
    ll x,y,z; cin >> x >> y >> z;

    cout << (x-z)/(y+z) << endl;
    
}

Measured memory_bytes: 256
n=gets.split.map(&:to_i)
lines = []
while line=gets
    lines << line.chomp.split(' ').map(&:to_i)
end


result=[10000000000]
for i in 1..lines.length
combi=lines.combination(i).to_a
    for j in 0..combi.length-1
        
        yen=0
         v=Array.new(n[1],0)
         
         combi[j].each do |k|
           yen+=k[0]
             for l in 1..k.length-1
              v[l-1]+=k[l]
             end
             
          end

        if v.all? {|m| m>=n[2]}==true
        result.push(yen)
        end
        
    end
    

end

if result.min==10000000000
puts -1
else
puts result.min
end

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

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0)

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }

    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

int main() {
	int n = ri();
	int l = ri();
	int a[n];
	INPUT(a);

	FOR(i,n-1) {
		if (a[i] + a[i+1] >= l) {
			cout << "Possible" << endl;
			// last : i
			FOR(j,i) {
				cout << j+1 << endl;
			}
			DOWNTO(j,n-2,i+1) {
				cout << j+1 << endl;
			}
			cout << i + 1 << endl;
			return 0;
		}
	}
	cout << "Impossible" << endl;

	return 0;
}


Measured memory_bytes: 1152
module Main where

import Control.Applicative
import Numeric

main :: IO ()
main = loop

loop :: IO ()
loop = do
  { [h, w] <- getInts
  ; if h == 0 && w == 0 then done
    else do
      { putStrLn $ unlines $ checkerboard h w
      ; loop
      }
  }

firstLine :: Int -> String
firstLine n = take n (cycle "#.")

secondLine :: Int -> String
secondLine n = take n (cycle ".#")

checkerboard :: Int -> Int -> [String]
checkerboard h w = take h (cycle [firstLine w, secondLine w])

--

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""

done :: IO ()
done = return ()



Measured memory_bytes: 4152
// luogu-judger-enable-o2
// luogu-judger-enable-o2
#include<bits/stdc++.h>
#define ll long long
#define reg register
using namespace std;
string s;
int main()
{
	cin>>s;
	puts((s[0]==s[s.length()-1])^(s.length()&1)?"First":"Second");
	return 0;
}

Measured memory_bytes: 512
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,i,j,a[100000],flg[100000],p,x,cnt,st;
	scanf("%d",&n);
	for(i=0;i<n;i++)	scanf("%d",&a[i]);
	for(i=0;i<n;i++)	flg[i]=-1;
	p=1;
	cnt=0;
	for(i=0;i<n;i++)	{
		if(flg[i]==-1)	{
			x=i;
			flg[i]=p;
			st=p;
			p++;
			while(1)	{
				x=(x+a[x])%n;
//				printf("x=%d\n",x);
				if(flg[x]!=-1)	break;
				flg[x]=p;
				p++;
			}
			if(flg[x]>=st)	cnt+=p-flg[x];
		}
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 3468
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::*,
    std::{cmp::*, collections::*, convert::*, iter::*, marker::*, mem::*, ops::*},
};
fn main() {
    input! {//
        n:usize,
    }
    let mut ans = 0i64;
    for a in 1..=n {
        for b in 1..=((n + a - a) / a) {
            if a * b < n {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2152
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
for i in range(n):
    left = min(a[i], b[i])
    ans += left
    a[i] -= left
    b[i] -= left
    right = min(a[i + 1], b[i])
    ans += right
    a[i + 1] -= right
    b[i] -= right

print(ans)

Measured memory_bytes: 19228
// Problem: A - Don't be late
// Contest: AtCoder - AtCoder Beginner Contest 177
// URL: https://atcoder.jp/contests/abc177/tasks/abc177_a
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define pb push_back
#define mp make_pair
#define y1 y114514
#define elif else if
#define VPII vector <PII>
#define y2 y1919810
typedef pair <int, int> PII;
typedef vector <int> VI;
//#define int long long
#define all(x) x.begin(),  x.end()
#define lsh(i) (1 << (i))
#define lshll(i) (1LL << (i))
#define repn(i, n) for (int i = 1; i <= (int)n; i++)
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define range(i, s, t)  for (int i = s; i <= (int)t; i++)
#define RESET(x) memset((x), 0, sizeof(x))
const int INF = 0x3f3f3f3f;
const long double EPS = 1e-6;
void solve() {
  int d, t, s;
  cin >> d >> t >> s;
  if (s * t >= d) cout << "Yes" << endl;
  else cout << "No" << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);
  int T = 1;
  // cin >> T;
  while (T--) 
    solve();
  return 0;
}


Measured memory_bytes: 3644
pattern = input().lower()
contents = []
while True:
    line = input()
    if line == 'END_OF_TEXT':
        break
    line_list = line.split()
    line_list = [string.lower() for string in line_list]
    contents.append(line_list)

counter = 0
for row in contents:
    match_count = row.count(pattern)
    counter += match_count

print(counter)


Measured memory_bytes: 5568
import java.util.HashSet;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    HashSet<Color> colors = new HashSet<>();
    int numNull = 0;
    int N = scanner.nextInt();
    for (int i = 0; i < N; i++) {
      int a = scanner.nextInt();
      Color c = Color.fromScore(a);
      if (c != null) colors.add(c);
      else numNull++;
    }

    int min = Math.max(colors.size(), 1);
    int max = colors.size() + numNull;
    System.out.printf("%d %d\n", min, max);
  }

  private enum Color {
    GRAY, BROWN, GREEN, LIGHT_BLUE, BLUE, YELLOW, ORANGE, RED;

    static Color fromScore(int score) {
      if (score < 400) return GRAY;
      if (score < 800) return BROWN;
      if (score < 1200) return GREEN;
      if (score < 1600) return LIGHT_BLUE;
      if (score < 2000) return BLUE;
      if (score < 2400) return YELLOW;
      if (score < 2800) return ORANGE;
      if (score < 3200) return RED;
      return null;
    }
  }
}


Measured memory_bytes: 21332
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#define vel vector<long long>
using namespace std;
int main() {
	vel v(3);
	for (int i = 0; i < 3; i++) { cin >> v[i]; }
	sort(v.begin(), v.end());
	if (v[2] == v[0]) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
	return 0;
}

Measured memory_bytes: 256
N,K,C=map(int,input().split())
S=input()

maekara=[]
i=1
cnt=0
while i<=N and cnt<K:
    if S[i-1]=='o':
        maekara.append(i)
        i+=C+1
        cnt+=1
    else: i+=1

usirokara=[]
j=N
cnt=0
while j>=1 and cnt<K:
    if S[j-1]=='o':
        usirokara.append(j)
        j-=C+1
        cnt+=1
    else: j-=1
usirokara=usirokara[::-1]

for i in range(K):
    if maekara[i]==usirokara[i]:
        print(maekara[i])


Measured memory_bytes: 59608
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main(){
    cout<<fixed<<setprecision(10);
    int N;
    cin>>N;
    cout<<N*N;
    return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  int S = 0;
  
	for (int i = 0; i < N; i++) {
      int x;
      cin >> x;
      if (x*2 < K) S += x*2;
      else S += (K - x)*2;
    }
  
  cout << S << endl;
  
}


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

int x[10], y[10];

double dist(int i, int j) {
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx * dx + dy * dy, 0.5);
}

int main()
{
    int n;
    double sum = 0.0;
    cin >> n;
    vector<int> v(n);
    iota(v.begin(), v.end(), 1);
    for (int i = 1; i <= n; i++) {
        cin >> x[i] >> y[i];
    }
    do {
        for (int j = 1; j < n; j++) {
            sum += dist(v[j-1], v[j]);
        }
    } while(next_permutation(v.begin(), v.end()));
    int factorial = 1;
    for (int i = 2; i <= n; i++) factorial *= i; 
    printf("%.10f\n", sum / factorial);
    return 0;
}


Measured memory_bytes: 256
//
// Created by jal on 2019-10-08.
//

#include <bits/stdc++.h>
using namespace std;
const int N = 10001, Q = 100001;
int F[N];
int getF(int x){
    return x != F[x]? F[x] = getF(F[x]): F[x];
}
int main(){
    int n, q;
    scanf("%d %d", &n, &q);
    for(int i = 0; i < n; i++){
        F[i] = i;
    }
    for(int i = 0; i < q; i++){
        int com, x, y;
        scanf("%d %d %d", &com, &x, &y);
        int fx = getF(x);
        int fy = getF(y);
        if(com == 0){
            F[fx] = fy;
        }else{
            printf("%d\n", fx == fy);
        }
    }
    return 0;
}


Measured memory_bytes: 3320
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

	int ans = 0;

	if (a >= 13) {
		ans = b;
	} else if (a >= 6) {
		ans = b / 2;
	}

	cout << ans << endl;

	return 0;
}


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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//library----------------------------------------------

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

const int NMAX = 100;
bool flag;

bool cmp(int x,int y){
    return abs(0-x)<abs(0-y);
}

int main(){
    SCIN(s);
    printf("%c%d%c\n",s[0],s.size()-2,s[s.size()-1]);
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES // for C++  
#include "bits/stdc++.h"
#define NUM ((long long)1000000007)
#define int unsigned long long

using namespace std;

signed main()
{
	int X, A, B, answer;
	cin >> X >> A >> B;
	answer = X - A;
	cout << answer % B << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N; i++)
    cin >> d.at(i);
  int M = 0;
  
  for (int i = 0; i < N; i++){
    int dmax = 0;
    for (int j = 0; j < N; j++){
      if (dmax < d.at(j)){
        dmax = d.at(j);
      }
    }
    if (dmax == 0)
      break;
    else {
      M++;
      for (int j = 0; j < N; j++)
        if (d.at(j) == dmax)
          d.at(j) = 0;
    }
  }
  
  cout << M << endl;
}


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

int main(){
    ll N;
  	cin >> N;
    vector<ll> A(N);
    ll are=1000000007;
    ll sum=0;
    ll sum2=0;
    for(ll i=0; i<N; i++){
        cin >> A.at(i);
        sum+=A.at(i);
        if(sum>=are) sum-=are;
        ll b=A.at(i)*A.at(i);
        if(b>=are) b=b%are;
        sum2+=b;
        if(sum2>=are) sum2-=are; 
    }
    ll c=sum*sum;
    if(c>=are) c=c%are;
    ll d=c-sum2;
    if(d<0) d+=are;
    if(d%2!=0) d+=are;
    ll e=d/2;
    cout << e << endl;
}

Measured memory_bytes: 4844
#include<stdio.h>
int main(void){
  int num,value;
  scanf("%d %d",&num,&value);
    int man=10000;
    int go=5000;
    int sen=1000;
    int nman,ngo,nsen;
    int ans=0;
    int flag=0;

    for(nman=0;nman<=num;nman++){
        for(ngo=0;ngo<=num;ngo++){
            nsen=num-nman-ngo;
         if(nsen<0)break;
            ans=nsen*1000+ngo*5000+nman*10000;
            if(value==ans){
              if(flag==1){
                break;
             	 }else{
                flag=1;
                printf("%d %d %d",nman,ngo,nsen);
              }
            }
        }
    }
if(flag==0){
    printf("%d %d %d",-1,-1,-1);
}
}

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

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

  long long s1 = min(n, m / 2);
  long long s2 = (m - 2 * s1) / 4;
  long long result = s1 + s2;
  cout << result << endl;
  return 0;
}

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

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	int s; cin >> s;
	int ans = 1;
	set<int> R;
	while(R.find(s) == R.end()){
		R.insert(s);
		if(s%2 == 0) s /= 2;
		else s = s*3+1;
		++ans;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n=int(input())
xy=[]
for i in range(n):
  xx,yy=map(int,input().split())
  xy.append((xx,yy))
from itertools import permutations
a=list(permutations(xy))
d=[]
for aa in a:
  t=0
  for i in range(len(aa)-1):
    t+=((aa[i+1][0]-aa[i][0])**2+(aa[i+1][1]-aa[i][1])**2)**0.5
  d.append(t)
print(sum(d)/len(d))


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

void solve(){
    int N,M;
    cin >> N >> M;
    vector<int> cnt(N);
    rep(i,0,M){
        int a,b;
        cin >> a >> b;
        --a;
        --b;
        if(a>b) swap(a,b);
        if(a==0) ++cnt[b];
        else{
            ++cnt[a];
            ++cnt[b];
        }
    }
    rep(i,0,N) if(cnt[i]%2){
        cout << "NO" << endl;
        return;
    }
    cout << "YES" << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Measured memory_bytes: 640
from sys import stdin
import fractions

n = int(stdin.readline().rstrip())
li = [[0,0]]+[list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
li = li[::-1]
count = 0
for i in range(n):
    count += -li[i][0]%li[i][1]
    li[i+1][0] += count
print(count)

Measured memory_bytes: 33344
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define rep(i,n) for(int i = 0; i < n; i++)
#define ll long long
#define INF 100000000
#define uint unsigned int
using namespace std;

#define constant 1000
int main() {
	int price[4];
	int time = 0;
	int time_plus = 0;
	int flag = 9;
	rep(i, 5) {
		cin >> price[i];
		if (time_plus < (constant - price[i]) % 10) {
			time_plus = (constant - price[i]) % 10;
			flag = i;
		}
	}

	rep(j, 5) {
		if (j == flag) {
			time += price[j];
		}
		else {
			time += price[j] + (constant - price[j]) % 10;
		}
	}

	cout << time << endl;
}


Measured memory_bytes: 256
#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
char s1[7],s2[7];
int main(){
    cin>>s1>>s2;
    int cnt=0;
    for(int i=0;i<=2;++i){
        if(s1[i]==s2[i])
            cnt++;
    }
    cout<<cnt;
    return 0;
}


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

int main()
{
  int n;
  cin >> n;
  bool ans = true;
  for (int i = 0; i < n; i++)
  {
    int a;
    cin >> a;
    if (a % 2 == 0 && (a % 3 && a % 5))
    {
      ans = false;
      break;
    }
  }
  if (ans)
  {
    cout << "APPROVED" << endl;
  }
  else
  {
    cout << "DENIED" << endl;
  }
}

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

using namespace std;

#define Vi vector<int>
#define FOR(i,s,e) for (int i=s; i<e; i++)
#define ITER(v) v.begin(), v.end()

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

    int a, b, c, d, e, f;
    double den, x, y;

    while (true) {
        cin >> a >> b >> c >> d >> e >> f;
        if (cin.eof()) { break; }
        den =  a * e - b * d;
        x = static_cast<double>(c * e - b * f) / den;
        y = static_cast<double>(- c * d + a * f) / den;
        // avoid -0.000
        x += 0.0;
        y += 0.0;
        cout << fixed << setprecision(3) << x << " " << y << endl;
    }

    return 0;
}

Measured memory_bytes: 3216
module Main where

import Control.Applicative
import Text.Printf

main :: IO ()
main = loop 1

loop :: Int -> IO ()
loop i  = do
  { [x] <- getInts
  ; if x == 0 then return ()
    else do
      { putStr $ printf "Case %d: %d\n" i x
      ; loop (i+1)
      }
  }

--

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn .  unwords . map show



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

int main() {
    int N, T, A, H;
    cin >> N;
    cin >> T >> A;
    cin >> H;
    double d = abs(A - (T - H * 0.006));
    int ans = 0;
    for (int i = 1; i < N; i++) {
        cin >> H;
        if (d > abs(A - (T - H * 0.006))) {
            d = abs(A - (T - H * 0.006));
            ans = i;
        }
    }
    cout << ans + 1 << endl;
}

Measured memory_bytes: 3540
from collections import deque

n, q = map(int, input().split())
dq = deque()

for _ in range(n):
    name, time = input().split()
    dq.append([name, int(time)])

cnt = 0

while dq:
    qt = dq.popleft()
    if qt[1] <= q:
        cnt += qt[1]
        print(qt[0], cnt)
    else:
        cnt += q
        qt[1] -= q
        dq.append(qt)

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

#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n,a,b;
  cin >> n >> a >> b;
  int ca=0,cb=0;
  for(int i=0;i<n;i++){
    if(a&(1<<i)) ca++;
    if(b&(1<<i)) cb++;
  }
  if(n==1){
    cout << "YES" << endl;
    cout << a SP b << endl;
    return 0;
  }
  if(ca%2==cb%2){
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  vector<int> g(1<<n,0);
  for(int i=0;i<n;i++){
    for(int j=0;j<(1<<n);j++){
      if((j&(1<<i))^((j&(1<<(i+1)))/2)) g[j]+=(1<<i);
    }
  }
  vector<int> y;
  for(int i=0;i<n;i++){
    if((a&(1<<i))!=(b&(1<<i))) y.push_back(i);
  }
  vector<bool> ok(n,false);
  int k=y.size();
  int start=a;
  for(int i=0;i<=k;i++){
    if(i<k) ok[y[i]]=true;
    int tmp;
    vector<int> x;
    for(int j=0;j<n;j++){
      if(!ok[j]) x.push_back(j);
    }
    int m=x.size();
    for(int j=0;j<(1<<m);j++){
      tmp=start;
      for(int l=0;l<m;l++){
        if(g[j]&(1<<l)){
          tmp^=(1<<x[l]);
        }
      }
      cout << tmp << " ";
    }
    tmp^=(1<<y[i]);
    start=tmp;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 1536
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	x := sc.nextInt()

	if x < 1200 {
		fmt.Fprintln(wtr, "ABC")
	} else {
		fmt.Fprintln(wtr, "ARC")
	}
	wtr.Flush()
}


Measured memory_bytes: 640
/* In the name of Allah */
#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;
bool mark[N] = {true};
int cnt[N];

int main() {
	ios_base :: sync_with_stdio(false), cin.tie(0), cout.tie(0);

	int n, m;
	cin >> n >> m;
	fill(cnt, cnt + n, 1);
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;

		x--, y--;
		mark[y] |= mark[x];
		mark[x] &= (--cnt[x] > 0), cnt[y]++;
	}

	int ans = 0;
	for (int i = 0; i < n; i++)
		ans += mark[i];
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  int x;
  cin >> x;
  for(int i = 1; i < 100000; ++i){
    if(i*360%x == 0){
      int ans = i*360/x;
      cout << ans << endl;
      return 0;
    }
  }



  return 0;
}


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


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

        int c = 0 ;
        int p1, p2, p3;
        for (int i = 0; i < n; ++i){
                if (i == 0) {
                        cin >> p1 ;
                }
                if (i == 1) {
                        cin >> p2 ;
                }
                if (i >= 2) {
                        cin >> p3 ;
                        if (((p1 < p2)&&(p2 < p3))||((p1 > p2)&&(p2 > p3))) {
                                c += 1 ;
                        }
                        p1 = p2 ;
                        p2 = p3 ;
                }
        }
        cout << c << endl ;
}

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

class Point{
    public:
    double x;
    double y;
};

 double vecProduct(Point p1, Point p2, Point p3)
{
    return ((p1.x - p3.x)*(p2.y - p3.y) - (p2.x - p3.x)*(p1.y - p3.y));
}
    
bool isPointInTriangle(Point pt, Point v1, Point v2, Point v3)
{
    
    bool r1 = vecProduct(pt,v1,v2) < 0.0;
    bool r2 = vecProduct(pt,v2,v3) < 0.0;
    bool r3 = vecProduct(pt,v3,v1) < 0.0;
    
    return ((r1 == r2) && (r2 == r3));
}

int main(void){
   Point p1,p2,p3,pt;
   
   while(cin>>p1.x>>p1.y>>p2.x>>p2.y>>p3.x>>p3.y>>pt.x>>pt.y)
   {
        if(isPointInTriangle(pt,p1,p2,p3))
        {
            cout<<"YES"<<endl;
        }
        else
        {
            cout<<"NO"<<endl;
        }
   }
}


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

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	long long ans[10010] = {};
	for (long long x = 1; x <= n; x++) {
		for (long long y = 1; y <= n; y++) {
			long long tmp = x * x + y * y + x * y;
			if (tmp < n) {
				for (long long z = 1; z <= n; z++) {
					long long tmp1 = tmp + z * z + x * z + y * z;
					if (tmp1 <= n) {
						ans[tmp1]++;
					}
				}
			}
		}
	}

	for (int i = 1; i <= n; i++) {
		cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 3480
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

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

//想定解答との絶対誤差または相対誤差が 10−6以下の場合+1以上だしておく。適当に15とかでもおｋ．
//cout << fixed << setprecision(15);

int main() {
    int D, N;
    cin >> D >> N;
    if (D == 0) {
        if (N == 100) {
            cout << 101 << endl;
        } else {
            cout << N << endl;
        }

    } else if (D == 1) {
        if (N == 100) {
            cout << 10100 << endl;
        } else {
            cout << 100 * N << endl;

        }

    } else if (D == 2) {
        if (N == 100) {
            cout << 1010000 << endl;
        } else {
            cout << 10000 * N << endl;
        }

    }
    return 0;
}

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

int main()
{
    const int N=100;
    const int M=100;

    int n,m;
    int A[N][M] ={{}};
    int b[M]={};

    cin>>n>>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++)
    {
        int ans=0;
        for(int j=0;j<m;j++)
        {
            ans+= A[i][j]*b[j];
        }
        cout<<ans<<"\n";
    }
    return 0;
}

Measured memory_bytes: 1208
#include <stdio.h>

//h[i]=0となるところ以外h[i]-1していく
//すべてのiに対してh[i]=0になったところが最小値
int hiku(int *a);

int main(void){
	int N,i;
	scanf("%d",&N);
	int h[N+1];
	for(i=0;i<N;++i){
	scanf("%d",&h[i]);
	}
	
	h[N]=0;
	int count=0,min=0;
	for(int j=0;j<100;++j){
		count=0;
		for(i=0;i<N;++i){
			if(h[i]!=0 && h[i+1]==0) min++;		
			int tmp=h[i];
			if(tmp!=0) hiku(&h[i]) ;
			else {
				count++;
			}
			}
			/*printf("\nc=%d,min=%d ",count,min);
			for(int k=0;k<N;k++){
			printf("%d ",h[k]);
		}*/
		if(count==N) break;
	}
	printf("%d\n",min);
	return 0;
}

int hiku(int *a){
	int tmp;
	tmp=*a-1;
	*a=tmp;
}

Measured memory_bytes: 128
#include <cstdio>
using namespace std;

// x > 1
long long int gcd(long long int x, long long int y)
{
    if (y == 0){
        return x;
    }
    return gcd(y, x - (x/y)*y);
}

long long int lcm(long long int x, long long int y)
{
    return (x / gcd(x, y)) * y;
}

int main()
{
    long long int n, a, ans;
    ans = 1;
    scanf("%lld", &n);
    for (int i = 0; i < n; ++i){
        scanf("%lld", &a);
        if (a >= ans){
            ans = lcm(a, ans);
        } else {
            ans = lcm(ans, a);
        }
    }

    printf("%lld\n", ans);
    return 0;
}



Measured memory_bytes: 2732
N = gets.to_i

a_list = gets.strip.split(/ /).collect{|num|
	num.to_i
}.sort

#p a_list

new_list = []

cur_size = a_list.shift
cur_count = 1
a_list.each{|size|
	if cur_size * 2 < size
		cur_count = 1
	else
		cur_count += 1
	end
	cur_size += size
}

puts cur_count


Measured memory_bytes: 11256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define float long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define endl '\n'
#define pii pair<int, int>
#define tii tuple<int, int, int>
#define min3(a,b,c) min(a, min(b, c))
#define max3(a,b,c) max(a, max(b, c))
#define all(x) x.begin(), x.end()
#define fill(a,b) memset(a, b, sizeof(a))
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

signed main()
{
 
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int x; cin>>x;
    cout<<1-x<<endl;

}

Measured memory_bytes: 3648
import java.util.*;

class Main{
	public static void main(String[] $) {
		System.err.println();
		Scanner s=new Scanner(System.in);

		int x=s.nextInt(),y=s.nextInt();
		int a=2*x-y,b=2*y-x;

		if(a<0||b<0||a%3+b%3>0) {
			System.out.println(0);
			return;
		}
		a/=3;
		b/=3;

		System.out.println(nCr(a+b,Math.min(a,b)));
	}

	static int mod=1000000007;

	static long modpow(long n,long p) {
		if(p==0)
			return 1;
		if(p%2==1)
			return n*modpow(n,p-1)%mod;
		long d=modpow(n,p/2);
		return d*d%mod;
	}

	static long nCr(long n,long r){
		long res=1;
		for(long i=n-r+1;i<=n;++i) {
			res*=i;
			res%=mod;
		}
		for(long i=2;i<=r;++i) {
			res*=modpow(i,mod-2);
			res%=mod;
		}
		return res;
	}
}


Measured memory_bytes: 25300
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int k;
  cin >> k;
  vi a = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
          1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << a[k - 1] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pi pair<int ,int >
#define pl pair<ll ,ll >
#define pb push_back
#define vl vector <long long int >
#define vi vector <int >
#define mod 1000000007
#define eps 1e-9
#define fi first
#define se second
#define _ <<" "<<
#define forn(x,	n) for(int x = 0; x < n ;++ x) 
#define forn1(x,n) for(int x = 1; x <= n ;++ x)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
void scan(){}
template<typename F, typename... R> void scan(F &f,R&... r){cin>>f;scan(r...);}
int di_; string dnms_, co_ = ",";
void debug_(){cout<<endl;}
template<typename F, typename... R> void debug_(F &f, R&... r){while(dnms_[di_] != ',')cout<<dnms_[di_++];di_++;cout<<": "<<f<<",";debug_(r...);}
#define debug(...) dnms_=#__VA_ARGS__+co_,di_=0,debug_(__VA_ARGS__)

template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}

int main(){
	IOS

	int n;
	cin>>n;
	std::vector<string> v;
	string s;
	forn(i,n)
	{
		cin>>s;
		sort(s.begin(),s.end());
		v.push_back(s);
	}
	sort(v.begin(),v.end());
	ll c=0;
	ll total =0;
	for(int i=0;i<n;)
	{
		s = v[i];
		c=0;
		while(i<n&&(v[i]==s))
		{
			c++;
			i++;
		}
		total += ((c*(c-1))>>1);
	}
 	cout<<total;
	return 0;	
}

Measured memory_bytes: 5748
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define MOD (100000007LL)

using namespace std;

typedef unsigned long long ull;
typedef pair<int,int> ii;

string message;

typedef long long ll;
/*
ll my_pow(ll a,ll e)
{
  return !e?1:
    (e%2?(a*my_pow(a,e-1))%MOD:(my_pow(a*a,e/2))%MOD);
}

void calc(ull &v,char c,int pw)
{
  if(pw == 0)return;
  if(c == '8' || c == '0')
    {
      if(pw == 3)v = ((v * 2LL)%MOD - 1 ) % MOD;
      else if(pw > 3)v = ((v * 2LL)%MOD - my_pow(2LL,(pw-4))) % MOD;
      else      v = (v * 2LL) % MOD;
    }
  else
    {
      if(pw > 5)v = ((v * 2LL)%MOD - my_pow(2LL,pw-6) ) % MOD;
      else      v = (v * 2LL) % MOD;
    }
}
void compute()
{
  ull ans = 1;
  ull value = 1;
  char cur = message[0];
  int seq = -1;
  rep(i,message.size())
    {
      seq++;
      calc(value,message[i],seq);
      if((i+1 < message.size() && cur != message[i+1]) || i == message.size()-1)
	{
	  ans = ( ans * value ) % MOD;
	  value = 1;
	  seq = -1; 
	  if(i != message.size()-1)cur = message[i+1];
	  continue;
	}
    }
  cout << ans << endl;
}
*/

void compute()
{
  vector<ii> vec;
  char cur = message[0];
  int cnt = 0,max_length = 0;
  rep(i,message.size())
    {
      cnt++;
      if((i+1<message.size() && cur != message[i+1]) || i == message.size()-1)
	{
	  vec.push_back(ii(cur-'0',cnt));
	  max_length = max(max_length,cnt);
	  cnt = 0;
	  cur = message[i+1];
	}
    }

  max_length++;
  ull dp[2][max_length];//dp[0] : 3, dp[1] : 5
  rep(i,3)dp[0][i] = (ull)pow(2.0,i);
  rep(i,6)dp[1][i] = (ull)pow(2.0,i);

  REP(i,3,max_length)dp[0][i] = (((dp[0][i-1] + dp[0][i-2]) % MOD + dp[0][i-3]) % MOD + 1ULL) % MOD;
  REP(i,6,max_length)dp[1][i] = (((((dp[1][i-1] + dp[1][i-2])%MOD + dp[1][i-3])%MOD + dp[1][i-4])%MOD + dp[1][i-5])%MOD + 1ULL) % MOD;

  ull ans = 1;
  rep(i,vec.size())
    {
      int type = ((vec[i].first == 8 || vec[i].first == 0)?0:1);
      ans = ( ans * dp[type][vec[i].second-1] ) % MOD;
    }

  cout << ans << endl;

}

int main()
{
  while(cin >> message,message != "#")
    {
      compute();

    }
  return 0;
}

Measured memory_bytes: 2880
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll w, h;
    cin >> w >> h;

    vector<P> v;  // v[i] : (i番目に小さいコスト、横線なら1で縦線なら2)
    rep(i, w) {
        ll p;
        cin >> p;
        v.pb(make_pair(p, 1));
    }
    rep(i, h) {
        ll q;
        cin >> q;
        v.pb(make_pair(q, 2));
    }
    sort(all(v));

    ll tate = h+1;  // 縦線が何列あるか(最初はh+1列)
    ll yoko = w+1;  // 横線が何列あるか(最初はw+1列)
    ll ans = 0;
    rep(i, h+w) {
        if(v[i].second == 1) {  // 横線を使うとき
            ans += v[i].first*tate;
            yoko--;
        }
        else {  // 縦線を使うとき
            ans += v[i].first*yoko;
            tate--;
        }
    }

    out(ans);
    re0;
}

Measured memory_bytes: 6512