akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, nuint_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; 
#define int long long
#define MOD 1000000007
#define what_is(x) cerr << #x << " is " << x << endl;
#define loop(i,a,n) for(int i=a;i<n;i++)
#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, szof(x))
#define sortall(x) sort(aint(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626 
 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int, int> pt;

// int arr[2][2]={{0,1},{1,0}};
signed main() {

	fastio();
	//#define LOCAL_DEFINE	
	#ifdef LOCAL_DEFINE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
		//https://zhuhan0.blogspot.com/2017/09/leetcode-425-word-squares.html
		//https://yzygitzh.github.io/algorithm/2018/11/09/leetcode-summary.html
		//https://beginnersbook.com/2015/03/why-dont-we-call-run-method-directly-why-call-start-method/
		//https://leetcode.com/problems/lfu-cache/
	// int n,k;
	// cin>>n>>k;
	// vector<int> arr(n);
 // 	for(int i=0;i<n;i++)
 // 	{
 // 		cin>>arr[i];
 // 	}
 // 	set<int> hash;
 // 	int ans=0;
 // 	bool flag=false;
 // 	for(int i=0;i<k;i++)
 // 	{
 // 		if(hash.lower_bound(arr[i])!=hash.end())
 // 		{
 // 			flag=true;
 // 		}
 // 		hash.insert(arr[i]);
 // 	}
 // 	if(flag)
 // 	{
 // 		ans++;
 // 	}
 // 	bool flag1=false;
 // 	for(int i=k;i<n;i++)
 // 	{
 // 		cout<<ans<<endl;
 // 		hash.erase(arr[i-k]);
 // 		if(hash.lower_bound(arr[i])!=hash.end())
 // 		{
 // 			ans++;
 // 		}else if(hash.lower_bound(arr[i-k])!=hash.begin())
 // 		{
 // 			ans++;
 // 		}else{
 // 			flag1=true;
 // 		}

 // 		hash.insert(arr[i]);	
 // 	}
 // 	if(!flag || !flag1)
 // 		ans++;
 // 	cout<<ans;

	int n,k,ans=0;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		int x;

		cin>>x;
		if(x>=k)
			ans++;
	}
	cout<<ans;
 	return 0;
}
 

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

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] p = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Array.Sort(p);
            if (p[0] == 5 && p[1] == 5 && p[2] == 7) Console.WriteLine("YES");
            else Console.WriteLine("NO");
        }
    }
}


Measured memory_bytes: 2904
<?php
// Your code here!
$n = trim(fgets(STDIN));
$arr = explode(" ",trim(fgets(STDIN)));
$cnt=0;
for($i=0;$i<$n;$i++) {
    if($arr[$i]!=$i+1) {
        $num[] = $i;
        $turn[] = $arr[$i];
        $cnt++;
    }
}
if($cnt==0) {
    echo "YES";
}
elseif($cnt==2) {
    $x = $arr[$num[0]];
    $arr[$num[0]] = $arr[$num[1]];
    $arr[$num[1]] = $x;
    
    for($i=0;$i<$n;$i++) {
        if($arr[$i]!=$i+1) {
            echo "NO";
        }
    if($i==$n-1) {
        echo "YES";
    }
    }
}else {
    echo "NO";
}

?>


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

int main() {
  int n; cin>>n;
  vector<int> a(n);
  rep(i, n) cin>>a[i];

  bool frag=true;
  int p=0; //未ソート部分の先頭
  int cnt=0;
  while (frag) {
    frag=false;
    for (int i=n-1; i>p; i--) {
      if (a[i]<a[i-1]) {
        int tmp=a[i-1];
        a[i-1]=a[i];
        a[i]=tmp;
        frag=true;
        cnt++;
      }
    }
    p++;
  }
  rep(i, n-1) cout<<a[i]<<" ";
  cout<<a[n-1]<<endl;
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 3092
import sys
import numpy as np
input = sys.stdin.readline
N, M = [int(x) for x in input().split()]
I = []
for _ in range(M):
    I.append([int(x) for x in input().split()])
s_1 = set()
s_N = set()
for i in I:
    if i[0] == 1 and i[1] == N:
        print("POSSIBLE")
        sys.exit()
    if i[0] == 1:
        if i[1] in s_N:
            print("POSSIBLE")
            sys.exit()
        s_1.add(i[1])
    if i[1] == N:
        if i[0] in s_1:
            print("POSSIBLE")
            sys.exit()
        s_N.add(i[0])
for j in s_1:
    if j in s_N:
        print("POSSIBLE")
        sys.exit()
print("IMPOSSIBLE")
    



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

int main(){
  int n,h;
  cin >> n >> h;
  int a[n],b[n];
  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i];
  }
  int ans=0;
  sort(a,a+n);
  sort(b,b+n);
  int k=-1;
  for(int i=0;i<n;i++){
    if(a[n-1]>b[i]){
      k=i;
    }
  }
  for(int i=n-1;i>k;i--){
    h-=b[i];
    ans++;
    if(h<=0){
      break;
    }
  }
  if(h<=0){
    cout << ans << endl;
  }
  else{
    int x=(h-1)/a[n-1]+1;
    cout << ans+x << endl;
  }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int r,D,x,a,ans;
  //入力
  cin>>r;
  cin>>D;
  cin>>x;
  //処理
  for(a=2;a<=11;a++){
    ans=x*pow(r,a-1)+D*(pow(r,a-1)-1)/(1-r);
    cout<<ans<<'\n';
  } 
}

