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

////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
int main(void){
	int i;
	int N;
	int j;
	char c;
	int col;
	int ind;
	int cnt;
	int letter;
	char line[1025] = {0};
	char ans[80];
	char *pkey;

char *tbl[9] = {	".,!? ",
					"abc",
					"def",
					"ghi",
					"jkl",
					"mno",
					"pqrs",
					"tuv",
					"wxyz"};

	scanf("%d", &N);

	for ( j = 0 ; j < N ; j++ ) {
		memset(line, 0, sizeof(line));
		col = 0;
		ind = 0;
		cnt = 0;

		scanf("%s", line);

		for ( i = 0 ; i < sizeof(line) ; i++ ) {
			if ( (c = line[i]) == 0 ) {
				break;
			}

			letter = c - 0x30;
			if (letter == 0) {
				if (ind > 0 && cnt > 0 ) {
					pkey = tbl[ind-1];
					ans[col++] = pkey[(cnt-1)%strlen(pkey)];
				}
				ind = letter;
				cnt = 0;
			} else if (letter > 0 && letter < 10) {
				ind = letter;
				cnt++;
			}
		}
		if (col > 0) {
			printf("%.*s\n", col, ans);
		}
	}

	return 0;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
string dp[10001];
int match[11] = {0,2,5,5,4,5,6,3,7,6};

// s1 < s2  : -1
// s1 == s2 : 0
// s1 > s2  : 1
int str_cmp(string s1, string s2) {
    if(s1.length() < s2.length()) return -1;
    if(s1.length() > s2.length()) return 1;

    REP(i, s1.length()) {
        if(s1[i] < s2[i]) return -1;
        if(s1[i] > s2[i]) return 1;
    }

    return 0;
}

void solve(long long N, long long M, std::vector<long long> A){
    REP(i, N+1) dp[i] = "";
    
    REP(i, N) {
        if(i==0 || dp[i] != ""){
            REP(j, A.size()){
                int target_idx = i + match[A[j]];
                if(N < target_idx) continue;
                string new_str = dp[i] + (char)('0' + A[j]);
                
                if(str_cmp(new_str, dp[target_idx]) == 1){
                    dp[target_idx] = new_str;
                }
            }
        }
    }

    cout << dp[N] << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, M, std::move(A));
    return 0;
}


Measured memory_bytes: 45440
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int maxn=0x7fffff;
 
int main(){
	int a,b,c,i;
	cin>>a>>b>>c;
	for(i=a;i<=maxn;i+=a){
		if(i%b==c){
			cout<<"YES";
			return 0;
		}
	}
	cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define INF 1000000000000
#define MOD 1000000007
#define PI 3.14159265359
#define dij priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>
typedef long long ll;
//
int main(){
  string s;cin>>s;
  string ans;
  if(s[s.size()-1]=='s')s+="es";
  else s+="s";
  cout<<s<<endl;
}

Measured memory_bytes: 3624
"""
A
>
B
 のときGREATER、
A
<
B
 のときLESS、
A
=
B
 のときEQUALと出力せよ。

"""
A,B=map(int,open(0).read().split())
if A>B:ans="GREATER"
if A<B:ans="LESS"
if A==B:ans="EQUAL"
print(ans)

Measured memory_bytes: 3064
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
    string S;
    cin >> S;
    int N = S.size();
    int ans=999;

    for(int i=0;i<=N-3;i++){
        int A=(S[i]-'0')*100+(S[i+1]-'0')*10+S[i+2]-'0';
        ans=min(ans,abs(A-753));
    }
    cout<<ans<<endl;

}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s; cin >> s;
    int k; cin >> k;
    vector<string> st;
    rep(i,s.size()){
        FORe(j,1,k){
            string x = s.substr(i,j);
            st.push_back(x);
        }
    } 
    SORT(st);
    st.erase(unique(all(st)),st.end());
    OUT(st[k-1]);

    return 0;
}

