akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    ll W;
    cin>>W;
    vector<ll> v(n),w(n);
    rep(i,n) cin>>v[i]>>w[i];
    int m=n/2;
    vector<P> cnt;
    rep(i,1<<m){
      ll sw=0,sv=0;
      rep(j,m){
        if(i&(1<<j)) sw+=w[j],sv+=v[j];
      }
      cnt.push_back(P(sw,sv));
    }
    sort(begin(cnt),end(cnt));
    ll k=1;
    FOR(i,1,1<<m){
      if(cnt[k-1].second<cnt[i].second){
        cnt[k++]=cnt[i];
      }
    }
    ll inf=1e16;
    ll ans=0;
    rep(i,1<<(n-m)){
      ll sw=0,sv=0;
      rep(j,n-m){
        if(i&(1<<j)){
          sw+=w[m+j];
          sv+=v[m+j];
        }
      }
      if(sw<=W){
        ll tv=(lower_bound(begin(cnt),begin(cnt)+k,P(W-sw,inf))-1)->second;
        ans=max(ans,sv+tv);
      }
    }
    cout<<ans<<endl;
}


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

using System.Collections;

class Program
{
    static void Main()
    {
        int[] ab = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        Console.WriteLine((ab[0] - 1) * (ab[1] - 1));
        

    }
}



static class MathUtil
{
    public static IEnumerable<IEnumerable<int>> GetPermutation(int n)
    {
        if (n == 0)
        {
            yield return Single(0);
            yield break;
        }

        for (int i = 0; i <= n; i++)
        {
            foreach (var x in GetPermutation(n - 1))
            {
                yield return Single(i).Concat(x.Select(itm => itm < i ? itm : itm + 1));
            }
        }
    }

    private static IEnumerable<int> Single(int x)
    {
        yield return x;
    }

    public static IEnumerable<int> EnumeratePrimeNumbers()
    {
        List<int> primes = new List<int>() { 2 };
        yield return 2;

        for (int i = 3; i < int.MaxValue; i++)
        {
            bool isPrime = true;
            int Sqrt = (int)Math.Sqrt(i) + 1;

            foreach (var prime in primes)
            {
                if (prime > Sqrt)
                {
                    break;
                }
                if (i % prime == 0)
                {
                    isPrime = false;
                    break;
                }
            }

            if (isPrime)
            {
                primes.Add(i);
                yield return i;
            }
        }
    }
}


Measured memory_bytes: 13268
// https://atcoder.jp/contests/abc175/tasks/abc175_c
#include <iostream>
#include <vector>
#include <deque>
#include <tuple>
#include <algorithm>
#include <iterator> // std::back_inserter

using namespace std;

