akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char s[200005][15];
int cmp(const void *a,const void *b){return strcmp(s[*(int*)a],s[*(int*)b]);}
int main(){
    int n;
    scanf("%d",&n);
    int c[200006];
    for(int i = 0; i < n; i++){
        scanf("%s",s[i]);
        c[i] = i;
    }
    qsort(c,n,4,cmp);
    int a[200006];
    for(int i = 0; i < n; i++)
        a[i] = 0;
    a[c[0]] = 1;
    for(int i = 1; i < n; i++){
        if(strcmp(s[c[i]], s[c[i - 1]]) == 0)
            a[c[i]] = a[c[i - 1]] + 1;
        else 
            a[c[i]] = 1;
    }
    int ans = 0;
    for(int i = 0; i < n ; i++)
        if(a[c[i]] == 1){
            ans ++;
        }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 6220
A, B, C, K = map(int,input().split())

if A - K >= 0:
    print(K)
elif (A - K < 0) and (A + B - K >= 0):
    print(A)
elif (A + B - K < 0) and (A + B + C - K >= 0):
    print(A - (K - A - B))

Measured memory_bytes: 9188
# -*- coding: utf-8 -*-
import Queue
INF = 10000000000000000

# ?¨??????\???????????\????????¢?????§????????????
# |V| |E|
# ai bi wi
V,E,r = map(int,raw_input().split())
edges = [[] for i in range(V)]	# ??£??\?????????

for i in xrange(E):
	a,b,w = map(int,raw_input().split())
	edges[a].append({'to':b,'weight':w})
	# edges[b].append({'to':a,'weight':w})

distance = [INF] * V
visited = [False] * V

distance[r] = 0
pq = Queue.PriorityQueue()
pq.put((0,r))
while not pq.empty():
	d,v = pq.get()
	visited[v] = True
	for e in edges[v]:
		if visited[e['to']] or distance[v]+e['weight'] > distance[e['to']]: continue
		distance[e['to']] = distance[v] + e['weight']
		pq.put((d+e['weight'],e['to']))

for d in distance:
	if d >= INF:
		print "INF"
	else:
		print d

# for i in range(V):
# 	min_v = -1
# 	for v in range(V):
# 		if not visited[v] and (min_v == -1 or distance[v] < distance[min_v]):
# 			min_v = v

# 	visited[min_v] = True
# 	for e in edges[min_v]:
# 		distance[e['to']] = min(distance[min_v] + e['weight'],distance[e['to']])

# for d in distance:
# 	if d >= INF:
# 		print "INF"
# 	else:
# 		print d

Measured memory_bytes: 191916
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    int n;
    cin >> n;
    vector<int> t(n);
    int sum = 0;
    rep(i, 0, n){
        cin >> t[i];
        sum += t[i];
    }
    int m;
    cin >> m;
    rep(i, 0, m){
        int p, x;
        cin >> p >> x;
        cout << sum - t[p - 1] + x << endl;
    }
}

Measured memory_bytes: 256
N,A,B=map(int,input().split())
s=input()
cnt=0
sum_b=0

for i in s:
    if i=='a':
        if cnt < A+B:
            cnt+=1
            print('Yes')
        else:
            print('No')
    
    elif i=='b':
        sum_b+=1
        if cnt < A+B and sum_b <=B:
            print('Yes')
            cnt+=1
        else:
            print('No')
    
    else:
        print('No')

Measured memory_bytes: 52952
// G++ MACRO.CPP -STD=C++17
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){

  VC1(3,a);
  CIN(k);
  sort(ALL(a),greater<ll>());
  REP(i,k)
    a[0]*=2;
  COUT(accumulate(ALL(a),0LL));



  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] triangleNum = br.readLine().split(" ");

		int a = Integer.parseInt(triangleNum[0]);
		int b = Integer.parseInt(triangleNum[1]);
		int C = Integer.parseInt(triangleNum[2]);

		double S = 0.5 * a * b * Math.sin(Math.toRadians(C));
		double L = a + b + Math.sqrt((a * a) + (b * b) - (2 * a * b * Math.cos(Math.toRadians(C))));
		double h = (2 * S) / a;

		System.out.printf("%.8f\n", S);
		System.out.printf("%.8f\n", L);
		System.out.printf("%.8f\n", h);
	}
}

Measured memory_bytes: 24608
N = int(input())
V = [int(s) for s in input().split(" ")]
V_sort = sorted(V)

sumV = 0
for i,x in enumerate(V_sort):
    p = max(0,i-1)
    sumV += x*(2**p)
    #print(p,sumV)
res = sumV/2**(N-1)
print(res)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
using namespace std;
typedef long long ll;


