akhauriyash/Code-Regression huggingface dataset:
H, W, D = list(map(int, input().split()))

A = []
for i in range(H):
  A.append(list(map(int, input().split())))
  
Q = int(input())

LR = []

for i in range(Q):
  LR.append(list(map(int, input().split())))

List = [[0, 0] for i in range(H * W)]
for i in range(H):
  for j in range(W):
    List[A[i][j] - 1] = [i, j]
    
Data = [0 for i in range(H * W)]
for i in range(D):
  for j in range(D + i, H * W, D):
    a = List[j - D]
    b = List[j]
    Data[j] = abs(a[0] - b[0]) + abs(a[1] - b[1]) + Data[j - D]

for i in range(Q):
  print(Data[LR[i][1] - 1] - Data[LR[i][0] - 1])
    


Measured memory_bytes: 86748
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>/*toupperとかが入っている*/
#include<vector>/*可変長配列vectorのインクルード*/

const int MOD=1000000007;/* 1,000,000,007 で割った余りを出力する　のとき使う*/
using namespace std;/*標準名前空間を利用する。cinやcoutはこれによって利用可能になる*/

int A, B;

int main(void) {
  cin >> A >> B;

  int Tap=1;
  int count=0;

  while(Tap<B){
    Tap=Tap+A-1;
    count++;
  }
  
  cout << count << endl;

  return 0;
}


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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  int N;
  cin >> N;
  string A,B,C;
  cin >> A >> B >> C;

  int ans = 0;
  for(int i = 0; i < N; i++){
    char a = A[i];
    char b = B[i];
    char c = C[i];

    if(a == b && b == c){ 
      continue;
    } else if(a == b || b == c || c == a){
      ans += 1;
    } else{
      ans += 2;
    }

  }
  cout << ans << endl;

}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    a106(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}


fun a106(args: Array<String>) {
    if (args.size != 1) {
        throw IllegalArgumentException()
    }
    val (x, y) = args[0].split(" ").map { it.toInt() }
    println(x * y - (x + y - 1))
}

Measured memory_bytes: 38044
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int num,l,r,k;
    vector< vector<int> >c(10,vector<int>(10));
    for(int i=1;i<=n;i++)
    {
       r=i%10;
       num=i;
       while(num!=0)
       {
           k=num%10;
           num=num/10;
       }
       l=k;
       c[l][r]++;
    }
    long long int total=0;
    for(int i=0;i<10;i++)
    {
        for(int j=0;j<10;j++)
        {
            total+=c[i][j]*c[j][i];
        }
    }
    cout<<total<<endl;
    return 0;

}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
    cin >> a>>b>>c;
    if(a==b && b==c)cout<<"No"<<endl;
    else if(a!=b && b!=c && a!=c)cout <<"No"<<endl;
    else{
    cout <<"Yes"<<endl;}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main(){
  int n,m;
  cin>>n;
  map<string,int> m1,m2;
  for(int i=0;i<n;++i){
    string s;
    cin>>s;
    m1[s]++;
  }
  cin>>m;
  for(int i=0;i<m;++i){
    string t;
    cin>>t;
    m2[t]++;
  }
  int ans=0;
  for(auto x:m1){
    ans = max(ans,x.second-m2[x.first]);
  }
  cout<<ans<<endl;
}

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

