akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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 (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;} 
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll x, y, xx, yy;
        cin >> x >> y >> xx >> yy;
        complex<ll> v1(xx-x, yy-y);
        complex<ll> i(0, 1);
        complex<ll> v2 = v1 * i;
        ll xxxx = v2.real() + x;
        ll yyyy = v2.imag() + y;
        complex<ll> v3 = v1 + v2;
        ll xxx = v3.real() + x;
        ll yyy = v3.imag() + y;

        cout << xxx << ' ' << yyy << ' ' << xxxx << ' ' << yyyy << endl;
}

Measured memory_bytes: 3648
N=int(input())
K=[]
ans=0
ans2=0
AA=0
BB=0
BA=0
for i in range(N):
    s=input().strip()
    ans+=s.count('AB')
    ans2+=s.count('AB')
    if s[0]=='B' and s[-1]=='A':
        BA+=1
    elif s[0]=='B':
        BB+=1
    elif s[-1]=='A':
        AA+=1
#strategy1        
tmp=min(AA,BB)
tmp2=max(AA-tmp, BB-tmp)
tmp3=min(BA,tmp2)
if tmp3==BA:
    tmp4=0
elif tmp3==tmp2 and tmp2!=0:
    tmp4=(BA-tmp3)
elif tmp3==tmp2 and tmp2==0:
    tmp4=(BA-tmp3)-1
ans=ans+tmp+tmp3+tmp4
#strategy2
ans2+=BA
if BA>0:
    ans2-=1
if BA>0:
    if BB>0:
        BB-=1
        ans2+=1
    if AA>0:
        AA-=1
        ans2+=1
kk=min(BB,AA)
if kk>0:
    ans2+=kk
#print(ans,ans2)
print(max(ans,ans2))

Measured memory_bytes: 44008
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll k;
  cin >> k;
  rep(i, k) cout << "ACL";
  cout << endl;
}


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

