akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main (){
    //freopen("input.txt" , "r", stdin);
    string str1;
    while(getline (cin, str1)){
            
    int cnt =0;

    for(int i=1; i<27; i++){

        cnt++;

        for(int j=0; j<str1.size(); j++){
            if(str1[j]>= 'a' && str1[j]<= 'z'){
                int ascii = (int)  97+ (((str1[j] % 97) + 1) %26);
                str1[j] = ascii;
            }
            else str1[j] = str1[j];
        }

        //cout<<str1<<endl;

        int position =0, flag =0;

        if((position = (str1.find("this"))) != -1 ){
            flag = 1;
            break;
        }

        else if((position = (str1.find("the"))) != -1 ){
            flag = 1;
            break;
        }

        else if((position = (str1.find("that"))) != -1 ){
            flag = 1;
            break;
        }
    }

    //cout<<"The key: "<<cnt<<endl;
    cout<<str1<<endl;
    str1.clear();

    }


    return 0;
}


Measured memory_bytes: 3060
#インプットdataの格納(小文字に変換)
input_data = ""
while True:
    try:
        input_data_temp = input().lower()
    except:
        break
    input_data += input_data_temp

#結果の表示
for letter in "abcdefghijklmnopqrstuvwxyz":
    print(f"{letter} : {input_data.count(letter)}")



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

using namespace std;

int n, q;
int a[10010];
int b[510];
int main()
{
    cin >> n;
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    cin >> q;
    for (int i = 0; i < q; i++)
    {
        scanf("%d", &b[i]);
    }
    
    for(int i = 0;i<q;i++){
        for(int j = 0;j<n;j++){
            if(b[i] == a[j]){
                count++;
                break;
            }
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3244
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a; i<=b; i++)
#define rrep(i,a,b) for(int i = a; i >= b; i--)
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define sq(a) (a)*(a)
#define nl "\n"
#define debug2(x, y) cout << #x << " = " << x << "   " << #y << " = " << y << nl;
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,
//tree_order_statistics_node_update> indexed_set;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef unsigned long long ull;
const int MAXN = 100005;
ll mod=1000000007;


int main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        int t;
        t = 1;
        // cin>>t;
        while(t--) {
                int n, m, k;
                cin>>n>>m>>k;
                vector<ll> a(n),b(m);
                vector<ll> pre1(n+1,0), pre2(m+1,0);
                rep(i,0,n-1){
                        cin>>a[i];
                        pre1[i+1]+=pre1[i]+a[i];
                }
                rep(j,0,m-1){
                        cin>>b[j];
                        pre2[j+1]+=pre2[j]+b[j];
                }
                ll mx = 0;
                rep(i,0,n){
                        if(k < pre1[i]) continue;
                        ll x = upper_bound(pre2.begin(), pre2.end(), k - pre1[i]) - pre2.begin();
                        if(x == 0) continue;
                        x--;
                        mx = max(mx, x + i);
                }
                cout<<mx<<nl;
        }
        return 0;
}


Measured memory_bytes: 9544
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
constexpr int MOD = 1000000007;
constexpr int INF = 1e18;

using namespace std;


signed main() {
  int N, K;
  cin >> N >> K;

  vector<pair<int, int>> vec(N);
  REP(i, N) cin >> vec[i].first >> vec[i].second;

  sort(ALL(vec),   // dai -> syou
      [](pair<int, int> const & l, pair<int, int> const &  r){
      return l.second > r.second;
      });

  priority_queue<int, vector<int>, greater<int>> wakaran;
  vector<bool> used(N);
  int oisisa = 0, syurui = 0;
  REP(i, K){
    oisisa += vec[i].second;
    if(used[vec[i].first] == true) wakaran.push(vec[i].second);
    else{
      used[vec[i].first] = true;
      syurui++;
    }
  }

  int ans = oisisa+syurui*syurui;
  FOR(i, K, N){
    if(used[vec[i].first] == false){
      used[vec[i].first] = true;
      if(wakaran.empty()) break;
      oisisa -= wakaran.top(); wakaran.pop();
      oisisa += vec[i].second;
      syurui++;
      chmax(ans, oisisa+syurui*syurui);
    }
  }
    
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 2432
import java.util.Scanner;

public class Main {
    public static void main(String[] arge) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] a = new int[N];
        int min = Integer.MAX_VALUE;
        int minIndex = 0;
        for (int i = 0; i < N; i++) {
            a[i] = scanner.nextInt();
            if (min > a[i]) {
                min = a[i];
                minIndex = i;
            }
        }

        int count = 0;
        do {
            count = 0;
            int tmp = minIndex;
            for (int i = 0; i < N; i++) {
                if (tmp == i) continue;
                a[i] = a[i] % a[minIndex];
                if (a[i] == 0) count++;
                if (a[i] != 0 && a[i] < min) {
                    min = a[i];
                    minIndex = i;
                }
            }
        } while (count != N-1);
        System.out.println(min);

    }
}

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

