akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,cnte[300005],ans[300005];
string s;
signed main(){
    cin>>n>>s;
    for(int i=0;i<n;i++){
    	if(i==0){
    		if(s[i]=='E')cnte[i]++;
    	}else {
    		cnte[i]=cnte[i-1];
    		if(s[i]=='E')cnte[i]++;
    	}
    }
    for(int i=0;i<n;i++){
    	if(i==0)ans[i]=cnte[n-1]-cnte[0];
    	else if(i==n-1)ans[i]=n-1-cnte[n-2];
    	else {
    		ans[i]=i-cnte[i-1];
    		ans[i]+=cnte[n-1]-cnte[i];
    	}
    }
    sort(ans,ans+n);
    cout<<ans[0]<<endl;
}

Measured memory_bytes: 5380
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	var N, K int
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d", &N)
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d", &K)

	hs := make([]int, N+1)
	for i := 1; i < N+1; i++ {
		scanner.Scan()
		fmt.Sscanf(scanner.Text(), "%d", &hs[i])
	}

	dp := make([]int, N+1)
	dp[1] = 0
	for i := 2; i < N+1; i++ {
		m := math.MaxInt64
		for j := 1; i-j > 0 && j <= K; j++ {
			m = min(m, dp[i-j]+abs(hs[i-j]-hs[i]))
		}
		dp[i] = m
	}
	fmt.Println(dp[N])
}

func abs(n int) int {
	if n >= 0 {
		return n
	}
	return -n
}

func min(ns ...int) int {
	ret := math.MaxInt64
	for _, n := range ns {
		if n < ret {
			ret = n
		}
	}
	return ret
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
int main(){
    int n,k,a;
    long long sum=0;
    cin>>n>>k;
    priority_queue<int> pq;
    REP(i,n){
        cin>>a;
        pq.push(a);
    }
    REP(i,k)pq.pop();
    REP(i,n-k){
        sum+=pq.top();
        pq.pop();
    }
    cout<<sum<<endl;
}

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

using namespace std;
const int N = 1e5 + 9 ;
bool vis[N];
vector < int > adj[N];
int n , m, x , y;
int mem[N];
int dfs(int s){
    if(adj[s].empty()){

        return 0;
    }
    vis[s] = 1;
    int &ret = mem[s];
    if(~ret)
        return ret;
    for(int i = 0 ; i < adj[s].size() ; ++i){
              int to = adj[s][i];
              ret = max(ret , 1 + dfs(to));

    }
    return ret;


}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    memset(mem , -1 , sizeof mem);
    cin >> n >> m;
    for(int i = 0 ; i < m ; ++i){
        cin >> x >> y;
        adj[x].push_back(y);
    }
    int ans = 0;
    for(int i = 1 ;i<=n;++i){
        if(!vis[i]){
            ans = max(ans , dfs(i));
        }
    }
    cout << ans;
    return 0;
}


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

void Insert();
void Delete();
void DeleteFirst();
void DeleteLast();
void Output();
int Search(int a);

typedef struct{
  int back;
  int next;
  int value;
}LIST;

LIST data[3000005];
int p = 2;

int main(){
  int n;
  string query;
  data[0] = ((LIST){0,1,-1});
  data[1] = ((LIST){1,0,-1});
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> query;
    if(query == "insert")Insert();
    else if(query == "delete")Delete();
    else if(query == "deleteFirst")DeleteFirst();
    else if(query == "deleteLast")DeleteLast();
  }
  Output();
  return 0;
}

void Insert(){
  int v;
  cin >> v;
  data[p].value = v;
  data[p].back = 0;
  data[p].next = data[0].next;
  data[0].next = p;
  data[data[p].next].back = p;
  p++;
  return;
}

void Delete(){
  int a,v;
  cin >> a;
  v = Search(a);
  if(!~v)return;
  
  data[data[v].back].next = data[v].next;
  data[data[v].next].back = data[v].back;
  return;
}

void DeleteFirst(){
  data[0].next = data[data[0].next].next;
  data[data[0].next].back = 0;
  return;
}

void DeleteLast(){
  data[1].back = data[data[1].back].back;
  data[data[1].back].next = 1;
  return;
}

void Output(){
  int v = data[0].next;
  while(1){
    cout << data[v].value;
    if(data[v].next == 1)break;
    cout << " ";
    v = data[v].next;
  }
  cout << endl;
  return;
}

int Search(int a){
  int v = data[0].next;
  while(1){
    if(data[v].value == a)return v;
    if(data[v].next == 1)break;
    v = data[v].next;
  }
  return -1;
}

Measured memory_bytes: 16032
/*
 * Author: NomadThanatos
 * Created Time:  2011/8/31 13:18:17
 * File Name: I.cpp
 */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;

#define out(v) cerr << #v << ": " << (v) << endl
#define SZ(v) ((int)(v).size())

const int MAXINT = -1u>>1;

int main() {
    int K;
    while(scanf("%d",&K) == 1 && K) {
        int sum = 0;
        for(int k = 0 ; k < K * (K - 1) / 2 ; k++) {
            int tmp;
            scanf("%d",&tmp);
            sum += tmp;
        }
        sum /= (K - 1);
        printf("%d\n",sum);
    }
    return 0;
}

