akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rp(i,n) for(int i=0; i<n; i++)
using namespace std;
using ll=long long;

int shortest(int a,int b){
    if(a>b) swap(a,b);
    if(a>0&&b>0) return b;
    else if(a<0&&b<0) return (-1)*a;
    else{
        int c=min((-1)*a,b);
        return c+b-a;
    }
}
int main(){
    int n,k;
    cin >> n >> k;
    vector<int> x(n);
    rp(i,n) cin >> x.at(i);
    int ans=2000000000;
    rp(i,n-k+1){
        ans=min(ans,shortest(x.at(i),x.at(i+k-1)));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python3
import sys


def solve(S: str, T: str):
    ans = T + S
    print(ans)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;

const int INF = 200000000;
const int MOD = 1e9 + 7;

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

    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    vector<int> num;

    REP(i, N) { num.push_back(S[i] - '0'); }

    vector<int> nums;
    if (num[0] == 0)
        nums.push_back(0);
    for (int i = 0; i < S.size();) {
        int j = i;
        while (j < S.size() && S[j] == S[i]) {
            ++j;
        }
        nums.push_back(j - i);
        i = j;
    }
    if (num[S.size() - 1] == 0)
        nums.push_back(0);

    vector<int> sum(nums.size() + 1, 0);
    for (int i = 0; i < nums.size(); i++) {
        sum[i + 1] = nums[i] + sum[i];
    }
    vector<int> x;
    for (int i = 0; i < sum.size(); i += 2) {
        if (i + 2 * K + 1 < sum.size()) {
            x.push_back(sum[i + 2 * K + 1] - sum[i]);
        } else {
            x.push_back(sum[sum.size() - 1] - sum[i]);
        }
    }

    cout << *max_element(ALL(x)) << endl;

    return 0;
}


Measured memory_bytes: 1992
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

int N,K,i,x[100],ans;
inline void solve(){
  IN2(N,K);
  REP(i,N){
    IN(x[i]);
    ans+=min(abs(x[i]),abs(x[i]-K))*2;
  }
  OUT(ans);
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
#define mkp make_pair
#define fi first
#define se second
void read(int &x){
	char ch=getchar();x=0;
	for (;ch==' '||ch=='\n';ch=getchar());
	for (;ch!=' '&&ch!='\n';x=x*10+ch-'0',ch=getchar());
}
void write(int x){
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
int dist[100004],k,vis[100004];
priority_queue <pii,vector<pii>,greater<pii> > pq;
int main(){
	for (int i=0;i<100004;i++) dist[i]=1e9;
	read(k);
	dist[1]=1;
	pq.push(mkp(1,1));
	while (!pq.empty()){
		pii x=pq.top();pq.pop();
		if (vis[x.se]) continue;
		vis[x.se]=1;
		if (dist[(x.se+1)%k]>x.fi+1){
			dist[(x.se+1)%k]=x.fi+1;
			pq.push(mkp(x.fi+1,(x.se+1)%k));
		}
		if (dist[x.se*10%k]>x.fi){
			dist[x.se*10%k]=x.fi;
			pq.push(mkp(x.fi,x.se*10%k));
		}
	}
	write(dist[0]);
}

Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
//BEGIN CUT HERE
template<typename T>
struct AbsoluteSum{
  multiset<T> lp,rp;
  T sum;
  AbsoluteSum():sum(0){}
  T insert(T x){
    if(lp.empty()){
      lp.emplace(x);
      rp.emplace(x);
      return T(0);
    }
    auto p=interval();
    lp.emplace(x);
    rp.emplace(x);
    if(p.first<=x&&x<=p.second) return T(0);
    if(*lp.rbegin()>*rp.begin()){
      T a=*lp.rbegin();
      T b=*rp.begin();
      lp.erase(lp.find(a));
      rp.erase(rp.find(b));
      rp.emplace(a);
      lp.emplace(b);
    }
    T res=min(abs(p.first-x),abs(p.second-x));
    sum+=res;
    return res;
  }

  T erase(T x){
    assert(lp.count(x)+rp.count(x)>=2);
    if(lp.count(x)&&rp.count(x)){
      lp.erase(lp.find(x));
      rp.erase(rp.find(x));
      return T(0);
    }
    if(lp.count(x)){
      lp.erase(lp.find(x));
      lp.erase(lp.find(x));
      lp.emplace(*rp.begin());
      rp.erase(rp.begin());
    }else{
      rp.erase(rp.find(x));
      rp.erase(rp.find(x));
      rp.emplace(*lp.rbegin());
      lp.erase(lp.rbegin().base());
    }
    auto p=interval();
    if(p.first<=x&&x<=p.second) return T(0);
    T res=min(abs(p.first-x),abs(p.second-x));
    sum-=res;
    return res;
  }

  pair<T, T> interval(){
    assert(!lp.empty());
    return make_pair(*lp.rbegin(),*rp.begin());
  }

  T value(){return sum;}
};
//END CUT HERE
//INSERT ABOVE HERE
signed ABC127_F(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  int q;
  cin>>q;
  using ll = long long;
  AbsoluteSum<ll> as;
  ll sum=0;
  for(int i=0;i<q;i++){
    int t;
    cin>>t;
    if(t==1){
      ll a,b;
      cin>>a>>b;
      as.insert(a);
      sum+=b;
    }
    if(t==2){
      cout<<as.interval().first<<" "<<sum+as.value()<<"\n";
    }
  }
  cout<<flush;
  return 0;
}
/*
  verified on 2019/06/19
  https://atcoder.jp/contests/abc127/tasks/abc127_f
*/

signed YUKI_837(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  using ll = long long;

  int n;
  cin>>n;
  vector<ll> ys(n);
  for(int i=0;i<n;i++) cin>>ys[i];
  sort(ys.begin(),ys.end());
  if(ys.front()==ys.back()){
    cout<<1<<endl;
    return 0;
  }

  AbsoluteSum<ll> as;
  vector<ll> dp(n,0);
  for(int i=0;i<n;i++){
    as.insert(ys[i]);
    dp[i]+=as.value();
  }
  for(int i=0;i<n;i++){
    as.erase(ys[i]);
    dp[i]+=as.value();
  }

  cout<<*min_element(dp.begin(),dp.end())<<endl;
  return 0;
}
/*
  verified on 2019/06/19
  https://yukicoder.me/problems/no/837
*/

signed main(){
  ABC127_F();
  //YUKI_837();
  return 0;
}


Measured memory_bytes: 19072
#include <iostream>

using namespace std;

int N;
long long int A[200005];

int main(void) {

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

	if (N == 1) { cout << "YES" << endl; }

	int count = 0;
	for (int i = 1; i <= N; i++) {
		if (A[i] % 2 == 1) { count++; }
	}

	if (count % 2 == 0) {
		cout << "YES" << endl;
	}
	else { cout << "NO" << endl; }
	//system("pause");
	return 0;
}

Measured memory_bytes: 1024
package main

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

type node struct {
	key int
	parent *node
	left *node
	right *node
}

type tree struct {
	root *node
}

func (tree *tree) insert(key int) {
	if tree.root == nil {
		tree.root = &node{key: key}
		return
	}

	var currentNode, prevNode *node
	currentNode = tree.root
	for currentNode != nil {
		prevNode = currentNode
		if currentNode.key < key {
			currentNode = currentNode.right
		} else {
			currentNode = currentNode.left
		}
	}

	newNode := &node{key: key}
	newNode.parent = prevNode
	if prevNode.key < key {
		prevNode.right = newNode
	} else {
		prevNode.left = newNode
	}
}

func (tree tree) print() {
	var acc []int
	if tree.root == nil {
		fmt.Println("")
		fmt.Println("")
	} else {
		fmt.Println(" " + strings.Join(isToAs(visitInorder(tree.root, acc)), " "))
		fmt.Println(" " + strings.Join(isToAs(visitPreorder(tree.root, acc)), " "))
	}
}

func visitPreorder(node *node, acc []int) []int {
	if node == nil {
		return acc
	}
	acc = append(acc, int(node.key))
	if node.left != nil {
		acc = visitPreorder(node.left, acc)
	}
	if node.right != nil {
		acc = visitPreorder(node.right, acc)
	}
	return acc
}

func visitInorder(node *node, acc []int) []int {
	if node == nil {
		return acc
	}
	if node.left != nil {
		acc = visitInorder(node.left, acc)
	}
	acc = append(acc, int(node.key))
	if node.right != nil {
		acc = visitInorder(node.right, acc)
	}
	return acc
}

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

	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}

	tree := &tree{}
	for i := 0; i < n; i++ {
		command := nextText(sc)
		switch command {
		case "insert":
			key, err := nextInt(sc)
			if err != nil {
				panic(err)
			}
			tree.insert(key)
		case "print":
			tree.print()
		default:
			panic("unknown command: " + command)
		}
	}
}

func nextText(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) (int, error) {
	return strconv.Atoi(nextText(sc))
}

func isToAs(is []int) []string {
	n := len(is)
	as := make([]string, n)
	for i := 0; i < n; i++ {
		as[i] = strconv.Itoa(is[i])
	}
	return as
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    string s; cin >> s;
    map<char, int> m;
    for(int i = 0; i < 4; i++){
        m[s[i]]++;
    }

    if(m.size() == 2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


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

		int dp[(1<<16)+1];
int main()
{
	int N;
	while(cin>>N && N!=0){
		for(int k=0;k<=(1<<16);k++)
			dp[k]=100000000;

		dp[0]=0;

		int cost[16][16];
		int no[16];
		for(int i=0;i<N;i++){
			cin>>no[i];
			for(int j=0;j<N;j++)
				cin>>cost[i][j];
		}
			

		for(int bit=0;bit<(1<<N);bit++){
			for(int i=0;i<N;i++){
				if(bit & (1<<i)) continue;
				int next=(bit | (1<<i));
				dp[next]=min(dp[next],dp[bit]+no[i]);
				for(int j=0;j<N;j++){
					if(bit & (1<<j))
						dp[next]=min(dp[next],dp[bit]+cost[i][j]);
				}
			}


		}
		cout<<dp[(1<<N)-1]<<endl;


	}
	return 0;
}

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


def main(n, s):
    count = 0
    max_values = []
    for c in s:
        if c == 'I':
            count += 1
            max_values.append(count)
        else:
            count -= 1
    max_values = max_values if max_values else [0]
    return max(max_values) if 0 < max(max_values) else 0


if __name__ == '__main__':
    n = int(input())
    s = input()
    answer = main(n, s)
    print(answer)

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



signed main(){
  int n,m;
  cin>>n>>m;
  vector<long long int> a(m+1);
  for(auto &v:a) cin>>v;
  vector<int> b(m);
  for(auto &v:b) cin>>v;
  long long int res=0;
  vector<pair<pair<int,int>,long long int>> state;
  for(int i=0;i<m;i++){
    state.push_back({{a[i],a[i+1]},(1LL<<b[i])});
  }
  for(long long int rank=n;rank>=0;rank--){
    if(rank==0){
      if(!(state[0].second& 1LL)){
	res++;
      }
      break;
    }
    vector<pair<pair<int,int>,long long int>> nex;
    for(int i=0;i<state.size();i++){
      long long int lef=state[i].first.first+state[i].first.first%2;
      long long int rig=state[i].first.second-state[i].first.second%2;
      if(lef<rig){
	if(!(state[i].second&(1LL<<rank))){
	  res+=(rig-lef)/2;
	}
	nex.push_back({{lef/2,rig/2},state[i].second});
      }
      
      if(rig!=state[i].first.second){
	long long int val=state[i+1].second;
	if(state[i].second&(1LL<<rank)){
	  if(val & (1LL<<rank)){
	  nex.push_back({{rig/2,rig/2+1},val|state[i].second});	    
	  }
	  else nex.push_back({{rig/2,rig/2+1},val});
	}
	else if(val & (1LL<<rank)){
	  nex.push_back({{rig/2,rig/2+1},state[i].second});
	}
	else{
	  res++;
	  nex.push_back({{rig/2,rig/2+1},state[i].second|val});
	}
      }
    }
    state=nex;
  }
  cout<<res<<endl;
  
  return 0;
}

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

void solve() {
    int N; cin >> N;
    for(int i = 1; i < 10; ++i) {
        for(int j = 1; j < 10; ++j) {
            if(i * j == N) {
                cout << "Yes" << '\n';
                return;
            }
        }
    }
    cout << "No" << '\n';
}

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


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.util.Comparator.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==================================================================
    public void solve() {
    	char[] C = nc();
    	long ans = 0, wk;
    	int start;
    	StringBuffer sb = new StringBuffer();
    	for (int i = 0; i < (1 << C.length-1); i++) {
    		start = 0;
			for (int j = 0; j < C.length-1; j++) {
				if(((i >> j) & 1) == 1) {
					sb.setLength(0);
					for (int j2 = start; j2 <= j; j2++) {
						sb.append(C[j2]);
					}
					ans += Long.valueOf(sb.toString());
//					out.println("区切りを入れた　start = " + start 
//							+ "  end = " + j + "  数値　= " + sb.toString());
					start = j + 1;
				}
			}
			if(start < C.length) {
				sb.setLength(0);
				for (int j2 = start; j2 < C.length; j2++) {
					sb.append(C[j2]);
				}
				ans += Long.valueOf(sb.toString());
//				out.println("残っていた　start = " + start 
//						+ "  end = " + (C.length-1) + "  数値　= " + sb.toString());
			}
		}
    	out.println(ans);
    }
    // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return Integer.parseInt(sc.next());
    }
    public long nl() {
    	return Long.parseLong(sc.next());
    }
    public String ns() {
    	return sc.next();
    }
    public char[] nc() {
    	return sc.next().toCharArray();
    }
    public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    }
    public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    }
    public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    }
    public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    }
    public int[][] ndii(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    }
}


Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin>>N;
	vector<int> vec(N);
	for(int i=0; i<N; i++){
		cin>>vec[i];
	}
	sort(vec.begin(),vec.end());
	int M;
	M=vec[N-1];
	
	vector<int> veca(N);
	vector<int> vecb(N);
	veca[0]=vec[0];
	int j=0;
	for(int i=0; i<N; i++){
		if(veca[j]!=vec[i]){
			veca[j+1]=vec[i];
			j++;
		}
	}//vecaの入力

	int sub=1;
	j=0;
	for(int i=0; i<N; i++){
		if(vec[i]!=vec[i+1]){
			vecb[j]+=sub;
			j++;
			sub=1;
		}
		else{
			sub++;
		}
	}

	int ans=0;
	for(int i=0; i<j; i++){
		if(veca[i]>vecb[i]){
			ans+=vecb[i];
		}
		else{
			ans+=(vecb[i]-veca[i]);
		}
	}

	cout<<ans<<endl;
}

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

