akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

void out_put(int ans[], int d) {
  for ( int i = 0; i < d; i++ ) {
    printf("%d\n", ans[i]+1);
  }
}

double now_time(clock_t start, clock_t end) {
  return ((double)(end - start) / CLOCKS_PER_SEC);
}

int main() {
  clock_t start = clock();

  int d;
  int c[26];
  int last[26];
  scanf("%d", &d);
  for ( int i = 0; i < 26; i++ ) {
    scanf("%d", &c[i]);
    last[i] = 0;
  }
  int s[d][26];
  for ( int i = 0; i < d; i++ ) {
    for ( int j = 0; j < 26; j++ ) {
      scanf("%d", &s[i][j]);
    }
  }

  // greedy
  int now = 0;
  int val = 0;
  int t[d];
  while ( now < d ) {
    int mx = - (1e9 + 7);
    int select;
    for ( int k = 0; k < 26; k++ ) {
      int val_tmp = val;
      int now_tmp = now;
      int contest = k;
      val_tmp += s[now_tmp][contest];
      now_tmp++;
      for ( int i = 0; i < 26; i++ ) {
        if ( contest == i ) { continue; }
        val_tmp -= c[i]*(now_tmp-last[i]);
      }
      if ( val_tmp > mx ) {
        mx = val_tmp;
        select = contest;
      }
    }
    t[now] = select;
    now++;
    last[select] = now;
    val = mx;
  }

  // local search
  clock_t end;
  random_device rnd;
  mt19937 mt(rnd());
  uniform_int_distribution<> rand_day(0, d-1);
  uniform_int_distribution<> rand_contest(0, 25);

  end = clock();
  while ( now_time(start, end) < 1.5 ) {
    int change_day = rand_day(mt);
    int after_contest = rand_contest(mt);
    int val_tmp = val;

    int bef_contest = t[change_day];
    t[change_day] = after_contest;
    val_tmp -= s[change_day][bef_contest];
    val_tmp += s[change_day][after_contest];
    
    int last_bef_front = -1;
    for ( int i = change_day-1; i >= 0; i-- ) {
      if ( t[i] == bef_contest ) { last_bef_front = i; break; }
    }
    int last_bef_back = d;
    for ( int i = change_day+1; i < d; i++ ) {
      if ( t[i] == bef_contest ) { last_bef_back = i; break; }
    }
    val_tmp += c[bef_contest]*((change_day-last_bef_front)*(2+(change_day-last_bef_front-1))/2);
    val_tmp += c[bef_contest]*((last_bef_back-change_day)*(2+(last_bef_back-change_day-1))/2);
    val_tmp -= c[bef_contest]*((last_bef_back-last_bef_front)*(2+(last_bef_back-last_bef_front-1))/2);

    int last_after_front = -1;
    for ( int i = change_day-1; i >= 0; i-- ) {
      if ( t[i] == after_contest ) { last_after_front = i; break; }
    }
    int last_after_back = d;
    for ( int i = change_day+1; i < d; i++ ) {
      if ( t[i] == after_contest ) { last_after_back = i; break; }
    }
    val_tmp -= c[after_contest]*((change_day-last_after_front)*(2+(change_day-last_after_front-1))/2);
    val_tmp -= c[after_contest]*((last_after_back-change_day)*(2+(last_after_back-change_day-1))/2);
    val_tmp += c[after_contest]*((last_after_back-last_after_front)*(2+(last_after_back-last_after_front-1))/2);

    if ( val_tmp > val ) {
      val = val_tmp;
    } else {
      t[change_day] = bef_contest;
    }

    end = clock();
  }

  // ans
  out_put(t, d);

  return 0;
}


Measured memory_bytes: 3888
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, K, = map(int, input().split())

m = [0] * K
for v in range(1, N + 1):
    m[v % K] += 1

ans = 0
for v in range(1, K + 1):
    b = (K - v) % K
    c = (K - v) % K
    if (b + c) % K != 0:
        continue
    ans += m[v % K] * m[b] * m[c]
print(ans)

Measured memory_bytes: 4852
import java.util.Scanner;
public class Main {
	static int[] Shichigo = new int[1100000];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int s,cnt = 0;
		s = N;
		for(int i = 0;i < 4;i ++) {
			if((s % 10) == 2) cnt++;
			//System.out.println(s%10);
			s = s / 10;
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 27860
#include <stdio.h>
#include <string.h>

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

	int ans[256] = {0};
	for (int i = 0; i < N; i++) {
		char str[8];
		scanf("%s", str);
		ans[str[0]]++;
	}

	printf("AC x %d\n", ans['A']);
	printf("WA x %d\n", ans['W']);
	printf("TLE x %d\n", ans['T']);
	printf("RE x %d\n", ans['R']);

	return 0;
}


Measured memory_bytes: 1732
#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 max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#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
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; }

signed main(){
    int a,b,x;
    cin>>a>>b>>x;
    bool ok=1;
    if(x<a) ok=0;
    if(x>a+b) ok=0;
    cout<<(ok?"YES":"NO")<<endl;
}

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