Measured memory_bytes: 640
import numpy as np


def solve():
    ans = 0
    mask = 1
    for i in range(60):
        one_cnt = np.sum(A >> i & 1)
        tmp = one_cnt * (N - one_cnt)
        tmp %= MOD
        ans += tmp * mask
        ans %= MOD
        mask <<= 1
        mask %= MOD
    return ans


N, *A = map(int, open(0).read().split())
A = np.array(A, dtype=np.int64)
MOD = 1_000_000_007
print(solve())


Measured memory_bytes: 65680
n = int(input())
h = list(map(int,input().split()))

ans = 0
while True:
    if sum(h) <= 0:
        print(ans)
        exit()
    M = h.index(max(h))
    start = M
    end = M+1
    for i in range(M,-1,-1):
        if h[i] > 0:
            start = i
        else:
            break
    if end != n:
        for i in range(M,n):
            if h[i] > 0:
                end = i+1
            else:
                break
    for i in range(start,end):
        h[i] -= 1
    ans += 1
   

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

int main() {
	int n; // 品物の数
	int w; // なっぷサックの容量
	scanf("%d%d", &n, &w);
	int a[n]; // 重さ
	int b[n]; // 価値
	for (int i = 0; i < n; i++)
		scanf("%d%d", &a[i], &b[i]);
	
	std::vector<std::vector<int64_t> > dp(n, std::vector<int64_t> (w + 1, -1000000000000000000));
	dp[0][0] = 0;
	dp[0][a[0]] = b[0];
	for (int i = 0; i + 1 < n; i++) {
		for (int j = 0; j <= w; j++) {
			// i+1番目を使わない場合
			dp[i + 1][j] = std::max(dp[i + 1][j], dp[i][j]);
			// i+1番目を使う場合
			if (j + a[i + 1] <= w)
				dp[i + 1][j + a[i + 1]] = std::max(dp[i + 1][j + a[i + 1]], dp[i][j] + b[i + 1]);
		}
	}
	int64_t res = 0;
	for (int i = 0; i <= w; i++) res = std::max(res, dp[n - 1][i]);
	std::cout << res << std::endl;
	return 0;
}


Measured memory_bytes: 79488
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000000
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
	ll r=1;
	a=a%m;
	while(b>0)
	{
		if(b&1)
		    r=(r*a)%m;
		b>>1;
		a=(a*a)%m;
	}
	return r%m;
}


int main(){
    ll n,m; cin>>n>>m;
    if(n!=m)cout<<"No\n";
    else cout<<"Yes\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;

int n;
ll k;
char s[210000];
const ll MX = 500000;
int a[220000];

int main() {
	scanf("%d%lld", &n, &k);
	scanf(" %s", s);
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'A')
			a[i] = 0;
		else
			a[i] = 1;
	}
	int cur = 0;
	int fl = 0;
	for (int i = 0; i < k; ++i) {
		if ((a[cur] ^ fl) == 0) {
			a[cur] ^= 1;
		}
		else {
			fl ^= 1;
			++cur;
			if (cur == n)
				cur = 0;
		}
	}
	for (int i = 0; i < n; ++i)
		a[i] ^= fl;
	int now = 0;
	for (int i = cur; i < n; ++i) {
		if (a[i] == 0) 
			s[now] = 'A';
		else
			s[now] = 'B';
		++now;
	}
	for (int i = 0; i < cur; ++i) {
		if (a[i] == 0) 
			s[now] = 'A';
		else
			s[now] = 'B';
		++now;
	}
	cout << s << "\n";
/*	if (n == 1) {
		if (k % 2 == 0) {
			cout << s << "\n";
		}
		else {
			if (s[0] == 'A')
				cout << "B\n";
			else
				cout << "A\n";
		}
		return 0;
	}
	int cur = 0;
	int fl = 0;
	for (int i = 0; i < min(MX, k); ++i) {
		if ((a[cur] ^ fl) == 0) {
			a[cur] ^= 1;
		}
		else {
			fl ^= 1;
			++cur;
			if (cur == n)
				cur = 0;
		}
	}
	if (k > MX) {
		k -= MX;

	}
*/
//	cout << s << "\n";
	return 0;
}




Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    int x,y;
    cin>>x>>y;
    if(y%2)
    cout<<"No\n";
    else 
    {
        if(4*x>=y && y>=2*x)
        cout<<"Yes\n";
        else
        cout<<"No\n";
    }
}

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

