akhauriyash/Code-Regression huggingface dataset:
# coding: utf-8
road = [[] for _ in range(4)]
for _ in range(3):
    index_0, index_1 = map(int, input().rstrip().split())
    road[index_0-1].append(index_1)
    road[index_1-1].append(index_0)

ans = ''
for can_go in road:
    length = len(can_go)
    if not(length == 1 or length == 2):
        ans = 'NO'
        break

if ans == '':
    ans = 'YES'

print(ans)


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

using namespace std;
#define ll long long
int n, k, h[100000], dp[100000];

int cost(int i){
	//base case
	if(i>= n-1){
		return 0;
	}
	//recursive case
	if(dp[i]!=-1){return dp[i];}

	int ans=INT_MAX;

	for(int j=1; j<=k&&i+j<n; j++){
		ans = min(ans, abs(h[i]-h[i+j]) + cost(i+j));
	}

	dp[i]=ans;
	return dp[i];
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cin>>n>>k;
	for(int i=0; i<n; i++){
		cin>>h[i];
	}
	memset(dp, -1, sizeof(dp));
	cout<<cost(0);
}

Measured memory_bytes: 5760
length = int(input())
wset = set()
flag = 1
word = input()
wset.add(word)
for i in range(length - 1):
	add = word[-1]
	word = input()
	if add != word[0] or word in wset:
		flag=0
		break
	wset.add(word)
if flag == 1:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 3064
n = int(input())
p = []
for i in range(n):
    p.append(int(input()))
chain_length = [-1 for i in range(n+1)]
for i in p:
    if chain_length[i-1] < 0:
        chain_length[i] = 1
    else:
        chain_length[i] = chain_length[i-1] + 1
print(n - max(chain_length))


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

#define pb push_back
#define MAX 100005
#define ff first
#define ss second
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;


const ll INF = 1e18;
typedef ll ftype;
typedef complex<ftype> point;
#define x real
#define y imag

ftype dot(point a, point b) {
    return (conj(a) * b).real();
}

ftype f(point a,  ftype x) {
    return dot(a, {x, 1});
}

const int maxn = 1e6+5;

point line[4 * maxn];

void add_line(point nw, int v = 1, int l = 0, int r = maxn) {
    int m = (l + r) / 2;
    bool lef = f(nw, l) < f(line[v], l);
    bool mid = f(nw, m) < f(line[v], m);
    if(mid) {
        swap(line[v], nw);
    }
    if(r - l == 1) {
        return;
    } else if(lef != mid) {
        add_line(nw, 2 * v, l, m);
    } else {
        add_line(nw, 2 * v + 1, m, r);
    }
}

ll get(int x, int v = 1, int l = 0, int r = maxn) {
    int m = (l + r) / 2;
    if(r - l == 1) {
        return f(line[v], x);
    } else if(x < m) {
        return min(f(line[v], x), get(x, 2 * v, l, m));
    } else {
        return min(f(line[v], x), get(x, 2 * v + 1, m, r));
    }
}

int n,h[200005];
ll C,dp[200005];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    for(int i =1; i<4*maxn; ++i)
        line[i] = {0,INF};
    cin>>n>>C;
    for(int i =0; i<n; ++i)
        cin>>h[i];
    dp[0] = 0;
    add_line({-2LL*h[0],h[0]*1LL*h[0]});
    for(int i = 1; i<n; ++i){
        dp[i] = get(h[i])+C+h[i]*1LL*h[i];
        add_line({-2LL*h[i],h[i]*1LL*h[i]+dp[i]});
    }
    cout<<dp[n-1]<<"\n";
    return 0;
}

Measured memory_bytes: 65152
#include <iostream>
#include <string>
int main()
{
  int N;
  std::cin >> N;
  int status[4] = {0,0,0,0};
  for (int i=0; i<N; i++) {
    std::string st;
    std::cin >> st;
    if (st == "AC") status[0]++;
    else if (st == "WA") status[1]++;
    else if (st == "TLE") status[2]++;
    else status[3]++;
  }
  std::cout << "AC x " << status[0] << std::endl;
  std::cout << "WA x " << status[1] << std::endl;
  std::cout << "TLE x " << status[2] << std::endl;
  std::cout << "RE x " << status[3] << std::endl;
  return 0;
}


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

#define turn(x1,y1,x2,y2,x3,y3) x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)
int hantei(int ax,int ay,int bx,int by,int cx,int cy,int dx,int dy);
int main()
{
	int i;
	double xy[8];
	int ans;
	char a;
	
	for(;cin >> xy[0];)
	{
		for(i=1;i<8;i++)
			cin  >> a >> xy[i];
		
		ans=1;
		
		if(hantei(xy[0],xy[1],xy[2],xy[3],xy[4],xy[5],xy[6],xy[7])==0)
			ans=0;
		
		if(hantei(xy[2],xy[3],xy[4],xy[5],xy[6],xy[7],xy[0],xy[1])==0)
			ans=0;
		
		if(hantei(xy[4],xy[5],xy[6],xy[7],xy[0],xy[1],xy[2],xy[3])==0)
			ans=0;
		
		if(hantei(xy[6],xy[7],xy[0],xy[1],xy[2],xy[3],xy[4],xy[5])==0)
			ans=0;
		
		
		if(ans==1)
			printf("YES\n");
		else
			printf("NO\n");
	}
}

int hantei(int ax,int ay,int bx,int by,int cx,int cy,int dx,int dy)
{
	if((
		turn(ax,ay,bx,by,cx,cy)>0 &&
		turn(dx,dy,ax,ay,bx,by)>0 &&
		turn(dx,dy,bx,by,cx,cy)>0 &&
		turn(dx,dy,cx,cy,ax,ay)>0)
		||(
		turn(ax,ay,bx,by,cx,cy)<0 &&
		turn(dx,dy,ax,ay,bx,by)<0 &&
		turn(dx,dy,bx,by,cx,cy)<0 &&
		turn(dx,dy,cx,cy,ax,ay)<0)
	)
		return 0;
	else
		return 1;
}

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

