akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/dynamic_bitset.hpp>
using namespace std;
using u64 = uint64_t;

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

	u64 div_base = 2019;
	u64 ans = 0;
	boost::dynamic_bitset<> search_done(S.size()+1);
	
	for(u64 b=0; b<S.size(); b++) {
		u64 tmp_div = 0;
		u64 num_b_variations = 0;
		
		if(search_done[b]) continue;
		
		for(u64 e=b; e<S.size(); e++) {
			tmp_div = tmp_div * 10 + S[e] - '0';
			bool is_zero = (tmp_div == 0);
			
			tmp_div = tmp_div - (tmp_div / div_base) * div_base;
			
			if(!is_zero && tmp_div == 0) {
				num_b_variations++;
				ans += num_b_variations;	
				
				if(search_done[e+1]) break;
				
				search_done[e+1] = 1;
			}
		}
	}

	cout << ans;

}


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

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

	int ans1=0,ans2=0;
	for(int i=0; i<s.size(); i++){
		if(i%2==(int(s[i])-'0')) ans1++;
		else ans2++;
	}

	cout << min(ans1,ans2) << endl;
	return 0;
}

Measured memory_bytes: 3740
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e10
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextFloat() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func intSlicePrint(el interface{}) {
	fmt.Println(strings.Trim(fmt.Sprint(el), "[]"))
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)

	a := next()
	if unicode.IsUpper(rune(a[0])) {
		fmt.Println("A")
	} else {
		fmt.Println("a")
	}
}



Measured memory_bytes: 1772
#import <stdio.h>
typedef long long Int;
int main(){
	Int n,a,b;
	scanf("%lld %lld %lld",&n,&a,&b);
	if(n==1){
		if(a==b){
			puts("1");
		}else{
			puts("0");
		}
	}else{
		if(b>=a){
			printf("%lld\n",(n-2)*(b-a)+1);
		}else{
			puts("0");
		}
	}
}

Measured memory_bytes: 6356
<?php
	$s=fgets(STDIN);
	$t=fgets(STDIN);
	$n=strlen($s)-1;
	for($i=0;$i<$n;$i++){
		$c=0;
		for($j=0;$j<$n;$j++){
			$c+=$s[$j]===$t[($i+$j)%$n];
		}
		$f+=$c==$n;
	}
	echo $f?Yes:No;


Measured memory_bytes: 3828
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;
int dh[]={-1,0,0,1};
int dw[]={0,-1,1,0};
ll dp[3010][3010][4];

int main(){
    ll r,c,k; cin>>r>>c>>k;
    vector<vector<ll> > G(r,vector<ll>(c,0));
    for(int _=0;_<k;_++){
        int i,j,v;
        cin>>i>>j>>v;
        i--; j--;
        G[i][j]=v;
    }
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            for(int n=0;n<4;n++){
                dp[i][j][n]=0;
            }
        }
    }

    for(int i=0;i<r;i++){
        if(i==0){////////
            for(int n=1;n<4;n++){
                dp[0][0][n]=G[0][0];
            }
            for(int j=1;j<c;j++){
                for(int n=1;n<4;n++){
                    dp[i][j][n]=max(dp[i][j-1][n],dp[i][j-1][n-1]+G[i][j]);
                }
            }
        }else{     //////////
            dp[i][0][0]=dp[i-1][0][3];
            for(int n=1;n<4;n++){
                dp[i][0][n]=dp[i][0][0]+G[i][0];
            }
            for(int j=1;j<c;j++){
                dp[i][j][0]=dp[i-1][j][3];
                dp[i][j][1]=max(dp[i][j][0]+G[i][j],dp[i][j-1][1]);
                for(int n=2;n<4;n++){
                    dp[i][j][n]=max(dp[i][j][n-1],max(dp[i][j-1][n-1]+G[i][j],dp[i][j-1][n]));           
                }
            }
        }
    }

    /*for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            for(int n=0;n<4;n++){
                cout<<dp[i][j][n]<<" ";
            }
            cout<<"  ";
        }
        cout<<endl;
    }*/

    cout<<dp[r-1][c-1][3]<<endl;

    
}

Measured memory_bytes: 355892
#include <iostream>
//#include <bits/stdc++.h>
// a&1 check odd or not and a>>=1 halfs a
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define pb(x) push_back(x)
#define F first
#define S second
using namespace std;
#define ll long long
const int N=1e5+8;
int n;
ll arr[N];
ll joints[N];
ll l;