using namespace std;

#define int long long
#define double long double
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CCIN(...)                                                              \
    char __VA_ARGS__;                                                          \
    CIN(__VA_ARGS__)
#define DCIN(...)                                                              \
    double __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Printv(v)                                                              \
    {                                                                          \
        REP(x, v.size()) { cout << v[x] << (x == v.size() - 1 ? "\n" : " "); } \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const double PI = atan(1.0) * 4.0;
// const int MOD = 998244353;
const ll LINF = 1e18;
const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};

void cinfast() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

ll dp[3030][3030];

signed main() {
    SCIN(s, t);
    ll slen = s.length(), tlen = t.length();
    REP(i, slen) REP(j, tlen) {
        if(s[i] == t[j])
            dp[i + 1][j + 1] = dp[i][j] + 1;
        else
            dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
    }
    string ans = "";
    ll i = slen, j = tlen;
    while(i && j) {
        if(dp[i][j] == dp[i][j - 1]) {
            j--;
        } else if(dp[i][j] == dp[i - 1][j]) {
            i--;
        } else {
            i--;
            j--;
            ans += s[i];
        }
    }
    reverse(All(ans));
    cout << ans << "\n";
}


Measured memory_bytes: 71936
lis=[]
while True:
	a,op,b=input().split()
	a,b=int(a),int(b)
	if op=="?":
		break
	else:
		lis.append([a,b,op])

