akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
long long int ans=0;
long long sort(long long d[],int NumberArrays,int up){
  int tmp;
  for (int i = 0; i < NumberArrays-1; i++) {
    if (up && d[i]<d[i+1]) {
      d[i]=tmp;
      d[i]=d[i+1];
      d[i+1]=tmp;
    }else if (d[i]>d[i+1]) {
      d[i]=tmp;
      d[i]=d[i+1];
      d[i+1]=tmp;
    }
  }
}
//最大公約数
long long int getgcd(long long n, long long m)
{
  int r;
  if (n > m) {
    long long t = m;
    m = n;
    n = t;
  }
  while ((r = m % n) != 0) {
    m = n;
    n = r;
  }
return n;
}

//nの階乗を計算
long long factorial(long long n){
    long long int answer = 1;
while(n > 1){
  answer *= n;
  n--;
}
    return answer;
}

//組み合わせの数nCrを計算
long long calcNumOfCombination(long long  n, long long r){
    return factorial(n) / (factorial(r) * factorial(n-r));
}


int main(int argc, char* argv[]){
	double a = 0;
	scanf("%lf",&a);
  printf("%lf\n",a*2*3.141592);
  return 0;
}


Measured memory_bytes: 1740
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vp = vector<pii>;
using vs = vector<string>;
using qi = queue<int>;
using qp = queue<pii>;
using pqi = priority_queue<int>;
using pqim = priority_queue<int, vector<int>, greater<int> >;
using ppp = pair<int, pair<int, int>>;
#define all(vec) vec.begin(), vec.end()
#define rall(vec) vec.rbegin(), vec.rend()
#define pb push_back
const ll mod = 998244353;
//const ll inf = 1e18;
const int inf = 1e9 + 7;
const int mxn = 2e5;


int n, k;
pqim pq;
void input() {
	cin >> n >> k;

	for (int i = 0; i < n; ++i) {
		int x; cin >> x;
		pq.push(x);
	}

}

void solve() {

	int sum = 0;
	for (int i = 0; i < k; ++i) {
		sum += pq.top();
		pq.pop();
	}
	cout << sum;

	return;
}

int main() {
	cin.tie(NULL); ios_base::sync_with_stdio(false);

	input();
	solve();
}

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

bool is_palindromic(int num)
{
	string s = to_string(num);
	for (int i = 0; i < s.size()/2+1; i++) {
		if (s[i] != s[s.size()-1-i])
			return false;
	}

	return true;
}

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

	int count = 0;
	for (int i = a; i <= b; i++) {
		if (is_palindromic(i))
			count++;
	}

	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [A, B] = input[0].map(Number);

  const sum = A + B;

  return sum >= 10 ? "error" : sum;
};

console.log(main(read()));


Measured memory_bytes: 29572
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  string S; cin>>S;
  int Q; cin>>Q;
  bool flag=0;
  vector<string> T(2);
  rep(i,0,Q){
    int f; cin>>f;
    if(f==1){
      flag=!flag;
    }
    else{
      int F; cin>>F;
      F--;
      char X; cin>>X;
      if(F==flag){
        T[0]+=X;
      }
      else{
        T[1]+=X;
      }
    }
  }
  string ans;
  reverse(ALL(T[0]));
  ans+=T[0];
  ans+=S;
  ans+=T[1];
  if(flag) reverse(ALL(ans));
  cout<<ans<<endl;
  }



Measured memory_bytes: 1348
#include<stdio.h>

int main(){
    int a,b;
    long long sum,min,max;
    sum=0;
    scanf("%d",&a);
    int array[a];
    for(int i=0; i<=a-1; i++){
        scanf("%d",&b);
        array[i]=b;
        sum+=b;
    }
    min=max=b;
    for(int i=0; i<=a-1; i++){
        if(min>array[i]){
            min=array[i];
        }
        if(max<array[i]){
            max=array[i];
        }
    }
    printf("%d %d %lld\n",min,max,sum);
    return 0;
}


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

