akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

using namespace std;

int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a > b){
		printf("a > b\n");
	}else if(a < b){
		printf("a < b\n");
	}else{
		printf("a == b\n");
	}
}


Measured memory_bytes: 2608
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair <int,int> PII;
typedef pair <ll, ll> PLL;
typedef pair <int,string> PIS;
typedef vector <int> vec;
typedef priority_queue<int> PQ;
#define endl '\n'
#define pi 3.141592653589793
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define fori(z,n) for(int i=z;i<n;i++)
#define forii(z,n) for(int i=z;i<=n;i++)
int maxElement(int arr[],int n)
{
    int maxi=arr[0];
    for(int i=1;i<n;i++)
    {
        if(arr[i]>maxi)
            maxi=arr[i];
    }
    return maxi;
}
int minElement(int arr[],int n)
{
    int mini=arr[0];
    for(int i=1;i<n;i++)
    {
        if(arr[i]<mini)
            mini=arr[i];
    }
    return mini;
}
string trim(const string& str)
{
    size_t first = str.find_first_not_of(' ');
    if (string::npos == first)
    {
        return str;
    }
    int last = str.find_last_not_of(' ');
    return str.substr(first, (last - first + 1));
}
int main() 
{ 
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,w;cin>>n>>w;
    vector<pair<int,int>> v(n+1);
    for(int i=1;i<=n;i++)
    {
        int p,q;cin>>p>>q;
        v[i]={p,q};
    }
    ll dp[w+1][n+1];
    for(int i=0;i<=n;i++) dp[0][i]=0;
    for(int i=0;i<=w;i++) dp[i][0]=0;
    for(int i=1;i<=w;i++)
    {
        for(int k=1;k<=n;k++)
        {
            if(i-v[k].first>=0)
                dp[i][k]=max(dp[i-v[k].first][k-1]+v[k].second,dp[i][k-1]);
            else
                dp[i][k]=dp[i][k-1];
        }
    }
    cout<<dp[w][n]<<endl;
    cerr<<"Time elapsed"<<1.0*clock()/CLOCKS_PER_SEC<<"s\n";
    return 0;
}


Measured memory_bytes: 79232
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;cin>>n;
    ll a[n+1];
    map<ll,ll>m,mm;
    set<ll>s;
    for(int i=1;i<=n;++i)
    {
        cin>>a[i];
        s.insert(a[i]+i);
        m[a[i]+i]++;
        if(i-a[i]>0)
        {
            mm[i-a[i]]++;
        }
    }
    ll ans=0;
    for(auto i:s)
    {
        ans+=m[i]*mm[i];
    }
    cout<<ans<<"\n";
    return 0;
   
}

Measured memory_bytes: 39440
import java.util.Scanner;

public class Main {

	    public static void main(String[]args){
	    	Scanner scan=new Scanner(System.in);
	        int S=scan.nextInt();
	            int h=S/3600;
	            int m=(S%3600)/60;
	            int s=(S%3600)%60;
	            System.out.println(h+":"+m+":"+s);
	    }
	}


Measured memory_bytes: 26272
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template <typename T>
struct SegmentTree{
  using F = function<T(T,T)>;
  Int n;
  F f;
  T ti;
  vector<T> dat;
  SegmentTree(){};
  SegmentTree(F f,T ti):f(f),ti(ti){}
  void init(Int n_){    
    n=1;
    while(n<n_) n<<=1;
    dat.assign(n<<1,ti);
  }
  void build(const vector<T> &v){
    Int n_=v.size();
    init(n_);
    for(Int i=0;i<n_;i++) dat[n+i]=v[i];
    for(Int i=n-1;i;i--)
      dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
  }
  void set_val(Int k,T x){
    dat[k+=n]=x;
    while(k>>=1)
      dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);    
  }
  T query(Int a,Int b){
    T vl=ti,vr=ti;
    for(Int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
      if(l&1) vl=f(vl,dat[l++]);
      if(r&1) vr=f(dat[--r],vr);
    }
    return f(vl,vr);
  }
  template<typename C>
  Int find(Int a,Int b,C &check,Int k,Int l,Int r){
    if(!check(dat[k])||r<=a||b<=l) return -1;
    if(k>=n) return k-n;
    Int m=(l+r)>>1;
    Int vl=find(a,b,check,(k<<1)|0,l,m);
    if(~vl) return vl;
    return find(a,b,check,(k<<1)|1,m,r);
  }
  template<typename C>
  Int find(Int a,Int b,C &check){
    return find(a,b,check,1,0,n);
  }
};

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  vector<Int> v(n);
  for(Int i=0;i<n;i++) cin>>v[i];
  Int ans=0;
  for(Int i=0;i<n;i++) ans+=abs(v[i]-i);
  
  using P = pair<Int, Int>;
  struct T{
    P a,b,c;
    T(){}
    T(P a,P b,P c):a(a),b(b),c(c){}
  };
  auto f=[&](T x,T y){
           return T(max(x.a,y.a),min(x.b,y.b),x.c);
         };

  vector<T> vt(n);
  for(Int i=0;i<n;i++){
    vt[i]=T(P(min(v[i],i),i),P(max(v[i],i),i),P(i,i));    
  }

  const Int INF = 1e9;
  T ti(P(-INF,-INF),P(INF,INF),P(0,0));
  SegmentTree<T> seg(f,ti);
  seg.build(vt);

  for(Int i=0;i<m;i++){
    T res=seg.query(0,n);
    Int x=res.b.second;
    Int y=res.a.second;
    if(x==y) break;
    if(min(v[y],y)<=max(v[x],x)) break;
    //cout<<x<<" "<<y<<endl;
    ans+=(min(v[y],y)-max(v[x],x))*2;
    swap(v[x],v[y]);
    vt[x]=T(P(min(v[x],x),x),P(max(v[x],x),x),P(x,x));
    vt[y]=T(P(min(v[y],y),y),P(max(v[y],y),y),P(y,y));
    seg.set_val(x,vt[x]);
    seg.set_val(y,vt[y]);
  }
  Int res=0;
  for(Int i=0;i<n;i++) res+=abs(v[i]-i);
  assert(ans==res);  
  //cout<<ans<<endl;
  cout<<res<<endl;
  
  return 0;
}