for x in lis:
	a=x[0]
	b=x[1]
	op=x[2]
	if op=="+":
		print(a+b)
	elif op=="-":
		print(a-b)
	elif op=="/":
		print(a//b)
	elif op=="*":
		print(a*b)








Measured memory_bytes: 5596
//#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define endl '\n'



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

	int a, b, c, k, sum = 0;
	cin >> a >> b >> c >> k;

	if (k > a)
	{
		sum += a;
		k -= a;
		if (k > b)
		{
			k -= b;
			sum -= k;
		}
	}
	else
	{
		sum += k;
	}

	cout << sum << endl;
	//system("pause");
	return 0;
}

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

l = 0
count = 0

ans = 0
for r in range(N):
    if S[r] == '0':
        if r == 0 or S[r - 1] == '1':
            count += 1
    if count > K:
        while S[l] == '1':
            l += 1
        while S[l] == '0':
            l += 1
        count -= 1
    ans = max(ans, r - l + 1)

print(ans)


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

#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 INF 10000000000
#define MOD 1000000007
#define M_MAX 1000100
using ll = long long;

int main(){
  ll H,N; cin>>H>>N;
  vector<ll> A(N),B(N);
  rep(i,N)cin>>A.at(i)>>B.at(i);
  ll A_MAX = 0;
  rep(i,N)A_MAX = max(A_MAX,A.at(i));
  vector<ll> dp(H+A_MAX+1,INF);
  /*dp[h]はhの体力を減らすのに必要な魔力の最小値*/
  dp.at(0)=0;
  for(ll n = 0; n < N; n++){
    for(ll h = 1; h < H+A_MAX; h++){
      dp.at(h) = min(dp.at(h),dp.at(max((ll)0,h-A.at(n)))+B.at(n));
    }
  }
  ll res = dp.at(H);
  for(ll i = H+1; i < H+A_MAX; i++)res = min(res,dp.at(i));
  cout<<res<<endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<utility>

using namespace std;

vector<int> ans;
vector<vector<pair<int,int> > > roads;

void dfs(int now,int back,int back_color)
{
    int cnt=1;
    for(auto i : roads[now])
    {
        if(i.first == back)continue;
        if(cnt == back_color)cnt++;
        ans[i.second] = cnt;
        dfs(i.first , now, cnt);
        cnt++;
    }
}

main()
{
    int n;
    scanf("%d",&n);
    roads.resize(n);
    for(int i=0;i<n-1;i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        a--,b--;
        roads[a].push_back({b, i});
        roads[b].push_back({a, i});

    }
    ans.resize(n-1);
    int k=0;
    for(int i=0;i<n;i++)k=max(k, int(roads[i].size()));
    dfs(0, -1, -1);
    printf("%d\n",k);
    for(int i=0;i<n-1;i++)printf("%d\n",ans[i]);
    return 0;
}

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

int main() {
	vector<int>a(3);
	for (int b = 0; b < 3; b++)cin >> a[b];
	sort(a.begin(), a.end());
	(a[0] == 5 && a[1] == 5 && a[2] == 7) ? (cout<<"YES"<<endl) : (cout<<"NO"<<endl);
}

Measured memory_bytes: 256
import heapq
n=int(input())
rb = []
heapq.heapify(rb)
for i in range(n):
    x,l= map(int,input().split())
    heapq.heappush(rb,(x+l,x-l))
ans=0
mostr=-1
while len(rb)>0:
    c=heapq.heappop(rb)
    if ans==0:
        ans+=1
        mostr=c[0]
    else:
        if mostr<=c[1]:
            ans+=1
            mostr=c[0]
print(ans)

Measured memory_bytes: 22624
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a,b,c,d;
  cin >> a >> b>> c>> d;
  if(a+b > c+d){
    cout << "Left" << endl;
  }else if(a+b < c+d){
    cout <<"Right"<<endl;
  }else if(a+b == c+d){
    cout << "Balanced" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c,t;
	scanf("%d%d%d",&a,&b,&c);
	if(a>b)
	{
		t=a;a=b;b=t;
	}
	if(a>c)
	{
		t=a;a=c;c=t;
	}
	if(b>c)
	{
		t=b;b=c;c=t;
	}
	printf("%d",c-a);
}

Measured memory_bytes: 128
#include <stdio.h>
#include <cstring>
#include <algorithm>
using namespace std;

#define REP(i, N) for(int (i) = 0; (i) < (N); i++)

int main(){
    char str[128];
    bool al[26], flag = true;
    scanf("%s", str);
    int n = strlen(str);
    fill_n(al, 26, true);

    REP(i,n){
        int index = str[i] - 'a';
        al[index] = !al[index];
    }
    REP(i, 26){
        if(!al[i]){
            flag = false;
            break;
        }
    }
    printf("%s", flag ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std ;
#define ll long long 
int main () {
	int n ;
	cin >> n ;
	vector<ll> v (n) ;
	for (int i = 0 ; i < n ; ++i) {
		cin >> v[i] ;
	}
	ll ans = 1LL ;
	ll chk = 1000000000000000000 ;
	sort(v.begin() , v.end()) ;
	if (v[0] == 0) {
		cout << 0 ;
		return 0 ;
	}
	for (int i = 0 ; i < n ; ++i) {
		if (ans <= chk/v[i]) {
			ans *= v[i] ;
		} else {
			cout << "-1\n" ;
			return 0 ;
		}
	}
	cout << ans ;
}

Measured memory_bytes: 4032
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

typedef pair<int, int> P;
int main()
{
	int n, m;
	while (scanf("%d %d", &n, &m), n)
	{
		vector<P> edges[100];
		for (int i = 0; i < m; ++i)
		{
			int a, b, c;
			scanf("%d %d %d", &a, &b, &c);
			edges[a].push_back(P(c, b));
			edges[b].push_back(P(c, a));
		}
		bool inTree[100];
		fill(inTree, inTree+n, false);
		priority_queue<P, vector<P>, greater<P> > q;
		inTree[0] = true;
		for (int i = 0; i < edges[0].size(); ++i)
			q.push(edges[0][i]);
		int ans = 0;
		while (!q.empty())
		{
			P e = q.top();
			q.pop();
			if (inTree[e.second])
				continue;

			inTree[e.second] = true;
			ans += e.first;
			for (int i = 0; i < edges[e.second].size(); ++i)
				q.push(edges[e.second][i]);
		}
		printf("%d\n", ans);
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <queue>

std::vector<int> a[100000], b[100000], group;
int n, m, k, x, y, tmp, cnt, ans[100001], lbl[100001];
bool done[100001];
std::queue<int> idx;

void solve() {
	std::cin >> n >> m >> k;
    for (int i=0; i<m; ++i) {
		std::cin >> x >> y;
		a[x].push_back(y);
		a[y].push_back(x);
	}

	cnt = 0;
	for (int i=0; i<100001; ++i) {
		done[i] = 0;
		ans[i] = 0;
	}
    for (int i=1; i<n+1; ++i) {
		group.clear();
		if (done[i] == true)
            continue;
		done[i] = true;
		group.push_back(i);
		for (int nx : a[i]) {
			idx.push(nx);
			done[nx] = true;
			group.push_back(nx);
		}
		while (!idx.empty()) {
			tmp = idx.front();
			idx.pop();
			for (int nx : a[tmp]) {
				if (done[nx] == true)
                    continue;
				idx.push(nx);
				done[nx] = true;
				group.push_back(nx);
			}
		}
		for (int s : group) {
			ans[s] = group.size();
			lbl[s] = cnt;
		}
		cnt++;
	}

    for (int i=0; i<k; ++i) {
		std::cin >> x >> y;
		if (lbl[x] == lbl[y]) {
			b[x].push_back(y);
			b[y].push_back(x);
		}
	}

    for (int i=1; i<n+1; ++i)
		std::cout << ans[i] - a[i].size() - b[i].size() - 1 << " ";
    std::cout << std::endl;
}

int main() {
    std::ios_base::sync_with_stdio(0);
    solve();
    return 0;
}


Measured memory_bytes: 15516
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vvin=vector<vin>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int cnt[1000];

int main(){cout<<fixed<<setprecision(20);
		   int n,m;
           cin>>n>>m;
           int a,b;
           rep(i,0,m){
             cin>>a>>b;
             cnt[a]++;
             cnt[b]++;
           }
           rep(i,1,n+1)cout<<cnt[i]<<endl;
}

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

namespace atCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] temp = Console.ReadLine().Split(' ');
            int h = int.Parse(temp[0]);
            int w = int.Parse(temp[1]);
            List<string> s = new List<string>();

            for (int i = 0; i < h; i++)
            {
                s.Add(Console.ReadLine());
            }

            string[] result = { };

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

            for (int i = 0; i < h; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    if (s[i][j] == '#') continue;

                    int count = 0;

                    for (int k = 0; k < 8; k++)
                    {
                        int x = j + dx[k];
                        int y = i + dy[k];

                        if (x < 0 || w <= x) continue;
                        if (y < 0 || h <= y) continue;

                        if (s[y][x] == '#')
                        {
                            count++;
                        }
                    }

                    s[i] = s[i].Remove(j, 1).Insert(j, count.ToString());
                }
            }

            foreach (string st in s)
            {
                Console.WriteLine(st);
            }
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
void debug(mat m){REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl; }}



signed main(){

    int H, W; cin >> H >> W;
    vector<string> a(H); readv(a);
    mat dp(H, vec(W, 0));
    dp[0][0] = 1;
    int mod = 1000000007;
    REP(i, H) REP(j, W){
        if(a[i][j] == '#') continue;
        if(i > 0) dp[i][j] += dp[i - 1][j];
        if(j > 0) dp[i][j] += dp[i][j - 1];
        dp[i][j] %= mod;
    }
    cout << dp[H - 1][W - 1];
    
    return 0;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, start, stop) for (int i = start; i < stop; i++)
#define FORR(i, start, stop) for (int i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<int>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<int>());
#define REMOVE(v,n) remove(vector<int> v,v+v.size(),int n)
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<int> vint;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

//vector< vector<int> > v (size1, vector<int>(size2) );


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

    ll a,b;
    vector<LP> ba(n);
    FOR(i,0,n){
        cin>>a>>b;
        ba[i] = make_pair(b, a);;
    }

    sort(ba.begin(), ba.end());
    vector<ll> sm={};
    bool flag=true;

    FOR(i,0,n){
        if(i==0) sm.pb(ba[i].second);
        else sm.pb(ba[i].second+sm[i-1]);
        if (sm[i]>ba[i].first) flag=false;
    }

    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
	
}

Measured memory_bytes: 5620
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
int H, W;
int board[1010][1010];
set<pii> odds;

struct Query {
    int sx, sy, tx, ty;
};

vector<Query> queries;

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

    for(int i=0; i<H; i++) {
        int sign = (i % 2 ? 1 : -1);
        int sj = (i % 2 ? -1 : W);
        int tj = (i % 2 ? W : -1);

        for(int j=sj; j!=tj; j+=sign) {
            if(board[i][j] % 2) {
                int ni = i, nj = j + sign;
                if(nj >= 0 && nj < W) {
                    board[i][j]--;
                    board[ni][nj]++;
                    queries.push_back(Query{i+1, j+1, ni+1, nj+1});
                }
            }
        }

        int j = tj - sign;
        int ni = i + 1, nj = j;
        if(board[i][j] % 2 && ni < H) {
            board[i][j]--;
            board[ni][nj]++;
            queries.push_back(Query{i+1, j+1, ni+1, nj+1});
        }
    }

    cout << queries.size() << endl;
    for(size_t i=0; i<queries.size(); i++) {
        Query x = queries[i];
        printf("%lld %lld %lld %lld\n", x.sx, x.sy, x.tx, x.ty);
    }
    return 0;
}