int main(){

	int n;
	cin>>n;
	vector<double> A(n);
	double ans = 0;
	for(int i = 0; i<n; i++){
		cin>>A[i];
		ans+=1/A[i];
	}
	double res = 1/ans;
	cout<<res<<endl;

	return 0; 
}

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

int main(){
    int n; cin >> n;
    int binary[2] = {0}; for(int i = 0; i<n; ++i){
        int tmp; cin >> tmp;
        (tmp%2) ? ++binary[1] : ++binary[0];
    }
    cout << ((binary[1]%2) ? "NO" : "YES") << endl; return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var words = Console.ReadLine().Split(' ');

			var word = "";
			for(var i = 0; i < words.Length; i++)
			{
				word += (char)(words[i][0] - ('a' - 'A'));
			}

			Console.WriteLine(word);
		}
	}
}

Measured memory_bytes: 13140
using namespace std;
#include<bits/stdc++.h>
#define int long long
#define pb push_back 
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define repa(i,a,b) for (int i=a; i<=b; i++)
#define repd(i,b,a) for (int i=b; i>=a; i--)
#define endl "\n"
//debugging
#define debug1(a) cout<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

const int N = 1e+6+5;
int big = 1e+18+3;
int mod = 1e+9+7;

signed main()
{
    IOS;
        
    int n; cin>>n;
    int ar[n+1];
    repa(i,1,n)
        cin>>ar[i];
    sort(ar+1,ar+1+n,greater<int>());

    int ans = 0;

    ans+=ar[1];
    n-=2;
    int ind = 2;
    while(n)
    {
        ans+=ar[ind];
        n--;
        if (!n)
            break;
        ans+=ar[ind];
        n--;
        if (!n)
            break;
        ind++;
    }   

    cout<< ans <<endl;
}

Measured memory_bytes: 5220
#include<bits/stdc++.h>
using namespace std;
#define READ() freopen("in.txt","r",stdin)
#define pb(x) push_back(x)
#define mem(arr,val) memset(arr,val,sizeof(arr));
typedef long long ll;
struct data{
    bool ev;
    int val;
};
bool cmp(data a,data b)
{
    if(a.val<b.val)
        return true;
    if(a.val==b.val)
        return a.ev;
    return false;
}

int main()
{
//    READ();
    int w,a,b;
    cin>>w>>a>>b;


    if(b>a)
    {
            if(a+w>b)
            {
                cout<<0<<endl;
                return 0;
            }
        cout<<abs(a+w-b)<<endl;
    }
    else if(b<a){
            if(b+w>a)
            {
                cout<<0<<endl;
                return 0;
            }
        cout<<abs(b+w-a)<<endl;
    }
    else
        cout<<0<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <tuple>
#include <set>
#include <atcoder/dsu>

#define N_MAX (200000)

struct Compare {
  bool operator() (const std::tuple<int,int,int> &a, const std::tuple<int,int,int> &b) {
    return std::get<2>(a) < std::get<2>(b);
  }
};

int main() {
  int N;
  std::cin >> N;

  atcoder::dsu d(N);

  std::vector<std::tuple<int,int,int>> vec(N);
  for (int i = 0; i < N; i++) {
    int xi, yi;
    std::cin >> xi >> yi;
    vec[i] = std::make_tuple(i, xi, yi);
  }
  std::sort(vec.begin(), vec.end(), [](const std::tuple<int,int,int> &a, const std::tuple<int,int,int> &b) { return std::get<1>(a) < std::get<1>(b); });

  std::set<std::tuple<int,int,int>, Compare> st;
  st.insert(vec[0]);
  for (int i = 1; i < N; i++) {
    //std::cout << std::get<0>(vec[i]) << std::get<1>(vec[i]) << std::get<2>(vec[i]) << std::endl;
    bool find = false;
    for (const std::tuple<int,int,int> &a : st) {
      if (std::get<2>(a) < std::get<2>(vec[i])) {
        d.merge(std::get<0>(a), std::get<0>(vec[i]));
        find = true;
      } else {
        break;
      }
    }
    if (!find) st.insert(vec[i]);
  }
  for (int i = 0; i < N; i++) {
    std::cout << d.size(i) << std::endl;
  }
  return 0;
}


Measured memory_bytes: 10576
S = input()
T = input()

command = [S, T]
spel = [[], []]
counter = [[], []]

for i in range(2):
    for j in range(len(S)):
        if command[i][j] in spel[i]:
            counter[i][spel[i].index(command[i][j])].append(j)

        else:
            spel[i].append(command[i][j])
            counter[i].append([j])

print('Yes' if counter[0] == counter[1] else 'No')


Measured memory_bytes: 20272
using System;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] d = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int sum = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    sum = sum + d[i] * d[j];
                }
            }
            Console.WriteLine(sum.ToString());
        }
    }
}


Measured memory_bytes: 11348
#include <stdio.h>
int main(void){
    // Your code here!
    int n, a=1, b, c=0, i;
    scanf("%d",&n);
    
    while(a<=n){
        b=0;
        for(i=1;i<=a;i++){
            if(a%i==0) b++;
        }
        if((b==8)&&(a%2==1)) c++;
        a++;
    }
    printf("%d\n",c);
    return 0;
}