int main() {
	string s, p;
	int mark = 0;

	cin >> s >> p;
	for (int i = 0; i < s.size(); i++)
	{
		if (mark)
			break;
		if (s.find(p, 0) != s.npos)
			mark = 1;
		char first;
		first = s[0];
		s.push_back(first);
		s.erase(0, 1);
	}

	if (mark)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main(){
    ll n,d;
    cin >> n >> d;
    ll a[n][d];
    ll i,j,t,k;
    for(i=0;i<n;i++){
        for(j=0;j<d;j++){
            cin >> a[i][j];
        }
    }
    ll ans=0;
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            ll sum=0;
            for(k=0;k<d;k++){
                sum=sum+(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
            }
            ll m=sqrt(sum);
            if(sum==m*m){
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));

int main() {
	// ABC067d
	int n;
	cin >> n;
	vector<list<int>>g(n);
	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	int nl, nr;// 塗った点の数(点0からと点n-1から)
	nl = nr = 1;
	vector<bool>splat(n, false);// 色塗り済みかどうかを格納
	splat[0] = splat[n - 1] = true;

	// 点0と点n-1の2点から交互にBFSを進めて、
	// 両方の探索が続けられなくなったら、
	// 塗れた点の数を数えて勝敗を出力する
	queue<int>sl, sr;
	sl.push(0);
	sr.push(n - 1);
	while (!sl.empty() || !sr.empty()) {
		int sizel = sl.size();
		rep(i, sizel) {//点0からの距離が同じ点集合を全部popする
			if (!sl.empty()) {
				int l = sl.front();
				sl.pop();
				for (auto v : g[l]) {
					if (splat[v] == false) {
						splat[v] = true;
						sl.push(v);
						nl++;
					}
				}
			}
		}
		int sizer = sr.size();
		rep(i,sizer){
			int r = sr.front();
			sr.pop();
			for (auto v : g[r]) {
				if (splat[v] == false) {
					splat[v] = true;
					sr.push(v);
					nr++;
				}
			}
		}
	}


	if (nl > nr) cout << "Fennec" << endl;
	else cout << "Snuke" << endl;


	return 0;
}




Measured memory_bytes: 8064
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<math.h>
#include<bitset>
#include<random>
using namespace std;
using ll = __int64_t;
using lll = __int128_t;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(int i=(int)b;i<(int)e;i++)
#define rep0(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
constexpr int inf=(1<<30)-1;
constexpr ll mod=1e9+7;



int main(){
      int r;
      cin>>r;
      cout<<3*r*r<<endl;
      return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back

#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

signed main()
{
    speed
    int n;cin>>n;
    std::vector<int> inp(n);
    for(int i=0;i<n;++i)
    {
        cin>>inp[i];
    }
    bool b=1;   
    inp[0]-=1;
    for(int i=1;i<n;++i)
    {
        if(inp[i]<inp[i-1])
        {
            b=0;break;
        }
        if(inp[i]!=inp[i-1])
        {
            --inp[i];
        }
    }    
    if(b){cout<<"Yes\n";}
    else{cout<<"No\n";}
}

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

void selectionSort(vector<int> a, int n) {
    int count = 0;
    for (int i = 0; i < n; i++) {
        int minj = i;
        for (int j = i; j < n; j++) {
            if (a.at(j) < a.at(minj)) minj = j;
        }
        if (a.at(i) != a.at(minj)) {
            swap(a.at(i), a.at(minj));
            count++;   
        }
    }

    for (int x = 0; x < n; x++) {
        if (x) cout << " ";
        cout << a.at(x);
    }
    cout << endl;
    cout << count << endl;
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    selectionSort(a, n);

    return 0;
}


Measured memory_bytes: 3140
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
	int i,x,mini=100000;
	char s[100001];
	scanf("%s", s);

	for (i = 0; i < strlen(s) - 2; i++) {
		x = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
		if (mini > abs(753 - x)) {
			mini = abs(753 - x);
		}
	}
	printf("%d\n", mini);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;


int main()
{
	long long n, ans = 0;
	long double d;
	cin >> n >> d;
	while(n--) {
		long long p, q;
		cin >> p >> q;
		if (sqrt(p * p + q * q) <= d) {
			ans++;
		}
	}
	cout << ans;

	return 0;
}

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

using namespace std;

int gcd(int a, int b)
{
	return b ? gcd(b, a % b) : a;
}

void solve()
{
	int n, ans = 0;
	cin >> n;
	vector<int> h(n);
	int score = 0;
	for(auto&& i : h)
	{
		cin >> i;
		if(score < i)
		{
			score = i;
		}
		if(score > i)
		{
			ans += score - i;
			score = i;
		}
	}
	ans += score;
	cout << ans << "\n";
}

int main()
{
	solve();
}


Measured memory_bytes: 256
#（i+1 and i and i-1）の合計数が一番多いところを見つける
from collections import Counter
ans = []
N = int(input())
a = list(map(int,input().split()))
num = Counter(a)
for i in set(a):
    ans.append(num[i] + num[i+1] + num[i-1])
    
print(max(ans))

Measured memory_bytes: 20944
n=int(input())
S=input().split()
q=int(input())
T=input().split()
cnt=0
B=[]
for i in range(len(T)):
    c=0
    for j in range(len(S)):
        if T[i]==S[j]:
            if c==0:
                cnt+=1
                c+=1  
print(cnt)


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

res = float('inf')
for c in range(10**5+1):
    a = X-c
    b = Y-c
    cost = C*c*2
    cost += max(a,0)*A
    cost += max(b,0)*B
    res = min(res, cost)
print(res)

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

public class Main
{
	PrintWriter out = new PrintWriter(System.out);
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok = new StringTokenizer("");
    String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    }
    int ni() throws IOException { return Integer.parseInt(next()); }
    long nl() throws IOException { return Long.parseLong(next()); }
    
    void solve() throws IOException {
        for (int tc=1;tc>0;tc--) {
            int n=ni();
            int prev=ni();
            long ans=0;
            for (int i=1;i<n;i++) {
                int u=ni();
                if (u<prev) ans+=(prev-u);
                else prev=u;
            }
            out.println(ans);
        }
        out.flush();
    }
    
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
}

Measured memory_bytes: 54428
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = Integer.parseInt(in.next());
            int preT = 0;
            int preX = 0;
            int preY = 0;

            for (int i = 0; i < N; i++) {
                int postT = Integer.parseInt(in.next());
                int postX = Integer.parseInt(in.next());
                int postY = Integer.parseInt(in.next());

                int dt = postT - preT;
                int dist = Math.abs(postX - preX) + Math.abs(postY - preY);
                if ((dt < dist) || (((dist - dt) & 1) != 0)) {
                    out.println("No");
                    return;
                }

                preT = postT;
                preX = postX;
                preY = postY;
            }

            out.println("Yes");
        }

    }
}



