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

int main() {
  int n, m;
  cin >> n >> m;

  // その日にできるバイトを管理するベクターjobsを定義
  vector<vector<int>> jobs(m);

  rep(i, n) {
    // aは報酬が貰える日数、bは報酬額
    int a, b;
    cin >> a >> b;
    if (a > m) continue;  // 最大日より大きいバイトは弾く
    jobs[m - a].push_back(b);
  }

  priority_queue<int> q;
  ll ans = 0;

  /**
   * 後ろの日から遡って、報酬が最大のバイトを選択していく
   * 最大の値は、priority_queueを使って求める
   */
  for (int i = m - 1; i >= 0; --i) {
    for (int b : jobs[i]) {
      q.push(b);
    }
    if (!q.empty()) {
      ans += q.top();
      q.pop();
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
#define dump(a) cout << (a) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
// Int MOD = 998244353;

int main() {
    ios::sync_with_stdio(false);
    double t, x;
    cin >> t >> x;
    printf("%.12lf", t / x);
    return 0;  
} 

Measured memory_bytes: 764
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }

const ll INF=1e18;

int main(){
    ll x;
    cin>>x;
    ll ans=(x/500)*1000;
    ll cnt=x-(x/500)*500;
    ans+=(cnt/5)*5;
    cout<<ans<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
(全探索できるなら全探索しろ)
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'\n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std  ;
typedef long  long ll ;
#define pb push_back
ll a[5] ;
int main() {
    ll i,n  ;
    string s , t ;

    cin >> n>> s >> t ;


    for(i=0;i<n;i++){
        cout << s[i] << t[i] ;
    }

    cout << endl ;




    return  0 ;
}






Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
int n , m , a , b , pref1 , pref2;
int main() {
    abdelrahman010
    cin >> n >> m;
    for(int i = 0;i < n;i++) {
        int x;
        cin >> x;
        if(i)
            a = (a + ((1ll * x * i) % mod - pref1 + mod) % mod) % mod;
        pref1 = (pref1 + x) % mod;
    }
    int ans = 0;
    for(int i = 0;i < m;i++) {
        int x;
        cin >> x;
        b = ((1ll * x * i) % mod - pref2 + mod) % mod;
        ans = (ans + (1ll * a * b) % mod) % mod;
        pref2 = (pref2 + x) % mod;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
int main() {
    
    vector<int>sv(100001,0);
    sv[0] = 0;sv[1]=0;
    
    for(int i = 2; i <=100000; i++){
        for (int j = i; j<=100000; j+=i) {
            if (sv[j]) {
             sv[j] = 2;
             continue;
            }
            sv[j] = 1;
        }
    }
    
    vector<int>a(sv.size(),0);
    for (int i = 0; i<a.size(); i++) {
        if (i % 2 == 0) continue;
        if(sv[i] == 1 && sv[(i+1)/2] == 1) a[i] = 1;
    }
    
    vector<int>sc(a.size()+1,0);
    for (int i = 0; i<a.size(); i++) {
        sc[i+1] = sc[i]+a[i];
    }

    int q;
    cin >> q;
    rep(i, 0, q){
        int l, r;
        cin >> l >> r;
        r++;
        cout << sc[r]-sc[l] << endl;
    }

    
  return 0;
}


Measured memory_bytes: 4556
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2510

#include<iostream>
//#include<fstream>

#define N 1001//データの最大個数
#define ami 0
#define mami 1

int n = 0;
int wTime[N] = {};

int sum(int a[]){
	int ans = 0;
	for (int i = 0; a[i] != 0; i++)
		ans += a[i];
	return ans;
}

int timeCalc(int differ){
	bool dp[1000000] = {true,};

	//wTime[0 ? n-2]はsort済み
	int time = 0;

	for (int i = 0; i <= n - 2; i++){//各wTimeごとに
		for (int j = differ; j >= wTime[i]; j--){//wTime[i] < j < differ
			if (dp[j - wTime[i]]){
				dp[j] = true;//DP的な。
				if (time < j)time = j;//大きい方を選択
			}
		}
	}
	return time;
}

int main(){
	using namespace std;
/*
	ifstream fin;

	fin.open("input.txt");
	if (!fin)cout << "file read error!" << endl;
*/
	int rTime[N] = {};
	int allTime[2] = {0, 0};

	while (true){

		cin >> n;
		if (n == 0)break;//終了条件

		for (int i = 0; i < N; i++){//初期化
			rTime[i] = wTime[i] = 0;
		}

		for (int i = 0; i < n; i++){
			cin >> rTime[i] >> wTime[i];
//			cout << rTime[i] << wTime[i] << endl;
		}

		if (n == 1){
			cout << 2 * rTime[0] + wTime[0] << endl;
			continue;
		}

		//読書時間でbubble sort
		for (int i = n - 1; i >= 0; i--){
			for (int j = 0; j < i; j++){
				if (rTime[j] > rTime[j + 1]){
					int tmp[2] = { rTime[j], wTime[j] };
					
					rTime[j] = rTime[j + 1];
					wTime[j] = wTime[j + 1];

					rTime[j + 1] = tmp[0];
					wTime[j + 1] = tmp[1];
				}
			}
		}
		//計算開始

		//read
		//最も読む時間のかかる一つと、その他の全ての和を比較

		//max <= sum
		if (sum(rTime) >= 2 * rTime[n - 1]){
			cout << sum(rTime) + sum(wTime) << endl;
		}

		//max > sum
		else if (sum(rTime) < 2 * rTime[n - 1]){

			allTime[ami] = rTime[n - 1];
			allTime[mami] = sum(rTime) - rTime[n - 1];

			int differ = allTime[ami] - allTime[mami];

			for (int i = n - 2; i >= 0; i--){
				for (int j = 0; j < i; j++){
					if (wTime[j] > wTime[j + 1]){
						int tmp = wTime[j];
						wTime[j] = wTime[j + 1];
						wTime[j + 1] = tmp;
					}
				}
			}
			
			int writingTime = timeCalc(differ);

			cout << sum(rTime) + sum(wTime) + differ - writingTime << endl;

		}

	}
	return 0;
}

Measured memory_bytes: 2152
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, a;
    cin >> n;
    vector<int> v;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        v.push_back(a);
    }
    reverse(v.begin(), v.end());
    for (int i = 0; i < n - 1; i++)
    {
        cout << v[i] << " ";
    }
    cout << v[n - 1] << endl;
}


Measured memory_bytes: 3152
#include<iostream>
using namespace std;
typedef long long ll;
int main()
{
  ll n=50,k,a,b,q,r,i;
  cin >> k;
  q=(k+n-1)/n;
  r=q*n-k;
  a=n-1+q+r;
  b=q+r-2;
  cout << n << endl;
  for(i=0;i<r;i++)
    cout << b << " ";
  for(;i<n;i++)
    cout << a << " ";
  cout << endl;
  return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9
#define rep(i,a,b) for(int i = (a); i < (b); i++)

bool take[310][310];
int dp[310][310];

signed main() {
    int n;
    while(cin >> n, n) {
        int w[310];
        rep(i,0,n) cin >> w[i];
        memset(take, false, sizeof(take));
        memset(dp, 0, sizeof(dp));

        rep(i,0,n) {
            rep(j,0,n-i) {
                int len = i+1;
                int s = j, t = j+i;
                rep(k,s,t) {
                    if(take[s][k] && take[k+1][t]) take[s][t] = true;
                }
                if(len == 2) {
                    if(abs(w[s] - w[t]) < 2) {
                        take[s][t] = true;
                    }
                }
                if(take[s][t]) {
                    int x = s-1, y = t+1;
                    while(1) {
                        if(x < 0 || x >= n || y < 0 || y >= n) break;
                        if(abs(w[x] - w[y]) >= 2) break;
                        take[x][y] = true;
                        x--; y++;
                    }
                }
            }
        }

        rep(i,0,n) rep(j,i+1,n) {
            if(take[i][j]) dp[i][j] = j-i+1;
        }

        rep(i,0,n) rep(j,i,n) rep(k,i,j) {
            dp[i][j] = max(dp[i][j], dp[i][k] + dp[k+1][j]);
        }
        cout << dp[0][n-1] << endl;
    }
    return 0;
}


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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;
using P = pair<int,int>;
using graph = vector<vector<int>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    int N;
    cin>>N;
    vector<ll> v(N);
    rep(i,N) {
        cin>>v[i];
        v[i]*=-1;
    }
    vector<ll> s;
    rep(i,N){
        auto ite = upper_bound(s.begin(),s.end(),v[i]);
        if(ite==s.end()) s.push_back(v[i]);
        else{
            *ite=v[i];
        }
    }
    cout<<s.size()<<endl;
}

Measured memory_bytes: 4984
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

vector<vector<ll>> node;
deque<ll> ls;
vector<bool> flag;

void dfs(ll n){
    if(!flag[n]) return;
    
    flag[n] = false;
    for (auto e : node[n]) dfs(e);
    ls.push_front(n);
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    ll N, M;
    cin >> N >> M;

    node.resize(N);
    flag.resize(N, true);

    rep(i,M){
        ll x, y;
        cin >> x >> y;
        --x, --y;
        node[x].pb(y);
    }

    rep(i, N) dfs(i);

    vector<ll> dp(N);

    ll ans = 0;
    ll ct = 0;
    for (auto l : ls){
        for(auto n : node[l]){
            chmax(dp[n], dp[l] + 1);
            chmax(ans, dp[n]);
            ++ct;
        }
    }

    print(ans);

    return 0;
}

Measured memory_bytes: 9472
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
  int a, b;

  cin >> a >> b;

  int d = a / b;
  int r = a % b;
  double f = static_cast<double>(a) / static_cast<double>(b);

  cout << d << " " << r << " " << fixed << setprecision(5) << f << endl;
  return 0;
}

Measured memory_bytes: 3276
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_s(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

#define MOD 1000000007

int main() {
  int a, b;
  cin >> a >> b;

  int ans = a * b;

  cout << ans << endl;
}


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

int main() {
  int n,t,a;
  cin >> n >> t >> a;
  vector<int> h(n);
  vector<double> x(n),y(n);
  
  for(int i =0;i<n;i++){
    cin >> h.at(i);
    x.at(i) = a - t + (h.at(i)* 0.006);
    y.at(i) = x.at(i);
    if(x.at(i) < 0){
      x.at(i) = -x.at(i);
    }
  }
  
  sort(x.begin(), x.end());
  
  for(int i = 0; i<n;i++){
    if(y.at(i) == x.at(0)){
      cout << i+1 << endl;
      break;
    }
    else if (y.at(i) == -x.at(0)){
      cout << i+1 << endl;
    }
    else {
      continue;
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string>
//#inclde <bits/stdc++.h>
using namespace std;
int main(){
    
    string s;
    cin>>s;
    map<string,int> day;
    day["SUN"]=7;
    day["MON"]=6;
    day["TUE"]=5;
    day["WED"]=4;
    day["THU"]=3;
    day["FRI"]=2;
    day["SAT"]=1;
    cout<<day[s]<<endl;
    
    return 0;
    
    
}

Measured memory_bytes: 256
N,M = map(int,input().split())

DP = [[10**9]*(2**N) for i in range(M+1)]
DP[0][0] = 0
key = []
for i in range(M):
    a,b = map(int,input().split())
    c = list(map(int,input().split()))
    d = 0
    for j in c:
        d += 2**(j-1)
    key.append([a,d])
for i in range(M):
    cost,p = key[i]
    for j in range(2**N):
        q = j - (p&j)
        DP[i+1][j] = min(DP[i][j],cost+DP[i][q])
ans = DP[-1][-1]
if ans >= 10**9:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 78168
#include <stdio.h>
#include <math.h>

int main(){
  long long int s;
  scanf("%lld", &s);
  long long int r = (long long int)sqrt(s);
  //printf("%lld %lld\n", s, r);
  while(r * r < s){
    r++;
  }
  printf("%lld 1 %lld %lld 0 0\n", r, r * r - s, r);
  return 0;
}


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

int main() {
  long long X;
  cin >> X;
  
  string result = "NO";
  if (X == 3 || X == 5 || X == 7) {
    result = "YES";
  }
  
  cout << result << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define dunk(a) cout << (a) << "\n"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) {
		cin >> a[i];
		a[i]--;
	}
	vector<int> now(n, 0);
	int b = 0;
	int cnt = 0;
	for (;;) {
		//ボタンをつける
		b = a[b];
		cnt++;
		if (b == 1) {
			dunk(cnt);
			return 0;
		}
		if (cnt > n) break;
	}
	dunk(-1);
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const int h=333;
const int lim=1000;
char s[1010][1010];
int sum1[1010][1010],sum2[1010][1010];
int main()
{
	int n,m,cnt=0;
	long long la,ans=0;
	scanf("%d%d",&n,&m);
	memset(s,0,sizeof(s));
	for(int i=h+1;i<=h+n;i++)
		scanf("%s",s[i]+h+1);
	memset(sum1,0,sizeof(sum1));
	memset(sum2,0,sizeof(sum2));
	for(int i=1;i<=1000;i++)
		for(int j=1;j<=1000;j++)
		{
			sum1[i][j]=sum1[i-1][j-1]+(s[i][j]=='#');
			sum2[i][j]=sum2[i-1][j+1]+(s[i][j]=='#');
		}
	la=0;
	for(int i=h+1;i<=h+n;i++)
		for(int j=h+1;j<=h+m;j++)
			for(int k=1;k<=300;k++)
			{
				cnt=(s[i-k][j]=='#')+(s[i+k][j]=='#')+(s[i][j-k]=='#')+(s[i][j+k]=='#');
				if(cnt==3)
					ans--;
				else if(cnt==4)
					ans-=4;
				if((s[i-k][j]=='#')&&(s[i][j+k]=='#'))
					ans+=sum1[i+k][j]-sum1[i-1][j-k-1];
				if((s[i+k][j]=='#')&&(s[i][j-k]=='#'))
					ans+=sum1[i][j+k]-sum1[i-k-1][j-1];
				if((s[i+k][j]=='#')&&(s[i][j+k]=='#'))
					ans+=sum2[i][j-k]-sum2[i-k-1][j+1];
				if((s[i-k][j]=='#')&&(s[i][j-k]=='#'))
					ans+=sum2[i+k][j]-sum2[i-1][j+k+1];
			}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 9344
#include <bits/stdc++.h>
using namespace std;
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;}
const long long INFLL = 1LL<<60;
const int INF = 1<<28;
void solve(int a){cout<<( a?"YES":"NO")<<endl;}
int main(){
	
	long long n,m;
	
	
	cin >>n >>m;

	long long ss=0;
	long long cs=0;
	long long ans=0;
	long long a;
	a=min(n,m/2);

	ans=a;

	n-=a;
	m-=(a*2);
	//cout <<n<<"   "<<m<<endl;
	if(n==0){
		ans+=m/4;
	}
	cout <<ans<<endl;
	
}

Measured memory_bytes: 256
import sys
from itertools import accumulate
 
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines

import bisect

n,m=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

def hand(x):
  cnt=0
  for i in range(n):
    k=n-bisect.bisect_left(A,x-A[-i-1])
    if k==0:
      break
    cnt+=k
    if cnt>=m:
      break
  return cnt

def main():
  l=0
  h=2*10**5+1
  mid=(l+h)//2
  
  while l+1<h:
    mid=(l+h)//2
    if hand(mid)<m:
      h=mid
    else:
      l=mid
  
  B = list(accumulate(A[::-1]))[::-1]

  ans=0
  cnt=0
  
  
  for i in range(n):
    index=bisect.bisect_left(A,l-A[-i-1]+1)
    if n==index:
      break
    else:
      ans+=(n-index)*A[-i-1]+B[index]
      cnt+=(n-index)
  
  ans+=(m-cnt)*l
  print(ans)

if __name__ == "__main__":
	main()
  

  
  

Measured memory_bytes: 55216
#include<stdio.h>
int n,k,w[200000];
int bs(int a)
{
    int i,t = 0,c = 1;
    for(i = 0;i < n;i++)
    {
        if(w[i] > a) return 0;
        if(t+w[i] > a)
        {
            c++;
            t=0;
        }
        t += w[i];
    }
    return c<=k;
}

int main()
{
    int i,j,r,m;
    scanf("%d%d",&n,&k);
    for(i=0;i<n;i++)
        scanf("%d",&w[i]);
    for(j=0,r=2147483647;j<r;)
    {
        m=(j+r)/2;
        if(bs(m))
            r = m;
        else
            j = m+1;
    }
    printf("%d\n",r);
    return 0;
}


Measured memory_bytes: 2248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main() {
  int N,M;
  cin >> N >> M;
  vector<ll> n(N);
  vector<bool> m(N+5);
  for (int i = 0; i < M; i++) {
    int a;
    cin >> a;
    m.at(a) = true;
  }
  
  for (int i = 0; i < N; i++) {
    if (i == 0) {
      if (m.at(1)) n.at(0) = 0;
      else n.at(0) = 1;
    } else if (i == 1) {
      if (m.at(2)) n.at(1) = 0;
      else n.at(1) = n.at(0) + 1;
    } else {
      if (m.at(i+1)) n.at(i) = 0;
      else {
        n.at(i) = n.at(i-1) + n.at(i-2);
        n.at(i) %= 1000000007;
      }
    }
  }
  
  cout << n.at(N-1) << endl;
        
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const int inf=1e9;
int main(){
	int N;cin>>N;
	string s;cin>>s;
	if(N%2==1){ cout<<"No"<<endl; return 0; }
	rep(i,0,N/2){
		if(s[i]!=s[i+N/2]){ cout<<"No"<<endl; return 0; }
	}cout<<"Yes"<<endl;
}
/*タスクを並列に行う 二分探索
x=(x ? true : false)
sorted
auto it=lower_bound(v.begin(),v.end(),w) v[it-v.begin()]>=w
auto it=upper_bound(v.begin(),v.end(),w) v[it-v.begin()]>w
void func(int* vec){}
puts(string) cout<<string<<endl;
1.*a/b int to double
(int)a-48 char to int
(char)(i+97) int to char
stoi(s) string to int
stoll(s)
cout.precision(16);
cout<<fixed<<a;
printf("%.6lf\n",a);
accumulate(a,a+n,0);
*/

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  string s;
  cin >> s;
  int n = s.size();

  int x, res = 1e9;
  for (int i = 0; i < n-2; ++i) {
    x = 100*(s[i]-'0')+10*(s[i+1]-'0')+(s[i+2]-'0'); 
    res = min(abs(753-x), res);
  }
  cout << res << endl; 

  return 0;
}



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

int main(){
  int N, X;
  cin >> N >> X;
  int L[105];
  rep(i,N) cin >> L[i];
  int ans = 0, s = 0;
  rep(i,N){
    ++ans;
    s += L[i];
    if(s > X){
      cout << ans << endl;
      return 0;
    }
  }
  cout << ++ans << endl;
}


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

#define int long long

int dp[100001][17];
int N, K;

int dfs(int n, int k) {
  if ( dp[n][k] >= 0 ) return dp[n][k];  
  if ( k == K ) return 1;

  int ret = 0;
  for ( int i = 2; i <= 100000; i++ ) {
    if ( n*i > N ) break;
    ret += dfs(n*i, k+1);    
  }

  return dp[n][k] = ret;  
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin >> N >> K;
  fill_n(*dp, 100001*17, -1);

  int ans = 0;
  for ( int i = 1; i <= N; i++ ) ans += dfs(i, 1);
  cout << ans << endl;  
  
  return 0;
}



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

#define MP make_pair
#define PB push_back
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define PB push_back

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVi;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;

int main(){
	ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int x=800,y;

    cout<<x*n-(int)(n/15)*200<<endl;


    return 0;
}


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

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

    int first = 0;
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        int counter = 0;
        int temp = i;
        while (temp % 2 == 0)
        {
            temp = temp / 2;
            counter++;
        }
        first = max(first, counter);
    }
    cout << pow(2, first);
}

Measured memory_bytes: 4256
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f;
const ll mod = 998244353LL;
clock_t TIME_START, TIME_END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME_END - TIME_START) / CLOCKS_PER_SEC);
    system("pause");
#endif
}
string s, t;

void solve()
{
    cin>> s >> t;
    int ans = 0;
    for (int i = 0; i < s.length();++i)
    {
        if(s[i]!=t[i])
            ans++;
    }
    printf("%d\n", ans);
}

int main()
{
    TIME_START = clock();
    int Test = 1;
    // cin >> Test;
    while (Test--)
        solve();
    TIME_END = clock();
    program_end();
    return 0;
}

Measured memory_bytes: 3912
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iomanip>
using namespace std;

int main() {
	int N; cin >> N;
	vector<int> c(N);
	int sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> c[i];
		sum += c[i];
	}
	int ans = sum - *max_element(c.begin(), c.end()) / 2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
# coding:utf-8
import sys

def determination(ls):
    return ls[0][0]*ls[1][1]-ls[0][1]*ls[1][0]

def inversion(ls):
    ret = []
    tmp = [x for x in ls]
    det = determination(tmp)
    
    if det == 0:
        return False
    else:
        tmp[0][0], tmp[1][1] = tmp[1][1], tmp[0][0]
        tmp[0][1] = tmp[0][1]*(-1)
        tmp[1][0] = tmp[1][0]*(-1)

    for x in tmp:
        ret.append(list(map(lambda x:x/det, x)))

    return ret

def dot(a,b):
    ret = []
    
    for x in a:
        ret.append(x[0]*b[0] + x[1]*b[1])

    return ret

def simueq(a,b):
    return dot(inversion(a), b)

def main():

    for line in sys.stdin:
        ls = list(map(int, line.split(' ')))
        a = [[ls[0], ls[1]], [ls[3], ls[4]]]
        b = [ls[2], ls[5]]
        
        answer = simueq(a,b)
        print('%.3f' % round(answer[0],3), '%.3f' % round(answer[1],3))
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 7684
//2020-06-03 
#include <bits/stdc++.h>
using namespace std;
#define loop(v, st, en) for (int v = st; v < en; v++)
#define loopdesc(v, st, en) for (int v = st; v >= en; v--)
#define INF 1E9
#define clr(v, d) memset(v, d, sizeof(v))
#define pb push_back
#define MP make_pair
#define P(x) cout << #x  <<" = { "<< x<<" }\n"
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
const int M=2e5+5;


int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    int n  ,a,b, m ; cin>>n>>m;
    vi sign (n+1,-1);
    vi vistd (n+1,-1);
    vector<vi> adj (n+1); 
    loop(i,0,m){
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    queue<int > q ;
    q.push(1);vistd[1]=1;
    while (!q.empty())
    {
        int p = q.front();q.pop();
        loop(i,0,adj[p].size()){
            int child = adj[p][i];
            if(vistd[child]==-1){
            vistd[child]=1;
            sign[child]=p;
            q.push(child);
            }
        }
    }
    loop(i,2,n+1){
        if(sign[i]==-1) return cout <<"No\n",0;
    }
    cout <<"Yes\n";
    loop(i,0,n-1){
        cout <<sign[i+2]<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 10616
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
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 print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
//template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
//template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll INF=1e9+7;

vector<vector<ll>> G;

ll m;

vector<ll> z;

void dfs(ll p,ll c){
    if(c!=0) z[p]=c;
    ll pos=1;
    for(auto x:G[p]){
        if(pos==c) pos++;
        dfs(x,pos);
        pos++;
    }
    return;
}

int main()
{
    ll n;
    cin >> n;
    G.resize(n);
    z.resize(n);
    vector<ll> d;
    rep(i,n-1){
        ll a,b;
        cin >> a >> b;
        a--;
        b--;
        d.push_back(b);
        G[a].push_back(b);
    }
    m=-1;
    rep(i,n){
        ll w=G[i].size();
        if(i){
            m=max(m,w+1);
        }
        else{
            m=max(m,w);
        }
    }
    cout << m << endl;
    dfs(0,0);
    for(auto x:d){
        cout << z[x] << endl;
    }
    return 0;
} 


Measured memory_bytes: 6520
#include<iostream>
#include<algorithm>

using namespace std;


int main() {
    int N, A, B;

    cin >> N >> A >> B;

    // vector <int> field(N);

    // for (int i = 0; i < N; i++) {
    //     field[i] = -1
    // }
    // field[A] = 1;
    // field[B] = 1;
    A--;
    B--;

    while (true) {
        if(A + 1 != B) {
            A++;
        } else if (A > 0) {
            A--;
        } else {
            cout << "Borys" << endl;
            break;
        }

        if(B - 1 != A) {
            B--;
        } else if (B < N - 1) {
            B++;
        } else {
            cout << "Alice" << endl;
            break;
        }
    }

}

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

T RD(T = string)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }

long mod = pow(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!long;
	auto C = RD!long;
	long[][] D;
	foreach (i; 0..C)
	{
		D ~= RDR.split.to!(long[]);
	}
	long[][] c;
	foreach (i; 0..N)
	{
		c ~= RDR.split.to!(long[]);
	}

	auto cnt = new long[][](3, C);
	foreach (i; 0..N)
	{
		foreach (j; 0..N)
		{
			foreach (k; 0..C)
			{
				cnt[(i+j+2)%3][k] += D[c[i][j]-1][k];
			}
		}
	}

	long[][] pat = [
		[0, 1, 2],
		[0, 2, 1],
		[1, 0, 2],
		[1, 2, 0],
		[2, 0, 1],
		[2, 1, 0]];
	long ans = long.max;
	foreach (arr; pat)
	{
		long[] used;
		long tmpAns;
		foreach (i; arr)
		{
			long best = long.max;
			long bestPos;
			foreach (j; 0..C)
			{
				if (used.countUntil(j) != -1) continue;
				if (cnt[i][j] < best)
				{
					best = cnt[i][j];
					bestPos = j;
				}
			}
			tmpAns += best;
			used   ~= bestPos;
		}
		ans = min(ans, tmpAns);
	}

	writeln(ans);
	stdout.flush();
}

Measured memory_bytes: 5116
import java.util.Scanner;

public class Main {
    static final int MODULUS = 1_000_000_007;

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] a = new int[M];
        for (int i = 0; i < a.length; ++i) {
            a[i] = sc.nextInt();
        }

        System.out.println(solve(N, a));

        sc.close();
    }

    static int solve(int N, int[] a) {
        int[] wayNums = new int[N + 1];
        wayNums[0] = 1;

        boolean[] brokens = new boolean[N + 1];
        for (int ai : a) {
            brokens[ai] = true;
        }

        for (int i = 0; i < wayNums.length; ++i) {
            for (int j = 1; j <= 2; ++j) {
                if (i + j < wayNums.length && !brokens[i + j]) {
                    wayNums[i + j] = addMod(wayNums[i + j], wayNums[i]);
                }
            }
        }

        return wayNums[N];
    }

    static int addMod(int x, int y) {
        return (x + y) % MODULUS;
    }
}

