akhauriyash/Code-Regression huggingface dataset:
def trainticket(a):
    op = ['+','-']
    for i in op:
        for p in op:
            for o in op:
                f = a[0] + i + a[1] + p + a[2] + o + a[3]
                if eval(f) == 7:
                    return f + '=7'
A = input()
print(trainticket(A))

Measured memory_bytes: 3064
using namespace std;

#define PERSONS 3

int main(void){
	for( int i = 0; i < PERSONS; i++ ){
		int sec, h, m, s, eh, em, es;
		cin >> h >> m >> s >> eh >> em >> es;
		sec = (eh * 3600 + em * 60 + es) - (h * 3600 + m * 60 + s);
		cout << sec / 3600 << ' ';
		sec -= (sec / 3600) * 3600;
		cout << sec / 60 << ' ';
		sec -= (sec / 60) * 60;
		cout << sec << endl;
	}

	return 0;
}

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

long min(long a, long b) {
    return a < b ? a : b;
}

int main() {
    long q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;
    
    q *= 4;
    h *= 2;
    s = min(min(q, h), s);
    
    if (2 * s <= d) {
        cout << n * s << endl;
    } else {
        cout << n / 2 * d + n % 2 * s << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(); 
        int b = sc.nextInt();

        if(a<b){
            System.out.println("a < b");
        }else if(a>b){
            System.out.println("a > b");
        }else{
            System.out.println("a == b");
        }

        }
}



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

int main() {
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  if(a!=1)
  cout << 1 << endl;
  if(b!=2)
  cout << 2 << endl;
  if(c!=3)
  cout << 3 << endl;
  if(d!=4)
  cout << 4 << endl;
  if(e!=5)
  cout << 5 << endl;
}


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


class Program
{
    static void Main(string[] args)
    {
        int[] AB = Console.ReadLine().Split().Select(int.Parse).ToArray();
        string answer;
        if (AB[0] + AB[1] < 10) answer = (AB[0] + AB[1]).ToString();
        else { answer = "error"; }
        Console.WriteLine(answer);
    }
}

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

int main(void) {
    int x, a, b;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> x >> a >> b;
    cout << (abs(x - a) < abs(x - b)? "A" : "B") << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	int time = sc.nextInt();
      	int c = (int)(time/a)*b;
      	System.out.println(c);
    }
}
      	

Measured memory_bytes: 23764
/*************************************************************************
    > File Name: CC.cpp
    > Author: HandsomeHow
    > Mail: handsomehowyxh@gmail.com 
    > Created Time: 2017/7/11 14:08:03
 ************************************************************************/

#include <bits/stdc++.h>
using namespace std;

#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define cl(a) memset((a),0,sizeof(a))
#ifdef HandsomeHow
#define dbg(x) cerr << #x << " = " << x << endl
#else
#define dbg(x)
#endif
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
const int inf=0x3f3f3f3f;
const double eps=1e-8;
const int mod=1000000007;
const double pi=acos(-1.0);
inline void gn(long long&x){
    int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-');c=='-'?(sg=-1,x=0):(x=c-'0');
    while((c=getchar())>='0'&&c<='9')x=x*10+c-'0';x*=sg;}
inline void gn(int&x){long long t;gn(t);x=t;}
inline void gn(unsigned long long&x){long long t;gn(t);x=t;}
ll gcd(ll a,ll b){return a? gcd(b%a,a):b;}
ll powmod(ll a,ll x,ll mod){ll t=1ll;while(x){if(x&1)t=t*a%mod;a=a*a%mod;x>>=1;}return t;}
// (づ°ω°)づe★------------------------------------------------
const int maxn = 2e5+5;
int up[maxn],down[maxn];
pii p[maxn];
int main(){
#ifdef HandsomeHow
    //freopen("data.in","r",stdin);
    //freopen("data.out","w",stdout);
#endif
    int n,m;
    gn(n);gn(m);
    //rep(i,1,n)up[i]=down[i]=1;
    rep(i,1,m){ gn(p[i].first);gn(p[i].second); }
    sort(p+1,p+1+m);
    rep(i,1,m){
        down[p[i].second] = down[p[i].second+1] + 1; 
        up[p[i].second+1] = up[p[i].second] + 1;
    }
    rep(i,1,n){
        if(i>1)putchar(' ');
        printf("%d",up[i]+down[i]+1);
    }
    puts("");
    return 0;
}

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

bool is_low(char c){
    if('a' <= c && c <= 'z') return true;
    else return false;
}

int main(void){
    string S; cin >> S;
    if(S[0] == 'A' && is_low(S[1]) && is_low(S[S.length()-1])){
        int cnt_c = 0;
        for(int i = 2; i < S.length()-1; i++){
            if(S[i] == 'C') cnt_c++;
            else if(!is_low(S[i])) cnt_c -= 100;
        }
        if(cnt_c <= 0 || cnt_c > 1) cout << "WA" << endl;
        else cout << "AC" << endl;
    }
    else cout << "WA" << endl;
    return 0;
}

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