Measured memory_bytes: 10220
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  cout << (n + 1) / 2 << endl;
  return 0;
}

Measured memory_bytes: 3612
/*
Problem :
Algorithm :
Status :
*/
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#define DEBUG printf("Passing Line %d in Function [%s].\n",__LINE__,__FUNCTION__);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

const int INF = 0x3f3f3f3f;
const string S = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
const int L = 128;

int n;
vector<string> vec;

int Query(const string &s){
    cout << "? " << s << endl;
    int res;
    cin >> res;
    return res;
}

string Merge(int l,int r){
    if(l == r)
        return vec[l];
    int mid = (l + r) >> 1;
    string sl = Merge(l,mid),sr = Merge(mid + 1,r),s;
    int lenl = sl.length(),lenr = sr.length();
    for(int i = 0,j = 0,k = n - sl.size();i <= (int)sl.size();i++){
        if(i == (int)sl.size()){
            while(j < (int)sr.size()){
                s += sr[j++];
            }
            break;
        }
        while(j < (int)sr.size() && Query(s + sr[j] + sl.substr(i)) == k - 1){
            s += sr[j++];
            k--;
        }
        s += sl[i];
    }
    return s;
}

int main(){
    // freopen("data.in","r",stdin);
    // freopen("data.out","w",stdout);
    for(char c : S){
        string s(128,c);
        int num = 128 - Query(s);
        if(num)
            vec.push_back(s.substr(0,num));
        n += num;
    }
    string ans = Merge(0,vec.size() - 1);
    cout << "! " << ans << endl;
    return 0;
}