int main() {
    int N; cin >> N;
    vector<int> h(N);
    int ans = 0;
    rep(i, N){
        cin >> h[i];
        if(i == 0){
            ans += h[i];
        } else {
            if(h[i] <= h[i-1]){
                continue;
            } else {
                ans += h[i] - h[i-1];
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3592
using System;

class ABC_139_B
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int A = int.Parse(input[0]);
        int B = int.Parse(input[1]);

        int count = 0;
        int socket = 1;
        while (socket<B)
        {
            count++;
            socket += (A-1);
        }

        Console.WriteLine(count);
    }
}


Measured memory_bytes: 11092
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//234 Coloring Colorfully
	string s;
	cin>>s;
	char a='0';
	int cnta=0,cntb=0;
	for(char c:s) {
		if(c!=a)cnta++;
		if(a=='0')a='1';
		else a='0';
	}
	a='1';
	for(char c:s) {
		if(c!=a)cntb++;
		if(a=='0')a='1';
		else a='0';
	}
	cout<<min(cnta,cntb);
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3784
#include <iostream>
#include <vector>
using namespace	std;
int main(){

  vector <int> a;
  int n,b,i;

  cin>>n;
  for(i=0;i<n;i++){
    cin>>b;
    a.push_back(b);
  }

  for(i=0;i<n-1;i++) cout<<a[i]<<" ";
  cout<<a[n-1]<<endl;

  for(i=1;i<n;i++){
    for(int j=0;j<i;j++){
      if(a[i]<a[j]){
        a.insert(a.begin()+j,a[i]);
        a.erase(a.begin()+i+1);
      }
    }

    for(int j=0;j<n-1;j++) cout<<a[j]<<" ";
    cout<<a[n-1]<<endl;
  }

  return 0;

}

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

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  ll n;
  cin >> n;
  ll sum = 0, len = 0;
  for (int i = 0; i < n; i++) {
    ll d, c;
    cin >> d >> c;
    sum += d*c;
    len += c;
  }
  cout << (sum-1)/9+len-1 << endl;
}


Measured memory_bytes: 256
import random


def dice ( a , b , c , d , e , f , l ) :
    if l == "N" :
        return [ b , f , c , d , a , e ]
    if l == "S" :
        return [ e , a , c , d , f , b ]
    if l == "E" :
        return [ d , b , a , f , e , c ]
    if l == "W" :
        return [ c , b , f , a , e , d ]
d = list ( map ( int , input ( ).split ( ) ) )
s = [ "W" , "N" , "E" , "S" ]
a , b , c , g , e , f = map ( int , input ( ).split ( ) )
j = 0
while j <= 10000 :
    k = random.randrange ( 4 )
    d = dice ( d [ 0 ] , d [ 1 ] , d [ 2 ] , d [ 3 ] , d [ 4 ] , d [ 5 ] , s [ k ] )
    if d [ 0 ] == a and d [ 1 ] == b and d [ 2 ] == c and d [ 3 ] == g and d [ 4 ] == e and d [ 5 ] == f :
        print ( "Yes" )
        break
    if j == 10000 :
        print ( "No" )
    j += 1



Measured memory_bytes: 8176
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int n, k;
vector<vector<int>>a( 100005, vector<int>(4) ), memo( 100005, vector<int>(4, -1) );

int vacation( int day, int task ){
    if ( day == n )
        return 0;
    
    int mx = 0;
    if ( task == 0 ){
        mx = max( mx, a[day][1] + vacation(day + 1, 1) );
        mx = max( mx, a[day][2] + vacation(day + 1, 2) );
        mx = max( mx, a[day][3] + vacation(day + 1, 3) );
    }
    
    if ( memo[day][task] != - 1)
        return memo[day][task];
    if ( task == 1 ){
         mx = max( mx, a[day][2] + vacation(day + 1, 2) );
         mx = max( mx, a[day][3] + vacation(day + 1, 3) );
    }
    else if ( task == 2 ){
        mx = max( mx, a[day][1] + vacation(day + 1, 1) );
        mx = max( mx, a[day][3] + vacation(day + 1, 3) );
    }
       
    else{
         mx = max( mx, a[day][1] + vacation(day + 1, 1) );
        mx = max( mx, a[day][2] + vacation(day + 1, 2) );
    }
    
    return memo[day][task] = mx;
}

int main()
{
    cin >> n;
    for ( int i = 0; i < n; i++ )
        for ( int j = 1; j <= 3; j++ )
        cin >> a[i][j];
   
        
    cout << vacation(0, 0) << endl;
    return 0;
}


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

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

    vector<int> count(5, 0);
    for(int i = 0; i < n; i++){
        if(s[i][0] == 'M') count[0]++;
        else if(s[i][0] == 'A') count[1]++;
        else if(s[i][0] == 'R') count[2]++;
        else if(s[i][0] == 'C') count[3]++;
        else if(s[i][0] == 'H') count[4]++;
    }

    long long int ans = 0;
    for(int bit = 0; bit < (1 << 5); bit++){
        long long int coans = 1;
        int num = 0;
        for(int i = 0; i < 5; i++){
            if(bit & (1 << i)){
                coans *= count[i];
                num++;
            }
        }
        if(num == 3) ans += coans;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

const int N = 1e5;
vector<int> g[N];
vector<int> path[N];

void dfs(int u, int p, int x) {
  for (int v : g[u]) if (v != p) {
    dfs(v, u, x);
    path[u].push_back(path[v].back() + 1);
  }

  if (path[u].size() % 2 == 0) {
    path[u].push_back(0);
  }

  sort(path[u].begin(), path[u].end());

  int ok = path[u].size();
  int ng = -1;

  while (ok - ng > 1) {
    int mid = (ok + ng) / 2;

    int mx = 0;
    auto tmp = path[u];
    tmp.erase(tmp.begin() + mid);

    for (int i = 0; i * 2 + 1 < tmp.size(); i++) {
      mx = max(mx, tmp[i] + tmp[tmp.size() - 1 - i]);
    }

    if (mx <= x) {
      ok = mid;
    } else {
      ng = mid;
    }
  }
 
  if (ok == path[u].size()) throw -1;
  swap(path[u][ok], path[u].back());
  
  if (p == -1) {
    if (g[u].size() % 2 == 0 && ok != 0) throw - 1;
    if (g[u].size() % 2 == 1 && path[u].back() > x) throw -1;
  }
}

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

  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      ans += (g[i].size() + 1) / 2;
    } else {
      ans += (g[i].size() - 1) / 2;
    }
  }

  int ok = n - 1;
  int ng = -1;
  while (ok - ng > 1) {
    for (int i = 0; i < n; i++) {
      path[i].clear();
    }
    int mid = (ok + ng) / 2;
    try {
      dfs(0, -1, mid);
      ok = mid;
    } catch (...) {
      ng = mid;
    }
  }

  cout << ans << ' ' << ok << endl;
}



Measured memory_bytes: 21888
n=int(input())
l=list(map(int, input("").split()))
out=0
c=0
for i in  range(n):
    for j in range(i+1,n):
        if l[i] !=l[j]:
            c+=1
            for k in range(j+1,n):
                if l[j] != l[k] and l[i] != l[k]:
                    if l[i]+l[j] > l[k] and l[i]+l[k] > l[j] and l[j]+l[k] > l[i]:
                        out+=1
print(out)

Measured memory_bytes: 9208
#include<bits/stdc++.h>
using namespace std;
const int N = 5e2+10;
const int P = 1e9+7;
#define fr(i,low,up,st) for(register int i = low;i <= up;i += st)
#define nfr(i,low,up,st) for(register int i = low;i >= up;i -= st)
#define clr(a) memset(a,0,sizeof a)
#define SZ(a) (a.size())

int ga[N][N];

void solve(int l,int r,int ct){
   if(l == r)return ;
   int mid = (l+r)/2;
   fr(i,l,mid,1){
      fr(j,mid+1,r,1){
         ga[i][j] = ct;
      }
   }
   solve(l,mid,ct+1);
   solve(mid+1,r,ct+1);
}

