akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void) {
	int i, j, len;
	int f = 0;
	char c, d;
	char s[200001] = {}, t[200001] = {};

	scanf("%s%s", s, t);
	if (strlen(s) == strlen(t)) f = 1;
	len = strlen(s);

	for (i = 0; i < len; i++) {
		if (s[i] != t[i]) {
			c = s[i];
			d = t[i];
			
			for (j = 0; j < len; j++) {
				if (t[j] == c) {
					t[j] = d;
					if (i > j) {
						f = 0;
						break;
					}
				} else if (t[j] == d) {
					t[j] = c;
					if (i > j) {
						f = 0;
						break;
					}
				}
			}
		}
	}
	
	printf(f ? "Yes\n" : "No\n");
	return 0;
}

Measured memory_bytes: 512
$N=<>;
@a=glob<>;
while(grep$_>=$N,@a){
	$s=0;
	$a[$_]-=$N*($b[$_]=$-=$a[$_]/$N),$s+=$-for 0..$N-1;
	$a[$_]+=$s-$b[$_]for 0..$N-1;
	$%+=$s
}
print$%


Measured memory_bytes: 768
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	int n;
	scanf("%d", &n);
	vector<pii> v(n);
	for(int i = 0; i < n; ++i){
		int a;
		scanf("%d", &a);
		v[i] = pii(a, i);
	}
	sort(ALL(v));

	vint ans(n);
	for(int i = 0; i < n; ++i){
		if(i < n / 2){
			ans[v[i].second] = v[n / 2].first;
		}
		else{
			ans[v[i].second] = v[n / 2 - 1].first;
		}
	}
	for(int x : ans){ printf("%d\n", x); }
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 4480
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;
    cin >> s >> t;
    map<ll,ll> mp, mp2;
    ll idx = 1;
    ll v1[200010] = {}, v2[200010] = {};
    ll N = s.size();
    rep(i,0,N){
        if(mp[s[i]] == 0){
            mp[s[i]] = idx;
            idx++;
        }
        v1[i] = mp[s[i]];
    }
    idx = 1;

    rep(i,0,N){
        if(mp2[t[i]] == 0){
            mp2[t[i]] = idx;
            idx++;
        }
        v2[i] = mp2[t[i]];
    }
    bool ok = true;
    rep(i,0,N){
        if(v1[i] != v2[i]) ok = false;
    }
    if(ok){
        print("Yes");
    }else{
        print("No");
    }

}

Measured memory_bytes: 3988
#include "bits/stdc++.h"
using namespace std;
/////////////////// TYPES & MACROS ///////////////////////////////
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define vv vector
#define exist(s,e) (s.find(e)!=s.end())
#define sz(x) ((int)(x).size())
#define int ll
typedef long long ll; typedef long double ld; typedef double dd;typedef vector<int> vi; typedef pair<int, int> pii;typedef pair<ll,ll> pll;
ll INFLL=(ll)4e18, MOD=1e9+7; const int INF=0x3f6f6f6f;
//////////////////// DEBUG /////////////////////////////////////////
#define D(x) cerr<<#x<<" is:\t"<<x<<'\n';
#define DD(x,y) cerr<<'('<<#x<<','<<#y<<") are:\t"<<x<<' '<<y<<'\n';
#define DDD(x,y,z) cerr<<'('<<#x<<','<<#y<<','<<#z<<") are:\t"<<x<<' '<<y<<' '<<z<<'\n';
/////////////////// VARIABLES & FUNCTIONS//////////////////////////
vv<vv<int>> adj; vi vis, color, level; int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1},dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
inline ll mexp(ll x,ll n,ll m=MOD){ll res=1;x%=m;while(n){if(n&1)res=(res*x)%m;n>>=1;x=(x*x)%m;}return res;}
inline ll gcd(ll a, ll b){while (a>0 && b>0){if(a>b)a%=b;else b%=a;}return a+b;}