int main() {
	int n, a, b;
	cin >> n >> a >> b;
	int ans = 0;
	rep(i,n+1){
		int m = i;
		int sum = 0;
		while(m){
			sum += m % 10;
			m /= 10;
		}
		if(a <= sum && sum <= b){
			ans += i;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
/*
  AOJ #0305
  title:Yuekis' Audio Room
  @kankichi573
 */
#include <stdio.h>
#include <float.h>
int n;

int main()
{
  int i,r,t,org;
  
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
    scanf("%d %d",&r,&t);
    org=(r/100)+5*(t/30);
    printf("%d",org);
    if((r % 100)>0)
      printf(" %d",org+1);
    if((t % 30)>0)
      printf(" %d",org+5);
    if(((t % 30)>0) && ((r % 100)>0))
      printf(" %d",org+6);
    printf("\n");
    }
  return(0);
}

Measured memory_bytes: 604
import java.util.Scanner;
import java.util.Arrays;

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

        long array[] = new long[4];
        array[0] = a * c;
        array[1] = a * d;
        array[2] = b * c;
        array[3] = b * d;
        Arrays.sort(array);
        
        System.out.println(array[3]);
    }
}

Measured memory_bytes: 35884
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main()
{
	ll n,m;
  cin>>n>>m;
  ll ans=0;
  if(n>=2)
    ans+=(n*(n-1)/2);
  if(m>=2)
    ans+=(m*(m-1)/2);
  cout<<ans<<endl;
  
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

string s;
int a[4];

int main() {
    cin >> s;
    forn(i, 4) a[i] = s[i] - '0';
    forn(mask, 16) if (!(mask & 1)) {
        int res = 0;
        forn(j, 4) if (mask & (1 << j)) {
            res -= a[j];
        } else {
            res += a[j];
        }
        if (res == 7) {
            cout << a[0];
            for (int i = 1; i < 4; ++i) if (mask & (1 << i)) {
                cout << '-' << a[i];
            } else {
                cout << '+' << a[i];
            }
            cout << "=7" << endl;
            break;
        }
    }
    return 0;
}


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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;

    b -= a;
    if (b < 0) {
        b *= -1;
    }

    if (b > d * (n - 1)) {
        cout << "NO" << endl;
        return 0;
    }

    int64_t l = b, u = b;
    for (auto i : irange(1L, n) | reversed) {
        if (c * i <= u && l <= d * i) {
            cout << "YES" << endl;
            return 0;
        }

        l += c;
        u += d;
    }

    cout << "NO" << endl;
}

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

