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

typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;  typedef pair<LL, LL> PLL;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
typedef vector<LL>     VLL;  typedef vector<VLL>  VVLL;  typedef vector<VVLL>  VVVLL;
typedef vector<double> VD;   typedef vector<VD>   VVD;   typedef vector<VVD>   VVVD;
typedef vector<string> VS;   typedef vector<VS>   VVS;   typedef vector<VVS>   VVVS;
typedef vector<bool>   VB;   typedef vector<VB>   VVB;   typedef vector<VVB>   VVVB;
typedef vector<PII>    VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL>    VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a)   { OSS oss; oss << a; return oss.str(); };

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int    DX[] = {1,  0, -1, 0};
const int    DY[] = {0, -1,  0, 1};
const double EPS  = 1e-12;
// const double PI   = acos(-1.0);
// lambda: [](T1 x)->T2{return y;}
// simple lambda: [](T x){return x;}

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

    VI as(26);
    rep(i, N) {
        as[s[i] - 'a'] += 1;
    }

    VI ns(10);
    for (auto a : as) {
        ns[a] += 1;
    }

    int cnt = 0;

    // n == 1
    cnt += ns[1] * 2;

    // n > 1
    REP(i, 2, 10) {
        if (ns[i] == 1) {
            cnt += 4;
        } else if (ns[i] > 1) {
            cnt += (2 * ns[i] - 1) + 4 + 1;
        }
    }

    // - '+'
    cnt -= 1;

    cout << cnt << endl;

	return 0;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define Graph vector<vector<int>>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }


void func(long long N, std::vector<std::string> S){

}

int main(){

    long long N;
    scanf("%lld",&N);
    std::vector<std::string> S(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> S[i];
    }
    
    set<string> gachapool;

    for (int i = 0; i < N; i++)
    {
        gachapool.insert(S.at(i));
    }

    cout<<gachapool.size()<<endl;
    


    return 0;
}

Measured memory_bytes: 25076
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
using namespace std;
using ll = long long;

int main (){
    int p,q,r;
    cin >> p >> q>> r;
    vector<int> sum;
    
    sum.push_back(q+p);
    sum.push_back(q+r);
    sum.push_back(r+p);

    sort(sum.begin(),sum.end());

    cout << sum[0];

}

Measured memory_bytes: 256
D, G = map(int, input().split())
X = [0] + [list(map(int, input().split())) for _ in range(D)]

