akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root;
/*
Node treeMinimum(Node x){


}

Node treeMaximum(Node x){


}

Node treeSearch(Node x, int k){
  while(x != NIL && k != x.key){
    if(k < x.key) x = x.left;
    else x = x.left;
  }
  return x; 
}

Node treeSuccessor(Node x){
  if(x.right != NIL) return treeMinimum(x.right); // case 1
  y = x.p
  while(y != NIL && x == y.right){
    x = y
    y = y.p
  }
  return y // case 2
}

void treeDelete(Node z){

  Node y; // node to be deleted
  Node x; // child of y

  if(z.left == NIL || z.right == NIL) y = z;
  else y = Tree-Successor(z);

  if(y.left != NIL) x = y.left;
  else x = y.right;
  if(x != NIL) x.p = y.p;
  if(y.p == NIL) T.root = x;
  else if{
    y == y.p.left;
    y.p.left = x;
  }
  else y.p.right = x;
  if(y != z) z.key = y.key;
}*/

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x; // ???????¨????
    if(z->key < x->key) x = x->left; // ?????????????§????
    else x = x->right; 
    }// ?????????????§????
    z->parent = y;
    if(y == NIL) root = z;// T ???????????´???
    else if(z->key < y->key) y->left = z; // z ??? y ?????????????????????
    else y->right = z; // z ??? y ?????????????????????
}


void inParse(Node x){
  if(x->left != NIL) inParse(x->left);
  printf(" %d",x->key);
  if(x->right != NIL) inParse(x->right);
}
void preParse(Node x){
  printf(" %d",x->key);
  if(x->left != NIL) preParse(x->left);
  if(x->right != NIL) preParse(x->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    /*if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    }*/
     if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inParse(root);
      printf("\n");
      preParse(root);
      printf("\n");
    } 
    /*else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }*/
  }

  return 0;
}

Measured memory_bytes: 24040
package main

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

func solve() {
	n := getInt()
	as := getIntSlice(n)

	ans := as[0]
	for _, a := range as {
		ans = gcd(ans, a)
	}

	fmt.Fprintln(wr, ans)
}

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

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 3072
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Main {

    public static void main( final String[] args ) {

	final char[] inFromLst = { ' ', '\'', ',', '-', '.', '?', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };

	final String[] inToLst = { "101" ,"000000" ,"000011" ,"10010001" ,"010001" ,"000001" ,"100101" ,"10011010" ,"0101" ,"0001" ,"110" ,"01001" ,"10011011" ,"010000" ,"0111" ,"10011000" ,"0110" ,"00100" ,"10011001" ,"10011110" ,"00101" ,"111" ,"10011111" ,"1000" ,"00110" ,"00111" ,"10011100" ,"10011101" ,"000010" ,"10010010" ,"10010011" ,"10010000" };

	final HashMap<Character, String> inMap = new HashMap<Character, String>();
	for ( int i = 0; i < inFromLst.length; i++ ) {
	    inMap.put( inFromLst[ i ], inToLst[ i ] );
	}

	final String[] outFromLst = { "00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111", "01000", "01001", "01010", "01011", "01100", "01101", "01110", "01111", "10000", "10001", "10010", "10011", "10100", "10101", "10110", "10111", "11000", "11001", "11010", "11011", "11100", "11101", "11110", "11111" };

	final char[] outToLst = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', '.', ',', '-', '\'', '?' };

	final Map<String, Character> outMap = new HashMap<String, Character>();
	for ( int i = 0; i < outFromLst.length; i++ ) {
	    outMap.put( outFromLst[ i ], outToLst[ i ] );
	}
	final Scanner stdin = new Scanner( System.in );
	
	while ( stdin.hasNextLine() ) {

	    final String input = stdin.nextLine();
	    
	    final StringBuilder in = new StringBuilder();
	    for ( final char ch : input.toCharArray() ) {
		in.append( inMap.get( ch ) );
	    }
	    
	    for ( int i = 0; i < in.length() % 5; i++ ) {
		in.append( '0' );
	    }
	    final StringBuilder out = new StringBuilder();
	    final int no = in.length() / 5;
	    for ( int i = 0; i < no; i++ ) {
		final String token = in.substring( i * 5, ( i + 1 ) * 5 );
		out.append( outMap.get( token ) );
	    }
	    System.out.println( out.toString() );
	}
    }    
}

Measured memory_bytes: 22424
a,b=map(int,input().split())
lis=["1","2","3","4","5","6","7","8","9","0"]
s=input()
for i in range(a+b+1):
    if i==a:
        if s[i]!="-":
            print("No")
            break
    else:
        if not s[i] in lis:
            print("No")
            break
else:
    print("Yes")

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main
{

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

        int n = scan.nextInt();
        int t[] = new int[n];
        int best = 0;
        boolean no = false;

        for (int i = 0; i < n; i++) {
            t[i] = scan.nextInt();
        }

        for (int b = 0; b < n; b++) {
            if (best < b * 10) {
                no = true;
                break;
            }
            if (best < b * 10 + t[b]) {
                best = b * 10 + t[b];
            }
        }

        if (!no) {
            best = 0;
            for (int b = 0; b < n; b++) {
                if (best < b * 10) {
                    no = true;
                    break;
                }
                if (best < b * 10 + t[n - 1 - b]) {
                    best = b * 10 + t[n - 1 - b];
                }
            }
        }

        if (!no) {
            System.out.println("yes");
        } else {
            System.out.println("no");
        }

    }
}



