akhauriyash/Code-Regression huggingface dataset:
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val s = sc.nextInt()

  println(abc116b(s))
}

private fun abc116b(s: Int): Int {
  val set = mutableSetOf<Int>()
  set.add(s)

  var tmp = f(s)
  var count = 1
  while (!set.contains(tmp)) {
    set.add(tmp)
    tmp = f(tmp)
    count++
  }

  return count + 1
}

private fun f(n: Int): Int {
  if (n % 2 == 0) return n / 2

  return 3 * n + 1
}


Measured memory_bytes: 35564
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll d, g;
    cin>>d>>g; g /= 100;
    vl ps(d), cs(d);
    rep(i, d) cin>>ps[i]>>cs[i];
    rep(i, d) cs[i] /= 100;

    vvl dp(d + 1, vl(g + 10, LINF));
    dp[0][0] = 0;
    rep(i, d) rep(j, g + 10) {
        rep(k, ps[i] + 1) {
            if (k == ps[i]) {
                if (j - (i + 1) * k - cs[i] >= 0)
                    chmin(dp[i + 1][j], dp[i][j - (i + 1) * k - cs[i]] + k);
                else
                    chmin(dp[i + 1][j], (ll)k);
            }
            else {
                if (j - (i + 1) * k >= 0) chmin(dp[i + 1][j], dp[i][j - (i + 1) * k] + k);
                else chmin(dp[i + 1][j], (ll)k);
            }
        }
    }
    cout<<dp[d][g]<<endl;
}

Measured memory_bytes: 10240
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val m = scanner.nextInt()
    val isSeikaiArray = BooleanArray(n)
    val penaArray = IntArray(n) { i -> 0 }
    var seikai = 0
    var pena = 0
    for (i in 0..m-1) {
        val p = scanner.nextInt() - 1
        val s = scanner.next()
        if (isSeikaiArray[p] == false) {
            if (s == "AC") {
                isSeikaiArray[p] = true
                seikai += 1
            } else {
                penaArray[p] += 1
            }
        }
    }


    for (i in 0..n-1) {
        if (isSeikaiArray[i]) pena += penaArray[i]
    }
    println("$seikai $pena")
}

Measured memory_bytes: 69108
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
int n;
string s;
bool check(int a, int b) {
  vector<int> res(n);
  // 1 = sheep , -1 = wolf
  res[0] = a, res[1] = b;
  for (int i = 2; i < n; ++i) {
    if(s[i-1] == 'o') {
      if(res[i-1] == 1) res[i] = res[i-2];
      else res[i] = -res[i-2];
    }
    else {
      if(res[i-1] == 1) res[i] = -res[i-2];
      else res[i] = res[i-2];
    }    
  }

  auto show = [&]()-> void {
		rep(i,n) cout << (res[i] == 1 ? 'S' : 'W');
		cout << "\n";
	      };

  bool f = false;
  if(s[n-1] == 'o') {
    if(res[n-1] == 1) {
      if(res[n-2] == res[0]) {
	f = true;
      }
    }
    else {
      if(res[n-2] != res[0]) {
	f = true;
      }
    }
  }
  else {
    if(res[n-1] == 1) {
      if(res[n-2] != res[0]) {
	f = true;
      }      
    }
    else {
      if(res[n-2] == res[0]) {
	f = true;
      }      
    }    
  }

  if(!f) return false;

  if(s[0] == 'o') {
    if(res[0] == 1) {
      if(res[n-1] == res[1]) {
	show();
	return true;
      }
    }
    else {
      if(res[n-1] != res[1]) {
	show();
	return true;
      }
    }
  }
  else {
    if(res[0] == 1) {
      if(res[n-1] != res[1]) {
	show();
	return true;
      }      
    }
    else {
      if(res[n-1] == res[1]) {
	show();
	return true;
      }      
    }    
  }  
  
  return false;
}

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

  if(check(1,1)) return 0;
  if(check(1,-1)) return 0;
  if(check(-1,1)) return 0;  
  if(check(-1,-1)) return 0;
  cout << -1 << "\n";
  return 0;
}


Measured memory_bytes: 1016
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main() {
  readln;
  auto r = readln.chomp.split(" ").map!(to!uint).all!((a) => (a % 2 == 1) || (a % 3 == 0) || (a % 5 == 0));

  if (r) {
    writeln("APPROVED");
  } else {
    writeln("DENIED");
  }
}


Measured memory_bytes: 256
def print_result(A, n):
    for i in range(n):
        if i > 0:
            print(' ', end='')
        print(A[i], end='')
    print('\n', end='')


def insertion_sort(A, n):

    for i in range(1, n):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print_result(arr, n)


n = eval(input())

arr = [eval(x) for x in input().split()]
print_result(arr, n)
insertion_sort(arr, n)



Measured memory_bytes: 6284
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
ans="NO"
if v<=w:
    ans="NO"
else:
    if a>b:
        if (a-b)%(v-w)==0:
            if (a-b)//(v-w)<=t:
                ans="YES"
        else:
            if (a-b)//(v-w)+1<=t:
                ans="YES"
    elif a<b:
        if (a-b)%(v-w)==0:
            if (b-a)//(v-w)<=t:
                ans="YES"
        else:
            if (b-a)//(v-w)+1<=t:
                ans="YES"
print(ans)