def func(i, t):
    if i == 0:
        return 10 ** 9
    
    # Solve all problems, or part of them
    k = min(t // (100 * i), X[i][0])
    s = 100 * i * k
    
    # If all problems are solved, add bonus
    if k == X[i][0]:
        s += X[i][1]
        
    # If score < objective, go next step
    if s < t:
        k += func(i - 1, t - s)
        
    # Select minimum number of solved problems
    # k: solve i-th line
    # func(i-1,t): pass i-th line
    return min(k, func(i - 1, t))

# Solve backward
print(func(D, G))


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

int main() {
  int N,D,X,i,j,choco=0;
  cin >> N >> D >> X;
  int A[N];
  for (i=0; i<N; i++){
    cin >> A[i];
  }
  
  for (i=0; i<N; i++){
    j=0;
  	while (j*A[i]+1 <= D){
      choco = choco + 1;
      j = j + 1;
    }
  }
  cout << choco + X << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
ll comb[5001] = {}; int n;
vector<int> G[5000];
bool used[5000];
void init() {
	comb[0] = 1;
	for (ll i = 2; i <= 5000; i += 2) {
		comb[i] = comb[i - 2] * (i - 1) % MOD;
	}
	fill(used, used + n, false);
}
vector<ll> dp[5000][2];
void merge(int v0,int v1) {
	int l0 = dp[v0][0].size(); int l1 = dp[v1][0].size();
	vector<ll> res[2]; res[0].resize(l0 + l1 - 1); res[1].resize(l0 + l1 - 1);
	rep(c0, l0)rep(c1, l1)rep(p0, 2)rep(p1, 2) {
		(res[(p0 + p1) % 2][c0 + c1] += dp[v0][p0][c0] * dp[v1][p1][c1]%MOD)%=MOD;
		(res[(p0 + p1 + 1) % 2][c0] += dp[v0][p0][c0] * dp[v1][p1][c1] % MOD*comb[c1] % MOD) %= MOD;
	}
	swap(dp[v0], res);
}
void dfs(int v) {
	used[v] = true;
	dp[v][0].push_back(0); dp[v][0].push_back(1);
	dp[v][1].push_back(0); dp[v][1].push_back(0);
	int len = G[v].size();
	rep(j, len) {
		int nex = G[v][j];
		if (used[nex])continue;
		dfs(nex);
		merge(v, nex);
	}
}
int main(){
	init(); cin >> n;
	rep(i, n - 1) {
		int u, v; cin >> u >> v; u--; v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	dfs(0);
	ll ans = 0;
	int len = dp[0][0].size();
	rep(i, len)(ans += dp[0][0][i] * comb[i] % MOD) %= MOD;
	rep(i, len)((ans -= dp[0][1][i] * comb[i] % MOD) += MOD)%=MOD;
	cout << ans << endl;
	return 0;
}

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

#define ll long long

int main(){
    int B[3][3],G[3][3];
    int N;
    for(int i=0;i<3;i++) for(int j=0;j<3;j++) cin>>B[i][j];
    cin >> N;
    vector<int> Q(N);
    for(int i=0;i<N;i++) cin>>Q[i];

    for(int x=0;x<3;x++){
        for(int y=0;y<3;y++){
            G[x][y]=false;
        }
    }

        for(int i=0;i<N;i++){
            for(int x=0;x<3;x++){
                for(int y=0;y<3;y++){
                    if(B[x][y]==Q[i]){
                        G[x][y]=true;
                    }
                }
            }
        }
        for(int x=0;x<3;x++){
            bool ok=true;
            for(int y=0;y<3;y++){
                ok=ok&&G[x][y];
            }
            if(ok){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
        for(int x=0;x<3;x++){
            bool ok=true;
            for(int y=0;y<3;y++){
                ok=ok&&G[y][x];
            }
            if(ok){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
            bool ok=true;
            for(int y=0;y<3;y++){
                ok=ok&&G[y][2-y];
            }
            if(ok){
                cout<<"Yes"<<endl;
                return 0;
            }
            ok=true;
            for(int y=0;y<3;y++){
                ok=ok&&G[y][y];
            }
            if(ok){
                cout<<"Yes"<<endl;
                return 0;
            }
        cout<<"No"<<endl;
                        
        return 0;
    }


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

int main() {
  int N, a, b, c, d;
  cin >> N;
  a = N / 1000;
  b = (N - a * 1000) / 100;
  c = (N - a * 1000 - b * 100 ) / 10;
  d = N - a * 1000 - b * 100 - c * 10;

  
  if ( ((a == b) && (b == c)) || ((b == c) && (c == d)) ) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      String o = sc.next();
      String e = sc.next();
      for(int i = 0;i < e.length();i++){
      	System.out.print(o.substring(i,i+1));
        System.out.print(e.substring(i,i+1));
      }
      if(o.length()%2!=e.length()%2) System.out.print(o.substring(o.length()-1,o.length()));
    }
}

Measured memory_bytes: 21716
#include <string>
#include <bits/stdc++.h>
#include <stdio.h>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;


int main() {
 int ans,tmp;
  tmp=0;
  string s;
  cin >> s;
  for(int i=0;i<s.size();i++){
    if(i%2==0){
      if(s.at(i)=='0'){
        tmp++;
      }
    }
    else{
      if(s.at(i)=='1'){
        tmp++;
      }
    }
  }
  ans=tmp;
  tmp=0;
  for(int i=0;i<s.size();i++){
    if(i%2==0){
      if(s.at(i)=='1'){
        tmp++;
      }
    }
    else{
      if(s.at(i)=='0'){
        tmp++;
      }
    }
  }
  cout << min(ans,tmp) << endl;
}
      

Measured memory_bytes: 512
n = int(input())
p = list(map(int, input().split()))

ans, cnt = 0, 0
for i in range(1, n + 1):
    if i == p[i - 1]:
        cnt += 1
        if cnt % 2 == 1:
            ans += 1
    else:
        cnt = 0
print(ans)


Measured memory_bytes: 14008
#include<bits/stdc++.h>
#define int long long
#define MOD 1e9
#define MAX LONG_MAX
#define MIN LONG_MIN
#define pb push_back

using namespace std;

signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	int n,x=0;
	cin>>n;
	std::vector<int> arr(n);
	for(int i=0;i<n;i++){
		cin>>arr[i];
		x^=arr[i];
	}
	for(int i=0;i<n;i++){
		int r=x^arr[i];
		cout<<r<<" ";
	}
	return 0;
}

Measured memory_bytes: 4784
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    private struct Pair { public int x, y; }
    public static void Main()
    {
        int N = NextInt();
        int K = NextInt();
        string S = NextString();
        List<int> memo = new List<int>();
        int count = 0;
        bool flag = true;
        for (int i = 0; i < N; i++)
        {
            if (!flag && S[i] == '0') { count++; }
            else if (!flag && S[i] == '1') { memo.Add(count); count = 1; flag = true; }
            else if (flag && S[i] == '1') { count++; }
            else if (flag && S[i] == '0') { memo.Add(count); count = 1; flag = false; }
        }
        memo.Add(count);
        if (S[N - 1] == '0') memo.Add(0);
        long ans = memo[0];
        long box = memo[0];
        count = 0;
        for (int i = 1; i < memo.Count(); i += 2)
        {
            count++;
            if (count <= K)
            {
                box += memo[i];
                if (i + 1 != memo.Count()) box += memo[i + 1];
            }
            else
            {
                box += memo[i] + memo[i + 1];
                box -= (memo[i - K * 2] + memo[i - K * 2 - 1]);

            }
            ans = Math.Max(ans, box);
            //count++;
        }
        Console.WriteLine(ans);
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 13536
#include<stdio.h>
int main(void){
int i,j,a[10],t;

for(i=0;i<10;i++){
	
	scanf("%d",&a[i]);
}
  
  	for(i=0;i<10;i++)
	{
		for(j=0;j<10-1;j++)
		{
			if(a[j]<a[j+1])
			{
				t=a[j+1];
				a[j+1]=a[j];
				a[j]=t;
			}
		}
	}
	for(i=0;i<3;i++){
		printf("%d\n",a[i]);
	}
	

	
	
	
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> circle(n);
  rep(i,n) {
    cin >> circle.at(i);
  }
  sort(circle.begin(),circle.end(),greater<int>());
  ll ans = 0;
  ans += circle[0];
  circle.erase(circle.begin());
  rep(i,n - 2) {
    ans += circle[0];
    if(i % 2 & 1) circle.erase(circle.begin());
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4052
#include <stdio.h>
#include <math.h>

int gcd (x, y){
  long tmp = 0;;
  if(x < y){
    tmp = x;
    x = y;
    y = tmp;
  }
  while(y > 0){
    tmp = x % y;
    x = y;
    y = tmp;
  }

  return x;
}

int main(){
  long x, y;

  scanf("%d %d", &x, &y);

  printf("%d\n",gcd(x, y));

  return 0;
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
}

int ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b;
int x, y;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{

  rep(i, 3) cin >> v[i];
  sort(v.begin(), v.end());
  pr(v[2] * 10 + v[1] + v[0]);
}

Measured memory_bytes: 3600
H, N = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]

dp = [0] * (H + 1)
for h in range(1, H + 1):
    dp[h] = min([dp[max(h - a, 0)] + b for a, b in AB])

print(dp[-1])


Measured memory_bytes: 42972
<?php
  /*
$x = explode(" ",trim(fgets(STDIN)));
sort($x);

for ($i=0;$i<$x[1];$i++){
if(abs($x[0]-$i)==abs($x[1]-$i)){
echo $i;
exit;
}
}
echo 'IMPOSSIBLE';
*/
$N =trim(fgets(STDIN));
$p = explode(" ",trim(fgets(STDIN)));
$c=0;
for($i=0;$i<$N;++$i){
if($p[$i]!=$i+1){
++$c;
}
}

if($c<=2){
echo 'YES';
}else{
echo 'NO';
}

Measured memory_bytes: 4728
#include<bits/stdc++.h>
#define endl "\n" 
#define pi acos(-1)
#define ll long long 
using namespace std;
void att(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
}
void sirra(){
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif
}
void solve();
int main(){
	att();sirra();
	int q=1;//cin>>q;
	while(q--){
		solve();
	}
}
void solve(){
	ll n,sum(0);cin>>n;
	ll arr[n+1]={0};
	for(int i=1;i<=n;i++){
		for(int j=1;j*i<=n;j++){
			arr[i*j]++;
		}
	}
	for(int i=1;i<=n;i++){
		sum+=i*arr[i];
	}
	cout<<sum;
}

Measured memory_bytes: 81732
x,n = input().split()
x = int(x)
if int(n) != 0:
  p = list(map(int, input().split()))
else:
  p = []

all_list = [i for i in range(1,101)]
p = reversed(sorted(p))

for i in p:
  all_list.pop(i-1)
  
all_list.insert(0,0)
all_list.insert(0,-1)
all_list.append(101)

if x in all_list:
  ans = x
else:
  abs_ = 1000
  for i in all_list:
    if abs(x - i) < abs_:
      abs_ = abs(x - i)
      ans = i

print(ans)

Measured memory_bytes: 9216
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
const ll inf = 1000000007;
int main() {
  ll n;cin >>n;
  vector<ll> d(n);
  rep(i,n) cin  >>d[i];
  sort(all(d));
  cout <<d[n/2]-d[n/2-1]<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
#define all(obj) (obj).begin(), (obj).end()
static const int dx[4] = {0, 1, 0, -1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'u', 'r', 'd', 'l'};
static const ll INF = 1 << 21;
static const ll MOD = 1e9 + 7;

signed main() {
  int N, M;
  cin >> N >> M;
  vector<int> ps(N),tmpwa(N);
  int ac = 0, wa = 0;
  rep(i, M) {
    int p;
    string s;
    cin >> p >> s;
    --p;
    if (s == "WA") {
      tmpwa[p]++;
    } else {
      if (ps[p] == 0) {
        ac++;
        wa += tmpwa[p];
        ps[p]++;
      }
    }
  }
  cout << ac << " " << wa << endl;
  return 0;
}

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

int main(){
    int K,y = 0,x = 0, z = 0;
    cin >> K;
    for(int i=1; i < K + 1; i++){
        for(int j=1; j < K + 1; j++){
            for(int l=1; l < K + 1; l++){
                x = gcd(i,j);
                y = gcd(x,l);
                z += y;
            }
        }
    }

    cout << z << endl;
    return 0;
}

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

int main() {
  int n, k;
  string s;
  cin >> n >> s >> k;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) != s.at(k - 1)) s.at(i) = '*';
  }
  cout << s << endl;
}

Measured memory_bytes: 256
using static System.Console;

class Program {
	static void Main() {
		var N = int.Parse(ReadLine());
		WriteLine(N % S(N) == 0 ? "Yes" : "No");
	}

	static int S(int n) {
		var result = 0;
		for (; n != 0; n /= 10) {
			result += n % 10;
		}
		return result;
	}
}

Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<set>
using namespace std;
#define df 0
typedef long int li;
const li INF=1e15;
struct edge{
  int u;
  int v;
  li c;
};

int main(){
  if(df) printf("*debug mode*\n");
  int n,m; cin >>n >>m;
  edge graph[m];
  for(edge& x: graph){
    cin >>x.u >>x.v >>x.c;
    x.u--; x.v--;
  }

  li road[n];
  road[0]=0;
  for(int i=1; i<n; i++) road[i]=-INF;
  for(int i=0;i<2*n;i++){
    for(edge& x: graph){
      if(road[x.v]<road[x.u]+x.c){
	road[x.v]=road[x.u]+x.c;
	if(i>=n)road[x.v]=INF;
      }
    }
  }
  if(road[n-1]==INF)printf("inf\n");
  else printf("%ld\n",road[n-1]);
}

/// confirm df==0 ///


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a, b, c, i;
    int count = 0;
    cin >> a >> b >> c;
    i = a;
    while(i<=b){
        if(c%i==0){
            count++;
        }
        i++;
    }
    cout << count << endl;
    return 0;
}


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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x, a, b;
    cin >> x >> a >> b;
    int sub = x - a;
   // cout << sub << endl;
    int div = sub / b;
    //cout << div << endl;
    int mul = div * b;
    //cout << mul << endl;
    int ans = mul - sub;
    cout << abs(ans) << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static readonly int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//string s = Console.ReadLine();
			int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int[] b = new int[n];
			for (int i = 0; i < n; i++) {
				b[i] = a[i] - (i + 1);
			}
			b = b.OrderBy(p => p).ToArray();

			//System.Diagnostics.Debug.WriteLine(string.Join(" ", a));
			//System.Diagnostics.Debug.WriteLine(string.Join(" ", b));
			long med = 0;
			if (n % 2 == 0) {
				med = (b[(n / 2) - 1] + b[n / 2]) / 2;
				//System.Diagnostics.Debug.WriteLine($"{med} = {b[(n / 2) - 1]} + {b[n / 2]} / 2");
			} else {
				med = b[n / 2];
				//System.Diagnostics.Debug.WriteLine($"{med} = {b[n / 2]}");
			}

			long ans = 0;
			for (int i = 0; i < n; i++) {
				ans += Math.Abs(b[i] - med);
			}
			Console.WriteLine(ans);


			Console.Out.Flush();
		}
	}
}


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

int main() {
	int a,b;
	char op;
	
	for(;;){
	cin >> a >> op >> b;
	
	if(op=='+'){
		cout << a+b << endl;
	}
	else if(op=='-'){
		cout << a-b << endl;
	}
	else if(op=='*'){
		cout << a*b << endl;
	}
	else if(op=='/'){
		cout << a/b << endl;
	}
	else if(op=='?'){
		break;
	}
	
	
	}
	return 0;
}

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

#define ASC(a) a.begin(), a.end()		// 昇順ソート 例：sort(ASC(a));
#define DESC(a) a.rbegin(), a.rend()	// 降順ソート 例:sort(DESC(a));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(a) rep(i, n) cin>>a[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vii;

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; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };


