akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

func main() {
    var k, s int
    ans := 0

    fmt.Scan(&k, &s)

    for x := 0; x <= k; x++ {
        for y := 0; y <= k; y++ {
            if x + y > s { break }
            if s-x-y <= k { ans++ }
        }
    }
    fmt.Println( ans )
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);
typedef pair<int,int> P;
const int INF = 1001001001;


int main() {
  string s;
  cin >> s;
  rep(i,s.size()){
    if(s[i]=='?') s[i]='D';
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 3756
#include <stdio.h>
#include <stdlib.h>

#define N 10
#define INT(X) \
  ( *( (const int *)(X) ) )

int comparator (
  const void  * a,
  const void  * b
  )
{
  return ( INT( b ) - INT( a ) );
}

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int d[ N ];
  int i;

  for ( i = 0; i < N; ++i )
  {
    scanf ( "%d", d + i );
  }
  qsort ( d, N, sizeof ( int ), comparator );
  printf ( "%d ", d[ 0 ] + d[ 1 ] + d[ 2 ] );

  for ( i = 0; i < N; ++i )
  {
    scanf ( "%d", d + i );
  }
  qsort ( d, N, sizeof ( int ), comparator );
  printf ( "%d\n", d[ 0 ] + d[ 1 ] + d[ 2 ] );

  return ( 0 );
}

Measured memory_bytes: 0
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

#include "bits/stdc++.h"
using namespace std;

const int V = 100001;
vector<int> to[V*2];
bool visited[V*2];

vector<int> cnt;
void dfs(int v) {
	if(visited[v]) return;
	visited[v] = true;
	cnt[v/V]++;
	for (int u: to[v]) dfs(u);
}

int main() {
	int N;
	cin >> N;
	REP(i, N) {
		int x, y;
		cin >> x >> y;
		y += V;
		to[x].push_back(y);
		to[y].push_back(x);
	}
	long long int ans = 0;
	REP(i, V*2) {
		if (visited[i]) continue;
		cnt = vector<int>(2);
		dfs(i);
		ans += (long long int)cnt[0] * cnt[1];
	}
	ans -= N;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 10240
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;

int main() {
	string S;
	cin >> S;
	ll sum=0;

	rep(i, S.size()) {
		sum += (int)(S.at(i) - '0');
	}
	if (sum % 9 == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

typedef long long ll;

int T;
ll A, B, C, D;

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

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

	for (int i = 0; i < T; ++i) {
		scanf("%lld%lld%lld%lld", &A, &B, &C, &D);

		if (A < B || D < B) {
			printf("No\n");
			continue;
		}

		if (C >= B) {
			printf("Yes\n");
			continue;
		}

		ll d = gcd(D, B);
		if (B - d + A % d > C) printf("No\n");
		else printf("Yes\n");
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <cstdio>
#include <cmath>
#include <cassert>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
constexpr lnt INF = 2e18;
/*-*/

int main() {
	int n;
	std::cin >> n;
	std::vector<int> a(n);
	rep(i,n) std::cin >> a[i];
	std::vector<std::vector<int> > g(n);
	rep(i,n-1) {
		int x,y;
		std::cin >> x >> y;
		x--;y--;
		g[x].emplace_back(y);
		g[y].emplace_back(x);
	}
	if(n==2) {
		if(a[0]==a[1]) print("YES");
		else print("NO");
		return 0;
	}
	// take root to be a non leaf node
	auto dfs = [&] (auto f, int i, int par) -> int {
		if(g[i].size()==1) {
			return a[i];
		}
		int flow = 2*a[i];
		for(auto to:g[i]) {
			if(to==par) continue;
			int ret = f(f,to,i);
			if(ret==-1) return -1;
			if(2*a[i]-ret<ret) return -1;
			flow-=ret;
		}
		debug(flow);
		if(2*a[i]-flow<flow) return -1;
		if(flow<0) return -1;
		return flow;
	};
	int root=-1;
	rep(i,n) if(g[i].size()!=1) root=i;
	debug(root);
	int x = dfs(dfs,root,-1);
	debug(x);
	if(x==0) print("YES");
	else print("NO");
}


Measured memory_bytes: 9728
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LINF = 9223372036854775807;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int n; cin >> n;
	string s; cin >> s;
	string m="RGB";
	VVI r(n,VI(3,0));
	for(int i=n-1;i>0;i--){
		REP(j,3) {
			r[i-1][j]=r[i][j];
			if(s[i]==m[j])r[i-1][j]++;
		}
	}
	ll ans=0;
	REP(i,n-1){
		for(int j=i+1;j<n;j++){
			if(s[i]==s[j])
				continue;
			int p=-1;
			REP(k,3){
				if(s[i]!=m[k]&&s[j]!=m[k])
					p=k;
			}
			ans+=r[j][p];
			if(j+(j-i)<n){
				if(s[j+(j-i)]==m[p])
					ans--;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3828
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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





long long power(long long a, unsigned long long b, long long m){
    long long ret(1);
    while(b){
        if(b & 1) ret = (ret * a) % m;
        a = (a * a) % m;
        b /= 2;
        if(ret < 0) ret += m;
        if(a < 0) a += m;
    }
    return ret;
}


long long inv(int a, long long m){ // GCD(a, m) = 1
    return power(a, m-2, m);
}

int main(){
    const int m(998244353);
    long long inv2(inv(2, m));
    int N, S; std::cin >> N >> S;
    //dp[i][j] := i番目(1o)までで和jとなる{選んだ数, 個数}
    std::vector<std::vector<long long>> dp(N+1, std::vector<long long>(S+1));
    dp[0][0] = power(2, N, m);
    int A;
    for(int i(0); i < N; ++i){
        for(int j(0); j <= S; ++j){
            dp[i+1][j] = dp[i][j];
        }
        std::cin >> A;
        for(int j(A); j <= S; ++j){
            dp[i+1][j] += dp[i][j-A] * inv2;
            dp[i+1][j] %= m;
        }
    }
    std::cout << dp[N][S] << std::endl;
    return 0;
}


Measured memory_bytes: 73668
from collections import Counter

N, P = map(int, input().split())
S = input()

ans = 0

if P==2:
    for i in range(1, N+1):
        v = int(S[-i])
        if v%2==0:
            ans += N-(i-1)
elif P==5:
    for i in range(1, N+1):
        v = int(S[-i])
        if v%5==0:
            ans += N-(i-1)
else:
    ac = [0]*(N+1)
    for i in range(1, N+1):
        ac[i] = (ac[i-1]+int(S[-i])*pow(10, i-1, P))%P
    c = Counter(ac)
    for i in c.values():
        ans += i*(i-1)//2

print(ans)

Measured memory_bytes: 43980
#include<stdio.h>
 
int main(){
 int a[100],n,i;
 scanf("%d", &n);
 for(i=0; i<n; i++){
  scanf("%d", &a[i]);
 }
 for(i=n-1; i>=0; i--){
  if(i==0){ printf("%d\n", a[i]);}
  else{ printf("%d ", a[i]);}
 }
 return 0;
}

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


int main() {
	long long n;
	long long p[20];
	long long count = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> p[i];
	}

	for (int i = 1; i < n - 1; i++) {
		long long a, b, c;
		a = p[i - 1];
		b = p[i];
		c = p[i + 1];

		if ((a < b && b <= c) || (c < b && b <= a)) {
			count++;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define repr(i,x,n) for(int i=x; i<(int)n; i++)

int main() {
	int A, B; cin >> A >> B;
  	cout << A * B << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using LL  = long long;
using VI  = vector<LL>;
using VVI = vector<VI>;
using VB  = vector<bool>;
using VS  = vector<string>;
using PII = pair<LL, LL>;
using VP  = vector<PII>;
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define dump(x)      cerr << #x << " = " << (x) << endl;


int main() {
    LL A, B;
    cin >> A >> B;
    if (A >= 13) {
        cout << B << endl;
    } else if (A > 5) {
        cout << B / 2 << endl;
    } else {
        cout << "0" << endl;
    }
	
    return 0;
}


Measured memory_bytes: 764
#include <stdio.h>

int main(void)
{
	int i,j,k;
	int n,m;
	int temp;
	int maxtime;

	int date[20000];
	
	for(;;){
		for(i=0;i<20000;i++){
			date[i]=0;
		}
		maxtime=0;
		/////////////////////////ここから入力
		scanf("%d %d",&n,&m);
		if(n==0 && m==0) break;
		
		for(i=0;i<m+n;i++){
			scanf("%d",&date[i]);
		}

		for (i=0;i<m+n-1;i++) {
			for (j=m+n-1;j>i;j--) {
				if (date[j-1]>date[j]) {  
					temp = date[j];        
					date[j] = date[j-1];
					date[j-1]= temp;
				}
			}	
		}
		////////////////////////////ここまでデータ整理　ここから比較
		
		maxtime = date[0];
		
		for(i=0;i<n+m-1;i++){
			if(maxtime<date[i+1]-date[i]) maxtime = date[i+1]-date[i];
		}
		
		printf("%d\n",maxtime);
		
	}
	return 0;
}

Measured memory_bytes: 832
import sys
from collections import Counter

N = int(sys.stdin.readline())
S = []
uniqueS = []
for i in range(N):
    tempS = input()
    S.append(tempS)

SC = Counter(S)
max = max(SC.values())

ans_list = []
for i in SC.items():
    if i[1] == max:
        ans_list.append(i[0])
ans_list.sort()

for i in ans_list:
    print(i)

Measured memory_bytes: 35572
#include <bits/stdc++.h>
using namespace std;
int cirSentenceNum(int a, int b);
bool isCirSentence(int n);
int main() {
  int a, b, ans;
  cin >> a >> b;
  ans = cirSentenceNum(a, b);
  cout << ans << endl;
}
int cirSentenceNum(int a, int b) {
  int sum = 0;
  for(int i = a; i <= b; i++)
    if(isCirSentence(i))
      ++sum;
  return sum;
}
bool isCirSentence(int n) {
  int first,second, forth, fifth;
  first = n % 10;
  second = ((n - first) / 10) % 10;
  forth = ((n - first - second * 10) / 1000) % 10;
  fifth = n / 10000;
  if(first == fifth && second == forth)
    return true;
  else 
    return false;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }


vector<int> powerArray(int p, int n) {
	vector<int> power(n + 1); power[0] = 1;
	for (int i = 0; i < n; i++)
		power[i + 1] = power[i] * p;
	return power;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K; cin >> N >> K;
	dump(bitset<32>(K));
	vector<int> A(N), B(N); rep(i, 0, N) {
		cin >> A[i] >> B[i];
	}

	int ans = 0;

	rep(i, 0, N) {
		if (A[i] == 0)
			ans += B[i];
	}

	while (K > 0) {
		dump(K, bitset<32>(K));
		int c = 0;
		rep(i, 0, N) {
			if ((K | A[i]) == K) {
				c += B[i];
			}
		}
		chmax(ans, c);

		rep(i, 0, 32) {
			if ((K >> i) & 1) {
				continue;
			}
			else {
				dump((1 << i) - 1);
				K -= (1 << i) - 1;
				K--;
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define ll long long int
#define mp make_pair
#define ff first
#define ss second
#define fr(i,l,r) for (long long int i = l; i < r; ++i)
#define frr(i,l,r) for (long long int i = r; i >= l; --i) 
#define sortarr sort(arr,arr+n) //sorts array in asc order
#define sortarr_r sort(arr, arr+n, greater<long long int>()) //sorts array in desc order
#define make_set set<long long int>s //Set arranges in asc order
#define make_set_r set<long long int, greater <long long int>>s ////Set arranges in desc order
#define make_vector vector<long long int>v; 
#define max_heap priority_queue <int> pq; // max heap 
#define min_heap priority_queue <int, vector<int>, greater<int> > pq;  //min heap
#define make_pairVector vector<pair<long long int,long long int> > pairVector // vector of pairs
#define hashmap unordered_map<long long int, long long int>hashmap;
#define pb push_back


//map<pair<ll,ll>, ll > hash;          // pair,value hashmap where key is a pair
//hash[make_pair(i,j)] = 0;
//if(hash.find(make_pair(i,j)) == hash.end())


//map<ll,ll>::iterator itr;           // iterating a map
//for (itr = hash.begin();itr != hash.end(); itr++)
//{
//   itr->first = key  
//   itr->second = value
//}


// vector<string> v; //to convert vector to a set
// set<string> s(v.begin(), v.end());


// set<string>s;     // to convert set to a vector
// vector<string> v(s.begin(),s.end());


// cin >> x >> y;
// pairVector.pb(mp(x,y));


// string size = str.size()


// stack <int> s; 


// queue <int> gquiz; 


// __gcd(m, n) 

// ll arr[10e5 + 5];


// char arr[10e5 + 5];


// printf ("%.9f\n",x);


bool sortbysec(const pair<long long int,long long int> &a, const pair<long long int,long long int> &b) 
{ 
    return (a.second < b.second); 
}
bool compare(string &s1,string &s2) 
{ 
    return s1.size() < s2.size(); 
} 
int check_key(map<long long int, long long int> m, long long int key) 
{ 
    // Key is not present 
    if (m.find(key) == m.end()) 
        return 0; 
  
    return 1; 
} 

void yes()
{
    cout << "YES" << endl;
}
void no()
{
    cout << "NO" << endl;
}

int main(void)
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll a,b;
    cin >> a >> b;
    cout << a*b << endl;
    return 0;
}   

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

using namespace std;


int main() {
	int n, k;
	long double p = 0;

	cin >> n >> k;

	for (int i = n; i >= 1; i--) {
		int tmp = i;
		long double pt = 1;
		while (tmp < k) {
			tmp *= 2;
			pt /= 2;
		}
		p += pt;
	}


	cout << std::fixed << std::setprecision(12) << p/n << endl;
	
	return 0;
}


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

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

    //求める答え
    int cnt = 0;

    for(int i=0; i<(N-2); ++i){
        if(S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C'){
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
//    func enumerated() -> [(Int, Element)] {
//        return self.enumerate()
//    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

//func gcd(x: Int, _ y: Int) -> Int {
//    if y == 0 {
//        return x
//    } else {
//        return gcd(y, x%y)
//    }
//}

/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (N, K) = (input[0], input[1])
print(N-K+1)


Measured memory_bytes: 7908
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>

using namespace std;

#define ll long long

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

    if(a > 9 || b > 9){
        cout << "-1" << endl;
    }else{
        cout << a*b << endl;
    }

    return 0;
}

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

signed main() {
	int n, a, over = 0;
	cin >> n;
	vector<bool> color(8);
	for (int i = 0; i < n; ++i) {
		cin >> a;
		if (a < 400) color[0] = true;
		else if (a < 800) color[1] = true;
		else if (a < 1200) color[2] = true;
		else if (a < 1600) color[3] = true;
		else if (a < 2000) color[4] = true;
		else if (a < 2400) color[5] = true;
		else if (a < 2800) color[6] = true;
		else if (a < 3200) color[7] = true;
		else over++;
	}

	int cnt = 0;

	for (int i = 0; i < 8; ++i) {
		if (color[i]) cnt++;
	}

	cout << max(1, cnt) << ' ' << cnt + over << endl;
}


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

int main() {
  string s;
  vector<string> s_list;
  map<string, int> s_map;
  while (cin >> s) {
    s_map[s]++;
    s_list.push_back(s);
  }
  int max_s = 0;
  int i;
  for (i = 0; i < s_list.size(); i++) {
    max_s = max(max_s, s_map[s_list[i]]);
  }
  for (i = 0; i < s_list.size(); i++) {
    if (s_map[s_list[i]] == max_s) {
      cout << s_list[i] << ' ';
      break;
    }
  }
  int max_length = 0;
  for (i = 0; i < s_list.size(); i++) {
    max_length = max(max_length, (int)(s_list[i].length()));
  }
  for (i = 0; i < s_list.size(); i++) {
    if (max_length == s_list[i].length()) {
      cout << s_list[i] << endl;
      break;
    }
  }
  return 0;
}



Measured memory_bytes: 3096
#coding:utf-8
#1_4_A
def isFound(array, x):
    """ linear search """
    array.append(x)
    i = 0
    while array[i] != x:
        i += 1
    if i == len(array)-1:
        return False
    return True

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
count = 0

for i in range(q):
    if isFound(S, T[i]):
        count += 1

print(count)

Measured memory_bytes: 8472
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
ll INF = 1000000007;
using Graph = vector<vector<ll>>;

// 0 false, 1 true 
// stringの数字をint型にしてアスキーコードになったら -48する


int main() {
    string s;
    cin >> s;
    int ans = 0;
    rep(i,s.size() / 2){
        if(s.at(i) != s.at(s.size()-i-1)){
            ans++;
        }
    }

    cout << ans << endl;
    


}


Measured memory_bytes: 256
N=int(input())
*A,=map(int,input().split())
*B,=map(int,input().split())

C = sorted(a-b for a,b in zip(A,B))
ans = 0
S = 0
for c in C:
    if c>=0:break
    S += c
    ans += 1
for c in C[::-1]:
    if c<=0:break
    if S>=0:break
    S+=c
    ans += 1
if S<0:ans=-1
print(ans)

Measured memory_bytes: 18396
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

struct edge{
  int to,cost;
};

int A,B,C,N,W,H,ans,dp[HMAX][WMAX];
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){
	while(true){
		if(A+1 < B){
			A++;
		}else if(A == 1){
			S = "Borys";
			break;
		}else{
			A--;
		}
		if(B-1 > A){
			B--;
		}else if(B == N){
			S = "Alice";
			break;
		}else{
			B++;
		}
	}
}

void debug(){

}

void answer(){
	cout << S << "\n";
}

int main(){
	cin >> N >> A >> B;
	solve();
	#ifdef DEBUG
	debug();
	#endif
	answer();

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(int argc, char **argv){
	int a = 0;
	int b = 0;
	int c = 0;

	std::cin >> a >> b >> c;

	if(a < b && b < c){
		std::cout << "Yes";
	}
	else{
		std::cout << "No";
	}
	std::cout << std::endl;

	return 0;
}

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

using std::cin;
using std::cout;
using std::cerr;

using std::abs;
using std::min;
using std::max;
using std::swap;

using std::map;
using std::pair;
using std::set;
using std::string;
using std::vector;

using std::sort;
using std::reverse;

using ll = long long;

#define forn(i, n) for (ll i = 0; i < (ll) n; ++i)
#define sz(a) static_cast<int>(a.size())
#define endl '\n'

struct __init {
    __init() {
        cin.tie(nullptr);
        std::iostream::sync_with_stdio(false);
        cout << std::fixed << std::setprecision(10);
        cerr << std::fixed << std::setprecision(5);
        std::mt19937 rand(300);
    }

    ~__init() {
        #ifdef SEREZHKA
            cerr << "Time elapsed: " << static_cast<double>(clock()) / CLOCKS_PER_SEC << endl;
        #endif
    }
} init;

const ll inf = (ll) 1e9 + 7ll;
const int maxn = (int) 1e6 + 17;

struct pt {
    long double x, y;
    int i;
    pt() { }
    pt(long double x, long double y) : x(x), y(y) { }
};

struct vec {
    long double x, y;

    vec(pt a, pt b) {
        x = b.x - a.x;
        y = b.y - a.y;
    }

    long double length() {
        return sqrtl((long double) x * x + y * y);
    }
};

int n;
pt p[maxn];
long double ans[maxn];

bool read() {
    if (!(cin >> n))
        return false;

    forn (i, n)
        cin >> p[i].x >> p[i].y, p[i].i = i;

    return true;
}

ll prod(vec a, vec b) {
    return a.x * b.y - a.y * b.x;
}

bool cmp(pt a, pt b) {
    vec v1 = vec(p[0], a);
    vec v2 = vec(p[0], b);

    if (prod(v1, v2) != 0)
        return prod(v1, v2) < 0;
    else
        return v1.x * v1.x + v1.y * v1.y < v2.x * v2.x + v2.y * v2.y;
}

long double ang(vec a, vec b) {
    long double t = (a.x * b.x + a.y * b.y) / (a.length() * b.length());
    if (t < -1) t = -1;
    if (t > 1) t = 1;
    return acosl(t);
}

void solve() {
    if (n == 2) {
        cout << "0.5\n0.5\n";
        return ;
    }

    int mn = -1;

    for (int i = 0; i < n; ++i)
        if (mn == -1 || p[i].x < p[mn].x || (p[i].x == p[mn].x && p[i].y < p[mn].y))
            mn = i;

    swap(p[0], p[mn]);
    sort(p + 1, p + n, cmp);
    vector<pt> ch;
    ch.push_back(p[0]);
    ch.push_back(p[1]);

    for (int i = 2; i < n; ++i) {
        while (sz(ch) >= 2 && prod(vec(ch[sz(ch) - 2], ch[sz(ch) - 1]), vec(ch[sz(ch) - 2], p[i])) > 0)
            ch.pop_back();

        ch.push_back(p[i]);
    }

    long double len = 0;
    pt pp(0, 0);

    for (int i = 0; i < sz(ch); ++i) {
        pt p1 = ch[(sz(ch) + i - 1) % sz(ch)];
        pt p2 = ch[i];
        pt p3 = ch[(i + 1) % sz(ch)];
        pt u1 = pt(0.5 * (p1.x + p2.x), 0.5 * (p1.y + p2.y));
        pt u2 = pt(0.5 * (p2.x + p3.x), 0.5 * (p2.y + p3.y));
        vec p12 = vec(p1, p2);
        vec p23 = vec(p2, p3);
        swap(p12.x, p12.y);
        swap(p23.x, p23.y);
        p12.x *= -1;
        p23.x *= -1;
        ans[ch[i].i] = ang(p12, p23);
        len += ans[ch[i].i];
    }

    for (int i = 0; i < n; ++i)
        cout << ans[i] / len << endl;
}

int main() {
#if SEREZHKA
    freopen("file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}


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

int main(){
  long long n;
  long long ans=0;
  string a;
  cin >> a;
  n=a.size();
  for(int j='a';j<='z';j++){
    long long z=0;
    for(int i=0;i<n;i++){
      if(a[i]==j) z++;
    }
    ans+=z*(z-1)/2;
  }
  ans=n*(n-1)/2-ans+1;
  cout << ans <<endl;
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n;
	cin>>n;
	string s;
	cin>>s;
	long long a=0,b=0,c=0,count=0;
	for(int i=0;i<n;i++){
		if(s[i]=='R')
		a++;
		else if(s[i]=='G')
		b++;
		else if(s[i]=='B')
		c++;
	}
	count=a*b*c;
	long long k;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i<j){
				k=2*j-i;
			}
			if(s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k] && k<n)
            count--;
		}
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#define N 1000
using namespace std;

int main(){
  while(1){
    int n,q,e[N],w[N],que[N],f;
  string str[N];
  cin>>n>>q;
  if(n+q==0) break;
  for(int i=0;i<n;i++)cin>>str[i]>>e[i]>>w[i];
    for(int i=0;i<q;i++) cin>>que[i];

    for(int i=0;i<q;i++){
      f=0;
      for(int j=0;j<n;j++)if(e[j]-(w[j]-que[i])>0 && e[j]-(w[j]-que[i])<=e[j]) cout<<str[j]<<" "<<e[j]-(w[j]-que[i])<<endl,f=1;
      if(f==0) cout<<"Unknown"<<endl;
  }
  }
  return 0;
}

Measured memory_bytes: 1280
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
#print(N, K)
#print(A)

A_dict = {}
for a in A:
  if a not in A_dict:
    A_dict[a] = 0
  A_dict[a] += 1

sorted_A = sorted(A_dict.items(), key=lambda x:x[1])
#print(sorted_A)

num_A = len(sorted_A)

cnt=0

for item in sorted_A:
  if num_A > K:
    cnt += item[1]
    num_A -= 1
  else:
    break
print(cnt)

Measured memory_bytes: 38964
using System;

namespace Ex160425_1{
    public class Program{
        public static void Main(string[] args){
            var input = Console.ReadLine().Split(' ');
            var a = int.Parse(input[0]);
            var b = int.Parse(input[1]);
            var c = int.Parse(input[2]);

            Console.WriteLine((a < b && b < c) ? "Yes" : "No");;
        }
    }
}

Measured memory_bytes: 8784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
//void chmin(int &a, int b) { if (a > b) a = b; }
//void chmax(int &a, int b) { if (a < b) a = b; }

int main() {
    int A,B,m,mna = INT_MAX,mnb = INT_MAX;
    cin >> A >> B >> m;
    vector<int> a(A),b(B);
    for (int i = 0; i < A; ++i) {
        cin >> a[i];
        mna = min(mna,a[i]);
    }
    for (int i = 0; i < B; ++i) {
        cin >> b[i];
        mnb = min(mnb,b[i]);
    }
    int ans = INT_MAX;
    for (int i = 0; i < m; ++i) {
        int x,y,c;
        cin >> x >> y >> c;
        x--,y--;
        ans = min(ans,a[x]+b[y]-c);
    }
    ans = min(ans,mna+mnb);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<algorithm>
#include<math.h>
#include<time.h>
#include<queue>
#include<numeric>
#include<stdio.h>
#include<stack>
#include<string>
#include<stdio.h>
#include<utility>
#include<iomanip>
#include<sstream>
#include<deque>
#include<initializer_list>
#include<unordered_set>
#define MAX 50
#define ll long long
#define fr(i,a,b) for(ll i = a;i<b;i++)
#define pie 3.14159265358979
#define pb push_back
#define mp make_pair
#define fri(i,a,b) for(ll i = a;i>b;i--)
using namespace std;
ll solve(){
    string s;
    cin>>s;
    ll c =0 ,d= 0;
    if(s == "RRR"){
        cout<<"3";
    }
    if(s == "SSS"){
        cout<<"0";
    }
    if(s == "SSR"){
        cout<<"1";
    }
    if(s == "SRR"){
        cout<<"2";
    }
    if(s == "RSR"){
        cout<<"1";
    }
    if(s == "RRS"){
        cout<<"2";
    }
    if(s == "SRS"){
        cout<<"1";
    }
    if(s == "RSS"){
        cout<<"1";
    }
    //cout<<c<<"\n";
    return 0;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t =1
    ;
  //  cin>>t;
//
    while(t--){
        solve();}
}
 


Measured memory_bytes: 3092
import java.util.Scanner;

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

		if(a < b && b < c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}



Measured memory_bytes: 26340
#include <bits/stdc++.h>
#define il inline
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define mid ((l+r)>>1)
#define MAXN 5005 * 5005
#define MAXM 
#define mod
#define inf (1<<30)
#define eps (1e-6)
#define alpha 0.75
#define rep(i, x, y) for(register int i = x; i <= y; ++i)
#define repd(i, x, y) for(register int i = x; i >= y; --i)
#define file(s) freopen(s".in", "r", stdin), freopen(s".my", "w", stdout)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, int> pli;
typedef pair <int, ll> pil;
typedef pair <ll, ll> pll;
template <typename T> il bool chkmin(T &x, T y) {return x > y ? x = y, 1 : 0;}
template <typename T> il bool chkmax(T &x, T y) {return x < y ? x = y, 1 : 0;}
template <typename T> il void read(T &x) {
	char ch = getchar(); int f = 1; x = 0;
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') x = x*10+ch-'0', ch = getchar();
	x *= f;
}
template <typename T, typename... Args> il void read(T &x, Args &...args) {
	read(x), read(args...);
}
ll n, g[2], s[2], b[2];
ll f[MAXN];
ll solve() {
	memset(f, 0, sizeof(f));
	rep(i, 0, n) if(i >= g[0]) chkmax(f[i], f[i-g[0]] + g[1]);
	rep(i, 0, n) if(i >= s[0]) chkmax(f[i], f[i-s[0]] + s[1]);
	rep(i, 0, n) if(i >= b[0]) chkmax(f[i], f[i-b[0]] + b[1]);
	ll ret = 0;
	rep(i, 0, n) chkmax(ret, f[i] + n - i);
	return ret;
}
int main() {
	read(n);
	rep(i, 0, 1) read(g[i], s[i], b[i]);
	n = solve();
	swap(g[0], g[1]), swap(s[0], s[1]), swap(b[0], b[1]);
	n = solve();
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 196096
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict
    # from collections import deque
    # from collections import Counter
    # import numpy as np
    import math
    # import random
    input = stdin.readline

    p = 998244353

    def cmb(n, r, p):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return fact[n] * factinv[r] * factinv[n-r] % p

    # p = 10 ** 9 + 7
    N = 10 ** 6  # N は必要分だけ用意する
    fact = [1, 1]  # fact[n] = (n! mod p)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
    inv = [0, 1]  # factinv 計算用
    
    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)

    def pow_k(x, n):
        """
        O(log n)
        """
        if n == 0:
            return 1

        K = 1
        while n > 1:
            if n % 2 != 0:
                K *= x
                K = K%p
            x *= x
            n //= 2

        return (K * x)%p

    n, m, k = map(int, input().split())
    if m == 1:
        if k < n-1:
            print(0)
        else:
            print(1)
        exit()

    ans = 0
    first = pow_k(m-1, n-k-1)
    for i in range(k, -1, -1):
        first_cmb = cmb(n-1, i, p)
        ans += (first_cmb*first)%p
        first = (first*(m-1))%p
        # first_cmb = (first_cmb*i)//(n-i)
        


    ans = ans*m
    print(ans%p)



Measured memory_bytes: 128444
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        int a = num.nextInt();
        int b = num.nextInt();
     int d = a / b;
     int r = a % b;
     double f = (double)a / b;
        System.out.printf("%d %d %f",d,r,f);
     }
}

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

struct Node {
    int key;
    Node *prev;
    Node *next;
};

class DoublyLinkedList {
private:
    Node *nil;
public:
    DoublyLinkedList()
    {
        nil = new Node;
        nil->prev = nil;
        nil->next = nil;
    }

    ~DoublyLinkedList()
    {
        delete nil;
    }

    void insert(int key)
    {
        Node *node = new Node;
        node->key = key;
        node->next = nil->next;
        nil->next->prev = node;
        nil->next = node;
        node->prev = nil;
    }

    Node *list_search(int key)
    {
        Node *current = nil->next;
        while (current != nil && current->key != key) // 最後のNodeのnextはnilに繋がっている
        {
            current = current->next;
        }
        return current;
    }

    void delete_node(Node *node)
    {
        if (node != nil)
        {
            node->prev->next = node->next;
            node->next->prev = node->prev;
            delete node;
        }
    }

    void delete_key(int key)
    {
        delete_node(list_search(key));
    }

    void delete_first()
    {
        delete_node(nil->next);
    }

    void delete_last()
    {
        delete_node(nil->prev);
    }

    void print_list()
    {
        Node *current = nil->next;
        while (current != nil)
        {
            printf("%d", current->key);
            current = current->next;
            if (current != nil)
                printf(" ");
            else
                printf("\n");
        }
    }
};

int main()
{
    DoublyLinkedList list;
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        char command[16];
        int key;
        scanf("%s%d", command, &key);
        if (command[0] == 'i')
            list.insert(key);
        else if (command[0] == 'd')
        {
            if(command[6] == 'F')
                list.delete_first();
            else if(command[6] == 'L')
                list.delete_last();
            else
                list.delete_key(key);
        }
    }
    list.print_list();
}


Measured memory_bytes: 34408
#include <iostream>

using namespace std;

void solve()
{
	int n;
	cin >> n;
	for(int i = 1; i <= n; ++i)
	{
		int num;
		cin >> num;
		cout << "Case " << i << ":" << endl;
		int ans = 0;
		for(int j = 0; j < 10; ++j)
		{
			ans = num * num;
			ans %= 1000000;
			ans /= 100;
			num = ans;
			cout << ans << endl;
		}
	}
}

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

Measured memory_bytes: 1160
/* Tue 02 Jun 2020 10:28:22 PM PDT */
#include <bits/stdc++.h>
using namespace std;
#define rep(i,r) for(int i = 0; i < (r); i++)
#define pb push_back
#define ALL(a) a.begin(), a.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define uint unsigned long long
#define endl '\n'

signed main() {
  fastio;
  int n;
  cin >> n;
  vector<int>a(n);
  vector<int>b(n);
  rep(i,n) {
    cin >> a[i] >> b[i];
  }
  sort(ALL(a));
  sort(ALL(b));
  int res = 0;
  if (n % 2) {
    res = b[n/2] - a[n/2] + 1;
  } else {
    int y = b[n/2] - a[n/2] + 1;
    int x = b[n/2-1] - a[n/2-1] + 1;
    res = y + x - 1;
  }
  cout << res << endl;
  
}


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


using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 998244353;


int main() {

	string s, t;
	cin >> s >> t;
	int a, b;
	cin >> a >> b;
	string u;
	cin >> u;

	if (u == s)a--;
	else b--;
	cout << a << ' ' << b << endl;


}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long H, W;
  cin >> H >> W;
  vector<string> a(H);
  rep (h, H) cin >> a[h];
  rep (i, W+2) cout << "#";
  cout << endl;

  rep (h, H) {
    cout << "#";
    cout << a[h];
    cout << "#";
    cout << endl;
  }

  rep (i, W+2) cout << "#";
  cout << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <cstdio>
using namespace std;
#define ll  long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
# define st(v) (v).begin(),(v).end()
#define rep(i,a,n) for( int i = a ; i < n ; i++ )
#define prep( i, a , n ) for ( int i = a ; i>= n ; i--)
#define   pr pair<int,int>
const int N = 1e5 + 5 , M=N,inf=(int)1e9;
const int mod=1e9+7;
int fastAbs(int n) { return (n ^ (n >> 31)) - (n >> 31); }
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
ll ans ;
map< pair<int,int> , int > mp;
const int dx[4] = {1,0,0,-1};
const int dy[4] = {0,-1,1,0};
vector < int > h[N];
void solve(){
    int n ;
    cin >>  n ;
    while(n!=0){
        int r = n%10 ;
        if(r==2) ans++ ;
        n /= 10 ;
    }
    cout << ans ;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q=1;
   //cin >> q;
    while(q--)
        solve();
}
/*
    ---------------- lemmas-----------------------------------
   1)
   2)
   3)

*/


Measured memory_bytes: 2560
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll n,k;
  cin >> n >> k;
  ll x[n];
  REP(i,n) cin >> x[i];
  ll ans = INF;
  REP(i,n-k+1){
    ans = min(ans,abs(x[i]-x[i+k-1])+abs(x[i]));
  }
  REP(i,n-k+1){
    ans = min(ans,abs(x[i]-x[i+k-1])+abs(x[i+k-1]));
  }
  cout << ans << endl;
  return 0;
}


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

int top, S[1000];

void push(int x){
    S[++top] = x;
}

int pop(){
    top--;
    return S[top+1];
}

int main(){
    int a, b;
    top = 0;
    char s[100];
    while(scanf("%s", s) != EOF){
        if(s[0] == '+'){
            a = pop();
            b = pop();
            push(a + b);
        } else if(s[0] == '-'){
            b = pop();
            a = pop();
            push(a - b);
        } else if(s[0] == '*'){
            a = pop();
            b = pop();
            push(a * b);
        } else {
            push(atoi(s));
        }
    }

    printf("%d\n", pop());

    return 0;
}




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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  int a[10], cnt = 0;
  do {
    a[cnt++] = n % 10;
    n /= 10;
  } while(n);
  int now = 1;
  for (int i = 1; i < cnt && now < 3; ++i) {
    if (a[i] == a[i - 1]) {
      ++now;
    }
    else {
      now = 1;
    }
  }
  puts(now >= 3 ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
# 092a

def atc_092a(ABCD: int) -> int:
    return min(ABCD[0], ABCD[1]) + min(ABCD[2], ABCD[3])


A = int(input())
B = int(input())
C = int(input())
D = int(input())

ABCD = [A, B, C, D]
print(atc_092a(ABCD))


Measured memory_bytes: 9168
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>

using namespace std;
typedef long long ll;

ll ans, mx, mn = 1e8, sum, cnt;
int main(){
	string s;
	cin>>s;
	for(int i=0; i<s.size(); i++){
		if(s[i]=='1') cout<<9;
		else if(s[i]=='9') cout<<1;
	}
}


Measured memory_bytes: 256
#!/usr/bin/env python

def main():
    S = input()
    l = len(S)
    ans = [0] * (l + 1)
    ans[1] = 1

    for i in range(1, l):
        if S[i] != S[i-1]:
            ans[i+1] = ans[i] + 1
        else:
            if i == 1:
                ans[i+1] = ans[i]
            else:
                ans[i+1] = ans[i-2] + 2
    
    return ans[-1]

if __name__ == '__main__':
    print(main())


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

#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define gets(x) x; cin >> x;
#define puts(x) x; cout << x << endl;
#define list_input(x, n) x[n]; rep(i,n){ gets(x[i]);}
#define ll long long

int main(){
  ll a, b, k;
  cin >> a >> b >> k;
  FOR(i, a, b+1){
    if (i < a+k || i > b-k) {
      puts(i)
    }
  }
}


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

int main() {
	int n;
	cin >> n;
	int change = 0;
	if (n % 1000 ==0) {
		cout << change;
	}
	else {

		change = 1000 - (n % 1000);
		cout << change;
	}
	
}

Measured memory_bytes: 3620
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
int dx[4] = { 0,  0, 1, -1 };
int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

ll dp[MAX][13];

int main() {
	ll res = 0;
	string s; cin >> s;

	dp[0][0] = 1;
	rep(i, s.size()) {
		int c;
		if (s[i] == '?') c = -1;
		else c = s[i] - '0';

		rep(j, 10) {
			if (c != -1 && c != j) continue;
			rep(ki, 13) {
				dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki];
			}
		}
		rep(j, 13) dp[i + 1][j] %= mod;
	}
	res = dp[s.size()][5];
	cout << res << endl;
}


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

int main(){
    int N; cin >> N;
    int K; cin >> K;
    int y = 1;
    for(int i=0;i<N;i++){
        if(y*2 <= y+K){
            y = y*2;
        }
        else y = y+K;
    }
    cout << y << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <map>
#include <tuple>
#include <cmath>
#include <vector>

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

typedef unsigned long long ull;
typedef long long ll;
using namespace std;

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

    // vector<pair<string, int>> dictionaries(n);
    vector<tuple<string, int, int>> guidebook;
    string restaurant; int grade;
    rep(i, n) {
        // cin >> guidebook.at(i).first >> grade;
        cin >> restaurant >> grade;
        // guidebook.at(i).second = -grade;
        guidebook.push_back(make_tuple(restaurant, -grade, i+1));
        // dictionaries.insert(make_pair(guidebook.at(i).first, i+1));
        // guidebook.push_back(make_pair(restaurant,grade));
        // guidebook.insert({restaurant, grade});
    }
    sort(guidebook.begin(), guidebook.end());
    rep (i, n) {
        // cout << guidebook.at(i) << endl;
        // cout << guidebook.at(i).first << " " << guidebook.at(i).second << endl;
        cout << get<2>(guidebook[i]) << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int n;
vector<int> a(1e6);

int main() {
  IOS;
  cin >> n;
  REP(i,n) cin >> a[i];

  int mx = -INF, mn = INF;
  REP(i,n) {
    chmax(mx,a[i]);
    chmin(mn,a[i]);
  }
  int add = abs(mx) >= abs(mn) ? mx : mn;
  int add_idx = 0;
  REP(i,n) {
    if (a[i] == add) { add_idx = i; break; }
  }

  vector<P> ans;
  REP(i,n) {
    ans.push_back({ add_idx, i });
  }
  if (add >= 0) {
    REP(i,n-1) ans.push_back({ i, i+1 });
  } else {
    REP(i,n-1) ans.push_back({ n-i-1, n-i-2 });
  }

  COUT(ans.size());
  REP(i,ans.size()) {
    cout << ans[i].first+1 << " " << ans[i].second+1 << endl;
  }
  return 0;
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
lli GCD(lli x, lli y)
{
       if(x<y)swap(x,y);
        if (y == 0) {
                return x;
        } else {
                return GCD(y, x % y);
        }
}

void func(long long K){

    lli sum = 0;

    for(lli a=1;a<=K;a++){
    for(lli b=1;b<=K;b++){
        lli num = GCD(a,b);
        if(DEBUG)cout<<"num="<<num<<endl;
        for(lli c=1;c<=K;c++){
            lli nex = GCD(num,c);
            if(DEBUG)cout<<a<<" "<<b<<" "<<c<<" "<<num<<endl;
            sum += nex;
        }
    }
    }

    cout<<sum<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long K;
    scanf("%lld",&K);
    func(K);
    return 0;
}


Measured memory_bytes: 3764