Measured memory_bytes: 20544
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    ll s = 0, sg = 0;
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
        sg = i%2 == 0 ? 1 : -1;
        s += sg * A[i];
    }
    for ( int i = 0; i < N; i++ ) {
        cout << s << " ";
        s = 2*A[i] - s;
    }
    cout << "\n";
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    int A, B, C; cin >> A >> B >> C;
    if(C >= A && C <= B) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

typedef long long int ll;

int main()
{
	ll k,n;
	cin>>k>>n;
	ll arr[n],suma[n],sumb[n];
	for(ll i=0;i<n;i++)
		cin>>arr[i];
	sort(arr,arr+n);
	suma[0]=arr[n-1]-arr[0];
	sumb[0]=k+arr[0]-arr[1];
	for(ll i=i;i<n-1;i++)
	{
		suma[i]=k-arr[i]+arr[i-1];
		sumb[i]=k-arr[i+1]+arr[i];
	}
	suma[n-1]=k-arr[n-1]+arr[n-2];
	sumb[n-1]=arr[n-1]-arr[0];
	sort(suma,suma+n);
	sort(sumb,sumb+n);
	cout<<min(suma[0],sumb[0])<<endl;
//	cout<<sumb[0]<<endl;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
typedef vector<int> VI;
typedef vector<ll> VLL;

int main(){
    char a[26];
    int n;
    cin >> n;
    string s;
    cin >> s;

    for(int i=0; i<26; ++i){
        a[i] = 'A' + i;
    }

    int size = s.size();


    for(int i=0; i<size ; ++i){
        s[i] = a[(s[i] - 'A' + n)%26];
    }

    cout << s << endl;
    return 0;
    
}

Measured memory_bytes: 256
N = int(input())
A = []
B = []
for i in range(N):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)

cnt = 0
for i in range(N-1,-1,-1):
    if (A[i]+cnt)%B[i] == 0:
        continue
    cnt += B[i] - ((A[i]+cnt)%B[i])
print(cnt)

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

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

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

#define MAX 100005
#define INF 1001001001

int main(int, char**)
{
  string s;
  cin >> s;

  map<char, int> cnt;
  rep(i,s.size()) cnt[s[i]]++;
  priority_queue< int, vector<int>, greater<int> > q;
  for(auto c : cnt) q.push(c.second);

  if (q.size() == 1) { cout << q.top() << endl; return 0; }
  int ans = 0;
  while (q.size() > 1) {
    int c1 = q.top(); q.pop();
    int c2 = q.top(); q.pop();
    int c = c1 + c2;
    q.push(c);
    ans += c;
  }

  cout << ans << endl;

  return 0;
}



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

using namespace std;

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

const int MM = 1e9 + 7;
const double eps = 1e-8;

int a[1000];

int main(){
	int n;
	cin>>n;
	for(int i = 1; i <= n; i++)
		cin>>a[i];
	long long ans = 2e9;
	for(int j = -100; j <= 100; j++){
		long long tot = 0;
		for(int i = 1; i <= n; i++)
			tot += (a[i] - j) * (a[i] - j);
		ans = min(ans, tot);
	} 
	cout<<ans<<endl;
	return 0;
} 

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

typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
  int n;
  cin >> n;
  vector<int> L(n);
  for (int i = 0; i < n; i++) {
    cin >> L[i];
  }
  sort(L.begin(), L.end());
  int ans = 0;
  for (int b = 0; b < n; b++) {
    for (int a = 0; a < b; a++) {
      int ab = L[a] + L[b];
      int r = lower_bound(L.begin(), L.end(), ab) - L.begin();
      int l = b + 1;
      ans += max(0, r - l);
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

const int INF = 1000000001;
const int MAX = 500000;
int cnt;
int L[1 + MAX/2] = {0},R[1 + MAX/2] = {0};


void merge(int* A,int left,int mid,int right)
{
	int n1,n2,n,i,j;
	//int L[1 + MAX/2] = {0},R[1 + MAX/2] = {0};
	n1 = mid - left;
	n2 = right - mid;

	for(int i = 0; i < n1; i++)
	{
		L[i] = A[left + i];
	}
	for(int i = 0; i < n2; i++)
	{
		R[i] = A[mid + i];
	}

	L[n1] = INF;
	R[n2] = INF;

	i = 0;
	j = 0;

	//cout << "right=" << right << "left=" << left << endl;
	//cout << "right - left= " << right << " - " << left << " = " << right - left << endl;

	for(int k = 0; k < right - left; k++)
	{
		if (L[i] <= R[j] )
		{
			A[left + k] = L[i];
			i++;
		}else
		{
			A[left + k] = R[j];
			j++;
		}

		cnt++;
	}

	//return cnt;
}


void mergesort(int* A,int left,int right)
{
	int mid,sol, sol_left, sol_right;

	if(left + 1 < right)
	{
		mid = (left + right) / 2;
		//cout << "mid=" << mid << endl;
		//sol_left = mergesort(A,left,mid);
		//sol_right = mergesort(A,mid,right);
		//sol = merge(A,left,mid,right) + sol_right + sol_left;

		mergesort(A,left,mid);
		mergesort(A,mid,right);
		merge(A,left,mid,right);

		//cout << "sol= " << sol << endl;
	}

	//return sol;
}

int main()
{
	int N,S[MAX] = {0},solution;
	cnt = 0;

	cin >> N;

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

	//solution = mergesort(S,0,N);
	mergesort(S,0,N);

	for(int i = 0; i < N; i++)
	{
		if (i == N-1)
		{
			cout << S[i] <<endl;
		}else
		{
			cout << S[i] << " ";
		}
	}

	cout << cnt << endl;

	return 0;
}
	

Measured memory_bytes: 6964
import           Control.Monad
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe

readInt = fst . fromJust . BS.readInt
getInt = readInt <$> BS.getLine

bisectLeft :: Ord a => (Int -> a) -> a -> Int -> Int -> Int
bisectLeft f x lo hi
  | lo >= hi  = lo
  | f mid < x = bisectLeft f x (mid+1) hi
  | otherwise = bisectLeft f x lo mid
  where
    mid = lo + (hi - lo) `div` 2

main = do
  x <- getInt
  let n = bisectLeft (\i -> i * (i+1) `div` 2 >= x) True 1 (10^9 + 1)
  print n

Measured memory_bytes: 380
#include <bits/stdc++.h>
#define LL long long
using namespace std;
string	st;
int	ans;
bool	flag = true;
int main()
{
	cin >> st;
	int L=0,R = st.size() - 1;
	while ( L <= R )
	{
		if ( st[L] == st[R] ) {L++,R--;continue;}
		if ( st[L] == 'x' ) {L++,ans++;continue;}
		if ( st[R] == 'x' ) {R--,ans++;continue;}
		flag = false; break;
	}
	ans = flag ? ans : -1;
	cout << ans ;
	return(0);
}

Measured memory_bytes: 512
use std::io;


fn main() {
    let r = read_one::<isize>();
    let g = read_one::<isize>();
    println!("{}", 2 * g - r);
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
/******************************************
* AUTHOR : AMAN SAXENA *
* Nick : blue-meth *
* "There's some good in this world, and it's worth fighting for." *
* INSTITUTION : KIET Group of Institutions *
******************************************/
#include <bits/stdc++.h>

const long long MODULO=1000000007;
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define FOR1(i,a,n) for(int i=a;i<=n;i++)
#define FOR2(i,a,n) for(int i=a;i>=n;i--)
#define pb push_back
#define mp make_pair
#define ll long long 
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pi 3.14159265359

using namespace std;

ll amanpower(ll a, ll b) {
    ll r = 1;
    while (b > 0) 
    {
        if (b & 1) r = r * a;
        a = a * a;
        b >>= 1;
    }
    return r;
}

ll amanlcm(ll a, ll b)
{
     return a*(b/__gcd(a,b));
}


//********* CODE START *********


void solve()
{
    ll n, k;
    cin >> n >> k;
    ll a[n];
    FOR(i,0,n)
    {
        cin >> a[i];
    }
    ll sum = 0;
    FOR(i,0,k)
    {
        sum += a[i];
    }
    FOR(i,k,n)
    {
        ll prev = sum;
        sum += a[i] - a[i-k];
        if(sum > prev)
        {
            cout << "Yes\n";
        } 
        else 
            cout << "No\n";
    }
   

}

void test()
{
    int t;
    cin>>t;
    while(t--) //for(int j=1;j<=t;j++) cout << "Case #" << j << ": ";
    {
        solve();
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#endif
    
    // test();
    solve();

    
    return 0;
}

Measured memory_bytes: 5216
N, K = list(map(int, input().split()))
count = 0
if K == 0:
    print(N*N)
    exit()
for i in range(1, N+1):
    count += int(N/i) * max(i-K, 0) + max(N - int(N/i)*i + 1 - K, 0)
print(count)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

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

		int i = 1;
		while (i < 10001) {
			String line = sc.nextLine();
			int x = Integer.parseInt(line);
			if (x == 0) {
				break;
			}
			System.out.println("Case " + i + ": " + x);
			i++;
		}

	}

}

Measured memory_bytes: 59668
#include <iostream>
 using namespace std;
int main()
{
    int h,n;
    cin>>h>>n;
    int tmp,s;
    for (int i=1;i<=n;i++)
    {
        cin>>tmp;
        s+=tmp;
        if (s>=h)
        {
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc158/tasks/abc158_a

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  string S;
  cin >> S;

  ll all_same = true;
  rep(i, S.size()) {
    if (S[i] != S[0]) all_same = false;
  }

  if (all_same) drop("No");
  drop("Yes");
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include <vector>
#include<string>
#include<cmath>
#include<cstdio>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define max(x,y) (((x)>(y)) ? x:y)
#define min(x,y) (((x)<(y)) ? x:y)
#define FOR(a,b,c) for(b=(c);b<(a);b++)
#define ender {return 0;}
#define tosasuretu(a) (a*(a+1)/2)
inline ll kaizyo(ll);
ll combination(ll, ll);
int main() {
	int n;
	cin >> n;
	if (n < 105) {
		cout << 0;
	}
	else if (n < 135) {
		cout << 1;
	}
	else if (n < 165) {
		cout << 2;
	}
	else if (n < 189) {
		cout << 3;
	}
	else if (n < 195) {
		cout << 4;
	}
	else {
		cout << 5;
	}
	return 0;
}


inline ll kaizyo(ll x) {
	long ans = 1;
	for (int z = 0; z < x; z++) {
		ans *= (x - z);
	}
	return ans;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int a[5];
    for(int i = 0;i<5;i++)
    {
        cin>>a[i];
        if(a[i] == 0)
            cout<<i+1;
    }
    return 0;
}

Measured memory_bytes: 3632
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}


Measured memory_bytes: 1064
import java.io.*;

public class Main{
	public static void main(String[] args){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String[] tableSize = br.readLine().split(" ");
			int n = Integer.parseInt(tableSize[0]);
			int m = Integer.parseInt(tableSize[1]);
			int[][] table = new int[n][m];

			for (int i = 0; i < n; i++){
				String[] str = br.readLine().split(" ");
				for(int j = 0; j < m; j++){
					table[i][j] = Integer.parseInt(str[j]);
				}
			}

			int[][] newTable = new int[n+1][m+1];
			int[] sumX = new int[m];
			int[] sumY = new int[n];
			int sumAll = 0;

			for (int x = 0; x < n+1; x++){
				if (x < n){
					for (int y = 0; y < m+1; y++){
						if(y < m){
							newTable[x][y] = table[x][y];
							sumAll += newTable[x][y];
						}else{
							for (int a = 0; a < m; a++){
								sumY[x] += table[x][a];
								newTable[x][y] = sumY[x];
							}
						}
					}
				}else{
					for (int z = 0; z < m+1; z++){
						if (z < m){
							for (int b = 0; b < n; b++){
							sumX[z] += table[b][z];
							newTable[x][z] = sumX[z];
							}
						}else{
							newTable[x][z] = sumAll;
						}
					}
				}
			}

			for (int s = 0; s < n+1; s++){
				for (int t = 0; t < m+1; t++){
					if (t < m ){
						System.out.print(newTable[s][t] + " ");
					}else{
						System.out.print(newTable[s][t]);
					}
				}
				System.out.println();
			}
		}catch(IOException e){
		System.out.println(e);
		}
	}
}

Measured memory_bytes: 25208
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <stdlib.h>
int main(void)
{
	int n,d;
	scanf("%d %d",&n,&d);
	assert(1<=n&&n<=2*pow(10,5));
	assert(0<=d&&d<=2*pow(10,5));
	
	//printf("%d %d\n",n,d);
	int i,x,y;
	int c=0;
	double l;
	for(i=0;i<n;i++)
	{
		scanf("%d %d",&x,&y);
		//printf("%d %d\n",x,y);
		assert(abs(x)<=2*pow(10,5));
		assert(abs(y)<=2*pow(10,5));
		l=sqrt((double)((double)x*(double)x)+(double)((double)y*(double)y));
		//printf("%d %f\n",d,l);
		if((double)d<l)
		{
			;
		}
		else
		{
			c++;
		}
	}
	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 2148
#include <iostream>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<iomanip>
#include <limits>
#include <numeric>
#include <type_traits>
#include<stack>
#include<queue>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
const int INF =100000000;
typedef pair<int,int> P;


int retl(int K,int L){
    int tmp=0;
    while(pow(2,tmp) * L < K){
        tmp++;
    }
    return tmp;
}
int gcd(int a,int b)
{
	if (a%b==0)
	{
		return(b);
    }
	else
	{
		return(gcd(b,a%b));
    }
}
struct A{
    string s;
    int p;
    int order;
};

bool compare_by_b(pair<long, long> a, pair<long, long> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
bool dfs(long long sum,long long a[],int K,int N,int i){
    cout<<"sum="<<sum<<", i="<<i<<",a[i]="<<a[i]<<endl;
    if(sum==K){
        return true;
    }
    if(N==i){
        return false;
    }else{

    
    bool ret= dfs(sum+a[i],a,K,N,i+1) || dfs(sum,a,K,N,i+1);
    return ret;
    }
}
int dfs(int N){
    if(N==1){
        return 0;
    }
    if(N==3){
        return 1;
    }
    if(N%2==1){
        dfs(N/2);
        dfs(N/2 +1);
    }else{
        dfs(N/2);
        dfs(N/2);
    }
}

int main(){
    int a;
    string s;
    cin>>a>>s;
    
    
    string ans;
    if(a>=3200){
        ans=s;
    }else{
        ans="red";
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
ll a,b,c,d;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>a>>b>>c>>d;
  if(abs(a-c) <= d) cout<<"Yes"<<endl;
  else if(abs(a-b) <= d && abs(b-c) <= d) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

int main(){
  solve();
  return 0;
}




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

int main() {
  int N;
  cin >> N; //要素数の入力
  vector <int> data (N); // data：N個の要素を含む配列
  for (int i=0; i<N; i++){
  	cin >> data.at(i); // dataの要素入力
  }
  for (int j=1; j<N; j++){
   for (int i =0; i<N; i++){
      if (i==0)
        cout << data.at(i);
      else
        cout << " " << data.at(i);
    }
    cout << endl;
    int v=data.at(j);
    int k = j-1;
    while (k >=0 && data.at(k) > v) {
      data.at(k+1) = data.at(k);
      k--;
    }
    data.at(k+1)= v;
  }
  for (int i =0; i<N; i++){
      if (i==0)
        cout << data.at(i);
      else
        cout << " " << data.at(i);
    }
  cout << endl;
}



Measured memory_bytes: 3096
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <deque>
#include <map>

#define ll long long
#define ull unsigned long long
#define mod 1000000007

using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;

	if ((a&b) == 1 || c == 1) {
		cout << "Open" << "\n";
	}
	else {
		cout << "Close" << "\n";
	}

	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define pb push_back
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define endl "\n"
#define pii pair<int,int>
#define mii map<int,int>
#define int long long int
#define fbo find_by_order
#define ook order_of_key
#define in insert
#define F first
#define S second
#define bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a) for(auto ws: a)cout<<ws<<" "; cout<<endl
#define print1(a,b) for(int ws=0;ws<b;ws++) {cout<<a[ws]<<" ";} cout<<endl
#define all(a) a.begin(), a.end()
#define si set<int>
#define print2(a) for(auto ws: a)cout<<"("<<ws.F<<","<<ws.S<<") "; cout<<endl

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr (names + 1, ',');
    cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}
const int N = 105;
int cache[N][100000];
int val[N];
int wt[N];
int n, w;
int dp(int index, int w)
{
    if (w <= 0)return 0;
    if (index == n)return 0;
    int &ans = cache[index][w];
    if (ans != -1)return ans;
    ans = 0;
    if (wt[index] > w)
    {
        return ans = dp(index + 1, w);
    }
    else
    {
        return ans = max(val[index] + dp(index + 1, w - wt[index]), dp(index + 1, w));
    }
}
void solve()
{
    memset(cache, -1, sizeof(cache));
    cin >> n >> w;
    for (int i = 0; i < n; ++i)
    {
        cin >> wt[i] >> val[i];
    }
    cout << dp(0, w) << endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt",  "r",  stdin);
    freopen("output.txt", "w", stdout);
#endif
    cout << setprecision(9) << fixed;
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 85656
#include <bits//stdc++.h>
using namespace std;
#define int long long
#define rep(i,n,k) for(int i=n;i<k;i++)
#define P make_pair
#define F first
#define S second
#define M LLONG_MAX
signed main(void){
    int n,m,ans,w,p,q;
    ans=0;
    cin>>n;
    cout<<(n+1)/2<<endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
    static class Reader 
    { 
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;} 
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];} 
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;} 
        public String s(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isSpaceChar(c));return res.toString();} 
        public long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;} 
        public int i(){int c = read() ;while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }int res = 0;do{if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read() ;}while(!isSpaceChar(c));return res * sgn;} 
        public double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } 
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } 
        public int[] arr(int n){int[] ret = new int[n];for (int i = 0; i < n; i++) {ret[i] = i();}return ret;}
    }
    
    
 
           //       |----|       /\      |    |   -----   |
           //       |   /       /  \     |    |     |     |
           //       |--/       /----\    |----|     |     |
           //       |   \     /      \   |    |     |     |
           //       |    \   /        \  |    |   -----   -------

    public static void main(String[] args)throws IOException
    {
        PrintWriter out= new PrintWriter(System.out);
        Reader sc=new Reader();
        int n=sc.i();
        String arr[]=new String[3];
        for(int i=0;i<3;i++)
        arr[i]=sc.s();
        int count=0;
        for(int i=0;i<arr[0].length();i++)
        {
            int val1=arr[0].charAt(i)-48;
            int val2=arr[1].charAt(i)-48;
            int val3=arr[2].charAt(i)-48;
            if(val1==val2&&val2==val3&&val1==val3)
            ;
            else if(val1==val2||val2==val3||val1==val3)
            count++;
            else
            count+=2;
        }
        out.println(count);
        out.flush();
    }
}

