akhauriyash/Code-Regression huggingface dataset:
{-# LANGUAGE BangPatterns, OverloadedStrings, MultiWayIf #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Int
import Data.Foldable
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import Data.ByteString.Internal (accursedUnutterablePerformIO)
import qualified Data.Set as S
import System.IO.Unsafe
import Debug.Trace

unew :: VUM.Unbox a => Int -> VUM.IOVector a
unew !n = accursedUnutterablePerformIO $ VUM.unsafeNew n

uread :: VUM.Unbox a => Int -> VUM.IOVector a -> a
uread !i !v = accursedUnutterablePerformIO $ VUM.unsafeRead v i

uwrite :: VUM.Unbox a => Int -> a -> VUM.IOVector a -> VUM.IOVector a
uwrite !i !a !v =
  accursedUnutterablePerformIO $ VUM.unsafeWrite v i a >> return v

uthaw :: VUM.Unbox a => VU.Vector a -> VUM.IOVector a
uthaw !v = accursedUnutterablePerformIO $ VU.unsafeThaw v

ufreeze :: VUM.Unbox a => VUM.IOVector a -> VU.Vector a
ufreeze !v = accursedUnutterablePerformIO $ VU.unsafeFreeze v

uset :: VUM.Unbox a => a -> VUM.IOVector a -> VUM.IOVector a
uset !a !v = accursedUnutterablePerformIO $ VUM.set v a >> return v

solve :: B.ByteString -> B.ByteString -> B.ByteString
solve !s !t = walk
 where
  toIndex !i !j = j * succ (B.length s) + i

  ifoldlB' :: (a -> Int -> Char -> a) -> a -> B.ByteString -> a
  ifoldlB' !f !x !bs = snd $ B.foldl'
    ( \(!i, !acc) !ch ->
      let i'   = i + 1
          acc' = f acc i ch
      in  i' `seq` acc' `seq` (i', acc')
    )
    (0, x)
    bs

  dp :: VU.Vector Int16
  dp = ufreeze $ ifoldlB'
    ( \(!dp) !i !si -> ifoldlB'
      ( \(!dp) !j !tj -> uwrite
        (toIndex (i + 1) (j + 1))
        ( if si == tj
          then uread (toIndex i j) dp + 1
          else max (uread (toIndex (i + 1) j) dp) (uread (toIndex i (j + 1)) dp)
        )
        dp
      )
      dp
      t
    )
    (uset 0 (unew $ succ (B.length s) * succ (B.length t)))
    s

  walk =
    fst
      $ B.unfoldrN (fromIntegral $ dp VU.! toIndex (B.length s) (B.length t))
                   (\(x:xs) -> Just $ (,) (B.index s x) xs)
      $ fst
      $ flip fix ([], (B.length s, B.length t))
      $ \(!f) (!acc, (!i, !j)) -> if
          | i == 0 || j == 0 -> (acc, (i, j))
          | s `B.index` (i - 1) == t `B.index` (j - 1) -> f
            ((i - 1) : acc, (i - 1, j - 1))
          | dp VU.! toIndex (i - 1) j < dp VU.! toIndex i (j - 1) -> f
            (acc, (i, j - 1))
          | otherwise -> f (acc, (i - 1, j))


main = do
  s <- B.getLine
  t <- B.getLine
  B.putStrLn $ solve s t


Measured memory_bytes: 19452
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <math.h>
#include <map>
#include <time.h>
#include <iomanip>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int ad[200005];
int aa[200005];

signed main() {
    int n, k;
    int ans = 0;
    cin >> n >> k;

    ad[0] = n;

    rep(i, 0, n) {
        aa[i + 1] = aa[i] + (i + 1);
        ad[i + 1] = ad[i] + (n - (i + 1));
    }

    rep(i, k - 1, n + 1) {
        ans = (ans + ad[i] - aa[i] + 1) % mod;
    }

    cout << ans << endl;
}


Measured memory_bytes: 6784
#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
using lint = long long;
using pi = pair<int, int>;
const int MAXN = 200005;
 

typedef long long ll;

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
	string s;
	ll l;
	cin >> l;
	cin >> s;
	ll len = s.length();
	if(len <= l) cout << s <<endl;
	else cout << s.substr(0, l) + "..." << endl;
  return 0;
}