using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll A[300001];
int main()
{
    ll n,k;
    cin>>n>>k;

    for(int i=0; i<n; i++)
        cin>>A[i];
    sort(A,A+n);
    ll ans=1,sign=1;
    int l=0,r=n-1;
    if(k%2)
    {
        ans=A[r--];
        --k;
        if(ans<0)
            sign=-1;
    }
    while(k)
    {
        ll x=A[l]*A[l+1],y=A[r]*A[r-1];
        if(sign==1)
        {
            if(x>y)
            {
                ans=x%mod*ans%mod;
                l+=2;
            }
            else
            {
                ans=y%mod*ans%mod;
                r-=2;
            }
        }
        else
        {
            if(x<y)
            {
                ans=x%mod*ans%mod;
                l+=2;
            }
            else
            {
                ans=y%mod*ans%mod;
                r-=2;
            }
        }
        k-=2;
    }
    cout<<(ans+mod)%mod<<endl;
    return 0;
}


Measured memory_bytes: 5204
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  long long l,r;
  cin >> l;
  cin >> r;
  
  if (r % 2019 == 0 || l % 2019 == 0 || r/2019 != l/2019) {
    // l,r間に0を含む場合は0
    cout << 0 << endl;
    return 0;
  }

  long long result2 = 3000*3000;
  for (long long i = l; i <= r; i++) {
    for (long long j = i + 1; j <= r; j++) {
    	result2 = min(i * j % 2019, result2);
    }
  }
 
  cout << result2 << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    double l;
    cin>>l;
    cout<<fixed<<setprecision(10)<<(l/3.)*(l/3.)*(l/3.)<<endl;
}


Measured memory_bytes: 256
#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() {
  int64_t N, K;
  cin >> N >> K;

  cout << min(N % K, K - (N % K)) << endl;

  return 0;
}

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

long slice(long n)
{
    if (n == 1)
        return 1;
    return (long)1 + 2 * slice(n / 2);
}

int main()
{
    long n, res = 1, tmp, k, h;
    // std::vector<int> h;

    std::cin >> h;
    //h /= 2;
    // while (h > 1)
    // {
    //     res *= 2;
    //     h /= 2;
    // }
    std::cout << slice(h) << std::endl;
}

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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll fexp (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = fexp (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return fexp (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/gcd(num1,num2))*num2;}


// end of Template
int h,w,grid[200][200],n,a[10010],color,r,c;
void travel(){
    if(r%2){
        if(c<w)c++;
        else r++;
    }
    else{
        if(c>1)c--;
        else r++;
    }
}
int pick(){
    if(a[color]>0){
        a[color]--;
        return color;
    }
    else{
        color++;
        return pick();
    }
}
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    r=1;c=0;color=1;

    cin>>h>>w;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];

    for(int i=1;i<=h*w;i++){
        travel();int x = pick();
        grid[r][c] = x;
    }

    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cout<<grid[i][j];
            if(j<w)cout<<" ";
            else cout<<newl;
        }
    }

}


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  long N;
  cin >> N;
  
  vector<vector<long>> happiness(3, vector<long>(N+1, 0));
  for (size_t n = 1; n <= N; ++n) {
    for (size_t activity = 0; activity < 3; ++activity) {
	  cin >> happiness[activity][n];
    }
  }
  
  vector<vector<long>> dp(3, vector<long>(N+1, 0));
  for (size_t n = 1; n <= N; ++n) {
    for (size_t i = 0; i < 3; ++i) {
      long res = 0;
      for (size_t j = 0; j < 3; ++j) {
        if (i == j) continue;
        long val = dp[j][n-1] + happiness[i][n];
   	    if (res < val) res = val;
      }
      dp[i][n] = res;
    }
  }
  cout << max(dp[0][N], max(dp[1][N], dp[2][N])) << endl;
  
  return 0;
}

Measured memory_bytes: 5744
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
rage=range #lol
for i in rage(1,n):
    if i==1: dp[i]=dp[i-1]+abs(h[i]-h[i-1])
    else: dp[i]+=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
print(dp[-1])


Measured memory_bytes: 20524
while(int(input())):
    ar = list(map(int, input().split()))
    n = 0
    while(True):
        br = [ar.count(l) for l in ar]
        if ar == br:
            break
        ar = br
        n += 1
    print(n)
    print(" ".join(str(e) for e in br))



Measured memory_bytes: 5600
#include<iostream>
#include<cstring>
#include<cstdio>
#define in(x) scanf("%d",&x)
#define ic(x) cin>>x
#define N 100010
#define K 1010
using namespace std;
int n,k;
int ans;
int xi[N],yi[N],c[N];//1白0黑 
int numt[2*K],numf[2*K];//每个y坐标上满足条件的数量 (正确的，错误的) 
void insert(){
	in(n),in(k);
	for(int i=1;i<=n;i++){
		int x,y;
		char ci;
		in(x),in(y);
		cin>>ci;
		xi[i]=x%(2*k),yi[i]=y%(2*k);
		if(ci=='W')c[i]=1;
		else c[i]=0;
	}
} 
int ex_max(int x,int y,int z){
	return max(x,max(y,z));
} 
void work(){
	for(int i=0;i<=k;i++){
		int tot=0;
		memset(numt,0,sizeof(numt));
		memset(numf,0,sizeof(numf));
		for(int j=1;j<=n;j++){
			int pdx=0,pdy=0;//覆盖即为1 (两条k粗的线划分网格 
			if(xi[j]>=i&&xi[j]<i+k)pdx=1;
			if(yi[j]>=0&&yi[j]<k)pdy=1;
			if(pdx^pdy==c[j])tot++,numt[yi[j]]++;
			else numf[yi[j]]++;
		}
		for(int j=0;j<k;j++){
//			cout<<tot<<endl;
//			system("pause");
			ans=ex_max(ans,tot,n-tot);
			tot=tot-numt[j]+numf[j]-numt[j+k]+numf[j+k];
		}
		ans=ex_max(ans,tot,n-tot);
	}
}
int main(){
	insert();
	work();
	cout<<ans;
}

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

