akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch PowerSocket | diff PowerSocket.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address PowerSocket.cpp && ./a.out

/*
 
 9/1/2019
 
 5:02-5:12 AC
 
 Add math solution later
 
 */

int A,B;

void solve() {
  int res=(B-1+A-2)/(A-1);
  cout<<res<<endl;
}

void solve_org() {
  int res=0;
  if(B==1) res=0;
  else if(B<=A) res=1;
  else {
    res=2; int x=2*A-1;
    while(B>x) {
      ++res;
      x+=A-1;
    }
  }
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>A>>B;
  solve();
  
  return 0;
}


Measured memory_bytes: 256
from collections import deque
reverse = -1
S = deque(input())
Q = int(input())
for _ in range(Q):
    Query = input().split()
    if Query[0] == "1":
        reverse *= -1
    else:
        if Query[1] == "1":
            if reverse == 1:
                S.append(Query[2])
            else:
                S.appendleft(Query[2])
        else:
            if reverse == 1:
                S.appendleft(Query[2])
            else:
                S.append(Query[2])

ans = "".join(S)
if reverse == 1:
    ans = ans[::-1]
print(ans)

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

using namespace std;

const int mod = 1e9 + 7;

using int64 = long long;
const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N, M;
  cin >> N >> M;
  vector< int > A(M), B(M), C(M);
  vector< int > dp(1 << N, inf);
  for(int i = 0; i < M; i++) {
    cin >> A[i] >> B[i];
    for(int j = 0; j < B[i]; j++) {
      int x;
      cin >> x;
      --x;
      C[i] |= 1 << x;
    }
    chmin(dp[C[i]], A[i]);
  }
  for(int i = 0; i < (1 << N); i++) {
    for(int j = 0; j < (1 << N); j++) {
      chmin(dp[i | j], dp[i] + dp[j]);
    }
  }
  if(dp.back() == inf) cout << -1 << endl;
  else cout << dp.back() << endl;
}



Measured memory_bytes: 256
#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 fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long 
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX 500003
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >
//#define endl "\n"
 
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
const int mod=1e9+7;
int power(int a,int b)
{
    int ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return ans;
}


int32_t main()
{
    fast;
    vi v;

    int val=1;

    while(1)
    {
    	int temp=val*(val+1);
    	temp/=2;
    	v.pb(temp);
    	val++;
    	if(temp>1e13) break;
    }

    int n;
    cin>>n;
    map<int,int> mpp;

    repa(i,2,sqrt(n))
    {
    	if(n%i) continue;
    	int cnt=0;
    	while(n%i==0)
    	{
    		cnt++;
    		n/=i;
    	}

    	mpp[i]=cnt;
    }
    if(n>1) mpp[n]=1;
    int ans=0;
    for(auto i:mpp)
    {
    	int cnt=i.ss;
    	val=upper_bound(all(v),cnt)-v.begin();
    	ans+=val;
    }
    cout<<ans<<endl;
}

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

int main(){
  int A,B,C; cin >> A >> B >> C;
  
  int mx = max({A,B,C});
  
  if(mx == A){
  	cout << 10*A+B + C << endl;
  }
  else if(mx == B){
    cout << 10*B + A+ C << endl;
  }
  else{
    cout << 10*C + A+ B<< endl;
  }
  return 0;
}
  

Measured memory_bytes: 256
x1, y1, x2, y2 = map(int, input().split())

a = x2 - x1
b = y2 - y1
x3 = x2 - b
y3 = y2 + a
x4 = x3 - a
y4 = y3 - b

print("{} {} {} {}".format(x3, y3, x4, y4))


Measured memory_bytes: 2940
/* Filename: CodeFestival2016Final_A.java
 * Author: Mushiyo
 */

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);

		while (input.hasNext()) {
			int H = input.nextInt();
			int W = input.nextInt();
			
			int row = 0;
			int col = 0;
			for(int i  = 0; i < H; ++i){
				for(int j = 0; j < W; ++j){
					String cell = input.next();
					
					if(cell.equals("snuke")){
						row = i + 1;
						col = j;
					}
				}
			}
			
			System.out.println(String.format("%c%d", col + 'A', row));
		}
	}

}