/*
         ,--"""",--.__,---[],-------._         
       ,"   __,'            \         \--""""""==;-
     ," _,-"  "/---.___     \       ___\   ,-'',"
    /,-'      / ;. ,.--'-.__\  _,-"" ,| `,'   /
   /``""""-._/,-|:\       []\,' ```-/:;-. `. /
             `  ;:::      ||       /:,;  `-.\
                =.,'__,---||-.____',.=
                =(:\_     ||__    ):)=
               ,"::::`----||::`--':::"._
             ,':::::::::::||::::::::::::'.
    .__     ;:::.-.:::::__||___:::::.-.:::\     __,
       """-;:::( O )::::>_|| _<::::( O )::::-"""
   =======;:::::`-`:::::::||':::::::`-`:::::\=======
    ,--"";:::_____________||______________::::""----.          , ,
         ; ::`._(    |    |||     |   )_,'::::\_,,,,,,,,,,____/,'_,
       ,;    :::`--._|____[]|_____|_.-'::::::::::::::::::::::::);_
      ;/ /      :::::::::,||,:::::::::::::::::::::::::::::::::::/
     /; ``''''----------/,'/,__,,,,,____:::::::::::::::::::::,"
     ;/                :);/|_;| ,--.. . ```-.:::::::::::::_,"
    /;                :::):__,'//""\\. ,--.. \:::,:::::_,"
   ;/              :::::/ . . . . . . //""\\. \::":__,"
   ;/          :::::::,' . . . . . . . . . . .:`::\
   ';      :::::::__,'. ,--.. . .,--. . . . . .:`::`
   ';   __,..--'''-. . //""\\. .//""\\ . ,--.. :`:::`
   ;    /  \\ .//""\\ . . . . . . . . . //""\\. :`::`
   ;   /       . . . . . . . . . . . . . . . . .:`::`
   ;   (          . . . . . . . . . . . . . . . ;:::`
   ,:  ;,            . . . . . . . . . . . . . ;':::`
   ,:  ;,             . . . . . . . . . . . . .;`:::
   ,:   ;,             . . . . . . . . . . . . ;`::;`
    ,:  ;             . . . . . . . . . . . . ;':::;`
     :   ;             . . . . . . . . . . . ,':::;
      :   '.          . . . . . . . .. . . .,':::;`
       :    `.       . . . . . . . . . . . ;::::;`
        '.    `-.   . . . . . . . . . . ,-'::::;
          `:_    ``--..___________..--'':::::;'`
             `._::,.:,.:,:_ctr_:,:,.::,.:_;'`
________________`"\/"\/\/'""""`\/"\/""\/"____________________________
 
*/


Measured memory_bytes: 3656
#!/usr/bin/env python3
import sys
from collections import Counter

def solve(N: int, a: "List[int]"):
    counter = Counter(a)
    answer = 0
    for key,value in counter.items():
        if key >value:
            answer += value
        else:
            answer += value-key
    print(answer)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 24244
import java.util.Scanner;

public class Main {
	final int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int p = sc.nextInt();
			int n = sc.nextInt();
			if ((p | n) == 0)
				break;
			double max = 0;
			double min = Double.POSITIVE_INFINITY;
			double rp = Math.sqrt(p);
			int a = 1;
			int b = 1;
			int u = 0;
			int v = 0;
			int x = 0;
			int y = 0;
			while (true) {
				if (1.0 * a / b > rp) {
					if (min > 1.0 * a / b) {
						min = 1.0 * a / b;
						x = a;
						y = b;
					}
					b++;
					if (b > n)
						break;
				} else {
					if (max < 1.0 * a / b) {
						max = 1.0 * a / b;
						u = a;
						v = b;
					}
					a++;
					if (a > n)
						break;
				}
			}
			int g1 = gcd(x, y);
			int g2 = gcd(u, v);
			x /= g1;
			y /= g1;
			u /= g2;
			v /= g2;
			System.out.println(x + "/" + y + " " + u + "/" + v);
		}
	}

	int gcd(int a, int b) {
		if (a < b) {
			a = a ^ b;
			b = a ^ b;
			a = a ^ b;
		}
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
int n,a,v;
ll ans,dp[51][2501];
int main()
{
	scanf("%d%d",&n,&a);
	dp[0][0]=1;
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&v);
		for(int j=i;j>=1;--j)
			for(int k=2500;k>=v;--k)
				dp[j][k]+=dp[j-1][k-v]; 
	}
	for(int j=1;j<=n;++j)
		ans+=dp[j][a*j];
	printf("%lld\n",ans);
	return 0;
} 

Measured memory_bytes: 1280
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
vector<int> C[3300];
int A[2000];
vector<int> R[2000];
bool used[2000], dead[2000];

int gcd(int a, int b) {
  if (b==0)return a;
  return gcd(b,a%b);
}

vector<int> prime_list(int x) {
  vector<int> ret;
  for (int p=2; p*p<=x; p++) if (x%p == 0) {
    while (x%p == 0) x /= p;
    ret.pb(p);
  }
  if (x > 1) ret.pb(x);
  return ret;
}
int num = 0;
void dfs(int x);
void dfs2(int p) {
  vector<int> vs(C[p]);
  C[p].clear();
  for (int x : vs) dfs(x);
}
void dfs(int x) {
  assert(!dead[x]);
  if (used[x]) return;
  num--;
  used[x] = true;
  for (int p : R[x]) dfs2(p);
}
vector<int> seq, seqI;
vector<int> seqK[3300];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  vector<int> all;
  rep(i, N) cin >> A[i];
  sort(A, A+N);
  rep(i, N) R[i] = prime_list(A[i]), all.insert(all.end(), all(R[i]));
  sort(all(all)); uniq(all);
  assert(all.size() <= 3300);
  rep(i, N) for (int &x : R[i]) x = index(all, x);

  rep(_, N) {
    num = N-_;
    int m = -1;
    rep(i, N) used[i] = false;
    rep(i, N) if (!dead[i]) for (int p : R[i]) C[p].clear();
    rep(i, N) if (!dead[i]) for (int p : R[i]) C[p].pb(i);
    rep(i, N) if (!dead[i]) {
      int left = -1;
      for (int p : R[i]) if (!seqK[p].empty()) left = max(left, seqK[p].back()+1);
      auto it = lower_bound(all(seqI), left);
      int g = INF;
      if (it != seqI.end()) g = seq[*it];
      if (g >= A[i]) {
        dfs(i);
        if (num == 0) {
          m = i;
          break;
        }
      }
    }
    assert(m != -1);
    while (!seqI.empty() && seq[seqI.back()] >= A[m]) seqI.pop_back();
    seqI.pb(_);
    seq.pb(A[m]);
    dead[m] = true;
    for (int p : R[m]) seqK[p].pb(_);
  }
  rep(i, N) cout << seq[i] << " "; cout << "\n";
  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin >> a >>b>>c>>d;
  while(a > 0 && c > 0){
    a -= d;
    c -= b;
  }
  if(a <= 0 && c <= 0){
    cout << "Yes" << endl;
  }else if(a <= 0){
    cout << "No" << endl;
  }else {
    cout << "Yes";
  }
}
  

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