void solve(){	
	cin>>n>>l;
	loop(i,0,n){
		cin>>arr[i];
	}
	ll maxlen=-1;
	ll ind;
	loop(i,0,n-1){
		joints[i]=arr[i]+arr[i+1];
		if(maxlen<joints[i]){
			ind=i;
			maxlen=joints[i];
		}
	}	
	if(maxlen<l){
		cout<<"Impossible"<<endl;
//		puts("Impossible");		
	}
	else{
//		puts("Possible");
		cout<<"Possible"<<endl;
	if(ind==0){
		for(int i=n-2;i>=0;i--){
			cout<<i+1<<endl;
		}
	}
	else if(ind==n-2){
		for(int i=0;i<n-1;i++){
			cout<<i+1<<endl;
		}
	}
	else{
		for(int i=n-2;i>ind;i--){
			cout<<i+1<<endl;
		}
		for(int i=0;i<ind;i++){
			cout<<i+1<<endl;
		}
		cout<<ind+1<<endl;
	}
	}
}

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



Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H,W; cin >> H >> W;
    REP(i,H){
        REP(j,W){
            string s; cin >> s;
            if(s == "snuke"){
                cout  << char(j+'A') <<i+1<< endl;
            }
        }
    }

}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int H, W; cin >> H >> W;
  string s[H]; rep(i, H) cin >>s[i];

  vector<vector<bool>> m(H+2, vector<bool>(W+2, false));
  rep(i, H) rep(j, W) m[i+1][j+1] = (s[i][j] == '#');

  string result = "Yes";
  for (int i=1; i<H; i++) for (int j=1; j<W; j++) {
    if (m[i][j]) {
      if (m[i-1][j] || m[i+1][j] || m[i][j-1] || m[i][j+1]) continue;
      else { result = "No"; break; }
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<algorithm>
#include<iomanip>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(b>=a)
	cout<<"Yes"<<endl;
	else
	{
		int sum=a%500;
		if(b>=sum)
		cout<<"Yes"<<endl;
		else
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>

const int INF = 1000000000;

int main(){
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    int maxVal = -100, minVal = 100;
    for(int i = 0; i < n; i++){
        std::cin >> a[i];
        maxVal = std::max(maxVal, a[i]);
        minVal = std::min(minVal, a[i]);
    }

    int minCost = INF;
    for(int i = minVal; i <= maxVal; i++){
        int tmpCost = 0;
        for(int j = 0; j < n; j++){
            tmpCost += (i - a[j]) * (i - a[j]);
        }

        minCost = std::min(minCost, tmpCost);
    }

    std::cout << minCost << std::endl;
    return 0;
}


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

int main() {
	// your code goes here
	string s;
	cin>>s;
	for(int i=0;i<3;i++){
		cin>>s[i];
	}
	if((s[0]==s[1])&&(s[1]==s[2])){
		cout<<"No"<<endl;
	}
	else{
	cout<<"Yes"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    char b,c;
    scanf("%c",&b);
    if(b=='A')
        c='T';
    else if(b=='T')
        c='A';
        else if(b=='C')
        c='G';
        else if(b=='G')
        c='C';

    printf("%c",c);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
using namespace std;
using ll = long long;
const int INF = +100100100;
typedef pair<ll,ll> P;
const ll MO = 1000000007;

int main(){
    int n,k;
    cin >> n >> k;
    vector<ll> h(n),c(n);
    rep(i,n)cin>>h[i];
    c[0] = 0;
    c[1] = abs(h[0]-h[1]);
    for(int i = 2; i<n;++i){
        c[i] = c[i-1]+abs(h[i-1]-h[i]);
        for(int j = 1; j<=k;++j)if(i-j>=0)c[i]=min(c[i],c[i-j]+abs(h[i]-h[i-j]));
    }
    // rep(i,c.size())cout << c[i] <<" ";
    // cout << endl;
    cout << c[n-1]<<endl;
    // rep(i,c.size())cout << c[i]<<" ";
    // cout << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ll long long
const int MX=200011;
int N, M, k;
int arr[MX];

int main()
{
    int a, b, c, d;
    cin>>a>>b>>c>>d;
    cout<<min(a, b) + min(c, d);
    return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
pii point[3010];
bool ex[5010][5010];
int main(){
	int n;
	while(~scanf("%d",&n)){
		if(n==0)break;
		memset(ex, false, sizeof(ex));
		memset(point, 0, sizeof(point));
		for(int i=0;i < n;i++){
			scanf("%d %d",&point[i].first,&point[i].second);
			ex[point[i].second][point[i].first]=true;
		}
		sort(point,point+n);
		/*rep(i,n){
			printf("(x,y) =(%d,%d)\n",point[i].first,point[i].second);
		}*/
			int ans =0;
			for(int i=0;i < n;i++){
				for(int j=i+1;j < n;j++){
					int dx =abs(point[j].first-point[i].first);
					int dy =abs(point[j].second-point[i].second);
					int tmp =dx*dx+dy*dy;
					if(tmp<=ans)continue;
				/*printf("(x1,y1) =(%d,%d)\n",point[i].first,point[i].second);
				printf("(x2,y2) =(%d,%d)\n",point[j].first,point[j].second);
				printf("(dx,dy) = (%d,%d)\n",dx,dy);*/
				int nx1 =point[j].first+dy;
				int ny1 =point[j].second+dx;

				int nx2 =point[i].first+dy;
				int ny2 =point[i].second+dx;
				//
				int mnx1 =(point[j].first-dy);
				int mny1 =(point[j].second-dx);

				int mnx2 =(point[i].first-dy);
				int mny2 =(point[i].second-dx);
				/*printf("(nx1,ny1) =(%d,%d)\n",nx1,ny1);
				printf("(nx2,ny2) =(%d,%d)\n",nx2,ny2);
				printf("(mnx1,mny2) =(%d,%d)\n",mnx1,mny1);
				printf("(mnx1,mny2) =(%d,%d)\n",mnx2,mny2);
				cout <<endl;*/
				if(nx1<=5000&&ny1<=5000&&nx2<=5000&&ny2<=5000&&
				   ex[ny1][nx1]&&ex[ny2][nx2]){
					ans=max(ans,tmp);
				//cout <<ans<<endl;
				continue;
			}
			if(mnx1>=0&&mny1>=0&&mnx2>=0&&mny2>=0&&
			   ex[mny1][mnx1]&&ex[mny2][mnx2]){
				ans=max(ans,tmp);
		}
	}
}
cout <<ans<<endl;
}
return 0;
}

Measured memory_bytes: 25756
#include<bits/stdc++.h>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define MOD 1000000007
#define INF 1e9
#define F first
#define S second
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(void){
    int N,cnt=0;cin>>N;
    VI l(N);
    REP(i,N)cin>>l[i];
    sort(All(l));
    /*
    REP(i,N){
        int a=l[i];
        FOR(j,i+1,N){
            int b=l[j];
            cnt+=lower_bound(All(l),b+a)-lower_bound(All(l),max(b-a+1,b+1));
        }
    }
    */
    REP(i,N){
        int a=l[i];
        FOR(j,i+1,N){
            int b=l[j];
            FOR(k,j+1,N){
                int c=l[k];
                if(a<b+c&&b<c+a&&c<a+b){
                    cnt++;
                }
            }
        }
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
N, k = map(int, input().split())  # N回の操作, K番目に小さいものを選ぶ
ans = []
for _ in range(N):
    ans.append(list(map(int, input().split())))
ans = sorted(ans, key=lambda x: x[0])
for value, amount in ans:
    if amount >= k:
        print(value)
        exit()
    else:
        k -= amount


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

int main(void){
	char input[19];
	int a, b, c;
	int i;
	int count = 0;
	fgets(input, sizeof(input), stdin);
		
	a = atoi(strtok(input, " "));
	b = atoi(strtok(NULL, " "));
	c = atoi(strtok(NULL, " "));
	
	for (i = a; i <= b; i++){
		if (c % i == 0){
			count++;
		}
	}
	
	printf("%d\n", count);
	return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> pll;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(make_pair(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
    int n;
    string s;
    cin >> n >> s;
    for(int i = 0; i < s.length(); i++) {
        if(s[i] >= 'A' && s[i] <= 'Z') {
            if(n != 0 && s[i] + n > 'Z') {
                s[i] = s[i] - 26 + n;
            } else {
                s[i] += n;
            }
        } else {
        }
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
class Main{
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        double r = Double.parseDouble(in.readLine());
 
        double pi = Math.PI;
        double x = r * r * pi;
        double y = 2 * r * pi;
        System.out.printf("%.6f %.6f", x, y);
    }
}

Measured memory_bytes: 16984
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC103
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string t = Console.ReadLine();
            string answer = "No";
            for (int i = 0; i < s.Length; i++)
            {
                if (s == t) { answer = "Yes";break; }
                s = s.Substring(1) + s.Substring(0, 1);
            }
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 11092
/*========================
    Card Game for Two
========================*/
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> vec(N);
    for (int i = 0; i < vec.size(); i++) {
        cin >> vec.at(i);
    }
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());
    int Alice = 0, Bob = 0;
    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            Alice += vec.at(i);
        } else {
            Bob += vec.at(i);
        }
    }
    cout << Alice - Bob << endl;
    return 0;
}

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

const int maxn = 1e5 + 10;
int q, sum[2][maxn];
string a, b;

int f(int l, int ones){
	return ((l - ones) + 2 * ones) % 3;
}

int main(){
	ios_base::sync_with_stdio(false);

	cin >> a >> b;

	for(int i = 1; i <= a.size(); i++){
		sum[0][i] = sum[0][i - 1] + (a[i - 1] == 'B');
	}

	for(int i = 1; i <= b.size(); i++){
		sum[1][i] = sum[1][i - 1] + (b[i - 1] == 'B');
	}

	cin >> q;

	int l1, r1, l2, r2;

	while(q--){
		cin >> l1 >> r1 >> l2 >> r2;
		if(f(r1 - l1 + 1, sum[0][r1] - sum[0][l1 - 1]) == f(r2 - l2 + 1, sum[1][r2] - sum[1][l2 - 1])){
			cout << "YES\n";
		}else{
			cout << "NO\n";
		}
	}
}


Measured memory_bytes: 1744
def lcs_better(X, Y):
    costs = [0]
    for c in Y:
        for i in range(len(costs) - 1, -1, -1):
            tmp = X.find(c, costs[i])
            if tmp + 1:
                if i + 1 < len(costs):
                    costs[i + 1] = min(costs[i + 1], tmp + 1)
                else:
                    costs.append(tmp + 1)
    return len(costs) - 1


def answer(X, Y):
    m, n = len(X), len(Y)
    C = [[0] * (n + 1) for _ in range(m + 1)]
    for i in range(1, m + 1):
        for j in range(1, n + 1):
            if X[i - 1] == Y[j - 1]:
                C[i][j] = C[i-1][j-1] + 1
            else:
                C[i][j] = max(C[i][j -1], C[i -1][j])
    return C[m][n]


if __name__ == '__main__':
    q = int(input())
    for _ in range(q):
        X = input()
        Y = input()
        print(lcs_better(X, Y))

Measured memory_bytes: 7736
#include <stdio.h>

int main(void){
  int a,b,X;
  scanf("%d%d",&a,&b);

  if(b < 10){
    X = a*10+b;
  }else if(b < 100){
    X = a*100+b;
  }else{
    X = a*1000+b;
  }

  for(int i = 1;i*i <= X;i++){
    if(i*i == X){
      printf("Yes\n");
      return 0;
    }
  }

  printf("No\n");
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string.h>

using namespace std;

int main() {
	int n, m, nilai[100010], bigmod = 1000000007, a;
	bool rusak[100010];
	cin >> n >> m;
	memset(rusak, false, sizeof rusak);
	while (m--) {
		cin >> a;
		rusak[a] = true;
	}
	nilai[0] = nilai[1] = 1;
	if (rusak[1])
		nilai[1] = 0;
	for (int i = 2; i <= n; i++) {
		if (rusak[i])
			nilai[i] = 0;
		else
			nilai[i] = (nilai[i - 1] + nilai[i - 2]) % bigmod;
	}
	cout << nilai[n] << endl;
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    int cnt[100100] = {0};
    int a;
    for (int i=0; i<N; ++i) {
        cin >> a;
        ++cnt[a];
        ++cnt[a+1];
        ++cnt[a+2];
    }
    int ans = 0;
    for (int i=0; i<100100; ++i) {
        if (ans < cnt[i]) ans = cnt[i];
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String s = scan.next();

		if (s.substring(2, 3).contentEquals(s.substring(3, 4))
				&& s.substring(4, 5).contentEquals(s.substring(5, 6))) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		scan.close();

	}

}


Measured memory_bytes: 21972
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

int main(void) {
    string S, T;
    cin >> S >> T;

    int ans = 0;
    for (int i = 0; i < (int) S.size(); i++) {
        if (S[i] != T[i]) {
            ans++;
        }
    }

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


Measured memory_bytes: 3896
main :: IO ()
main = do
  s <- read <$> getLine
  let f n
        | n == 0 = [1]
        | n <= 2 = 0 : f (n - 1)
        | otherwise = let as = f (n - 1) in (as !! 0 + as !! 2) `mod` 1000000007 : as
  putStrLn $ show $ head $ f s


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

int main(){	
  string s, t;
  cin >> s >> t;
  int n = s.size(), cnt = 0;
  for(int i = 0; i < n; ++i){
   	if(s[i] == t[i]) cnt++; 
  }
 	cout << cnt << endl;
  return 0;
}

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

int main()
{
    int N, M;
    cin >> N >> M;
    priority_queue<int> q;
    int Ai;
    for (int i = 0; i < N; i++)
    {
        cin >> Ai;
        q.push(Ai);
    }

    for (int i = 0; i < M; i++)
    {
        int Ai = q.top();
        q.pop();
        q.push(Ai / 2);
    }
    int64_t res = 0;
    for (int i = 0; i < N; i++)
    {
        res += q.top();
        q.pop();
    }
    cout << res << endl;
}

Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <set>
#include <map>

long long int mod = 1e9 + 7;

long long int moddiv(long long int a, long long int b) {
	return 1;
}

long long int powmod(long long int a, long long int b){
	long long int res = 1;
	a %= mod;
	for (; b > 0; b >>= 1) {
		if (b & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
	}

	return res;
}

int main() {
	long long int n, a[10010];
	std::cin >> n;

	for (int i = 0; i < n; ++i)
		std::cin >> a[i];

	int cnt[1000010] = { 0 };
	for (int i = 0; i < n; ++i) {
		int tmp = a[i];
		std::map<int, int> primes;
		for (int j = 2; j*j <= tmp; ++j) {
			while (tmp > 1 && tmp % j == 0) {
				++primes[j];
				tmp /= j;
			}
		}

		if (tmp > 1)
			++primes[tmp];

		for (std::pair<int, int> x : primes) {
			cnt[x.first] = std::max(cnt[x.first], x.second);
		}
	}
	long long int lcm = 1;

	for (int i = 1; i <= 1e6; ++i) {
		lcm *= powmod(i, cnt[i]);
		lcm %= mod;
	}
	long long int sum = 0;
	for (int i = 0; i < n; ++i) {
		sum += powmod(a[i], mod-2);
		sum %= mod;
	}

	std::cout << (sum * lcm) % mod;
}

Measured memory_bytes: 7588
#include <bits/stdc++.h>
using namespace std;
struct elem {
	int a, b;
};
elem arr[200000];
int main() {
	ios::sync_with_stdio(0);cin.tie(0);
	int n;
	cin >> n;
	for(int i=0; i<n; i++) {
		cin >> arr[i].a >> arr[i].b;
	}
	sort(arr, arr+n, [](elem a, elem b){return a.b < b.b;});
	int cur = 0;
	for(int i=0; i<n; i++) {
		cur += arr[i].a;
		if(cur > arr[i].b)
			return !(cout << "No");
	}
	cout << "Yes";
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {
		int N, M;
		cin >> N >> M;
		int P[M], Y[M];
		vector<int> d[100001];
		for (int i = 0; i < M; i++) {
				cin >> P[i] >> Y[i];
				d[P[i]].push_back(Y[i]);
		}

		for (int i = 1; i <= N; i++) sort(d[i].begin(), d[i].end());

		for (int i = 0; i < M; i++) {
				int x = lower_bound(d[P[i]].begin(), d[P[i]].end(), Y[i]) - d[P[i]].begin() + 1;
				printf("%012lld\n", (ll)P[i] * 1000000 + x);
		}
		return 0;
}


Measured memory_bytes: 7808
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();

		int sNumber = s.length();
		int tNumber = t.length();

		List<String> sList = new ArrayList<>();
		List<String> tList = new ArrayList<>();

		String[] sAllay = s.split("");
		String[] tAllay = t.split("");
		for (String ss : sAllay) {
			sList.add(ss);
		}
		for (String tt : tAllay) {
			tList.add(tt);
		}

		Collections.sort(sList);
		Collections.sort(tList, Comparator.reverseOrder());
		String yn = null;
		int index = 0;
		int difference = sNumber - tNumber;
		if (difference < 0) {
			index = sNumber - 1;
			yn = "Yes";

		} else if (difference >= 0) {
			index = tNumber - 1;
			yn = "No";
		}

		for (int index1 = 0; index1 <= index; index1++) {
			for (int index2 = 0; index2 <= index; index2++) {
				if (index1 == index2) {
					String x = sList.get(index1);
					String y = tList.get(index2);
					int n = x.compareTo(y);
					if (n == 0) {
						break;
					} else if (n > 0) {
						System.out.println("No");
						return;
					} else if (n < 0) {
						System.out.println("Yes");
						return;
					}
				}
			}
		}
		System.out.println(yn);
	}
}

Measured memory_bytes: 23636
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int A,B;
	scanf("%d %d",&A,&B);

	printf("%d\n",abs(A-B));

	return 0;
}



Measured memory_bytes: 3240
#include "iostream"
#include "random"
#include "string"
#include "bitset"
#include "algorithm"
#include "map"
#include "queue"
#include "list"
#include "set"
#include "climits"
#include "iomanip"
#include "stack"
#include "functional"
#include "complex"

using namespace std;
using ll = long long int;
using PII = pair<ll, ll>;

using R = long double;
using P = complex<R>;
using L = pair<P, P>;
using G = vector<P>;
struct S : public L {
	S() {}
	S(const P &a, const P &b) : L(a, b) {}
};

const R EPS = 1e-8;
const R PI = atan(1) * 4;

inline int sgn(const R& r) { return (r > EPS) - (r < -EPS); }
inline R dot(const P& a, const P& b) {
	return real(a)*real(b) + imag(a)*imag(b);
}
inline R det(const P& a, const P& b) {
	return real(a)*imag(b) - imag(a)*real(b);
}
inline P vec(const L& l) { return l.second - l.first; }

inline P crosspoint(const L& l1, const L& l2) {
	R ratio = det(vec(l2), l2.first - l1.first) / det(vec(l2), vec(l1));
	return l1.first + vec(l1) * ratio;
}

R area(const G& pol) {
	R ret = 0.0;
	for (int i = 0; i < pol.size(); ++i) {
		ret += det(pol[i], pol[(i + 1) % pol.size()]);
	}
	return ret / 2.0;
}

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

	int N;
	cin >> N;
	vector<long double>v(N);
	for (auto &i : v) {
		cin >> i;
		i += 0.1;
	}
	vector<long double>x(10);
	vector<long double>y(10);
	vector<P>p(10);
	long double sx = 0, sy = 0;
	for (int i = 0; i < 10; i += 2) {
		x[i] = cos(PI*i / 5);
		y[i] = sin(PI*i / 5);
		p[i] = { x[i],y[i] };
	}
	for (int i = 1; i < 10; i += 2) {
		p[i] = crosspoint(L(p[(i + 9) % 10], p[(i + 3) % 10]), L(p[(i + 1) % 10], p[(i + 7) % 10]));
	}
//	reverse(p.begin(), p.end());
	long double r = area(p);
	int num = 1;
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			if (num>N)return 0;
			cout << num << endl;
			sx = i * 1000 - 5000 + 500;
			sy = j * 1000 - 5000 + 500;
			long double rr = sqrt(v[num - 1] / r);
			G t;
			for (auto k : p) {
				t.push_back({ sx + k.real()*rr ,sy + k.imag()*rr });
				cout << fixed << setprecision(9) << sx + k.real()*rr << " " << sy + k.imag()*rr << endl;
			}
			//cout << area(t) << endl;
			num++;
		}
	}
}


Measured memory_bytes: 3632
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <iostream>

#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;

using namespace std;
#include<stdio.h>
#include<math.h>
int ispow(int x)
{
    int i,k=(int)sqrt(x*1.0);
    if(x == k * k){return 1;}
    return 0;
}

int main(){
int a, b;
scanf("%d%d", &a, &b);

int ans = 0;
if(b < 10){
    ans = a * 10 + b;
}
else if(b >= 10 && b < 100){
    ans = a * 100 + b;
}
else{
    ans = a * 1000 + b;
}
    //cout << ans << endl;
    if(ispow(ans) == 1){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
    int n, m;
    cin >> n >> m;
    VI a(n);
    int s = 0;
    REP(i,n){
        a[i] = in();
        s += a[i];
    }
    int c = 0;
    REP(i,n) c += (4 * m * a[i] >= s);
    cout << (c >= m ? "Yes" : "No") << endl;

    return 0;
}


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

#define fs first
#define sc second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mp make_pair

const int N = 2e5+10;
const ll MAX = ll(1e18) + 111;
const ll MOD = 1e9+7;


int main()
{
    ll a, b;
    cin >>  a >> b;
    if(a%b) cout << a; else cout << -1;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

     class Main{
        public static void main(String args[]){
           Scanner scan = new Scanner(System.in);

              while(true){

                 int h =scan.nextInt();
                 int w =scan.nextInt();


                 if(h==0&&w==0){
                 break;
                 } else {



                    for(int f =0;f<w;f++){
                    System.out.print("#");
                    }
                     System.out.println();


                       for(int h1 =0;h1<h-2;h1++){
                          System.out.print("#");

                             for(int w1 =0;w1<w-2;w1++){
                             System.out.print(".");
                             }

                          System.out.println("#");
                       }


                     for(int e =0;e<w;e++){
                     System.out.print("#");
                     }
                      System.out.println();
                      System.out.println();

                   }
              }
        }
     }




Measured memory_bytes: 34208
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop") // to pop argument of function as soon as it returns
#define ll long long int
#define pb push_back
#define fs first
#define se second

int main()
{
    ios_base::sync_with_stdio(0);
     cin.tie(0);
     cout.tie(0);
    
     ll n,T;
     cin>>n>>T;
     vector < pair <ll,ll> > vec;
     for(ll i=0;i<n;i++)
     {
        ll c,t;
        cin>>c>>t;
        vec.pb(make_pair(c,t));
     }
     sort(vec.begin(),vec.end());
     ll flag = 1;
     for(ll i=0;i<vec.size();i++)
     {
        if(vec[i].second <= T)
        {
        flag = 0;
        cout<<vec[i].first;
        break;
        }
        
     }
     if(flag)
     cout<<"TLE";
     
}

Measured memory_bytes: 256
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
              if (d[i][k] != float("INF")) and (d[k][j] != float("INF")):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
        #print(d)
    return d

##############################
n,w = map(int,input().split()) #n:頂点数　w:辺の数

d = [[float("INF")] * n for i in range(n)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(w):
    x,y,z = map(int,input().split())
    d[x][y] = z
    #d[y][x] = z
for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０

D = warshall_floyd(d)
for i in range(n):
  if D[i][i] < 0:
    print("NEGATIVE CYCLE")
    #print(D)
    quit()
    
for i in range(n):
  for j in range(n):
    if D[i][j] == float("inf"):
      if j == n - 1:
        D[i][j] = print("INF")
      else:
        D[i][j] = print("INF", end = " ")
    else:
      if j == n - 1:
        print(D[i][j])
      else:
        print(D[i][j], end = " ")

#print(D)



Measured memory_bytes: 6280
//url:
//problem name: Brick Break

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

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

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

int main() {
    int N;
    cin >> N;
    vecl A(N);
    REP(i,N) cin >> A[i];
    ll ans = 0;
    REP(i,N) ans += A[i]-1;
    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007



from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007



n, k = LI()
L = LI()


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(reverse=True)
    return divisors


for gcd in make_divisors(sum(L)):
    remainder_l = sorted([i % gcd for i in L if i % gcd])
    remainder_u = [gcd - i for i in remainder_l]
    a = list(accumulate(remainder_l))
    b = list(reversed(list(accumulate(reversed(remainder_u)))))
    if not a:
        print(gcd)
        break
    ng = len(a) - 1
    ok = 0
    while ng > ok + 1:
        mid = (ok + ng) // 2
        if a[mid] > b[mid+1]:
            ng = mid
        elif a[mid] < b[mid+1]:
            ok = mid
        else:
            ok = mid
            break
    if a[ok] <= k:
        print(gcd)
        break

Measured memory_bytes: 45660
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  string s;
  cin>>s;
  if(s.length()==3) {
    reverse(ALL(s));
  }
  cout<<s<<endl;

  return 0;
}


Measured memory_bytes: 256
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	N := readInt()
	F := make([][]bool, N)
	for i := range F {
		F[i] = make([]bool, 10)
		for j := range F[i] {
			x := readInt()
			if x == 1 {
				F[i][j] = true
			}
		}
	}

	P := make([][]int, N)
	for i := range P {
		P[i] = make([]int, 11)
		for j := range P[i] {
			P[i][j] = readInt()
		}
	}

	ans := math.MinInt32
	DoWithExhaustiveBits(10, func(b []bool) {
		c := make([]int, N)
		var tmp int
		for i := range c {
			for j := range b {
				if b[j] && F[i][j] {
					c[i]++
				}
			}
			tmp += P[i][c[i]]
		}
		if ans < tmp {
			ans = tmp
		}
	})
	println(ans)
}

func DoWithExhaustiveBits(n int, fn func([]bool)) {
	N := 1 << uint(n)
	a := make([]bool, n)
	for i := 0; i < N; i++ {
		if i == 0 {
			continue
		}
		for j := 0; j < n; j++ {
			k := n - j - 1
			if i&(1<<uint(j)) == 0 {
				a[k] = false
			} else {
				a[k] = true
			}
		}
		fn(a)
	}
}

func DoWithExhaustive01(n int, fn func([]int)) {
	N := 1 << uint(n)
	a := make([]int, n)
	for i := 0; i < N; i++ {
		for j := 0; j < n; j++ {
			k := n - j - 1
			if i&(1<<uint(j)) == 0 {
				a[k] = 0
			} else {
				a[k] = 1
			}
		}
		fn(a)
	}
}


Measured memory_bytes: 1536
n,t = map(int, input().split())

dic = {}
for i in range(n):
    a,b = map(int, input().split())
    dic[a] = b

dic = sorted(dic.items(), key = lambda x : x[0])

for i,j in dic:
    if j <= t:
        print(i)
        exit()
print('TLE')

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
using ll = long long;

int main() {
    int H,W,N;
    cin >> H >> W >> N;
    int sr,sc;
    cin >> sr >> sc;
    string S,T;
    cin >> S >> T;

    bool ans = true;
    int sr1=sr,sc1=sc;
    // sr,scはH,Wより大きくする
    // sr1,sc1は1より小さくする
    for (int i = 0; i < N; ++i) {
        if(S[i]=='L'){
            sc1--;
        }else if(S[i]=='R'){
            sc++;
        }else if(S[i]=='U'){
            sr1--;
        }else{
            sr++;
        }

        if(sr>H || sr1<1 || sc>W || sc1<1){
            ans = false;
            break;
        }

        if(T[i]=='L'){
            if(sc>1) sc--;
        }else if(T[i]=='R'){
            if(sc1 < W) sc1++;
        }else if(T[i]=='U'){
            if(sr>1) sr--;
        }else{
            if(sr1 < H) sr1++;
        }
    }

    if(ans){
        cout << "YES";
    }else{
        cout << "NO";
    }
    return 0;
}

Measured memory_bytes: 776
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
inline void solve(void){
  string S;in(S);
  if(S[0]==S[1]&&S[1]==S[2])out("No");
  else out("Yes");
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll x = 0;
	for (int i = 0; i < n; i++) {
		x = a[i] * 2 - x;
	}
	x /= 2;
	vector<int> ans(n);
	ans[0] = x;
	for (int i = 1; i < n; i++) {
		ans[i] = (a[i - 1] - ans[i - 1] / 2) * 2;
	}
	for (int i = 0; i < n; i++) {
		cout << ans[i];
		if (i == n - 1)
			cout << endl;
		else
			cout << " ";
	}
	return 0;
}

Measured memory_bytes: 3992
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define pii pair<int, int>
#define pll pair<long long, long long>
const double PI = acos(-1);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int M,K; cin >> M >> K;

    if (M == 0) {
        if (K == 0) cout << "0 0" << endl;
        else cout << -1 << endl;
        return 0;
    }
    if (M == 1) {
        if (K == 0) cout << "0 0 1 1" << endl;
        else cout << -1 << endl;
        return 0;
    }
    if (K >= (1<<M)) {
        cout << -1 << endl;
        return 0;
    }

    int N = (1<<M);
    vector<int> A(2*N);
    rep(i,N) {
        if (i == K) {
            A[N-1] = A[2*N-1] = i;
        }
        else if (i < K) {
            A[i] = A[2*N-2-i] = i;
        } else {
            A[i-1] = A[2*N-1-i] = i;
        }
    }

    rep(i,2*N) cout << A[i] << " ";
    cout << endl;
} 


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

int main() {

	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	//freopen("text.in", "r", stdin);
	//freopen("text.out", "w", stdout);

	int n, A[(int)2e5 + 1], B[(int)2e5 + 1];
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> A[i];
		B[i] = A[i];
}
	sort(A + 0, A + n);
	int counter = 0;
	for (int i = 0; i < n; ++i) {
		if (A[i] != B[i])counter++;
	}
	cout << (counter <= 2 ? "YES" : "NO") << '\n';
	return 0;
}

Measured memory_bytes: 256