akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
#define INF 1<<30
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S;
ll ans = 0;
int main() {
	cin >> H >> W;
	vector<vector<int>>s(H+2, vector<int>(W+2,0));
	vector<vector<int>>d(H+2, vector<int>(W+2,INF));
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			char c;
			cin >> c;
			if (c == '.') {
				s[i][j] = 1;
				ans++;
			}
		}
	}
	priority_queue<pair<int,pair<int,int>>> pq;
	pq.push({ 0, { 1,1 } });
	d[1][1] = 0;
	while (!pq.empty()) {
		pair<int, pair<int, int>> now = pq.top(); pq.pop();
		int i = now.second.first;
		int j = now.second.second;
		s[i][j] = -1;
		if (d[i][j] < -now.first)continue;
		if (s[i + 1][j] && d[i + 1][j] > d[i][j] + 1) {
			d[i + 1][j] = d[i][j] + 1;
			pq.push({ now.first - 1,{i + 1,j} });
		}
		if (s[i][j + 1] && d[i][j + 1] > d[i][j] + 1) {
			d[i][j + 1] = d[i][j] + 1;
			pq.push({ now.first - 1,{i,j + 1} });
		}
		if (s[i - 1][j] && d[i - 1][j] > d[i][j] + 1) {
			pq.push({ now.first - 1,{i - 1,j} });
			d[i - 1][j] = d[i][j] + 1;
		}
		if (s[i][j - 1] && d[i][j - 1] > d[i][j] + 1) {
			d[i][j - 1] = d[i][j] + 1;
			pq.push({ now.first - 1,{i,j - 1} });
		}
	}
	if (s[H][W]!=-1)cout << -1 << endl;
	else {
		cout << ans - d[H][W]-1 << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,graph[22][22],dp[22][(1<<21)];
vector<int> vals[22];

int main(){
	cin >> n;
	for(int i = 1 ; i <= n ; i += 1){
		for(int j = 1 ; j <= n ; j += 1){
			cin >> graph[i][j];
		}
	}
	for(int i = 1 ; i < (1<<n) ; i += 1){
		int j = i , cnt = 0;
		while(j){
			if(j % 2 == 1){
				cnt += 1;
			}
			j /= 2;
		}
		vals[cnt].push_back(i);
	}
	dp[0][0] = 1;
	for(int i = 1 ; i <= n ; i += 1){
		for(int j : vals[i]){
			for(int q = 0 ; q < n ; q += 1){
				if((j & (1<<q)) && graph[i][q+1]){
					dp[i][j] += dp[i-1][j^(1<<q)];
					if(dp[i][j] >= 1000000007){
						dp[i][j] -= 1000000007;
					}
				}
			}
		}
	}
	cout << dp[n][(1<<n)-1] << endl;
}

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

int main()
{
    int A, B;
    cin >> A >> B;
    if(A==1){
        A = 14;
    }
    if(B==1){
        B = 14;
    }
    if(A>B){
        cout << "Alice" << endl;
    }
    else if(A<B){
        cout << "Bob" << endl;
    }
    else if(A==B){
        cout << "Draw" << endl;
    }
}

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

int ceil10(int in){
    return ceil(float(in)/10)*10;
}

int main()
{
    int a[5];
    int red=0;
    int last = 0;
    int time = 0;

    for (int i = 0; i < 5; ++i){
        cin >> a[i];
        if ((ceil10(a[i]) - a[i]) % 10 > red){
            red = ceil10(a[i]) - a[i];
            last = i; 
        }
        time += ceil10(a[i]);
    }

    cout << time - ceil10(a[last]) + a[last] << endl;

    return 0;
}


Measured memory_bytes: 256
from collections import deque
h, w = map(int, input().split())
s = [input() for _ in range(h)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
table = [[float('inf') for _ in range(w)] for _ in range(h)]
table[0][0] = 0
def bfs():
    que = deque([[0, 0]])
    # print(que)
    used = [[0 for _ in range(w)] for _ in range(h)]
    used[0][0] = 1
    while que:
        # print(que.popleft())
        y, x = que.popleft()
        for k in range(4):
            if 0 <= y+dy[k] < h and 0 <= x+dx[k] < w:
                if s[y+dy[k]][x+dx[k]] == '#':
                    continue
                if used[y+dy[k]][x+dx[k]] == 0:
                    table[y+dy[k]][x+dx[k]] = min(table[y+dy[k]][x+dx[k]], table[y][x]+1)
                    used[y+dy[k]][x+dx[k]] = 1
                    que.append((y+dy[k], x+dx[k]))
    
    # print(*table, sep='\n')
    return table[h-1][w-1]

c = bfs()
if c == float('inf'):
    print(-1)
else:
    white = 0
    for i in range(h):
        white += s[i].count('.')
    ans = white - (c+1)
    print(ans)


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

int main(){
	int N, a[110];
	cin >> N;
	for (int i = 0; i < N; i++){
		cin >> a[i];
	}
	sort(a, a + N, greater<int>());
	int Alice = 0, Bob = 0;
	for (int i = 0; i < N; i++){
		if (i % 2 == 0){
			Alice += a[i];
		}
		else{
			Bob += a[i];
		}
	}
	cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
/***********************************************************
	When you are inspired by passion 
	and you want to live for the current moment

	When your every thought and action
	has the power to become the story of your future

	When difficulties stand to demolish your Glory
	Just remember that Life is a 'Golden adverse Story'

	Withstand it to acheive your passion and dreams
	more amazingly more easily.

	Why then? When writing the story of your Life
	You want to Let someone else hold your pen

					huzaifa242©

***********************************************************/
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define MAX 100005
#define x first 
#define y second

int seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l=0,int r=INT_MAX)
{return uniform_int_distribution<int>(l,r)(rng);}

template <typename T,typename G>
ostream& operator << (ostream& out, const pair<T,G> &a) 
{return out<<"( "<<a.x<<", "<<a.y<<")";}

template <typename T>
ostream& operator << (ostream& out, const vector<T> &a) 
{out<<"[ ";for(const auto &i:a)out<<i<<", ";return out<<"]"<<endl;}

template <typename T>
ostream& operator << (ostream& out, const set<T> &a) 
{out<<"{ ";for(const auto &i:a)out<<i<<", ";return out<<"}"<<endl;}

template <typename T,typename G>
ostream& operator << (ostream& out, const map<T,G> &a) 
{out<<"< ";for(const auto &i:a)out<<i<<", ";return out<<">"<<endl;}

template<typename T, size_t N>
typename enable_if<!is_same<typename remove_cv<T>::type, char>::value,
ostream&>::type operator<<(ostream& out, T(&a)[N])
{out<<"[ ";for(size_t i=0;i<N;++i)out<<a[i]<<", ";out <<"]"<<endl;return out;}

void debug_out(){cerr<<endl;} 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{cerr<<(H)<<" ";debug_out(T...);}
 
#ifdef LOCAL
#define debug(...) cerr<<"#"<<#__VA_ARGS__<<":\n",debug_out(__VA_ARGS__)
#else
#define debug(...) 24
#endif

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	int n,k,ans=1,i;
	cin>>n>>k;
	int v=1;
	for(i=1;v<=n;i++){
		v*=k;
		ans=i;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue,copy
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])
def sortx(x,n,k):
    if k == 0:x.sort(key=lambda y:y[1,n])
    else:x.sort(reversed=True, key=lambda y:y[1,n])
def graph():
    n,m=inpm()
    g=[[] for _ in range(n)]
    for _ in range(n-1):
        a,b=inpm()
        a-=1
        b-=1
        g[a].append(b)
        #g[b].append(a)
    return n,m,g

def main():
    n=inp()
    ans=[]
    csf=[]
    for _ in range(n-1):
        c,s,f=inpm()
        ans.append(s)
        csf.append([c,s,f])
    csf.append([0,0,0])
    ans.append(0)
    for i in range(n-1):
        for j in range(i+1):
            if ans[j]>=csf[i][1] and ans[j]%csf[i][2]==0:
                ans[j]+=csf[i][0]
            elif ans[j]>=csf[i][1]:
                x=ans[j]%csf[i][2]
                ans[j]+=csf[i][2]-x
                ans[j]+=csf[i][0]
            else:
                ans[j]=csf[i][0]+csf[i][1]
    print(*ans)
    
if __name__ == "__main__":
    main()


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

					#define mp make_pair
					#define pb push_back
					#define sqr(x) (x) * (x)
					#define sors(s) sort(s.begin(), s.end())
					#define F first
					#define S second

					using namespace std;
					typedef long long ll;
					string a, b;
					int t;
					int main()
					{
						cin >> a >> b;
						if(a[0] == b[0])
							t++;
						if(a[1] == b[1])
							t++;
						if(a[2] == b[2])
							t++;
						cout << t;			
					}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;



int main()
{
	string s, t;
	cin >> s >> t;
	ll cnt = 0;
	rep(i, s.length()) {
		if (s[i] != t[i])
			cnt++;
	}
	cout << cnt;

}

Measured memory_bytes: 3920
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

main {
  string s;
  cin >> s;
  cout << s.front() << s.size() - 2 << s.back() << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stdio.h>
using namespace std;
class NumMatrix {
private:
    int row, col;
    vector<vector<int>> sums;
public:
    NumMatrix(vector<vector<int>> &matrix) {
        row = matrix.size();
        col = row>0 ? matrix[0].size() : 0;
        sums = vector<vector<int>>(row+1, vector<int>(col+1, 0));
        for(int i=1; i<=row; i++) {
            for(int j=1; j<=col; j++) {
                sums[i][j] = matrix[i-1][j-1] + 
                             sums[i-1][j] + sums[i][j-1] - sums[i-1][j-1] ;
            }
        }
    }

    int sumRegion(int row1, int col1, int row2, int col2) {
        return sums[row2+1][col2+1] - sums[row2+1][col1] - sums[row1][col2+1] + sums[row1][col1];
    }
};
void solve(){
	int n,m,Q;
	//cin >> n >> m >> Q;
	scanf("%d%d%d",&n,&m,&Q);
	vector<vector<int>> matrix(n+1,vector<int>(n+1,0));
	for(int  i = 0 ;i < m ;i++){
		int L,R;
		//cin >> L >> R;
		scanf("%d%d",&L,&R);
		matrix[L][R]++; 
	}
	NumMatrix numMatrix(matrix);
	while(Q--){
		int p,q;
		//cin >> p >> q;
		scanf("%d%d",&p,&q);
		//cout << numMatrix.sumRegion(p,p,q,q) << "\n";
		printf("%d\n",numMatrix.sumRegion(p,p,q,q));
	}
}
int main(){
	solve();
	return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for(long long i=0; i<(long long)c; i++)
int main() {
	int n,ans;
	string s;
	cin>>s;
	n=s.length();
	ans=0;
	rep(i,n){
		if(s[i]=='?'){
			s[i]='D';
		}
	}
	cout <<s<<endl;
	return 0;
}


Measured memory_bytes: 3756
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int N, M;
bool E[601][601];
int kazu[601];
double memo[601];
double dfs(int v) {
	if (memo[v] != -1) return memo[v];
	double ret = 0;
	rep1(i, N) if (E[v][i]) {
		ret += dfs(i);
	}
	return memo[v] = 1 + ret / kazu[v];
}

double K[601];
double omomi(int v) {
	if (K[v] != -1) return K[v];
	double ret = 0;
	rep1(i, N) if (E[i][v]) {
		ret += omomi(i) / kazu[i];
	}
	return K[v] = ret;
}

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


	cin >> N >> M;
	rep1(i, M) {
		int s, t;
		cin >> s >> t;
		kazu[s]++;
		E[s][t] = 1;
	}

	rep1(i, N) memo[i] = -1;
	memo[N] = 0;

	double kotae = dfs(1);

	rep1(i, N) K[i] = -1;
	K[1] = 1;

	double saishou = 0;
	rep1(i, N) {
		if (kazu[i] > 1) {
			double saidai = 0;
			double kei = 0;
			rep1(j, N) if (E[i][j]) {
				kei += dfs(j);
				chmax(saidai, dfs(j));
			}
			double are = (kei - saidai) / (kazu[i] - 1) - kei / kazu[i];
			are *= omomi(i);
			chmin(saishou, are);
		}
	}

	cout << setprecision(12) << kotae + saishou << endl;

	Would you please return 0;
}

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

using namespace std;

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

  int a[3];
  cin >> a[0]>>a[1]>>a[2];
  sort(a, a+3);
  if (a[0] + a[1] == a[2]) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}


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

template<typename T>
T gcd(T a, T b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

void Main() {
  int K;
  cin >> K;

  long long ans = 0;
  for (int i = 1; i <= K; i++) {
    for (int j = 1; j <= K; j++) {
      for (int k = 1; k <= K; k++) {
        ans += gcd(gcd(i, j), k);
      }
    }
  }
  cout << ans << endl;
}

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

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

#define pb push_back
#define ri(x) scanf("%d",&x)
#define rii(x,y) ri(x),ri(y)
#define ms(obj,val) memset(obj,val,sizeof(obj))
#define ms2(obj,val,sz) memset(obj,val,sizeof(obj[0])*sz)
#define FOR(i,f,t) for(int i=f;i<(int)t;i++)
#define FORR(i,f,t) for(int i=f;i>(int)t;i--)

typedef long long ll;
typedef vector<int> vi;

const int MAXN=2e5;

int N,A[MAXN];
ll sum1=0,sum2=0,best = 1e18;

int main() {
	ri(N);
	FOR(i,0,N) ri(A[i]);
	FOR(i,0,N) sum1 += A[i];
	FOR(i,0,N-1) {
		sum1 -= A[i];
		sum2 += A[i];
		best = min(best, abs(sum1-sum2));
	}
	printf("%lld\n",best);
}


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

void main()
{
    auto S = sread();
    bool eval(string s)
    {
        return s.length % 2 == 0 && s[0 .. $ / 2] == s[$ / 2 .. $];
    }

    foreach_reverse (i; 0 .. S.length)
    {
        if (eval(S[0 .. i]))
        {
            writeln(i);
            return;
        }
    }
}


Measured memory_bytes: 3648
fun main(args:Array<String>) {
	val p = readLine()!!.split(" ").map{ it.toInt() }
	var vec=Pair(p[1]-p[3],p[2]-p[0])
	println("${p[2]+vec.first} ${p[3]+vec.second} ${p[0]+vec.first} ${p[1]+vec.second}")
}

Measured memory_bytes: 37804
#ifndef _UNICODE
#define _UNICODE
#endif
#ifndef UNICODE
#define UNICODE
#endif

#include <stdio.h>
#include <wchar.h>

#include <algorithm>
#include <bitset>
#include <complex>
#include <cstring>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <unordered_map>

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define int_pair second
#define SZ(X) ((int64_t)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define S1(X) scanf("%d", &(X))
#define S2(X, Y) scanf("%d%d", &(X), &(Y))
#define S3(X, Y, Z) scanf("%lld%lld%lld", &(X), &(Y), &(Z))
#define P1(X) printf("%lld", (X))
#define P2(X) printf("%lld\n", (X))
#define _ printf(" ");
#define __ printf("\n");
#define LEN(X) strlen(X)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define MOD 1000000007
#define EPS 1e-9
#define gcd(a, b) __gcd(a, b)
#define IOS ios_base::sync_with_stdio(0);
#define EACH(I, V) for (auto I : V)
#define REP(I, N) for (int64_t I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int64_t I = (A); I < (B); ++I)
#define REPPP(i, begin, end)                                                   \
  for (__typeof(end) i = (begin) - ((begin) > (end));                          \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

template<class T>
size_t choose(T a, T b, size_t src1, size_t src2) {
#if defined(__clang__) && defined(__x86_64)
  size_t res = src1;
  asm("cmpq %1, %2; cmovaeq %4, %0"
  :
  "=q" (res)
  :
  "q" (a),
  "q" (b),
  "q" (src1),
  "q" (src2),
  "0" (res)
  :
  "cc");
  return res;
#else
  return b >= a ? src2 : src1;
#endif
}

#define FOR(x, xs) for (__typeof( (xs).begin() ) x = (xs).begin(); x != (xs).end(); x++)

int64_t u = pow(10, 11) * 2;
int v = pow(u, 2.0 / 3);
int w = sqrt(u);

int64_t sum = 0;
vector<bool> isPrime(v + 1);

int nextPrime(int p) {
  while (!isPrime[++p]) {
  }
  return p;
}

vector<int64_t> divisors(vector<int64_t> &ps) {
  vector<int64_t> ds(1, 1), tmp; // 1 is divisor
  int64_t q = 1;
  FOR(p, ps) {
    if (*p != q) {
      tmp.clear();
      FOR(d, ds) {
        tmp.push_back(*d);
      } // tmp <- ds
    }
    FOR(t, tmp) {
      *t *= *p; // tmp <- map (p*) tmp
      ds.push_back(*t);
    }
    q = *p;
  }
  sort(ds.begin(), ds.end());
  return ds;
}

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

  long long var;
  cin >> var;
  for (long long i = -1000; i <= 1000; i++) {
    for (long long j = -1000; j <= 1000; j++) {
      if ((long long) pow(i, 5) - (long long) pow(j, 5) == var) {
        cout << i << ' ' << j << '\n';
        exit(0);
      }
    }
  }
}


Measured memory_bytes: 6864
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << a * b / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main() {
    let ab = read_vec::<String>();
    let a = ab[0].parse::<i32>().unwrap();
    let b = ab[2].parse::<i32>().unwrap();
    let ans = if ab[1] == "+"{
        a + b
    } else{
        a -b 
    };
    println!("{}",ans );
}

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

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

    if ( n%2 != 0){
        cout << "No";
        return 0;
    }

    if (n==2 && s[0] != s[1]){
        cout << "No";
        return 0;
    }

        
    rep(i, n/2-1){
        if ( s[i] != s[i + n/2]){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";

    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# 46

A = [int(input()) for i in range(28)]

A.sort()
#print(A)
B = list()

for i in range(1,31):
        B.append(i)
#print(B)       

a = set(A)^set(B)
K = list(a)
print(K[0])
print(K[1])


Measured memory_bytes: 5608
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

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

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint N, A, B; cin >> N >> A >> B;
    lint num_blocks = N / (A + B);
    lint rest = N % (A + B);
    cout << num_blocks * A + min(A, rest) << "\n";
}


Measured memory_bytes: 256
A, B, C, X, Y = map(int, input().split())

ans = []

for z in range(0,max(X+1, Y+1)*2, 2):
    x = max(X - z//2, 0)
    y = max(Y - z//2, 0)
    ans.append((A * x) + (B * y) + (C * z))

print(min(ans))


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

int main(){
    char s;
    cin >> s;
    if (s == 'A') {
        cout << 'T' << "\n";
    }
    else if (s == 'T') {
        cout << 'A' << "\n";
    }
    else if (s == 'C') {
        cout << 'G' << "\n";
    }
    else if (s == 'G') {
        cout << 'C' << "\n";
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::cout.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
/*-*/

int main() {
    int h,w,k;
    std::cin >> h >> w >> k;
    std::vector<std::string> g(h);
    rep(i,h) std::cin >> g[i];
    int ans=0;
    rep(s,1<<h) {
        rep(t,1<<w) {
            int count=0;
            rep(i,h) {
                rep(j,w) {
                    if((s>>i&1) && (t>>j&1) && g[i][j]=='#') count++; 
                }
            }
            if(count==k) ans+=1;
        }
    }
    print(ans);
}


Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main(){
  int h,r;
  cin>>h>>r;
  if(h<0 && h+r<0){
    cout<<-1<<endl;
  }
  else if(h<0 && h+r==0){
    cout<<0<<endl;
  }
  else{
    cout<<1<<endl;
  }
  return 0;
}



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

#define MAXN 3001

using namespace std;

typedef long long ll;

ll data[MAXN];
ll dp[MAXN][MAXN];

ll Solve(int a, int b, ll acum){
    if(dp[a][b] == 0) {
        if (a == b)
            dp[a][b] = data[a];
        else {
            Solve(a + 1, b, acum - data[a]);
            Solve(a, b - 1, acum - data[b]);
            dp[a][b] = acum - min(dp[a + 1][b], dp[a][b - 1]);
        }
    }
    return dp[a][b];
}

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

    int n;
    cin >> n;

    ll acum = 0;
    for(int i = 1; i <= n; ++i) {
        cin >> data[i];
        acum += data[i];
    }

    ll best = Solve(1, n, acum);
    cout << 2 * best - acum << "\n";

    return 0;
}//RUL0

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

int main() {
  int k, x;
  cin >> k >> x;
  string ans = "No";
  if (x <= 500*k) {
    ans = "Yes";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
N, M = sorted([int(a) for a in input().split()])
fa = 1
P = 10 ** 9 + 7
for i in range(1, N+1):
    fa = fa * i % P

if N == M:
    print(fa*fa*2%P)
elif M - N == 1:
    print(fa*fa*M%P)
else:
    print(0)

Measured memory_bytes: 3060
#方針...gcd(A,B)の約数の中で素数or1となるものの個数を調べれば良い(O(route N))
import fractions
import math

def prime_fac(N):
    primes = {1:1}
    n = int(math.sqrt(N))
    for i in range(2,n+1):
        if N%i==0:
            primes[i] = 0
            while N%i==0:
                primes[i] += 1
                N = N//i
    if (N!=1):
        primes[N] = 1
    return primes

A,B = list(map(int,input().split()))
C = fractions.gcd(A,B)
primes = prime_fac(C)

print(len(primes))

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

#define mp make_pair
#define pb push_back
#define fst first
#define snd second
#define int long long
#define fast_io() ios::sync_with_stdio(false)
#define FOR(i, l, r) for(int i = (l); i < (r); i++)
#define H(x) cout << #x << " " << x << endl;

typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef set<int> si;
typedef double ld;
typedef pair<ld, ld> dd;

const ll INF = 1000000000000000000LL;
const int NMAX = 1e6+4;
const int mod = 1e9+7;
const ld eps = 1e-10;
const ld PI = acos(-1);

signed main(){
    int N;
    cin >> N;
    string A, B, C;
    cin >> A >> B >> C;
    int sum = 0;
    FOR(i, 0, N){
        int dist = (A[i] != B[i]) + (B[i] != C[i]) + (C[i] != A[i]);
        sum += max(dist-1, 0LL);
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FT first
#define SC second

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int, int> pint;
const int INF = 1e9;
const double EPS = 1e-9;



int main()
{
  int n, m, x ;
  cin >> n >> m >> x ;
  vector<int> pay(n-1,0) ;
  int sum1 = 0 ;
  int sum2 = 0 ;
  REP(i,m){
    int a ;
    cin >> a ;
    pay.at(a-1) = 1 ;
  }
  
  REP(i,x){
    sum1 += pay.at(i) ;
  }
  FOR(i,x-1,n-1){
    sum2 += pay.at(i) ;
  }
  
  cout << min(sum1,sum2) <<endl ;
  return 0 ;
}




Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	int num[1000];
	num[0]=0;
	for(int i=1;i<=999;i++){
		num[i]=num[i-1]+i;
		if(i>1){
			if(b-a==num[i]-num[i-1]){
				cout<<num[i]-b;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pi = tuple<int, int, int>;
const int INF = 100000000;

int main()
{
	int N, M, H, K, S, T, P;
	while (cin >> N >> M >> H >> K, N | M | H | K) {
		vector<int> a(M), b(M), c(M), h(M), r(M);
		for (int i = 0; i < M; i++) {
			cin >> a[i] >> b[i] >> c[i] >> h[i] >> r[i]; a[i]--; b[i]--; r[i]--;
		}
		cin >> S >> T >> P; S--; T--;
		vector<int> dp(1 << K, INF); dp[0] = 0;
		for (int i = 0, l, d; i < P; i++) {
			cin >> l >> d;
			int val = 0;
			for (int j = 0, k; j < l; j++) {
				cin >> k;
				val += 1 << (k - 1);
			}
			for (int j = 0; j < (1 << K); j++) {
				if (dp[j] != INF) {
					dp[j | val] = min(dp[j | val], dp[j] + d);
				}
			}
		}
		int res = INF;
		for (int i = 0; i < (1 << K); i++) {
			if (dp[i] == INF) continue;
			vector<vector<int>> d(N, vector<int>(H + 1, INF));
			vector<vector<pi>> G(N);
			for (int j = 0; j < M; j++) {
				if (i & (1 << r[j])) {
					G[a[j]].push_back(pi(0, h[j], b[j]));
					G[b[j]].push_back(pi(0, h[j], a[j]));
				}
				else {
					G[a[j]].push_back(pi(c[j], h[j], b[j]));
					G[b[j]].push_back(pi(c[j], h[j], a[j]));
				}
			}
			priority_queue<pi, vector<pi>, greater<pi>> pq;
			pq.push(pi(0, 0, S));
			while (!pq.empty()) {
				auto p = pq.top(); pq.pop();
				if (d[get<2>(p)][get<1>(p)] != INF) {
					continue;
				}
				d[get<2>(p)][get<1>(p)] = get<0>(p);
				for (auto v : G[get<2>(p)]) {
					if (get<1>(p) + get<1>(v) <= H && d[get<2>(v)][get<1>(p) + get<1>(v)] == INF) {
						pq.push(pi(get<0>(p) + get<0>(v), get<1>(p) + get<1>(v), get<2>(v)));
					}
				}
			}
			int mid = INF;
			for (int i = 0; i <= H; i++) {
				mid = min(mid, d[T][i]);
			}
			res = min(res, dp[i] + mid);
		}
		cout << (res != INF ? res : -1) << endl;
	}
	return 0;
}

Measured memory_bytes: 3520
import sys
sys.setrecursionlimit(10**5+10)
input = sys.stdin.readline
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
MOD = 1000000007
INF = float("inf")

H,W = LI()
c = [list(S()) for i in range(H)]
dp = FILL(0,H+1,W+1)
dp[0][0] = 1
for i in range(H):
    for j in range(W):
        if i+1<H:
            if c[i+1][j] == '.':
                dp[i+1][j] += dp[i][j]

        if j+1<W:
            if c[i][j+1] == '.':
                dp[i][j+1] += dp[i][j]

        dp[i][j] %= MOD


print(dp[H-1][W-1])


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

int main(){
    string s;
    map<char,int> mp;
    cin >> s;
    for(int i = 0;i < 4;i ++){
        mp[s[i]] ++;
    }
    if(mp.size()==2 && mp.begin()->second==2) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 764
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main() {
    string s;
    int a;

    cin >> a >> s;

    if(a>=3200) {
        cout << s << endl;
    } else {
        cout << "red" << endl;
    }

    return 0;
    
}

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()
typedef pair<ll, ll>    P;


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

    if(s.size() < 4) {
        cout << "No" << endl;
    } else {
        if(s.substr(0, 4) == "YAKI") cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(void) {
    ll N;cin>>N;
    ll result = 1;
    for (ll i = 1; i <= N; i++) {
        result = (result * i) % MOD;
    }
    cout << result << endl;
    return 0;
}

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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
#define rep2(i, startValue, N) for (int i = (int)(startValue); i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double
#define DUMP(v) "," #v ":" << v


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

  cout << (((d + s - 1) / s <= t) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3632
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
int a,b,c;
int main() {
	scanf("%d%d",&a,&b);

	int t=b,cc=0;
	while(t){
		t/=10;
		cc++;
	}
	c=a;
	for(int i=0;i<cc;i++){
		c*=10;
	}
	c+=b;
	if(sqrt(c)==int(sqrt(c)))
		printf("Yes");
	else
		printf("No");
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
"""
17D8101031C 杉山　祥吾 ID:keisei334 python
"""

n=int(input())
a=[int(input()) for i in range(n)]

maximum=a[1]-a[0]
minimum=a[0]
for j in range(1,n):
    if(a[j]-minimum>maximum):
        maximum=a[j]-minimum
    if(minimum>a[j]):
        minimum=a[j]

print(maximum)

"""実行結果
6
5
3
1
3
4
3
3

3
4
3 
2
-1
"""



Measured memory_bytes: 13604
N = int(input())
s = 0
a = 0
import math

while s== 0:
  
  if a**5 > N:
    b = math.floor( (a**5 - N)**(1/5) )
    c = 1
  else:
    b = math.floor( (N - a**5)**(1/5) )
    c = 2
  
  if c == 1 and a**5 - b**5 == N:
    s = 1
  elif  c == 2 and a**5 + b**5 == N:
    b = -b	
    s = 1
  else:
    a += 1  
  
print(a,b)

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

#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();

#define MAXX 500005

#define PI 3.14159265358979323846264338327950

#define F first
#define S second

#define ll  long long int

#define mod  1000000007



int main()
{
	FAST;
	string s;
	cin >> s;
	for(ll i = 0; i< s.size(); i ++){
		if(s[i] == '9'){
			s[i] = '1';
		}
		else if(s[i] == '1'){
			s[i] = '9';
		}
	}
	cout << s;
}

Measured memory_bytes: 3620
s=[0b0111111,0b0000110,0b1011011,0b1001111,0b1100110,0b1101101,0b1111101,0b0100111,0b1111111,0b1101111]
while 1:
    n=int(input())
    if n<0:break
    a=0
    for _ in range(n):
        b=int(input())
        print(bin(a^s[b])[2:].zfill(7))
        a=s[b]

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

int main() {
	long long n, k;
	cin >> n >> k;
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
	}

	sort(a.begin(), a.end());
	
	int j;

	for (int i = 0; k > 0; i++)
	{
		if (k > a[i].second) {
			k -= a[i].second;
		}
		else {
			j = i;
			break;
		}
	}

	cout << a[j].first << endl;
	
	return 0;
}

Measured memory_bytes: 1152
#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];
  }
  
  vector<int> b(N+1,0);
  for(int i=0;i<N;i++){
    b[a[i]]++;
  }
  
  for(int i=1;i<N+1;i++){
    cout << b[i] <<endl;
  }
}


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

int prime[100010];
bool isprime[100010];

int sieve(int n)
{
  int p=0;
  for (int i=0; i<=n; i++) isprime[i] = true;
  isprime[0] = isprime[1] = false;
  for (int i=2; i<n; i++) {
    if (isprime[i]) {
      prime[p++] = i;
      for (int j=2*i; j<=n; j+=i) isprime[j] = false;
    }
  }
  return p;
}

int main()
{
  int n; cin >> n;
  sieve(100000);
  int i = 0;
  vector<int> ans;
  while ((int)ans.size() < n) {
    if (prime[i]%5 == 1) ans.push_back(prime[i]);
    i++;
  }
  for (int i=0; i<n; i++) {
    if (i > 0) cout << " ";
    cout << ans[i];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 384
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		for(; sc.hasNext();){
			double w=sc.nextDouble();
			if(w<=48.)
				println("light fly");
			else if(w<=51.)
				println("fly");
			else if(w<=54.)
				println("bantam");
			else if(w<=57.)
				println("feather");
			else if(w<=60.)
				println("light");
			else if(w<=64.)
				println("light welter");
			else if(w<=69.)
				println("welter");
			else if(w<=75.)
				println("light middle");
			else if(w<=81.)
				println("middle");
			else if(w<=91.)
				println("light heavy");
			else
				println("heavy");
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 12000
while True:
    H,W=map(int,input().split())
    if (H==0 and W==0):
                break
    for i in range(H):
        for j in range(W):
            if(i==0):
                print("#", end="")
            elif(j==0):
                print("#", end="")
            elif(j==W-1):
                print("#", end="")
            elif(i==H-1):
                print("#", end="")
            else:
                print(".", end="")
        print()
    print()


Measured memory_bytes: 7000
/*---> 04 April 2020 <--- > 01:16:35 <---*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
//template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
const int N=1e5+5;

int32_t main(){__
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5])
	cout<<"Yes\n";
	else
	cout<<"No\n";	
return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int number = scan.nextInt();
		
		String[] info = new String[number];
		for (int i = 0; i < number; i++) {
			// 都市名、スコア、番号
			info[i] = scan.next() + "," + (Integer.MAX_VALUE - scan.nextInt()) + "," + (i+1);
		}
		
		Arrays.sort(info);
		for (String str : info) {
			String ans = str.split(",")[2];
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    ll H, W, N;
    cin >> H >> W >> N;
    map<pair<ll,ll>, int> num;
    ll a,b;
    ll dx[9]={-1,0,1,-1,0,1,-1,0,1}, dy[9]={-1,-1,-1,0,0,0,1,1,1};
    for ( int i = 0; i < N; i++ ) {
        cin >> a >> b;
        a--, b--;
        for ( int j = 0; j < 9; j++ ) {
            ll aa = a + dx[j], bb = b + dy[j];
            if ( aa >= 0 && aa < H && bb >= 0 && bb < W ) num[make_pair(aa, bb)]++;
        }
    }
    vector<ll> nums(10);
    for ( auto& p : num ) {
        a = p.first.first;
        b = p.first.second;
        if ( a > 0 && a < H-1 && b > 0 && b < W-1 ) nums[p.second]++;
    }
    nums[0] = (H-2) * (W-2);
    for ( int j = 1; j < 10; j++ ) {
        nums[0] -= nums[j];
    }
    
    for ( int j = 0; j < 10; j++ ) {
        cout << nums[j] << "\n";
    }
    return 0;
}

Measured memory_bytes: 56448
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

#define MOD 1000000007

int N, W, M;
int w[201], wt[201], wr[201];
int dp[10001][201], tmp[10001][201];

int main(){
  while(cin >> N >> W){
    for(int i = 0; i < N; i++){
      cin >> w[i];
    }

    sort(w, w + N);

    wt[0] = 0;
    wr[0] = w[0];

    for(int i = 1; i < N; i++){
      if(w[i] > w[i - 1]){
        wt[i] = wt[i - 1] + 1;
        wr[wt[i]] = w[i];
      }
      else{
        wt[i] = wt[i - 1];
      }
    }
    M = wt[N - 1] + 1;

    memset(dp, 0, sizeof(dp));
    dp[0][M] = 1;

    for(int i = 0; i < N; i++){
      memset(tmp, 0, sizeof(tmp));

      for(int j = 0; j <= W; j++){
        for(int k = 0; k <= M; k++){
          if(dp[j][k] == 0){
            continue;
          }

          if(j + w[i] <= W){
            tmp[j + w[i]][k] += dp[j][k];
            tmp[j + w[i]][k] %= MOD;
          }
          if(k == M){
            tmp[j][wt[i]] += dp[j][k];
            tmp[j][wt[i]] %= MOD;
          }
          else{
            tmp[j][k] += dp[j][k];
            tmp[j][k] %= MOD;
          }
        }
      }

      for(int j = 0; j <= W; j++){
        for(int k = 0; k <= M; k++){
          dp[j][k] = tmp[j][k];
        }
      }
    }

    /*
    for(int i=0;i<=N;i++){
      for(int j=0;j<=W;j++){
        for(int k=0;k<=M;k++){
          printf("%2d",dp[i][j][k]);
        }
        cout<<endl;
      }
      cout<<endl;
    }
    */

    int ans = 0;

    for(int j = 0; j <= W; j++){
      for(int k = 0; k <= M; k++){
        if(k == M || j + wr[k] > W){
          ans += dp[j][k];
          ans %= MOD;
        }
      }
    }

    cout << ans << endl;
  }
}

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

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

int eval(int x) {
	int ret=0;
	for (int d=1; d<=x; d++)
		if(x%d==0)
			ret++;
	return ret;
}

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,ret=0; cin>>n;
	for (int i=1; i<=n; i++)
		if(i%2&&eval(i)==8)
			ret++;
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
using ll = long long;

int main() {
  ll N;
  cin >> N;
  const size_t M = 5;
  vector<ll> X(M,0);
  for (int i=0; i<M; ++i) {
    cin >> X[i];
  }
  // find bottle neck
  ll min_size = *min_element(X.begin(), X.end());
  ll ans = (M-1) + (N / min_size) + ((N % min_size == 0) ? 0 : 1);
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int m=sc.nextInt();
    if (n==m) {
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
    
  }
}


Measured memory_bytes: 21844
n,k=map(int,input().split())
a=[0]*n
for i in range(k):
    d=int(input())
    aa=list(map(int,input().split()))
    for j in aa:
        a[j-1]=d
ans=0
for i in a:
    if i == 0:
        ans+=1

print(ans)

Measured memory_bytes: 9192