akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import kotlin.math.max

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
//    2 2
//    1 4
//    1 1
//    1 4 1 4 1 4 1 2
//    4 1 4 1 4 1 4 2
    val n = readInteger()
    val aList = readIntegerList()
    val evenCount = aList.count { (it % 2 == 0) && (it % 4 != 0) }
    val oddCount = aList.count { it % 2 == 1}
    val fourCount = aList.count { it % 4 == 0 }
    if (evenCount == 0) {
        val ans = if (oddCount <= fourCount + 1) "Yes" else "No"
        out.println(ans)
    } else {
        val ans = if (oddCount <= fourCount) "Yes" else "No"
        out.println(ans)
    }
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 51416
from math import ceil
def mlt(): return map(int, input().split())


x = int(input())
s = list(mlt())

res = 0

for n in range(1, x):
    if s[n] < s[n-1]:
        d = s[n-1]-s[n]
        res += d
        s[n] += d

print(res)


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

 using namespace std;

 int main() {
   string S, ans;
   vector<int> count(26);
   int i;

   cin >> S;

   for (i = 0; i < S.length(); i++) {
     count.at((int)S.at(i) - 97)++;
   }

   ans = "None";
   for (i = 0; i < 26; i++) {
     if (count.at(i) == 0) {
       ans = (char)(i + 97);
       break;
     }
   }

   cout << ans << endl;
 }


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

