akhauriyash/Code-Regression huggingface dataset:
// J'aime
// Chemise Blanche

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  int n; cin >> n;
  cout << (n + 1) / 2 - 1 << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
int main()
{
    int N,M,totale,z;
    vector <int> tot;
    cin>>N>>M;
    for(int i=0;i<M;i++)
    {
        cin>>z;
        tot.push_back(z);
    }
    totale=accumulate(tot.begin(),tot.end(),0);
    if((N-totale)>=0)
    {
        cout<<(N-totale);
    }
    else
    {
        cout<<-1;
    }

    return 0;
}

Measured memory_bytes: 3632
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}
template<typename T>vector<T> & cset(vector<T> &A,T e=T()){for(auto &I:A){I=e;} return A;}

const int MX=2000;

bitset<MX> A[MX];
bitset<MX> dp[MX];

int main(){
    int n;
    cin>>n;
    char c;
    for(int i=0;i<n;i++){
        dp[i][i]=true;
        for(int j=0;j<i;j++){
            cin>>c;
            if(c=='1'){A[i][j]=true;}
            A[j][i]=!A[i][j];
        }
    }
    for(int i=1;i<n;i++){
        for(int j=0;i+j<n;j++){
            int R=i+j;
            int l=j+1;
            dp[R][j]=(A[j]&dp[l]&dp[R]).any();
        }
        for(int j=i;j<n;j++){
            int R=j-i;
            int l=j-1;
            dp[R][j]=(A[j]&dp[l]&dp[R]).any();
        }
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        if(dp[0][i] && dp[n-1][i]){ans++;}
    }
    cout<<ans<<endl;
    
    
    
    return 0;
}


