akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = 1000000000;

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


Measured memory_bytes: 256
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

# import numpy as np
# from scipy.special import perm
# from scipy.special import comb

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

########

N, X = l_inpl()
L = l_inpl()

cnt = 1
now = 0

for Li in L:
    now += Li
    # print(now)
    if now > X:
        break
    cnt += 1

print(cnt)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
 
/// ----------------------------- (Debug) ------------------------------
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i));}
sim, class b dor(pair < b, c > d) {ris << "(" << d.first << ", " << d.second << ")";}
sim dor(rge<c> d) {*this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]";}
#else
sim dor(const c&) { ris; }
#endif
};
vector<char*> tokenizer(const char* args) {
  char *token = new char[111]; strcpy(token, args); token = strtok(token, ", ");
  vector<char*> v({token});
  while(token = strtok(NULL,", ")) v.push_back(token);
  return reverse(v.begin(), v.end()), v;
}
void debugg(vector<char*> args) { cerr << "\b\b "; }
template <typename Head, typename... Tail>
void debugg(vector<char*> args, Head H, Tail... T) {
  debug() << " [" << args.back() << ": " << H << "] ";
  args.pop_back(); debugg(args, T...);
}
#define harg(...) #__VA_ARGS__
#ifndef ONLINE_JUDGE
#define dbg(...) { debugg(tokenizer(harg(__VA_ARGS__, \b\t-->Line)), __VA_ARGS__, __LINE__); cerr << endl;}
#else
#define dbg(...) { }
#endif
/// -----------------------------------------------------------------------

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi; 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)    
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define REP(i,a,b) for(i=a;i<=b;i++)
#define RAP(i,a,b) for(i=a;i>=b;i--)
#define spa <<" "<<
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
ll mod=1e9+7;
const int MX=0x3f3f3f3f;

int main() {
    IOS;
    int n,i,z,w;
    cin>>n>>z>>w;
    int a[n];
    REP(i,0,n-1) cin>>a[i];
    if(n==1){
    	cout<<abs(a[n-1]-w);
    	return 0;
    }
    cout<<max(abs(a[n-1]-w),abs(a[n-1]-a[n-2]));
    return 0;   
} 

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

int main() {
    int N, M;
    cin >> N >> M;

    vector<bool> done(N, false);
    done[0] = true;

    vector<int> num(N, 1);

    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;

        if (done[x] == true) {
            done[y] = true;
        }
        num[x]--;
        num[y]++;
        if (num[x] == 0) {
            done[x] = false;
        }
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (done[i] == true and num[i] > 0) {
            ans++;
        }
    }

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

Measured memory_bytes: 640
import scala.util.control.Breaks._

object Main {
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val s = sc.next

    var index = s.length
    val words = List("dreamer", "dream", "eraser", "erase")
    val lens = words.map(_.length)
    breakable { while (index >= 0) {
      var deleted = false
      breakable { for ((word, len) <- words zip lens) {
        if (s.slice(0, index).endsWith(word)) {
          index -= len
          deleted = true
          break
        }
      } }
      if (! deleted) break
    } }
    println(if (index == 0) "YES" else "NO")
  }
}


Measured memory_bytes: 117404
#include<bits/stdc++.h>
#define usll unsigned long long int 
#include <cstring>
#define rf freopen("inputf.in", "r", stdin)
#define wf freopen("outputf.in", "w", stdout)
#define endl "\n" 
//#define max 1000001
//int arr[max];
usll a,b,i;
using namespace std;
int main(void){//rf;wf;
cin>>a;b=a;
a=(a+1)*(a)/2;
for(usll j=1;j<=b;j++){
	if(j%3==0 || j%5==0){
		a-=j;
	}
}
cout<<a<<endl;
}

Measured memory_bytes: 3536
K = int(input())
a = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'.split(',')
a = list(map(int, a))
print(a[K-1])


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

using namespace std;

#define fast_io ios::sync_with_stdio(false); cin.tie(NULL);

int main()
{
	fast_io;
	
	string str;
	cin >> str;
	int sum = 0;
	for (int i = 0; i < str.size(); ++i)
	{
		sum += (str[i] - '0');
	}

	if (stoi(str) % sum == 0) cout << "Yes\n";
	else cout << "No\n";
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int N{};
    int cnt[4] = {0};
    cin >> N;
    while (N--) {
        string temp{};
        cin >> temp;
        if (temp == "AC")
            cnt[0]++;
        else if (temp == "WA")
            cnt[1]++;
        else if (temp == "TLE")
            cnt[2]++;
        else
            cnt[3]++;
    }
    cout << "AC x " << cnt[0] << endl;
    cout << "WA x " << cnt[1] << endl;
    cout << "TLE x " << cnt[2] << endl;
    cout << "RE x " << cnt[3] << endl;
    return 0;
}


Measured memory_bytes: 3244
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100111;
const int inf=1000000007;
const long long INF=1000000000000000007;
using ll=long long;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};


int main(){
	int n,W;
	cin>>n>>W;
	int v[M],w[M];
	for(int i=0;i<n;i++)cin>>w[i]>>v[i];
	ll dp[M]={};	//dp[i]: 重さiまでの最大の利益;
	rep(i,0,n)for(int j=W;j>=w[i];j--)
		dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
	print(dp[W]);
	return 0;
}

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

int main(void) {
  int A, B, K;
  cin >> A >> B >> K;

  vector<int> div;
  for (int i = 1; i <= min(A, B); i++) {
    if (A % i == 0 && B % i == 0) {
      div.push_back(i);
    }
  }
  cout << div[div.size() - K] << endl;

  return 0;
}

Measured memory_bytes: 256
//vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  cout << c <<" "<< a << " "<<b;
 
}


Measured memory_bytes: 256
use proconio::*;