Measured memory_bytes: 10324
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():

    N = int(input())
    p = list(map(int, input().split()))

    count = 0
    l = []
    for i in range(N):
        if p[i] == i + 1:
            continue
        else:
            count += 1
            l.append((i + 1, p[i]))

    if count == 0:
        ans = 'YES'
    elif count == 2:
        if l[0][0] == l[1][1] and l[1][0] == l[0][1]:
            ans = 'YES'
        else:
            ans = 'NO'
    else:
        ans = 'NO'

    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin >> a >> b>>c>>d;
  if(a+b > c+d){
    cout << "Left" << endl;
  }
  else if (a+b < c+d){
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n, m, sz, G[705][705];
int col[705], cnt[705][2];
bool mrk[705], f[2][705];
bool DFS(int u) {
	mrk[u] = true, cnt[sz][0] += !col[u], cnt[sz][1] += col[u];
	for (int v = 1; v <= n; v++) if (G[u][v]) {
		if (mrk[v] && col[u] == col[v]) return false;
		if (!mrk[v]) {col[v] = col[u]^1; if (!DFS(v)) return false;}
	}
	return true;
}
int main() {
	read(n), read(m), memset(G, true, sizeof G);
	for (int i = 1; i <= n; i++) G[i][i] = false;
	for (int i = 1, u, v; i <= m; i++)
		read(u), read(v), G[u][v] = G[v][u] = false;
	for (int i = 1; i <= n; i++) if (!mrk[i])
		{sz++; if (!DFS(i)) return puts("-1"), 0;}
	f[0][0] = true;
	for (int i = 1, c = 1; i <= sz; i++, c ^= 1) {
		memset(f[c], false, sizeof f[c]);
		for (int j = 0; j <= n; j++)
			f[c][j+cnt[i][0]] |= f[c^1][j], 
			f[c][j+cnt[i][1]] |= f[c^1][j];
	}
	int mi = 0x3f3f3f3f;
	for (int i = 0; i <= n; i++) if (f[sz&1][i])
		mi = min(mi, i*(i-1)/2+(n-i)*(n-i-1)/2);
	return printf("%d\n", mi), 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG



int main() {
  unsigned long long N, K, tmp, ans1, ans2, ans;
  cin >> N >> K;
  //vector<ll> a(N);
  //vector<vector<int>> data(3, vector<int>(4));
  ans1 = N % K;
  ans2 = abs((long long)ans1 - (long long)K);
  if (ans1 < ans2) ans = ans1;
  else ans = ans2;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3588
#import sys
#input = sys.stdin.readline
def main():
    A, B, K = map( int, input().split())
    if A >= K:
        print(A-K, B)
        return
    K -= A
    if B >= K:
        print(0, B-K)
        return
    print(0, 0)
if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for (int i=0; i<(n); ++i)
#define rrep(i,n) for (int i=1; i<=(n); ++i)
#define drep(i,n) for (int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for (int i=s; i<t; ++i)ß
#define pi (acos(-1))
//#define pii pair<int,int>
//#define pll pair<ll,ll>
//#define vec vector
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int, int> P;
const int INF = 1001001001;
ll gcd (ll a, ll b) {
  return b ? gcd(b, a%b) : a;
}
ll lcm (ll a, ll b) {
  return a/gcd(a,b)*b;
}

int main(void) {
	int n;
	cin >> n;
	vector<string> s(n);
	rep(i,n) cin >> s[i];
	int ca = 0;
	int cw = 0;
	int ct = 0;
	int cr = 0;
	for (int i=0; i<n; i++){
		if (s[i]== "AC") ca++;
	  else if (s[i]=="WA") cw++;
	  else if (s[i]=="TLE") ct++;
	  else if (s[i]=="RE") cr++;
	}
	cout << "AC x " << ca << endl;
	cout << "WA x " << cw << endl;
	cout << "TLE x " << ct << endl;
	cout << "RE x " << cr << endl;
}









  






  



Measured memory_bytes: 6424
#include<iostream>
using namespace std;
int main(){
  long long i,n,dp[100];
  scanf("%lld\n",&n);
  dp[0]=2,dp[1]=1;
  for(i=2;i<=n;i++){
    dp[i]=dp[i-1]+dp[i-2];
  }
  printf("%lld\n",dp[n]);
  return 0;
}

Measured memory_bytes: 256
S = input()
p = 0
g = 0
a = 0

for s in S:
  if s=="p":
    if p+1<=g:
      a+=0
      p+=1
    else:
      a-=1
      g+=1
  else:
    if p+1<=g:
      a+=1
      p+=1
    else:
      a+=0
      g+=1

print(a)

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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    cout << (s == "abc" ? "Yes" : "No") << endl;
}


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

int main(){
  int n;cin>>n;
  int s[4]={};
  string si;
  rep(i,n){
    cin>>si;
    if(si=="AC")s[0]++;
    else if(si=="WA")s[1]++;
    else if(si=="TLE")s[2]++;
    else s[3]++;
  }
  cout<<"AC x "<<s[0]<<endl;
  cout<<"WA x "<<s[1]<<endl;
  cout<<"TLE x " <<s[2]<<endl;
  cout<<"RE x "<<s[3];
}

Measured memory_bytes: 3628
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("no-stack-protector")
//#pragma GCC target("popcnt")
//#pragma GCC target("sse4")
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rng(a) a.begin(),a.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define sz(a) (int)(a.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef long double ld;















signed main(){
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int flex = (h2 - h1) * 60;
    int kal = (m2 - m1) + flex;
    cout << kal - k << endl;




}


Measured memory_bytes: 3600
#define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl
#define DV(v) for (auto __macro_vi : v){ cout << __macro_vi << " ";} cout << endl;
#define DA(a, n) for (int __macro_i = 0; __macro_i < n; ++__macro_i) { cout << a[__macro_i] << " "; } cout << endl;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(), (v).end()
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
#include<algorithm>
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p){ os << "(" << p.first << ", " <<  p.second << ")"; return os; }

using namespace std;
using P = pair<int, int>;

void solve(long long N, std::vector<long long> A){
    vector<P> p;
    REP(i, N) {
        p.emplace_back(A[i], i + 1);
    }
    sort(p.begin(), p.end());
    REP(i, N - 1) {
        cout << p[i].second << " ";
    }
    cout << p[N - 1].second << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


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

using namespace std;

#define ll long long
#define vi  vector<int>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD 1e9 + 7
#define PAI  3.1415
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

ll gcd(ll a,ll b){
  if(a < b)swap(a , b);
  if(a % b == 0) return b;
  else gcd(b, a%b);
}

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a/gcd(a , b))*b;
}

struct UnionFind {
  vi par; //par[i] : iの親番号（例）par[3] = 2 : 3の親は2

  UnionFind(int N) : par(N) { //最初は全てが根として初期化
    rep(i,N) par[i] = i;
  }

  int root(int x){ //データxが属する木の根を再帰で得る : root(x) = {xの木の根}
    if(par[x] == x)return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y){ //xとyの木を併合
    int rx = root(x); //xの根をrx
    int ry = root(y); //yの根をry
    if(rx == ry)return; //xとyの根が同じ
    par[rx] = ry; //xとyの根が同じでない時、xの根rxをyの根にryにつける。
  }

  bool same(int x, int y){//2つのデータx，yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};


int main(){

  int A, B, K; cin >> A >> B >> K;

  vi ans;

  for(int i = 1; i <= min(A,B); i++)
  {
    if (A % i == 0 and B % i == 0){
      ans.pb(i);
    }
  }

pr(ans[ans.size() - K]);

 return 0;

}


Measured memory_bytes: 256
//Range Add Query
//reference https://kujira16.hateblo.jp/entry/2016/12/15/000000
//https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/2/DSL_2_E
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

template <typename T>
struct RAQ {
  T n;
  T k;//バケットの数
  T sqrt_n;//バケットの大きさ
  vector<T> data;
  vector<T> bucket_sum;

  RAQ() = delete;
  RAQ(T n_,T sqrt_n_ = 1000) {
    initialize(n_,sqrt_n_);
  }

  void initialize(T n_,T sqrt_n_ = 1000) {
    n = n_;

    sqrt_n = sqrt_n_;

    k = (n + sqrt_n - 1) / sqrt_n;//切り上げ割り算

    data.clear();bucket_sum.clear();

    data.resize(k * sqrt_n,0);
    bucket_sum.resize(k,0);
  }

  void add(T a,T b,T x) { //[a,b)(0-indexed)にx を加算
    if (a >= sqrt_n * k || b > sqrt_n * k) {
      cerr << "error index k" << endl;
      return;
    }
    if (a >= n || b > n) {
      cerr << "warning index k" << endl;
    }

    rep (i,k) {
      T l = i * sqrt_n,r = (i + 1) * sqrt_n;
      if (b <= l|| r <= a) continue;
      if (l < a || b < r) {
        for (int i = max(l,a);i < min(b,r);i++) {
          data[i] += x;
        }
      } else {
        bucket_sum[i] += x;
      }
    }
  }

  T get(T i) { // i番目(0-indexed)の値を取得する
    return data[i] + bucket_sum[i / sqrt_n];
  }
};

using ll = long long;

signed main() {
  ll n,q;
  cin >> n >> q;

  RAQ<ll> raq(n);

  rep(i,q) {
    ll c;
    cin >> c;
    if(c) {
      ll i;
      cin >> i;
      i--;
      cout << raq.get(i) << endl;
    } else {
      ll s,t,x;
      cin >> s >> t >> x;
      s--;t--;
      raq.add(s,t+1,x);
    }
  }
  return 0;
}



Measured memory_bytes: 3636
public class Main {
	public static void main(String[] args){
		java.util.Scanner scan = new java.util.Scanner(System.in);
		double a = scan.nextDouble();
		double b = scan.nextDouble();
		double c = scan.nextDouble();

		double S,L,h;

		S = a*b*Math.sin(Math.toRadians(c))/2;
		System.out.println(S);

		L = a+b+Math.sqrt(a*a+b*b-2*a*b*Math.cos(Math.toRadians(c)));
		System.out.println(L);

		h = 2*S/a;
		System.out.println(h);
	}

}

Measured memory_bytes: 27904
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	int n;
	while(cin>>n,n){
		int sum=0,a[5001],ans=-999999999;
		vector<int>anss(0);
		for(int i=0;i<n;i++)cin>>a[i];
		for(int i=0;i<n;i++){
			sum=0;
			for(int j=i;j<n;j++){
				sum+=a[j];
				ans=max(sum,ans);
				//anss.push_back(sum);
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1180
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
const ll MAX_N=1e6+10,INF=99999999;
ll n,a[MAX_N],s[MAX_N],from[MAX_N],to[MAX_N],w[MAX_N];
vector<int> adj[MAX_N];
void dfs(int v,int p){
    for(int k:adj[v]){
        int u=from[k]^to[k]^v;
        if(u!=p){
            dfs(u,v);
            if(adj[u].size()==1){
                w[k]=a[u];
            }
            else{
                w[k]=(2*a[u])-s[u];
            }
            if(w[k]<0){
                cout<<"NO";
                exit(0);
            }
            s[v]+=w[k];
        }
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n-1;i++){
        cin>>from[i]>>to[i];
        adj[from[i]].pb(i);
        adj[to[i]].pb(i);
    }
    dfs(1,0);
    ll sum=0;
    for(int u:adj[1]){
        sum+=w[u];
    }
    if(adj[1].size()>1 && 2*a[1]!=sum){
        cout<<"NO";
        return 0;
    }
    if(adj[1].size()==1 && a[1]!=sum){
        cout<<"NO";
        return 0;
    }
    for(int i=1;i<=n;i++){
        ll mx=-INF,sum=0;
        for(int u:adj[i]){
            mx=max(mx,w[u]);
            sum+=w[u];
        }
        if(2*mx>sum && adj[i].size()>1){
            cout<<"NO";
            return 0;
        }
    }
    cout<<"YES";
}


Measured memory_bytes: 46976
n,m=[int(i) for i in input().split()]

students=[]
for i in range(n):
    students.append([int(i) for i in input().split()])

check=[]
for i in range(m):
    check.append([int(i) for i in input().split()])
ans=[]
for i in students:
    x,y=i
    move=None
    minhat=1000000000
    for j in  range(m):
        x2,y2=check[j]
        manhat=abs(x-x2)+abs(y-y2)
        if manhat<minhat:
            minhat=manhat
            move=j
    ans.append(move+1)
for i in range(len(ans)):
    print(ans[i])
            

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

int N, M;
int x[101], y[101];
int X, Y;

int main()
{
    cin >> N >> M >> X >> Y;
    for(int i =0; i<N; i++)
        cin >> x[i];
    for(int i =0; i< M; i++)
        cin >> y[i];

    int max_x = -100;
    int min_y = 100;
    for(int i =0; i <N; i++)
        if( x[i] > max_x)
            max_x = x[i];

    for(int i =0; i<M; i++)
        if( y[i] < min_y )
            min_y = y[i];

    if(max_x >= min_y){
        cout << "War\n";
        return 0;
    }
    bool can = false;
    for(int i = max_x+1 ; i<=min_y; i++){
        if( X <i && i <= Y){
            can = true;
            break;
        }
    }
    if(can)
        cout << "No War\n";
    else
        cout << "War\n";
}




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

int main() {
  int64_t H, W;
  cin >>H >>W;
  int64_t cnt =0;
  if(H == 1 || W ==1){
    cnt = 1;
  }
  else if(H%2 == 1 && W%2 ==1) {
    cnt = (H*W)/2+1;
  }else{
    cnt = (H*W)/2;
  }

  cout << cnt << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
#include <math.h>
using namespace std;
int main(){
    long long int n,ans=0;
    cin>>n;
    vector<long long int>a(1000000);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end(),greater<>());
    for(int i=0;i<n-1;i++){
        ans+=a[(i+1)/2];
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 11156
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

// union find with count
struct union_find {
  std::vector<int> data, rank;

  explicit union_find(int n): data(n, -1), rank(n,0) {}

  int find(int x) {
    if(data[x] < 0) return x;
    return data[x] = find(data[x]);
  }

  void unite(int x, int y) {
    x = find(x); y = find(y);
    if(x == y) return;
    if(rank[x] > rank[y]) std::swap(x, y);
    data[y] += data[x];
    data[x] = y;
    if(rank[x] == rank[y]) ++rank[y];
  }

  int count(int x){ return -data[find(x)]; }
};

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int N, M; std::cin >> N >> M;
  union_find uf(N);
  for(int i = 0; i < M; ++i) {
    int X, Y, Z; std::cin >> X >> Y >> Z; --X; --Y; //no need to check consistency
    uf.unite(X, Y);
  }
  std::set<int> s;
  for(int i = 0; i < N; ++i) s.insert(uf.find(i));
  fin(s.size());
  return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int x;
    cin >> x;
    x %= 10;
    map <int, string> c;
    c[0] = "pon";
    c[1] = "pon";
    c[2] ="hon";
    c[3] = "bon";
    c[4] = "hon";
    c[5] = "hon";
    c[6] = "pon";
    c[7] = "hon";
    c[8] = "pon";
    c[9] = "hon";
    cout<< c[x] << '\n';
    return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN = 1e5 + 4;
ll x;
set<ll> tr;
map<ll , ll> mert;
int main(){
    tr.clear();
    mert.clear();
    cin>>x;
    for(ll i=-2000;i<=2000;i++){
        ll v=i*i*i*i*i;
        tr.insert(i*i*i*i*i);
        mert[v]=i;
    }
    for(ll v:tr){
        auto it = tr.find(v - x);
        if(it != tr.end()){
            cout << mert[v] << " " << mert[*it] << endl;
            return 0;
        }
    }
    return 0;
}


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

using namespace std;
typedef long long int ll;

int main()
{
    int n,m;
    cin >> n >> m;
    vector<vector<int>>v(m);
    vector<int>k(m);
    vector<int>p(m);
    for(int i = 0; i < m; i++)
    {
        cin >> k[i];
        v[i].resize(k[i]);
        for(int j = 0; j < k[i]; j++)
        {
            cin >> v[i][j];
            v[i][j]--;
        }
        sort(v[i].begin(),v[i].end());
    }
    for(int i = 0; i < m; i++)
    {
        cin >> p[i];
    }
    vector<bool>f;
    int result = 0;
    for(int bit = 0; bit <(1<<n); bit++)
    {
        bool val = true;
        f.assign(n,false);
        for(int i = 0; i < n; i++)
        {
            if(bit&(1<<i))
            {
                f[i] = true;
            }
        }
        for(int i = 0; i < m; i++)
        {
            int count = 0;
            for(auto x: v[i])
            {
                if(f[x])
                {
                    count++;
                }
            }
            if(count % 2 != p[i])
            {
                val = false;
                break;
            }
        }
        if(val)
        {
            result++;
        }
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    int N, M;
    cin >> N >> M;
    for(int i=0; i<M; i++){
        int a;
        cin >> a;
        N-=a;
    }
    if(N<0){
        cout << -1 << endl;
    }else{
        cout << N << endl;
    }
}

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

int main()
{
  int a;
  int b;
  char c;
  do 
  {
    cin >> a >> c >> b;
    //cout << a << c << b << endl;
    if(c == '+')
    {
      cout << a + b << endl;
    }else if(c == '-')
    {
      cout << a - b << endl;
    }else if(c == '*')
    {
      cout << a * b << endl;
    }else if(c == '/')
    {
      cout << a / b << endl;
    }
  }while(c != '?');
  

}


Measured memory_bytes: 3096
using System;

namespace ABC089_B_Hina_Arare
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			string[] arareColor = Console.ReadLine().Split(' ');

			for (int i = 0; i < n; i++) {
				if (arareColor[i] == "Y")
				{
					Console.WriteLine("Four");
					return;
				}
			}
			Console.WriteLine("Three");
		}
	}
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  ll n,k;
  cin >> n >> k;
  ll a[n];
  for(int i=0;i<n;i++)cin >> a[i];
  sort(a,a+n);
  
  ll s=0;
  for(int i=0;i<k;i++)s+=a[i];

  cout << s << endl;

}

Measured memory_bytes: 3624
import sys

AB = list(map(int, input().split()))

if AB[1] == 1:
    print(0)
    sys.exit(0)

b = AB[1] - AB[0]

if b <= 0:
    print(1)
    sys.exit(0)

c = b // (AB[0]-1)

if b % (AB[0]-1) != 0:
    print(c+2)
else:
    print(c+1)




Measured memory_bytes: 3060
#include <stdio.h>

int main(void)
{
	int n,k,ans_A,ans_B;
	int ans=1;
	
	scanf("%d%d",&n,&k);
	
	for(int i=1;i<=n;i++){
		
		ans_A=ans*2;
		ans_B=ans+k;
		
		if(ans_A>=ans_B){
			ans=ans_B;
		}else{
			ans=ans_A;
		}
	}
	
	printf("%d\n",ans);
	
	return 0;
}

Measured memory_bytes: 128
'use strict'
function Main(hoge){
  var input=hoge.trim();
  input=input.split(/\n/);
  var firstLine=input.shift().trim().split(' ');
  var A=firstLine[0]-0;
  var B=firstLine[1]-0;
  var Q=firstLine[2]-0;
  for(let i=0;i<input.length;i++)
    input[i]=input[i]-0;
  var s=input.splice(0,A);
  var t=input.splice(0,B);
  var x=input;
  var y=binarySort(x);
  var s_before=[];
  var s_after=[];
  var t_before=[];
  var t_after=[];
  var p=0,q=0;
  for(let i=0;i<Q;i++){
    while(s[p]<y[i][0])
      p++;
    s_before[i]=(s[p-1]||-1e14);
    s_after[i]=(s[p]||1e14);
    while(t[q]<y[i][0])
      q++;
    t_before[i]=(t[q-1]||-1e15);
    t_after[i]=(t[q]||1e15);
  }
//  console.log(s_before,s_after);
  var ans=[];
  for(let i=0;i<Q;i++){
    let j=y[i][1];
    let Y=y[i][0];
    let sb=s_before[i],sa=s_after[i],tb=t_before[i],ta=t_after[i]; 
    let abs=Math.abs;
    ans[j]=Math.min(
      abs(sa-Y)+abs(ta-sa),
      abs(sa-Y)+abs(tb-sa),
      abs(sb-Y)+abs(ta-sb),
      abs(sb-Y)+abs(tb-sb),
      abs(ta-Y)+abs(sa-ta),
      abs(ta-Y)+abs(sb-ta),
      abs(tb-Y)+abs(sa-tb),
      abs(tb-Y)+abs(sb-tb)
    );
  }
  return (ans.join('\n'));
}

function binarySort(A){ 
  var a=A.length;
  var B=[[A[0],0]];
  for(let i=1;i<a;i++){
    let u=B.length-1;
    let d=0;
    let m=Math.floor((d+u)/2);
    while(!(d>u)){
      if(B[m][0]<A[i]){
        d=m+1;
      }else{
        u=m-1;
      }
      m=Math.floor((d+u)/2);
    }
    B.splice(m+1,0,[A[i],i]);
  }
  return B;
}

var myAns=Main(require('fs').readFileSync('/dev/stdin','utf8'));
console.log(myAns);

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

int main(){
  string s;
  cin>>s;
  int n=s.size()-1;
  if(n%2!=0) n--;
  while(n>0){
	if(s.substr(0,n/2)==s.substr(n/2,n/2)){
      cout<<n<<endl;
      return 0;
    }else {
	  n-=2;
    }
  }
}


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

int main() {
	std::string S;
	std::cin >> S;

	int numRed = 0;
	int numBlue = 0;
	for(const auto &c : S) {
		if(c == '0') {
			numRed++;
		} else if(c == '1') {
			numBlue++;
		}
	}

	const int result = S.length() - std::abs(numRed - numBlue);

	std::cout << result << std::endl;

	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int ans=0;
  for(int i=1;i<n+1;i+=2){
    int count =0;
    for(int j=1;j<i+1;j++){
      if(i%j==0){
        count++;
      }
    }
    if(count == 8){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000001145
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};

int ans=0;
int k,n;
string s;
signed main(){
	
	cin>>n>>s;
	set<int> v[11];
	rep(i,n){
		v[s[i]-'0'].insert(i);
	}
	rep(i,1000){
		int ok=1;
		string t=to_string(i);
		if(t.size()==1)t="00"+t;
		if(t.size()==2)t="0"+t;
		//cout<<t<<endl;
		if(v[t[0]-'0'].size()){
			auto itr=v[t[0]-'0'].begin();
			auto itr2=v[t[1]-'0'].upper_bound(*itr);
			if(itr2==v[t[1]-'0'].end())ok=0;
			else{
				auto itr3=v[t[2]-'0'].upper_bound(*itr2);
				if(itr3==v[t[2]-'0'].end())ok=0;
			}
		}
		else ok=0;
		
		
		if(ok){
			ans++;
		//	cout<<t<<endl;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1664
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

string ntos(long long n){
  string s;
  stringstream ss;
  ss << n;
  ss >> s;
  return s;
}

int main(){
  ll n;
  cin>>n;
  ll ans = 0;
  rep(i,1,n+1){
  	string s;
  	s = ntos(i);
  	if(s.sz%2==1)ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

void dfs( int pos, LL now_cost );

vector< LP > tree[SIZE];
LL cost[SIZE];

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

    int n;
    cin >> n;
    for( int i = 0; i <= n; ++i ) cost[i] = LINF;

    for( int i = 0; i < n - 1; ++i ) {
        LL a, b, c;
        cin >> a >> b >> c;
        tree[a].pb( MP( b, c ) );
        tree[b].pb( MP( a, c ) );

    }

    int q, k;
    cin >> q >> k;

    dfs( k, 0 );
    for( int i = 0; i < q; ++i ) {
        int x, y;
        cin >> x >> y;
        cout << cost[x] + cost[y] << endl;

    }

    return 0;
}

void dfs( int pos, LL now_cost ) {
    if( now_cost >= cost[pos] ) {
        return;

    }

    cost[pos] = now_cost;

    for( int i = 0; i < tree[pos].size(); ++i ) {
        dfs( tree[pos][i].F, now_cost + tree[pos][i].S );
    
    }
    return;
}


Measured memory_bytes: 14336
using System;

namespace abc158C
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int Ans = -1;
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            for(int N = 1; (N <= 1009 && Ans == -1); N++)
            {
                if (Math.Floor(N * 0.08) == A && Math.Floor(N * 0.10) == B)
                    Ans = N;
            }
            Console.WriteLine(Ans);
        }
    }
}


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

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int x,t;
    cin>>x>>t;
    cout << max(0,x-t) <<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1 << 25;

struct edge {
	int to, time;
} es[200000];

int a[200000];
int b[200000];
int t[200000];

struct S {
	int v, d, time;
	bool operator <(const S& x) const {
		if(d != x.d) return d > x.d;
		return time < x.time;
	}
};

typedef pair<int, int> P; // dist, time
P dist[100000];
vector<edge> G[100000];
int ng[200000];

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

	int N, M, Q;
	cin >> N >> M >> Q;

	for(int i = 0; i < M; i++) {
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
		t[i] = INF;
	}

	for(int i = 0; i < Q; i++) {
		int r;
		cin >> r;
		r--;
		t[r] = i;
	}

	for(int i = 0; i < M; i++) {
		G[a[i]].push_back({ b[i], t[i] });
		G[b[i]].push_back({ a[i], t[i] });
	}

	fill(dist, dist + N, P{ INF, 0 });
	dist[0] = { 0, INF };

	priority_queue<S> q;
	q.push({ 0, 0, INF });

	while(q.size()) {
		S s = q.top();
		q.pop();
		if(dist[s.v] != P{ s.d, s.time }) continue;
		//cerr << "s.d : " << s.d << ", s.time : " << s.time << endl;

		for(auto e : G[s.v]) {
			P np = { s.d + 1, min(s.time, e.time) };
			if(dist[e.to].first > np.first || dist[e.to].first == np.first && dist[e.to].second < np.second) {
				dist[e.to] = np;
				q.push({ e.to, np.first, np.second });
			}
		}
	}

	for(int i = 0; i < N; i++) {
		int time = dist[i].second;
		if(time == INF) continue;
		ng[time]++;
	}

	int ans = 0;
	for(int i = 0; i < Q; i++) {
		ans += ng[i];
		cout << ans << endl;
	}
}

Measured memory_bytes: 15812
#include<stdio.h>
int main(void)
{
 int x,y;
 while(1){
  scanf("%d %d",&x,&y);
  if(x == 0 && y == 0){
   break;
  }
  if(x>y){
   printf("%d %d\n",y,x);
  }
  else if(x<=y){
   printf("%d %d\n",x,y);
  }
 }
 return 0;
}

Measured memory_bytes: 596
n = int(input())
i = 1
while n >= i:
    c3 = i
    if i % 3 == 0:
        print(" {}".format(i), end = "")
    else:
        while c3 != 0:
            if c3 % 10 == 3:
                print(" {}".format(i), end = "")
                break
            c3 = int(c3 / 10)
    i += 1
print("")



Measured memory_bytes: 5876
s = input()
ans = 0
for i in range(2**(len(s)-1)):
    bit = "{:010b}".format(i)[11-len(s):]
    formula = s[0]
    for j in range(len(bit)):
        if bit[j] == "1":
            formula += "+"
        formula += s[j+1]
    ans += eval(formula)
print(ans)


Measured memory_bytes: 3060
import heapq

n=int(input())
a=[-int(x) for x in input().split()]

a.sort()
ans=0
b=[]
heapq.heapify(b)

if n==2:
    ans-=a[0]
else:
    ans-=sum(a[:2])
    #間優先配列をつくる
    heapq.heappush(b,a[1])
    for i in range(2,n-1):
        #取る
        ans-=heapq.heappop(b)
        #増やす
        heapq.heappush(b,a[i])
        heapq.heappush(b,a[i])

print(ans)


Measured memory_bytes: 31836
#include<iostream>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<algorithm>

using namespace std;
const int maxn = 200000+5;
int n,f[maxn],g[maxn];
char S[maxn];

int main(){
	int i,j;
	scanf("%s",S+1);
	n = strlen(S+1);
	for(i=2;i<=n;i++)
		f[i] = S[i] == S[i-1] ? f[i-1]:f[i-1]+1;
	for(i=n-1;i>0;i--)
		g[i] = S[i] == S[i+1] ? g[i+1]:g[i+1]+1;
	int ans = 0x3f3f3f3f;
	for(i=1;i<=n;i++)
		ans = min(f[i]+g[i],ans);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1152
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? (-(a)) : (a))

typedef long long ll;

using namespace std;

const ll mod = 1e9 + 7;

ll get_pow(ll num, ll pow)
{
	ll ret = 1LL;
	while (pow)
	{
		if (pow & 1) ret = (ret * num) % mod;
		num = (num * num) % mod;
		pow /= 2;
	}
	return ret;
}

ll memo[100000 + 5];
ll N, K;

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

	scanf("%lld %lld", &N, &K);

	ll ans = 0LL;

	for (ll i = K; i >= 1; --i)
	{
		ll q = K / i;
		ll temp = get_pow(q, N);

		for (ll j = 2; i * j <= K; ++j) temp = (temp - memo[i * j] + mod) % mod;
		ans = (ans + (i * temp) % mod) % mod;
		memo[i] = temp;
	}

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

	return 0;
}

Measured memory_bytes: 4564
import java.util.*;

public class Main{
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int [] d = new int [n];
        for(int i = 0; i < m; i++){
            int x = sc.nextInt() - 1;
            int y = sc.nextInt() - 1;
            d[x]++; d[y]++;
        }
        if(allEven(n,d)) {
            System.out.println("YES");
        } else{
            System.out.println("NO");
        }
        return;
    }

    public static boolean allEven(int n,int [] d){
        for(int i = 0; i < n; i++){
            if ((d [i] & 1) == 1) return false;
        }
        return true;
    }
}


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

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

  for (int i = 0; i < n; i++) {
      cin >> c;
      if (c == "Y") {
          cout << "Four" << endl;
          break;
      }
      else if (i == n - 1) cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=long long int;

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

    set<int> oc;
    int a = s;
    int ans = 1;
    while (oc.count(a) == 0) {
        oc.insert(a);
        if (a % 2 == 0) a /= 2;
        else a = 3 * a + 1;
        ++ans;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
using namespace std;

int syc(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	
	int x;
	cin >> x;
	syc(x,1,100);
	int a[x];
	int temp;
	
	for(int i=0;i<x;i++){
		cin >> a[i];
		syc(a[i],0,1000);
	}
	
	for(int i=1;i<x;i++){
		for(int p=0;p<x;p++){
			cout << a[p];
			if(p<x-1)cout << " ";
		}
		cout << endl;
		for(int j=0;j<i;j++){
			if(a[j]>a[i]){
				temp=a[i];
				for(int k=i;k>j;k--){
					a[k]=a[k-1];
				}
				a[j]=temp;
			}
		}
	}
	for(int p=0;p<x;p++){
			cout << a[p];
			if(p<x-1)cout << " ";
	}
	cout << endl;
	
	return 0;
}



Measured memory_bytes: 3088
n, m = map(int, input().split())
penalty_num = [0 for i in range(n)]
acc = 0
ac_flag = [False for i in range(n)]

for i in range(m):
    p, s = input().split()
    q_num = int(p) - 1
    # WA
    if s == 'WA':
        if ac_flag[q_num]:
            continue
        else:
            penalty_num[q_num] += 1
    # AC
    else:
        if ac_flag[q_num]:
            continue
        else:
            ac_flag[q_num] = True
            acc += 1
penalty = 0
for n, flag in zip(penalty_num, ac_flag):
    if flag:
        penalty += n
print('{} {}'.format(acc, penalty))

Measured memory_bytes: 50992
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 04/05/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

struct bit {
 vector<ll> vec;
 bit(size_t size) : vec(size+1) {}
 void set(size_t index, ll val) {
   auto i = index+1;
   while (i < vec.size()) {
     vec[i] = max(vec[i], val);
     i += i&(-i);
   }
 }
 ll get(size_t index) const {
   auto i = index+1;
   ll res = vec[i];
   i -= i&(-i);
   while (i > 0) {
     res = max(res, vec[i]);
     i -= i&(-i);
   }
   return res;
 }
};

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

  int n; cin>>n;
  bit dp(n+1);
  vector<int> H(n); for (auto& h:H) cin>>h;
  vector<ll> A(n); for (auto& a:A) cin>>a;
  for (int i = 0; i < n; i++) {
    dp.set(H[i], dp.get(H[i]) + A[i]);
  }
  cout << dp.get(n) << endl;

  return 0;
}


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

#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
using namespace std;

int main(){
	int n, k;	cin >> n >> k;
	int p[n];
	for( int i = 0; i < n; i++ ){
		cin >> p[i];
	}
	int sum = 0;

	sort( p, p + n );

	for( int i = 0; i < k; i++ ){
		sum += p[i];
	}

	cout << sum << endl;

	return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1};
const int dx[] = {-1,0,1};
const int dz[] = {-1,0,1};

inline bool value(int x){
  return (x >= 0 && x < 5);
}
vector<int> a,b;
array<array<array<int,5>,5>,5> ca;
int check(int x,int y,int z,int f){
  int al = 0;
  rep(i,3){
    rep(j,3){
      rep(k,3){
        int cx = x + dx[k],cy = y + dy[j],cz = z+dz[i];
        if(value(cx) && value(cy) && value(cz)){
          al += ca[cx][cy][cz];
        }
      }
    }
  }
  al -= f;
  if(f == 0){
    rep(i,a.size()){
      if(al == a[i]){
        return 1;
      }
    }
    return 0;
  }
  else{
    rep(i,b.size()){
      if(al == b[i]){
        return 1;
      }
    }
    return 0;
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,cnt = 1;
  while(cin >> n && n){
    if(cnt != 1){
      cout << endl;
    }
    char c;
    rep(z,5){
      rep(y,5){
        rep(x,5){
          cin >> c;
          ca[x][y][z] = c - '0';
        }
      }
    }
    ll m1,m2,k;
    cin >> m1;
    a.clear();
    rep(j,m1){
      cin >> k;
      a.push_back(k);
    }
    cin >> m2;
    b.clear();
    rep(j,m2){
      cin >> k;
      b.push_back(k);
    }
    rep(l,n){
      array<array<array<int,5>,5>,5> c2;
      rep(z,5){
        rep(y,5){
          rep(x,5){
            c2[x][y][z] = check(x,y,z,ca[x][y][z]);
          }
        }
      }
      ca = c2;
    }
    cout << "Case " << cnt << ":" << endl;
    rep(z,5){
      rep(y,5){
        rep(x,5){
          cout << ca[x][y][z];
        }
        cout << endl;
      }
      if(z != 4)
      cout << endl;
    }
    ++cnt;
  }
  return 0;
}

Measured memory_bytes: 3232