Measured memory_bytes: 0
//たてH cm よこ W cm の長方形を描くプログラム
#include <stdio.h>

int main()
{
	int i, j;//ループカウンタ
	int H, W;//縦と横
	while (1){
	  scanf("%d %d", &H, &W);
	  if (H == 0) break;
	  for (i = 0; i < W; i++){
		  printf("#");
	  }
	  printf("\n");
		for (j = 0; j < H-2; j++){
			printf("#");
			for (i = 0; i < W-2; i++){
				printf(".");
			}
			printf("#\n");
		}
		for (i = 0; i < W; i++){
			printf("#");
		}
		printf("\n\n");
	}
	return 0;
}


Measured memory_bytes: 2144
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const int INF = 100000000;
using namespace std;

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

    int maxi;
    vector<int> v;
    vector<int> ans;
    for(int i = (sqrt(n) + 1) * 2; i * i + 1 >= n; i--){
        int temp = n;
        v.clear();
        for(int j = i; j > 0; j--){
            if(temp >= j){
                v.emplace_back(j);
                temp-=j; 
                //show(j)
            }
            if(temp == 0){
                ans.clear();
                ans = v;
            }
        }
    }
    for(auto it:ans){
        cout << it << endl;
    }
}


Measured memory_bytes: 384
class PriorityQueue < Array
  def <<(x)
    super(x)
    i = size - 1
    while i > 0
      j = parent(i)
      swap_if(i,j)
      i = j
    end
  end
 
  def push(x); self << x; end
 
  def pop
    x = super
    ret = self[0]
    return x if ret.nil?
    self[0] = x
    i = 0
    while parent?(i)
      j, k = children(i)
      j = k if self[k] && self[j] < self[k]
      swap_if(j,i)
      i = j
    end
    ret
  end
 
  private
 
  def swap(i, j); self[i], self[j] = self[j], self[i]; end
  def swap_if(i,j); swap(i,j) if self[i] > self[j]; end
  def parent(i); (i - 1) / 2; end
  def parent?(i); i * 2 + 1 < size; end
  def children(i); [i * 2 + 1, i * 2 + 2]; end
end
 
n,m = gets.split.map &:to_i
work = n.times.map{ gets.split.map(&:to_i) }.sort_by(&:first)

que = PriorityQueue.new
ans = 0
i = 0

1.upto(m) do |j|
  loop do
    break if !work[i] || work[i].first > j
    que << work[i].last
    i += 1
  end
  next if que.empty?
 
  v = que.pop
  ans += v
end
 
puts ans

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

#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

int main() {
    int N;
    cin >> N;
    vector<int> L(2 * N);
    for(int i = 0; i < 2 * N; i++) cin >> L[i];
    sort(all(L));
    int sum = 0;
    for(int i = 0; i < 2 * N; i+= 2){
        sum += min(L[i], L[i + 1]);
    }
    cout << sum << endl;
}

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

int main(){
  ll n,k;
  cin >>n>>k;
  ll a =n/k;
  ll ans=min(n-a*k,(a+1)*k-n);
  cout <<ans<<endl;
}

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


const int MAX_CHAR = 26; 
const int MAX_FACT = 20; 
ll fact[MAX_FACT]; 
  
// utility for calculating factorials 
void precomputeFactorials() 
{ 
    fact[0] = 1; 
    for (ll i = 1; i < MAX_FACT; i++){
        fact[i] = fact[i - 1] * i;
        //cout << i << "||" << fact[i] << endl; 
    }
}

ll gcd(ll a, ll b){
    if(a < b) swap(a, b);
    if(b == 0) return a;
    return gcd(b, a%b);
}

vector <string> getWords(string s){
    string cur = "";
    vector <string> vec;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == ' '){
            vec.push_back(cur);
            cur = "";
        } else cur += s[i];
    }
    vec.push_back(cur);
    return vec;
}

map <int,string> mp;

int main(){
    int n;
    cin >> n;
    set <int> se, se1;
    se.insert(2);
se.insert(4); 
se.insert(5); 
se.insert(7); 
se.insert(9);
se1.insert(0);
se1.insert(1); 
se1.insert(6); 
se1.insert(8); 

    if(se.count(n%10)){
        cout << "hon";
    } else if(se1.count(n%10)){
        cout << "pon";
    } else cout << "bon";
}
   

Measured memory_bytes: 3636
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE BangPatterns #-}
import Data.Char (isSpace)
import Data.List (unfoldr, tails, sort)
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS

isTriangle :: Int -> Int -> Int -> Bool
isTriangle a b c = a < b + c && b < c + a && c < a + b

naive = do
  n <- readLn :: IO Int
  xs <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  print $ length [ (a,b,c) | a:xss <- tails xs, b:xsss <- tails xss, c <- xsss, isTriangle a b c ]

