akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.math.*;
import java.text.*;
public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		for(int i=0; i<n; i++){
			double x1=in.nextDouble();
			double y1=in.nextDouble();
			double x2=in.nextDouble();
			double y2=in.nextDouble();
			double x3=in.nextDouble();
			double y3=in.nextDouble();
			double x4=in.nextDouble();
			double y4=in.nextDouble();
			if((y1-y2)*(x3-x4)==(x1-x2)*(y3-y4)) System.out.println("YES");
			else System.out.println("NO");
		}
	}
}

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

int main() {
  ll n,a,m; cin>>n>>a;
  m=a;
  rep(i,5){
    cin>>a;
    if(a<m){m=a;}
  }
  ll ans=5;
  if(n%m==0){ans+=n/m-1;}
  else{ans+=n/m;}
  cout<<ans;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<functional>
using namespace std;
#define INF 1e15
#define MOD 1000000007
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
typedef long long ll;
#define END system("PAUSE");return 0
int n, m, q, a[111111], b[111111];
signed main() {
	cin >> n >> m >> q;
	rep(i, n)cin >> a[i];
	rep(i, m)cin >> b[i];
	rep(i, q) {
		int X;
		cin >> X;
		int A, B, C, D;
		if (X < a[0])A = -INF;
		else A = *(lower_bound(a, a + n, X) - 1);
		if (X < b[0])B = -INF;
		else B = *(lower_bound(b,b + m, X) - 1);
		if (X > a[n - 1])C =INF;
		else C = *lower_bound(a, a + n, X);
		if (X > b[m - 1])D = INF;
		else D = *lower_bound(b, b + m, X);
		A = X - A, B = X - B, C = C - X, D = D - X;
		cout << min({ max(A,B),max(C,D),min(A,D) + A + D,min(B,C) + B + C }) << endl;
	}
	END;
}


Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll N,i;scanf("%lld",&N);
  ll A[N];
  for(i=0;i<N;i++) scanf("%lld",&A[i]);
  ll money = 1000,now = A[0],buy;
  bool loh = 1;
  for(i=1;i<N;i++){
    if(loh){
      if(A[i] > now){
        buy = now;
        loh = 0;
        now = A[i];
      } else now = A[i];
    }
    else if(!loh){
      if(A[i] < now){
        money += (now-buy)*(money/buy);
        loh = 1;
        now = A[i];
      }
      else now = A[i];
    } 
  }
  if(!loh) money += (now-buy)*(money/buy);
  printf("%lld\n",money);
}

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

using lint = long long;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    cout << c << ' ' << a << ' ' << b << '\n';
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
cnt = [0]*(N+1)
for a in A:
  cnt[a] += 1
m = 0
for a in cnt:
  m += a*(a-1)/2
for i in range(N):
  print(int(m - (cnt[A[i]] - 1)))

Measured memory_bytes: 24996
n, m, x = map(int, input().split())
ca_list = [[int(i) for i in input().split()] for _ in range(n)]
ans = 999999999999999
flag = 0

for i in range(2**n):
  bin_str = format(i, '0'+str(n)+'b')
  skill_list = [0]*m
  cost = 0
  for j, ca in enumerate(ca_list):
    if bin_str[j] == "1":
      cost += ca[0]
      for k in range(m):
        skill_list[k] += ca[k+1]
  if all([i >= x for i in skill_list]):
    ans = min(ans, cost)
    flag = 1
print(ans if flag == 1 else -1)

Measured memory_bytes: 9224
#include<iostream>
#include<stdio.h>
using namespace std;
int main() {
	double a, b, c, d, e, f, x, y;
	while (cin >> a >> b >> c >> d >> e >> f) {
		double bd = b*d;
		double ea = e*a;
		double cd = c*d;
		double fa = f*a;
		y = (cd - fa) / (bd - ea);
		x = (c - b*y) / a;
		printf("%.3f %.3f\n", x, y);
	}
}

Measured memory_bytes: 3048
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pi pair<int,int>
#define ll long long
#define rep(i,a,b) for(int i=int(a); i<=int(b);i++)
#define repv(vec,v) for(v=(vec).begin(); v!=(vec).end();v++)
#define sz(vec) (int)(vec).size()
#define PB push_back
#define F first()
#define S second()


int main(){
	int x,y,z;
	cin >> x >> y >> z;
	cout << z << " " << x << " "  << y;
	return 0;
}


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

const int mod = 1e9 + 7;

int main( ) {
	int n, b;
	long long ans;
	string s1, s2;
	cin >> n >> s1 >> s2;
	
	if (s1[0] == s2[0]) ans = 3;
	else ans = 6;
	for (int i = 0; i < n - 1; i++) {
		if (i < n - 1 && s1[i] == s1[i + 1]) continue;
		if (s1[i] == s2[i] && s2[i + 1] == s2[i + 1]) b = 2;
		if (s1[i] == s2[i] && s1[i + 1] != s2[i + 1]) b = 2;
		if (s1[i] != s2[i] && s1[i + 1] == s2[i + 1]) b = 1;
		if (s1[i] != s2[i] && s1[i + 1] != s2[i + 1]) b = 3;
		ans = (ans * b) % mod;
	}
	cout << ans << endl;
	
  	return 0;
}