int main(){
   int n;
   scanf("%d",&n);
   solve(1,n,1);
   fr(i,1,n,1){
      fr(j,i+1,n,1){
         printf("%d ",ga[i][j]);
      }
      puts("");
   }
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう
//a=61
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
typedef vector<int> veci;
typedef long long  ll;
typedef long double  ld;
typedef pair<int,int> pairii;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
int main() {
  veci m(9,0);
  veci v(10);
  rep1(i,9){
    cin>>v[i];
  }
  int n,cur;
  cin>>n;
  rep(j,n){
    cin>>cur;
    rep1(k,9){
      if(v[k]==cur){cerr<<k;m[k-1]=1;}
    }
  }
  if(m[0]*m[1]*m[2]+m[3]*m[4]*m[5]+m[6]*m[7]*m[8]+m[0]*m[3]*m[6]+m[4]*m[1]*m[7]+m[8]*m[5]*m[2]+m[0]*m[4]*m[8]+m[6]*m[4]*m[2]){
    cout<<"Yes"<<endl;
  }
  else cout<<"No"<<endl;
}

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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  double r;
  cin >> r;
  
  cout << std::fixed << std::setprecision(5) <<  r*r*M_PI << " " << 2.0*r*M_PI << endl;
 
  return 0;
}


Measured memory_bytes: 3236
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,k,s;
  cin >> n >> m;
  vector<vector<int>> light(m);
  vector<int> p(n);
  for(int i=0;i<m;i++){
    cin >> k;
    light[i] = vector<int>(k);
    for(int j=0;j<k;j++)
      cin >> light[i][j];
  }
  for(int i=0;i<m;i++) cin >> p[i];

  int cnt = 0;
  for(int r = 0; r < (1 << n); r++){
    bitset<10> pt(r);
    for(int i=0;i<m;i++){
      int sm = 0;
      for(int j:light[i]){
        sm ^= pt[--j];
      }
      if(p[i] != sm){
        cnt --;
        break;
      }
    }
    cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
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 people[4][3][10];

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

    int n; cin >> n;
    rep(i,n) {
        int b, f, r, v; cin >> b >> f >> r >> v;
        b--; f--; r--;
        people[b][f][r] += v;
    }
    rep(i,4) {
        rep(j,3) {
            rep(k,10) {
                if(k == 0) cout << " ";
                cout << people[i][j][k];
                if(k != 9) cout << " ";
            }
            cout << endl;
        }
        if(i != 3) {
            rep(loop,20) cout << "#";
            cout << endl;
        }
    }
}




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

int main(){
	int N, H;
	cin >> N >> H;
	int a[N], b[N], max = -1;
	for(int i=0; i<N; i++){
		cin >> a[i] >> b[i];
		if(max < a[i]){
			max = a[i];
		}
	}
	sort(b, b+N);
	int h = H;
	vector<int> ans;
	for(int i=1; i<=N; i++){
		h -= b[N-i];
		if(h <= 0){
			ans.push_back(i);
			break;
		}else{
			int a = i + (h+max-1)/max;
			ans.push_back(a);
		}
	}
	int min = ans[0];
	for(int i=1; i<ans.size(); i++){
		if(ans[i] < min){
			min = ans[i];
		}
	}
	cout << min << endl;
	return 0;
}

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

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

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

  int a, b;
  cin >> a >> b;

  if (8 < a || 8 < b) {
    cout << ":(" << endl;
  } else {
    cout << "Yay!" << endl;
  }

  return 0;
}


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

using namespace std;

int main()
{
	string str[9];
	int sum[20];
	int a,b;
	
	for(int i=0;i<9;i++)
	{
		cin >> str[i] >> a >> b ;
		sum[i]=a+b;
		sum[9+i]=200*a+300*b;
	}
	
	for(int i=0;i<9;i++)
		cout << str[i] << " " << sum[i] << " " << sum[9+i] << endl;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

int main() {
  ll n;
  cin >> n;
  vll a(n);
  rep(i,n) cin >> a[i];
  ll sum = 0LL;
  rep(i,n) sum ^= a[i];
  vll ret;
  rep(i,n) {
    ll ans = sum^a[i];
    ret.push_back(ans);
  }
  ll m = ret.size();
  rep(i,m) {
    if(i==m-1) cout << ret[i] << endl;
    else cout << ret[i] << " ";
  }
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> t(N+1), x(N+1), y(N+1);
  t.at(0) = 0;
  x.at(0) = 0;
  y.at(0) = 0;
  for(int i = 0; i < N; i++){
    cin >> t.at(i+1) >> x.at(i+1) >> y.at(i+1);
  }
  bool can = true;
  for(int i = 0; i < N; i++){
    int dt = abs(t.at(i + 1) - t.at(i));
    int dx = abs(x.at(i + 1) - x.at(i));
    int dy = abs(y.at(i + 1) - y.at(i));
    if(dx + dy > dt) can = false;
    if((dx + dy)%2 != dt%2) can = false;
  }
  if(can) cout << "Yes" << endl;
  else cout << "No" << endl;
  //cout << t.at(1) << x.at(1) << y.at(1) << endl;
}


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

typedef long long ll;

signed main()
{
  bool arr[10000][10000] = {};
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  for (int i = sx; i < tx; i++)
    cout << "R";
  for (int i = sy; i < ty; i++)
    cout << "U";
  for (int i = tx; i > sx; i--)
    cout << "L";
  for (int i = ty; i > sy; i--)
    cout << "D";

  cout << "D";

  for (int i = sx; i <= tx; i++)
    cout << "R";
  for (int i = sy; i <= ty; i++)
    cout << "U";

  cout << "LU";

  for (int i = tx; i >= sx; i--)
    cout << "L";
  for (int i = ty; i >= sy; i--)
    cout << "D";

  cout << "R" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		if(A == 1){
			A += 13;
		}
		if(B == 1){
			B += 13;
		}
		if(A == B){
			System.out.print("Draw");
		}else if (A > B){
			System.out.print("Alice");
		}else{
			System.out.print("Bob");
		}
	}
}