Measured memory_bytes: 1280
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
struct ta
{
    long long x,y;
    long long h;
}t[1000];
int main()
{
    long long n;
    cin >> n;
    for(long long i = 0 ; i < n; i ++)
    {
        cin >> t[i].x >> t[i].y >> t[i].h;
    }
    long long maxx = 0,temp;
    ta ans;
    bool p;
    for(long long i = 0; i <= 100; i++)
    {
        for(long long j = 0; j <= 100; j ++)
        {
            for(long long k = 0; k < n; k ++)
            {
                if(t[k].h!=0)
                {
                    temp = t[k].h + abs(i - t[k].x) + abs(j - t[k].y);
                    maxx = k;
                    break;
                }
            }
            p = true;
            for(long long k = maxx+1; k < n; k ++)
            {
                if(t[k].h == 0)
                {
                    if(temp - abs(i - t[k].x) - abs(j - t[k].y) > 0)
                    {
                        p = false ;
                        break;
                    }
                }
                if(t[k].h!=0 && t[k].h + abs(i - t[k].x) + abs(j - t[k].y) != temp)
                {
                    p = false;
                    break;
                }
            }
            if(p)
            {
                ans.h = temp;
                ans.x = i;
                ans.y = j;
            }
        }
    }
    cout << ans.x << " " << ans.y << " " << ans.h <<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define pb push_back
#define all(x) x.begin(), x.end()
#define pi pair<int, int>
#define l first
#define r second

using namespace std;

const int maxn = 1e6 + 1;

bool v[11][1001];
int pf[11][1001];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++) {
            char c; cin >> c;
            v[i][j] = (c - '0');
        }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++)
            pf[i][j + 1] = pf[i][j] + v[i][j];
    }
    int ans = n * m;
    for (int mask = 0; mask < (1 << (n - 1)); mask++) {
        vector<int> rd;
        for (int x = mask, i = 0; i < n - 1; i++, x /= 2)
            if (x % 2) rd.pb(i);
        rd.pb(n);
        int i = 0, ca = 0;
        for (; i < m; ) {
            int l = i - 1, r = m;
            while (r - l > 1) {
                int md = (l + r) / 2;
                int cmx = 0, cp = 0, cx = 0;
                for (int j = 0; j < n; j++) {
                    if (j > rd[cp]) {++cp; cx = 0;}
                    cx += pf[j][md + 1] - pf[j][i];
                    cmx = max(cmx, cx);
                }
                if (cmx > k) r = md;
                else l = md;
            }
            if (l == i - 1) {ca = 14881488; break;}
            ++ca; i = l + 1;
        }
        ans = min(ans, ca - 1 + __builtin_popcount(mask));
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main(){
	var h,w int
	fmt.Scan(&h,&w)
	if h == 1 || w == 1{
		fmt.Println("1")
	} else if h%2 == 1 && w%2 == 1{
		fmt.Println(h*w/2+1)
	} else {
		fmt.Println(h*w/2)
	}
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }

const int MAX = 30000000;
ll f[MAX],finv[MAX],inv[MAX];
const ll MOD = 1e9+7;
void COMinit(int N){
    f[0] = 1;
    f[1] = 1;
    finv[0] = 1;
    finv[1] = 1;
    inv[1] = 1;
    for(int i=2;i<=N;++i){
        f[i] = f[i-1]*i %MOD;
        inv[i] = MOD - inv[MOD%i] *(MOD/i) %MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int N, int K){
    if(N<K || N<0 || K <0){ return 0; }
    return f[N] *(finv[K]*finv[N-K]%MOD) %MOD;
}

int main(){
  ll X,Y; cin>>X>>Y;
  ll ans = 0;
  ll a = X*2-Y;
  ll b = Y*2-X;
  if( a>=0 && a%3==0 && b>=0 && b%3==0 ){
      ll k = a/3;
      ll l = b/3;
      COMinit(k+l);
      ans = COM(k+l,k);
  }
  cout << ans << "\n";
}

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

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n, w;
	cin >> n >> w;
	ll weight[n], price[n];
	for (ll i = 0; i < n; i++)
		cin >> weight[i] >> price[i];
	ll maxN = 1000 * n;
	ll dp[n + 1][maxN + 1];
	for (ll i = 0; i <= maxN; i++)
		dp[0][i] = 2e9;
	dp[0][0] = 0;
	// dp[1][price[0]] = weight[0];
	for (ll i = 1; i <= n; i++)
		for (ll j = 1; j <= maxN; j++) {
			dp[i][j] = dp[i - 1][j];
			if (price[i - 1] <= j)
				dp[i][j] = min(dp[i][j] , weight[i - 1] + dp[i - 1][j - price[i - 1]]);
		}
	ll ans = 0;
	for (ll i = 0; i <= maxN; i++)
		if (dp[n][i] <= w)
			ans = i;
	cout << ans;
	return 0;
}

Measured memory_bytes: 82556
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define X first
#define Y second
#define mod 1e9+7
#define pb push_back
#define mp make_pair
#define abs(x) ((x)>0?(x):(-(x)))
#define F(n) Fi(i,n)
#define Fi(i,n) Fl(i,0,n)
#define Fl(i,l,n) for(int i=l;i<n;i++)
#define memres(a) memset(a,0,sizeof(a))
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
vector<int> tab[100001];
int vt[100001],ut[100001];
void dfsfv(int f,int t,int m){
	vt[t]=m;
	F(tab[t].size()){
		if(tab[t][i]!=f)dfsfv(t,tab[t][i],m+1);
	}
	return;
}
void dfsfu(int f,int t,int m){
	ut[t]=m;
	F(tab[t].size()){
		if(tab[t][i]!=f)dfsfu(t,tab[t][i],m+1);
	}
	return;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	int n,u,v,ma=0,c,mi=200000;
	cin>>n>>u>>v;
	F(n-1){
		int a,b;
		cin>>a>>b;
		tab[a].pb(b);
		tab[b].pb(a);
	}
	dfsfv(-1,v,0);
	c=vt[u];
	dfsfu(-1,u,0);
	Fl(i,1,n+1){
		if(vt[i]<ut[i])continue;
		else if(vt[i]==ut[i]){
			mi=min(mi,vt[i]);
		}
		else{
			if(c&1)ma=max(vt[i]-1,ma);
			else ma=max(vt[i]-1,ma);
		}
	}
	if(c&1==0)ma=max(mi,ma);
	cout<<ma<<endl;
return 0;
}


Measured memory_bytes: 11648
#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, m, l;
  cin >> n >> m >> l;
  vector<vector<int>> wf(n, vector<int>(n, l + 1));
  rep(i, m)
  {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    wf[a][b] = wf[b][a] = c;
  }
  rep(k, n)
    rep(i, n)
      rep(j, n)
        if (wf[i][k] <= l && wf[k][j] <= l)
          wf[i][j] = min(wf[i][j], wf[i][k] + wf[k][j]);
  vector<vector<int>> g(n);
  rep(i, n - 1)
    for (int j = i + 1; j < n; j++)
      if (wf[i][j] <= l)
      {
        g[i].push_back(j);
        g[j].push_back(i);
      }
  vector<vector<int>> g2(n, vector<int>(n, -1));
  rep(i, n)
  {
    queue<pair<int, int>> q;
    q.emplace(i, i);
    while (!q.empty())
    {
      auto p = q.front();
      q.pop();
      int pre = p.first;
      int crt = p.second;
      if (g2[i][crt] != -1)
        continue;
      if (pre != crt)
        g2[i][crt] = g2[i][pre] + 1;
      for (int nxt : g[crt])
        q.emplace(crt, nxt);
    }
  }
  int q;
  cin >> q;
  rep(i, q)
  {
    int s, t;
    cin >> s >> t;
    s--;
    t--;
    printf("%d\n", g2[s][t]);
  }
  return 0;
}

