akhauriyash/Code-Regression huggingface dataset:
//============================================================================
// Name        : d.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	string s;cin>>s;
	int q;cin>>q;
	vector<int> t(q),f(q),r(q);
	vector<string> c(q);
	vector<int> top,back;

	int re=0;
	for(int i=0;i<q;i++){
		cin>>t[i];
		if(t[i]==1){
			re=1-re;
			continue;
		}
		cin>>f[i]>>c[i];
		if((f[i]+re)%2){
			top.push_back(i);
		}else{
			back.push_back(i);
		}
		r[i]=re;

	}
//	for(int i=0;i<top.size();i++){
//		cout<<c[top[i]]<<' ';
//	}cout<<endl;
//	for(int i=0;i<back.size();i++){
//		cout<<c[back[i]]<<' ';
//	}cout<<endl;
	string temps;
	if(re==0){
		for(int i=top.size()-1;i>=0;i--){
			if(r[i]==re){
				cout<<c[top[i]];
			}else{
				reverse(c[top[i]].begin(),c[top[i]].end());
				cout<<c[top[i]];
			}
		}
		cout<<s;
		for(int i=0;i<back.size();i++){
			if(r[i]==re){
				cout<<c[back[i]];
			}else{
				reverse(c[back[i]].begin(),c[back[i]].end());
				cout<<c[back[i]];
			}
		}
		cout<<endl;
	}else{
		for(int i=back.size()-1;i>=0;i--){
			if(r[i]==re){
				cout<<c[back[i]];
			}else{
				reverse(c[back[i]].begin(),c[back[i]].end());
				cout<<c[back[i]];
			}
		}
		reverse(s.begin(),s.end());
		cout<<s;
		for(int i=0;i<top.size();i++){
			if(r[i]==re){
				cout<<c[top[i]];
			}else{
				reverse(c[top[i]].begin(),c[top[i]].end());
				cout<<c[top[i]];
			}
		}


	}
	return 0;
}

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

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

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