int main(){
  int k,t;
  cin >> k >> t;
  vector<int> a(t);
  int b = 0;
  rep(i,t){
    cin >> a[i];
    b = max(b,a[i]);
  }
  sort(a.rbegin(),a.rend());
  int c = k-b;
  int ans = max(0,b-c-1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
     
    int main(){
        long long int w;
        scanf("%lld",&w);
     
        char name[100];
        int i=0;
        
        while(w!=0)
        {
            w--;
            int b = w%26;
            name[i] ='a'+ b;
            w/=26;
            i++;
        }
     
        for(int j=i-1;j>=0;j--)
        {
            printf("%c",name[j]);
        }
        
        return 0;
    }

Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int A, B, C;
  cin>>A>>B>>C;

  int ans = C - (min(A, C + B) - B);
  cout<<ans<<endl;

  return 0;
}


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

int main() {
  int s, s1, s2, s3;
  cin >> s;
  s1 = s/100;
  s2 = s%100 /10;
  s3 = s%10;
  cout << s1 + s2 + s3 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

LL A, B, K;

int main() {
  scanf("%lld%lld%lld", &K, &A, &B);
  
  LL ans = K+1;
  if (B - A <= 2) {
    printf("%lld\n", ans);
    return 0;
  }

  if (K >= A-1) {
    MX(ans, A + (K-A+1)/2*(B-A) + (K-A+1)%2);
  }
  printf("%lld\n", ans);
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $n);
$words = [];

if ($n < 26) {
  echo chr(96 + $n);
  return;
}

while ($n >= 26) {
  if ($n % 26 == 0) {
    $word_keys[] = 26;
    $n = $n / 26 - 1;
    if ($n != 0 && $n < 26) {
      $word_keys[] = $n;
    }
    continue;
  }
  $word_keys[] = $n % 26;

  $n = floor($n / 26);
  if ($n < 26) {
    $word_keys[] = $n;
  }
}
$word_keys = array_reverse($word_keys);

foreach ($word_keys as $key) {
  echo chr(96 + $key);
}

Measured memory_bytes: 16008
#include <stdio.h>

int main() {
    int cnt = 0;
    int N;
    scanf("%d", &N);

    int judge[100] = {0};
    int d[N];
    for (int i = 0; i < N; i++) {
        scanf("%d", &d[i]);
    }

    for (int i = 0; i < N; i++) {
        if (!(judge[d[i]-1])) {
            cnt++;
            judge[d[i]-1] = 1;
        }
    }

    printf("%d\n", cnt);
    return 0;
}

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

int main(){
    double N; cin >> N;
    int tmp=floor(N/1.08);
    if(N==floor(tmp*1.08)) cout << tmp;
    else if(N==floor((tmp+1)*1.08)) cout << tmp+1;
    else cout << ":(";
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    S=list(input())
    S=list(map(ord,S))
    for i in range(len(S)):
        s=S[i]
        S[i]=65+(s+n-65)%26
    S=list(map(chr,S))
    print(''.join(S))
resolve()

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

int main() {
	ios_base::sync_with_stdio( false );

	string A, B, C;
	cin >> A >> B >> C;

	bool result = A.back() == B.front() && B.back() == C.front();
	cout << (result ? "YES" : "NO") << endl;

	return 0;
}


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

int main(){
  int64_t N;
  cin >> N;
  
  int64_t a = 0;
  int64_t b = 0;
  for(int64_t i=1; i<= sqrt(N); i++){
    if(N %i == 0){
      a = i;
      b = N/i;
    }
  }
  int c = max(a,b);
  int ans = 0;
  
  while(c){
    c = c /10;
    ans++;
  }
  cout << ans << endl;   
}

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

using namespace std;

long long lc[90];

long long lucas(int n) {
    if (lc[n]) return lc[n];
    if (n == 0) return 2;
    if (n == 1) return 1;
    return lc[n] = lucas(n - 1) + lucas(n - 2);
}

int main() {
    int n;
    cin >> n;
    cout << lucas(n) << endl;
    return 0;
}


Measured memory_bytes: 256
#![allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}
fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn mod_pow(mut x: i64, mut n: i64, p: i64) -> i64 {
    let mut ret = 1;
    while n > 0 {
        if n & 1 != 0 {
            ret = (ret * x) % p;
        }
        x = (x * x) % p;
        n >>= 1;
    }
    ret
}
fn main() {
    let n: i64 = read();
    let m = 1000000007;
    let mut ans = (mod_pow(10, n, m) + mod_pow(8, n, m) - mod_pow(9, n, m) - mod_pow(9, n, m)) % m;
    ans = (ans + m) % m;
    println!("{}", ans);
}


Measured memory_bytes: 2116
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    string s, t;
    cin >> s >> t;
    sort(whole(s));
    sort(whole(t));
    reverse(whole(t));
    string ans = "No";
    if (s<t) ans = "Yes";
    
    cout << ans << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,N) for(ll i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n,p;
bool is_prime[200100];
vector<ll> prime;

void sieve(){
    rep(i,200000)is_prime[i] = 1;
    is_prime[0] = is_prime[1] = 0;
    for(ll i = 2;i <= 200000;i++){
        if(is_prime[i]){
            prime.push_back(i);
            for(ll j = 2*i;j <= 200000;j += i)is_prime[j] = 0;
        }
    }
}

int main(){
    sieve();
    while(cin >> n >> p && n != -1){
        auto it = upper_bound(ALL(prime),n);
        ll b = it - prime.begin();
        vector<ll> ans;
        for(int i = 0;i <= 100;i++){
            for(int j = i;j <= 100;j++){
                ans.push_back(prime[i+b]+prime[j+b]);
            }
        }   
        sort(ALL(ans));
        // rep(i,p){
        //     cout << ans[i] << " ";
        // }
        // cout << endl;
        cout << ans[p-1] << endl;
    }

}


Measured memory_bytes: 3372
def solver():
    N = int(input())
    ans = []
    for i in range(1, N+1):
        s, p = [n for n in input().split()]
        ans.append({'id': i, 'city': s , 'point': int(p)})
    ans_s = sorted(ans, key=lambda x: (x['city'], -x['point']))
    for j in ans_s:
        print(j['id'])

if __name__=='__main__':
    solver()


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

int main() {
   int n;
   cin >> n;
   if(n%10==2 || n%10==4 || n%10==5 ||n%10==7 ||n%10==9){
        cout << "hon" << endl;
   }
   if(n%10==0 || n%10==1 || n%10==6 ||n%10==8){
      cout << "pon" << endl;
   }
   if(n%10==3){
      cout << "bon" << endl;
   }
return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

int N, K;
int A[10], C[10];

int sub(int s) {
  int ans = 0;
  int p = 0;
  for (int i = 0; i < N; ++i) {
    if ((s >> i) & 1) {
      ans += A[i];
      p += A[i] * (i + 1) * 100 + C[i];
    }
  }
  
  vector<int> vec;
  for (int i = 0; i < N; ++i) {
    if ((s >> i) & 1) continue;
    for (int z = 0; z < A[i]; ++z) {
      vec.push_back((i + 1) * 100);
    }
  }
  reverse(vec.begin(), vec.end());
  
  int i = 0;
  while (p < K && i < vec.size()) {
    p += vec[i];
    ++ans;
    ++i;
  }
  return ans;
}

int main() {
  cin >> N >> K;
  for (int i = 0; i < N; ++i) {
    cin >> A[i] >> C[i];
  }
  
  int mn = 1e9;
  for(int s = 0; s < (1 << N); ++s) {
    mn = min(sub(s), mn);
  }
  cout << mn << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <sstream>

using namespace std;

int order[100000][3];

bool check_r[100000];
bool check_c[100000];

int main(){
	
	int r, c, q;
	
	while(true){
		
		cin >> r >> c >> q;
		
		if(r == 0 && c == 0 && q == 0){
			break;
		}
		
		for(int i = 0; i < 100000; i++){
			check_r[i] = false;
			check_c[i] = false;
		}
		
		for(int i = 0; i < q; i++){
			cin >> order[i][0] >> order[i][1] >> order[i][2];
		}
		
		long long int r_rest = c;
		long long int c_rest = r;
		
		long long int ans = 0;
		
		for(int i = q - 1; i >= 0; i--){
			if(order[i][0] == 0){
				if(!check_c[order[i][1]]){
					if(order[i][2] == 1){
						ans += r_rest;
					}
					check_c[order[i][1]] = true;
					c_rest--;
				}
			}else{
				if(!check_r[order[i][1]]){
					if(order[i][2] == 1){
						ans += c_rest;
					}
					check_r[order[i][1]] = true;
					r_rest--;
				}
			}
		}
		
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3828
import scala.io.StdIn._
import scala.annotation.tailrec

object Main {

  trait Monoid[A]{
    def op(a1: A, a2: A): A
    def zero: A
  }

  type Per = List[Int]
  type Rot = Dice => Dice

  object DiceRoll extends Monoid[Rot]{

    def op(rot1: Rot, rot2: Rot): Rot = (dice: Dice) => rot2(rot1(dice))
    def zero: Rot = (dice: Dice)=>dice

    val north = List(2,6,3,4,1,5).map(_ - 1)
    val east = List(4,2,1,6,5,3).map(_ - 1)
    val ccw = List(1,4,2,5,3,6).map(_ - 1)

    def rot(perm: Per): Rot = (dice: Dice) => Dice(perm.map(dice.pip))

    def axial(f: Rot): List[Rot] = List(zero,f,op(f,f),op(op(f,f),f))

    def enumerateTop(f: Rot = zero, n: Int = 6): List[Rot] = {
      if(n<=0)List[Rot]()
      else if(n%2==0) f :: enumerateTop(op(f,rot(north)),n-1)
      else f :: enumerateTop(op(f,rot(east)),n-1)
    }

    def enumerate: List[Rot] = enumerateTop().flatMap( e => axial(rot(ccw)).map(op(e,_)))
  }

  case class Dice(pip: List[Int]){
    lazy val all: List[Dice] = DiceRoll.enumerate.map(_(Dice(pip)))
    def ===(that: Dice): Boolean = pip == that.pip
    def ==(that: Dice): Boolean = all.exists(_ === that)
  }

  def main(args: Array[String]): Unit = {
    val Array(n,_*) = readLine.split(" ").map(_.toInt)
    val dices = for(i <- 1 to n) yield Dice(readLine.split(" ").map(_.toInt).toList)

    val res = for{
      i <- 0 until n
      j <- 0 until n
      if i<j
    } yield dices(i) == dices(j)

    println( if(res.fold(false)(_ | _)) "No" else "Yes")
  }
}

Measured memory_bytes: 50556
n=int(input())
s=input()

dict={'R':1,'G':2,'B':3}
num={1:'R',2:'G',3:'B'}

snum=[[0,0,0] for i in range(n)]
for i in range(n):
    if i == 0:
        snum[0][dict[s[i]]-1] = 1
        continue
    for j in range(3):
        if dict[s[i]]-1 == j:
            snum[i][j] = snum[i-1][j] + 1
        else:
            snum[i][j] = snum[i-1][j]
#print(snum)
ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        temp=s[i]
        temp1=s[j]
        if temp == temp1:continue

        temp_num=6-dict[temp]-dict[temp1]
        temp2=num[temp_num]
        count=snum[-1][temp_num-1]-snum[j][temp_num-1]
        #print(count)
        if 2*j-i<n and s[2*j-i] == temp2:
            count-=1
        ans+=count
print(ans)

Measured memory_bytes: 74780
a, b, c = map(int, input().split())

count = 0

for _ in range(1000000):
    
    _a, _am = divmod(a, 2)
    _b, _bm = divmod(b, 2)
    _c, _cm = divmod(c, 2)

    if _am or _bm or _cm:
        print(count)
        break
    elif a == b == c:
        print(-1)
        break
    else:
        a = _b + _c
        b = _a + _c
        c = _a + _b
        count += 1
else:
    print(-1)

Measured memory_bytes: 3064
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

tmp_heap = []
while True:
    input_str = input()
    if input_str[2] == 'd':
        break

    if input_str[0] == 'i':
        heappush(tmp_heap,-int(input_str[7:]))
    else:
        print("%d"%(-heappop(tmp_heap)))




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

class Stack{
    public:
    int top,Max;
    int *Cap;
    Stack(int n){//nは容量
        top=0;
        Max=n+1;//0は余らせておく
        Cap=new int[Max];//0を入れておく
    }
bool isEmpty(){
    return top==0;
}
bool isFull(){
    return top>=Max-1;
}
int pop(){
    top--;
    return Cap[top+1]; 
}
void push(int x){
    top++;
    Cap[top]=x;
}
void Sortir(){
    delete[] Cap;
}
};

int main(){
    string x;//数字は2つしか連続しないのか、そんな...
    Stack S(200);
    while(cin>>x){
        if(x=="+"){
            S.push(S.pop()+S.pop());
        }
        else if(x=="-"){
            int a=S.pop();
            int b=S.pop();
            S.push(b-a);
        }
        else if(x=="*"){
            S.push(S.pop()*S.pop());
        }
        else{
            S.push(atoi(x.c_str()));
        }
    }
    cout<<S.pop()<<endl;
    S.Sortir();
    return 0;
}


Measured memory_bytes: 3176
#include <iostream>

using namespace std;

void print(int *p, int n)
{
    cout << p[0];
    for (int i = 1; i < n; i++) cout << " " << p[i];
    cout << endl;
}

int bubblesort(int *p, int n)
{
    int i, v;
    bool flag = true;
    int count = 0;
    while (flag)
    {
        flag = false;
        for (i = n - 1; i >= 1; i--)
        {
            if (p[i] < p[i - 1])
            {
                v = p[i];
                p[i] = p[i - 1];
                p[i - 1] = v;
                count++;
                flag = true;
            }
        }
    }
    return count;
}

int main(void)
{
    int A[100];
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    int count = bubblesort(A, N);
    print(A, N);
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3108
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cmath>

using namespace std;

int main(){
    int D,N;   
    cin>>D>>N;
    if(N==100) N=101;
    int ans=pow(100,D)*N;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
	int K; cin >> K;
	string S; cin >> S;
	if (S.length() <= K) cout << S << endl;
	else cout << S.substr(0, K) << "..." << endl;
	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)

int main(){

    fast;
    int T;
    T=1;
    //cin>>T;
    while(T--){
    	ll n,i,j;
    	cin>>n;
    	map<ll,ll>m;
    	ll sum=0;
    	for(i=0;i<n;i++)
    	{
    		ll x;
    		cin>>x;
    		m[x]++;
    		sum+=x;
		}
		ll q;
		cin>>q;
		while(q--)
		{
			ll b,c;
			cin>>b>>c;
			if(m.find(b)!=m.end())
			{
				sum=sum-b*m[b];
				sum=sum+c*m[b];
				m[c]+=m[b];
				m.erase(b);
				
			}
		    cout<<sum<<"\n";
			
		}


    }

}

Measured memory_bytes: 7544
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <iomanip>
using namespace std;

int n;
int a[200010];
pair<int, int> pa[200010];

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    pa[i] = make_pair(a[i], i);
  }

  sort(pa, end(pa));
  reverse(pa, end(pa));

  for(int i = 0; i < n; i++) {
    if (pa[0].second == i) {
      cout << pa[1].first << endl;
    } else {
      cout << pa[0].first << endl;
    }
  }

}


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

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

  for(int i = 0; i < s.size(); i++){
    if(s[i] == ',') cout << " ";
    else cout << s[i];
  }

  cout << endl;

  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>

using namespace std;

typedef long long ll;

string s;
map<ll, ll> ma;
ll d[200005];
ll ans;

int main()
{
    cin>>s;
    ll now = 1;
    ma[0]++;
    for(ll i = s.size() - 1; i >= 0; i--)
    {
        d[i] = d[i + 1] + now * (s[i] - '0');
        d[i] %= 2019;
        now *= 10;
        now %= 2019;
        ans += ma[d[i]];
        ma[d[i]]++;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 5444
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
//map.containsKey(A)

//Map<String, Integer> map = new HashMap<String, Integer>(n);
/*for ( キーのデータ型 key : マップの名前.keySet() ) {
	データのデータ型 data = マップの名前.get( key );
	
	// keyやdataを使った処理;
}*/
//int i = Integer.parseInt(s);

//ArrayList<String> cc = new ArrayList<>(n);
//Collections.sort(list);
//Array.sort(list);
//Arrays.asList(c).contains("a")
//list.set(1,"walk");
public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static String s;
	static String g;
	static int a[]=new int[4];
	public static void main(String[] args) {
		int a=0;
		String S=sc.next();
		boolean aa=false;
		if(S.charAt(0)==65) {
			a=S.indexOf("C",2);
			int b=S.lastIndexOf("C",S.length()-2);
			if(a!=-1&&b!=-1) {
				if(a==b) {
					aa=true;
				}
			}
		}
		
		if(aa) {
			boolean wa=false;
			for(int i=0;i<S.length();i++) {
				if(i==0||i==a) {
					
				}else {
					if(!(S.charAt(i)>=97)) {
						wa=true;
					}
				}
				
			}
			if(wa) {
				p("WA");
			}else {
				p("AC");
			}
		}else {
			p("WA");
		}

	}
	static boolean dfs(int b,int sum,String v) {
		g=v;
		if(b==4)return sum==7;
		if(dfs(b+1,sum+a[b],v+"+"))return true;
		if(dfs(b+1,sum-a[b],v+"-"))return true;
		return false;
	}
	

	
	
	
}


Measured memory_bytes: 22868
#include<bits/stdc++.h>
#define INF            1e9
#define REP(i,n)       for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)      for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPI(i,ini,n)  for(lint i=(ini),i##_len=(n);i<i##_len;++i)
#define REPR(i,n)      for(lint i=(n)-1;i>=0;--i)
#define REPR1(i,n)     for(lint i=(n);i>0;--i)
#define REPRI(i,ini,n) for(lint i=(ini)-1,i##_len=(n);i>=i##_len;--i)
#define REPC(i,obj)    for(auto i:obj)
#define R_UP(a,b)      (((a)+(b)-1)/(b))
#define ALL(obj)       (obj).begin(),(obj).end()
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
signed main()
{
	int n = in();
	int ans = 0;
	REP(i, n)ans += in() - 1;
	cout << ans << endl;
}

Measured memory_bytes: 256
// I love
// Chemise Blanche

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  string s, t;
  cin >> s >> t;
  vector<string> res;
  for (int i = 0; i < s.size() - t.size() + 1; i++) {
    string l = s;
    int b = 1;
    for (int j = 0; j < t.size(); j++) {
      if (l[i + j] == '?') l[i + j] = t[j];
      if (l[i + j] != t[j]) {
        b = 0;
        break;
      }
    }
    if (b) {
      for (auto &j : l) {
        if (j == '?') j = 'a';
      }
      res.push_back(l);
    }
  }
  if (res.empty()) {
    cout << "UNRESTORABLE" << '\n';
    return;
  }
  sort(all(res));
  cout << res.front() << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3648
import sys
input = sys.stdin.readline
INF = 10**18
sys.setrecursionlimit(10**6)

def li():
    return [int(x) for x in input().split()]


N = int(input())

X, Y = [], []
for i in range(N):
    x, y = li()
    X.append(x)
    Y.append(y)


def maxAbsValExpr(arr1, arr2):
    maxVal = 0
    for x, y in [[1, 1], [1, -1], [-1, -1], [-1, 1]]:
        distances = [x * arr1[i] + y * arr2[i] for i in range(len(arr1))]
        maxVal = max(maxVal, max(distances) - min(distances))
    return maxVal

ans = maxAbsValExpr(X, Y)
print(ans)

Measured memory_bytes: 146688
using System;

namespace AtCoder0627
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string t = Console.ReadLine();

            char[] sc = s.ToCharArray();
            char[] tc = t.ToCharArray();

            int ans = 0;

            for(var i =0; i<sc.Length; i++)
            {
                if(sc[i] != tc[i]) { ans++; }
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 28312
<?php
// Here your code !
$split_data = explode(" ",trim(fgets(STDIN)));
$tate = $split_data[0];
$yoko = $split_data[1];

$result[0] = $tate * $yoko;
$result[1] = 2 * $tate + 2 * $yoko;

echo implode(" ",$result);
?>

Measured memory_bytes: 15332
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define ALL(n) begin(n),end(n)

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


Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,r1,r2,r3;
  cin >>a >>b;
  r1=a*b;
  r2=(a+b);
  r3=(a-b);
  if (r1>=r2 && r1>=r3)
    cout <<r1<<"\n";
  else if (r2>=r1 && r2>=r3)
    cout << r2<<"\n";
  else
    cout << r3 <<"\n";
}

Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    String s;
    char[] c;
    int i, joi, ioi;

    for(;sc.hasNextLine();){
      s = sc.nextLine();
      c = new char[s.length()];
      for(i = 0;i < s.length();i++)c[i] = s.charAt(i);
      joi = 0; ioi = 0;
      for(i = 0;i < s.length() - 2;i++){
        if(c[i] == 'J' && c[i + 1] == 'O' && c[i + 2] == 'I'){joi++; i++;}
        else if(c[i] == 'I' && c[i + 1] == 'O' && c[i + 2] == 'I'){ioi++; i++;}
      }
      out.println(joi);
      out.println(ioi);
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 20496
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long long unsigned int ull;
#define INF 1LL << 29
// 1 1 1 1 1
// 1 2 3 4 5
// 1 3 6 10 15
// 1 4 10 20 35
// 1 5 15 35 70
//
int main(){
	ll H, W;
	cin >> H >> W;
	ll ans = INF;
	//よこ,たてに三等分
	if (W % 3 == 0)ans = 0;
	else ans = min(ans, H);
	if (H % 3 == 0)ans = 0;
	else ans = min(ans, W);
	for (int i = 1; i < W; i++) {
		if (H % 2 == 0) {
			ll a = i*H, b = (H / 2)*(W - i);
			ans = min(ans, abs(a - b));
		}
		else {
			ll a = i*H, b = (H / 2)*(W - i), c = ((H / 2) + 1)*(W - i);
			ll mn = min(min(a, b), c), mx = max(max(a, b), c);
			ans = min(ans, abs(mx - mn));
		}
	}
	for (int i = 1; i < H; i++) {
		if (W % 2 == 0) {
			ll a = i*W, b = (W / 2)*(H - i);
			ans = min(ans, abs(a - b));
		}
		else {
			ll a = i*W, b = (W / 2)*(H - i), c = ((W / 2) + 1)*(H - i);
			ll mn = min(min(a, b), c), mx = max(max(a, b), c);
			ans = min(ans, abs(mx - mn));
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int e[15];
	int i,cnt;
	for(i=0;i<12;i++) cin>>e[i];
	sort(e,e+12);
	cnt=0;
	for(i=1;i<4;i++){
		if(e[0]!=e[i]) break;
		cnt++;
	}
	for(i=5;i<8;i++){
		if(e[4]!=e[i]) break;
		cnt++;
	}
	for(i=9;i<12;i++){
		if(e[8]!=e[i]) break;
		cnt++;
	}
	if(cnt==9) cout<<"yes"<<endl;
	else cout<<"no"<<endl;
	return 0;
}


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

int main(){
  int A,B,C,X,Y;
  cin>>A>>B>>C>>X>>Y;
  int ans=A*X+B*Y;
  if(X>Y){
    ans=min(ans,2*X*C);
    ans=min(ans,2*Y*C+A*(X-Y));
  }else{
    ans=min(ans,2*Y*C);
    ans=min(ans,2*X*C+B*(Y-X));
  }
  cout<<ans<<endl;
}


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

const int N = 2e5 + 10;

int a[N];
int sum[25][N];

int main(){
	int n, rec, d;
	long long ans;
	scanf("%d",&n);
	for (int i = 1; i <= n; i++) scanf("%d",&a[i]);
	for (int i = 1; i <= n; i++){
		for (int j = 0; j <= 19; j++){
			if (a[i] & (1 << j)) sum[j][i] = 1;
			else sum[j][i] = 0;
		}
	}
	for (int i = 0; i <= 19; i++){
		sum[i][0] = 0;
		for (int j = 1; j <= n; j++)
			sum[i][j] += sum[i][j - 1];
	}
	ans = 0;
	for (int i = 1; i <= n; i++){
		rec = n;
		for (int j = 0; j <= 19; j++){
			d = upper_bound(sum[j] + 1, sum[j] + n + 1, sum[j][i - 1] + 1) - sum[j];
			rec = min(rec, d - 1);
		}
		ans += rec - i + 1;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 17408
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#endif

#define ITER(c)         __typeof__((c).begin())
#define FOREACH(it, c)  for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)        __typeof__((c).rbegin())
#define RFOREACH(it, c) for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)       REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)
#define REVREP(i, n)    for (int i = ((n)-1); i >= 0; --i)
#define FIND(c, n)      std::find((c).begin(), (c).end(), (n));
#define BSEARCH(c, n)   std::binary_search((c).begin(), (c).end(), (n))
#define LLPOW(p1,p2)    ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)      (sizeof(A)/sizeof((A)[0]))
#define MIN(p1,p2)      (((p1)<(p2))?(p1):(p2))
#define MAX(p1,p2)      (((p1)>(p2))?(p1):(p2))
#define CIN_NO_SYNC     do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)       fgets((p), sizeof(p), stdin)
#define CHOMP(p)        do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n') *_q = 0; } while(0)

typedef double D;
D cosine_theorem(D length_a, D length_b, D degree_c){
    return sqrt( length_a * length_a + length_b * length_b
        -2 * length_a * length_b * cos(degree_c / 180.0 * M_PI) );
}

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

    double c = cosine_theorem(a,b,degc);

    double h = b * sin(degc / 180.0 * M_PI);
    double S = a * h / 2;
    double L = a + b + c;

    printf("%.9f\n", S);
    printf("%.9f\n", L);
    printf("%.9f\n", h);

    return 0;
}

Measured memory_bytes: 1244
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class AABCSwap {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            int[] a = new int[3];
            for (int i = 0; i < 3; i++)
                a[i] = s.nextInt();
            int temp = a[0];
            a[0] = a[1];
            a[1] = temp;
            temp = a[0];
            a[0] = a[2];
            a[2] = temp;
            for (int i = 0; i < 3; i++)
                w.print(a[i] + " ");
            w.println();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            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 int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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

string x;
int m=0;

signed main(){
    cin>>x;
    for(int i=0;i<x.size();++i){
        m+=x[i]-'0';
        m%=9;
    }
    if(m==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

#define endl '\n'

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string number;
    cin >> number;
    if(number.find("7") != string::npos)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3652
#include <cstdio>
using namespace std;
int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= 9; ++i)
	{
		if(n % i == 0 && n / i >= 1 && n / i <= 9)
		{
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
import sys

for line in sys.stdin:
    line = line.strip()
    i = 0
    ans = ""
    while i < len(line):
        if line[i] == "@":
            m = int(line[i+1])
            c = line[i+2]
            i += 3
            ans += m*c
        else:
            ans += line[i]
            i += 1
    print(ans)

Measured memory_bytes: 7596
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

#bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す
#bisect.bisect_right(list, key)はlistのなかでkey以下の数字がいくつあるかを返す
#これを応用することで
#len(list) - bisect.bisect_left(list,key)はlistのなかでkey以上の数字がいくつあるかを返す
#len(list) - bisect.bisect_right(list,key)はlistのなかでkeyより大きい数字がいくつあるかを返す
#これらを使うときはあらかじめlistをソートしておくこと！
n,m,k = MI()
a = LI()
b = LI()
a_cum = [0]
b_cum = [0]
ans = 0
for i in range(1,n+1):
    a_cum.append(a[i-1]+a_cum[i-1])
for i in range(1,m+1):
    b_cum.append(b[i-1]+b_cum[i-1])
for i in range(m+1):
    K = k-b_cum[i]
    if K >= 0:
    #K以下で最大のa_cum[j]を求め出力するのはi+j
      j = bisect.bisect_right(a_cum, K) - 1
      ans = max(ans,i+j)
print(ans)



Measured memory_bytes: 48428
#include <bits/stdc++.h>
#define INF 1e9
#define MOD 1000000007
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main(void) {
    string s;
    cin >> s;
    if(s[s.size() - 1] == 's'){
        s.push_back('e');
        s.push_back('s');
    } else {
        s.push_back('s');
    }

    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef signed long long ll;
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) for(i=1;i<=n;i++)

int main(){
	int i,j,k,n,m,l,f,y,z; string s;
	int t[105]={0};
	int p[105]={0}, x[105]={0};
	cin >> n;
	rep(i, n) cin >> t[i];
	cin >> m;
	rep(i, m){
		cin >> p[i] >> x[i];
	}	

	int sum[105]={0};
	rep(i, m){
		rep(j, n){
			if(p[i] == j+1){
				sum[i] += x[i];
				continue;
			}
			sum[i] += t[j];
		}
	}

	rep(i, m) cout << sum[i] << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();
        
        long a = (n + k - 1) / k;
        
        System.out.println(Math.min(n, Math.abs(n-k*a)));
    }
}


Measured memory_bytes: 23636
import copy
N = int(input())
p = list(map(int, input().split()))

is_asc = True

for k in range(N-1):
  if p[k] > p[k+1]: is_asc = False

if is_asc == True:
    print('YES')
else:
  for i in range(N):
      for j in range(N):
          if i == j: continue
          is_asc = True
          tmp_p = copy.deepcopy(p)
          tmp = p[i]
          tmp_p[i] = p[j]
          tmp_p[j] = tmp
          for k in range(N-1):
              if tmp_p[k] > tmp_p[k+1]: is_asc = False
          if is_asc == True:
              break
      if is_asc == True:
          break

  if is_asc == True:
      print('YES')
  else:
      print('NO')

Measured memory_bytes: 3444
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
char s[105];int n;
int main(){
	scanf("%s",s+1),n=strlen(s+1);
	fp(i,1,n){
		if((i&1)&&s[i]=='L')return puts("No"),0;
		if((i&1^1)&&s[i]=='R')return puts("No"),0;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int n;
    cin >> n;
    map<ll, ll> a;
    rep(i, n){
        int x;
        cin >> x;
        a[x]++;
    }
    vector<ll> maxim;
    for(const auto& [key, value] : a){
        if(value>=2){
            maxim.push_back(key);
        }
    }
    ll mlen = maxim.size();
    if(mlen<2){
        cout << 0 << endl;
    }else{
        sort(maxim.begin(), maxim.end());
        if(a[maxim[mlen-1]]>=4){
            cout << maxim[mlen - 1] * maxim[mlen - 1] << endl;
        }else{
            cout << maxim[mlen - 1] * maxim[mlen - 2] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 9800
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;
using ll = long long;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
///////////////////////////////////////////////



int main() {
    int k; cin >> k;
    vector<ll> a(k);
    rep(i,k) cin >> a[i];
    ll mx = 2, mn = 2;
    repr(i,k-1) {
        if (mx%a[i]!=0 && mn%a[i]!=0 && mx/a[i] == mn/a[i]) {
            cout << -1 << endl;
            return 0;
        }
        mx = mx/a[i]*a[i]+a[i]-1;
        mn = (mn+a[i]-1)/a[i]*a[i];
    }
    cout << mn << " " << mx << endl;
    return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast","inline")
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof (x))
#define For(i,a,b) for (int i=a;i<=b;i++)
#define Fod(i,b,a) for (int i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define _SEED_ ('C'+'L'+'Y'+'A'+'K'+'I'+'O'+'I')
#define outval(x) printf(#x" = %d\n",x)
#define outvec(x) printf("vec "#x" = ");for (auto _v : x)printf("%d ",_v);puts("")
#define outtag(x) puts("----------"#x"----------")
#define outarr(a,L,R) printf(#a"[%d...%d] = ",L,R);\
						For(_v2,L,R)printf("%d ",a[_v2]);puts("");
using namespace std;
typedef long long LL;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f|=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int N=100005,mod=1e9+7;
int cnt[26];
char s[N];
int n;
int main(){
	n=read();
	scanf("%s",s+1);
	For(i,1,n)
		cnt[s[i]-'a']++;
	int ans=1;
	For(i,0,25)
		ans=(LL)ans*(cnt[i]+1)%mod;
	ans=(ans-1+mod)%mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace AC
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadLong();
            var A = ReadArrayLong();
            var cnt = new long[100001];
            long sum = A.Sum();
            for (int i = 0; i < N; i++) cnt[A[i]]++;
            var Q = ReadLong();
            for (int i = 0; i < Q; i++)
            {
                var input = ReadArrayLong();
                var B = input[0];
                var C = input[1];
                var cntB = cnt[B];
                sum -= B * cntB;
                sum += C * cntB;
                cnt[C] += cntB;
                cnt[B] = 0;
                Console.WriteLine(sum);
            }

            Console.WriteLine();
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static string[] ReadArrayString() { return Read().Split(' '); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 45584