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

#define rep(i,n) for (int i=0; i< (n); i++)
typedef std::pair<int, int> P;
typedef long long int ll;

using namespace std;

int main(){
    int n;
    std::cin >> n;
    vector<int> p(n);
    rep(i, n) {
        cin >> p[i];
    }

    int count = 0;
    for(int i=1; i<(n-1); i++){
        if(p[i-1] < p[i] && p[i] < p[i+1]){
            count +=1;
        }else if(p[i-1] > p[i] && p[i] > p[i+1]){
            count +=1;
        }
    }
    printf("%d", count);
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  static int n;
  static int[] a;

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

    n = sc.nextInt();
    a = new int[n];
    for(int i = 0; i < n; i++){
      a[i] = sc.nextInt();
    }

    int[] b = new int[2 * n];
    int s = n, t = n;
    boolean f = true;
    for(int i = 0; i < n; i++){
      if(f){
        b[t++] = a[i];
      }
      else{
        b[--s] = a[i];
      }
      f = !f;
    }

    StringBuilder sb = new StringBuilder();
    if(f){
      for(int i = s; i < t; i++){
        sb.append(b[i] + " ");
      }
    }
    else{
      for(int i = t - 1; i >= s; i--){
        sb.append(b[i] + " ");
      }
    }

    System.out.println(sb);
  }
}

Measured memory_bytes: 98100
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String N = sc.next();
        String[] splitN = N.split("", 0);
        int sum = 0;
        
        for(int i = 0; i < splitN.length; i++){
            sum += Integer.parseInt(splitN[i]);
        }
        
        if(Integer.parseInt(N) % sum == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21844
N = int(input())
C = input()
answer = 0

for i in range(N):
    if C[i] == 'W':
        red_start = i
        break
    if i == N-1:
        red_start = N-1

for i in range(1, N+1):
    if C[-i] == 'R':
        white_start = i
        break
    if i == N:
        white_start = N

red_pos = red_start
white_pos = white_start    

while red_pos + white_pos < N:
    answer += 1
    for i in range(red_pos+1, N):
        if C[i] == 'W':
            red_pos = i
            break
        if i == N-1:
            red_pos = N-1
    for i in range(white_pos+1, N+1):
        if C[-i] == 'R':
            white_pos = i
            break
        if i == N:
            white_pos = N

print(answer)

Measured memory_bytes: 9340
n,a,b,c,d = map(int,input().split())
sub = "#"+input()
s = list(sub)

con = True
for i in range(a,d+1):
    if s[i-1]=="#" and s[i]=="#":
        print("No")
        con = False
        break

if (con):
    if (c<b) or (c<d):
        print("Yes")
        con = False

if (con):
    for i in range(b-1,d):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            print("Yes")
            con = False
            break

if (con):
    print("No")



Measured memory_bytes: 4980
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  int k0=0,k1=0;
  for(char c:S){
    if(c=='0')
      k0++;
    else
      k1++;
  }
  cout<<min(k0,k1)*2<<endl;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> cnt(20, vector<int>(20));
  vector<pair<int, int>> a;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    long long x = 0;
    bool found = false;
    for (int i = 0; i < (int) s.size(); i++) {
      if (s[i] != '.') (x *= 10) += s[i] - '0';
      else found = true;
    }
    if (!found) {
      x *= (long long) 1e9;
    } else {
      int cur = 0;
      while (s.back() != '.') {
        ++cur;
        s.pop_back();
      }
      for (int it = 0; it < 9 - cur; it++) x *= 10;
    }
    int cnt2 = 0;
    long long y = x;
    while (y % 2 == 0) {
      ++cnt2;
      y /= 2;
    }
    int cnt5 = 0;
    y = x;
    while (y % 5 == 0) {
      ++cnt5;
      y /= 5;
    }
    ++cnt[min(18, cnt2)][min(18, cnt5)];
    a.emplace_back(min(18, cnt2), min(18, cnt5));
  }
  for (int i = 18; i >= 0; i--) {
    for (int j = 18; j >= 0; j--) {
      cnt[i][j] += cnt[i + 1][j] + cnt[i][j + 1] - cnt[i + 1][j + 1];
    }
  }
  long long res = 0;
  for (auto x : a) {
    res += cnt[18 - x.first][18 - x.second] - (x.first >= 9 && x.second >= 9);
  }
  res /= 2;
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 5300
#include<cstdio>
#include<iostream>
#define NIL -1
using namespace std;
struct Node{int l, r, p;};
Node T[30];
void preorder(int r)
{
  if(r == NIL)
    return ;
  printf(" %d", r);
  preorder(T[r].l);
  preorder(T[r].r);
}

void inorder(int r)
{

  if(r == NIL)
    return ;
  inorder(T[r].l);
  printf(" %d", r);
  inorder(T[r].r);
}