// ────────────────────────────────────────────────────

int main() {
	int n; cin >> n;
	vii a(n);
	rep(i, n) cin >> a[i].first >> a[i].second;

	int m; cin >> m;
	a.resize(n + m);
	for (int i = n; i < n + m; ++i) cin >> a[i].first >> a[i].second;

	sort(ASC(a));
	a.erase(std::unique(a.begin(), a.end()), a.end());

	rep(i, a.size()) {
		if (i + 1 != a.size()) printf("%d:%02d ", a[i].first, a[i].second);
		else printf("%d:%02d\n", a[i].first, a[i].second);
	}
}



Measured memory_bytes: 3212
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
one = sum(1 for i in p if i <= a)
two = sum(1 for i in p if a + 1 <= i <= b)
three = sum(1 for i in p if b + 1<= i)
print(min(one, two, three))

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>

using namespace std;

typedef long long ll;

ll fac[300005];
ll rfac[300005];
const ll mod = 1e9 + 7;
ll ans;
ll p(ll a, ll x) {
  ll res = 1;
  while(x > 0) {
    if(x & 1) res = res * a % mod;
    a = a * a % mod;
    x >>= 1;
  }
  return res;
}

ll nCr(ll n, ll r) {
  return fac[n] * (rfac[r] * rfac[n-r] % mod) % mod;
}

