akhauriyash/Code-Regression huggingface dataset:
n=int(input())
plus=[]
for i in range(n):
    plus.append(input())
    
m=int(input())
minus=[]
for j in range(m):
    minus.append(input())
    
x=plus+minus
#max格納
l=[]
x=set(x)
x=list(x)

for i in range(len(x)):
    l.append(plus.count(x[i])-minus.count(x[i]))
    
if max(l)<0:
    print(0)
else:
    print(max(l))
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef int int__;
#define int long long
#define pb push_back
#define pi pair<int,int>
#define vpi vector<pi>
#define vi vector<int>
#define vvi vector<vi>
const int MAX = 1e9 + 7;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
int Mod(int x){const int mm=1e9 + 7;x%=mm;if(x<0)x+=mm;return x;}
int Pow(int x,int n){if(n==0)return 1;int t=Pow(x,n/2);t=Mod(t*t);if(n&1)t=Mod(t*x);return t;}
#define watch(x) cout << #x << " : " << x << endl;
int gcd(int x,int y){return y!=0 ? gcd(y,x%y) : x;}

const int nax = 3005;
const int mod = 1e9 + 7;

int__ main() {
	fast;
	
	int n; cin >> n;
	string a; cin >> a;

	vvi dp(n+1, vi(n+1 , 0));

	dp[1][1] = 1;

	for(int i=2;i<=n;i++) {
		for(int j = 1; j <= n ; j++) {dp[i-1][j] += dp[i-1][j-1]; dp[i-1][j] %= mod;}

		for(int j=1;j<=i;j++) {
			if(a[i-2] == '<') dp[i][j] = Mod(dp[i-1][j-1] - dp[i-1][0]);
			else dp[i][j] = Mod(dp[i-1][n] - dp[i-1][j-1]);
		}
	}

	int ans = 0;

	for(int i=1;i<=n;i++) ans = Mod(ans + dp[n][i]);

	cout << ans << endl;
}


Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,np,s,l=0,r=0,a;
	cin>>n>>np>>s;
	for(int i=0;i<np;i++){
		cin>>a;
		if(a<s) l++;
		else r++;
	}
	if(l>=r) cout<<r;
	else cout<<l;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,y;
  cin>>n>>y;
  int a=n;
  for(int i=y;i>=0&&a>=0;i-=10000){
    if((i-a*1000)%4000==0&&i<=a*5000&&i>=a*1000){
      cout<<n-a<<' '<<(i-a*1000)/4000<<' '<<(a*5000-i)/4000;
      return 0;
    }
    a--;
  }
  cout<<"-1 -1 -1";
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using static kyoupuro.Input;
using static kyoupuro.MyMath;

namespace kyoupuro {

    class MainClass {

        public static void Main() {
            var N = NextInt();
            var array = new int[100001];

            for (int i = 0; i < N; i++) {
                array[NextInt()]++;
            }

            Console.WriteLine(Enumerable.Range(1, 100000 - 1).Max(x => array[x - 1] + array[x] + array[x + 1]));
        }
    }

    class MyMath {
        static long Gcd(long a, long b) {
            return b == 0 ? a : Gcd(b, a % b);
        }
    }