Measured memory_bytes: 59256
#include <bits/stdc++.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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    ll N, M; cin >> N >> M;
    ll ans = 1;
    for(ll i=1; i*i<=M; i++){
        if(M%i == 0){
            if(i*N <= M) ans = max(ans, i);
            if(M/i*N <= M) ans = max(ans, M/i);
        }
    }

    cout << ans << endl;
}

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

const ll N = 2e5+5, MOD = 998244353;
ll n, m, k;
ll fact[N], invfact[N];

ll fastexp(ll a, ll x, ll m) {
	if(x == 0) return 1;
	ll ans = 1;
	while(x > 0) {
		if(x&1) ans = (ans*a)%m;
		a = (a*a) % m;
		x /= 2;
	}
	return ans;
}

ll choose(ll n, ll k) {
	if(k < 0 && k > n) return 0;
	return (((fact[n] * invfact[k]) % MOD) * invfact[n-k]) % MOD;
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n >> m >> k;

	fact[0] = 1; invfact[0] = 1;
	for(int i = 1; i < n; i++) {
		fact[i] = (fact[i-1] * i) % MOD;
		invfact[i] = (invfact[i-1] * fastexp(i, MOD-2, MOD)) % MOD;
	}

	ll ans = (m * fastexp(m-1, n-1, MOD)) % MOD;
	for(int i = 1; i <= k; i++) {
		ll cur = choose(n-1, i);
		cur *= (m * fastexp(m-1, n-i-1, MOD)) % MOD; cur %= MOD;
		ans += cur; ans %= MOD;
	}

	cout << ans << '\n';

	return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define ASSERT(expr...) assert((expr))

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

constexpr i64 INF = 1'010'000'000'000'000'017LL;

constexpr i64 MOD = 1'000'000'007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

const int MAX_N = 110000;

int memo[MAX_N];
int rec(int n) {
    if (n == 0) return 0;
    if (memo[n] != -1) return memo[n];

    int res = n;
    for (int pow6 = 1; pow6 <= n; pow6 *= 6) {
        chmin(res, rec(n - pow6) + 1);
    }

    for (int pow9 = 1; pow9 <= n; pow9 *= 9) {
        chmin(res, rec(n - pow9) + 1);
    }
    return memo[n] = res;
}

void solve() {
    int N; cin >> N;
    REP(i, MAX_N) memo[i] = -1;
    cout << rec(N) << "\n";
}

signed main() {
    solve();
    return 0;
}   

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

///////////////////
// RangeSumQuery //
///////////////////

class RangeSumQuery {
private:
	std::vector<long long> container_;
	long long getHelper(const int index) const
	{
		if (index < 0) return 0;
		if ((int)(container_.size()) <= index) return container_.back();
		long long sum{};
		for (int add_place{index}; add_place > 0; add_place -= add_place & -add_place)
			sum += container_[add_place];
		return sum;
	}

public:
	RangeSumQuery(const int array_size)
		: container_(array_size + 1) {}
	// 引数は0-indexed
	void update(const int index, const int added)
	{
		for (int update_place{index + 1}; update_place < (int)(container_.size()); update_place += update_place & -update_place)
			container_[update_place] += added;
	}
	// 引数は0-indexed、[l, r)の半開区間
	long long get(const int left, const int right) const
	{
		return -getHelper(left) + getHelper(right);
	}
};

int main()
{
	int n, q;
	scanf("%d%d", &n, &q);
	RangeSumQuery rsq(n);
	for (int i{}; i < q; i++)
	{
		int com, x, y;
		scanf("%d%d%d", &com, &x, &y);
		if (!com) rsq.update(x - 1, y);
		else printf("%lld\n", rsq.get(x - 1, y));
	}

	return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }

using ll = long long;
const ll mod = LLONG_MAX;

int dp[500010];
int main(){
  int N;
  string s;
  cin>>N>>s;

  rep(i,N){
    if(s[i]=='1'){

      if(i>1 && s[i-1]=='0'){
        for(int j=i-2;j>=0 && s[j]=='1';j--){
          dp[i+1]=max(dp[i+1],(i-j-1)+dp[j]);
        }
      }
      if(i<N-2 && s[i+1]=='0'){
        for(int j=i+2;j<N && s[j]=='1';j++){
          dp[j+1]=max(dp[j+1],(j-i-1)+dp[i]);
        }
      }


    }
    dp[i+1]=max(dp[i],dp[i+1]);
  }

  // rep(i,N+1){
  //   cout<<dp[i]<<" ";
  // }

  cout<<dp[N]<<endl;


}


Measured memory_bytes: 2820
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int a,b;
	cin >> a >> b;
	cout << (a^b) << endl;
	return 0;
}


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