int main() {
  string s;
  cin>>s;
  map<char,int> m;
  for(auto x:s) m[x]++;
  if(max(max(m['a'],m['b']),m['c'])-min(min(m['a'],m['b']),m['c'])<=1) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 512
import java.util.*;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int res = 0;
        for(int i = 0;i < S.length() / 2;i++){
            if(S.charAt(i) != S.charAt(S.length() - 1 -i)){
                res++;
            }
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 21844
import Control.Monad

qsort :: [Int] -> [Int]
qsort [] = []
qsort (p:xs) = qsort lt ++ [p] ++ qsort gt
  where lt = [l | l <- xs, l < p]
        gt = [g | g <- xs, g >= p]

solver :: [Int] -> [Int]
solver xs =
  let sorted = qsort xs
      revSort = reverse sorted
  in
      take 3 revSort

main ::IO()
main = do
  input <- replicateM 10 getLine
  mapM_ print $ solver $ map read input

Measured memory_bytes: 3616
N, u, v = map(int, input().split())
u -= 1
v -= 1
table = [[] for i in range(N)]
for i in range(N-1):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    table[A].append(B)
    table[B].append(A)

dist_u = [-1]*N
dist_v = [-1]*N
dist_u[u] = 0
dist_v[v] = 0

from collections import deque

H = deque()
H.append(u)
while H:
    x = H.popleft()
    for nx in table[x]:
        if dist_u[nx] == -1:
            H.append(nx)
            dist_u[nx] = dist_u[x]+1

H = deque()
H.append(v)
while H:
    x = H.popleft()
    for nx in table[x]:
        if dist_v[nx] == -1:
            H.append(nx)
            dist_v[nx] = dist_v[x]+1

tmp = 0
for i in range(N):
    if dist_u[i] < dist_v[i] and dist_v[i] >= tmp:
        tmp = dist_v[i]
        memo = i
print(tmp-1)

Measured memory_bytes: 29384
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#define R register
using namespace std;
const int MAXN=100100;
char s[MAXN];

int reads(char *st)
{
	int len=0;char ch=getchar();
	while(ch<'a'||ch>'z')ch=getchar();
	while(ch>='a'&&ch<='z')st[++len]=ch,ch=getchar();
	return len;
}

int main()
{
	int n=reads(s);
	for(R int i=3;i<=n;++i)
	{
		char c1=s[i-2],c2=s[i-1],c3=s[i];
		if(c1==c2||c1==c3||c2==c3)
		{
			printf("%d %d\n",i-2,i);
			return 0;
		}
	}
	if(n==2)if(s[1]==s[2])
	{
		puts("1 2");
		return 0;
	}
	puts("-1 -1");
	return 0;
}

Measured memory_bytes: 384
#include <time.h>

#include <stdlib.h>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <iomanip>
#include <numeric>

using namespace std;
#include <cstdint>
#include <iostream>
#include <utility>
#include <map>

int64_t gcd(int64_t a,int64_t b){//calc gcd
	if(a==0){
		return b;
	}else if(b==0){
		return a;
	}else if(a>b){
		return gcd(a%b,b);
	}else{
		return gcd(b%a,a);
	}
}
std::pair<int64_t,int64_t> extgcd(int64_t a,int64_t b){//a*(pair->first) + b*(pair->second) = gcd(a,b)
	if(a==0){
		return std::make_pair(0,1);
	}else if(b==0){
		return std::make_pair(1,0);
	}else{
		if(a>b){
			std::pair<int64_t,int64_t> d=extgcd(a%b,b);
			return std::make_pair(d.first,d.second-(a/b)*d.first);
		}else{
			std::pair<int64_t,int64_t> d=extgcd(a,b%a);
			return std::make_pair(d.first-(b/a)*d.second,d.second);
		}
	}

}
int64_t inline normalize_mod(int64_t a,int64_t m){
	return (m+a%m)%m;
}
int64_t mod_inv(int64_t a,int64_t m){//a^-1(mod m),m is a prime number
	int64_t raw=extgcd(a,m).first;
	return normalize_mod(raw,m);;
}
std::map<int64_t,int64_t> factorization(int64_t n){
	std::map<int64_t,int64_t> retval;
	for(int64_t i=2;i*i<=n;i++){
		int64_t counter=0;
		while(n%i==0){
			n=n/i;
			counter++;
		}
		if(counter!=0){
			retval.emplace(i,counter);
		}
	}
	return retval;
}
std::pair<int64_t,int64_t> mod_fact(int64_t n,int64_t m){//n!=first*m^second
	if(n==0){
		return std::make_pair(1,0);
	}else{

		std::pair<int64_t,int64_t> d=mod_fact(n/m,m);
		int64_t second=d.second+n/m;
		int64_t first;
		if((n/m)%2==0){
			first=1;
		}else{
			first=m-1;
		}
		for(int64_t i1=1;i1<=(n%m);i1++){
			first=normalize_mod(first*i1,m);
		}
		return std::make_pair(first,second);
	}
}

int main(){
	int64_t n,a,b,k;
	cin>>n>>a>>b>>k;
	int64_t ans=0;
	int64_t table[n+1];
	int64_t m=998244353;
	table[0]=1;
	for(int64_t i1=1;i1<=n;i1++){
		table[i1]=normalize_mod(((table[i1-1]*(n-i1+1))%m)*mod_inv(i1,m),m);
	}
	for(int64_t i1=0;i1<=n;i1++){
		if((k-a*i1)%b!=0){
			continue;
		}
		int64_t i2=(k-a*i1)/b;
		if(i2<0){
			break;
		}
		if(i2>n){
			continue;
		}
		ans=normalize_mod(ans+table[i1]*table[i2],m);
	}
	cout<<ans<<endl;


}

Measured memory_bytes: 2688
n = int(input())
A = list(map(int,input().split()))
answer = 1
flag = 1
zero = 0
for i in range(n):
    answer *= A[i]
    if answer > pow(10,18):
        flag = 0
        break
if 0 in A:
    print(0)
elif flag ==0:
    print('-1')
else:
    print(answer)

Measured memory_bytes: 21604
#include<bits/stdc++.h>
using namespace std;
const int maxN = 500 + 13;
int n, m;
char a[maxN][maxN];
int main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i = 0; i < n; i++)
	for (int j = 0; j < m; j++)
	    cin >> a[i][j];
    for (int i = 0; i < n; i++) {
	for (int j = 0; j < m; j++) {
	    if (a[i][j] == '#' || j == 0 || (i % 2 == 0 && j != m - 1))
		cout << '#';
	    else
		cout << '.';
	}
	cout << '\n';
    }
    cout << '\n';
    for (int i = 0; i < n; i++) {
	for (int j = 0; j < m; j++) {
	    if (a[i][j] == '#' || j == m - 1 || (i % 2 == 1 && j != 0))
		cout << '#';
	    else
		cout << '.';
	}
	cout << '\n';
    }
}
    
    


Measured memory_bytes: 1024
from fractions import gcd

N = int(input())
A = list(map(int,input().split()))
'''
res = 0
for i in range(N):
    tmp = A[i+1:] + A[:i]
    ans = tmp[0]
    for i in range(1,N-1):
        ans = gcd(ans,tmp[i])
    res = max(ans,res)
print(res)
'''

L = [0] * (N+1)
R = [0] * (N+1)

for i in range(N):
    L[i+1] = gcd(L[i],A[i])
    R[N-i-1] = gcd(R[N-i],A[N-i-1])