int main(void) {
    int X;
    cin >> X;
    if(X < 4) {
        cout << "1\n";
        return 0;
    }

    set<int> s;
    for(int i=2;i<33;i++) {
        for(int j=2;;j++) {
            int r = pow(i,j);
            if(r > 1000) break;
            s.insert(r);
        }
    }

    set<int>::iterator it = s.lower_bound(X);
    while((*it) > X) {
        it--;
    }
    cout << *it << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second



int main() {
	int c[3][3];
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> c[i][j];
		}
	}

	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			for (int k = 0; k <= 100; k++) {
				int d[3][3];
				for (int l = 0; l < 3; l++)for (int m = 0; m < 3; m++)d[l][m] = c[l][m];
				for (int l = 0; l < 3; l++)d[0][l] -= i;
				for (int l = 0; l < 3; l++)d[1][l] -= j;
				for (int l = 0; l < 3; l++)d[2][l] -= k;
				if (d[0][0] == d[1][0] && d[1][0] == d[2][0])
					if (d[0][1] == d[1][1] && d[1][1] == d[2][1])
						if (d[0][2] == d[1][2] && d[1][2] == d[2][2]) {
							cout << "Yes" << endl;
							return 0;
						}
			}
		}
	}
	cout << "No" << endl;
	return 0;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

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

constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;

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

  llong ans = inf;
  for (int i = 0; i < S.size(); i++) {
    string s = S.substr(i, T.size());
    if (s.size() != T.size()) continue;
    llong res = 0;
    for (int j = 0; j < s.size(); j++) {
      res += s[j] != T[j];
    }
    ans = min(ans, res);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3624
/*author : Yashvardhan
Friday, May 01, 2020
12:52 PM
*/

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

using ll = long long;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define rev(Y) reverse(all(Y))

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int takemod(int a){return ((a%mod)+mod)%mod;}

int pow(int a, int b, int m)
{
	int ans = 1;
	a %= m;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

int modinv(int a){return takemod( pow( takemod(a), mod-2,mod ) );}


signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	int n,k;
	cin >> n >> k;

	string s;
	cin >> s;

	string ans = "";
	for(int i = 0; i < n; i++){
		if(i == k - 1){
			char req = (s[i] - 'A') + 97;
			ans += req;
		}	
		else ans += s[i];
	}

	cout << ans << endl;
	

	t2 = clock();
	cerr << endl << t2-t1 << endl;
	
	return 0;
}



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

int main(){

	int t = 1;
	//cin >> t;
	while(t--){
		int a;
		string s;
		cin >> a;
		int x = a / 1000;
		//cin >> s;
		cout << (x*1000 - a + 1000) % 1000 << '\n';
	}
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n;
ll sol=0;
ll cnt[10][10];
int a,b;

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

	cin>>n;
    for(int j=1;j<=n;j++)
    {
        int i=j;
        a=i%10;
        while(i!=0)
        {
            b=i;
            i/=10;
        }
        cnt[b][a]++;
    }
    for(int i=1;i<10;i++)
        for(int j=1;j<10;j++)
            sol+=cnt[i][j]*cnt[j][i];
    cout<<sol;

	return 0;
}


Measured memory_bytes: 256
a=list(input())
count=1
ans = 0
temp = 0
for i in range(len(a)-1):
  if a[i] ==a[i+1]:
    count+=1
  else:
    if a[i]=='<':
      ans += count*(count+1)//2
      temp = count
      #print('<', count, ans)
      count = 1
      
    else:
      ans += count*(count+1)//2
      ans -= min(count, temp)
      #print('>', count, ans)
      count =1
else:
  if a[-1]=='<':
    ans += count*(count+1)//2
  else:
    ans += count*(count+1)//2
    ans -= min(count, temp)
print(ans)

Measured memory_bytes: 13244
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
using namespace std;
typedef long long ll;

int main(){
string a,b,c;cin>>a>>b>>c;
cout<<a[0]<<b[1]<<c[2];
}

Measured memory_bytes: 256
#define Bobyama
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 200000;
int N;
string S;

struct data {
  ll lb, ub, numOfA;
};

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

  cin >> S;
  N = len(S);

  vector<data> v;
  for (int i = 0; i < N; ++i) {
    if (S[i] == 'A') {
      int lb = i;
      while (i+1 < N && S[i+1] =='A') ++i;
      ++i;
      int numOfA = i-lb;
      int sb = i;
      while (i+1 < N && S.substr(i, 2) == "BC") i += 2;
      int ub = i;
      if (sb != ub) {
        v.push_back((data){lb, ub, numOfA});
      }
      --i;
    }
  }

  rep(i, len(v)) cerr << "lb: " << v[i].lb << ", ub: " << v[i].ub << ", numOfA: " << v[i].numOfA << endl;

  ll ans = 0;
  for (int i = 0; i < len(v); ++i) {
    vector<data> tmpv;
    tmpv.push_back(v[i]);
    while (i+1 < len(v) && v[i].ub == v[i+1].lb) {
      tmpv.push_back(v[i+1]); ++i;
    }

    ll lastA = tmpv[len(tmpv)-1].ub;
    for (int i = len(tmpv)-1; i >= 0; --i) {
      ans += (lastA-(tmpv[i].lb+tmpv[i].numOfA))/2*tmpv[i].numOfA;
      lastA -= tmpv[i].numOfA;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2168
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define INF 10000000000

ll a, b, c, n, x, y, z, w, h, ans = 0, cnt = 0, mx = 0, mn = INF;
string s;

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

    cin >> n;
    ll list[n + 2];
    list[0] = 0;
    list[n + 1] = 0;
    rep(i, 1, n + 2){
        cin >> list[i];
        cnt += abs(list[i] - list[i - 1]);
    }
    rep(i, 1, n + 1){
        cout << cnt + abs(list[i - 1] - list[i + 1]) - (abs(list[i - 1] - list[i]) + abs(list[i] - list[i + 1])) << endl;
    }
}



Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LL long long int 
const LL MOD=1e9+7;
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//            When something is important enough, you do it even if the odds are not in your favor.

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // code goes here
    int t=1;//cin>>t;
    while(t--){
      LL l,r,d,i;cin>>l>>r>>d;
      LL ans=0;
      fo(i,1,101){
        if(l<=i*d&&i*d<=r) ans++;
      }
      cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 3608
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

R = read_a_int()
print(R * 2 * 3.14159265359)


Measured memory_bytes: 9504
#define _CRT_SECURE_NO_WARNINGS
#define __STDC_FORMAT_MACROS
#include <array>
#include <cinttypes>
#include <cstdio>

using namespace std;

int main()
{
    int64_t K;
    if (scanf("%" PRId64, &K) < 1) return 0;

    if (K == 0)
    {
        printf("%d\n", 2);
        printf("%d %d\n", 1, 1);
    }
    else if (K == 1)
    {
        printf("%d\n", 2);
        printf("%d %d\n", 0, 2);
    }
    else if (2 <= K && K <= 50)
    {
        printf("%" PRId64 "\n", K);
        for (int64_t i = 1; i <= K; i++)
        {
            if (i == 1) printf("%" PRId64, i);
            else printf(" %" PRId64, i);
        }
        printf("\n");
    }
    else
    {
        int64_t tmp = 51;
        int64_t mxv = tmp;
        array<int64_t, 50> ary;

        int64_t div = K / 50;
        if (K % 50 <= 1)
        {
            tmp += (div - 1) * 50;
            mxv += (div - 1);
        }
        else
        {
            tmp += div * 50;
            mxv += div;
        }


        ary[0] = mxv;
        int64_t now = tmp;
        for (int i = 49; 1 <= i; i--)
        {
            if (i == 49) --mxv;
            ary[i] = --mxv;
        }

        while (now != K)
        {
            int64_t val = -1;
            int ix = -1;
            // maxを探す
            for (int i = 0; i < 50; i++)
            {
                if (ary[i] > val)
                {
                    ix = i;
                    val = ary[i];
                }
            }

            bool flg = false;
            for (int i = 0; i < 50; i++)
            {
                if (!flg && ary[i] == val)
                {
                    ary[i] -= 50;
                    flg = !flg;
                }
                else
                {
                    ary[i]++;
                }
            }

            now--;
        }

        printf("%d\n", 50);
        for (int i = 0; i < 50; i++)
        {
            if (i == 0) printf("%" PRId64, ary[i]);
            else printf(" %" PRId64, ary[i]);
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
    int m,n;
    std::cin>>n>>m;
    std::vector <int> v;
    float sum=0;
    for(int i=0; i<n;i++){
        int t;
        std::cin>>t;
        v.push_back(t);
        sum=sum+t;
    }
    std::sort(v.rbegin(),v.rend());
    if(v[m-1]>=sum/(4*m)){
        std::cout<<"Yes"<<std::endl;
    }else{
        std::cout<<"No"<<std::endl;
    }
    return 0;
}

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

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

using namespace std;

void DFS(vector<int> bvec, vector<vector<pair<int, int>>> A, int N, int *max) {
	if (bvec.size() == N) {
		//cout << "unko" << endl;
		rep(i, N) {
			if (bvec[i]) {
				rep(j, A[i].size()) {
					if (bvec[A[i][j].first - 1] != A[i][j].second)return;
				}
			}
		}
		int num = accumulate(bvec.begin(), bvec.end(), 0);
		//cout << num << endl;
		if (*max < num)*max = num;
	}
	else {
		vector<int> bvect = bvec;
		bvect.push_back(1);
		DFS(bvect, A, N, max);
		vector<int> bvecf = bvec;
		bvecf.push_back(0);
		DFS(bvecf, A, N, max);
	}
}

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

	vector<vector<pair<int, int>>> A;
	rep(i, N) {
		int a;
		cin >> a;
		vector<pair<int, int>> vec(a);
		rep(j, a) {
			int x, y;
			cin >> x >> y;
			vec[j] = make_pair(x, y);
		}
		A.push_back(vec);
	}

	int ans = 0;
	vector<int> bvec;
	DFS(bvec, A, N, &ans);
	cout << ans;

}

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

typedef struct data {
    int income, time;
    char name[25];
} data;

int comp(const void* a, const void* b)
{
    data x=*((data*)a), y=*((data*)b);
    int p=x.income*y.time, q=y.income*x.time;
    if (p==q) return strcmp(x.name, y.name);
    return p<q;
}

int main(void)
{
    int n;
    while (scanf("%d", &n), n) {
        data v[51];
        int i;
        for(i=0;i<n;++i) {
            char l[26];
            int p,a,b,c,d,e,f,s,m;
            int j, t=0;
            scanf("%s%d%d%d%d%d%d%d%d%d",l,&p,&a,&b,&c,&d,&e,&f,&s,&m);
            strcpy(v[i].name, l);
            v[i].time=(d+e)*m+a+b+c;
            v[i].income=f*s*m-p;
        }
        qsort(v, n, sizeof(data), comp);
        for(i=0;i<n;++i) puts(v[i].name);
        puts("#");
    }
    return 0;
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, m;
string s;
void solve(){
	cin >> n >> m;
	cin >> s;
	
	vector<int> ans;
	for(int i = n; i > 0;){
		bool ok = 0;
		for(int j = min(m,i); j > 0; j--){
			if(s[i-j] == '1') continue;
			ans.push_back(j);
			i -= j;
			ok = 1;
			break;
		}
		if(!ok){
			cout << -1 << endl;
			return;
		}
	}
	reverse(ans.begin(),ans.end());
	for(auto i = ans.begin(); i != ans.end(); i++){
		cout << *i << " ";
	}
	cout << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 1096
#include <iostream>
using namespace std;
int main() {
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }

    int dp[n];
    dp[n-1]=0;
    dp[n-2]=max(arr[n-1]-arr[n-2],arr[n-2]-arr[n-1]);
    int k=n-2;
    while(k--){
        dp[k]=min(dp[k+1]+abs(arr[k]-arr[k+1]),dp[k+2]+abs(arr[k]-arr[k+2]));
    }
    cout<<dp[0];
}

Measured memory_bytes: 4368
#include<bits/stdc++.h>
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define INF 2000000000
#define PI 3.1415926535897932384626
const ll MOD=1e9+7;
int main(){
	char in[105];
	while(~scanf("%s",in)){
		int l=strlen(in),ans=0;
		for(int i=0,j=l-1;i<l/2;i++,j--) if(in[i]!=in[j]) ans++;
		printf("%d\n",ans);
	}
}



Measured memory_bytes: 256
void main()
{
    long[] tmp = rdRow;
    long n = tmp[0], a = tmp[1];
    long[] x = rdRow;

    long lim = 50 * 50 + 1;
    long[][] dp = new long[][](n+1, lim);

    foreach (i, y; x)
    {
        foreach_reverse (j; 1 .. i+1)
        {
            foreach (k; 0 .. lim-y)
            {
                dp[j+1][k+y] += dp[j][k];
            }
        }
        ++dp[1][y];
    }

    long result;
    foreach (i; 1 .. n+1)
    {
        result += dp[i][i*a];
    }

    result.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    ll n;cin>>n;
    map<ll,ll> mp;
    rep(i,n-1){
        int a;cin>>a;a--;
        mp[a]++;
    }
    rep(i,n)cout<<mp[i]<<endl;
}

Measured memory_bytes: 16072
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>

using namespace std;
typedef long long ll;

//-------------------- Modulo --------------------//
#define MOD (1000000007LL)
#define SIZE (1000000LL)

long long fac[SIZE + 1];
long long inv[SIZE + 1];
long long finv[SIZE + 1];

void modinit(void) {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i <= SIZE; ++i) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i ) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;  
}

long long modcom(long long n, long long k) {
  assert(n >= k);
  assert(n <= SIZE);
  assert(k <= SIZE);
  return fac[n] * finv[n - k] % MOD * finv[k] % MOD;
}
//-------------------- Modulo --------------------//


int main() {
  modinit();
  
  int X, Y;
  cin >> X >> Y;
  
  if ((X + Y) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }

  int N = (X + Y) / 3;
  int a = X - N;
  int b = Y - N;
  
  if (a < 0 or b < 0) {
    cout << 0 << endl;
    return 0;
  }

  cout << modcom(N, a) << endl;
  
  return 0;
}


Measured memory_bytes: 23680
mod = 10**9 + 7
n,m,k = map(int,input().split())
nm = n*m
f = [1]*(nm+1)
for i in range(1,nm+1):
    f[i] = (f[i-1]*i)%mod
def C(n,k):
    x = f[n]
    x *= pow(f[n-k],mod-2,mod)
    x %= mod
    x *= pow(f[k],mod-2,mod)
    x %= mod
    return x
def F(n):
    x = n*n*(n+1)//2
    y = n*(n+1)*(2*n+1)//6
    return (x-y)%mod
res = (m*m%mod*F(n)%mod + n*n%mod*F(m)%mod)%mod
res *= C(n*m-2,k-2)
print(res%mod)

Measured memory_bytes: 10868
#include <iostream>
#include <vector>
#include <string>
#include <queue>

using namespace std;

const int inf = 1 << 30;

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

int main()
{
	int H, W;
	cin >> H >> W;
	vector<string> A(H);
	for (auto &x : A) {
		cin >> x;
	}

	vector<vector<bool>> visited(H, vector<bool>(W, false));

	queue<int> q;

	const int N = H * W;
	int M = 0;

	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (A[i][j] == '#') {
				q.push(i);
				q.push(j);
				visited[i][j] = true;
				++M;
			}
		}
	}
	int ans = 0;
	while (M < N) {
		queue<int> next;
		while (!q.empty()) {
			int i = q.front(); q.pop();
			int j = q.front(); q.pop();
			for (int k = 0; k < 4; ++k) {
				int i2 = i + dy[k];
				int j2 = j + dx[k];
				if (0 <= i2 && i2 < H && 0 <= j2 && j2 < W) {
					if (!visited[i2][j2]) {
						visited[i2][j2] = true;
						++M;
						next.push(i2);
						next.push(j2);
					}
				}
			}
		}
		q = move(next);
		++ans;
	}
	cout << ans << endl;
}


Measured memory_bytes: 9616
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mm multimap<ll,ll>
#define mp make_pair
#define pii pair<ll,ll>
 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    ll w;
    cin>>w;
    ll arr[n][2];
    ll ts=0;
    
    for(ll i=0;i<n;i++)
    {
        cin>>arr[i][0]>>arr[i][1];
        ts+=arr[i][1];
    }
    //cout<<ts;
    //cout<<arr[0][0]<<arr[0][1];
  ll  dp[ts+1];dp[0]=0;
  for(ll i=1;i<=ts;i++)
  dp[i]=INT_MAX;
  
    for(ll i=0;i<n;i++)
    {
        ll a=arr[i][0];ll b=arr[i][1];
        for(ll j=ts;j>0 && j-b>=0;j--)
       
        dp[j]=min(dp[j-b]+a,dp[j]);
    }
    ll m=0;
    //cout<<dp[30];
    for(ll i=1;i<=ts;i++)
    {
        if(dp[i]!=0 && dp[i]<=w)
        m=i;
    }
    cout<<m;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    
    long ans = 1;
    
    ans = ans * b;
    a--;
    
    for(int i = 0; i < a; i++){
      ans = ans * (b - 1);
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5+5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



n = int(input()) 
n += 1
a = list(map(int,input().split()))

x = y = 0
b = [-1 for i in range(n)]
for i in range(len(a)):
    if b[a[i]] != -1:
        x = b[a[i]]
        y = i
        break 
    else:
        b[a[i]] = i

for k in range(1,n+1):
    print((cmb(n,k,mod)-cmb(n+x-y-1,k-1,mod))%mod)

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

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

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

using namespace std;

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

    int e;
    long long int ans = 0;
    e = k - a;
    ans += e > 0 ? a : k;
    e -= b;
    ans -= e > 0 ? e : 0;
    cout << ans << endl;
}

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


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

    int n;
    cin>>n;
    ll ans=0;
    vector<int>a(n+1),b(n+1);
    rep(i,n){
        cin>>a[i+1];
        b[a[i+1]]=i+1;
    }
    set<int> s;
    s.insert(0);
    s.insert(n+1);

    forx(i,1,n+1){
        s.insert(b[i]);
        auto z=s.find(b[i]);
      	z--;
        ll x = b[i]- *z;
      	z=s.find(b[i]);
        z++;
        ll y = *z -b[i];
        ans+=x*y*(ll)i;
    }

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



Measured memory_bytes: 11264
#include<iostream>
 using namespace std ;
 int main()
{
	 char a,b,c,d,e,f,g,h,i;
	 cin>> a>>b>>c;
	 cin>> d>>e>>f;
	 cin>>g>>h>>i;
 	cout<< a<<e<<i;
   	return 0;
 }

Measured memory_bytes: 2964
S = input()

Rnum=0
Lnum=0
list1=[]

#RとLをまとめてリスト作成
for i in S:
    if i=="R":
        if(Lnum!=0):
            list1.append([Rnum, Lnum])
            Rnum=0
            Lnum=0
        Rnum+=1;
    else:
        Lnum+=1;

if(Lnum!=0):
    list1.append([Rnum, Lnum])
    Rnum=0
    Lnum=0

list2=[]

for i in list1:
    rl=i[0]+i[1]
    if(rl%2==0):
        for j in range(rl):
            if(j == i[0]-1):
                list2.append(rl//2)
            elif(j == i[0]):
                list2.append(rl//2)
            else:
                list2.append(0)
    else:
        if(i[1]%2==0):
            for j in range(rl):
                if(j == i[0]-1):
                    list2.append(rl//2+1)
                elif(j == i[0]):
                    list2.append(rl//2)
                else:
                    list2.append(0)
        else:
            for j in range(rl):
                if(j == i[0]-1):
                    list2.append(rl//2)
                elif(j == i[0]):
                    list2.append(rl//2+1)
                else:
                    list2.append(0)

print(' '.join(map(str, list2)))

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

int main(){
    while(true){
        int h,w;
        cin >> h >> w;
        if(h == 0 and w == 0){
            break;
        }
        vector<vector<char> > chess(h,vector<char>(w));
        
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                if(i%2==0){
                    if(j%2==0) chess[i][j] = '#';
                    else chess[i][j] = '.';
                }
                else {
                    if(j%2==0) chess[i][j] = '.';
                    else chess[i][j] = '#';
                }
            }
        }
        
        rep(i,h){
            rep(j,w){
                cout << chess[i][j];
                if(j == w - 1) cout << endl;
            }
        }
        cout << endl;
    }
}







Measured memory_bytes: 3164
#include<iostream>
#include<fstream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<ctime>
#include<random>
#include<algorithm>
#define ll long long
using namespace std;
struct T
{
    ll a,b;
}s[120000];

bool cmp(T x,T y)
{
    return x.a+x.b>y.a+y.b;
}
int n;
int main()
{
    scanf("%d",&n);
    for (int i=0; i<n; ++i)
        scanf("%lld%lld",&s[i].a,&s[i].b);
    sort(s,s+n,cmp);
    ll ans1=0,ans2=0;;
    for (int i=0; i<n; ++i)
    {
        if ((i&1)==0)
            ans1+=s[i].a;
        else ans2+=s[i].b;
    }
    cout<<ans1-ans2<<endl;

    return 0;
}


Measured memory_bytes: 1792
//#pragma comment(linker,"/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>pii;
const int INF=0x3f3f3f3f;
#define _for(i, a, b) for (int i = (a); i < (b); ++i)
#define _rep(i, a, b) for (int i = (a); i <= b; ++i)
const int max_number=1000000;



int main()
{
    int a, b;
    cin>>a>> b;
    cout << a * b << " " << (a + b) * 2 << endl;
    return 0;
}


Measured memory_bytes: 3116
#include <stdio.h>
#include <string.h>
char s1[100],s2[100],p[100];

int main(void) {
    scanf( "%s %s", s1, p );
    strcpy( s2, s1 );
    strcat( s1, s2 );
    if( strstr( s1, p ) == NULL ) printf( "No\n" );
    else printf( "Yes\n" );
    return 0;
}


Measured memory_bytes: 2756
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >>N;
  vector<tuple<string,int,int>> a;
  for(int i=1;i<=N;i++){
    string s;
    int p;
    cin >> s >> p;
    p = -p;
    a.push_back(tie(s,p,i));
  }
  
  sort(a.begin(),a.end());
  for(int i=0;i<N;i++){
    cout << get<2>(a[i]) <<endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong(), b = sc.nextLong(), c = sc.nextLong();
        long k = sc.nextLong();
        if(k <= a){
            System.out.println(k);
        }else if(k <= a + b){
            System.out.println(a);
        }else{
            System.out.println(a - (k - a - b));
        }
    }
}


Measured memory_bytes: 27084
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	int N, L;
	cin >> N >> L;
	vector<string> S(N);
	for (int i = 0; i < N; i++) cin >> S[i];

	sort(begin(S), end(S));

	for (auto s : S) cout << s;
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
// D - Powerful Discount Tickets
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rp(i,n) for(int i=0;i<(n);i++)

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

	vector<int> A(N);
	vector<pair<int,int>> B;
	rp(i, N){
		cin>>A[i];
		for(int a=A[i]; a>0; a>>=1) B.push_back(make_pair(a, i));
	}

	sort(B.rbegin(), B.rend());

	vector<int> counting(N);
	rp(i, min(M, (int)B.size())) counting[B[i].second]++;

	ll ans = 0;
	rp(i,N) ans += (ll)A[i]>>counting[i];
	cout<< ans <<endl;
}


Measured memory_bytes: 35172
#include<stdio.h>
int main()
{
	int a,b;
	while (scanf("%d %d",&a,&b)==2)
	{
		int sum=a+b;
		int c=0;
		while (sum>0)
		{
			sum=sum/10;
			c++;
		}
		printf("%d\n",c);
	}
	return 0;
}

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

int main()
{
    ll N, M; cin >> N >> M;
    vector<set<ll>> v(N);
    rep(i,M) {
        ll t1, t2; cin >> t1 >> t2;
        t1--;
        t2--;
        v[t1].insert(t2);
        v[t2].insert(t1);    
    }
#if 0
    rep(i,N) {
        for (auto j : v[i]) {
            cout << j << " ";
        }
        cout << endl;
    }
#endif
    vector<int> dist(N, -1);
    vector<int> m(N, 0);
    for (int j = 0; j < N; ++j) {
        if (m[j] == 1) continue;        
        queue<ll> que;
        que.push(j);
        m[j] = 1;
        int num = 0;
        while (1) {
            if (que.empty()) break;
            ll f = que.front();
            num++;
            que.pop();
            for (auto i : v[f]) {
                if (m[i] != 1) {
                    que.push(i);
                    m[i] = 1;
                }
            }
        }
        dist[j] = num;
    }
    sort(dist.begin(), dist.end(), greater<ll>());
    cout << dist[0] << endl;

}


Measured memory_bytes: 33540
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define input freopen("input.txt", "r", stdin);
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);



#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
int main()
{
    ll n, ans=0, sum=0;
    cin>>n;
    ll a[n];
    for(ll i=0; i<n; i++) cin>>a[i];
    for(ll i=n-2; i>=0; i--){
        ll x = a[i];
        sum = (sum + a[i+1]) % mod;
        ll prc = x * sum % mod;
        ans = (ans + prc) % mod;
    }
    cout<<ans;
}








Measured memory_bytes: 5160
#include <bits/stdc++.h>
#define repi(i,x,n) for(int i = x; i < n; i++)
#define rep(i,n) repi(i,0,n)
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;

#define int long long

#define f first
#define s second

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

    cout<<fixed<<setprecision(10);

    int N;
    vector<pair<int,pair<pair<int,int>,pair<int,int>>>> t;
    vector<pair<int,int>> a, b;

    cin>>N;

    t.resize(N);

    for(int i = 0; i < N; i++){
        cin>>t[i].f>>t[i].s.f.f>>t[i].s.f.s>>t[i].s.s.f>>t[i].s.s.s;
    }


    sort(t.begin(), t.end());

    for(int i = 0; i < N; i++){
        if(i && t[i-1].s.f.s == t[i].s.f.s && t[i].s.f.f != t[i-1].s.f.f){
            if(t[i].s.f.s == 0){
                a.push_back(make_pair((t[i-1].s.s.s - t[i].s.s.s)*(t[i-1].s.s.s - t[i].s.s.s) + (t[i-1].s.s.f - t[i].s.s.f)*(t[i-1].s.s.f - t[i].s.s.f), t[i].f - t[i-1].f));
                a[a.size()-1].f *= -1;
            } else {
                
                b.push_back(make_pair((t[i-1].s.s.s - t[i].s.s.s)*(t[i-1].s.s.s - t[i].s.s.s) + (t[i-1].s.s.f - t[i].s.s.f)*(t[i-1].s.s.f - t[i].s.s.f), t[i].f - t[i-1].f));
                 b[b.size()-1].f *= -1; 
            }
        }
    }

    sort(a.begin(), a.end());
    

    sort(b.begin(), b.end());

    if(a.size() == 0) cout<<-1<<" "<<-1<<endl;
    else cout<<sqrt(-a[0].first)<<" "<<(double)a[0].second/60<<endl;;

    
    if(b.size() == 0) cout<<-1<<" "<<-1<<endl;
    else cout<<sqrt(-b[0].first)<<" "<<(double)b[0].second/60<<endl;;


    
    return 0;
}



Measured memory_bytes: 3352
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define OUT(s) cout << s << "\n";

long K;
using namespace std;
// https://atcoder.jp/contests/abc162/tasks

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    }

    return gcd(b, a % b);
}

