akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
	string s[200];
	int n,l;

	cin >> n >> l;

	for(int i =0; i <n;i++)cin >> s[i];
	sort(s,s+n);
	for(int i =0; i <n;i++)cout <<s[i];
	cout <<endl; 

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define It set<node>::iterator
#define endl '\n'
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

const int maxn=2e5+10;
const int inf=0x3f3f3f3f;

int n;
int arr[maxn];
map<int,int> mp;

int main(){
	cin>>n;
	for(int i=1;i<=n;++i) cin>>arr[i];
	for(int i=1;i<=n;++i){
		if(mp[arr[i]]) return puts("NO"),0;
		++mp[arr[i]];
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 10368
#include <iostream>
#include <string>
using namespace std;
 
int main() {
    string s, t;
    int i, cnt;
    cnt = 0;

    cin >> s >> t;

    for(i=0; i<3;i++){
        if(s[i]==t[i]){
            cnt++;
        }
    }
    cout << cnt << endl;
}

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

int main() {
	long a, b, c;
	char op;
	
	while (cin >> a >> op >> b){
		if (op == '+') c = a + b;
		if (op == '-') c = a - b;
		if (op == '*') c = a * b;
		if (op == '/') c = a / b;
		if (op == '?') break;
		cout << c << endl;
	}
}

Measured memory_bytes: 1160
<?PHP
$first_line = fgets(STDIN);
$second_line = fgets(STDIN);
$first_line_array = explode(" ", $first_line);
$steps_amount=$first_line_array[0];
//ジャンプで飛べる足場の数
$skip_power=$first_line_array[1];
$steps_heights = explode(" ", $second_line);

//足場ごとにたどり着くまでのコストの総和の最小値を入れていく配列
$dps=[];

foreach (range(0, $steps_amount-1) as $index) {

    // 最初にいた足場に辿り着くまでのコストは０
    if($index===0){
        $dps[0]=0;
        continue;
    }

    // 一つ前の踏み台につくまでの総コスト
    $previous_total_cost=$dps[$index-1];
    // 一つ前の踏み台から飛ぶためのコスト
    $jump_cost=abs($steps_heights[$index]-$steps_heights[$index-1]);
    // とりあえず一つ前の踏み台から飛んだ場合の総コストで初期化して、数を比較して最小値を入れていく
    $dps[$index]= $previous_total_cost+$jump_cost;

    // 足場を飛ばした場合のことを考える
    foreach (range(1, $skip_power) as $i) {
        if($index>=$i){
            $new_total_cost=abs($dps[$index - $i] + abs($steps_heights[$index] - $steps_heights[$index - $i]));
            // 足場を飛ばした時のコストの方が少ない場合は値を更新する
            if ($dps[$index]> $new_total_cost){
                $dps[$index]=$new_total_cost;
            }
        }
    }
}

echo end($dps);


Measured memory_bytes: 23028
def f():
 for c in range(n):
  for d in a[c+1:]:
   for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):
    if[d[p[0]],d[p[5]]]==a[c][::5]:
     f=[d[i]for i in p[1:5]]*2
     for k in range(4):
      if f[k:k+4]==a[c][1:5]:return"No"
 return"Yes"
b=0
n=int(input())
a=[input().split()for _ in[0]*n]
for b in a:b[3:5]=b[4],b[3]
print(f())


Measured memory_bytes: 5608
n = int(input())
a = []
b = []
for i in range(n):
    A, B = map(int, input().split())
    a.append(A)
    b.append(B)
a.sort()
b.sort()
if n%2 == 0:
    m = n//2
    c = (b[m-1]+b[m])-(a[m-1]+a[m])
else:
    m = n//2+1
    c = b[m-1]-a[m-1]
print(c+1)

Measured memory_bytes: 25528
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iterator>
#include <fstream>
#include <math.h>

#include <random>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <list>
#include <bitset>
#include <unordered_set>
#include <unordered_map>

#include <random>
#include <ctime>

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define FOR(i, from, to) for (int i = from; i < to; i++)
#define ROF(i, from, to) for (int i = from; i > to; i--)

const long double PI = 3.141592653589793238463;
const int INF = 0x3f3f3f3f;
const int INFS = 1000000000;
const ll M = 1000000007;
const ll LLINF = 1000000000000000000;
const double EPS = 1e-8;

#define int long long

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;
    vector<pair<int, int> > a(n);
    FOR(i, 0, n) {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a.begin(), a.end());
    set<int> curr = {};
    int ans = 0, l, r;
    for (auto x : a) {
        auto itl = curr.lower_bound(x.second);
        auto itr = itl;
        if (itl == curr.begin()) {
            l = -1;
        } else {
            l = *(--itl);
        }
        if (itr == curr.end()) {
            r = n;
        } else {
            r = *itr;
        }
        ans += x.first * (x.second - l) * (r - x.second);
        curr.insert(x.second);
    }
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 15860
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>

#define SIZE 100005
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
using namespace std;


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

	ll a;
	a=(N+1)/2-1;

	printf("%lld", a);
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int D = sc.nextInt();
		int N = sc.nextInt();
		if (N != 100) {
			int kotae = (int) (Math.pow(100, D)) * N;
			System.out.println(kotae);
		}else{
			int kotae = (int) (Math.pow(100, D)) * (N+1);
			System.out.println(kotae);
		}

	}

}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define mp(a,b) make_pair((a),(b))
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