fn run() {
    input! {
        n: usize,
        m: usize,
        x: u32,
        p: [(u32, [u32; m]); n],
    }
    let mut ans = std::u32::MAX;
    for i in 0..(1 << n) {
        let mut sum = 0;
        let mut y = vec![0; m];
        for (j, p) in p.iter().enumerate() {
            if (i >> j) & 1 == 1 {
                sum += p.0;
                for (y, p) in y.iter_mut().zip(p.1.iter()) {
                    *y += *p;
                }
            }
        }
        if y.iter().all(|y| *y >= x) {
            ans = std::cmp::min(ans, sum);
        }
    }
    if ans == std::u32::MAX {
        println!("-1");
    } else {
        println!("{}", ans);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 2192
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
 #define PI 3.141592653
using namespace std;



ll modexp(ll n, ll p){
	if(p ==0) return 1;

	ll ans = modexp(n, p/2);
	ans = (ans*ans)%MOD;
	if(p%2) return (n*ans)%MOD;
	else return ans;
}


pair<ll,ll> reduce(ll a,ll b){
	if(b == 0) return {1,0};
	if(a ==0 ) return {0,1};
	if(b<0){
		a= -a;
		b = -b;
	}
	ll g = __gcd(abs(a),abs(b));

	return {a/g,b/g};
}


void solve(){
	map<pair<ll,ll>, int> mp;
	vector<pair<ll,ll> > v;
	int n; cin>>n;
	int ans=0;
	for(int i=0; i<n; i++){
		ll a,b;
		cin>>a>>b;
		
		if(a == 0 && b == 0){
			ans++;
			continue;
		}
		if(mp[reduce(a,b)] ==0){
			if(mp[reduce(-b,a)] == 0){
				v.pb(reduce(a,b));
			}
		}
		mp[reduce(a,b)]++;
		//cout<<reduce(a,b).f<<" fucks "<<reduce(a,b).s<<" in "<<mp[reduce(a,b)]<<"\n";
	}
	ll f =0;
	for(auto pp: v){
	//	cout<<pp.f<<" "<<pp.s<<" "<<mp[{pp.f,pp.s}]<<"\n";
	//	cout<<-pp.s<<" "<<pp.f<<" "<<mp[{-pp.s,pp.f}]<<"\n";
		int s = pp.f/(abs(pp.f));
		f = (f+ ((modexp(2,mp[{pp.f,pp.s}])-1)*(f+1))%MOD  + ((modexp(2,mp[reduce(-pp.s,pp.f)])-1)*(f+1))%MOD)%MOD;
	}
	cout<<(f+ans)%MOD;

}


int main()
{ 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout<<fixed<<setprecision(12);
	int t =1; //cin>>t;
	for(int i=1; i<=t; i++){
		solve();
		cout<<"\n";
	}
	return 0;

}


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

int main(){
    
    std::string s;
    size_t cnt = 0;

    std::cin >> s;

    for(size_t i = 1; i < s.size(); i++){
        if(s[i] == s[i - 1]){
            if(s[i] == '0'){
                s[i] = '1';
            }else{
                s[i] = '0';
            }
            cnt++;
        }
    }

    std::cout << cnt << std::endl;
    
    return 0;
}


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

using namespace std;

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	cout << n * (n + 1) / 2 << endl;
	return 0;
}


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

#define N 105

int a[N], n;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i ++) cin >> a[i];
	int ans = 1e9;
	for (int x = -100; x <= 100; x ++) {
		int res = 0;
		for (int i = 1; i <= n; i ++) {
			res += (a[i] - x) * (a[i] - x);
		}
		ans = min(ans, res);
	}
	cout << ans << endl;
	return 0;
}


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

int main()
{
    long long n;
    cin >> n;
    string ans;
    int rem;

    while(n>0) {
        rem = n%26;
        if(rem == 0) {
            n--;
            ans.push_back('z');
        }
        else {
            ans.push_back((char)96+rem);
        }

        n /= 26;
    }

    reverse(ans.begin(), ans.end());

    cout << ans << "\n";

    return 0;
}

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

int n , vis[1001][1001], m, a[200001], b[200001], source, br, q[1001][1001], p[1001][1001];
vector<int> g[1001];

void dfs(int u) {
	if (vis[source][u])return;
	vis[source][u] = 1;
	for (int i = 0; i < g[u].size(); ++i)dfs(g[u][i]);
}
void pre(int u, int vis[]) {
	if (u == source)return;
	if (vis[u])return;
	vis[u] = br;
	for (int i = 0; i < g[u].size(); ++i)pre(g[u][i], vis);
}
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; ++i) {
		scanf("%d%d", &a[i], &b[i]);
		g[a[i]].pb(b[i]);
	}
	for (source = 1; source <= n ; ++source) {
		dfs(source);
		for (int i = 0 ; i < g[source].size(); ++i) {
			br = g[source][i];
			pre(br, p[source]);
		}
		for (int i = g[source].size() - 1; i >= 0 ; --i) {
			br = g[source][i];
			pre(br, q[source]);
		}
	}
	for (int i = 0; i < m; ++i){
		bool yes = (vis[b[i]][a[i]] ^ (q[a[i]][b[i]]!=b[i] || p[a[i]][b[i]]!= b[i]));
		if(!yes)puts("same");
		else puts("diff");
	}
	return 0;
}

Measured memory_bytes: 16000
<?php
  $s = strval(trim(fgets(STDIN)));
  $array = str_split($s);
  $prev = "default";
  $counter = 1;
  $change = 0;
  $length = count($array);
  foreach($array as $n){
    if($counter === 1){
      $prev = $n;
    }elseif($n === $prev){
      if($prev === "0"){
        $prev = "1";
      }else{
        $prev = "0";
      }
      $change++;
    }else{
      $prev = $n;
    }
    $counter++;
  }
  if($change > $length/2){
    $change = $length - $change;
  }
  echo $change;