Measured memory_bytes: 3812
//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <bitset>
#include <string>
#include <set>
#include <stack>
#include <sstream>
#include <list>
//#include <array>
#include <vector>
#include <queue>
#include <map>
#include <memory>
#include <iterator>
#include <climits>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
#define FAST_IO ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef unsigned int UINT;
typedef unsigned long long ull;
typedef pair<int, int> pdi;
typedef pair<ll, int> pli;

int const maxn = 1e5 + 10;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
inline int lc(int x)  {return x << 1;}
inline int rc(int x)  {return x << 1 | 1;}



int main(void) {
    FAST_IO;
    
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b + c >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }

    return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int>x(n), y(n), h(n);
	for (int i = 0;i < n;i++) {
		cin >> x[i] >> y[i] >> h[i];
	}

	for (int cx = 0;cx <= 100;cx++) {
		for (int cy = 0;cy <= 100;cy++) {
			bool b = false;
			int left = -1;
			int right = 2000000000;
			for (int i = 0;i < n;i++) {
				if (h[i] == 0) {
					right = min(right, abs(x[i] - cx) + abs(y[i] - cy));
				}
				else {
					if (left == -1) {
						left = max(left, h[i] + abs(x[i] - cx) + abs(y[i] - cy));
						b = true;
					}
					else if (left != max(h[i] + abs(x[i] - cx) + abs(y[i] - cy), 0)) {
						b = false;
						break;
					}
				}
			}
			if (!b || left > right) {
				continue;
			}
			cout << cx << ' ' << cy << ' ' << left << endl;
		}
	}


	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdint>