-- v は昇順にソートされているとする。
-- countGE a v は a 以上の要素の個数を数える。
countGE :: Int -> U.Vector Int -> Int
countGE !a = loop 0
  where
    loop !s !v | U.null v = s
               | U.length v == 1 = if a <= U.head v then
                                     s + 1
                                   else
                                     s
               | otherwise = let n = U.length v
                                 n2 = n `quot` 2
                             in if a <= v U.! n2 then
                                  loop (n - n2 + s) (U.take n2 v)
                                else
                                  loop s (U.drop n2 v)

main = do
  n <- readLn :: IO Int
  xs <- mergeSort . U.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  let c = U.generate (2*10^3+1) $ \c_max -> countGE c_max xs
  print $ sum [ n - (j+1) - c U.! c_max
              | i <- [0..n-1]
              , let a = xs U.! i
              , j <- [i+1..n-1]
              , let b = xs U.! j
              , let c_max = a + b {- c < a + b, b - a < c, a - b < c -}
              ]

mergeSortBy :: (U.Unbox a) => (a -> a -> Ordering) -> U.Vector a -> U.Vector a
mergeSortBy !cmp !vec = doSort vec
  where
    doSort vec | U.length vec <= 1 = vec
               | otherwise = let (xs, ys) = U.splitAt (U.length vec `quot` 2) vec
                             in merge (doSort xs) (doSort ys)
    merge xs ys = U.create $ do
      let !n = U.length xs
          !m = U.length ys
      result <- UM.new (n + m)
      let loop !i !j
            | i == n = U.copy (UM.drop (i + j) result) (U.drop j ys)
            | j == m = U.copy (UM.drop (i + j) result) (U.drop i xs)
            | otherwise = let !x = xs U.! i
                              !y = ys U.! j
                          in case cmp x y of
                               LT -> do UM.write result (i + j) x
                                        loop (i + 1) j
                               EQ -> do UM.write result (i + j) x
                                        UM.write result (i + j + 1) y
                                        loop (i + 1) (j + 1)
                               GT -> do UM.write result (i + j) y
                                        loop i (j + 1)
      loop 0 0
      return result

mergeSort :: (U.Unbox a, Ord a) => U.Vector a -> U.Vector a
mergeSort = mergeSortBy compare


Measured memory_bytes: 1020
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<cstdio>
#include<climits>
#include<iostream>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>
#include<queue>
#include<map>
#include<set>
#include<utility>
#include<queue>

using namespace std;
int R,C;
const int MAX = 10000;
bool senbei[MAX][MAX];
int count(){
  /*cout << "begin" << endl;
  for(int i = 0;i < R;i++){
    for(int j = 0;j < C;j++){
      cout << (int)senbei[i][j];
    }
    cout << endl;
  }
  */

  int ans = 0;

  for(int i = 0;i < C;i++){
    int num = 0;
    for(int j = 0;j < R;j++){
      if(senbei[j][i])num++;
    }
    ans+=max(num,R-num);
  }

  //cout << ans << endl;
  //cout << "end" << endl;
  return ans;
}


int dfs(int r){
  if(r == 0)return count();
  int ans = dfs(r-1);
  for(int i = 0;i < C;++i)senbei[r][i] = !senbei[r][i];
  ans = max(dfs(r-1),ans);
  for(int i = 0;i < C;++i)senbei[r][i] = !senbei[r][i];
  return ans;
}
int main(){
  ios::sync_with_stdio(false);

  while(cin >> R >> C && (R+C)>0){
    for (int r = 0; r < R; ++r){
      for (int c = 0; c < C; ++c){
	bool b;
	cin >> b;senbei[r][c] = b > 0 ? true:false;
      }
    }
    cout << dfs(R) << endl;
  }

  return 0;
}

Measured memory_bytes: 1308
import sys
from itertools import product

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    H, W, K = map(int, input().split())
    grid = [list(input()) for _ in range(H)]

    R = [[0] * (W + 1) for _ in range(H + 1)]
    for h in range(H):
        for w in range(W):
            R[h + 1][w + 1] = R[h][w + 1] + R[h + 1][w] - R[h][w] + int(grid[h][w])

    res = f_inf
    for pattern in product([0, 1], repeat=H-1):
        cut_H = [idx + 1 for idx, p in enumerate(pattern) if p == 1] + [H]
        cnt_cut = sum(pattern)
        left = 0
        right = 1
        flg = 1
        while right <= W:
            if not flg:
                break
            up = 0
            for bottom in cut_H:
                cnt_w = R[bottom][right] - R[bottom][left] - R[up][right] + R[up][left]
                if cnt_w > K:
                    if right - left == 1:
                        flg = False
                    cnt_cut += 1
                    left = right - 1
                    break
                else:
                    up = bottom
            else:
                right += 1
        else:
            res = min(res, cnt_cut)
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9524
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        int m = Integer.parseInt(scan.next());
        UnionFind uf = new UnionFind(n);
        for (int i = 0; i < m; i++) {
            int a = Integer.parseInt(scan.next());
            int b = Integer.parseInt(scan.next());
            a--;
            b--;
            uf.unite(a, b);
        }
        scan.close();

        int[] root = new int[n];
        for (int i = 0; i < n; i++) {
            root[uf.getRoot(i)]++;
        }

        int ans = 0;
        for (int i = 0; i < n; i++) {
            ans = Math.max(ans, root[i]);
        }

        System.out.println(ans);
    }

    static class UnionFind {

        /** ルートノード */
        public int[] roots;

        /**
         * コンストラクタ.
         *
         * @param n ノード数
         */
        public UnionFind(int n) {
            roots = new int[n];
            for (int i = 0; i < n; i++) {
                roots[i] = i;
            }
        }

        /**
         * 各々のノードが属するグループを結合する.
         *
         * @param x
         * @param y
         */
        public void unite(int x, int y) {
            roots[getRoot(y)] = getRoot(x);
        }

        /**
         * 各々のノードが属するグループが同じかどうかを判定する.
         *
         * @param x
         * @param y
         * @return 同じグループに属するならtrue
         */
        public boolean same(int x, int y) {
            return getRoot(x) == getRoot(y);
        }

        /**
         * ルートノードを返す.<br>
         * 再帰によって経路圧縮を行っている.
         *
         * @param x
         * @return ルートノード
         */
        public int getRoot(int x) {
            int parent = roots[x];
            if (x != parent) {
                roots[x] = getRoot(parent);
            }
            return roots[x];
        }

    }

}