Measured memory_bytes: 1660
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    long long flag,i,n,k,a[100001],ans=0;
    scanf("%lld%lld",&n,&k);
    if(n==k){
        printf("1");
        return 0;
    }
    for(i=0;i<n;i++){
        scanf("%lld",&a[i]);
        if(a[i]==1){
            flag=i;
        }
    }if((n-1)%(k-1)==0){
        ans=(n-1)/(k-1);
    }else{
    ans=(n-1)/(k-1)+1;
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
using namespace std;
int main(void) {
  int L;
  int M[12], N[12];
  int cnt, sum;
  int i;
  while(1) {
    sum = 0; cnt = 0;
    cin >> L;
    if(L == 0) break;

    for(i = 0 ; i < 12 ; i++) {
      cin >> M[i] >> N[i];
    }

    for(i = 0 ; i < 12 ; i++) {
      sum += (M[i] - N[i]);
      if(sum >= L) break;
      //cout << sum << endl;
    }
    if(sum < L) cout << "NA" << endl;
    else cout << i + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 0
use proconio::*;

fn main() {
    input! {
        n: usize
    };
    let mut shop = Vec::new();
    for i in 0..n {
        input! {
            s: String,
            p: u32
        };
        shop.push((s, p, i + 1));
    }
    shop.sort_by(|a, b| a.0.cmp(&b.0).then(b.1.cmp(&a.1)));
    for i in 0..n {
        println!("{}", shop[i].2);
    }
}


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

signed
main(){
	int n;
	cin >> n;
	vector<string> s(n);

	for(int i=0;i<n;i++)
	{
			cin >> s[i];
	}

	//アルファベット配列
	vector<vector<int> > al(26, vector<int>(n, 0));

	for(int i=0;i<n;i++)
	{
			for(int j=0;j<s[i].size();j++)
			{
					al[s[i][j]-'a'][i]++;
			}
	}

	string ans = "";
	for(int i=0;i<26;i++)
	{
			sort(al[i].begin(),al[i].end());
			ans += string(al[i][0], char('a'+i));
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

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

// value
int N;
int d[100010];

void solve() {

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> d[i];
	}

	sort(d, d + N);

	cout << d[N / 2] - d[N / 2 - 1] << endl;

	return;

}

int main() {

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

	solve();

	return 0;

}

Measured memory_bytes: 640
//
//  main.cpp
//  AT
//
//  Created by 黄道煜 on 2018/8/9.
//  Copyright © 2018年 黄道煜. All rights reserved.
//

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#define MAXN 100005
#define p 1000000007
#define LL long long
using namespace std;

LL ans, num1[MAXN], num2[MAXN], num3[MAXN];
char s[MAXN];

LL ksm(LL x, LL y)
{
    if(y<=0) return 1;
    LL sum=1;
    while(y)
    {
        if(y&1) sum=(sum*x)%p;
        x=(x*x)%p; y>>=1;
    }
    return sum;
}

int main()
{
    scanf("%s", s);
    int len=strlen(s);
    for(int i=0; i<len; i++)
    {
        if(s[i]=='A') num1[i]=1;
        if(s[i]=='?') num2[i]=1;
        if(s[i]=='C') num3[i]=1;
        if(i>0) num1[i]+=num1[i-1];
        if(i>0) num2[i]+=num2[i-1];
        if(i>0) num3[i]+=num3[i-1];
    }
    for(int i=0; i<len; i++)
        if(s[i]=='B' || s[i]=='?')
        {
            ans=(ans+num1[i-1]*(num3[len-1]-num3[i])*ksm(3, num2[len-1]-(s[i]=='?')))%p;
            ans=(ans+num2[i-1]*(num3[len-1]-num3[i])*ksm(3, num2[len-1]-(s[i]=='?')-1))%p;
            ans=(ans+num1[i-1]*(num2[len-1]-num2[i])*ksm(3, num2[len-1]-(s[i]=='?')-1))%p;
            ans=(ans+num2[i-1]*(num2[len-1]-num2[i])*ksm(3, num2[len-1]-(s[i]=='?')-2))%p;
        }
    printf("%lld\n", ans);
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
#define LOCAL 0
#define lli long long int
const lli mod=1e9+7;
const lli pINF=LLONG_MAX;
const lli nINF=-LLONG_MAX;
void fast() {std::ios::sync_with_stdio(false);cin.tie(NULL);}
lli power(lli a,lli b){lli ans=1;while(b!=0){ if(b%2==1){ans*=a;ans%=mod;}b/=2;a*=a;a%=mod;} return ans;}
lli invmod(lli a) {return pow(a,mod-2);}
#define vi vector<int>
#define vlli vector<lli>
#define pb push_back
#define mp make_pair
#define F first
#define S second
const int INF=0x3f3f3f3f;
#define Pa pair<int,int>
#define si(n) scanf("%d",&n)
#define sli(n) scanf("%lld",&n)
#define printi(n) printf("%d\n",n)
#define ld long double
#define printli(n) printf("%lld\n",n)
#define all(v) v.begin(),v.end()
#define forn(i,n) for(int i=0;i<n;i++)
void print(int a[],int n){for(int i=0;i<n;i++) cout<<a[i]<<" ";}
lli a[200005];
map<lli,lli> m;

int main() {
	int n;
	si(n);
	
	for(int i=0;i<n;i++) sli(a[i]);
	
    m[0]=1;
    lli sum=0;
    lli ans=0;
    
    for(int i=0;i<n;i++){
        sum+=a[i];
        if(m[sum]) ans+=m[sum];
        m[sum]++;
    }
    
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 14336
#include <iostream>

using namespace std;

int main()
{
    char a[4];
    cin >> a;
    int cnt{0};
    for(int i=0;i<3;i++)
    {
        if(a[i]=='R')
        {
            cnt++;
            if(a[i+1]=='S')
                break;
        }
    }
    cout << cnt << '\n';
    return 0;
}


Measured memory_bytes: 3156
using System;
 
class Payment{
    static void Main(string[] args){

        int change;

        // stdin
        var N = Console.ReadLine();

        // Calculate 
        var rest = int.Parse(N) % 1000;
        if (rest == 0){
            change = 0;
        } else {
            change = 1000 - rest;
        }
      
        // stdout
        Console.Write(change);
    }
}

Measured memory_bytes: 27504
#include <iostream>
#include <string>

#define MAX 100000
using namespace std;

int main(){
	string S;
	cin >> S;
	int size = S.length();
	int X = 0, Y = 0;
	for (int i = 0; i < size; i++) {
		if (i % 2 == 0) {
			if( S[i] == '0') {
			X++;
		    }
			else {
				Y++;
			}
		}
		else {
			if (S[i] == '1') {
				X++;
			}
			else {
				Y++;
			}
		}
	}
	if (X >= Y) {
		cout << Y << endl;
	}
	else {
		cout << X << endl;
	}
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<map>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define N 200005

ll a[N],c[N],ans=0;
map<ll,int>q;
int main(){
    int n,i;
    cin>>n;
    
    for(i=1;i<=n;i++){
        cin>>a[i];
        q[i+a[i]]++;
        c[i]=i-a[i];
    }
    for(i=1;i<=n;i++){
            ans+=q[c[i]];
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 29308
#include <stdio.h>
int main(void){
    
    int a,b;
    scanf("%d %d",&a,&b);
    
    if(a<b){
        printf("a < b\n");
    }
    
    else if(a>b){
        printf("a > b\n");
    }
    
    else{
        printf("a == b\n");
    }
    
    return 0;
    
}



Measured memory_bytes: 2100
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            int n = int.Parse(In[0]);
            int k = int.Parse(In[1]);
            string s = Console.ReadLine();
            string ans = "";
            for(int i=0; i < n; i++)
            {
                if (i == k - 1)
                {
                    ans += s[i].ToString().ToLower();
                }
                else
                {
                    ans += s[i];
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27760
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		double cnt = 0;
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			if (a % 4 == 0) {
				cnt++;
			} else if (a % 2 == 0) {
				cnt += 0.5;
			}
		}

		if (n / 2 <= cnt) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();

	}

}

Measured memory_bytes: 58940
import sys


def resolve(in_):
    S = next(in_).strip()
    
    H = None
    W = None

    for c in S:
        if c == 'N':
            if H == 'S':
                H = False
            elif H is None:
                H = c
        elif c == 'S':
            if H == 'N':
                H = False
            elif H is None:
                H = c
        elif c == 'W':
            if W == 'E':
                W = False
            elif W is None:
                W = c
        elif c == 'E':
            if W == 'W':
                W = False
            elif W is None:
                W = c
    
    return not (H or W)
    
    return True


def main():
    answer = resolve(sys.stdin)
    print('Yes' if answer else 'No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9028
fun main(args: Array<String>) {
    abc089b()
}

fun abc089b() {
    val n = readLine()!!.toInt()
    val sList = readLine()!!.split(" ")

    val types = sList.groupBy { it }.size

    val answer = if (types == 3) "Three" else "Four"

    println(answer)
}


Measured memory_bytes: 36008
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (r : d : x0 : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    f x = r * x - d
  mapM_ print . take 10 . tail . iterate f $ x0

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 508
N, M = map(int, raw_input().split())
X = []
for _ in range(M):
    a, b, c = map(int, raw_input().split())
    X.append((a-1, b-1, c))

INF = 100000000
D = [[INF for _ in range(N)] for _ in range(N)]
for i in range(N):
    D[i][i] = 0
for a, b, c in X:
    D[a][b] = c
    D[b][a] = c
for k in range(N):
    for i in range(N):
        for j in range(N):
            D[i][j] = min(D[i][j], D[i][k] + D[k][j])
ans = 0
for a, b, c in X:
    if D[a][b] != c:
        ans += 1
print ans


Measured memory_bytes: 2948
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K, sum;
  sum = 0;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    if (K - 2 * x > 0) {
      sum += 2 * x;
    }
    else {
      sum += 2 * (K - x);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define MAX 100000
#define INF 2140000000
#define MOD 1000000007

vector<string> ans;

void fun(string s, int k, int dist, int n) {
	if (k == n) {
		cout << s << endl;
	}
	else {
		for (int i = 0; i < dist; ++i) {
			string temp = s + (char)('a' + i);

			if (i == dist - 1) {
				fun(temp, k + 1, dist + 1, n);
			}
			else {
				fun(temp, k + 1, dist, n);
			}
		}
	}

	return;
}

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

	string s = "a";

	fun(s, 1, 2, n);

	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cii(a);
    cis(s);
    auto ans = (a >= 3200)
            ?s
            :"red";
    co(ans);
    return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main(){
    input!{
        a:chars,
    }
    let result = if &a[0] == &a[1] && &a[0] == &a[2] {"No".to_string()} else {"Yes".to_string()};
    println!("{}", result);
}

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

typedef long long int ll;
ll dp[1001][1001];
char arr[1001][1001];
ll r=pow(10,9)+7;
int main() {
	// your code goes here
	int h,w;
	cin>>h>>w;
	
	for(int i=0;i<h;i++)
	{
	    for(int j=0;j<w;j++)
	    {
	        cin>>arr[i][j];
	        dp[i][j]=0;
	    }
	}
	
	for(int i=0;i<h;i++)
	{
	    if(arr[i][0]=='#')
	    break;
	    else 
	    dp[i][0]=1;
	}
	for(int j=0;j<w;j++)
	{
	    if(arr[0][j]=='#')
	    break;
	    else 
	    dp[0][j]=1;
	}
	
	for(int i=1;i<h;i++)
	{
	    for(int j=1;j<w;j++)
	    {
	        if(arr[i][j]=='#')
	        dp[i][j]=0;
	        else 
	        dp[i][j]=(dp[i-1][j]%r+dp[i][j-1]%r)%r;
	    }
	}
	cout<<dp[h-1][w-1]%r<<"\n";
	
	return 0;
}


Measured memory_bytes: 12400
#include<bits/stdc++.h> 
using namespace std; 
int gcdEx(int a, int b, int *x, int *y){if(!a){*x=0;*y=1;return b;} 
int x1,y1,gcd=gcdEx(b%a,a,&x1,&y1); *x=y1-(b/a)*x1;*y=x1; return gcd;}
int modI(int b, int m)      {int x,y;gcdEx(b,m,&x,&y);return (x%m+m)%m;}
typedef long long           ll;
typedef pair<int, int>      pii;
typedef vector<int>         vi;
typedef vector<pii>         vii;
typedef set<int>            si;
typedef map<string, int>    msi;
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define loop(b,n)           for(int i=b;i<n;i++)
#define loopv(b,n,a)         for(int i=b;i<n;i+=a)
#define loopr(b,n)           for(int i=n;i>=0;i--)

#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
                      cerr << "\n\n" << "Time elapsed: " << \
                      (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
                      return 0
#define mp                  make_pair
#define ff                  first
#define ss                  second
#define pb                  push_back 
#define MOD                 1000000007 
#define modA(a,b)           (((a%MOD)+(b%MOD))%MOD)
#define modS(a,b)           (((((a%MOD)-(b%MOD))%MOD)<0)?(int)(MOD+((a%MOD)-(b%MOD))%MOD):(int)(((a%MOD)-(b%MOD))%MOD))
#define modM(a,b)           (int)((((ll)(a%MOD))*((ll)(b%MOD)))%MOD)
#define modD(a,b)           ((modI(b,MOD)*(a%MOD))%MOD)
ll modP(ll x, ll y)         {ll r=1; x%=MOD; while(y>0){if(y&1){r=(r*x)%MOD;}
y=y>>1; x=(x*x)%MOD;} return r;}

int main()
{ 
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin.exceptions(cin.failbit);
    start_routine();
    
   ll t,sum=0,ans=0,n;
   cin>>n;
   vector<pair<ll,ll>> u; 
   vector<ll> v(n);
   loop(0,n)
   {cin>>v[i]; 
   u.pb({v[i],i});
   }
   sort(all(u));
   loop(0,n)
   {
       if(i!=u[n-1].ss)
       cout<<u[n-1].ff<<"\n";
       else
      
     cout<<u[n-2].ff<<"\n";
     
       
   }
    
    return 0;
}


Measured memory_bytes: 8048
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    string s;
    cin >> s;
    int cnt = 0;
    rep(i, s.size()) if (s[i] == 'o') cnt++;
    cnt += 15 - s.size();
    cout << (cnt >= 8 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val h, n = sc.nextInt
    val magics = new Array[(Int, Int)](n)
    for (i <- 0 until n) {
      val a = sc.nextInt
      val b = sc.nextInt
      magics(i) = (a, b)
    }

    // モンスターの体力をi減らすため消耗する魔力の最小値
    val dp = Array.fill[Int](h + 1)(Int.MaxValue)
    dp(0) = 0
    for (magic <- magics) {
      for (i <- 0 to h) {
        if(dp(i) != Int.MaxValue){
          val nj = math.min(i + magic._1, h)
          dp(nj) = math.min(dp(nj), dp(i) + magic._2)
        }
      }
    }
    println(dp(h))
  }
}


Measured memory_bytes: 30800
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(); int K = sc.nextInt();
		int ans = 1;
		for(int i=0; i<N; i++) {
			if(ans*2 < ans+K) ans = ans*2;
			else ans += K;
		}
		System.out.println(ans);
	}
}


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

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;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
    ll n;
    cin >> n;
    cout << (n-30)/2 << endl;
}


Measured memory_bytes: 3112
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
    private static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

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

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

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        int array[] = new int[3], num = 0;
        int count = 0;

        while (count < 3) {
            num = sc.nextInt();
            if (0 < num && num < 10) {
                array[count] = num;
                count++;
            }
        }


        for (int i = 0; i < 3; i++) {
            for (int j = i + 1; j < 3; j++) {
                if (array[i] == array[j]) {
                    count = count - 1;
                }
            }
        }
        if (count == 2) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    }
}


Measured memory_bytes: 21204
#include<cstdio>
int main()
{
	int a,b,i;
	i=1;
	scanf("%d %d",&a,&b);
	while(1){
		a-=b;
		if(a<=0) break;
		i+=1;
	}
	printf("%d\n",i);
	return 0;
}

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

#define int long long
const int INF = 100000000000000000;


int N;
int A[100];

signed main()
{
    cin >> N;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }

    int ans = 0;
    int cnt = 0;
    int color = 0;
    for(int i = 0; i < N; i++) {
        if(cnt == 0) {
            color = A[i];
            cnt = 1;
        } else if(color == A[i]) {
            cnt++;
        } else {
            ans += cnt/2;
            cnt = 1;
            color = A[i];
        }
    }

    cout << ans + cnt/2 << endl;

    return 0;
}

Measured memory_bytes: 256
n,m,s=map(int,input().split())
s=min(s,2500)

# 2501×nの[]行列
# 0~2500枚 × 頂点数
edge=[[[] for i in range(50*50+1)] for i in range(n)]

# (頂点, コスト)→(頂点, コスト)へ辺を渡っての遷移（頂点が変わる）
# u,v,a,bが与えられるたびに、edgeを更新
for i in range(m):
    u,v,a,b=map(int,input().split())
    
    # jは、保有銀貨枚数
    # j:a→2500なのは、jがa未満であれば、隣の頂点に行けないから
    for j in range(a,2501):
        edge[u-1][j].append((v-1,j-a,b))
        edge[v-1][j].append((u-1,j-a,b))

# (頂点, コスト)→(頂点, コスト)へ、その頂点に留まって両替の遷移（頂点変わらない）
# c,dが与えられるたびに、edgeを更新
for i in range(n):
    c,d=map(int,input().split())
      
    # 銀貨を捨てるのはノーコスト
    # 2500枚以上持ってたら、2500枚持ってることと同値と考える
    for j in range(2500):
        if j+c>=2500:
            edge[i][j].append((i,2500,d))
        elif j+c<2500:
            edge[i][j].append((i,j+c,d))
        
from heapq import heappush,heappop,heapify

# dはn×2501のすべての状態の最小コストの表
d=[[float('inf')  for i in range(50*50+1)] for i in range(n)]

# 初期値。頂点0, 銀貨Sには、コスト0で到達
d[0][s]=0

pq = []
heappush(pq,(0,0,s))

while len(pq):
    # [コスト, 頂点, 銀貨数]で、コストをkeyとして、heapソートして、一番コストが低いリストを先頭に持ってくる
    _,u,g = heappop(pq)
    
    # 頂点までのコストが更新できれば更新してヒープに登録
    # edge[u][g]は、頂点u, 銀貨g枚の状態から、行ける状態のtuple(頂点, 銀貨数, コスト)を呼び出す
    # pqには、[コスト, 頂点, 銀貨数]の順で入れている
    for tuple in edge[u][g]:
        if d[tuple[0]][tuple[1]]>d[u][g]+tuple[2]:
            d[tuple[0]][tuple[1]]=d[u][g]+tuple[2]
            heappush(pq,[d[u][g]+tuple[2],tuple[0],tuple[1]])
            
# d[i]で、頂点iにおける保有銀貨数に応じたコストが入ったリストを呼び出せる
# リストの中で、一番小さいコストのやつを呼び出せば、その頂点に行ける最小コストと同値である
for i in range(1,n):
    print(min(d[i]))


Measured memory_bytes: 99696
#include <stdio.h>

int main(){
	double a,b,c,d,e,f;
	while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)>0){
			b/=a;
			c/=a;
			a=1;
			
			e-=b*d;
			f-=c*d;
			d=0;
			
			f/=e;
			e=1;
			
			c-=f*b;
			b=0;
			printf("%.3f %.3f\n",c,f);
	}
	return 0;
}

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


using namespace std;

#define rep(i,N) for(int i=0;i<N;i++)

int main() {

	//input
	int N;
	cin >> N;
	vector<int> V(N), C(N);

	rep(i, N) {
		cin >> V[i];
	}

	rep(i, N) {
		cin >> C[i];
	}
	//compute
	int ans_max = 0;
	rep(i, N) {

		if (V[i] - C[i] > 0) {
			ans_max += V[i] - C[i];
		}

		
	}
	cout << ans_max << endl;


}

Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

ll n, a, b;
vector<ll> v;
unordered_map<ll, ll> mp;

// nCr: v[n][r]
vector<vector<ll>> comb(ll n, ll r) {
    vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
    for (int i = 0; i < v.size(); i++) {
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for (int j = 1; j < v.size(); j++) {
        for (int k = 1; k < j; k++) {
            v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
        }
    }
    return v;
}


void solve() {
    sort(v.begin(), v.end(), greater<>());
    double tmp = 0;
    rep(i, a) tmp += v[i];
    tmp /= a;
    cout << fixed << tmp << endl;

    if (v[0] == v[a - 1]) {
        ll ans = 0;
        vector<vector<ll>> table = comb(mp[v[0]], min(mp[v[0]], b));
        for (ll i = a; i <= min(mp[v[0]], b); i++) ans += table[mp[v[0]]][i];
        cout << ans << endl;
    } else {
        ll prev = 0;
        rep(i, a) if (v[i] != v[a - 1]) prev++;
        vector<vector<ll>> table = comb(mp[v[a - 1]], a - prev);
        cout << table[mp[v[a - 1]]][a - prev] << endl;
    }

}

int main() {
    cin >> n >> a >> b;
    v.resize(n);
    rep(i, n) {
        cin >> v[i];
        cerr << v[i] << endl;
        mp[v[i]]++;
    }
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

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

    int ans = a - b;
    if(k % 2 == 1){
        ans = -1 * ans;
    }

    if(ans > 1e18){
        cout << "Unfair" << endl;
        return 0;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n, m; cin>>n>>m;
    int a[n][m], b[m];
    int i, j;
    for(i=0; i<n; i++){
        for(j=0; j<m; j++){
            cin>>a[i][j];
        }
    }
    for(j=0; j<m; j++){
        cin>>b[j];
    }
    for(i=0; i<n; i++){
        int c=0;
        for(j=0; j<m; j++){
            c += a[i][j]*b[j];
        }
        cout<< c <<endl;
    }
}


Measured memory_bytes: 3128
#include <stdio.h>

#define MAX 100

int n, m;
int a[MAX][MAX];
int b[MAX];

int main(void) {
	int i, j;
	if (scanf("%d%d", &n, &m) != 2) return 1;
	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			if (scanf("%d", &a[i][j]) != 1) return 1;
		}
	}
	for (i = 0; i < m; i++) {
		if (scanf("%d", &b[i]) != 1) return 1;
	}
	
	for (i = 0; i < n; i++) {
		int tomatu_haruka = 0;
		for (j = 0; j < m; j++) {
			tomatu_haruka += a[i][j] * b[j];
		}
		printf("%d\n", tomatu_haruka);
	}
	return 0;
}



Measured memory_bytes: 2140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
int n,x;
ll b[100001],bl[100001],u[100001];
ll tot=0;
pair<ll,int>a[100001];
ll pf[100001];
int main(){
	ios::sync_with_stdio(false);
	cin >> n >> x;
	for(int i=1; i<=n ;i++){
		cin >> b[i] >> bl[i] >> u[i];
		tot+=b[i]*bl[i];
		a[i]={b[i]*bl[i]+(x-b[i])*u[i],i};
	}
	sort(a+1,a+n+1);
	reverse(a+1,a+n+1);
	for(int i=1; i<=n ;i++){
		pf[i]=pf[i-1]+a[i].fi;
	}
	ll ans=1e18;
	for(int i=1; i<=n ;i++){
		int y=a[i].se;
		int l=0,r=n;
		while(l!=r){
			int mid=(l+r)/2;
			ll cost;
			if(i<=mid) cost=pf[mid];
			else cost=pf[mid]+a[i].fi;
			if(cost>=tot) r=mid;
			else l=mid+1; 
		}
		ll cans;
		ll cost;
		if(i<=l) cost=pf[l]-a[i].fi,cans=1LL*(l-1)*x;
		else cost=pf[l],cans=1LL*l*x;
		l=0,r=x;
		while(l!=r){
			int mid=(l+r)/2;
			ll tae;
			if(mid<=b[y]) tae=cost+mid*bl[y];
			else tae=cost+b[y]*bl[y]+(mid-b[y])*u[y];
			if(tae>=tot) r=mid;
			else l=mid+1;
		}
		cans+=l;
		ans=min(ans,cans);
	}
	cout << ans << endl;
}

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

int main()
{
    int k, t;
    cin >> k >> t;
    vector<int> a(t);
    rep(i, t) cin >> a[i];
    int sum = 0;
    rep(i, t) sum += a[i];
    int mx = *max_element(all(a));
    int b = sum - mx;
    int ans = max(mx - 1 - b, 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <numeric>
#include <string>
#include <functional>

using namespace std;

int main(void){
    int N,K;
    string S;
    cin>>N>>S>>K;

    char c=S[K-1];
    for(int i=0;i<N;i++){
        if(S[i]!=c){
            S[i]='*';
        }
    }
    cout<<S<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n=int(input())
t=list(map(int,input().split()))
m=int(input())
px=[list(map(int,input().split())) for i in range(m)]
sm=sum(t)
for i in range(m):
    print(sm-t[px[i][0]-1]+px[i][1])


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int N,M,a[100],sum=0;

int main(){
    cin >> N >> M;
    for(int i=0;i<N;i++){
        cin >> a[i];
        sum += a[i];
    }
    double cr = (double)sum/(4*M);
    int count = 0;
    for(int i=0;i<N;i++){
        if(a[i]>=cr) count++;
    }
    if(count>=M){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;

const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;
const int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, -1, 0 };
const int MAX_N = 100000;

int main() {
	int N, L, tmp1, tmp2, ans;
	int ok = 0;
	cin >> N >> L;
	cin >> tmp1;
	for(int i=1;i<N;i++) {
		cin >> tmp2;
		if(tmp1 + tmp2 >= L) {
			ok = 1; ans = i;
		}
		tmp1 = tmp2;
	}
	if(ok == 0) cout << "Impossible" << endl;
	else {
		cout << "Possible" << endl;
		for(int i=1;i<ans;i++) cout << i << endl;
		for(int i=N-1;i>=ans;i--) cout << i << endl;
	}
	return 0;
}


Measured memory_bytes: 768
open Str

module L =
  struct
    include List
  
    let rec span f = function
        [] -> ([],[])
      | h :: t when f h -> let (xs, ys) = span f t in (h::xs, ys)
      | l -> ([],l)

    let rec group f = function
      | [] -> []
      | h :: t -> let (xs, ys) = span (f h) t in (h :: xs) :: group f ys

  end

let read_list f =
  split (regexp " +") (read_line ()) |> List.map f

let rec together ct = function
    (x1, l1) :: (x2, l2) :: (x3, l3) :: tl when x1 + 1 = x2 && x2 + 1 = x3 -> together (max ct (l1+l2+l3)) ((x2, l2) :: (x3, l3) :: tl)
  | (x1, l1) :: (x2, l2) :: tl when x1 + 1 = x2 -> together (max ct (l1+l2)) ((x2, l2) :: tl)
  | (x1, l1) :: tl -> together (max ct l1) tl
  | [] -> ct

let () =
  let _ = read_line () in
  let lst = read_list int_of_string |> L.sort compare |> L.group (=) |> L.map (fun l -> (L.hd l, L.length l))in
  together 0 lst |> string_of_int |> print_endline


Measured memory_bytes: 14908
#include<iostream>
using namespace std;
int main()
{
	int a, b, n, sum = 0;
	cin >> n;
	if (n == 1) {
		cout << "Hello World" << endl;
	}
	else {
		cin >> a >> b;
		sum = a + b;
		cout << sum << endl;
	}
	return 0;
}


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



int main(){
    ll n;
    cin >> n;
    if(n==1){
      cout << 0 << endl;
      return 0;
    }
    ll res=1;
    ll mod=1e9+7;
    for(ll i=0;i<n;i++){
      res*=10;
      res%=mod;
    }
    ll nine=1;
    for(ll i=0;i<n;i++){
      nine*=9;
      nine%=mod;
    }
    nine*=2;
    nine%=mod;
    ll eight=1;
    for(ll i=0;i<n;i++){
      eight*=8;
      eight%=mod;
    }
    ll ans=res-nine+eight+mod;
    ans%=mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3576
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  re0 x=0,f=1;rec c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
inline void read(rel &x){
  x=0;re0 f=1;rec c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  x=f?x:-x;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  re0 bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  }
inline char fuhao(){
  rec c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;

int main(){
puts(read()*read()&1?"Odd":"Even");
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
//cout<<setprecision(20)
//cin.tie(0);
//ios::sync_with_stdio(false);
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int LBI(vector<int>&ar,int in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
int UBI(vector<int>&ar,int in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	int i,j,k,n,ans=0;cin>>n;
	string str;cin>>str;
	for(i=1;i<n;i++){
		int c[26]={0};
		int gen=0;
		for(j=0;j<i;j++){c[str[j]-'a']=1;}
		for(j=i;j<n;j++){gen+=c[str[j]-'a'];c[str[j]-'a']=0;}
		maxeq(ans,gen);
	}
	cout<<ans<<endl;
	return 0;
}


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


int main() {
	int N, M;
	cin >> N >> M;
	vector<string> A(N), B(M);
	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < M; i++) cin >> B[i];

	bool flag[50] = { false };
	bool F = false;
	for (int i = 0; i <= N-M; i++) {
		for (int j = 0; j <= N-M; j++) {
			int cnt = 0;
			for (int k = 0; k < M; k++) {
				if (B[k] == A[i+k].substr(j, M)) {
					flag[k] = true;
					cnt++;
				}
			}
			if (cnt == M) F = true;
		}
	}
	cout << ((F) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int a=1;
    char s[100];
    int i=0;
    while(1){
        scanf("%c",&s[i]);
        if(s[i]!='L'&&s[i]!='R'&&s[i]!='U'&&s[i]!='D')break;
        if(i%2==1){
            if(s[i]=='R')a=0;
        }
        else{
            if(s[i]=='L')a=0;
        }
        i++;
    }
    if(a==0)printf("No\n");
    else printf("Yes\n");
    return 0;
}

Measured memory_bytes: 128
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    A, B, C, D = lr()
    cnt = 0
    while A > 0 and C > 0:
        if cnt == 0:
            cnt = 1
            C -= B
        else:
            cnt = 0
            A -= D
    if A <= 0:
        print('No')
    else:
        print('Yes')
resolve()

Measured memory_bytes: 61720
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod = 1e9 + 7;
int INF = 2e18;

signed main() {
    int A, B;
    cin >> A >> B;
    if (A < 1 || A > 9) {
        cout << -1 << endl;
        return 0;
    } else if (B < 1 || B > 9) {
        cout << -1 << endl;
        return 0;
    } else {
        cout << A * B << endl;
    }
    return 0;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD9        = 1'000'000'009;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void debug() { std::cerr << '\n'; }
template <class H, class... T> void debug(H &&head, T &&... args) {
    std::cerr << head;
    sizeof...(args) == 0 ? std::cerr << "" : std::cerr << ' ';
    debug(std::forward<T>(args)...);
}
template <class T> void debug(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cerr << v[i];
        i == v.size() - 1 ? std::cerr << '\n' : std::cerr << ' ';
    }
}
template <class T> void debug(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cerr << v[i][j];
            j == v[i].size() - 1 ? std::cerr << '\n' : std::cerr << ' ';
        }
    }
}

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

    string s;
    cin >> s;
    int N  = s.size();
    int gu = 0, pa = 0;
    REP(i, N) {
        if (s[i] == 'g')
            gu++;
        else
            pa++;
    }
    int ans = 0;
    if (pa < N / 2) {
        ans = N / 2 - pa;
    }
    print(ans);

    return 0;
}

Measured memory_bytes: 512