///////////////////// MAIN STARTS //////////////////////////////////
int32_t main(void){
ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
cout<<fixed;cerr<<fixed; cout<<setprecision(1); cerr<<setprecision(3);
mt19937 genr(chrono::high_resolution_clock::now().time_since_epoch().count());



int n; cin>>n;
vv<vv<ll>> dp(n+1,vv<ll>(3,0));
vv<ll> v(3);
for(int i=0;i<n;++i){
    for(int j=0;j<3;++j) cin>>v[j];
    for(int x=0;x<3;++x) for(int y=0;y<3;++y){
        if(x==y) continue;
        else dp[i+1][y]=max(dp[i+1][y], dp[i][x]+v[y]);
    }
}
// for(int i=0;i<3;++i) for(int j=0;j<=n;++j) cout<< dp[j][i] <<" \n"[j==n]; 
cout<< *max_element(all(dp[n])) <<'\n'; 


return 0;
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()

int main(){
	int N,K;cin>>N>>K;
	if(K>(N-1)*(N-2)/2){
		cout<<-1<<endl;
	}else{
        cout<<N*(N-1)/2-K<<endl;
		rep(i,1,N){
			cout<<i<<" "<<N<<endl;
		}int count=0;
		rep(i,1,N){
			rep(j,1,i){
				count++;
				if(count>K) cout<<i<<" "<<j<<endl;
			}
		}
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

//??´???AB????§?????????´???BC????§??????????RotType????¨????(A???B???C????????§??????)
//RotType = ????????¢1, ????????¢-1, ??´???0
int getRotType( double angle_a, double angle_b ){
	const int eps = 1e-8;
	const double PAI = 3.14159265358979;
	
	if( fabs(angle_a - angle_b) <= eps )
		return 0;
	if( angle_a > angle_b + PAI )
		angle_b += 2 * PAI;
	else if( angle_b > angle_a + PAI )
		angle_a += 2 * PAI;
	
	if( angle_b > angle_a )	//?§????????¢????????????????
		return 1;
	return -1;	//?§???????????°?????????????
}

int main()
{
	double x[4], y[4];
	while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]) != -1)
	{
		//A???B???C, B???C???D, C???D???A?????????????????¨???????????????????????????
		double ang[4];
		
		for( int i = 0; i < 4; i++ )
			ang[i] = atan2(y[(i+1)%4] - y[i%4], x[(i+1)%4] - x[i%4]);
		
		double angType[4];
		for( int i = 0; i < 4; i++ )
			angType[i] = getRotType( ang[i], ang[(i+1)%4] );
		
		int i;
		for( i = 0; i < 3; i++ ){
			if( angType[i] != angType[i+1] )
				break;
		}
		if( i == 3 )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 1284
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    int S, W;
    cin >> S >> W;
    cout << (W >= S ? "unsafe" : "safe") << endl;
}

Measured memory_bytes: 3584
using System;

    class Program
    {
        static void Main(string[] args)
        {
            int n;

            string num1 = Console.ReadLine();
            n = int.Parse(num1);

            string[] num2 = Console.ReadLine().Split(' ');
            int[] array = new int[n];

            for (int i = n - 1; i >= 0; i--)
            {
                array[i] = int.Parse(num2[i]);
                Console.Write(array[i]);
                if (i == 0)
                {
                    break;
                }

                Console.Write(" ");
            }
                Console.WriteLine("");
        }
    }



Measured memory_bytes: 9180
/**
*    Username : adhoc_king
*    Name : adhoc_king
*    Institute : IIT Bombay
*/

// #include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
// #include <deque>
// #include <queue>
// #include <array>
// #include <ctime>
// #include <list>
#include <map>
// #include <set>
// #include <cassert>
// #include <complex>
// #include <sstream>
// #include <forward_list>
// #include <unordered_set>
// #include <unordered_map>
using namespace std;

#define pb push_back
#define mp make_pair
#define scani(n) scanf("%d",&n);
#define EPS 1e-9
#define FOR(i,n) for(int i=0; i<n; i++)
#define X first
#define Y second
#define arrinput for(int i=0; i<n; i++) cin>>arr[i];
#define arrsum for(int i=0; i<n; i++) sum+=arr[i];
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define forr(i,n) for(int i=n-1; i>=0; i--)
#define all(v) v.begin(), v.end()

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int MOD = 1e9+7;
const int n_ = 1e5+1000;
const long double PI = acos(-1.0);

ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

bool vowel(char ch) {
    if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') return true;
    else return false;
}

int brr[100005];

int main()
{
    // #define int long long
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    int n, q, l, r;
    cin>>n>>q;
    string str;
    cin>>str;
    memset(brr, 0, sizeof(brr));
    for0(i,n+3) {
        if(i>0 && i<n && str[i] == 'C' && str[i-1] == 'A') {
            brr[i+1] = brr[i] + 1;
        }
        else brr[i+1] = brr[i];
    }
    // for0(i,10) cout<<brr[i]<<" "; cout<<endl;
    for0(w,q) {
        cin>>l>>r;
        cout<<brr[r] - brr[l]<<endl;
    }

    return 0;
}

Measured memory_bytes: 1488
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int a = n / 100;
        int b = (n - a * 100) / 10;
        int c = (n - a * 100 - b * 10);

        if (a < b || a < c) {
            System.out.println((a + 1) * 100 + (a + 1) * 10 + (a + 1));
        } else {
            System.out.println(a * 100 + a * 10 + a);
        }
    }
}








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