Measured memory_bytes: 58612
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for((i)=0; (i)<(int)(n); ++(i))
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
const int inf = 1<<28;

int limit, n, m, x;
int e0[102], s0[102], e1[102], s1[102];
int dp[102][1002];

void solve() {
  int i, j, k, l, ii, jj;
  string in;
  rep (i,n) cin >> in >> e0[i] >> s0[i];
  rep (i,m) cin >> in >> e1[i] >> s1[i];

  //memset(dp, -1, sizeof dp);
  rep (i,102) fill(dp[i], dp[i] + 1002, -inf);
  // dp[A][B] := Aツ人ツづ個人ツづーBツ円ツづ古卍づつスツ湘ェツ債づ個催妥・ツづ個鳴楪堕ォツ度
  // ツづヲツづづp[0][0] = 0ツづづ按づゥ
  dp[0][0] = 0;
  for (i = 0; i < m; ++i) {
    for (j = i; j >= 0; --j) {
      for (k = e1[i]; k <= limit; ++k) {
        dp[j+1][k] = max(dp[j+1][k], dp[j][k - e1[i]] + s1[i]);
      }
    }
  }
  
  // ツシツーツクツδ個ッツトツアツーツテツィツスツトツづ個δ環スツトツづーツ催ャツづづつィツつュ
  /*
  int secret[21];
  memset(secret, 0, sizeof secret);
  rep (i,n) {
    secret[e0[i]] = max(secret[e0[i]], s0[i]);
    rep (j,n) if (i != j) {
      secret[e0[i] + e0[j]] = max(secret[e0[i] + e0[j]], s0[i] + s0[j]);
    }
  }*/
  
  int ans = -inf;
  for (i = x; i <= m; ++i) {
    for (j = 0; j <= limit; ++j) if (dp[i][j] >= 0) {
      /*
      for (k = 0; k < 21 && k + j <= limit; ++k) {
        ans = max(ans, dp[i][j] + secret[k]);
      }*/
      
      for (k = 0; k < n; ++k) {
        if (j + e0[k] <= limit) ans = max(ans, dp[i][j] + s0[k]);
        for (l = 0; l < k; ++l) {
          if (j + e0[k] + e0[l] <= limit) {
            ans = max(ans, dp[i][j] + s0[k] + s0[l]);
          }
        }
      }
      
    }
  }
  cout << ans << endl;
}