Measured memory_bytes: 256
q, g, s, d = map(int, input().split())
n = int(input())

g = min(g, q * 2)
s = min(s, g * 2)
d = min(d, s * 2)

ans = 0

#1 2 4 8
n *= 4

ans += n // 8 * d
n %= 8

ans += n // 4 * s
n %= 4

ans += n // 8 * g
n %= 2

ans += n

print(ans)

Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m,i,j,k,a,b,c,dp[500000],cc[500000];
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&cc[i]);
	for (int i=2;i<=n;i++) dp[i]=9999999999;	
	for (int i=1;i<n;i++){
		dp[i+1]=min(dp[i+1],dp[i]+abs(cc[i]-cc[i+1]));
		dp[i+2]=min(dp[i+2],dp[i]+abs(cc[i]-cc[i+2]));		
	}
	printf("%d\n",dp[n]);
	return 0;
}

Measured memory_bytes: 896
#include<iostream>

using namespace std;

int main()
{
	int n,m;
	int num[1000];
	int i,j;
	
	for(;;)
	{
		cin >> n >> m ;
		if(n==0 && m==0)
			break;
		
		for(i=0;i<n;i++)
		{
			num[i]=1;
		}
		
		int flag1,flag2=0;
		
		flag1=n;
		
		for(i=0;flag1!=1;i++)
		{
			if(i==n)
				i=0;
			
			if(num[i]==1)
				flag2++;
			if(flag2==m)
			{
				flag2=0;
				num[i]=0;
				flag1--;
			}
		}
		
		for(i=0;i<n;i++)
		{
			if(num[i]==1)
				cout << i+1 << endl;
		}
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<cmath>
#include<set>
#include<iterator>

using namespace std;
long long int dp[100001];
long long int ma=10000000;
int main()
{
    int n,k;
    cin>>n>>k;
    int ara[n];
    long long int a1,a2;
    for(int i=0;i<n;i++)cin>>ara[i];
    dp[0]=0,dp[1]=abs(ara[1]-ara[0]);
    for(int i=2;i<n;i++){
        dp[i]=1000000000;
        for(int j=max(i-k,0);j<i;j++){
            a1=dp[j]+abs(ara[i]-ara[j]);
            dp[i]=min(dp[i],a1);
        }
    }
    cout<<dp[n-1];
}


Measured memory_bytes: 4788
using System;

namespace Takoyaki
{
    class Program
    {
        static void Main(string[] args)
        {

            double X, N, T;
            string inD0 = Console.ReadLine();
            string[] cngD0 = inD0.Split(' ');

            N = int.Parse(cngD0[0]);
            X = int.Parse(cngD0[1]);
            T = int.Parse(cngD0[2]);

            double Res = Math.Ceiling(N / X) * T;

            Console.WriteLine(Res);
        }
    }
}


Measured memory_bytes: 27584
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define repp(i,n) for(int (i) = 1; (i) <= (n); ++(i))
#define popcnt __builtin_popcount
#define all(v) v.begin(),v.end()
#define _Pi 3.1415926535
#define _MOD = 1e9+7;
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
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;}
template<class T> T gcd(T a, T b){return b?GCD(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/GCD(a,b);}

int main(){
    int n,k; cin >> n >> k;
    double ans = 0.0;

    repp(i,n){
        int point = i;
        double pro = 1.0/n;
        while(point < k){
            point *= 2;
            pro *= 0.5;
        }
        ans += pro;
    }

    printf("%.10lf\n", ans);

    
    return 0;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/21  Problem: ABC 056 B / Link: http://abc056.contest.atcoder.jp/tasks/abc056_b  ----- */


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

	LL W, a, b; cin >> W >> a >> b;


	LL ans = min({ abs(b - a - W),abs(b + W - a) });
	LL aa = max(a, b);
	LL bb = min(a + W, b + W);
	if (aa <= bb)ans = 0;

	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main(){
	int N,T;
  	cin>>N>>T;
	int cmin=1001;
  	int c,t;
	for(int i=0;i<N;i++){
    	cin>>c>>t;
      	if(t<=T){
        	if(c<cmin) cmin=c;
        }
    
    }
  	if(cmin!=1001) cout<<cmin<<endl;
  	else cout<<"TLE"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())

#define pb emplace_back
#define fi first
#define se second

using namespace std;

using ld = long double;
using ll = long long int;

const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> void UNIQUE(vector<T> &a){ a.erase(unique(a.begin(), a.end()), a.end()); }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll in(){long long int x; assert(scanf("%lld", &x) == 1); return x;}
ld fin(){double x; assert(scanf("%lf", &x) == 1); return x;}
char yuyushiki[1000010]; string stin(){assert(scanf("%s", yuyushiki) == 1); return yuyushiki;}

// head

struct Mod{
  unsigned n;
  Mod() : n(0){}
  Mod( ll x ){
    if( x < 0 ) n = x%MOD+MOD;
    else n = x%MOD;
  }
};
Mod operator + ( Mod a  , Mod b ){ return Mod( a.n + b.n ); }
Mod operator +=( Mod &a , Mod b ){ return a = a + b; }
Mod operator - ( Mod a ){ return Mod( MOD - a.n ); }
Mod operator - ( Mod a  , Mod b ){ return Mod( a.n + MOD - b.n ); }
Mod operator -=( Mod &a , Mod b ){ return a = a - b; }
Mod operator * ( Mod a  , Mod b ){ return Mod( (ll)a.n * b.n ); }
Mod operator *=( Mod &a , Mod b ){ return a = a * b; }
Mod modpow( Mod x , ll k ){
  Mod res = 1;
  while( k ){
    if( k & 1 ) res *= x;
    k /= 2;
    x *= x;
  }
  return res;
}
ll extgcd( ll a , ll b , ll &x , ll &y ){
  ll d = a;
  if( b != 0 ){
    d = extgcd( b , a % b , y , x );
    y -= a / b * x;
  } else {
    x = 1, y = 0;
  }
  return d;
}
Mod inv( Mod a ){ ll x, y; assert( extgcd( a.n , MOD , x , y ) == 1 ); return Mod( x ); }
Mod operator / ( Mod a  , Mod b ){ return Mod( (ll)a.n * inv(b).n ); }
Mod operator /=( Mod &a , Mod b ){ return a = a / b; }

int main(){

  int n = in();
  vector<vector<int>> a(n, vector<int>(n));
  REP(i, n){
    REP(j, n){
      a[i][j] = in();
    }
  }
  vector<vector<Mod>> dp(n + 1, vector<Mod>(PW(n), 0));
  dp[0][0] = 1;
  REP(i, n){
    REP(j, PW(n)){
      if(dp[i][j].n == 0){
        continue;
      }
      REP(k, n){
        if(j & PW(k)){
          continue;
        }
        if(a[i][k] == 0){
          continue;
        }
        dp[i + 1][j | PW(k)] += dp[i][j];
      }
    }
  }

  cout << dp[n][PW(n) - 1].n << endl;
  
  return 0;
}


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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> A(3 * N);
  for (int i = 0; i < 3 * N; i++) {
    cin >> A[i];
  }
  sort(A.begin(), A.end(), greater<int>());
  ll res = 0;
  for (int i = 0; i < 2 * N; i++) {
    if (i % 2 == 1) res += A[i];
  }
  cout << res << '\n';
  return 0;
}


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

#define MAXN (100010)

int n, m;
int y[MAXN], p[MAXN];

vector<pair<int, int>> arr[MAXN];


int main() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; ++i) {
        scanf("%d%d", p + i, y + i);
        arr[p[i]].emplace_back(y[i], i);
    }
    for (int j = 1; j <= n; ++j) {
        int k = 1;
        sort(arr[j].begin(), arr[j].end());
        for (auto i : arr[j]) {
            y[i.second] = k ++;
        }
    }
    for (int k = 1; k <= m; ++k) {
        printf("%06d%06d\n", p[k], y[k]);
    }
    return 0;
}