int main(){
    long int c,b,h,n,N;
    cin>>N;
    for(h=0;h<3500;h++){
        for(n=0;n<3500;n++){
            c= N*h*n;
            b= 4*n*h-N*n-N*h;
            if(b>0 && c!=0){
                if(c%b==0){
                    cout<<h<<' '<<n<<' '<<long(c/b)<<endl;
                    return 0;
                }
            }
        }
    }
}       

Measured memory_bytes: 256
from collections import Counter

n = int(input())
history = []
for _ in range(n):
    history.append(input())


cnt = Counter(history)
for val in cnt.values():
    if val >= 2:
        print('No')
        exit()

for i in range(1,n):
    if history[i][0] != history[i-1][-1]:
        print('No')
        exit()

print('Yes')

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

typedef pair<int, int> Pii;

void readint(int N, vector<int> &a);
void readdouble(int N, vector<double> &a);
void readindex(int N, vector<int> &a);



signed main(){

    int N;
    cin >> N;
    N /= 3;
    cout << N;    
    
    return 0;
}








void readint(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str());
}
void readdouble(int N, vector<double> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atof(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atof(s.c_str());
}
void readindex(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str()) - 1;
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str()) - 1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }
const double PI = 3.14159265358979323846;
int vector_finder(vector<int> vec, int number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance(vec.begin(), itr);
  if (index != vec.size()) {  // 発見できたとき
    return 1;
  } else {  // 発見できなかったとき
    return 0;
  }
}
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n - k; i++) {
    if (a[i] < a[k + i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 4404
#define f first
#define s second
#define loop(a,b) for(int i=a;i<b;i++)
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define ll long long
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define loop2(a,b) for(int j=a;j<b;j++)
#define str_in cin.ignore(numeric_limits<streamsize>::max(), '\n')
#define sz(a) int(a.size())
#define displaymatrix(a,m,n) for(int i=0;i<m;i++)\
{for(int j=0;j<n;j++)cout<<a[i][j]<<" ";cout<<endl;}
#define printarray(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}nl;
#define vinput(a,n) vl a(n);loop(0,n)cin>>a[i]
#define ainput(a,n) loop(0,n)cin>>a[i]

//#define all(c) c.begin(),c.end()
#define tr(container,it)\
for(__typeof(container.begin()) it=container.begin();it!=container.end();it++)
#include<bits/stdc++.h>

using namespace std;

const int mod=1e+9+7;

void solve(){
    double PI = 2.0*acos(0);
    int a,b,h,m;
    cin >> a >> b >> h >> m;
    double degh = (PI/6.00)*h;
    double degm = (PI/30.00)*m;
    degh += degm/12;
//    double dif = PI*((degh - degm)/(180.00));
    double ans = sqrt(a*a + b*b - (2.0*a*b)*cos(degh-degm));
    cout << fixed << setprecision(19) << ans << "\n";
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int t=1;
    //    cin>>t;
    while(t--) solve();
    return 0;
}



Measured memory_bytes: 4232
n, x, y = map(int, input().split())
ans = [0]*(n-1)

for i in range(1, n+1):
    for j in range(i+1, n+1):
        min_dis = min(j-i, abs(i-x)+abs(j-y)+1)
        ans[min_dis - 1] += 1

for x in ans:
    print(x)

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

using namespace std;
long long memo[100100][5],n,a[100005],b[100005],c[100005] ;
// 0 swim
//1 Catch bugs
// 2 homework
long long dp(long long i,long long last){
   if(i == n)
        return 0;
    if(memo[i][last]!=-1)
        return memo[i][last];
        long long Res1=-2e14;

if(last!=0)
     Res1=max(dp(i+1,0)+a[i],Res1);


if(last!=1)
     Res1=max(dp(i+1,1)+b[i],Res1);


if(last!=2)

     Res1=max(dp(i+1,2)+c[i],Res1);



return memo[i][last]=Res1;

}

int main()
{
    cin>>n;
    for(long long i=0; i<n; i++)
        scanf("%164d%164d%164d",&a[i],&b[i],&c[i]);

        memset(memo,-1,sizeof(memo));
    cout<<dp(0,4);

    return 0;
}


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

int main() {
    long long a, b, k;
    cin >> a >> b >> k;
    if(a + b <= k) {
        a = 0;
        b = 0;
    } else if(a >= k)
        a -= k;
    else {
        b -= (k - a);
        a = 0;
    }
    cout << a << endl
         << b << endl;
}

Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define M 1000000007LL
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(v) ((ll)v.size())
#define mp make_pair
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pii pair<ll,ll> 
#define mod 998244353LL
#define MAXN 300002
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll s;
  cin>>s;
  ll gg=1000000000LL;
  ll m=gg-s%gg;
  if(m==gg)m=0;
  cout<<0<<" "<<0<<" "<<gg<<" "<<1<<" "<<m<<" "<<(s+m)/gg;
}    

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	int N;
	int A, B;

	N = scan.nextInt();

	if(N == 1){
	    System.out.println("Hello World");
	}else{
	    A = scan.nextInt();
	    B = scan.nextInt();
	    System.out.println(A+B);
	}
    }
}