int main() {
  while (cin >> limit >> n >> m >> x, limit) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 1320
#include <bits/stdc++.h>
using namespace std;
int main(void){
    std::vector<int> vec;
    int q;
    cin >> q;
    int query,num;
    for (int i=0;i<q;i++) {
        cin >> query;
        if ( query==0 ) {
            cin >> num;
            vec.push_back(num);
//            cout << vec[vec.size()-1] << endl;
        } else if ( query==1 ) {
            cin >> num;
            cout << vec[num] << endl;
        } else if ( query==2 ) {
            vec.pop_back();
//            cout << vec[vec.size()-1] << endl;
        }
    }
}



Measured memory_bytes: 3880
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<math.h>
#include<iostream>
using namespace std;

bool era[1000000];

int main(){
	era[0]=false;
	era[1]=false;
	for(int i=2;i<=1000000;i++) era[i]=true;
	for(int i=2;i<=1000;i++){
		for(int j=2;i*j<1000000;j++) era[i*j]=false;
	}
	int a,b,n,cnt;
	while(cin>>a>>b>>n && a && b && n){
		cnt=0;
		while(cnt!=n){
			if(era[a]==true) cnt++;
			a+=b;
		}
		cout<<a-b<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var H = BigInteger.Parse(Read());


            //for (int i = 1; i <= H; i++)
            //{
            //    if (i == 1) list.Add(0);
            //    else if (i == 2) list.Add(3);
            //    else if (i == 3) list.Add(3);
            //    else
            //    {
            //        var a = Floor(i / 2.0);
            //        list.Add(list[int.Parse(a.ToString())] * 2 + 1);
            //    }
            //}
            //foreach (var item in list)
            //{
            //    Write(item + " ");
            //}
            //WriteLine(list[int.Parse(H.ToString())]);

            var list = new List<BigInteger>()
            {2, 4
, 8
, 16
, 32
, 64
, 128
, 256
            , 512
            , 1024
            , 2048
            , 4096
            , 8192
            , 16384
            , 32768
            , 65536
            , 131072
            , 262144
            , 524288
            , 1048576
            , 2097152
            , 4194304
            , 8388608
            , 16777216
            , 33554432
            , 67108864
            , 134217728
            , 268435456
            , 536870912
            , 1073741824
            , 2147483648
            , 4294967296
            , 8589934592
            , 17179869184
            , 34359738368
            , 68719476736
            , 137438953472
            , 274877906944
            , 549755813888
            , 1099511627776 };
            if (H == 1)
            {
                WriteLine(1);
            }
            else if (H == 2)
            {
                WriteLine(3);
            }
            else
            {
                for (int i = 0; i < list.Count-1; i++)
                {
                    var a = list[i];
                    var b = list[i + 1] - 1;
                    if (a <= H && H <= b)
                    {
                        WriteLine(b);
                        return;
                    }
                }
            }
        }
        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13524
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>
typedef long long ll;
typedef long double ld;
/*swap 交換*/
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
/*2つのうち大きい数を返す*/
ll max2(ll a,ll b){return a>=b?a:b;}
/*2つのうち小さい数を返す*/
ll min2(ll a,ll b){return a>=b?b:a;}

typedef struct{
    ll num; //number
    ll par; //parent
    ll height; //height
}UF;

void UFmake(ll n, UF b[n]){for(ll i=0;i<n;i++){
    b[i].par = i;
    b[i].num = i;
    b[i].height = 1;}}

ll UFroot(ll n, ll a,UF b[n]){
    return a==b[a].par?a:UFroot(n,b[a].par,b);}
    
void UFunite(ll n, ll x, ll y, UF b[n]){
    if(b[UFroot(n,x,b)].height > b[UFroot(n,y,b)].height){
        b[UFroot(n,y,b)].par = UFroot(n,x,b);
    }else{
        b[UFroot(n,x,b)].par = UFroot(n,y,b);
        b[UFroot(n,y,b)].height = max2(b[UFroot(n,y,b)].height,b[UFroot(n,x,b)].height+1);
    }
}

ll UFsame(ll n, ll x, ll y, UF b[n]){
    if( UFroot(n,x,b) == UFroot(n,y,b) ){
        return 1;
    }
    return 0;
}


int main(void){
    ll n,q,i;
    scanf("%lld%lld",&n,&q);
    ll p[q],a[q],b[q];
    UF tree[n];
    for(i=0;i<q;i++){
        scanf("%lld%lld%lld",&p[i],&a[i],&b[i]);
    }
    UFmake(n,tree);
    for(i=0;i<q;i++){
        if(p[i]==0){
            UFunite(n,a[i],b[i],tree);
        }else{
            printf("%lld\n", UFsame(n,a[i],b[i],tree) );
            // if(UFsame(n,a[i],b[i],tree)){
            //     printf("Yes\n");
            // }else{
            //     printf("No\n");
            // }
        }
    }
    return 0;
}


Measured memory_bytes: 4360
import copy
H,W,K = map(int, input().split())
board = [0]*H

def retunuru(x):
    for j in range(H):
        if ((x>>j)&1):
            new_board_num[j] = [5]*W

def gyonuru(y):
    for l in range(W):
        if ((y>>l)&1):
            for a in range(H):
                new_board_num[a][l]=5

for i in range(H):
    board[i] = input()

board_num = [[0]*W for i in range(H)]
for i in range(H):
    for j in range(W):
        if board[i][j]==".":
            board_num[i][j] = 0
        else:
            board_num[i][j] = 1


ans = 0
new_board_num = copy.deepcopy(board_num)
for i in range(2**H):
    total = 0
    for k in range(2**W):
        retunuru(i)
        gyonuru(k)
        for x in range(H):
            for y in range(W):
                if new_board_num[x][y]==1:
                    total+=1
        #print(i,k)
        #print(new_board_num)
        #print(total)

        if total == K:
            ans +=1
            #print("ok")
        new_board_num = copy.deepcopy(board_num)

        total = 0
print(ans)


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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cout << #x << " = " << (x) << endl;
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

ll n,m;
string s;
//Write From this Line

int main()
{
	cout << setprecision(10);
	int m1,d1,m2,d2;
	cin >> m1 >> d1 >> m2 >> d2;
	if(m1 != m2){

		cout << 1 << endl;
	}
	else cout << 0 << endl;

}


Measured memory_bytes: 764
#include <stdio.h>

int main(void) {
    int a,c = 0;
    scanf("%d",&a);
    int t = a;
    while (t > 0) {
        c = c + t % 10;
        t = t / 10;
    }
    if (a % c == 0) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		int n=sc.I;
		var a=sc.Arr(n,()=>sc.La);
		var hs=new HashSet<string>();
		for(int i = 0;i<n;i++) {
			hs.Add(a[i][0].ToString()+" "+a[i][1].ToString());
		}
		int ans=0;
		for(int i = 0;i<n;i++) {
			for(int j = 0;j<n;j++) {
				if(i==j){continue;}
				int r=0;
				long p=a[i][0]-a[j][0],q=a[i][1]-a[j][1];
				for(int k = 0;k<n;k++) {
					if(i==k){continue;}
					if(hs.Contains((a[k][0]-p).ToString()+" "+(a[k][1]-q).ToString())){
						r++;
					}
					//hs.Contains(0);
				}
				ans=Max(ans,r);
			}
		}
		Console.WriteLine("{0}",n==1?1:(n-ans-1));
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2(int b){return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}
	public int[] Ia3(int a,int b){return Array.ConvertAll(((a!=0?b.ToString()+" ":"")+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(int a,int b,int c,int d){return Array.ConvertAll(((a!=0?b.ToString()+" ":"")+Console.ReadLine()+(c!=0?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2(int b){return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}
	public long[] La3(int a,int b){return Array.ConvertAll(((a!=0?b.ToString()+" ":"")+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(int a,int b,int c,int d){return Array.ConvertAll(((a!=0?b.ToString()+" ":"")+Console.ReadLine()+(c!=0?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

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

using namespace std;

int main(void) {
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for (auto& v : H) {
    cin >> v;
  }
  sort(H.begin(), H.end(), greater<>());
  long long ans = 0;
  for (int i = K; i < N; ++i) {
    ans += H[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3952
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int n; cin >> n;
    vector<int> t(n);
    rep(i,n) cin >> t[i];
    int m; cin >> m;
    vector<int> p(m), x(m);
    rep(i,m){
        cin >> p[i] >> x[i];
        --p[i];
    }
    int sum = 0;
    rep(i,n) sum += t[i];
    rep(i,m){
        int ans = sum - t[p[i]] + x[i];
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    string pickles;
    string ickles;
    cin >> pickles >> ickles;
    pickles = pickles + pickles;
    if (pickles.find(ickles) != string::npos) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}


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

n = int(input())
a = list(map(int, input().split()))
rs, ls = [0], [0]
for i in range(n-1):
    rs.append(gcd(rs[i], a[i]))
    ls.append(gcd(ls[i], a[-i-1]))
gcd_list = [gcd(r,l) for r, l in zip(rs, ls[::-1])]
print(max(gcd_list))

Measured memory_bytes: 14060
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
queue <int>Q;
int C[105][105] = { 0 };
int main()
{
	int h, w, n;
	cin >> h >> w >> n;
	for (int i = 1; i <= n; i++) {
		int k;
		cin >> k;
		for (int j = 1; j <= k; j++) {
			Q.push(i);
		}
	}
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			C[i][j] = Q.front();
			Q.pop();
		}
		cout << endl;
	}
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if (i % 2 == 1)cout << C[i][j] << " ";
			else cout << C[i][w+1-j] << " ";
		}
		cout<<endl;
	}
	
}



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

int main() {
  string s;
  cin >> s;
  int N = s.size();
  for (int i = 0; i < N-1;i++){
    if(s[i]==s[i+1]) {
      cout << i +1<< ' '<<i + 2 << endl;
      return 0;
    }
  }
  for (int i = 0; i < N - 2;i++){
    if(s[i]==s[i+2]){
      cout << i+1 << ' '<<i + 3 << endl;
      return 0;
    }
  }

  cout << -1 <<' '<< -1 << endl;
}

Measured memory_bytes: 3720
n,m = map(int,input().split())
ans = [0]*n
for i in range(m):
  s,c = map(int,input().split())
  if ans[s-1] != 0 and ans[s-1] != c:
    print(-1)
    exit()
  elif n != 1 and s == 1 and c == 0:
    print(-1)
    exit()
  else:
    ans[s-1] = c
ans_f = "".join((map(str,ans)))
if n>1 and ans_f[0] == "0":
  print("1"+ans_f[1::])
else:
  print(ans_f)

Measured memory_bytes: 61948
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int dx=c-a,dy=d-b;
	for(int i=0; i<dy; i++)
	{
		cout<<"U";
	}
	for(int i=0; i<dx; i++)
	{
		cout<<"R";
	}
	for(int i=0; i<dy; i++)
	{
		cout<<"D";
	}
	for(int i=0; i<=dx; i++)
	{
		cout<<"L";
	}
	for(int i=0; i<=dy; i++)
	{
		cout<<"U";
	}
	for(int i=0; i<=dx; i++)
	{
		cout<<"R";
	}
	cout<<"D";
	cout<<"R";
	for(int i=0; i<=dy; i++)
	{
		cout<<"D";
	}
	for(int i=0; i<=dx; i++)
	{
		cout<<"L";
	}
	cout<<"U";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define allR(v) v.rbegin(), v.rend()
#define PRINT(v) for (auto x : (v)) cout <<x <<" " ; cout <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
typedef pair<int,int> Pi;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
const int inf = 1001001001;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }

template<class T> struct edge { int to; T cost;};


int main() {
  int N; ll W; cin >>N >>W;
  vector<vector<ll>> vs(4, vector<ll>(1, 0));
  ll wmin;
  // 各々重さがwmin,wmin+1,wmin+2,wmin+3のものを格納
  rep(i, N){
    if (i == 0){
      int v; cin >>wmin >>v;
      vs[0].push_back(v);
    }else{
      int w,v; cin >>w >>v;
      vs[w-wmin].push_back(v);
    }
  }
  rep(i, 4){ sort(next(vs[i].begin()), vs[i].end()); reverse(next(vs[i].begin()), vs[i].end());}
  rep(i, 4) rep(j, vs[i].size()-1) vs[i][j+1] += vs[i][j];
  ll res = 0;
  rep(i, vs[0].size()){
    rep(j, vs[1].size()){
      rep(k, vs[2].size()){
        rep(l, vs[3].size()){
          ll weight = i*wmin + j*(wmin+1) + k*(wmin+2) + l*(wmin+3);
          if (weight > W) continue;
          chmax(res, vs[0][i] + vs[1][j] + vs[2][k] + vs[3][l]);
        }
      }
    }
  }
  cout <<res <<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
	unsigned int *arr;
	int n,i,a=0,b=0,c=0;
	scanf("%d", &n);
	arr = (unsigned int*)malloc(sizeof(unsigned int*)*n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
		if (arr[i] % 4 == 0)a++;
		else if (arr[i] % 2 == 0)b++;
		else c++;
	}
	if (b == 0)c--;
	if (c <= a )printf("Yes");
	else printf("No");
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
vll g[MAX];
bool vis[MAX];
ll dp[MAX];
void dfs(ll cur)
{
	if(!vis[cur])
	{
		vis[cur] = true;
		for(auto x: g[cur])
			dfs(x), dp[cur] = max(1 + dp[x], dp[cur]);
	}
}
int main()
{
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
	ll n, m, u, v, i;
	cin >> n >> m;
	for(i = 0; i < m; i++)
	{
		cin >> u >> v;
		g[u].pb(v);
	}
	for(i = 1; i <= n; i++)
		dfs(i);
	ll ans = 0;
	for(i = 1; i <= n; i++)
		ans = max(ans, dp[i]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 32256
H,W,K=gets.split.map(&:to_i)

m = Array.new(H) { Array.new(W,0) }

blank = []
idx = 1
H.times do |i|
    s = gets.chomp
    l = 0
    r = s.index('#',l)
    unless r
        blank << i
        next
    end

    while r = s.index('#',l)
        m[i].fill(idx,l..r)
        idx += 1
        l = r+1
    end
    idx -= 1
    m[i].fill(idx,l..-1)
    idx += 1

    blank.each do |j|
        m[j] = m[i]
    end
    blank = []
end

if !blank.empty?
    i = H-1
    i -= 1 while m[i][0] == 0
    blank.each do |j|
        m[j] = m[i]
    end
end

m.each do |row|
    puts row.join(' ')
end


Measured memory_bytes: 3068
N=int(input())

A1=input().rstrip().split()
A2=input().rstrip().split()

    


#再帰関数を使えば簡単？

answer=0
sum=0
s=0
for i in range(0,len(A1)):
    sum=0
    s+=int(A1[i])
    # print('s:',s)
    sum=s
    for j in range(i,len(A2)):
        sum+=int(A2[j])
    # print(sum)
    if sum>answer:
        answer=sum

print(answer)


Measured memory_bytes: 3060
import itertools

n,m,q=map(int,input().split())

lis=[]
for i in range(q):
    lis.append(list(map(int,input().split())))

M=0
for l in map(list,itertools.combinations(range(1,n+m),n)):
    s=0
    for j in range(q):
        aj=lis[j][0]
        bj=lis[j][1]
        cj=lis[j][2]
        dj=lis[j][3]
        if l[bj-1]-bj-l[aj-1]+aj==cj:
            s+=dj
    M=max(M,s)
print(M)

Measured memory_bytes: 73684
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
  
using namespace std;
using namespace boost;
using namespace multiprecision;  

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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

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

  int n;
  cin >> n;
  
  vector<cpp_int> a(n);
  
  rep(i,n){
	cin >> a[i];
    if(a[i] == 0){
      return cout << 0 << '\n', 0;
    }
  }
   
  cpp_int mul = 1;
  
  rep(i,n){
    mul *= a[i];
    if(mul > cpp_int(1e18)){
      return cout << -1 << '\n', 0;
    }
  }

  cout << mul << '\n';
  
  return 0;
}


Measured memory_bytes: 6456
/*
                            Author: Ankit Kaul
*******Code Belongs to Respective Author Only*************
*/
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/
/*freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
*/
#include <bits/stdc++.h>
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
        {   if(n % 2 ==1)
            result=(result * x)%M;
            x=(x*x)%M;
            n=n/2;
        }
    return result%M;
}
bool isPrime(int n)
    {
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
    }
int inv(int a,int m)
{   return power(a,m-2);
}   
int lcm(int a,int b)
{   return a*b/(gcd(a,b));
}
signed main()
{   jaldi
    int n,count=0,d;
    cin>>n>>d;
    for(int i=0;i<n;i++)
    {   int x,y;
        cin>>x>>y;
        int s=x*x+y*y;
        int z=sqrt(s);
        if(z*z==s && z==d)
        count++;
        else if(z<d)
        count++;
    }
    cout<<count;
}

Measured memory_bytes: 3696
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

const int Maxn = 2e5+7;

string S, T;
int mmps[256], mmpt[256];

int main()
{
    cin >> S >> T;
    if(S.length() != T.length())
    {
        puts("No");
        return 0;
    }
    for(int i = 0; i < S.length(); ++i)
    {
        if(!mmps[S[i]]) mmps[S[i]] = T[i];
        else if(mmps[S[i]] != T[i])
        {
            puts("No");
            return 0;
        }
        if(!mmpt[T[i]]) mmpt[T[i]] = S[i];
        else if(mmpt[T[i]] != S[i])
        {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

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

int main(void) {
    char a, b;
    string A, B;
    int i;
    
    cin >> a >> b;
    
    for (i = 0; i < b - '0'; i ++) {
        A += a;
    }
    
    for (i = 0; i < a - '0'; i ++) {
        B += b;
    }
    
    if (A < B) {
        cout << A << endl;
    } else {
        cout << B << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
module c;

import std.conv, std.stdio;
import std.algorithm, std.array, std.string, std.range;

void main()
{
    auto buf = readln.chomp.split.to!(long[]);
    auto n = buf[0], k = buf[1];
    n = n % k;
    n.min(k-n).writeln;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=200000;
int n,m;
struct dsu{
    int g[N];
    int size[N];
    int max_=1;
    void init(){for(int i=0;i<n;i++)g[i]=i,size[i]=1;}
    int find(int x){return x==g[x]?x:g[x]=find(g[x]);}
    void uni(int x,int y){
        int px=find(x),py=find(y);
        if(px!=py){
            if(size[px]<size[py])swap(px,py);
            size[px]+=size[py];
            size[py]=0;
            g[py]=g[px];
            max_=max(max_,size[px]);
        }
    }
}dis;

int main(){
    ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    cin>>n>>m;
    dis.init();
    for(int i=0;i<m;i++){
        int a,b;cin>>a>>b;
        dis.uni(--a,--b);
    }
    cout<<dis.max_<<'\n';
}


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

using namespace std;

bool ok(vector<int64_t> &w, int64_t n, int64_t k, int64_t P) {
  int64_t i = 0;
  for (int64_t j = 0; j < k; j++) {
    int64_t l = 0;
    while(l + w[i] <= P) {
      l += w[i];
      i += 1;
      if (i == n) {
        return true;
      }
    }
  }
  return false;
}

int main() {
  int64_t n, k;
  cin >> n >> k;

  vector<int64_t> w(n);

  for (int64_t i = 0; i < n; i++) {
    cin >> w[i];
  }

  int64_t l = 0;
  int64_t r = (1ll << 40);

  while (r - l > 1) {
    int64_t mid = (r + l - 1) / 2;
    if (ok(w, n, k, mid)) {
      r = mid + 1;
    } else {
      l = mid + 1;
    }
  }

  cout << l << endl;
}



Measured memory_bytes: 3620
Imports System.Collections
Imports System.Collections.Generic
Imports System.Linq
Imports System.xml
Imports System.xml.Linq

Module Module1
	public sub main()

		dim SW as string() = Console.ReadLine().split(" ")
    dim A as integer = convert.toint32(SW(0))
    dim B as integer = convert.toint32(SW(1))
    dim C as integer = convert.toint32(SW(2))
    dim D as integer = convert.toint32(SW(3))
    dim takahashi as integer =  (A\D) + iif(A mod D = 0,0,1)
    dim aoki as integer =  (C\B) + iif(C mod B = 0,0,1)
    
    
    if takahashi >= aoki then 
      console.writeLine("Yes")
    else
      console.writeLine("No")
    end if
    
	end sub 
End Module

Measured memory_bytes: 28492
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int n,k;
int main(){
    cin>>k>>n;
    if(k>=10){
        cout<<n<<endl;
        return 0;
    }
    cout<<n+100*(10-k)<<endl;
    return 0;
}

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

int main(){

  long long sum=0;
  long n;
  char c;
  int flg=0;
  while(cin>>n>>c , c!='='){
    
    if(flg==0)sum+=n;
    else if(flg==1)sum-=n;
    else if(flg==2)sum*=n;
    else sum/=n;

    if(c=='+')flg=0;
    else if(c=='-')flg=1;
    else if(c=='*')flg=2;
    else flg=3;

  }

  if(flg==0)sum+=n;
  else if(flg==1)sum-=n;
  else if(flg==2)sum*=n;
  else sum/=n;


  cout << sum << endl;

  return 0;
}

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

int main(){
  int n,m;
  string tmp;
  cin >> n;
  
  vector<string> s,t;
  rep(i,n){
    cin >> tmp;
    s.push_back(tmp);
  }
  
  cin >> m;
  rep(i,m){
    cin >> tmp;
    t.push_back(tmp);
  }
  
  int max=0;
  for(auto it=s.begin(); it!=s.end(); it++){
    int x = 0;
    for(auto jt=s.begin(); jt!=s.end(); jt++){
      if(*jt == *it) x++;
    }
    for(auto jt=t.begin(); jt!=t.end(); jt++){
      if(*jt == *it) x--;
    }
    
    if(x > max) max = x;
  }
  
  cout << max << endl;

  return 0;
}


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

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  int a[110] = {};
  for(int i = 0; i < m; i++){
    int tmp;
    cin >> tmp;
    a[tmp]++;
  }
  int c = 0;
  for(int i = 0; i < x; i++){
    if(a[i]){
      c++;
    }
  }

  int d = 0;
  for(int i = x + 1; i <= n; i++){
      if(a[i]){
        d++;
      }
  }

  cout << min(c,d) << endl;

}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<cstring>
using namespace std;

vector<int>rinsetu[8];
bool k[8];
int S = 0;
int a, b;
void saiki(int c) {
	bool d = true;
	for (int e = 0; e < a; e++) {
		if (!k[e])d = false;
	}
	if (d) { S++; return; }
	for (int i : rinsetu[c]) {
		if (!k[i]) {
			k[i] = true;
			saiki(i);
			k[i] = false;
		}
	}
}
int main() {
	cin >> a >> b;
	for (int c = 0; c < b; c++) {
		int d, e; scanf("%d%d", &d, &e); d--; e--;
		rinsetu[d].push_back(e); rinsetu[e].push_back(d);
	}
	k[0] = true;
	saiki(0);
	cout << S << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int sum = 0;
		int max = 0;
		for (int i = 0; i < 5; i++) {
			int num = sc.nextInt();
			sum += num;

			int x = 0;
			if (num % 10 != 0) {
				x = 10 - (num % 10);
			}
			sum += x;

			max = Math.max(max, x);
			//System.out.println(sum);
		}

		sum -= max;

		System.out.println(sum);
	}

}


Measured memory_bytes: 23892
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<cstring>

using namespace std;

int A, B, C, D;

void solve(int a, int b, int c, int d)
{
    if((c-b)<=0){
        cout << "Yes" << endl;
    }else if((a-d)<=0){
        cout << "No" << endl;
    }else{
        solve(a-d,b,c-b,d);
    }
}

int main()
{
    cin >> A >> B >> C >> D;
    solve(A,B,C,D);

 
    return 0;
}


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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
  pr(b);
}

int ans = 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{

  int a, b;
  cin >> a >> b;
  rep(i, 10)
  {
    if ((a * b * i) % 2 != 0)
    {
      Yes();
      return 0;
    }
  }
  No();
  return 0;
}


Measured memory_bytes: 3496
#include<bits/stdc++.h>
using namespace std ;
int main() {
  string s,a;
  cin >> s;
  
  
  for(int i=0; i < s.size(); i++) {
    if(i % 2 == 0) {
     a += s.at(i);
    }
  }  
  cout << a << endl;
 }
    

Measured memory_bytes: 512