Measured memory_bytes: 9224
#include<stdio.h>
int main()
{
	int i,p,sum=0,copy;
	scanf("%d",&p);
	copy=p;
	while(p>0)
	{
		sum+=p%10;
		p=p/10;
	}
	if(copy%sum==0)printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

tmp = x
x_2 = x

if n == 0:
    print(x)
    exit()

if x not in p:
    print(x)
    exit()

else:
    x -= 1
    if x not in p:
        print(x)
        exit()
    if (x_2 + 1) not in p:
        print(x_2+1)
        exit()

    else:
        x_2 += 1

while True:
    if(x - 1) not in p:
        print(x-1)
        exit()

    else:
        x -= 1
        if (x_2 + 1) not in p:
            print(x_2+1)
            exit()

        else:
            x_2 += 1


Measured memory_bytes: 9240
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;

int main()
{
    int n,m;
    cin >> n >> m;
    int ans = (n-m) * 100 + m * 1900;
    int mul = 1;
    for(int i = 0; i < m; i++){
        mul *= 2;
    }
    cout << ans * mul << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <bitset>
#include <set>
const int maxlongint=2147483647;
const int mo=1e9+7;	
const int N=1000005;
const int M=3005;
using namespace std;
#define sqr(x) (1ll*(x)*(x))
long long a[N],rev[N],ans=0;
int n;
map <long long,int> v;
int max(int x,int y)
{
	return x>y?x:y;
}
int main()
{
	//freopen("agc003d.in","r",stdin);
	//freopen("agc003d.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		long long x;
		scanf("%lld",&x);
        for(long long j=2;j*j*j<=x;j++)
            while(x%(j*j*j)==0) x/=j*j*j;
        v[a[i]=x]++;
        rev[i]=1;
        for(long long j=2;j*j*j<=x;j++)
            if(x%j==0)
            {
                rev[i]*=(x%(j*j)==0)?j:j*j;
                while(x%j==0) x/=j;
            }
        if(sqr((long long)sqrt(x))==x)
        	rev[i]*=1ll*sqrt(x);
        else 
        	rev[i]*=x*x;
	}
	if(v[1]) v[1]=0,ans++;
	for(int i=1;i<=n;i++)
		ans+=max(v[a[i]],v[rev[i]]),v[a[i]]=v[rev[i]]=0;
	printf("%lld",ans);
}

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int plana, planb;
  
  plana = N * A;
  planb = B;
  
  int x;
  if( plana <= planb){
    x = plana;
  }
  else{
    x = planb;
  }
  
  cout << x << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	int  sum,sum1;
	sum=ceil(a*1.0/0.08);
	sum1=ceil(b*1.0/0.1);
	int t=max(sum,sum1);
	int a1=floor(t*0.08),a2=floor(t*0.1);
	if(a1==a&&a2==b)
	printf("%d",t);
	else
	printf("-1");
}

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

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
constexpr int INF = 1<<30;
constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