string pos[12]={"01", "02", "03", "04", "05", "06", "07","08","09","10","11","12"};

bool ok(string S){
    for(int i=0; i<12; i++){
        if(pos[i]==S) return true;
    }
    return false;
}

int main(){
    string S; cin >> S;
    string S1="aa", S2="aa";
    S1.at(0)=S.at(0); S1.at(1)=S.at(1);
    S2.at(0)=S.at(2); S2.at(1)=S.at(3);
    if(ok(S1) && ok(S2)) cout << "AMBIGUOUS" << endl;
    if(ok(S1) && !ok(S2)) cout << "MMYY" << endl;
    if(!ok(S1) && ok(S2)) cout << "YYMM" << endl;
    if(!ok(S1) && !ok(S2)) cout << "NA" << endl;
}

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

int main(){
    int N; cin >> N;
    vector<int> W(N,0);
    int sum = 0;
    for(int i = 0; i < N; i++){
        cin >> W.at(i);
        sum += W.at(i);
    }
    
    int S1 = 0, S2 = 0;
    int ans = 99999999;
    for(int i = 0; i < N; i++){
        S1 += W.at(i);
        S2 = sum - S1;
        ans = min(ans,abs(S1-S2));
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>

int main(){
	using namespace std;
	int a,i,b,r = 0;
	cin >> a;
		for (i = 1; i < 10; i++) {
			b = a / i;
			if (b < 10 && b * i == a && a % i == 0) {
				r++;
			}
		}
		if (r == 0) {
			cout << "No" << endl;
		}
		else {
			cout << "Yes" << endl;
		}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  while (1){
    int N, M;
    cin >> N >> M;
    if (N == 0 && M == 0){
      break;
    }
    vector<int> h(N);
    for (int i = 0; i < N; i++){
      cin >> h[i];
    }
    vector<int> w(M);
    for (int i = 0; i < M; i++){
      cin >> w[i];
    }
    vector<int> S1(N + 1);
    S1[0] = 0;
    for (int i = 0; i < N; i++){
      S1[i + 1] = S1[i] + h[i];
    }
    vector<int> S2(M + 1);
    S2[0] = 0;
    for (int i = 0; i < M; i++){
      S2[i + 1] = S2[i] + w[i];
    }
    map<int, int> mp;
    for (int i = 0; i < N; i++){
      for (int j = i + 1; j <= N; j++){
        mp[S1[j] - S1[i]]++;
      }
    }
    long long ans = 0;
    for (int i = 0; i < M; i++){
      for (int j = i + 1; j <= M; j++){
        ans += mp[S2[j] - S2[i]];
      }
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 20936
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int n[] = new int[a];
		for(int i = 0; i < a; i++){
			n[i] = sc.nextInt();
		}
		int max1,max2;
		if(n[0] >= n[1]){
			max1 = n[0];
			max2 = n[1];
		}
		else{
			max1 = n[1];
			max2 = n[0];
		}
		for(int i = 2; i < a; i++){
			if(max2 < n[i]){
				if(max1 < n[i]){
					max2 = max1;
					max1 = n[i];
				}
				else{
					max2 = n[i];
				}
			}
		}
		for(int i = 0; i < a; i++){
			if(n[i] == max1){
				System.out.println(max2);

			}
			else{
				System.out.println(max1);

			}
		}

	}

}

Measured memory_bytes: 114000
import java.util.*;

public class Main {
    static final int MOD = 1000000007;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<HashMap<Integer, Integer>> list = new ArrayList<>();
		HashMap<Integer, Integer> all = new HashMap<>();
		for (int i = 0; i < n; i++) {
		    HashMap<Integer, Integer> map = getMap(sc.nextInt());
		    for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
		        int key = entry.getKey();
		        int value = entry.getValue();
		        if (!all.containsKey(key) || all.get(key) < value) {
		            all.put(key, value);
		        }
		    }
		    list.add(map);
		}
		long[] tmp = new long[n];
		Arrays.fill(tmp, 1L);
		for (Map.Entry<Integer, Integer> entry : all.entrySet()) {
		    int key = entry.getKey();
		    int value = entry.getValue();
		    for (int i = 0; i < n; i++) {
		        if (list.get(i).containsKey(key)) {
		            tmp[i] *= pow(key, value - list.get(i).get(key));
		        } else {
		            tmp[i] *= pow(key, value);
		        }
		        tmp[i] %= MOD;
		    }
		}
		long ans = 0;
		for (long x : tmp) {
		    ans += x;
		    ans %= MOD;
		}
		System.out.println(ans);
   }
   
   static long pow(long x, long y) {
       if (y == 0) {
           return 1;
       } else if (y % 2 == 0) {
           return pow(x * x % MOD, y / 2);
       } else {
           return pow(x, y - 1) * x % MOD;
       }
   }
    
    static HashMap<Integer, Integer> getMap(int x) {
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 2; i <= Math.sqrt(x); i++) {
            while(x % i == 0) {
                if (map.containsKey(i)) {
                    map.put(i, map.get(i) + 1);
                } else {
                    map.put(i, 1);
                }
                x /= i;
            }
        }
        if (x > 1) {
            if (map.containsKey(x)) {
                map.put(x, map.get(x) + 1);
            } else {
                map.put(x, 1);
            }
        }
        return map;
    }
}