int main() {
  int K, S, ans=0;
  cin >> K >> S;

  for(int z = 0; z <= K; z++) {
    for(int y = 0; y <= K; y++) {
      int x = S - y - z;
      if( 0 <= x && x <= K ) ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


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

#define MAX 1000000000000000000
#define MIN -1000000000000000000

int main() {
    long a, b, c, k;
    scanf("%ld %ld %ld %ld", &a, &b, &c, &k);
    if (a - b < MIN || MAX < a - b) {
        printf("Unfair\n");
    } else if (k % 2 == 0) {
        printf("%ld\n", a - b);
    } else {
        printf("%ld\n", b - a);
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll a,b,c; cin>>a>>b>>c;
	ll x=c-(a+b);
	if(x<0) {
		cout<<"No\n";
		return 0;
	}
	cout<<((4*a*b<x*x)?"Yes":"No")<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
#define SZ(v) int((v).size())
#define ALL(vec) (vec).begin(),(vec).end()
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string>) {}
template<typename T1,typename T2> ostream& operator<<(ostream& os, pair<T1,T2> buf) {
  return os << "(" << buf.first << ": " << buf.second << ")"; }
#define DefOut(Con) template<typename T>ostream&operator<<(ostream&os,Con<T>&A){ bool f = false; os << "{"; \
  for (const auto e: A) { if (f) os << ", "; os << e; f = true; } return os << "}"; }
#define DefOut2(Con) template<typename K,typename V>ostream&operator<<(ostream&os,Con<K,V>&A) \
{ bool f = false; os << "{"; for (auto &e: A) { if (f) os << ", "; os << e; f = true; } return os << "}"; }
template<typename T>ostream &operator << (ostream &os,vector<vector<T>>& A) {
  for (auto &B: A) os << '\n' << B; return os; }
DefOut(vector) DefOut(set) DefOut(multiset) DefOut2(map) 
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << a << endl; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1000000007;
long long const INF = 1e18;
#define PI 3.14159265358979323846
/***********************************************************************/

int32_t main() {

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

  int w, h, x, y;
  cin >> w >> h >> x >> y;
  cout.precision(10);
  cout << fixed << ((double) 0.5 * w * h) << " ";
  cout << (2 * x == w && 2 * y == h ? "1" : "0"); 
  
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N, K = map(int, input().split())
S = input()

# N, Kがそれぞれ10^5以下なので、O(NK)は不可能
# 1の連続Bit数を最大化する
# K回の操作で、ある区間におけるK個の00を11に変えることに相当。
# (001100を110011にして、111111にするのも結局2回要している)

# 00,11のグループで再カウント、[(start, end, True/False)]: Trueなら1
start = 0
l = []
for i in range(1,N):
    if S[i-1] == S[i]:
        continue
    else:
        v = True if S[i-1] == "1" else False
        l.append((start, i, v))
        start = i
v = True if S[-1] == "1" else False
l.append((start, N, v))

mx = 0
L = len(l)
for i, val in enumerate(l):
    start, end, v = val
    if v is True:   # "1"
        # 1 0 1 0 1として、1+2Kのグループを1にできる
        idx = min(i+2*K, L-1)
    else:   # "0"
        # 0 1 0 1として、2Kのグループを1にできる
        idx = min(i+2*K-1, L-1)
    ln = l[idx][1] - start
    if ln > mx:
        mx = ln

print(mx)


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

typedef long long llong;

void solve() {
  llong N, K;
  string s;
  cin >> N >> K >> s;

  vector<llong> ii = {1};

  for(int i = 1; i < N; ++i) {
    if(s[i]!=s[i-1]) { ii.push_back(i+1); }
  }

  llong lmax = 0, r = ii.size(), t;
  for(int k = 0; k < r; ++k) {
    lmax = max(lmax, (s[ii[k]-1]=='0') ?
      (((k+1+2*K > r) ? N+1 : ii[k+2*K]) - ii[k]) :
      (((k+1+2*K+1 > r) ? N+1 : ii[k+2*K+1]) - ii[k]));
  }

  cout << lmax;

}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  solve();
  return 0;
}

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

int main(){
      int n,m,x,y;cin >> n >> m >> x >> y;
      int arrn[n + 10];for(int i = 0;i < n;i++)cin >> arrn[i];
      int arrm[m + 10];for(int i = 0;i < m;i++)cin >> arrm[i];
      sort(arrn, arrn + n);
      sort(arrm, arrm + m);
      if(arrm[0] > arrn[n - 1] && arrm[0] > x && arrm[0] <= y)cout << "No War";
      else cout << "War";
}

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

int main()
{
    int n;
    int r[200000];
    scanf("%d", &n);
    for (int i=0; i<n; i++) {
        scanf("%d", &r[i]);
    }
    
    int i=0, j=1;
    int ans=INT_MIN;
    while(j<n){
        ans = max(ans, r[j]-r[i]);
        if(r[j] < r[i]){
            i = j;
            j++;
        }else{
            j++;
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

class UnionFind {
  vector<int> par, rank;
public:
  UnionFind(int n) {
    par.resize(n);
    for (int i = 0; i < n; i++)
      par[i] = i;
    rank.resize(n, 0);
  }
  int root(int x) {
    if (par[x] == x)
      return x;
    return par[x] = root(par[x]);
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y)
      return false;
    if (rank[x] >= rank[y]) {
      par[y] = x;
      if (rank[x] == rank[y])
        rank[x]++;
    } else
      par[x] = y;
    return true;
  }
};

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> to(n);
  rep(i, n) rep(j, n) {
    char c;
    cin >> c;
    if (c == '1')
      to[i].push_back(j);
  }
  UnionFind uf(n*2);
  rep(i, n) for (auto j : to[i]) {
    uf.unite(i, j+n);
    uf.unite(i+n, j);
  }
  rep(i, n) {
    if (uf.same(i, i+n)) {
      cout << -1 << endl;
      return 0;
    }
  }
  int ans = 0;
  rep(i, n) {
    vector<int> dist(n, -1);
    queue<int> que;
    que.push(i);
    dist[i] = 0;
    while (!que.empty()) {
      int now = que.front();
      que.pop();
      chmax(ans, dist[now]+1);
      for (auto next : to[now]) {
        if (dist[next] >= 0)
          continue;
        dist[next] = dist[now]+1;
        que.push(next);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

int main()
{
	int n,ans=0,l,r;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> l >> r;
		ans += r - l + 1;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF=(1LL<<60);

struct item{
    ll w,v;
};

int main(void){
    int N,W; cin >> N >> W;
    ll dp[N+1][W+1];
    item items[N+1];

    for(int i=1; i<=N; i++){
        cin >> items[i].w >> items[i].v; 
    }

    for(int i=1; i<=W; i++){
        dp[1][i]= items[1].w<=i? items[1].v : 0;
    }
    for(int i=0; i<=N; i++){
        dp[i][0]=0;
    }
    for(int i=2; i<=N; i++){
        for(int j=1; j<=W; j++){
            if(j-items[i].w>=0) dp[i][j]=max(dp[i-1][j], dp[i-1][j-items[i].w]+items[i].v);
            else dp[i][j]=dp[i-1][j];
        }
    }

    cout << dp[N][W] << endl;
    // for(int i=0; i<=N; i++){
    //     for(int j=0; j<=W; j++){
    //         if(j) cout << " ";
    //         cout << dp[i][j];
    //     }
    //     cout << endl;
    // }
}

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

int main(){
  string N;
  cin>>N;
  if((N.at(0)==N.at(1)&&N.at(1)==N.at(2)) || (N.at(1)==N.at(2)&&N.at(2)==N.at(3))){
    cout<<"Yes"<<endl;
  }
  else cout<<"No"<<endl;
}

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

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

    vector<char> num={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
    vector<int> a(26);
    for(int i=0;i<s.size();i++){
        for(int j=0;j<26;j++){
            if(s.at(i)==num[j])a[j]++;
        }
    }

    for(int i=0;i<26;i++){
        if(a.at(i)==0){
            cout<<num[i]<<endl;
            break;
        }
        if(i==25)cout<<"None"<<endl;
    }

    return 0;
 
}


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

public class Main {
    public static long INF = Long.MAX_VALUE/2;
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(f.readLine());
        long[] arr = new long[n];
        StringTokenizer st = new StringTokenizer(f.readLine());
        for(int i = 0; i < arr.length; i++){
            arr[i] = Long.parseLong(st.nextToken());
        }
        long[][] dp = new long[n][n];
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                dp[i][j] = INF;
                if(i == j) dp[i][j] = 0;
            }
        }
        for(int j = 1; j < n; j++){
            for(int i = 0; i < n; i++){
                if(i+j < n){
                    long sum = 0;
                    for(int k = i; k <= i+j; k++) sum+=arr[k];
                    for(int k = i; k < i+j; k++){
                        dp[i][i+j] = Math.min(dp[i][i+j], sum+dp[i][k]+dp[k+1][i+j]);
                    }
                }
            }
        }
        out.println(dp[0][n-1]);
        out.close();
    }
}


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

using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int N = 0; cin >> N;
	vector<int> A,B,C;
	int a,b,c = 0;
	int tarot[100020][3];
	for (int i = 0; i < N; ++i)
	{
		cin>> a >>b>>c;
		A.push_back(a);
		B.push_back(b);
		C.push_back(c);
	}
	for (int i = 0; i < 3; ++i)
	{
		tarot[N][i] = 0;
	}
	for (int i = N-1; i >= 0; --i)
	{
		for (int j = 0; j < 3; ++j)
		{
			if(j == 0)tarot[i][j] = max(tarot[i+1][1]+B[i],tarot[i+1][2]+C[i]);
			else if (j == 1)tarot[i][j] = max(tarot[i+1][0]+A[i],tarot[i+1][2]+C[i]);
			else tarot[i][j] = max(tarot[i+1][0]+A[i],tarot[i+1][1]+B[i]);
		}
	}
	/*
	for (int i = 0; i < N+1; ++i)
	{
		for (int j = 0; j < 3; ++j)
		{
			cout << tarot[i][j] << " ";
		}
		cout << endl;
	}
	cout << endl;*/
	int MAX = 0;
	MAX = max(tarot[0][0],tarot[0][1]);
	MAX = max(MAX, tarot[0][2]);
	cout << MAX << "\n";
}	


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

using namespace std;

vector<string> solve(const vector<vector<int>>& cards) {
    vector<string> v;
    string s;
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 13; j++) {
            if (cards[i][j] == -1) {
                continue;
            }
            switch (i) {
            case 0:
                s = "S";
                break;
            case 1:
                s = "H";
                break;
            case 2:
                s = "C";
                break;
            case 3:
                s = "D";
                break;
            default:
                break;
            }
            s += " " + to_string(j + 1);
            v.push_back(s);
        }
    }
    return v;
}

int main() {
    int n;
    cin >> n;
    vector<vector<int>> cards(4, vector<int>(13));
    for (int i = 0; i < n; i++) {
        char a;
        int b;
        cin >> a >> b;
        switch (a) {
        case 'S':
            cards[0][b - 1] = -1;
            break;
        case 'H':
            cards[1][b - 1] = -1;
            break;
        case 'C':
            cards[2][b - 1] = -1;
            break;
        case 'D':
            cards[3][b - 1] = -1;
            break;
        default:
            break;
        }
    }
    vector<string> ans = solve(cards);
    for (auto& e : ans) {
        cout << e << endl;
    }
    return 0;
}



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

int main(){
  int n;
  cin>>n;
  vector<int>x;
  for(int i=0;i<n;i++){
    int s;
    cin>>s;
    x.push_back(s);
  }
  sort(x.begin(),x.end());
  cout<<abs(x[(n/2)-1]-x[(n/2)])<<endl;
  return 0;
}


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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);

    ll N;
    cin >> N;
    vll x(N), y(N);
    vector<char> d(N);
    rep(i, N) cin >> x[i] >> y[i] >> d[i];

    ll min_cx = 200000000, max_cx = -200000000;
    ll min_cy = 200000000, max_cy = -200000000;
    ll min_rx = 200000000, max_rx = -200000000;
    ll min_lx = 200000000, max_lx = -200000000;
    ll min_uy = 200000000, max_uy = -200000000;
    ll min_dy = 200000000, max_dy = -200000000;

    rep(i, N){
        if(d[i]=='R'){
            min_rx = min(x[i]*2, min_rx);
            max_rx = max(x[i]*2, max_rx);
            min_cy = min(y[i]*2, min_cy);
            max_cy = max(y[i]*2, max_cy);
        }
        else if(d[i]=='L'){
            min_lx = min(x[i]*2, min_lx);
            max_lx = max(x[i]*2, max_lx);
            min_cy = min(y[i]*2, min_cy);
            max_cy = max(y[i]*2, max_cy);
        }
        else if(d[i]=='D'){
            min_dy = min(y[i]*2, min_dy);
            max_dy = max(y[i]*2, max_dy);
            min_cx = min(x[i]*2, min_cx);
            max_cx = max(x[i]*2, max_cx);
        }
        else{
            min_uy = min(y[i]*2, min_uy);
            max_uy = max(y[i]*2, max_uy);
            min_cx = min(x[i]*2, min_cx);
            max_cx = max(x[i]*2, max_cx);
        }
    }

    set<ll> t = {
        0, min_cx-min_rx, (min_lx-min_rx)/2, min_lx-min_cx, max_lx-max_cx, (max_lx-max_rx)/2, max_cx-max_rx,
        min_cy-min_uy, (min_dy-min_uy)/2, min_dy-min_cy, max_dy-max_cy, (max_dy-max_uy)/2, max_cy-max_uy, 400000000,
    };

    ll ans = 1600000000000000000;
    for(ll e : t){
        if(e<0) continue;
        ll w = max({max_cx, max_lx-e, max_rx+e}) - min({min_cx, min_lx-e, min_rx+e});
        ll h = max({max_cy, max_dy-e, max_uy+e}) - min({min_cy, min_dy-e, min_uy+e});
        ans = min(ans, w*h);
    }
    cout << (double)ans/4 << endl;
}


Measured memory_bytes: 4716
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    n = int(input())
    xy = [list(map(int, input().split())) for i in range(n)]
    
    d = defaultdict(int)
    for i in range(n):
        for j in range(n):
            if i == j:
                continue
            aaa = xy[i][0] - xy[j][0]
            bbb = xy[i][1] - xy[j][1]
            # if aaa > 0 and bbb >0:
            #     g = gcd(aaa, bbb)
            #     aaa //= g
            #     bbb //= g
            # else:
            #     if aaa > 0:
            #         aaa = 1
            #     else:
            #         bbb = 1

            d[(aaa,bbb)]+=1
            #d[(bbb,aaa)]+=1
    t = 0
    for v in d.values():
        t = max(v , t)
    print(n - t)

    






    


if __name__ == '__main__':
    main()


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

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

vector<VI> G;
int n, m;
bool memo[8];

int dfs(int now){
    memo[now] = true;
    int cnt = 0;
    REP(i, 8) cnt += memo[i];
    if(cnt == 8){
        memo[now] = false;
        return 1;
    }

    int res = 0;
    REP(i, G[now].size()){
        int next = G[now][i];
        if(memo[next]) continue;
        res += dfs(next);
    }
    memo[now] = false;
    return res;
}

int main(){
    cin >> n >> m;
    REP(i, n){
        VI tmp;
        G.PB(tmp);
        memo[i] = false;
    }
    REP2(i, n, 8){
        memo[i] = true;
    }
    REP(i, m){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        G[a].PB(b);
        G[b].PB(a);
    }

    cout << dfs(0) << endl;
}


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

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

using namespace std;

typedef long long int lli;

int main () {
    int N;
    while (cin >> N, N) {
        vector<int> guys(N, 0);
        vector<lli> cost(N, 0);
        int base = 6;
        int size = 1 << (22 - 6);
        REP (i, 0, N) {
            int M;
            cin >> M >> cost[i];
            REP (j, 0, M) {
                int s, e;
                cin >> s >> e;
                REP (k, s, e) guys[i] |= (1 << (k - base));
            }
        }
        vector<vector<lli>> dp(N + 1, vector<lli>(size, -1));
        dp[0][0] = 0;
        REP (i, 0, N) {
            REP (j, 0, dp[i].size()) {
                if (dp[i][j] == -1)  continue;
                dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
                if ((j & guys[i]) != 0) continue;
                dp[i + 1][j | guys[i]] = max(dp[i + 1][j | guys[i]], dp[i][j] + cost[i]);
            }
        }
        lli ans = 0;
        REP (i, 0, size) ans = max(ans, dp[N][i]);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 55024
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let [n,k,q] = nextIntArray()
    let b = new Array(n).fill(k-q)
    while(hasNext()){
        let tmp = nextInt()
        b[tmp-1]++
    }
    for(let i = 0; i<b.length;i++){
        if(b[i] > 0 ) console.log("Yes")
        else console.log("No")    
    }
        
    
}
Main()


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

int main() {
  long long int x=100,z,i=1,count=0;
  cin>>z;
  //co=x;
while(i)
{ count++;
    x+=x*0.01;
    //cout<<x;
    if(x>=z)
    i=0;
  }
  cout<<count;
}


Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<string>

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

  int count[3]={};
  char c;
  for(int i=0;i<3;i++){
    cin >> c;
    count[c-'a']++;
  }

  if(count[0] == count[1] && count[1] == count[2]) cout << "Yes";
  else cout << "No";
  cout << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
    long long int N,i,T,t[200001],X,sum;
    scanf("%lld %lld",&N,&T);
    for(i=0;i<N;i++){
        scanf("%lld",&t[i]);
        }
        sum = 0;
    for(i=0;i<N-1;i++){
        if(t[i]+T < t[i+1]){sum += T;}
        if(t[i] + T >= t[i+1]){sum += t[i+1] - t[i];}
    }
    sum += T;
        
    printf("%lld\n",sum);
    return 0;
}

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

using namespace std;

typedef long long LL;

struct ans
{
	bool b = false;
	int count_2 = 0;
	int now = 0;
};

ans data_['z' + 1];

LL count_ = 1;
string s;

int main()
{
	cin >> s;
	LL ll = 0;
	for (int i = 1; i < s.length(); i++)
	{
		ll = count_;
		int u = 0;
		if (data_[s[i]].b)
		{
			u = data_[s[i]].now;
			count_ += data_[s[i]].count_2;
		}
		for (int h = u; h < i; h++)
		{
			if (s[h] != s[i])count_++;
		}
		data_[s[i]].b = true;
		data_[s[i]].count_2 = count_ - ll;
		data_[s[i]].now = i;
	}
	cout << count_ << endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>

int candivCheck(int n)
{
    int number = n;
    int waru = 10;
    int shou = 1;
    int waruCount = 0;

    while (shou != 0)
    {
        shou = n / waru;
        waru = waru * 10;
        waruCount++;
    };

    int sum = 0;
    int warutwo = 10;
    int amari = 0;
    for (int i = 0; i < waruCount; i++)
    {
        amari = n % warutwo;
        sum += amari;
        n = n / 10;
    }

    int result = number % sum;
    return result;
}
int main(int argc, char *argv[])
{
    int n = 0;

    do
    {
        scanf("%d", &n);
    } while (n < 1 || 1000000000 < n);

    if (candivCheck(n) == 0)
    {
        printf("Yes\n");
    }

    else
        printf("No\n");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
 
int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    string s;
    cin >> s;
    int n = s.length();
    ll ans = 0;
    vector<int> dp(2019);
    for (int i = 0; i < n; i++) {
        vector<int> new_dp(2019);
        int d = s[i] - '0';
        new_dp[d]++;
        for (int j = 0; j < 2019; j++) {
            int rem = (j * 10 + d) % 2019;
            if (rem == 0) ans += dp[j];
            new_dp[rem] += dp[j];
        }
        dp = new_dp;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3716
/*
author : seryu
title : ABC167C_"Skill Up"
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
typedef long long ll;
typedef pair<int, int> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;
int INF = 1001001001;

void solve()
{
	int n, m, x;
	cin >> n >> m >> x;
	vector<int> c(n);
	vector<vector<int>> a(n,vector<int>(m));
	rep(i, n)
	{
		cin >> c[i];
		rep(j, m)cin >> a[i][j];
	}
	int ans = INF;
	rep(mask, 1 << n)
	{
		int cost = 0;
		vector<int> comp(m, 0);
		rep(i, n)
		{
			if(mask>>i & 1)
			{
				cost += c[i];
				rep(j, m) comp[j] += a[i][j];
			}
		}
		int ok = true;
		rep(j, m)if(comp[j] < x)ok = false;
		if(ok)chmin(ans, cost);
	}
	if(ans == INF)ans = -1;
	cout << ans << endl;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3668
#include<stdio.h>

int main(){
  
  int a=0,b=0,n,N[10000],i=0;
  long long  c=0;

scanf("%d",&n); 

  for( i =0; i< n ; i++){
    
    scanf("%d",&N[i]);
    a=N[0];
    b=N[0];
  }

  for(i=1; i<n ; i++){ 

    if(N[i] < b){ b =N[i];}
    if (N[i]> a){ a = N[i];}

  }

 for(i=0;i<n;i++){

 c=c+N[i];
 
  }

  printf("%d %d %lld\n",b,a,c);

  return 0;
}

Measured memory_bytes: 636
#include <stdio.h>
#include <string.h>
#include <algorithm>
long long int home[12345678];
long long int muki[12345678];
long long int important[123456];
long long int hit[12345678];
long long int ans[12345678];
int main(){
	long long int num;
	long long int time;
	long long int imp_num;
	long long int hit_num = 0;
	scanf("%lld%lld%lld", &num, &time, &imp_num);
	for (long long int a = 0; a < num; a++){
		scanf("%lld%lld", &home[a], &muki[a]);
	}
	for (int a = 0; a < imp_num; a++){
		scanf("%lld", &important[a]);
	}
	for (long long int a = 0; a < num - 1; a++){
		if (muki[a] == 1 &&
			muki[a + 1] == 2){
			hit[hit_num] = (home[a + 1] - home[a]) / 2 + home[a];
			hit_num++;
		}
	}
	for (long long int a = 0; a < num; a++){
		if (muki[a] == 1){
			home[a] += time;
			for (long long int b = 0; b < hit_num; b++){
				if (home[a] >= hit[b] &&
					home[a] - time <= hit[b]){
					home[a] = hit[b];
					break;
				}
			}
		}
		else{
			home[a] -= time;
			for (long long int b = hit_num - 1; 0 <= b; b--){
				if (home[a] <= hit[b] &&
					home[a] + time >= hit[b]){
					home[a] = hit[b];
					break;
				}
			}
		}
	}
	for (int a = 0; a < imp_num; a++){
		printf("%lld\n", home[important[a] - 1]);
	}
	return 0;
}

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

// C(n, r) = n! / r! / (n - r)!

map<int, int> pf(int x)
{
	map<int, int> res;
	if (x <= 1) return res;
	
	for (int i = 2; i <= x; i++){
		int y = i;
		for (int j = 2; j * j <= i; j++){
			while (y % j == 0){
				res[j]++;
				y /= j;
			}
		}
		if (y > 1) res[y]++;
	}
	return res;
}

string solve(int n, int m, int r)
{
	if (n * m > r) return "0";
	int N = (r - n * m) + (n - 1);
	int R = n - 1;
	
	auto A = pf(N), B = pf(R), C = pf(N - R);
	
	for (auto &it : B){
		A[it.first] -= it.second;
	}
	for (auto &it : C){
		A[it.first] -= it.second;
	}
	
	const int sz = 4096;
	vector<int> a(sz, 0);
	a[0] = 1;
	
	for (auto &it : A){
		int x = it.first;
		int y = it.second;
		for (int i = 0; i < y; i++){
			for (int j = 0; j < sz - 1; j++){
				a[j] *= x;
			}
			for (int j = 0; j < sz - 1; j++){
				a[j + 1] += a[j] / 10000;
				a[j] %= 10000;
			}
		}
	}
	
	while (!a.back()) a.pop_back();
	
	stringstream ss;
	ss << a.back();
	for (int i = int(a.size()) - 2; i >= 0; i--){
		ss << setfill('0') << setw(4) << a[i];
	}
	
	return ss.str();
}

int main()
{
	int n, m, r;
	cin >> n >> m >> r;
	cout << solve(n, m, r) << endl;
}

Measured memory_bytes: 1484
#-*-coding:utf-8-*-

def main():
    n = int(input())
    t_list = list(map(int, input().split()))
    m = int(input())
    drink_list = [list(map(int, input().split())) for _ in range(m)]

    for drink in drink_list:
        p, x = drink
        ans = 0
        for i in range(1, n+1):
            if i == p:
                ans += x
            else:
                ans += t_list[i-1]
        print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
N = input()
A = int(N[-1])

if A == 2 or A == 4 or A == 5 or A == 7 or A == 9:
    print('hon')
elif A == 0 or A == 1 or A == 6 or A == 8:
    print('pon')
else:
    print('bon')

Measured memory_bytes: 9044
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <vector>
#include <functional>
using namespace std;

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

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

    int n;
    cin >> n;

    vector<ll> a(n);

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

    ll ans = 0, limit = 1;
    for (int i = 0; i < n; i++) {
        if (i == 0) {
            ans += a[i] - 1;
            a[i] = 1;
        } else {
            //
            ll temp = (a[i] - 1) / limit;
            ans += (a[i] - 1) / limit;
            a[i] = a[i] - temp * limit;
            if (temp >= 1) {
                a[i] = 1;
            }
        }
        limit = max(limit, a[i] + 1);
    }
    cout << ans << endl;

    /*
    for (int i = 0; i < n; i++) {
        cout << a[i] << endl;
    }
    */

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const LL mod = 1e9 + 7;
const int N = 1000005;

char s[N];
int f[N][2];
int main() {
    scanf("%s", s + 1);
    int n = strlen(s + 1);
    f[n+1][1]=INF;
    for (int i = n; i >= 1; i--) {
        int x = s[i] - '0';
        f[i][0] = f[i + 1][0] + x;
        if (x + 1 != 10) f[i][0] = min(f[i][0], f[i + 1][1] + x + 1);
        f[i][1] = min(f[i + 1][0] + 10 - x, f[i + 1][1] + 10 - x - 1);
    }
    printf("%d\n", min(f[1][0], f[1][1] + 1));
    return 0;
}


Measured memory_bytes: 9088
#include <stdio.h>

#define MAX 200001
#define MAXV 10001

int main(){
  int *A, *B;

  int i, n;
  int C[MAXV];

  scanf("%d", &n);

  A = malloc(sizeof(int)*n+1);
  B = malloc(sizeof(int)*n+1);

  for(i = 0; i <= MAXV; i++)
    C[i] = 0;

  for(i = 0; i < n; i++){
    scanf("%d", &A[i+1]);
    C[A[i+1]]++;
  }

  for(i = 1; i <= MAXV; i++)
    C[i] += C[i-1];

  for(i = 1; i <= n; i++){
    B[C[A[i]]] = A[i];
    C[A[i]]--;
  }

  for(i = 1; i <= n; i++){
    if(i > 1)
      printf(" ");
    printf("%d", B[i]);
  }

  printf("\n");

  return 0;
}

Measured memory_bytes: 16272
def BubbleSort(C, N):
    for i in xrange(0, N):
        for j in reversed(xrange(i+1, N)):
            if C[j][1] < C[j-1][1]:
                C[j], C[j-1] = C[j-1], C[j]

def SelectionSort(C, N):
    for i in xrange(N):
        minj = i
        for j in xrange(i, N):
            if C[j][1] < C[minj][1]:
                minj = j
        C[i], C[minj] = C[minj], C[i]

def isStable(C, N):
    flag = 0
    for i in xrange(1, 14):
        Ct = [C[j] for j in xrange(N) if C[j][1] == str(i)]
        if len(Ct) > 1:
            for k in xrange( len(Ct)-1 ):
                if Ct[k][2] > Ct[k+1][2]:
                    flag = 1
    if flag == 0: print "Stable"
    else:         print "Not stable"

# MAIN
N = input()
C = []
Ct = map(str, raw_input().split())
for i in xrange(N):
    C.append([Ct[i][0], Ct[i][1::], i])

Ct = list(C)
BubbleSort(Ct, N)
print " ".join([Ct[i][0]+Ct[i][1] for i in xrange(N)])
isStable(Ct, N)

Ct = list(C)
SelectionSort(Ct, N)
print " ".join([Ct[i][0]+Ct[i][1] for i in xrange(N)])
isStable(Ct, N)

Measured memory_bytes: 6480
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//

const int di[] = {0, 1};
const int dj[] = {1, 0};


int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i, h) cin >> s[i];
  vvi dp(h, vi(w, INF));
  dp[0][0] = 0;
  if (s[0][0] == '#') dp[0][0] = 1;
  rep(i, h) rep(j, w) {
    rep(dir, 2) {
      int ni = i + di[dir], nj = j + dj[dir];
      if (ni>=h||nj>=w) continue;
      int c = 0;
      if (s[i][j] == '.' && s[ni][nj] == '#') c++;
      chmin(dp[ni][nj], dp[i][j] + c);
    }
  }
  cout << dp[h-1][w-1] << endl;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  for(int i = 1; i <= 50000; i++){
    int x = i * 1.08;
    if(x == n){
      cout << i << "\n";
      return 0;
    }
  }
  
  cout << ":(" << "\n";
}

Measured memory_bytes: 256
import Text.Printf

ft (a,b,c) =
  printf "%d %d %d" a b c

mms :: [Int] -> (Int, Int, Int)
mms x =
  (minimum x, maximum x, sum x)

main = do
  n <- getLine
  a <- getLine
  putStrLn $ ft $ mms $ map (read :: String -> Int) $ words a

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

using namespace std;


int main()
{
  int n;
  cin >> n;
  string str[n];
  int top_b = 0;
  int last_a = 0;
  int ba = 0;

  for(int i = 0;
      i < n;
      ++i)
    {
      cin >> str[i];
      if(str[i][0] == 'B')
        {
          ++top_b;
          if(str[i][str[i].length() - 1] == 'A')
            {
              ++last_a;
              ++ba;
            }
        }
      else if(str[i][str[i].length() - 1] == 'A')
        {
          ++last_a;
        }
    }

  int ret = 0;
  for(int i = 0;
      i < n;
      ++i)
    {
      for(int j = 0;
          j < str[i].length() - 1;
          ++j)
      if(str[i][j] == 'A'
         && str[i][j + 1] == 'B')
        {
          ++ret;
        }
    }

  if(ba > 0)
    {
      ret += (ba - 1);
    }

  int only_top_b = top_b - ba;
  int only_last_a = last_a - ba;

  if(ba > 0)
    {
      if(only_top_b > 0)
        {
          ++ret;
          --only_top_b;
        }

      if(only_last_a > 0)
        {
          ++ret;
          --only_last_a;
        }
    }

  ret += std::min(only_top_b,
                  only_last_a);
  
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 768
const lines=readlines(open("/dev/fd/0"))
let
    state=0
    global input
    input()=lines[state+=1]
end
int(s::String)=parse(Int32,s)
intSub(s::SubString{String})=parse(Int32,s)
intLine()=map(intSub,split(input()))
function main()
    println(1110-int(input()))
end
main()

Measured memory_bytes: 112492
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    int ok = 0, sum = 0;
    while(sum <= 1000){
        if(a % 2 != 0 || b % 2 != 0 || c % 2 != 0){
            ok = 1;
            break;
        }
        int x, y, z;
        x = (b + c) / 2, y = (a + c) / 2, z = (a + b) / 2;
        a = x, b = y, c = z;
        sum++;
    }
    if(ok == 0) printf("-1\n");
    else printf("%d\n", sum);
}

Measured memory_bytes: 128
def put(i):
    global n,row,cur
    while n>0:
        row[cur[0]] = i
        n -= 1
        if cur[1]=="R":
            cur[0] += 1
        elif cur[1]=="L":
            cur[0] -= 1
        if cur[0]>W-1 or cur[0]<0:
            B.append(row)
            row = ["." for _ in range(W)]
        if cur==[-1,"L"]:
            cur = [0,"R"]
        elif cur==[W,"R"]:
            cur = [W-1,"L"]
        
H,W = map(int,input().split())
N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
B = []
row = ["." for _ in range(W)]
cur = [0,"R"]
for i in range(1,N+1):
    n = A[i]
    put(i)
    
for i in range(H):
    print(*B[i])

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

using namespace std;

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

LL search(vector<vector<PII>> &graph, int v, int pre, LL mask, int b) {
  if(v == b) {
    return mask;
  }
  for(auto ui: graph[v]) {
    int u = ui.first;
    int i = ui.second;
    if(u==pre) continue;
    LL new_mask = mask | (1LL<<i);
    LL res = search(graph, u, v, new_mask, b);
    if(res>=0) return res;

  }
  return -1;

}

LL get_mask(vector<vector<PII>> graph, int a, int b) {
  int N = graph.size();
  LL mask = 0;
  //stack<pair<int, LL>> sta; // vertex, pre, mask
  //sta.push(make_pair(a, 0));
  mask = search(graph, a, -1, 0, b);
  return mask;

}

int main() {
  int N, M;
  cin >> N ;
  vector<vector<PII>> graph(N);
  for(int i=0; i<N-1; i++) {
    int v, u;
    cin >> v >> u;
    v--;u--;
    graph[v].push_back(PII(u, i));
    graph[u].push_back(PII(v, i));

  }
  cin >> M;
  vector<LL>  masks;
  for(int i=0; i<M; i++) {
    int a, b;
    cin >> a >>b;
    a--;
    b--;
    masks.push_back(get_mask(graph, a, b));
  }
  LL ans = 0;
  for(int bit=0; bit<(1<<M); bit++) {
    LL mask = 0;
    LL mult = 1;
    for(int i=0; i<M; i++) {
      if((bit & (1<<i)) > 0) {
        mask |= masks[i];
        mult *= -1;
      }
    }
    int bcnt = 0;
    for(int i=0; i<N; i++) {
      if((mask&(1LL<<i)) > 0) bcnt++;
    }
    bcnt = N-1-bcnt;

    ans += mult * (1LL<<bcnt);

  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

use std::collections::BTreeSet;

fn f(dis: &Vec<Vec<f64>>, p: &mut BTreeSet<usize>, u: usize) -> f64 {
    p.remove(&u);
    let mut ret = 0.0;
    for v in 0..8 {
        if !p.contains(&v) {
            continue;
        }
        ret += dis[u][v] + f(dis, p, v);
    }
    let l = p.len();
    if l > 0 {
        ret = ret / (l as f64);
    }
    p.insert(u);
    return ret;
}

fn main() {
    let n: usize = read();
    let xy: Vec<Vec<f64>> = read_vec2(n);
    let mut dis: Vec<Vec<f64>> = vec![vec![0.0; n]; n];
    for i in 0..n {
        for j in 0..n {
            dis[i][j] = ((xy[i][0] - xy[j][0]) * (xy[i][0] - xy[j][0])
                + (xy[i][1] - xy[j][1]) * (xy[i][1] - xy[j][1]))
                .sqrt();
        }
    }
    let mut ans: f64 = 0.0;
    let mut p: BTreeSet<usize> = BTreeSet::new();
    for i in 0..n {
        p.insert(i);
    }
    for i in 0..n {
        ans += f(&dis, &mut p, i);
    }
    ans = ans / (n as f64);
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
    char s[5];
    cin>>s;
    for(int i=0;i<3;i++)
    {
        if(s[i]=='7')
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;


}


Measured memory_bytes: 3632
#include <stdio.h>
main(){
   int W,H,x,y,r;
   scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
   if(x+r<=W && x-r>=0 && y+r<=H && y-r>=0){
         printf("Yes\n");
   }else{
         printf("No\n");
   }
return 0;
}

Measured memory_bytes: 584
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include <queue>

using namespace std;

const int maxx=205;
int n,m,k;
char a[maxx][maxx];
int ans = 0,cnt = 0,pos = 0;
int l = 0,r = 0;


const int INF = 100000000;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
typedef pair <int,int> P;
queue<P> que;
int d[maxx][maxx];
int sx,sy;
int ex,ey;
int ans1 = INF,ans2 = INF;
bool judge(int x,int y){
    if(a[x][y] != '#'){
        if(x >= 0 && x < n)
        {
            if(y >= 0 && y < m)
            {
                if(d[x][y] == INF){
                    return true;
                }
            }
        }
    }
    return false;
}

void bfs()
{
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            d[i][j] = INF;//初始化
        }
    }
    que.push(P(sx,sy));
    d[sx][sy] = 0;//并把距???0；
    while(que.size()){//直到?列?空
        P p = que.front();que.pop();
        if(a[p.first][p.second] == '$'){
            ans2 = min(ans2,d[p.first][p.second]);
        }
        if(a[p.first][p.second] == '@')
        {
            ans1 = min(ans1,d[p.first][p.second]);
        }
        for(int i = 0; i < 4; i++)
        {
            int nx = p.first + dx[i],ny = p.second + dy[i];
            if(judge(nx,ny))
            {
                que.push(P(nx,ny));
                d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }
//    return d[ex][ey];
}


int main()
{
#ifdef LOCAL
//    freopen("/Users/ecooodt/Desktop/c++ and acm/_集?/tp1/2.txt","r",stdin);
#endif
    scanf("%d%d",&n,&m);
    for(int i = 0; i < n; i++)
    {
        getchar();
        for(int j = 0; j < m; j++)
        {
            scanf("%c",&a[i][j]);
            if(a[i][j] == '%')
            {
                sx = i,sy = j;
            }
        }
    }
    bfs();
    if(ans1 < ans2)
    printf("Yes\n");
    else
    printf("No\n");
    return 0;
}

Measured memory_bytes: 3436
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define debug(x) cerr <<__LINE__<< ": " <<#x<< " = " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#v<<" = ";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    double l;
    cin >> l;
    cout << fixed << setprecision(10) << pow(l, 3) / 27 << endl;
}

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


Measured memory_bytes: 4232