int main()
{
    string s;
    cin >> s;

    vector<int> alpha(26);
    for (auto c: s)
    {
        alpha[c-'A']++;
    }
    int count = 0;
    for (int a: alpha)
    {
        if (a == 2)
        {
            count++;
        }
    }
    if (count == 2)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
function Main(input) {
  "use strict"
  const temp = input.split("\n")

  const nk = temp.shift().split(" ");
  const n = parseInt(nk.shift());
  const k = parseInt(nk.shift());
  const s = temp.shift().split("");

  let tempChar = s.shift()
  let counter = 0;
  s.forEach(char => {
    if(tempChar === char) counter += 1;
    tempChar = char;
  })
  console.log(Math.min(counter + k * 2,  n - 1));

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 12108
#include<stdio.h>
#include<stdlib.h>

int top, S[1000];

void push(int x) {
	S[++top] = x;
}

int pop() {
	top--;
	return S[top+1];
}

int main() {
	int a, b;
	top = 0;
	char s[100];
	
	while(scanf("%s", s) != EOF ) {
		if (s[0] == '+') {
			a = pop();
			b = pop();
			push(a + b);
		} else if ( s[0] == '-') {
			b = pop();
			a = pop();
			push(a - b);
		} else if ( s[0] == '*') {
			a = pop();
			b = pop();
			push(a * b);
		} else {
			push(atoi(s));
		}
	}
	
	printf("%d\n", pop());
	
	return 0;
}




Measured memory_bytes: 2140
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

int a, b;

int main()
{
    std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
    std::cin >> a >> b;
    if (a >= 13)
        b = b;
    else if (a >= 6)
        b = b / 2;
    else
        b = 0;
    std::cout << b << std::endl;
    return 0;
}

Measured memory_bytes: 256
import sys
inf = float("inf")
# sys.setrecursionlimit(1000000)


# abc='abcdefghijklmnopqrstuvwxyz'

def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

n = int(input())
string = input()
last = string[0]
curr = 1
for i in range(1,n):
    if string[i]==last:
        continue
    else:
        curr+=1
        last = string[i]
print(curr)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

#define All(x) (x).begin(),(x).end()

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    long n;
	int m;

	cin >> n >> m;

	string dp[n + 1];
	map<int, V<char> > table;
	int cost[9] = { 2, 5, 5, 4, 5, 6, 3, 7, 6 };
	int a;
	string str;
	
	long i;

	repin(i, n) dp[i] = "";

	rep(i, m) {
		cin >> a;

		table[cost[a - 1]].pb((char)(a + '0'));
	}

	repit(table) {
		sort(All(it->Y), std::greater<char>());

		if (it->X <= n) dp[it->X] = string(1, it->Y[0]);
	}

	repiin(i, n, 4) {
		repit(table) {
		    if (0 < i - it->X && dp[i - it->X] != "") {
				str = dp[i - it->X] + it->Y[0];

				sort(All(str), std::greater<char>());
				
				if (dp[i].size() == str.size() && dp[i] < str) dp[i] = str;
				else if (dp[i].size() < str.size()) dp[i] = str;
			}
		}
	}

	Out(dp[n]);
	
	return 0;
}


Measured memory_bytes: 25472
#include<bits/stdc++.h>
#define nl '\n'
#define vi vector<long int>
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mod 1000000007
using namespace std;

signed main(){
    ios;
    int t;
    cin>>t;
    vi vec(t);
    for(int i=0;i<t;i++) cin>>vec[i];
    vi ans(t);
    ans[t-1]=0;
    ans[t-2]=abs(vec[t-1]-vec[t-2]);
    for(int i=t-3;i>=0;i--){
        ans[i]=min(ans[i+1] + abs(vec[i]-vec[i+1]),ans[i+2] + abs(vec[i]-vec[i+2]));
//        cout<<ans[i]<<nl;
    }
    cout<<ans[0]<<nl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <queue>
#define rep(i,n) for(int i=0; i<(n); ++i)
typedef long long ll;
using namespace std;

int main(){

  ll x, y, a, b, c;
  ll ans = 0;

  cin >> x >> y >> a >> b >> c;

  priority_queue<ll> quep, queq, quer;
  queq.push(0);
  rep(i,a){
    ll p;
    cin >> p;
    quep.push(p);
  }
  queq.push(0);
  rep(i,b){
    ll q;
    cin >> q;
    queq.push(q);
  }
  quer.push(0);
  rep(i,c){
    ll r;
    cin >> r;
    quer.push(r);
  }

  ll r, g, n;
  r = g = n = 0;
  while(r+g+n < x+y){
    ll rtop, gtop, ntop;
    rtop = quep.top(); gtop = queq.top(); ntop = quer.top();
    if(x <= r) rtop = 0;
    if(y <= g) gtop = 0;

    if(rtop > max(gtop,ntop)){
      ++r; ans += rtop;
      quep.pop();
    }
    else if(gtop > ntop){
      ++g; ans += gtop;
      queq.pop();
    }
    else{
      ++n; ans += ntop;
      quer.pop();
    }
  }

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


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;
constexpr i64 MOD = 1e9 + 7;

i64 modpow(i64 a, i64 n, i64 mod) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        i64 t = modpow(a, n / 2, mod);
        return t * t % mod;
    }
    return a * modpow(a, n - 1, mod) % mod;
}

i64 modinv(i64 a, i64 mod) {
    // mod is prime
    return modpow(a, mod - 2, mod);
}

struct Combination {
    const int MAX_N = 1 << 21;
    vi fact = vi(MAX_N);
    vi factinv = vi(MAX_N);

    Combination() {
        fact[0] = 1;
        for (int i = 1; i < MAX_N; i++) {
            fact[i] = fact[i - 1] * i % MOD;
        }
        factinv[MAX_N - 1] = modinv(fact[MAX_N - 1], MOD);
        for (int i = MAX_N - 2; i >= 0; i--) {
            factinv[i] = factinv[i + 1] * (i + 1) % MOD;
        }
    }

    i64 ncr(i64 n, i64 r) {
        if (r < 0 || r > n) return 0;
        return fact[n] * factinv[r] % MOD * factinv[n - r] % MOD;
    }

    i64 npr(i64 n, i64 r) {
        if (r < 0 || r > n) return 0;
        return fact[n] * factinv[n - r] % MOD;
    }

    i64 nhr(i64 n, i64 r) {
        if (n == 0 && r == 0) return 1;
        return ncr(n + r - 1, r);
    }
} comb;

i64 f(int n, int k) {
    i64 ret = 0;
    for (int i = 1; i <= k; i++) {
        if ((k - i) % 2) {
            ret -= comb.ncr(k, i) * modpow(i, n, MOD) % MOD;
        } else {
            ret += comb.ncr(k, i) * modpow(i, n, MOD) % MOD;
        }
        ret %= MOD;
    }
    ret += MOD;
    return ret % MOD;
}

i64 S(int n, int k) {
    return f(n, k) * comb.factinv[k] % MOD;
}

i64 B(int n, int k) {
    i64 ret = 0;
    for (int i = 1; i <= k; i++) {
        ret += S(n, i);
        ret %= MOD;
    }
    return ret;
}

int main() {
    int n, k;
    cin >> n >> k;
    cout << S(n, k) << endl;
}


Measured memory_bytes: 35404
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    Map<String,Integer> su = new LinkedHashMap<String,Integer>();
    su.put("1",0);
    for(int i = 2; i <= n; i++){
    	String num = String.valueOf(i);
      su.put(num,0);
    }
    for(int i = 0; i < n-1; i++){
      String j = sc.next();
      int temp = su.get(j) + 1;
      su.put(j,temp);
    }
    sc.close();
    for(String ans : su.keySet()){
      System.out.println(su.get(ans));
    }
  }
}

Measured memory_bytes: 83292
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split(" ");
			int n = Integer.parseInt(chr[0]);
			int m = Integer.parseInt(chr[1]);
			 System.out.println((n+m)*(n+m-1) / 2 - n * m);
		}
	}
}

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

char F(char c, int a, int b)
{
	return ((c-'a')*a + b)%26 + 'a';
}