Measured memory_bytes: 7808
using System;

namespace MyProgram{
    class AtCoder{
        static void Main(string[] args){
            long[] input = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
            long W = input[0];
            long H = input[1];
            double x = (double)input[2];
            double y = (double)input[3];
            int method = 0;
            if((double)input[0]/2==(double)input[2] && (double)input[1]/2==(double)input[3]){
                method = 1;
            }
            Console.WriteLine("{0} {1}",(double)(W*H)/2,method);
        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int s;
    cin>>s;
    int x=s;
    set<int>b;
    int i=0;
    while(!b.count(x)){
        b.insert(x);
        if(x%2==0){x/=2;}
        else{x=3*x+1;}
    }
    cout<<b.size()+1<<endl;
   
    return 0;
}

Measured memory_bytes: 256
N, M = map(int,input().split())
s_list = []
for i in range(M):
    KS = list(map(int,input().split()))
    s_list.append(KS[1:])
p_list = list(map(int,input().split()))

patterns = []
for i in range(2**N):
    l = list(map(int,list(format(bin(i)[2:]))))
    l = [0 for _ in range(N-len(l))] + l
    patterns.append(l)

for i in range(M):
    tmp_patterns = []
    for pat in patterns:
        tmp_sum = 0
        for s in s_list[i]:
            tmp_sum += pat[s-1]
        if tmp_sum%2 == p_list[i]:
            tmp_patterns.append(pat)
    patterns = tmp_patterns

print(len(patterns))

Measured memory_bytes: 41328
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        System.out.println(s.next().replace(',',' '));
    }

}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

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

#define rep(ver,n) rep2(ver,0,n)
#define rep2(ver,m,n) for(int ver=m;ver<(n);ver++)
#define loop while(true)
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(v) (v).begin(), (v).end()
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

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

int main(){
  int n;
  ll l[200];
  
  cin>>n;
  rep(i,n)cin>>l[i];
  
  ll ans=0;
  
  rep(i,n){
    rep2(j,i,n){
      rep2(k,j,n){
        if(l[i]==l[j]){}
        else if(l[j]==l[k]){}
        else if(l[k]==l[i]){}
        else{
          ll l_m=max(max(l[i],l[j]),l[k]);
          if(l_m<l[i]+l[j]+l[k]-l_m)ans++;
        }
      }
    }
  }
  
  cout<<ans;
  
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0 ; i < n; i++){
    cin >> a[i];
    if (a[i] == 0){
      cout << 0 << endl;
      return 0;        
    }
  }
  ll ans = 1;
  float ansf = 1;
  for (int i = 0; i < n ; i++){
    ans *= a[i];
    ansf *= a[i];
    if (ansf > 1000000000000000000 || ans > 1000000000000000000){
      cout << -1 << endl;
      return 0;
    }
  }  
  cout << ans << endl;
}