Measured memory_bytes: 59540
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#define forn(i, n) for (long long i = 0; i < (long long) (n); ++i)
#define pb emplace_back
#define endl '\n'

template<typename T> void _dbg(const char*_s,T _h) { cerr<<_s<<" = "<<_h<<"\n"; }

template<typename T, typename... Ts> void _dbg(const char*_s,T _h,Ts... _t) {
    for(int _b=0;((_b+=*_s=='(')-=*_s==')')!=0||*_s!=',';)cerr<<*_s++;
    cerr<<" = "<<_h<<",";_dbg(_s+1,_t...);
}

#define int long long

#ifdef LOCAL
    #define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
    #define dbg(...)
#endif

const int N = 500 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int a, b, c;

bool read() {
    if (!(cin >> a >> b >> c))
        return false;

    return true;
}

void solve(int id = 0) {
    swap(a, b);
    swap(a, c);
    cout << a << ' ' << b << ' ' << c << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    srand(time(nullptr));

    int T;
    T = 1;

    while (read())
        solve(T++);

    return 0;
}



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

m_ = min(A)

flag = True

#m_ = m
while True:
    m = m_
    flag = True
    for a in A:
        n = a % m
        if n > 0:
            flag = False
            m_ = min(m_, n)
    if m_ == m:
        break
    if flag:
        break

print(m_)

Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s);i<(e);i++)
#define rep(i,n) REP(i,0,n)

vector<vector<pair<int, int>>> G;
vector<int> color;
vector<int> visited; // 0: unvisited, 1: visiting, 2: visited

void solve(int n, int dist) {
  if (dist % 2 == 0)
    color[n] = 1;

  visited[n] = 1;
  for (auto &p : G[n]) {
    int nn, w;
    tie(nn, w) = p;
    if (visited[nn] != 0)
      continue;
    solve(nn, dist + w);
  }
  visited[n] = 2;
}

int main(void) {
  int N; cin >> N;
  G.resize(N);
  color.resize(N);
  visited.resize(N);

  rep(i, N-1) {
    int u, v, w; cin >> u >> v >> w;
    u--; v--;
    G[u].push_back(pair<int, int>(v, w));
    G[v].push_back(pair<int, int>(u, w));
  }

  solve(0, 0);

  for (auto c : color) {
    cout << c << endl;
  }
}


Measured memory_bytes: 8576
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

int main()
{
	vector<int> X(10, 0);
	int idx = -1;

	rep(i, 5)
	{
		cin >> X.at(i);
		if (X.at(i) == 0)
		{
			idx = i + 1;
			break;
		}
	}

	cout << idx << endl;
	return 0;
}

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

using namespace std;

string A[3] = {"Sunny", "Cloudy", "Rainy"};

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

    int p = 0;
    while (A[p] != s) p++;
    p++;
    p = p % 3;
    cout << A[p] << endl;
    return 0;
}