Measured memory_bytes: 64144
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>


using namespace std;


int main(){
    string N;
    cin >> N;
    
    int sum=0;

    for(int i=0;i<N.length();i++)sum += (N[i]-'0');
    if(sum == 1)cout << 10 << endl;
    else cout << sum << endl;

}


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

int main() {
	int l, r, d;
	cin >> l >> r >> d;
	if (l % d != 0) {
		l += (d - l % d);
	}
	r -= (r % d);
	cout << (r-l)/d+1;
}


Measured memory_bytes: 3572
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
int main() {
  int N, K;
  map<int, int> M;
  vector<int> C;
  cin >> N >> K;
  for(int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    ++M[a];
  }
  for(auto p : M) {
    C.push_back(p.second);
  }
  sort(C.begin(), C.end());
  partial_sum(C.begin(), C.end(), C.begin());
  int d = (int)M.size() - K;
  cout << (d > 0 ? C[d - 1] : 0)  << endl;
}


Measured memory_bytes: 10748
import numpy as np

n, m, Q = map(int, input().split())

array = np.zeros([n,n])
for _ in range(m):
    p, q = map(int, input().split())
    array[p-1][q-1] += 1
    
for p in range(n):
    for q in range(1, n):
        array[p][q] += array[p][q-1]

for p in range(1,n):
    for q in range(n):
        array[p][q] += array[p-1][q]

for _ in range(Q):
    p, q = map(int, input().split())
    if p == 1:
        print(int(array[q-1][q-1]))
    else:
        print(int(array[q-1][q-1] - array[p-2][q-1]))

Measured memory_bytes: 15064
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#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 EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int n; cin >> n;
	vector<int> a(n);
	vector<int> tb(100001);
	LL sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
		tb[a[i]]++;
	}

	int q; cin >> q;
	for (int i = 0; i < q; i++) {
		int b, c; cin >> b >> c;

		sum += (c - b)*tb[b];
		cout << sum << endl;
		tb[c] += tb[b];
		tb[b] = 0;
	
	}



	
	return 0;
}

Measured memory_bytes: 4056
n = int(input())
h = list(map(int, input().split()))

state = "Yes"
tmp = h[-1]
for i in range(len(h)-1, 0, -1):
  if h[i] <= tmp:
    tmp = h[i]
  elif tmp - h[i] == -1:
    tmp = h[i] - 1
  else:
    state = "No"
    break

print(state)

Measured memory_bytes: 14396
use std::io;
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let A: i32 = iter.next().unwrap().parse().unwrap();
    let B: i32 = iter.next().unwrap().parse().unwrap();
    let C: i32 = iter.next().unwrap().parse().unwrap();
    for k in 0..10000000 {
      if (k * A) % B == C {
          println!("{}", "YES");
          return;
      }
    }
    println!("{}", "NO");
}


Measured memory_bytes: 4352
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
	static String reverse(String str) {
		return new StringBuilder(str).reverse().toString();
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		for(int i=1;i<=m;i++) {
			String t = sc.next();
			TreeSet<String> pats = new TreeSet<>();
			for(int j=0;j<t.length()-1;j++) {
				String front = reverse(t.substring(0,j+1));
				String tail = reverse(t.substring(j+1));
				 pats.add(reverse(front) + tail);
                 pats.add(tail + reverse(front));
                 pats.add(reverse(tail) + front);
                 pats.add(front + reverse(tail));
                 pats.add(front + tail);
                 pats.add(tail + front);
                 pats.add(reverse(front) + reverse(tail));
                 pats.add(reverse(tail) + reverse(front));
			}
			System.out.println(pats.size());
		}
	}
}


Measured memory_bytes: 62792
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d,f,h,e;
	cin>>a>>b;
	c=a+b;
	d=a-b;
	f=a*b;
	h=max(c,d);
	e=max(h,f);
	cout<<e<<endl;
	
	return 0;
}

Measured memory_bytes: 256
//#include <ext/pb_ds/assoc_container.hpp> 
 //#include <ext/pb_ds/tree_policy.hpp>
// #include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define trace(x) cerr << #x << ": " << x << " " << endl;

typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e17;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power(((((a)%mod)*((a)%mod))%mod),b/2)%mod;
    else return (((a)%mod)*(power(((((a)%mod)*((a)%mod))%mod),b/2)%mod))%mod;
}
inline ll inverse(ll a,ll md) {
  a %= md;
  if (a < 0) a += md;
  ll b = md, u = 0, v = 1;
  while (a) {
    ll t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}
  
  
 //using namespace __gnu_pbds;
 //#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
//find_by_order(k)  returns iterator to kth element starting from 0;
//order_of_key(k) returns count of elements strictly smaller than k;
//erase,insert same as normal set
// mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count()); for randomized solution
const int ce=1e9+7;
ll fast_mod(ll input)
{
    return input < ce ? input : input%ce;
}
#define pi acos(-1)

int32_t main()
{
    IOS


    int n;
    cin>>n;
    int x=0;
    int st=100;
    while(1)
    {
        if(st>=n)
            break;
        int in=st/100;
        st+=in;
        x++;
    }
    cout<<x<<endl;
}       


Measured memory_bytes: 3652
// https://atcoder.jp/contests/agc029/tasks/agc029_a
//
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use std::fmt::*;
use std::io::*;
use std::str::*;

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

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

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

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

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        c: chars
    };
    let mut ans: u64 = 0;
    let mut black: u64 = 0;
    for ci in c {
        if ci == 'W' {
            ans += black;
        } else {
            black += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define num(a) a-'0'
#define charr(a) a - 'a'
#define rep(i,a,b) for(int i=a;i<b;i++)
#define maxs(a,b) if(b>a)a=b
#define mins(a,b) if(b<a)a=b
#define debug(x) cerr<<"["<<#x<<":"<<x<<"] "
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/(__gcd(a,b))
#define print(arr) for(auto it = arr.begin();it < arr.end();it ++){cout << *it << " ";}cout << ln;
#define all(a) (a).begin(), (a).end()
#define vi vector<int>
#define vl vector<long long int>
#define v vector
#define p pair
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define ln "\n"
typedef long long int ll;
typedef long double ld;
typedef double d;
using namespace std;
ll modF=1e9+7;
ll INF=1e11;

void solve(){
	string n;
	cin>>n;
	int l=n.length();
	ll sum = 0;
	for(int i=0;i<l;i++){
		sum+=num(n[i]);
	}
	if(sum%9==0){
		cout<<"Yes\n";
	}
	else{
		cout<<"No\n";
	}
}	

int main(){
	boost_io;
	solve();
	return 0;
}


Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define per(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
#define LINF 1e18
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n, x; cin >> n >> x;
    vector<int> m(n);
    rep(i, n) {
        cin >> m[i];
        x -= m[i];
    }
    sort(all(m));
    int ans = n;
    ans += x/m[0];
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 200000
vector<long long>e[N];
bool emp[N];
bool used[N];
vector<long long>a;
long long cnt;
long long b[N];
long long c[N];
long long k[N];
long long r[N];

void dfs(int k) {
	if (used[k])return;
	used[k] = true;
	cnt++;
	long long sz = e[k].size();
	f(i, sz)dfs(e[k][i]);
	return;
}

int main() {
	long long n, cc;
	long long x, y, z;
	long long s, ans;
	f(i, N) {
		emp[i] = false;
		used[i] = false;
	}
	scanf("%lld", &n);
	f(i, n) {
		scanf("%lld", &x);
		x--;
		if (x >= 0) {
			e[x].push_back(i);
			e[i].push_back(x);
		}
		else emp[i] = true;
	}
	cc = 0;
	f(i, n) {
		if (emp[i]) {
			cnt = 0;
			dfs(i);
			a.push_back(cnt);
		}
	}
	f(i, n) {
		if (!used[i]) {
			cc++; 
			dfs(i);
		}
	}
	k[0] = 1;
	f(i, N - 1) {
		x = k[i] * (i + 1);
		x %= MOD;
		k[i + 1] = x;
	}
	r[0] = 1;
	f(i, N - 1) {
		r[i + 1] = (r[i] * (n - 1)) % MOD;
	}
	f(i, N) {
		b[i] = 0;
		c[i] = 0;
	}
	b[0] = 1;
	long long sz = a.size();
	ans = 0;
	f(i, sz) {
		s = ((a[i] - 1)*r[sz - 1]) % MOD;
		ans = (ans + s) % MOD;
		f(j, i) {
			s = (a[i] * b[j + 1]) % MOD;
			s = (s*k[j + 1]) % MOD;
			s = (s*r[sz - j - 2]) % MOD;
			ans = (ans + s) % MOD;
		}
		c[0] = 1;
		f(j, i + 1)c[j + 1] = ((b[j] * a[i]) + b[j + 1]) % MOD;
		f(j, i + 2)b[j] = c[j];
	}
	s = n - cc;
	s = (s*r[sz]) % MOD;
	ans = (s - ans + MOD) % MOD;
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 14716
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#include <algorithm>

using namespace std;
vector<long long> v;

void num(int x){




}

int main() {
string a,b;int coun=0;
cin>>a>>b;
for(int i=0;i<a.length();i++){

    if(a[i]!=b[i]){

        coun=coun+1;
    }


}
cout<<coun<<endl;


    return 0;
}


Measured memory_bytes: 3824
function main()
    n, k = parse.(Int, split(readline()))
    a = parse.(Int, split(readline()))
    
    for i in 1:min(k, 41)
        b = zeros(Int, n)
        for j in 1:n
            l = max(1, j-a[j])
            r = min(j+a[j], n)
            b[l] += 1
            r + 1 <= n && (b[r+1] -= 1)
        end
        for j in 2:n
            b[j] += b[j-1]
        end
        a = b
    end

    for i in a
        print(i," ")
    end
    println()

end

function getrange(i, x, m)
    l = max(1, i-x)
    r = min(i+x, m)
    
end

main()


Measured memory_bytes: 252808
#define __USE_MINGW_ANSI_STDIO
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef long long ull;
typedef pair<ll, ll> ii;

#define all(v)		((v).begin()), ((v).end())
#define sz(v)		((int)((v).size()))
#define endl		"\n"
#define fx(n)		fixed<<setprecision(n)
#define mk			make_pair	

void File()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
#ifdef ONLINE_JUDGE
	/*freopen("output.txt", "w", stdout);
	freopen("commandos.in", "r", stdin);*/
#endif
}
void fast()
{
	ios::sync_with_stdio(NULL);
	cout.tie(NULL);
	cin.tie(NULL);
	//File();
}
const double pi = acos(-1.0);
const ll oo = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int nn = 1e2 + 15;
int dx[8] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[8] = { 0, 1, 0, -1, 1, -1, -1, 1 };

ll dp[nn][int(1e5)], n;
vector < pair<int, int>  > arr;
ll solve(int idx, int w)
{
	if (idx >= n)
		return 0;
	ll &ret = dp[idx][w];
	if (~ret)
		return ret;
	ret = solve(idx + 1, w);
	if (arr[idx].first <= w)
		ret = max(ret, solve(idx + 1, w - arr[idx].first) + arr[idx].second);
	return ret;
}
int main()
{
	fast();
	ll w;
	cin >> n >> w;
	memset(dp, -1, sizeof dp);
	arr.resize(n + 1);
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i].first >> arr[i].second;
	}
	cout << solve(0, w) << endl;
	return 0;
}

Measured memory_bytes: 90112
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    int n = sc.nextInt();
    
    int[] a = new int[n];
    for(int i=0;i<n;i++){
      a[i] = sc.nextInt();
    }
    int ans = a[n-1] - a[0];
    for(int i=0;i<n-1;i++){
      ans = Math.min(ans,k-(a[i+1]-a[i]));
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 80896
'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf8');

// Your code here!
const max = (a)=>{
    let i = a.length;
    let max=-Infinity;
    while (i--) {
        if (a[i] > max)max = a[i];
    }
    return max;
}
const min = (a)=>{
    let i = a.length;
    let max=Infinity;
    while (i--) {
        if (a[i] < max)max = a[i];
    }
    return max;
}
const Main = (p)=>{
	p = p.split("\n");//2 or more
	//let N = parseInt(p[0]);//N
	let N = parseInt(p[0].split(" ")[0]);//N M
	let K = parseInt(p[0].split(" ")[1]);//N M
	let h = (p[1].split(" ").map(Number));//a1 a2 a3...

	let c = new Array(N).fill(Infinity);
    c[0]=0;
    c[1]=Math.abs(h[0]-h[1]);
    for(let i=2;i<N;i++){
        let t=[];
        for(let j=1;j<=K&&i-j>=0;j++){
            //console.log(i,j)
            t[j-1]=c[i-j]+Math.abs(h[i]-h[i-j]);
        }
        //console.log(t);
        c[i]=min(t);
    }
	//console.log(c);
	console.log(c[N-1]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


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

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

int A[100010];

int main() {
    int n; cin >> n;
    int MIN = 100010;
    int MAX = 0;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
        MIN = min(MIN,a[i]-1);
        MAX = max(MAX,a[i]+1);
        A[a[i]]++;
        A[a[i]-1]++;
        A[a[i]+1]++;
    }
    

    int ans = 0;
    for(int j = MIN; j <= MAX; j++){
        ans = max(ans,A[j]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String s = (sc.next());
        String t = (sc.next());
        String ans = "No";

        t = t.substring(0, t.length()-1);

        if (s.equals(t)) {
            ans = "Yes";
        }


        System.out.println(ans);
    }
}

Measured memory_bytes: 35572
S0 = input()
S = S0
C = set("abcdefghijklmnopqrstuvwxyz")
C1 = set(S)
candidate = sorted(C - C1)
if candidate != []:
    if S0 < S + candidate[0]:
        print(S + candidate[0])
        exit()
while S != "":
    C1 = set(S)
    candidate = sorted([ c for c in C - C1 if c > S[-1]])
    if candidate != []:
        if S0 < S[0:-1] + candidate[0]:
            print(S[0:-1] + candidate[0])
            exit()
    S = S[0:- 1]
if S0[0] == "z":
    print(-1)
else:
    print(chr(ord(S0[0]) + 1))


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

using namespace std;

#define ll long long
#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a, b, c;
    cin >> a >> b >> c;
    if ((a == b && a != c) || (b == c && b != a) || (a == c && a != b)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n,i=0,i2=0;
  scanf("%d",&n);
  char s[n+1];
  scanf("%s",s);
  for(int j=0;j<n;j++) {
    if(s[j]=='I') i++;
    else i--;
    if(i2<i) i2=i;
  }
  printf("%d",i2);
}

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

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#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 UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

signed main() {
  int n[11];
  m0(n);
  for (int i = 0; i < 4; i++) {
    int tmp;
    cin >> tmp;
    n[tmp]++;
  }
  if (n[1] == 1 && n[7] == 1 && n[9] == 1 && n[4] == 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
node_list = [[0] * n for i in range(n)]
count = 0

for i in range(m):
    a, b = map(int, input().split())
    node_list[a - 1][b - 1] = 1
    node_list[b - 1][a - 1] = 1

flg = True
count = 0
while flg:
    flg = False
    for i in range(n):
        if node_list[i].count(1) == 1:
            count += 1
            j = node_list[i].index(1)
            node_list[i][j] = 0
            node_list[j][i] = 0
            flg = True

print(count)


Measured memory_bytes: 3064
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let mut a:Vec<i32> = Vec::new();
	let v:Vec<i32> = procon_read();
	a.push(v[0]);
	for i in 1..5 {
		let v:Vec<i32> = procon_read();
		for j in 0..i {
			if a[j as usize]%10 < v[0]%10 {
				a.insert(j, v[0]);
				break;
			}
			if j == i-1 {
				a.push(v[0]);
			}
		}
	}
	/*for i in &a {
		print!("{} ", i);
	}
	println!("");*/
	for i in 0..5 {
		if a[i]%10 == 0 {
			if i != 0 {
				let c = a[4];
				a[4] = a[(i-1) as usize];
				a[(i-1) as usize] = c;
			}else{
				break;
			}
		}
	}
	let mut ret = 0;
	for i in 0..4 as usize {
		if a[i] % 10 == 0 {
			ret += a[i];
		}else{
			ret += a[i] + (10 - a[i]%10);
		}
	}
	ret += a[4];
	println!("{}", ret);
}

Measured memory_bytes: 4352
#include <iostream>

using namespace std;

int main() {
	while (1) {
		int m, f, r;
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1)
			break;
		if (m == -1 || f == -1)
			cout << "F" << endl;
		else if (m + f >= 80)
			cout << "A" << endl;
		else if (m + f >= 65)
			cout << "B" << endl;
		else if (m + f >= 50)
			cout << "C" << endl;
		else if (m + f >= 30)
			if (r >= 50)
				cout << "C" << endl;
			else
				cout << "D" << endl;
		else
			cout << "F" << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include <numeric>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

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

    int N; cin >> N;
    vector<ll> count(5);
    rep(i, 0, N) {
        string s; cin >> s;
        if (s[0] == 'M') count[0]++;
        if (s[0] == 'A') count[1]++;
        if (s[0] == 'R') count[2]++;
        if (s[0] == 'C') count[3]++;
        if (s[0] == 'H') count[4]++;
    }

    vector<int> I = {0, 0, 0, 0, 0, 0, 1, 1, 1, 2};
    vector<int> J = {1, 1, 1, 2, 2, 3, 2, 2, 3, 3};
    vector<int> K = {2, 3, 4, 3, 4, 4, 3, 4, 4, 4};

    ll res = 0;
    rep(d, 0, 10) {
        res += count[I[d]] * count[J[d]] * count[K[d]];
    }

    cout << res << endl;
}

Measured memory_bytes: 256
# デバッグ用
GBN_DEBUG = False
GBN_DEBUG = True
def dprn(s, i):
    if GBN_DEBUG: print(", " + s + " = " + str(i), end = "")
def dprns(s):
    if GBN_DEBUG: print(", " + s, end = "")
def dprni(i):
    if GBN_DEBUG: print(i, end=" ")
def endl(): 
    if GBN_DEBUG: print('')
def puts(s): print(s)

#本体ここから

S = input()
#N = int(input())
#S, T = input().split()
#N, M = map(int, input().split())
#W = [input() for _ in range(N)]
#A = A = list(map(int, input().split()))

slen = len(S)
zero = 0
one = 0
for i in range(slen):
    if S[i] == '0':
        zero += 1
    else:
        one += 1
if (zero > one):
    print(one * 2)
else:
    print(zero * 2)


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

int main() {
  ll x;
  cin >> x;
  ll m=100;
  int i = 0;
  while(m<x){
    m=m*1.01;
    i++;
  }   
  cout << i << endl;
}





Measured memory_bytes: 3592
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <boost/multi_array.hpp>

int main() {
    std::string str;
    std::cin >> str;
    
    std::string ans = str.substr(4);
    ans = "2018" + ans;
    
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using namespace boost::adaptors;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    ll n;
    cin >> n;
    vector<ll> as(n, 0);
    for (auto &&i: boost::irange(0LL, n)){
        cin >> as.at(i);
    }
    sort(as.begin(), as.end());
    ll maximum = as.back();
    vector<ll> diff(n, numeric_limits<ll>::max());
    for (auto &&i: boost::irange(0LL, n)){
        diff.at(i) = abs(maximum - 2 * as.at(i));
    }
    ll diff_min_idx = 0;
    ll diff_min = numeric_limits<ll>::max();
    for (auto &&i: boost::irange(0LL, n)){
        if (diff_min > diff.at(i)){
            diff_min_idx = i;
            diff_min = diff.at(i);
        }
    }
    cout << maximum  << " " <<  as.at(diff_min_idx) << endl;

    return 0;
}

Measured memory_bytes: 1920
/*
  The Island Was Silent before.
  .....
  And One day again it became Silent.
*/
#include<bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define ll  long long
#define modd(a,b) ((a+2*b)%b)
#define debug(a) cout << #a << ": " << (a) << "\n"
#define ioso ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define rtt cerr << "Time: " << clock()*1.0 / CLOCKS_PER_SEC << endl;
#define ffe freopen("input.txt","r",stdin), freopen("output.txt","w",stdout);
 
int main() {
  ioso
  #ifndef ONLINE_JUDGE
 // ffe
  #endif
  ll n; cin >> n;
  int xx[100010];
  int a[200010];
  int x = 0;
  for(int i=0;i<n;i++) {
    cin >> a[i];
    x ^= a[i];
  }
  for(int i=0;i<n;i++) {
    cout << (x^a[i]) << " ";
  }
  cout << endl;

}

Measured memory_bytes: 4424
import sys
input = sys.stdin.readline

N = int(input())


def main():

    end = N ** 0.5
    minv = 10 ** 12
    list = []
    for i in range(1, int(end) + 1):
        if N % i == 0:
            list.append([i, N / i])
    for item in list:
        minv = min(minv, item[0] + item[1] - 2)

    print(int(minv))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3476
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define el '\n'
#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define repd(i, a, b) for (ll i = (b)-1; i >= (a); i--)
#define large 1000000007
#define pb() push_back()
#define MAX 10e+7
#define float double
#define pi 3.141592653589793
void solve()
{
int a,b;
cin>>a>>b;
int h,m;
cin>>h>>m;
//cout<<cos(60)<<el;
//cout<<cos(3*pi/2)<<el;
//cout<<h<<el;
//cout<<m<<el;

float thita;
float h2=(float)h/6;
float h1=(float)m/360;
float m1=(float)m/30;
//cout<<h2<<el;
float tans=pi*(h2+h1-m1);
//cout<<tans<<el;
if(tans>pi) 
{
//=tans-1;
tans=tans-pi;
thita=-1*cos(tans);
 //thita=cos(pi*((float)(h/6)+(float)(m/360)-(float)(m/30)));
}
else
{
    thita=cos(tans);
}

//cout<<thita<<el;
cout.precision(9);
float ans=sqrt((a*a)+(b*b)-(2*a*b*thita));
printf("%0.9f\n",ans);
//cout<<ans<<el;
}
int main()
{
    
solve();
  return 0;
}


Measured memory_bytes: 4192
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
using namespace std;


int main() {
	long long int a=0, b, c, d, n, m;
	string str,str2,str3;
	cin >> n>>str>>str2>>str3;
	for (int i = 0; i < n; i++) {
		if (str[i] == str2[i] && str2[i] == str3[i]) {
			
		}
		else if (str[i] == str2[i] || str2[i] == str3[i] || str[i] == str3[i]) {
			a++;
		}
		else { a += 2; }
	}
	cout << a;
}

Measured memory_bytes: 256
my ($a, $b) = split(/\s+/, <STDIN>);

my $max = $a;
$max = $b if $max < $b;

my $val;
if ($a == $b) {
    $val = $max * 2;
} else {
    $val = $max * 2 - 1;
}

print $val, "\n";


Measured memory_bytes: 512
#include <stdio.h>
int main(void)
{
    int n ,m,p,i,AC = 0,WA = 0,ac[100008] ={0},wa[100008] = {0};
    char s[3];
    scanf("%d%d",&n,&m);
    for(i = 0 ; i < m ; i++)
    {
        scanf("%d %s",&p,s);
        if(ac[p] == 1)
        {
            continue;
        }
        else if(s[0] == 'A')
        {
            AC++;
            ac[p]++;
            WA += wa[p];

        }
        else
        {
            wa[p]++;
        }
    }
    printf("%d %d\n",AC,WA);
        return 0;
}

Measured memory_bytes: 2472
def main():   
    N,X=map(int,input().split())
    G=list(map(int,input().split()))

    S=[0]
    for g in G:
        S.append(S[-1]+g)

    ANS=1<<60

    def length(x):
        if x==1:
            return 5
        else:
            return 2*x+1

    for rep in range(1,N+1):
        score=X*N+X*rep
        count=1
        
        for i in range(N,0,-rep):
            score+=(S[i]-S[max(0,i-rep)])*length(count)
            count+=1

        if ANS>score:
            ANS=score

    print(ANS)
    
main()

Measured memory_bytes: 26404
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string>

using namespace std;

int main(){
  string s;
  int n;
  cin >> n >> s;
  int ans = 200000;
  int sumw[200000] = {0};
  int sumb[200000] = {0};
  if(s[0] == '#'){
    sumb[0] = 1;
    sumw[0] = 0;
  }
  else{
    sumw[0] = 1;
    sumb[0] = 0;
  }
  for(int i = 1; i < n ; i++){
    if(s[i] == '.'){
      sumw[i] = sumw[i-1]+1;
      sumb[i] = sumb[i-1];
    }
    else{
      sumb[i] = sumb[i-1]+1;
      sumw[i] = sumw[i-1];
    }
  }
  for(int i = 0; i < n ; i++){
    ans = min(ans, sumb[i] + sumw[n-1] - sumw[i]);
    ans = min(ans, sumw[n-1]);
    ans = min(ans, sumb[n-1]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 2180
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define vi vector <int>
#define vl vector <ll>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d",x)
#define plld(x) printf("%lld",x)
#define pds(x) printf("%d ",x)
#define pllds(x) printf("%lld ",x)
#define pdn(x) printf("%d\n",x)
#define plldn(x) printf("%lld\n",x)
#define INF 2e9
#define INFLL 4e18
#define spn setprecision
#define fr(x,a,b,c) for(int x = a; x <= b; x+=c)
using namespace std;
ll multiply(ll num1, ll num2, ll mod) { // with mod > 1e9
	ll ans = 0;
	num1 %= mod;
	num2 %= mod;
	while (num2) {
		if (num2&1) {
			ans += num1;
			ans %= mod;
		}
		num1 *= 2;
		num1 %= mod;
		num2 /= 2;
	}
	return ans;
}
ll powmod2(ll base,ll exponent,ll mod){ // with mod > 1e9
	ll ans = 1;
	while (exponent) {
		if (exponent&1) {
			ans = multiply(ans, base, mod);
		}
		base = multiply(base, base, mod);
		exponent /= 2;
	}
	return ans;
}
ll powmod(ll base,ll exponent,ll mod){ // with mod < 1e9
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
const int upperlimit = 1e6+100;
const int mod = 1e9+7;
int main() {
	int a,b;
	sd(a);
	sd(b);
	if((a&1)&&(b&1)){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256