Measured memory_bytes: 128
//someshsingh22		
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define loop(i,n) for(int i = 0 ; i < n; i++)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL)
#define inp_int(n,arr) loop(i,n) cin >> arr[i];
#define inp_ll(n,arr) loop(i,n) cin >> arr[i];
#define out_int(n,arr) loop(i,n) printf("%d ",arr[i]);
#define out_ll(n,arr) loop(i,n) printf("%lld ",arr[i]); cout << endl;
#define all(c) c.begin(),c.end()
// Snippets : BFS, DFS, edger, ncr, chef, inverse, sieve, lis-d*, mat_d*, pow

typedef long long ll;
typedef pair<int, int> ii; 
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

ll dp[(int)1e5+1]={0};
ll arr[(int)1e5+1]={0};
int k;
void update(int index)
{
	ll up=ll(1e10);
	for(int i=1; i<=k && index>=i; i++)
		up=min(up,dp[index-i]+abs(arr[index]-arr[index-i]));
	dp[index]=up;
}

int main ()
{
	FAST;
	int n; cin >> n >> k;
	inp_ll(n,arr);

	dp[1]=abs(arr[1]-arr[0]);

	for(int i = 2; i<n; i++)
		update(i);
	cout << dp[n-1];
	return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main()
{
    int sum, i, n, t;
    while (1) {
	scanf("%d", &n);
	if (n == 0)
	    return 0;

	for (sum = 0, i = 0; i < n / 4; i++) {
	    scanf("%d", &t);
	    sum += t;
	}
	printf("%d\n", sum);
    }
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=100003,INF=1<<30;

int main(){

    string S;cin>>S;
    int K;cin>>K;
    int N=int(S.size());
    int dp[N+1][2],dp2[N+1][2];
    for(int i=0;i<=N;i++){
        dp[i][0]=INF;
        dp[i][1]=INF;
    }
    dp[0][0]=0;
    dp[0][1]=0;
    dp[1][0]=0;
    dp[1][1]=1;
    
    for(int i=1;i<N;i++){
        if(S[i-1]==S[i]){
            dp[i+1][0]=dp[i][1];
            dp[i+1][1]=min(dp[i][0]+1,dp[i][1]+1);
        }else{
            dp[i+1][0]=min(dp[i][0],dp[i][1]);
            dp[i+1][1]=min(dp[i][0]+1,dp[i][1]+1);
        }
    }
    
    if(S[0]!=S[N-1]) cout<<ll(min(dp[N][0],dp[N][1]))*ll(K)<<endl;
    else{
        bool ok=true;
        for(int i=1;i<N;i++){
            if(S[i]!=S[0]) ok=false;
        }
        
        if(ok){
            cout<<ll(N)*ll(K)/2<<endl;
        }else{
            ll ans1=ll(dp[N][1])*ll(K-1)+ll(min(dp[N][0],dp[N][1]));
            
            for(int i=0;i<=N;i++){
                dp2[i][0]=INF;
                dp2[i][1]=INF;
            }
            dp2[0][0]=0;
            dp2[0][1]=0;
            dp2[1][0]=10000;
            dp2[1][1]=1;
            
            for(int i=1;i<N;i++){
                if(S[i-1]==S[i]){
                    dp2[i+1][0]=dp2[i][1];
                    dp2[i+1][1]=min(dp2[i][0]+1,dp2[i][1]+1);
                }else{
                    dp2[i+1][0]=min(dp2[i][0],dp2[i][1]);
                    dp2[i+1][1]=min(dp2[i][0]+1,dp2[i][1]+1);
                }
            }
            
            ll ans2=ll(min(dp[N][0],dp[N][1]))+ll(min(dp2[N][0],dp2[N][1]))*ll(K-1);
            
            cout<<min(ans1,ans2)<<endl;
        }
    }
    //cout<<min(dp[N][0],dp[N][1])<<endl;
    
}




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

int main() {
    int N; cin >> N;
    vector<int> v(N), c(N);
    for (int i = 0; i < N; i++) cin>> v[i];
    for (int i = 0; i < N; i++) cin>> c[i];
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if(v[i]-c[i]>0) ans += v[i]-c[i];
    }
    cout << ans << endl;
        
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int

	fmt.Scan(&n)
	a := make([]int, n+1)
	b := make([]int, n)

	for i := 0; i < n+1; i++ {
		fmt.Scan(&a[i])
	}
	for i := 0; i < n; i++ {
		fmt.Scan(&b[i])
	}

	var ans int64

	for i := 0; i < n; i++ {
		var c int
		if a[i] > b[i] {
			c = b[i]
		} else {
			c = a[i]
		}
		b[i] -= c
		ans += int64(c)
		if a[i+1] > b[i] {
			c = b[i]
		} else {
			c = a[i+1]
		}
		a[i+1] -= c
		ans += int64(c)
	}
	fmt.Println(ans)
}


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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> p(n);
  for(int i = 0;i < n;i++){
    cin >> p[i];
    a[i] = (i + 1) * n;
    b[i] = n * (n - i);
  }
  for(int i = 0;i < n;i++){
    b[p[i] - 1] += i;
  }

  for(auto i : a){
    cout << i << ' ';
  }cout << endl;
  for(auto i : b){
    cout << i << ' ';
  }cout << endl;
}


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