int main()
{
    long long x, k, d;

    cin >> x >> k >> d;
    x = abs(x);
    long long mod = x % d;
    long long div = x / d;
    long long a = x - mod;
    if (k < x / d)
    {
        cout << x - (d * k) << endl;
    }
    else if ((k - div) % 2 == 0)
    {
        cout << x - a << endl;
    }
    else
    {
        cout << d - (x - a) << endl;
    }
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int n,m,dp[202020],now[202020];
vector<int>g[202020];
queue<int>tuopuxu;
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int x,y;
		cin>>x>>y;
		x--;
		y--;
		g[x].push_back(y);
		now[y]++;
	}
	for(int i=0;i<n;i++)
	{
		if(!now[i])
		{
			tuopuxu.push(i);
		}
	}
	while(tuopuxu.size())
	{
        int i=tuopuxu.front();
        tuopuxu.pop();
        for(int j=0;j<g[i].size();j++)
		{
            dp[g[i][j]]=max(dp[i]+1,dp[g[i][j]]);
            now[g[i][j]]--;
            if(!now[g[i][j]])
			{
				tuopuxu.push(g[i][j]);
			}
        }
    }
	int ans=0;
	for(int i=0;i<n;i++)
	{
		ans=max(ans,dp[i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 9472
import sys
import math
input = lambda:sys.stdin.readline().strip()
n,m = map(int,input().split())
k = 0
j = 0
for i in range(m):
    if n%2==0 and ((n-j)-(i+1))*2<=n and k==0:
        j+=1
        k+=1
    print(i+1,n-j)
    j+=1

Measured memory_bytes: 9208
#include<bits/stdc++.h>
#define ll long long
#define lLimit 1000000000000000000
#define testfor(T) ll T; cin>>T; while(T--)
using namespace std;
void quickstart()
{
	ios_base::sync_with_stdio(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
}
ll a [100010];
int main()
{
	quickstart();
	int n;
	ll  product = 1;
	int zeros=0;
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		if(a[i]==0) zeros+=1;
	}
	if(zeros){
		cout<<"0"<<endl;
		return 0;
	}
	for (int i = 0; i < n; i++)
	{
		if (a[i] <= lLimit / product) {
			product *= a[i];
		} else {
			product = -1;
			cout << product;
			return 0;
		}
	}
	cout << product << endl;
	return 0;
}

Measured memory_bytes: 4444
#include<bits/stdc++.h>
#define x first
#define y second
#pragma GCC optimize(2)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize(3)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("sse3","sse2","sse")
#pragma GCC target("avx","sse4","sse4.1","sse4.2","ssse3")
#pragma GCC target("f16c")
#pragma GCC optimize("inline","fast-math","unroll-loops","no-stack-protector")
#pragma GCC diagnostic error "-fwhole-program"
#pragma GCC diagnostic error "-fcse-skip-blocks"
#pragma GCC diagnostic error "-funsafe-loop-optimizations"
#pragma GCC diagnostic error "-std=c++14"
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef long long LL;
const int N=10010;
const int M=150;
const int INF=0x3f3f3f3f;
const int MOD=998244353;
const double PI=3.1415926;
int main(){
    IOS;
    int r;cin>>r;
    cout<<PI*2*r<<endl;
    return 0;
}


Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;scanf("%d",&N);
    int K=N;
    map<int,int> a;
    for(int i=2;i<sqrt(N)+3;i++){
        while(K%i==0){
            a[i]++;
            K/=i;
        }
    }
    if(K!=1)a[K]++;
    printf("%d%s",N,":");
    for(auto p:a){
        for(int i=0;i<p.second;i++){
            printf(" %d",p.first);
        }
    }
    printf("\n");
}


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

int Ex_Euclid(int a, int b, int &x, int &y)
{
	if(b==0)
	{
		x=1;
		y=0;
	}
	else
	{
		Ex_Euclid(b,a%b,y,x);
		y-=(a/b)*x;
	}
}

int main()
{
	int a,b,x,y;
    
	cin >> a >> b;
	
	Ex_Euclid(a,b,x,y);
	cout << x << " " << y << endl;
	
	return 0;
}

Measured memory_bytes: 3096
h,w = map(int,input().split())
a=[list(input()) for i in range(h)]
b=[]
dl=[]
for i in a:
  if "#" in i:
    b.append(i)
for j in range(w):
  for i in range(len(b)):
    if b[i][j] == "#":
      break
    elif i == len(b)-1:
      dl.append(j)
dl.sort(reverse=True)
for i in dl:
  for j in range(len(b)):
    del b[j][i]
for c in b:
  print(*c,sep="")

Measured memory_bytes: 4596
#include <stdio.h>

int main(void){
    int K,i,j,n;
    n=0;
    
    scanf("%d",&K);
    
    for(i=1; i<=K; i++){
        for(j=i; j<=K; j++){
            if((i+j)%2==1)
                n++;
        }        
    }
    printf("%d\n",n);
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
using ll = long long;

int main(){
    ll a=0,b=0,c=0,d=0,e,l,m,n,o=0,p,q,x,y,z,max1=0,ans,r,g;
    string t,u;
    
    cin>>n;
    
    cout<<(n-2)*180<<endl;
}




Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define double long double
const int maxn =2e5+10;
const int mod=1e9+7;
map<ll,ll>mp;
ll check(ll x)
{
    for(ll i=2;i*i<=x;i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin>>n;
	ll cnt=0;
	for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0&&check(i))
        {
            if(mp[i]==0)
            {
                mp[i]++;
                cnt++;
                n/=i;
            }
            ll x=1;
            while(n%i==0)
            {
                x*=i;
                if(mp[x]==0)
                {
                    cnt++;
                    mp[x]++;
                    x=1;
                }
                n/=i;
            }
        }
    }
    if(n>1)
        cnt++;
    cout<<cnt<<'\n';






}


Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}
void solve(){
	ll x;
	cin>>x;
	ll g=gcd(360,x);
	ll lcm=360ll*x/g;
	ll ans=lcm/x;
	cout<<ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

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


int main () {
    int N,O,A;
    A=0, O=0;
    cin >> N;
    for (int j=1;j<=N;j+=2){
        for (int i=1;i<=j;i+=2){
            if (j%i==0)O++;
            }    
        if (O==8)A++;
        O=0;
    }

    cout << A << endl;
    return 0;
}

Measured memory_bytes: 256
def gcd(x,y):
    return gcd(y,x % y) if y > 0 else x

def lcm(a, b):
    return ((a*b) // gcd(a,b))

while(1):
    try:
        x,y = (int(x) for x in input().split())
        print(gcd(x,y),lcm(x,y))
    except:
        break


Measured memory_bytes: 5600
#include<iostream>
using namespace std;
int dd(int x){
	int y;
	y = x * x;
	return y;
}
int main(){
	int n;
	int a, b ,c;
	cin >> n;
	while(n > 0){
		cin >> a;
		cin >> b;
		cin >> c;
		if((dd(a) + dd(b) == dd(c)) || (dd(b) + dd(c) == dd(a)) || (dd(c) + dd(a) == dd(b))){
			cout << "YES\n";
		}else{
			cout << "NO\n";
		}
		n--;
	}
}

Measured memory_bytes: 1120
#include <stdio.h>

int main(int argc, char const *argv[]) {

    double r;
    double s,l;

    scanf("%lf", &r);

    l = 2 * r * 3.141592653589;
    s = r * r * 3.141592653589;

    printf("%.6lf %.6lf\n",s,l);

    return 0;
}



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

int main() {
    int n, k;
    cin >> n >> k;
    
    vector<int> p(n);
    rep(i,n) {
        cin >> p[i];
    }
    
    sort(p.begin(), p.end());
    
    int sum = 0;
    rep(i,k) {
        sum += p[i];
    }
    
    cout << sum << endl;
    
    return 0;
}




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

# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ;

# define ll long long
# define C continue;

# define pb push_back
# define vi vector < int >
# define vll vector < ll >

# define I insert

# define pii pair < int , int >
# define pll pair < ll , ll >
# define F first
# define S second

# define vpii vector < pair < int , int > >
# define vpll vector < pll >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()

# define ld long double
# define PQ priority_queue

# define vc vector < char >
# define vb vector < bool >
# define vs vector < string >

# define vvi vector < vector < int > >
# define vvll vector < vector < ll > >
# define vvc vector < vector < char > >
# define vvb vector < vector < bool > >

# define allcomp(v) v.begin() , v.end() , comp

# define pp(n) printf("%.10Lf",n);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;

/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .
/// Start using lower bound !!

void solve ( int test_case )
{
    ll a , v , b , w ;
    cin >> a >> v >> b >> w ;

    ll dis = abs ( a - b ) ;
    ll vel = v - w ;

    if ( dis == 0 ) { cout << "YES" ; line ; return ; }
    if ( vel < 0 ) { cout << "NO" ; line ; return ; }

    ll t ;
    cin >> t ;

    if ( vel * t >= dis )
        cout << "YES" ;

    else cout << "NO" ;

    line ;
}

int main()
{
    int t = 1;
    // cin >> t;

    for ( int i = 1 ; i <= t ; i ++ )
    {
        solve ( i ) ;
    }

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> ts(n + 2), vs(n + 2);
  rep(i, n) cin >> ts[i + 1];
  rep(i, n) cin >> vs[i + 1];
  for (int i = 1; i <= n; i++) {
    vs[i] = min(vs[i], vs[i - 1] + ts[i]);
  }
  for (int i = n; i >= 1; i--) {
    vs[i] = min(vs[i], vs[i + 1] + ts[i]);
  }
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    double t = ts[i], d1 = vs[i] - vs[i - 1], d2 = vs[i] - vs[i + 1];
    if (d1 > 0 && d2 > 0 && d1 + d2 > t) {
      double vl = min(vs[i - 1], vs[i + 1]), vd = vl + t - max(vs[i - 1], vs[i + 1]);
      ans += (vl * 2 + t) * t / 2 - vd * vd / 4;
    } else {
      ans += vs[i] * ts[i];
      if (d1 > 0) ans -= d1 * d1 / 2;
      if (d2 > 0) ans -= d2 * d2 / 2;
    }
  }
  cout << setprecision(20) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A;
  int B;
	cin >> A;
    cin >> B;
  if(A+B>A-B){
    if(A+B>A*B){
		cout << A+B << endl;

    }else{
		cout << A*B << endl;

    }
  }else{
    if(A-B>A*B){
		cout << A-B << endl;

    }else{
		cout << A*B << endl;

    }
  }
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
import numpy as np
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

"""
lim = 2*10**5   #必要そうな階乗の限界を入力

#階乗#
fact = [1] * (lim+1)
for n in range(1, lim+1):
	fact[n] = n * fact[n-1] % mod

#階乗の逆元#
fact_inv = [1]*(lim+1)
fact_inv[lim] = pow(fact[lim], mod-2, mod)
for n in range(lim, 0, -1):
	fact_inv[n-1] = n*fact_inv[n]%mod

def C(n, r):
	return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod

"""

N, K = MAP()
D = LIST()

while 1:
	if set(list(str(N))) & set(D) == set():
		print(N)
		break
	N += 1

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

int main() {
	int n,k,a[1000];
	cin >> n>>k;
	for(int i=0; i<n; i++) cin>>a[i];
	sort(a, a+n);
	int sum=0;
	for(int i=0; i<k; i++) sum+=a[i];
	cout<<sum;
	return 0;
}

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

using namespace std;

#define p 1000000007LL

long long power(long long x, long long y) {
    long long res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res%p;
}

long long gcdExtended(long long a, long long b, long long *x, long long *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    long long x1, y1; // To store results of recursive call
    long long gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

long long modInverse(long long b)
{
    long long x, y; // used in extended GCD algorithm
    long long g = gcdExtended(b, p, &x, &y);

    // Return -1 if b and m are not co-prime
    if (g != 1)
        return -1;

    // m is added to handle negative x
    return (x%p + p) % p;
}

// a/b
long long mod_divide(long long a, long long b) {
   a = a % p;
   long long inv = modInverse(b);
   return (inv * a) % p;
}

// a*b
long long mulmod(long long a, long long b) {
   long long res = 0;
   a = a % p;
   while (b > 0) {
      if (b % 2 == 1) {
         res = (res + a) % p;
      }
      a = (a*2)%p;
      b /= 2;
   }
   return res%p;
}

long long choose(long long n, long long b) {
   long long ans = 1;
   long long fact = 1;
   for (long long i = 0; i < b; ++i) {
      ans = mulmod(ans, n - i);;
      fact = mulmod(fact, i + 1);
   }
   return mod_divide(ans, fact);
}

int main() {
   long long n, a ,b;
   cin >> n >> a >> b;
   long long pow_2 = (power(2, n) - 1 + p)%p;
   long long choose_a = choose(n, a);
   long long choose_b = choose(n, b);
   long long rem = (choose_a + choose_b) % p;
   long long ans = (pow_2 - rem + p)%p;
   cout << ans << endl;
}


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

template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')
    cerr<<*sdbg++;
  cerr<<"="<<h<<","; 
  _dbg(sdbg+1, a...);
}

template<class T> ostream & operator<<(ostream & os, vector<T> V){
  os<<"[";
  for(auto vv: V) os << vv <<",";
  return os << "]";
}
template<class L, class R> ostream & operator <<(ostream & os, pair<L,R> P){
  return os <<"("<<P.st <<","<<P.nd <<")";
}

#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int MAXN = 2003;
int n, x, y;
int odl[MAXN];
bool vis[MAXN];
int ans[MAXN];

void bfs(int start) {
  for (int i = 1; i <= n; ++i) {
    odl[i] = 0;
    vis[i] = false;
  }
  queue<int> q;
  q.push(start);
  vis[start] = true;

  while (!q.empty()) {
    int w = q.front();
    q.pop();


    if (w < n && !vis[w + 1]) {
      vis[w + 1] = true;
      odl[w + 1] = odl[w] + 1;
      q.push(w + 1);
    }

    if (w > 1 && !vis[w - 1]) {
      vis[w - 1] = true;
      odl[w - 1] = odl[w] + 1;
      q.push(w - 1);
    }

    if (w == x && !vis[y]) {
      vis[y] = true;
      odl[y] = odl[x] + 1;
      q.push(y);
    }

    if (w == y && !vis[x]) {
      vis[x] = true;
      odl[x] = odl[y] + 1;
      q.push(x);
    }
  }
  for (int i = 1; i <= n; ++i) {
    ans[odl[i]]++;
  }
}

int main() {
  cin >> n >> x >> y;
  for (int i = 1; i <= n; ++i) {
    bfs(i);
  }

  for (int i = 1; i < n; ++i) {
    ans[i] /= 2;
    cout << ans[i] << endl;
  }

}


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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll ;

const ll inf = 1e18 + 17;
const int maxn = 1e3 + 10;
const int maxq = 1e2 + 10;
const int alf = 26;
const ll dlm = 1e9 + 7;
const int del = 998244353 ;
const int eps = 1e-7 ;

ll dp[maxn][maxn];
int mark[maxn][maxn];

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    ll R,C;
    cin>>R>>C;
    dp[1][1]=1;
    for(int i=1;i<=R;i++){
        for(int j=1;j<=C;j++){
            char f;
            cin>>f;
            if(f=='.')mark[i][j]=1;
        }
    }
    for(int i=1;i<=R;i++){
        for(int j=1;j<=C;j++){
            if(mark[i][j]==0)continue;
            if(mark[i-1][j]==1)dp[i][j]+=dp[i-1][j];
            if(mark[i][j-1]==1)dp[i][j]+=dp[i][j-1];
            dp[i][j]%=dlm;
        }
    }
    cout<<dp[R][C]<<endl;
    return 0;
}


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

int main() {
    int n ,ma,mi;
    mi=10000;
    ma=0;
    cin >>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a.at(i);
    }
    for(int i=0;i<n;i++){
        ma=max(ma,a[i]);
        mi=min(mi,a[i]);

    }
    cout << ma-mi << endl;
    return 0;
}

Measured memory_bytes: 256
exec({'RUBY_THREAD_VM_STACK_SIZE'=>'1000000000'}, '/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

N, Q = gets.split.map(&:to_i)
ABCDs = (N - 1).times.map{gets.split.map(&:to_i)}
XYUVs = Q.times.map{gets.split.map(&:to_i)}

@g = Array.new(N + 1){[]}
ABCDs.each{|a, b, c, d| @g[a] << [b, c, d]; @g[b] << [a, c, d]}

def euler_tour(x, d = 0, p = nil, acc = [])
  acc << [x, d]
  @g[x].each do |y, _, _|
    next if y == p
    acc = euler_tour(y, d + 1, x, acc)
    acc << [x, d]
  end
  acc
end

vds = euler_tour(1)
@tv, @td = vds.transpose
@v2i = @tv.map.with_index.to_h
@v2d = vds.to_h
l = @tv.length
u = l.bit_length
@sp = [[*0 ... l]]
(1 ... u).each do |i|
  ps = @sp[-1]
  w = 1 << (i - 1)
  n1 = ps[0 ... -w]
  n2 = ps[w .. -1]
  @sp << n1.zip(n2).map{|l, r| @td[l] < @td[r] ? l : r}
end

def lca(x, y)
  ix = @v2i[x]
  iy = @v2i[y]
  ix, iy = iy, ix if ix > iy
  items = iy - ix + 1
  l = items.bit_length - 1
  n1 = @sp[l][ix]
  n2 = @sp[l][iy - (1 << l) + 1]
  @tv[@td[n1] < @td[n2] ? n1 : n2]
end

@ts = Array.new(N + 1){[]}
XYUVs.each_with_index do |(x, y, u, v), i|
  @ts[u] << [i, x, y, 1]
  @ts[v] << [i, x, y, 1]
  @ts[lca(u, v)] << [i, x, y, -2]
end

def dfs(x = 1, ss = [0] * (N + 1), ns = [0] * (N + 1), t = 0, p = 0, acc = [0] * Q)
  @ts[x].each{|i, c, d, f| acc[i] += f * (t - ss[c] + ns[c] * d)}
  @g[x].each do |y, c, d|
    next if y == p
    ss[c] += d
    ns[c] += 1
    t += d
    dfs(y, ss, ns, t, x, acc)
    ss[c] -= d
    ns[c] -= 1
    t -= d
  end
  acc
end

puts dfs.join("\n")

Measured memory_bytes: 335124
#include <iostream>
#include <algorithm>
using namespace std;
const int num = 1001,num1 = 10000, INF = 2000000000;
int n, a[num], b[num], c[num1], tf[num], s = INF;
inline int mini() {
	int an = 0;
	int cu = 0;
	for (int i = 0; i < n; i++) {
		if (tf[i]) continue;
		cu = i;
		int m = INF;
		int sum = 0;
		int cnt = 0;
		while (true) {
			tf[cu] = 1;
			int v = a[cu];
			cnt++;
			m = min(v, m);
			sum += v;
			cu = c[v];
			if (tf[cu]) break;
		}
		an += min(sum + m*(cnt - 2), sum + m*(cnt - 2) + 2 * (m + s) - (m - s)*(cnt - 1));
	}
	return an;
}
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		s = min(a[i], s);
		b[i] = a[i];
		tf[i] = 0;
	}
	sort(b, b + n);
	for (int i = 0; i < n; i++) 
		c[b[i]] = i;
	int ans = mini();
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3164
# -*- coding: utf-8 -*-
from math import ceil

left = -1
right = 0

n,a,b = map(int, input().split())
h = []
for _ in range(n):
    h.append(int(input()))
    right += h[-1]//b+1

def check(t):
    cnt = 0
    for i in range(n):
        if h[i]-b*t>0:
            cnt += ceil((h[i]-b*t)/(a-b))
    return cnt<=t

while left+1<right:
    mid = (left+right)//2

    if check(mid):
        right = mid
    else:
        left = mid


print(right)


Measured memory_bytes: 7104
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int w = sc.nextInt();
			int h = sc.nextInt();
			if(w==0 && h==0) break;
			
			int[][] xw = new int[h][w-1];
			int[][] yw = new int[h-1][w];
			for(int i=0;i<h;i++){
				for(int j=0;j<w-1;j++) xw[i][j] = sc.nextInt();
				if(i==h-1) break;
				for(int j=0;j<w;j++) yw[i][j] = sc.nextInt();
			}
			
			int[][] cost = new int[h][w];
			for(int i=0;i<h;i++){
				for(int j=0;j<w;j++){
					cost[i][j] = Integer.MAX_VALUE;
				}
			}
			
			LinkedList<Integer> x = new LinkedList<Integer>();
			LinkedList<Integer> y = new LinkedList<Integer>();
			x.offer(0);
			y.offer(0);
			cost[0][0] = 1;
			
			int p, q;
			while(x.size()!=0){
				p = x.poll();
				q = y.poll();
				if(p>0 && xw[q][p-1]==0 && cost[q][p]+1<cost[q][p-1]){
					cost[q][p-1] = cost[q][p]+1;
					x.offer(p-1);
					y.offer(q);
				}
				if(p<w-1 && xw[q][p]==0 && cost[q][p]+1<cost[q][p+1]){
					cost[q][p+1] = cost[q][p]+1;
					x.offer(p+1);
					y.offer(q);
				}
				if(q>0 && yw[q-1][p]==0 && cost[q][p]+1<cost[q-1][p]){
					cost[q-1][p] = cost[q][p]+1;
					x.offer(p);
					y.offer(q-1);
				}
				if(q<h-1 && yw[q][p]==0 && cost[q][p]+1<cost[q+1][p]){
					cost[q+1][p] = cost[q][p]+1;
					x.offer(p);
					y.offer(q+1);
				}
			}
			
			if(cost[h-1][w-1]==Integer.MAX_VALUE) System.out.println(0);
			else System.out.println(cost[h-1][w-1]);
		}	
	}	
}