int main() {
    int k;
    string s;
    string s0;
    cin >> k;
    cin >> s;
    if (s.length() <= k) {
        cout << s << endl;
    } else {
        s0 = s.substr(0, k);
        s0 = s0 + "...";
        cout << s0 << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <ctype.h>
int main(){
    char ch ;
	int box[30]={0};
	int cnt,i,p;
	char c;
		while(scanf("%c",&ch)!=EOF){ 
			for(i=0,c='a';c<='z';c++,i++){
				if(tolower(ch)==c){box[i]++;break;}
			}
		}
	
	for(i=0,c='a';c<='z';c++,i++){printf("%c : %d\n",c,box[i]);}
	return 0;
}

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

const int MAX_V = 50;
const int MAX_S = MAX_V * 50 + 5;
const long long INF = 1e18;

struct Edge {
	int to, a, b;
	Edge(int to, int a, int b) :to(to), a(a), b(b) {}
};

struct Data {
	int v, s;//頂点、所持金
	long long x;//時間
	Data(int v, int s, long long x) :v(v), s(s), x(x) {}
	bool operator<(const Data& a) const {//小さい順
		return x > a.x;
	}
};

vector<Edge>g[MAX_V];
long long dp[MAX_V][MAX_S + 5];
int main() {
	//dp[頂点][金]=時間
	int n, m, s;
	cin >>n>>m>>s;
	for (int i = 0;i<m;++i) {
		int u, v, a, b;
		cin >> u >> v >> a >> b;
		--u;
		--v;
		g[u].emplace_back(v, a, b);
		g[v].emplace_back(u, a, b);
	}

	vector<int>c(n),d(n);
	for (int i = 0;i<n; ++i) {
		cin >>c[i]>>d[i];
	}

	for (int i = 0;i < MAX_V;++i) {
		for (int j = 0;j<MAX_S+5;++j) {
			dp[i][j]= INF;
		}
	}
	s = min(s, MAX_S);

	priority_queue<Data>q;
	auto push = [&](int v, int s,long long x) {
		if (s < 0) {
			return;
		}
		if (dp[v][s] <= x) {
			return;
		}
		dp[v][s] = x;
		q.emplace(v, s, x);
	};
	push(0,s,0);//初期条件

	while (!q.empty()) {
		Data hoge = q.top();
		q.pop();
		int v = hoge.v;
		int s = hoge.s;
		long long x = hoge.x;
		if (dp[v][s] != x) {
			continue;
		}
		//お金増やす
		int ms = min(s+c[v],MAX_S);
		push(v, ms, x + d[v]);
		//移動
		for (Edge e:g[v]) {
			push(e.to, s - e.a, x + e.b);
		}
	}
	for (int i = 1;i<n;++i) {
		long long  ans = INF;
		for (int j = 0;j < MAX_S + 5; ++j) {
			ans = min(ans, dp[i][j]);
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 6284
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
typedef long long ll;
using namespace std;
int r, g, b;
void SumofThreeIntegers() {

	int k, s;
	cin >> k >> s;
	int sum = 0;
	for (size_t i = 0; i <= k; i++)
	{

		for (size_t j = 0; j <= k; j++)
		{
			int ts = s - (i + j);
			if (ts >= 0 && ts <= k) sum++;
		}
	}
	cout << sum << endl;
}

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



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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

std::vector<std::vector<int> > val;
int res;
int h, w;
int k;


int query(int l0, int r0, int l1, int r1) {
	if (l0 >= h || l1 >= w) return 0;
	r0 = std::min(r0, h);
	r1 = std::min(r1, w);
	printf("? %d %d %d %d\n", l0, l1, r0 - 1, r1 - 1);
	fflush(stdout);
	return ri();
}

void dfs(int l0, int r0, int l1, int r1, int t) {
	if (!t) return;
	if (l0 + 1 == r0 && l1 + 1 == r1) {
		assert(t == 1);
		res = (res + val[l0][l1]) % k;
	} else if (l0 + 1 == r0) {
		int mid = l1 + ((r1 - l1) >> 1);
		int next = query(l0, r0, l1, mid);
		dfs(l0, r0, l1, mid, next);
		dfs(l0, r0, mid, r1, t - next);
	} else {
		int mid = l0 + ((r0 - l0) >> 1);
		int next = query(l0, mid, l1, r1);
		dfs(l0, mid, l1, r1, next);
		dfs(mid, r0, l1, r1, t - next);
	}
}

int main() {
	h = ri();
	w = ri();
	int n = ri();
	k = ri();
	val.resize(h, std::vector<int> (w));
	int tmp = 1;
	for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) val[i][j] = tmp, tmp = tmp * 2 % k;
	
	// divide 4 * 8
	for (int i = 0; i < n; i += 4) {
		for (int j = 0; j < n; j += 8) {
			dfs(i, i + 4, j, j + 8, query(i, i + 4, j, j + 8));
		}
	}
	printf("! %d\n", res);
	fflush(stdout);
	return 0;
}


Measured memory_bytes: 3792
#include <bits/stdc++.h>
#define BPhuong "main"
#define maxn 100005
#define maxm
#define fi(i,a,b) for(int i = a; i<= b; i++)
#define fid(i,a,b) for(int i = a; i>= b; i--)
#define se second
#define f first
#define ll long long
#define pii pair<int, int>
#define pb push_back
#define bit(x, i) ((x>>i)&1)
#define oo 1e9
struct data{
    int x, y, z;
};
using namespace std;
int n, f[maxn], mod, k;
void add(int& a, int b)
{
    a+=b;
    if(a>=mod) a-=mod;
}
void release(int& a, int b)
{
    a-=b;
    if(a < 0) a+=mod;
}
void nhap(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);
    //freopen(BPhuong".inp","r",stdin);
    //freopen(BPhuong".out","w",stdout);
    cin >> n >> k;
    mod = 1e9+7;
}

void xuli(){
    f[0] = 1;
    fi(i, 1, n)
    {
        int a;
        vector <int> sum(k+1);
        cin >> a;
        fid(j, k, 0)
        {
            int cnt = f[j];
            int l = j+1;
            int r = j + min(k-j, a);
            if(l<=r)
            {
                add(sum[l], cnt);
                if(r+1 <= k) release(sum[r+1], cnt);
            }
        }
        int pre = 0;
        fi(j, 0, k)
        {
            add(pre, sum[j]);
            add(f[j], pre);
        }
    }
    cout << f[k];
}

int main(){
    nhap();
    xuli();
}


Measured memory_bytes: 4416
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

int main()
{
	string s;
	cin >> s;
	int t = s.find('7');
	cout << (t == -1 ? "No" : "Yes");





	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
    int h,w,n;
    cin>>h>>w>>n;
    int m,cnt=1e9;
    for(int i=0; i<=h; i++){
        for(int j=0; j<=w; j++){
            m=i*w+j*h-i*j;
            if(m>=n) cnt=min(cnt,i+j);
        }
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    vvec<int> A(3,vec<int>(3));
    for(int i=0;i<3;i++) for(int j=0;j<3;j++) cin >> A[i][j];
    int N;
    cin >> N;
    for(int i=0;i<N;i++){
        int b;
        cin >> b;
        for(int a=0;a<3;a++) for(int c=0;c<3;c++) if(A[a][c]==b) A[a][c] = -1;
    }
    bool ok = false;
    for(int i=0;i<3;i++){
        bool now = true;
        for(int j=0;j<3;j++) now &= A[i][j]==-1;
        ok |= now;
        now = true;
        for(int j=0;j<3;j++) now &= A[j][i]==-1;
        ok |= now;
        now = true;
        for(int j=0;j<3;j++) now &= A[j][j]==-1;
        ok |= now;
        now = true;
        for(int j=0;j<3;j++) now &= A[j][2-j]==-1;
        ok |= now;
    }
    cout << (ok? "Yes":"No") << "\n";
}

Measured memory_bytes: 256
S = input()
T = input()
l = len(S)
flag = "Yes"
Rs = [-1]*130
Rt = [-1]*130

for i in range(l):
    s = ord(S[i])
    t = ord(T[i])
    if Rs[s] < 0:
        Rs[s] = t
    if Rt[t] < 0:
        Rt[t] = s
    if Rs[s] > 0:
        if Rs[s] != t:
            flag = "No"
    if Rt[t] > 0:
        if Rt[t] != s:
            flag = "No"

print(flag)


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

using namespace std;

class UnionFind {
 public:
  std::vector<int> parent;

  UnionFind(int n) : parent(n, -1) {}

  int root(int x) {
    if (parent[x] < 0) return x;
    return parent[x] = root(parent[x]);
  }

  bool issame(int x, int y) { return root(x) == root(y); }

  int size(int x) { return -parent[root(x)]; }

  bool unite(int x, int y) {
    int rx = root(x), ry = root(y);
    if (rx == ry) return false;
    if (parent[rx] > parent[ry]) std::swap(rx, ry);
    parent[rx] += parent[ry];
    parent[ry] = rx;
    return true;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<int> P(N);
  for (int i = 0; i < N; i++) {
    cin >> P[i];
    P[i]--;
  }
  UnionFind uf(N);
  for (int i = 0; i < M; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    uf.unite(x, y);
  }
  int res = 0;
  for (int i = 0; i < N; i++) {
    if (uf.issame(i, P[i])) res++;
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

class UnionFindTree {
public:
    vector<int> rank, p;

    UnionFindTree() {}

    UnionFindTree(int size) {
        rank.resize(size, 0);
        p.resize(size, 0);
        for (int i = 0; i < size; ++i) {
            makeSet(i);
        }
    }

    void makeSet(int x)
    {
        p[x] = x;
        rank[x] = 0;
    }

    bool same(int x, int y)
    {
        return findSet(x) == findSet(y);
    }

    void unite(int x, int y)
    {
        link(findSet(x), findSet(y));
    }

    void link(int x, int y)
    {
        if (rank[x] > rank[y]) {
            p[y] = x;
        } else {
            p[x] = y;
            if (rank[x] == rank[y]) {
                rank[y]++;
            }
        }
    }

    int findSet(int x)
    {
        if (x != p[x]) {
            p[x] = findSet(p[x]);
        }
        return p[x];
    }

    int maxUnion()
    {
        int size = p.size();
        int r = 0;
        REP(i,size) {
            r = max(r, (int)count(p.begin(), p.end(), i));
        }
        return r;
    }
};

vector<int> p;

int main()
{
    int n, m;
    cin>>n>>m;
    UnionFindTree uf(n);
    REP(i,n) {
        int tp;
        cin>>tp;
        p.push_back(tp-1);
        //uf.p[i] = tp-1;
    }
    REP(i,m) {
        int x, y;
        cin>>x>>y;
        uf.unite(x-1, y-1);
    }
    int ans = 0;
    REP(i,n) {
        if (uf.findSet(i) == uf.findSet(p[i]))
            ans++;
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 1660
import numpy as np
import math
 
def length(x,y):
    return np.sqrt(x**2+y**2)

N = int(input())
xy = []
for i in range(N):
    xyi = map(int,input().split())
    xy.append(np.array(list(xyi)))

L=0
for i in range(N):
    for j in range(N):
        d = xy[i] - xy[j]
        l = float(length(d[0],d[1]))
        L += l * math.factorial(N-1)
nn = math.factorial(N)
ans = L/nn
print(ans)

Measured memory_bytes: 12448
#include <bits/stdc++.h>
#define r(p,s) for(int p=0;p<s;p++)
using namespace std;
int main(){
	int i,j,d[100][100],e[100];cin>>i>>j;
	r(a,i)r(b,j)cin>>d[a][b];r(a,j)cin>>e[a];
	r(a,i){
		int sum=0;r(b,j)sum+=d[a][b]*e[b];cout<<sum<<endl;
	}
}

Measured memory_bytes: 3120
N,M=map(int,input().split())

Pstr=[]
for i in range(N+1):
    SL=len(str(i))
    Pstr.append("0"*(6-SL)+str(i))
PY=[]
for i in range(1,M+1):
    P,Y=map(int,input().split())
    PY.append([i,P,Y])

PY.sort(key=lambda x:x[1])

cnt=0
ans=[]
for i in range(M):
    if cnt==0:
        Ps=Pstr[PY[i][1]]
        Ylis=[]
        Ylis.append([PY[i][0],PY[i][2]])
        cnt=1
    elif PY[i-1][1]==PY[i][1]:
        Ylis.append([PY[i][0],PY[i][2]])
    else:
        Ylis.sort(key=lambda x:x[1])
        for j in range(len(Ylis)):
            YL=len(str(j+1))
            temp=Ps+("0"*(6-YL))+str(j+1)
            ans.append([Ylis[j][0],temp])
        Ps=Pstr[PY[i][1]]
        Ylis=[]
        Ylis.append([PY[i][0],PY[i][2]])
        cnt=1
Ylis.sort(key=lambda x:x[1])
for j in range(len(Ylis)):
    YL = len(str(j + 1))
    temp = Ps + ("0" * (6 - YL)) + str(j + 1)
    ans.append([Ylis[j][0], temp])

ans.sort()

for i in range(M):
    print(ans[i][1])







Measured memory_bytes: 57752
#include <iostream>
#include <algorithm>
using namespace std;
long long int gcd(int a,int b) {
  if (a % b == 0) return b;
  else return gcd(b, a % b);
}
int main() {
  long long int a, b;
	while(cin >> a >> b) {
	  cout << gcd(a, b) << " " << (a*b)/gcd(a, b) << endl;
	}
  return 0;
}

Measured memory_bytes: 3068
n,q=map(int,input().split())
s=input()
t=[0]*(n+1)
for i in range(n):
    t[i+1] = t[i] + (1 if s[i:i+2] == 'AC' else 0)
for i in range(q):
    l,r=map(int,input().split())
    print(t[r-1]-t[l-1])

Measured memory_bytes: 51928
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String A = sc.next();
        String B = sc.next();
        String C = sc.next();
        String ans = "NO";
        if(A.charAt(A.length()-1)==B.charAt(0)&&B.charAt(B.length()-1)==C.charAt(0)) ans = "YES";
        System.out.println(ans);
    }
}


Measured memory_bytes: 23892
MOD=10**9+7
N=int(input())
x=list(map(int, input().split()))
y=[x[i+1]-x[i] for i in range(N-1)]

upp=[1]*(N+1)
for i in range(2, N+1):
  upp[i]=upp[i-1]*i
  upp[i]%=MOD
  
inv=[1]*(N+1)
inv[-1]=pow(upp[-1], MOD-2, MOD)
for i in range(N, 1, -1):
  inv[i-1]=inv[i]*i%MOD

a=[0]*(N-1)
a[0]=upp[N-1]
for i in range(1, N-1):
  a[i]=a[0]*pow(i+1, MOD-2, MOD)
  a[i]%=MOD

b=[0]*(N-1)
b[0]=a[0]
for i in range(1, N-1):
  b[i]=b[i-1]+a[i]
  b[i]%=MOD
  
def moddot(v1, v2):
  n=len(v1)
  out=0
  for i in range(n):
    out+=v1[i]*v2[i]%MOD
    out%=MOD
  return out

ex=moddot(b, y)
print(ex)

Measured memory_bytes: 65944
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<vector<int> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int s,w;
    cin >> s >> w;
    if(w>=s){
        cout << "unsafe" << endl;
    }
    else{
        cout << "safe" << endl;
    }

    return 0;
}

Measured memory_bytes: 3624
import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int i=1;
        while(N>1){
            N/=2;
            i*=2;
        }
        System.out.println(i);
    }
}


Measured memory_bytes: 21844
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <cmath>
#include <queue>
#include <map>


using namespace std;


int main()
{
  long a, b, c, x;
  cin >> a >> b >> c >> x ; //１万から99999

long ans =0 ;
  for (int i = 0; i <= a; ++i)
  {
    for (int j = 0; j <= b; j++) {
      for (int t = 0; t <= c; t++) {
        if (x == i* 500+ j*100 + t*50)ans++;
      }
    }
  }



  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N, i, j;
  cin >> N;

  for (i = 0; i < 26; i++){
      for (j = 0; j < 16; j++){
        if (4 * i + 7 * j == N){
          cout << "Yes" << endl;
          return 0;
        }
      }

  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

n = k()
a = l()

i=1
while i < n:
    if a[i] == a[i-1]:
        ans += 1
        i += 1
    i += 1

print(ans)


Measured memory_bytes: 9968
// Copyright 2020 yaito3014
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
#include <boost/preprocessor.hpp>

#define repi(i, f, l) \
  for(int (i) = (f); (i) <= (l) ; ++(i))
#define MAKE_I(num) BOOST_PP_CAT(i, num)
#define MAKE_FOR(z, n, data) \
  repi( \
    MAKE_I(n), \
    BOOST_PP_IF( \
      BOOST_PP_EQUAL(0, n), \
      BOOST_PP_TUPLE_ELEM(0, data), \
      MAKE_I(BOOST_PP_DEC(n)) \
    ), \
    BOOST_PP_TUPLE_ELEM(1, data) \
  )
#define EXPAND(z, n, data) \
	MAKE_I(n),
int main() {
	using namespace std;
	using Ti4 = tuple<int, int, int, int>;
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<Ti4> abcd(Q);
  for(auto& [a, b, c, d] : abcd)
  	cin >> a >> b >> c >> d, --a, --b;
  int ans = 0;
  BOOST_PP_REPEAT(10, MAKE_FOR, (1, M)) {
  	vector<int> arr = { BOOST_PP_REPEAT(10, EXPAND, 0) };
  	int sum = 0;
  	for(auto& [a, b, c, d] : abcd)
  		if(arr[b] - arr[a] == c)sum += d;
  	ans = max(ans, sum);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3636
#include <stdio.h>

int main(void){
    int a, b, t;
    scanf("%d %d %d", &a, &b, &t);

    float now = 0.0;
    int sum = 0;
    while(now + a <= (float)t + 0.5){
        now += a;
        sum += b;
    }

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

    return 0;
}


Measured memory_bytes: 256
<?php

// define('DEBUG', true);
define('DEBUG', false);
fscanf(STDIN, "%d %d %d", $A, $B, $C);

$ans = 0;
// 毒入り○→解毒○を食べるフレーズ
// 解毒○の方が多い、同数、1枚だけ少なければここで終わり(美味しいもの全部食べれる)
if ($B >= $C - 1) {
	$ans += $B + $C;
} else {
	// そうでない場合は毒入り・解毒○を同数食べる(初期状態に戻る)
	$minBC = min($B, $C);
	$ans += $minBC * 2;
	$B -= $minBC;
	$C -= $minBC;
	// 毒入り○→解毒✖を解毒✖より最大1枚多く食べる
	$ans += min($A + 1, $C);
}
echo $ans;


Measured memory_bytes: 4728
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = input()

for i in range(len(N)):
    if N[i] == "7":
        print("Yes")
        exit()
print("No")


Measured memory_bytes: 10564
/*
 * Author - Abhas Jain
 * Code is inside the solve function
 */
 
#include <bits/stdc++.h>
 
#define F first
#define S second
#define all(c) c.begin(), c.end()
#define endl '\n'
#define pb push_back

typedef long long ll;
typedef long double ld;

using namespace std;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
 
const ld PI = 3.141592653589793;
const ll INF = 9223372036854775807ll;
const ll mod = 1e9 + 7;
 
void solve() 
{
	int x, n;
	cin >> x >> n;
	set<int> contain;
	for (int i = 0; i < n; ++i) {
		int cur;
		cin >> cur;
		contain.insert(cur);
	}
	int ans = 1000;
	int best = -1;
	for (int i = 0; i < 102; ++i) {
		if (contain.find(i) == contain.end()) {
			if (ans > abs(i - x)) {
				best = i;
				ans = abs(i - x);
			}
		}
	}
	cout << best << endl;
}
 
int main( )
{   
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    solve();
    return 0;
}

Measured memory_bytes: 3664
/**
 *    author:  math2do
 *    created: 03.03.2020 20:27:32 IST
**/

#include <bits/stdc++.h>

using namespace std;

template <typename T> 
inline void read(T &x) {
  char c = (char) getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = (char) getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = (char) getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}

template <typename T>
class graph {
 public:
  struct edge {
    int from;
    int to;
    T cost;
  };
 
  vector<edge> edges;
  vector<vector<int>> g;
  int n;
 
  graph(int _n) : n(_n) {
    g.resize(n);
  }
 
  virtual int add(int from, int to, T cost) = 0;
};

template <typename T>
class undigraph : public graph<T> {
 public:
  using graph<T>::edges;
  using graph<T>::g;
  using graph<T>::n;
 
  undigraph(int _n) : graph<T>(_n) {
  }
 
  int add(int from, int to, T cost = 1) {
    assert(0 <= from && from < n && 0 <= to && to < n);
    int id = (int) edges.size();
    g[from].push_back(id);
    g[to].push_back(id);
    edges.push_back({from, to, cost});
    return id;
  }
};

template <typename T>
vector<int> find_scc(const graph<T> &g) {
  vector <int> grp(g.n, -1);
  auto Bfs = [&](int s, int mark) {
    queue <int> q;
    q.push(s);
    grp[s] = mark;
    while (!q.empty()) {
      int size = (int) q.size();
      while (size--) {
        int u = q.front(); q.pop();
        for (int id : g.g[u]) {
          int v = g.edges[id].from ^ g.edges[id].to ^ u;
          if (grp[v] == -1) {
            grp[v] = mark;
            q.push(v);
          }
        } 
      }
    }
  };
  int id = 1;
  for (int i = 0; i < g.n; i++) {
    if (grp[i] == -1) {
      Bfs(i, id);
      id++;
    } 
  } 
  
  return grp;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m, k;
  read(n); read(m); read(k);
  undigraph <int> g(n);
  vector <int> deg(n, 0);
  for (int i = 0; i < m; i++) {
    int x, y;
    read(x); read(y);
    x--; y--;
    deg[x]++;
    deg[y]++;
    g.add(x, y);
  } 
  vector <vector <int>> block(n);
  for (int i = 0; i < k; i++) {
    int x, y;
    read(x); read(y);
    x--; y--;
    block[x].push_back(y);
    block[y].push_back(x);
  } 
  vector <int> grp = find_scc(g);
  int maxe = *max_element(grp.begin(), grp.end());
  vector <int> cnt(maxe + 1, 0);
  vector <int> ans(n, 0);
  for (int i = 0; i < n; i++) {
    cnt[grp[i]]++;
  } 
  for (int u = 0; u < n; u++) {
    int id = grp[u];
    int many = cnt[id];
    int direct = deg[u];
    int hate = 0;
    for (int v : block[u]) {
      if (grp[v] == id) {
        hate++;
      } 
    } 
    ans[u] = many - direct - hate - 1;
  } 
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  } 
  return 0;
}


Measured memory_bytes: 14252
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include <sstream>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include <iomanip>
#include <regex>
#include <initializer_list>
#define DBL_MIN 0.000000000000001
#define A_P(n,a,d) (n/2)*(2*a + (n-1)*d)
using namespace std;


int main(void){
  string s;
  cin >> s;
  long long sum = 0;
  for(int i =0; i < s.size(); i++){
    sum += (int)s[i] - (int)'0';
  }

  if(sum % 9){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}

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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set

using namespace std;

const ll MOD = 1000000007;
const ll INF = (1LL << 62);

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  string s1;
  cin >> s1;

  string s2;
  cin >> s2;

  // cout << s2.substr(0, s2.size() - 1) << endl;

  if (s1 == s2.substr(0, s2.size() - 1)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3632
# coding: utf-8
M, D = list(map(int, input().split()))

cnt = 0
for m in range(1, M+1):
    for d in range(1, D+1):
        if d < 10:
            continue
        d1 = d % 10
        d10 = d // 10
        if d1 >=2 and d10 >=2 and m == d1 * d10:
            cnt += 1
            # print("{} {}".format(m, d))

print(cnt)


Measured memory_bytes: 3064
#include <stdio.h>

int main(int argc, char *argv[]){
  int i, j, k;
  int n;

  scanf("%d", &n);

  int a[n];

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

  k = 0;
  for(i=0; i<=n-1; i++){
    j = 0;
    while(n>0){
      if(a[i]%2 == 0){
        j++;
        a[i] = a[i]/2;
      }else{
        break;
      }
    }
    //printf("%d\n", j);
    k = k + j;
  }

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

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#define INF 0x3f3f3f3f
long long sum,min_b=INF;
long long min(long long a,long long b){
	return a>b?b:a;
}
int main(){
	int n;
	scanf("%d",&n);
	while(n--){
		long long a,b;
		scanf("%lld %lld",&a,&b);
		sum+=a;
		if(a>b) min_b=min(min_b,b);
	}
	if(min_b==INF) sum=INF;
	printf("%lld",sum-min_b);
	return 0;
}

Measured memory_bytes: 128
S = list(input())
l = len(S)
c = 1000000000
f = 0

for i in range(l):
    if S[i] == 'C':
        c = min(c,i)
    if S[i] == 'F':
        f = max(f,i)

if c < f:
    print('Yes')
else:
    print('No')
    

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

using namespace std;
typedef long long ll;
const ll inf=(1ll<<61);
const ll mod=1e9+7;
const int MX=3e5+9;
int n,x,y,z;
vector<pair<int,int> >v[MX];
int ans[MX];
void dfs(int x,int p,int d){
    ans[x]=d%2;
    for(auto pp:v[x]){
        if(pp.first==p)continue;
        dfs(pp.first,x,pp.second+d);
    }
}
int main(){
    cin>>n;
    for(int i=0;i<n-1;i++){
        scanf("%d%d%d",&x,&y,&z);
        z%=2;
        v[x].push_back({y,z});
        v[y].push_back({x,z});
    }
    dfs(1,-1,0);
    for(int i=1;i<=n;i++){
        cout<<ans[i]<<endl;
    }
}


Measured memory_bytes: 13056
from collections import deque
import sys

def input():
    return sys.stdin.readline().rstrip()

li = list(input().split())
A = int(li[0])
a, b, c = int(li[1][0]), int(li[1][2]), int(li[1][3])

ans = 100 * A * a + 10 * A * b + A * c
ans //= 100
print(ans)

Measured memory_bytes: 9464
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <list>
#include <stack>
#include <queue>
#include <utility>

using namespace std;


#define ll long long
#define MOD 1000000007
#define rep(i, n) for(int i = 0;i < n;i++)


int main()
{
    int a,b;
    cin >> a>> b;
    int ans;
    ans = (b-1)/(a-1);
    if ((b-1)%(a-1) == 0)
    {
        cout << ans << endl;
    }else
    {
        cout << ans+1 << endl;
    }
    
    
}

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

#define INF (i64)1e18
#define MOD (i64)(1e9+7)
#define REP(i, n) for(i64 i = 0; i < n; i++)
#define RANGE(i, a, b) for(i64 i = a; i < b; i++)
#define ALL(v) (v).begin(), (v).end()
#define SIZE(v) ((i64)(v).size())
template<class T> inline void chmax(T &a, const T &b) { if (a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if (a > b) a = b; }

int main() {
  i64 n;
  cin >> n;
  i64 ans = 0;
  REP(i, n) {
    ans += (i + 1) * (n - i);
  }
  REP(i, n-1) {
    i64 u, v;
    cin >> u >> v;
    if (u > v) swap(u, v);
    ans -= u * (n - v + 1);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }
template<class T>
ostream &operator<<(ostream &os,const vector<T> &v){
	for(int i = 0;i < v.size();i++) os << (i ? "," : "[") << v[i];
	os << "]";
	return os;
}

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }

const int INF=1e+18;
const double EPS=1e-9;
const int MOD=998244353;

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

template<class T>
struct Edge{
	int from,to;
	T cost;
	Edge(int to,T cost) : to(to),cost(cost){}
	Edge(int from,int to,T cost) : from(from),to(to),cost(cost){}
	operator int() const noexcept { return to; }
};

template<class T>
ostream &operator<<(ostream &os,const Edge<T> &p){ return os << "(" << p.to << "," << p.cost << ")"; }

template<class T>
using WeightedGraph = vector<vector<Edge<T>>>;
using Graph = vector<vector<int>>;
template<class T>
using Matrix = vector<vector<T>>;

template<class T>
vector<T> dijkstra(const WeightedGraph<T> &G,int source = 0){
	using P = pair<T,int>;
	vector<T> dist(G.size(),INF);
	priority_queue<P,vector<P>,greater<P>> que;
	dist[source] = 0;
	que.emplace(dist[source],source);
	while(!que.empty()){
		P p = que.top();que.pop();
		int v = p.second;
		if(dist[v] < p.first) continue;
		for(const auto &e : G[v]){
			if(dist[e.to] > dist[v] + e.cost){
				dist[e.to] = dist[v] + e.cost;
				que.emplace(dist[e.to],e.to);
			}
		}
	}
	return dist;
}

int n,m;

void solve(){
	int cap,v = 0,c1[3010],c2[3010],d[3010];
	string s,t;
	map<string,int> mp;
	vector<int> lpg = {0,1};
	cin >> cap >> s >> t;
	mp[s] = v++; mp[t] = v++;
	for(int i = 0;i < n;i++){
		string sc1,sc2;
		cin >> sc1 >> sc2 >> d[i];
		if(!mp.count(sc1)) mp[sc1] = v++;
		if(!mp.count(sc2)) mp[sc2] = v++;
		c1[i] = mp[sc1];
		c2[i] = mp[sc2];
	}
	for(int i = 0;i < m;i++){
		string ss;
		cin >> ss;
		if(ss != s && ss != t) lpg.push_back(mp[ss]);
	}
	WeightedGraph<int> G(mp.size()),lG(lpg.size());
	for(int i = 0;i < n;i++){
		G[c1[i]].emplace_back(c2[i],d[i]);
		G[c2[i]].emplace_back(c1[i],d[i]);
	}
	for(int i = 0;i < lpg.size();i++){
		auto dist = dijkstra(G,lpg[i]);
		for(int j = i + 1;j < lpg.size();j++){
			if(dist[lpg[j]] <= cap * 10){
				lG[i].emplace_back(j,dist[lpg[j]]);
				lG[j].emplace_back(i,dist[lpg[j]]);
			}
		}
	}
	auto dist = dijkstra(lG,0);
	if(dist[1] == INF) cout << -1 << endl;
	else cout << dist[1] << endl;
}

signed main(){
	while(cin >> n >> m,n) solve();
}


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

#define ll long long

using namespace std;


int main(){
	ll s, t; cin>>s>>t;
	ll p, q, M; cin>>p>>q>>M;
	ll y; cin>>y;
	ll a = 0;
	ll ans = y;
	for(int i=1;i<1e8;i++) {
		a = (a*p+q) % M;
		ans = ans ^ a;

	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3092
package main

/*
フィボナッチ数列
*/

import (
	"bufio"
	"bytes"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func fibWithMemo(n int, memo map[int]int) int {
	if n == 0 || n == 1 {
		return 1
	}
	if val, ok := memo[n]; ok {
		return val
	}
	memo[n] = fibWithMemo(n-1, memo) + fibWithMemo(n-2, memo)
	return memo[n]
}

func fib(n int) int {
	memo := make(map[int]int)
	return fibWithMemo(n, memo)
}

func main() {
	scanner := makeScanner(1024)
	n := eGetInt(scanner)
	fmt.Println(fib(n))
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}

type ints []int

func (s ints) String() string {
	var buf bytes.Buffer
	buf.WriteString("[")
	sep := ""
	for _, v := range s {
		buf.WriteString(fmt.Sprintf("%s%d", sep, v))
		sep = ", "
	}
	buf.WriteString("]")
	return buf.String()
}

func reverse(a ints) ints {
	r := make(ints, len(a))
	for i := 0; i < len(a); i++ {
		r[i] = a[len(a)-1-i]
	}
	return r
}
func max(a ints) (int, bool) {
	if len(a) == 0 {
		return 0, false
	}
	m := a[0]
	for _, e := range a {
		if e > m {
			m = e
		}
	}
	return m, true
}
func min(a []int) int {
	m := a[0]
	for _, v := range a {
		if v < m {
			m = v
		}
	}
	return m
}

func sum(a ints) int {
	if len(a) == 0 {
		return 0
	}
	sum := 0
	for _, e := range a {
		sum += e
	}
	return sum
}
func find(n int, a ints) int {
	for i, v := range a {
		if n == v {
			return i
		}
	}
	return -1
}



Measured memory_bytes: 1128
# coding: utf-8

import math

n = int(raw_input())

def vector_rot(vector, radian):
	new_x = vector[0] * math.cos(radian) - vector[1] * math.sin(radian)
	new_y = vector[0] * math.sin(radian) + vector[1] * math.cos(radian)
	return [new_x, new_y]

def vector_add(v1, v2):
	new_v = []
	for i in range(2):
		add = v1[i] + v2[i]
		new_v.append(add)
	return new_v

def makepoint(p_A1, p_A2):
	x_p_C1 = (p_A2[0] - p_A1[0]) / 3 + p_A1[0]
	y_p_C1 = (p_A2[1] - p_A1[1]) / 3 + p_A1[1]
	x_p_C3 = (p_A2[0] - p_A1[0]) * 2 / 3 + p_A1[0]
	y_p_C3 = (p_A2[1] - p_A1[1]) * 2 / 3 + p_A1[1]

	p_C1 = [x_p_C1, y_p_C1]
	p_C3 = [x_p_C3, y_p_C3]

	v01 = [x_p_C1 - p_A1[0], y_p_C1 - p_A1[1]]
	rot_v01 = vector_rot(v01, 60 * math.pi / 180)
	v02 = vector_add(v01, rot_v01)
	p_C2 = vector_add(p_A1, v02)	
	
	C = [p_C1, p_C2, p_C3]
	return C

A = [[0., 0.],[100., 0.]]
for i in range(n):
	B = []
	for j in range(len(A)-1): #A[j]??¨A[j+1]
		C = makepoint(A[j], A[j+1]) #C = [p_C1, p_C2, p_C3]
		B.append(A[j])
		for p in C:
			B.append(p)
		#A[j+1]????¬????makepoint?????????append??????
	B.append(A[-1]) #??????????????\?????\??????
	A = B

for x in A:
	print("{:.8f}".format(x[0])),
	print("{:.8f}".format(x[1]))

Measured memory_bytes: 7184