int main() {
  ll n,a,b,c;
  cin >> n >> a >> b >> c;
  fac[0] = 1;
  rfac[0] = 1;
  for(ll i = 1; i <= 2 * n; i++) {
    fac[i] = fac[i-1] * i % mod;
    rfac[i] = p(fac[i],mod-2);
  }

  
  ll C = 1;
  if(c != 0) {
    C = (ll)100 * p(100-c,mod-2) % mod;
  }

  for(ll i = n; i <= 2 * n - 1; i++) {
    ll com = nCr(i - 1,n - 1);
    ans = (ans + com * i % mod * C % mod * p(a,n) % mod * p(b,i-n) % mod * p(p(a+b,i),mod-2) % mod) % mod;
    ans = (ans + com * i % mod * C % mod * p(b,n) % mod * p(a,i-n) % mod * p(p(a+b,i),mod-2) % mod) % mod;
  }

  cout << ans % mod<< endl;
}

  


Measured memory_bytes: 3840
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>

using namespace std;

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

#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}

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

const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const long double PI = 3.14159265358979323846;

// ****************************************CODE***************************************//

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

    sort(all(a));

    int ans = 0;
    int check = 0;
    while (check < n)
    {
        int tmp = a[check];
        int sumnum = 0;
        while (check < n && tmp == a[check])
        {
            check++;
            sumnum++;
        }
        if (sumnum % 2 != 0)
        {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))