int N;
int main() {
  cin >> N;
  
  for(int i=0; i*4<=N; ++i) {
    int M = N-i*4;
    if(M%7 == 0) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  cout << "No" << endl;
  
  return 0;
}

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

int main() {
  int n[3];
  cin >> n[0] >> n[1] >> n[2];

  int count = 0;
  while(!(n[0] == n[1] && n[1] == n[2])){
    sort(n, n+3);

    if(n[0] != n[1]){
      n[0] += 2;
    }else{
      n[0] += 1;
      n[1] += 1;
    }

    count++;
  }

  cout << count << endl;
}


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

int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char> > vec(H,vector<char>(W));
  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      cin >> vec.at(i).at(j);
    }
  }
  vector<vector<char> > ve(2*H,vector<char>(W));
  for (int i=0; i<2*H; i++) {
    for (int j=0; j<W; j++) {
      cout << vec.at(i/2).at(j);
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


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

  #ifndef ONLINE_JUDGE
      if(fopen("INPUT.txt","r"))
      {
      freopen ("INPUT.txt" , "r" , stdin);
      freopen ("OUTPUT.txt" , "w" , stdout);
      }
  #endif  


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


Measured memory_bytes: 3652
#include<stdio.h>

int main(void)
{
	int n;
	int i,j;
	
	scanf("%d",&n);
	
	int R[n];
	
	for(i=0;i<n;i++)
	{
		scanf("%d",&R[i]);
	}
	
	int maxv=R[1]-R[0],minv=R[0];
	
	for(j=1;j<n;j++)
	{
		if(maxv>R[j]-minv)
		{
			maxv=maxv;
		}
		if(maxv<R[j]-minv)
		{
			maxv=R[j]-minv;
		}
		if(minv>R[j])
		{
			minv=R[j];
		}
		if(minv<R[j])
		{
			minv=minv;
		}
	}
	
	printf("%d\n",maxv);
	
	return 0;
}


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

using namespace std;

typedef long long ll;
//const ll MOD = 1000000007;

int main() {
  int N,M;
  cin>>N>>M;
  vector<ll> A(N);
  ll sum = 0;
  for (int i = 0; i < N; i++) {
    cin>>A[i];
    sum += A[i];
  }
  sort(A.begin(),A.end());
  vector<pair<int,ll>> pairs(M);
  for (int i = 0; i < M; i++) {
    ll B,C;
    cin>>B>>C;
    pairs[i].second = B;
    pairs[i].first = C;
  }
  sort(pairs.rbegin(),pairs.rend());
  int cur = 0;
  for (int i = 0; i < M; i++) {
    if (cur >= N) break;
    int cnt = pairs[i].second;
    ll tmp = pairs[i].first;
    bool ok = false;
    for (int j = cur; j < min(cur + cnt, N); j++) {
      if (A[j] < tmp) sum = sum - A[j] + tmp;
      else {
        ok = true;
        break;
      }
    }
    if (ok) break;
    cur += cnt;
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<cstring>
#include<cstdio>
#define lint long long
#define LOG 17
#define maxK 10
#define V 1<<LOG
#define N 42
#define mod 1000000007
using namespace std;
inline int updv(int x,int p) { return x|(1<<(p-1)); }
int dp[N][V],can[V];
int fast_pow(int x,int k)
{
	int ans=1;
	while(k)
	{
		if(k&1) ans=(lint)ans*x%mod;
		x=(lint)x*x%mod,k>>=1;
	}
	return ans;
}
int show(int x)
{
	for(int i=1;i<=LOG;i++)
		printf("%d",(x&(1<<(i-1)))>>(i-1));
	cout<<endl;
	return 0;
}
int main()
{
	int n,x,y,z;scanf("%d%d%d%d",&n,&x,&y,&z);
	int all=(1<<LOG)-1,v=0,ans=0;dp[0][0]=1;
	v=updv(v,x+y+z),v=updv(v,y+z),v=updv(v,z);
	for(int i=0;i<=all;i++) can[i]=((i&v)!=v);
	for(int i=0,x;i<n;i++)
		for(int j=0;j<=all;j++)
			if(can[j]&&(x=dp[i][j]))
				for(int k=1;k<=maxK;k++)
					(dp[i+1][all&updv(j<<k,k)]+=x)%=mod;
	for(int i=1;i<=all;i++)
		if(can[i]) (ans+=dp[n][i])%=mod;
	printf("%d\n",(fast_pow(10,n)-ans+mod)%mod);
	return 0;
}

Measured memory_bytes: 20224
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=3e3+2;
const int mod=998244353;
void add(int &x,int y){
	x+=y;
	if(x>=mod){
		x-=mod;
	}
}
void sub(int &x,int y){
	x-=y;
	if(x<0){
		x+=mod;
	}
}
int mul(int x,int y){
	return (1ll*x*y)%mod;
}
int dp[N][N][3];
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int a,b,c,d,i,j,k;
	cin>>a>>b>>c>>d;
	dp[a][b][0]=1;
	for(i=a;i<=c;i++){
		for(j=b;j<=d;j++){
			add(dp[i][j][1],mul(dp[i][j-1][0],i));
			add(dp[i][j][1],mul(dp[i][j-1][1],i));
			add(dp[i][j][1],mul(dp[i][j-1][2],i));
			for(k=0;k<3;k++){
				if(k!=1){
					add(dp[i][j][k],mul(dp[i-1][j][k],j-1));
				}
				if(k==1&&j==b){
					add(dp[i][j][k],mul(dp[i-1][j][k],j-1));
				}
				if(k){
					add(dp[i][j][k],dp[i-1][j][k-1]);
				}
				if(k==2){
					add(dp[i][j][k],dp[i-1][j][k]);
				}
			}
		}
	}
	cout<<(dp[c][d][0]+dp[c][d][1]+dp[c][d][2])%mod;
}

Measured memory_bytes: 214688
#include <cstdio>
#include <iostream>
#include <queue>
#include <map>
#include <string>

using namespace std;

typedef struct P{
    int x;
    int y;
}P;


int h,w,n;

const int INF = 100000000;

char feld[1010][1010];
P ch[15];
int d[1010][1010];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int sx,sy;
int gx,gy;
int ans=0;

int bfs(){
    for(int i=0;i<n;i++){
        P s_xy=ch[i];
        sx=ch[i].x;
        sy=ch[i].y;
        gx=ch[i+1].x;
        gy=ch[i+1].y;
        for(int y=0;y<h;y++)
            for(int x=0;x<w;x++)
                d[y][x]=INF;
            queue<P> que;
            que.push(s_xy);
            d[sy][sx]=0;
            while(!que.empty()){
                P p=que.front();
                que.pop();
                int x=p.x;
                int y=p.y;
                if(x==gx&&y==gy){
                    ans+=d[gy][gx];
                    break;
                }
                for(int i=0;i<4;i++){
                    int nx=x+dx[i];
                    int ny=y+dy[i];
                    if(nx<0||nx>=w||ny<0||ny>=h)continue;
                    if(feld[ny][nx]!='X'&&d[ny][nx]==INF){
                        P n;
                        n.x=nx;
                        n.y=ny;
                        d[ny][nx]=d[y][x]+1;
                        que.push(n);
                    }
                }
            }
        }
        return 0;
}

int main(){
    cin>>h>>w>>n;
    char c;
    for(int y=0;y<h;y++){
        for(int x=0;x<w;x++){
            scanf(" %c",&feld[y][x]);
            c=feld[y][x];
            if(feld[y][x]=='S'){
                ch[0].x=x;
                ch[0].y=y;

            }
            if(c>='1'&&c<='9'){
                ch[c-'0'].x=x;
                ch[c-'0'].y=y;

            }
        }
    }
    bfs();
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6224
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <math.h>
#include <iostream>
using namespace std;

#define INF      2147483647LL
// #define NUL      2147483647LL
#define NUL     -1LL
typedef long long int llong;

llong n_array;
llong queries;
vector<llong> D, Lazy;

void printDL();

void lazyEv(llong k, llong l, llong r){
  if( Lazy[k] == NUL ){
    return;
  }
  D[k] = Lazy[k];
  // if it is not leaf
  if( r - l > 1 ){
    Lazy[2*k+1] = Lazy[k];
    Lazy[2*k+2] = Lazy[k];
  }
  Lazy[k] = NUL;
}

void init(llong reqsz){
  n_array = 1;
  while( n_array < reqsz ){
    n_array *= 2;
  }
  D.resize(2*n_array-1, 0);
  Lazy.resize(2*n_array-1, NUL);

  for( llong i = 0 ; i < reqsz ; i++ ){
    D[i+n_array-1] = INF; // initialize the leaves
  }
  for( llong i = n_array - 2 ; i >= 0 ; i--){
    D[i] = min(D[i*2+1] ,D[i*2+2]); // first update segment tree
  }
}

void updateRange(llong a, llong b, llong x, llong k=0, llong l=0, llong r=-1){
  if( r < 0 ){
    r = n_array;
  }

  lazyEv(k, l, r);
  if( b <= l || r <= a){  // case 1
    return;
  }else if( a <= l && r <= b ){ // case 2
    Lazy[k] = x;
    lazyEv(k, l, r);
  }else{ // case 3
    updateRange(a, b, x, 2*k+1, l, (l+r)/2);
    updateRange(a, b, x, 2*k+2, (l+r)/2, r);
    D[k] = min(D[2*k+1], D[2*k+2]);
  }

}

llong find(llong a, llong b, llong k=0, llong l=0 , llong r=-1){
  if( r < 0 ){
    r = n_array;
  }
  lazyEv(k, l, r);
  if( b <= l || r <= a){  // case 1
    return INF;
  }else if( a <= l && r <= b ){ // case 2
    return D[k];
  }else{ // case 3
    llong vl = find(a, b, 2*k+1, l, (l+r)/2);
    llong vr = find(a, b, 2*k+2, (l+r)/2, r);
    return min(vl,vr);
  }
}

void printDL(){ // For debug
  llong i = 0;
  llong j = 0;
  for (const auto& e : D) {
     printf("D[%lld]=" ,i); i++;
     std::cout << e << std::endl;
  }
  for (const auto& e : Lazy) {
     printf("Lazy[%lld]=" ,j); j++;
     std::cout << e << std::endl;
  }
}

int main(){
  llong reqsz;
  scanf("%lld %lld" ,&reqsz ,&queries);
  init(reqsz);
  for(llong i = 0 ; i < queries ; i++){
    llong com;
    scanf("%lld" ,&com ); 
    if( com== 0){
      llong s, t, x;
      scanf("%lld %lld %lld" ,&s ,&t ,&x );
      updateRange(s, t+1, x);
    }else{
      llong idx;
      scanf("%lld" ,&idx );
      llong result = find(idx, idx+1);
      printf("%lld\n" ,result);
    }
  }

  return 0;
}



Measured memory_bytes: 7016
#include <iostream>
using namespace std;
int n,s[100000];
int main(void){
    cin>>n;
    for(int i=0;i<n;i++)cin>>s[i];
    for(int i=n-1;i>0;i--){
        if(s[i]+1==s[i-1])s[i-1]--;
        else if(s[i]<s[i-1]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


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

int main(void){
    int n;
    std::cin >> n;

    std::vector<int> b(n);
    for(int i = 0; i < n; i++){
        int a;
        std::cin >> a;
        b[i] = a - i - 1;
    }

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

    int median_b = b[n/2];

    long long ans = 0;
    for(int i = 0; i < n; i++){
        long long temp_ans = std::abs(b[i] - median_b);
        ans += temp_ans;
    }

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

Measured memory_bytes: 1024
N,K = map(int,input().split())
D = {}
for i in range(N):
    D[i+1] = 0
for i in range(K):
    d = input()
    A = list(map(int,input().split()))
    for a in A:
        D[a] += 1
ans = 0
for i in range(N):
    if D[i+1] == 0:
        ans += 1
print(ans)

Measured memory_bytes: 9096
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
int main()
{
	int a,b;
	string s;
	cin>>a>>b;
	cin>>s;
	int i,sum;
	sum=0;
	for(i=0;i<s.size();i++)
	{
		if(s[i]=='-')
			sum++;
	}
	if(sum==0||sum>1)
		cout<<"No"<<endl;
	else
	{
		if(s[a]=='-')
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = a; i < (ll)b; ++i)
#define INF 10e12
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
typedef long long ll;

using namespace std;

const long long MOD = 1e9 + 7;

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    string s;
    int n;
    deque<char> q;
    cin >> s >> n;
    int cta = 0, flag = 0;
    rep(i, 0, s.length()) q.push_back(s[i]);
    rep(i, 0, n)
    {
        int t;
        cin >> t;
        if (t == 1)
            cta++, flag++;
        else
        {
            int f;
            char c;
            cin >> f >> c;
            if ((f + cta) % 2 == 1)
                q.push_front(c);
            else
                q.push_back(c);
        }
    }
    int len = q.size();
    if (cta % 2 == 0)
        rep(i, 0, len) cout << q.front(), q.pop_front();
    else
        rep(i, 0, len) cout << q.back(), q.pop_back();

    cout << endl;
}

Measured memory_bytes: 4012
def solve():
    N, Y = list(map(int, input().split()))
    max_yukichi = Y // 10000
    max_ichiyo = Y // 5000
    for yukichi in range(Y//10000+1):
        for ichiyo in range(max((Y//5000+1-2*yukichi), 0)):
            if Y - yukichi*10000 - ichiyo*5000 == (N - yukichi - ichiyo) * 1000:
                print(yukichi, ichiyo, (N - yukichi - ichiyo))
                return
    print(-1, -1, -1)

solve()
    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define long long long
string s[100000];
int main() {
	long n; cin >> n;
	for(long i = 0; i < n; i++){
		cin >> s[i]; char ss[10]; 
		for(long j = 0; j < 10; j++) ss[j] = s[i][j]; sort(ss, ss + 10);
		s[i] = "";
		for(long j = 0; j < 10; j++) s[i] += ss[j];
	}
	sort(s, s + n);
	long ans = 0, d = 1;
	for(long i = 1; i < n; i++){
		// cout << s[i] << ans << endl;
		if (s[i] == s[i - 1]) d++;
		else ans += d * (d - 1) / 2, d = 1;
	}
	ans += d * (d - 1) / 2; cout << ans;
}

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

namespace ABC087A
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, a, b, c;

            x = int.Parse(Console.ReadLine());
            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());

            c = (x - a) % b;
            
            Console.WriteLine(c);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>

using namespace std;

#define ll long long

const int MAXN = (int)3e5 + 5;
const int K = 3;

int a[MAXN][K];
int dp[MAXN][K];


int main(){
    int n;cin >> n;
    for (int i = 1;i <= n;i ++) {
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }
    for (int i = 1;i <= n;i ++) {
        for (int k = 0;k < 3;k ++) {
            for (int not_k = 0;not_k < 3;not_k ++) {
                if (not_k == k) continue;
                dp[i][k] = max(dp[i][k], a[i][k] + dp[i - 1][not_k]);
            }
        }
    }
    int ans = 0;
    for (int i = 0;i < K;i ++) {
        ans = max(ans, dp[n][i]);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 5504
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
	string s;cin>>s;
	int n=s.length();
  if(n==2&&s[0]==s[1]){
cout<<1<<" "<<2<<endl;
    return 0;
  }
	for(int i=0;i<n-2;i++){
		if(s[i]==s[i+1]||s[i]==s[i+2]||s[i+1]==s[i+2]){
			cout<<i+1<<" "<<i+3<<endl;
			return 0;
		}
	}
	cout<<-1<<" "<<-1<<endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N; cin >> N;
    vector<int> a(N);
    for(int i=0; i<N; i++) cin >> a[i];

    int ans = 0;
    for(int i=0; i<N; i++){
        int t = a[i];
        while(t%2 == 0){
            ans++;
            t /= 2;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <random>
#include <chrono>
#include <iomanip>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
#define endl '\n'
#define debug(name) DEBUG(#name, (name))
template<typename T>
void DEBUG(string label, T value) {
    cerr << "[" << label << " = " << value << "]\n";
}

void solve(){
    int n, m;
    cin >> n >> m;
    int s = 0;
    int a[n];
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        s += a[i];
    }
    int ans = 0;
    for(int i = 0; i < n; ++i){
        if(a[i] >= (s+4*m-1)/(4*m))++ans;
    }
    if(ans >= m){
        cout << "Yes\n";
    }
    else
        cout << "No" << endl;
}
int main(int argv, char **argc){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int t;
    t  = 1;
    while(t--)
        solve();

}


Measured memory_bytes: 3616
N, M = map(int, raw_input().split())


vote = map(int, raw_input().split())
total = sum(vote)
thres = 1/float(4*M)*total
cnt = 0
for v in vote:
    if v >= thres:
        cnt = cnt + 1

if cnt >= M:
    print('Yes')
else:
    print('No')


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

int main() {

	ll n, a, b;
	cin >> n >> a >> b;

	ll ans = 0;

	ans += (n / (a + b))*a;

	ans += min(n % (a + b), a);

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
long long n;
cin >> n;
long long ans=0;
if(n&1){cout << "0" << endl;
       return 0;}
while(n!=0){
    long long tmp=n/5;
    ans+=(tmp/2);
    n/=5;
}

cout << ans << endl;
}


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

int main(){
  int n,s[10000],q,t,count=0;
  cin>>n;
  for(int i=0;i<n;i++)cin>>s[i];
  cin>>q;
  for(int i=0;i<q;i++){  
    cin>>t;
    for(int j=0;j<n;j++)
      if(s[j]==t){
	count++;
	break;
      }
  }
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 1196
n=int(input())
t=list(map(int,input().split()))
v=list(map(int,input().split()))
v.append(0)
t.append(1)
sumoftimes=[0]
currentsum=0
for i in range(n+1):
  currentsum+=t[i]
  sumoftimes.append(currentsum)
ans=[]
for i in range(2*sumoftimes[n]+1):
  a=10**9
  for j in range(n+1):
    if 2*sumoftimes[j]<=i:
      if j>0:
        a=min(a,(i/2-sumoftimes[j]+v[j-1]))
    else:
      a=min(a,(sumoftimes[j]-i/2+v[j]))
  a=min(a,i/2)
  for j in range(n):
    if i<2*sumoftimes[j+1]:
      a=min(a,v[j])
      break
  if i==2*sumoftimes[n]:
    a=0
  ans.append(a)
finalans=0
for i in range(len(ans)-1):
  finalans+=(ans[i]+ans[i+1])/4
print(finalans)
      

Measured memory_bytes: 79628
N, M=map(int, input().split())
x=[]
y=[]
for i in range(M):
  a, b=map(int, input().split())
  if a==1:
    x.append(b)
  if b==N:
    y.append(a)
    
nx=len(x)
ny=len(y)

if nx==0 or ny==0:
  print('IMPOSSIBLE')
  exit()

x.sort()
y.sort()
i=0
j=0
out='IMPOSSIBLE'

while i+j<nx+ny-1:
  if x[i]==y[j]:
    out='POSSIBLE'
    break
  elif x[i]>y[j]:
    j+=1
  else:
    i+=1
    
print(out)

Measured memory_bytes: 11408
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n; cin >> n;
  vector<int> data(n); REP(i,n) cin >> data[i];
  bool flag = true;
  REP(i,n){
    if(data[i] % 2 == 0){
      if(data[i] % 3 != 0 && data[i] % 5 != 0){
        flag = false;
        break;
      }
    }
  }
  if(flag)
    cout << "APPROVED" << endl;
  else
    cout << "DENIED" << endl;
}

Measured memory_bytes: 3648
// 解き直し.
// https://img.atcoder.jp/arc077/editorial.pdf
// C++(GCC 9.2.1)
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
int a[202020], b[202020];
LL up[202020], down[202020];

int main(){
    
    // 1. 入力情報.
    int N, M;
    scanf("%d %d", &N, &M);
    rep(i, N) scanf("%d", &a[i]);
    
    // 2. お気に入り(x = 0 -> x = M に 読み替え)を使う場合.
    LL cnt = 0;
    repx(i, 1, N){
        if(a[i - 1] > a[i]) cnt += (LL)(a[i] + (M - a[i - 1] > 0));
        else if(a[i] == M)  cnt++;
        else                cnt += (LL)(a[i] - a[i - 1]);
    }
    
    // 3. 増加分.
    repx(i, 1, N) up[a[i]] += (LL)((a[i] + M - a[i - 1]) % M - 1);
    // rep(i, M + 1) printf("i=%d up=%d\n", i, up[i]);
    
    // 4. 減少分.
    // a[i] と a[i + 1] の 間に x があるような iの個数.
    rep(i, N - 1){
        int s = a[i] + 1;
        if(s > M) s -= M;
        if(a[i + 1] - a[i] > 1){
            b[s]++, b[a[i + 1]]--;
        }
        if(a[i + 1] < a[i] && a[i + 1] + M - a[i] > 1){
            if(s > 1) b[s]++, b[M + 1]--;
            b[1]++, b[a[i + 1]]--;
        }
    }
    rep(i, M) down[i + 1] = down[i] + (LL)b[i + 1];
    // rep(i, M + 1) printf("i=%d down=%d\n", i, down[i]);
    
    // 5. 出力.
    LL ans = cnt, bef = cnt, cur = 0;
    repx(x, 1, M){
        // 今回分更新.
        int idx = (x - 1) == 0 ? M : x - 1;
        cur = bef + up[idx] - down[idx];
        // printf("cur=%d bef=%d up=%d down=%d\n", cur, bef, up[idx], down[idx]);
        
        // 最小値更新.
        ans = min(ans, cur);
        
        // 前回分更新.
        bef = cur;
    }
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 6032
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.Comparator;
import java.util.Collections;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author teiwa
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            List<Integer> inputList = new ArrayList<>();
            for (int i = 0; i < 5; i++) {
                inputList.add(in.nextInt());
            }
            int diffThr = in.nextInt();
            //Collection.sort(inputList);
            Collections.sort(inputList, new Comparator<Integer>() {

                public int compare(Integer a, Integer b) {
                    return a - b;
                }
            });

            //System.out.println(inputList.get(inputList.size() - 1) + ":" + inputList.get(0) );
            if (inputList.get(inputList.size() - 1) - inputList.get(0) <= diffThr) {
                out.println("Yay!");
            } else {
                out.println(":(");
            }
        }

    }
}



Measured memory_bytes: 21716
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main() {
	int n;
	const char b[9][5] = { {'.',',','!','?',' '}, {'a','b','c'}, {'d','e','f'},
							{'g','h','i'}, {'j','k','l'}, {'m','n','o'},
							{'p','q','r','s'}, {'t','u','v'}, {'w','x','y','z'} };
	const int a[] = {5,3,3,3,3,3,4,3,4};
	cin >> n;
	for(int i=0;i<n;++i){
		string buf;
		cin >> buf;
		int c,j=0;
		bool f = false;
		int cnt = 0;
		while((c=buf[j++])!='\0'){
			c -= '0';
			int tmp;
			if(c==0){
				if(f){
					cout << b[tmp-1][--cnt%a[tmp-1]];
					cnt=0;
					f=false;
				}
			}else{
				tmp=c; cnt++; f=true;
			}
		}
		cout << endl;
	}
	return 0;
}

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

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    string S;
    cin >> S;
    vector<int> ans;
    int n_ans = 0;
    int cur = N;
    int step;
    while(cur != 0){
        step = min(M, cur);
        while(S[cur - step] == '1'){
            step--;
            if(step == 0){
                cout << -1 << endl;
                return 0;
            }
        }
        ans.emplace_back(step);
        cur -= step;
    }
    int l = ans.size();
    for (int i=l-1; i>=0; i--){
        cout << ans[i];
        if(i != 0) cout << " " ;
    } cout << endl;
    return 0;
}

Measured memory_bytes: 1144
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		int len = s.length();
		boolean ok = true;
		for(int i = 0;i < len; ++i){
			if(s.charAt(i) != t.charAt(i))ok = false;
		}
		System.out.print(ok ? "Yes":"No");
	}
}



Measured memory_bytes: 35696
//author: Harsh Nema
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 922337203685477;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main()
{
    fastio;
    string s;
    cin>>s;
    string r=s;
    ll c=0;
    reverse(r.begin(),r.end());
    for(ll i=0;i<s.length()/2;++i){
        if(s[i]!=r[i])
            ++c;
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int a[100001];
    for (int i = 0; i < n; i++)
        cin >> a[i];

    int p[100001];
    for (int i = 0; i < 100000; i++)
        p[i] = 0;

    for (int i = 0; i < n; i++) {
        p[a[i]]++;
        if (a[i] > 0)
            p[a[i]-1]++;
        if (a[i] < 100000)
            p[a[i]+1]++;
    }

    int m = -1;
    int x = 0;
    for (int i = 0; i < 100000; i++) {
        if (p[i] > m) {
            m = p[i];
            x = i;
        }
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] - 1 <= x && a[i] + 1 >= x)
            ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const int mod = 1e9+7;
const int N = 1e5+5;
int a[N];

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int n, ans = INT_MAX, sum1 = 0, sum2 = 0;

    cin >> n;

    int arr[n];

    for (int i = 0; i < n; i++) {

        cin >> arr[i];
        sum1 += arr[i];
    }

    for (int i = 0; i < n; i++) {

        sum2 += arr[i];

        ans = min(ans, abs(sum1-sum2*2));
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<iomanip>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#define INF long long int(1e18+1)
#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;

long long int dp[3][100010];

int main()
{
	int n, k;
	cin >> n >> k;
	int r, s, p;
	cin >> r >> s >> p;
	string t;
	cin >> t;

	rep(i, 0, 3)dp[i][0] = 0;
	rep(j, 1, n + 1) {
		long long int m;
		if (t[j - 1] == 'r') {
			dp[0][j] = dp[0][j - 1];
			dp[1][j] = dp[1][j - 1];
			if (j - k > 0)
				if (dp[2][j - k] != dp[2][j - k - 1]) {
					dp[2][j] = dp[2][j - 1];
					continue;
				}
			m = max(dp[0][j - 1], dp[1][j - 1]);
			m = max(m, dp[2][j - 1]);
			dp[2][j] += m + p;
		}
		else if (t[j - 1] == 's') {
			dp[1][j] = dp[1][j - 1];
			dp[2][j] = dp[2][j - 1];
			if (j - k > 0)
				if (dp[0][j - k] != dp[0][j - k - 1]) {
					dp[0][j] = dp[0][j - 1];
					continue;
				}
			m = max(dp[1][j - 1], dp[2][j - 1]);
			m = max(m, dp[0][j - 1]);
			dp[0][j] += m + r;
		}
		else if (t[j - 1] == 'p') {
			dp[0][j] = dp[0][j - 1];
			dp[2][j] = dp[2][j - 1];
			if (j - k > 0)
				if (dp[1][j - k] != dp[1][j - k - 1]) {
					dp[1][j] = dp[1][j - 1];
					continue;
				}
			m = max(dp[0][j - 1], dp[2][j - 1]);
			m = max(m, dp[1][j - 1]);
			dp[1][j] += m + s;
		}
	}
		long long int ans = 0;
		rep(i, 0, 3)ans = max(ans, dp[i][n]);
		cout << ans << endl;
}



Measured memory_bytes: 5648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;
/* ちゃんと考えてわかって実装 */

int main(void){
    int n;
    cin >> n;
    // 全部 mod5 = k であるような素数ならok
    vector<int> primes;
    vector<bool> isP(55556);
    for(int i=0; i<=55555; i++){
        isP[i] = true;
    }
    isP[0] = false;
    isP[1] = false;

    for(int i=2; i<=55555; i++){
        if(isP[i] == true){
            for(int j=i; j<=55555; j+=i){
                isP[j] = false;
            }
            if(i % 5 == 1){
                primes.push_back(i);
            }
        }
    }

    for(int i=0; i<n; i++){
        cout << primes[i] << " ";
    }
    return 0;
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

void add(ll& x, ll y) {
    if (x>=mod) x%=mod;
    if (y>=mod) y%=mod;
    x += y;
    if (x>=mod) x%=mod;
}

const int maxn = 1e6 + 5;

// source: ARC90E - Avoiding collision
// https://atcoder.jp/contests/arc090/tasks/arc090_c

// g: graph of exactly size n
// dist[i]: standard shortest path from src to i
// ways[i]: # of shorest paths from src to i

void spa(vector<vector<pair<ll,int>>> g, vector<ll>& dist, vector<ll>& ways, int src) {
    int n = g.size();
    dist.assign(n, inf);
    dist[src] = 0;
    ways.assign(n, 0);
    ways[src] = 1;

    priority_queue<pair<ll,int>> pq;
    pq.emplace(0, src);

    while (pq.size()) {
	auto cur = pq.top();
	pq.pop();
	int at = cur.second;
	ll walk = -cur.first;
	if (walk > dist[at]) {
	    continue;
	}
	for (auto ed: g[at]) {
	    ll wei = ed.first;
	    int to = ed.second;
	    if (walk+wei < dist[to]) {
		ways[to] = ways[at];
		dist[to] = walk+wei;
		pq.emplace(-dist[to], to);
	    } else if (walk+wei == dist[to]) {
		add(ways[to], ways[at]);
	    }
	}
    }
    
}


int n, m, s, t;
vector<vector<pair<ll,int>>> g;
vector<ll> sdist, tdist, sways, tways;

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

    cin>>n>>m>>s>>t;
    --s; --t;
    assert(s != t);
    
    g.resize(n);
    sdist.resize(n);
    sways.resize(n);
    tdist.resize(n);
    tways.resize(n);

    for (int i=0; i<m; i++) {
	int u,v,d; cin>>u>>v>>d;
	--u; --v;
	g[u].push_back({d,v});
	g[v].push_back({d,u});
    }

    spa(g, sdist, sways, s);
    spa(g, tdist, tways, t);

    assert(sdist[t] == tdist[s]);
    assert(sways[t] == tways[s]);

    
    ll dist = sdist[t];
    ll ways = sways[t]*sways[t]%mod;


    for (int i=0; i<n; i++) {
	if (i==s || i==t) {
	    continue;
	}
	
	// there exists a shortest path that goes through node i
	//dist/2 to meet at exact same time
	
	if (sdist[i]==dist/2 && tdist[i]==dist/2 && sdist[i]+tdist[i]==dist) {
	    ll paths = sways[i]*tways[i]%mod;
	    ll pairs = paths*paths%mod;
	    //cout<<i<<": "<<paths<<endl;
	    ways -= pairs;
	    ways %= mod;
	}
    }


    for (int u=0; u<n; u++) {
	for (auto ed: g[u]) {
	    int v = ed.second;
	    ll wei = ed.first;

	    // <dist/2 to prevent overcounting same pairs of paths,
	    // all necessary/sufficient condition to meet at same time
	    
	    if (sdist[u]*2<dist && tdist[v]*2<dist && sdist[u]+wei+tdist[v]==dist) {
		// there exists a shortest path via u-v edge
		ll paths = sways[u]*tways[v]%mod;
		ll pairs = paths*paths%mod;

		//cout<<u+1<<"-"<<v+1<<": "<<pairs<<endl;
		ways -= pairs;
		ways %= mod;
	    }
	}
    }

    //watch(dist);

    ways %= mod;
    ways += mod;
    ways %= mod;
    cout<<ways<<endl;
    
    return 0;
}


Measured memory_bytes: 31440
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define INF 1000000000
#define mod 1000000007
#define vi vector <int>
#define vll vector<long long>
#define ii pair<int,int>
#define vii vector<pair<int,int>>
#define ll long long 
#define ld long double
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define sz(a) (int)a.size()

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
/*struct item{
    int m,c;
};					// change item according to the question;
struct segtree{
	int size;
	vector<item>values;
	void intit(int n){
		size=1;
		while(size<n)size*=2;
		values.resize(2*size);
	}
    item merge(item a,item b){
        if(a.m<b.m)return a;
        if(b.m<a.m)return b;
        if(a.m==b.m)return {a.m,a.c+b.c}; 
    }
    item single(int v){
        return {v,1};
    }
    item NEUTRAL_ELEMENT={INF,1};
    void build(vi &a,int x,int lx,int rx){
        if(rx-lx==1){
            if(lx<sz(a)){
                values[x]=single(a[lx]);
            }
            return;
        }
        int m=(lx+rx)/2;
        build(a,2*x+1,lx,m);
        build(a,2*x+2,m,rx);
        values[x]=merge(values[2*x+1],values[2*x+2]);
    }
    void build(vi &a){
        build(a,0,0,size);
    }
    void set(int i,int v,int x,int lx,int rx){
        if(rx-lx==1){
            values[x]=single(v);
            return;
        }
        int m=(lx+rx)/2;
        if(i<m){
            set(i,v,2*x+1,lx,m);
        }else{
            set(i,v,2*x+2,m,rx);
        }
        values[x]=merge(values[2*x+1],values[2*x+2]);
    }
    void set(int i,int v){
        set(i,v,0,0,size);
    }
    item calc(int l,int r,int x,int lx,int rx){
        if(lx>=r||rx<=l)return NEUTRAL_ELEMENT;
        if(l<=lx && rx<=r)return values[x];
        int m=(lx+rx)/2;
        item s1=calc(l,r,2*x+1,lx,m);
        item s2=calc(l,r,2*x+2,m,rx);
        return merge(s1,s2);
    }
    item calc(int l,int r){
        return calc(l,r,0,0,size);
    }
};*/
int main(){
	int x;
    cin>>x;
    if(x>=30)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3608
N = int(input())
S = input()

kizetu = False
cnt = 0

for s in S:
    
    if s == "x":
        kizetu += 1
    else:
        kizetu = 0
        
    if kizetu == 2:
        print(cnt)
        break
    
    cnt += 1
else:
    print(len(S))

Measured memory_bytes: 7856
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

vector<long long int> divisor(long long int n) {
	vector<long long int> res;
	for (long long int i = 1; i * i <= n; ++i) {
		if (n % i == 0) {
			res.push_back(i);
			if (i * i != n) res.push_back(n / i);
		}
	}
	sort(begin(res), end(res));
	return res;
}
long long int gcd(long long int l, long long int r) {
	if (l > r)return gcd(r, l);
	else {
		if (r%l) {
			return gcd(l, r%l);

		}
		else {
			return l;
		}
	}
}
int main() {
	int N; cin >> N;
	vector<long long int>ns(N);
	for (int i = 0; i < N; ++i) {
		cin >> ns[i];
	}
	long long int a =  gcd(ns[0], ns[1]);
	if (N == 3) {
		a =  gcd(a, ns[2]);
	}
	auto v(divisor(a));
	for (auto n : v) {
		cout << n << endl;
	}
	return 0;
}

Measured memory_bytes: 3112
# UnionFind
#############################################################
class UnionFind:

    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, v):  # vが属する集合の根を返す
        if self.parents[v] < 0:
            return v
        else:
            self.parents[v] = self.find(self.parents[v])
            return self.parents[v]

    def unite(self, u, v):  # 「uが属する集合」と「vが属する集合」を併合（根同士を結ぶ）
        u = self.find(u)
        v = self.find(v)
        if u == v:
            return
        if self.parents[u] > self.parents[v]:  # u < v に統一する
            u, v = v, u
        self.parents[u] += self.parents[v]
        self.parents[v] = u

    def size(self, v):  # vが属する集合の要素数
        return -self.parents[self.find(v)]

    def same(self, u, v):  # uとvが同じ集合に属するか否か
        return self.find(u) == self.find(v)
#############################################################

N = int(input())
XY = [list(map(int, input().split())) + [i] for i in range(N)]

X = sorted(XY, key=lambda x: x[0])
Y = sorted(XY, key=lambda x: x[1])

side = []
for i in range(N - 1):
    # iとi+1の距離、iのindex, i+1のindex
    side.append([X[i + 1][0] - X[i][0], X[i][2], X[i + 1][2]])
    side.append([Y[i + 1][1] - Y[i][1], Y[i][2], Y[i + 1][2]])

ans = 0
side.sort(key=lambda x: x[0])

uf = UnionFind(N)

for cost, i, j in side:
    if uf.same(i, j):
        continue
    uf.unite(i, j)
    ans += cost

print(ans)


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

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

int main() {
	int H, W; cin >> H >> W;
	int K = gcd(H, W);
	cout << H + W + 1 - K << endl;
	return 0;
}


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

int main(){
     int x1,y1,x2,y2;
     cin >> x1 >> y1>> x2 >> y2;

    cout << x2+y1-y2<<" "<< y2-x1+x2<<" ";
    cout << x1+y1-y2 << " " << y1+x2-x1 <<endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int size = 0;
		StringBuilder out = new StringBuilder();
		while ((size = sc.nextInt()) != 0) {
			int min = 1000001;
			int[] array = new int[size];
			for (int i = 0; i < size; i++) {
				array[i] = sc.nextInt();
			}
			int tmp;
			for (int i = 0; i < size; i++) {
				for (int j = 0; j < size; j++) {
					if (i != j && min > (tmp = Math.abs(array[i] - array[j]))) {
						min = tmp;
					}
				}
			}
			out.append(min);
			out.append('\n');
		}
		System.out.print(out.toString());
	}
}



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

int main() {
  int N1,N2;
  cin >> N1 >> N2;
  vector<int> P(N1);
  for (int i=0; i<N1; i++){
    cin >> P.at(i);
  }
  sort(P.begin(),P.end());
  int ans=0;
  for (int i=0; i<N2; i++){
    ans+=P.at(i);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
using System;

class sample3{
    
    static void Main(string[] args){
    int area = 0;
    int around = 0;
    int a;
    int b;
    
    string[] nums = Console.ReadLine().Split(' ');
    
    a = int.Parse(nums[0]);
    b = int.Parse(nums[1]);
    
    area =  a*b;
    around = ((a*2) + (b*2));
    
    Console.WriteLine("{0} {1}",area, around);
    }

}


Measured memory_bytes: 15884
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 heapq import heapify, heappop, heappush

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, K = MAP()

ans = 0
for i in range(K, N + 2):
    B = N * (N + 1) // 2 - (N - i) * (N - i + 1) // 2
    A = (i - 1) * i // 2
    ans += (B - A + 1)
print(ans % mod)

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

struct cal_and_flag{
	long num;
	bool three, five, seven;
};

long N, ans = 0;

void calculate(cal_and_flag a){
	
	if(a.three&&a.five&&a.seven&&a.num<=N)ans++;
	
	if(a.num > 100000000){
		return;
	}
	
	cal_and_flag aa = a;
		aa.three = true;
		aa.num *= (long)10;
		aa.num += (long)3;
		calculate(aa);
	
	cal_and_flag ab = a;
		ab.five = true;
		ab.num *= (long)10;
		ab.num += (long)5;
		calculate(ab);
	
	cal_and_flag ac = a;
		ac.seven = true;
		ac.num *= (long)10;
		ac.num += (long)7;
		calculate(ac);
	
}

int main() {
	cin >> N;
	
	cal_and_flag start = {0, false, false, false};
	calculate(start);
	
	cout << ans << endl;
}

Measured memory_bytes: 256