akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll a,b,c;
  cin >> a >> b >> c;
  cout << min({a+b,b+c,c+a}) << endl;
}

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

namespace AtTest._500problems
{
    class Tenka1_2017D
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int[] nk = ReadInts();
            int n = nk[0];
            int k = nk[1];
            int[][] abs = new int[n][];
            for(int i = 0; i < n; i++)
            {
                abs[i] = ReadInts();
            }
            long res = 0;
            for(int i = 0; i < n; i++)
            {
                if ((k | abs[i][0]) == k) res += abs[i][1];
            }
            for(int i = 0; i < 30; i++)
            {
                if ((k & (1 << i)) == 0) continue;

                int kk = 0;
                for(int j = 0; j < 30; j++)
                {
                    if (j < i) kk += 1 << j;
                    if (j > i) kk += (k & (1 << j));
                }

                long tmp = 0;
                for(int j = 0; j < n; j++)
                {
                    if ((kk | abs[j][0]) == kk) tmp += abs[j][1];
                }
                res = Max(res, tmp);
            }
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 23744
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#define INF 0x3f3f3f3f
#define MOD 1000000009
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
typedef long long ll;

using namespace std;

int main()
{
    char a[10];
    scanf("%s", a);
    int len = strlen(a);
    int sum = 0;
    for(int i = 0; i < len; i++)
    {
        if(a[i] == '1')sum++;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <string>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <queue>
#include <deque>
#include <iostream>
#include <cstdio>
#include <memory.h>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1 ; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define FILL(a,b) memset(a , b , sizeof(a))
#define SZ(a) (int)a.size()
#define PB push_back
#define MP make_pair

typedef long long Int;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MAX = 307;
const int INF = 1000000000;

int A[MAX][MAX];
int cnt[MAX];
int d[MAX];

int main()
{
	//freopen("in.txt" , "r" , stdin);


	int n , m;
	cin >> n >> m;
	FOR(i,0,n)
	{
		FOR(j,0,m)
		{
			cin >> A[i][j];
			-- A[i][j];
		}
	}

	int res = INF;

	FOR(it,0,m)
	{
		FILL(cnt , 0);
		FOR(i,0,n)
		{
			FOR(j,0,m)
			{
				if (!d[A[i][j]])
				{
					cnt[A[i][j]] ++ ;
					break;
				}
			}
		}
		int mx = -1;
		int id;
		FOR(i,0,m)
		{
			if (cnt[i] > mx)
			{
				mx = cnt[i];
				id = i;
			}
		}

		res = min(res , mx);
		d[id] = 1;
	}

	cout << res << endl;



}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<cctype>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<string>
#include<cmath>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
const int N = 2;

int main(){
    int n;
    cin >>n;
    REP(z, n){
        double x[N], y[N], r[N];
        REP(i, N) cin >>x[i] >>y[i] >>r[i];
        double d = sqrt((x[0] - x[1]) * (x[0] - x[1]) + (y[0] - y[1]) * (y[0] - y[1]));
        if(r[0] + r[1] < d) cout <<0 <<endl;
        else if(r[0] > r[1] && d < r[0] - r[1]) cout <<2 <<endl;
        else if(r[1] > r[0] && d < r[1] - r[0]) cout <<-2 <<endl;
        else cout <<1 <<endl;
    }
    return 0;
}

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

/*
 *変数
 */
int k;

/*
 *解 
 */
void solve(){
    printf("%d",(k/2)*(k-(k/2)));
}

/*
 *入力 
 */
int main(){
       std::cin.tie(0);
       std::ios::sync_with_stdio(false);
       std::cin>>k;
       solve();
       return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	int64 A, B, C;
	int64 K;
	cin >> A >> B >> C;
	cin >> K;
	if(K%2 == 0){
		cout << A-B << endl;
	}else{
		cout << B-A << endl;
	}
}

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

using namespace std;

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

    int n = static_cast<int>(s.size());

    int res = n;
    for (int i = 1; i < n; i++) {
        if (s[i - 1] != s[i]) {
            res = min(res, max(i, n - i));
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007
typedef long long ll;

int main() {
    double n, k;
    cin >> n >> k;
    int cnt = 1;
    while((int)(n/k)!=0){
        n /= k;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bits/allocator.h>
#include<bits/basic_ios.h>
#include<bits/basic_string.h>
#include<bits/basic_string.tcc>
#include<bits/c++config.h>
#include<bits/char_traits.h>
#include<bits/cpp_type_traits.h>
#include<bits/cxxabi_forced.h>
#include<bits/ios_base.h>
#include<bits/locale_classes.h>
#include<bits/localefwd.h>
#include<bits/ostream_insert.h>
#include<bits/postypes.h>
#include<bits/range_access.h>
#include<bits/stl_algobase.h>
#include<bits/stl_function.h>
#include<bits/stl_iterator.h>
#include<bits/stl_iterator_base_funcs.h>
#include<bits/stl_iterator_base_types.h>
#include<bits/stringfwd.h>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<cmath>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwchar>
#include<cwctype>
#include<debug/debug.h>
#include<deque>
#include<exception>
#include<ext/atomicity.h>
#include<ext/numeric_traits.h>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<utility>
#include<valarray>
#include<vector>
using namespace std;
int main()
{
	int a;
	cin>>a;
	cout<<48-a;
	return 0;
}

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


int main(){
  int n,ans=0;
  cin >> n ;
  for(int i=1 ; i<=n ;i++){
    if(i/10==0){
      ans++;
    }else if(i/1000==0 && i/100!=0 ){
      ans++;
    }else if(i/100000==0 && i/10000!=0){
      ans++;
    }
  }

  cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000000
#define MAX 200001

const ll MOD = 1000000007;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

using mint = Fp<MOD>;

int main(){
    double D, T, S;
    cin >> D >> T >> S;
    if(D/S > T){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 3708
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

#include <vector>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <cmath>

using namespace std;

const long long bigNum = 1000000007;

int gcd(int a, int b)
{
	int buffer = a;
	if (b > a)
	{
		a = b;
		b = buffer;
	}

	int remainder = a%b;
	while (remainder != 0)
	{
		a = b;
		b = remainder;
		remainder = a%b;
	}
	return b;
}

long long comb(int n, int k)
{
	vector<int> setofNums;
	long long ret = 1;
	for (int i = 1; i <= k; i++)
	{
		setofNums.push_back(i);
	}
	for (int i = 0; i < k; i++)
	{
		ret = ret * (n - i);
		for (auto it : setofNums)
		{
			if (ret % it == 0)
			{
				ret /= it;
				it = bigNum;
			}
		}
		if (ret > bigNum)
			ret %= bigNum;
	}
	return ret;
}

map<long long, long long> factors;

int main()
{
	bool allEven = true;
	int N;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		int a;
		cin >> a;
		if (a % 2 != 0)
		{
			allEven = false;
			break;
		}
			
	}
	if (allEven)
	{
		cout << "second" << endl;
	}
	else
	{
		cout << "first" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100005
#define NIL -1
struct Node_struct
{
    int p, l, r, s;
};
/*p: 親(parent), l: 一番左の子(left child), r:右の兄弟(right sibling)*/
//s: 兄弟(sibling)
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX];
int DEG[MAX];
int H[MAX];

void print(int u)
{
    int i, c;
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ", u, T[u].p, T[u].s, DEG[u], D[u], H[u]);

    if (D[u] == 0 /*ここを埋める (fill this blank)*/)
        printf("root");
    else if (H[u] == 0 /*ここを埋める(fill this blank)*/)
        printf("leaf");
    else
        printf("internal node");
    /*  
  printf("[");
  for (i=0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if(i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
  */
    printf("\n");
}

void calcDepth(int u, int p)
{
    D[u] = p;
    if (T[u].r != NIL /*ここを埋める*/)
        calcDepth(T[u].r, p + 1 /*ここを埋める*/);
    if (T[u].l != NIL /*ここを埋める*/)
        calcDepth(T[u].l, p + 1 /*ここを埋める*/);
}

void calcDegree(int u)
{
    int tmp = 0;
    if (T[u].r != NIL)
    {
        DEG[u] += 1;
        calcDegree(T[u].r);
    }
    if (T[u].l != NIL)
    {
        DEG[u] += 1;
        calcDegree(T[u].l);
    }
}

int calcHeight(int u)
{

    int left = 0, right = 0;

    if (T[u].l == NIL && T[u].r == NIL)
    {
        H[u] = 0;
        return 0;
    }
    if (T[u].r != NIL)
        right = calcHeight(T[u].r) + 1;
    if (T[u].l != NIL)
        left = calcHeight(T[u].l) + 1;

    if (left > right)
        H[u] = left;
    else
        H[u] = right;

    return H[u];
}

int main()
{
    int i, j, k;
    int n;
    int id, sib, child;
    int root = NIL;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
        T[i].p = T[i].l = T[i].r = NIL;

    for (i = 0; i < n; i++)
    {
        scanf("%d", &id);

        for (j = 0, sib = NIL; j < 2; j++)
        { //子を入力する (input children)//2回まわす
            scanf("%d", &child);
            T[child].p = id;
            if (j == 0)
            {
                T[id].l = child; //idの一番左の子 (the most left child of id)
            }
            else
            {
                T[id].r = child; //左の兄弟に繋げる (connect to left sibling)
                                 //T[child].s = T[id].l;//兄弟の情報を伝える
                T[T[id].r].s = T[id].l;
                T[T[id].l].s = T[id].r;
            }
            sib = child; //次の子供の左の兄弟 (the left sibling of the next child)
        }
        //    T[T[child].s].s = T[T[child].s].r;//兄弟の情報を伝える
    }

    //根を求める (find the root)
    for (i = 0; i < n; i++)
    {
        if (T[i].p == -1)
            root = i;
    }
    T[root].s = NIL; //ルートの兄弟を初期化
    //それぞれのノードの深さを求める (find depth of each node)
    calcDepth(root, 0);

    //for(i=0; i<n; i++){
    calcDegree(root);
    //}
    //for(i=0; i<n; i++){
    calcHeight(root);
    //  }

    //出力 (output)
    for (i = 0; i < n; i++)
        print(i);

    return 0;
}



Measured memory_bytes: 2056
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono> 
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long 
#define pa(a,s) fl(i,0,s-1) cout<<*(a+i)<<" "; cout<<nl;
#define pv(v) fl(i,0,v.size()-1) cout<<v[i]<<" "; cout<<nl;
#define read(v) fl(i,0,v.size()-1) cin>>v[i];
#define all(v) v.begin(),v.end()
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define vll vector<ll>
#define sll set<ll>
#define spll set<pll>
#define dl(x) cout<<#x<<"="<<x<<nl;
#define d(x) cout<<#x<<"="<<x<<" ";
#define mkp(x,y) make_pair(x,y)
#define ump unordered_map
#define ff first
#define ss second
#define in insert
#define sz size
#define len length
#define nl '\n'
#define pb push_back
#define in insert
#define ub upper_bound
#define lb lower_bound
#define ld long double
const int MXN=1e5;
ll mod=1e9+7;
void solve(){
    double x;
    cin>>x;
    if(x==0) cout<<1<<nl;
    else if(x==1) cout<<0<<nl;
    
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); ll t=1;
    //cin>>t; //comment for single test
    while(t--) solve();
}

Measured memory_bytes: 3796
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int sunua[]=new int [5];
		int ans=0;
		for(int i=0; i<5; i++) {
			sunua[i]=sc.nextInt();
			if(sunua[i]==0) {
				ans=i+1;
			}	
	  }	
		System.out.println(ans);
	}
}

Measured memory_bytes: 35656
n=int(input())
s=[]
for i in range(n):
    S = str(input())
    s.append(S)
al=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
cnt=[51]*26
for i in range(26):
    for j in range(n):
        cnt[i]=min(cnt[i],s[j].count(al[i]))
ans=""
for i in range(26):
    ans+=al[i]*cnt[i]
print(ans)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const ll M = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];

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

  int m = a[n-1];
  int k = (m+1)/2;

  int d = M;
  int ans = a[0];
  rep(i,n){
    if (abs(a[i] - k) < d) {
      d = abs(a[i] - k);
      ans = a[i];
    }
  }
  cout << m << endl;
  cout << ans << endl;

  // rep(i,n){
  //   cout << a[i] << endl;
  // }
 
  return 0;
}


Measured memory_bytes: 4036
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FIR first
#define SEC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  int s;
  cin>>s;
  int d=s%10;
  int c=(s%100-d)/10;
  int b=(s%1000-c-d)/100;
  int a=(s-b-c-d)/1000;
  vector<string> str(20);
  vector<int> t(20);
  REP(i,8){
    str[i]=to_string(a);
    t[i]=a;
  }
  REP(i,4){
    t[i]+=b;
    str[i]+="+";
    str[i]+=to_string(b);
  }
  LOOP(i,4,8){
    t[i]-=b;
    str[i]+="-";
    str[i]+=to_string(b);
  }
  int tmp=1;
  for(int i=0;i<8;i+=2){
    if(tmp>0){
      t[i]+=c;
      str[i]+="+";
      str[i]+=to_string(c);
      t[i+1]+=c;
      str[i+1]+="+";
      str[i+1]+=to_string(c);
      tmp*=(-1);
    }else{
      t[i]-=c;
      t[i+1]-=c;
      str[i]+="-";
      str[i]+=to_string(c);
      str[i+1]+="-";
      str[i+1]+=to_string(c);
      tmp*=(-1);
    }
  }
  REP(i,8){
    if(i%2==0){
      t[i]+=d;
      str[i]+="+";
      str[i]+=to_string(d);
    }else{
      t[i]-=d;
      str[i]+="-";
      str[i]+=to_string(d);
    }
  }

  REP(i,8){
    if(t[i]==7){
      cout<<str[i]<<"=7"<<endl;
      return 0;
    }
  }
  

  return 0;
}


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

 int main() {
   int H, W;
   cin >> H >> W;

   vector<vector<int>> c(10, vector<int>(10, 0));

   rep(i, 0, 10) {
     rep(j, 0, 10) {
       cin >> c.at(i).at(j);
     }
   }

   rep(k, 0, 10) {
     rep(i, 0, 10) {
       rep(j, 0, 10) {
         c.at(i).at(j) = min(c.at(i).at(j), c.at(i).at(k) + c.at(k).at(j));
       }
     }
   }
   int ans = 0;
   vector<int> A(10);
   rep(i, 0, H * W) {
     int tmp;
     cin >> tmp;
     if (tmp != -1) A.at(tmp)++;
   }

   rep(i, 0, 10) ans += A.at(i) * c.at(i).at(1);

   cout << ans << endl;
 }


Measured memory_bytes: 256
#include <stdio.h>

#define N 16
#define M 8

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  const char ttbl[ M ] = { '0', '1', '2', '3', '5', '7', '8', '9' };

  for ( ; ; )
  {
    char    res[ N ];
    char  * p;
    int     n;

    scanf ( "%d", &n );
    if ( !( n ) ) break ;

    for ( p = res; n; n /= M )
    {
      *( p++ ) = ttbl[ n % M ];
    }

    while ( p != res )
    {
      putchar ( *( --p ) );
    }
    puts ( "" );
  }

  return ( 0 );
}

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

int main() {
  int N, M; cin >> N >> M;
  int max_gcd = 0;
  for (int i = 1; i <= M / i; i++) {
    if (M % i == 0) {
      if (i >= N) max_gcd = max(max_gcd, M/i);
      if (M/i >= N) max_gcd = max(max_gcd, i);
    }
  }
  cout<<max_gcd<<endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int a, b, c;
	cin>>a>>b>>c;
	unordered_map<int,int> cnt;
	cnt[a]++;
	cnt[b]++;
	cnt[c]++;
	if(cnt.size() == 2)
		puts("Yes");
	else
		puts("No");
}

Measured memory_bytes: 256
import itertools, collections
N, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
C = list(itertools.accumulate([0] + A))
D = [(v - i) % K for i, v in enumerate(C)]
#D[i]==D[j] and i-j<K
dp = collections.Counter(D[:K])
ans = 0
for i in range(N):
    dp[D[i]] -= 1
    ans += dp[D[i]]
    if i + K < len(D):
        dp[D[i + K]] += 1
print(ans)


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

using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
typedef double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define MOD 1
#define PI 3.14159265

int check(string str1 , string str2) {
    int ans = 0;
    set<char> s;
    for(int i = 0 ; i < (int)str1.size() ; i++) {
        if(str2.find(str1[i]) != string::npos && s.find(str1[i]) == s.end()) ans++ , s.insert(str1[i]);
    }
    return ans;
    return 0;
}

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

    int n;
    cin >> n;
    string str;
    cin >> str;
    int ans = 0;
    for(int i = 0 ; i < n - 1 ; i++) {

        ans = max(ans , check(str.substr(0 , i + 1) , str.substr(i + 1 , n - (i + 1))));
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;

int main() {
    int n, m; cin >> n >> m;
    cout << n*(n-1)/2 + (m*(m-1)/2) << endl;
}

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

using namespace std;

int main()
{
    string s;

    cin >> s;

    int i = 0;
    i += s[0] == '1';
    i += s[1] == '1';
    i += s[2] == '1';

    cout << i << endl;

    return 0;
}


Measured memory_bytes: 256
s = str(input())
l = len(s)
first = "01"*(int(l/2))
result1 = 0
result2 = 0
if l%2!=0:
	first += "0"
for i in range(l):
	if first[i] == s[i]:
		result2+=1
	else:
		result1+=1
print(min(result1,result2))



Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>

#define min(x,y) ((x)<(y)?(x):(y))

int main(int argc, char *argv[])
{
    long long n;
    long long a[5];
    long long min;
    int i;
    long long ans;

    scanf("%lld", &n);

    for (i = 0; i < 5; i++) {
        scanf("%lld", &a[i]);
    }

    min = min(a[0], min(a[1], min(a[2], min(a[3], a[4]))));

    ans = n / min + 4;
    ans += (n % min)?(1):(0);

    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int h, w;
    cin >> h >> w;
    int h2, w2;
    cin >> h2 >> w2;

    OUT(h*w - h2*w - w2*h + h2*w2)

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define NOT_FOUND -1
#define MAX 100000

int binarySearch(int[],int);

int n;

int main(){
    int q,count = 0;
    int S[MAX],T[MAX];

    scanf("%d",&n);
    for(int i = 0;i < n;i++)scanf("%d",&S[i]);

    scanf("%d",&q);
    for(int i = 0;i < q;i++)scanf("%d",&T[i]);

    for(int i = 0;i < q;i++)if(binarySearch(S,T[i]) >= 0)count++;

    printf("%d\n",count);

    return 0;
}

int binarySearch(int A[n],int key){
    int left = 0,mid,right = n;

    while(left < right){
        mid = (left + right) / 2;
        if(A[mid] == key)return mid;
        else if(key < A[mid])right = mid;
        else left = mid + 1;
    }

    return NOT_FOUND;
}


Measured memory_bytes: 2316
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
/*
F(i):=i文字目を始点とする部分文字列と,i+L文字目を始点とする部分文字列が最長何文字一致するか
S[i] == S[i+L]ならF(i) = F(i+1) + 1
そうでなければF(i) = 0としてiの多ものから
 */

// http://kmjp.hatenablog.jp/entry/2019/09/16/0900
int main() {
    ll N;
    string S;
    cin >> N;
    cin >> S;
    ll ma = 0;
    for(ll len = N; len >= 1; len--) {
        vector<ll> dp(N - len + 1, 0LL);
        for(ll x = N - len - 1; x >= 0; x--) {
            // cout << "hoge" << endl;
            // dp[x] = 0LL;
            if(S[x] != S[x + len]) {
                // cout << "huga1" << endl;
                dp[x] = 0LL;
            } else {
                // cout << "huga2" << endl;
                dp[x] = min(dp[x + 1] + 1LL, len);
                // cout << "huga3" << endl;
            }
            ma = max(ma, dp[x]);
        }
    }
    cout << ma << endl;
}

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

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
 
int main(){
   int N; cin >> N;
   for(int i=1;i<=10;i++){
   if(N<=1000*i){
      cout << 1000*i-N << endl;
      return 0;
   }
   }
}

Measured memory_bytes: 3636
/**
*    created: 24.06.2020 12:51:50
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define int long long
#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 all(x) (x).begin(),(x).end()
#define pcnt(bit) __builtin_popcount(bit)
#define mod 1000000007
#define pi acos(-1.0)
using namespace std;

signed main() {

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

    int n, i;
    cin >> n >> i;
    cout << n + 1 - i << endl;
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;

main()
{
  int n;
  long long z,w;
  long long data[2001];

  cin >> n >> z >> w;
  for (int i = 0; i < n ; ++i) {
    cin >> data[i];
  }

  long long maxv = llabs(data[n-1] - w);
  if ( n>1 ) {
    maxv = max(llabs(data[n-2]-data[n-1]), maxv);
  }

  cout << maxv << endl;
  return (0);
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <string>
#define SIZE 1002
#define INF 10000005

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

ll K;

struct edge{int to,cap,rev;};

vector<edge> G[SIZE];
bool used[SIZE];

//グラフ追加: from -> to (cap)
void add_edge(int from, int to, int cap){
	G[from].push_back((edge){to,cap,(int)G[to].size()});
	G[to].push_back((edge){from,0,(int)G[from].size()-1});
}

//パスを一本見つける
int dfs(int v, int t, int f){
	if(v==t)return f;
	used[v] = true;
	for(int i=0;i<G[v].size();i++){
		edge &e = G[v][i];
		if(!used[e.to] && e.cap>0){
			int d = dfs(e.to,t,min(f,e.cap));
			if(d>0){ //v -> G[v][i].toにd流す
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s,int t){
	int flow = 0;
	for(;;){
		memset(used,0,sizeof(used));
		int f = dfs(s,t,INF);
		if(f==0)return flow;
		flow += f;
	}
}

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

bool imain()
{
	int m,n;
	int B[500];
	int R[500];
	scanf("%d %d",&m,&n);
	if(m==0&&n==0)return false;
	for(int i=0;i<m;i++){
		scanf("%d",&B[i]);
		add_edge(1000,i,1);
	}
	for(int i=0;i<n;i++){
		scanf("%d",&R[i]);
		add_edge(i+500,1001,1);
	}
	for(int i=0;i<m;i++){
		for(int j=0;j<n;j++){
			if(gcd(B[i],R[j])!=1){
				add_edge(i,500+j,1);
			}
		}
	}
	int ans = max_flow(1000,1001);
	printf("%d\n",ans);
	for(int i=0;i<m;i++)G[i].clear();
	for(int i=0;i<n;i++)G[i+500].clear();
	G[1000].clear();
	G[1001].clear();
	return true;
}

int main(){
	while(imain());
	return 0;
}



Measured memory_bytes: 9052
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		char[] arr = in.readLine().toCharArray();
		int best = arr.length;
		char l = '-';
		for(int i = 0; i < arr.length; i++) {
			if(arr[i] != l && i != 0) {
				int o = arr.length - i;
				int m = i > o ? i : o;
				if(m < best) best = m;
			}
			l = arr[i];
		}
		System.out.println(best);
	}
}

Measured memory_bytes: 23892
s = input()
q = int(input())


is_reverse = False
pre_s = ""
suf_s = ""

for i in range(q):
  query = input()
  if query == '1':
    is_reverse = not is_reverse
  else:
    query = query.split()
    f, c = int(query[1]), query[2]
    if f == 1:
      if is_reverse:
        suf_s = suf_s + c
      else:
        pre_s = c + pre_s
    else:
      if is_reverse:
        pre_s = c + pre_s
      else:
        suf_s = suf_s + c

if is_reverse:
  print(suf_s[::-1] + s[::-1] + pre_s[::-1])
else:
  print(pre_s + s + suf_s)



Measured memory_bytes: 4480
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        boolean hasOdd = false;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
            if (a[i] % 2 != 0) {
                hasOdd = true;
            }
        }
        if (hasOdd) {
            System.out.println("first");
        } else {
            System.out.println("second");
        }
    }

}


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

int main(){
    int n;
    cin >> n;
    vector<char> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    vector<char> list;
    bool b;
    for(int i = 0; i < n; i++){
        b = false;
        for(int j = 0; j < list.size(); j++){
            if(v[i] == list[j]) b = true;
        }
        if(!b) list.push_back(v[i]);
    }
    if(list.size() == 3){
        cout << "Three" << endl;
    } else {
        cout << "Four" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        int i;
        for(i=0; i < str.length(); i++){
            char c = str.charAt(i);
            if(65 <= c && c <= 90){
                System.out.print((char)(c + 32));
            }else if(97 <= c && c <= 122){
                System.out.print((char)(c - 32));
            }else{
                System.out.print((char)c);
            }
        }
        System.out.print("\n");

        sc.close();

    }
}


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

using namespace std;

int main(){
	vector<int> vec(3);
	for(int i = 0; i < 3; i++)
		cin >> vec[i];
	
	sort(vec.begin(), vec.end());
	cout << vec[0] + vec[1] << endl;
}

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

typedef long long ll;
const ll InF = 1e15;
// ll mod = 1000000007;

int main() {
  ll N;
  cin>>N;
  string s;
  if (N % 2 == 0) {
    s = s + '0';
    while (N != 0) {
      N /= -2;
      if (N % 2 == 0) s = s + '0';
      else s = s + '1', N--;
    }
  } else {
    s = s + '1', N--;
    while (N != 0) {
      N /= -2;
      if (N % 2 == 0) s = s + '0';
      else s = s + '1', N--;
    }
  }
  reverse(s.begin(),s.end());
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 256
int main(void){
  int N,L,S=0,max=0;
  int i=0;
  scanf("%d",&N);
  
  for(i=0;i<N;i++){
    scanf("%d",&L);
    S+=L;
    if(L>max){
      
      max=L;
    }
  }
  S = S-max;
  if(max<S){
   
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }  
  return 0;
 
}


Measured memory_bytes: 128
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

#define rep(i, n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
const ll INFL = 1e17;
static const int MAX = 100;
static const int INF = (1 << 23);

template<class T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

template<class T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

int main() {
    ll n,m,l;
    cin>>n>>m>>l;
    ll dp[n][n];
    ll dp2[n][n];
    rep(i,n){rep(j,n){
        if(i==j){dp[i][j]=0;dp2[i][j]=0;}
        else{dp[i][j]=INFL;dp2[i][j]=INFL;}
    }}
    rep(i,m){
        ll a,b,c;cin>>a>>b>>c;
        a--;b--;
        dp[a][b]=c;
        dp[b][a]=c;
    }
    rep(k,n){
        rep(i,n){
            rep(j,n){
                dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
            }
        }
    }

    rep(i,n){
        rep(j,n){
            if(i==j)continue;
            dp2[i][j]=(dp[i][j]<=l?1:INFL);
        }
    }

    rep(k,n){
        rep(i,n){
            rep(j,n){
                dp2[i][j]=min(dp2[i][j],dp2[i][k]+dp2[k][j]);
            }
        }
    }
    ll q;
    cin>>q;
    rep(i,q){
        int s,t;
        cin>>s>>t;
        s--;t--;
        if(dp2[s][t]==INFL){
            cout<<-1<<endl;
        }else {
            cout << dp2[s][t]-1 << endl;
        }
    }








    return 0;
}


Measured memory_bytes: 1920
/* いもす法 */
#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<ll, ll> P;

int main(){
    int d, g;
    cin >> d >> g;
    vector<int> cnt(d);
    vector<int> bonus(d);
    int ans = INF;

    REP(i, d) cin >> cnt[i] >> bonus[i];

    REP(state, 1 << d) {
        int tmp = 0;
        int kaisu = 0;
        REP(i, d) {
            if((state >> i)&1) {
                tmp += bonus[i];
                tmp += (i+1) * 100 * cnt[i];
                kaisu += cnt[i];
            }
        }
        if(tmp >= g) {
            ans = min(ans, kaisu);
            continue;
        }
        REP_REV(i, d) {
            if(!((state >> i & 1))) {
                REP(j, cnt[i]-1) {
                    kaisu++;
                    tmp += (i+1) * 100;
                    if(tmp >= g) break;
                }
            }
            if(tmp >= g){
                ans = min(ans, kaisu);
                break;
            }
        } 
    }
    
    cout << ans << endl;

    return 0;
}


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

int main() {
	int n; cin >> n;
	vector<int> l(2*n);
	for(int i=0;i<2*n;++i)cin >>l[i];
	sort(l.begin(), l.end());
	int ans =0;
	for(int i=1;i<2*n; i+=2){
		int len = min(l[i], l[i-1]);
		ans += len;
	}
	cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
h = Hash.new(0)
n.times do
  s = gets.chomp
  h[s] += 1

end

puts 'AC x ' + h['AC'].to_s
puts 'WA x ' + h['WA'].to_s
puts 'TLE x ' + h['TLE'].to_s
puts 'RE x ' + h['RE'].to_s




Measured memory_bytes: 14712
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define loop(i,L,R) for(int i=(L);i<=(R);i++)
const int maxn=1e5+5;
int main()
{
    int n,k;
    string s;
    scanf("%d",&n);
    cin>>s;
    scanf("%d",&k);
    rep(i,n)
    {
        if(s[i]!=s[k-1]) printf("*");
        else printf("%c",s[i]);
    }
    printf("\n");
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cmath>

#define FOR(i,a,b)  for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n)    FOR(i,0,n)
#define RER(i,n)    FOR(i,0,(n+1))
#define pb          push_back
#define mp(a,b)     make_pair((a),(b))
#define mset(m,v)   memset(m,v,sizeof(m))
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef vector<pair<ll, ll> > vpll;
typedef vector<string> vs;
typedef long double ld;
const double EPS    = 1e-10;
const int INF       = 1e+9;
const double PI     = acos(-1);


auto main() -> int
{
    string year;

    cin >> year;

    cout << "2018/01/" << year.substr(8, 2) << endl;

    return 0;
}



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

int main() {
  int N, X, T;
  cin >> N >> X >> T;
  if (N % X == 0){
    cout << N/X * T << endl;
  }
  else {
    cout << (N/X + 1) * T << endl;
  }
}

Measured memory_bytes: 3580
#include<stdio.h>
int main(){
  int F[45],n,i;
  F[0]=1;
  F[1]=1;
  scanf("%d",&n);
  for(i=2;i<=n;i++){
    F[i]=F[i-2]+F[i-1];
  }
  printf("%d\n",F[n]);
  return 0;
}



Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
int mod = 1e9+7;
long long dp[100005][2]; 
// 0 white 1 black
vector<int> edge[100005];

void dfs(int last,int curr){
  
  if(dp[curr][0]>0){
    return ;
  }
  if(dp[curr][1]>0){
    return ;
  }
  
  if(edge[curr].size()==1 && edge[curr][0]==last){
    dp[curr][0] = 1;
    dp[curr][1] = 1;
    return ;
  }
  
  if(edge[curr].size()==0){
    dp[curr][0] = 1;
    dp[curr][1] = 1;
    return ;    
  }
  
  dp[curr][0] = 1;
  dp[curr][1] = 1; 
  for(int i=0;i<edge[curr].size();++i){
    if(edge[curr][i]!=last){
      dfs(curr,edge[curr][i]);
      
      dp[curr][0] *= (dp[edge[curr][i]][0]+dp[edge[curr][i]][1]);
      dp[curr][0] = dp[curr][0]%mod;
      
      dp[curr][1] *= dp[edge[curr][i]][0];
      dp[curr][1] = dp[curr][1]%mod;
      
    }
  }
  
}

int main(){
  int n;cin>>n;
  int from,to;
  for(int i=0;i<n-1;++i){
    cin>>from>>to;
    edge[from].push_back(to);
    edge[to].push_back(from);
  }
  
  dfs(0,1);
  
  cout<<(dp[1][0]+dp[1][1])%mod<<endl;
  
  return 0;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define out(x) cout<<x<<endl
#define put(x) out(x)
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;
const ll mod = 1000000007;


int main() {
 int N;in(N);
  vl a(N),b(N);
  rep(i,N) in(a[i]);
  rep(i,N) in(b[i]);
  int ans =0;
  rep(i,N){
   int k =0;
    rep(j,N){
     if(j>i) k += b[j];
      else if(j==i) k += (a[j]+b[j]);
      else k += a[j];
    }
    ans = max(ans,k);
  }
  out(ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int ans;
int a, b, c;

int main(void) {
    scanf("%d %d %d", &a, &b, &c);

    bool flag = false;
    if (a!=b&&b!=c&&a!=c) flag = true;
    else if (a==b&&a==c&&b==c) flag = true;

  
    if (flag) puts("No");
    else puts("Yes");

	return 0;
}


Measured memory_bytes: 256
N, D = map(int, input().split())
P = [list(map(int, input().split())) for i in range(N)]

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        pi, pj = P[i], P[j]
        tmp = 0
        for d in range(D):
            tmp += (pi[d] - pj[d]) ** 2
        if (tmp ** 0.5).is_integer():
            ans += 1

print(ans)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define test int t; cin>>t; while(t--)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopr(i,a,b) for(int i=a;i>=b;i--)
#define loops(i,a,b,step) for(int i=a;i<b;i+=step)
#define looprs(i,a,b,step) for(int i=a;i>=b;i-=step)
#define ull unsigned long long int
#define ll long long
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define all(a) a.begin(),a.end()
#define ld long double
using namespace std;
// For ordered_set
using namespace __gnu_pbds;
template <typename T>
using ord_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
const ll maxn = 1e5;
const ll inf = 1e9;
ll dp[101][100000];
ll solve(ll w[],ll v[],ll c,ll n)
{
  if(n<0)
  {
    return 0;
  }
  if(dp[n][c]!=-1)
  {
    return dp[n][c];
  }
  if(w[n]<=c)
  {
    ll temp1=solve(w,v,c,n-1);
    ll temp2=solve(w,v,c-w[n],n-1)+v[n];
    dp[n][c]=max(temp1,temp2);
    return dp[n][c];
  }
  else
  {
    dp[n][c]=solve(w,v,c,n-1);
    return dp[n][c];
  }
  
}
int main(){
  ll n,c;
  cin>>n>>c;
  for(ll i=0;i<n+1;i++)
  {
    for(ll j=0;j<c+1;j++)
    dp[i][j]=-1;
  }
  ll w[n],v[n];
  for(ll i=0;i<n;i++)
  {
    cin>>w[i]>>v[i];
  }
  ll ans=solve(w,v,c,n-1);
  cout<<ans<<"\n";
   return 0;
}

Measured memory_bytes: 82500
# C
n = int(input())
a = [int(input()) for i in range(n)]
maxa = [-1,0]
premaxa = [-1,-1]
for i,num in enumerate(a):
    if num >= maxa[1]:
        premaxa = [maxa[0], maxa[1]]
        maxa = [i,num]
    elif num > premaxa[1]:
        premaxa = [i,num]
for i in range(n):
    if i == maxa[0]:
        print(premaxa[1])
    else:
        print(maxa[1])

Measured memory_bytes: 69080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<int> a(3);
	rep(i,3) cin >> a.at(i);
	sort(a.begin(),a.end());
	if(a.at(0)%2==a.at(1)%2 && a.at(1)%2==a.at(2)%2){
		cout << (a.at(2)*2-a.at(0)-a.at(1))/2 << endl;
	}
	else{
		if(a.at(0)%2==a.at(1)%2){
			a.at(0)++;
			a.at(1)++;
		}
		else if(a.at(1)%2==a.at(2)%2){
			a.at(1)++;
			a.at(2)++;
		}
		else{
			a.at(0)++;
			a.at(2)++;
		}
		cout << (a.at(2)*2-a.at(0)-a.at(1))/2+1 << endl;
	}
}

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

int
main()
{
	int i;

	int n_nums;
	scanf("%d", &n_nums);

	int *nums = (int *)malloc(n_nums * sizeof(int));
	for (i = 0; i < n_nums; i++)
	{
		scanf("%d", &nums[i]);
	}

	for (i = 0; i < n_nums; i++)
	{
		if (i != 0)
		{
			printf(" ");
		}
		printf("%d", nums[n_nums-i-1]);
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 600
#include <stdio.h>

int main(void){
    int i,o,p,q,n,m,l,map[100][100],map1[100][100],finish[100][100];
    long long sum;
    scanf("%d %d %d",&n,&m,&l);
    for(i=0;i<n;i++)
        for(o=0;o<m;o++)
            scanf("%d",&map[i][o]);
    for(i=0;i<m;i++)
        for(o=0;o<l;o++)
            scanf("%d",&map1[i][o]);
    for(i=0;i<n;i++)
        for(o=0;sum=0,o<l;o++){
            for(p=0,q=0;p<m;p++,q++)
                sum+=map[i][p]*map1[q][o];
            printf("%lld%s",sum,o==l-1?"\n":" ");
        }
    return 0;
}

Measured memory_bytes: 676
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define scan(arr,a,n) for(ll i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}


int main(){
    fast;
    ll n;
    cin>>n;
    ll z = 1000 - (n%1000);
    if(z==1000){
        cout<<0<<endl;
    }
    else{
        cout<<z<<endl;
    }
}

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

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

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

int main() {
  char X,Y; cin >>X >>Y;
  if (X<Y) cout <<'<' <<endl;
  if (X>Y) cout <<'>' <<endl;
  if (X==Y) cout <<'=' <<endl;
  return 0;
}


Measured memory_bytes: 256