int main()
{
	string str;
	char str1[8]="that",src1[8]="that";
	char str2[8]="this",src2[8]="this";

	int a,b,n; cin >> n; cin.ignore();
	while(n--)
	{
		getline(cin,str);

		for(a=1; true; a++)
		{
			if(a%2==0 || a%13==0) continue;

			for(b=0; b<26; b++)
			{
				for(int i=0; i<4; i++)
				{
					str1[i] = F(src1[i],a,b);
					str2[i] = F(src2[i],a,b);
				}
				if(str.find(str1)!=string::npos
				|| str.find(str2)!=string::npos)
				{
					goto ex;
				}
			}
		}

		ex:;

		char tb[256];
		for(char i='a'; i<='z'; i++)
		{
			tb[F(i,a,b)] = i;
		}
		tb[' ']=' ';

		for(int i=0; i<str.size(); i++)
		{
			cout << tb[str[i]];
		}
		cout << endl;
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>//pair
#include<cmath>//abs,sqrt
#include<cstring>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const int INF=1e+9;
const ll INFLL=1e+17;
int n,k;
char s[100010];
int solve(){
  s[n]='2';
  int cnt=1;
  vector<int> v;
  rep(i,n){
    if(s[i]!=s[i+1]){
      v.push_back(cnt);
      cnt=1;
    }
    else cnt++;
  }
  int cum[100010];
  cum[0]=0;
  int vs=v.size();
  rep1(i,vs){
    cum[i]=cum[i-1]+v[i-1];
  }
  int res=0;
  if(s[0]=='0'){
    if((vs+1)/2<=k) return n;
    res=cum[2*k];
    if(s[n-1]=='0'){
      rep(i,(vs-1)/2-k){
	int temp=cum[2*k+2+2*i]-cum[2*i+1];
	res=max(res,temp);
      }
      int temp=cum[vs]-cum[vs-2*k];
      res=max(res,temp);
    }
    else{
      rep(i,vs/2-k){
	int temp=cum[2*k+2+2*i]-cum[2*i+1];
	res=max(res,temp);
      }
    }
  }
  else{
    if(vs/2<=k) return n;
    if(s[n-1]=='0'){
      rep(i,vs/2-k){
	int temp=cum[2*k+1+2*i]-cum[2*i];
	res=max(res,temp);
      }
      int temp=cum[vs]-cum[vs-2*k];
      res=max(res,temp);
    }
    else{
      rep(i,(vs-1)/2-k+1){
	int temp=cum[2*k+1+2*i]-cum[2*i];
	res=max(res,temp);
      }
    }
    
  }
  return res;
  

}
int main(){
  cin>>n>>k;
  rep(i,n) cin>>s[i];
  prin(solve());
  

  
  
  return 0;
}


Measured memory_bytes: 1272
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
using namespace std;

#define ll long long int

const int MOD = 1000000007;

int max(int a, int b) {

	if (a > b)return a;
	else return b;

}
int cost(int num1, int num2) {

	if (num1 > num2)return (num1 - num2)*(num1 - num2);
	else return (num2 - num1)*(num2 - num1);

}
int main() {

	int A, B, C;

	cin >> A >> B >> C;

	if ((A == 7 && B == 5 && C == 5) || (B == 7 && A == 5 && C == 5) || (C == 7 && A == 5 && B == 5))cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b

signed main(){
	int n,a,b,c; 
	cin>>a>>b>>c;
	cin>>n;
	int ans=0;
	rep(i,0,n+1){
		rep(j,0,n+1){
			int k=i*a+j*b;
			if(n-k>=0 && (n-k)%c==0)ans++;
		}
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;


template <typename T> T gcd(T a, T b) {if(b == 0) return a;return gcd(b,a%b);}
template <typename T> T lcm(T a, T b) {return a*b/gcd(a,b);}
template <typename T> T extgcd(T a, T b, T& x, T& y){
    T d = a;
    if(b != 0){
        d = extgcd(b,a%b,y,x);
        y-=(a/b)*x;
    }
    else x=1,y=0;
    return d;
}
template <typename T> T modpow(T x, T n, T m) {
    if(n==0) return 1;
    T resp = modpow(x*x%m,n/2,m);
    if(n&1) resp = resp*x%m;
    return resp;
}
template <typename T> T modinverse(T a, T m) {
    T x,y;
    extgcd(a,m,x,y);
    return (m+x%m)%m;
}
struct combination {
    ll M = mod;
    vector<ll> fact,ifact;
    combination(ll n):fact(n+1),ifact(n+1){
        fact[0]=1;ifact[0]=1;
        for (ll i = 0; i<n; i++) {
            fact[i+1] = fact[i]*(i+1) % M;
            ifact[i+1] = ifact[i]*modpow(i+1, M-2, M) % M;
        }
    }
    ll com(ll a, ll b){
        if(a == 0 && b == 0)return 1;
        if(a < b || a < 0)return 0;
        ll tmp = ifact[a-b] * ifact[b] % M;
        return tmp * fact[a] % M;
    }
};



int main()
{

    ll N,M,K;
    cin >> N >> M >> K;
    
    combination C(N*M);
    ll cc = C.com(N*M-2,K-2);
    
    ll ans = 0;
    
    for (ll i = 1; i <= M-1; i++) {
        ans += (cc*N*N%mod)*i*(M-i)%mod;
        ans %= mod;
    }
    for (ll i = 1; i <= N-1; i++) {
        ans += (cc*M*M%mod)*i*(N-i)%mod;
        ans %= mod;
    }
    cout << ans << endl;
    

    return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <utility>
#define maxm 55
using namespace std;
typedef long long ll;
int n,m,c,b[maxm],a[maxm];
int check(){
  int res = c;
  for(int i = 1;i <= m;i++){
    res += a[i] * b[i];
  }
  return res > 0;
}
int main(){
  scanf("%d%d%d",&n,&m,&c);
  for(int i = 1;i <= m;i++) scanf("%d",&b[i]);
  int res = 0;
  for(int i = 1;i <= n;i++){
    for(int i = 1;i <= m;i++) scanf("%d",&a[i]);
    res += check();
  }
  printf("%d\n",res);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    int n;
    cin>>n;
    vi as(n);
    cin>>as;

    vector<bool> ans(n + 1);
    vi cnt(n + 1);
    for (int i = n; i >= 1; --i) {
        if (cnt[i] % 2 - as[i - 1]) {
            ans[i] = true;
            cnt[1]++;
            for (int j = 2; j * j <= i; ++j) {
                if (i % j == 0) {
                    cnt[j]++;
                    if (i / j != j) cnt[i / j]++;
                }
            }
        }
    }
    int m = 0;
    rep(i, n) if (ans[i + 1]) m++;   
    cout<<m<<endl;
    rep(i, n) {
        if (ans[i + 1]) cout<<i + 1<<endl;
    }
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long int llint;

bool comp(char a, char b){
	return a>b;
}

int main(){
	int i, sizes, sizet;
	string s, t;
	cin>>s>>t;
	sort(begin(s), end(s));
	sort(begin(t), end(t), comp);
	if(s<t) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	vector<int> a(3);
	cin >> a.at(0) >> a.at(1) >> a.at(2);
	sort(a.begin(), a.end());
	cout << a.at(0) << " " << a.at(1) << " " << a.at(2) << endl;
}


Measured memory_bytes: 3128
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <ctime>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

int main(void)
{
    string s;
    cin >> s;
    if(s.at(0) == s.at(1) && s.at(1) == s.at(2)) puts("No");
    else puts("Yes");
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		double ch = 180.0 / Math.PI;

		Scanner in = new Scanner(System.in);
		double a = in.nextDouble(), b = in.nextDouble(), x = in.nextDouble();
		in.close();

		double ans = 0.0;
		double lim = a * a * b / 2;

		if ( x <= lim ) {
			System.out.println(90.0 - Math.atan(x * 2 / (a * b * b)) * ch);
		} else {
			System.out.println(Math.atan(2 * (b - x / (a * a)) / a) * ch);
		}

	}
}

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

using namespace std;

int main()
{
  string S;
  cin >> S;
  int cnt = 0;
  for (char t : S)
    if (t == '0')
      cnt++;
  cout << min(cnt, (int)S.size() - cnt) * 2 << endl;

  return 0;
}


Measured memory_bytes: 512
def thickness(l):
    return 2 ** (l + 2) - 3


def pate(l):
    return 2 ** (l + 1) - 1


def rec(l, x):
    if l == 0:
        return x
    t = thickness(l-1)
    if x <= 1:
        return 0
    elif x <= t + 1:
        return rec(l-1, x-1)
    elif x <= t + 2:
        return pate(l-1) + 1
    elif x <= 2 * t + 2:
        return pate(l-1) + 1 + rec(l-1, x-t-2)
    else:
        return pate(l)


def main():
    n, x = map(int, input().split())
    print(rec(n, x))


main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  string a,b;
  cin>>a>>b;
  int c=stoi(a+b);
  cout << (ceil(sqrt(c))==floor(sqrt(c))? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 501
long long n,c,d[31][31],a[N][N],f[3][31];
int main()
{
	cin>>n>>c;
	for(int i=1;i<=c;i++)
	  for(int j=1;j<=c;j++)
	    cin>>d[i][j];
	for(int i=1;i<=n;i++)
	  for(int j=1;j<=n;j++)
	    cin>>a[i][j];
	//for(int k=1;k<=c;k++)
	  //for(int i=1;i<=c;i++)
	    //for(int j=1;j<=c;j++)
	      //d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	for(int i=1;i<=n;i++)
	  for(int j=1;j<=n;j++)
	    for(int k=1;k<=c;k++)
	      f[(i+j)%3][k]+=d[a[i][j]][k];
	long long ans=10000000000ll;
	for(int i=1;i<=c;i++)
	  for(int j=1;j<=c;j++)
	    for(int k=1;k<=c;k++)
	      if(i!=j && j!=k && k!=i)//cout<<i<<" "<<j<<" "<<k<<" "<<f[0][i]+f[1][j]+f[2][k]<<endl;
	        ans=min(ans,f[0][i]+f[1][j]+f[2][k]);
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

#define LOOP(N) for(int i=(int)(N); i--;)
#define REP(i, N) for(int i=0; i<(N); ++i)
#define FOR(i, start, end) for(int i=(int)(start); i<(end); ++i)
#define ALL(a) (a).begin(),(a).end()

class FastIO {
public:
    FastIO() {
        cin.tie(0);
        ios::sync_with_stdio(false);
    }
    ~FastIO() {}

    template <class T>
    void scan(T &v) {
        cin >> v;
    }
    template <class T, class... Rest>
    void scan(T &v, Rest&... rest) {
        scan(v);
        scan(rest...);
    }

    template <class T>
    void print(T v) {
        cout << v;
    }
    template <class T, class... Rest>
    void print(T v, Rest... rest) {
        print(v);
        print(" ");
        print(rest...);
    }
    template <class T>
    void print(vector<T> v) {
        for (T t: v) {
            print(t);
            print(" ");
        }
        print("\b\n");
    }
    template <class T>
    void prints(T v) {
        print(v);
        cout << "\n";
    }
};

void _main(FastIO&);
int main() {
    FastIO io;
    _main(io);
}



void _main(FastIO &io) {
    string s, t; io.scan(s, t);
    int c = 0;
    REP(i, 3) {
        if (s[i] == t[i]) c++;
    }
    
    cout << c;
}

Measured memory_bytes: 256
#include <cstdio>
#define N 20005
#define M 30000
int n, p, a[N], b[N], c[N];
int main() {
	int i;
	scanf("%d", &n);
	for(i=1; i<=n; i++) scanf("%d", &p), c[p] = i;
	for(i=1; i<=n; i++) {
		a[i] = i*M;
		b[i] = (n-i)*M + c[i];
	}
	for(i=1; i<=n; i++) printf("%d ", a[i]);
	puts("");
	for(i=1; i<=n; i++) printf("%d ", b[i]);
	return 0;
}

Measured memory_bytes: 768
def resolve():
    #n=int(input())
    #a,b=map(int,input().split())
    #x=list(map(int,input().split()))
    #a=[list(map(lambda x:int(x)%2,input().split())) for _ in range(h)]
    import heapq 

    t=int(input())
    for i in range(t):
        n=int(input())
        L=[[] for _ in range(n)]
        R=[[] for _ in range(n)]
        lm,rm=-1,-1
        ans=0
        for j in range(n):
            k,l,r=map(int,input().split())
            ans+=min(l,r)
            if l-r>=0:
                L[k-1].append(r-l)
                lm=max(lm,k-1)
            else:
                if n-k-1>=0:
                    R[n-k-1].append(l-r)
                    rm=max(rm,n-k-1)
        q=[]
        heapq.heapify(q)
        if lm>-1:
            for j in range(lm,-1,-1):
                for k in L[j]:
                    heapq.heappush(q,k)
                if q:
                    ans-=heapq.heappop(q)
        q=[]
        heapq.heapify(q)
        if rm<n:
            for j in range(rm,-1,-1):
                for k in R[j]:
                    heapq.heappush(q,k)
                if q:
                    ans-=heapq.heappop(q)
        print(ans)

if __name__ == '__main__':
    resolve()

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

int main(void) {
    int N;
    int l,r;
    int ans = 0;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> l >> r;
        ans += (r - l + 1);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int max (int a,int b){return a>b ? a:b;}
int min (int a,int b){return a<b ? a:b;}
#define MAX 200000
int main(void) {
	int R[MAX],r,i,maxv,minv;
	scanf("%d",&r);
	for(i = 0; i < r; i++){scanf("%d",&R[i]);}
	maxv = -2000000000;
	minv = R[0];
	for(i = 1; i < r; i++){
		maxv = max(maxv,R[i]-minv);
		minv = min(minv,R[i]);
	}
	printf("%d\n",maxv);
	return 0;
}



Measured memory_bytes: 2624
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int X, Y, Z;
    cin >> X >> Y >> Z;

    int res = 0;
    res += X/(Y+Z);
    
    if(X%(Y+Z) < Z) res--;

    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  int a,b;
  cin >> a >> b;
  cout << (a+b)/2 << endl;
}



Measured memory_bytes: 3112
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace C_test_For_Atcorder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var min = 30;
            var N = cin.ReadInt;
            for (int i = 0; i < N; i++){
                var a = cin.ReadInt;
                var c = 0;
                while (a % 2 == 0 && a != 0) { a >>= 1; c++; }
                min = Min(min, c);
            }
            WriteLine(min);

        }
    }


    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue inputStream;

        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return (string)inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return (string)inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }

}

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

int main(){
    int N,L,b=0,c=0;
    cin>>N>>L;
    int a[N];
    for(int i=1;i<=N;i++){
        a[i-1]=L+i-1;
    }
       for(int j=1;j<N;j++){
        if(abs(a[b])<abs(a[j])){
        b=b;
        }else{
        b=j;
        }
       }
    for(int l=0;l<N;l++){
        c+=a[l];
    }
    c=c-a[b];
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
 
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
 
    while(a > 0 && c > 0){
      c -= b;
      if(c <= 0){
        System.out.println("Yes");
        break;
      }
      a -= d;
      if(a <= 0){
        System.out.println("No");
        break;
      }
    }
 
 
 
  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  auto solve = [&]() -> bool {
    vector<ll> cnt(26);
    ll H, W; cin >> H >> W;
    for (ll i = 0; i < H; i++) {
      string s; cin >> s;
      for (ll j = 0; j < W; j++) {
	char c = s.at(j) - 'a';
	cnt.at(c)++;
      }
    }
    ll n4 = 0;
    ll n2 = 0;
    ll n1 = 0;
    for (ll i = 0; i < 26; i++) {
      ll res = cnt.at(i) % 4;
      if (res == 0) n4++;
      else if (res == 2) n2++;
      else n1++;
    }
    ll numodd = (H % 2) + (W % 2);
    if (numodd == 0) {
      return (n1 == 0) && (n2 == 0);
    }else if (numodd == 1) {
      if (H % 2 == 1) {
	return (n1 == 0) && (n2 <= W / 2);
      }else {
	return (n1 == 0) && (n2 <= H / 2);
      }
    }else if (numodd == 2) {
      return (n1 <= 1) && (n1 + 2 * n2 <= W + H - 1);
    }else assert(0);
  };
  
  cout << (solve() ? "Yes\n" : "No\n");

  return 0;
}



Measured memory_bytes: 3660
import sys
sys.setrecursionlimit(10000000)
import numpy as np
from heapq import heapify, heappop, heappush
import copy
import math


def main():
    A, B, H, M = map(int, input().split())
    theta = abs(6 * M - 30 * (H + M / 60))
    c = (B ** 2 + A ** 2 - 2 * A * B * math.cos(math.radians(theta))) ** 0.5
    print(c)

if __name__ == '__main__':
    main()


Measured memory_bytes: 27228
#include <bits/stdc++.h>
#define INF 0x7fffffff
#define MAXN 100010
#define MOD 1000000007
#define int long long
using namespace std;
inline int read(){
	int ret=0,pos=1;char c=getchar();
	while(!isdigit(c) && c!='-' ) c=getchar();
	if(c=='-')	pos=-1,c=getchar();
	while(isdigit(c))ret=(ret<<3)+(ret<<1)+c-48,c=getchar();
	return pos*ret;
}
inline int fst_pow(int a,int b){
	int ret=1;
    for(;b;b>>=1,a=(a*a)%MOD)	if(b&1)	ret=a*ret%MOD;
    return ret;
}
int a[MAXN];
int n,k,ans=0x7fffffff;
signed main(){
	n=read();for(int i=1;i<=n;++i) a[i]=read();
    for (int i=1;i<=100;++i) {
		int sum = 0;
		for(int j=1;j<=n;++j)	sum+=pow(a[j]-i,2);
		ans=min(ans, sum);
	}
	cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
from operator import itemgetter

n,m = map(int, input().split())
ab = sorted([list(map(int, input().split())) for i in range(m)], key=itemgetter(1,0))
end = 1
ans = 0
for s,e in ab:
  if s >= end:
    ans += 1
    end = e
print(ans)

Measured memory_bytes: 36316
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i, n) cin >> p[i];
  sort(p.begin(), p.end());
  int ans = 0;
  rep(i, k) ans += p[i];
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int func(string x, string y) {
  int ans = 0;
  for(char c = 'a'; c <= 'z'; c++) {
    bool s = false;
    bool t = false;
    for(int i=0; i<x.size(); i++) {
      if(x[i] == c) {
        s = true;
      }
    }
    for(int i=0; i<y.size(); i++) {
      if(y[i] == c) {
        t = true;
      }
    }
    if(s && t) ans++;
  }
  return ans;
}

int main() {
  int n;
  string s;
  cin >> n >> s; 
  int ans = 0;
  for(int i = 0; i<=n; ++i) {
    int tmp = func(s.substr(0,i), s.substr(i));
    ans = max(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
typedef long long ll;
int main() {
//input
int h,w,n,max;
int ans = 0;
cin >> h >> w >> n;
//compute
if(h>w)max=h;
else max =w;
if(n%max == 0) ans = n/max;
else ans = n/max+1;
//output
cout<<ans;
	return 0;
}

Measured memory_bytes: 256
n,m,k=map(int,input().split())
mod = 998244353

fac = [1]*(n+1)
per = [1]*(n+1)
for i in range(1,n+1):
    fac[i] = fac[i-1]*i%mod
    per[i] = pow(fac[i],mod-2,mod)

def nCk(n,k):
    return fac[n]*per[k]%mod*per[n-k]%mod

ans = 0
for i in range(k+1):
    ans += m*pow(m-1,n-1-i,mod)%mod * nCk(n-1,i)%mod
    ans %= mod
print(ans)


Measured memory_bytes: 74144
X,Y,Z,K=map(int,input().split())
A=sorted(map(int,input().split()), reverse=True)
B=sorted(map(int,input().split()), reverse=True)
C=sorted(map(int,input().split()), reverse=True)
AB=[]
for a in A:
    for b in B:
        AB.append(a+b)
AB=sorted(AB,reverse=True)[:K]
ans=[]
for ab in AB:
    for c in C:
        ans.append(ab+c)
ans=sorted(ans,reverse=True)[:K]
print(*ans,sep='\n')

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

int main(){
  int N, K;
  cin >> N >> K;
  int d;
  vector<int> A;
  vector<bool> v(N, false);
  for(int i=0; i<K; i++){
    cin >> d;
    A.resize(d);
    for(int j=0; j<d; j++){
      cin >> A[j];
      v[A[j]-1]=true;
    }
  }
  int cnt=0;
  for(int i=0; i<N; i++){
    if(v[i]==false) cnt++;
  }
  cout <<cnt <<endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int quan;
	while(cin>>quan&&quan!=0){
		int minCost=100000000;
		for(int i = 0; i <= 25; i++){
			for(int j = 0; j <= 17; j++){
				for(int k = 0; k <= 10; k++){
					if(i*200+j*300+k*500==quan){
						int il=i%5;
						int jl=j%4;
						int kl=k%3;
						double sum=(i-il)*380*0.8+il*380;
						sum+=(j-jl)*550*0.85+jl*550;
						sum+=(k-kl)*850*0.88+kl*850;
						minCost=min(minCost,(int)(sum+0.99999999));
					}
				}
			}
		}
		cout<<minCost<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using ll = long long;
#define ull unsigned ll
//#define endl "\n"
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(),(v).end()
#define mst(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pll pair<ll, ll>
#define ppi pair<int, pii>
#define vpi vector<pii>
#define vpl vector<pll>
#define mt make_tuple
#define eb emplace_back
using namespace std;

const ll N = 2e5 + 5, mod = 1e9 + 7;
const ll inf = 1e18;

struct cmp{
    bool operator() (pii a, pii b){
        if(a.F == b.F) return a.S < b.S;
        return a.F > b.F;
    }
};

ll power(ll x, ll p){
    ll r = 1ll;
    x = x % mod;
    while(p > 0){
        if(p & 1) r = (r * x) % mod;
        p = p >> 1;
        x = (x * x) % mod;
    }
    return r;
}

void solve(){
    ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    ll n = x/d;
    //cout << n << endl;
    if(n <= k){
        x -= n * d;
        k -= n;
    }
    else{
        x -= k * d;
        k = 0;
    }
    //cout << x << endl;
    assert(x >= 0);
    ll y = abs(x - d);
    if(/*y <= x && */k % 2 == 1){
        cout << y << endl;
        return;
    }
    if(/*x <= y && */k % 2 == 0){
        cout << x << endl;
        return;
    }

}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //cout.tie(0);
    /*#ifndef ONLINE_JUDGE
        freopen("Input.txt", "r", stdin);
    #endif*/
    //freopen("running_on_fumes_chapter_1_input (1).txt", "r", stdin);
    //freopen("Output.txt", "w", stdout);
    int t = 1, p;
    //cin >> t;
    for(p = 1; p <= t; p++){
        //cout << "Case #" << p << ": ";
        solve();
    }
    return 0;
}


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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORTASC(c) sort((c).begin(),(c).end())
#define SORTDESC(c,t) sort((c).begin(),(c).end(), std::greater<t>());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define VMAX(a) *max_element(ALL(a))
#define VMIN(a) *min_element(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double PI  = acos(-1.0);
const long long MOD = 1000000007;

template <class T, class S>
using umap = std::unordered_map<T, S>;
using ll = long long;
using namespace std;

int main() {
    ll x, y;
    ll p[200010];
    vector<ll > v;
    string s;
   
    cin >> x >> y;

    ll n = 2*x;

    if (y == n){
        cout << "Yes" << endl;
        return 0;
    }
    
    REP(i, x){
        n += 2;
        if (n == y){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, s, n) for (int i = s; i <= n; i++)
typedef long long ll;

class cl_stack {
private:
	/* Stack array */
	int* stack;
	/* Current position */
	int position;

public:
	/* Constructor */
	cl_stack(int size)
	{
		stack = new int[size];
		position = 0;
	}
	/* Destructor */
	~cl_stack()
	{
		delete[] stack;
	}
	/* Pop */
	int pop()
	{
		int pop_value = stack[position - 1];
		position--;
		return pop_value;
	}
	/* Push */
	void push(int value)
	{
		stack[position] = value;
		position++;
	}
};

cl_stack myStack(200);
char s[200];

int main()
{
	string S;
	int pop1st, pop2nd;
	int pos = 0;

	while (scanf("%s", s) != EOF) {
		if (s[0] == '+') {
			pop1st = myStack.pop();
			pop2nd = myStack.pop();
			myStack.push(pop2nd + pop1st);
		}
		else if (s[0] == '-') {
			pop1st = myStack.pop();
			pop2nd = myStack.pop();
			myStack.push(pop2nd - pop1st);
		}
		else if (s[0] == '*') {
			pop1st = myStack.pop();
			pop2nd = myStack.pop();
			myStack.push(pop2nd * pop1st);
		}
		else {
			myStack.push(atoi(s));
		}
	}

	cout << myStack.pop() << endl;

	return 0;
}



Measured memory_bytes: 3232
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;
ll ans = 0;
int was[120000];
vector<int> eds[120000];
int cl[120000];
int cc[120000][2];
int a[120000];
int n, m;

void dfs1(int v, int c) {
	was[v] = 1;
	cl[v] = c;
	++cc[v][c];
	for (int u: eds[v]) {
		if (!was[u]) {
			dfs1(u, c^1);
			cc[v][0] += cc[u][0];
			cc[v][1] += cc[u][1];
		}
	}
	ans += abs(cc[v][0] - cc[v][1]);
}

vector<int> vv;
vector<int> st;

int dfs2(int v, int fr) {
	st.push_back(v);
	was[v] = 1;
	for (int u: eds[v]) {
		if (u == fr)
			continue;
		if (!was[u]) {
			if (dfs2(u, v))
				return 1;
		}
		else {
			while (st.back() != u)
				vv.push_back(st.back()), st.pop_back();
			vv.push_back(u);
			return 1;
		}
	}
	st.pop_back();
	return 0;
}

ll get(int x) {
	ll ans = 0;
	ll now = x;
	for (int i = 0; i < n; ++i) {
		now += a[i];
		ans += abs(now);
	}
	return ans;
}

int main() {
	scanf("%d%d", &n, &m);
	if (n % 2 == 1) {
		cout << -1 << "\n";
		return 0;
	}
	for (int i = 0; i < m; ++i) {
		int a, b;
		scanf("%d%d", &a, &b);
		--a;
		--b;
		eds[a].push_back(b);
		eds[b].push_back(a);
	}
	if (m == n - 1) {
		dfs1(0, 0);
		if (cc[0][0] != cc[0][1]) {
			cout << -1 << "\n";
		}
		else {
			cout << ans << "\n";
		}
	}
	else {
		dfs2(0, -1);
		memset(was, 0, sizeof(was));
		for (int i: vv)
			was[i] = 1;
		for (int i = 0; i < (int)vv.size(); ++i) {
			dfs1(vv[i], i % 2);
			a[i] = cc[vv[i]][0] - cc[vv[i]][1];
			ans -= abs(a[i]);
		}
		int sum = 0;
		for (int i = 0; i < (int)vv.size(); ++i)
			sum += a[i];
		n = vv.size();
		if ((int)vv.size() % 2 == 0) {
			if (sum != 0) {
				cout << -1 << "\n";
				return 0;
			}
			int lb = -120000;
			int rb = 120000;
			while (rb - lb > 3) {
				int m1 = lb + (rb - lb) / 3;
				int m2 = m1 + (rb - lb) / 3;
				if (get(m1) > get(m2))
					lb = m1;
				else
					rb = m2;
			}
			ll aans = 1e11;
			for (int j = lb; j <= rb; ++j)
				aans = min(aans, get(j));
			cout << ans + aans << "\n";
		}
		else {
			sum /= 2;
			ans += abs(sum);
			a[0] -= sum;
			a[n - 1] -= sum;
			cout << ans + get(0) << "\n";
		}
	}
	return 0;
}




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

int main(){
  int N, X;
  vector<int> m;
  cin >> N >> X;
  for(int i=0; i<N; i++){
    int mi; cin>> mi;
    m.push_back(mi);
    X-=mi;
  }
  sort(m.begin(), m.end());
  cout << N+X/m[0] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <vector>

using namespace std;
#define MAX_NUM 50
uint32_t counts[MAX_NUM];
long long comb[MAX_NUM + 1][MAX_NUM + 1];

static void calc_comb()
{
  for (uint32_t i = 0; i <= MAX_NUM; i++) {
    for (uint32_t j = 0; j <= i; j++) {
      if ((j == 0) || (i == j)) {
        comb[i][j] = 1;
      } else {
        comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
      }
    }
  }
}

int32_t main()
{
  int64_t N, A, B;

  cin >> N >> A >> B;

  calc_comb();

  vector<uint64_t> values;
  for (uint32_t i = 0; i < N; i++) {
    uint64_t value;
    cin >> value;
    values.push_back(value);
  }

  sort(values.begin(), values.end());
  reverse(values.begin(), values.end());

  long double total = 0;
  for (uint32_t i = 0; i < A; i++) {
    total += values[i];
  }

  long double ave = total / A;

  cout << fixed << setprecision(6) << ave << endl;

  uint64_t nums = 0;
  if (values[0] == values[A - 1]) {
    int64_t same_num = 0;
    for (uint32_t i = 0; i < N; i++) {
      if (values[i] == values[0]) {
        same_num++;
      }
    }

    for (uint32_t i = A; i <= min(B, same_num); i++) {
      nums += comb[same_num][i];
    }

  } else {
    uint32_t selected_num = 0;
    uint32_t same_num = 0;
    for (uint32_t i = 0; i < N; i++) {
      if (i < A) {
        if (values[A - 1] == values[i]) {
          selected_num++;
        }
      }
      if (values[A - 1] == values[i]) {
        same_num++;
      }
    }
    nums = comb[same_num][selected_num];
  }

  cout << nums << endl;

  return 0;
}


Measured memory_bytes: 256
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n,x,t = miinps()

ans = (n + (x - 1)) // x

ans *= t

print(ans)

Measured memory_bytes: 9080
#include <iostream>
#include<string>
using namespace std;
 
int main() {
	int n;
	cin>>n;
	string a,b,c;
cin>>a>>b>>c;
	int ans=0;
	for(int i=0;i<n;i++){
		if(a[i]==b[i]){
			if(a[i]!=c[i]){ans++;}
		}
		else{
			if(a[i]==c[i]){ans++;}
			else if(b[i]==c[i]){ans++;}
			else{ans+=2;}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256