#include <vector>

using namespace std;
namespace {
bool same(vector<int>& lhs, vector<int>& rhs) {
  for (size_t i = 0, size = lhs.size(); i < size; ++i) {
    if (lhs[i] != rhs[i]) {
      return false;
    }
  }
  return true;
}
}

int main() {
  int64_t N;
  cin >> N;
  vector<int> P(N);
  vector<int> Q(N);
  vector<int> sorted(N);
  for (size_t i = 0; i < N; ++i) {
    int n;
    cin >> n;
    P[i] = n;
    sorted[i] = n;
  }
  for (size_t i = 0; i < N; ++i) {
    int n;
    cin >> n;
    Q[i] = n;
  }
  sort(sorted.begin(), sorted.end());
  size_t order = 1;
  int p_order = 0;
  int q_order = 0;
  {
    bool p_comp = false;
    bool q_comp = false;
    do {
      if (!p_comp && same(P, sorted)) {
        p_order = order;
        p_comp = true;
      }
      if (!q_comp && same(Q, sorted)) {
        q_order = order;
        q_comp = true;
      }
      if (p_comp && q_comp) {
        break;
      }
      ++order;
    } while (next_permutation(sorted.begin(), sorted.end()));
  }
  cout << abs(p_order - q_order) << endl;         
  return 0;
}