    class Input {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

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

int main()
{
	int n,k;
	while(cin >> n >> k){
		int ans = 0;
		for(int i = 1; i <= n; i++){
			int x;
			cin >> x;
			if(x >= k)
				ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

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

int32_t main() {
  int n;
  string s;
  cin >> n >> s;
  string res = "No";
  int k = n / 2;
  if (n % 2 == 0 && s.substr(0, k) == s.substr(k, k)) res = "Yes";
  cout << res;
}

Measured memory_bytes: 256
#include<cstdio>
int main()
{
    int ta,su,sum=0,ave=0,i=0;
    while(scanf("%d,%d",&ta,&su)!=EOF)
    {
        sum+=ta*su;
        ave+=su;
        i++;
    }
    ave*=10;
    ave/=i;
    ave+=5;
    ave/=10;
    printf("%d\n%d\n",sum,ave);
    return 0;
}

Measured memory_bytes: 1020
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;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I%10;
		var t="";
		if(n==3){t="bon";}
		else if(n==0||n==1||n==6||n==8){t="pon";}
		else{t="hon";}
		Console.WriteLine("{0}",t);
	}
}
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{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.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: 27544
#include <cstdio>
#include <vector>
#include <iostream>
#include <complex>
#include <cmath>
using namespace std;

using P = complex<double>;

double cross(const P& a, const P& b){
  return a.real()*b.imag() - a.imag()*b.real();
}

double area(const vector<P>& pol){
  int n = pol.size();
  double ret = 0;
  for(int i = 0; i < n; ++i){
    ret += cross(pol[i],pol[(i+1)%n]);
  }
  ret *= 0.5;
  return ret;
}

int main(){
  int n;
  cin >> n;
  vector<P> star = {P(-10.00, -6.48),
                    P(-10.79, -8.91),
                    P(-13.34, -8.91),
                    P(-11.28, -10.41),
                    P(-12.07, -12.84),
                    P(-10.00, -11.34),
                    P(-7.93, -12.84),
                    P(-8.72, -10.41),
                    P(-6.66, -8.91),
                    P(-9.21, -8.91)};
  // for(auto p : star)
  //   cerr << p << endl;

  double r = sqrt(area(star));
  // cerr << r << endl;
  P g(0,0);
  for(auto& p : star){
    p /= r;
    g += p;
  }
  g /= 10;
  for(auto& p : star)
    p -= g;
  double Xmin = -5e3, Ymin = -5e3;
  for(int i = 0; i < n; ++i){
    P c(Xmin + 500 + (i/10)*1e3, Ymin + 500 + (i%10)*1e3);
    double a;
    cin >> a;
    a += 1e-2;
    double rr = sqrt(a);
    vector<P> star_ = star;
    for(auto& p : star_){
      p *= rr;
      p += c;
    }
    printf("%d\n",i+1);
    // printf("%.9f %.9f\n",c.real(),c.imag());
    for(auto p : star_)
      printf("%.9lf %9lf\n",p.real(),p.imag());
  }
}



Measured memory_bytes: 3288
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
#include <list>
#include <set>
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
using namespace std;
using ll = long long;
const int INF = 1e9 + 1;
ll MOD = 1e9+7;
ll dx[9] = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
ll dy[9] = {-1,  0,  1,-1, 0, 1,-1, 0, 1};

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

    int N;
    cin >> N;
    vector<ll> A(N,0);
    REP(i, N){
        cin >> A[i];
    }
    int start = 0;
    while(true){
        sort(A.begin(), A.end());
//        REP(i, N){
//            cout << A[i] << endl;
//        }
//        cout << endl;
        for(int i = start; i < N; i++){
            if(i == N-1){
                cout << A[i] << endl;
                return 0;
            }
            if(A[i] > 0){
                start = i;
                for(int j = i+1; j < N; j++){
                    A[j] %= A[i];
                }
                break;
            }
        }
    }
}


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

typedef long long ll;
typedef unsigned long long ull;

int main(){
    ll a,b;
    cin >> a >> b;
    printf("%lld %lld %.12lf\n",a/b,a%b,(double)a/(double)b);
    
    return 0;
}


Measured memory_bytes: 3228
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val Array(h, w) = sc.nextLine.split(" ").map(_.toInt)
    val frame = List.fill(h)(sc.nextLine)
    val edgeRow = "#" * (w + 2)
    val ans = edgeRow +: frame.map(cols => "#" ++ cols ++ "#") :+ edgeRow
    ans.foreach(println)
  }
}


Measured memory_bytes: 26512
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main(){
    ll a,b;
    cin >> a >> b;
    cout << a-b+1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int argc, char *argv[]){
	int n;
	while(cin>>n){
		bool check[999999]={false};
		int count=0;
		for(int i=2;i<=n;i++){
			if(!check[i]){
				for (int j = 1; i*j <= n;j++){
					check[i*j]=true;
				}
				count++;
			}
		}
		cout<<count<<endl;
	}
	return 0;
}

Measured memory_bytes: 2140
x,k,d=map(int, input().split())

zahyo=abs(x)%d
nokori=k-(abs(x)//d)
#print(nokori)
if nokori<0:
  print(abs(x)-k*d)
else:
  if nokori % 2 == 0:
    print(zahyo)
  else:
    print(abs(zahyo-d))



Measured memory_bytes: 9144
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

ll INF = 1LL << 50;

class Graph{
public:
    int N;
    vector<vector<ll>> d;

    Graph(int n){
        N = n;
        d.resize(N, vector<ll>(N, INF));
        for(int i = 0; i < N; i++){
            d[i][i] = 0;
        }
    }

    void make_edge(int s, int t, ll c){
        d[s][t] = c;
    }

    void warshallFroyd(){
        for(int k = 0; k < N; k++){
            for(int i = 0; i < N; i++){
                for(int j = 0; j < N; j++){
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }
    }
};

int main(){
    int N, M;
    ll L;
    cin >> N >> M >> L;

    Graph g = Graph(N);
    for(int i = 0; i < M; i++){
        int a, b;
        ll c;
        cin >> a >> b >> c;
        a--;
        b--;
        g.make_edge(a, b, c);
        g.make_edge(b, a, c);
    }

    g.warshallFroyd();

    Graph g2 = Graph(N);
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            if(g.d[i][j] <= L){
                g2.make_edge(i, j, 1);
            }
        }
    }

    g2.warshallFroyd();

    int Q;
    cin >> Q;
    vector<ll> ans;
    for(int i = 0; i < Q; i++){
        int s, t;
        cin >> s >> t;
        s--;
        t--;
        ans.push_back(g2.d[s][t]);
    }

    for(ll x : ans){
        if(x == INF) cout << -1 << endl;
        else cout << x - 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 2808
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int d = readint;
    string[] ss = ["Christmas"];
    for (int i = 0; i < 25 - d; i++) ss ~= "Eve";
    writeln(ss.join(" "));
}


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

class UnionFind{
    public:
        vector<int> parent;
        UnionFind(int n){
            parent = vector<int>(n, -1);
        }
        int root(int num){
            if(parent[num]<0) return num;
            return parent[num]=root(parent[num]);
        }
        int size(int num){
            return -parent[root(num)];
        }
        bool connect(int a, int b){
            int A = root(a);
            int B = root(b);
            if(A==B) return false;
            if(size(A)<size(B)) swap(A, B);
            parent[A]+=parent[B];
            parent[B]=A;
            return true;
        }
};

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> A(M), B(M);
    for(int i=0; i<M; i++){
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }
    vector<long long> ans(M);
    ans[M-1] = (long long)N * (N-1) / 2;
    UnionFind Uni(N);
    for(int i=M-2; i>=0; i--){
        ans[i]=ans[i+1];//繋がっていた時
        if(Uni.root(A[i+1])!=Uni.root(B[i+1])){
            ans[i]-=Uni.size(A[i+1])*Uni.size(B[i+1]);
            Uni.connect(A[i+1], B[i+1]);

        }
    }
    for(int i=0; i<M; i++){
        cout << ans[i] << endl;
    }
    
    return 0;
}


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

int main() { 
  string ans= "Good";
  string str;

  cin >> str;
  
  for(int i=0;i<3;i++) if(str.at(i) == str.at(i+1)) ans = "Bad";
 
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
S = input()
target = "keyence"
length = len(target)+1

# 部分文字列を取り除く方法は、
# 1. 先頭の文字列を削除
# 2. 真ん中の文字列を削除
# 3. 末尾の文字列を削除

if target in S: # 1 & 3
    print("YES")
    exit()
else: # 2
    for i in range(1, length):
      first = target[:i]
      second = target[i:]
      # print("{} + {}".format(S[0:len(first)], S[len(target)-len(second):len(target)]))
      if first in S and second in S and S.find(first) < S.rfind(second):
          if S[0:len(first)] + S[len(S)-len(second):len(S)] == target:
                print("YES")
                exit()
print("NO")


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

using namespace std;

int a[6];

void genInput() {
	for (int i = 1; i <= 5; ++i)
		a[i] = rand() % 50 + 3;
}

int bruteForce() {
	int res = 1e9 + 7;
	sort(a + 1, a + 6);
	do {
		int tmp = 0;
		for (int i = 1; i <= 5; ++i) {
			if (tmp % 10) tmp = (tmp / 10 + 1) * 10;
			tmp += a[i];
		}
		res = min(res, tmp);
	}
	while (next_permutation(a + 1, a + 6));
	return res;
}

int Greedy() {
	int res = 1e9 + 7, mm = 0;
	for (int i = 1; i <= 5; ++i) {
		int tmp = 0;
		for (int j = 1; j <= 5; ++j)
			if (i != j) {
				if (tmp % 10) tmp = (tmp / 10 + 1) * 10;
				tmp += a[j];
			}
		if (tmp % 10) tmp = (tmp / 10 + 1) * 10;
		res = min(res, tmp + a[i]);
	}
	return res;
}

int main() {
	for (int i = 1; i <= 5; ++i)
		cin >> a[i];
	cout << Greedy();
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%1d%1d%1d",&a,&b,&c);
    if(a==c) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 128
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
bool minimize(T)(ref T x, T y) { if (x > y) { x = y; return true; } else { return false; } }
bool maximize(T)(ref T x, T y) { if (x < y) { x = y; return true; } else { return false; } }

long mod = 10^^9 + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto s = new long[](N);
	long total;
	foreach (i; 0..N)
	{
		s[i] = RD;
		total += s[i];
	}
	s.sort();
	s = 0 ~ s;
	long ans;
	foreach (i; 0..s.length)
	{
		if ((total - s[i]) % 10 != 0)
		{
			ans = total - s[i];
			break;
		}
	}
	writeln(ans);
	stdout.flush();
}

Measured memory_bytes: 256
from fractions import gcd
# from datetime import date, timedelta
# from heapq import *
import heapq
import math
from collections import defaultdict, Counter, deque
from bisect import *
import itertools
import fractions
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
# input = sys.stdin.readline


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


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def modpow(a, n, mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res


def modinv(a, mod):
    return modpow(a, mod - 2, mod)


def cnk(a, b):
    MOD = 10**9+7
    ret = 1
    for i in range(b):
        ret *= (a-i)
        ret %= MOD
        ret = ret * modinv(i+1, MOD) % MOD
    return ret




def main():
    h, w, d = map(int, input().split())
    a = [list(map(int, input().split())) for i in range(h)]

    dd = defaultdict(list)
    for i in range(h):
        for j in range(w):
            dd[a[i][j]] = [i,j]

    d2 = defaultdict(int)
    for i in range(d):
        n = 1 + i
        v = 0
        x,y = dd[n]
        while n <= h * w - d:
            n += d
            xx,yy = dd[n]
            v += abs(xx - x) + abs(yy - y)
            x = xx
            y = yy
            d2[n] = v
    q = int(input())
    for i in range(q):
        l, r = map(int, input().split())
        if l == r:
            print(0)
        elif l == 0:
            print(d2[r])
        else:
            print(d2[r] - d2[l])
        



            


    




    


if __name__ == '__main__':
    main()


Measured memory_bytes: 41600
#include<bits/stdc++.h>
using namespace std;
const int mx=100001;
vector<int> adj[mx];
vector<int> v(mx);
vector<int> a(mx);
int dfs(int i)
{
	if(a[i]!=0)
		return a[i];
	for(int j:adj[i])
	{
		if(a[j]==0)
		a[i]=max(a[i],dfs(j));
		else
		a[i]=max(a[i],a[j]);
	}
	a[i]++;
	return a[i];
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,e,x,y,i;
	cin>>n>>e;
	for(i=0;i<e;i++)
	{
		cin>>x>>y;
		adj[x-1].push_back(y-1);
	}
	int ans=0;
	for(i=0;i<n;i++)
	{
		if(v[i]==0)
		{
			ans=max(ans,dfs(i));
		}
	}
	cout<<ans-1<<"\n";
	return 0;
}

Measured memory_bytes: 10712
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int n,k,i,a,b;
    scanf("%d%d",&n,&k);
    long long int x[n+5],time=0x3f3f3f3f,t,min;
    for(i=0; i<n; i++)
    {
        scanf("%lld",&x[i]);
    }

    for(i=0; i<=n-k; i++)
    {
        a=i;
        b=i+k-1;;
        t=abs(x[a]-x[b]);
        if(abs(x[a])<abs(x[b]))
            min=abs(x[a]);
        else
            min=abs(x[b]);
        //printf("%lld\n",t+min);
        if((t+min)<time)
            time=t+min;


    }
    printf("%lld",time);
}


Measured memory_bytes: 896
#include <stdio.h>
int main(int argc, char *argv[])
{
	int x,a,b,c;
	scanf("%d%d%d",&x,&a,&b);
	if(b<=a)printf("delicious");
	 if(b>a&&b<=(a+x))printf("safe");
	 if(b>(a+x))printf("dangerous");
	return 0;
}

Measured memory_bytes: 128
s=input()[::-1]

count=[0]*2019
count[0]+=1
sd=0
d=1
for c in s:
   sd+=int(c)*d
   sd%=2019
   d*=10
   d%=2019
   count[sd]+=1

ans=0
for cnt in count:
    ans+=cnt*(cnt-1)//2

print(ans)



Measured memory_bytes: 68604
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
//#include<algorithm>
//#include<cmath>
//#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	while (n--) {
		int a, b;
		cin >> a >> b;
		if(a%b)	cout << a%b << endl;
		else cout << b << endl;
	}
	return 0;
}

Measured memory_bytes: 3084
#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 = 1 << 30;
const ll LLINF = 1LL << 60;

int mod = 1000000007;


int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, M; cin >> N >> M;
    int state = (1 << N);
    vector<int> dp[M+1]; rep(i, M+1) dp[i].resize(state);