a = rli()
a.sort()
if(a == [5,5,7]):
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 100005
ll ans[SIZE];
vector<ll> graph[SIZE];
ll vis[SIZE];
ll as[SIZE];
ll comp[SIZE];
vector<pll> block;
ll k=0;
ll DFS(ll u){
	vis[u]=1;
	ll cnt=0;
	comp[u]=k;
	for(auto v:graph[u]){
		if(vis[v]==0){
			cnt+=DFS(v);
		}
	}
	return cnt+1;
}
void assign(ll u,ll cnt){
	as[u]=1;
	ans[u]+=cnt-1;
	for(auto v:graph[u]){
		if(as[v]==0){
			assign(v,cnt);
		}
	}
}
int main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll N,M,K;
	cin>>N>>M>>K;
	for(int i=0;i<M;++i){
		ll u,v;
		cin>>u>>v;
		graph[u].pb(v);
		graph[v].pb(u);
		ans[u]--;
		ans[v]--;
	}
	for(int i=0;i<K;++i){
		ll u,v;
		cin>>u>>v;
		block.pb(mp(u,v));
	}

	for(int i=1;i<=N;++i){
		if(vis[i]==0){
			ll cnt=DFS(i);
			assign(i,cnt);
			k++;
		}
	}
	//for(int i=1;i<=N;++i) cout<<ans[i]<<" ";
	for(auto p:block){
		if(comp[p.first]==comp[p.second]){
			ans[p.first]--;
			ans[p.second]--;
		}
	}
	for(int i=1;i<=N;++i) cout<<ans[i]<<" ";
}