Measured memory_bytes: 23124
$dx = [0,1,0,-1]
$dy = [1,0,-1,0]
def bfs(f, sy, sx, h, w, col)
    q = [[sy,sx]]
    visited = [[sy,sx]]
    while q.size > 0
        sy, sx = q.shift
        for i in 0..3
            cy = sy + $dy[i]
            cx = sx + $dx[i]
            if cy.between?(0,h-1) && cx.between?(0,w-1) && f[cy][cx]== f[sy][sx] && !visited.include?([cy,cx])
                q.push([cy,cx])
                visited.push([cy,cx])
            end
        end
        f[sy][sx] = col
    end
    return f
end
def count(f, sy, sx, h, w)
    q = [[sy,sx]]
    visited = [[sy,sx]]
    c = 1
    while q.size > 0
        sy, sx = q.shift
        for i in 0..3
            cy = sy + $dy[i]
            cx = sx + $dx[i]
            if cy.between?(0,h-1) && cx.between?(0,w-1) && f[cy][cx]== f[sy][sx] && !visited.include?([cy,cx])
                q.push([cy,cx])
                visited.push([cy,cx])
                c += 1
            end
        end
    end
    return c
end
loop do
    h, w, c = gets.split.map(&:to_i)
    break if h == 0 && w == 0 && c == 0
    p = h.times.map{gets.split.map(&:to_i)}
    o = (1..6).to_a.repeated_permutation(5).to_a
    o.select!{|od| od[0] == p[0][1] || od[0] == p[1][0]} if h > 1 && w > 1 && count(p,0,0,h,w) == 1
    o.select!{|od| od[0] != od[1] && od[1] != od[2] && od[2] != od[3] && od[3] != od[4]}
    o.select!{|od| od[4] == c}
    max = 0
    o.each_with_index do |od, i|
        pp = Marshal.load(Marshal.dump(p))
        od.each do |col|
            pp = bfs(pp,0,0,h,w,col)
        end
        cnt = count(pp,0,0,h,w)
        max = cnt if cnt > max
    end
    puts max