    int A[M], B[M];
    rep(i, M){
        int a, k; cin >> a >> k;
        A[i] = a;
        int acc = 0;
        rep(j, k){
            int c; cin >> c;
            acc += (1 << (c-1));
        }
        B[i] = acc;
    }

    rep(i, M+1) rep(j, state) dp[i][j] = INF;
    dp[0][0] = 0;
    for(int i = 0; i < M; i++){
        for(int j = 0; j < state; j++){
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
            int to = j | B[i];
            dp[i+1][to] = min(dp[i+1][to], dp[i][j] + A[i]);
            
        }
    }
    if(dp[M][state-1] == INF) cout << -1 << endl;
    else cout << dp[M][state-1] << endl;
    return 0;
}

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

int main(){
    int A, B, C, N, M ,K;
    M = 0;
    K = 0;
    cin >> N;
    vector<int> p(N);
    for(int i = 0; i < N; i++){
        cin >> p.at(i);
        K += p.at(i);
        M = max(M, p.at(i));
    }

    cout << K-M/2 << endl;

//    vector<int> X();

//    for(int i = 0; i < ; i++){}
//    for(int j = 0; j < ; j++){}

//    cout <<  << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long sum=0,m,n,i,res=0,low,mid,high;
    cin>>n;

    low=1;
    high=n;
    while(low<=high)
    {
        mid=(low+high)/2;

        sum=(mid*(mid+1))/2;

        if(sum>=n)
        {
            high=mid-1;
            res=mid;
        }
        else
        {
            low=mid+1;
        }

    }

    cout<<res<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int c=0;
	char s[4],t[4];
	string stri;
	cin>>stri;
	strcpy(s,stri.c_str()); 
	cin>>stri;
	strcpy(t,stri.c_str()); 
	for(int i=0;i<3;i++){
		if(s[i]==t[i]) c++;
	}
	cout<<c;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
a = input()
A = a.split()

i = 0
j = 0
s = 0
while s == 0:
    for i in range(N):
        s += int(A[i]) % 2
        A[i] = int(A[i])//2
    if s == 0:
        j += 1

print(j)

Measured memory_bytes: 3060
a,b,c,d =map(int,input().split())
if a==b:
    if c==d:
        print('yes')
    else:
        print('no')
elif b==c:
    if d==a:
        print('yes')
    else:
        print('no')
elif c==d:
    if a==b:
        print('yes')
    else:
        print('no')
elif d==a:
    if b==c:
        print('yes')
    else:
        print('no')
else:
    print('no')


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MN = 1e4 + 5, MOD = 1e9 + 7;
ll dp[MN][105];

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int d; string s;
    cin >> s >> d;
    int N = s.length();
    reverse(s.begin(), s.end());
    ll ans = 0;
    dp[0][0] = 1;
    for (int i = 1; i <= N; i++) {
        for (int j = 0; j < d; j++) {
            for (int k = 0; k < 10; k++) {
                (dp[i][(j + k) % d] += dp[i - 1][j]) %= MOD;
            }
        }
    } 
    int sum = 0;
    for (int i = N - 1; i >= 0; i--) {
        for (int j = 0; j < s[i] - '0'; j++) {
            (ans += dp[i][(d - (sum + j) % d) % d]) %= MOD;
        }
        sum += s[i] - '0';
    }
    if (sum % d == 0) ans++;
    cout << (ans - 1 + MOD) % MOD << '\n';
    return 0;
}

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