int main() {
    int r, g, b, n;
    cin >> r >> g >> b >> n;
    int ans = 0;
    rep(i,3001) {
        rep(j,3001) {
            int k = i*r+j*g;
            if(k<=n && (n-k)%b==0) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define lli long long int
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define ve vector<lli>
#define vep vector<pair<lli,lli> >
#define pii pair<int,int>
#define pll pair<lli,lli>
#define fr(i,n) for(lli i=0;i<(n);i++)
#define F first
#define S second
#define PI 3.141592653589793238
using u64 = uint64_t;
//using u128 = __uint128_t;
long long int gcd(long long int a,long long int b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}
int bin(long int a[],long int low,long int high,long d,long day[])
{
	//cout<<low<<" "<<high<<" "<<d<<"\n";
	if(low>high)return -1;
	long mid=(low+high)/2;
	if(a[mid]>(a[low]+d)&&(a[mid-1]<=(a[low]+d)||day[mid-1])&&day[mid]==0)
		return mid;
	else if(a[mid]>(a[low]+d)&&day[mid]==0)
		return bin(a,low,mid-1,d,day);
	else
		return bin(a,mid+1,high,d-a[mid+1]+a[low],day);
}
long long power(long long a,long long b)
{
	//cout<<a<<" "<<b<<"\n";
	if(b==0)return 1;
	if(b%2==0)return (power(((a*a)),b/2));
	return (((a)*(power(((a*a)),b/2))));
}
/*int subtree(vector<int>v,int sub[],i,j)
{
	if(sub[i]>0)return sub[i];
	for(auto x:v[i])
	{
		if(x!=j)sub[i]+=subtree(v,sub,x,i);
	}
	return sub[i];
}*/
bool cmp(int a,int b)
{
	return a>b;
}	
bool sortbysecdesc(const pair<int,int> &a, 
                   const pair<int,int> &b) 
{ 
       return a.first>b.first; 
} 

u64 binpower(u64 base,u64 e,u64 m)
{
	u64 ans=1;
	base%=m;
	while(e)
	{
		if(e&1)
		{
			ans=ans*base%m;
		}
		base=base*base%m;
		e>>=1;
	}
	return ans;
}
int main()
{	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	for(int X=1;X<=t;X++)
	{
		//cout<<"Case #"<<X<<": ";
		lli n,i;
		cin>>n;
		lli a[n],nm[n],dp[n],ans=0;
		fr(i,n)cin>>a[i];
		stack<lli>s;
		nm[n-1]=n;
		s.push(n-1);
		for(i=n-2;i>=0;i--)
		{
			while(!s.empty()&&a[s.top()]>=a[i])s.pop();
			if(s.empty())nm[i]=n;
			else nm[i]=s.top();
			s.push(i);
		}
		dp[n-1]=a[n-1];
		for(i=n-2;i>=0;i--)
		{
			dp[i]=(nm[i]-i)*a[i];
			if(nm[i]<n)dp[i]+=dp[nm[i]];
		}
		fr(i,n)ans+=dp[i];
		cout<<ans<<"\n";
	}
	return 0;
}

Measured memory_bytes: 6528
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main() {
  vector<int> x(5);
  rep(i, 5) { cin >> x[i]; }

  rep(i, 5) {
    if (x[i] == 0) {
      cout << i + 1 << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
using namespace std;
int main (void)
{
	ios_base::sync_with_stdio(0);
    cin.tie(0);
	int perimeter, houses;
	cin >> perimeter >> houses;
	vector<int> v;
	for(int i = 0; i < houses; i++){
		int a;
		cin >> a;
		v.push_back(a);
    }
    int current_distance = 0, min_distance = 0;
    for(auto i = 0; i < houses; i++){
		if(i == 0){
			current_distance = v[houses-1] - v[0];
			min_distance = current_distance;
		}
		else{
			current_distance = perimeter - (v[i] - v[i-1]);
			if(current_distance < min_distance)
				min_distance = current_distance;
		}
	}
	cout << min_distance;
    return 0;
}
// date_time : 31.03.2020 15:49:15 IST 
// Author : Aditya Kumar Maurya <adityakrmaurya03@gmail.com>


Measured memory_bytes: 1400
#include <iostream>

using namespace std;

int main()
{
    int x;
    cin>>x;
    for (int i=1;i<=9;i++){
        for (int j=1;j<=9;j++){
            if (i*j==x){
                cout<<"Yes";
                return 0;
            }
        }
    }
    cout<<"No";

    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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



int main()
{
  ll N,M; cin>>N>>M;
  vector<pair<ll,ll>> vec(N+M);
  rep(i,N) {
    ll A; cin>>A;
    vec[i]={A,1};
  }
  for(int i=N;i<N+M;i++){
    ll B,C; cin>>B>>C;
    vec[i]={C,B};
  }
  
  sort(vec.rbegin(),vec.rend());
  ll sum=N,ans=0;
  for(auto p:vec){
    ll B,C; tie(C,B)=p;
    ans+=C*min(B,sum);
    sum-=B;
    if(sum<=0) break;
  }
  
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 6440
// atcoder/abc118/D/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, m;
  while (cin >> n >> m) {
    vector<int> a(m);
    cin >> a;
    map<int, int> x;
    x[1] = 2;
    x[2] = 5;
    x[3] = 5;
    x[4] = 4;
    x[5] = 5;
    x[6] = 6;
    x[7] = 3;
    x[8] = 7;
    x[9] = 6;

    const int N = 1e4 + 5;
    pair<int, int> dp[N];
    fill(dp, dp + N, make_pair(-2, -2));
    dp[n] = make_pair(0, -1);
    for (int i = n; 0 <= i; --i) {
      unless (0 <= dp[i].first) continue;
      each (j, a) {
        int rem = i - x[j];
        if (0 <= rem) {
          setmax(dp[rem], make_pair(dp[i].first + 1, j));
        }
      }
    }

    int idx = 0;
    vector<int> v;
    while (0 <= dp[idx].second) {
      v.push_back(dp[idx].second);
      idx += x[dp[idx].second];
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    each (i, v) cout << i;
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 384
n = int(input())
b = list(map(int,input().split()))

a = [10**6] * n

for i in range(n-1):
    c = b[i]
    if a[i] > c:
        a[i] = c
    if a[i+1] > c:
        a[i+1] = c

print(sum(a))


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

const ll MAX = 1000000000000001;

int main(){
  int a, b, q; cin >> a >> b >> q;
  vector<ll> s(a), t(b), u(q), ans(q);
  rep(i, a) cin >> s[i];
  rep(i, b) cin >> t[i];
  rep(i, q) cin >> u[i];
  rep(i, q){
    ll x = u[i], sl, sr, tl, tr;
    int sid = lower_bound(s.begin(), s.end(), x) - s.begin();
    int tid = lower_bound(t.begin(), t.end(), x) - t.begin();
    if(sid == 0){
      sl = -MAX;
    }
    else{
      sl = s[sid - 1];
    }
    if(sid == s.size()){
      sr = MAX;
    }
    else{
      sr = s[sid];
    }
    if(tid == 0){
      tl = -MAX;
    }
    else{
      tl = t[tid - 1];
    }
    if(tid == t.size()){
      tr = MAX;
    }
    else{
      tr = t[tid];
    }
    //cout << sl << " " << sr << " " << tl << " " << tr << endl;

    ans[i] = max(sr, tr) - x;
    ans[i] = min(ans[i], x - min(sl, tl));
    ans[i] = min(ans[i], (sr - x) + sr - tl);
    ans[i] = min(ans[i], tr - x + tr - sl);
    ans[i] = min(ans[i], x - sl + tr - sl);
    ans[i] = min(ans[i], x - tl + sr - tl);

  }

  rep(i, q) cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 6376
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0; i<n; ++i)
#define rep1(i,n) for(ll i=1; i<=n; ++i)
#define revrep(i,n) for(ll i=n-1; i>=0; --i)
inline constexpr ll Inf = (1ULL << 62) -1;
#define fastio cin.tie(nullptr); ios_base::sync_with_stdio(false);
#define endl '\n'
template <class T> bool updmax(T& a, T b) { if (b > a) { a = b; return true;} return false;}
template <class T> bool updmin(T& a, T b) { if (b < a) { a = b; return true;} return false;}

int main() {
    fastio;
    ll ans=0;
    ll N;
    cin >> N;
    for (int a=1; a < N; ++a) {
        for (int b=1; a*b+1 <= N; ++b) {
                ++ans;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3660
/* ~ Programmer >> Tushar Mahajan */
#include <iostream>
#include <bits/stdc++.h> 
using namespace std;
#define ll long long int
#define ld long double
#define MOD 1000000007
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL); 

int main() {
	ios;
	ll k;
	cin>>k;
	ll ans = 0;
	for(int i=1;i<1000000;i++)
	{
	    ans = ans*10+7;
	    ans %= k;
	    if(ans == 0)
	    {
	        cout<<i;
	        return 0;
	    }
	}
	cout<<-1<<endl;
	return 0;
}


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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

const lli e5 = 1 << 20;

lli n,k,l;
lli a[e5];

lli gcd(lli a,lli b){
	while (a != 0) {
		b %= a;
		swap(a,b);
	}
	return b;
}

void impossible(){
	cout << "IMPOSSIBLE" << endl;
	exit(0);
}

int main(){
	cin >> n >> k;
	for(lli i = 0;i < n;i++) cin >> a[i];
	if(*max_element(a,a+n) < k) impossible();
	l = gcd(a[0],a[1]);
	for(lli i = 2;i < n;i++) l = gcd(l,a[i]);
	if(k%l == 0) cout << "POSSIBLE" << endl;
	else impossible();
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
using namespace std;
vector<int> counter(100, 0);
int main() {
	
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M*2; i++) {
		int tmp;
		cin >> tmp;
		counter[tmp-1]++;
	}
	for (int i = 0; i < N; i++)
	{
		cout << counter[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
s=[0 for i in range(M)]
c=[0 for i in range(M)]
for i in range(M):
    s[i],c[i]=map(int,input().split())
    s[i]-=1
for n in range(10**N):
    t=str(n)
    if len(t)!=N:
        continue
    flag=1
    for i in range(M):
        if t[s[i]]!=str(c[i]):
            flag=0
    if flag==1:
        print(n)
        exit()
print(-1)


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

int gcd(int x, int y);

const int INF = 1001001001;

/*struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }*/

int main() {
    int a, b, ans = 0;
    cin >> a >> b;

    for (int i = a; i <= b; i++) {
        if (i / 10000 == i % 10 && (i % 10000) / 1000 == (i % 100) / 10) {
            ans++;
        }
    }

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

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define reps(i,s,e) for(int i=s; i<(int)e; i++)
#define coutd(i) cout << std::fixed << std::setprecision(i)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Set = std::set<T>;
template<class T, class U>
using Map = std::map<T, U>;

template<class T>
using Graph = vector<vector<T>>;

const int INT_BIG = 1<<28;

int main() {
    int D;
    cin >> D;
    vint downrate(26);
    Graph<int> uppoint(D, vint(26));
    rep(i, 26) {
        cin >> downrate[i];
    }

    rep(i, D) {
        rep(j, 26) {
            cin >> uppoint[i][j];
        }
    }

    vint lastDay(26, -1);

    ll satisfy = 0;
    vint schedule(D);
    vector<Set<int>> dayset(26);
    rep(i, 26){
        dayset[i].insert(-1);
        dayset[i].insert(D);
    }
    rep(i, D) {
        cin >> schedule[i];
        schedule[i]--;
        dayset[schedule[i]].insert(i);
        satisfy += uppoint[i][schedule[i]];
        lastDay[schedule[i]] = i;
        rep(j, 26) {
            satisfy -= (i - lastDay[j]) * downrate[j];
        }
        // cout << satisfy << endl;
    }
    
    int M;
    cin >> M;
    rep(m, M) {
        int d, q;
        cin >> d >> q;
        d--;
        q--;
        ll tmpsatisfy = satisfy;
        tmpsatisfy += -uppoint[d][schedule[d]] + uppoint[d][q];
        
        // 追加したことによる減少分
        auto it = dayset[q].lower_bound(d);
        int nextp = *it;
        it--;
        int befp = *it;
        int p = nextp - d;
        int k = (d-befp);
        // cout << befp << " shita " << nextp << endl;
        // cout << k << " " << p << endl;
        // cout << (p*(p+1)/2+k*p-p) << endl;
        // tmpsatisfy -= (2*(((p)*(p+1)/2) + k*p - 1*p )*k-p*k*k+p*k)/2*downrate[q];
        tmpsatisfy += k*p*downrate[q];


        // 減らしたことによる増加分
        auto it2 = dayset[schedule[d]].upper_bound(d);
        auto it3 = dayset[schedule[d]].find(d);
        nextp = *it2;
        it3--;
        befp = *it3;
        // cout << befp << " ue " << nextp << endl;
        p = nextp - d;
        k = (d-befp);
        // cout << k << " " << p << endl;
        tmpsatisfy -= k*p*downrate[schedule[d]];

        // if (tmpsatisfy > satisfy) {
            satisfy = tmpsatisfy;
            dayset[schedule[d]].erase(d);
            dayset[q].insert(d);
            schedule[d] = q;
        // }
        cout << satisfy << endl;
    }
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define collect(arr, size) rep(i,size) cin >> arr[i];
#define int long long

signed main(){
    int N, A, B, C, D;
    string s;
    cin >> N >> A >> B >> C >> D >> s;
    s += '#';
    A--; B--; C--; D--;
    
    bool achievable = true;
    
    reps(i, A, max(C,D)-1){
        if(s[i]==s[i+1] && s[i] == '#') achievable = false;
    }
    
    if(D < C && achievable){
        achievable = false;
        reps(i, B, D){
            if(s[i-1]==s[i] && s[i]==s[i+1] && s[i]=='.'){
                achievable = true;
            }
        }
    }
    
    cout << (achievable ? "Yes" : "No") << endl;
}

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

int main () {
  int A, B, C;
  cin >> A >> B >> C;
  vector<int> x(3);
  x.at(0) = A;
  x.at(1) = B;
  x.at(2) = C;
  
  sort (x.begin(), x.end());
  
  if (x.at(0)%2 == x.at(1)%2) cout << (x.at(2)-x.at(1))+(x.at(1)-x.at(0))/2 << endl;
  else cout << (x.at(2)-x.at(1)+1)+(x.at(1)-x.at(0)+1)/2 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;

int N,L;
int *time;

int func(int table[],int index){

	if(table[index] > table[index-1] && index < N-1 && table[index] > table[index+1]){
		return L - table[index];
	}else if(table[index] > table[index-1] && index == N-1){
		return L - table[index];
	}else{
		return func(table,index+1) + L - table[index];
	}
}

int main(){

	int maximum;
	scanf("%d %d",&N,&L);
	int* table = new int[N];
	time = new int[N];

	for(int i = 0; i < N; i++){
		scanf("%d",&table[i]);
	}

	if(table[0] > table[1]){
		time[0] = L - table[0];
	}else{
		time[0] = func(table,1) + L - table[0];
	}

	for(int i = 1; i <= N-2; i++){
		if(table[i] > table[i-1] && table[i] > table[i+1]){
			time[i] = L - table[i];
		}else{
			if(table[i-1] > table[i] && table[i+1] > table[i]){
				time[i] = max(time[i-1],func(table,i+1)) + L - table[i];
			}else if(table[i-1] > table[i]){
				time[i] = time[i-1] + L - table[i];
			}else if(table[i+1] > table[i]){
				time[i] = func(table,i+1) + L - table[i];
			}
		}
	}

	if(table[N-1] > table[N-2]){
		time[N-1] = L - table[N-1];
	}else{
		time[N-1] = time[N-2] + L - table[N-1];
	}

	maximum = 0;
	for(int i = 0; i < N; i++){
		maximum = max(maximum,time[i]);
	}

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

    return 0;
}

Measured memory_bytes: 3896
N = int(input())
s = [str(input()) for i in range(N)]
M = int(input())
t = [str(input()) for i in range(M)]
x = {}
for i in s:
    if i in x:
        x[i] += 1
    else:
        x[i] = 1
for i in t:
    if i in x:
        x[i] -= 1
    else:
        x[i] = -1
if max(x.values()) < 0:
    print(0)
else:
    print(max(x.values()))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=INT_MAX;
struct segtree
{
    vector<int> node;
    vector<int> lazy;
    vector<bool> lflg;
    int n;
    segtree(int sz)
    {
        n=1;while(n<sz) n*=2;
        node.resize(2*n,INF);
        lazy.resize(2*n,0);
        lflg.resize(2*n,false);
    }
    void lazyupdate(int k, int l, int r)
    {
        if(lflg[k])
        {
            node[k]=lazy[k];
            push(lazy[k],k,l,r);
            lazy[k]=0;
            lflg[k]=false;
        }
    }
    void push(int v,int k,int l,int r)
    {
        if(r-l>0)
        {
            lazy[2*k]=lazy[2*k+1]=v;
            lflg[2*k]=lflg[2*k+1]=true;
        }
    }
    void update(int qa, int qb, int v, int k=1, int l=1,int r=-1)
    {
        if(r<0) r=n;
        lazyupdate(k, l, r);
        if(qb<l||r<qa) return;
        if(qa<=l&&r<=qb)
        {
            node[k]=v;
            push(v,k,l,r);
        }
        else
        {
            int m=(l+r)/2;
            update(qa,qb,v,2*k,l,m);
            update(qa,qb,v,2*k+1,m+1,r);
            node[k]=min(node[2*k],node[2*k+1]);
        }
    }
    int get(int qa, int qb, int k=1, int l=1, int r=-1)
    {
        if(r<0) r=n;
        lazyupdate(k ,l, r);
        if(qb<l||r<qa) return INF;
        if(qa<=l&&r<=qb) return node[k];
        else
        {
            int m=(l+r)/2;
            int lv=get(qa, qb, 2*k, l, m);
            int rv=get(qa, qb, 2*k+1, m+1, r);
            return min(lv,rv);
        }
    }
};

int main()
{
    int n,q;
    scanf("%d %d",&n,&q);
    segtree tree(n);
    for(int i=0;i<q;i++){
        int c;
        scanf("%d",&c);
        if(c){
            int s,t;
            scanf("%d %d",&s,&t);
            cout<<tree.get(s+1,t+1)<<endl;
        }else{
            int x,y;
            scanf("%d %d",&x,&y);
            tree.update(x+1,x+1,y);
        }
    }
}


Measured memory_bytes: 4972
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
int64_t INF = 1000000007;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    string s;
    cin >> s;
    // NがあるなあらSが必要
    // EがあるなあらWが必要
    bool isN=false;
    bool isE=false;
    bool isW=false;
    bool isS=false;
    rep(i,s.size()){
        if(s.at(i)=='N') isN=true;
        if(s.at(i)=='E') isE=true;
        if(s.at(i)=='W') isW=true;
        if(s.at(i)=='S') isS=true;
    }
    if((isN!=isS)||(isE!=isW)){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <utility>

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

signed main()
{
    string s;
    cin >> s;
    
    bool c = false;
    rep(i, s.size()){
        c |= s[i] == 'C';
        if(c && s[i] == 'F'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    cout << "No" << endl;
}


Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
x = [-1]*N
b = []
for i in range(N,0,-1):
    m = N//i
    x[i-1] = int(sum(x[j] for j in range(i*2-1,i*m,i)) % 2 != a[i-1])
    if x[i-1] == 1:
        b.append(i)
print(len(b))
if len(b) > 0:
    print(" ".join(map(str, b)))

Measured memory_bytes: 19808
count = 0
arr = []
n = gets.chomp.to_i
n.times do |i|
    s = gets.chomp.to_i
    count += s
    arr << s
end
i = 0
arr = arr.sort
ans = 0
tmp = 0
i = 0
if count % 10 != 0
    puts count
else
    while true
        tmp = count
        ans = tmp - arr.shift
        if ans % 10 != 0
            puts ans
            break
        elsif i == n - 1
            puts "0"
            break
        end
        i += 1
    end
end

Measured memory_bytes: 14320
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a>b)swap(a,b);
  if(c<a||b<c)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}


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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define pll         pair<long,long>
#define vi          vector<int>
#define vll         vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define mod        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rem(i,a,b)  for(int i=a;i>b;i--)
#define mp(a,b)     make_pair(a,b)
#define vvi(a,b,name)    vector<vector<int>> name(a,vector<int>(b,-1))


void solve(){
    int a,b,c;cin>>a>>b>>c;
    if(c>=a && c<=b)cout<<"Yes";
    else cout<<"No";
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;// 任意長整数型
using bint = mp::cpp_int;// 仮数部長が32の浮動小数点数型
using real32 = mp::number<mp::cpp_dec_float<32>>;// 仮数部長が1024の浮動小数点数型
using real1024 = mp::number<mp::cpp_dec_float<1024>>;// ついでに有理数型
using rat = boost::rational<bint>;
*/
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
string x;
const int a = 'a'-'A';
int main(){ //srand((unsigned)time(NULL));
  getline(cin,x);
  for (int i = 0; i < x.length(); i++) {
    if('A' <= x[i] && x[i] <= 'Z'){
      x[i] += a;
    }else if('a' <= x[i] && x[i] <= 'z'){
      x[i] -= a;
    }
  }
  cout << x << endl;
}



Measured memory_bytes: 3088
S = input()
n = len(S)
ans = [0 for i in range(n)]
for i in range(n):
    if S[i:i+2] == "RL":
        for j in range(i,-1,-1):
            if S[j] == "R":
                ans[i + (i-j) % 2] += 1
            else:
                break
        for j in range(i+1,n):
            if S[j] == "L":
                ans[i + (j-i) % 2] += 1
            else:
                break

print(*ans)

Measured memory_bytes: 6400
import sys


def main():
    H = int(input())
    W = int(input())
    N = int(input())

    n_black = 0

    larger = max([H, W])
    smaller = min([H, W])

    n_l = 0
    n_s = 0

    for i in range(H+W):
        paint_l = larger - n_s
        paint_s = smaller - n_l

        if paint_l >= paint_s:
            n_black += paint_l
            n_l += 1
        else:
            n_black += paint_s
            n_s += 1

        if n_black >= N:
            break

    print(n_l + n_s)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 100000000000000009
#define mod 1000000007;
#define int long long
using P = pair<int,int>;
signed main(){
  int n;
  cin >> n;
  vint s(n);
  rep(i,n) cin >> s[i];
  int ans = 0;
  rep(i,60){
    int x = 0;
    rep(j,n) if(s[j]>>i&1) x++;
    int now = x*(n-x)%mod;
    rep(j,i) now = now*2%mod;
    ans += now;
    ans %= mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,d,e;
    cin>>a>>b>>c;
    d=4*a*b;
    e=(c-a-b)*(c-a-b);
    if(a+b>c)
    {
        cout<<"No"<<endl;
    }
    else
    {
        if(d<e)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    string s;
    cin >> s;
    REP(i,s.size()){
        s[i] = ((s[i] - 'A') + n) % 26 + 'A';
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<complex>
#include<string>
#include<string.h>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)

int main() {
	int a, b, c, d;
	cin >> a;
	b = a;
	int x = 0;
	while (a > 0) {
		x += a % 10;
		a /= 10;
	}
	if (b%x == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
s = list(input())
n = len(s)+1
p = [1]*(n)
if s[0]=="<":
    p[0]=0
for i in range(1,n-1):
    if s[i]=="<" and s[i-1]==">":
        p[i]=0
for i in range(1,n-1):
    if s[i]=="<" and s[i-1]=="<":
        p[i]=p[i-1]+1
for i in range(1,n-1):
    if s[n-i-1]==">" and s[n-i-2]==">":
        p[n-i-2]=p[n-i-1]+1
if s[n-2]==">":
    p[n-1]=0
else:
    p[n-1]=p[n-2]+1
for i in range(1,n-1):
    if s[i]==">" and s[i-1]=="<":
        if p[i-1]>=p[i]:
            p[i]=p[i-1]+1
print(sum(p))


Measured memory_bytes: 27224
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional>
#define ll long long int
#define ld long double
#define pb push_back
#define pll pair<ll,ll>
#define pint pair<int,int>
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define mod 1000000007
#define MAX 1e10
#define endl '\n'
#define mp make_pair
#define INF INT_MAX
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ff first
#define ss second
#define ps(x,y) fixed<<setprecision(y)<<x
#define setbits(x) __builtin_popcountll(x)			//counts no of ones in binary representation
#define w(t) 	int t; cin>>t; while(t--)
#define pi 3.141592653589793238
#define sortt(v)  sort(v.begin(),v.end())
#define lb(v,x) std::lower_bound(v.begin(),v.end(),x)
#define ub(v,x) std::upper_bound(v.begin(),v.end(),x)

using namespace std;

int main(){
	fast;
	ll a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	if(a==0)	cout<<1;
	else if(b==0)	cout<<2;
	else if(c==0)	cout<<3;
	else if(d==0)	cout<<4;
	else	cout<<5;
}

Measured memory_bytes: 3648
#!/usr/bin/env ruby

# Generated by AtcoderGreedy on 2018-06-10
# ABC099 A

# my lib

module Enumerable
  # work just like String#split,
  # except this method does not use regex match
  # but check whether yield succeeds or not.
  def split
    current = nil
    ret = []
    each do |elem|
      if yield elem
        if current
          ret << current
          current = nil
        end
      elsif current
        current << elem
      else
        current = [elem]
      end
    end
    ret << current if current
    ret
  end
end

class Array
  # truncate tail, opposite of drop
  def clip(amount = 1)
    if amount < 0
      raise ArgumentError, "amount == #{amount}, cannot be negative!"
    end
    take_amount = size - amount
    take_amount < 0 ? [] : take(take_amount)
  end
end

def n_choose_k(n, k)
  return 0 unless (0..n).cover? k
  result = 1
  1.upto(k) do |d|
    result *= n
    result /= d
    n -= 1
  end
  result
end

# end of lib

# Your code here

N = gets.chomp.to_i

if N >= 1000
  puts 'ABD'
else
  puts 'ABC'
end


Measured memory_bytes: 1788
w,h,n = map(int,input().split())
lis1 = [0]
lis2 = [w]
lis3 = [0]
lis4 = [h]
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:lis1.append(x)
    if a == 2:lis2.append(x)
    if a == 3:lis3.append(y)
    if a == 4:lis4.append(y)
cou1 = max(lis1)
cou2 = min(lis2)
cou3 = max(lis3)
cou4 = min(lis4)

if cou1 + (w -cou2) >= w or cou3 + (h - cou4) >= h:
    print("0")
else:
    print((w-(cou1 + (w - cou2))) * ((h-(cou3 + (h - cou4)))))

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

using namespace std;
typedef long long ll;

ll min( ll a,  ll b ){
return (a<b)?a:b;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a , b , c;
    while(cin >> a >> b >> c){
        cout << (a*b)/2 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>


#define rep(i,p,q) for(int i = p;i < q;i++)
#define ll long long

using namespace std;

//E
int main(void) {
	int n, k;
	cin >> n >> k;
	if (k > (n - 1) * (n - 2) / 2) cout << -1 << endl;
	else {
		vector<string> ans = vector<string>();
		rep(i, 2, n+1) {
			ans.push_back("1 " + to_string(i));
		}
		int vCount = (n - 1) * (n - 2) / 2;
		int vForward = 2;
		int vBackward = 3;
		while (vCount != k) {
			vCount--;
			ans.push_back(to_string(vForward) + " " + to_string(vBackward));
			if (vBackward == n) {
				vForward++;
				vBackward = vForward + 1;
			}
			else vBackward++;
		}

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


Measured memory_bytes: 512
n,m = gets.split.map(&:to_i)
mod = 10**9+7

if(1 < (m-n).abs)
  puts 0
elsif(m == n)
  nB = 1
  n.times do|ii|
    i = ii+1
    nB=(nB*i)%mod
  end
  puts (2*nB*nB) % mod
else
  if n < m then
    max = m
    min = n
  else 
    max = n
    min = m
  end
  minB = 1
  min.times do|ii|
    i = ii+1 
    minB = minB*i%mod
  end
  puts (max*minB*minB) % mod
end

Measured memory_bytes: 1788
#include <iomanip>
#include <iostream>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int R;
  cin >> R;
  double answer = 2.0 * M_PI * (double)R;

  cout << setprecision(10) << answer << endl;
  return 0;
}


Measured memory_bytes: 3804
import java.util.Scanner;


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

    int n = sc.nextInt();
    int p = sc.nextInt();
    boolean hasOdd = false;

    for (int i = 0; i < n; i++) {
      long a = sc.nextLong();
      if (a % 2 == 1) {
        hasOdd = true;
        break;
      }
    }

    if (hasOdd) {
      long result = pow(2, n - 1);
      System.out.println(result);
    } else {
      if (p == 1) {
        System.out.println("0");
      } else {
        long result = pow(2, n);
        System.out.println(result);
      }
    }

  }

  static long pow(long n, long m) {
    long result = 1L;
    for (int i = 0; i < m; i++) {
      result = result * n;
    }

    return result;
  }

}


Measured memory_bytes: 21844
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true) {
        	int a = sc.nextInt();
        	String op = sc.next();
        	int b = sc.nextInt();
        	if(op.equals("?")) {
        		break;
        	}
        	switch(op) {
        	case "+" :
        		System.out.println(a + b);
        		break;
        	case "-" :
        		System.out.println(a - b);
        		break;
        	case "*" :
        		System.out.println(a * b);
        		break;
        	case "/" :
        		System.out.println(a / b);
        		break;
        }
     }
}
}


Measured memory_bytes: 26144
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
 
const int N=1e6+5,MAX=3e7,MOD=1e9+7;
 
using namespace std;
 
int n,k;
int a[N];
bool dp[N];

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //#ifndef ONLINE_JUDGE
      //freopen("test.txt","r",stdin);
    //#endif
 

    scanf("%d %d",&n,&k);

    for(int i=0;i<n;i++)scanf("%d",&a[i]);
      
    for(int i=0;i<n;i++){

    	  dp[k-a[i]]=1;
    }
    
    dp[k]=0;
    for(int i=k;i>=0;i--){

    	 if(dp[i])continue;

    	 for(int j=0;j<n;j++){
              if(i+a[j] >k )continue;
              if(!dp[i+a[j]])dp[i]=1;
    	 }
    }

    if(dp[0])printf("First\n");
    else printf("Second\n");

      
   
     
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    int l = 1, r = n;
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        l = max(l, a);
        r = min(r, b);
    }
    cout << max(r - l + 1, 0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(void){
  int i,j,s,n,m;
  static int a[100][100],b[100],c[100];
 
  scanf("%d%d",&n,&m);
 
  for(i=0;i<n;i++)
    for(j=0;j<m;j++)
      scanf("%d",&a[i][j]);
 
  for(i=0;i<m;i++)
    scanf("%d",&c[i]);
 
  for(i=0;i<n;i++){
    s = 0;
    for(j=0;j<m;j++)
      s += a[i][j] * c[j];
    printf("%d\n",s);
  }
   
  return 0;
}


Measured memory_bytes: 2148
n,m=map(int,input().split())
K=[]
for _ in range(n):
    A=list(map(int,input().split()))
    A.pop(0)
    K.append(A)
ans=0
for i in range(1,31):
    flag=True
    for j in range(n):
        if i not in K[j]:
            flag=False
    if flag:
        ans+=1
print(ans)

Measured memory_bytes: 3188