Measured memory_bytes: 256
//	package Dynamic;
import java.io.*;
import java.util.*;
public class Main{
	static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st;
    static public void main(String[] args)throws IOException{
    	st=new StringTokenizer(br.readLine());
    	int a=i();
    	String s=s();
    	if(!(a<3200))	pl(s);
    	else	pl("red");
    }
    static int i()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Integer.parseInt(st.nextToken());
    }
    static long l()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Long.parseLong(st.nextToken());
    }
    static String s()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return st.nextToken();
    }
    static double d()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Double.parseDouble(st.nextToken());
    }
    static void p(String p)
    {
    	System.out.print(p);
    }
    static void pl(String pl)
    {
    	System.out.println(pl);
    }
    static void pl()
    {
    	System.out.println();
    }
    static int[] ari(int n)throws IOException
    {
    	int ar[]=new int[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=i();
    	return ar;
    }
    static long[] arl(int n)throws IOException
    {
    	long ar[]=new long[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=l();
    	return ar;
    }
    static String[] ars(int n)throws IOException
    {
    	String ar[]=new String[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=s();
    	return ar;
    }
    static double[] ard(int n)throws IOException
    {
    	double ar[]=new double[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=d();
    	return ar;
    }
    static char[] arc(int n)throws IOException
    {
    	char ar[]=new char[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=st.nextToken().charAt(0);
    	return ar;
    }
    static void pari(int ar[])
    {
    	for(int a:ar)
    		System.out.print(a+" ");
    }
    static void parl(long ar[])
    {
    	for(long a:ar)
    		System.out.print(a+" ");
    }
    static void pars(String ar[])
    {
    	for(String a:ar)
    		System.out.print(a+" ");
    }
    static void pard(double ar[])
    {
    	for(double a:ar)
    		System.out.print(a+" ");
    }
    static void parc(char ar[])
    {
    	for(char a:ar)
    		System.out.print(a+" ");
    }
}

Measured memory_bytes: 22100
use std::io::*;
use std::str::FromStr;

fn main() {
    let s: Vec<char> = read::<String>().chars().collect();
    let t: Vec<char> = read::<String>().chars().collect();

    let mut ans = 0;
    let mut l = (0, 0);
    // dp[i+1][j+1] = s[i],t[j]までで最長
    let mut dp: Vec<Vec<usize>> = vec![vec![0; t.len()+1]; s.len()+1];
    let mut prev: Vec<Vec<(usize, usize)>> = vec![vec![(0, 0); t.len()+1]; s.len()+1];
    for i in 0..s.len() {
        for j in 0..t.len() {
            if s[i] == t[j] {
                if dp[i+1][j+1] <= dp[i][j] + 1 {
                    dp[i+1][j+1] = dp[i][j] + 1;
                    prev[i+1][j+1] = (i, j);
                    if ans < dp[i+1][j+1] {
                        ans = dp[i+1][j+1];
                        l = (i, j);
                    }
                }
            }
            if dp[i+1][j+1] <= dp[i+1][j] {
                dp[i+1][j+1] = dp[i+1][j];
                prev[i+1][j+1] = prev[i+1][j]
            }
            if dp[i+1][j+1] <= dp[i][j+1] {
                dp[i+1][j+1] = dp[i][j+1];
                prev[i+1][j+1] = prev[i][j+1]
            }
        }
    }
    if ans == 0 {
        println!();
        return;
    }
    let mut st: Vec<char> = Vec::new();
    st.push(s[l.0]);
    for _ in 0..ans-1 {
        l = prev[l.0][l.1];
        st.push(s[l.0]);
    }
    st.reverse();
    for i in &st {
        print!("{}", i);
    }
    println!();
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

int main() {
  int a,b;
  
  cin >> a >> b;
  
  int res = a * b;
  
  if(res % 2 == 0){
    cout << "Even" << endl;
  }else{
    cout << "Odd" << endl;
  }
}


Measured memory_bytes: 3592
from sys import stdin 

def main():
    n = int(input())
    a = list(map(int, input().split()))
    flag = True 

    for i in range(n):
        if (a[i] % 2 == 0):
            if  a[i] % 3 == 0 or a[i] % 5 == 0:
                flag = True
            else:
                flag = False
                break
    if flag:
        print('APPROVED')
    else:
        print('DENIED')

if __name__ == "__main__":
    main()

Measured memory_bytes: 9176
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ii = pair<ll, ll>;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
ll comb(ll, ll);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    int n, d;
    cin >> n >> d;
    int x[n][d];
    rep(i, n) {
        rep(j, d) { cin >> x[i][j]; }
    }

    int ans = 0;

    rep(i, n) {
        repd(j, i + 1, n) {
            int distance = 0;
            rep(l0, d) {
                int temp = x[j][l0] - x[i][l0];
                distance += temp * temp;
            }

            int s = sqrt(distance);
            if (s * s == distance) {
                ans++;
            }
        }
    }

    cout << ans << endl;
    return 0;
}

ll comb(ll a, ll b) {
    if (a < b) {
        return 0;
    }

    ll v[a + 1][a + 1] = {};

    rep(i, a + 1) {
        v[i][0] = 1;
        v[i][i] = 1;
    }

    repd(k, 2, a + 1) {
        repd(j, 1, k) { v[k][j] = v[k - 1][j - 1] + v[k - 1][j]; }
    }

    return v[a][b];
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void prime_map(map<ll, ll> &m, ll num) {
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }

    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }
        return;
    } else {
        prime_map(m, num);
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
    int a,b;
    cin >> a >> b;
    string s,t;
    rep(i,a) s.push_back('0'+b);
    rep(i,b) t.push_back('0'+a);
    if(s < t) cout << s << endl;
    else cout << t << endl;
}


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

int main(void){
    int n,ans=0,cnt=0;
    scanf("%d",&n);
    char s[n+1];
    scanf("%s",s);
    for(int i=1;i<n;i++){
        int cnt=0;
        for(char c='a';c<='z';c++){
            bool left=false,right=false;
            
            for(int j=0;j<i;j++){
                if(s[j]==c){
                    left=true;
                }
            }
            
            for(int j=i;j<n;j++){
                if(s[j]==c){
                    right=true;
                }
            }
            
            if(left&&right){
                cnt++;
            }
        }
        if(ans<cnt){
            ans=cnt;
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
  long n=sc.nextLong();
  long m=sc.nextLong();
long temp1=max(m,n);
long temp2=min(m,n);
n=temp1;
m=temp2;
long ans=0;
if(m==1&&n==1){
ans=1;
}else{
ans=abs(m-2)*(n-2);
}
out.println(ans);
}
}


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

int main(void)
{
  int i, j, k = 0;
  char str1[200001], str2[200001];
  scanf("%s", &str1);
  scanf("%s", &str2);
  i = strlen(str1);
  for (j = 0; j < i; j++)
  {
    if (str1[j] != str2[j])
    {
      k++;
    }
  }
  printf("%d", k);
  return 0;
}


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

int main()
{
    int n,i,b;

    cin>>n;

    int a[n+5]={0};

    for(i=1;i<n;i++){
        cin>>b;

        a[b]++;
    }
    for(i=1;i<=n;i++){
        cout<<a[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 4408
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <time.h>
#include <queue>
#include <string.h>
#define sf scanf
#define pf printf
#define lf double
#define ll long long
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
#define LL long long
#define eps 1e-6
using namespace std;

char a[10000];

int main() {
    re(a,0);
    ss(a);
    int b[30];
    re(b,0);
    for(int i = 0; i < len(a); i ++){
        b[a[i]-'a'] ++;
    }
    int sta = 0;
    for(int i = 0; i < 30; i ++){
        if(b[i]&1){
            sta = 1;
        }
    }
    if(sta == 0){
        puts("Yes");
    }else{
        puts("No");
    }
    return 0;
}


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

int main() {
  int W, H, x, y, r;

  cin >> W >> H >> x >> y >> r;
  
  
  string answer;
  if ( ((x -r) < 0 || (x + r) > W) || ((y - r) < 0 || (y + r) > H)) {
  	answer = "No";
  } else {
  	answer = "Yes";
  }
  
  cout << answer << endl;
  
  return 0;
}


Measured memory_bytes: 3232
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		String s = sc.next();
		int B = sc.nextInt();
		if (s.equals("+")) {
			System.out.println(A+B);
		} else {
			System.out.println(A-B);
		}
	}
}

Measured memory_bytes: 22740
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int T = Integer.parseInt(sc.next());
		double A = Integer.parseInt(sc.next());

		double num = 0;
		double Kinji = Math.pow(5,10)+1;
		int ans = 1;
		for(int i=0; i<N;i++) {
			num = Integer.parseInt(sc.next())*0.006;
			num = T - num;
			num = Math.abs(num-A);

			if(num < Kinji) {
				Kinji = num;
				ans = i+1;
			}
		}

		System.out.println(ans);

	}

}

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

using namespace std;
typedef long long ll;

int main() {
  ll N; cin >> N;
  vector<ll> d(N);
  for (ll j=0; j < N; ++j) cin >> d[j];
  sort(d.begin(), d.end());
  cout << (d[N/2]-d[N/2-1]) << endl;
  return 0;
}


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

int main(){
	int a;
	cin>>a;
	pair<long double,string>b[100];
	long double c=0;
	for(int i=0;i<a;i++){
		cin>>b[i].first>>b[i].second;
		if(b[i].second=="JPY"){
			c+=b[i].first;
		}
		else{
			c+=b[i].first*380000.00000000;
		}
	}
	cout<<c<<endl;
	
}


Measured memory_bytes: 256
#include <stdio.h>

main(){
    int N;
    int i,a[100];
    int rt=0;

    scanf("%d",&N);
    for(i=0;i<N;i++)
        scanf("%d",&a[i]);

    for(i=1;i<N;i++){
        if(a[i]==a[i-1]){
            rt++;
            i++;
        }
    }
    printf("%d\n",rt);
    return 0;
}


Measured memory_bytes: 128
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int n;
    long long s,i,k,a,b;
    scanf("%d",&n);
    while(n--)
    {
        cin>>a>>b;
        if(a==b) {cout<<(a-1)*2<<"\n";continue;}
        s=a*b-1;
        i=sqrt(s);
        k=i*2-1;
        if(i*(i+1)>s)k--;
        if(i*i>s&&a!=b) k--;
        cout<<k<<"\n";
    }
    return 0;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};
int ddx[]={1,1,1,0,-1,-1,-1,0},ddy[]={1,0,-1,-1,-1,0,1,1};


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

int n;
int mi=INF,idx=-1;

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

	cin>>n;
	REP(i,n) {
		int a,b;cin>>a>>b;
		if(b<mi) mi=b,idx=a;
	}
	cout<<idx+mi<<endl;

	return 0;
}


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

#define PI 3.14159265358979323846264338327950L

int main() {
	int N, K, d, A;
	int l[100];

	memset(l, 0x00, sizeof(l));
	cin >> N >> K;

	for (int ii = 0; ii < K; ii++) {
		cin >> d;
		for (int jj = 0; jj < d; jj++) {
			cin >> A;
			l[A - 1] += 1;
		}
	}
	int cnt = 0;
	for (int ii = 0; ii < N; ii++) {
		if (l[ii] == 0) {
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3620
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BBattle solver = new BBattle();
        solver.solve(1, in, out);
        out.close();
    }

    static class BBattle {
        public void solve(int testNumber, Scanner sc, PrintWriter pw) {
            int health = sc.nextInt(), strength = sc.nextInt();
            int health2 = sc.nextInt(), strength2 = sc.nextInt();
            boolean first = true;
            while (health > 0 && health2 > 0) {
                if (first) {
                    health2 -= strength;
                } else {
                    health -= strength2;
                }
                first = !first;
            }
            pw.println(health <= 0 ? "No" : "Yes");
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 32824
#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> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
//long long ccw(const Point& A, const Point& B, const Point& C) {
//	return 1LL * (B.x - A.x)*(C.y - A.y) - 1LL * (B.y - A.y)*(C.x - A.x);
//}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	cout << abs(a[1] - a[0]) + abs(a[2] - a[1]) << '\n';







}

Measured memory_bytes: 256
// MatrixVectorMultiplocation.c
// n × mの行列 A と、m × 1 の列ベクトルb を読み込み、Aとb の積を
// 出力するプログラムを作成してください。
//
// m個の数を縦に並べたものを m × 1の列ベクトルと呼びます。
// n個の数を含む列ベクトルを m個横に並べたものを n × m の行列と呼びます。
//
// ベクトルまたは行列の中に含まれる数のことを要素と呼び、m×1の列ベクトル b の上から
// i番目の要素は bi(i=1,2,...,m)、n×mの行列 Aには n×m個の要素が含まれ、
// i行 j列目の要素は aij(i=1,2,...,n,j=1,2,...,m)で示されます。
//
// n×mの行列 Aとm×1の列ベクトル bの積は、n×1の列ベクトル cとなり、
// cの i番目の要素 ci は次の式で得られます：
//
// ci = Σj=1,m aij bj = ai1b1 + ai2b2 + … + aimbm
// 【入力】
// １行目に nと mが空白区切りで与えられます。
// 続く n行に行列 Aの要素 aijが空白区切りで与えられます。
// 続く m行にベクトル bの要素 biがそれぞれ１行に与えられます。
// 【出力】
// 出力は n行からなります。ベクトル cの要素 ci をそれぞれ１行に出力してください。
// 【制約】
// ・1≤n,m≤100
// ・0≤bi,aij≤1000
// 【例】
// 入力：
// 3 4
// 1 2 0 1
// 0 3 0 1
// 4 1 1 0
// 1
// 2
// 3
// 0
// 出力：
// 5
// 6
// 9
#include<stdio.h>

int main( void) {
  int n, m;
  int A[100][100] = {};
  int b[100] = {};
  int c[100] = {};

  // 行列データを読み込む
  scanf( "%d %d", &n, &m);

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

  for ( int j = 0; j < m; j++) {
    scanf( "%d", &b[j]);
  }

  // Aとbの積を計算する。
  for ( int i = 0; i < n; i++) {
    for ( int j = 0; j < m; j++) {
      c[i] += A[i][j] * b[j];
    }
  }

  // 結果を出力する。
  for ( int i = 0; i < n; i++) {
    printf( "%d\n", c[i]);
  }
}



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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;

using namespace std;

ll sum(string s,ll r)
{
    ll res = 0, n = 0;
    if(s.empty())return res + r;
    while(!s.empty())
    {
        n = n * 10 + (s.front() - '0');
        s.erase(s.begin());
        res += sum(s,r+n);
    }
    return res;
}

int main(int argc,char* argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    ll r = 0;
    cout<<sum(s,r)<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define DBG(x) cout<<"# # #     "<<x<<'\n';
#define fri(i,s,n) for(int i=s;i<n;i++)
#define mod 1000000007LL
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 1e18
#define five 100005;
#define six 1000005;
#define prllclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//___________________________________________________________________________________________________________________________________________________________
int main()
{
       int n,m,c;
       cin>>n>>m>>c;
       int b[m];
       arrin(b,m);
       int a[n][m];
       fri(i,0,n){
              fri(j,0,m){
                     cin>>a[i][j];
              }
       }
       int sum = 0;
       int ans = 0;
       fri(i,0,n){
              int sum = 0;
              fri(j,0,m){
                     sum += a[i][j] * b[j];
              }
              if(sum>-c){ans++;}
       }
       cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	int a,b;
	string op;
	while(1){
		cin>>a>>op>>b;
		if(op=="?")break;
		else if(op=="+") cout<<a+b<<endl;
		else if(op=="-") cout<<a-b<<endl;
		else if(op=="*") cout<<a*b<<endl;
		else  cout<<a/b<<endl;
	}
	return 0;
}

Measured memory_bytes: 3132
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define p (int)(1e9 + 7)

int MOD(int a){
	a %= p;
	return a >= 0 ? a : a + p;
}

int power(int a, int N){
	if(N == 0){
		return 1;
	}
	else if(N % 2 == 0){
		return power(MOD(a * a), N / 2);
	}
	else{
		return MOD(a * power(a, N - 1));
	}
}

int max(int a, int b){
	return a >= b ? a : b;
}

signed main(){
	int N, K, L, i, j, k, ans, j_max, next_j_max;
	scanf("%lld%lld", &N, &K);
/*	for(i = 1, L = 1; i <= K; i++){
		L += (K + i - 1) / i;
	}
	printf("L = %lld\n", L);
*/	L = K * K;
	int **dp = (int **)malloc(sizeof(int *) * (N + 1));
	for(i = 0; i <= N; i++){
		dp[i] = (int *)malloc(sizeof(int) * (L + 1));
		for(j = 0; j <= L; j++){
			dp[i][j] = 0;
		}
	}
	if(N == K){
		dp[N][0] = K;
		dp[N][1] = 1;
		next_j_max = 1;
	}
	else{
		dp[N][0] = K + 1;
		next_j_max = 0;
	}
	for(i = N; i > 1; i--){
		j_max = next_j_max;
//		printf("(i, j_max) = (%lld, %lld)\n", i, j_max);
		for(j = 0; j <= j_max; j++){
			for(k = 0; k <= K; k++){
				if(k + j < i - 1 || i - 1 < k){
					dp[i - 1][j] = MOD(dp[i - 1][j] + dp[i][j]);
				}
				else{
					dp[i - 1][j + (k + j) / (i - 1)] = MOD(dp[i - 1][j + (k + j) / (i - 1)] + dp[i][j]);
					next_j_max = max(next_j_max, j + (k + j) / (i - 1));
				}
			}
		}
	}
/*	for(i = 1; i <= N; i++){
		printf("i = %lld\n", i);
		for(j = 0; j <= L; j++){
			printf("%lld  ", dp[i][j]);
		}printf("\n");
	}
*/	ans = MOD(((K * (K + 1)) / 2) * power(K + 1, N - 1) * N);
	for(j = 0; j <= next_j_max; j++){
		ans = MOD(ans - dp[1][j] * j);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define doublepr(x) cout<<fixed<<setprecision(10)<<x
double dp[3000][3000];

double solve(vector<double>& arr, int i, int x) {
    if(x == 0) return 1;
    if(i == 0) return 0;
    if(dp[i][x] > -0.9) return dp[i][x];
    else return dp[i][x] = arr[i]*solve(arr, i-1, x-1) + (1-arr[i])*solve(arr, i-1, x);
}

int main() {
    int N; cin>>N;
    vector<double> arr(N+1);
    for(int i=1; i<=N; i++) cin>>arr[i];
    memset(dp, -1, sizeof dp);
    solve(arr, N, (N+1)/2);
    doublepr(dp[N][(N+1)/2]);
    return 0;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x, n) bitset<n>(x)
#define PI 3.14159265358979323846

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

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

string s;
int len[200010], nxt[200010][26];

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

	cin >> s;
	int sz = (int)s.size();
	len[0] = -1;
	for (int i = sz; i > 0; i--) {
		for (int j = 0; j < 26; j++) {
			nxt[i][j] = nxt[i+1][j];
		}
		nxt[i][s[i-1] - 'a'] = i + 1;
		int mi = INF;
		for (int j = 0; j < 26; j++) {
			mi = min(mi, len[nxt[i][j]]);
		}
		len[i] = mi + 1;
		//cout << "len = " << mi + 1 << " nxt = ";
		//REP(j, 26) cout << nxt[i][j] << ' ';
		//cout << endl;
	}
	int idx = 1;
	while (idx) {
		int j = 0;
		while (len[nxt[idx][j]] != len[idx] - 1) j++;
		cout << (char)('a' + j);
		//cout << "idx, j = " << idx << ',' << j << endl;
		idx = nxt[idx][j];
	}
	cout << endl;
  
    return 0;
}


Measured memory_bytes: 21652
n = int(input())
A = [list(map(int, input().split())) for _ in range(n)]
data = [[0]*(n+1) for _ in range(n+1)]

for i in A:
    #print(i[0])
    for j in i[2:]:
        #print(j)
        data[i[0]][j] = 1

for i in data[1:]:
    for j in i[1:-1]:
        print('{} '.format(j), end='')
    print(i[-1])


Measured memory_bytes: 6540
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline



    n, k = map(int, input().split())

    ww = [0]*n
    for i in range(n):
        ww[i] = int(input())

    max_w = 10000

    max_p = max_w*n
    min_p = 0


    def number_of_track(p):
        ans = 1
        sum_w = 0
        for w in ww:
            if w > p:
                return n+1
            if sum_w + w > p:
                ans += 1
                sum_w = w
            else:
                sum_w += w
        return ans

    while min_p != max_p:
        mid = (max_p + min_p)//2
        if number_of_track(mid) <= k:
            max_p = mid
        else:
            min_p = mid+1
    print(max_p)



Measured memory_bytes: 9416