const int max_v=100;
struct edge{int to,cap,rev;};
vector<edge> graph[max_v];
bool used[max_v];

void add_edge(int from,int to,int cap){
    graph[from].push_back(edge{to,cap,int(graph[to].size())});
    graph[to].push_back(edge{from,0,int(graph[from].size()-1)});
}

int ford_fulkerson_dfs(int v,int t,int f){
    if(v==t) return f;
    used[v]=true;
    for(auto &e:graph[v]){
        if(used[e.to] or e.cap<=0) continue;
        int d=ford_fulkerson_dfs(e.to,t,min(f,e.cap));
        if(d>0){
            e.cap-=d;
            graph[e.to][e.rev].cap+=d;
            return d;
        }
    }
    return 0;
}

int ford_fulkerson(int s,int t){
    int flow=0,f;
    while(true){
        fill_n((bool*)used,max_v,false);
        f=ford_fulkerson_dfs(s,t,inf);
        if(f==0) return flow;
        flow+=f;
    }
}

void solve(){
    int v_size,e_size;
    cin >> v_size >> e_size;
    rep(i,0,e_size){
        int u,v,c;
        cin >> u >> v >> c;
        add_edge(u,v,c);
    }
    
    cout << ford_fulkerson(0,v_size-1) << endl;
}

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

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

using namespace std;
typedef long long ll;

int main() {
    ll n, a, max = -1000001, min = 1000001, sum = 0;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        if (max < a) max = a;
        if (min > a) min = a;
        sum += a;
    }
    printf("%ld %ld %ld\n", min, max, sum);
    return 0;
}


Measured memory_bytes: 3216
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import lru_cache, reduce
from math import gcd
from operator import add, itemgetter, mul, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353




S = sys.stdin.buffer.readline().decode().rstrip()
print(S[:3])


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