Measured memory_bytes: 21132
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X, A, B;
    cin >> X >> A >> B;
    X -= A;
    while(X - B >= 0) {
        X -= B;
    }
    cout << X << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
using namespace std;
int n;
int main(){
  cin >> n;
  char s;
  bool flag = false;
  for(int i = 0; i < n; i++){
    cin >> s;
    if (s == 'Y') flag = true;
  }
  if(flag) cout << "Four" << endl;
  else cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
using namespace std;
int dic[256] = { 0 };

int main(){
	int N;
	cin >> N;
	vector<int> v;
	for (int i = 0; i < N; i++){
		int tmp;
		cin >> tmp;
		v.push_back(tmp);
	}
	int ans = accumulate(v.begin(), v.end(),0);
	sort(v.begin(), v.end());
	//find first not 10baisu;
	int del = -1;
	for (int i = 0; i < N; i++){
		if (v[i] % 10 != 0){
			del = v[i];
			break;
		}
	}
	if (ans % 10 != 0){
		cout << ans << "\n";
	}
	else if (del != -1){
		cout << ans - del << "\n";
	}
	else{
		cout << 0 << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace _028_ModeValue
{
	class Program
	{
		static void Main ( string[] args )
		{
			List<Pair> list = new List<Pair> (100);

			for (int lp = 1; lp <= 100; lp++)
			{
				Pair p = new Pair (lp, 0);
				list.Add (p);
			}

			string inputStr;

			while ((inputStr = Console.ReadLine ()) != null)
			{
				int inputNum = int.Parse (inputStr);
				list[inputNum - 1].Value++;
			}

			list = list.OrderByDescending (item => item.Value).ToList ();

			int max = list[0].Value;

			int index = 0;
			while (list[index].Value == max)
			{
				Console.WriteLine (list[index].Index);
				index++;
			}
		}
	}
	class Pair
	{
		public Pair ( int index, int value )
		{
			this.Index = index;
			this.Value = value;
		}
		public int Index { set; get; }
		public int Value { set; get; }
	}
}

Measured memory_bytes: 10032
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

vector<bool> getPrime(int n) {
	vector<bool> prime(n + 1, true);

	if (n >= 0) prime[0] = false;
	if (n >= 1) prime[1] = false;

	for (int i = 2; i * i <= n; i++) {
		if (prime[i]) {
			for (int j = i + i; j <= n; j += i) {
				prime[j] = false;
			}
		}
	}

	return prime;
}

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

	string s;
	cin >> s;

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

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


Measured memory_bytes: 512
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#include<bits/stdc++.h>
using namespace std;

#if defined(DAIJOBU)
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}


int main(){
	FIO
	
	int x;cin >> x;
	cout << x * x * x << "\n";
	return 0;
}



Measured memory_bytes: 3164
X, K, D = map(int, input().split())

ans = 0

if X>=0:
    if K*D>=X:
        P = X//D
        Q = X%D
        if (K-P)%2==0:
            ans = Q
        else:
            ans = D-Q
    else:
        ans = X-K*D
else:
    X = abs(X)
    if K*D>=X:
        P = X//D
        Q = X%D
        if (K-P)%2==0:
            ans = Q
        else:
            ans = D-Q
    else:
        ans = X-K*D

print(ans)

Measured memory_bytes: 9204
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;

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

	int N;

	cin >> N;

	for(double i = 1; i <= N; i++) {
		if(floor(i * 1.08) == N) {
			cout << i << endl;
			return 0;
		}
	}

	cout << ":(" << endl;
			
}



Measured memory_bytes: 256
H,W=map(int,input().split())

list1=[]
for i in range(H):
    a=input()
    if a.count(".")==len(a):
        pass
    else:
        list2=[]
        for m in range(len(a)):
            
            list2.append(a[m])
        list1.append(list2)
        list2=[]
#print(list1[0][3])
list3=[]
for j in range(W):
    count=0
    if list1[0][j]==".":
        for k in range(len(list1)):
            if list1[k][j]==".":
                count+=1
        if count==len(list1):
            list3.append(j)
            
#print(list3)

list4=[]
for x in range(len(list1)):
    list5=[]
    for y in range(W):
        if y in list3:
            pass
        else:
            list5.append(list1[x][y])
    list4.append(list5)
    list5=[]
#print(list4)

for c in range(len(list4)):
    print("".join(list4[c]))

Measured memory_bytes: 3188
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  cout << A * B << endl;

  return 0;
}


Measured memory_bytes: 3756
/*
digu_J - Digvijay Janartha
NIT Hamirpur - INDIA
*/

#include <bits/stdc++.h>
using namespace std;

void test() {
    int n;
    cin >> n;
    set<string> st;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        st.emplace(s);
    }
    cout << st.size() << "\n";
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifdef HOME
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; ++i) {
        test();
    }
    return 0;
}


Measured memory_bytes: 19272
#import <stdio.h>
#import <string.h>
int main() {
  char s[102];
  fgets(s, 102, stdin);
  int n = strlen(s);
  s[--n] = '\0';
  int i = 0, j = n - 1;
  int cnt = 0;
  while (i < j) {
    if (s[i] != s[j]) {
      ++cnt;
    }
    ++i;
    --j;
  }
  printf("%d\n", cnt);
  return 0;
}

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

