akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long N, K;
  cin >> N >> K;
  vector<long> A(N);
  rep (i, N) cin >> A[i];

  unordered_map<long, vector<long>> shutugen;
  rep (i, N) shutugen[A[i]].push_back(i);

  /*
  for (auto it: shutugen) {
    cout << it.first << ": ";
    for (auto a: it.second) cout << a << " ";
    cout << endl;
  }
  */

  // cout << "--- foo 1" << endl;

  vector<pair<long, long>> next_sentou(N);
  rep (i, N) {
    long a = A[i];
    auto vec = shutugen[a];
    auto it = upper_bound(vec.begin(), vec.end(), i);
    if (it == vec.end()) {
      long index = vec[0];
      long loop = 1;
      index++;
      if (index == N) { index = 0; loop++; }
      next_sentou[i] = make_pair(loop, index);
    } else {
      long index = *it;
      long loop = 0;
      index++;
      if (index == N) { index = 0; loop++; }
      next_sentou[i] = make_pair(loop, index);
    }
  }

  /*
  rep (i, N) {
    cout << i << ": " << next_sentou[i].first << ", " << next_sentou[i].second << endl;
  }
  */

  pair<long, long> current = make_pair(0, 0);
  map<long, pair<long, long>> visited;
  visited[current.second] = current;

  // cout << "--- foo 2" << endl;

  while (true) {
    // cout << "current:  " << current.first << ", " << current.second << endl;
    auto diff = next_sentou[current.second];
    pair<long, long> next = make_pair(current.first + diff.first, diff.second);
    // cout << "next:  " << next.first << ", " << next.second << endl;
    if (next.first >= K) break;
    current = next;
    if (visited.count(current.second)) {
      auto prev = visited[current.second];
      long loopdiff = current.first - prev.first;
      if (K - 1 - current.first > 0) {
        current.first += ((K - 1 - current.first) / loopdiff) * loopdiff;
      }
    }
    visited[current.second] = current;
  }

  // cout << "--- foo 3" << endl;

  vector<long> ans;
  unordered_map<long, long> pos;

  for (long i = current.first * N + current.second; i < N * K; i++) {
    long num = A[i % N];

    if (pos.count(num) != 0 and pos[num] < ans.size() and ans[pos[num]] == num) {
      ans = vector<long>(ans.begin(), ans.begin() + pos[num]);
      pos.erase(pos.find(num));
    } else {
      pos[num] = ans.size();
      ans.push_back(A[i % N]);
    }

/*
    if (pos.count(num) == 0) {
      pos[num] = ans.size();
      ans.push_back(A[i % N]);
    } else {
      ans = vector<long>(ans.begin(), ans.begin() + pos[num]);
      pos.erase(pos.find(num));
    }
*/
  }

  if (ans.size() == 0) return;

  bool flag = false;
  rep (i, ans.size()) {
    if (flag) cout << " ";
    flag = true;
    cout << ans[i];
  }
  cout << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 44104
#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--)
#define ALL(x) x.begin(),x.end()

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9+7;
const ll INF = 1e18;
const int MAX = 1e6;

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

struct edge {int to, cost;}; // 辺
// vector<edge> graph[MAX]; // 隣接リスト
// bool visit[MAX]; // 訪問の有無

int n, m; // 変数
string s, t;
int dp[3001][3001];
string ans;

void lcs(int i, int j) { // LCSの復元
    if (i == 0 || j == 0) return;
    if (s[i] == t[j]) {
        ans.push_back(s[i]);
        lcs(i-1, j-1);
    } else if (dp[i][j] == dp[i-1][j]) {
        lcs(i-1, j);
    } else if (dp[i][j] == dp[i][j-1]) {
        lcs(i, j-1);
    }
}

int rec(int i, int j) {
    if (dp[i][j] != -1) return dp[i][j];
    if (i == 0 || j == 0) return dp[i][j] = 0;
    if (s[i] == t[j]) return dp[i][j] = rec(i-1, j-1) + 1;
    int x = rec(i-1, j);
    int y = rec(i, j-1);
    return dp[i][j] = max(x, y);
}

int main() {
// input
    cin >> s;
    cin >> t;
// solve
    s = ' ' + s;
    t = ' ' + t;
    n = s.size();
    m = t.size();
    rep(i, n) {
        rep(j, m) {
            dp[i][j] = -1;
        }
    }
    rec(n-1, m-1);
    lcs(n-1, m-1);
    reverse(ALL(ans));
// output
    cout << ans << "\n";
}

Measured memory_bytes: 39068
#include <iostream>

int main(){
    int x, a, b;
    std::cin >> x >> a >> b;

    if(x < b - a){
        std::cout << "dangerous" << std::endl;
    }else if(0 >= b - a){
        std::cout << "delicious" << std::endl;
    }else{
        std::cout << "safe" << std::endl;
    }

    return 0;
}

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


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

    int N;
    cin >> N;
    int B[N-1];
    rep(i,N-1){
        cin >> B[i];
    }
    int ans=B[0];
    rep(i,N-2){
        ans+=min(B[i],B[i+1]);
    }
    ans+=B[N-2];
    cout << ans << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vec             vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define inf             1e18