void postorder(int r)
{
  if(r == NIL)
    return ;
  postorder(T[r].l);
  postorder(T[r].r);
  printf(" %d", r);
}
int main()
{
  int n=0, v=0, l=0, r=0;
  scanf("%d", &n);
  for(int i=0; i<n; i++)
  {
    T[i].l = T[i].r = T[i].p = NIL;
  }
  for(int i=0; i<n; i++)
  {
    scanf("%d", &v);
    scanf("%d%d", &l, &r);
    T[v].l = l; T[v].r = r;
    T[l].p = T[r].p = v;
  }
  for(int i=0; i<n; i++)
  {
    if(T[i].p == NIL) r = i;
  }
  printf("Preorder\n");
  preorder(r);
  printf("\nInorder\n");
  inorder(r);
  printf("\nPostorder\n");
  postorder(r);
  printf("\n");

  return 0;
}



Measured memory_bytes: 3220
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 998244353
N, S = lr()
A = lr()
dp = np.array([0] * (S+1), dtype=np.int64)
answer = 0
for a in A:
    dp[0] += 1 # Lの数は１個ずつ加わる
    prev = dp.copy()
    dp[a:] += prev[:-a]
    answer += dp[-1] # その位置をRとした時
    dp %= MOD

print(answer % MOD)
# 26


Measured memory_bytes: 13324
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ちゃんとユニークな配列にする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

int main() {
  int N;
  int size;
  cin >> N;
  vector<int> A;
  rep(i, N) {
    cin >> size;
    A.pb(size);
  }
  sort(all(A));

  vector<int> B;
    rep(i, N) {
    cin >> size;
    B.pb(size);
  }
  sort(all(B));

  vector<int> C;
  rep(i, N) {
    cin >> size;
    C.pb(size);
  }
  sort(all(C));

  ll result = 0;
  rep(i, N) {
    // DEBUG(i);
    int b = B[i];
    decltype(A)::iterator ita = lower_bound(A.begin(), A.end(), b);
    ll countA = ita - A.begin();
    // DEBUG(countA);
    decltype(C)::iterator itc = upper_bound(C.begin(), C.end(), b);
    ll countC = N - (itc - C.begin());
    // DEBUG(countC);
    result = result + (countA * countC);
  }
  cout << result << endl;
}


Measured memory_bytes: 1784
#include <bits/stdc++.h>
using namespace std;
typedef tuple<int, int, int> tp;
typedef long long LL;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<int, LL> pil;
typedef pair<LL, int> pli;
typedef pair<LL, LL> pll;
typedef pair<pii, int> piipi;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;
typedef pair<LL, pii> plpii;
typedef pair<LD, LD> pdd;
typedef pair<LD, int> pdi;
typedef pair<LD, LL> pdl;
typedef pair<int, LD> pid;
typedef pair<LL, LD> pld;
const int mod = 1e9 + 7;
const int hf = 999983;
const int N = 1e6;

pii p[1005];
int w[1005], s[1005], v[1005];
LL dp[20005];

int main(){
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++){
        scanf("%d%d%d", &w[i], &s[i], &v[i]);
        p[i] = pii(s[i]+w[i], i);
    }
    sort(p+1, p+1+n);
    LL ans = 0;
    for(int i=1;i<=n;i++){
        int idx = p[i].second;
        for(int j=s[idx];j>=0;j--){
            dp[j+w[idx]] = max(dp[j+w[idx]], dp[j] + v[idx]);
            ans = max(ans, dp[j+w[idx]]);
        }
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 384
s=input()
p=[]
p.append(r'^keyence$')
p.append(r'(\D+)keyence$')
p.append(r'^k(\D+)eyence$')
p.append(r'^ke(\D+)yence$')
p.append(r'^key(\D+)ence$')
p.append(r'^keye(\D+)nce$')
p.append(r'^keyen(\D+)ce$')
p.append(r'^keyenc(\D+)e$')
p.append(r'^keyence(\D+)')
ans='NO'
import re
for pi in p:
    m=re.search(pi,s)
    if m and m.start()>-1:
        ans='YES'
        break
print(ans)


Measured memory_bytes: 3316
x1, x2 = map(int, input().split())
 
l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]
 
if (x1 in l1) & (x2 in l1):
  print("Yes")
elif (x1 in l2) & (x2 in l2):
  print("Yes")
elif (x1 in l3) & (x2 in l3):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 61720
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
using namespace std;

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

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
mint COM(int n, int k){
    if (n < k) return (mint)0;
    if (n < 0 || k < 0) return (mint)0;
    return (mint)(fac[n] * (finv[k] * finv[n - k] % MOD) % MOD);
}
mint H(int n,int k){
    return COM(n+k-1,n-1);
}
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    // cout << fixed << setprecision(20);
    COMinit();
    int n,k;cin >> n >> k;

    mint ans = 0;
    for(int i = 0;i <= min(n,k);i++){
        ans += COM(n,i)*H(n-i,i);
    }
    cout << ans.x << '\n';
    return 0;
}



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

map<int, int> pf(int n) {
  map<int, int> ma;
  for (int i = 2; i * i <= n; i++) {
    while (n % i == 0) ma[i]++, n /= i;
  }
  if (n != 1) ma[n]++;
  return ma;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);

  vector<int> cnt(1e6+1);
  for (auto a : A) {
    for (auto [b, c] : pf(a)) {
      if (cnt.at(b)) goto NG;
      cnt.at(b)++;
    }
  }
  return cout << "pairwise coprime" << "\n", 0;
  NG:;
  int G = 0;
  for (int i = 0; i < N; i++) G = gcd(G, A.at(i));
  if (G == 1) cout << "setwise coprime" << "\n", 0;
  else cout << "not coprime" << "\n";
}


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