Measured memory_bytes: 4040
import copy
from collections import deque
N, M = map(int, input().split())
edge = [[] for _ in range(N)]
ab = []
answer = 0
for _ in range(M):
    a, b = map(int, input().split())
    ab.append((a-1, b-1))
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
# print(edge[0])
# print(ab)
for a, b in ab:
    lost_edge = copy.deepcopy(edge)
    # print(lost_edge)
    # print(a, b, edge)
    lost_edge[a].remove(b)
    lost_edge[b].remove(a)
    # print(lost_edge)

    seen = [0] * N
    seen[0] = 1
    todo = deque([0])
    while todo:
        cur_v = todo.pop()
        seen[cur_v] = 1
        for next_v in lost_edge[cur_v]:
            if not seen[next_v]:
                todo.append(next_v)
        # print(todo)
        # print(seen)
    if 0 in seen:
        answer += 1

print(answer)

Measured memory_bytes: 3444
#include <stdio.h>
#include <string.h>
#include <math.h>

#define LINE_BUF_SIZE 256

int main(){

    int A,B,C;
    char line[LINE_BUF_SIZE];

    fgets(line,sizeof(line),stdin);
    sscanf(line,"%d %d %d", &A,&B,&C);

    if(A+B >= C){

        printf("Yes");

        return 0;
    }

    printf("No");

    return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    // cout << fixed << setprecision(10) << flush;

    int n;
    cin >> n;
    int ans = 0;
    for(int i=2; i*i<=n; i++){
        int ci = 0;
        while(n % i == 0){
            n /= i;
            ci++;
        }
        if(ci != 0){
            int tri = (-1.0 + sqrt(1.0+8.0*(ci+0.01)))/2.0;
            ans += tri;
        }
    }
    if(n != 1){
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define RS resize
#define CLR clear
#define PB push_back
#define ALL(x) (x).begin(), (x).end()
#define LLI long long int
using namespace std;
template <typename T> using V = vector<T>;
template <typename T, typename U> using P = pair<T,U>;
template <typename T, typename U> P<T,U> operator+(const P<T,U> &a, const P<T,U> &b){return {a.first + b.first, a.second + b.second};}
template <typename T, typename U> P<T,U> operator-(const P<T,U> &a, const P<T,U> &b){return {a.first - b.first, a.second - b.second};}
template <typename T> void cout_join(vector<T> &v,string d=" "){REP(i,v.size()){if(i>0)cout<<d;cout<<v[i];}cout<<endl;}

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

  int x,y; cin >> x >> y;
  cout << x + y/2 << endl;

  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T>
bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for(int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T>
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);
    }
};
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<string> c(h);
    queue<P> q;
    vector<vector<int>> d(h, vector<int>(w, INF));
    for(int i = 0; i < h; i++) {
        cin >> c[i];
        for(int j = 0; j < w; j++) {
            if(c[i][j] == '#') {
                q.push(P(i, j));
                d[i][j] = 0;
            }
        }
    }
    while(!q.empty()) {
        P p = q.front();
        q.pop();
        int y = p.first, x = p.second;
        for(int i = 0; i < 4; i++) {
            int ny = y + dy[i], nx = x + dx[i];
            if(ny < 0 || nx < 0 || ny >= h || nx >= w) {
                continue;
            }
            if(d[ny][nx] <= d[y][x] + 1) {
                continue;
            }
            d[ny][nx] = d[y][x] + 1;
            q.push(P(ny, nx));
        }
    }
    int ans = -INF;
    for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            chmax(ans, d[i][j]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 21684
N = gets.to_i
arr = gets.split.map(&:to_i)

def judge(arrays)
arrays.each do |array|
if array.odd? == true then
  return false
end
end
  return true
end

count = 0
while true do
if judge(arr) == true
  count += 1
  arr = arr.map do |i|
    i / 2
  end
else
  p count
  break
end
end

Measured memory_bytes: 1788
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();
    	Map<Long, Long> shop = new HashMap<>();
    	for (int i = 0; i < N; i++) {
    		long cost = sc.nextInt();
    		long count = sc.nextInt();
    		if (shop.containsKey(cost)) {
    			shop.put(cost, shop.get(cost) + count);
    		} else {
    			shop.put(cost, count);
    		}
    	}
    	List<Long> key = new ArrayList<>(shop.keySet());
    	Collections.sort(key);
    	long rem = M;
    	long totalCost = 0;
    	for (int i = 0; i < key.size(); i++) {
    		long cost = key.get(i);
    		long count = shop.get(cost);
    		if (count < rem) {
    			rem -= count;
    			totalCost += count * cost;
    		} else {
    			totalCost += rem * cost;
    			break;
    		}
    	}
    	System.out.println(totalCost);
    }
}


Measured memory_bytes: 100724
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll n;
  cin >> n;
  set <string> s;
  rep(i, n) {
    string str;
    cin >> str;
    s.insert(str);
  }
  cout << s.size() << endl;
}