#define no_of_test(x)        int x; cin>>x; while(x--)
const int mod = 1e9 + 7;
int32_t main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//	no_of_test(x)
	{
       	   int k,n;
           cin>>k>>n;
           int a[n],sum=0;
           for(int i=0;i<n;i++)
           {
               cin>>a[i];
               sum+=a[i];
           }
           if(k>sum)
           {
              
                cout<<"No"<<'\n';
           }
           else if(k<=sum)
           {
               
                   cout<<"Yes"<<'\n';
               
           }
           

	}
	return 0;
}

Measured memory_bytes: 4464
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int n;
    cin >> n;
    lint ans = (power(2, n, mod) + mod - 1) % mod;
    for(int c = 0; c < 2; c++){
        int a;
        cin >> a;
        lint incorrect = 1;
        for(int i = 1; i <= a; i++){
            incorrect = incorrect * (n - i + 1) % mod;
            incorrect = incorrect * power(i, mod - 2, mod) % mod;
        }
        ans = (ans - incorrect + mod) % mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	char str[1002]={0,};
	int i,x;
	while(1){
		x=0;
		fgets(str,1002,stdin);
		if(str[0]=='0'){
			break;
		}
		for(i=0;str[i] > 10;i++){
			x += str[i];
			//printf("%d個目は%d\n",i,str[i]);
		}
		x -= i*48;
		printf("%d\n",x);
	}
}


Measured memory_bytes: 2044
import Control.Applicative
import Control.Monad
import Control.Monad.ST
-- import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
--import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import GHC.ST
-- import System.IO.Unsafe
 
-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
tjoin :: (Show a, Show b) => (a, b) -> String
tjoin (x, y) = show x ++ (' ' : show y)
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
-- templete