Measured memory_bytes: 12276
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

K = int(input())

a = 1
b = 1
c= 1
ans = 0

while a <= K:
  b = 1
  while b <= K:
    c = 1
    while c <=K:
      if gcd(a, b) == 1:
        ans += 1
      else:
        ans += gcd(a, b, c)
      c += 1
    b += 1
  a += 1
print(ans)

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

using namespace std;

using ll = long long;

ll solve(int n, string& s, int k) {
    int idx = 0;
    while (idx < n) {
        if (s[idx] == 'D') break;
        idx++;
    }

    if (idx == n) return 0;

    int j = min(idx + k, n);
    ll score = 0, cnt_c = 0, cnt_m = 0;
    for (int i = idx; i < j; i++) {
        if (s[i] == 'C') {
            score += cnt_m;
            cnt_c++;
        } else if (s[i] == 'M') {
            cnt_m++;
        }
    }

    ll res = score;
    for (int i = idx + 1; i < n; i++) {
        if (s[i] == 'D') {
            int nj = min(i + k, n);
            for (int ii = j; ii < nj; ii++) {
                if (s[ii] == 'C') {
                    score += cnt_m;
                    cnt_c++;
                } else if (s[ii] == 'M') {
                    cnt_m++;
                }
            }
            res += score;
            j = nj;
        } else if (s[i] == 'C') {
            cnt_c--;
        } else if (s[i] == 'M') {
            score -= cnt_c;
            cnt_m--;
        }
    }
    return res;
}

// DMCDMCC
// score = 5, cnt_c = 3, cnt_m = 2
// score = 2, cnt_c = 3, cnt_m = 1
// score = 2, cnt_c = 2, cnt_m = 1
//

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    int q;
    cin >> n >> s >> q;

    for (int i = 0; i < q; i++) {
        int k;
        cin >> k;
        cout << solve(n, s, k) << endl;
    }
    return 0;
}

Measured memory_bytes: 1948
from itertools import accumulate

N = int(input())
a_list = list(map(int, input().split()))
a_list.sort()

check = [False for _ in range(N)]

acc = tuple(accumulate(a_list))

for i in range(N - 1):
    if acc[i] * 2 >= a_list[i + 1]:
        check[i] = True
check[N - 1] = True

ans = 0
for c in check:
    if c:
        ans += 1
    else:
        ans = 0
print(ans)


Measured memory_bytes: 14428
#include "bits/stdc++.h"
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 - 1; i >= 0; i--)

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

int N;
int a[110];

int main()
{
    cin >> N;
    float sum = 0;
    rep(i, N)
    {
        cin >> a[i];
        sum += a[i];
    }
    float avg = sum / float(N);

    float diff = 5000.0;
    int thmfr = 10000;
    int thmidx = 10000;
    rep(i, N)
    {
        float diff2 = abs(a[i] - avg);
        if (diff2 < diff)
        {
            thmfr = a[i];
            thmidx = i;
            diff = diff2;
        }
    }

    cout << thmidx << endl;
}


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

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES\n")
#define Yes puts("Yes\n")
#define NO  puts("NO\n")
#define No  puts("No\n")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }


signed main() {

	int N;
	cin >> N;

	// N=1,2,4,8,はNG
	bool power = false;
	for (int i = 1; i > 0; i *= 2)
		if (N == i) { power = true;  break; }

	if (power == true) {
		No; return 0;
	}

	auto print = [](int a, int b) { cout << a << " " << b << endl; };

	Yes;

	print(1, 2);
	print(2, 3);
	print(3, 1 + N);
	print(1 + N, 2 + N);
	print(2 + N, 3 + N);

	for (int i = 4; i <= N-1; i += 2) {
		print(i, i + 1);
		print(i + 1, 1+N);
		print(1+N, i+N);
		print(i + N, i + 1 + N);
	}

	if (N % 2 == 0) {
		for (int i = 2; i <= N - 1; i++) {
			int b = (i ^ 1 ^ N);
			if (b <= N - 1 && i != b) {
				cerr << endl;
				cerr << i << endl;
				cerr << (i ^ 1 ^ N) << endl;
				cerr << endl;
				if (i % 2 == 0) {
					print(N, i + N);
//					print(i + N, 1+N);
				}else {
					print(N, i);
//					print(i, 1+N);
				}
				if (b % 2 == 0) {
					print(b + N, N + N);
				}
				else {
					print(b, N + N);
				}
				return 0;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 2816
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val input = scanner.nextLine()
    val value: CharArray = input.toCharArray()

    var number = 0
    for (v in value) {
        if (v == '+') number++
        if (v == '-') number--
    }

    println(number)
}

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

int main()
{
    int n, a;

    while( cin >> n )
    {
        if( n == 0 )
            break;
        int sum = 0;
        for( int i = 0; i < n / 4; i++ )
        {
            cin >> a;
            sum += a;
        }
        cout << sum << endl;
    }

    return 0;
}


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

#ifdef _DEBUG
inline void dump() { cerr << endl; }
template<typename Head> void dump(Head&& head) { cerr << head; dump(); }
template<typename Head, typename... Tail> void dump(Head&& head, Tail&&... tail) { cerr << head << ", "; dump(forward<Tail>(tail)...); }
#define debug(...) do {cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; dump(__VA_ARGS__); } while (false)
#else
#define dump(...)
#define debug(...)
#endif

template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////

const ll inf = 1LL<<60;

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

  ll ans = 0;
  for (int i=1; i<n; i++) {
    ll t = max(0LL, a[i-1]-a[i]);
    ans += t;
    a[i] += t;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4772
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;

void fill_one_ind(char *ptr, int width, int ones, int index) {
  for(int i = 0; i < width; i++) {
    *(ptr + i) = '0';
  }
  for(int i = 0; i < ones; i++) {
    int ind_cur = (i + index) % width;
    *(ptr + ind_cur) = '1';
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w, a, b;
  cin >> h >> w >> a >> b;

  char ans[h][w + 1];
  for(int i = 0; i < b ; i++) {
    for(int j = 0; j < a; j++) {
      ans[i][j] = '0';
    }
    for(int j = a; j < w; j++) {
      ans[i][j] = '1';
    }
  }
  for(int i = b; i < h; i++) {
    for(int j = 0; j < a; j++) {
      ans[i][j] = '1';
    }
    for(int j = a; j < w; j++) {
      ans[i][j] = '0';
    }
  }
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      cout << ans[i][j];
    }
    cout << "\n";
  }
  return 0;
}



Measured memory_bytes: 2304
import itertools
n, k  = map(int,input().split())
ans =0
for i in range(k,n+2):  #i 個選ぶ
    min = i*(i-1)//2
    max = i*(2*n-i+1)//2
    ans += max-min+1
    ans %=(10**9+7)
print(int(ans))

Measured memory_bytes: 63688
S = input()
length = len(S) - 1
S = list(S)
for i in range(2**length):
	sum=int(S[0])
	MP = []
	if i & 2**0:
		sum += int(S[1])
		MP.append("+")
	else:
		sum -= int(S[1])
		MP.append("-")
	if i & 2**1:
		sum += int(S[2])
		MP.append("+")
	else:
		sum -= int(S[2])
		MP.append("-")
	if i & 2**2:
		sum += int(S[3])
		MP.append("+")
	else:
		sum -= int(S[3])
		MP.append("-")
	if sum == 7:
		print("{0}{1}{2}{3}{4}{5}{6}=7".format(S[0], MP[0], S[1], MP[1], S[2], MP[2], S[3]))
		break


Measured memory_bytes: 38256
#include<iostream>
using namespace std;
int main()
{
	int a,b,i=1;
	while(cin>>a>>b)
	{
		if(a==0&&b==0)
		break;
		if(a<=b)
		cout<<a<<" "<<b<<endl;
		else
		cout<<b<<" "<<a<<endl;
	}
	return  0;
 } 


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

int main() {
	int n ;
	cin >> n;
	int a[n];
	for(int i=0;i<n;i++)cin >> a[i];
	int b[n];
	for(int i=0;i<n;i++)b[i]=a[i];
	sort(b,b+n);
	for(int i=0;i<n;i++){
		if(a[i]<b[n/2])cout<<b[n/2]<<endl;
		else cout<<b[n/2-1]<<endl;
	}
}


Measured memory_bytes: 3712
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
#define vv(a,b,c,d) vector<vector<a> >(b,vector<a>(c,d))
#define vvv(a,b,c,d,e) vector<vector<vector<a> > >(b,vv(a,c,d,e))
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    int N;
    while (cin >> N) {
        vi A(N);
        int ma = 0;
        rep(a, N) {
            cin >> A[a];
            smax(ma, A[a]);
        }

        int r = -1, mi = INT_MAX;
        each(a, A)if (a != ma) {
            int b = ma - a;
            int p = abs(a - b);
            if (p < mi) {
                r = a;
                mi = p;
            }
        }
        cout << ma << ' ' << r << endl;
    }
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};
 
template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};
 
 
 
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Timer TM;

    ll a,b,c;
    cin>>a>>b>>c;
    ll s=a+b+c;
    cout<<min(min(s-a,s-b),s-c)<<endl;
    return 0;
}

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