Measured memory_bytes: 81560
#include <stdio.h>
#include <stdlib.h>
int soma(int vetor[],int n, int index){
	int s1=0,s2=0;
	for(int j=0;j<=index;j++)s1+=vetor[j];
	for(int w=index+1;w<n;w++)s2+=vetor[w];
	return abs(s1-s2);
}

int main(void){
	int n,menor,t;
	scanf("%d", &n);
	int arr[n];
	for(int i=0;i<n;i++)scanf("%d",&arr[i]);
	menor = soma(arr,n,0);
	for(t=1;t<n;t++){
		int comp;
		comp = soma(arr,n,t);
		if(comp<menor)menor=comp;
	}
	printf("%d\n", menor);
	return 0;
}

Measured memory_bytes: 128
/*input
5
0.42 0.01 0.42 0.99 0.42
*/
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define mpr make_pair
#define MX 1000000007
#define ui unsigned int
#define ll long long
#define ld long double
#define fi first
#define se second
#define testcases int testcases;cin>>testcases;while(testcases--)
#define printvector(v) for(int i=0;i<v.size();i++) cout<<v[i]<<" ";  cout<<endl
#define printarray(v,n)  for(int i=0;i<n;i++) cout<<v[i]<<" ";  cout<<endl
#define inputarray(v,n)  for(int i=0;i<n;i++)cin>>v[i]
#define debug(i) cout<<"debug: "<<i<<endl
#define pr(i) cout<<i<<endl
#define timetaken cerr<<clock()/double(CLOCKS_PER_SEC)<<endl
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }


// class graph{
//     unordered_map<int,vector<int>> adjList;
//     int n;
// public:
//     graph(int n){
//         this->n = n;
//     }
//     void addEdge(int a, int b){
//         adjList[a].pb(b);
//         adjList[b].pb(a);
//     }
    
//     ll dfs(int from, vector<vector<ll>>&dp, int col, int parent){
//         if(dp[from][col] != -1) return dp[from][col];
        
//         ll ans = 1;
//         for(auto to: adjList[from]){
//             ll tmp = 1;
//             if(to != parent){
//                 if(col == 1){
//                     tmp = dfs(to, dp, 1-col, from);
//                 } else {
//                     tmp = dfs(to, dp, col, from) + dfs(to, dp, 1-col, from);
//                 }
//             }
//             ans = (ans*tmp)%MX;
//         }
//         return dp[from][col] = ans%MX;
//     }
// };

double dp[3000][3000];

double cal(int n, int x, vector<double> &a){
    if(x == 0)return 1;
    if(n == 0) return 0;
    
    if(dp[n][x] > -0.9) return dp[n][x];
    
    double ans = a[n-1]*cal(n-1,x-1,a) + (1-a[n-1])*cal(n-1,x,a);
    return dp[n][x] = ans;
}

int main() {
    fast_io
    int n;
    cin>>n;
    vector<double>a(n); inputarray(a,n);
    memset(dp,-1,sizeof(dp));
    dp[0][0] = 1;
    cout<<fixed<<setprecision(10)<<(cal(n,(n+1)/2,a));
}