Measured memory_bytes: 2384
-- This file was written after reading the editorial.

import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
import Data.List

solve :: Int -> [[Int]] -> (Int, [Int], [String])
solve n xys
  | check rem rest = solve0 rem n xys
  | otherwise = (-1, [], [])
  where
    [x0,y0] : rest = xys
    rem = (x0 + y0) `mod` 2

check :: Int -> [[Int]] -> Bool
check rem xys = all (\[x,y] -> (x+y) `mod` 2 == rem) xys

solve0 :: Int -> Int -> [[Int]] -> (Int, [Int], [String])
solve0 rem n xys
  | rem == 1 = solve1 n xys
  | rem == 0 = (m+1, 1 : ds, map ('R' :) ws)
  where
    (m, ds, ws) = solve1 n $ map (\[x,y] -> [x-1,y]) $ xys

solve1 :: Int -> [[Int]] -> (Int, [Int], [String])
solve1 n xys = (m0+1, ds, ws)
  where
    uvs = map (\[x,y] -> (x-y, x+y)) xys
    m0 :: Int
    m0 = debug_m uvs
    ds = [2^i | i <- [m0,m0-1..0]]
    ws = [mkDir u v | (u, v) <- uvs]
    mkDir :: Int -> Int -> String
    mkDir u v = map f (zip seq_u seq_v)
      where seq_u = mkSeq u
            seq_v = mkSeq v
            f :: (Int,Int) -> Char
            f (  1 ,   1 ) = 'R'
            f (  1 , (-1)) = 'D'
            f ((-1),   1 ) = 'U'
            f ((-1), (-1)) = 'L'
    mkSeq :: Int -> [Int]
    mkSeq x = unfoldList f x ds
      where f x d | x > 0     = ( 1, x - d)
                  | otherwise = (-1, x + d)