#define LL long long

#define FOR(INDEX, START, END) for (int INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (int INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
	LL K, A, B;
	cin >> K >> A >> B;

	if (B - A < 2) {
		cout << 1 + K << endl;
		return 0;
	}

	LL total = 1;

	if (total < A) {
		LL tap = min(A - total, K);

		total += tap;
		K -= tap;
	}

	LL changeCount = K / 2;

	total += changeCount * (-A + B);
	K -= changeCount * 2;

	total += K;

	cout << total << endl;

	return 0;
}


Measured memory_bytes: 256
/* おまじない　*/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD=pow(10,9)+7;
const ll INF=(1LL<<62);
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

int main(){
    init();
    string s;
    cin>>s;
    ll numR=0;
    ll numB=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='0')numR++;
        else numB++;
    }
    cout<<2*min(numR,numB)<<endl;

}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MOD = 1e9+7;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//C++17以上
template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main() {
    int n;cin >> n;
    vector<int> h(n);
    rep(i,n)cin >> h[i];
    int ans = 0;
    int active = 0;
    for(int i=0;i<n;i++){
        if(active>=h[i]){
            active = h[i];
        }else{
            ans += h[i] - active;
            active = h[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! debug {
	($($a:expr),*) => {
		println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
	}
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(dead_code)]
const MOD: usize = 1e9 as usize + 7;

fn factors_prep(n: usize) -> Vec<usize> {
    let mut tbl = (0..=n).collect::<Vec<usize>>();
    for p in 2.. {
        if p * p > n {
            break;
        }
        if tbl[p] == p {
            for mul in (2 * p..=n).step_by(p) {
                if tbl[mul] == mul {
                    tbl[mul] = p;
                }
            }
        }
    }
    tbl
}

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let q: usize = sc.read();

    let max = 1e5 as usize;
    let tbl = factors_prep(max);
    let primes = tbl
        .into_iter()
        .enumerate()
        .map(|(i, v)| match i {
            0 | 1 => false,
            x => {
                if x == v {
                    true
                } else {
                    false
                }
            }
        })
        .collect::<Vec<bool>>();

    let mut cum = vec![0; max + 1];
    for i in 0..max {
        if i % 2 == 1 && primes[i] && primes[(i + 1) / 2] {
            cum[i + 1] = cum[i] + 1;
        } else {
            cum[i + 1] = cum[i];
        }
    }

    for _ in 0..q {
        let l: usize = sc.read();
        let r: usize = sc.read();
        println!("{}", cum[r + 1] - cum[l]);
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}

#[allow(dead_code)]
fn yn(flag: bool) {
    if flag {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2864
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

struct UnionFind {
	vector<int> par;
	UnionFind(int x) : par(x, -1) {}
	void init(int x) { par.assign(x, -1); }
	int root(int x) {
		if (par[x] <= -1) return x;
		else return root(par[x]);
	}
	bool issame(int x, int y) {
		return root(x) == root(y);
	}
	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}
	int size(int x) {
		return -par[root(x)];
	}
};
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    int s[51], t[51];
    rep(i, M) cin >> s[i] >> t[i];
    rep(i, M) {s[i]--; t[i]--;}
    int ans = 0;
    rep(i, M) {
        UnionFind UF(N);
        rep(j, M) {
            if (i == j) continue;
            UF.merge(s[j], t[j]);
        } 
        if(UF.size(0) != N) ans++;


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


Measured memory_bytes: 256
n,m = map(int, input().split())
A = [None]*n
for i in range(n):
    A[i] = list(input())
B = [None]*m
for i in range(m):
    B[i] = list(input())

def solve(i,j):
    for k in range(m):
        for l in range(m):
            if A[i+k][j+l] != B[k][l]:
                return False
    return True # match

for i in range(n-m+1):
    for j in range(n-m+1):
        if solve(i,j):
            print("Yes")
            exit()
print("No")

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

string S;

int main() {
  cin >> S;

  S[0] = '2';
  S[1] = '0';
  S[2] = '1';
  S[3] = '8';
  cout << S << "\n";

#if 0
  cout << S << "\n";
#endif
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
   int N;
   cin >> N;
   int n=0;
   for(int i=0;i<N+1;i++){
       if(0<i && i<10){
           n++;
       }
       else if(99<i && i<1000){
           n++;
       }
       else if(9999<i && i<100000){
           n++;
       }
   }
   cout << n;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
using namespace std;
int n,q,t,a;
map<int,int>m;
int main(void){
  cin>>n;
  while(n--){
    cin>>t;
    m[t]++;
  }
  cin>>q;
  while(q--){
    cin>>t;
    a+=m[t]>0;
  }
  cout<<a<<endl;
  return 0;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
#define clr(a) memset(a,0,sizeof(a))
#define umap unordered_map
#define uset unordered_set
#define fr first
#define sc second
#define pb push_back
#define M int(1e9+7)


using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;


int main(){
	fast_io; cout_precision;
	int n;	cin >> n; ll num=0;
	int a[n+1] , b[n];
	for(int i=0; i<=n; i++)	cin >> a[i];
	for(int i=0; i<n; i++)	cin >> b[i];
	for(int i=0; i<n; i++){
		if(b[i] >= a[i] + a[i+1]){
			num += a[i] + a[i+1];
			a[i+1] = 0;
		}
		else if(b[i] >= a[i]){
			num+=a[i];b[i]-=a[i];		a[i+1]-=b[i];	num+=b[i];
		}
		else{
			num+=b[i];	
		}
	}
	cout<<num;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int n, x, p=0,cnt=1;
	vector<int> v;

	cin>> n >> x;
	v.resize(n);
	for(int i=0;i<n;i++) cin>> v[i];

	for(int i=0;i<v.size();i++){
		p+=v[i];
		if(p<=x) cnt++;
	}

	cout<< cnt << endl;


}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int N, odd_count = 0;
  	cin >> N;
  	for (int i = 0; i < N; i++){
    	int a; cin >> a;
      	if (a % 2 == 1){
        	odd_count++;
        }
    }
  	if (odd_count % 2 == 0){
    	cout << "YES";
    } else {
    	cout << "NO";
    }
}

Measured memory_bytes: 384
from bisect import bisect_right
N = int(input())
A = [int(input()) for i in range(N)]
A = [-a for a in A]

# dp[i] := 長さiの広義単調増加部分列を取る時の最大の数
dp = []
for a in A:
    i = bisect_right(dp, a)
    if i >= len(dp):
        dp.append(a)
    else:
        dp[i] = a

print(len(dp))


Measured memory_bytes: 11048
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N , S=0;
	cin >> N;

	int l,r;

	for(int i=0;i<N;i++){
		cin >> l >> r;
		S = S + r - l + 1;
	}

	cout << S << endl;


}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
ll mod =1e9+7;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

template<class T> T maxt(T x,T y) {if (x>y) return x;else return y;}
template<class T> T mint(T x,T y) {if (x>y) return y;else return x;}
//sort(v.begin(), v.end(), [](auto& x, auto& y){return x[1] < y[1];});


//小数出力
double print_double(double d){printf("%.11f", d);}

//約数列挙
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}



// ll combination_mod(int n, int k) {
//   k = mint(k,n-k);
//   ll ans = 1;
//   if (n==0 || k ==0) return ans;
//   rep(i,k) {
//     ans = ans*(n-i)%mod;
//     ans = ans*modinv(i+1)%mod;
//   }
//   return ans;
// }

struct edge {
  int from; //出発点
  int to;   //到達点
  ll cost; //移動コスト
};

//ベルマンフォード法
vector<ll> bellman_ford (vector<edge> edges, int V, int E, int r, ll INF = 100000000000) {  
  vector<ll> cost_to(V,INF);
  cost_to[r] = 0;
  rep(i,V) {
    rep(j,E) {
      edge e = edges[j];
      if (cost_to[e.from]==INF) continue;
      if (cost_to[e.to] > cost_to[e.from] + e.cost) {
        cost_to[e.to] = cost_to[e.from] + e.cost;
        if (i==V-1) {
          printf("NEGATIVE CYCLE\n");
          return {};
        }
      }

    }
  }
  return cost_to;
}

// combination
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}


// 木上の探索
vector<int> cnt;
void dfs(const vector<vector<int>> &G, int v, int p) {
    for (auto nv : G[v]) {
        if (nv == p) continue; // nv が親 p だったらダメ
        dfs(G, nv, v);
    }

    // 帰りがけ時に、部分木サイズを求める
    cnt[v] = 1; // 自分自身
    for (auto c : G[v]) {
        if (c == p) continue;
        cnt[v] += cnt[c]; // 子のサイズを加える
    }
}

int main() {
  int H,W;string s;
  cin >> H >> W;
  vector<string> S;
  S.push_back(string('.',W+2));
  rep(i,H) {
    cin >> s;
    s = '.' + s + '.';
    S.push_back(s);
  }
  S.push_back(string('.',W+2));

  rep2(i,1,H+1) rep2(j,1,W+1) {
    if (S[i][j]=='#') continue;
    int tmp=0;
    rep2(ix,-1,2)rep2(iy,-1,2) {
      if (S[i+ix][j+iy]=='#') tmp++;
    }
    S[i][j] = '0' + tmp;
  }
  vector<string> ansv;
  rep2(i,1,H+1) {
    string ans = S[i].substr(1,W);
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main() {
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  double res;
  res = sqrt(pow(x2-x1, 2) + pow(y2-y1, 2));
  cout.precision(10);
  cout << res << endl;

  return 0;
}



Measured memory_bytes: 3272
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
    string a,b,c;
    cin>>a>>b;
    c=a+b;
    int d=stoi(c);
    string ans="No";
    REP(i,sqrt(d)+1){
        if(i*i==d){
            ans="Yes";
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  int N, K;
  string S;
  cin >> N >> S >> K;
  for(int i=0;i<N;++i) {
    if(S[i] != S[K-1]) S[i] = '*';
  }
  cout << S << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
	bool f=false;
	int n,cnt=0;
	cin>>n;
	int x,y;
	for(int i=0;i<n;i++) {
		cin>>x>>y;
		if(x==y) {
			cnt++;
		}else cnt=0;
		if(cnt>=3) f=true;
	}
	if(f) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

template<class T>
bool UpdateMax(T &a, const T &b){
  if(a<b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template<class T>
bool UpdateMin(T &a, const T &b){
  if(a>b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int x,y;
  cin>>x>>y;
  for(int i=0;i<=x;i++){
    int tmp=i*2+(x-i)*4;
    if(tmp==y){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;


  return 0;
}




Measured memory_bytes: 3640
#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define CONCAT_(x,y) x##y
#define CONCAT(x,y) CONCAT_(x,y)
#define _v1 CONCAT(qyw1, __LINE__) // unique name in same line (otherwise use __COUNTER__)
#define _v2 CONCAT(qyw2, __LINE__)
#define forbits(i, m) for (int _v1 = m, i = __builtin_ctz(_v1); _v1 != 0; _v1 ^= _v1 & -_v1, i = __builtin_ctz(_v1))
#define forsubm(s, m) for (int s = m; s >= 0; s = !s ? -1 : m & (s - 1))
int __nextXZW(int v){int t=v|(v-1);int w=(t+1)|(((~t&-~t)-1)>>(__builtin_ctz(v)+1));return w;}
#define ksets(i, n, k) for (int i = (1u << k) - 1, max = i << (n - k); i <= max; i = __nextXZW(i))
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9+7;
const ll N = 5e5+5, inf = 1e9+5000;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n; cin >> n;
  ll ans = 0;
  for (int a = 1; a < n; a++) {
    for (int b = 1; b < n; b++) {
      if (a*b >= n) break;
      ans++;
    }
  }
  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 3644
#include<iostream>
using namespace std;
#define MAX 2000000

int H, A[MAX + 1];

void maxHeapify(int i) {
	int l, r, largest;
	l = 2 * i;
	r = 2 * i + 1;

	if (l <= H&&A[l] > A[i])largest = l;
	else largest = i;
	if (r <= H&&A[r] > A[largest])largest = r;

	if (largest != i) {
		swap(A[i], A[largest]);
		maxHeapify(largest);
	}
}

int main() {
	cin >> H;

	for (int i = 1; i <= H; i++)cin >> A[i];

	for (int i = H / 2; i >= 1; i--)maxHeapify(i);

	for (int i = 1; i <= H; i++) {
		cout << " " << A[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 5028
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    string s;
    cin >> s;
    int n = s.size();

    int cnt = 0;
    for (int i=0; i<n; i++) {
        cnt++;
        while(i<n-1 && s[i] == s[i+1]) i++;
    }

    cout << cnt - 1 << endl;
}

Measured memory_bytes: 512
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		List<Integer> list = new ArrayList<Integer>();
		for(;;){
			String number = scan.next();
			if(number.equals("0")){
				break;
			}
			int sum = 0;
			for(int i = 0; i < number.length(); i++){
				char ch = number.charAt(i);
				String c = String.valueOf(ch);
				int n = Integer.parseInt(c);
				sum += n;
			}
			list.add(sum);
		}

		for(int n : list){
			System.out.println(n);
		}
	}
}

Measured memory_bytes: 27000
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	
	
	
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String k = s.next();
		String m = s.next();
		
		int n = k.length(),ctr=0;
		for(int i=0;i<n;i++) {
			if(k.charAt(i)!=m.charAt(i)) {
				ctr++;
			}
		}
		System.out.println(ctr);
	}

}


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

int main() {
    string s, t;
    cin >> s >> t;
    int size = s.size();
    int tot = 0;
    for (int i = 0; i <= size - 1; i++) {
        if (s[i] != t[i]) {
            tot++;
        }
    }
    cout << tot << '\n';
    return 0;
}

Measured memory_bytes: 3904
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

S=[]
if a<40:
    S.append(40)
else:
    S.append(a)

if b<40:
    S.append(40)
else:
    S.append(b)

if c<40:
    S.append(40)
else:
    S.append(c)

if d<40:
    S.append(40)
else:
    S.append(d)

if e<40:
    S.append(40)
else:
    S.append(e)

ave=sum(S)//5
print(ave)


Measured memory_bytes: 5596
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n;
  cin >> n;
  map<string, int> mp;
  REP(i,n){
    string s;
    cin >> s;
    mp[s]++;
  }
  cout << "AC x " << mp["AC"] << endl;
  cout << "WA x " << mp["WA"] << endl;
  cout << "TLE x " << mp["TLE"] << endl;
  cout << "RE x " << mp["RE"] << endl;
  return 0;

}





Measured memory_bytes: 3232