#ifdef SG
	#include <debug.h>
#else
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define forv(i,v) for (auto i = v.begin(); i != v.end(); ++i)
#define forr(i,v) for (auto i = v.end(); i != v.begin() && (--i, 1); )
#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned char uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

const ld pi = 3.1415926535897932384626433832795l;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T> inline T abs (T x) {return x > T() ? x : -x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

const int N = 200000;
int rightmin[N];
int leftmax[N];
int sorted[N];
int n, k;
int p[N];
int obrp[N];

int main () {
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(nullptr);
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);
#ifdef SG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
	cin >> n >> k;
	forn(i, n) {
		cin >> p[i];
		obrp[p[i]] = i;
	}
	for (int i = 0; i < n;) {
		int j = i;
		for (; j < n && p[max(i, j - 1)] <= p[j]; ++j);
		for (int k = i; k < j; ++k) {
			sorted[k] = j - 1;	
		}
		i = j;
	}
	debug(sorted, sorted + n);
	set<int> s;
	memset(leftmax, -1, sizeof(leftmax));
	ford(val, n) {
		int pos = obrp[val];
		auto it = s.lower_bound(pos);
		if (it != s.begin()) {
			leftmax[pos] = *(--it);
		}
		s.insert(pos);
	}
	s.clear();
	memset(rightmin, 1, sizeof(rightmin));
	forn(val, n) {
		int pos = obrp[val];
		auto it = s.lower_bound(pos);
		if (it != s.end()) {
			rightmin[pos] = *it;
		}
		s.insert(pos);
	}
	bool is_sorted = false;
	int ans = 0;
	debug(rightmin, rightmin + n);
	debug(leftmax, leftmax + n);
	forn(i, n - k + 1) {
		if (sorted[i] >= i + k - 1) {
			is_sorted = true;
			continue;		
		}
		if (i == 0 || !(rightmin[i - 1] > i + k - 1 && leftmax[i + k - 1] < i - 1)) {
			++ans;
		}
	}
	debug(ans);
	if (is_sorted) {
		++ans;
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  double n, t, a;
  cin >> n;
  cin >> t >> a;
  vector<double> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  for (int i = 0; i < n; i++) {
    vec.at(i) = t - vec.at(i) * 0.006;
  }

  double min_diff = 10000000;
  int index = 0;
  for (int i = 0; i < n; i++) {
    auto diff = fabs(vec.at(i) - a);
    if (min_diff > diff) {
      min_diff = diff;
      index = i;
    }
  }
  cout << index + 1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int n , a[N] , dp[N];
int calc(int i){
    if(i == n - 1)
        return 0;
    if(i >= n)
        return 1e9 + 10;
    int &ret = dp[i];
    if(ret != -1)return ret;
    return ret = min( calc(i + 1) + abs(a[i] - a[i + 1]) , calc(i + 2) + abs(a[i] - a[i + 2]) ); 
}
int main(){
    scanf("%d", &n);
    for(int i = 0 ; i < n ; i++){
        scanf("%d", &a[i]);
    }
    memset(dp , -1 , sizeof dp);
    cout<<calc(0);
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#define _USE_MATH_DEFINENS
#include <cmath>
using namespace std;

#define p(x) cout << x << endl;
#define el cout << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    char x, y;
    cin >> x >> y;
    if(x == y){
        cout << '=' << endl;
    }else if(x < y){
        cout << '<' << endl;
    }else{
        cout << '>' << endl;
    }
}


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

int dfs(int idx,int n,vector<int> &mine,vector<int> &tar){
    if(idx==n) return 0;
    int dist=tar[idx]-mine[idx];
    if(dist==0) return dfs(idx+1,n,mine,tar);
    int res=10000;
    for(int i=idx;i<n;i++){
        mine[i]=(mine[i]+dist)%10;
        res=min(res,dfs(idx+1,n,mine,tar)+1);
    }
    for(int i=idx;i<n;i++){
        mine[i]=(mine[i]+10-dist)%10;
    }
    return res;
}
int solve(int n,vector<int> mine,vector<int> tar){
    return dfs(0,n,mine,tar);
}
int main(){
    int n;
    while(cin>>n,n){
        string a,b;
        cin>>a>>b;
        vector<int> mine(n);
        vector<int> tar(n);
        for(int i=0;i<n;i++){
            mine[i]=a[i]-'0';
            tar[i]=b[i]-'0';
        }
        cout<<solve(n,mine,tar)<<endl;
    }
    return 0;
}


Measured memory_bytes: 3160
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<utility>
#include<queue>
#include<stdbool.h>
#include<math.h>
#include<sstream>
typedef long long ll;
#define N (1000000000+7)
using namespace std;
typedef pair<int, int> P;
#define INF (-1000)

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

int num[110] = { 0 };

int main(void) {
	int n, y;
	cin >> n >> y;
	for (int i = 0;i <= 2000;i++) {
		for (int j = 0;j <= 2000;j++) {
			if ((n-i-j>=0)&&(10000 * i + 5000 * j + 1000 * (n - i - j) == y)) {
				cout << i << " " << j << " " << n - i - j << endl;
				return 0;
			}
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
from collections import Counter
def input(): return sys.stdin.readline().rstrip()
def main():
    n,k,q=map(int,input().split())
    A=[int(input())for _ in range(q)]
    A_C=Counter(A)

    for i in range(n):
        if k-q+A_C[i+1]>0:print("Yes")
        else:print("No")

if __name__=='__main__':
    main()

Measured memory_bytes: 11892
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include <numeric>
using namespace std;

int main()
{	
	long long int N;
	long long int P;
	scanf("%lld %lld", &N, &P);

	long long int soin[1000000][2];
	for(long long int i=0;i<1000000;i++){
		soin[i][0]=0;
		soin[i][1]=0;
	}
	if(N!=1){
	long long int p=2;
	long long int counter=0;
	while(p<=1000000){
		if(P%p==0)
		{	
			P=P/p;
			soin[counter][0]=p;
			soin[counter][1]++;
		}
		else
		{
			if(soin[counter][0]!=0){counter++;}
			p++;
		}
	}
	if(soin[0][0]==0){
		soin[0][0]=P;
		soin[0][1]=1;
	}
		
		
	long long int ans=1;
	for(long long int i=0;i<1000000;i++){
		
			if((soin[i][1])/N!=0)
			{
					ans=ans*pow(soin[i][0],(soin[i][1])/N);
			}
		
	}
	
	printf("%lld", ans);
	}
	else{
		printf("%lld", P);
		}
}


Measured memory_bytes: 16000
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a[n];
	int mazrab2 = 0;
	int mazrab4 = 0;
	int hich = 0;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++){
		if (a[i] % 4 == 0) mazrab4 ++;
		else if(a[i] % 2 == 0) mazrab2 ++;  
		else hich ++;
	}
	if (mazrab4 == 0 && hich > 0){
		cout << "No";
		return 0;
	}
	else if (mazrab2 == 0 && hich == mazrab4 + 1){
		cout << "Yes";
		return 0;
	}
	else if(mazrab4 < hich){
		cout << "No";
		return 0;
	}
	
	else cout << "Yes";
	return 0;
	
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int (i) = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int (i) = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int (i) = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define Pi 3.1415926535
#define MOD = 1e9+7;
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}



int solve(){
    int x,y,a,b,c; cin >> x >> y >> a >> b >> c;
    vector<ll> p(a), q(b), r(c);
    rep(i,a) cin >> p[i];
    rep(i,b) cin >> q[i];
    rep(i,c) cin >> r[i];
    sort(all(p),greater<>());
    sort(all(q),greater<>());
    
    rep(i,x) r.pb(p[i]);
    rep(i,y) r.pb(q[i]);
    sort(all(r),greater<>());

    cout << accumulate(r.begin(),r.begin()+x+y,0ll) << endl;
     

    return 0;
}

int main(){
    cin.tie(0);
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 6384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/abc158/tasks/abc158_b>
 問題文============================================================
 B - Count Balls
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N,A,B; cin >> N >> A >> B;
    
    res += N/(A+B) * A;
    N %= (A+B);
    res += min(N,A);
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	std::cin >> a;
}
template<class _T> static void getint(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}

static void Keyence2020B();

int main()
{
	Keyence2020B();
	fflush(stdout);
	return 0;
}

static void Keyence2020B()
{
	int N;
	getint(N);

	std::vector<std::pair<int, int>> robots(N);
	for (int i = 0; i < N; i++) {
		getint(robots[i].first, robots[i].second);
	}

	std::sort(robots.begin(), robots.end(),
		[](const std::pair<int, int>& a, const std::pair<int, int>& b) {
		return a.first < b.first;
	});

	int ans = 1;
	int lastR = robots[0].first + robots[0].second;
	for (int i = 2; i <= N; i++) {
		int nowLeft = robots[i - 1].first - robots[i - 1].second;
		int nowRight = robots[i - 1].first + robots[i - 1].second;
		if (nowLeft >= lastR) {
			ans++;
			lastR = nowRight;
		}
		else if (nowRight < lastR) {
			lastR = nowRight;
		}
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>

using namespace std;

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

#define RANGE(a,i,b) ((a)<=(i)&&(i)<=(b))

#define pb push_back
#define mp make_pair

#define ALL(a) (a).begin(), (a).end()

#define SET(a,c) memset(a,c,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))

#define INF 1001001001
#define LLINF 1001001001001001001LL

typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

#define PQ priority_queue

#define FST first
#define SEC second

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

//------------------HEAD---------------------

int dp[101][101][2][2];


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

    int w,h;
    while(cin>>w>>h,w||h){
    rep(i,w)rep(j,h)rep(k,2)rep(l,2)dp[i][j][k][l]=0;
    dp[0][0][0][0]=1;
    dp[0][1][0][0]=1;
    dp[1][0][1][0]=1;   


    rep(x,w)rep(y,h){
        if(!x&&!y)continue;
        dp[x+1][y][1][1]+=dp[x][y][0][0]%100000;
        dp[x][y+1][0][0]+=dp[x][y][0][0]%100000;

        dp[x][y+1][0][0]+=dp[x][y][0][1]%100000;

        dp[x+1][y][1][0]+=dp[x][y][1][0]%100000;
        dp[x][y+1][0][1]+=dp[x][y][1][0]%100000;

        dp[x+1][y][1][0]+=dp[x][y][1][1]%100000;
    }

    cout<<(dp[w-1][h-1][0][0]+dp[w-1][h-1][1][0]+dp[w-1][h-1][0][1]+dp[w-1][h-1][1][1])%100000<<endl;
    
    }
    return 0;
}


Measured memory_bytes: 3164
/*
* @author:  codancer
* @createTime:  2020-06-22, 08:43:48
*/
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
#define pb push_back
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define fep(i,a,b) for(int i=(a);i>=(b);i--)
typedef vector<int> VI;
typedef vector<ll> VII;
typedef pair<int,int> pii;
int main(){
	int n;
	scanf("%d",&n);
	vector<int> a(n+1),pre(n+1),suf(n+1);
	rep(i,1,n) scanf("%d",&a[i]);
	rep(i,1,n) pre[i]=pre[i-1]^a[i];
	fep(i,n,1) suf[i]=suf[i+1]^a[i];
	rep(i,1,n){
		printf("%d ", pre[i-1]^suf[i+1]);
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 5620
import sys
from itertools import accumulate
from collections import Counter
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
s_ls = [i for i in accumulate([0] + a_ls)]
ct = Counter(s_ls)

def nC2(n):
    return n * (n - 1) // 2

res = 0
for k, v in ct.items():
    res += nC2(v)
print(res)

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

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

const int mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 11


int main()
{
    int n; cin >> n;
    vector<int> six;
    vector<int> nine;
    int tmp = 6; 
    while(tmp <= 100005){
        six.push_back(tmp);
        tmp *= 6;
    }
    tmp = 9;
    while(tmp <= 100005){
        nine.push_back(tmp);
        tmp *= 9;
    }
    int dp[n+1];
    dp[0] = 0;
    for(int i = 1 ; i <= n; i++){
        dp[i] = dp[i-1]+1;
        for(auto s : six){
            if(i - s >= 0){
                dp[i] = min(dp[i],dp[i-s]+1);
            }
        }
        for(auto x : nine){
            if(i - x >= 0){
                dp[i] = min(dp[i],dp[i-x]+1);
            }
        }
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

ll x[110000],y[110];
main(){
  ll n,k,tmp,ans=1e15;
  cin>>n>>k;
  rep(i,0,n)cin>>x[i];
  rep(i,0,n-k+1){
    if(x[i]>=0)tmp=x[i+k-1];
    else if(x[i+k-1]<0)tmp=-x[i];
    else if(x[i+k-1]>0&&x[i]<0)tmp=x[i+k-1]-x[i]+min(x[i+k-1],-x[i]);
    ans=min(ans,tmp);
  }
  cout<<ans;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using CHY72;

namespace CHY72{
    
    public class PointXY<T>where T:IComparable {
        public T X , Y;
        public bool Flag = false;
        public PointXY(T _X,T _Y) {
            X = _X; Y = _Y;
        }
        public static bool operator ==(PointXY<T> P1, PointXY<T> P2) {
            return (P1.X.CompareTo( P2.X) == 0 && P1.Y.CompareTo (P2.Y) == 0);
        }
        public static bool operator !=(PointXY<T> P1, PointXY<T> P2) {return !(P1 ==P2);}
        public override int GetHashCode() {return X.GetHashCode() ^ Y.GetHashCode();}
        public override bool Equals(object obj) {
            if (obj == null || this.GetType() != obj.GetType()) {return false;}
            return (this == (PointXY<T>)obj);
        }         

    }
    
}    

public class Program {
    static bool ReadLine_1(ref int num1, bool Fin0 = true) {
        string str = Console.ReadLine();
        num1 = int.Parse(str);
        return (Fin0 && num1 == 0);
    }
    static int  ReadLine_1() {
        return  int.Parse(Console.ReadLine());
    }
    static bool ReadLine_2(ref int num1, ref int num2, char Spliter = ' ', bool Fin0 = true) {
        string str = Console.ReadLine();
        num1 = int.Parse(str.Split(Spliter)[0]);
        num2 = int.Parse(str.Split(Spliter)[1]);
        return (Fin0 && num1 == 0);
    }
    static int[] ReadLine72(char Spliter = ' ') {
        return Console.ReadLine().Split(Spliter).Select(s => int.Parse(s)).ToArray();
    }

    const int DefaultMax = 727272;



    static void Main(string[] args) {
        int iMax = ReadLine_1();
        var IDs = new string[iMax];
        //var IDs = new Dictionary<string,bool>();
        for (int i = 0; i < iMax; i++) {
            IDs[i] = Console.ReadLine();
            //IDs.Add( Console.ReadLine(),false );
        }
        iMax = ReadLine_1();
        bool isOpen = false;
        for (int i = 0; i < iMax; i++) {
            string Commer = Console.ReadLine();
            //if (IDs.ContainsKey(Commer)) {
            if (IDs.Contains(Commer)) {
                if (!isOpen ) { Console.WriteLine("Opened by " + Commer); }
                else { Console.WriteLine("Closed by " + Commer); }
                isOpen = !isOpen;
            }else {
                Console.WriteLine("Unknown " + Commer);
            
            }
        
        }

    }
}

Measured memory_bytes: 7532
l, r = gets.split.map(&:to_i)

ans = 2018
j_divided_zero = false

l.upto(r - 1) do |i|
  if j_divided_zero || i % 2019 == 0
    ans = 0
    break
  end

  break if j_divided_zero == true

  (i + 1).upto(r) do |j|
    if j % 2019 == 0
      j_divided_zero = true
      break
    end

    p = i % 2019 * j % 2019
    ans = p if p <= ans
  end
end

puts ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long;
using llint = long long;
using namespace std;

int main() {
    fastIO;
    lint n, k, x, y;
    cin >> n >> k >> x >> y;
    if (n < k)
        cout << n * x << endl;
    else
        cout << k * x + (n - k) * y << endl;
}



Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <tuple>
using namespace std;

constexpr int INF = 1e9;


int main() {
    // idx, num, dis 
    using data = tuple<int, int, int>;
    int n;
    while(cin >> n , n) {
        vector<int> p(n), t(n);
        for(int i=0; i<n; ++i) {
            cin >> p[i] >> t[i];
        }
        queue<data> que;
        if(p[0] <= t[0]) {
            que.push(make_tuple(0, 1, p[0]));
        }
        int ma_id = 1;
        vector<vector<int>> res(4, vector<int>(n+1, INF));
        res[1][0] = p[0];
        while(!que.empty()) {
            int id = 0, num = 0, dis = 0;
            data d = que.front(); que.pop();
            tie(id, num, dis) = d;
            ma_id = max(ma_id, id+2);
            if(id == n-1) {
                res[0][n] = min(res[0][n], dis + p[id]);
                continue;
            }
            if(t[id] + (num+1) * p[id] + p[id+1] <= t[id+1]) {
                if(dis + p[id] + p[id+1] < res[1][id+1]) {
                    res[1][id+1] = dis + p[id] + p[id+1];
                    que.push(make_tuple(id+1, 1, res[1][id+1]));
                }
            }
            if(num < 3) {
                if((num+1) * abs(p[id+1] - p[id]) <= t[id+1] - t[id]) {
                    if(dis + abs(p[id+1] - p[id]) < res[num+1][id+1]) {
                        res[num+1][id+1] = dis + abs(p[id+1] - p[id]);
                        que.push(make_tuple(id+1, num+1, res[num+1][id+1]));
                    }
                }
            }
        }
        if(res[0][n] != INF) {
            cout << "OK " << res[0][n] << endl;
        } else {
            cout << "NG " << ma_id << endl;
        }
    }
}


Measured memory_bytes: 3020
#include <bits/stdc++.h>
#define ll long long 
#define int long long
#define ld long double
using namespace std;
const ll INF = 1e18;
const ll MOD = 998244353;

vector<string> vec_splitter(string s) {
		s += ',';
		vector<string> res;
		while(!s.empty()) {
				res.push_back(s.substr(0, s.find(',')));
				s = s.substr(s.find(',') + 1);
		}
		return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
		if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
		stringstream ss; ss << H;
		cerr << args[idx] << " = " << ss.str();
		debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define deb(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define deb(...) 42
#endif

ll arr[200000];
vector<int> vec;
vector<vector<int>> edges;
bool vis[200000];

void dfs(int u){
	vis[u] = true;
	vec.push_back(u);
	for(auto v : edges[u]){
		if(!vis[v]){
			dfs(v);
		}
	}
}

int32_t main() {
	ios::sync_with_stdio(!cin.tie(NULL));

	int n, m;
	cin >> n >> m;
	for(int i = 0; i < n; i++)	cin >> arr[i];
	int u, v;
	edges.resize(n + 1);
	for(int i = 0; i < m; i++)	{
		cin >> u >> v;
		edges[u].push_back(v);
		edges[v].push_back(u);
	}
	memset(vis, false, sizeof(vis));
	int cc = 0;
	vector<vector<int>> now;
	for(int i = 0; i < n; i++){
		if(!vis[i]){
			vec.clear();
			dfs(i);
			cc++;
			now.push_back(vec);
		}
	}
	if((2*cc - 2) > n)	{
		cout << "Impossible" << "\n";
		return 0;
	}
	sort(now.begin(), now.end(), [&](vector<int> &x, vector<int>&y){
		return x.size() > y.size();
	});
	set<pair<int, int>> a, b;

	for(auto x : now[0])	a.insert({arr[x], x});
	int cur = 1;
	ll ans = 0;
	for(int i = 1; i < cc; i++){
		sort(now[i].begin(), now[i].end(), [&](int x, int y){
				return arr[x] < arr[y];
		});
		ans += (a.begin()->first) + arr[now[i][0]];
		a.erase(a.begin());
		for(int j = 1; j < now[i].size(); j++){
			a.insert({arr[now[i][j]], now[i][j]});
		}
	}
	cout << ans << "\n";
}



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

int main(){
  int N, X, Y;
  cin >> N >> X >> Y;

  vector<int> ans(N - 1 + 1);

  for(int i = 1; i <= N; i++){
    for(int j = i + 1; j <= N; j++){
      int k = min(j - i, abs(j - Y) + 1 + abs(i - X));
      ans[k]++;
    }
  }

  for(int k = 1; k <= N - 1; k++){
    cout << ans[k] << endl;
  }
  
}


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

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {

    val n = readInt()
    var isGood = false
    val s = n.toString()
    for(i in 0 until s.length - 2) {
        if(s[i] == s[i+1] && s[i] == s[i+2]) {
            isGood = true
        }
    }
    println(if(isGood) "Yes" else "No")
    pw.flush()
}

/****** Decrared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
    }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j] % MOD)
        }
    }
    return v.map { it.toList() }.toList()
}

fun gcd(a: Long, b: Long): Long = 
    if(b != 0L) a else gcd(b, a % b)

fun lcm(a: Long, b: Long) = 
    if(b==0L) a else gcd(b, a % b)

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


Measured memory_bytes: 33656
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(){
    string s,e="";
    cin>>s;
    for(ll i=0;i<s.size();i++){
        if(s[i]=='1') e+='1';
        else if(s[i]=='0') e+='0';
        else{
            if(e!="") e.pop_back();
        }
    }
    cout<<e<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void){
    char set[200];
    char copy[201];
    char tmp[200];
    char end[100] = "-";
    int m,h,i,j,k,len = 0;
    scanf("%s\n",set);
    while(strcmp(set,end) != 0){
        for(i=0;set[i] != '\0' && i < 200;i++) len++;
        scanf("%d",&m);
        for(i = 0; i<m;i++){
            strcpy(copy,set);
            scanf("%d",&h);
            for(j = 0;j < h;j++){
                tmp[j] = set[j];
            }
            for(j = 0;j < len - h;j++){
                set[j] = copy[j+h];
            }
            k = 0;
            for(j=len - h;j<len;j++){
                set[j] = tmp[k];
                k++;
            }
        }
        printf("%s\n",set);
        scanf("%s\n",set);
        len = 0;
    }
}

Measured memory_bytes: 604
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

///////////////////////////



int main() {
	ll N, K;
	cin >> N >> K;

	vector<ll> A(N + 1);
	repn(i, N) cin >> A[i];

	vector<vector<ll>> t(N + 1, vector<ll>(63));
	repn(i, N) t[i][0] = A[i];

	repn(j, 62)repn(i, N) {
		t[i][j] = t[t[i][j - 1]][j - 1];
	}

	ll ans = 1;
	rep(j, 63) {
		if ((K >> j) % 2 == 1) { ans = t[ans][j]; }
	}
	cout << ans << endl;



	system("PAUSE");

}

Measured memory_bytes: 109748
#include <iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    long long sum = 0;
    for (long long i = 1; i <= n; i++) {
        if (i % 3 == 0 || i % 5 == 0) {}
        else { sum += i;}
    }
    cout << sum;
}

Measured memory_bytes: 3624
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
int a[N];
int sum[N];
void init()
{
	a[0] = a[1] = 1;
	for (int i = 2; i < N; i++)
	{
		if (a[i]) continue;
		for (int j = i + i; j < N; j += i) a[j] = 1;
		if (a[i] == 0 && a[(i + 1) / 2] == 0) sum[i] = 1;
	}
	for (int i = 2; i < N; i++) sum[i] += sum[i - 1];

}
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int q;
	cin >> q;
	init();
	while (q--)
	{
		int l, r;
		cin >> l >> r;
		cout << sum[r] - sum[l - 1] << '\n';
	}
	return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000099;
const int OO = 0x3f3f3f3f;

int n, h[MAX];
int dist[MAX], k;

int dijkstra()
{
	memset(dist, 63, sizeof(dist));
	dist[0] = 0;
	priority_queue<array<int, 2>> pq;
	pq.push({0, 0});
	while(!pq.empty())
	{
		int u = pq.top()[1];
		int d = -pq.top()[0];
		pq.pop();
		if(d > dist[u]) continue;
		if(u == n - 1) return dist[n - 1];
		for(int i = u + 1; i <= min(u + k, n - 1); i++)
			if(dist[i] > dist[u] + abs(h[u] - h[i]))
			{
				dist[i] = dist[u] + abs(h[u] - h[i]);
				pq.push({-dist[i], i});
			}
	}
	return dist[n - 1];
}


int main()
{
	cin >> n >> k;
	for(int i = 0; i < n; i++)
		cin >> h[i];
	cout << dijkstra() << '\n';	
	

	return 0;
}

Measured memory_bytes: 7544