Measured memory_bytes: 104972
#include <iostream>
#include <string>

using namespace std;

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

  string ans;
  for(int i=0; i<s.size(); i++){
    if(i%2 == 0){
      ans.push_back(s.at(i));
    }
  }
  cout << ans;

  return 0;
}


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

using namespace std;

int main(){
  int H,W;
  cin>>H>>W;

  vector<vector<char> > space(H,vector<char>(W));
  vector<vector<int> >math(H,vector<int>(W,0));

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>space[i][j];
    }
  }

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(space[i][j]=='#'){
        if(i>0&&space[i-1][j]!='#'){
          math[i-1][j]++;
        }
        if(i<(H-1)&&space[i+1][j]!='#'){
          math[i+1][j]++;
        }
        if(j>0&&space[i][j-1]!='#'){
          math[i][j-1]++;
        }
        if(j<(W-1)&&space[i][j+1]!='#'){
          math[i][j+1]++;
        }
        if(j>0&&i<(H-1)&&space[i+1][j-1]!='#'){
          math[i+1][j-1]++;
        }
        if(j<(W-1)&&i<(H-1)&&space[i+1][j+1]!='#'){
          math[i+1][j+1]++;
        }
        if(j>0&&i>0&&space[i-1][j-1]!='#'){
          math[i-1][j-1]++;
        }
        if(j<(W-1)&&i>0&&space[i-1][j+1]!='#'){
          math[i-1][j+1]++;
        }
      }
    }
  }

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(space[i][j]=='.') cout<<math[i][j];
      else cout<<space[i][j];
    }
    cout<<endl;
  }

  return 0;
}


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

int main(){
    int N;
    cin >> N;
    int a;
    if(N%1000!=0){
        a=N/1000;
        cout << 1000*(a+1)-N << endl;
    }else{
        cout << 0 << endl;
    }
   
}

Measured memory_bytes: 3580
n = int(input())
a = input().split()

money = 1000
stock = 0
pivot = []
upflag = 0
dnflag = 1