f n p d = 100 * minimum ((last d') : (n - head d') : binMap (\x y -> let [x',y'] = sort [x, n-y] in x'*2 + y') d')
  where
    d' = sort . map ((`mod` n) . (subtract p)) $ d

main = do
    [n,m,p] <- getInts
    ds <- replicateM m getInt
    print $ f n p ds



Measured memory_bytes: 9164
N = int(input())
List=list(map(int,input().split()))
a = 0
b = []
for i in range(N//2):
    a += List[2*i] - List[2*i+1]
b.append(a + List[N-1])
for i in range(N-1):
    b.append(2*(List[i]-b[i]//2))
print(*b)

Measured memory_bytes: 69604
/*
数据不清空，爆零两行泪。
多测不读完，爆零两行泪。
边界不特判，爆零两行泪。
贪心不证明，爆零两行泪。
D P 顺序错，爆零两行泪。
大小少等号，爆零两行泪。
变量不统一，爆零两行泪。
越界不判断，爆零两行泪。
调试不注释，爆零两行泪。
溢出不 l l，爆零两行泪。
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int inf=0x3f3f3f3f3f3f3f3f;
const int N=100000;
int n,m,s;
int a[N+1];
int dp[N+1];
int q[N],head,tail;
signed main(){
	cin>>n>>m>>s;
	for(int i=1;i<=n;i++)cin>>a[i];
	q[tail++]=0;
	int now=-1,mn=inf;
	for(int i=1;i<=n;i++){
		while(now+1<i&&2*a[now+2]<2*a[i]-s)now++,mn=min(mn,dp[now]-a[now]-2*a[now+1]);
		while(head<tail&&q[head]<=now)head++;
		while(head<tail&&dp[q[tail-1]]-a[q[tail-1]]>=dp[i-1]-a[i-1])tail--;
		q[tail++]=i-1;
		dp[i]=mn+3*a[i];
		if(head<tail)dp[i]=min(dp[i],dp[q[head]]-a[q[head]]+a[i]+s);
	}
	cout<<dp[n]+m-a[n]<<"\n";
	return 0;
}
/*1
3 9 1
1 3 8
*/
/*2
3 9 3
1 3 8
*/
/*3
2 1000000000 1000000000
1 999999999
*/

Measured memory_bytes: 2560
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld  double
#define pii pair<int,int>
#define pb push_back
#define N 200003
#define inf (ll)1e9+11
#define warmup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int mod=1e9+7;

signed main()
{
    warmup
    
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(((a==b and a==c) or (a!=c and b!=c and a!=b)) ? "No":"Yes"); 
    
    return 0;
}


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

int main() { 	
 int N,K,kk;
  string AA;
  string  A,B,C,D;
  cin>>AA;
  
  A=AA.at(0);
   B=AA.at(1);
   C=AA.at(2);
   D=AA.at(3);
  int num1 = atoi(A.c_str());
    int num2 = atoi(B.c_str());
    int num3 = atoi(C.c_str());
    int num4 = atoi(D.c_str());
  int YY =num1*10 +num2;
  int MM =num3*10 +num4;
  if(YY==0||MM==0){
    if(MM<13&&MM>0){
    cout << "YYMM"<< endl;  
    }else if(YY<13&&YY>0){
    cout << "MMYY"<< endl;      
    }else if(YY>13){
       cout << "NA"<< endl;  
    }else if(MM>13){
       cout << "NA"<< endl;  
    }else if(MM ==0&&YY==0){
       cout << "NA"<< endl;     
    }
  }else{
  if(YY <13 &&MM <13&&YY>0&&MM>0){
  cout << "AMBIGUOUS"<< endl;
  }else if(MM>13&&YY<13&&YY>0){
    cout << "MMYY"<< endl;
  }else if(YY>13&&MM<13&&MM>0){
    cout << "YYMM"<< endl;  
  }else if(YY>13 && MM>13){
      cout << "NA"<< endl;  
  }else{
      cout << "YYMM"<< endl;    
  }
  }
}



Measured memory_bytes: 256
# https://atcoder.jp/contests/abc149/tasks/abc149_c
import math


def is_prime(x):
    for i in range(2, math.floor(math.sqrt(x))):
        if x % i == 0:
            return False
    return True


def main():
    n = int(input())
    for i in range(n, 100004):
        if is_prime(i):
            print(i)
            break


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
a = int(input())
arr = list(range(400,2001,200))
arr2 = [8,7,6,5,4,3,2,1]
res = 8
for i in range(1,len(arr)):
  if (a >= arr[i]):
    res = arr2[i]
  else:
    print(res)
    break

Measured memory_bytes: 9172
// なんだこれ Aを決め打ちするのか？まにあうんかそれ
package main

import "fmt"

var N, M, Q int
var AS [][]int

func main() {
	fmt.Scan(&N, &M, &Q)
	AS = [][]int{}
	for i := 1; i <= M; i++ {
		a := []int{i}
		createAS(a)
	}
	queries := make([][]int, Q)
	for i := 0; i < Q; i++ {
		var a, b, c, d int
		fmt.Scan(&a, &b, &c, &d)
		queries[i] = []int{a, b, c, d}
	}
	ans := 0
	for _, a := range AS {
		tmp_ans := 0
		for _, q := range queries {
			if a[q[1]-1]-a[q[0]-1] == q[2] {
				tmp_ans += q[3]
			}
		}
		ans = max(ans, tmp_ans)
	}
	fmt.Println(ans)
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func createAS(arr []int) {
	if len(arr) == N {
		tes := append([]int{}, arr...)
		AS = append(AS, tes)
	} else {
		limit := arr[len(arr)-1]
		tmp_arr := append([]int{}, arr...)
		for i := limit; i <= M; i++ {
			tmp_arr = append(tmp_arr, i)
			createAS(tmp_arr)
			tmp_arr = tmp_arr[:len(tmp_arr)-1]
		}
	}

}


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

int min(int a,int b)
{
  if(a<b)return a;
  else return b;
}

int main(void)
{
  char dp[1001][1001];
  int n,i,j,max,M[1001][1001];
  
  
  while(1)
    {
      max=0;
      cin >> n;
      
      if(n==0)break;
      
      for(i=0;i<n;i++)
	{
	  for(j=0;j<n;j++)
	    {
	      M[i][j]=1;
	    }
	} 

      for(i=0;i<n;i++)
	{
	  for(j=0;j<n;j++)
	    {
	      cin >> dp[i][j];
	      if(i==0)
		{
		  if(dp[i][j]!='*')M[i][j]=1;
		  else M[i][j]=-1;
		}
	      else
		{
		  if(dp[i][j]!='*')
		    {
		  if(j==0)M[i][j]=1;
		  else
		    {
		      if(M[i-1][j]==-1 || M[i-1][j-1]==-1 || M[i][j-1]==-1)M[i][j]=1;
		      else M[i][j]=min(M[i-1][j],min(M[i-1][j-1],M[i][j-1]))+1;
			     }
		    }
		}
	      if(dp[i][j]=='*')M[i][j]=-1;
	      //cout << M[i][j];
	    }
	  //cout <<"\n";
	}

      for(i=0;i<n;i++)
	{
	  for(j=0;j<n;j++)
	    {
	      if(M[i][j]>=0 && max<M[i][j])max=M[i][j];
	    }
	}
      cout << max <<"\n";
    }
  return 0;
}

Measured memory_bytes: 0
#include <cstdio>

int main()
{
    int a, b;
    scanf("%d %d", &a, &b);
    if (a == 1)
    {
        a = 14;
    }
    
    if (b == 1)
    {
        b = 14;
    }
    
    if (a>b)
    {
        printf("Alice");
    }
    else if (b>a)
    {
        printf("Bob");
    }
    else
    {
        printf("Draw");
    }
    return 0;
}

Measured memory_bytes: 128
extern crate core;

use std::fmt;
use std::cmp::{Ordering, min, max};
use std::fmt::{Display, Error, Formatter};
use std::collections::{VecDeque, BinaryHeap, BTreeMap};
use std::f32::MAX;
use std::ops::{Add, Sub};

fn show<T: Display>(vec: &Vec<T>) {
    if vec.is_empty() {
        println!("[]");
    }else {
        print!("[{}", vec[0]);
        for i in 1 .. vec.len() {
            print!(", {}", vec[i]);
        }
        println!("]");
    }
}
macro_rules! read_line{
    () => {{
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).ok();
        line
    }};
    (delimiter: ' ') => {
        read_line!().split_whitespace().map(|x|x.to_string()).collect::<Vec<_>>()
    };
    (delimiter: $p:expr) => {
        read_line!().split($p).map(|x|x.to_string()).collect::<Vec<_>>()
    };
    (' ') => {
        read_line!(delimiter: ' ')
    };
    ($delimiter:expr) => {
        read_line!(delimiter: $delimiter)
    };
    (' '; $ty:ty) => {
        read_line!().split_whitespace().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
    };
    ($delimiter:expr; $ty:ty) => {
        read_line!($delimiter).into_iter().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
    };
}
macro_rules! let_all {
    ($($n:ident:$t:ty),*) => {
        let line = read_line!(delimiter: ' ');
        let mut iter = line.iter();
        $(let $n:$t = iter.next().unwrap().parse().ok().unwrap();)*
    };
}

fn main() {
    loop {
        let_all!(n: usize);
        if n == 0 {
            return
        }
        let_all!(y: f64);
        let mut max_rate = 0_f64;
        let mut max_bank = 0;
        for _ in 0..n {
            let_all!(b: usize, r: f64, t: usize);
            let rate = match t {
                1 => {
                    (1_f64 + y * r / 100_f64).log10()
                }
                2 => {
                    (1_f64 + r / 100_f64).log10() * y
                }
                _ => unreachable!()
            };
            if max_rate < rate {
                max_bank = b;
                max_rate = rate;
            }
        }
        println!("{}", max_bank);
    }
}


Measured memory_bytes: 5184
s = input().split()
if s[0]==s[1] and s[0]!=s[2]:
    print('Yes')
elif s[0]==s[2] and s[0]!=s[1]:
    print('Yes')
elif s[2]==s[1] and s[0]!=s[2]:
    print('Yes')
else:
    print('No')

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

int main() {

  int input1,input2;

  int days[12] = {31,29,31,30,31,30,31,31,30,31,30,31};

  while(true) {

    cin >> input1 >> input2;
    if ( input1 == 0 ) break;

    int cnt = 0;

    for ( int i = 0; i < input1-1; i++ ) {
      cnt += days[i];
    }
    cnt += input2-1;

    int week = ( cnt + 3 ) % 7;

    if ( week == 0 ) {
      cout << "Monday";
    }else if ( week == 1 ) {
      cout << "Tuesday";
    }else if ( week == 2 ) {
      cout << "Wednesday";
    }else if ( week == 3 ) {
      cout << "Thursday";
    }else if ( week == 4 ) {
      cout << "Friday";
    }else if ( week == 5 ) {
      cout << "Saturday";
    }else {
      cout << "Sunday";
    }
    cout << endl;

  }

  return 0;

}

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

int main()
{
    ll n,m,i,j;
    cin>>n;
    string a;
    map<string,ll>ma;
    map<string,ll>:: iterator it;
    for(i=0; i<n; i++)
    {
        cin>>a;
        ma[a]++;
    }
    cin>>m;
    for(i=0; i<m; i++)
    {
        cin>>a;
        ma[a]--;
    }
    ll x=-999999999999;
    for(it=ma.begin(); it!=ma.end(); it++)
    {
        x=max(x,it->second);
    }
    if(x<0)
    {
        cout<<0<<endl;
    }
    else{
    cout<<x<<endl;}
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = []
l = [0]*(n + 1)
cnt = 0
now = 1

for i in range(n):
    a.append(int(input()))

for i in range(n):
    cnt += 1
    now = a[now - 1]
    if now == 2:
        print(cnt)
        exit()

print(-1)

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

int main() {
  ll n;
  cin >> n;
  vector<char> ans;
  n -= 1;

  ll shou = n / 26;
  char amari = n % 26;
  ans.push_back(amari);

  while(shou > 0){
    ll newshou = (shou - 1 ) / 26;
    amari = (shou - 1) % 26;
    ans.push_back(amari);
    shou = newshou;
  }

  reverse(ans.begin(), ans.end());
  rep(i, ans.size()){
    cout << char(ans[i] + 97);
  }
  cout << endl;
}


Measured memory_bytes: 3612
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    vi a(n),b(n),c(n-1);
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    rep(i,n-1)cin>>c[i];
    int ans=0;
    rep(i,n){
        ans+=b[a[i]-1];
        if(i&&a[i]-a[i-1]==1)ans+=c[a[i-1]-1];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
 
N = input()

#print( N[-1] )

if ( N[-1]=="3" ):
  print("bon")
  
elif ( N[-1]=="0" or N[-1]=="1" or N[-1]=="6" or N[-1]=="8"):
  print("pon")
  
else:
  print("hon")

Measured memory_bytes: 9108
n,x = map(int,input().split())
l = list(map(int,input().split()))
now = 1
flag = 0
score = 0
for i in range(len(l)):
  score += l[i]
  if score > x:
    flag = 1
    break
  now += 1
if flag == 0:
  print(n+1)
else:
  print(now)

Measured memory_bytes: 3064
import sys
from collections import deque
stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N, M = na()
node_dic = {}
for _ in range(M):
    A, B = na()
    if B in node_dic:
        node_dic[B].append(A)
    else:
        node_dic[B] = [A]
    if A in node_dic:
        node_dic[A].append(B)
    else:
        node_dic[A] = [B]


edge = deque()
edge.append(1)
d = [-1] * N
d[0] = 0
while len(edge):
    e = edge.popleft()
    for ee in node_dic[e]:
        if d[ee - 1] == -1:
            d[ee - 1] = e
            edge.append(ee)
if -1 in d:
    print("No")
else:
    print("Yes")
    print("\n".join(map(str, d[1:])))


Measured memory_bytes: 114208
#include<stdio.h>
int main ()
{
    int a[200][200],b[40000];
    int h,w;
    while(~scanf("%d %d",&h,&w))
    {

        int i,j,n,s=0;
        scanf("%d",&n);
        for(i=0;i<n;i++)
            scanf("%d",&b[i]);
        for(i=0;i<h;i++)
        {
            if(i%2==0)
                for(j=0;j<w;j++)
                {
                    a[i][j]=s+1;
                    b[s]--;
                    if(b[s]==0)
                        s++;
                }
            if(i%2==1)
                for(j=w-1;j>=0;j--)
                {
                    a[i][j]=s+1;
                    b[s]--;
                    if(b[s]==0)
                        s++;
                }
        }
        for(i=0;i<h;i++)
        {
            for(j=0;j<w-1;j++)
                printf("%d ",a[i][j]);
            printf("%d\n",a[i][w-1]);
        }
    }
}

Measured memory_bytes: 384
n,k,s=map(int,input().split())
A=[]
for i in range(k):
    A.append(s)
if s==10**9:
    for i in range(n-k):
        A.append(10**8+99999999)
else:
    for i in range(n-k):
        A.append(10**9)
print(*A)

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

int main(){
  int N,K,c = 1000000000;
  cin >> N >> K;
  int H[N];
  for(int i=0;i<N;i++){
    cin >> H[i];
  }
  sort(H,H+N);
  for(int i=0;i+K-1<N;i++){
    c = min(H[i+K-1]-H[i],c);
  }
  cout << c << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int M,D;
    cin >> M >> D;
    int res = 0;
    for(int i=1;i<=M;i++){
        for(int j=22;j<=D;j++){
            if((j%10)*(j/10)==i&&(j%10)>=2&&(j/10)>=2)res++;
        }
    }    
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX_N 150
typedef struct {
	int a;
	int b;
	int w;
} hen;

int par[MAX_N];
int rank[MAX_N];
int n,m;
hen dis[20000];

void init(int n){
	int i;
	for(i=0;i<n;i++){
		par[i] = i;
		rank[i] = 0;
	}
}
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(rank[x] < rank[y]){
		par[x] = y;
	}else {
		par[y] = x;
		if(rank[x] == rank[y])rank[x]++;
	}
}
int same(int x,int y){
	return find(x)==find(y);
}
int  judge(hen *a,hen *b){
	return (a->w)-(b->w);
}

int Kruskal(int start){

	int i,j,k;
	int max=0;
	int min = dis[start].w;
	init(110);
	for(i=start;i<m;i++){
		hen h = dis[i];
		if(!same(h.a,h.b)){
			unite(h.a,h.b);
			max = h.w;
		}
	}
	for(i=1;i<n+1;i++){
	//	printf("%d ",find(i));
		if(!same(1,i)){
			return -1;
		}
	}
//	return ans;
	return max-min ;
}
int main(){
	int i,j,k;
	int ans=10e8;
	int buf=0;
	while(scanf("%d %d",&n,&m)){
		if(n==0&&m==0){
			break;
		}
		for(i=0;i<m;i++){
			scanf("%d %d %d",&dis[i].a,&dis[i].b,&dis[i].w);
		}
		ans=10e8;
		qsort(dis,m,sizeof(hen),judge);
		for(i=0;i<m;i++){
			buf = Kruskal(i);
			if(buf!=-1&&buf<ans){
				ans =buf;
			}
		}
		if(ans==10e8){
			printf("%d\n",-1);
		}else {
			printf("%d\n",ans);
		}
	}
	return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
#define ll long long int
#define Y printf("YES\n")
#define N printf("NO\n")
#define mp make_pair
#define pb push_back
#define tp make_tuple
#define sc(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld%lld",&a,&b)
#define pr(a) printf("%lld\n",a)
using namespace std;

int main()
{
    ll n,i,j,k,l,p,q,t,x,y;

    sc(n);

    k=0;

    for(i=0;i<n;i++){

        cin>>x;
        k+=(x-1);
    }

    cout<<k<<endl;
}


Measured memory_bytes: 3772
n,m = map(int,input().split())
path = [[[],[],[]] for i in range(n)]

gone = [[0]*3 for i in range(n)]
for i in range(m):
    u,v = map(int,input().split())
    path[u-1][0].append([v-1,1])
    path[u-1][1].append([v-1,2])
    path[u-1][2].append([v-1,0])

s,t = map(int,input().split())

now = [[s-1,0]]
gone[s-1][0] = 1
for ans in range(1,1000000):
    next = []
    for point,key in now:
        for go,gokey in path[point][key]:
            if go == t-1 and gokey == 0:
                print(ans//3)
                exit()
            if gone[go][gokey] == 0:
                gone[go][gokey] = 1
                next.append([go,gokey])
    now = next
  #     print(now)
print(-1)

Measured memory_bytes: 94560
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp>   
using namespace std;
using namespace __gnu_pbds;  
typedef tree<int, null_type, less<int>, rb_tree_tag,  tree_order_statistics_node_update>  ordered_set; 
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define avg(a,b) ((a)+(b))/2
#define pb push_back
#define pob pop_back
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
#define all(x) x.begin(), x.end()
#define M_PI 3.14159265358979323846
#define epsilon (long double)(0.00000000001)
#define side 1e9
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;

ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll mymod(ll a,ll b)
{
    return ((a%b)+b)%b;
}
bool prime[200001];
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=200000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=200000; i += p) 
                prime[i] = false; 
        } 
    } 
    return;
}
ll powe[100005];
void power()
{
    powe[0]=1;
    REP(i,1,100005)
    {
        powe[i]=mymod(2*powe[i-1],num);
    }
}
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
        ll res = (x%m + m) % m;
        return res;
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
    return gcd; 
}
struct node
{
	vll adj;
    ll waysblack;
    ll wayswhite;
};
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    ll A[n+1];
    REP(i,1,n+1)
    {
        cin>>A[i];
    }
    ll cur=1;
    map<ll,vll> m;
    m[1].pb(0);
    ll times=0;
    while(true)
    {
        cur = A[cur];
        times++;
        m[cur].pb(times);
        if(times==k)
        {
            cout<<cur<<"\n";
            exit(0);
        }
        if(m[cur].size()==2)
        {
            break;
        }
    }
    ll period = m[cur][1] - m[cur][0];
    ll timeleft = (k - times)%period;
    REP(i,0,timeleft)
    {
        cur = A[cur];
    }
    cout<<cur<<"\n";
    return 0;
}




Measured memory_bytes: 22752
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int M = 55;
int n, m, q, a[M], b[M], c[M], d[M];

void solve(int i, vector <int> &v, int &ans)
{
	if(i > n)
	{
		int cur = 0;
		for(int j = 0; j < q; j++)
			if(v[b[j]] - v[a[j]] == c[j])
				cur += d[j];
		ans = max(ans, cur);
		return;
	}
	for(int j = v[i - 1]; j <= m; j++)
	{
		v[i] = j;
		solve(i + 1, v, ans);
	}
}

int32_t main() 
{
	ios_base::sync_with_stdio(0);	cin.tie(0);	cout.tie(0);
	cin >> n >> m >> q;
	for(int i = 0; i < q; i++)
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	vector <int> v(n + 1, 1);
	int ans = 0;
	solve(1, v, ans);
	cout << ans;
    	return 0;
}

Measured memory_bytes: 3632
N = int(input())
S = [input() for i in range(N)]

ans = {}
for i in S:
    if i in ans:
        ans[i] += 1
    else:
        ans[i] = 1

max_v = max(ans.values())        
ANS = []
for key, value in ans.items():
    if ans[key] == max_v:
        ANS.append(key)

for i in sorted(ANS):
    print(i)

Measured memory_bytes: 35216
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;i++)
const ll INF=1e15;
const ll MOD=1000000007;

int main(){
    int N;string S;cin>>N>>S;
    char info[S.size()];
    rep(i,S.size()){
        info[i]=S[i];
        info[i]=(info[i]-'A'+N)%26+'A';
    }
    rep(i,S.size())cout<<info[i];
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>

using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    priority_queue<int> q;
    for(int i = 0; i < n; i++){
        long long temp;
        cin >> temp;
        q.push(temp);
    }
    for(int j = 0; j < m; j++){
        long long q_top;
        q_top = q.top();
        q.pop();
        q_top /= 2;
        q.push(q_top);
    }
    long long sum = 0;
    for(int i = 0; i < n; i++){
        sum += q.top();
        q.pop();
    }
    cout << sum << endl;
}   

Measured memory_bytes: 892
a = input()
x = [a[i:i+1] for i in range(len(a))]
b = input()
y = [b[i:i+1] for i in range(len(b))]
c = input()
z = [c[i:i+1] for i in range(len(c))]
ans = x[0]+y[1]+z[2]
print(ans)

Measured memory_bytes: 3064
import Data.List
import Data.Ord
main = do
  t <- readLn :: IO Int
  xs <- fmap (map read . words) getLine :: IO [Int]
  print $ solve4 xs
solve4 = solve4' 0 1
solve4' c _ [] = c
solve4' c i (x : []) = if x == i then c + 1 else c
solve4' c i (x : y : xs) = if x == i then solve4' (c + 1) (i + 2) xs else solve4' c (i + 1) (y : xs)


Measured memory_bytes: 29180
# C - Christmas Eve
N, K = map(int, input().split())
h = [int(input()) for i in range(N)]
H = list(h)
H.sort(reverse=True)
ans = H[0]-H[N-1]
tmp = 0
for i in range(len(H)-K+1):
    tmp = H[i]-H[i+K-1]
    if ans >= tmp:
        ans = tmp
    else:
        pass
print(ans)

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

int main(){
    int N, cnt = 0, ans = 0, tmp = 0;
    string n;
    cin >> n;
    rep(i, 2){
        if(n[i] == '9'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
    
}

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

int main() {
  int A,B;
  cin >> A >> B;
  int counter=0;
  int x=1;
  
  while ( true ) {
    if ( x<B ) {
      x += A-1;
      counter++;
    }
    else {
      break;
    }
  }
    
    cout << counter << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {

    int N = sc.nextInt();
    int M = sc.nextInt();

    if (N >= M) {
      System.out.println(0);
      return;
    }

    int[] X = new int[M];
    for (int i=0; i<M; i++) {
      X[i] = sc.nextInt();
    }

    Arrays.sort(X);

    ArrayList<Integer[]> ranking = new ArrayList(M-1); //[0] 添字 [1] 差
    for (int i=1; i<M; i++) {
      int dif = X[i] - X[i-1];
      ranking.add(new Integer[]{i, dif});
    }

    Collections.sort(ranking, (x,y) -> y[1]-x[1]);
    while(ranking.size() >= N) ranking.remove(N-1);
    Collections.sort(ranking, (x, y) -> x[0] - y[0]);
    ranking.add(0, new Integer[]{0, -1});
    ranking.add(new Integer[]{M, -1});

    int sum = 0;
    for (int i=1; i<=N; i++) {
      sum += X[ranking.get(i)[0]-1] - X[ranking.get(i-1)[0]];
    }

    System.out.println(sum);

  }
}

Measured memory_bytes: 53268
#include <bits/stdc++.h>
using namespace std;
int main()
{
  long n,x,i,var,sum=0,count=0;
  cin>>n>>x;
  vector <long> a(n);
  for(i=0;i<n;i++)
  {
      cin>>var;
      a.at(i)=var;
      sum+=var;
  }
  count=n;
  long rem,min;
  rem=x-sum;
  min=a.at(0);
  for(i=0;i<n;i++)
      if(a.at(i)<min)
          min=a.at(i);
  count+= rem/min;
  cout<<count;
   return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define INF 1e8

struct edge {
    int to, cost;
};

struct P {
    int from, cost, ticket;

    bool operator >(const P& p) const {
        return cost > p.cost;
    }
};

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

int ticket_n, node_n, edge_n, start, goal;

int main() {
    while (cin >> ticket_n >> node_n >> edge_n >> start >> goal, ticket_n|node_n|edge_n|start|goal) {
        vector<vector<edge>> E(node_n+1);
        REP(i, edge_n) {
            int from, to, cost;
            cin >> from >> to >> cost;
            E[from].push_back({to, cost});
            E[to].push_back({from, cost});
        }

        vvi G(node_n+1, vi(ticket_n+1, INF));
        priority_queue<P, vector<P>, greater<P>> q;
        q.push({start, 0, ticket_n});
        while (!q.empty()) {
            P p = q.top(); q.pop();

            if (p.from == goal) {
                cout << p.cost << endl;
                break;
            }

            int from = p.from, cost = p.cost, ticket = p.ticket;
            for (edge e : E[from]) {
                // use ticket
                if (G[e.to][ticket] > cost + e.cost) {
                    G[e.to][ticket] = cost + e.cost;
                    q.push({e.to, cost + e.cost, ticket});
                }
                // don't use ticket
                if (ticket-1 >= 0) {
                    if (G[e.to][ticket-1] > cost + e.cost/2) {
                        G[e.to][ticket-1] = cost + e.cost/2;
                        q.push({e.to, cost + e.cost/2, ticket-1});
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 1256
//@author yash2040
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define int long long
#define pb push_back
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int32_t main()
{
	fast();
	int t=1;
	//cin>>t;
	while(t--)
	{
		int x;
		cin>>x;
		if(x==0)
		cout<<1;
		else
		cout<<0;
	}
}








Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int, int>;

const int INF = 1e7;

enum {
    U, R, D, L,
};

int solve(map<int, vector<Pair>> &mp) {
    int res = INF;
    for(auto &[x, planes] : mp) {
        for(int i = 0; i < planes.size() - 1; ++i) {
            auto[y1, d1] = planes[i];
            auto[y2, d2] = planes[i + 1];
            if(d1 == U && d2 != U) res = min(res, y2 - y1);
        }
    }
    return res;
}

int main() {
    int N; cin >> N;
    vector<int> X(N), Y(N), dir(N);
    for(int i = 0; i < N; ++i) {
        char u;
        cin >> X[i] >> Y[i] >> u;
        if(u == 'U') dir[i] = U;
        if(u == 'R') dir[i] = R;
        if(u == 'D') dir[i] = D;
        if(u == 'L') dir[i] = L;
    }
    int ans = INF;
    for(int _ = 0; _ < 4; ++_) {
        map<int, vector<Pair>> mp;
        for(int i = 0; i < N; ++i) {
            if(dir[i] == R || dir[i] == L) continue;
            mp[X[i]].emplace_back(Y[i], dir[i]);
        }
        for(auto &[key, val] : mp) sort(val.begin(), val.end());
        ans = min(ans, 5 * solve(mp));

        map<int, vector<Pair>> mp2;
        for(int i = 0; i < N; ++i) {
            if(dir[i] == D || dir[i] == L) continue;
            mp2[X[i] + Y[i]].emplace_back(Y[i], dir[i]);
        }
        for(auto &[key, val] : mp2) sort(val.begin(), val.end());
        ans = min(ans, 10 * solve(mp2));

        for(int i = 0; i < N; ++i) {
            swap(X[i], Y[i]);
            Y[i] = -Y[i];
            dir[i] = (dir[i] + 1) % 4;
        }
    }
    if(ans == INF) cout << "SAFE" << '\n';
    else cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 48856
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int n,T,t;
long long Ans,tot,last;

int main(){
  scanf("%d %d",&n,&T);
  for(int i=1;i<=n;i++){
    scanf("%d",&t);
    if(t>last) Ans+=tot,tot=T;
    else tot+=t+T-last;
    last=t+T;
  }
  printf("%lld\n",Ans+tot);
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;

char s[100010], c[10];
int n, q, t, f;
vector<char> fr, ba;
int main() {
	scanf("%s", s);
	for (n = 0; s[n]; n++);
	scanf("%d", &q);

	int swp = 0;
	for (int i = 0; i < q; i++) {
		scanf("%d", &t);
		if (t == 1) {
			fr.swap(ba);
			swp ^= 1;
			continue;
		}
		scanf("%d %s", &f, c);
		(f == 1 ? fr : ba).emplace_back(c[0]);
	}
	for (int i = fr.size() - 1; 0 <= i; i--)
		printf("%c", fr[i]);
	for (int i = 0; i < n; i++)
		printf("%c", swp ? s[n - 1 - i] : s[i]);
	for (int i = 0; i < ba.size(); i++)
		printf("%c", ba[i]);
	printf("\n");
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> divisor(ll n) {
	vector<ll> res;
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			res.push_back(i);
			if (i * i != n)
				res.push_back(n / i);
		}
	}

	return res;
}
int main() {
	int n, m;
	cin >> n >> m;
	vector<ll> d;
	d = divisor(m);
	ll ans = 1;
	for (int i = 0; i < d.size(); i++) {
		if (m / d[i] >= n) {
			ans = max(ans, d[i]);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3624
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        s: Chars,
    }

    let len = s.len();
    if s[len - 1] == 's' {
        for c in &s {
            print!("{}", c);
        }
        println!("es");
    } else {
        for c in &s {
            print!("{}", c);
        }
        println!("s");
    }
}


Measured memory_bytes: 2176
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.util.Map;
import java.io.BufferedReader;
import java.io.InputStream;

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

    static class AZeroSumRanges {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            int n = in.ints();
            long[] a = in.longs(n);
            long[] sum = new long[n + 1];
            for (int i = 0; i < n; i++) {
                sum[i + 1] = sum[i] + a[i];
            }
            Map<Long, Integer> c = new HashMap<>();
            for (long x : sum) {
                c.merge(x, 1, (v1, v2) -> v1 + v2);
            }
            long ans = 0;
            for (int m : c.values()) {
                ans += m * (m - 1L) / 2;
            }
            out.println(ans);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

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

        public int ints() {
            return Integer.parseInt(string());
        }

        public long longs() {
            return Long.parseLong(string());
        }

        public long[] longs(int length) {
            return IntStream.range(0, length).mapToLong(x -> longs()).toArray();
        }

    }
}



Measured memory_bytes: 53020
# include <bits/stdc++.h>
 
/*
// ordered_set 
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
# define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
 
using namespace std;
 
typedef long long                                        ll;
typedef long double                                      ld;
typedef pair <int, int>                                  pii;
typedef pair <pii, int>                                  ppi;
typedef pair <int, pii>                                  pip;
typedef pair <pii, pii>                                  ppp;
typedef pair <ll, ll>                                    pll;
 
# define A                                               first
# define B                                               second
# define endl                                            '\n'
# define sep                                             ' '
# define all(x)                                          x.begin(), x.end()
# define kill(x)                                         return cout << x << endl, 0
# define SZ(x)                                           int(x.size())
# define Sort(x)                                         sort(all(x))
# define InTheNameOfGod                                  ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
 
ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));}
 
const int xn = 1e5 + 10;
const int xm = -20 + 10;
const int SQ = 320;
const int sq = 320 + 10;
const int inf = 1e9 + 10;
const ll INF = 1e18 + 10;
const int MOD = 1e9 + 7;
const int TM = 3;
const int BASE = 257;

ll n, m, k;
pii num[xn];
map <pii, int> mp;
map <int, ll> cnt;

void Solve(int x, int y){
	if (x < 1 || y < 1 || x + 2 > n || y + 2 > m) return;
	-- cnt[mp[{x, y}]];
	++ mp[{x, y}];
	++ cnt[mp[{x, y}]];
}
 
int main(){
    InTheNameOfGod;
    
    cin >> n >> m >> k;
    cnt[0] = (n - 2) * (m - 2);
    for (int i = 0; i < k; ++ i) cin >> num[i].A >> num[i].B;
    for (int i = 0; i < k; ++ i) for (int j = 0; j < 3; ++ j) for (int l = 0; l < 3; ++ l) Solve(num[i].A - j, num[i].B - l);
    for (int i = 0; i < 10; ++ i) cout << cnt[i] << endl;
	
    return 0;
}


Measured memory_bytes: 57344