akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<bits/stdc++.h>
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define ll long long int
#define F first
#define S second
#define endl "\n"
#define f(i,x,n) for(ll i=x;i<n;i++)
using namespace std;
string ans="";
void solve(string s,string t){
	int n=s.size(),m=t.size();
	ll dp[n+1][m+1];
	f(i,0,n+1){
		f(j,0,m+1){
			if(i==0 || j==0) dp[i][j]=0;
			else{
				if(s[i-1]==t[j-1]) {
				dp[i][j]=1+dp[i-1][j-1];
			}
			else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
}
	int i=n-1,j=m-1;
	while(i>=0 && j>=0){
	//	cout<<"i"<<i<<" j"<<j<<endl;
			if(s[i]==t[j]) {
			ans+=s[i];
			i--; j--;
		}
		else {
			if(dp[i][j+1]>dp[i+1][j]){
				i--;
			}
			else if(dp[i][j+1]<dp[i+1][j]) j--;
			else {j--;
			}
		}
	}
}
int main(){
		string s,t; cin>>s>>t;
		solve(s,t);
		reverse(ans.begin(),ans.end());
			cout<<ans<<endl;

	 
	return 0;
	}

Measured memory_bytes: 70656
a = input().rstrip().split(' ')
b=[int(i) for i in a]
S,T,U=b[0],b[1],b[2]
if S>U:
    S1=S-U
    print(S1,T)
elif S==U:
    print(0,T)
elif S<U and S+T>U:
    U1=U-S
    T1=T-U1
    print(0,T1)
else:
    print(0,0)

Measured memory_bytes: 3064
//Gvs Akhil (Vicennial)
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ld(a) while(a--)
#define tci(v,i) for(auto i=v.begin();i!=v.end();i++)
#define tcf(v,i) for(auto i : v)
#define all(v) v.begin(),v.end()
#define rep(i,start,lim) for(long long (i)=(start);i<(lim);i++)
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define osit ostream_iterator
#define INF 		0x3f3f3f3f
#define LLINF       1000111000111000111LL
#define PI 			3.14159265358979323
#define endl '\n'
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
const int N=1000006;
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef tuple<int,int,int> iii;
typedef set<int> si;
typedef complex<double> pnt;
typedef vector<pnt> vpnt;
typedef priority_queue<ii,vii,greater<ii> > spq;
const ll MOD=1000000007LL;
template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
template<typename T> T power(T x,T y,ll m=MOD){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
int32_t main(){
	int n,p; cin>>n>>p;
	int ct=0;
	rep(i,0,n){
		int x; cin>>x;
		ct+=x%2;
	}
	int total=(1LL<<n);
	int eways;
	if(ct)
	eways=((1LL<<(ct))/2)*(1LL<<(n-ct));
	else eways=total;
//	trace5(n,p,total,ct,eways);
	if(p==0) cout<<eways;
	else cout<<total-eways;
}



Measured memory_bytes: 256
mod = 10**9 + 7
n = int(input())
caps = ['A','G','C','T']
agct = []
for a in caps:
    for b in caps:
        for c in caps:
            if a+b+c not in ['AGC','GAC','ACG']:
                agct.append(a+b+c)

ngs = set(['AGC','GAC','ACG','AGGC','ATGC','AAGC','AGAC','AGTC'])           
dic = {}
for trio in agct:
        dic[trio] =1
for _ in range(n-3):
    dic2 = {x:0 for x in agct}
    for trio in agct:
        for cap in caps:
            quad = trio + cap
            if (not quad in ngs) and (not quad[1:] in ngs):
                dic2[quad[1:]] += dic[trio]
    dic = dic2

print(sum(dic.values())%mod)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
    cin >> a >> b >> c;

    if(a == b){
        if(b == c) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    else
    {
        if(b == c) cout << "Yes" << endl;
        else{
            if (a == c) cout << "Yes" << endl;
            else cout << "No" << endl;
        }
    } 
}

Measured memory_bytes: 256
//-----------------------
// author : xyqkoala
// time : 2020-07-01
//-----------------------

#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;

typedef long long LL;
const int MOD = 1e9+7;

void solve();


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


void solve(){
	int a;
	cin>>a;
	cout<<a + a*a + a*a*a<<endl;
}


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

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

const int INF = 100000000;
const double PI=acos(-1);

int main(){
    int A,B,C,D,E,F;
    cin >> A >> B >> C >> D >> E >> F;
    set<int> Ws,Ss;
    vector<int> W(0),S(0);
    for (int i=0; i<=F; i+=A*100){
        for (int j=B*100; i+j<=F; j+=B*100) {
            if (!Ws.count(i+j)) {
                Ws.insert(i+j);
                W.push_back(i+j);
            }
        }
    }
    for (int i=0; i<=F; i+=B*100){
        for (int j=A*100; i+j<=F; j+=A*100) {
            if (!Ws.count(i+j)) {
                Ws.insert(i+j);
                W.push_back(i+j);
            }
        }
    }

    for (int i=0; i<=E*F/100+1; i+=C){
        for (int j=0; i+j<=E*F/100+1; j+=D) {
            if (!Ss.count(i+j)) {
                Ss.insert(i+j);
                S.push_back(i+j);
            }
        }
    }

    for (int i=0; i<=E*F/100+1; i+=D){
        for (int j=0; i+j<=E*F/100+1; j+=C) {
            if (!Ss.count(i+j)) {
                Ss.insert(i+j);
                S.push_back(i+j);
            }
        }
    }   
    
    sort(S.begin(),S.end());

    double n_tmp;
    int s_tmp,w_tmp;
    n_tmp = -1.0;
    rep(i,W.size()) {
        rep(j,S.size()) {
            int X;
            X = E*W[i]/100;
            if (S[j]>X) {
                continue;
            }
            else {
                if (n_tmp<(1.0*S[j]/(W[i]/100)) && (W[i]+S[j])<=F) {

                    n_tmp = (1.0*S[j]/(W[i]/100));
                    s_tmp = S[j];
                    w_tmp = W[i];
                }
            }
        }
    }

    cout << w_tmp+s_tmp << " " << s_tmp << endl;

    
}


Measured memory_bytes: 384
from string import ascii_lowercase

n = int(input())
strings = [input() for _ in range(n)]
alphabets = [a for a in ascii_lowercase]

counts = []
for a in alphabets:
    for i in range(n):
        count = strings[i].count(a)
        if count == 0:
            break
        if i == 0:
            m = count
            continue
        m = min(m, count)
    else:
        counts.append((a, m))

ans = ''
for count in counts:
    ans += count[0] * count[1]

print(ans)


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

namespace cola2
{
    class Program
    {
        static void Main()
        {
            List<int> list_num = new List<int>();
            int num = 1;

            while(true)
            {
                num = int.Parse(Console.ReadLine());
                if (num > 0)
                {
                    list_num.Add(num);
                }
                else
                {
                    break;
                }
            }

            for(int i = 0; i < list_num.Count; i++)
            {
                Console.WriteLine("Case {0}: {1}", i + 1, list_num[i]);
            }
        }
    }
}

Measured memory_bytes: 9364
#include <stdio.h>
 
#define M 36
 
typedef struct{
  char m;
  int v;
}Trump;
 
int main(){
   
  int n, i, j, f, min;
  Trump x[M], y[M], t ;
 
 
  scanf("%d",&n);
 
 
  for(i = 0 ; i < n ; i++){
    //scanf("%c%d",&x[i].m, &x[i].v);
    scanf("%c%c%d",&x[i].m, &x[i].m, &x[i].v);
    y[i] = x[i];
  }
   
 
  
 
  for(i = 0 ; i < n ; i++)
    for(j = n-1 ; j >= i+1 ; j--)
      if(x[j].v < x[j-1].v){
    t = x[j];
    x[j] = x[j-1];
    x[j-1] = t;
      }
   
 
 
  for(i = 0 ; i < n ; i++){
    min = i;
    for(j = i ; j < n ;j++)
      if(y[j].v < y[min].v)
    min = j;
    t = y[i];
    y[i] = y[min];
    y[min] = t;     
  }
 
 
 
 
  for( i = 0 ; i < n-1 ; i++){
    printf("%c%d ",x[i].m, x[i].v);
  }
  printf("%c%d\n",x[n-1].m, x[n-1].v);
  printf("Stable\n");
  
  for( i = 0 ; i < n-1 ; i++){
    printf("%c%d ",y[i].m, y[i].v);
  }
  printf("%c%d\n",y[n-1].m, y[n-1].v);
 
 
  f = 1;
 
 
  for(i = 0 ; i < n ; i++)
    if(x[i].m != y[i].m)
      f = 0;
 
 
  if(f == 1)
    printf("Stable\n");
  else
    printf("Not stable\n");
  
 
  return 0;
}

Measured memory_bytes: 608
L, R = map(int,input().split())

x = 2019
xL = L // x
xR = R // x
if xL < xR or L == 0:
    print(0)
    exit()

mL = L % x
mR = R % x

ans = 2019
for i in range(mL,mR):
    for j in range(i+1,mR+1):
        cr = (i*j)%2019
        if ans > cr:
            ans = cr
print(ans)


Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>

using namespace std;

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

int main() {
    int N, M;
    cin >> N >> M;

    int A[N + 1];
    REP(0, i, N + 1) A[i] = 0;

    REP(0, j, M) {
        int L, R;
        cin >> L >> R;
        L--;

        A[L]++; A[R]--;
    }

    // REP(0, i, N + 1) cout << A[i] << endl;

    int B[N];
    REP(0, i, N) {
        if (i == 0) B[0] = A[0];
        else B[i] = B[i - 1] + A[i];
    }

    int ans = 0;
    REP(0, i, N) {
        if (B[i] == M) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(std::vector<T>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}

void solve(void)
{
  int N,K;
  cin>>N>>K;
  vector<int> vec(N);
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
  }
  SORT_(vec,1);
  int ANS = 0;
  for (int i = 0; i < K; i++)
  {
    ANS += vec[i];
  }
  cout<<ANS<<endl;
  

  
  
  
  
  
  
  return; 
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 256
def f(x):
  a,c=x,0
  while 1:
    b=[a.count(e) for e in a]
    if a==b: return c," ".join(map(str,a))
    else: a,c=b,c+1

while 1:
  if input()==0: break
  c,s=f(map(int,raw_input().split()))
  print c; print s

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

using namespace std;
#define sf scanf
#define pf printf
#define mem(a,b) memset(a,b,sizeof(a));
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define bug1 puts("bug1");
#define bug2 puts("bug2");
#define bug3 puts("bug3");
#define N 100
#define M 200
#define ULL unsigned long long
#define LL long long
const int INF=1e9;
const int inf=0x3f3f3f3f;
const int maxn=2e5+100;
//2017Äê7ÔÂ16ÈÕ 07:49:29
int tot;
int head[maxn];
int fa[maxn];
int siz[maxn];
struct Edge{
    int v,nxt;
}edge[maxn<<1];
void addedge(int u,int v){
    edge[tot].v=v;
    edge[tot].nxt=head[u];
    head[u]=tot++;
}
int depth[maxn];
void dfs(int u,int pre,int dep){
    fa[u]=pre;
    depth[u]=dep;
    siz[u]=1;
    for(int i=head[u];~i;i=edge[i].nxt){
        int v=edge[i].v;
        if(v==pre)continue;
        dfs(v,u,dep+1);
        siz[u]+=siz[v];
    }
}
int main(){
    int n;
    sf("%d",&n);
    rep(i,0,n)head[i]=-1;
    rep(i,1,n-1){
        int u,v;
        sf("%d%d",&u,&v);
        addedge(u,v);addedge(v,u);
    }
    dfs(1,1,1);
    int H=depth[n]/2-1;
    int x=n;
    while(H--){
        x=fa[x];
    }
    int uu=siz[1]-siz[x];int vv=siz[x];
    if(uu>vv)puts("Fennec");
    else puts("Snuke");
}


Measured memory_bytes: 12288
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define F first
#define S second
#define MEM(i,j) memset(i,j,sizeof i)
#define ALL(v) v.begin(),v.end()
#define MP make_pair
#define ET cout << "\n"
#define DB(a,s,e) {for(int i=s;i<e;i++) cout << a[i] << " ";ET;}
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int dp[100005],arr[100005];

int main()
{jizz
	dp[0]=1e9;
	int n,k;
	cin >> n >> k >> arr[1];
	for(int i=2;i<=n;++i)
	{
		cin >> arr[i],dp[i]=1e9;
		for(int j=i-1;j>=i-k&&j>0;--j)
			dp[i]=min(dp[j]+abs(arr[i]-arr[j]),dp[i]);
	}
	cout << dp[n] << "\n";
}

Measured memory_bytes: 1024
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = if n <= m then  List.range n `To m else []
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (0 ++^ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv
let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv
let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let atoi c = Char.code c - Char.code '0'
let itoa n = Char.chr (n + Char.code '0')

let between n x m = n <= x && x < m


(* ===== MAIN ===== *)

let k = scan "%d" id
let s = scan "%s" id

let () =
  let ans =
    if (String.length s) <= k then s
    else (String.sub s 0 k) ^ "..."
  in
    Printf.printf "%s\n" ans


Measured memory_bytes: 5352
n = gets.to_i
point = [0,0]
n.times do |i|
  s = gets.chomp.split(" ")
  if s[0] == s[1]
    point[0] += 1
    point[1] += 1
  elsif s[0] > s[1]
    point[0] += 3
  else
    point[1] += 3
  end
end
puts point.join(" ")

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


int main() {
    int n,m,q;

   cin>>n>>m>>q;
vector<int> a(q);
vector<int> b(q);
vector<int> c(q);
vector<int> d(q);
vector<int> A(10);
long int ans=0;

for (int i = 0; i < q; i++)
{
    cin>>a[i]>>b[i]>>c[i]>>d[i];
  
}

for (int i = 1; i <=m; i++)
{
A[0]=i;
 for (int i1 = i; i1 <=m; i1++)
 {
       A[1]=i1;

    for (int i2 = i1 ;i2 <= m; i2++)
    {
       A[2]=i2;
         for (int i3 = i2; i3 <= m; i3++)
     {
         A[3]=i3;
         for (int i4 = i3; i4 <= m; i4++)
      {
           A[4]=i4;
         for (int i5 = i4; i5 <= m; i5++)
      {
           A[5]=i5;
         for (int i6 =i5; i6 <= m; i6++)
      {
        A[6]=i6;
         for (int i7 = i6; i7 <= m; i7++)
    {
          A[7]=i7;
         for (int i8 = i7; i8 <= m; i8++)
    {
           A[8]=i8;
         for (int i9 = i8; i9 <=m; i9++)
    {
       A[9]=i9;
long int sum=0;
       for (int j = 0; j < q; j++)
       {
           int fir=a[j]-1;
           int sec=b[j]-1;

           if(A[sec]-A[fir]==c[j]){
               sum+=d[j];

           }
       }
if(sum>ans){ans=sum;}
//if(A[0]==2)cout<<"yo"<<endl;

        
    
    }

    }
 
    }
   
    }

    }

    }
  
    }
    
    }
 
}
 
}
cout<<ans<<endl;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SZ(x) (int)(x).size()
#define ZERO(a) memset(a,0,sizeof(a))
#define dbg(x) cout<<#x<<": "<<(x)<<"\n"
#define pb push_back
#define eb emplace_back
#define mp make_pair

ll a,b;
string s1 = "Positive";
string s2 = "Negative";
string s3 = "Zero";

int main() {
    cin >> a >> b;
    string t;
    if(a > 0) t = s1;
    else if(a < 0 and b > 0) t = s3;
    else if(a==0 or b==0) t = s3;
    else if((b-a) % 2 == 0) t = s2;
    else t = s1;

    cout << t << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{
  int A;
  int B;
  int X;
  
  scanf("%d %d %d",&A,&B,&X);

  
 if (X >= A && X <= A+B )
    printf("YES\n");
  else
    printf("NO\n");
  
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
//const int INF = 1<<29;
//const int MODINF = 1000000007;
using namespace std;

int main(){
    vector<string> N(3);
    rep(i, 0, 3) cin >> N.at(i);
    vector<int> n(3, -1);
    int st = 0;
    while (true){
        n.at(st)++;
        if (n.at(st) == N.at(st).size()){
            char ans = 'A' + st;
            cout << ans << endl;
            break;
        }
        if ((N.at(st).at(n.at(st))) == 'a') st = 0;
        else if ((N.at(st).at(n.at(st))) == 'b') st = 1;
        else if ((N.at(st).at(n.at(st))) == 'c') st = 2;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define prin(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 1000005
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PA;
typedef priority_queue<ll> PQ;
typedef map<ll, ll> Map;

int main(void) {
    ll H, W, h, w;
    cin >> H >> W >> h >> w;
    ll i, j;
    
    if(H%h==0 && W%w==0) {
        puts("No");
        return 0;
    }
    
    
    ll bigcnt=(H/h)*(W/w);
    ll smallcnt=H*W-bigcnt;
    ll par=1000000000/smallcnt;
    ll bignum=-smallcnt*par+1;
    ll smallnum=bigcnt*par;
    
    puts("Yes");
    for(i=0; i<H; i++) {
        for(j=0; j<W; j++) {
            if(i%h==h-1 && j%w==w-1) {
                printf("%lld ", bignum);
            }else {
                printf("%lld ", smallnum);
            }
        }
        printf("\n");
    }

}

Measured memory_bytes: 2816
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

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

    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());
    if(s<t){
        cout  << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
'use strict';

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', function(line){
  lines.push(line);
})
reader.on('close', function(){
  const input = lines[0].split(" ");
  const result = maximizingFormula(input);
  console.log(result);
})

// 1から9の整数3つからなる配列[a,b,c]を与えたとき、その整数と1つの"+"を用いて最大の数を求める関数
// 例)(1,4,5) => 55(51 + 4)
function maximizingFormula(input){
  let maxnum = 0;
  let maxIndex = 0;
  input.map((num, index) => {
    if (num > maxnum) {
      maxnum = num;
      maxIndex = index;
    }
  })
  
  return Number(maxnum.toString() + input[(maxIndex + 1) % 3].toString()) + Number(input[(maxIndex + 2) % 3]);
}


Measured memory_bytes: 21320
N,K = map(int,input().split())

S=input()

left = 0
right = 0

max_len = N

count0 =0
henka = 0
first = int(S[0])
for i in range(1,N):
    if S[i-1]!=S[i]:
        henka +=1
    if S[i]=='0'and henka == (2*K+first):
        right = i-1
        max_len = i
        break

    


# print(max_len)  
right_count = 3
left_count = 3

while(1):
    # print(left,right)
    if right_count <= 2: break
    if max_len == N:break
    #３変化する前までrightを動かす
    right_count = 0
    while(1):
        if right+1 >= N: break
        if S[right+1] !=  S[right]:
            right_count += 1
        if right_count >2 : break
        right += 1
    left_count = 0
    #leftを動かす
     
    if S[left] =='0':
        left_count = 1
    else:
        left_count = 0
    while(1):
        if right_count == 0:break
        if S[left+1] !=  S[left]:
            left_count += 1
        left += 1
        if left_count >1 : break
        
    

    
    max_len = max(right-left+1,max_len)

print(max_len)  

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

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

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

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int) a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair

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

const double PI = acos(-1.0);
const LL INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 100100;

LL A[MAX];
LL B[MAX];

int main()
{
	//freopen("in.txt", "r", stdin);
	//ios::sync_with_stdio(false); cin.tie(0);

	int n;
	scanf("%d", &n);

	LL sum = 0;

	FOR (i, 0, n)
	{
		int x;
		scanf("%d", &x);
		A[i] = x;

		sum += A[i];
	}

	LL b = n * (LL)(n+1) / 2;

	if (sum % b != 0)
	{
		cout<<"NO"<<endl;
		return 0;
	}

	LL cnt = sum / b;

	FOR (i, 0, n)
	{
		B[i] = A[(i + 1) % n] - A[i];
	}

	FOR (i, 0, n)
	{
		B[i] -= cnt;
	}

	LL x = 0;
	FOR (i, 0, n)
	{
		if (B[i] > 0 || B[i] % n != 0)
		{
			cout<<"NO"<<endl;
			return 0;
		}

		x += abs(B[i] / n);
	}

	if (x == cnt) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;


}


Measured memory_bytes: 1792
#高橋君とホテルイージー
def ABC_44_A():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())

    syukuhakuhi = 0

    for i in range(N+1):

        if i!=0:
            if i <= K:
                syukuhakuhi+=X
            else:
                syukuhakuhi+=Y
    print(syukuhakuhi)


if __name__ == '__main__':

    ABC_44_A()

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

using namespace std;

int main(){
    int n;
    cin >> n;

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

    sort(d.begin(), d.end());

    int k = d[n/2 -1] + 1, cnt=0;
    while(k<=d[n/2]){
        cnt++;
        k++;
    }

    cout << cnt << endl;

}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
using namespace std;


int main() {
	long long int a[200000] = {}, b[200000] = {}, ruia[200000] = {}, ruib[200000] = {}, big[200000] = {}, sa = 0, change = 0, c, d, n, m, tmp = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		ruia[i] = ruia[i - 1] + a[i];
	}
	for (int i = 1; i <= n; i++) {
		cin >> b[i];
		if (b[i] > a[i]) {
			sa += b[i] - a[i];
			change++;
		}
		else {
			big[i] = a[i] - b[i];
		}
		ruib[i] = ruib[i - 1] + b[i];
	}
	if (ruib[n] > ruia[n]) { cout << -1; return 0; }
	if (sa==0) { cout << 0; return 0; }

	sort(big + 1, big + n + 1);
	for (int i = n; i >=1; i--) {
		if (sa <= 0) { cout << change; return 0; }
		else {
			sa -= big[i];
			change++;
		}
	}

}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
using Graph = vector<vector<int>>;

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

  ll n; cin >> n;
  set<string> se;
  rep(i, 0, n){
    string s; cin >> s;
    se.insert(s);
  }

  cout << se.size() << endl;

  return 0;
}


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

int main()
{
    long int n;
    string s;
    cin>>n>>s;
    long int l=0,r=n-1,ans=0;
    while(l<r)
    {
        if(s[l]!='W')
        l++;
        if(s[r]!='R')
        r--;
        if(s[l]=='W' && s[r]=='R')
        {
            ans++;
            l++;
            r--;
        }
    }
    cout<<ans;
}


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

//	素数判定 Primarity Test O(N log log N)
template <typename T>
bool pt( T a ) {
	for( int i=2; i*i <= a; i++ ) {
		if( a%i == 0 ) {
			return false;
		}
	}
	return true;
}


int main() {
    int n, ans = 0;
    
    while( cin >> n ) {
        if( pt(n) ) {
            ++ ans;
        }
    }
    
    cout << ans << endl;
}



Measured memory_bytes: 3092
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>

using namespace std;



struct node {
	int id = 0;
	int prnt = -1;
	int dpth = 0;
	string type = "";
	vector<int> chd;

	bool operator< (const node& other) const {
		return id < other.id;
	};

};

vector<node> ndLst(100000);


void dfs(node parNd, int dp) {
	node nd;
	for (int i = 0;i < parNd.chd.size();i++) {

		int	idx = parNd.chd[i];

		ndLst[idx].prnt = parNd.id;
		ndLst[idx].dpth = dp;

		dfs(ndLst[idx], dp + 1);
	}
	return;
}


int main() {



	int nCnt, id, chdCnt, isf;
	cin >> nCnt;
	set<int> chdSet;
	vector<int> ids(nCnt);

	for (int i = 0;i < nCnt;i++) {
		node nd;

		cin >> nd.id;
		ids[i] = nd.id;

		cin >> chdCnt;

		if (chdCnt == 0) {
			nd.type = "leaf";
		}
		else if (chdCnt > 0) {
			nd.type = "internal node";
		}

		vector<int> chd(chdCnt);
		for (int k = 0;k < chdCnt;k++) {
			cin >> chd[k];
			chdSet.insert(chd[k]);
		}

		nd.chd = chd;
		ndLst[nd.id] = nd;
	}



	node root;
	for (int n : ids) {
		if (chdSet.count(n) == 0) {
			ndLst[n].type = "root";
			root = ndLst[n];
		}
	}

	dfs(root, 1);

	for (int i = 0;i < nCnt;i++) {

		string chdStr = "";
		isf = 0;
		for (int l = 0;l < ndLst[i].chd.size();l++) {
			if (isf++) chdStr += ", ";
			chdStr += to_string(ndLst[i].chd[l]);
		}

		string out = "";
		out = "node " + to_string(ndLst[i].id) + ": parent = " + to_string(ndLst[i].prnt)
			+ ", depth = " + to_string(ndLst[i].dpth) + ", " + ndLst[i].type
			+ ", [" + chdStr + "]";


		cout << out << endl;
	}

	return 0;
}





Measured memory_bytes: 20012
fun main(args: Array<String>) {
    val n = readLine()!!.toLong()
    var list = mutableListOf<Long>()
    for (i in 0 until 1000){
        list.add((i.toLong() * i * i * i * i))
    }
    var lefta = 0
    var righta = 0
    list.forEach {left:Long ->
        list.forEach {right:Long ->
            if (left - right == n) {
                lefta = list.indexOf(left)
                righta = list.indexOf(right)
            }
            else if (left + right == n) {
                lefta = list.indexOf(left)
                righta = list.indexOf(right) * -1
            }
        }
    }
    println("$lefta $righta" )
}


Measured memory_bytes: 35796
#include<bits/stdc++.h>
using namespace std;
int main()
{

    char ch;
    cin>>ch;
    if (ch=='a'||ch=='b'||ch=='c'||ch=='d'||ch=='e'||ch=='f'||ch=='g'||ch=='h'||ch=='i'||ch=='j'||ch=='k'||ch=='l'||ch=='m'||ch=='n'||ch=='o'||ch=='p'||ch=='q'||ch=='r'||ch=='s'||ch=='t'||ch=='u'||ch=='v'||ch=='w'||ch=='x'||ch=='y'||ch=='z')
    {
        cout<<"a"<<endl;
    }
    else
    {

        cout<<"A"<<endl;
    }

}


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

int main() {
  int c[3][3];
  for (int i=0; i<3; i++) {
    for (int j=0; j<3; j++) {
      scanf("%d",&c[i][j]);
    }
  }

  
  for (int i=0; i<2; i++) {
    if (c[i][0]-c[i+1][0] != c[i][1]-c[i+1][1]
	|| c[i][0]-c[i+1][0] != c[i][2]-c[i+1][2]) {
      printf("No\n");
      return 0;
    }
  }
  for (int i=0; i<2; i++) {
    if (c[0][i]-c[0][i+1] != c[1][i]-c[1][i+1]
	|| c[0][i]-c[0][i+1] != c[2][i]-c[2][i+1]) {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}

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

int main()
{
    string S;
    cin >> S;
    
    int N = (int)S.size() - 1;
    long long sum = 0;
    for (int bit = 0; bit < (1<<N); bit++) {
        long long T = S[0] - '0';
        for (int i = 0; i < N; i++) {
            if (bit & (1<<i)) {
                sum += T;
                T = S[i+1] - '0';
            }else{
                T *= 10;
                T += S[i+1] - '0';
            }
        }
        sum += T;
    }
    cout << sum << endl;
}

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

void solve1() {
  string s, t;
  cin >> s >> t;
  int d = t.size();
  for (int i = 0; i <= s.size() - t.size(); i++) {
    int j = 0, k = i;
    // treat same part
    // bug report:
    // ÁúüÊ≠£Êú™ÈÄöËøáÁöÑÂéüÂõ†Â∫îËØ•ÊòØÂΩìÊ£ÄÈ™åstring s‰∏≠s.size() - t.size() < i < s.size()‰∏≠ÁöÑÂÖÉÁ¥†Êó∂Âá∫Áé∞ÁöÑÈóÆÈ¢ò--ÊäädÂÖ®ÈÉ®ËÆæ‰∏∫‰∫Üt.size()
    // bug1: ÂØπ‰∫és‰∏≠‰∏çÁ≠â‰∫ét[0]ÁöÑÈ°πÊú™ËøõË°åÊ£ÄÈ™åÔºàÊàñËÄÖËØ¥ÈÄöËøá‰∫ÜreverseÊñπÊ≥ïÊ£ÄÈ™å‰∫ÜÔºâ
    for (; k < s.size() && j < t.size() && s[k] == t[j]; k++, j++) {
      ;
    }
    // have all
    if (j == t.size()) {
      d = 0;
      break;
    }
    // have one or two...
    // treat different part
    int c = 0;
    for (; j < t.size() && k < s.size(); k++, j++) {
      if (s[k] != t[j]) {
        c++;
      }
    }
    // s.size() - t.size() < k <= s.size() - 1
    // bug2 : (
    // if (j < t.size()) {
    //   c = t.size();
    // }
    if (c < d) d = c;
  }
  cout << d << endl;
}

void solve2() {
  string s, t;
  cin >> s >> t;
  int c = t.size();
  // ÈúÄÊª°Ë∂≥Ëá≥Â∞ëËÉΩËØªÂà∞Â≠óÁ¨¶‰∏≤sÁöÑ4‰∏™Â≠óÁ¨¶
  for (int i = 0; i <= s.size() - t.size(); i++) {
    int count = 0;
    for (int j = 0, k = i; j < t.size(); j++, k++) {
      if (s[k] != t[j]) {
        count++;
      }
    }
    if (count < c) c = count;
  }
  cout << c << endl;
}

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


Measured memory_bytes: 3668
(let* ((n (read))
       (a (make-array n :element-type 'integer
                        :initial-element 0
                        :fill-pointer 0))
       (r 0)
       (l 0)
       (flg t)
       (now 0)
       (ans 0))
  (loop while (< r n) do
        (setf (aref a r) (read))
        (loop while (and flg (not (> l r))) do
              (cond ((= r l) (incf ans) (setf flg nil) (setf now (aref a r)) (incf r))
                    ((= 0 (logand now (aref a r))) (incf ans (- r l -1)) (setf flg nil) (setf now (logxor now (aref a r))) (incf r))
                    (t (setf now (logxor now (aref a l))) (incf l))))
        (setf flg t))
  (format t "~A~%" ans))


Measured memory_bytes: 59752
#include <iostream>
#include <vector>

using namespace std;

const int MaxN = 1001;
const int MaxM = 10001;

int N, M;

int main() {
  int count[MaxM];

  while(cin>>N>>M && !(N==0 && M==0)) {
    vector < vector< pair<int,int> > > logg(MaxM);
    int r;
    cin>>r;
    int t,n,m,s;
    for(int i=0; i<MaxM; i++) { // 初期化
      count[i] = 0;
    }
    for(int i=0; i<r; i++) {
      cin>>t>>n>>m>>s;
      if(s == 1) { // login
	count[m]++;
	if(count[m] == 1) {
	  logg[m].push_back(make_pair(t,t));
	}
      }
      else { // logout
	count[m]--;
	if(count[m] == 0) {
	  logg[m].back().second = t;
	}
      }
    }
    int q;
    cin>>q;
    for(int i=0; i<q; i++) {
      int ts, te, m, ans = 0;
      cin>>ts>>te>>m;
      int ans1, ans2; // 4debug ans1は誤りらしい
      for(int j=0; j<logg[m].size(); j++) {
	if(logg[m][j].first < te) {
	  ans1 = min(te, logg[m][j].second)-max(ts, logg[m][j].first);
	}
	else {
	  ans1 = 0;
	}
	ans2 = max(0, min(te,logg[m][j].second)-max(ts,logg[m][j].first));
	/*
        if(ans1!=ans2) {
	  cout<<"Q: "<<ts<<" "<<te<<endl;
	  cout<<"why: "<<min(te, logg[m][j].second)-max(ts, logg[m][j].first)<<endl;
	  cout<<"val: "<<logg[m][j].first<<" "<<logg[m][j].second<<endl;
	  cout<<"ans: "<<ans1<<" "<<ans2<<endl;
	}
	*/
        ans += ans2;
      }
      cout<<ans<<endl;
    }
  }
}

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

a = int(input())
b = int(input())
h = int(input())

if  a >= 1 and a <= 100 \
and b >= 1 and b <= 100 \
and h >= 1 and h <= 100 \
and h % 2 == 0 :
  ans = int((a + b) * h / 2)
  
  print(ans)

Measured memory_bytes: 2940
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on

void main()
{
    auto S = sread();
    auto T = sread();
    char[char] d;
    foreach (i; 0 .. S.length)
    {
        if (S[i] in d)
        {
            dprint(i, S[i], T[i]);
            if (d[S[i]] != T[i])
            {
                writeln("No");
                return;
            }
        }
        else
        {
            d[S[i]] = T[i];
        }
    }
    auto k = d.values.map!(to!long).array;
    k.sort();
    writeln(k.walkLength == k.uniq.walkLength ? "Yes" : "No");
}


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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/d.in", "r", stdin);
//  freopen("../IO/d.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}

constexpr int N = (int)2e5 +15496;
constexpr int mod = (int)1e9 + 7;
vector<int> g[N];
int fac[N+1],ifac[N+1], ans[N], dp[N], sz[N], inv[N], n;

int powmod(int64_t a, int64_t b) {
  int64_t res = 1;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}

void init() {
  fac[0] = ifac[0] = 1;
  for (int i = 1; i < N; ++i) {
    fac[i] = (int64_t) fac[i - 1] * i % mod;
  }
  ifac[N - 1] = powmod(fac[N - 1], mod - 2);
  for (int i = N - 2; i >= 1; --i) {
    ifac[i] = (int64_t) ifac[i + 1] * (i + 1) % mod;
  }
  inv[1] = 1;
  for (int i = 2; i < N; ++i)
    inv[i] = (mod - (int64_t)(mod / i) * inv[mod % i] % mod) % mod;
}

void dfs1(int v, int p = -1) {
  int prod = 1;
  for (int u : g[v]) if (u != p) {
    dfs1(u, v);
    prod = (int64_t) prod * dp[u] % mod * ifac[sz[u]] % mod;
    sz[v] += sz[u];
  }
  sz[v] += 1;
  dp[v] = (int64_t) prod * fac[sz[v] - 1] % mod;
}

void dfs2(int v, int a, int p = -1) {
  ans[v] = (int64_t) a % mod * ifac[sz[v] - 1] % mod;
  for (int u : g[v]) {
    if (u != p) {
      dfs2(u, (int64_t) ans[v] * fac[sz[u]] % mod * inv[n - sz[u]] % mod, v);
    }
  }
}

void solve(std::istream &in, std::ostream &out) {
  init();
  in >> n;
  for (int i = 0, a, b; i < n - 1; ++i) {
    in >> a >> b;
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs1(0);
  dfs2(0, dp[0]);
  for (int i = 0; i < n; ++i) {
    out << (int64_t)ans[i]*fac[n-1]%mod << '\n';
  }
}

Measured memory_bytes: 19316
#include <bits/stdc++.h>
using namespace std;
#define ul unsigned long long
#define ll long long
#define ld long double



int main()
{
  ll n,a[100];
  cin>>n;
  for (ll i = 0; i < n; i++)
  {
    cin>>a[i];
  }
  ll f=1,ct=0;
  while (f) {
    f=0;
    for (ll j = n-1; j >0 ;j--) {
      if (a[j]<a[j-1]) {
        swap(a[j],a[j-1]);
        ct++;
        f=1;
      }
    }
  }
  for (ll i = 0; i < n-1; i++)
  {
    cout << a[i] << " ";
  }
  cout << a[n-1] <<endl;

  cout<<ct<<endl;

  return 0;
}



Measured memory_bytes: 3096
str = gets.split
N,X = str[0].to_i, str[1].to_i

L = Array.new(N+2,0)
str = gets.split
for x in 1..N
  L[x] = L[x-1] + str[x-1].to_i
end
L[N+1] = 10001

i = 0
while L[i] <= X
  i += 1
end

puts i

Measured memory_bytes: 1788
#from collections import deque
mod = 10**9 + 7
S = int(input())
length = S//3

#N, K = map(int, input().split())
#A = list(map(int, input().split()))
ans = 0
#print(ans)
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2,  S + 3):
  fact.append((fact[-1] * i) % mod)
  inv.append((-inv[mod % i] * (mod // i)) % mod)
  factinv.append((factinv[-1] * inv[-1]) % mod)


for k in range(1, length+1):
  total = S - 3*k
  ans += fact[total+k-1]*factinv[total]%mod*factinv[k-1]%mod
  ans%= mod

print(ans)

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

int main()
{
	int A,B;
	cin >> A >> B;
	if(A == B) cout << 2 * A << endl;
	else if( A > B )cout << 2 * A - 1 << endl;
	else cout << 2 * B - 1 << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int n = sc.nextInt();
		
		for (int i=1; i<=n; i++) {
			if (i%3 == 0) System.out.print(" "+i);
			else if (String.valueOf(i).contains("3")) System.out.print(" "+i);
		}
		
		System.out.println();
		
	}
}


Measured memory_bytes: 29360
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

#define _GLIBCXX_DEBUG
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int64_t gcd_(int64_t a, int64_t b){
    int64_t x = max(a,b);
    int64_t y = min(a,b);
    if(x%y==0){
        return y;
    }
    return gcd_(y, x%y);
}

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n;
    cin >> n;
    vi a(n), b(n);
    for(int i=0; i<n; i++){
        cin >> a.at(i) >> b.at(i);
    }
    priority_queue<pair<int64_t, int64_t>> pq;
    for(int64_t i=0; i<n; i++){
        pq.push(make_pair(b.at(i), a.at(i)));
    }
    int64_t max_bi = pq.top().first;
    int64_t netTime = pq.top().second;
    int64_t bi;
    for(int i=0; i<n-1; i++){
        pq.pop();
        bi = pq.top().first;
        if(max_bi - bi - netTime > 0){
            netTime += max_bi - bi - netTime;
        }
        netTime += pq.top().second;
    }
    if(max_bi - netTime >= 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 9712
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;
// Comment out below and program paste

// #include "UnionFind.hpp"
// #include "power.hpp"

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int A, B, T;
    cin >> A >> B >> T;
    cout << (T / A) * B << endl;
}


Measured memory_bytes: 384
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod   998244353
#define PI 2*acos(0.0)
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};

ll bigmod(ll x, ll p)
{
    ll res = 1;
    while(p)
    {
        if(p&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        p >>= 1;
    }
    return res;
}

//=============================================ASIFAZAD==============================================//

int32_t main()
{
    io;
    int n, k;
    cin>>n>>k;
    vi inp(n);
    for(auto& x: inp) cin>>x;
    for(int i = 0; i< n-k; i++)
        cout<<(inp[i] < inp[i+k]?"Yes":"No")<<"\n";
    return 0;
}

Measured memory_bytes: 4048
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let s: String = scan(tokens);
    for (i, c) in s.chars().enumerate() {
        if i % 2 == 0 && c == 'L' {
            println!("No");
            return;
        }
        if i % 2 == 1 && c == 'R' {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 4352
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

  string s;
  cin >> s;

  int n = s.length();
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      if(s[i] == s[j]){
        cout << "no" << endl;
        return 0;
      }
    }
  }

  cout << "yes" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

void pri(int[], int);
int main()
{
  int i,v,j,N = 0,A[100];
  scanf("%d",&N);
  for(i = 0;i < N;i++)
    {
      scanf("%d",&A[i]);
      //if(A[i] >= 1000 || A[i] <= 0) i--;
    }
  pri(A,N);
  for(i = 1;i < N;i++)
    {
      
      v = A[i];
      j = i - 1;

      while(j >= 0 && A[j] > v)
	{
	  A[j+1] = A[j];
	  j--;
	  
	}
      A[j+1] = v;
      pri(A,N);
    }
	
      
      
  return 0;
}
void pri(int A[],int N)
{
  int i;
  for(i = 0;i < N;i++)
    {
      if(i > 0) printf(" ");
      printf("%d",A[i]);
    }
  printf("\n");
}



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

using namespace std;
#define ll long long
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;
typedef pair<int,int>           PI;
typedef pair<ll,ll>             PL;
typedef vector<PI>               vip; 
typedef vector<int>             vi;
typedef vector<vi>              vvi;
typedef vector<ll>              vl;
typedef vector<vl>              vvl;








int main (){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vi a(n+1, 0);
    REPS(i,n){
        cin >> a.at(i);
    }
    int i = 1;
    int cnt = 0;
    while( i > 0 ){
        int b = a.at(i);
        ++cnt;
        if(b == 0) {
          cout << -1 << endl;
          break;
        }
        else if(b == 2){
            cout << cnt << endl;
          break;
        }else {
            a.at(i) = 0;
            i = b;
        }
    }








    return 0;
}


Measured memory_bytes: 640
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	result := "No"
	if isOk(s) {
		result = "Yes"
	}
	fmt.Printf("%s\n", result)
}

func isOk(s string) bool {
	if strings.Index(s, "a") < 0 {
		return false
	}
	if strings.Index(s, "b") < 0 {
		return false
	}
	if strings.Index(s, "c") < 0 {
		return false
	}

	return true
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
using namespace std;
using ll=long long;
#ifdef ONLINE_JUDGE
#define D(...)
#else
#define D(...)cerr<<__LINE__<<":"<<"["<<#__VA_ARGS__<<"]->",P(__VA_ARGS__)
#endif
void P(){cerr<<endl;} 
template<typename H,typename...T>void P(H h,T...t){cerr<<h<<" ";P(t...);}
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int d,n;cin>>d>>n;
    if(d==0){
        if(n==100){
            cout<<101;
        }
        else cout<<n;
    }
    else if(d==1){
        if(n==100){
            cout<<10100;
        }
        else cout<<100*n;
    }
    else{
        if(n==100){
            cout<<1010000;
        }
        else cout<<10000*n;
    }



}

Measured memory_bytes: 3648
#include<stdio.h>

int main(void){
  int i,j,k;
  int prime[10000];
  int n;
  int ans;

  i = 1;
  k = 3;
  prime[0] = 2;
  while(i<10000){
    for(j=0;j<i;j++){
      if( !(k%prime[j]) )break;
    }
    if(j==i){
      prime[i] = k;
      i++;
    }
    k++;
  }

  while(1){
    scanf("%d",&n);
    if(!n)break;

    ans = 0;
    for(i=0;i<n;i++)ans += prime[i];

    printf("%d\n",ans);
  }

  return 0;
}

Measured memory_bytes: 316
import sys
stdin = sys.stdin
sys.setrecursionlimit(100001)
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
print(n*(n-1)//2)

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

namespace ABC096A
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int a = ab[0];
            int b = ab[1];

            if (b < a)
            {
                Console.WriteLine(a - 1);
            }
            else Console.WriteLine(a);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13268