end

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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

#ifdef DEBUG
#define debug(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__)
#else
#define debug(fmt, ...)
#endif

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<llll> vllll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define repC3(vari,varj,vark,n)  for(int vari=0;vari<(n)-2;++vari)for(int varj=vari+1;varj<(n)-1;++varj)for(int vark=varj+1;vark<(n);++vark)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }
template<typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template<typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }


double solve(int N, vd& p) {
    vector<vd> dp(N+1, vd(N+1, 0));
    // dp[i][j] : j枚やってi枚表
    dp[0][0] = 1.0;
    rep1(i,N){
        double pi = p[i-1];
        rep(j, N) {
            dp[i][j]   += dp[i-1][j] * (1.0 - pi);
            dp[i][j+1] += dp[i-1][j] * pi;
        }
    }
    double ans = 0;
    int h = (N+1)/2;
    for (int i=h; i<=N; ++i) ans += dp[N][i];
    return ans;
}

int main() {
    int N; cin >> N;
    vd p(N);
    rep(i,N) cin >> p[i];
    printf("%.10f\n", solve(N,p));
    return 0;
}


Measured memory_bytes: 70656
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var n, d int

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	fmt.Scan(&n, &d)
	x := make([][]int, n)

	sc.Split(bufio.ScanWords)
	for i := 0; i < n; i++ {
		tmp := make([]int, d)
		for j := 0; j < d; j++ {
			tmp[j] = nextInt()
		}
		x[i] = tmp
	}

	count := 0
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			if isIntDistance(x[i], x[j]) {
				count++
			}
		}
	}

	fmt.Println(count)
}