using namespace std;

int main() {
	string s;
	cin >> s;
	if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
		cout << "Bad" << endl;
	}
	else {
		cout << "Good" << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n) / gcd(n, m)*abs(m);//gl=xy
}
 
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;
}
 
using namespace std;


void solve(){
  string s;
  cin>>s;
  bool ng=false;
  rep(i,2){
    if(s[i]!=s[i+1])ng=true;
  }
  if(ng)cout<<"Yes";
  else cout<<"No";
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 256
height, width = map(int, input().split(" "))
target = []
white_num = 0
for h in range(height):
    temp = [n for n in input()]
    white_num += temp.count(".")
    target.append(temp)
queue = [[0, 0]]
goal = -1
turn = 1
visited = [[0 for n in range(width)] for m in range(height)]
visited[0][0] = 1
all_move = [[0, 1], [0, -1], [1, 0], [-1, 0]]

while queue:
    next_queue = []
    for q in queue:
        here_x, here_y = q
        if here_x == width - 1 and here_y == height - 1:
            goal = turn
        for move in all_move:
            next_x, next_y = move[0] + here_x, move[1] + here_y
            if 0 <= next_x < width and 0 <= next_y < height:
                if not visited[next_y][next_x] and target[next_y][next_x] == ".":
                    visited[next_y][next_x] = 1
                    next_queue.append([next_x, next_y])
    queue = next_queue
    turn += 1
# print(visited, turn, white_num)
if goal >= 0:
    print(white_num - goal)
else:
    print(-1)

Measured memory_bytes: 3064
N = int(input())
A = list(map(int, input().split()))
cnt = 0
chge = 0
for i in range(N):
    mn = A[i]
    for j in range(i+1, N):
        if mn > A[j]:
            mn = A[j]
            idx = j
            chge = 1
    if chge:
        A[idx] = A[i]
        A[i] = mn
        cnt += 1
        chge = 0

for i in range(N):
    if i == N - 1:
        print(A[i])
    else:
        print(str(A[i]), end = " ")
print(cnt)

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()
auto &errStream = cerr;
#ifdef LOCAL
#define cerr (cerr << "-- line " << __LINE__ << " -- ")
#else
class CerrDummy {
} cerrDummy;
template <class T> CerrDummy &operator<<(CerrDummy &cd, const T &) {
  return cd;
}
using charTDummy = char;
using traitsDummy = char_traits<charTDummy>;
CerrDummy &operator<<(CerrDummy &cd,
    basic_ostream<charTDummy, traitsDummy> &(
      basic_ostream<charTDummy, traitsDummy> &)) {
  return cd;
}
#define cerr cerrDummy
#endif
#define REACH cerr << "reached" << endl
#define DMP(x) cerr << #x << ":" << x << endl
#define ZERO(x) memset(x, 0, sizeof(x))
#define ONE(x) memset(x, -1, sizeof(x))

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

#define CAPITAL
void Yes(bool ex = true) {
#ifdef CAPITAL
  cout << "YES" << endl;
#else
  cout << "Yes" << endl;
#endif
  if (ex)
    exit(0);
}
void No(bool ex = true) {
#ifdef CAPITAL
  cout << "NO" << endl;
#else
  cout << "No" << endl;
#endif
  if (ex)
    exit(0);
}

const ll infLL = LLONG_MAX / 3;

#ifdef int
const int inf = infLL;
#else
const int inf = INT_MAX / 2 - 100;
#endif

signed main() {
  int N = read(), T = read();

  int ans = INT_MAX, cost, time;
  REP(i, N) {
    cost = read();
    time = read();
    if (time <= T)
      chmin(ans, cost);
  }
  if (ans == INT_MAX)
    cout << "TLE" << endl;
  else
    print(ans);

  return 0;
}


Measured memory_bytes: 256