ans = 0
for i in range(N):
    ans = max(ans,gcd(L[i],R[i+1]))

print(ans)

Measured memory_bytes: 16152
n, a, b = map(int,input().split())
s_list = list(input())

sum_AB = a + b
sum_total = 0
sum_B = 0

for s in s_list:
    if s == 'c':
        print('No')
        continue
    if s == 'a':
        if sum_total < sum_AB:
            print("Yes")
            sum_total += 1
        else:
            print('No')
    elif s == 'b':
        if sum_total < sum_AB and sum_B < b:
            print('Yes')
            sum_total += 1
            sum_B += 1
        else:
            print('No')


Measured memory_bytes: 4708
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<cmath>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<algorithm>
#include<bitset>
#include<complex>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<stack>
#include<set>
using namespace std;
long long n,ans;
int main()
{
	cin>>n;
	for (int i=1;i<=n;++i)
		ans+=i*(n/i*(n/i+1)>>1);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3172
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

#define mod 1000000007

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;

int main() { 
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m, x;
	cin >> n >> m >> x;
	int a[100];
	rep(i, m) cin >> a[i];
	int cost1 = 0, cost2 = 0;
	rep(i, m) {
		if (a[i] < x) {
			cost1++;
		}
		else {
			cost2++;
		}
	}
	cout << min(cost1, cost2) << "\n";
	return 0;
}

Measured memory_bytes: 256
package main

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

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

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

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

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

func df(i, n int, on []int) {
	if i == n {
		for i := range S {
			cnt := 0
			for j := range S[i] {
				if on[S[i][j]-1] == 1 {
					cnt++
				}
			}
			if cnt%2 != P[i] {
				return
			}
		}
		ans++
		return
	}
	df(i+1, n, append(on, 0))
	df(i+1, n, append(on, 1))
}

var ans int
var S [][]int
var P []int

func main() {
	n := readInt()
	m := readInt()

	S = make([][]int, m)
	for i := range S {
		k := readInt()
		S[i] = make([]int, k)
		for j := range S[i] {
			S[i][j] = readInt()
		}
	}

	P = make([]int, m)
	for i := range P {
		P[i] = readInt()
	}

	df(0, n, make([]int, 0, n))

	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
int BinarySearch(int key,int n,int S[]){
  int l=0,r=n;
  while(r-l>1){
    int mid=(l+r)/2;
    if(S[mid]>key)r=mid;
    else l=mid;
  }
  return S[l]==(key?1:0);
}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8


int main(){
    ll N,A[100007];cin >> N;
    rep(i,N){
        cin >> A[i];
    }
    sort(A,A+N);
    cout << A[N-1]-A[0] <<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string>
#include <ctype.h>

#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;
constexpr ll INF = 1000000000;

using namespace std;
int main() {
	string n; cin >> n;
	if (n[0] == n[1] && n[1] == n[2]) {
		cout << "Yes" << endl;
	}
	else if (n[1] == n[2] && n[2] == n[3]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int X, A;
	cin >> X >> A;
	if (X < A) {
		cout << 0 << endl;
	}
	else {
		cout << 10 << endl;
	}
}

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

using namespace std;

#define ll long long

void solve() {
	int a, b;
	cin >> a >> b;
	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= a-i; j++) {
			int k = a-i-j;
			if (i*10000+j*5000+k*1000 == b) {
				cout << i << " " << j << " " << k << "\n";
				return;
			}
		}
	}
	cout << "-1 -1 -1\n";
}

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

	int t = 1, i = 1;
	//cin >> t;
	while(t--) {
		//cout << "Case #" << i << ": ";
		solve();
		//i++;
	}
	return 0;
}



Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

int n;
string s;
vi a;

int dfs(int i) {
  if (a[i] != -1) return a[i];
  a[i] = 0;
  if (i && s[i-1] == '<') {
    maxs(a[i],dfs(i-1)+1);
  }
  if (i+1 < n && s[i] == '>') {
    maxs(a[i],dfs(i+1)+1);
  }
  return a[i];
}

int main() {
  cin>>s;
  n = sz(s)+1;
  a = vi(n,-1);
  rep(i,n) dfs(i);
  ll ans = suma(a);
  cout<<ans<<endl;
  return 0;
}






















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

int main()
{
    long long h, w;
    cin >> h >> w;
    if (h == 1 || w == 1) 
    {
        cout << 1 << endl;
        return 0;
    }
    cout << ((w + 1) / 2) * ((h + 1) / 2) + (w / 2) * (h / 2) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  int a,b,c,d;cin>>a>>b>>c>>d;
  cout<<(a==c?0:1);
}

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


//最大公約数を求める
ll gcd(ll a,ll b)
{
	if (a%b==0)
	{
		return(b);
    }
	else
	{
		return(gcd(b,a%b));
    }
}

int main(){
    ll a,b; cin >> a >> b;
    cout << a*b/gcd(a,b);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String str = sc.next();
        int res = 1;
        for(int i = 1; i < str.length(); i++) {
            if(str.charAt(i) != str.charAt(i-1)) res++;
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 39404
a, v = [int(s) for s in input().split(" ")]
b, w = [int(s) for s in input().split(" ")]
t = int(input())

if v == w:
  print("NO")
else:
  if a > b and w > v:
    print("NO")
  elif b > a and w > v:
    print("NO")
  else:
    l = abs(b - a)
    k = abs(v - w)
    if k * t >= l:
      print("YES")
    else:
      print("NO")

Measured memory_bytes: 9208
#include <iostream>
using namespace std;
class Dice{
public:
	int num[6],t;//t=top
	void North(){
		/*
		dice.num[0] = ???
		dice.num[1] = ???
		dice.num[2] = ???
		dice.num[3] = ???
		dice.num[4] = ???
		dice.num[5] = ???*/
		
		t = num[0];
		num[0] = num[1];//??????1?????¨???
		num[1] = num[5];//??????2?????¨???
		num[5] = num[4];//??????6?????¨???
		num[4] = t;//??????5?????¨???
		}

	void East(){
		t = num[0];
		num[0] = num[3];//??????1?????¨???
		num[3] = num[5];//??????4?????¨???
		num[5] = num[2];//??????6?????¨???
		num[2] = t;//??????3?????¨???
		}

	void West(){
		t = num[0];
		num[0] = num[2];//??????1?????¨???
		num[2] = num[5];//??????5?????¨???
		num[5] = num[3];//??????6?????¨???
		num[3] = t;//??????2?????¨???
		}
		
	void South(){
		t = num[0];
		num[0] = num[4];//??????1?????¨???
		num[4] = num[5];//??????3?????¨???
		num[5] = num[1];//??????6?????¨???
		num[1] = t;//??????3?????¨???
		}
	
	void Rotation(){//?????¢??????????????§?????¢???????????¨???
		t = num[1];
		num[1] = num[2];//?????¢???2?????¨???
		num[2] = num[4];//?????¢???3?????¨???
		num[4] = num[3];//?????¢???5?????¨???
		num[3] = t;//?????¢???4?????¨???
		}
};






int main()
{
	
	Dice d[100];//2<=n<=100
	int n;
	
	cin >>n;

	for(int i=0; i<n; i++){//dice
		cin >> d[i].num[0] >> d[i].num[1] >> d[i].num[2] >> d[i].num[3] >> d[i].num[4] >> d[i].num[5];
	}
		
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			if(i == j)continue;
			
			for(int k=0; k<6; k++){//dice?????°???
				if (k == 4){
					d[i].East();
				}
				if(k == 5){//dice?????°?????¨????????????
					d[i].East();
					d[i].East();
				}
				
				for(int l=0; l<4; l++){//dice?????°??????4???????????????????????????Rotation
					d[i].Rotation();
					//?????????????????????????????´??????No
					if( d[i].num[0] == d[j].num[0] &&
						d[i].num[1] == d[j].num[1] &&
						d[i].num[2] == d[j].num[2] &&
						d[i].num[3] == d[j].num[3] &&
						d[i].num[4] == d[j].num[4] &&
						d[i].num[5] == d[j].num[5] )
					{cout << "No" << endl;
						return 0;
					}
					
				}
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define int long long
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;
 
 
signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  int x[20][20] = {};
  int y[20][20] = {};
  for(int i=0; i < 20; i++){
    for(int j=0; i < 20; i++){
      x[i][j]=-1;
      y[i][j]=-1;
    }
  }
  for(int i=0; i < N; i++){
    cin >> A[i];
    for (int j = 0; j < A[i]; j++){
      cin >> x[i][j] >> y[i][j];
      x[i][j]--;
    }
  }
  int ans = 0;
  for(int bit=0; bit<(1<<N); ++bit){
    vector<int> l(N,-1);
    bool f = true;
    for(int i=0; i < N; i++){
      if ((bit>>i) & 1 == 1){
        if (l[i]==0){
          f = false;
          break;
        } else {
          l[i]=1;
          for(int j=0; j < A[i]; j++){
            if(l[x[i][j]] == -1){
              if (y[i][j] == 1 & (bit >> x[i][j]) & 1 == 1){
                l[x[i][j]] = y[i][j];
              } else if(y[i][j] == 0) {
                l[x[i][j]] = y[i][j];
              } else {
                f=false;
                break;
              }
            } else {
              if (l[x[i][j]] != y[i][j]){
                f = false;
                break;
              }
            }
          }
        if(!f){
          break;
        }
        }
      }
    }
    if(f==true){
      int tmp=0;
      for (int i = 0; i < N; i++){
        if(l[i]==1){
          tmp++;
        }
      }
      ans = max(ans, tmp);
    }
  }
  cout << ans << endl;
 
}

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

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

    while(a > 0 || c > 0){
        c -= b ;
        if(c <= 0){
            cout << "Yes" << endl; 
            return 0 ;
        }
        a -= d ;
        if(a <= 0){
            cout << "No" << endl;
            return 0 ;
        }
    }

    
    return 0 ;
}

 



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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define VIN(x) for(auto&youso_: (x) )cin>>youso_
#define VOUT(x, delim) for(auto&youso_: (x) )cout<<youso_<<delim;cout<<endl

#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) i64 __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    CIN(a, b, c, d);
    i64 ans = -2e18;

    bool zero = false;
    if (a * b <= 0) zero = true;
    if (c * d <= 0) zero = true;

    chmax(ans, a * c);
    chmax(ans, a * d);
    chmax(ans, b * c);
    chmax(ans, b * d);

    if (zero) chmax(ans, (i64)0);
    COUT(ans);

    return 0;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, K;
	cin >> N >> K;

	int combi = (N - 1) * (N - 2) / 2;
	if (K > combi) {
		cout << "-1" << "\n";
	}
	else {
		cout << N - 1 + combi - K << "\n";
		for (int i = 2; i <= N; i++) {
			cout << 1 << " " << i << "\n";
		}
		int cnt = 2;
		bool flag = combi != K;
		while(flag){
			for (int i = cnt + 1; i <= N; i++) {
				if (combi - K == 0) {
					flag = false;
					break;
				}
				cout << cnt << " " << i << "\n";
				K++;
			}
			cnt++;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#coding:utf-8
import fileinput
from collections import defaultdict

for row in fileinput.input():
    row = row.strip()
    dic = defaultdict(int)
    for s in row:
        dic[s] += 1
    if max(dic.values()) == 3 and row[0]!=row[-1]:
        print 'Yes'
    elif max(dic.values()) == 4:
        print 'Yes'
    else:
        print 'No'


Measured memory_bytes: 2932
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define MAX 1000000007
typedef long long ll;

int mycount[110];
bool S[10],flag=true;
ll ans=-10000000000,P[110][10],temp;
bool F[110][10];
int N;

void solve(){
  for(int i=0;i<N;i++) mycount[i]=0;
  for(int i=0;i<10;i++){
    if(S[i]==1){
      for(int j=0;j<N;j++) if(F[j][i]==1) mycount[j]++;
    }
  }
  for(int i=0;i<N;i++){
    temp+=P[i][mycount[i]];
  }
  ans=max(ans,temp);
  temp=0;
}

void set(int x){
  if(x==10) {
  if(flag){
      flag=false;
      return;
    } 
    solve();
    return;
  }
  S[x]=0;
  set(x+1);
  S[x]=1;
  set(x+1);

}

int main(){
  cin>>N;
  for(int i=0;i<N;i++){
    for(int j=0;j<10;j++) cin>>F[i][j];
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<=10;j++) cin>>P[i][j];
  }
  set(0);
  cout<<ans<<endl;
}


Measured memory_bytes: 256
// #includes {{{
#ifdef MY_DEBUG
#include "header/header.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

template<class T>
constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity():(numeric_limits<T>::max()/2);

int __inf_ignore(){
	int t = inf<int>;
	return t;
}

typedef pair<int,int> pii;

#ifdef MY_DEBUG
#include"print.hpp"
#include"debug.hpp"
#endif
// }}}

Int N;
vector<Int> d;

void solve(){
	int ans = 0;
	sort(ALL(d));
	for(int K = 0;K <= 100000;K++){
		int u = distance(d.begin(),lower_bound(ALL(d),K));
		if(u==N/2)ans++;
	}
	cout<<ans<<endl;
}
//{{{ main fucnction
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> N;
    d.assign(N,Int());
    for(int i = 0 ; i < N ; i++){
        cin >> d[i];
    }
	solve();
	return 0;
}
//}}}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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; }
int main(){
    ll n,k; cin>>n>>k;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll x=0;
    rep(i,n) if(a[i]==1) x=i;
    ll res=0;
    res+=x/(k-1);
    if(x%(k-1)) {
        res++;
        n-=(k-1)-x%(k-1);
    }
    res+=(n-1-x)/(k-1);
    if((n-1-x)>0 && (n-1-x)%(k-1)) res++;
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 1148
import java.io.*;
import java.util.*;

class Main{
	public static void main(String[] args){
		int a, b, c, max, middle, bottom;
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			
			String[] line = br.readLine().split(" ");
			a = Integer.parseInt(line[0]);
			b = Integer.parseInt(line[1]);
			c = Integer.parseInt(line[2]);
			
			Arrays.sort(line);
			
			System.out.println(line[0]+" "+line[1]+" "+line[2]);
		} catch(Exception e){
		}
	}
}

Measured memory_bytes: 24196
#pragma warning (disable:4996)
#include <stdio.h>
#include <string.h>
void checkCards(int *taro, int *hanako){
	int num, point;
	char taroC[128], hanakoC[128];
	scanf("%d", &num);
	while (num--){
		scanf(" %s %s", taroC, hanakoC);
		point = strcmp(taroC, hanakoC);
		if (point > 0)*taro += 3;
		else if (point < 0)*hanako += 3;
		else {
			*taro += 1;
			*hanako += 1;
		}
	}
}

int main(void){
	int taro = 0, hanako = 0;
	checkCards(&taro, &hanako);
	printf("%d %d\n", taro, hanako);
	return 0;
}

Measured memory_bytes: 604
#include <stack>
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<int, int> P;
ll ma = 1000000000 + 7;
ll h, w, n,k,m; string s,t;
char maze[60][60];
int dis[101][101]; int graph[50][50]; bool vis[50];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

int main() {
	cin >> n;
	vector<ll> a(n);
	vector<ll> b(n);
	rep(i, n) {
		cin >> a[i] >> b[i];
	}
	ll res = 0;
	for (ll i = n - 1; i >= 0; i--) {
		ll k = (a[i]+res) % b[i];
		if (k != 0) res += b[i] -k;
	}
	cout << res << endl;
}




Measured memory_bytes: 1792
S = input()
y = [0,0,0]
ans = -1e64

def calc(s):
    #print(s)
    A = []
    i = 0
    cntr = 0
    s2 = ""
    for j,c in enumerate(s):
        if cntr > 0:
            if c == ')':
                cntr -= 1
                if cntr == 0:
                    A.append(calc(s2))
                    continue
            if c == '(':
                cntr += 1
            s2 = s2 + c
        else:
            if c.isdigit():
                i *= 10
                i += int(c)
            else:
                if c == '(':
                    cntr += 1
                    if cntr == 1:
                        s2 = ""
                    continue
                if s[j - 1] != ')':
                    A.append(i)
                i = 0
                A.append(c)
    A.append(i)
    #print(A)
    for i in range(3):
        j = 0
        while j < len(A):
            a = A[j]
            if a == "+" and y[0] == i:
                A[j - 1] += A[j + 1]
                del A[j : j + 2]
            elif a == "-" and y[1] == i:
                A[j - 1] -= A[j + 1]
                del A[j : j + 2]
            elif a == "*" and y[2] == i:
                A[j - 1] *= A[j + 1]
                del A[j : j + 2]
            else:
                j += 1
    return A[0]


for i in range(27):
    y[0] = i // 9
    y[1] = (i % 9) // 3
    y[2] = i % 3
    ans = max(ans, calc(S))

print(ans)



Measured memory_bytes: 5624
import java.util.Scanner;

class Main{
	static public void main (String args[]){
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter("\\s");
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int i = 0;

		while(true){
			if(c%a == 0){
				i++;
			}
			a++;
			if(a>b)
				break;
		}
		System.out.println(i);
	}
}

Measured memory_bytes: 26244
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a, b, c, t=0;
	cin >> a >> b;
	c=b;
	do
	{
		c/=10;
		t++;
	}while(c!=0);
	for(int i=1;i<=t;i++)
	{
		a*=10;
	}
	a+=b;
	if(int(sqrt(a))==sqrt(a))
	{
		cout <<"Yes"<<endl;
		return 0;
	}
	else
	{
		cout <<"No"<<endl;
		return 0;
	}
	return 0;
}

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

using ll=long long;
#define int ll
using pii=pair<int,int>;
using vpii=vector<pii>;


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m;
    cin >> n >> m;
    vpii ab(n);
    for (int i=0; i<n; ++i)
        cin >> ab[i].first >> ab[i].second;
    sort(ab.begin(), ab.end());
    int cost = 0;
    for (int i=0; i<n; ++i) {
        int here = min(ab[i].second, m);
        cost += here*ab[i].first;
        m -= here;
        if (here == 0)
            break;
    }
    cout << cost << "\n";
}


Measured memory_bytes: 1792
/*
    @uthor: Varun Mishra
    "varun21999" ->  Codechef, Codeforce, Hackerrank, Hackerearth;
*/
//#include<boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
#define int            long long int
#define ull            unsigned int
#define ld             long double
#define pb             push_back
#define pa             pair<int,int>
#define ppa            pair<pair<int,int>,int>
#define pap            pair<int,pair<int,int>>
#define v1d            vector<int>
#define v2d            vector<vector<int> >
#define vpa            vector<pair<int,int>>
#define M              1000000007
#define MN             LLONG_MIN
#define MX             LLONG_MAX
#define ff             first
#define ss             second
#define endl           "\n"
#define v1s            vector<string>
#define all(v)         v.begin(),v.end()
#define S(v)           sort(v.begin(),v.end())
#define RS(v)          sort(v.rbegin(),v.rend())
#define R(v)           reverse(v.begin(),v.end())
#define mxpq(T)        priority_queue <T>
#define mnpq(T)        priority_queue<T,vector<T>,greater<T>>
#define T              int tc;cin>>tc;while(tc--)
#define p2d(v)         for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)         for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v)         for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define forIloop(i,n)  for(auto i=0;i<n;i++);
#define forDloop(i,n)  for(auto i=n-1;i>=0;i--);
#define qqq 400005
#define isEven(n)  (!n & 1);
const int MOD = 1e9 + 7;
// bool isEven(int n){
//     return (!(n & 1));
// }
// int popcount(int num){
//     num = num - ((num >> 1) & 0x55555555);
//     num = (num & 0x33333333) + ((num >> 2) & 0x33333333);
//     return ((num + (num >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
// }
// int powerOfTwo(int n){
//     return 1 << n;
// }

// int arr[1000001];
// bool temet = false;


void codeforce2(){
    int n,m; cin>>n>>m;
    v1d arr(n);
    int flag = 0, summ = 0;
    for(auto &i:arr){
        cin>>i;
        summ+=i;
    }
    for(int i=0; i<n; i++){
        if(arr[i]>= ((double)1/(4*m)) *summ){
            flag++;
        }
    }
    if(flag>=m){
        cout << "Yes" << endl;
        return;
    }
    cout << "No" << endl;
    

    return;
}




int32_t main(){

    cout<<fixed<<setprecision(16);
    cin.sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    
    /*#ifndef _DEBUG
     freopen("input.txt",  "r",  stdin);
     freopen("output.txt", "w", stdout);
    #endif*/
    //auto start = high_resolution_clock::now();

    // Lucario();
    //codeforceContest();
    //hackerEarth();
    //codeChef();

    // T{
    //     codeforce2();
    // }
    codeforce2();

   /* auto stop = high_resolution_clock::now();
    auto duration = duration_cast<seconds>(stop - start);
    cout << "Time: "<<duration.count()<<endl;*/
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
  
int main() {
  int H, N, a,sum;
  sum=0;
  cin >> H >> N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin >>a;
    sum+=a;
  }
  if(sum>=H)cout<<"Yes"<<endl;
  else cout << "No"<< endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    char c[3];
    rep(i,3)cin >> c[i];
    int ans = 0;
    int cnt = 0;
    rep(i,3){
        if(c[i] == 'R')cnt++;
        else cnt = 0;
        ans = max(ans,cnt);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  string t;
  cin >> t;
  for(ll i = 0; i < (ll)t.size(); i++){
    if(t.at(i) != '?') continue;
    if(i == 0){
      if(i == (ll)t.size() - 1){
          t.replace(i, 1, "D");
        }
        else if(t.at(i+1) == 'P'){
          t.replace(i, 1, "D");
        }
        else if(t.at(i+1) == 'D'){
          t.replace(i, 1, "D");
        }
        else if(t.at(i+1) == '?'){
          t.replace(i, 1, "P");
        }
    }
    else {
      if(t.at(i-1) == 'P'){
        t.replace(i, 1, "D");
      }
      else if(t.at(i-1) == 'D'){
        if(i == (ll)t.size() - 1){
          t.replace(i, 1, "D");
        }
        else if(t.at(i+1) == 'P'){
          t.replace(i, 1, "D");
        }
        else if(t.at(i+1) == 'D'){
          t.replace(i, 1, "D");
        }
        else if(t.at(i+1) == '?'){
          t.replace(i, 1, "P");
        }
      }
    }
  }
  cout << t << endl;
}



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


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

  int d = b - a;
  int h = 0;
  for (int i = 0; i <= d; i++) {
    h += i;
  }
  int ans = h - b;
  cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Contest.A
{
	class Program
	{
		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);

			Scanner cin = new Scanner();

			int n = cin.nextInt();
			int a = cin.nextInt();
			int b = cin.nextInt();

			Console.WriteLine(Math.Min(n * a, b));

			Console.Out.Flush();
		}
	}

	class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return next();
			i = 0;
			return s[i++];
		}

		public int nextInt()
		{
			return int.Parse(next());
		}

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = nextInt() + add;
			}
			return Array;
		}

		public long nextLong()
		{
			return long.Parse(next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = nextLong() + add;
			}
			return Array;
		}

		public double nextDouble()
		{
			return double.Parse(next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = nextDouble() + add;
			}
			return Array;
		}
	}
}

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