Measured memory_bytes: 19072
from collections import deque

N = int(input())
A = [int(input()) for _ in range(N)]

A.sort()
array = deque([A[0]])
a_len = 1
count = 0
idx = 0
result1 = 0

while a_len < N:
    if count % 2 == 0:
        array.appendleft(A[-idx-1])
        array.append(A[-idx-2])
    else:
        array.appendleft(A[idx+1])
        array.append(A[idx+2])
        idx += 2
    count += 1
    a_len += 2

for i in range(N-1):
    result1 += abs(array[i] - array[i+1])

array = deque([A[-1]])
a_len = 1
count = 0
idx = 0
result2 = 0

while a_len < N:
    if count % 2 != 0:
        array.appendleft(A[-idx])
        array.append(A[-idx-1])
    else:
        array.appendleft(A[idx])
        array.append(A[idx+1])
        idx += 2
    count += 1
    a_len += 2

for i in range(N-1):
    result2 += abs(array[i] - array[i+1])

print(max(result1, result2))

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

int main()
{
	int N,D,i,j,k,ans=0;
	double dis;
	cin>>N>>D;
	int X[N][D];
	for(i=0;i<N;i++){
		for(j=0;j<D;j++){
			cin>>X[i][j];
		}
	}
	for(i=0;i<N-1;i++){
		for(k=i+1;k<N;k++){
			dis=0;
			for(j=0;j<D;j++){
				dis+=(X[i][j]-X[k][j])*(X[i][j]-X[k][j]);
			}
			dis=sqrt(dis);
			if(ceil(dis)==floor(dis)){
				ans++;
			}
		}
	}
	cout<<ans;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>

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

using namespace std;

int main() {

	int a, b, h;
	cin >> a >> b >> h;
	cout << (a + b)*h/2 << endl;
	






	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<set>
#define ll long long
using namespace std;
double a[1000000]={0};
int main(){
    int t;
    cin>>t;
    string s;
    cin >>s;
    if(t>=3200)
        cout<<s<<endl;
    else if(t<3200)
        cout<<"red"<<endl;
     return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    double  r,a,b;
    scanf("%lf",&r);
    a = r * r * 3.141592653589;
    b = r * 2 * 3.141592653589;
    printf("%lf %lf\n",a,b);
    return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) int((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;
typedef vector<int> V;
typedef vector<vector<int>> VV;
typedef pair<int, int> P;
typedef map<string, int> M;
typedef unordered_map<int, int> HM;
typedef set<int> S;
typedef multiset<int> MS;
typedef queue<int> Q;

int main(){
    int n,a,b; cin>>n>>a>>b;
    OUT(min(n*a, b));
}

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

int main(){
    string s;
    cin >> s;
    vector<int> x(4);
    rep(i, 4) x[i] = s[i] - '0';
    if(x[0] + x[1] + x[2] + x[3] == 7){
        printf("%d+%d+%d+%d=7", x[0], x[1], x[2], x[3]);
    }else if(x[0] + x[1] + x[2] - x[3] == 7){
        printf("%d+%d+%d-%d=7", x[0], x[1], x[2], x[3]);
    }else if(x[0] + x[1] - x[2] + x[3] == 7){
        printf("%d+%d-%d+%d=7", x[0], x[1], x[2], x[3]);
    }else if(x[0] + x[1] - x[2] - x[3] == 7){
        printf("%d+%d-%d-%d=7", x[0], x[1], x[2], x[3]);
    }else if(x[0] - x[1] + x[2] + x[3] == 7){
        printf("%d-%d+%d+%d=7", x[0], x[1], x[2], x[3]);
    }else if(x[0] - x[1] + x[2] - x[3] == 7){
        printf("%d-%d+%d-%d=7", x[0], x[1], x[2], x[3]);
    }else if(x[0] - x[1] - x[2] + x[3] == 7){
        printf("%d-%d-%d+%d=7", x[0], x[1], x[2], x[3]);
    }else if(x[0] - x[1] - x[2] - x[3] == 7){
        printf("%d-%d-%d-%d=7", x[0], x[1], x[2], x[3]);
    }
    cout << endl;

    return 0;
}

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

int main() {
  int x,a=1,b;
  cin >> x;
  while(a*a*a*a*a <= x){
    for(b=0;b<=a;b++){
      if(b*b*b*b*b == x - a*a*a*a*a){
        cout << a << " " << -b << endl; return 0;
      }
    }
    a++;
  }
  a=1;
  while(a){
    for(b=0;b<=a;b++){
      if(b*b*b*b*b == a*a*a*a*a - x){
        cout << a << " " << b << endl; return 0;
      }
    }
    a++;
  }
}


Measured memory_bytes: 3636
from collections import deque
H, W = map(int, input().split())
maze = []
b = 0
for h in range(H):
    tmp = list(input())
    maze.append(tmp)
    for x in tmp:
        if x == ".":
            b += 1
sx, sy = 0, 0
gx, gy = W-1, H-1
dist = [[-1 for y in range(W)] for x in range(H)]
dist[sy][sx] = 0
que = deque([[sy, sx]])
while len(que) > 0:
    y, x = que.popleft()
    if y == gy and x == gx:
        break
    for n in range(4):
        ny, nx = y+[0,0,-1,1][n], x+[1,-1,0,0][n]
        if nx >= 0 and nx < W and ny >= 0 and ny < H and dist[ny][nx] == -1:
            if maze[ny][nx] == ".":
                dist[ny][nx] = dist[y][x] + 1
                que.append([ny, nx])
if dist[gy][gx] == -1:
    print(-1)
else:
    print(b-1-dist[gy][gx])


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrep(i,a,b) for(int i=(int)(a);i>=(int)(b);--i)
#define fore(i,a) for(auto &i:a)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define isin(i,a,b) ((a) <= (i) && (i) < (b))
#define uni(a) (a).erase(unique(all(a)),(a).end())
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll  = long long;
using unit= unsigned;
using ull = unsigned long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vvi = vector<vi>;
using vp  = vector<P>;
void _main(); int main(){ cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T>void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T>void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T>void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T>void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T>bool chmax(T &a, const T &b){ if (a<b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if (b<a){ a = b; return 1; } return 0; }
template<class T>T gcd(T a, T b){ if (b==0){ return a; }else{ return gcd(b, a%b); }}
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
constexpr double eps = 1e-10;
constexpr int inf = INT_MAX / 2;
constexpr ll infl = 1LL << 60;

void _main() {
  int N, L;
  cin >> N >> L;

  int ans = 0;
  if isin(0, L, L+N) {
    rep(i, L, L+N) ans += i;
  } else if (L > 0) {
    ans = (N+L-1)*(N+L)/2 - L*(L+1)/2;
  } else {
    rep(i, L, L+N-1) ans += i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

template<typename T>
class SegmentTree{
    int n;
    int realsize;
    T initialvalue;
    vector<T> tree;

    public:
    
    SegmentTree(int size,T initial):realsize(size),initialvalue(initial){
        n = 1;
        while(n < size)n *= 2;

        tree = vector<T>(2*n + 1,initial);
    }

    //1-indexed
    void insert(int i,T data){
        int ind = n+i-1;
        tree[ind] = data;
        ind >>= 1;
        while(ind > 0){
            tree[ind] = tree[ind*2] + tree[ind*2+1];
            ind >>= 1;
        }
    }

    void add(int i,T data){
        int ind = n+i-1;
        tree[ind] += data;
        ind >>= 1;
        while(ind > 0){
            tree[ind] = tree[ind*2] + tree[ind*2+1];
            ind >>= 1;
        }
    }

    T get(int l,int r){
        if(l > realsize || r > realsize || l <= 0 || r <= 0)return initialvalue;
        l = n+l-1;
        r = n+r-1;
        if(l == r)return tree[l];
        int prel = l;
        int prer = r;
        T lnum = tree[l];
        T rnum = tree[r];
        l >>= 1;
        r >>= 1;
        while(l != r){
            if(l*2 == prel){
                lnum += tree[l*2+1];
            }
            if(r*2+1 == prer){
                rnum += tree[r*2];
            }
            prel = l;
            prer = r;
            l >>= 1;
            r >>= 1;
        }
        return lnum+rnum;
    }
};

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

    LL n,k;
    cin >> n >> k;
    vector<LL> a(n+1);
    for(LL i = 1; i < n+1; i++){
        cin >> a[i];
    }

    vector<LL> sum(n+1,0);
    for(LL i = 1; i < n+1; i++){
        sum[i] += sum[i-1] + a[i] - k;
    }

    vector<LL> cpy = sum;
    sort(sum.begin(),sum.end());

    SegmentTree<LL> st(sum.size(),0);
    st.add(lower_bound(sum.begin(),sum.end(),0) - sum.begin() + 1,1);
    
    LL ans = 0;
    for(LL i = 1; i < n+1; i++){
        auto itr = lower_bound(sum.begin(),sum.end(),cpy[i-1]);
        ans += sum.end() - itr;
        ans -= st.get(itr - sum.begin() + 1,sum.size());

        auto itr2 = lower_bound(sum.begin(),sum.end(),cpy[i]);
        st.add(itr2 - sum.begin() + 1,1);
    }

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 9088
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define deb(x) cout << #x << " is " << x << "\n";

using namespace std;
using namespace __gnu_pbds;

const double PI = 2 * acos(0.0);
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int x, y, z;
    cin >>x >>y >>z;
    if((x + y + z) >= 22)
        cout <<"bust";
    else 
        cout <<"win";
    return 0;
}

Measured memory_bytes: 256
taka_l, taka_a, ao_l, ao_a = map(int, input().split())
con = 0

while True:
  if con % 2 == 0:
    ao_l -= taka_a
    if ao_l <= 0:
      print("Yes")
      break
    con += 1
  if con % 2 != 0:
    taka_l -= ao_a
    if taka_l <= 0:
      print("No")
      break
    con += 1



Measured memory_bytes: 9128
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef __int128 lll;
constexpr ll mod = 1000000007;

int main() {
    int n,m,x,y,c[100001],p[100001];
    for(int i = 0;i < 100001;i++) {
        c[i] = 1;
        p[i] = 0;
    }
    p[1] = 1;
    cin >> n >> m;
    for(int i = 0;i < m;i++) {
        cin >> x >> y;
        if(p[x]) {
            p[y]++;
            if(c[x] == 1) p[x] = 0;
        }
        c[x]--;
        c[y]++;
    }
    int r = 0;
    for(auto e:p) if(e) r++;
    cout << r << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define itrep(it, a) for(it = (a).begin(); it != (a).end; it++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
#define INF (1 << 30)
using namespace std;

typedef struct {
    double x, y;
}point;

double AreaOfTriangle(point a, point b, point c){
    b.x-=a.x;
    b.y-=a.y;
    c.x-=a.x;
    c.y-=a.y;
    return abs((b.x * c.y - b.y * c.x) / 2);
}

int main(){
    point point[22];
    int i = 0, second = 0, third = 1;
    double ans = 0;
    char g;
    while(cin >> point[i].x >> g >> point[i].y) i++;
    rep(j,i - 2){
        if(second < third) second+=2;
        else third+=2;
        ans+=AreaOfTriangle(point[0], point[second], point[third]);
    }
    printf("%.6lf\n",ans);
}

Measured memory_bytes: 1240
// AOJ Volume0 0095

#include <stdio.h>

int main(void)
{
    int n, a, v;
    int a_win, v_win;
    int i;
    
    scanf("%d", &n);
    
    a_win = 0;
    v_win = -1;
    
    for (i = 0; i < n; i++){
        scanf("%d%d", &a, &v);
        if (v > v_win){
            v_win = v;
            a_win = a;
        }
        else if ((v == v_win) && (a < a_win)){
            a_win = a;
        }
    }
    printf("%d %d\n", a_win, v_win);
    
    return (0);
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll const mod=1000000007;
ll const md=998244353;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0);
for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ifstream in("txt.in");
ofstream out("txt.out");

#define mp make_pair
#define pb push_back
#define fi first
#define se second

int f[100005][5];
int dp[100005][5];

int main()
{
    cout<<fixed<<setprecision(12);
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cout.tie(0);

    ll n;cin>>n;
    for(int i=1;i<=n;++i){
        for(int j=1;j<=3;++j){
            cin>>f[i][j];
        }
    }
    dp[1][1]=f[1][1];
    dp[1][2]=f[1][2];
    dp[1][3]=f[1][3];
    for(int i=2;i<=n;++i){
        for(int j=1;j<=3;++j){
            if(j==1)dp[i][j]=max(dp[i-1][2],dp[i-1][3])+f[i][j];
            if(j==2)dp[i][j]=max(dp[i-1][1],dp[i-1][3])+f[i][j];
            if(j==3)dp[i][j]=max(dp[i-1][2],dp[i-1][1])+f[i][j];
        }
    }
    cout<<max({dp[n][1],dp[n][2],dp[n][3]});


    return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

int main() {
  int N, M;
  cin >> N >> M;
  int a[N], b[N];
  vector<P> ab;
  for (int i = 0; i < N; i++) {
    cin >> a[i] >> b[i];
    ab.push_back(P(a[i], b[i]));
  }
  
  sort(ab.begin(), ab.end());
  int num = 0;
  int ans = 0;
  priority_queue<P> que;
  
  for (int A = 1; A <= M; A++) {
    while (ab[num].first <= A && num < N) {
      que.push(P(ab[num].second, ab[num].first));
      num++;
    }
    if (!que.empty()) {
      P p = que.top();
      ans += p.first;
      que.pop();
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
using namespace std;
long long a[4];
void solve()
{
    sort(a,a+1);
    sort(a+2,a+3);
    if (a[0]>=0&&a[1]>=0&&a[2]>=0&&a[3]>=0)
    {
        cout<<a[1]*a[3];
    }
    else if (a[0]>=0&&a[1]>=0&&a[2]>=0&&a[3]<=0)
    {
        
    }
    else if (a[0]>=0&&a[1]>=0&&a[2]<=0&&a[3]>=0)
    {
        cout<<a[1]*a[3];
    }
    else if (a[0]>=0&&a[1]>=0&&a[2]<=0&&a[3]<=0)
    {
        cout<<a[0]*a[3];
    }
    else if (a[0]>=0&&a[1]<=0&&a[2]>=0&&a[3]>=0)
    {
        
    }
    else if (a[0]>=0&&a[1]<=0&&a[2]>=0&&a[3]<=0)
    {
        
    }
    else if (a[0]>=0&&a[1]<=0&&a[2]<=0&&a[3]>=0)
    {
        
    }
    else if (a[0]>=0&&a[1]<=0&&a[2]<=0&&a[3]<=0)
    {
        
    }
    else if (a[0]<=0&&a[1]>=0&&a[2]>=0&&a[3]>=0)
    {
        cout<<a[1]*a[3];
    }
    else if (a[0]<=0&&a[1]>=0&&a[2]>=0&&a[3]<=0)
    {
            
    }
    else if (a[0]<=0&&a[1]>=0&&a[2]<=0&&a[3]>=0)
    {
        cout<<max(a[0]*a[2],a[1]*a[3]);
    }
    else if (a[0]<=0&&a[1]>=0&&a[2]<=0&&a[3]<=0)
    {
        cout<<a[0]*a[2];
    }
    else if (a[0]<=0&&a[1]<=0&&a[2]>=0&&a[3]>=0)
    {
        cout<<a[1]*a[2];
    }
    else if (a[0]<=0&&a[1]<=0&&a[2]>=0&&a[3]<=0)
    {
        
    }
    else if (a[0]<=0&&a[1]<=0&&a[2]<=0&&a[3]>=0)
    {
        cout<<a[0]*a[2];
    }
    else if (a[0]<=0&&a[1]<=0&&a[2]<=0&&a[3]<=0)
    {
        cout<<a[0]*a[2];    
    }
    cout<<endl;
}
int main()
{
    while(cin>>a[0]>>a[1]>>a[2]>>a[3])
        solve();
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;

  int L, R, d, count = 0;
  cin >> L >> R >> d;
  for(int i = L; i <= R; i++){
    if(i % d == 0){
      count++;
    }
  }
  cout << count <<endl;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed
#define endl '\n'

const ll MOD = 1e9 + 7;
struct mint {
    ll x;
    mint() : x(0) {}
    mint(ll x) : x((x % MOD + MOD) % MOD) {}
    mint& operator+=(const mint& r) { if ((x += r.x) >= MOD) { x -= MOD; } return *this; }
    mint& operator-=(const mint& r) { if ((x -= r.x) < 0) { x += MOD; } return *this; }
    mint& operator*=(const mint& r) { if ((x *= r.x) > MOD) { x %= MOD; } return *this; }
    mint& operator++() { if ((++x) >= MOD) { x -= MOD; } return *this; }
    mint operator++(int) { mint ret = x; if ((++x) >= MOD) { x-= MOD; } return ret; }
    mint& operator--() { if ((--x) < 0) { x += MOD; } return *this; }
    mint operator--(int) { mint ret = x; if ((--x) < 0) { x += MOD; } return ret; }
    mint operator+(const mint& r) { mint ret; return ret = x + r.x; }
    mint operator-(const mint& r) { mint ret; return ret = x - r.x; }
    mint operator*(const mint& r) { mint ret; return ret = x * r.x; }
    mint operator-() { return mint() - *this; }
    bool operator<(const mint& a) { return x < a.x; }
    bool operator>(const mint& a) { return x > a.x; }
    bool operator<=(const mint& a) { return x <= a.x; }
    bool operator>=(const mint& a) { return x >= a.x; }
    bool operator==(const mint& a) { return x == a.x; }
    bool operator!=(const mint& a) { return x != a.x; }
};
ostream& operator<<(ostream& os, const mint& r) { os << r.x; return os; }
ostream& operator>>(ostream& os, const mint& r) { os >> r.x; return os; }

void solve(istream& cin, ostream& cout) {
  int n;
  string s, t;
  cin >> n >> s >> t;
  REP(i, n) {
    cout << s[i] << t[i];
  }
  cout << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
}
#endif


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

typedef map<string, int> M;
typedef M::value_type MV;
int main()
{
    M word_counts;
    string max_letters = "";

    for (string s; cin >> s;) {
        if (s.size() > max_letters.size())
            max_letters = s;
        word_counts[s]++;
    }
    cout << (*max_element(word_counts.begin(), word_counts.end(),
                          [](MV &a, MV &b){return a.second < b.second;})).first
        << " " << max_letters << endl;

    return 0;
}

Measured memory_bytes: 1196
S = input()
n = len(S)

for i in range(1<<(n-1)):
    sum = int(S[0])
    eq = S[0]
    for j in range(n-1):
        if (i>>j) & 1:
            sum += int(S[j+1])
            eq += "+"
            eq += S[j+1]
        else:
            sum -= int(S[j+1])
            eq += "-"
            eq += S[j+1]
    if sum==7:
        print(eq+"=7")
        break


Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define ll long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010
 
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int abs(int a){if(a<0)return -a;return a;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}

void swapl(ll* a,ll* b){ll tmp=*a;*a=*b;*b=tmp;}
ll absl(ll a){if(a<0)return -a;return a;}
ll dupl(ll a,ll d){if(a%d==0)return a/d;else return a/d+1;}
ll modl(ll a,ll m){if(a<0)return a%m+m;else return a%m;}

ll GCD(ll a,ll b){ll c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
ll LCM(ll a,ll b){return a*b/GCD(a,b);}

ll factorial(ll n, ll m) {return n < m ? 1 : n*factorial(n-1, m);}

int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

// ll dp[200*200*200];

int main(){
  ll K;
  ll sum=0;
  
  scanf("%lld", &K);
  

  for (ll i = 1; i <= K; i++)
  {
      for (ll j = i; j <= K; j++)
      {
          for (ll k = j; k <= K; k++)
          {
              if(i == j && j == k) sum += i;
              else if (i == j || j== k) sum += 3 * GCD(GCD(i, j), k);
              else sum += 6*GCD(GCD(i, j), k);
          }
          
      }
  }
  printf("%lld\n", sum);
  
  return 0;
}

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

using namespace std;

int main(){

 string s1;
 
 cin >> s1;

  char a, b;
  a = s1[s1.size()-1];
  b = 's';
   
  if( a == b ){
  cout << s1 << "es" << endl;
  }
  else{
  cout << s1 << "s" << endl;
  }
  
 return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#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)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
const ld PI=3.141592;
int main(){
    ld r;cin>>r;
    cout<<fixed<<setprecision(10);
    cout<<2*r*PI<<endl;
    return 0;
}


Measured memory_bytes: 3788