void swap(int &a, int &b)
{
    int tmp = a;
    a = b;
    b = tmp;
    return;
}

int main(int argc, const char * argv[]) {
    int x, y, z;
    cin >> x;
    cin >> y;
    cin >> z;
    
    swap(x, y);
    swap(x, z);
    
    std::cout << x << " " << y << " " << z << endl;
    return 0;
}


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

int main(){
	int a,v=0,vll=0;

	for(int i=0;i<3;i++){
		cin >>a;
		if(a==5)v++;
		else if(a==7)vll++;
	}
	if(v==2&&vll==1)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
unsigned long long clz64(unsigned long long n){
	n|=n>>1;
	n|=n>>2;
	n|=n>>4;
	n|=n>>8;
	n|=n>>16;
	n|=n>>32;
	return 64-__builtin_popcountll(n);
}

#include <stdio.h>
int main(){
	long long N;
	scanf("%lld",&N);
	printf("%d\n",64-clz64(N));
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int binarySearch(int arr[], int p, int r, int num) { 
   if (p <= r) { 
      int mid = (p + r)/2; 
      if (arr[mid] == num)   
         return mid ; 
      if (arr[mid] > num)  
         return binarySearch(arr, p, mid-1, num);            
      if (arr[mid] > num)
         return binarySearch(arr, mid+1, r, num); 
   } 
   return -1; 
} 
int main()
{
ll n;
	cin>>n;
	ll a[n];
	ll sum=0;
	map<ll,ll>m;
	for(int i=0;i<n;i++)
	  {
	    cin>>a[i];
	    sum+=a[i];
	    m[a[i]]++;
	}
   map<ll,ll>::iterator it;
   int q,b,c;
   cin>>q;
	 for(ll i=0;i<q;i++)
	  {  cin>>b>>c;
	    it=m.find(b);
	    if(it!=m.end())
	      {
	      	sum=sum-(it->second*b)+(c*it->second);
	      	m[c]=m[c]+it->second;
	      	m[b]=0;
		  }
	   /*if(m[b]!=0)
	    {
	  	for(it=m.begin();it!=m.end();it++)
	  	   { 
	  	     if(it->first==b)
	  	       {
	  	       	sum=sum-(b*it->second)+(c*it->second);
	  	       	m[b]=0;
	  	       	 m[c]=m[c]+it->second;
	  	       	 break;
				 }
	  	   	  
			 }

	  }*/
	  cout<<sum<<endl;
}
return 0;
	
	  
	
}

Measured memory_bytes: 9360
//Copyright(c)2017 Mstdream
#include<bits/stdc++.h>
using namespace std;

inline void splay(int &v){
	v=0;char c=0;int p=1;
	while(c<'0' || c>'9'){if(c=='-')p=-1;c=getchar();}
	while(c>='0' && c<='9'){v=(v<<3)+(v<<1)+c-'0';c=getchar();}
	v*=p;
}
int n,x,a,b,c,f;
int main(){
	//freopen("xxx.in","r",stdin);
	splay(n);
	for(int i=1;i<=n;i++){
		splay(x);
		if(x%4==0)a++;
		else if(x%2==0)b++;
		else c++;
	}
	if(b==0&&c-a<=1)f=1;
	if(b!=0&&c-a<=0)f=1;
	puts(f?"Yes":"No");
}

Measured memory_bytes: 256
import sys
def coun(n):
  i = 0
  ans = 1
  while i < n:
    ans = (ans*2)%(10**9+7)
    i += 1
  return ans
N = int(input())
A = list(map(int, input().split()))
A.sort()
if len(A)%2 == 1:
  if A[0]!=0:
    print(0)
    sys.exit()
  i = 1
  while i <= len(A)//2:
    if A[2*i-1]==2*i and A[2*i]==2*i:
      i += 1
    else:
      print(0)
      sys.exit()
  print(coun(N//2))

if len(A)%2 == 0:
  i = 0
  while i < N//2:
    if A[2*i] == 2*i+1 and A[2*i+1] == 2*i+1:
      i += 1
    else:
      print(0)
      sys.exit()
  print(coun(N//2))

Measured memory_bytes: 14008
/*#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	char a=0,b=0;
	int aa=0,bb=0;
	cin>>s;
	for(int i=0;i<4;i++)
	if(a==0) a=s[i];
	else if(s[i]==a) aa++;
	else if(b==0) b=s[i];
	else if(s[i]==b) bb++;
	else
	{
		cout<<"No";
		return 0;
	}
	if(aa!=2||bb!=2)
	{
		cout<<"No";
		return 0; 
	}
	cout<<"Yes";
}*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int f[10010];
	int n;
	cin>>n;
	for(int i=1;i<=n;i++) cin>>f[i];
	int ans=0;
	for(int i=2;i<=n-1;i++)
	if(f[i-1]<f[i]&&f[i]<f[i+1]||f[i+1]<f[i]&&f[i]<f[i-1]) ans++;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,a,b,i,m,z;
	m=-1;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a,&b);
		if(m<b){
			m=b;	
			z=a;
		}
		else if(m==b){
			if(a<z){
				z=a;
			}
		}
	}
	printf("%d %d\n",z,m);
	return 0;
}

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

int main()
{
    int a,b,x,y,z,r;
    while(scanf("%d%d",&a,&b)==2)
    {
        x=a+b;
        y=a-b;
        z=a*b;
        if(x>=y&&x>=z)
            r=x;
        else if(y>=x&&y>=z)
            r=y;
        else
            r=z;
        printf("%d\n",r);
    }

    return 0;
}


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

int main(){
		double a,b,r1,d,e,r2;
		scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&r1,&d,&e,&r2);

		double di=sqrt((a-d)*(a-d)+(b-e)*(b-e));

		if(di+r1<r2)printf("0\n");
		else if(di+r2<r1)printf("0\n");
		else if(di==r2+r1)printf("3\n");
		else if(di>r2+r1)printf("4\n");
    else if(di+r2==r1)printf("1\n");
    else if(di+r1==r2)printf("1\n");
    else printf("2\n");
}



Measured memory_bytes: 2760
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, P = MAP()
A = LIST()

fact = [0]*(51)
fact[0] = 1

for i in range(1, 51):
	fact[i] = i*fact[i-1]

def Conv(n, r):
	return fact[n]//fact[r]//fact[n-r]

C = Counter([x%2 for x in A])

ans = 0
for i in range(P%2, C[1]+1, 2):
	ans += Conv(C[1], i)

ans *= pow(2, C[0])
print(ans)


Measured memory_bytes: 5200
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  rep(i, n) {
    ll x;
    cin >> x;
    ans += 2 * min(x, abs(x-k));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




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

/*　吾輩はやれば出来る子である。 
　　　　∩∩ 
　　　（´･ω･） 
　　 ＿|　⊃／(＿＿_ 
　／　└-(＿＿＿_／ 
　￣￣￣￣￣￣￣ 
　やる気はまだない 

　　 ⊂⌒／ヽ-、＿_ 
　／⊂_/＿＿＿＿ ／ 
　￣￣￣￣￣￣￣　　*/

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



int main() {
int N;
cin >> N;
int panel[200000];
for(int i = 0; i < N; i++) cin >> panel[i];
for(int i = N-1; i > 0; i--){
if(panel[i] < panel[i-1])panel[i-1]--;
}
string ans = "Yes";
for(int i = 0; i < N-1; i++){
    if(panel[i] > panel[i+1]) ans = "No";
}
cout << ans << endl;
}




Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7


int par[100002]; //親を表す
int myrank[100002];  //木の深さを表す

void init(int n){   //初期化
  REP(i,n){
    par[i]=i;
    myrank[i]=0;
  }
}

int find(int x){    //親を見つける
  if(par[x]==x){
    return x;
  }else{
    return par[x]=find(par[x]);
  }
}

void unit(int x, int y){    //x,yを併合
  x=find(x);
  y=find(y);
  if(x==y)return;

  if(myrank[x]<myrank[y]){
    par[x]=y;
  }else{
    par[y]=x;
    if(myrank[x]==myrank[y])myrank[x]++;
  }
}

bool same(int x, int y){    //x,yが同じグループか判定
  return find(x)==find(y);
}

int size(int x, int n){     //xのグループの要素数を求める
  int group=find(x);
  int size=0;
  rep(i,1,n+1)if(find(i)==group)size++;
  return size;
}

int main(){
  int n, m;
  int P, X, Y;
  VE p, x, y;
  cin >> n >> m;
  REP(i, n){
    cin >> P;
    p.push_back(P);
  }
  while(cin >> X >> Y){
    x.push_back(X);
    y.push_back(Y);
  }
  init(n);
  REP(i, m){
    unit(x[i], y[i]);
  }
  int count = 0;
  rep(i, 1, n + 1){
    if(same(i, p[i - 1])){count++;}
  }
  print(count);
}

Measured memory_bytes: 2680
X, N = map(int, input().split())

if N != 0:
    p = list(map(int, input().split()))
else:
    p = []

for i in range(100):
    if (X - i) not in p:
        print(X - i)
        break

    elif (X + i) not in p:
        print(X + i)
        break

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

int main(){

	int n;cin >> n;
	vector<ll> v(n);REP(i,n)cin >> v[i];

	sort(ALL(v),greater<ll>());

	ll a=0,b=0;
	REP(i,n){
		if(i%2)b += v[i];
		else a += v[i];
	}

	cout << a - b << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;

typedef long long ll;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define INF 1000000000

int main() {

	bool ans = 1;
	string s;
	cin >> s;
	int len = s.length(), count = 0;

	if (s[0] != 'A')ans = 0;
	FOR1(i, len) {
		if (isupper(s[i])) {
			if (s[i] != 'C' || i == 1 || i == len - 1)ans = 0;
			count++;
		}
	}
	if (count != 1)ans = 0;

	if (ans)cout << "AC" << endl;
	else cout << "WA" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
int N; 
cin >> N; 
string ans = "No"; 
for (int i = 0; i <= 30; ++i){
if(N - 4 * i >= 0 && (N - 4 * i) % 7 == 0){
 ans = "Yes";
 break;
}
}
cout << ans << endl; 
}

Measured memory_bytes: 256
#include<cstdio>
long long a[100005];
long long b[100005];
long long sum[100005];

long long min(long long a,long long b){ return a>b?b:a; }

int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    int sizeA = 0, sizeB = 0;
    for(int i = 0; i < n; i++){
        long long u;
        scanf("%lld",&u);
        if(u<0) a[++sizeA] = u;
        else b[++sizeB] = u;
    }
    long long ans = 1e17+7;
    for(int i = 0; i <= sizeA; i++){
        int j = k-i;
        if(j>sizeB) continue;
        else{
            long long l = 0-a[sizeA-i+1], r = b[j];
            ans = min(ans,min(2*l+r,2*r+l));
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 2500
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String p = sc.nextLine();
		s = s + s;
		int pLen = p.length();
		int sLen = s.length();
		int pPoint = 0;
		int sPoint = 0;
		while (sPoint < sLen && pPoint < pLen) {
			if (s.charAt(sPoint) == p.charAt(pPoint)) {
				sPoint++;
				pPoint++;
			} else {
				sPoint = sPoint - pPoint + 1;
				pPoint = 0;
			}
		}
		if (pPoint == pLen) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 26292
/* ex9_1
  kt125*/

#include<stdio.h>
#include<stdlib.h>
#define SIZE 11
typedef struct{
    int size; //格納最大数
    int count; //データ数
    char data[SIZE]; //データの配列
    char *top; //topへのポインタ
} stack;
void initialize_stack(stack *stk); //スタックを初期化する関数
void print_stack(stack *stk); //スタックの中身をprintする関数
void push(stack *stk, char x); //スタックのpush操作をする関数
void pop(stack *stk); //スタックのpop操作をする関数

stack stk;

int main(void){
    char key[12];
    char *ptr;
    scanf("%s", key); //入力を読み取る
    ptr = key; //keyの先頭アドレスを渡す
    initialize_stack(&stk);
    while(*ptr){ //ヌル文字に至るまで数字ならpush,'B'ならpop
        if( *ptr == '0' || *ptr == '1'){
            push(&stk, *ptr);
        }else{
            pop(&stk);
        }
        ptr++;
    }
    print_stack(&stk);
    return 0;
}

void initialize_stack(stack *stk){
    stk->count = 0;
    stk->size = SIZE;
    stk->top = &(stk->data[SIZE]); //データの一番後ろのアドレスを渡す
}

void pop(stack *stk){
    if(stk->count <= 0){ //データが空のときは何もしない
        return;
    }else{
        stk->top++;
        stk->count--;
    }
}

void push(stack *stk, char x){
    if(stk->count >= stk->size){ //エラー出力
        printf("Error:stack overflow. (x=%lf)\n", x);
        exit(1);
    }else{
        //topをずらして、そのアドレスに新たにxを追加
        stk->top--;
        *(stk->top) = x;
        stk->count++;
    }
}

void print_stack(stack *stk){
    char *p;
    p = &(stk->data[SIZE-1]);
    //stkには古いものが後ろに格納されているので後ろからprint
    for(int i=0; i<stk->count; i++){
        printf("%c", *p--);
    }
    printf("\n");
}


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

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

  int *a = new int[n];
  for(int i=0; i<n; i++)
  {
    cin >> a[i];
  }

  int alice = 0;
  int bob = 0;

  for(int i=0; i<n; i++)
  {
    int max = 0;
    int max_j;
    for(int j=0; j<n; j++)
    {
      if(a[j] > max)
      {
        max = a[j];
        max_j = j;
      }
    }

    if(i%2 == 0)
    {
      alice += max;
    }
    else
    {
      bob += max;
    }
    a[max_j] = 0;
  }
  

  cout << alice - bob << endl;
    
  return 0;
}


Measured memory_bytes: 256
n,m = gets.split.map(&:to_i)
food = Array.new(m,0)
for i in 0..n-1
  inst = gets.split.map(&:to_i)
  for j in 1..inst[0]
    food[inst[j]-1] += 1
  end
end
ans = 0
m.times {|i| ans += 1 if food[i] == n}
 puts ans


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

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    int number = 1;
    for (int i = 0; i < n; i++) {
        if (number * 2 > number + k) {
            number += k;
        } else {
            number *= 2;
        }
    }
    cout << number << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>

using namespace std;
int a[105];
char ch[105];
int n, ans = 999999999;
int pd(){
	for(int i = 2; i <= n; i ++){
		if(a[i] == 0) break;
		if(a[i] != a[i - 1]) return 0;
	}
	return 1;
}
void sol(int x){
	for(int i = 1; i <= n; i ++){
		a[i] = ch[i] - 'a' + 1;
	}
	int p = 0;
	while(!pd()){
		for(int i = 1; i <= n - p; i ++){
			if(a[i] == x || a[i + 1] == x){
				a[i] = x;
			}
		}
		a[n - p] = 0;
		p++;
	}
	ans = min(ans, p);
}
int main(){
	scanf("%s", ch + 1);
	n = strlen(ch + 1);
	for(int i = 1; i <= 26; i ++){
		sol(i);
	}
	printf("%d\n", ans);
	return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
#define ll long long

int main(){
  ll a,b,r,tmp,x;
  scanf("%lld%lld",&a,&b);
  x=a*b;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }

  printf("%lld",x/b);
  return 0;
}

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

int Func(int n) {
  int sum = 0;
  while(n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  
  int total = 0;
  for(int i = 1; i <= N; i++) {
    if(A <= Func(i) && Func(i) <= B) total += i;
  }
  cout << total << endl;
}  


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

const int N=1e2+20,MOD=1e9+7;

int k,len;
string a,b;
long long ans;

void go(int i,int k)
{
	if(k<0) return;
	if(i==len)
	{
		if(b<=a and k==0) ans++;
		return;
	}

	for(char c='0';c<='9';c++)
	{
		b[i]=c;
		if(k==0)
		{
			if(c=='0') go(i+1,k-(c!='0'));
		}
		else go(i+1,k-(c!='0'));
	}
}

int main()
{
	cin>>a>>k;

	len=a.size();
	for(int i=1;i<=len-1;i++)
	{
		if(i==1)
		{
			if(k==1) ans+=9;
		}
		else if(i==2)
		{
			if(k==1) ans+=9;
			else if(k==2) ans+=9*9;
		}
		else if(i==3)
		{
			if(k==1) ans+=9;
			else if(k==2) ans+=2*9*9;
			else ans+=9*9*9;
		}
		else
		{
			if(k==1) ans+=9;
			else if(k==2) ans+=9*(i-1)*9;
			else ans+=9*9*9*(i-1)*(i-2)/2;
		}
		ans%=MOD;
	}

	for(int i=1;i<=a[0]-'0'-1;i++)
	{
		if(k==1) ans++;
		else if(k==2) ans+=9*(len-1);
		else ans+=9*9*(len-1)*(len-2)/2;
		ans%=MOD;
	}

	b=a;
	if(k==1) ans++;
	else go(1,k-1);

	cout<<ans<<endl;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

try:
   scores = [0] * 2 #得点
   n = int(input())
   
   for i in range(n):
      cards = []
      animals = input()
      
      #spaceの位置を探す
      for j in range(len(animals)):
         if animals[j] == " ":
            sp = j
            break
      
      taro = animals[0 : sp]
      hanako = animals[sp + 1 : len(animals)]
      
      cards = []
      cards.append(taro)
      cards.append(hanako)
      #print("@", cards)
      
      #得点を計算する
      if taro == hanako:
         scores[0] += 1
         scores[1] += 1
      else:
         #辞書順にソートする
         new_cards = sorted(cards)
         if cards[0] == new_cards[0]:
            #print("True")
            scores[1] += 3
         else:
            #print(False)
            scores[0] += 3

   print(scores[0], scores[1])

except EOFError:
   pass



Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
int main() {
   int a,b;
   scanf("%d%d",&a,&b);
    if(a>=1&&a<=13&&b>=1&&b<=13) {
	    if(a==1)
    	   a=15;  
    	if(b==1)
    	   b=15;
    	if(a>b)
    	  cout<<"Alice";
    	else if(a<b)
		   cout<<"Bob";
	else
	    printf("Draw");
  }
}

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

// youtube 
int dist[100005][3];//(node, step), total distance
const int INF = 1001001001;//10^5の間違えづらい書き方
int main() {
    string S;
    cin >> S;
    int i = 1;
    for(auto &l : S){
        if (i  && l == 'L'){
            cout << "No" << endl;
            return 0;
        }else if (!i  && l == 'R'){
            cout << "No" << endl;
            return 0;
        }
        i = (i + 1) % 2;
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main() {
  int k;
  vector<int> A(5);
  for (int i = 0; i < 5; i++) {
    cin >> A[i];
  }

  cin >> k;

  bool is = false;
  for (int i = 0; i < 5; i++) {
    for (int j = i; j < 5; j++) {
      int dis = abs(A[i] - A[j]);
      if (dis > k) {
        is = true;
        break;
      }
    }
  }

  if (is) {
    cout << ":(" << endl;
  } else {
    cout << "Yay!" << endl;
  }
};


Measured memory_bytes: 256
num = int(input())
row = [int(s) for s in input().split()]
p = 0
nums = []
for i in range(num):
  if i == num - 1:
    nums.append(p)
  elif row[i] >= row[i + 1]:
    p += 1
  else:
    nums.append(p)
    p = 0
print(max(nums))

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
 
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007;

 
int main(){
    int n;cin >> n;
    int type[9] = {};
    rep(i,n){
        int rate;cin >> rate;
        rate /= 400;
        if(rate>= 8) rate = 8;
        type[rate] += 1;
    }
    int small = 0;
    for(int i = 0; i < 8; i++){
        if(type[i] > 0) small += 1;
    }
    int large = small + type[8];
    if(small == 0) small = 1;
    cout << small <<" "<< large<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=int64_t;
int main(){
  string s;
  cin>>s;
  ll l=s.length(),t,x,k,j,ans=0;
  for(j=0;j<(1<<(l-1));j++){
    bitset<10> b(j);
    x=0;
    t=s[0]-'0';
    for(k=0;k<l-1;k++){
      if(b.test(k)){
        x+=t;
        t=s[k+1]-'0';
      }
      else t=10*t+(s[k+1]-'0');
    }
    x+=t;
    ans+=x;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3616
#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; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++) 
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    //ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    int N,M,K;
    cin >> N >> M >> K;
    bool ans=false;
    if(K%N==0 || K%M==0)ans=true;
    else{
        rep(i,N){
            rep(j,M){
                if(i*M+j*N-2*i*j==K)ans=true;
            }
        }
    }
    if(ans)cout << "Yes";
    else cout << "No";
    


}

/*



 */



Measured memory_bytes: 256
using System;

namespace abc170_c
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] XN = Console.ReadLine().Split(" ");
            int X = int.Parse(XN[0]);
            int N = int.Parse(XN[1]);
            string pStr = Console.ReadLine();
            if (pStr.Length == 0)
            {
                Console.WriteLine(X);
                return;
            }

            string[] p = pStr.Split(" ");


            int[] arr = new int[102];
            for(int i = 0; i < p.Length;i++)
            {
                int pi = int.Parse(p[i]);
                arr[pi] = 1;
            }
            int min = int.MaxValue;
            int ans = 0;

            for (int i = 0; i < arr.Length; i++)
            {
                if(arr[i] == 0)
                {
                    if(min > Math.Abs(X - i))
                    {
                        min = X - i;
                        ans = i;
                    }
                }
            }

            Console.WriteLine(ans);
            return;
        }
    }
}


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


int main()
{
    string s;
    int i,c=0;

    cin>>s;

    for(i=0;i<4;i++)
    {
        if(s[i]=='+')c++;
        else
            c--;
    }

    cout<<c<<endl;
    return 0;

}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int N, X; cin >> N >> X;
  int S[N]; rep(i,N) cin >> S[i]; sort(S,S+N,greater<int>());
  ll dp[N+1][X+1] = {}; dp[0][X] = 1;
  rep(i,N) rep(j,X+1) {
    dp[i+1][j%S[i]] += dp[i][j];
    dp[i+1][j%S[i]] %= MOD;
    dp[i+1][j] += dp[i][j]*((N-1)-i);
    dp[i+1][j] %= MOD;    
  }
  ll result = 0;
  rep(i,S[N-1]+1) {
    result += i * dp[N][i];
    result %= MOD;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 157312
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

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

    ll a, b, c; cin >> a >> b >> c;

    if(a + b > c){
        cout << "No" << endl;
        return 0;
    }

    if(4*a*b < (c - a - b)*(c - a - b)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
//#include<tr1/unordered_map>
#pragma GCC optimize ("Ofast")
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for(int i=0; i<int(n); i++)
#define Forn(i, n) for(int i=1; i<=int(n); i++)

using namespace std;

const int inf = 1000;
int n;
int a[210][210];
int dis[210][210];

vector<int> g[210];
int col[210];
int nowcol;

bool die;

void dfs(int x)
{
    col[x] = nowcol;
    for(int i=0; i<g[x].size(); i++)
    {
        if(col[g[x][i]] == nowcol) die = 1;
        if(!col[g[x][i]])
        {
            nowcol = 3-nowcol;
            dfs(g[x][i]);
            nowcol = 3-nowcol;
        }
    }
}

bool check()
{
    die = 0;
    nowcol = 1;
    dfs(1);
    return die;
}

int main()
{
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> n;
    Forn(i, n) Forn(j, n)
    {
        char x;
        cin >> x;
        if(x == '1')
        {
            a[i][j] = 1;
            g[i].pb(j);
            g[j].pb(i);
            dis[i][j] = 1;
        }
        else if(i == j) dis[i][j] = 0;
        else dis[i][j] = inf;
    }
    Forn(k, n) Forn(i, n) Forn(j, n) if(dis[i][k]+dis[k][j]<dis[i][j]) dis[i][j] = dis[i][k]+dis[k][j];
    if(check())
    {
        cout << -1 << endl;
        return 0;
    }
    int maxi = -1;
    Forn(i, n) Forn(j, n) maxi = max(maxi, dis[i][j]);
    cout << maxi+1 << endl;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//




int main() {

    string s; cin >> s;
    if (s[s.size()-1] == 's') {
        s += "es";
    } else {
        s += 's';
    }

    out(s);

    return 0;
}





Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
ll modfac(ll a){
    ll ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
ll modinv(ll a,ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main(){
    ll n;cin >> n;
    vl l(n,0),r(n,0),v(n);
    rep(i,n)cin >> v[i];
    ll left=v[0],right=v[n-1];
    rep(i,n-1){
        left=__gcd(left,v[i]);
        l[1+i]=left;
    }
    for(int i=0;i<n-1;i++){
        right=__gcd(right,v[n-1-i]);
        r[n-1-i-1]=right;
    }
    l[0]=r[0];
    r[n-1]=l[n-1];
    ll ans=0;
    rep(i,n){
        ans=max(ans,__gcd(l[i],r[i]));
    }
    cout <<ans <<endl;
}

Measured memory_bytes: 2560
if __name__ == "__main__":

    n = int(input())

    d1 = []
    d2 = []
    flag = 0

    for i in range(n):
        a,b = (int(x) for x in input().split())
        #print(a)
        #print(b)
        d1.append(a)
        d2.append(b)

        if i >= 2:
            if d1[i-2] == d2[i-2] and \
               d1[i-1] == d2[i-1] and \
               d1[i] == d2[i] :
                  flag = 1

    if 0 == flag:
        print("No")
    else:
        print("Yes")
        

Measured memory_bytes: 9196
/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#ifdef WAAUTOMATON
     #define debug(args...)            {dbg,args; cerr<<endl;}
#else
    #define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;

void solve(long long N, string s, string t){
	for(int i=N; i>=0; --i) {
		bool flag=true;
		for(int j=1; j<=i; ++j) {
			if (s[N-i-1+j]!=t[j-1]) {
				flag=false;
				break;
			}
		}
		if (flag) {
			cout<<N*2-i;
			return;
		}
	}	
}

int main(){	
#ifdef WAAUTOMATON
	//freopen("in.txt","r",stdin);
#endif
	string t;
	string s;
	long long N;
	scanf("%lld",&N);
	cin >> s;
	cin >> t;
	solve(N, s, t);
	return 0;
}



Measured memory_bytes: 256
// https://onlinejudge.u-aizu.ac.jp/problems/0558
// チーズ (Cheese)
// 一张地图上有开始点、空白、阻碍和奶酪
// 奶酪的数量N是1-9，其中有硬度1-9，初始只能吃1个硬度的然后2个、三个。
// 可以直接N次BFS也可以一直BFS（记录吃了几个）
// 如果硬度是随机的？dfs可能超时、bfs要记录地图变化就比较难写了

#include <cstring>
#include <iostream>
#include <map>
#include <queue>

using namespace std;

typedef pair<int, int> pii;

char m[1100][1100];
char mark[1100][1100];
int W, H, N;
pii s[10];
pii dir[4] = {pii(-1, 0), pii(1, 0), pii(0, 1), pii(0, -1)};

int bfs(int n)
{
    memset(mark, 0, sizeof(mark));
    pii start = s[n];
    queue<pii> q;
    q.push(start);
    mark[start.first][start.second] = 1;
    int ans = 0;
    while (!q.empty())
    {
        ans++;
        int k = q.size();
        for (int i = 0; i < k; ++i)
        {
            for (int i = 0; i < 4; ++i)
            {
                pii t = q.front();
                t = pii(t.first + dir[i].first, t.second + dir[i].second);
                if (t.first >= 0 && t.second >= 0 && t.first < H && t.second < W && !mark[t.first][t.second])
                {
                    if (m[t.first][t.second] == '1' + n)
                    {
                        return ans;
                    }
                    else if (m[t.first][t.second] == '.' || m[t.first][t.second] >= '1' && m[t.first][t.second] <= '9')
                    {
                        q.push(t);
                        mark[t.first][t.second] = 1;
                    }
                }
            }
            q.pop();
        }
       
    }
    return 100; // unreachable code
}

int main()
{
    cin >> H >> W >> N;
    for (int i = 0; i < H; ++i)
    {
        cin >> m[i];
        for (int j = 0; j < W; ++j)
        {
            if (m[i][j] >= '1' && m[i][j] <= '9')
            {
                s[m[i][j] - '0'] = pii(i, j);
            }
            else if (m[i][j] == 'S')
            {
                m[i][j] = '.';
                s[0] = pii(i, j);
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < N; ++i)
    {
        // cout << ans << endl;
        ans += bfs(i);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 5356
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define INF 2147483647
pair<int,int> data[4000030];
int n,_n;
void init(int n){
  _n=1;
  while(_n<1500000)_n*=2;
}
void update(int i,int x){
  int p=i;
  i+=_n-1;
  data[i].f+=x;
  data[i].s=p+1;
  while(i>0){
    i=(i-1)/2;
    if(data[2*i+1].f==data[2*i+2].f){
      if(data[2*i+1].s<data[2*i+2].s)
        data[i]=data[2*i+1];
      else data[i]=data[2*i+2];
    }
    else if(data[2*i+1].f>data[2*i+2].f)
      data[i]=data[2*i+1];
    else data[i]=data[2*i+2];
  }
}
int main(){
  int q;
  cin>>n>>q;
  init(n);
  while(q--){
    int a,b;
    cin>>a>>b;
    update(a-1,b);
    cout<<data[1].second<<' '<<data[1].first<<endl;
  }
}

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

typedef long long ll;

ll f(ll n){
    return n*(n-1)/2;
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n), cnt(n, 0);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        cnt[--a[i]]++;
    }
    ll ans = 0;
    for(int i = 0; i < n; i++){
        ans += f(cnt[i]);
    }
    for(int i = 0; i < n; i++){
        cout << ans-f(cnt[a[i]])+f(cnt[a[i]]-1) << endl;
    }
    return 0;
}

Measured memory_bytes: 4096