#define ll long long int
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define repm(i, a, n) for (ll i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define mod (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vd vector<double>
#define vb vector<bool>
#define vs vector<string>
#define vii vector<vector<int>>
#define vllll vector<vector<ll>>
#define ALL(a) (a).begin(), (a).end()

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

void print(bool f)
{
    cout << (f ? "Yes" : "No") << endl;
}

void Print(bool f)
{
    cout << (f ? "YES" : "NO") << endl;
}

ll combination(ll n)
{
    return n * (n - 1) / 2;
}

int main(void)
{
    ll n;
    cin >> n;
    vll a(n);
    rep(i, 0, n) cin >> a[i];
    vll sum(n + 1, 0);
    map<ll, ll> mp;
    mp[0]++;
    rep(i, 1, n + 1) sum[i] = sum[i - 1] + a[i - 1], mp[sum[i]]++;
    ll ans = 0;
    for (auto x : mp)
    {
        if (x.second >= 2)
            ans += combination(x.second);
    }
    cout << ans << endl;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
#define int long long
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    int N;cin>>N;
    int count = 0;
    for(int i=0;i<N;i++){
        int a, b; cin>>a>>b;
        if(a==b){
            count++;
        }else{
            count=0;
        }
        if(count==3){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
            cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define INF 990000000

using namespace std;

int main() {
    // 頂点数と辺数
    int N; 
int a[3][3];
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
cin >> a[i][j];
}
}
cin >>N;
//int b[N];
int b;

for(int i=0;i<N;i++){
cin>>b;

for(int k=0;k<3;k++){
for(int j=0;j<3;j++){
if(a[k][j]==b){a[k][j]=-1;
//cout << "dddd"<<b;
}
}
}

}
/*
for(int k=0;k<3;k++){
for(int j=0;j<3;j++){
cout << a[k][j]<<" ";
}
cout << "\n";
}*/




if(a[0][0]+a[0][1]+a[0][2]==-3 || a[1][0]+a[1][1]+a[1][2]==-3||
a[2][0]+a[2][1]+a[2][2]==-3 || a[0][0]+a[1][0]+a[2][0]==-3 ||
a[0][1]+a[1][1]+a[2][1]==-3 || a[0][2]+a[1][2]+a[2][2]==-3 ||
a[0][0]+a[1][1]+a[2][2]==-3 || a[0][2]+a[1][1]+a[2][0]==-3)
cout << "Yes";
else
cout << "No";

}


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

int main()
{
    int i,cnt=0;
    char s[100];
    cin>>s;

    for(i=0;i<strlen(s);i++)
    {
        if((i+1)%2==1&&(s[i]=='R'||s[i]=='U'||s[i]=='D'))
        {
            cnt++;
        }
        if((i+1)%2==0&&(s[i]=='L'||s[i]=='U'||s[i]=='D'))
        {
            cnt++;
        }
    }
    if(cnt==strlen(s))
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

int main(){
    int H, W, D; cin >> H >> W >> D;
    vector<vector<int>> a(H, vector<int>(W));
    vector<pair<int, int>> b(H * W + 1);//逆引き用
    rep(i, H)rep(j, W){
        int num;
        cin >> num;
        b[num] = make_pair(i, j);
        a[i][j] = num;
    }
    // rep(i, H * W){
    //     cout << i + 1 << endl;
    //     cout << b[i + 1].first << "," << b[i + 1].second<<endl;
    // }
    vector<vector<int>> cost(D + 1);
    for(int i = 1; i <= D; i++){
        int k = 1;
        cost[i].push_back(0);
        while(i + k * D <= H * W){
            cost[i].push_back(abs(b[i + k * D].first - b[i + (k - 1) * D].first) + abs(b[i + k * D].second - b[i + (k - 1) * D].second) + cost[i][k - 1]);
            k++;
        }
    }

    // rep(i, D + 1){
    //     rep(j, cost[i].size())cout << cost[i][j] << " ";
    //     cout << endl;
    // }

    int Q;
    cin >> Q;
    vector<int> ans;
    rep(i, Q){
        int L, R; cin >> L >> R;
        int t = L % D;
        if(t == 0) t = D;
        R -= D;
        L -= D;
        ans.push_back(cost[t][(R + (D - 1)) / D] - cost[t][(L + (D - 1)) / D]);
    }
    rep(i, Q)cout << ans[i] << endl;
}


Measured memory_bytes: 6912
use std::io;
use std::str::FromStr;

fn input_tuple() -> (u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn main() {
    let (x, a) = input_tuple();
    if x < a {
        println!("0");
    } else {
        println!("10");
    }
}


Measured memory_bytes: 2152
package main

import "fmt"

func main() {
	var n_5 int
	var n_7 int

	t := make([]int, 3)

	fmt.Scan(&t[0], &t[1], &t[2])

	for i := 0; i < 3; i++ {
		if t[i] == 5 {
			n_5++
		} else if t[i] == 7 {
			n_7++
		}
	}

	if n_5 == 2 && n_7 == 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,x,count;
  count = 0;
  cin >> N >> x;
  vector<int>a(N);
  for(int i = 0; i< N; i++){
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  for(int i = 0; i< N-1; i++){
    x = x - a.at(i);
    count++;
    if (x < 0){
      break;
    }else if(i == N-2){
      count++;
      if(a.at(N-1) == x){
        count++;
      }
      }
    
  }
  cout << count-1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  ll a;
  string b;
  cin>>a>>b;
  ll ans=0;
  ans+=(b[0]-'0')*100;
  ans+=(b[2]-'0')*10;
  ans+=(b[3]-'0')*1;
  ans*=a;
  cout<<ans/100<<endl;
  return(0);
}


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin>>n;
  (n%2)?cout<<n/2+1<<endl:cout<<n/2<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};

auto cmp=[](const string&a,const string&b)
{
    return a<b;
};

map<string,int> mymap;

int main()
{
    int n;
    cin >> n;
    vector<string> mem;
    string s;
    
    rep(i,n){
        cin >> s;
        if(mymap[s] == 0) mem.pb(s);
        mymap[s]++;
        //cout << s << " " << mymap[s] << endl;
    }

    int M = 0;
    int size = mem.size();
    rep(i,size){
      M = max(mymap[mem[i]], M);
    }

    //cout << M << endl;

    vector<string> ans;
    rep(i,size){
        if(mymap[mem[i]] == M) ans.pb(mem[i]); //cout << "OK" << endl; }
    }

    sort(ans.begin(), ans.end());
    rep(i,ans.size()){
        cout << ans[i] << endl; 
    }
}

Measured memory_bytes: 28400
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 100005;

struct edge{
	int x,nxt;
}e[N*2];
int h[N],tot;
int n;
int a[N];
int d[N];
LL c[N];
bool ans;

void inse(int x,int y){
	e[++tot].x=y;
	e[tot].nxt=h[x];
	h[x]=tot;
}

LL maxll(LL x,LL y){
	return x>y?x:y;
}

bool bz[N];
int fa[N];

void dfs(int x){
	bz[x]=1;
	if (d[x]==1){c[x]=a[x];return;}
	for(int p=h[x];p;p=e[p].nxt)
	if (!bz[e[p].x]){
		fa[e[p].x]=x;
		dfs(e[p].x);
	}
	LL s=0,mv=0;
	for(int p=h[x];p;p=e[p].nxt)
	if (fa[e[p].x]==x){
		s+=c[e[p].x];
		mv=maxll(mv,c[e[p].x]);
	}
	LL k=s-a[x];
	if (k<0)ans=0;
	c[x]=s-k*2;
	if (c[x]<0)ans=0;
	if (mv>s/2&&s-mv<k)ans=0;
}

int main(){
	n=get();
	fo(i,1,n)a[i]=get();
	fo(i,2,n){
		int x=get(),y=get();
		inse(x,y);
		inse(y,x);
		d[x]++,d[y]++;
	}
	if (n==2){
		if (a[1]==a[2])printf("YES\n");
		else printf("NO\n");
		return 0;
	}
	int rt;
	fo(i,1,n)
	if (d[i]>1){rt=i;break;}
	ans=1;
	dfs(rt);
	ans&=(c[rt]==0);
	if (ans)printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 6912
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        if (s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21716
n = int(input())


def divisor(x):
    div = []
    div_append = div.append
    for i in range(1, int(x**.5)+1):
        if x % i == 0:
            div_append(i)
            div_append(x//i)
    div.sort()
    return div

ans = 0
for i in range(1, n+1, 2):
    if len(divisor(i)) == 8:
        ans += 1
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
//#define N 500005
#define inf 1000000005
#define mod 1000000007
#define put putchar('\n')
#define F(i,a,b) for (int i=a;i<=b;i++)
#define D(i,a,b) for (int i=a;i>=b;i--)
#define go(i,t) for (int i=head[t];i;i=Next[i])
#define sqr(x) ((x)*(x))
#define re register
#define mp make_pair
#define fi first
#define se second
#define int ll
using namespace std;
inline int read(){char c=getchar();int tot=1;while ((c<'0'|| c>'9')&&c!='-') c=getchar();if (c=='-'){tot=-1;c=getchar();}
int sum=0;while (c>='0'&&c<='9'){sum=sum*10+c-'0';c=getchar();}return sum*tot;}
inline void wr(int x){if (x<0) {putchar('-');wr(-x);return;}if(x>=10)wr(x/10);putchar(x%10+'0');}
inline void wrn(int x){wr(x);put;}inline void wri(int x){wr(x);putchar(' ');}
inline void wrn(int x,int y){wri(x);wrn(y);}
int n,m,k,num,ans;
signed main(){
	n=read();k=read();
	num=n/k;
	ans=num*num*num;
	if (!(k&1)){
		num=(n+k/2)/k;
		ans=ans+num*num*num;
	}
	wrn(ans);
	return 0;
}

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

using namespace std;

typedef long long int lli;

map<lli, lli> prime_factor(lli n){
  map<lli, lli> res;
  for (lli i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ++res[i];
      n /= i;
    }
  }
  if (n != 1) res[n] = 1;
  return res;
}

int main(int argc, char const *argv[]) {
  lli n, ans=1, divs = 1000000007;
  cin >> n;
  map<lli, lli> mp;

  for (lli i = 1; i <= n; i++) {
    map<lli,lli> pf = prime_factor(i);
    for(auto x : pf){
      mp[x.first] += x.second;
    }
  }
  for (auto x : mp) {
    ans *= x.second+1;
    ans %= divs;
  }

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


Measured memory_bytes: 256