int main(){
  int A,B;
  cin >> A >> B;
  
  if(A==1 && B==2){
    cout << 3 << endl;
  }
  if(A==1 && B==3){
    cout << 2 << endl;
  }
  if(A==2 && B==1){
    cout << 3 << endl;
  }
  if(A==2 && B==3){
    cout << 1 << endl;
  }
  if(A==3 && B==1){
    cout << 2 << endl;
  }
  if(A==3 && B==2){
    cout << 1 << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<cstring>
#include<iostream>
#include<cstdio>
#define ll unsigned long long
using namespace std;;
//const ll mod=1e9+7;
vector<pair<int,int>>q[100003];
int s[100003];
void dfs(int a,int fa)
{
    for(int i=0;i<q[a].size();i++)
    {
        int n=q[a][i].first;
        if(n==fa)continue;
        if(q[a][i].second%2)s[n]=s[a]?0:1;
        else s[n]=s[a];
        dfs(n,a);
    }
}
int main()
{
s[1]=1;
    int t,tt;
    cin>>t;tt=t;t--;
    int sum=0;
   while(t--)
   {
       int a,b,c;
       scanf("%d%d%d",&a,&b,&c);
       q[a].push_back(make_pair(b,c));
       q[b].push_back(make_pair(a,c));
   }
   dfs(1,1);
   for(int i=1;i<=tt;i++)
    cout<<s[i]<<endl;
}


Measured memory_bytes: 9216
// Library
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

// TYPEDEFS
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

// CONSTANTS
#define SZA 0
#define SZB 0

// MACRO
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
#define ABS(X) (((X) > 0)? (X) : -(X))
#define YN(X) ((X)? "YES" : "NO")
#define SWAP(T, X, Y) {T t; t = X; X = Y; Y = t;}

#define F1 first
#define S2 second
#define PB push_back
#define MP make_pair


// Global Tables

//ull gPreProcess[SZA][SZB];

// Functions

void Print2DVector(vector<vector<int>>& v)
{
    ull i, j; 
    for(i = 0; i < v.size(); i++)
    {
        for(j = 0; j < v[i].size(); j++)
        {
            cout << v[i][j];
            if(j == v[i].size()-1)
            {
                cout << endl;
            }
            else
            {
                cout << " ";
            }
        }
    }
}

void PrintVector(vi& v)
{
    ull i;
    for(i = 0; i < v.size(); i++)
    {
        cout << v[i];
        if(i == v.size()-1)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

void PrintArr(int* a, ull N)
{
    ull i;
    for(i = 0; i < N; i++)
    {
        cout << a[i];
        if(i == N-1)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

void PreProcessTables()
{
    ull i, j;
    for(i = 0; i < SZA; i++)
    {
        for(j = 0; j < SZB; j++)
        {
            break;
        }
        break;
    }
}

void TC(int t)
{
    ull mod_val = 998244353;
    ull dp[200001] = {0};
    ull dpsum[200001] = {0};
    ull N, K, L, R;
    cin >> N >> K;
    vector<pair<ull,ull>> seg;
    for(ull i = 0; i < K; i++)
    {
        cin >> L >> R;
        seg.push_back(make_pair(L, R));
    }
    dp[1] = 1;
    dpsum[1] = 1;
    for(ull i = 2; i < N+1; i++)
    {
        for(ull j = 0; j < K; j++)
        {
            if(i <= seg[j].first)
            {
                continue;
            }
            else
            {
                L = seg[j].first;
                R = min(seg[j].second, i-1);
                dp[i] = (dp[i] + mod_val + dpsum[i-L] - dpsum[i-R-1])%mod_val;
            }
        }
        dpsum[i] = (dpsum[i-1]+ dp[i])%mod_val;
    }
    cout << dp[N] << endl;
}   

// Main

int main(void)
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 
    PreProcessTables();

    int T = 1, t;
    //cin >> T;
    for(t = 1; t <= T; t++)
    {
        TC(t);
    }
    return 0;
}


Measured memory_bytes: 6796
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef long long ll;
const int inf = 1000000005;
int n,m;
ll a[100005];
ll gcd(int a, ll b){
    return a== 0 ? b : gcd(b%a,a);
}
ll lcm(int a, ll b){
    if (inf/a*gcd(a,b) <= b) return -1;
    return a/gcd(a,b)*b;
}
main(){
    scanf("%lld%lld",&n,&m);
    ll lc = 1;
    int prev = -1;
    for (int i = 0; i < n; i++){
        scanf("%lld",&a[i]);
        lc = lcm(a[i]/2,lc);
        if (lc == -1){
            printf("0");
            return 0;
        }
        int cur = 0;
        while (a[i] % 2 == 0){
            a[i] /= 2;
            cur++;
        }
        if (prev != cur && prev != -1){
            printf("0");
            return 0;
        }
        prev = cur;
    }
    ll ans = m/lc;
    printf("%lld",(ans+1)/2);
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

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

    if(a == b){
        if(x == 1){
            cout << 1 << endl;
            return 0;
        }

        if(b % x == 0){
            cout << 1 << endl;
            return 0;
        }else if(b % x > 0){
            cout << 0 << endl;
            return 0;
        }
        
        return 0;
    }
    
    if(a <= 0){
        cout << b / x + 1 << endl;
    }else{
        a--;
        cout << (b / x) - (a / x) << endl;
    }

}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <map>
#include <vector>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

const int INF = INT_MAX;

int main(){
    int h,w;    cin >> h >> w;
    int c[10][10];  //c[i][j]:i->j
    rep(i, 10)  rep(j, 10)  cin >> c[i][j];
    map<int, int>a;
    rep(i, h)   rep(j, w){
        int A;  cin >> A;
        a[A]++;
    }
    rep(k, 10)  rep(i, 10)  rep(j, 10){
        c[i][j] = min(c[i][j], c[i][k]+c[k][j]);
    }
    int ans = 0;
    rep(i, 10){
        if(i != 1){
            ans += a[i]*c[i][1];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#from itertools import groupby

def groupby(a):
    a2=[[a[0],1]]
    for i in range(1,len(a)):
        if a2[-1][0]==a[i]:
            a2[-1][1]+=1
        else:
            a2.append([a[i],1])
    return a2


s1=input()
k=int(input())

#s2=[[h, len(list(g))] for h, g in groupby(s1)]
s2=groupby(s1)

c=0
if len(s2)!=1:
    for i in range(len(s2)):
        if i!=0 and i!=len(s2)-1:
            c+=(s2[i][1]//2)*k

    if s2[0][0]==s2[-1][0]:
        c+=((s2[0][1]+s2[-1][1])//2)*(k-1)
        c+=(s2[0][1]//2+s2[-1][1]//2)
    else:
        c+=(s2[0][1]//2+s2[-1][1]//2)*k
else:
    c+=(s2[0][1]*k)//2

print(c)


Measured memory_bytes: 3064
fun main(args: Array<String>) {

    var (a, b, c) = readLine()!!.split(" ").map(String::toInt)

    if (a and 1 == 1 || b and 1 == 1 || c and 1 == 1) {
        println(0)
        return
    }

    if (a == b && b == c) {
        println(-1)
        return
    }

    var count = 0

    while (true) {

        if (a and 1 == 1 || b and 1 == 1 || c and 1 == 1) {
            println(count)
            return
        }

        val at = a / 2
        val bt = b / 2
        val ct = c / 2

        a = bt + ct
        b = at + ct
        c = at + bt

        count++
    }
}





Measured memory_bytes: 37748
#include <bits/stdc++.h>
using namespace std;
int a[3],n;
bool cmp(int tmpa,int tmpb)
{
    return tmpa>tmpb;
}
int main()
{
    for(int i=0;i<3;i++)scanf("%d",&a[i]);
    scanf("%d",&n);
    sort(a,a+3);
    int ans=0;
    for(int i=0;i*a[2]<=n;++i)
    {
        for(int j=0;j*a[1]<=n-i*a[2];++j)
        {
            if((n-i*a[2]-j*a[1])%a[0]==0)
                ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}



/*


13 1 4 3000


*/


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			int n=in.nextInt();
			int m=in.nextInt();
			if((n|m)==0)
				return;
			int t=n+m;
			ArrayList<Integer> L=new ArrayList<Integer>();
			for(int i=0;i<t;i++)
				L.add(in.nextInt());
			Collections.sort(L);
			int	max=L.get(0);
			for(int i=0;i<t-1;i++)
			{
				int tmp=L.get(i+1)-L.get(i);
				if(max<tmp)
					max=tmp;
			}
			System.out.println(max);
		}
	}
}

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

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  vector<int> h(n);
  rep(i,n) cin >> h[i];
  
  auto ok = [&](ll m) {
    ll cnt = 0;
    for (int i = 0; i < n; i++) {
      if (h[i] > m * b) {
        cnt += ((h[i] - m * b + (a - b - 1) )/ (a - b));
      }
    }
  return cnt > m;
  };
  ll l = 0, r = 1e9;
  while (r - l > 1) {
    int m = (r + l) / 2;
    if (ok(m)) l = m;
    else r = m;
  }
  cout << r << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <list>
#include <algorithm>
using namespace std;
#define B


int bubbleSort(list<int>&arr, int n) {
	int cunt = 0;
	bool cont = true;
	while (cont)
	{
		list<int>::iterator it1 = arr.begin(), it2 = arr.begin();
		advance(it2, 1);
		cont = false;
		for (int i = 1; i < n; ++i, advance(it1, 1), advance(it2, 1))
		{
			if (*it1 > *it2) {
				swap(*it1, *it2);
				cont = true;
				cunt++;
			}
		}
	}
	return cunt;
}
int selectionSort(list<int>& arr, int n) {
	int cunt = 0;
	list<int>::iterator it1, it2, min, itend = arr.end();
	for (it1 = arr.begin(); it1 != itend; advance(it1, 1))
	{
		min = it1;
		for (it2 = next(it1); it2 != itend; advance(it2, 1))
		{
			if (*it2 < *min)
				min = it2;
		}
		if (it1 != min) {
			cunt++;
			swap(*it1, *min);
		}
	}
	return cunt;
}

#ifdef D
int main(void)
{
	int n;
	return 0;
}
#endif // D

#ifdef B
int main(void)
{
	int n;
	cin >> n;
	list<int> arr(n);
	for (auto &a : arr)
		cin >> a;
	int cunt = selectionSort(arr,n);
	list<int>::iterator it = arr.begin();
	cout << *it;
	advance(it, 1);
	for (; it != arr.end(); advance(it, 1))
		cout << " " << *it;
	cout << endl << cunt << endl;
	return 0;
}
#endif // B

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

int main()
{
    int N, K, X, Y;
    cin >> N >> K >> X >> Y;
    int ans = 0;
    if (K < N)
    {
        ans = X * K + Y * (N - K);
    }
    else
    {
        ans = X * N;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A , B;
  cin >> A >> B;
  if(A == 1 && B == 2 || A == 2 && B == 1){
    cout << "3" << endl;
  }
  
  if(A == 2 && B == 3 || A == 3 && B == 2){
    cout << "1" << endl;
  }
  if(A == 1 && B == 3 || A == 3 && B == 1){
    cout << "2" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define M 1046527
#define L 14
char H[M][L];

//?°?????¬??????¬??¢?????°???
int getChar(char c) {
  switch (c) {
    case 'A': return 1;
    case 'C': return 2;
    case 'G': return 3;
    case 'T': return 4;
    default: return 0;
  }
}
//?°?????¬??????¬??¢?????°?????¶??????key
long long getKey(char str[]) {
  long long ret = 0, p = 1;
  int i;
  for(i = 0; str[i] != '\0'; i++) {
    ret += p * getChar(str[i]);
    p *= 3;
  }
  return ret;
}
int h1(int key){return key%M;}
int h2(int key){return 1+(key%(M-1));}
int find(char str[]) {
  long long key, h, i;
  key = getKey(str);
  for(i = 0; ; i++) {
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h], str) == 0) {
      return 1;
    } else if(strlen(H[h]) == 0) {
      return 0;
    }
  }
  return 0;
}
int Insert(char str[]) {
  long long key, h, i;
  key = getKey(str);
  for(i = 0; ; i++) {
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h], str) == 0) {
      return 1;
    } else if(strlen(H[h]) == 0) {
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}
int main()
{
    int i,n;
    char str[L],cmd[9];
    for(i=0;i<M;i++){ 
         H[i][0]='\0';
    }
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%s %s",cmd,str);
        if(cmd[0]=='i'){
            Insert(str);
        }
        else
        {
            if(find(str)){
                printf("yes\n");
             }
            else{
                printf("no\n");
             }
        }
    }
    return 0;
}

Measured memory_bytes: 17060
def LCM(a, b):
    s = a * b
    a, b = min(a, b), max(a, b)
    while a % b > 0:
        a, b = b, a % b
    return s // b

N = int(input())
ans = int(input())
for i in range(N-1):
    ans = LCM(ans, int(input()))
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>
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 FORR(i,a,b) for (int i=a; i>=b; --i)

typedef long long ll;

int w,h;
int a[20][20];
int dx[4] = {1,-1,0,0} , dy[4] = {0,0,1,-1};
int ans;

void dfs(int i , int j){
    a[i][j]=0;
    ans++;
    REP(k,4){
        int ii=i+dx[k] , jj=j+dy[k];
        if (ii>=0 && ii<h && jj>=0 && jj<w && a[ii][jj]){
            dfs(ii,jj);
        }
    }
}

int main(void) {
    while (cin>>w>>h && w){
        int x , y;
        REP(i,h){
            REP(j,w){
                char c;
                cin >> c;
                if (c=='.')
                    a[i][j]=1;
                else if (c=='#')
                    a[i][j]=0;
                else{
                    a[i][j]=1;
                    x=i;
                    y=j;
                }
            }
        }
        ans = 0;
        dfs(x,y);
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main(){
    char c;
    cin >> c;
    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
        cout << "vowel" << endl;
    }else{
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
#define fst first
#define snd second
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<int> vi;
const int mn=1e5+4;
vi g[mn];
bitset<mn> isleaf;
int v2l[mn];
int vdeg[mn];
vi construct(vi chain) {
  int gid=1;
  vi vans;
  int cid=gid++;
  for (auto &x:chain) {
    int leaf=v2l[x];
    //printf("x:%d leaf:%d\n",x,leaf);
    for (int i=0;i<leaf;i++) {
      vans.PB(gid++);
    }
    vans.PB(cid);
    cid=gid++;
  }
  return vans;
}
vi chain;
void dfs(int x, int p) {
  chain.PB(x);
  //printf("chain:%d\n",x);
  for (auto &y:g[x]) {
    if (y!=p&&!isleaf[y]) {
      dfs(y,x);
    }
  }
}
void fail(int t) {
  //printf("Fail t:%d\n",t);
  printf("-1\n"); exit(0);
}
int main(){ 
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n; scanf("%d",&n);
  for(int i=1;i<n;i++) {
    int x,y; scanf("%d%d",&x,&y); g[x].PB(y); g[y].PB(x);
  }
  if (n==2) {
    printf("1 2\n"); exit(0);
  }
  for (int x=1;x<=n;x++) {
    if (g[x].size()==1) {
      int p=g[x][0];
      v2l[p]++;
      isleaf[x]=true;
      //printf("x:%d is leaf p:%d\n",x,p);
    }
  }
  for (int x=1;x<=n;x++) {
    if (!isleaf[x]) {
      int deg=0;
      for (auto &y:g[x]) {
        if (!isleaf[y]) ++deg;
      }
      //printf("x:%d deg:%d\n",x,deg);
      vdeg[x]=deg;
    }
  }
  vi zeros;
  vi ones;
  int good=0;
  for (int x=1;x<=n;x++) {
    if (isleaf[x]) continue;
    if (vdeg[x]==0) {zeros.PB(x); good++;}
    else if (vdeg[x]==1) {ones.PB(x); good++;}
    else if (vdeg[x]==2) {good++;}
    else fail(1);
  }
  if (zeros.size()==1) {
    dfs(zeros[0],-1);
    if (good!=chain.size()) fail(3);
    int lft=2;
    int x=zeros[0];
    for (auto &y:g[x]) {
      if (isleaf[y]&&lft>0) {
        if (lft==2) {
          chain.insert(chain.begin(),y);
        }
        else if (lft==1) {
          chain.PB(y);
        }
        isleaf[y]=false;
        v2l[x]--;
        --lft;
      }
    } 
  }
  else if (ones.size()==2) {
    dfs(ones[0],-1);
    if (good!=chain.size()) fail(33);
    for (int i=0;i<2;i++) {
      int x=ones[i];
      for (auto &y:g[x]) {
        if (isleaf[y]) {
          if (i==0) {
            chain.insert(chain.begin(),y);
          }
          else {
            chain.PB(y);
          }
          isleaf[y]=false;
          v2l[x]--;
          break;
        }
      }
    }
  }
  else fail(4);
  vi ans1=construct(chain);
  reverse(chain.begin(),chain.end());
  vi ans2=construct(chain);
  vi ans=min(ans1,ans2);
  for (auto &w:ans) printf("%d ",w);
  printf("\n");
}



Measured memory_bytes: 14572
#include<stdio.h>

int main(void)
{
  int t;
  int n;
  int i,j;
  int data[100][100];
  int up[100] = {0};
  int down[100] = {0};
  int judge;

  scanf("%d",&t);
  
  for(i=0;i<t;i++){
    
    scanf("%d",&n);
    
    for(j=0;j<n;j++){
      
      scanf("%d",&data[i][j]);
	
	}
    
    for(j=0;j<n-1;j++){
      
      judge = data[i][j+1] - data[i][j];
      
      if((judge >= 0) && (judge > up[i])){
	
	up[i] = judge;
	
      }
      
      else if((judge < 0) && (judge < down[i])){
	
	down[i] = judge;
	
      }
      
    }
    
  }
  
  for(i=0;i<t;i++)
    printf("%d %d\n",up[i],-down[i]);
  
  return 0;
  
}


		




Measured memory_bytes: 2712
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define plll pair<ll, pll>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
const ll MOD = (ll)1e9+7;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
 
ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}
 
ll modinv(ll x){
	return modpow(x, MOD-2);
}
 
bool was_output = false;
template<class t>
void output(t x){
	if(was_output)cout << " ";
	was_output = true;
	cout << x;
}
 
void outendl(){
	was_output = false;
	cout << endl;
}
 
int main(){
	int a, b;
	cin >> a >> b;
	int ans = a;
	if(a<1||a>=10){
		ans = -1;
	}
	if(ans==-1||b<1||b>=10){
		ans = -1;
	}else{
		ans *= b;
	}
	cout << ans << endl;

	return 0;
}
 


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

int N;
int A[100000];
vector<int> G[100000];

int main() {
  cin >> N;
  for (int i=0; i<N; i++) {
    cin >> A[i];
    A[i]--;
    G[A[i]].push_back(i);
  }
  int c = 0;
  for (int i=0; i<N; i++) {
    if (find(G[i].begin(), G[i].end(), A[i]) != G[i].end()) c++;
  }
  cout << c/2 << "\n";
  return 0;
}


Measured memory_bytes: 6144
#include<stdio.h>

int main()
{
    long long int a , b, c, d;
    long long int x[5];
    long long int maximum;

    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

    x[0] = a*c;
    x[1] = a*d;
    x[2] = b*c;
    x[3] = b*d;


    maximum=x[0];
    for(int i=1; i<4; i++)
    {
        if(maximum<x[i])
            maximum = x[i];
    }

    printf("%lld", maximum);


    return 0;
}

Measured memory_bytes: 1736
#include<stdio.h>

int main( void )
{
    int n ;
    scanf( "%d" ,&n ) ;
    int a ,b ,c ,p ;
    int one[ 200 ] ,two[ 200 ] ,three[ 200 ] ;
    int i ,j ;
    for( i = 0 ; i < n ; i++ )
    {
        scanf( "%d %d %d" ,&one[ i ] ,&two[ i ] ,&three[ i ] ) ;
    }
    for( i = 0 ; i < n ; i++ )
    {
        a = b = c = p = 0 ;
        for( j = 0 ; j < n ; j++ )
        {
            if( i == j )
            {
                continue ;
            }
            if( one[ i ] != one[ j ] )
            {
                a++ ;
            }
            if( two[ i ] != two[ j ] )
            {
                b++ ;
            }
            if( three[ i ] != three[ j ] )
            {
                c++ ;
            }
        }
        if( a == n - 1 )
        {
            p += one[ i ] ;
        }
        if( b == n - 1 )
        {
            p += two[ i ] ;
        }
        if( c == n - 1 )
        {
            p += three[ i ] ;
        }
        printf( "%d\n" ,p ) ;
    }
    return 0 ;
}


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

int main(){
	int n,pa,pb,ca,*cb,pt,ct;
	
	cin >> n >> pa >> pb >> ca;
	cb = new int[n];
	
	for(int i=0; i<n; i++){
		cin >> cb[i];
	}
	
	for(int i=1; i<n; i++){
		if(cb[i] > cb[i-1]){
			ct = cb[i-1];
			cb[i-1] = cb[i];
			cb[i] = ct;
			i=0;
		}
	}
	
	pt = pa;
	ct = ca;
	
	for(int i=0; i<n; i++){
		if(ct/pt <= (ct+cb[i])/(pt+pb)){
			ct += cb[i];
			pt += pb;
		}else{
			break;
		}
	}
	
	cout << ct/pt << endl;
	
	return 0;
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { std::fill( (T*)array, (T*)(array+N), val ); }
#define INF 1e9
#define PI (acos(-1))
#define mod (int)1e9+7
int main() {
    ll n,a,b;
    cin>>n>>a>>b;
    ll d=n/(a+b);
    ll m=n%(a+b);
    if(m>=a)cout<<d*a+a<<endl;
    else cout<<d*a+m<<endl;
    return 0;
}

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

int main() {
    string s = "Sunny", c = "Cloudy", r = "Rainy";
    
    string input;
    cin >> input;
    
    if(input == s)      cout << c << endl;
    else if(input == c) cout << r << endl;
    else                cout << s << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.Math;
/*Question
/2????????????????????????????????????????????????????????????????????¢??§??¬???????????????????????????????????°???????????????????§?????????¨????????§????????????????????????
/????????§??????2?????? n ?¬???????????????? x={x1,x2,...,xn} ??¨ y={y1,y2,...,yn} ????????¢????¨????????????????????????????
/????????????????????????????????¢?????¬???????¨?????????¨?????¨??????????¬??????????????????????????????¢?????\????????????????????? 
/Dxy=(???i=1n|xi???yi|p)1p
/p=1 ?????¨??? 
/Dxy=|x1???y1|+|x2???y2|+...+|xn???yn|
/??¨?????????????????????????????????????????¢??¨?????°???????????? 
/p=2 ?????¨??? 
/Dxy=(|x1???y1|)2+(|x2???y2|)2+...+(|xn???yn|)2/
??¨???????????????????????¬?????????????????????????????????????????¢??????????????????
/p=??? ?????¨??? 
/Dxy=maxni=1(|xi???yi|)
/??¨???????????????????????§????????§????????¢??¨?????°????????????
/2?????? n ?¬???????????????????????????????????????§???p ??????????????? 1???2???3?????? ?????????????????????????????¢????±???????????????°????????????????????????????????????
*/

/*Input
/1???????????´??° n ????????????????????????
/2????????????????????? x ???????´? {x1,x2,...xn}
/3????????????????????? y ???????´? {y1,y2,...yn} ????????????????????§?????????????????????
/??\?????????????????´??°?????§??????
*/

public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		//????????¨
		StringBuffer b = new StringBuffer();
		/*????????¨
		????????????p=1,p=2,p=3,p=??????????´???¨
		*/
		double[] p = new double[4];
		/*??\?????¨
		/???????????´??°n?????£??\
		/????????????x?????????x??????????????????y?????????y???????´?
		*/
		int n = Integer.parseInt(sc.readLine());
		String[] st = sc.readLine().split(" ");
		int[] x = new int[st.length];
		for(int i = 0;i < st.length;i++){
			x[i] = Integer.parseInt(st[i]);
		}
		st = sc.readLine().split(" ");
		int[] y = new int[st.length];
		for(int i = 0;i < st.length;i++){
			y[i] = Integer.parseInt(st[i]);
		}
		/*p1????¨????
		abs???????????°?°????
		*/
		for(int i = 0;i < n;i++){
			p[0] += Math.abs(x[i]-y[i]);
		}
		/*p2????¨????
		p1?????????pow,sqrt???????????°??????
		*/
		for(int i = 0;i < n;i++){
			p[1] += Math.pow(Math.abs(x[i]-y[i]),2);
		}
		p[1] = Math.sqrt(p[1]);
		/*p3????¨????
		????´????p2??¨??????????????§????????????cbrt??¨3????????????
		*/
		for(int i = 0;i < n;i++){
			p[2] += Math.pow(Math.abs(x[i]-y[i]),3);
		}
		p[2] = Math.cbrt(p[2]);
		/*p=???????¨????
		max??§??????????????¨??????????????§????????????????????£??\???????????°??????
		*/
		for(int i = 0;i < n;i++){
			p[3] = Math.max(Math.abs(x[i]-y[i]),p[3]);
		}
		//????????????????????????
		for(double d:p)
			b.append(String.format("%.6f",d)).append("\n");
		System.out.println(b);
	}
}

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

int main()
{
    ll a, b, c, d;

    cin >> a >> b >> c >> d;

    vector<ll> x = {a * c, a * d, b * c, b * d};

    ll ans = -1 * pow(10, 18);
    rep(i, x.size())
    {
        ans = max(ans, x.at(i));
    }

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

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;

struct Linear
{
    double a, b;
    double operator() (double x)
    {
        return a * x + b;
    }
    double cross(const Linear &l)
    {
        return -(l.b - b) / (l.a - a);
    }
};

int main()
{
    int N;
    double C;
    cin >> N >> C;
    vector<double> h(N);
    for(auto &x : h)
        cin >> x;
    vector<double> p(N, 0.0);
    deque<Linear> q;
    for(int i = 1; i < N; i++)
    {
        Linear l = {-2.0 * h[i - 1], p[i - 1] + h[i - 1] * h[i - 1]};
        while(q.size() > 1)
        {
            Linear l1 = q[q.size() - 1], l2 = q[q.size() - 2];
            if(l1.cross(l2) > l1.cross(l))
                q.pop_back();
            else
                break;
        }
        q.push_back(l);
        while(q.size() > 1)
        {
            Linear l1 = q[0], l2 = q[1];
            if(l1(h[i]) > l2(h[i]))
                q.pop_front();
            else
                break;
        }
        Linear optim = q.front();
        p[i] = C + h[i] * h[i] + optim(h[i]);
        assert(p[i]>=p[i-1]);
    }
    cout << (i64)p[N - 1] << endl;
    return 0;
}


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

#define TASK ""
#define openfile ({freopen(TASK".inp", "r", stdin); freopen(TASK".out", "w", stdout);})

const int N = 100005;

int n;
int p[N], p1[N];

int main() {
	//openfile;
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> p[i], p1[i] = p[i];;
		int ans = 0, ans1 = 0;
	for (int i = 1; i <= n - 1; i++) 
		if (p[i] == i) {
			ans++;
			swap(p[i], p[i + 1]);
		}
		if (p[n] == n) ans++;
	cout << ans;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	  Scanner sc = new Scanner(System.in);
      double x1 = sc.nextDouble();
      double y1 = sc.nextDouble();
      double x2 = sc.nextDouble();
      double y2 = sc.nextDouble();

      double calc = Math.sqrt((Math.pow((x2-x1) , 2) + Math.pow((y2-y1) , 2)));
      
      System.out.println(calc);
	}
}



Measured memory_bytes: 28088
import numpy as np

N, M = map(int, input().split())
a = [int(input()) for i in range(M)]

ans = np.zeros(N + 1)
ans[N] = 1
broken_a = np.zeros(N)
for a_ in a:
    broken_a[a_] = 1
if broken_a[N-1] != 1:
    ans[N - 1] = 1


for i in range(2, N + 1):
    if broken_a[N - i] != 1:
        ans[N - i] = (ans[N - i + 1] + ans[N - i + 2]) % (10 ** 9 + 7)
    else:
        ans[N - i] = 0
print(int(ans[0]))



Measured memory_bytes: 17872