if(int(a[1]) - int(a[0]) > 0): # initial
    stock = int(money // (int(a[0])))
    money = int(money % (int(a[0])))
    upflag = 1
    dnflag = 0

for i in range(n-2): # i=0,1,,,,n-3 (for n=7, n-3=4)
    if(int(a[i+1]) == int(a[i])):
        if((int(a[i+2]) - int(a[i+1]) < 0) and upflag == 1): # i+1 is local max so that to sell stock
            money = money + stock * (int(a[i+1]))
            stock = 0
            upflag = 1
            dnflag = 0
        elif((int(a[i+2]) - int(a[i+1]) > 0) and dnflag == 1): # i+1 is local min so that to sell stock
            stock = int(money // (int(a[i+1])))
            money = int(money % (int(a[i+1])))
            upflag = 0
            dnflag = 1

    elif(int(a[i+1]) - int(a[i]) > 0):
        upflag = 1
        if(int(a[i+2]) - int(a[i+1]) < 0): # i+1 is local max so that to sell stock
            money = money + stock * (int(a[i+1]))
            stock = 0
            upflag = 0

    elif(int(a[i+1]) - int(a[i]) < 0):
        dnflag = 1
        if(int(a[i+2]) - int(a[i+1]) > 0): # i+1 is local min so that to buy stock
            stock = int(money // (int(a[i+1])))
            money = int(money % (int(a[i+1])))
            dnflag = 0

if(int(a[n-1]) - int(a[n-2]) > 0): # sell @ final
    money = money + stock * (int(a[n-1]))
elif(int(a[n-1]) - int(a[n-2]) == 0):
    if(upflag == 1):
        money = money + stock * (int(a[n-1]))

print(money)


Measured memory_bytes: 9360
n = int(input())
*A, = map(int, input().split())
m = max(2, max(A))
P = {p: True for p in range(2, m + 1)}
for i in range(2, m + 1):
    for j in range(2 * i, m + 1, i):
        P[j] = False
Pmap = {p: 0 for p in P if P[p]}
Amap = {a: 0 for a in range(1, m + 1)}
for a in A:
    Amap[a] += 1
for p in Pmap:
    for a in range(p, m + 1, p):
        Pmap[p] += Amap[a]
s = max(Pmap.values())
if s < 2:
    print('pairwise coprime')
elif s < n:
    print('setwise coprime')
else:
    print('not coprime')


Measured memory_bytes: 301756
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int N, M;
  cin >> N >> M;
  vector<pair<int, int> > P[100010];
  int s1[100010];
  int s2[100010];
  for(int i=1; i<=M; i++){
    int p, y;
    cin >> p >> y;
    P[p].emplace_back(make_pair(y,i));
  }
  for(int i=1; i<=N; i++) sort(P[i].begin(), P[i].end());
  for(int i=1; i<=N; i++){
    for(int j=0; j<P[i].size(); j++){
      s1[P[i][j].second]=i;
      s2[P[i][j].second]=j+1;
    }
  }
  for(int i=1; i<=M; i++){
    cout.fill('0');
    cout << setw(6) << s1[i];
    cout << setw(6) << s2[i] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 7808
#include<iostream>
#include<algorithm>
#include<climits>

using namespace std;

int main(){
    int n;
    cin >> n;
    int r[n];
    int ans = INT_MIN;
    for(int i=0;i < n;i++){
        cin >> r[i];
    }
    int minv = r[0];
    for(int i=1;i < n;i++){
      ans = max(ans,r[i]-minv);
      minv = min(minv,r[i]);
    }
    cout << ans << endl;
}


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

int main() {
  int n;
  cin >> n;
  int p[10000000];
  rep(i,n) cin >> p[i];
  int count = 0;
  int curmin = 1e9;
  rep(i,n) {
    curmin = min(curmin, p[i]);
    if (curmin == p[i]) count++;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 2944
N, K = gets.split.map(&:to_i)
S = gets.chomp.chars

def cumulative_sum(s)
  left = 0
  sums = []
  (s + ['-1']).each.with_index do |ch, i|
    if s[left] != ch
      sum = [s[left], sums.empty? ? 0 : sums[-1][2], i]
      sums.push(sum)
      left = i
    end
  end
  sums
end

sums = cumulative_sum(S)
ans = 0
sums.size.times do |i|
  ch, prev_sum, _ = sums[i]
  count =
    if ch == '0'
      left = i > 0 ? sums[i - 1][1] : 0
      right = sums[[i + (K - 1) * 2 + 1, sums.size - 1].min][2]
      right - left
    else
      left = prev_sum
      right = sums[[i + K * 2 - 1 + 1, sums.size - 1].min][2]
      right - left
    end
  ans = count if count > ans
end
puts ans


Measured memory_bytes: 16892
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

int main() {
  i64 N, M, V, P;
  cin >> N >> M >> V >> P;
  vector<i64> A(N);
  rep(i,0,N) cin >> A[i];
  using Pii = pair<i64, i64>;

  vector<Pii> vec;
  rep(i,0,N) vec.push_back({ A[i], i });

  sort(all(vec));

  i64 ok = N;
  i64 ng = -1;

  while(ok - ng > 1) {
    i64 m = (ok + ng) / 2;

    i64 idx = vec[m].second;

    i64 AA = A[idx] + M;


    i64 cnt = 0;
    i64 vs = 0;
    for(int i = N; i-->0;) {
      if(i == m) continue;
      i64 a = vec[i].first;
      i64 need = std::max(-1ll, AA - a);
      if(need == -1 || cnt <= P - 2) {
        cnt++, vs += M;
        continue;
      }
      if(cnt >= P) break;
      if(vs >= (V - 1) * M) continue;
      need = std::min(M, need);
      vs += need;
    }
    if(cnt < P && vs >= (V - 1) * M) {
      ok = m;
    }
    else {
      ng = m;
    }
  }
  cout << N - ok << endl;
}


Measured memory_bytes: 3316
#include<stdio.h>

int main(void){
    int i;
    int max = -2147483648;
    scanf("%d\n", &i);
    int min = 0;
    scanf("%d\n", &min);
    while((scanf("%d\n", &i)) != EOF){
        if((i - min) > max) max = i - min;
        if(i < min) min = i;
    }
    printf("%d\n", max);
    return 0;
} 

Measured memory_bytes: 1852
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


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

  vector<pair<pair<int, int>, int>> vec(M);
  REP(i, M){
    cin >> vec[i].first.first >> vec[i].first.second;
    vec[i].second = i;
  }

  sort(ALL(vec));

  int past = vec[0].first.first;
  int cnt = 0;
  REP(i, M){
    if(past != vec[i].first.first){
      cnt = 0;
      past = vec[i].first.first;
    }
    vec[i].first.second = ++cnt;
  }

  sort(ALL(vec),   // dai -> syou
      [](pair<pair<int, int>, int> const & l, pair<pair<int, int>, int> const &  r){
      return l.second < r.second;
      });

  REP(i, M){
    printf("%06lld%06lld\n", vec[i].first.first, vec[i].first.second);
  }

  return 0;
}

Measured memory_bytes: 3840
#include<iostream>
using namespace std;
int main(){
  int Case = 1;
  while(1){
    int w,n;
    int t[1001];
    int copy[1001];
    int takara[1000][2];
    for(int i=0;i<1001;i++){
      t[i]=0;
      copy[i]=0;
    }
    cin >> w;
    if ( w == 0)break;
    cin >> n;
    for(int i=0;i<n;i++){
      int kati,omosa;
      char conma;
      cin >> kati>>conma>>omosa;
      takara[i][0]=kati;
      takara[i][1]=omosa;
    }
    for(int i=1;i<=w;i++){
      if (i >= takara[0][1])copy[i] = takara[0][0]; 
    }
    for(int i=1;i<n;i++){
      for(int j=0;j<=w;j++){
        if (j <takara[i][1])t[j] = copy[j];
        else if (copy[j] < takara[i][0]+copy[j-takara[i][1]])t[j] = takara[i][0]+copy[j-takara[i][1]];
        else t[j] =copy[j]; 
      }
      for(int j=0;j<=w;j++){
        copy[j]=t[j];
      }
    }
    int max = t[w],maxweight = w;
    for(int i=w-1;i>=0 ;i--){                      
      if ( t[i] >= max ){
        max = t[i];
        maxweight = i;
      }  
    }
    cout << "Case " << Case++ <<":" <<endl <<max <<  endl<< maxweight << endl;
  }
  return 0;
}

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

#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ll long long
#define tp top()
#define fr front()
#define pii pair<int,int>
#define pip pair<int,pii>
#define ppi pair<pii,int>
#define ppp pair<pii,pii>
#define sz size()
using namespace std;

double PI = acos(-1);

int main()
{
	double a,b,x;
	scanf("%lf %lf %lf",&a,&b,&x);
	
//	double area = x/a;
	double top = ((2.0 * x) / (a * a)) - b;
	if (top <= 0){
		double y = (2.0*x)/(a*b);
		double ans = atan(b/y) * 180.0 / PI;
		printf("%.8lf\n",ans);
	} else {
		double dif = b-top;
		double ans = atan(dif/a) * 180.0 / PI;
		printf("%.8lf\n",ans);	
	}
	
	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
static const int N = 1000;

int lcs(string X, string Y) {
  int c[N + 1][N + 1];
  int m = X.size();
  int n = Y.size();
  int maxl = 0;
  X = ' ' + X;
  Y = ' ' + Y;
  for (int i = 0; i <= m; i++) c[i][0] = 0;
  for (int j = 1; j <= n; j++) c[0][j] = 0;

  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      if (X[i] == Y[j]) {
        c[i][j] = c[i - 1][j - 1] + 1;
      } else {
        c[i][j] = max(c[i - 1][j], c[i][j - 1]);
      }
      maxl = max(maxl, c[i][j]);
    }
  }

  return maxl;
}

int main() {
  string s1, s2;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s1 >> s2;
    cout << lcs(s1, s2) << endl;
  }
}


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

// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }

int n, m, q;
vector<int> a, b, c, d;
int ans = 0;

void dfs(vector<int> A){
  if(A.size() == n+1){
    int now = 0;
    rep(i,q){
      if(A[b[i]] - A[a[i]] == c[i])now += d[i];
    }
    ans = max(now,ans);
  }

  A.push_back(A.back());
  while(A.back() <= m){
    dfs(A);
    A.back()++;
  }
}

int main(){
  string s;
  cin >> s;
  if(s == "ARC")cout << "ABC" << endl;
  else cout << "ARC" << endl;
}



Measured memory_bytes: 3628
def read_input():
    a, b, c, x, y = map(int, input().split())
    return a, b, c, x, y


def submit():
    a, b, c, x, y = read_input()


    # ABピザをmin(x,y)まで買い、あとは個別
    p1 = 0
    if x < y:
        ab_n = 2 * x
        b_n = y - x
        p1 = b*b_n + ab_n*c
    else:
        ab_n = 2 * y
        a_n = x - y
        p1 = a*a_n + ab_n*c

    # A, Bを別々に買ったほうがいい
    p2 = a*x + b*y

    # 全部ABピザ
    p3 = c * max(x, y)*2

    print(min(p1, p2, p3))

if __name__ == '__main__':
    submit()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define bitrep(X,N) for(ll X = 0; X < (1 << (N)); X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end() 


using namespace std;

int main(){

    int n;
    cin >> n;

    int sum = 0;
    int expensive = 0;

    rep(i,n){
        int tmp;
        cin >> tmp;
        sum += tmp;
        expensive = max(expensive, tmp);
    }

    cout << sum - expensive / 2 << endl;


    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_a() {
	ll x, y, n, k, a, b;
	string s, t;
	// ans = 0;
	string ans = "NG";

	cin >> a >> s;

	if (a >= 3200) ans = s;
	else ans = "red";

	cout << ans << "\n";

	return;
}


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

	solve_abc_a();

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(abs(b-a)<=d&&abs(c-b)<=d||abs(a-c)<=d)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>

using namespace std;

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

int ans = 1000000000;
int n, a, b, c;
int l[8];

void f(int* x, int m){
    
    if (m == n){
        int mp = 0;
        int s[3];
        rep(i, 3) s[i] = 0;
        rep(i, n){
            if (x[i] == 3) continue;
            if(s[x[i]] != 0) mp += 10;
            s[x[i]] += l[i];
        }
        rep(i, 3) if(s[i] == 0) return;
        mp += abs(s[0] - a) + abs(s[1] - b) + abs(s[2] - c);
        ans = min(ans, mp); 
        return;
    }

    int y[n];
    rep(i, n) y[i] = x[i];
    rep(i, 4){
        y[m] = i;
        f(y, m + 1);
    }
}

int main(){
    cin >> n >> a >> b >> c;
    rep(i, n) cin >> l[i];
    int per[n];
    
    f(per, 0);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int n;
//vector<int> g[200020];
int main()
{
	cin>>n;
	ll ans=0;
	for(ll i=1; i<=n; i++){
		ans+=i*(n-i+1);
	}
	for(int i=0; i<n-1; i++){
		ll x, y; cin>>x>>y;
		if(x>y) swap(x, y);
		ans-=x*(n-y+1);
	}
	cout<<ans<<endl;
	return 0;
}


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

const long long MOD = 1000000007;

long long solve(long long N, std::string S){
    map<char,int> ma;
    for(int i=0;i<N;++i){
        ma[S[i]]++;
    }
    long long res = 1;
    for(auto p:ma){
        res *= p.second + 1;
        res %= MOD;
    }
    return ((res-1)%MOD+MOD)%MOD;
}

// Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    cout<<solve(N, S)<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <queue>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;
typedef tuple<int,int,int> Tp;

int main() {
    int N, M;
    cin >> N >> M;
    vector<bool> v(N, false);
    vector<int> pos(N, 0);
    vector<vector<Tp>> G(N);

    REP (i, 0, M) {
        int L, R, D;
        cin >> L >> R >> D;
        L--;
        R--;
        G[L].push_back(make_tuple(L, R, D));
        G[R].push_back(make_tuple(R, L, -D));
    }

    queue<Tp> q;
    int idx = 0;
    vector<bool> ch(N, false);
    while (true) {
        while ((idx < N && !G[idx].size()) || (idx < N && ch[idx])) {
            ch[idx] = true;
            idx++;
        }
        if (idx != N) {
            REP (i, 0, G[idx].size()) {
                q.push(G[idx][i]);
            }
            ch[idx] = true;
        } else {
            break;
        }

        while(q.size()) {
            Tp data = q.front();
            q.pop();
            int L = get<0>(data), R = get<1>(data), D = get<2>(data);
            if (ch[L] == false) {
                REP (i, 0, G[L].size()) {
                    q.push(G[L][i]);
                }
            }
            if (ch[R] == false) {
                REP (i, 0, G[R].size()) {
                    q.push(G[R][i]);
                }
            }
            bool ot = false;
            if (v[L] == false && v[R] == false) {
                pos[L] = 0;
                pos[R] = pos[L] + D;
            } else if (v[L] == true && v[R] == false) {
                pos[R] = pos[L] + D;
            } else if (v[L] == false && v[R] == true) {
                pos[L] = pos[R] + D;
            } else {
                if (pos[L] + D != pos[R]) {
                    ot = true;
                }
            }

            v[L] = v[R] = true;
            ch[L] = ch[R] = true;

            if (ot) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 13876
#include <iostream>
#include <string>
using namespace std;
int main(){
	string S;
	int cnt[2019] = {1}, ans = 0;
	int curr = 0, margin = 1;
	for(cin >> S; S.size(); S.pop_back()){
		ans += cnt[curr = (curr + (S.back() - '0') * margin) % 2019]++;
		margin = (margin * 10) % 2019;
	}
	cout << ans << endl;
}





Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  double a;
  
  if(n%2==0){
    cout << 0.50000000 << endl;
  }
  else{
    a = (n+1.0)/2.0/n;
      cout << fixed << setprecision(15);
    cout << a << endl;
  }
}


Measured memory_bytes: 256
a,b=map(int,input().split())
a_set = set(range(-int(-a//0.08),-int(-(a+1)//0.08)))
b_set = set(range(-int(-b//0.1),-int(-(b+1)//0.1)))
candi = sorted(list(a_set&b_set))
print(candi[0] if len(candi)>0 else -1)

Measured memory_bytes: 3060
#include<stdio.h>

#define N 100

int main(){
  int i,n,A[N],j,tmp,cnt=0;

  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&A[i]);
  }

  for(i=0; i<n; i++){
    for(j=n-1;j>=i+1;j--){
      if(A[j]<A[j-1]){
	tmp=A[j];
	A[j]=A[j-1];
	A[j-1]=tmp;
	cnt++;
      }
    }
  }

  for(i=0;i<n;i++){
    if(i>0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n%d\n",cnt);

  return 0;
}

Measured memory_bytes: 604
import numpy as np
H , W = list(map(int, input().split()))
S = np.array([list(input().rstrip()) for _ in range(H)]) == '.'
U = np.zeros((H, W), dtype=int)
D = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)
L = np.zeros((H, W), dtype=int)
for h in range(1, H):
    U[h] = (U[h - 1] + 1) * S[h - 1]
for h in reversed(range(H - 1)):
    D[h] = (D[h + 1] + 1) * S[h + 1]
for w in range(1, W):
    L[:, w] = (L[:, w - 1] + 1) * S[:, w - 1]
for w in reversed(range(W - 1)):
    R[:, w] = (R[:, w + 1] + 1) * S[:, w + 1]
print(np.max((U+D+L+R) * S) + 1)

Measured memory_bytes: 219832
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
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;}

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

Measured memory_bytes: 256
def gcd(a,b): 
    if a == 0: 
        return b 
    return gcd(b % a, a) 

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

if __name__ == "__main__":
    n1,n2=map(int,input().split(' '))
    print(int(lcm(n1,n2)))

Measured memory_bytes: 9180
#include<iostream>

#define EVEL '1'

using namespace std;

using lli = long long int;
using ulli = unsigned long long int;

#define MOD 1000000007

#ifndef EVEL

#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s;
#define dbugln std::cout<<"\n";

#else

#define dbug(X) {X=X;}
#define dbugf(s) {}
#define dbugln {}

#endif

int N;
lli A[100002];
int c = 0, ans = 0;

int main(){
  cin >> N;
  cin >> A[0];
  for(int l = 1; l < N ;l++){
    cin >> A[l];
    if(A[l-1] < A[l] && c >= 0){
      c++;
      dbugf("1 ");
    }else if(A[l-1] > A[l] && c > 0){
      ans++;
      c = 0;
      dbugf("2 ");
    }else if(A[l-1] > A[l] && c <= 0){
      c--;
      dbugf("3 ");
    }else if(A[l-1] < A[l] && c < 0){
      ans++;
      c = 0;
      dbugf("4 ");
    }else if(A[l-1] == A[l] && c > 0){
      c++;
      dbugf("5 ");
    }else if(A[l-1] == A[l] && c > 0){
      c--;
      dbugf("6 ");
    }else{
      dbugf("7 ");
    }
    dbug(c);
    dbugln;
  }

  cout << ans+1;

  return 0;

}


Measured memory_bytes: 1024
#include <iostream>                                             
using namespace std;                                            
                                                                
int main(void) {                                                
  int a, b;                                                     
  cin >> a >> b;                                                
  if (a<b) {                                                    
    cout << "a < b" << endl;                                    
  } else if (a>b) {                                             
    cout << "a > b" << endl;                                    
  } else {                                                      
    cout << "a == b" << endl;                                   
  }                                                             
  return 0;                                                     
}                                                               
                                     

Measured memory_bytes: 3092
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<cmath>
#include<cstring>
using namespace std;
#define maxn 510
#define llg long long 
#define yyj(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout);
llg n,m;
char a[maxn][maxn],b[maxn][maxn];
bool check(llg lx,llg ly)
{
	llg nx=lx+m-1,ny=ly+m-1;
	if (nx>n || ny>n) return 0;
	for (llg i=0;i<m;i++)
		for (llg j=0;j<m;j++)
			if (a[lx+i][ly+j]!=b[i+1][j+1])
			{
				return 0;
			}
	return 1;
}

int main()
{
	//yyj("B");
	cin>>n>>m;
	for (llg i=1;i<=n;i++) scanf("%s",a[i]+1);
	for (llg i=1;i<=m;i++) scanf("%s",b[i]+1);
	for (llg i=1;i<=n;i++)
		for (llg j=1;j<=n;j++)
			if (check(i,j))
				{
					puts("Yes");
					return 0;
				}
	puts("No");
	return 0;
}


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

long long dp[2][10003];

int main()
{


        long long n,m,a,b,c,d,e,f,g,h,p,q,r,fr,sc,tr,sz,tz,i,j,k,mx=LLONG_MIN,mn=99999999999;
        long long x=0,y=0,cnt=0,res=0,ttl=0,ans=0,sum=0; long long flg=0,flag=1,na=0,as=1;
        vector<long long>u,v,w; vector< pair<long long,long long> >vct; vector<string>vst;
        set<long long>st,nt,tt; map<long long,long long>mp,nq,qr; string str,ttr,ntr;

        scanf("%lld %lld",&h,&n);

        for(i=1;i<=n;i++)
        {
            scanf("%lld %lld",&a,&b);  vct.push_back(make_pair(a,b));

        }

        long long idx,cap;

        for(idx=n-1;idx>=0;idx--)
        {
            for(cap=1;cap<=h;cap++)
            {
                a=vct[idx].first; b=vct[idx].second; fr=idx%2; sc=(idx+1)%2;

                if(idx==n-1)
                {
                    long long p=mn,q=mn,d,e,f;

                    if(cap-a<=0)d=b;
                    else{ d=b+dp[fr][cap-a];  }

                    e=q;

                    dp[fr][cap]=min(d,e);

                }
                else
                {

                    long long p=mn,q=mn,d,e,f;

                    if(cap-a<=0)d=b;
                    else{   d=b+dp[fr][cap-a];   }

                    e=dp[sc][cap];

                    dp[fr][cap]=min(d,e);

                }


                //cout<<idx<<" "<<cap<<"    "<<dp[fr][cap]<<endl;



            }
        }






       printf("%lld\n",dp[0][h]);







    return 0;
}




Measured memory_bytes: 3896
#coding:utf-8
 
import sys
import copy
 
def main():
    line = sys.stdin.readline()
    while line.split() != ["0","0"]:
        analy(line)
        line = sys.stdin.readline()
    return
 
def analy(line):
    field = [int(n) for n in line.split()]
    num = int(sys.stdin.readline())
    data = []
    for i in range(num):
        a = sys.stdin.readline()
        b = [int(n) for n in a.split()]
        data.append(b)
    print (compute(field, data))
 
def compute(field, ng):
    list = []
    for i in range(field[1]):
        for j in range(field[0]):
                if i == 0 :
                    if [j+1,i+1] in ng:
                        list.append(0)
                    elif j == 0:
                        list.append(1)
                    else:
                        list.append(list[j-1])
                else:
                    if [j+1,i+1] in ng:
                        list[j] = 0
                    elif j != 0:
                    #no left the same.
                        list[j] = list[j-1] + list[j]
    return list[len(list)-1]
 
if __name__ == "__main__":
    main()

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

template<int64_t MOD> struct Mint {
  int64_t v;
  Mint() { v = 0; }
  Mint(int64_t x) { v = x % MOD; if(v < 0) v += MOD; }

  Mint operator-() { return Mint(-v); };
  Mint operator+(Mint x) { return Mint(v + x.v); };
  Mint operator-(Mint x) { return Mint(v - x.v); };
  Mint operator*(Mint x) { return Mint(v * x.v); };
  Mint operator/(Mint x) { return Mint(v * pow(x.v, MOD-2).v); };

  Mint& operator+=(Mint x) { return *this = (*this + x); };
  Mint& operator-=(Mint x) { return *this = (*this - x); };
  Mint& operator*=(Mint x) { return *this = (*this * x); };
  Mint& operator/=(Mint x) { return *this = (*this / x); };

  static Mint pow(Mint base, int64_t exp) {
    if(exp == 0) return Mint(1);
    return pow(base*base, exp/2) * (exp&1 ? base : Mint(1));
  }

  friend ostream& operator<<(ostream& os, Mint x) { return os << x.v; }
};
using mint = Mint<1000000007>;

const int SIZE = 11234567;
mint fact(int n) {
  static vector<mint> factorial = []() {
    vector<mint> _f(SIZE, 1);
    for(int i=1; i<SIZE; i++) _f[i] = _f[i-1] * i;
    return _f;
  }();
  return factorial[n];
}
mint perm(int n, int k) { return n<k ? 0 : fact(n) / fact(n-k); }
mint comb(int n, int k) { return n<k ? 0 : perm(n, k) / fact(k); }

int main() {
  lint N;
  cin >> N;

  mint ans = 0;
  ans += mint::pow(10, N);
  ans -= mint::pow(9, N) * 2;
  ans += mint::pow(8, N);
  cout << ans << endl;
}

Measured memory_bytes: 3624
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			if(a==0 && b==0 && c==0)break;
			
			double[] d = new double[3];
			d[0] = Math.sqrt(a*a + b*b);
			d[1] = Math.sqrt(b*b + c*c);
			d[2] = Math.sqrt(c*c + a*a);
			Arrays.sort(d);
			
			int n = sc.nextInt();
			int r;
			for(int i=0;i<n;i++){
				r = sc.nextInt();
				if(d[0]<r*2){
					System.out.println("OK");
				}else{
					System.out.println("NA");
				}
				
			}
			
		}
	}	
}

Measured memory_bytes: 17196
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0)
#define scl(n) scanf("%lld", &n)
#define pcl(n) printf("%lld\n", n)
#define pcl1(n) printf("%lld ", n)
#define nln printf("\n")
#define dev(x) cout << #x << " " << x << " ";
#define PTT pair<ll, ll>

map<ll, ll> mp, mp1;
map<ll, ll>::iterator itr;

int main()
{
    ll t, n, x;
    scl(n);
    ll mod = 1e9 + 7;
    if (n == 1)
    {
        cout << 1 << endl;
    }
    else
    {
        for (ll i = 2; i <= n; i++)
        {
            x = i;
            for (ll j = 2; j * j <= x; j++)
            {
                while (x % j == 0)
                {
                    x /= j;
                    mp[j] += 1;
                }
            }
            if (x > 1)
            {
                mp[x] += 1;
            }
        }
        ll ans = 1;
        for (auto k : mp)
        {
            ans = ((ans % mod) * ((k.second + 1) % mod)) % mod;
        }
        pcl(ans);
    }

    return 0;
}

Measured memory_bytes: 3796
using System;
using System.Collections.Generic;

namespace AtCoder_ABC_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int k, x;

            string[] str = Console.ReadLine().Split(' ');
            k = int.Parse(str[0]);
            x = int.Parse(str[1]);

            for (int i = x - k + 1; i <= x + k - 1; i++)
            {
                Console.Write(i + " ");
            }
        }
    }
}

Measured memory_bytes: 13140
(let* ((x (read))
       (y (make-array `(,(1+ (* 2 x))) :initial-element t)))
  (loop :for i :from 2 :to (ceiling (sqrt (* 2 x)))
        :if (aref y i)
        :do (loop :for j :from (* i 2) :to (* 2 x) :by i
                  :do (setf (aref y j) nil)))
  (loop :for i :from x :to (* 2 x)
        :if (aref y i)
        :return (format t "~A~%" i)))


Measured memory_bytes: 26192
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

struct Node {
  int key;
  Node *next, *prev;
};

Node *nil;

Node *list_search(int key) {
  Node *cur = nil->next;
  while (cur != nil && cur->key != key) {
    cur = cur->next;
  }
  return cur;
}

void init() {
  nil = (Node *) malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void print_list() {
  Node *cur = nil->next;
  int isf = 0;
  while (true) {
    if (cur == nil) {
      break;
    }
    if (isf++ > 0) {
      printf(" ");
    }
    printf("%d", cur->key);
    cur = cur->next;
  }
  printf("\n");
}

void delete_node(Node *t) {
  if (t == nil) {
    return;
  }
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void delete_first() {
  delete_node(nil->next);
}

void delete_last() {
  delete_node(nil->prev);
}

void delete_key(int key) {
  delete_node(list_search(key));
}

void insert(int key) {
  Node *x = (Node *) malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main() {
  int key, n;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for (int i = 0; i < n; ++i) {
    scanf("%s%d", com, &key);
    if (com[0] == 'i') {
      insert(key);
      ++np;
      ++size;
    } else if (com[0] == 'd') {
      if (strlen(com) > 6) {
        if (com[6] == 'F') {
          delete_first();
        } else if (com[6] == 'L') {
          delete_last();
        }
      } else {
        delete_key(key);
        ++nd;
      }
      --size;
    }
  }

  print_list();

  return 0;
}



Measured memory_bytes: 33840
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <tuple>

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

int main() {
  string s;
  cin >> s;
  int ans = 0;

  for(char c: s) {
    if (c == '+') ans++;
    if (c == '-') ans--;
  }

  
  cout << ans<< endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, m, k, a;
bool like[31][31];

int main(){
	cin >> n >> m;
	memset(like, 0, sizeof(like));
	for(ll i = 1; i <= n; i++){
		cin >> k;
		for(ll j = 1; j <= k; j++){
			cin >> a;
			like[i][a] = true;
		}
	}
	
	ll ans = 0;
	for(ll j = 1; j <= m; j++){
		bool flag = true;
		for(ll i = 1; i <= n; i++){
			if(!like[i][j]){flag = false;}
		}
		if(flag){ans++;}
	}
	
	cout << ans << endl;
	return 0;
}

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

int top = 0, S[1000];

void push(int x) {
  S[++top] = x;
}

int pop(void) {
  top--;
  return S[top+1];
}

int main(void) {
  int a, b;
  top = 0;
  char s[100];
  while(scanf("%s",s) != EOF) {
    if(s[0] == '+') {
      a = pop();
      b = pop();
      push(a + b);
    } else if(s[0] == '-') {
      b = pop();
      a = pop();
      push(a - b);
    } else if(s[0] == '*') {
      a = pop();
      b = pop();
      push(a * b);
    } else {
      push(atoi(s));
    }
  }
  printf("%d\n",pop());

  return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) ((x).begin()),((x).end())
#define int ll
using pii = pair <int, int>;
#define INF 0x7f7f7f7f7f7f7f7f
const bool debug = false;

bool ispal(string str)
{
    string strprime = str;
    reverse(all(strprime));
    return str == strprime;
}
int32_t main()
{
    string str;
    cin >> str;
    int n = str.length();
    string str1 = str.substr(0, (n-1)/2);
    string str2 = str.substr((n+1)/2);
    cout << (ispal(str) && (ispal(str1) && ispal(str2))?"Yes":"No");
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		final int max = 1000000;
		int[] vals = new int[200];
		int maxN = 1;
		int val = 1;
		int maxValN = 0;

		ArrayList<Integer> arrayList = new ArrayList<>();
		int n;
		while ((n = s.nextInt()) != 0) {
			arrayList.add(n);
		}

		while (val < max) {
			vals[maxN] = val;
			if (val % 2 == 1) {
				maxValN = maxN;
			}
			maxN++;
			val = maxN * (maxN + 1) * (maxN + 2) / 6;
		}
		maxN--;

		int[] dp = new int[max];
		for (int i = 0; i < dp.length; i++) {
			dp[i] = 1000000000;
		}
		dp[0] = 0;

		for (int i = 1; i <= maxN; i++) {
			for (int j = vals[i]; j < max; j++) {
				dp[j] = Math.min(dp[j], dp[j - vals[i]] + 1);
			}

		}
		int[][] b = new int[arrayList.size()][2];
		for (int i = 0; i < arrayList.size(); i++) {
			b[i][0] = dp[arrayList.get(i)];
		}
		for (int i = 0; i < dp.length; i++) {
			dp[i] = 1000000000;
		}
		dp[0] = 0;

		for (int i = 1; i <= maxN; i++) {
			if ((vals[i] % 2) != 1)
				continue;
			for (int j = vals[i]; j < max; j++) {
				dp[j] = Math.min(dp[j], dp[j - vals[i]] + 1);
			}

		}
		for (int i = 0; i < arrayList.size(); i++) {
			b[i][1] = dp[arrayList.get(i)];
		}

		for (int i = 0; i < b.length; i++) {
			System.out.println(b[i][0] + " " + b[i][1]);
		}

	}
}

Measured memory_bytes: 32292
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;


int main(void) {
  string s;
  cin >> s;
  string a = "AAA";
  string b = "BBB";
  if(s == a) cout << "No" << endl;
  else if(s == b) cout << "No" << endl;
  else cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int n;
  if(a/d >= c/b){
    n = c/b + 1;
  }else{
    n = a/d + 1;
  }
  for(int i=0;i<n;i++){
    c -= b;
    if(c<=0){
      cout << "Yes" << endl;
      break;
    }
    a -= d;
    if(a <=0){
      cout << "No" << endl;
      break;
    }
  }
    
}

Measured memory_bytes: 3568
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<map> 
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int maxn=2e5+6;
const int mod=1e9+7;
const double pi=acos(-1.0);
int n,m; 
int read(){        
    int s = 0, f = 1;        
    char ch = getchar();        
    while(!isdigit(ch)) {        
        if(ch == '-') f = -1;        
        ch = getchar();        
    }        
    while(isdigit(ch)) {        
        s = s * 10 + ch - '0';        
        ch = getchar();        
    }        
    return s * f;        
}        
void write(int x){        
    if(x < 0) {        
        putchar('-');        
        x = -x;        
    }        
    if(x > 9)        
        write(x/10);        
    putchar(x % 10 + '0');        
    return;        
}   
signed main(){
	string s,t;
	cin>>s>>t;
	if(s.length()-t.length()!=-1){
		cout<<"No"<<endl;
		return 0;
	}
	if(s==t.substr(0,s.length())){
		cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3628
import java.util.*;
import java.lang.*;
import java.io.*;

class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      if(sc.nextInt()*sc.nextInt()*sc.nextInt()==175){
        System.out.println("YES");
      }
      else{
        System.out.println("NO");
      }
      
    }
}

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

int main(){
  int N;
  cin >> N;
  string S = to_string(N);
  string ans = "";
  for (int i = 0; i < S.size(); i++){
    if (S.at(i) == '9') cout << '1';
    if (S.at(i) == '1') cout << '9';
  }
  cout << "" << endl;
}

Measured memory_bytes: 3668
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String S = scan.next();
		StringBuilder sb  = new StringBuilder();
		
		for(int i = 0; i < S.length(); i++) {
			sb.append('x');
		}

		System.out.println(sb.toString());
	}
}

Measured memory_bytes: 22740
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

int main() {
    int n,l;
    cin >> n >> l;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    int ans = -1;
    vector<int> ret;
    for(int i = 0; i < n-1; i++){
        if(a[i] + a[i+1] >= l){
            ans = i+1;
            break;
        }
    }
    if(ans == -1){
        cout << "Impossible" << endl;
    }else{
        cout << "Possible" << endl;
        for(int i = ans; i < n; i++){
            ret.push_back(i);
        }
        for(int i = ans - 1; i > 0; i--){
            ret.push_back(i);
        }
        reverse(ret.begin(), ret.end());
        for(int i = 0; i < n-1; i++){
            cout << ret[i] << endl;
        }
    }
}

Measured memory_bytes: 1784