int main(){
	char c;
	int a,b;
	int w,q;
	int check[100];
	while(cin >> w >> q && w || q ){
		memset(check,-1,100*4);
		for(int i=0;i<q;i++){
			cin >> c;
			if(c == 's'){
				cin >> a >> b;
				int seq = -1,cnt = 0,ret = -1;
				for(int j=0;j<w;j++){
					if(check[j] != -1){cnt = 0;continue;}
					
					if(cnt == 0 && check[j] == -1){
						cnt = 1;
						seq = j;
					}else{
						cnt++;
					}
					if(cnt == b){
						ret = seq;
						break;
					}
				}
				if( ret == -1){cout << "impossible" << endl;continue;}
				else cout << ret << endl;
				
				for(int j=0;j<b;j++)check[ret+j] = a;
				//for(int j=0;j<w;j++)cout << check[j] << " ";cout << endl;
				
			}else{
				cin >> a;
				for(int j=0;j<w;j++){
					if(check[j] == a)check[j] = -1;
				}

			}
		}
		cout << "END" << endl;
	}
}

Measured memory_bytes: 0
# ユークリッドの互除法で最大公約数を求める
def d(n,m)
  if m == 0
    n
  else
    d(m, n % m)
  end
end

# 棒の左右の最小重量から棒以下のモビールの重量を求める
def weight(bo)
  # boが錘である
  if bo[0] == 0
    return 1
  else
    w_red  = weight($boes[bo[2]])
    w_blue = weight($boes[bo[3]])
    l_red  = bo[0]
    l_blue = bo[1]
    m_min = l_red * l_blue * w_red * w_blue / d(l_red * w_red, l_blue * w_blue)
    return m_min/l_red + m_min/l_blue
  end