int main() {
	long min;
	int N, minus_count, min_index;
	vector<long> A;

	cin >> N;

	int temp;
	minus_count = 0;
	min = 1000000000;
	min_index = 0;
	for(int i = 0; i < N; i++) {
		cin >> temp;

		if(temp < 0)
			minus_count++;

		if(abs(temp) < min) {
			min = abs(temp);
			min_index = i;
		}

		A.push_back(temp);
	}

	long ans = 0;
	for(int i = 0; i < N; i++) {
		if(i == min_index && minus_count % 2 == 1)
			ans -= min;
		else
			ans += abs(A[i]);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1400
using System;

namespace AOJ.Volume0
{
    public class WhatDayIsToday
    {
        public static void Main()
        {
            while (true)
            {
                var input = Console.ReadLine().Split(' ');
                int month = int.Parse(input[0]);
                int day = int.Parse(input[1]);
                if (month == 0) { break; }

                DateTime d = new DateTime(2004, month, day);
                Console.WriteLine(d.ToString("dddd"));
            }
        }
    }
}

Measured memory_bytes: 9436
N, K = map(int, input().split())
p = [int(x) for x in input().split()]

sum = 0
e = [0] * 1001
for i in range(1, 1000 + 1):
    sum += i
    e[i] = sum / i
    # print(i, e[i])


maxV = 0
maxI = 0
for i in range(0, K):
    maxV += p[i]

tmp = maxV
# [1 ..  2]
for i in range(1, N-K+1):
    tmp -= p[i-1]
    tmp += p[i+K-1] 
    if tmp > maxV:
        maxV = tmp
        maxI = i
    
    
    
    
    

ans = 0
for i in range(maxI, maxI + K):
    ans += e[p[i]]

print(ans)

Measured memory_bytes: 24676
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vvl = vector<vector<ll>>;
using vl  = vector<ll>;
#define _GLIBCXX_DEBUG
#define acc_io cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(ll i=sta;i<end;i++)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
const ll MOD = 1000000007;
const double PI = acos(-1);  
//name[i]   -> vl  name(i)
//name[i][j]-> vvl name(i,vl(j))
//or-> ||
//map<int,int>mp

ll n,k;
ll ans;
//string s;
signed main(){
	acc_io;
	ans=0;
	cin>>n>>k;
	int a[200010];
	int pass[200010]={0};
	rep(i,1,n+1) cin>>a[i];
	ll cyc=1;
	ll sta=0;
	map<int,int>mp;
	int next=1;
	pass[1]=1;
	while(1){
		if(pass[a[next]]){
			sta=pass[a[next]]-1;
			cyc=cyc-pass[a[next]]+1;
			break;
		}
		else{
			cyc++;
			pass[a[next]]=cyc;
			next=a[next];
		}
	}
//	cout<<sta<<" "<<cyc<<" "<<endl;
	if(k>(sta+cyc)){
		k=(k-sta)%cyc;
		k+=sta;
		k+=cyc;
	}
//	cout<<k<<endl;
	int j=1;
	rep(i,0,k){
		next=a[j];
		j=next;
//		cout<<j<<" "<<next<<endl;
	}
	cout<<next<<endl;
	return 0;
}


Measured memory_bytes: 5220
n, k = map(int, input().split())
a = list(map(int, input().split()))
a = [0] + a
c = [1]
x = True
y = [1, 1] + [0]*(n-1)

while x:
    c.append(a[c[-1]])
    y[c[-1]] += 1
    if y[c[-1]] == 2:
        x = False

t = c.index(c[-1])
if k <= t:
    ans = c[k]
else:
    ans = c[t + ((k-t) % (len(c)-1-t))]

print(ans)

Measured memory_bytes: 32380
from collections import defaultdict
import math




if __name__ == '__main__' :
    n = int(input())
    R = [int(input()) for i in range(n)]
    maxv = R[1]-R[0]
    minv = min(R[0],R[1])
    for j in range(2,n):
        maxv = max(maxv,R[j]-minv)
        minv = min(minv,R[j])
    print(maxv)   


Measured memory_bytes: 14060
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=1e9,dx[]={-1,0,1,0},dy[]={0,-1,0,1};
int n,a[3][105],ans,x,y;
int main(){
	cin>>n;
	for(int i=1;i<=2;i++)
		for(int j=1;j<=n;j++)
			cin>>a[i][j];
	for(int i=1;i<=2;i++)
		for(int j=1;j<=n;j++)
			a[i][j]=a[i][j-1]+a[i][j];
	for(int i=1;i<=n;i++)
	{
		ans=max(ans,int(a[1][i]+a[2][n]-a[2][i-1]));
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

int main(void){
	string s; cin >> s;
	bool flagN = false, flagW = false, flagS = false, flagE = false;
	rep(i, s.size()){
		if(s[i] == 'N') flagN = true;
		else if(s[i] == 'W') flagW = true;
		else if(s[i] == 'S') flagS = true;
		else if(s[i] == 'E') flagE = true;
	}

	if(flagN && !flagE && flagS && !flagW) printf("Yes\n");
	else if(!flagN && flagE && !flagS && flagW) printf("Yes\n");
	else if(flagN && flagE && flagS && flagW) printf("Yes\n");

	else printf("No\n");

	return 0;
}

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

int main(){
    ll h, n;
    cin >> h >> n;
    ll a;
    ll sum = 0;
    rep(i, n){
        cin >> a;
        sum += a;
    }
    if(sum>=h){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3600
#include <stdio.h>

#define lli long long int

lli banyak[100010], ketua[100010], ketinggian[100010];

lli count(lli x) {
	return (x * (x - 1) / 2);
}

lli cari(lli y) {
	return ((ketua[y] == y) ? y : cari(ketua[y]));
}

void join(lli p, lli q) {
	if (ketinggian[p] > ketinggian[q]) {
		ketua[q] = p;
		banyak[p] += banyak[q];
	}
	else {
		ketua[p] = q;
		banyak[q] += banyak[p];
		if (ketinggian[p] == ketinggian[q])
			ketinggian[q]++;
	}
}

int main() {
	lli n, m, a[100010], b[100010], temp, ans[100010], u, v;
	scanf("%lld %lld", &n, &m);
	for (lli i = 1; i <= n; i++) {
		ketua[i] = i;
		ketinggian[i] = 0;
		banyak[i] = 1;
	}
	for (lli i = 1; i <= m; i++)
		scanf("%lld %lld", &a[i], &b[i]);
	temp = count(n);
	for (lli i = m; i > 0; i--) {
		ans[i] = temp;
		u = cari(a[i]);
		v = cari(b[i]);
		if (u != v) {
			temp += count(banyak[u]);
			temp += count(banyak[v]);
			temp -= count(banyak[u] + banyak[v]);
			join(u, v);
		}
	}
	for (lli i = 1; i <= m; i++)
		printf("%lld\n", ans[i]);
	return 0;
}

Measured memory_bytes: 5888
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int i,j,k,n,sum,x,y;
	char a[105];
	int b[27];
	scanf("%d",&n);
	cin>>a;
	sum=0;
	for(i=0;i<n;i++)
	{
		x=0;
		for(j=0;j<26;j++)
			b[j]=0;
		for(j=0;j<=i;j++)
		{
			y=a[j]-'a';
			if(b[y]==0)
				for(k=i+1;k<n;k++)
					if(a[k]==a[j])
					{
						b[y]=1;
						x++;
						break;
					}
		}
		if(x>sum)
			sum=x;
	}
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 256
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c<=32)c=_buff.get();return c;}
ll qpow(ll x,ll k){return k==0?1:1ll*qpow(1ll*x*x%mod,k>>1)*(k&1?x:1)%mod;}
ll n,a[100111];
int p[100111],pn;
int main()
{
	geti(n);
	for(int i=1;i<=n;i++)
	{
		char op;
		if(i>1)op=getreal();
		else op='+';
		geti(a[i]);
		a[i]+=a[i-1];
		if(op=='-')p[pn++]=i;
	}
	ll s=0;
	ll ans=-1e18;
	for(int i=0;i<pn;i++)
	{
		if(i+1<pn)
		{
			ans=max(ans,a[n]-(a[p[i+1]-1]-a[p[i]-1]+s)*2);
		}
		s+=a[p[i]]-a[p[i]-1];
	}
	ans=max(ans,a[n]-s*2);
	cout<<ans<<endl;
	return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  // Including tree_order_statistics_node_update

using namespace __gnu_pbds;
using namespace std;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
#define minei(x) min_element(x.begin(), x.end()) - (x).begin()
#define maxei(x) max_element(x.begin(), x.end()) - (x).begin()
#define LSOne(S) (S & (-S))

#define uns(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
#define acusum(x) accumulate(x.begin(), x.end(), 0)
#define acumul(x) accumulate(x.begin(), x.end(), 1, multiplies<int>());
#define bits(x) __builtin_popcount(x)
#define oo INT_MAX
#define inf 1000000000
#define MAXN 1000007
#define MOD 1000000007

const double pi = acos(-1.0);
const double eps = 1e-11;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

int main() {
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    ll k;
    cin >> n >> k;
    vector<int> tele(n + 1);
    vector<int> vis(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        cin >> tele[i];
    }
    int indx = 1;
    int st = -1;
    while (true) {
        if (vis[indx]) {
            st = indx;
            break;
        }
        vis[indx] = 1;
        indx = tele[indx];
    }
    vector<int> path;
    vector<int> cycle;
    indx = 1;
    while (indx != st) {
        path.push_back(indx);
        indx = tele[indx];
    }
    indx = st;
    while (true) {
        cycle.push_back(indx);
        indx = tele[indx];
        if (indx == st) break;
    }

    if (k < sz(path)) {
        cout << path[k] << endl;
    } else {
        k -= sz(path);
        int m = sz(cycle);
        cout << cycle[k % m] << endl;
    }

    return 0;
}


Measured memory_bytes: 5884
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#include <vector>
#include <queue>
using namespace std;
typedef long long LL;

LL n,m,k;
LL cnt[15][15] = {0},ans = 0;

LL get_h(LL x){
	while(1){
		if(x / 10 > 0) x /= 10;
		else break;
	}
	return x;
}

int main(){
	ios::sync_with_stdio(false);
	cin >> n;
	for(LL i = 1;i <= n;i ++){
//		cout << i << ' ' << get_h(i) << endl;
		cnt[get_h(i)][i % 10] ++;
	}
	for(LL i = 0;i <= 9;i ++){
		for(LL j = 0;j <= 9;j ++){
			ans += cnt[i][j] * cnt[j][i];
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define F first
#define S second
#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(int i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
typedef long long ll; typedef pair <int, int> ii; typedef vector <int> vi; const int inf = 1e9 + 7;
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cout << str << " : " << t << endl;}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cout << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cout << "["; for (T i = a; i != b; ++i) {if (i != a) cout << ", "; cout << *i;} cout << "]";cout<<endl;}

struct node {
	int nxt[2];
	bool h;
	node() {
		memset(nxt, 0, sizeof nxt);
		h = 0;
	}
};
vector<node> T;
ll L;
string s;
void add(int i, int pos) {
	if (pos == s.length()) return(void)(T[i].h=1);
	if (!T[i].nxt[s[pos]-'0']) T.emplace_back(), T[i].nxt[s[pos]-'0']=sz(T)-1;
	add(T[i].nxt[s[pos]-'0'], pos+1);
}
inline ll g(ll x) {
	if (x == 0) return 0;
	return 1LL<<__builtin_ctzll(x);
}
ll qry(int i, int d) {
	if (T[i].h) return 0;
	ll ans = 0;
	FOR (b, 0, 1) {
		if (T[i].nxt[b]) ans ^= qry(T[i].nxt[b], d+1);
		else ans ^= g(L-d);
	}
	return ans;
}
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);

	T.emplace_back();
	int n; cin >> n >> L; while (n--) {
		cin >> s;
		add(0, 0);
	}
	cout << (qry(0, 0) ? "Alice\n": "Bob\n");

	return 0;
}


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

int main(){
    string S; cin>>S;
    bool can=true;
    int size=S.size();
    for(int i=0;i<size;i++){
        if(S[i]!=S[size-i-1]){
            can=false;
        }
    }
    int count=0;
    for(int i=(size-1)/2;i<=(size-1)/2-1;i++){
            if (S[i] != S[(size - 1) / 2-1-count]) {
                can = false;
            }
            count++;
    }
    int count2=0;
    for(int i=(size+3)/2-1;i<size;i++){
            if (S[(size+3)/2-1+count] != S[size -1-count]){
                can=false;
        }

    }

    if(can){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 256
N,M,K=map(int,input().split())
par=[0]*(N+1)
num=[0]*(N+1)
group = [1]*(N+1)

for i in range(1,N+1): par[i]=i

def root(x):
  if par[x]==x: return x
  return root(par[x])

def union(x,y):
  rx = root(x)
  ry = root(y)
  if rx==ry: return
  par[max(rx,ry)] = min(rx,ry)
  group[min(rx,ry)] += group[max(rx,ry)]

def same(x,y):
  return root(x)==root(y)     

for _ in range(M):
  a,b=map(int,input().split())
  union(a,b)
  num[a]+=1
  num[b]+=1
for _ in range(K):
  c,d=map(int,input().split())
  if same(c,d):
    num[c]+=1
    num[d]+=1

for i in range(1,N+1):
  print(group[root(i)]-num[i]-1,end=" ")

Measured memory_bytes: 14624
#include <bits/stdc++.h>
 
#define ll          long long
#define ld          long double
#define pb          push_back
#define pf          push_front
#define mp          make_pair
#define pll         pair<ll,ll>
#define vl          vector<ll>
#define sl          set<ll> 
#define vll         vector<pll>
#define ml          map<ll,ll>
#define mll         map<pll,ll>
#define all(a)      a.begin(),a.end()
#define x           first
#define y           second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define mod         (ll)1000000007
#define lp(i,a,b)   for(ll i=a;i<b;++i)
#define lpr(i,a,b)  for(ll i=a;i>=b;i--)
#define lpd(i,x)    for(auto i:x)
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ll inf = (ll)1e18;
ld pi = 3.141592653589;
using namespace std;

ll bpow(ll x, ll v) {	
	if (v == 0)
		return 1 % mod;
	if (v % 2 == 1)
		return (x * bpow(x, v - 1)) % mod;
	ll r = bpow(x, v / 2);
	return (r * r) % mod;	
}

ll lcm(ll a,ll b)
{
	ll ret=(a*b)/__gcd(a,b);
	return ret;
} 

ll solve(){ 
	ll n,i=0,p,q; cin>>n;
	vl a(n),b(n),c(n); lp(i,0,n) cin>>a[i];
	lp(i,0,n) cin>>b[i];
	lp(i,0,n) c[i]=i+1;
	do {
		i++;
		if(a==c) p = i;
		if(b==c) q = i;
	}while(next_permutation(all(c)));
	cout<<abs(p-q);
}
int main(){
    ios
    ll t=1; 
    //cin>>t;
    while(t--){
    	solve();
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

template <class T>
void cout_vec2(const vector<vector<T>> &vec){
  rep(i,vec.size()){
    rep(j,vec[i].size()){
      cout<<vec[i][j]<<' ';
    }
    cout<<endl;
  }
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;
static const double pi = 3.141592653589793;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double a,b,x;
  cin>>a>>b>>x;
  double v=a*a*b;
  v/=2.0;
  if(x<=v){
    double now=2*x/(a*b*b);
    double rad=atan(now);
    double ang=rad*180.0/pi;
    cout<<setprecision(15)<<90-ang<<endl;
  }else{
    double now=(a*a*a)/(2*(b*a*a-x));
    double rad=atan(now);
    double ang=rad*180.0/pi;
    cout<<setprecision(15)<<90-ang<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vb=vector<bool>;
using vvb=vector<vb>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N;
  cin >> N;
  vi A(N);
  rep(i,N) cin >> A[i];
  sort(A.begin(),A.end());
  
  bool flag=true;
  rep(i,N-1) flag&=A[i]!=A[i+1];
  
  if(flag) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 3972
#include<bits/stdc++.h>
#include<queue>
#include<deque>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<set>
//#define ll long long
#define MOD 1000000007
#define INF 214748364
using namespace std;
int read()
{
	int kk(0);
	bool fh=true;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')fh=false;
		ch=getchar();
	}
	while(ch<='9'&&ch>='0')
	{
		kk=(kk<<3)+(kk<<1)+(ch^48);
		ch=getchar();
	}
	return fh?kk:-kk;
}
int main()
{
	int x=read(),y=read();
	printf("%d",x+(y>>1));
	return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll n, m; cin>>n>>m;
	map<ll, ll> cb;

	rep(i, n){
		ll a; cin>>a;
		cb[a]++;
	}

	rep(i, m){
		ll b, c; cin>>b>>c;
		cb[c] += b;
	}

	ll cnt=n, ans=0;
	for(auto itr=cb.rbegin(); itr!=cb.rend(); itr++){
		if (itr->se <= cnt){
			ans += itr->se * itr->fi;
			cnt -= itr->se;
		}else{
			ans += cnt * itr->fi;
			break;
		}
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 12800
#include <cstdio>
#include <map>
#include <algorithm>
#include <cstring>
#include <vector>
using namespace std;

const int MAX_N = 1000;

struct data{
	int time, id;
	bool in;
};


map<pair<int,int>, vector<data> > dict;

bool is_in[MAX_N];
int total[MAX_N];


bool operator<(const data& lhs, const data& rhs){
	return lhs.time != rhs.time ? lhs.time < rhs.time : lhs.id < rhs.id;
}

bool init(){
	int N;
	dict.clear();
	memset(total, 0, sizeof(total));
	scanf("%d", &N);
	if(!N){
		return false;
	}
	for(int i=0; i<N; i++){
		int month, day, hour, minute, id;
		char in;
		scanf("%d/%d %d:%d %c %d ", &month, &day, &hour, &minute, &in, &id);
		dict[ make_pair(month, day) ].push_back( (data){ hour*60 + minute, id, in == 'I' } );
	}
	return true;
}

void proc(const vector<data>& ds){
	memset(is_in, false, sizeof(is_in));
	for(int t=0; t<60*24; t++){
		for(int i=0; i<(int)ds.size(); i++){
			const data& d = ds[i];
			if(d.time == t){
				is_in[d.id] = d.in;
			}
		}
		if( is_in[0] ){
			for(int i=1; i<MAX_N; i++){
				if(is_in[i]){
					total[i]++;
				}
			}
		}
	}
}

int solve(){
	for(map<pair<int,int>, vector<data> >::iterator itr=dict.begin(); itr!=dict.end(); itr++){
		proc(itr->second);
	}
	
	return *max_element(total+1, total+MAX_N);
}

int main(){
	while(init()){
		printf("%d\n", solve());
	}
	
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include<iostream>
#include<cmath>
#include<math.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
const double PI=3.1415926535;
signed main(){
    ll n;cin>>n;
    if(n%10==3){
        cout<<"bon"<<endl;
    }else if(n%10==0||n%10==1||n%10==6||n%10==8){
        cout<<"pon"<<endl;
    }else{
        cout<<"hon"<<endl;
    }
}

Measured memory_bytes: 3632
/*
 It's better to sleep happy and tired rather than disappointed and frustrated
 There's only 1 thing that's impossible and that is defeating a man who doesn't give up
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mx2 102
#define mx3 1003
#define mx4 10004
#define mx5 100005
#define mx6 1000006
#define mod 1000000007
#define PI 3.14159265
#define deb(x) cout << #x << " " << x << endl;
#define fo(i,n) for(int i=0 ; i<n ; i++)
#define Fo(i,k,n) for(int i=k ; i<n ; i++)
 
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pair<int,int>,int> piii;

// const int inf=0x3f3f3f3f;
int n , sum , a , b ,arr[403];
ll dp[403][403];
vector<ll> v(500);
string str;

ll solve(int i , int j )
{
	if(i==j)
	{
		return 0;
	}
	if(dp[i][j]!=-1)
	{
		return dp[i][j];
	}
	ll res=LONG_MAX, sum=0;
	Fo(k,i,j)
	{
		res=min(res,solve(i,k)+solve(k+1,j));
		sum+=arr[k];
	}
	sum+=arr[j];
	// cout<<i<<" "<<j<<" "<<res<<" "<<sum<<"\n";
	return dp[i][j]=res+sum;
}

int main() {
	ios::sync_with_stdio(false);
	//int t;cin>>t;while(t--)
	{
		cin>>n;
		fo(i,n)cin>>arr[i];
		memset(dp,-1,sizeof(dp));
		cout<<solve(0,n-1);
	}
	return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <string>

using namespace std;

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

    if (str.at(2) == str.at(3) && str.at(4) == str.at(5)) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}



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

// 素因数分解する 
// たとえば 60 = 2^2 x 3 x 5 だったら {(2, 2), (3, 1), (5, 1)} を返す
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

// 最大公約数を求める
long long GCD(long long x, long long y) {
    return y ? GCD(y, x%y) : x;
}

int main() {
    long long A, B;
    cin >> A >> B;
    long long G = GCD(A, B);
    auto pf = prime_factorize(G);
    cout << pf.size() + 1 << endl;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Data.List


addAccum :: Integer -> Integer -> (Integer, Integer)
addAccum a b = (a + b, a + b)

solve :: [Integer] -> Integer
solve arr = minimum diff
    where
        p1 = init $ snd $ mapAccumL addAccum 0 arr
        p2 = tail $ snd $ mapAccumR addAccum 0 arr
        zp = zip p1 p2
        diff = map (\b -> abs ((fst b) - (snd b))) zp

main :: IO ()
main = do
    n <- fst . fromJust . BS.readInt <$> BS.getLine
    a <- map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine
    print $ solve a

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

int main() {
    string s;
    int k;
    cin >> k >> s;
    if (s.size() <= k) cout << s << endl;
    else {
        for (int i = 0; i < k; i++)
        {
            cout << s[i];
        }
        cout << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define ll long long
#define N 200005
#define M 1000000007
#define pii pair<ll,ll>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
ll a[N];
main()
{
    ll n;
    cin>>n;
    ll k;
    cin>>k;
    ll now=1;
    for(ll i=1;i<=n;i++)
        cin>>a[i];
    vector<ll>v;
    v.push_back(now);
    while(v.size()!=n*3)
    {
        now=a[now];
        v.push_back(now);
    }
    if(k<v.size())
    {
        cout<<v[k];
        return 0;
    }
    ll x=v[n+5];
    ll p=n+5;
    ll q;
    for(ll i=n+6;;i++)
    {
        if(v[i]==x)
        {
            q=i;
            break;
        }
    }

    k-=n+5;
    ll dur=q-p;
    k%=dur;
    cout<<v[n+5+k];


}


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



int main() {
    int n;
    cin>>n;
    int a[100]={};
    rep(i,n){
        cin>>a[i];
    }
    rep(i,n-1){
        cout<<a[i]<<" ";
    }
    cout<<a[n-1]<<endl;

    for(int i=1;i<n;i++){
        int v=a[i];
        int j=i-1;
        while(j>=0&&a[j]>v){
            a[j+1]=a[j];
            j--;
        }
        a[j+1]=v;
        rep(k,n-1){
            cout<<a[k]<<" ";
        }
        cout<<a[n-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
const int INF=1e9+5;
const int N=2e5+5;
const int mod=1e9+7;
vector<int> v[500005];
map<vector<int>,ll> maps;


int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,k;
	cin>>n>>k;
	vector<int> a(n);
	for(int& x:a) cin>>x;
	for(int i=k;i<n;++i){
		//~ cout<<a[i]<<" ? "<<endl;
		cout<<(a[i-k]<a[i]?"Yes":"No")<<endl;
	}
	return 0;
}


Measured memory_bytes: 15900
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
    string s;
    while(cin >> s, s != "#")
    {
        int a, b, c; cin >> a >> b >> c;
        if(a >= 32)
        {
            cout << "?" << " " << a  - 30 << " " << b << " " << c << endl;
        }
        else
        {
            if(a == 31 and b > 4)
            {
                cout << "?" << " " << a - 30 << " " << b << " " << c << endl;
            }
            else
            {
                cout << s << " " << a << " " << b << " " << c << endl;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3168
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

LL gcd(LL a, LL b) { return a&&b?gcd(b,a%b):a+b; }

int main(void)
{
  LL n, x;
  cin >> n >> x;
  cout << (n-gcd(n,x))*3 << endl;
  return 0;
}


Measured memory_bytes: 256
import math

a, b, h, m = map(int, input().split())
h_degree = 30*h + m/2
m_degree = 6*m
diff_degree = abs(h_degree-m_degree)

c_sq = a**2 + b**2 - 2*a*b*math.cos(math.radians(diff_degree))
print(math.sqrt(c_sq))


Measured memory_bytes: 9500
#include <bits/stdc++.h>
using namespace std;
template <class T> int size(const T &x) { return x.size(); }
#define rep(i,a,b) for (__typeof(a) i=(a); i<(b); ++i)
#define iter(it,c) for (__typeof((c).begin()) \
  it = (c).begin(); it != (c).end(); ++it)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
const int INF = ~(1<<31);

const double EPS = 1e-9;
const double pi = acos(-1);
typedef unsigned long long ull;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
template <class T> T smod(T a, T b) {
  return (a % b + b) % b; }

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

    int n;
    cin >> n;
    vi A(n);
    rep(i,0,n) cin >> A[i];
    int mx = 0;
    rep(i,0,n) rep(j,0,n) mx = max(mx, abs(A[i]-A[j]));

    cout << mx << endl;
    
    return 0;
}


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

int 
main()
{
	int a[10], b[10];
	int tmp_a[4], tmp_b[4];
	int i = 0, j = 0, k = 0, hit = 0, blow = 0;

	while( i < 50 )
	{
		hit = 0;
		blow = 0;
		if ( scanf( "%d %d %d %d", &tmp_a[0], &tmp_a[1], &tmp_a[2], &tmp_a[3]) == EOF )
		{
			break;
		}
		scanf( "%d %d %d %d", &tmp_b[0], &tmp_b[1], &tmp_b[2], &tmp_b[3] );

		for ( j = 0 ; j < 4 ; j = j + 1 )
		{
			if ( tmp_a[j] == tmp_b[j] )
			{
				hit = hit + 1;
			}
			for ( k = 0 ; k < 4 ; k = k + 1 )
			{
				if ( ( tmp_a[j] == tmp_b[k] ) && ( j != k ) )
				{
					blow = blow + 1;
				}
			}
		}

		fprintf( stdout, "%d %d\n", hit, blow );

		i = i + 1;
	}


	return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int a;
 cin>>a;
 if(a==19||a==29||a==39||a==49||a==59||a==69||a==79||a==89)
 {
     cout<<"Yes";
 }
 else if(a==91||a==92||a==93||a==94||a==95||a==96||a==97||a==98||a==99)
 {
     cout<<"Yes";
 }
 else
 {
     cout<<"No";
 }

    return 0;
}


Measured memory_bytes: 256
def main():
    S = input()
    cnt = 0
    ans = 0
    f = 1
    for i in range(3):
        if S[i] == 'R':
            cnt += 1
        else:
            cnt = 0
        ans = max(ans, cnt)
    print(ans)
    


if __name__ == "__main__":
    main()

Measured memory_bytes: 8984
def main():
    N = int(input())
    A = list(map(int, input().split()))

    import collections

    C = collections.Counter(A)
    m = max(A)
    for i in range(m):
        print(C[i+1])

    for _ in range(N-m):
        print(0)


if __name__ == '__main__':
    main()


Measured memory_bytes: 33504
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n, k, s;
  cin >> n >> k >> s;
  vll ans(n, 1000000000);
  if(s == 1000000000){
    rep(i, n){
      ans[i] = 1;
    }
  }
  rep(i, k){
    ans[i] = s;
  }
  print(ans);
}


Measured memory_bytes: 2176
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

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

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")



/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main() { 
  long long n;cin>>n;
  long long ans = 0;
  string mx = to_string(n);
  for(int i = 1; n >= i; i++){
    if(!(i%10))continue;
    //cout << i << endl;
    string s = to_string(i);
    for(int j = 1; mx.size() >= j; j++){
      if(j == 1){
        if(s[0] == s[s.size()-1])ans++;
      }else{
        if(mx.size() == j){
          if(mx[0] < s[s.size()-1])break;
          else if(mx[0] > s[s.size()-1]){
            int t = 1;
            for(int z = 0; j-2 > z; z++){
              t*=10;
            }
            ans += t;
          }else{
            int t = 1;
            for(int z = 0; j-2 > z; z++){
              t *= 10;
            }
            
            t/= 10;
            int tans = 0;
            for(int z = 1; mx.size()-1 > z; z++){
              //cout << t << " " <<(mx[z]-'0') << " ";
              tans += t*(mx[z]-'0');
              if(z+1 == mx.size()-1){tans++;}
              //cout << ":" << tans << ": ";
              t /= 10;
            }
            if(mx.size() == 2)tans++;
            tans += (mx[mx.size()-1] >= s[0] ? 0 : -1);
            ans += max(0,tans);
          }
        }else{
          int t = 1;
          for(int z = 0; j-2 > z; z++){
            t*=10;
          }
          ans += t;
        }
      }
    }
    //cout << i << " " << ans  << endl;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

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

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

int idx;
string A, B, C;
int ans = 0;

int main(){
	
	cin>>A>>B>>C;
	
	idx = A.size()-1;
	
	if( A[idx] != B[0] ) ans = 1;
	
	idx = B.size()-1;
	
	if( B[idx] != C[0] ) ans = 1;
	
	if( ans ) puts("NO");
	else{	puts("YES");}
	
	return 0;

}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
import java.lang.Math;

class Main{
        public static void main(String args[]){
                Scanner scan = new Scanner(System.in);
                int N = scan.nextInt();
                int W = scan.nextInt();
                int[] v = new int[N+1];
                int[] w = new int[N+1];
                for(int i=0; i<N; i++){
                        v[i] = scan.nextInt();
                        w[i] = scan.nextInt();
                }

                int[][] T = new int[N+1][W+1];
                // (1) ?????????
                for(int i=0; i<=W; i++){
                        T[0][i] = 0;
                }
                for(int i=0; i<=N; i++){
                        T[i][0] = 0;
                }

                // (2) ????????????????????´??°?????????
                // T[i][j] = Math.min(T[i-1][j], T[i][j-c[i]]+1)
                for(int i=1; i<=N; i++){
                        for(int j=1; j<=W; j++){
                                if (j-w[i-1] < 0)
                                {
                                        T[i][j] = T[i-1][j];
                                }else{
                                        T[i][j] = Math.max(Math.max(T[i-1][j], T[i-1][j-w[i-1]]+v[i-1]), T[i][j-w[i-1]]+v[i-1]);
                                }
                        }
                }

                System.out.println(T[N][W]);
        }
}

Measured memory_bytes: 31252
hash = Hash.new(0)
n,q = gets.split.map(&:to_i)
max_v,min_a = -Float::INFINITY,Float::INFINITY
q.times do
    a,v = gets.split.map(&:to_i)
    hash[a] += v
  if v > 0
      if hash[a] > max_v
        max_v = hash[a]
        min_a = a
      elsif hash[a] == max_v
      min_a = [a,min_a].min
      end
  else
      if a == min_a
        tmp = hash.sort do |(k1,v1),(k2,v2)|
          if v1 == v2
            k1 <=> k2
          else
            v2 <=> v1
          end
        end
  min_a,max_v = tmp.first[0],tmp.first[1]
      end
  end
  puts [min_a,max_v].join(" ")
end


Measured memory_bytes: 11556
#include <stdio.h>

int main(void){
    int len,i;
    scanf("%d",&len);
    int num[len];
    for(i=0;i<len;i++){
        scanf("%d",&num[i]);
    }
    printf("%d",num[len-1]);
    for(i=len-2;i>=0;i--){
        printf(" %d",num[i]);
    }
    puts("");
    return 0;
}

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

using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }

  const int md = 1e9 + 7;
  vector<long long> s(n + 1, 0);
  for (int i = 0; i < n; i++) {
    s[i + 1] = (s[i] % md + a[i]) % md;
  }
  long long ans = 0;
  for (int i = 0; i < n - 1; i++) {
    long long b = s[n] - s[i + 1];
    if (b < 0) b += md;

    ans = ((ans % md) + (a.at(i) * b) % md) % md;
  }
  cout << ans;
}


Measured memory_bytes: 6412
n, m = map(int, input().split())
h = list(map(int, input().split()))
good = [1] * n
for i in range(m):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    if h[a] > h[b]:
        good[b] = 0
    elif h[a] < h[b]:
        good[a] = 0
    else:
        good[a] = 0
        good[b] = 0

print(sum(good))


Measured memory_bytes: 86272