unfoldList :: (s -> a -> (b,s)) -> s -> [a] -> [b]
unfoldList f s as = unfoldr g (s,as)
  where g (_, [])   = Nothing
        g (s, a:as) = Just (b, (s',as))
          where (b, s') = f s a

debug_m :: [(Int,Int)] -> Int
debug_m uvs = ceiling (logBase (fromIntegral 2) (fromIntegral uvmax))
  where uvmax = maximum [max (abs u) (abs v) | (u,v) <- uvs]

bsReadInts :: B.ByteString -> [Int]
bsReadInts = map (fst . fromJust . B.readInt) . B.words

main :: IO ()
main = do
  conts <- B.getContents
  let [n] : xys = map bsReadInts (B.lines conts)
      (m, ds, ws) = solve n xys
  if m < 0 then putStrLn "-1"
    else do
    putStrLn $ show m
    putStrLn $ unwords $ map show ds
    putStr $ unlines ws


Measured memory_bytes: 1148
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll n,m,ans=-1;
  cin >> n >> m;
  vector<ll> s(m),c(m);
  for(int i=0;i<m;i++){
    cin >> s[i] >> c[i];
    s[i]--;
  }
  for(int i=0;i<1000;i++){
    string ti = to_string(i);
    if(ti.size()!=n) continue;
    bool can = true;
    for(int j=0;j<m;j++){
      if(ti[s[j]]-'0' != c[j]){
        can = false;
      }
    }
    if(can){
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}


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

class street{
public:
  int a,b,d;
  void set(int x,int y,int z){a = x;b = y;d = z;};
  bool operator<(const street x)const{return d>x.d;}
};

int uf[100],rank[100];

int par(int x){
  if(uf[x] == x)return x;
  return uf[x] = par(uf[x]);
}

void unit(int x,int y){
  x = par(x);
  y = par(y);
  if(x==y)return;
  if(rank[x] < rank[y]){
    uf[x] = y;
  }else{
    uf[y] = x;
    if(rank[x]==rank[y])rank[x]++;
  }
}

int main(){
  int n,m;

  while(scanf("%d",&n) && n){
    scanf("%d",&m);
    priority_queue<street> q;

    for(int i=0;i<m;i++){
      int x,y,z;
      scanf("%d%*c%d%*c%d ",&x,&y,&z);
      q.push((street){x,y,z/100-1});
    }
    
    for(int i=0;i<n;i++){
      uf[i] = i;
      rank[i] = 0;
    }
    int ans = 0;

    while(q.size()){
      street s = q.top();q.pop();
      if(par(s.a) != par(s.b)){
	ans += s.d;
	unit(s.a,s.b);
      }
    }
    printf("%d\n",ans);
  }
}

Measured memory_bytes: 0
import collections

n=int(input())
arr=list(map(int,input().split()))
cnt=collections.defaultdict(int)
for val in arr: #あらかじめ各Aiの個数を数えておく
 cnt[val]+=1
sums=sum(arr) #あらかじめAiの総和を求めておく
q=int(input())
for _ in range(q):
 b,c=map(int,input().split())
 diff=(c-b)*(cnt[b]) #各クエリにおいて数列Aの総和は(値がBiである要素の個数)*(Ci-Bi)だけ変化する
 sums+=diff
 print(sums) 
 cnt[c]+=cnt[b] #値がCi,Biである要素の個数を更新する
 cnt[b]=0

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

int main() {
    int n;
    cin >>n;
    
    vector<int> jousi(n-1);
    vector<int> b(n,0);
    
    for(int i=0;i<n-1;i++){
        cin>>jousi.at(i);
    }
  
    for(int j=0;j<n-1;j++){
        b.at(jousi.at(j)-1)++;
        }

    for(int k=0;k<n;k++){
        cout<<b.at(k)<<endl;
    }

}


Measured memory_bytes: 4840
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
 
using namespace std;
 
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
#define MAX 100010
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES

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

    int a,b,c;
    cin>>a>>b>>c;
    vector<int> v;
    v.push_back(a);
    v.push_back(b);
    v.push_back(c);
    sort(v.begin(),v.end());
    cout<<v[2]*10+v[1]+v[0];
	return 0;
} 

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


ans = 0

for i in range(N-1,-1,-1):
    if A[i+1] > 0:
        if B[i] > A[i+1]:
            ans += A[i+1]
            B[i] -= A[i+1]
            A[i+1] = 0
        else:
            ans += B[i]
            A[i+1] -= B[i]
            B[i]=0
    if B[i] > 0:
        if B[i] > A[i]:
            ans += A[i]
            B[i] -= A[i]
            A[i] = 0
        else:
            ans += B[i]
            A[i] -= B[i]
            B[i]=0


print(ans)


Measured memory_bytes: 82020
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;
constexpr ll LL_MAX = numeric_limits<ll>::max();
constexpr ull ULL_MAX = numeric_limits<ull>::max();

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

int main() {
    unordered_map<string, ll> freq;
    ll N;
    cin >> N;
    rep(i,0,N) {
        string s;
        cin >> s;
        freq[s]++;
    }
    ll max_freq = numeric_limits<ll>::min();
    for (auto& kv : freq) {
        max_freq = max(max_freq, kv.second);
    }
    vector<string> ans;
    for (auto& kv : freq) {
        if (kv.second == max_freq) {
            ans.push_back(kv.first);
        }
    }
    sort(ans.begin(), ans.end());
    for (auto& s : ans) {
        cout << s << endl;
    }
}


Measured memory_bytes: 22648
#!/usr/bin/env python3
#ABC137 C

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
s = [list(input()) for _ in range(n)]
for i in s:
    i.sort()
s = [''.join(i) for i in s]
t = list(Counter(s).items())
ans = 0
for i,j in t:
    if j == 1:
        continue
    else:
        ans += (j)*(j-1)//2
print(ans)


Measured memory_bytes: 31800
n, m = map(int, input().split())
A = [[] for i in range(n)]
for i in range(n):
    A[i] = list(map(int, input().split()))

B = []
for i in range(m):
    x = int(input())
    B.append(x)

res = [0 for i in range(n)]

for i in range(n):
    for j in range(m):
        res[i] += A[i][j] * B[j]

for i in range(n):
    print(res[i])



Measured memory_bytes: 6020
<?php

fscanf(STDIN, "%s", $s);
$c = 0;
$result = 0;

$w = [];
for ($i = 0; $i < strlen($s); $i++) {
    if ($s[$i] === 'W') {
        $w[] = $i;
        $c++;
    }
}

for ($i = 0; $i < $c; $i++) {
    $result += $w[$i] - $i;
}

echo $result . "\n";

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

int main(){
  ll n;
  cin>>n;
  int vec[100];
  int x=0;
  while(n>0){
    vec[x]=n%26;
    if(n%26==0){
      n/=26;
      n--;
    }
    else{
      n-=n%26;
      n/=26;
    }
    x++;
  }
  string s="abcdefghijklmnopqrstuvwxyz";
  for(int i=x-1;i>=0;i--){
    if(vec[i]==0){
      cout<<"z";
      continue;
    }
    cout<<s[vec[i]-1];
  }
  cout<<endl;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;

class Solution
{
    static void Main()
    {
        var s = Console.ReadLine();
        var ok = s.Contains("AC");

        if(ok)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
const ll MOD = 1000000007;

int main() {
  int n, m;
  cin >> n >> m;
  ll xsum = 0, ysum = 0;
  rep(i, n) {
    ll x;
    cin >> x;
    xsum += x * (2 * i - n + 1);
    xsum %= MOD;
  }
  rep(i, m) {
    ll y;
    cin >> y;
    ysum += y * (2 * i - m + 1);
    ysum %= MOD;
  }
  cout << xsum * ysum % MOD << endl;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int h,w;cin>>h>>w;
    vector<vector<int>>a(h,vector<int>(w));
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >>a[i][j];
        }
    }
    vector<int>ans0;
    vector<int>ans1;
    vector<int>ans2;
    vector<int>ans3;
    for (int j = 0; j < w; ++j) {
        for (int i = 0; i < h - 1; ++i) {
            if(a[i][j]%2==1){
                a[i+1][j]++;
                a[i][j]--;
                ans0.push_back(i+1);
                ans1.push_back(j+1);
                ans2.push_back(i+2);
                ans3.push_back(j+1);
            }
        }
    }
    for (int j = 0; j < w - 1; ++j) {
        if(a[h-1][j]%2==1){
            a[h-1][j+1]++;
            a[h-1][j]--;
            ans0.push_back(h);
            ans1.push_back(j+1);
            ans2.push_back(h);
            ans3.push_back(j+2);
        }
    }
    cout <<ans0.size()<<endl;
    for (int i = 0; i < ans0.size(); ++i) {
        cout <<ans0[i]<<" "<<ans1[i]<<" "<<ans2[i]<<" "<<ans3[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 6372
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s

n = load()
A = load_list()

result = [0 for i in range(n+1)]
for i in range(n):
    result[A[i]] = i+1

print(join_i(result[1:], " "))


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

int main() {
  int n;
  cin >> n;
  vector<int> h;
  for(int i = 0; i < n; i++) {
  	int temp;
    cin >> temp;
    h.push_back(temp);
  }
  vector<int> dp(n, 0);
  // dp[0] = 0 - min cost to reach stone 1 from stone 1
  dp[1] = abs(h[0] - h[1]);
  for(int i = 2; i < n; i++) {
  	dp[i] = min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i]));	
  } 
  cout << dp[n - 1];
  return 0;
}

Measured memory_bytes: 1144
bingo = (0..2).map do 
  gets.split(' ').map { |v| { value: v.to_i, open: false } }
end
  
N = gets.to_i

(1..N).each do
  v = gets.to_i
  bingo = bingo.map do |row|
    row.map do |cell|
      if cell[:value] == v
        cell[:open] = true
      end
      cell
    end
  end
  (0..2).each do |i|
    if bingo[i].all? { |cell| cell[:open] }
      puts 'Yes'
      exit
    end
    if bingo.all? { |col| col[i][:open] }
      puts 'Yes'
      exit
    end
    
    if bingo[0][0][:open] && bingo[1][1][:open] && bingo[2][2][:open]
      puts 'Yes'
      exit
    end
    if bingo[2][0][:open] && bingo[1][1][:open] && bingo[0][2][:open]
      puts 'Yes'
      exit
    end
  end
end

puts 'No'

Measured memory_bytes: 1788
import itertools
N=int(input())

def returnSplit(N):
    if N%2==0:
        return [[i+1,N-i] for i in range(N//2)]
    else:
        return returnSplit(N-1)+[[N]]


blocks=returnSplit(N)
retval=[]

for i in range(len(blocks)):
    for j in range(i+1,len(blocks)):
        for k in itertools.product(blocks[i],blocks[j]):
            retval.append(k)


print(len(retval))
for i in retval:
    print("{0} {1}".format(*i))


Measured memory_bytes: 3724
import sys
input = sys.stdin.readline
N, x = map(int, input().split())
a = list(map(int, input().split()))
res = 0
for i in range(1, N):
  if a[i - 1] + a[i] > x:
    t = a[i - 1] + a[i] - x
    res += t
    if t > a[i]:
      t -= a[i]
      a[i] = 0
      a[i - 1] -= t
    else:
      a[i] -= t
print(res)

Measured memory_bytes: 59632
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define ALL(x) (x).begin(),(x).end()
#define lowbit(x) x&-x
#define pb push_back
#define ls (id<<1)
#define rs (id<<1|1)
#define Rint register int
#define UNI(x) sort(ALL(x)),x.resize(unique(ALL(x))-x.begin())
#define GETPOS(c,x) (lower_bound(ALL(c),x)-c.begin())
#define LEN(x) strlen(x)
#define MS0(x) memset((x),0,sizeof((x)))
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<pii> Vpii;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(ll &x) { scanf("%lld", &x); }
void _R(ull &x) { scanf("%llu", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const ll &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
const int MAXN=2e6+10,MAXM=4e6+10;
const int INF=INT_MAX,SINF=0x3f3f3f3f;
const ll llINF=LLONG_MAX;
const int MOD=1e9+7,mod=998244353;
const int inv2=5e8+4;
const int Lim=1<<20;

void solve()
{
   ll a,b,n;
   R(a,b,n);
   ll tmp=min(b-1,n);
   W(a*tmp/b-a*(tmp/b));
}

int main()
{
    //freopen("in.txt","r",stdin);
    int t=1;
    //R(t);
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 3828
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		ArrayList<Integer> valueList = new ArrayList<Integer>();
		for(int i = 0; i < n; ++i){
			valueList.add(sc.nextInt());
		}
		Collections.sort(valueList);
		Collections.reverse(valueList);
		
		double ans = 0.0;
		double coefficient = 1.0;
		
		for(int i = 0; i < n; ++i){
			if(i < n - 1){
				coefficient *= 0.5;
			}
			ans += valueList.get(i) * coefficient;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21972
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <bitset>
#include <stack>
#include <cstdlib>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = s; n > i; i++)
#define REP(i,n) rep(i,0,n)
#define MODU 33
#define Range(x,a,b) ((a) <= (x) && (x) <= (b))
#define POWT(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef vector<int> Ivec;
typedef pair<int, int> pii;
typedef long long int ll;

int main() {
	int n, m;
	scanf("%d %d", &n, &m);

	vector<int> trgts(m);
	REP(i, m) {
		scanf("%d", &trgts[i]);
	}
	vector<int> pt(n);
	REP(i, m) {
		int los = 0;
		REP(j, n) {
			int cur;
			scanf("%d", &cur);
			if (trgts[i] == cur)
				pt[j]++;
			else pt[trgts[i]-1]++;
		}
	}
	REP(i, n) {
		printf("%d\n", pt[i]);
	}

	return 0;
}

Measured memory_bytes: 3220
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(void){
  int n;
  cin >> n;
  int c[n - 1], s[n - 1], f[n - 1];
  rep(i, n - 1) cin >> c[i] >> s[i] >> f[i];

  rep(i, n){
    int t = 0;
    for(int j = i; j < n - 1; j++){
      if(t < s[j]) t = s[j];
      else if(t % f[j] == 0);
      else t += f[j] - t % f[j];
      t += c[j];
    }
    cout << t << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n,x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0

if a[0]>x:
    ans = ans+(a[0]-x)
    a[0]=x

for i in range(0,n-1):
    if a[i]+a[i+1]>x and a[i]>=0 and a[i+1]>0:
        ans += (a[i+1]-(x-a[i]))
        a[i+1] = x - a[i]
        
print(ans)

Measured memory_bytes: 14052
A = list(map(int, input().split()))
A += list(map(int, input().split()))
A += list(map(int, input().split()))
N = int(input())

idx = set()

def check(mat):
    len = 1
    len *= (mat[0] + mat[1] + mat[2])
    len *= (mat[3] + mat[4] + mat[5])
    len *= (mat[6] + mat[7] + mat[8])
    len *= (mat[0] + mat[3] + mat[6])
    len *= (mat[1] + mat[4] + mat[7])
    len *= (mat[2] + mat[5] + mat[8])
    len *= (mat[0] + mat[4] + mat[8])
    len *= (mat[2] + mat[4] + mat[6])
    return len

for i in range(N):
    b = int(input())
    if b in A:
        idx = A.index(b)
        A[idx] = 0

if (0 == check(A)):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include<queue>
#include <sstream>
#include <set>
#include<stack>
#include <utility>

const long long MOD = 1000000007;
using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//c_str()変換
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

//queueクラス
//find()次に取り出す値の表示をする。
//pop()値を取り出す。戻り値はなし
//push()キューに値をプッシュする

//priority_queueクラス

//切り上げ
//ceil
//floor

int main(){
    llong a,b,c,d;
    cin >> a >> b >> c >> d;
    llong ans;
    ans = max(a*c, a*d);
    ans = max(ans, b*c);
    ans = max(ans, b*d);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3192
/* ITP1_3_D: How Many Divisors */
/* 20181118 AOJ */

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

int main(void){
	int a, b, c, cnt = 0;

	scanf("%d %d %d", &a, &b, &c);
	while(a <= b && a <= c){
		if(c % a == 0) cnt++;
		a++;
	}

	printf("%d\n", cnt);

	return 0;
}


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

int main(){
    int n, x;
    cin >> n >> x;
    while (n != 0 || x != 0)
    {
        int count = 0;
        for(int i = 1; i <= n; i++){
            for(int j = i + 1; j <= n; j++){
                for(int k = j + 1; k <= n; k++){
                    if(i + j + k == x) count++;
                }
            }
        }
        cout << count << endl;
        cin >> n >> x;
    }
    
    return 0;
}


Measured memory_bytes: 3084
from itertools import accumulate
import copy

def sol(acmA, sign=1):    
  add = 0
  ans = 0
  if sign==1:
    if acmA[0] <= 0:
      add = -acmA[0]+1
      ans = abs(-acmA[0]+1)
      acmA[0] = 1
  else:  
    if acmA[0] >= 0:
      add = -acmA[0]-1
      ans = abs(-acmA[0]-1)
      acmA[0] = -1      
      
  for i in range(1,N):
    acmA[i] += add
    tmp_add = 0
    if sign == 1:
      if i%2==0:
        if acmA[i] <=0:
          tmp_add = -acmA[i]+1
      else:
        if acmA[i] >=0:
          tmp_add = -acmA[i]-1
    else:
      if i%2==1:
        if acmA[i] <=0:
          tmp_add = -acmA[i]+1
      else:
        if acmA[i] >=0:
          tmp_add = -acmA[i]-1     
   
    #print(i, tmp_add, acmA[i])
    acmA[i] += tmp_add
    add +=  tmp_add
    ans +=abs(tmp_add)
  if acmA[-1] == 0: return ans +1
  else: return ans

N = int(input())
A = list(map(int,input().split()))
acmA = list(accumulate(A))
acmA2 = copy.deepcopy(acmA)
print(min(sol(acmA, 1), sol(acmA2, -1)))

Measured memory_bytes: 93220
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;

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

/* 定数 */
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;

#define ALL(v) v.begin(), v.end()

#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    u32 L;
    cin >> L;
    f64 x = L / 3.0, y = L / 3.0, z = L - x - y;
    cout << x * y * z << endl;
}


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

// --------------------------------------------------------------------------------
#define fastio	ios_base::sync_with_stio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b,k) for(int i=a;i<=b;i+=k)
#define frepj(a,b,k) for(int j=a;j<=b;j+=k)
// --------------------------------------------------------------------------------


void solve_main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int win = -1;
    bool ok = true;
    while(1)
    {
    	if(!ok)
    	{
    		a-=d;
    		if(a<1)
    		{
    			win = 2;
    			break;
    		}
    	}
    	else
    	{
    		c-=b;
    		if(c<1)
    		{
    			win=1;
    			break;
    		}
    	}
    	ok = !ok;
    }
    if(win==1)
    	cout<<"Yes";
    else cout<<"No";
}

int main()
{
	// #ifndef ONLINE_JUDGE
 //    	freopen("/home/suryakant/input.txt","r",stdin);
 //        freopen("/home/suryakant/output.txt","w",stdout);
 //    #endif
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve_main();
    }
    
}

Measured memory_bytes: 3548
#include <stdio.h>

int main(void) {
	char str[2][1024];
	int pos[2], i;
	int possible;
	int turn, iturn;
	if (scanf("%s", str[0]) != 1) return 1;
	if (scanf("%s", str[1]) != 1) return 1;
	for (iturn = 0; iturn <= 1; iturn++) {
		pos[0] = pos[1] = 0;
		turn = iturn;
		possible = 1;
		for (i = 0; str[0][i] != '\0'; i++) {
			while (str[turn][pos[turn]] != '\0' && str[turn][pos[turn]] != str[0][i]) {
				pos[turn]++;
			}
			if (str[turn][pos[turn]] == '\0') {
				possible = 0;
				break;
			}
			pos[turn]++;
			turn = 1 - turn;
		}
		if (possible) {
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}

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

int main(){
	int k, x;
	cin >> k >> x;

	if(x <= k*500) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
using namespace std;

typedef long long ll;

int di[] = { 1, 0, -1, 0 }, dj[] = { 0, 1, 0, -1 };
int grid[105][105];


int main() {
	int A, B; cin >> A >> B;
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			grid[i][j] = i < 50 ? 1 : -1;
		}
	}
	int ca = 1, cb = 1;
	for (int i = 0; i < 50; i += 2) {
		for (int j = 0; j < 100; j += 2) {
			if (cb < B) {
				grid[i][j] = -1;
				cb++;
			}
		}
	}
	for (int i = 99; i >= 50; i -= 2) {
		for (int j = 0; j < 100; j += 2) {
			if (i % 2 == j % 2) continue;
			if (ca < A) {
				grid[i][j] = 1;
				ca++;
			}
		}
	}
	cout << 100 << " " << 100 << endl;
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			cout << (grid[i][j] == 1 ? "." : "#");
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int unsigned long long
#define endl "\n"
using namespace std;

int32_t main() {
  ios;
  int t = 1;
  // cin>>t;
  while(t--) {
    string s,t;
    cin>>s>>t;
    cout<<t+s;
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 3640
S = input()

yyyy, mm, dd = S.split('/')
yyyy = int(yyyy)
mm = int(mm)
dd = int(dd)

if yyyy > 2019:
  print('TBD')

elif yyyy <= 2019:
  if mm <= 4:
    print('Heisei')
  else:
    print('TBD')
else:
  print('TBD')

Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
/*#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2")  //Enable AVX*/

using namespace std;

using ll = long long;

#define mp make_pair

const int p = 998244353;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};*/

/*const int N = 1000000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

vector<pair<int, int>> solve(vector<int> &a)
{
    map<int, int> kek;
    for (auto it: a) kek[it]++;
    vector<pair<int, int>> ans;
    for (auto it: kek) ans.push_back(mp(it.second, it.first));
    sort(ans.begin(), ans.end());
    reverse(ans.begin(), ans.end());
    return ans;
}


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

    int n;
    cin>>n;
    vector<int> a, b;
    int t;
    for (int i = 0; i<n; i++)
    {
        cin>>t;
        if (i%2) a.push_back(t);
        else b.push_back(t);
    }
    auto A = solve(a);
    auto B = solve(b);
    if (A[0].second!=B[0].second)
    {
        cout<<n - A[0].first - B[0].first; return 0;
    }
    else
    {
        int maxx = 0;
        if (A.size()>=2) maxx = max(maxx, A[1].first + B[0].first);
        if (B.size()>=2) maxx = max(maxx, B[1].first + A[0].first);
        if (A.size()==1 && B.size()==1) maxx = n/2;
        cout<<n - maxx;
    }


}




Measured memory_bytes: 4216
def is_exist_triangle(a, b, c):
    l = [a, b, c]
    l.sort()
    return l[0] + l[1] > l[2] if len(set(l)) == 3 else False


def main():
    n = int(input())
    length = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                ans += 1 if is_exist_triangle(length[i], length[j], length[k]) else 0
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9156
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;

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

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

const int inf = 1e9 + 7;
const ll longinf = 1LL << 50;
const long long mod_const = 1e9+7;

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

using MIte = multimap<ll, ll, greater<ll> >::iterator;

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

using pll = pair<long long, long long>;

vector<ll> divisor(ll n) {
	vector<ll> vec;
	for (ll i = 1; i * i <= n; ++i) {
		if (n % i == 0) {
			vec.push_back(i);
		}
	}
	return vec;
}


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

	ll N;
	cin >> N;

	vector<ll> vec = divisor(N);

	ll ans = longinf;
	for (int i = 0; i != vec.size(); ++i) {
		ans = min(ans, vec[i] + N / vec[i] - 2);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main()
{
    int a,b=0,i;
    double sum;
    scanf("%d",&a);
    for(i=1;i<=a;i=i+2)
    {
        b++;
    }

    sum=(double)b/(double)a;
    printf("%.10lf\n",sum);




    return 0;
}


Measured memory_bytes: 128
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
if a[n-1] == 0:
    print("0")
    exit()
ans = 1
for i in a:
    ans *= i
    if ans > 10 ** 18:
        ans = -1
        break
print(ans)

Measured memory_bytes: 21648
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<numeric>
#include<string>
#include<vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll mod = 1e9+7;

template<typename T>
int insertion_sort(vector<T> &a, int g) {
    int cnt = 0;
    for(int i = g; i < a.size(); i+=1) {
        T v = a[i];
        int j = i - g;
        while(j >= 0 && a[j] > v) {
            a[j+g] = a[j];
            j-=g;
            ++cnt;
        }
        a[j+g] = v;
    }
    return cnt;
}

template<typename T>
void shellSort(vector<T> &a) {
    int cnt = 0;
    int m = 0;
    for(int i=1; i<=a.size(); i=i*3+1) {
        ++m;
    }
    cout << m << endl;
    int G[m];
    for(int i=m-1, j=1; i>=0; --i, j=j*3+1) {
        G[i] = j;
    }
    rep(i,m) {
        if(i) cout << " ";
        cout << G[i];
    }
    cout << endl;
    for(int i=0; i<m; ++i) {
        cnt += insertion_sort(a, G[i]);
    }
    cout << cnt << endl;
}

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    shellSort<ll>(a);
    rep(i,n) cout<<a[i]<<endl;
    return 0;
}


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

#define all_of(x) std::begin(x), std::end(x)
#ifdef _GLIBCXX_DEBUG
    #define debug(x) cerr << #x << ": " << x << endl
#else
    #define debug(x) 
#endif

using namespace std;

using LL = long long;

template<typename T>
ostream& operator << (ostream& out, const vector<T>& v) {
    out << "[";
    for(const auto& x : v) {
        out << x << ", ";
    }
    return out << "]";
}
template<typename T>
istream& operator >> (istream& in, vector<T>& v) {
    for(auto& x : v) {
        in >> x;
    }
    return in;
}

template<typename S, typename T>
ostream& operator << (ostream& out, const pair<S, T>& p) {
    return out << "{" << p.first << ", " << p.second << "}";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    LL a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max({a * c, a * d, b * c, b * d}) << "\n";
    
    
    
    return 0;
}


Measured memory_bytes: 3648