Measured memory_bytes: 256
//atcode d - knapsack1
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

void mx(ll& a, ll b) {
    a = max(a, b);
}
int main() {
	// your code goes here
	int n,w;
	cin>>n>>w;
	vector<ll>dp(w+1);
	for(int i=0;i<n;i++){
		int we,v;
		cin>>we>>v;
		for(int j=w-we;j>=0;j--){
			mx(dp[j+we],dp[j]+v);
		}
	}ll ans=0;
	for(int i=0;i<=w;i++){
		mx(ans,dp[i]);
	}cout<<ans<<endl;
	return 0;
}

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

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

    int ans = 0;
    for (int i = 1; i <= M; i++)
    {
        for (int j = 10; j <= D; j++)
        {
            int d10 = j / 10;
            int d1  = j % 10;

            if(i == d10 * d1 && d1 >= 2 && d10 >= 2)
            {
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int n, AC=0, WA=0, TLE=0, RE=0;
    cin >> n;
    string* p = new string[n];
    for (int i = 0; i < n; i++)
        cin >> p[i];
    for (int i = 0; i < n; i++) {
        if (p[i] == "AC")
            AC++;
        else if (p[i] == "WA")
            WA++;
        else if (p[i] == "TLE")
            TLE++;
        else if (p[i] == "RE")
            RE++;
    }
    cout << "AC x " << AC << endl;
    cout << "WA x " << WA << endl;
    cout << "TLE x " << TLE << endl;
    cout << "RE x " << RE << endl;
    return 0;
}

Measured memory_bytes: 6764
#include <bits/stdc++.h>
         
typedef long long ll;
using namespace std;
        
#define F first
#define S second
#define sqr(x) x*x
#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define repit(i, n) for(auto it = n.begin(); it != n.end(); ++it)
       
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){if(b==0)return a;else return gcd(b,a%b);}
int lcm(int a,int b){return abs(a*b)/gcd(a,b);}
int arr[10];
bool check(int x){
    while(x){
        if(arr[x % 10] == 1){
            return false;
        }
        x = x / 10;
    }
    return true;
}

int main(){ios_base::sync_with_stdio(0);cin.tie(0);
    int b , n;
    cin >> b >> n; 
    for(int i = 0; i < n; ++i){
        int x;
        cin >> x;
        arr[x] = 1;
    }
    for(int i = b; ; i++){
        if(check(i)){
            cout << i;
            exit(0);
        }
    }
}

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

string s[2000];
int dp[2000][2000][4];
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int h, w;
  cin >> h >> w;
  for (int i = 0; i < h; i++) {
    cin >> s[i];
    for (int j = 0; j < w; j++) {
      dp[i][j][0] = s[i][j] == '#' ? -1 : j == 0 ? 0 : dp[i][j-1][0]+1;
      dp[i][j][1] = s[i][j] == '#' ? -1 : i == 0 ? 0 : dp[i-1][j][1]+1;
    }
  }
  int ans = 0;
  for (int i = h-1; i >= 0; i--) {
    for (int j = w-1; j >= 0; j--) {
      dp[i][j][2] = s[i][j] == '#' ? -1 : j == w-1 ? 0 : dp[i][j+1][2]+1;
      dp[i][j][3] = s[i][j] == '#' ? -1 : i == h-1 ? 0 : dp[i+1][j][3]+1;
      if (s[i][j] == '.')
	ans = max(ans, dp[i][j][0]+dp[i][j][1]+dp[i][j][2]+dp[i][j][3]+1);
    }
  }
  cout << ans << endl;
}


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

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