Measured memory_bytes: 21716
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    ll n; cin >> n;
    vl h(n);
    rep(i,n) cin >> h[i];
    ll ans = 0;
    ll mx = 0;
    rep(i,n){
        if(h[i] > mx){
            ans += h[i] - mx;
            mx = h[i];
        }else{
            mx = h[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

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

int main(){
    int a,b;
    cin >> a >> b;
    rep(i,100000){
        if(i*8/100 == a && i*10/100 == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 888
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<memory>
#include<cmath>
#include<stack>
#include<tuple>
#include<numeric>
#include<cassert>

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pb push_back
#define DEBUG false

using namespace std;

using ll = long long;
using P = pair<int,int>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll LINF=1LL<<60;
const int MAX_N= 12;
const ll lmod = 1e9+7;

int main(){
  int N,a,b;
  cin >> N ;
  b = 1;
  rep(i,N){
    cin >> a ;
    if((a%2)==0){
      b*=2;
    }
  }
  int ans = 1;
  rep(i,N) ans *= 3;
  cout << ans - b << endl;
  return 0;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/abc079/tasks/abc079_d
import sys
input = sys.stdin.readline
# int(input()) # 入力が1つ
h, w = map(int, input().split()) # 入力が複数

graph = []
for _ in range(10):
    row = [int(i) for i in input().split()]
    graph.append(row)

def warshall_floyd(graph, n):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])
warshall_floyd(graph, 10)
ans = 0
for _ in range(h):
    row = [int(i) for i in input().split()]
    for wall in row:
        if wall == -1 or wall == 1:
            continue
        ans += graph[wall][1]
print(ans)

Measured memory_bytes: 40684
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    s=STR()
    a=s.count('+')
    b=s.count('-')
    print(a-b)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3060
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    ret = MAX

    for n in range(1, int((N + 1)**0.5)+1):
        if N % n == 0:
            ret = min(ret, n + (N // n) - 2)
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 10480
#include<iostream>  
using namespace std;
int a[200005];
int main()
{
	int n, count1, count2;
	while (cin >> n)
	{
		int flag = 0;
		count1 = count2 = 0;
		for (int i = 0; i<n; i++)
		{
			cin >> a[i];
			if (a[i] % 4 == 0)
				count1++;
			if (a[i] % 2 != 0)
				count2++;
		}
		if (count2 == count1 + 1 && count2 + count1 == n)    
			flag = 1;
		if (count1 >= count2)      
			flag = 1;
		if (flag)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main() {
	int n, r, t;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> r >> t;
		if (t % 30 == 0) {
			if (r % 100 == 0) {
				cout << (t / 30) * 5 + r / 100 << endl;
			}
			else {
				cout << (t / 30) * 5 + r / 100 << ' ' << 1 + (t / 30) * 5 + r / 100 << endl;
			}
		}
		else {
			if (r % 100 == 0) {
				cout << (t / 30) * 5 + r / 100 << ' ' << 5 + (t / 30) * 5 +r / 100 << endl;
			}
			else {
				cout << (t / 30) * 5 + r / 100 << ' ' << 1 + (t / 30) * 5 + r / 100 << ' ' << 5 + (t / 30) * 5 + r / 100 << ' ' << 6 + (t / 30) * 5 + r / 100 << endl;
			}
		}
	}
	return 0;
}

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

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string a, b; cin >> a >> b;
  if(a.size() < b.size()) cout << "LESS\n";
  else if( a.size() > b.size()) cout << "GREATER\n";
  else{
    int id = -1;
    for(int i = a.size() - 1 ; i >= 0; i--) id = (a[i] != b[i])? i : id;
    if(id == -1) cout << "EQUAL\n";
    else if(a[id] < b[id]) cout << "LESS\n";
    else if(a[id] > b[id]) cout << "GREATER\n";
  }
  return 0;
}


Measured memory_bytes: 256
from collections import Counter
n = int(input())
s = []
ans = []
for i in range(n):
  s.append(input())
#s_set = set(s)
s_counter = Counter(s).most_common()
check_num = s_counter[0][1]
#print(s_counter)
for i in s_counter:
  if i[1] == check_num:
    ans.append(i[0])
  else:
    break
ans.sort()
for i in ans:
  print(i)



Measured memory_bytes: 45040
#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstdlib>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
  int i,j,k;
  int h,w;
  while(cin>>h>>w,h||w){
    int a[22][22],sx,sy,tx,ty;
    memset(a,-1,sizeof(a));
    for(i=1;i<h+1;i++){
      for(j=1;j<w+1;j++){
	char s;
	cin>>s;
	if(0){
	}else if(s=='#'){
	  a[j][i]=-2;
	}else{
	  a[j][i]=-3;
	  if(0){
	  }else if(s=='A'){
	    sx=j;
	    sy=i;
	  }else if(s=='B'){
	    tx=j;
	    ty=i;
	  }
	}
      }
    }
    string s;
    cin>>s;
    int ln=s.length();
    queue<pair<pair<int,int>,int> > b;
    b.push(make_pair(make_pair(sx,sy),0));
    while(b.empty()==0){
      int x,y,z;
      x=b.front().first.first;
      y=b.front().first.second;
      z=b.front().second;
      b.pop();
      if(a[x][y]==-3){
	a[x][y]=z;
	b.push(make_pair(make_pair(x-1,y),z+1));
	b.push(make_pair(make_pair(x+1,y),z+1));
	b.push(make_pair(make_pair(x,y-1),z+1));
	b.push(make_pair(make_pair(x,y+1),z+1));
      }
    }
    int x=tx,y=ty;
    int c[22][22][10],d[22][22][10];
    memset(c,-1,sizeof(c));
    memset(d,-1,sizeof(d));
    c[x][y][ln-1]=0;
    int mn=1<<30,xmn,ymn;
    j=0;
    for(;;){
      for(i=0;i<ln;i++){
	j++;
	if(0){
	}else if(s[i]=='5'){
	}else if(s[i]=='8'){
	  if(a[x][y-1]!=-1)
	    y--;
	}else if(s[i]=='6'){
	  if(a[x+1][y]!=-1)
	    x++;
	}else if(s[i]=='4'){
	  if(a[x-1][y]!=-1)
	    x--;
	}else if(s[i]=='2'){
	  if(a[x][y+1]!=-1)
	    y++;
	}
	if(c[x][y][i]==-1){
	  c[x][y][i]=j;
	  if(a[x][y]>=0&&a[x][y]<=j){
	    if(mn>j){
	      mn=j;
	      xmn=x-1;
	      ymn=y-1;
	    }
	  }
	}else{
	  if(d[x][y][i]){
	    d[x][y][i]=0;
	    if(a[x][y]>=0&&a[x][y]>c[x][y][i]){
	      for(k=0;a[x][y]>c[x][y][i]+ln*k;k++);
	      if(mn>c[x][y][i]+ln*k){
		mn=c[x][y][i]+ln*k;
		xmn=x-1;
		ymn=y-1;
	      }
	    }
	  }else{
	    break;
	  }
	}
      }
      if(i!=ln)
	break;
    }
    if(mn==1<<30)
      cout<<"impossible"<<endl;
    else
      cout<<mn<<" "<<ymn<<" "<<xmn<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
while n = gets.to_i
  break if n == 0
  l = gets.split.map(&:to_i)
  dif = l.zip(l[1..-1])[0...-1].map{ |v| v[1] - v[0] } << 2
  ret = []
  f = false
  n.times do |i|
    if dif[i] > 1
      if f
        ret[-1] = ret[-1] + "-" + l[i].to_s
        f = false
      else
        ret << l[i].to_s
      end
    else
      if !f
        ret << l[i].to_s
        f = true
      end
    end
  end
  puts ret.join(" ")
end

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

int main() {
    int x; cin >> x;
    int ans = 0;
    int zan = 0;
    ans = (x/500) * 1000;
    zan = x%500;
    ans += (zan/5) *5;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
def main():
    a,b,c,x,y = [int(i) for i in input().split()]
    ans = 1 << 32
    if x < y:
        tmp = 2*x*c
        tmp += (y-x)*b
        ans = min(tmp,ans)
    else:
        tmp = 2*y*c
        tmp += (x-y)*a
        ans = min(tmp,ans)
    if a//2+b//2 < c:
        ans = x*a+ y*b
    ans=min(ans,2*max(x,y)*c)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	int num[100]={0};
	for(int i=0;i<n;i++){
		cin>>num[i];
	}
	sort(num,num+n);
	double sum=num[0];
	for(int i=1;i<n;i++){
		sum=(sum+num[i])*1.0/2;
	}
	cout<<sum<<endl;
//	printf("%.1f\n",sum);
	return 0;
}

Measured memory_bytes: 256
using System;

class Program
{

	static void Main(string[] args)
	{
		// 整数の入力
		int a = int.Parse(Console.ReadLine());
		int b = int.Parse(Console.ReadLine());
		int c = int.Parse(Console.ReadLine());
		int x = int.Parse(Console.ReadLine());
		int totalCount = 0;
		for (int i = 0; i <= a; i++)
		{
			for (int j = 0; j <= b; j++)
			{
				for (int k = 0; k <= c; k++)
				{
					if (500 * i + 100 * j + 50 * k == x)
						totalCount++;
				}
			}
		}
		Console.WriteLine(totalCount);
	}
}

Measured memory_bytes: 11092
a = int(input())
b = int(input())

if (a==1) and (b==2):
  print(3)
if (a==1) and (b==3):
  print(2)
if (a==2) and (b==1):
  print(3)
if (a==2) and (b==3):
  print(1)
if (a==3) and (b==1):
  print(2)
if (a==3) and (b==2):
  print(1)

Measured memory_bytes: 3064
H, W = map(int, input().split())
C = [0]*10
for i in range(10):
    C[i] = [int(x) for x in input().split()]

for k in range(0, 10):
    for i in range(0, 10):
        for j in range(0, 10):
            if C[i][j] > C[i][k] + C[k][j]:
                C[i][j] = C[i][k] + C[k][j]
cost = 0
A = [0]*H
for h in range(H):
    for a in map(int, input().split()):
        if a == 1 or a == -1:
            continue
        cost += C[a][1]
print(cost)


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int n, m;
    cin >> n >> m;

    vector<string> a(n);
    rep(i, n) {
        string sa;
        cin >> sa;
        a[i] = sa;
    }
    vector<string> b(m);
    rep(i, m) {
        string sb;
        cin >> sb;
        b[i] = sb;
    }

    rep(i, n-m+1) {
        rep(j, n-m+1) {
            int flag = 1;
            rep(h, m) {
                rep(w, m) {
                    if(a[i+h][j+w] != b[h][w]) {
                        flag = 0;
                    }
                }
            }
            if(flag) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int x;
    cin >> x;
    if(x == 3 || x == 5 || x == 7){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define dbg(var) cout<<#var<<"="<<var<<" "
#define nl cout<<"\n"
#define fr(i,n) for(int i=0;i<n;i++)
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define fast ios::sync_with_stdio(false);cin.tie(0);
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define fa(v) for(auto &i:v)
#define all(v) v.begin(),v.end()
#define sz(v) (int)(v.size())
#define int long long
int32_t main()
{
    int n ;cin >> n;vi v(n);fr(i,n) cin >> v[i];
    v.pb(-1);
    vvi lst;vi temp;
    fr(i,n){
    	temp.pb(v[i]);
    	if(v[i+1] < v[i]){
    		if(sz(temp)) lst.pb(temp);
    		temp.clear();
    	}
    }
    int cur = 1000, ans = 0;
    for(auto vv: lst){
    	int rem = cur % vv[0];
    	cur = (vv.back()) * (cur / vv[0]);
    	cur += rem;
    }
    cout << cur;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  int d[k];
  for (int i = 0; i < k; i++) cin >> d[i];
  auto f = [&](int x) {
    while (x) {
      if (binary_search(d, d + k, x % 10)) return false;
      x /= 10;
    }
    return true;
  };
  while (1) {
    if (f(n)) break;
    n++;
  }
  cout << n << "\n";
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){

	double v;
	double t;
	double y;

	while(scanf("%lf",&v)!=EOF){

		t = v / 9.8 ;

		y = 4.9*t*t;

		printf("%d\n",(int)((y+5.0)/5)+1);

	}

	return 0;

}

Measured memory_bytes: 1056
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        char[] s = Console.ReadLine().ToCharArray();
        int[] nums = new int[n + 1];
        for (int i = 1; i <= n; i++)
            nums[i] = nums[i - 1] + ((s[i - 1] == 'W') ? 1 : 0);
        int wn = s.Count(p => p == 'W');
        int ans = int.MaxValue;
        for (int i = 1; i <= n; i++)
            ans = Math.Min(ans, 2 * nums[i - 1] + n - i - wn + ((s[i - 1] == 'W') ? 1 : 0));
        Console.WriteLine(ans);
    }
}

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

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int[] a = cin.arrayInt();

        int ret = 0;
        for (int i = 0; i < N; i++)
        {
            ret += a[i] - 1;
        }

        Console.WriteLine(ret);
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}

Measured memory_bytes: 13200
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <algorithm>

using namespace std;

int main()
{
  int N, K;
  string s;
  cin >> N >> K;
  cin >> s;
  s[K-1] = 'a' + (s[K-1] - 'A');
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

const P: i64 = 1_000_000_007;

fn main() {
    let S = rl();

    let mut k = 1;
    let mut A = 0;
    let mut AB = 0;
    let mut ABC = 0;

    for c in S.chars() {
        match c {
            'A' => {
                // 左にある ? の数 Q に対して 3^Q 個の重複がある。
                A += k;
                A %= P;
            }
            'B' => {
                AB += A;
                AB %= P;
            }
            'C' => {
                ABC += AB;
                ABC %= P;
            }
            '?' => {
                // ? を A, B, C のどれに選ぶかによって、左にある ABC の選び方は3倍に増える。
                // さらに C を選んだときのみ、左にある AB の選び方だけ ABC の選び方が増える。
                ABC *= 3;
                ABC %= P;
                ABC += AB;
                ABC %= P;

                AB *= 3;
                AB %= P;
                AB += A;
                AB %= P;

                A *= 3;
                A %= P;
                A += k;
                A %= P;

                k *= 3;
                k %= P;
            }
            _ => unreachable!(),
        }
    }

    println!("{}", ABC)
}


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

using ll = long long;
using pii = pair<int, int>;

#define     endl               "\n"
#define     fast_io            ios::sync_with_stdio(false); cin.tie(0);
#define     file_io            freopen("input.txt", "r", stdin);   \
                               freopen("output.txt", "w", stdout);
#define     all(x)             begin(x), end(x)
#define     debug(x)           cerr <<"Line "<< __LINE__ <<" : "<< #x " = "<< x <<endl;
 
template<typename T, typename TT>
ostream& operator<<(ostream &os, const pair<T, TT> &t) { return os<<"("<<t.first<<", "<<t.second<<")"; }
template<typename T>
ostream& operator<<(ostream& os, const vector<T> &t) { for(auto& i: t) os<<i<<" "; return os; }
 



int main(int argc, char** argv) {
    fast_io
   
	int n;
	cin >> n;
	
	for(int i = 1, x; i <= n; ++i) {
		x = i;
		if(x % 3 == 0) {
			cout << " " << i;
			continue;
		}
		do {
			if ( x % 10 == 3 ) {
				cout << " " << i;
				break;	
			}
		} while((x/10) && (x/=10));
	}
	cout << endl;
	

    return 0;
}























Measured memory_bytes: 3168
import fractions, functools
def lcm_base(x, y):
  return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
  return functools.reduce(lcm_base, numbers, 1)

n = int(input())
list_t = [int(input()) for _ in range(n)]
print(lcm_list(list_t))

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

int main(){
  int n,a;
  cin>>n;
  map<int,int> m;

  while(n--){
    cin>>a;
    m[a]++;
  }

  a=0;
  for(auto &e:m){
    if(e.second%2==1)a++;
  }

  cout << a << endl;
  return 0;
}


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

const int MAXN = 100010;
const int MAXD = 11;
const int MAXQ = 100010;
int N, M, Q;
vector<int> adj[MAXN];
bool vis[MAXN][MAXD];
int V[MAXQ], D[MAXQ], C[MAXQ];

int ans[MAXN];

void dfs(int cur, int prv, int d, int c) {
	if (vis[cur][d]) return;
	vis[cur][d] = true;
	if (ans[cur] == 0) {
		ans[cur] = c;
	}
	if (d == 0) return;
	for (int nxt : adj[cur]) {
		if (nxt == prv) continue;
		dfs(nxt, cur, d-1, c);
	}
}

int main() {
	scanf("%d %d", &N, &M);
	for (int i = 0; i < M; i++) {
		int a, b; scanf("%d %d", &a, &b);
		adj[a].push_back(b);
		adj[b].push_back(a);
	}

	scanf("%d", &Q);
	for (int i = 0; i < Q; i++) {
		scanf("%d %d %d", &V[i], &D[i], &C[i]);
	}
	for (int i = Q-1; i >= 0; i--) {
		dfs(V[i], 0, D[i], C[i]);
	}

	for (int i = 1; i <= N; i++) {
		printf("%d\n", ans[i]);
	}

	return 0;
}


Measured memory_bytes: 9080
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

int N;

vector<int> va;

int main() {
    GI(N);

    FORN(i, N) {
        int a;
        GI(a); va.PB(a);
    }

    LL best = 1LL * INF * INF;

    for (int i = -100; i <= 100; i++) {
        LL cost = 0;
        for (auto& a : va) {
            cost += (a - i) * (a - i);
        }

        best = min(best, cost);
    }

    cout << best << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;

long long const MOD = 1000000007LL;

int main() {
    int x;
    cin >> x;

    if (x == 7 || x == 5 || x == 3) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  char c='1';
  s+=c;
  int cnt=0;
  int w=s.size();
  for(int i=0;i<w-1;i++){
    if(s.at(i)!=s.at(i+1)){
      cnt++;
    }
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 512
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        x: u8,
        a: u8,
    }
    if x < a {
        println!("{}", 0);
    } else {
        println!("{}", 10);
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>
int main(){
	char str[4];
	int a[4]={0},b=0,t=0;
	gets(str);
	for(int i=0;i<3;i++){
		for(int j=i+1;j<4;j++){
			if(str[i]==str[j]){a[b]++;b++;} 
		}
	}
	for(int i=0;i<4;i++){
		if(a[i]==1)t++;
			
	}
	if(t==2)printf("Yes");
	else printf("No");
	return 0;
}

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

#define int           long long
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (long long )(1e10+1)
#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii>

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){
    cerr << name << " = " << arg1 << endl;
}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args){
    const char *name = strchr(names, ',');cerr.write(names, name-names) << " = " << arg1 << endl;_F(name+2, args...);
}
template<typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2> &q){ 
    in >> q.F >> q.S; return in;
}
template<typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> &q){
    out << q.F << " " << q.S; return out;
}
template< typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){
    return {p1.F+p2.F, p1.S+p2.S};
}
template< typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){
    return {p1.F-p2.F, p1.S-p2.S};
}

void solve() {
    string s;
    cin >> s;
    if(s == "ARC"){
        cout << "ABC" << endl;
    }else{
        cout << "ARC" << endl;
    }
}

signed main(){

    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);   

    int t = 1;
    start = clock(); 

    cout << fixed << setprecision(20);

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin); 
    // freopen("output.txt", "w", stdout);
    // freopen("error.txt", "w", stderr);
    // #endif
   
    //cin >> t;

    
    for(int i = 1; i <= t; ++i){
        //cout << "Case #" << i << ": "; 
        solve();
        //cout << endl;
    }
    //cerr << time(start);
    return 0;
}


Measured memory_bytes: 3656
#include<stdio.h>
int main(void)
{
  int S,h,m,s;
  scanf("%d",&S);
  s=S%60;
  m=S/60;
  h=m/60;
  m=m%60;
  printf("%d:%d:%d\n",h,m,s);
  return 0;
}


Measured memory_bytes: 2080
import sys, math
from collections import deque
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    S = input()
    K = ii()
    ans = ''.join([S[i] if S[i] == S[K-1] else '*' for i in range(N)])
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 65344