void Main()
{
    long a = 0;
    REP(i, K) {
        REP(ii, K) {
            REP(iii, K) {
                int tmp = gcd((i+1), (ii+1));
                a = a + gcd(tmp, (iii+1));
            }
        }
    }
    OUT(a);
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> K;
    // cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int t = 0;
  for(int i = 0;i <= 100;i++) {
    if(a <= i && i <= b && c <= i && i <= d) {
      t++;
    }
  }
  if(t != 0) {
    cout << t - 1 << endl;
  }else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
n,y = map(int,input().split())
import sys
for i in range(n+1):
    for j in range(n+1-i):
        if 10*i + 5*j + (n-i-j) == y//1000:
            print(i,j,n-i-j)
            sys.exit()

print(-1,-1,-1)

Measured memory_bytes: 3060
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
 
using namespace std;
using ll = long long;
 
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
 
int main()
{
	string s;
	int i, a, b;

	cin >> s;
	for(i = 0; i < s.size(); i++){
		if(s[i] == 'A'){
			a = i;
			break;
		}
	}
	for(i = s.size() - 1; i >= 0; i--){
		if(s[i] == 'Z'){
			b = i;
			break;
		}
	}

	cout << b - a + 1<< endl;
}

Measured memory_bytes: 640
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var sc = bufio.NewScanner(os.Stdin)

const inf = 1 << 60

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

type pair struct {
	b, c int
}

type byC []pair

func (p byC) Len() int { return len(p) }

func (p byC) Swap(i, j int) { p[i], p[j] = p[j], p[i] }

func (p byC) Less(i, j int) bool { return p[i].c > p[j].c }

func larger(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	sc.Split(bufio.ScanWords)
	n, m := ri(), ri()

	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = ri()
	}

	sort.Ints(a)

	q := make([]pair, m) // クエリ
	for i := 0; i < m; i++ {
		q[i] = pair{b: ri(), c: ri()}
	}

	// c で降順にソート
	sort.Sort(byC(q))

	ans := 0
	j := 0 // 限界値は m-1
	for i := 0; i < n; i++ {
		if j < m && q[j].c > a[i] {
			ans += q[j].c
			q[j].b--
			if q[j].b == 0 {
				j++
			}
		} else {
			ans += a[i]
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 3072
x,n = map(int,input().split())
if n!=0:
    p = list(map(int,input().split()))
    li = set([i for i in range(102)])
    li = li-set(p)
    k=10**9
    m=0
    li=sorted(list(li))
    for i in li:
        if k>abs(x-i):
            k=abs(x-i)
            m=i
    print(m)
else:
    print(x)

Measured memory_bytes: 9232