Measured memory_bytes: 70784
S = input()
cnt = 0
for i in range(0, len(S)):
	if S[i] == 'g':
		cnt += 1
gandp = [0, 0]
for i in range(0, len(S)):
	if gandp[0] <= gandp[1]:
		gandp[0] += 1
		cnt -= 1
	else:
		gandp[1] += 1
print(cnt)

Measured memory_bytes: 39536
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 100000000000
using ll = long long ;
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
using namespace std;

int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> vec(n);
    rep(i,n) cin >> vec[i];
    ll ans = INF;
    sort(all(vec));
    for(int i=0;i<=n-k;i++){
        ll tmp = vec[i+k-1]-vec[i];
        ans = min(ans,tmp);
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 1152
'use strict';
(function(stdin) {
  var lines  = stdin.toString().split('\n');
  var result = (function(r) {
  	return [
  		Number(Math.PI * Math.pow(r,2)).toFixed(6)
  		,Number(Math.PI * 2 * r).toFixed(6)
  	].join(' ');
  }(parseFloat(lines[0])
  ));
  console.log(result);
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

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

int main(){
  int n;cin>>n;
  map<string,int> mp;
  vector<string>lis;
  string s;
  fol(i,n){
    cin>>s;
    if(find(lis.begin(),lis.end(),s)==lis.end())lis.pb(s);
    mp[s]++;
  }
  cin>>n;
  fol(i,n){
    cin>>s;
    if(find(lis.begin(),lis.end(),s)==lis.end())lis.pb(s);
    mp[s]--;
  }
  int ans = 0;
  for(int i=0;i<lis.size();i++){
    ans = max(mp[lis[i]],ans);
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  string s; cin >> s;
  int a_min_idx = s.size();
  int z_max_idx = 0;
  
  for (int i = 0; i < s.size(); ++i) {
    char c = s[i];
    if (c == 'A') a_min_idx = min(a_min_idx, i);
    if (c == 'Z') z_max_idx = max(z_max_idx, i);
  }
  cout << z_max_idx - a_min_idx + 1 << endl;
  
  return 0;
}

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

int64_t at(int64_t H, int64_t num){
    if(H/2 == 0) num++;
    else num += 1 + at(H/2, num) * 2;
    return num;
}

int main() {
  int64_t H;
  cin >> H;
  int64_t ans = at(H, 0);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <tuple>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <tuple>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <sys/time.h>

using namespace std;

void solve(long long N, long long K){
  if ((N+1)/2 >= K) {
    std::cout << "YES" << std::endl;
  } else {
    std::cout << "NO" << std::endl;
  }
}

int main(){
  long long N;
  long long K;
  scanf("%lld",&N);
  scanf("%lld",&K);
  solve(N, K);
  return 0;
}


Measured memory_bytes: 888
x,y = map(int,input().split())


a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]


if (x in a) & (y in a):
  print("Yes")
elif (x in b) & (y in b):
  print("Yes")
elif (x in c) & (y in c):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 61832
import numpy as np
import sys
sys.setrecursionlimit(100000)

def dfs(cost, i, ratio):
    if i == n:
        global ans
        if cost < ans and all([r >= x for r in ratio]):
            ans = cost
        return
    dfs(cost, i+1, ratio)
    dfs(cost+c[i], i+1, ratio+a[i])

if __name__ == "__main__":
    n, m, x = map(int, input().split())
    c = [None]*n
    a = np.array([None]*n)
    for i in range(n):
        c[i], *a[i] = map(int, input().split())
    ans = 10**8
    dfs(0, 0, np.array([0]*m))
    if ans == 10**8:
        print(-1)
    else:
        print(ans)

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

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

    int N;
    cin >> N;
    cout << (N + 1) / 2 << endl;

    return 0;
}

Measured memory_bytes: 256
from itertools import accumulate
n,k = map(int,input().split())
l = list(map(int,input().split()))
l = list((i+1)/2 for i in l)
rui = list(accumulate([0]+l))
#print(l)
#print(rui)
ma = 0
for i in range(n-k+1):
  a = rui[i+k]-rui[i]
  ma = max(ma,a)
print(ma)

Measured memory_bytes: 25152
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int dp[3005][3005];

void lcs(string a,string b,int m,int n)
{
    ll i,j;
    for(i=0; i<=m; i++)
    {
        for(j=0; j<=n; j++)
        {
            if(i==0 || j==0)
                dp[i][j]=0;
            else if(a[i-1]==b[j-1])
                dp[i][j]=1+dp[i-1][j-1];
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    //cout<<dp[m][n]<<endl;
    string ans= " ";
    i = m;
    j = n;
    while(i>0 and j>0)
    {
        if(a[i-1]==b[j-1])
        {
            ans=a[i-1]+ans;
            i--;
            j--;
        }
        else
        {
            if(dp[i-1][j]>=dp[i][j-1])
                i--;
            else
                j--;
        }
    }
    cout<<ans<<endl;
}

int main()
{
    string a, b;
    cin>>a>>b;
    ll m=a.size();
    ll n=b.size();
    lcs(a,b,m,n);

    return 0;
}


Measured memory_bytes: 38880
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

const int MAX = 100007;
const int MOD = 1000000007;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> edges[MAX];
    int heights[MAX];
    for (int i = 0; i < n; i++) {
        cin >> heights[i];
    }
    int ed, ef;
    for (int i = 0; i < m; i++) {
        cin >> ed >> ef;
        ed--; ef--;
        edges[ed].push_back(ef);
        edges[ef].push_back(ed);
    }
    int res = 0;
    for (int i = 0; i < n; i++) {
        bool good = true;
        for (int j : edges[i]) {
            if (heights[j] >= heights[i]) {
                good = false; break;
            }
        }
        if (good) {
            res++;
        }
    }
    cout << res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //int tt; cin >> tt; for (int i = 1; i <= tt; i++) {solve(); cout << endl;}
    solve();
}

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

template <class T> using V = vector<T>;

using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;


#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;



int main() {
  ll n;
  	ci(n)
  ll k;
  	ci(k)
  co(n-k+1)
}

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    H, W, K = map(int, readline().split())
    G = [readline() for _ in range(H)]

    ans = 0
    for mask_r in range(1 << H):
        for mask_c in range(1 << W):
            black = 0
            for i in range(H):
                for j in range(W):
                    if ((mask_r & (1 << i)) == 0) and ((mask_c & (1 << j)) == 0) and G[i][j] == '#':
                        black += 1
            if black == K:
                ans += 1

    print(ans)
    return


if __name__ == '__main__':
    main()


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

vector < int > adj[100010];
int dp[100010];

int dfs(int i)
{
    if(dp[i] + 1)return dp[i];
    dp[i] = 0;
    for(auto x : adj[i])dp[i] = max(dp[i],1+dfs(x));
    return dp[i];
}
int main()
{
    int n , m;
    scanf("%d%d",&n,&m);
    for(int i = 0 ; i < m ; i++)
    {
        int a, b;   scanf("%d%d",&a,&b);    a--;b--;
        adj[a].push_back(b);
    }
    for(int i = 0 ; i < n ; i++)dp[i] = -1;
    int ans = 0;
    for(int i = 0 ; i < n ; i++)
        ans = max(ans,dfs(i));
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 7424
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
#include <stack>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef map<int, int> Mii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;
typedef pair<ll, ll> Pll; 

int d[1010];

int main()
{
	int n;
	cin >> n;
	rep(i,0,n) cin >> d[i];

	int ans = -1;
	rep(i,0,1010) {
		if (ans >= 0) break;
		if (i < 10) {
			rep(j,0,n) {
				if (d[j] == i) break;
				if (j == n-1) {
					ans = i;
					break;
				}
			}
		}
		else if (i < 100) {
			int ten = i/10, one = i-10*ten;
			//printf("i=%d ten=%d one=%d\n",i,ten,one);
			rep(j,0,n) {
				if (d[j] == ten && d[j+1] == one) break;
				if (j == n-2) {
					ans = i;
					break;
				}
			}
		}
		else {
			int hund = i/100, ten = (i-100*hund)/10, one = i-100*hund-10*ten;
			rep(j,0,n) {
				if (d[j] == hund && d[j+1] == ten && d[j+2] == one) break;
				if (j == n-3) {
					ans = i;
					break;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3140
c[999],i,r;main(A,a,C){for(scanf("%*d%d%d%d",&A,&a,&C);~scanf("%d",c+i++););for(qsort(c,i,4,"\x8b\7+\6\xc3");r=fmax(r,C/A),i--;C+=c[i])A+=a;i=!printf("%d\n",r);}

Measured memory_bytes: 608
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll,null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_pair tree<pair<ll,ll>,null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 

typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<ll,ll> pi; 
#define FOR(i,vv,n) for(ll i=vv;i<n;i++)
#define FORR(i,n,vv) for(ll i=n-1;i>=vv;i--)
#define ve vector 
#define maxe(v) *max_element(v.begin(),v.end())
#define mine(v) *min_element(v.begin(),v.end())
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define M 1000000007ll
#define PRECISE cout.precision(18);
#define F first
#define S second




int main(){
 

    FAST
	PRECISE


ll l;
cin>>l;
double d=(double)l/3;
cout<<(double)d*d*d;



return 0;
}



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

import sys
import os


N = int(input())
score0 = 0
score1 = 0
for i in range(N):
    word0, word1 = input().split()
    if word0 < word1:
        score1 += 3
    elif word0 > word1:
        score0 += 3
    else:
        score0 += 1
        score1 += 1
print(score0, score1)

Measured memory_bytes: 7680
//#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cstring>
#include <cassert>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(...) DBG2::print(#__VA_ARGS__, __LINE__, __VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;



int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   int H, W, K;
   cin >> H >> W >> K;

   vector<string> B(H);
   REP(r, H)
      cin >> B[r];

   int res = 0;
   REP(rmask, 1<<H) {
      REP(cmask, 1<<W) {
         int nblack = 0;
         REP(r, H) REP(c, W) {
            if (rmask & (1<<r)) continue;
            if (cmask & (1<<c)) continue;
            if (B[r][c] == '#')
               ++nblack;
         }
         if (nblack == K)
            ++res;
      }
   }
   cout << res << endl;

   return 0;
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){

    int n,m;
    cin>>n>>m;
    vi h(n),a(m),b(m);
    rep(i,n)cin>>h[i];
    rep(i,m)cin>>a[i]>>b[i];

    vi good(n,1);
    rep(i,m){
        if(h[a[i]-1]<=h[b[i]-1])good[a[i]-1]=0;
        if(h[a[i]-1]>=h[b[i]-1])good[b[i]-1]=0;
    }

    int ans=0;
    rep(i,n){
        if(good[i])ans++;
    }

    cout<<ans<<"\n";

    return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,K;
deque<char> Q;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K>>s;
	FORR(c,s) Q.push_back(c);
	
	bool rev=false;
	FOR(i,min(K,2*N+(K%2))) {
		if((Q[0]=='A')^rev) {
			Q[0]='A'+'B'-Q[0];
		}
		else {
			Q.pop_front();
			rev ^= 1;
			Q.push_back('A'+rev);
		}
	}
	
	FORR(r,Q) {
		if(rev) _P("%c",'A'+'B'-r);
		else _P("%c",r);
	}
	_P("\n");
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 920
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

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

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

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;
int h[100000];

int gcd(int a, int b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

  cin >> n;
  REP(i, n) cin >> h[i];

  int sk = gcd(max(h[0], h[1]), min(h[0], h[1]));

  FOR(i, 1, n) {
    int ma = max(sk, h[i]);
    int mi = min(sk, h[i]);
    sk = gcd(ma, mi);
  }

  cout << sk << endl;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> V(N);
    for (int i = 0; i < N; i++){
        int v;
        cin >> v;
        V.at(i) = v;
    }
    sort(V.begin(), V.end());
    double ans = V.at(0);
    for (int i = 1; i < N; i++){
        ans = (ans + V.at(i)) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define exf(x)	 for(auto&& tmp : x) { cout << tmp << endl; }	// 拡張for
#define PI 3.14159265358979323846264338327950288
#define testP	 cout << "------------------ test ------------------" << endl;	// 動作確認テスト
#define testX(x) cout << "testout : " << x << endl;	// テストアウト
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

// ------------------ ベクター表示 ------------------ //
void printVec(vector<int>& vec) {
	cout << "";
	for (auto it = vec.begin(); it != vec.end(); it++) cout << *it << " ";
	cout << endl;
}

// ------------------ ベクター合計 ------------------ //
int sumVec(vector<int> v) {
	int sum = 0;
	for (size_t i = 0; i < v.size(); i++) sum += v[i];
	return sum;
}

// -------------------------------------------------- //
// ------------------ ここから本編 ------------------ //
// -------------------------------------------------- //

int main(void) {

	int N, X; cin >> N >> X;
	int sum = 0, cnt = 1;
	rep(i, N) {
		int l;
		cin >> l;
		sum += l;
		if (sum <= X) cnt++;
	}

	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    ll n, a, b;
    cin >> n >> a >> b;

    ll blue = 0;


    ll times = n / (a+b);
    ll amari = n % (a+b);

    blue += a * times;

    if(amari < a) blue += amari;
    else blue += a;

    cout << blue << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout << fixed << setprecision(10);
    solve();
    // stopBBB
        return 0;
}

Measured memory_bytes: 256