int main()
{
    int N, M;
    cin >> N >> M;
    
    //i段目が踏めるかどうか
    vector<bool> can_step(N, true);
    for (int i = 0; i < M; i++)
    {
        int a;
        cin >> a;
        can_step[a] = false;
    }

    vector<ll> dp(N + 1, 0);
    dp[0] = 1;

    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j <= min(i + 2, N); j++)
        {
            if (can_step[j])
            {
                dp[j] += dp[i];
                dp[j] %= mod;
            }
        }
    }

    cout << dp[N] << endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
 
int main() {
  string S ;
  cin >> S ;
  if (S == "Sunny" ) cout << "Cloudy" ;
  if (S == "Cloudy" ) cout << "Rainy" ;
  if (S == "Rainy" ) cout << "Sunny" ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int x,x1;
	cin>>x;
	x1=x;
	for(int i=0;;i++){
		if(x1==2){
				cout<<"2"<<endl;
				return 0;
			}
		for(int j=x1-1;j>1;j--){
			if(x1%j==0){
				break;
			}
			else if(j==2){
				cout<<x1<<endl;
				return 0;
			}
		}
		x1++;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
	int n;
	cin>>n;
	
	vector<int> a(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	
	int mn=a[0],mx=a[0];
	for(int i=1;i<n;i++){
		if(mn>a[i])
			mn=a[i];
		if(mx<a[i])
			mx=a[i];
	}
	
	cout<<mx-mn<<endl;
}

Measured memory_bytes: 3572
def main():
    X = int(input())
    M = int(1e5+1)
    dp = [False] * M
    dp[0] = True
    for i in range(M):
        for j in range(100, 106):
            if i - j >= 0:
                dp[i] |= dp[i-j]
    if dp[X]:
        print(1)
    else:
        print(0)


if __name__ == "__main__":
    main()


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

#define ll long long
#define sd(x) scanf("%d", &(x))
#define pii pair<int, int>
#define F first
#define S second

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

vector<pair<int, int> > edges;

void make(int n){
	for(int i = 1; i <= n; i++)
		for(int j = 1; j < i; j++) if(i + j != n + 1) edges.push_back({i, j});
}
int main(){
	int n; cin>>n;
	make(2 * (n / 2));
	if(n & 1){
		for(int i = 1; i < n; i++) edges.push_back({n, i});
	}

	cout << edges.size() << endl;
	for(auto it : edges) cout << it.F << " " << it.S << endl;
}

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

typedef long long ll;

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

    for(int i = 0; i < n; i++)
    {
        if(s[i] != s[k - 1]){
            s[i] = '*';
        }
    }
    
    cout << s << endl;
}



Measured memory_bytes: 256