end

# main
loop do
  n = gets.to_i
  break if n == 0
  $boes = []*(n+1)
  $boes[0] = [0,0,0,0]
  for i in 1..n do
    $boes[i] = gets.split(" ").map(&:to_i)
  end

  # 一番上の棒を探す
  is_child = Array.new(n+1) {false}
  for i in 1..n do
    is_child[$boes[i][2]] = true
    is_child[$boes[i][3]] = true
  end
  top = is_child.index(false)

  # 一番上から再帰的にモビールの重量を求める
  res = weight($boes[top])
  puts res
end

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
using ll = long long;
using ull = unsigned long long;

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> v(h);
  rep(i, h) {
    string s;
    cin >> s;
    rep(j, w) {
      char c = s[j];
      if (c == '.') c = '0';
      v[i].push_back(c);
    }
  }

  rep(i, h) {
    rep(j, w) {
      if (v[i][j] == '#') {
        for(int dx = -1; dx <= 1; dx++) {
          for(int dy = -1; dy <= 1; dy++) {
            if (!(dx == 0 && dy == 0)) {
              if (i + dy >= 0 && i + dy < h) {
                if (j + dx >= 0 && j + dx < w) {
                  if (v[i + dy][j + dx] != '#') v[i + dy][j + dx]++;
                }
              }
            }
          }
        }
      }
    }
  }

  rep(i, h) {
    rep(j, w) {
      cout << v[i][j];
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
a=int(input())
p=[0 for i  in range(4)]
for i  in range(a):
    t=input()
    if  t=="AC":
        p[0]+=1
    elif t=="WA":
        p[1]+=1
    elif t=="TLE":
        p[2]+=1
    else:
        p[3]+=1

print("AC x "+str(p[0]))
print("WA x "+str(p[1]))
print("TLE x "+str(p[2]))
print("RE x "+str(p[3]))

Measured memory_bytes: 74804
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n = [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]
    k= inp()
    print(n[k-1])
if __name__ == "__main__":
    main()

Measured memory_bytes: 63084
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAXN=2e5+5;
const ll MOD=1e9+7;
const ll MOD1=13;
ll n,a[MAXN],max1,max2;
void solve()
{
    for(ll i=1;i<=n;i++)
    {
        if(a[i]>=max1)
        {

            max2=max1;
            max1=a[i];
        }
        else if(a[i]>max2)
        {
            max2=a[i];
        }
    }
    for(ll i=1;i<=n;i++)
    {
        if(a[i]==max1)
        {
            printf("%lld\n",max2);
        }
        else
        {
            printf("%lld\n",max1);
        }
    }
}
int main()
{
    scanf("%lld",&n);
    for(ll i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
    }
    solve();
}


Measured memory_bytes: 3200