// a = (a+b)%MOD;
void addmod(ll& a, ll b) {
  a = (a+b)%MOD;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========

int N, X;

void fillup(vi& ret) {
  int M = 2*N-1;
  si pool;

  for (int i=1; i<=M; i++) {
    pool.insert(i);
  }

  for (auto x : ret) {
    if (x==0) continue;
    pool.erase(x);
  }

  for (int i=0; i<int(ret.size()); i++) {
    if (ret[i] != 0) continue;

    auto it = pool.begin();
    ret[i] = *it;
    pool.erase(it);
  }

}

int main(int argc, char** argv) {
  cin >> N >> X;

  if (X==1 || X==(2*N-1)) {
    cout << "No" << endl;
    return 0;
  }

  if (N==2) {
    if (X!=2) {
      cout << "No" << endl;
      return 0;
    }

    cout << "Yes\n1\n2\n3" << endl;
    return 0;
  }

  const int M = 2*N-1;
  vi ret(M);

  if (X!=M-1) {
     ret[N-2] = M;
     ret[N-1] = 1; // center
     ret[N]   = X;
     ret[N+1] = M-1;
  } else {
     // X == M-1
     ret[N-2] = 1;
     ret[N-1] = M-1; // X
     ret[N]   = M;
     ret[N+1] = 2;
  }

  fillup(ret);

  cout << "Yes" << endl;
  for (auto x : ret) {
    cout << x << endl;
  }

  return 0;
}


Measured memory_bytes: 12416
// D - Candidates of No Shortest Paths
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
#define rp(i,n) for(int i=0;i<(n);i++)

// void vprn(vector<int> &v){ for(int i=0;i<v.size();i++) cout<<v[i]<<(i<v.size()-1?",\t":"\n"); }
// void vvprn(vector<vector<int>> &vv){ for(auto v:vv) vprn(v);cout<<"----\n"; }

#define INF (INT_MAX/2)

int main(){
	int N,M; cin>>N>>M;

	vi a(M), b(M), c(M);
	rp(e,M){ cin>>a[e]>>b[e]>>c[e]; a[e]--; b[e]--; }

	vvi dist(N,vi(N, INF));//dist[from][to] from->to: cost of shortest path
	rp(v,N) dist[v][v] = 0;
	// vvprn(dist);//

	rp(e,M){//set cost of edge
		dist[a[e]][b[e]] = min(dist[a[e]][b[e]], c[e]);
		dist[b[e]][a[e]] = min(dist[b[e]][a[e]], c[e]);
	}
	// vvprn(dist);//

	// Warshall Floyd (set cost of shortest path)
	rp(r,N)//relay point
		rp(s,N)//start point
			rp(t,N)//terminal point
				dist[s][t] = min(dist[s][t], dist[s][r] + dist[r][t]);
	// vvprn(dist);//

	int ans = 0;
	rp(e,M) if(dist[a[e]][b[e]] < c[e]) ans++;
	cout<< ans <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
typedef unsigned long long ull;
typedef std::pair<ll, ll>P;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const ll mod = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool fl = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
std::string abc = "abcdefghijklmnopqrstuvwxyz";
struct edge { ll to, cost; };
double pai = 3.141592653589793;
std::vector<P>v[100010];

int main() {
	int n;
	std::string s, t;
	std::cin >> n >> s >> t;
	ll ans = 3, i;
	if (s[0] == s[1]) {
		ans *= 2 ;
		i = 2;
	}
	else i = 1;
	for (;i < n;) {
		if (s[i - 1] == t[i - 1]) {
			if (s[i] == s[i+1]) {
				ans *= 2;
				ans %= mod;
				i += 2;
			}
			else {
				ans *= 2;
				ans %= mod;
				i++;
			}
		}
		else {
			if (s[i] == s[i+1]) {
				ans *= 3;
				ans %= mod;
				i += 2;
		}
			else {
				ans *= 1;
				ans %= mod;
				i++;
			}
		}
	}
	std::cout << ans%mod << std::endl;
}

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

#define For(i, j, k) for(int i = j; i <= k; i++)
#define pb push_back

using namespace std;

const int N = 210;
const int M = 1e7 + 10;

bool vis[M];
int prm[M], tot;

void init(int n){
	vis[1] = true;
	For(i, 2, n){
		if(!vis[i]) prm[++tot] = i;
		for(int j = 1; j <= tot && prm[j] * i <= n; ++j){
			vis[prm[j] * i] = true;
			if(i % prm[j] == 0) break;
		}
	}
}

int n, m;
vector<int> G[N];
int pos[N], match[N], used[N];

bool Hungary(int o){
	if(used[o]) return false;
	used[o] = true;
	for(int v : G[o]){
		int &x = match[v];
		if(!x || Hungary(x)){
			x = o;
			return true;
		}
	}
	return false;
}

int main(){
	
	init(M - 5);
	scanf("%d", &n);
	For(i, 1, n){
		int x;
		scanf("%d", &x);
		pos[++m] = x, pos[++m] = x + 1;
	}

	sort(pos + 1, pos + m + 1);
	int node = 0;
	For(i, 1, m){
		if(pos[i + 1] == pos[i]) ++i;
		else pos[++node] = pos[i];
	}
	For(i, 1, node) if(pos[i] & 1)
		For(j, 1, node){
			int x = abs(pos[i] - pos[j]);
			if(pos[j] % 2 == 0 && !vis[x]){
				G[i].pb(j);
			}
		}

	int ret = 0, odd = 0;
	For(i, 1, node) if(pos[i] & 1){
		++odd;
		memset(used, false, sizeof used);
		ret += Hungary(i);
	}

	int even = node - odd - ret;
	odd -= ret;
	if(even & 1) ret = node - ret + 1;
	else ret = node - ret;

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

	return 0;
}

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

vector<int64_t> divisor(int64_t n)
{ //約数列挙
    vector<int64_t> ret;
    for (int64_t i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}

int main()
{
    long N, M;
    cin >> N >> M;
    long num = M / N;
    vector<int64_t> ans_list = divisor(M);
    sort(ans_list.begin(), ans_list.end());
    long l = 0;
    long r = ans_list.size();
    while ((r - l) != 1)
    {
        long index = (l + r) / 2;
        if (ans_list[index] > num)
            r = index;
        else
            l = index;
    }

    cout << ans_list[l] << endl;
    return 0;
}

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

int main(){
  int A,B,C;
  cin>>A>>B>>C;
  if(A==7 && B==5 && C==5){
    cout<<"YES"<<endl;
  }else if(A==5 && B==7 && C==5){
    cout<<"YES"<<endl;
  }else if(A==5 && B==5 && C==7){
    cout<<"YES"<<endl;
  }else{
cout<<"NO"<<endl;
  }
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long N, K;
    long long ans = 0;
    cin >> N >> K;
    for (long long i = K; i <= N+1; i++){
        //cout <<(N - i + 1)*i << endl;
        ans += (N - i + 1)*i + 1;
        ans = ans % ((long long) 1e9 + 7);
    }
    cout << ans << endl;

}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX(type)   std::numeric_limits<type>::max()
#define MIN(type) std::numeric_limits<type>::min()
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
ll inf = 1e18;
vector<ll> v;
int main(){
	fast;
	ll n,k;cin>>n;
	k = 2;
	ll a[n+1];memset(a,0,sizeof(a));
	v.push_back(0);
	for(ll i=0;i<n;++i){
		ll k;cin>>k;
		v.push_back(k);
	}
	
	a[1] = 0;
	
	for(ll i=2;i<=n;++i){
		ll mn = MAX(ll);
		for(ll j=max(1ll,i-k);j<i;++j)
			mn = min(mn,abs(v[i]-v[j])+a[j]);
		a[i] = mn;
	}
	cout<<a[n];
	return 0;
}

Measured memory_bytes: 2168
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;i++)
int gcd(int a, int b){
    int r=1;
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
typedef long long ll;
void revStr(char* str){
    int size = strlen(str);
    int i,j;
    char tmp = {0};
    for(i = 0, j = size - 1; i < size / 2; i++, j--){
        tmp = str[i];
        str[i] = str[j];
        str[j] = tmp;
    }return;
}
typedef struct{
    int p;
    int q;
}data;

//降順
int compare_int(const void *a, const void *b)
{
    return *(int*)b - *(int*)a;
}
int asc(const void *a, const void *b) {
  long *A = (long *)a;
  long *B = (long *)b;
  if (*A > *B) return 1;
  if (*A < *B) return -1;
  return 0;
}

int kai(int n){
    if(n==0){
        return 1;
    }
    int sum=1;
    for(int i=1;i<=n;i++){
        sum*=i;
    }
    return sum;
}
//構造体の.pを降順
int comp( const void *c1, const void *c2 )
{ data test1 = *(data *)c1;
  data test2 = *(data *)c2;
  int tmp1 = test1.p;   /* b を基準とする */
  int tmp2 = test2.p;
    return tmp2 - tmp1;}




int main(){
    int x;
    scanf("%d",&x);
    int temp=0;
    temp=x/100;
    if(x%100<=5*temp){
        printf("1");
        return 0;
    }else{
        printf("0");
        return 0;
    }
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main(){
    int N,M,s,c,ans = -1;
    cin >> N >> M;
    vector<int> a(3,-1);
    REP(i,M){
        cin >> s >> c;
        if(a[s-1] != -1){
            if(a[s-1] == c){}
            else{
                cout << "-1" <<endl;
                return 0;
            }
        }if( N != 1 && (s == 1 && c == 0)){
            cout << "-1" <<endl;
            return 0;
        }else{
            a[s-1] = c;
        }
    }
    ans = 0;
    if( N != 1 && a[0] == -1) a[0] = 1;
    REP(i,N){
        if(a[i] == -1) a[i] = 0;
        ans += a[i];
        if(i != N-1)ans *= 10;
    }
   
    cout << ans <<endl;

    return 0;
}

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

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

using namespace std;

int main(void)
{
	ui N{};
	cin >> N;

	// 出現した値と出現回数を記憶するDictionary
	map<ull, ui> bits_dic{};

	for (size_t i = 0; i < N; ++i)
	{
		ull bit;
		cin >> bit;

		if (bits_dic.find(bit) == bits_dic.end())
		{
			bits_dic[bit] = 0;
		}
		++bits_dic[bit];
	}
	
	bool ans{ true };

	if(bits_dic.size() == 1)
	{
		if (bits_dic.find(0) != bits_dic.end()
			&& bits_dic[0] == N)
		{
			ans = true;
		}
		else
		{
			ans = false;
		}
	}
	else if(bits_dic.size() == 2)
	{
		for (auto p : bits_dic)
		{
			if (p.first == 0)
			{
				ans &= (p.second == N / 3);
			}
			else
			{
				ans &= (p.second == (N * 2) / 3);
			}
		}
	}
	else if (bits_dic.size() == 3)
	{
		ull res = accumulate(bits_dic.begin(), bits_dic.end(), 0, [](ull res, pair<ull, ui> p) {
			return (res ^ p.first);
		});
		ans = !res && all_of(bits_dic.begin(), bits_dic.end(),[&N](pair<ull, ui> p) {
			return (p.second == N / 3);
		});
	}
	else
	{
		ans = false;
	}

	string ans_txt = ans ? "Yes" : "No";
	cout << ans_txt << endl;

	return 0;
}


Measured memory_bytes: 5120
using System;
using System.Collections.Generic;
using System.Text;

namespace AtCorder1
{
    class AtCorder161A
    {
        static void Main()
        {
            string[] line = System.Console.ReadLine().Trim().Split(' ');

            var a = int.Parse(line[0]);
            var b = int.Parse(line[1]);
            var c = int.Parse(line[2]);

            var tmp = b;
            b = a;
            a = tmp;

            var tmp2 = a;
            a = c;
            c = tmp2 ;

            var d = a + " " + b + " " + c;
            Console.WriteLine(d);

        }
    }
}


Measured memory_bytes: 11092
fun main() {
  val (A, P) = readInts()
  println((A * 3 + P) / 2)
}

fun gcd(a: Int, b: Int): Int = if (a < b) gcd(b, a) else if (b == 0) a else gcd(b, a % b)
fun gcd(a: Long, b: Long): Long = if (a < b) gcd(b, a) else if (b == 0L) a else gcd(b, a % b)
fun lcm(a: Int, b: Int): Int = (a * b) / gcd(a, b)
fun lcm(a: Long, b: Long): Long = (a * b) / gcd(a, b)

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readInts() = readLine()!!.split(" ").map { it.toInt() }
fun readLongs() = readLine()!!.split(" ").map { it.toLong() }


Measured memory_bytes: 36404
#include <bits/stdc++.h>
using namespace std;
#define PI 3.1415926535
const long long int MOD = 998244353;
#define pb push_back
#define mp make_pair
#define fill(a)  memset(a, 0, sizeof (a))
#define SORT(v)  sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define MAX(v) *max_element(v.begin(), v.end())
#define MIN(v) *min_element(v.begin(), v.end())
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define watch(x) cout << (#x) << " is " << (x) << endl;
const long long int MAXX = 2e6 + 5;
const long long int MINN = 2e5 + 5;
const long long int inf = 1e6;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef pair<int,ii> iii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector< iii > viii;

ll lcm(ll a, ll b) {
   return a / __gcd(a, b) * b;
}
int XOR(int x, int y){
  return (x | y) & (~x | ~y);
}
bool cmp(const pair<int,int> &a,const pair<int,int> &b) {
    return (a.second < b.second);
}
// bool isl = binary_search(x.begin(), x.end(), 5);
// __builtin_popcount(x)  - Returns the number of set bits in x
const long long int N = 10050;
const int MAXN = 105;
int binsearch(int lo, int hi){
	while(lo<hi){
		int mid=(lo+hi)/2;
		if((mid))   // check(mid)
			hi=mid;
		else
			lo=mid+1;
	}
	return lo;
}
ll power(ll x,ll y){
    ll res=1;
    while(y>0){
      if(y&1) res=((res*x)%MOD);

      y/=2;
      x=((x*x)%MOD);
    }
    return res%MOD;
}

int main(){
    FAST
    int x,y,z;
    cin>>x>>y>>z;
    cout<<z<<" "<<x<<" "<<y;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Would
#define you
#define please
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, n) for(int i=n-1; i>0; i--)

using namespace std;

void solve() {
	int n; cin >> n;
	vector<int> H(n);
	rep(i, n) scanf("%d", &H[i]);

	bool flag = true;
	repr(i, n) {
		if (H[i - 1] > H[i]) {
			H[i - 1]--;
			if (H[i - 1] > H[i]) {
				flag = false;
				break;
			}
		}
	}

	cout << (flag ? "Yes" : "No") << endl;

}

int main(void) {
	solve();
	Would you please return 0;
}

Measured memory_bytes: 640
// Problem : D - Partition
// Contest : AtCoder - AtCoder Beginner Contest 112
// URL : https://atcoder.jp/contests/abc112/tasks/abc112_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

/* DEBUGGING */
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif

/* MACROS */ 
typedef long long int ll;
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

typedef map<int,int> mii;

#define  ff          first
#define  ss          second
#define  pb          push_back
#define  IOS         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  lb          lower_bound
#define  ub          upper_bound
#define  all(x)      (x).begin(), (x).end()
#define  ps(x,y)     fixed<<setprecision(y)<<x
#define  setbit(x)   __builtin_popcountll(x)
#define  rep(i,a,b)  for(int i=a ; i<b ; ++i)
#define  repr(i,a,b) for(int i=a ; i>=b ; --i)

/* CONSTANTS */ 
#define PI 3.141592653589793
const ll MOD = 1e9 + 7;
const ll INF = 1000000000;
const ll MAX_N = 2e5 + 2;

// #define cerr if(false)cerr
/* CODE STARTS HERE */

void solve(){
    ll n,m; cin >> n >> m;
    vll divs(0);
    
    for(ll i=1;i*i<=m;++i){
        if(m%i==0){
            divs.pb(i);
            
            if(m/i != i) divs.pb(m/i);
        }
    }
    
    sort(all(divs) , greater<ll>());
    int sz = divs.size();
    
    rep(i,0,sz){
        ll temp = n*divs[i];
        
        if(temp <= m) {cout << divs[i]; return;}
    }    
}

int main(){
    IOS;
    solve();
}

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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> a_list;
    int temp;

    for(auto i = 0; i < N; i++){
        cin >> temp;
        a_list.push_back(temp);
    }

    sort(a_list.begin(), a_list.end());
    reverse(a_list.begin(), a_list.end());

    int alice = 0;
    int bob = 0;

    for(auto i = 0; i < N; i++){
        if(i % 2 == 0){
            alice += a_list[i];
        }else{
            bob += a_list[i];
        }
    }

    cout << alice - bob << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<set>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=200000 +117;
const int MM=200000 +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}

#define pii pair<int,int>
#define mp make_pair 
int m,n,l;
int a[NN]={};
int v[NN][2]={};
int xt[NN]={};
int pre[NN]={};
set<pii> all;
int tp[NN][2]={};
int sum[NN]={};
int id[NN]={};
int res[NN][2]={};
LL calc(int v[NN][2],int len){
	for(int i=1;i<=len;++i){
		sum[i]=sum[i-1]+v[i][1];
	}
	LL ans=0;
	for(int i=1;i+l-1<=len;++i){
		ans+=(LL)v[i][0]*(sum[len]-sum[i+l-2]);
	}
	return ans;
}
int main(){
	//open();
	n=read();
	l=read();
	LL ans=n;
	for(int i=1;i<=n;++i){
		a[i]=read();
		all.insert(mp(a[i],i));
		v[i][0]=v[i][1]=1;
		xt[i]=i+1;
		pre[i]=i-1;
	}
	while(!all.empty()){
		pii now=*all.begin();
		int val=now.first;
		int pos=now.second;
		int cnt=0;
		while(a[pos]==val){
			tp[++cnt][0]=v[pos][0];
			tp[cnt][1]=v[pos][1];
			id[cnt]=pos;
			all.erase(mp(val,pos));
			pos=xt[pos];
		}
		if(cnt>=l){
			ans+=calc(tp,cnt);
			int bcnt=cnt/l;
			for(int i=1;i<=bcnt;++i){
				res[i][0]=res[i][1]=0;
			}
			for(int i=l;i<=cnt;++i){
				res[i/l][1]+=tp[i][1];
			}
			for(int i=cnt-l+1;i>=1;--i){
				res[bcnt+1-(cnt+1-i)/l][0]+=tp[i][0];
			}
			ans-=calc(res,bcnt);
			for(int i=1;i<=bcnt;++i){
				int pos=id[i];
				all.insert(mp(val+1,pos));
				a[pos]=val+1;
				v[pos][0]=res[i][0];
				v[pos][1]=res[i][1];
			}
			xt[id[bcnt]]=xt[id[cnt]];
			pre[xt[id[bcnt]]]=id[bcnt];
		}
	}
	printf("%lld\n",ans);
	close();
	return 0;
}

Measured memory_bytes: 16768
public class Main {
  public static void main(String[] args) {
    int k = 0;
    for (int i = 1; i < 10; i++) {
      for (int j = 1; j < 10; j++) {
        k = i * j;
        System.out.println(i + "x" + j + "=" + k);
      }
    }
  }
}

Measured memory_bytes: 24020
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
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; }
  
const int MOD=1e9+7;
const ll INF=1e18;
const ll inf=1e9;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
 
const int MAX=510000;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
   
  ll k,a,b;
  cin >> k >> a >> b;
  ll now = 1;
  if(a+2>=b)now+=k;
  else{
    while(k>0){
      if(now<a){
        if(a-now+2>k){
          now += k;
          break;
        }
        else{
          k -= (a-now+2);
          now = b;
        }
      }
      else{
        if(k<2){
          now += k;
          break;
        }
        else{
          k-=2;
          now += b-a;
        }
      }
    }
  }
  
  cout << now << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef pair<ll,ll> pll;

const ll mod=1000000007;
const ll inf=1000000000000; 

#define rep(i,m,n) for(ll i=m;i<n;i++)

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

 ll n;
  cin >> n;
  vector<vector<char>> s(n,vector<char>(n));
  rep(i,0,n) {
    rep(j,0,n) cin >> s[i][j];
  }

  ll res=0;
  rep(k,0,n){
    bool flag=true;
  rep(i,0,n){
    rep(j,0,n) 
      if(s[i][(j+k)%n]!=s[j%n][(i+k)%n]) {
      flag=false;
      break;
    }
  }
  if(flag) res+=n;
  }
  cout << res << endl;
}

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


 
int main() {
  string s;
  cin >> s;
  int n=s.size();
  bool ok=true;
  vector<char> ss(n);
  vector<char> sb((n-1)/2);
  vector<char> se((n-1)/2);
  vector<char> sss(n);
  vector<char> bs((n-1)/2);
  vector<char> es((n-1)/2);
  rep(i,n) {
      ss[i]=s[i];
      sss[n-1-i]=s[i];
      if(i<(n-1)/2) {
          sb[i]=s[i];
          bs[(n-1)/2-1-i]=s[i];
      }
      if(i>(n-1)/2) {
          se[i-(n+1)/2]=s[i];
          es[(n-1)/2-1-i+(n+1)/2]=s[i];
      }
      
  }
  
  
  if(sss!=ss) ok=false;
  if(sb!=bs) ok=false;
  if(se!=es) ok=false;

  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

using ll = long long;
using itn = int;
using namespace std;


int main() {
	int n, k;
	cin >> n >> k;
	double x = 0;
	for (int i = 1; i < n+1; i++) {
		for (int j = 0; j < k; j++) {
			if (k <= i*powf(2, j)) {
				x = x +(1.0/n)*powf(0.5, j);
				break;
			}
		}
	}
	printf("%.12lf", x);
}

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

int main() {
  vector<int> vec(1000000);
  cin>>vec.at(0);
  
  if(vec.at(0)==4||vec.at(0)==2||vec.at(0)==1){
    cout<<"4"<<endl;
    return 0;
  }
  
  for(int i=0;i<1000000;i++){
    if(vec.at(i)%2==0){
      vec.at(i+1)=vec.at(i)/2;
    }
    else{
      vec.at(i+1)=3*vec.at(i)+1;
    }
    
    if(vec.at(i+1)==4){
      cout<<i+5<<endl;
      break;
    }
  }
}


Measured memory_bytes: 4096
#include <iostream>
#include <vector>
#include <set>

using namespace std;

// |xj - xi| + |yj - yi|                                                                                                                                      
// xj + max(yj - xi - yi, -yj - xi + yi)                                                                                                                      

int main() {
  int N;
  cin >> N;
  set<int> plus, minus;
  int ans = 0;
  vector<pair<int, int>> points;
  for (int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    points.push_back(make_pair(x, y));
  }
  sort(points.begin(), points.end(),
       [](const pair<int, int> &a, const pair<int, int> &b) { return a.first < b.first; });
  for (int i = 0; i < N; i++) {
    pair<int, int> point = points[i];
    int x = point.first;
    int y = point.second;
    if (i > 0) {
      int cand = max(x+y-*plus.begin(), x-y-*minus.begin());
      ans = max(ans, cand);
    }
    plus.insert(x+y);
    minus.insert(x-y);
  }
  cout << ans << endl;
}


Measured memory_bytes: 23080
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC098A
{
    class Program
    {
        static void Main(string[] args)
        {
            int A, B,c,d,f,g;
            var word = Console.ReadLine().Split(' ');
            A = int.Parse(word[0]);
            B = int.Parse(word[1]);
            c = A + B;d = A - B;f = A * B;
            if (c >= d)
            {
                if (c >= f) { g = c; }
                else { g = f; }
            }
            else if (d >= c)
            {
                if (d >= f) { g = d; }
                else { g = f; }
            }
            else { g = f; }
            Console.WriteLine(g);
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 11092
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
using namespace std;
int a[15];

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	int sum = 1;
	for (int i =  1; i <= n; i++)	sum *= 3;

	int kk = 1;
	for (int i = 1; i <= n; i++){
		if (a[i]%2 == 0)	kk *= 2;
	}
	int num = 0;
	for (int i = 1; i <= n; i++){
		if (a[i] % 2 == 1) num++;
	}
	if (num == n)
		printf("%d\n", sum - kk);
	else
	printf("%d\n", sum - kk);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y;
  cin >> x >> y;
if(x == y && x == 2)
  cout << "Yes" << endl;
  else if((x == 4 || x == 6 || x == 9 || x == 11 ) &&(y == 4 || y == 6|| y == 9 || y == 11))
	cout << "Yes" << endl;
  else if((x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12) &&
          (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
    }


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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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; }
typedef long long ll;

const long long INF = 1LL << 60;
const long long DIV = 1000000007;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<ll> field(N + 1, 0);

    rep(i, M) {
        ll a;
        cin >> a;
        field[a] = -1;
    }

    vector<ll> ans(N + 1);
    ans[0] = 1;
    repd(i, 1, N + 1) {
        if (field[i - 1] != -1) {
            ans[i] += ans[i - 1] % DIV;
        }
        if (field[i - 2] != -1 && i >= 2) {
            ans[i] += ans[i - 2] % DIV;
        }
    }

    cout << ans[N] % DIV << endl;


    return 0;
}

Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main(){
    int x;
    int kyu;

    scanf("%d", &x);

    if(x < 600) kyu = 8;
    else if(600 <= x && x < 800) kyu = 7;
    else if(800 <= x && x < 1000) kyu = 6;
    else if(1000 <= x && x < 1200) kyu = 5;
    else if(1200 <= x && x < 1400) kyu = 4;
    else if(1400 <= x && x < 1600) kyu = 3;
    else if(1600 <= x && x < 1800) kyu = 2;
    else if(1800 <= x && x < 2000) kyu = 1;

    printf("%d", kyu);

    return 0;
}

Measured memory_bytes: 1736
public class Main {
	public static void main(String args[]) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		boolean f = false;

		for (int i=0; i<N; i++) {
			A[i] = sc.nextInt();
			if (A[i] % 2 == 0) {
				if (A[i]%3 != 0 && A[i]%5 != 0) {
					f = true;
				}
			}
		}

		if (f) {
			System.out.println("DENIED");
		} else {
			System.out.println("APPROVED");
		}

	}
}


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

int main()
{
    string s;
    cin >> s;
    int count = 0;
    if(s[0] == 'A'){
        if(s[1] != 'C' && (s[1] >= 'a' && s[1] <= 'z') && (s.back() >= 'a' && s.back() <= 'z'))
        for(int i=2;i<s.size()-1;i++){
            if(s[i] == 'C'){
                count++;
            }
            else if(s[i] >= 'A' && s[i] <= 'Z'){
                cout << "WA" << endl;
                break;
            }
        }
        if(count == 1){cout << "AC" << endl;}
        else{cout << "WA" << endl;}
    }
    else{
        cout << "WA" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define MOD2 998244353
#define INF MOD
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int a[6];

int main() {
    int ans = 0;
    rep(i,5) {
        cin >> a[i];
        if (a[i] == 0) ans = i+1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
typedef long long int ll;
using namespace std;
int main()
{
	int a,b,c;
	cin >> a >> b >> c;

	if(a > b && a > c){
		cout << b+c << endl;
	}else if(b > a && b > c){
		cout << a+c << endl;
	}else{
		cout << a+b <<endl;
	}
	
	return 0;
}

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

int main(){
    
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    
    ll ans = 1;
    sort(a.begin(),a.end());
    ans = a[n-1];
    bool flag = true;
    for(int i = 0;i<n-1;i++){
        if(ans == 0){
            break;
        }else if(1000000000000000000/ans < a[i]){
            flag = false;
            break;
        }else{
            ans = ans*a[i];
        }
    }

    if(flag){
        cout << ans << endl;
    }else{
        cout << "-1" << endl;
    }
}


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

int main(){
    int n, k, ans = 0;
    cin >> n >> k;
    vector<int> l(n);
    for(int i = 0; i < n; i++) cin >> l[i];
    sort(l.begin(), l.end(), greater<int>());
    for(int i = 0; i < k; i++){
        ans += l[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 3520
#include<stdio.h>
int main(void)
{
   int a,b,k,j,w,n=0,m=1;
   scanf("%d%d%d",&a,&b,&k);
   if(a<b) w=a;
   else w=b;
   for(j=w;n<k;j--){
      if((a%j==0)&&(b%j==0)){
         n++;
      }
   }
   printf("%d\n",j+1);
   return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
inline int read()
{
	int s=0,f=1;char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

const int maxn=25;

int n,K;

int dp[maxn][1<<21];
int num[1<<21];

inline void init()
{
	n=read(); K=read();
	REP(i,0,n)
	{
		static char str[(1<<20)+20];
		scanf("%s",str);int len=strlen(str);
		REP(j,0,len-1)dp[0][(1<<i)|j]=str[j]-'0';
	}
}

inline void doing()
{
	REP(i,0,n-1)
	{
		REP(j,0,(1<<n+1)-1)if(dp[i][j])
		{
			int a=j>>n+1-i,b=j&(1<<n-i+1)-1;
			int ws=31-__builtin_clz(b);
			b^=1<<ws;
			if(b)dp[i+1][(a<<n+1-i)|(1<<n-i)|b]+=dp[i][j];
			if(b!=(1<<ws)-1)
			{
				int nws=~b&(1<<ws)-1;
				nws=31-__builtin_clz(nws);
				dp[i+1][(a<<n+1-i)|1<<nws|(b&(1<<nws)-1)]+=dp[i][j];
			}
		}
	}
	DREP(i,n,0)
	{
		//REP(j,0,(1<<i)-1)
		REP(j,0,(1<<i)-1)
		{
			int res=0;
			REP(k,0,(1<<n+1-i)-1)
			{
				res+=dp[i][(j<<n+1-i)|k];
			}
			if(res>=K)
			{
				DREP(x,i-1,0)printf("%d",j>>x&1);puts("");
				exit(0);
			}
		}
	}
}

int main()
{
	init();
	doing();
	return 0;
}


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

using namespace std;

int main(){
  int x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> x1 >> y1 >> x2 >> y2;

  int yd=abs(y2-y1);
  int xd=abs(x2-x1);
  if (x1 <= x2 && y1 < y2){
    x3 = x2 - yd;
    y3 = y2 + xd;
    x4 = x1 - yd;
    y4 = y1 + xd;
  }else if (x1 > x2 && y1 < y2){
    x3 = x2 - yd;
    y3 = y2 - xd;
    x4 = x1 - yd;
    y4 = y1 - xd;
  }else if (x1 > x2 && y1 >= y2){
    x3 = x2 + yd;
    y3 = y2 - xd;
    x4 = x1 + yd;
    y4 = y1 - xd;
  }else{
    x3 = x2 + yd;
    y3 = y2 + xd;
    x4 = x1 + yd;
    y4 = y1 + xd;
  }
  
  printf("%d %d %d %d\n",x3,y3,x4,y4);
}


Measured memory_bytes: 3744
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		String[] Array = s.split("");
		int[]intArray=new int[Array.length];
		
		for (int i=0;i<Array.length;i++) {
			intArray[i]=Integer.parseInt(Array[i]);
			}
		
		int A=intArray[0];
		int B=intArray[1];
		int C=intArray[2];
		int D=intArray[3];
		
		if((A+B+C+D)==7) {
			System.out.println(A+"+"+B+"+"+C+"+"+D+"=7");
		}else if((A-B+C+D)==7) {
			System.out.println(A+"-"+B+"+"+C+"+"+D+"=7");
		}else if((A-B-C+D)==7) {
			System.out.println(A+"-"+B+"-"+C+"+"+D+"=7");
		}else if((A-B-C-D)==7) {
			System.out.println(A+"-"+B+"-"+C+"-"+D+"=7");
		}else if((A-B+C-D)==7) {
			System.out.println(A+"-"+B+"+"+C+"-"+D+"=7");
		}else if((A+B-C+D)==7) {
			System.out.println(A+"+"+B+"-"+C+"+"+D+"=7");
		}else if((A+B+C-D)==7) {
			System.out.println(A+"+"+B+"+"+C+"-"+D+"=7");
		}else if((A+B-C-D)==7) {
			System.out.println(A+"+"+B+"-"+C+"-"+D+"=7");
		}
		sc.close();
	}

}


Measured memory_bytes: 21972
//Code is like humor. When you have to explain it, it’s bad.
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#include <bits/stdc++.h>
#define MOD 1000000007
#define MOD1 998244353
#define endl "\n"
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define mkp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define int ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pairs;
typedef map<int,int> maps;
typedef vector <int> VI;
typedef std::multimap<int, pair<int,int>>::iterator MMIPIterator;
typedef std::map<int, int>::iterator MIIIterator;
double pi = 2 * acos(0.0);


int32_t main()  {
    fastio;
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
    #endif
    
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    bool w;
    while(1) {
        c -= b;
        if(c <= 0) {
            w = true;
            break;
        }
        a -= d;
        if(a <= 0) {
            w = false;
            break;
        }
    }
    if(w) cout << "Yes\n";
    else cout << "No\n";
    
    return 0;
    
}



Measured memory_bytes: 3612
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using E = System.Linq.Enumerable;
class Program
{
    static long N;
    static char[] abc = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
    static long ans = 1;
    static void Main(string[] args)
    {

        //A = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        //N = long.Parse(Console.ReadLine());
        var S = Console.ReadLine().ToCharArray();
        N = S.Length;
        var dic = new Dictionary<char, int>();
        foreach (var item in abc)
        {
            dic.Add(item, 0);
        }

        var count = 0;
        foreach (var item in S)
        {
            ans += (count - dic[item]);
            dic[item]++;
            count++;
        }

        Console.WriteLine(ans);
    }

    
}
















Measured memory_bytes: 27372
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			int in = Integer.parseInt(br.readLine());
			int re = in/15;

			System.out.println(in*800 - re*200);

		}
	}
}


Measured memory_bytes: 25284
n=int(input())
a=list(input())
b=list(input())
c=list(input())
cnt=0
for i in range(n):
    if a[i]==b[i]==c[i]:
        continue
    if a[i]==b[i] or b[i]==c[i] or a[i]==c[i]:
        cnt+=1
    else:
        cnt+=2
print(cnt)

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

int main(){
    string S,T;
    cin >> S >> T;
    int len_S = S.size();
    int len_T = T.size();
    int ans_max = 0;
    for (int i = 0; i <= len_S - len_T; i++){
        int ans_sub = 0;
        rep(j,len_T){
            if (S[i + j] == T[j]) ans_sub++;
        }
        ans_max = max(ans_max, ans_sub);
    }
    cout << len_T - ans_max << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#define N 100000
int a[N],b[N],c[N];
using namespace std;
int main( void )
{
  int i,j,k,n,d=0,ret=0;
  cin >> n;
  for( i=0; i<n; i++ )
    cin >> a[i] >> b[i];
  sort( a, a+n );
  sort( b, b+n );
  for( i=2,j=0,k=0; i<=n+1; i++ ){
    while( a[j] == i ){ j++; d++; }
    while( b[k] == i-1 ){ k++; d--; }
    if( i-1 <= d ) ret = i-1;
  }
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 1964
#include <algorithm>
#include <iostream>
#include <vector>
#define maxn 200003
#define pb push_back
using namespace std;

int n,m;
int inc[maxn];
int sum[maxn];
vector<int>adj[maxn];

void dfs( int node , int dad ) {
	sum[node] = sum[dad] + inc[node];
	for( int i = 0 ; i < (int) adj[node].size() ; i++ )
		if( adj[node][i] != dad )
			dfs( adj[node][i] , node );
}

int main() {
	cin >> n >> m;
	for( int i = 1 , x , y ; i < n ; i++ ) {
		cin >> x >> y;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	for( int i = 0 , u , val ; i < m ; i++ ) {
		cin >> u >> val;
		inc[u] += val;
	}
	dfs( 1 , 0 );
	for( int i = 1 ; i <= n ; i++ )
		cout << sum[i] << " ";
}


Measured memory_bytes: 27264