Measured memory_bytes: 21712
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>

using namespace std;

int main()
{
    int n;
    cin >> n;
    map<int, int> a;
    int tmp = 0;
    bool flag = false;
    for(int i = 0; i<n; i++){
        cin >> tmp;
        a[tmp]++;
        if(a[tmp] != 1) flag = true;
    }

    if(flag) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
char s[5];
int main(){
	scanf("%s", s);
	for(Rint i = 0;i < 3;i ++)
		if(s[i] == s[i + 1]){
			puts("Bad");
			return 0;
		}
	puts("Good");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define gc getchar
#define pc putchar
#define cs const

inline
int getint(){
	re int num=0;
	re char c;
	re bool f=0;
	while(!isdigit(c=gc()))f^=c=='-';num=c^48;
	while(isdigit(c=gc()))num=(num<<1)+(num<<3)+(c^48);
	return num; 
}

inline
void outint(int a){
	static char ch[23];
	if(a==0)pc('0');
	while(a)ch[++ch[0]]=a-a/10*10,a/=10;
	while(ch[0])pc(ch[ch[0]--]^48);
}

char s[100005];
int n;

signed main(){
	cin>>(s+1);
	n=strlen(s+1);
	if(s[1]=='0'||s[n]=='1')return puts("-1"),0;
	for(int re i=1;i<n;++i)if(s[i]^s[n-i])return puts("-1"),0;
	int now=1;
	for(int re i=2;i<=n;++i){
		outint(now),pc(' '),outint(i),pc('\n');
		if(s[i-1]=='1')now=i;
	}
	return 0;
} 

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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll mod = (ll)1e9 + 7;
const ll mxN = 200200;




int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(20);
	cout << fixed;

	ll n;
	cin>>n;
	ll bit = ll(log2(n))+1;
	if(1<<bit == n) cout<<n;
	else cout<<(1<<(bit-1));

}


Measured memory_bytes: 3748
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long 
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
const ll mod=998244353;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> data_struct;

// vector<ll> gr[2e5+5];
// vector<ll> dis(2e5+5);
// ll a[2e5+5];
// bool vis[2e5+5];



int main()
{
	ll x;
	cin>>x;
	ll n=100;
	ll t;
	for(ll i=1;i<=5000;i++)
	{
		n+=(n/100);
		if(n>=x)
		{
			t=i;
			break;
		}
	}
	cout<<t;
}

Measured memory_bytes: 3636
N,Y = (int(x) for x in input().split())
y = Y // 1000
for i in range(N+1):
    for j in range(N+1-i):
        if 10*i + 5*j + (N-i-j) == y:
            print(i,j,N-i-j)
            break
    else:
        continue
    break
else:
    n = -1
    print(n,n,n)

Measured memory_bytes: 3064
N=int(input())

dp=[0 for i in range(N*100+1)]

dp[0]=1

for i in range(N):
    s=int(input())
    for j in range(len(dp)):
        if dp[len(dp)-1-j]==1:
            dp[len(dp)-1-j+s]=1
ans=0
for i in range(len(dp)):
    if i%10==0:
        pass
    else:
        if dp[i]==1 and ans<i:
            ans=i
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main() {
    int x[3], y[3];
    for (int i = 0; i < 3; ++i) {
        cin >> x[i] >> y[i];
    }
    double a[3];
    double max = 0.0;
    double sum = 0.0;
    for (int i = 0; i < 3; ++i) {
        a[i] = sqrt(pow(x[i] - x[(i + 1 == 3) ? 0 : i + 1], 2) + pow(y[i] - y[(i + 1 == 3) ? 0 : i + 1], 2));
        sum += a[i];
        if (max < a[i]) {
            max = a[i];
        }
    }
    double s = sum / 2;
    //heron's formula
    double area = sqrt(s * (s - a[0]) * (s - a[1]) * (s - a[2]));
    //内接円の半径の公式
    double r = area / s;
    double left = 0.0, right = max;
    while (right - left > 0.0000000001) {
        double x = (left + right) / 2;
        //内側の三角形の1番大きい辺
        if (max * (r - x) / r >= 2 * x) {
            left = x;
        } else {
            right = x;
        }
    }
    cout << fixed << setprecision(10) << left << endl;
    return 0;
}


Measured memory_bytes: 256
N,A,B,C = map(int,input().split())

L = [int(input()) for _ in range(N)]
    
INF = 10**9

def dfs(i, a, b, c):
    if i == N:
        if min(a,b,c) > 0:
            return abs(a-A) + abs(b-B) + abs(c-C) - 30
        else:
            return INF
            
    ret1 = dfs(i+1, a, b, c)
    ret2 = dfs(i+1, a+L[i], b, c) + 10
    ret3 = dfs(i+1, a, b+L[i], c) + 10
    ret4 = dfs(i+1, a, b, c+L[i]) + 10
    return min(ret1,ret2,ret3,ret4)
    
print(dfs(0,0,0,0))

Measured memory_bytes: 9144
#include <bits/stdc++.h>
using namespace std;
int dp[3001][3001];
int getLCS(string& s1, string& s2, int n, int m){
    if(n == 0 or m == 0){
        return 0;
    }
    if(dp[n][m] != -1){
        return dp[n][m];
    }
    if(s1[n-1] == s2[m-1]){
        return dp[n][m] = 1 + getLCS(s1, s2, n-1, m-1);
    }else{
        return dp[n][m] = max(getLCS(s1, s2, n-1, m), getLCS(s1, s2, n, m-1));
    }
}
string LCS(string& s1, string& s2){
    int n = s1.length();
    int m = s2.length();
    memset(dp, -1, sizeof(dp));
    int len = getLCS(s1, s2, n, m);
    string res = "";
    int i = n;
    int j = m;
    while(i > 0 and j > 0){
        if(s1[i-1] == s2[j-1]){
            res = s1[i-1] + res;
            i--;
            j--;
        }else{
            if(dp[i-1][j] > dp[i][j-1]){
                i--;
            }else j--;
        }
    }
    return res;
}
int main() {
	string s1, s2;
	cin>>s1>>s2;
	cout<<LCS(s1, s2);
	return 0;
}

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

int main() {
  int N , K , x , sum =0;
  cin >> N >> K;
  for (int i=0; i < N ; i++) {
    cin >> x;
    if(K > x) {
      if (2*x < 2*(K-x)) sum += 2*x;
      else sum +=2*(K-x);
    }
    if(K < x) {
      if (2*x > 2*(x-K)) sum +=2*x;
      else sum +=2*(x-K);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d%d", $H, $W);
for($y = 0; $y < $H; $y++){
    fscanf(STDIN, "%s", $str);
    $map[$y] = str_split($str);
    for($x = 0; $x < $W; $x++){
        if($map[$y][$x] == "#"){
            $list[$y][$x] = 1;
        }
    }
}
$count = 0;
$HM = $H - 1;
$WM = $W - 1;
while($list){
    $nextList = [];
    foreach($list as $y => $xs)foreach($xs as $x => $_){
        if($x && $map[$y][$x-1] == ".")$nextList[$y][$x-1] = $map[$y][$x-1] = 1;
        if($y && $map[$y-1][$x] == ".")$nextList[$y-1][$x] = $map[$y-1][$x] = 1;
        if($x < $WM && $map[$y][$x+1] == ".")$nextList[$y][$x+1] = $map[$y][$x+1] = 1;
        if($y < $HM && $map[$y+1][$x] == ".")$nextList[$y+1][$x] = $map[$y+1][$x] = 1;
    }
    $list = $nextList;
    if($list)$count++;
}
echo $count;


Measured memory_bytes: 123384
#include<iostream>
#include<math.h>
using namespace std;

struct Pos{
	double x,y;
};

Pos VSub(Pos pos1,Pos pos2){
	pos1.x -= pos2.x;
	pos1.y -= pos2.y;
	return pos1;
}

Pos Rotate(Pos v,double ang){
	double t;
	t = v.y;
	v.y = v.y*cos(ang)+v.x*sin(ang);
	v.x = v.x*cos(ang)-t*sin(ang);
	return v;
}
int main(){
	Pos point[4];	//point[3]:ten
	char *c[200];
	int i,cor = 0;
	while(cin >> point[0].x){
		cin >> point[0].y;
		for(i = 1;i < 4;i++){
			cin >> point[i].x >> point[i].y;
		}
		Pos v[6];
		double at[6];
		for(i = 0;i < 3;i++){
			v[i] = VSub(point[(i+1)%3],point[i]);
			v[i+3] = VSub(point[3],point[i]);
		}
		for(i = 0;i < 3;i++){
			at[i] = atan2(v[i].y,v[i].x);
			v[i+3] = Rotate(v[i+3],-at[i]);
			at[i+3] = atan2(v[i+3].y,v[i+3].x);
		}
		if(at[3] * at[4] > 0 && at[4]*at[5] > 0)
			c[cor] = "YES";
		else
			c[cor] = "NO";
		cor++;
	}
	for(i = 0;i < cor;i++)
		cout << c[i] << endl;
}

Measured memory_bytes: 1292
#include <bits/stdc++.h>
 
#define pb push_back
#define int long long
#define debug(n) cerr << #n << " = " << n << '\n';
 
using namespace std;
const int MAXN = 110 , MXN = 1e5 + 10;
int w[MAXN] , v[MAXN] , dp[MAXN][MXN];

int32_t main() {
    int N , W;
    cin >> N >> W;
    for(int i = 0; i < N; i++)
        cin >> w[i] >> v[i]; 
    for(int i = w[0]; i <= W; i++)
        dp[1][i] = v[0];
    for(int i = 2; i <= N; i++) {
        for(int j = 1; j <= W; j++) {
            if(j >= w[i - 1])
                dp[i][j] = max(dp[i - 1][j] , dp[i - 1][j - w[i - 1]] + v[i - 1]);
            else
                dp[i][j] = dp[i - 1][j];
        }
    }
    cout << dp[N][W];
    return 0;
}


Measured memory_bytes: 81660
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep_lr(i,l,r) for(int i=(l);i<(r);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<int, int, int> T;
constexpr int INF = INT_MAX >> 1;
constexpr ll LINF = 5000000000000000LL;
constexpr int MOD = 1000000007;

ll dp[110000];
bool fall[110000];

int main() {

	int n, m;
	cin >> n >> m;
	rep(i, m) {
		int a;
		cin >> a;
		fall[a] = true;
	}
	dp[0] = 1;
	rep(i, n + 1) {
		if (!fall[i + 1])dp[i + 1] += dp[i];
		if (!fall[i + 2])dp[i + 2] += dp[i];
		dp[i + 1] %= MOD;
		dp[i + 2] %= MOD;
	}
	cout << dp[n] << endl;
}

Measured memory_bytes: 1152
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#define mp make_pair
using namespace std;
int n,c,cnt[101010],ans;
pair<int,pair<int,int> >p[101010];
int main()
{
	cin>>n>>c;
	for(int i=0;i<n;i++)
	{
		int x,y,z;
		cin>>x>>y>>z;
		p[i].first=z;
		p[i].second.first=x;
		p[i].second.second=y;
	}
	sort(p,p+n);
	for(int i=0;i<n;i++)
	{
		int x,y,z;
		x=p[i].second.first;
		y=p[i].second.second;
		z=p[i].first;
		if(i<n-1 && p[i+1].first==z && p[i+1].second.first==y)
		{
			cnt[y]--;
			cnt[y+1]++;
		}
		cnt[x]++;
		cnt[y+1]--;
	}
	for(int i=1;i<=101000;i++)
	{
		cnt[i]+=cnt[i-1];
		ans=max(ans,cnt[i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
#define l long long
#define pb push_back
#define find(v,n) find(v.begin(),v.end(),n)
void frooty()
{
	float n;
	cin>>n;
	cout<<3.1415926*2*n<<"\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	l t=1;
	//cin>>t;
	while(t--)
	{
		frooty();
	}
}
		

Measured memory_bytes: 3740
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep1n(i,n) for(int i=1; i<=(n); ++i)
#define repxn(i,x,n) for(int i=x; i<=(n); ++i)
#define sort_u(x) sort((x).begin(),(x).end())
#define sort_d(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
#define INF 1001001001  // 浮動小数点型
#define INF_L 1001001001001001001  // 浮動小数点型
#define bit(n,m)(((n)>>(m))&1)  // nのmビット目が1
#define MOD 1000000007
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main() {
    ll n; cin >> n;
    vector<ll> a(n); rep(i, n) cin >> a[i];
    vector<ll> sum(n,0);
    sum[0] = a[0];
    rep(i,n){
        if(i == 0) continue;
        sum[i] = a[i] + sum[i-1];
    }
    ll ans = 0;
    for (ll i = 0; i < n-1; i++){
        ll s = (sum[n-1] - sum[i]) % MOD;
        ans += a[i] % MOD * s % MOD;
        ans %= MOD;
    }
    cout << ans << endl;       
}

/*
g++ c.cpp
./a.out
./problem.exe
oj d
oj t

debug:ctrl+shift+B problemin

*/


Measured memory_bytes: 6356
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<Integer> a = new ArrayList<>();
        IntStream.range(0, 3).forEach(i -> a.add(sc.nextInt()));
        Collections.sort(a);
        System.out.println(Math.abs(a.get(2) - a.get(1)) + Math.abs(a.get(1) - a.get(0)));
    }

}


Measured memory_bytes: 27348
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k;
    cin >> k;
    int a,b;
    cin >> a >> b;
    for(int i=a;i<=b;i++){
        if(i%k==0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>

using namespace std;

const int INF = 1000000000;

main(){
  int e;
  while(cin >> e && e){
    int m = INF;
    for(int z=0;z*z*z<=e;z++){
      for(int y=0;y*y<=e-z*z*z;y++){
        int x = e-z*z*z-y*y;
        m = min(m, x + y + z);
      }
    }
    cout << m << endl;
  }
  return 0;
}

Measured memory_bytes: 868
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

struct datatype{
	int city, year, citynum, num,bnum;
};

int compdata(const void*a, const void*b)
{
	return ((datatype*)a)->year - ((datatype*)b)->year;
}
int compdata2(const void*a, const void*b)
{
	return ((datatype*)a)->bnum - ((datatype*)b)->bnum;
}

int main()
{
	static int n, m, i,used[100010];
	static datatype data[100010];
	cin >> n >> m;
	for (i = 0; i < m; i++)
	{
		cin >> data[i].city >> data[i].year;
		data[i].bnum = i;
	}
	qsort(data, m, sizeof(datatype), compdata);
	for (i = 0; i < m; i++)
	{
		//printf("%d-%d\n", data[i].city, data[i].year);
	}
	for (i = 0; i < m; i++)
	{
		used[data[i].city]++;
		data[i].citynum = used[data[i].city];
		data[i].num = data[i].city * 1000000 + data[i].citynum;
	}
	qsort(data, m, sizeof(datatype), compdata2);
	for (i = 0; i < m; i++)
	{
		//printf("%d,%d,%d,num=%012d\n", data[i].city, data[i].year, data[i].citynum, data[i].num);
		printf("%06d%06d\n", data[i].city, data[i].citynum);
	}
}


Measured memory_bytes: 5976
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F(i,s,e) for(ll i=s;i<e;++i)

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

    int cnt=0;
    F(i,0,n){
        int d1,d2;
        cin >> d1 >> d2;
        if(d1==d2) ++cnt;
        else cnt=0;
        if(cnt==3){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3604
while True:
    N,X = map(int,input().split())
    if N == 0 and X == 0:
        break
    ans = 0
    for a in range(1,N+1):
        for b in range(1,N+1):
            if b <= a:
                continue
            c = X-(a+b)
            if c > b and c <= N:
                ans += 1
    print("%d"%(ans))


Measured memory_bytes: 5592
n = gets.to_i
m = Math.sqrt(n).to_i
arr = []

(1..m).each do |a|
  b = n / a
  arr << [a,b] if n == a*b
end


long = n.to_s.chars.length
arr.each do |x|
  long_x = x.max.to_s.chars.length
  long = long_x if long > long_x
end

puts long


Measured memory_bytes: 3836
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int r=0, c=0, x=0;
        int i, j, k, l, m, n;
        r=scan.nextInt();
        c=scan.nextInt();
        int[][] a=new int[r+1][c+1];
        
        for (i=0; i<r; i++) {
        for (j=0; j<c; j++) {
            x=scan.nextInt();
            a[i][j] = x;
            }
        }
        for (k=0; k<r; k++) {
        for (l=0; l<c; l++) {
            a[k][c] += a[k][l];
            }
        }
        for(m=0; m<=c; m++){ 
        for(n=0; n<r; n++){
            a[r][m] += a[n][m];
            }
        }
        for(i = 0; i <= r; i++){
			System.out.printf("%d", a[i][0]);
			for(j = 1; j <= c; j++){
				System.out.printf(" %d", a[i][j]);
			}
			System.out.printf("\n");
		}
    }
}


Measured memory_bytes: 53792
x,y=[int(i) for i in input().split()]
t=[1,-1]
ans=10**18
for i in range(0,2):
    for j in range(0,2):
        xx=x*t[i]
        yy=y*t[j]
        if xx<=yy:
            ans=min(ans,yy-xx+i+j)
print(ans)

Measured memory_bytes: 3060
// Problem : Maximal Value
// Contest : Virtual Judge - AtCoder
// URL : https://vjudge.net/problem/AtCoder-abc140_c
// Memory Limit : 1048 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")  // disable
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define lll __int128
#define lp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define vec(v, type, sz) vector<type> v(sz)
#define in(v) \
    for (auto &i : v) cin >> i
#define all(v) v.begin(), v.end()
#define prv(v)                         \
    for (auto i : v) cout << i << " "; \
    cout << "\n"
#define MOD 1000000007
#define INF 1000000000
#define INFL 1000000000000000000ll
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define vi vector<int>
#define vl vector<ll>
#define vii(v, n, m, val) vector<vector<int>> v(n, vector<int>(m, val))
#define viii(v, i, j, k, val)        \
    vector<vector<vector<int>>> v(i, \
                                  vector<vector<int>>(j, vector<int>(k, val)))
#define pii pair<int, int>
#define pb push_back
#define file_io                       \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define testc   \
    int tcc;    \
    cin >> tcc; \
    for (int tc = 1; tc <= tcc; tc++)
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while (!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
    cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if (idx > 0)
        cerr << ", ";
    else
        cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss;
    ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef DB
#define debug(...) \
    debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
//#define int ll

signed main() {
	fast_io;
	int n; cin>>n; vi v(n-1); in(v);
	ll sum=v[0]+v[n-2];
	lp(i,0,n-2) sum+=min(v[i],v[i+1]);
	cout<<sum;
}
// code!=think
// least efficient code to get ac


Measured memory_bytes: 3612
import java.util.*;
import java.lang.Math;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int inputNumLength = sc.nextInt();
        int[] x = new int[inputNumLength];
        int[] y = new int[inputNumLength];
        
        //入力
        for(int i = 0; i < inputNumLength; i++){
            x[i] = sc.nextInt();
        }
        for(int i = 0; i < inputNumLength; i++){
            y[i] = sc.nextInt();
        }
        
        MinkowskiLength ml = new MinkowskiLength(x, y);
        System.out.println(ml.manhattanLength());
        System.out.println(ml.euclidLength());
        System.out.println(ml.p3WhenLength());
        System.out.println(ml.chebyshevLength());
    }
}

class MinkowskiLength{
    int[] x;
    int[] y;
    //コンストラクタ
    public MinkowskiLength(int[] x, int[] y){
        this.x = x;
        this.y = y;
    }
    
    //マンハッタン距離
    public double manhattanLength(){
        double sum = 0;
        for(int i = 0; i < x.length; i++){
            sum += Math.abs(x[i] - y[i]);
        }
        return sum;
    }
    
    //ユークリッド距離
    public double euclidLength(){
        double sum = 0;
        for(int i = 0; i < x.length; i++){
            sum += Math.pow(Math.abs(x[i] - y[i]), 2);
        }
        return Math.sqrt(sum);
    }
    
    //P=3のとき
    public double p3WhenLength(){
        double sum = 0;
        for(int i = 0; i < x.length; i++){
            sum += Math.pow(Math.abs(x[i] - y[i]), 3);
        }
        return Math.cbrt(sum);
    }
    
    //チェビシェフ距離
    public double chebyshevLength(){
        double sum = 0;
        double max = 0;
        for(int i = 0; i < x.length; i++){
            max = Math.max(max, Math.abs(x[i] - y[i]));
        }
        return max;
    }
}


Measured memory_bytes: 26728
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC105_B solver = new ABC105_B();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC105_B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            String ans = "No";
            for (int i = 0; i <= 100; i++) {
                for (int j = 0; j <= 100; j++) {
                    if (4 * i + 7 * j == n) {
                        ans = "Yes";
                    }
                }
            }

            out.print(ans);

        }

    }
}



Measured memory_bytes: 23764
#include <cstdio>
#include <functional>
#include <vector>

#define int long long
#define dotimes(i, n) for (int i : range(n))

using namespace std;

class range {
  class iterator {
    int i, s;
  public:
    iterator(int i, int s): i(i), s(s) {}
    int& operator*() {
      return i;
    }
    void operator++() {
      i += s;
    }
    bool operator!=(iterator const& that) {
      return i < that.i;
    }
  };
  iterator b, e;
public:
  range(int e): b({0, 1}), e({e, 1}) {}
  range(int b, int e): b({b, 1}), e({e, 1}) {}
  range(int b, int e, int s): b({b, s}), e({e, s}) {}
  iterator begin() {
    return b;
  }
  iterator end() {
    return e;
  }
};

int rint() {
  int n;
  scanf("%lld", &n);
  return n;
}

void wint(int n) {
  printf("%lld\n", n);
}

template<typename T>
inline int size(T container) {
  return static_cast<int>(container.size());
}

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

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

signed main() {
  int n = rint();
  int m = rint();
  const int inf = 1 << 29;
  vector<vector<pair<int, int>>> edges(n), coedges(n);
  dotimes(i, m) {
    int s = rint();
    int t = rint();
    int d = rint();
    edges[s].emplace_back(t, d);
    coedges[t].emplace_back(s, d);
  }
  int r = inf;
  dotimes(u, n) {
    vector<vector<int>> dp(1 << n, vector<int>(n, -1));
    dotimes(t, n)
      if (t != u)
        dp[0][t] = inf;
    for (auto p : edges[u]) {
      int t = p.first, d = p.second;
      dp[0][t] = d;
    }
    function<int(int, int)> rec;
    rec =
      [&](int S, int t) {
        if (dp[S][t] >= 0)
          return dp[S][t];
        dp[S][t] = inf;
        for (auto p : coedges[t]) {
          int s = p.first, d = p.second;
          if (s != u && S & (1 << s))
            mins(dp[S][t], rec(S ^ (1 << s), s) + d);
        }
        return dp[S][t];
      };
    for (auto p : coedges[u]) {
      int t = p.first, d = p.second;
      mins(r, rec(((1 << n) - 1) ^ (1 << t) ^ (1 << u), t) + d);
    }
  }
  wint(r == inf ? -1 : r);
  return 0;
}



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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,m,x;
    cin >> n >> m >> x;
    vector<ll> c(n);
    vector<vector<ll>> a(n,vector<ll>(m));
    for(i = 0;i < n;++i){
        cin >> c.at(i);
        rep(j,m){
            cin >> a.at(i).at(j);
        }
    }
    ll ans = 1e9;
    for(ll bit = 1;bit < (1ll << n);++bit){
        vector<ll> rikai(m);
        ll tmp = 0;
        for(i = 0;i < n;++i){
            if(bit & (1ll << i)){
                tmp += c.at(i);
                rep(j,m){
                    rikai.at(j) += a.at(i).at(j);
                }
            }
        }
        bool flag = true;
        for(i = 0;i < m;++i){
            if(rikai.at(i) <  x){
                flag = false;
                break;
            }
        }
        if(flag) ans = min(ans,tmp);
    }
    if(ans == 1e9){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }
    return 0;
}

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


Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std;
int a[10005];
int main()
{
  int n;
  cin>>n;
  memset(a,0,sizeof(a));
for(int i=1;i<=100;i++)
    for(int j=1;j<=100;j++)
    for(int k=1;k<=100;k++)
{
    int c=(i+j)*(i+j)+(i+k)*(i+k)+(j+k)*(j+k);
    if(!(c&1)&&c<=20000)
        a[c/2]++;
}
for(int i=1;i<=n;i++)
    cout<<a[i]<<endl;
}


Measured memory_bytes: 3664