func isIntDistance(x, y []int) bool {
	var result float64
	for i := 0; i < d; i++ {
		result += math.Pow(float64(x[i]-y[i]), 2)
	}
	result = math.Sqrt(result)
	if math.Trunc(result) == result {
		return true
	}
	return false
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#define endl "\n"
using namespace std;

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a, b;

  cin >> a >> b;

  cout << (a+b)%24 << endl; 

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main() {
    /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif*/
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int d[4]={0};
    for(int i=0;i<3;i++){
        int a,b;cin>>a>>b;
        a--; b--;
        d[a]++; d[b]++;
    }
    for(int i=0;i<4;i++){
        if(d[i]==3){
            cout<<"NO"; return 0;
        }
    }
    cout<<"YES";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 1000005;
struct NODE {
	double x,y;
}nd[N];
int cmp_(NODE x,NODE y) {
	return x.x<y.x;
}
int t,T;
int s[N],x_1,x_2,y_1,y_2;
template<class Cmp>  
int LIS (Cmp cmp)  
{  
    static int m, end[N];  
    m = 0;  
    for (int i=1;i<=t;i++)  
    {  
        int pos = lower_bound(end, end+m, s[i], cmp)-end;  
        end[pos] = s[i], m += pos==m;  
    }  
    return m;  
}  
int main() {
	cin>>x_1>>y_1>>x_2>>y_2;
	if(x_1==x_2&&y_1==y_2) {printf("0.000000000000000");return 0;}
	if(x_1>x_2) swap(x_1,x_2),swap(y_1,y_2);
	cin>>T;
	for(int a,b,i=1;i<=T;i++) {
		cin>>a>>b;
		if(a==x_1&&b==y_1) continue;
		if(a==x_2&&b==y_2) continue;
		if(a>=x_1&&a<=x_2) {
			if(y_1<y_2) {
				if(b>=y_1&&b<=y_2)
					nd[++t].x=a,nd[t].y=b;
			
			}	
			else {
				if(b>=y_2&&b<=y_1)
					nd[++t].x=a,nd[t].y=b;
			}
		}
	}
	sort(nd+1,nd+t+1,cmp_);
	for(int i=1;i<=t;i++)
		s[i]=nd[i].y;
	if(y_2<y_1) {
		int mid=(y_1+y_2+1)/2;
		for(int i=1;i<=t;i++)
			s[i]=mid-(s[i]-mid);
	}
	int len=LIS(less<int>());
//	printf("%d\n",len);
	double ans,pi=acos(-1);
	if(len==min(fabs(x_1-x_2),fabs(y_1-y_2))+1)
		ans=fabs(x_1-x_2)*100.0+fabs(y_1-y_2)*100.0-len*20.0+(len-1)*0.5*pi*10.0+pi*10.0;
	else 
		ans=fabs(x_1-x_2)*100.0+fabs(y_1-y_2)*100.0-len*20.0+len*0.5*pi*10.0;
	printf("%.15lf",ans);
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll A, B, C;
    cin >> A >> B >> C;
    cout << A * B / 2 << endl;
    return 0;
}


Measured memory_bytes: 3464
#include"bits/stdc++.h"
using namespace std;

//typedef
//------------------------------------------
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define COUT(x) cout<<x<<endl

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double PI = acos(-1.0);
const LL MOD = 1e9 + 7;
const ULL INF= 1e20;

//function
//--------------------------------------------
LL gcd(LL, LL);
bool isEven(LL);

int main() {
	string s;
	cin >> s;
	int ANS = 700;
	REP(i, 3)if (s[i] == 'o')ANS += 100;
	COUT(ANS);
	return 0;
}

LL gcd(LL a, LL b) {
	if (a == 0 || b == 0)return 0;
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	else gcd(b, a % b);
}
bool isEven(LL a) {
	return !((bool)(a % 2));
}

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

int main() {
	long long n;
	cin >> n;
	vector<long long> A(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	sort(A.begin(), A.end(), greater<long long>());
	long long ans = A[0];
	int x = n-2;
	for (int i = 1; i < n; i++) {
		if (x > 0) ans += A[i], x--;
		if (x > 0) ans += A[i], x--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4832
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String U = sc.next();

        if (U.equals(S)) {
            a--;
        } else {
            b--;
        }

        System.out.println(a + " " + b);

    }

}

Measured memory_bytes: 23380
from collections import deque, Counter
n = int(input())
s = deque([])
for i in range(n):
    s.append(input())
s_count = Counter(s).most_common()
s_count.sort()
s_count.sort(key=lambda x: x[1], reverse=True)
cnt_max = -1
for word, cnt in s_count:
    if cnt_max == -1:
        cnt_max = cnt
    if cnt_max == cnt:
        print(word)
    else:
        break

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


int Min_Water(int b,int A,int B,int E,int F){
	int i=0;
	int j=0;
	int water=F;

	for (i=0;i<=30;i++){
		while(1){
			int a=A*100*i+B*100*j;
			if (a>F-b) break;

			if ((float)b*100/(float)E<=(float)a && water>a){
				water=a;
				break;
			}
			j++;
		}
		j=0;
	}
	return water;
}



int main(){

	int A,B,C,D,E,F;
	scanf("%d",&A);
	scanf("%d",&B);
	scanf("%d",&C);
	scanf("%d",&D);
	scanf("%d",&E);
	scanf("%d",&F);

	int i=0;
	int j=0;
	float max_percent=0.0;
	int max_suger=0;
	int max_water=0;
	int total=0;

	for (i=0;i<=F;i++){
		for (j=0;C*i+D*j<=F;j++){
			int b=C*i+D*j;
			int a=Min_Water(b,A,B,E,F);

			if (a+b<=F){
				float percent=(float)b*100/(float)(a+b);

				if (percent>max_percent){
					max_percent=percent;
					max_water=a;
					max_suger=b;
					total=a+b;
				}
			}
		}
	}

	if (max_percent==0.0){
		total=A*100;
		max_suger=0;
	}

	printf("%d %d\n",total,max_suger);
	return 0;
}

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

int main()
{
	int N, K, Q, player;

	cin >> N >> K >> Q;
	int *score = new int[N];
	for (int i = 0; i < N; i++) score[i] = K;
	for (int i = 0; i < Q; i++)
	{
		cin >> player;
		score[player - 1]++;
	}

	for (int i = 0; i < N; i++)
		cout << (score[i] - Q > 0 ? "Yes" : "No") << endl;
	delete[] score;

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    int N, M, X;
    cin >> N >> M >> X;
    vector<ll> C(N);
    vector<vector<ll>> A(N, vector<ll>(M));
    REP(i, N){
        cin >> C[i];
        REP(j, M) cin >> A[i][j];
    }
    ll ans = 1e9;
    REP(i, pow(2, N)){
        ll cost = 0;
        vector<ll> tmp(M, 0);
        REP(j, N){
            if ((i >> j) % 2 == 1) {
                REP(k, M) tmp[k] += A[j][k];
                cost += C[j];
            }
        }
        bool f = true;
        REP(j, M){
            if (tmp[j] < X) f = false;
        }
        if (f) ans = min(ans, cost);
    }
    if (ans == 1e9) ans = -1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3200
#include<stdio.h>

#define NIL -1

typedef struct node{
    int p;
    int r;
    int l;
}Node;

Node T[25];

void Preorder(int u){
    if(u == NIL) return;
    printf(" %d", u);
    Preorder(T[u].l);
    Preorder(T[u].r);
}

void Inorder(int u){
    if(u == NIL)return;
    Inorder(T[u].l);
    printf(" %d", u);
    Inorder(T[u].r);
}

void Postorder(int u){
    if(u == NIL) return;
    Postorder(T[u].l);
    Postorder(T[u].r);
    printf(" %d", u);
}



int main(){
    int n, i, j;
    int v, l, r;
    int root;

    scanf("%d", &n);

    for(i=0; i<n; i++){
        T[i].p = NIL;
        T[i].l = NIL;
        T[i].r = NIL;
    }

    for(i=0; i<n; i++){
        scanf("%d%d%d", &v, &l, &r);
        T[v].l = l;
        T[v].r = r;
        if(l != NIL)T[l].p = v;
        if(r != NIL)T[r].p = v;
    }

    for (i=0; i<n; i++) {
        if (T[i].p == NIL) root = i;
    }

    printf("Preorder\n");
    Preorder(root);
    printf("\nInorder\n");
    Inorder(root);
    printf("\nPostorder\n");
    Postorder(root);
    puts("");
    return 0;
}





Measured memory_bytes: 2060
// -> limitless <- //
#include<iostream>
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define PB push_back
#define MP make_pair
#define f(i, x, n) for (int i = x; i < (int)(n); ++i)
#define lp(i, n) for (int i = 0; i < (int)(n); ++i)
#define read(n) scanf ("%d", &n)
using namespace std;
typedef unsigned long long ll;
    const int N = 1e5 + 2;
    const int mod = 1e9 + 7;

int main()
{
    int n;
    read(n);
    int sm = 0;
    lp(i, n){int a; scanf("%d", &a); sm += (a-1);}
    printf("%d\n", sm);
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long long const mod = 998244353;
long long mod_fact(int x){
    static vector<long long> fact = {1, 1};
    if(x < 0)return 0; //
    if(x < fact.size())return fact[x];
    for(int i = fact.size(); i <= x; i++){
        fact.push_back((fact[i-1] * i) % mod);
    }
    return fact[x];
}

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

long long mod_inv(long long a){
    return mod_pow(a, mod-2);
}

long long mod_comb(int a, int b){
    if(b < 0 || a < b)return 0;
    if(b > a/2)return mod_comb(a, a-b);
    return (((mod_fact(a) * mod_inv(mod_fact(a-b))) % mod) * mod_inv(mod_fact(b))) % mod;
}
int main(void){
    long long n, m, k, ans = 0;
    cin >> n >> m >> k;
    for(long long i = 0; i <= k; i++){
        long long t = mod_comb(n-1, i);
        t *= m * mod_pow(m-1, n-i-1) % mod;
        ans += t % mod;
        // cout << ans << endl;
    }
    cout << ans%mod << endl;
}


Measured memory_bytes: 4852