akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

#define BUFSIZE 200001

int main() {
    int i= 0;
    char S[BUFSIZE]= "", Si[BUFSIZE]= "", buf1[BUFSIZE]= "";
    scanf("%s", S);
    int Slen= strlen(S), ans= Slen;
    while(i < Slen) {
        sprintf(Si, "%c", S[i]);
        if(strcmp(buf1, Si) == 0) {
            sprintf(buf1, "%c%c", S[i], S[i + 1]);
            i++;
            ans--;
        } else {
            strcpy(buf1, Si);
        }
        i++;
    }
    printf("%d", ans);

    return 0;
}


Measured memory_bytes: 896
#include<iostream>
#include<limits.h>

using namespace std;
const int LEN = 1e6 + 10;
int N, M, X, ans = INT_MAX;
int A[20][20], level[LEN], C[LEN];

void dfs(int dep, int sum) {
    if (dep == N + 1) {
        for (int i = 1; i <= M; i++) {
            if (level[i] < X)
                return;
        }
        ans = min(ans, sum);
        return;
    }
    for (int i = 1; i <= M; i++) {
        level[i] += A[dep][i];
    }
    dfs(dep + 1, sum + C[dep]);
    for (int i = 1; i <= M; i++) {
        level[i] -= A[dep][i];
    }
    dfs(dep + 1, sum);
}

int main() {
    cin >> N >> M >> X;
    for (int i = 1; i <= N; i++) {
        cin >> C[i];
        for (int j = 1; j <= M; j++)
            cin >> A[i][j];
    }
    dfs(1, 0);
    if (ans >= INT_MAX) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


int main() {
  ll n; cin >> n;
  Vll ind(n+1);
  rep(i, n) {
    int p;
    cin >> p;
    ind[p] = i;
  }
  ll ans = 0;
  multiset<int> seen;
  seen.insert(-1);
  seen.insert(-1);
  seen.insert(n);
  seen.insert(n);
  rep(i, n) {
    ll x = n-i;
    auto it = seen.insert(ind[x]);
    ll j = *it;
    ll c = *(++it);
    ll d = *(++it);
    --it; --it;
    ll b = *(--it);
    ll a = *(--it);
    ++it; ++it;
    ans += x * ((c-j)*(b-a) + (j-b)*(d-c));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5760
MOD=10**9+7
cnt=0; sum=0; prev=nil; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n,l=gsmi
ar=(l..(l+n-1)).to_a
min = ar[-1]
ar.each do |i|
  min = i if min.abs > i.abs
end
puts ar.inject(:+)-min

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,t,a; cin>>n>>t>>a;
	int ans; double mn=1e9;
	for(int i=1;i<=n;++i){
		double A; cin>>A;
		double hp=t-A*0.006;
		hp=abs(hp-a);
		if(mn>hp)mn=hp,ans=i;
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
if k>(n-1)*n//2-(n-1):
    print(-1)
else:
    ans=[(1,i) for i in range(2,n+1)]
    lestnum=(n-1)*n//2-(n-1)-k
    for i in range(2,n):
        for j in range(i+1,n+1):
            if lestnum!=0:
                ans.append((i,j))
                lestnum-=1
    print(len(ans))
    for i in ans:
        print(" ".join(map(str,i)))

Measured memory_bytes: 9304
N, W = map(int, input().split())
v, w = [], []
for i in range(N):
    vi, wi = map(int, input().split())
    v.append(vi)
    w.append(wi)

dp = [[0]*(W+1) for i in range(N+1)]
for i in range(N):
    for j in range(W+1):
        if w[i] > j:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])

print(dp[N][W])


Measured memory_bytes: 25492
class UnionFindNode(object):
    """
    Union-Find構造
    ノードのグループ併合や、所属グループ判定を高速に処理する
    """

    def __init__(self, group_id, parent=None, value=None):
        self.group_id_ = group_id
        self.parent_ = parent
        self.value = value
        self.size_ = 1

    def __str__(self):
        template = "UnionFindNode(group_id: {}, \n\tparent: {}, value: {}, size: {})"
        return template.format(self.group_id_, self.parent_, self.value, self.size_)

    def is_root(self):
        return not self.parent_

    def root(self):
        parent = self
        while not parent.is_root():
            parent = parent.parent_
            self.parent_ = parent
        return parent

    def find(self):
        parent = self.root()
        return parent.group_id_

    def size(self):
        parent = self.root()
        return parent.size_

    def unite(self, unite_node):
        parent = self.root()
        unite_parent = unite_node.root()

        if parent.group_id_ != unite_parent.group_id_:
            if parent.size() > unite_parent.size():
                unite_parent.parent_ = parent
                parent.size_ = parent.size_ + unite_parent.size_
            else:
                parent.parent_ = unite_parent
                unite_parent.size_ = parent.size_ + unite_parent.size_



N,M=map(int,input().split())
#X=N*(N-1)/2
X=0
AB=[]
for i in range(M):
    a,b=map(int,input().split())
    AB.append([a,b])
AB.reverse()
L=[X]
U=[UnionFindNode(i) for i in range(N+1)]
for i in range(M):
    if U[AB[i][0]].find()!=U[AB[i][1]].find():
        X+=U[AB[i][0]].size()*U[AB[i][1]].size()
    U[AB[i][0]].unite(U[AB[i][1]])
    L.append(X)
P=L.pop()
L=list(reversed(L))
for i in range(M):
    print(P-L[i])


Measured memory_bytes: 94040
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    int MAX = 100000;
    int N;
    cin >> N;
    
    int n= N/2;
    
    int b[n];
    int c[n];
    
    vector<pair<int,int>> bv(MAX+1);
    vector<pair<int,int>> cv(MAX+1);
 
    for(int i=0;i<MAX+1;i++){
        bv[i] = make_pair(0,i);
        cv[i] = make_pair(0,i);}
    
    
    //個数分布→値付き個数分布
    
    for (int i=0;i<n;i++){
        cin >> b[i] >> c[i];
        bv[b[i]].first += 1;
        cv[c[i]].first += 1;}
    
    sort(bv.begin(),bv.end());
    sort(cv.begin(),cv.end());
    
    reverse(bv.begin(), bv.end());
    reverse(cv.begin(), cv.end());
    
    
    int ans;
    
    if(bv[0].second != cv[0].second)
        ans = N - bv[0].first -cv[0].first;
    
    else{
        if(bv[0].first - bv[1].first > cv[0].first - cv[1].first)
            ans =  ans = N - bv[0].first -cv[1].first;
        else
            ans = ans = N - bv[1].first -cv[0].first;}
    
    cout << ans;
}







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

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

using namespace std;

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

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

int H, W;
char C[110][110];

int main() {
    cin >> H >> W;
    rep(i, H) rep(j, W) cin >> C[i][j];

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cout << C[i][j];
        }
        cout << endl;
        
        for (int j = 0; j < W; j++) {
            cout << C[i][j];
        }
        cout << endl;
    }
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new Main().compute();
    }

    void compute() {
        Scanner sc = new Scanner(System.in);
        String Sprime = sc.next();
        String T = sc.next();
        String S[] = new String[Sprime.length() - T.length() + 1];
        check:
        for (int i = Sprime.length() - T.length(); i >= 0; i--) {
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) == Sprime.charAt(i + j) || Sprime.charAt(i + j) == '?') {
                } else {
                    continue check;
                }
            }
            S[i] = "";
            for (int j = 0; j < Sprime.length(); j++) {
                if (j >= i && j < i + T.length()) {
                    S[i] += T.charAt(j - i);
                } else if (Sprime.charAt(j) == '?') {
                    S[i] += 'a';
                } else {
                    S[i] += Sprime.charAt(j);
                }
            }
        }
        boolean flag = false;
        String ans = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
        for (int i = 0; i < Sprime.length() - T.length()+1; i++) {
            if (S[i] != null && ans.compareTo(S[i]) >= 0) {
                flag = true;
                ans = S[i];
            }
        }
        if (flag) {
            System.out.println(ans);
        } else {
            System.out.println("UNRESTORABLE");
        }
    }
}


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

#define int long long
#define endl '\n'

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #ifdef LOCAL
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif
    
    
    int n,k; cin>>n>>k;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int x,y; cin>>x>>y;
        if (x*x + y*y <=k*k) ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 3652
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;

int main(int argc, const char * argv[]) {
    long long int w,h,x,y;
    cin >> w >> h >> x >> y;
    double a = (w * h)/2.0;

    int multiple = 0;
    
    if ((x >= ((w/2.0)-pow(10,-9)) && x <= ((w/2.0)+pow(10,-9))) && (y >= ((h/2.0)-pow(10,-9)) && y <= ((h/2.0)+pow(10,-9)))) {
        multiple = 1;
        
    } else {
        multiple = 0;
    }
        
            

    cout << fixed  <<  setprecision(6) << (double)a << " " << multiple;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String[] spl = s.split(" ");
		int A = Integer.parseInt(spl[0]);
		int P = Integer.parseInt(spl[1]);
		sc.close();
		int sum = A * 3 + P;
		int applePie = 0;
		applePie = sum /2;
		System.out.println(applePie);
	}
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
vector<int>dp(n,INT_MAX);
int arr[n];
for(int i=0;i<n;i++) cin>>arr[i];
dp[0]=0;
dp[1]=abs(arr[1]-arr[0]);
for(int i=2;i<n;i++){
    for(int j=i-1,jump=0;j>=0 && jump<k;j--,jump++){
    dp[i]=min(dp[i],dp[j]+abs(arr[i]-arr[j]));}
}
cout<<dp[n-1]<<endl;
return 0;
}


Measured memory_bytes: 1024
N = int(input())
A = list(input())
B = list(input())
C = list(input())
a, b, c = 0, 0, 0
cnt = 0
for i in range(N):
    if A[i] == B[i] == C[i]:
        a += 1
        b += 1
        c += 1
    elif A[i] == B[i]:
        a += 1
        b += 1
        cnt += 1
    elif B[i] == C[i]:
        b += 1
        c += 1
        cnt += 1
    elif C[i] == A[i]:
        c += 1
        a += 1
        cnt += 1
    else:
        cnt += 2
print(cnt)


Measured memory_bytes: 3064
#include <stdio.h>


int main(){

  int i,j,n,m;
  long min = 100000000000,ans = -100000000000;
  scanf("%d",&n);

  for(i = 0;i < n;i++){
      scanf("%d",&m);
      if(m - min > ans ) ans = m - min;
      if(m < min) min = m;
  }

  printf("%ld\n",ans);

  return 0;
}

Measured memory_bytes: 2756
#include<iostream>
#include<vector>
#include<cstdlib>
#include <cmath>

using namespace std;

int main(){
  int i,j,k,n,s;
  cin >> n;
  i=n;
  while(n/10!=0 || n%10!=0){
    s+=n%10;
    n/=10;
  }
  if(i%s==0)cout <<"Yes"<<endl;
  if(i%s!=0)cout <<"No"<<endl;

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <bitset>
#include <functional>
using namespace std;
const constexpr int INF = 1e9;
//typedef std::pair<std::string,double> P;

int K;
string s; 

string alp="abcdefghijklmnopqrstuvwxyz";
void solve(){
    vector<string> v;
    for(int i=0; i<s.size(); ++i){
        for(int j=1; j<=K; ++j){
            
            v.push_back(s.substr(i, j));
        }
    }
    sort(v.begin(), v.end());
    int idx=0, cnt=1;
    string comp=v[0];
    while(1){
        if(comp!=v[idx]){
            comp=v[idx];
            cnt++;
        }
        if(cnt==K) break;
        
        idx++;
    }
    cout << v[idx] << endl;
}
int main() {
    cin >> s >> K;
    solve();
	return 0;
}

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

int main(){
	
	int d[10];
	for(int i=0;i<10;i++)cin>>d[i];
	sort(d, d+10, greater<int>());
	for(int i=0;i<3;i++)cout<<d[i]<<endl;
	
	return 0;
}


Measured memory_bytes: 1176
#include <algorithm>
#include <functional>
#include <utility>
#include <vector>
#include <iostream>
template<typename T>
class ConvecHullTrick {
private:
	// 直線群(配列)
	std::vector<std::pair<T, T>> lines;
	// 最小値(最大値)を求めるxが単調であるか
	bool isMonotonicX;
	// 最小/最大を判断する関数
	std::function<bool(T l, T r)> comp;

public:
	// コンストラクタ ( クエリが単調であった場合はflag = trueとする )
	ConvecHullTrick(bool flagX = false, std::function<bool(T l, T r)> compFunc = [](T l, T r) {return l >= r; })
		:isMonotonicX(flagX), comp(compFunc)  {
		//lines.emplace_back(0, 0);
	};

	// 直線l1, l2, l3のうちl2が不必要であるかどうか
	bool check(std::pair<T, T> l1, std::pair<T, T> l2, std::pair<T, T> l3) {
		if (l1 < l3) std::swap(l1, l3);
		return (l3.second - l2.second) * (l2.first - l1.first) >= (l2.second - l1.second) * (l3.first - l2.first);
	}

	// 直線y=ax+bを追加する
	void add(T a, T b) {
		std::pair<T, T> line(a, b);
		while (lines.size() >= 2 && check(*(lines.end() - 2), lines.back(), line))
			lines.pop_back();
		lines.emplace_back(line);
	}

	// i番目の直線f_i(x)に対するxの時の値を返す
	T f(int i, T x) {
		return lines[i].first * x + lines[i].second;
	}

	// i番目の直線f_i(x)に対するxの時の値を返す
	T f(std::pair<T, T> line, T x) {
		return line.first * x + line.second;
	}

	// 直線群の中でxの時に最小(最大)となる値を返す
	T get(T x) {
		// 最小値(最大値)クエリにおけるxが単調
		if (isMonotonicX) {
			static int head = 0;
			while (lines.size() - head >= 2 && comp(f(head, x), f(head + 1, x)))
				++head;
			return f(head, x);
		}
		else {
			int low = -1, high = lines.size() - 1;
			while (high - low > 1) {
				int mid = (high + low) / 2;
				(comp(f(mid, x), f(mid + 1, x)) ? low : high) = mid;
			}
			return f(high, x);
		}
	}
};
using namespace std;
long long h[200010],dp[200010],c;
int main(){
	int i,n;
	cin >> n >> c;
	for(i=0;i<n;i++) cin >> h[i];
	ConvecHullTrick<long long> cht(true);
	dp[0] = 0;
	for(i=1;i<n;i++){
		cht.add(-2*h[i-1],h[i-1]*h[i-1]+dp[i-1]);
		dp[i] = cht.get(h[i]) + h[i]*h[i] + c;
	}
	cout << dp[n-1] << endl;
}

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

double find_length(double x1, double x2, double y1, double y2){
double x = (x1 - x2);
double y = (y1 - y2);
return sqrt(x*x + y*y);
}

double find_area(double a, double b, double c){
double z = (a + b + c) / 2;
return sqrt(z * (z - a) * (z - b) * (z - c));
}

int main(void){
double x[20];
double y[20];
double area = 0;
int i = 0;
while(scanf("%lf,%lf", &x[i],&y[i]) != EOF){
if(2 <= i){
double a = find_length(x[0],x[i-1],y[0],y[i-1]);
double b = find_length(x[i-1],x[i],y[i-1],y[i]);
double c = find_length(x[0],x[i],y[0],y[i]);
area += find_area(a,b,c);
}
i++;
}
printf("%lf\n",area);
return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <algorithm>
#include <functional>




int main() {

	int N, K;
	int Num;
	int A[200000] = { 0 };
	std::cin >> N >> K;

	for (int i = 0; i < N; i++) {
		std::cin >> Num;
		A[Num]++;
	}

	std::sort(A, A + 200000, std::greater<int>());

	int ref = 0;
	
	for (int i = K; i < N; i++) {

		if (A[i] > 0) {

			ref += A[i];
			A[i] = 0;
		}
	}

	std::cout << ref;

}



Measured memory_bytes: 1024
#include<stdio.h>

int main(){
    char s[3],t[3];
    int count,i;
    scanf("%s",s);
    scanf("%s",t);
    count=0;
    for(i=0;i<3;i++){
        if(s[i]==t[i])count++;
    }
    printf("%d",count);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n;
    cin >> n;
    vector<int> P(n);
    rep(i, n) cin >> P[i];

    int minv = INF, ans = 0;
    rep(i, n) {
        if(P[i] < minv) {
            minv = P[i];
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] arr = new int[N];
    int cnt = 0;

    for (int i = 0; i < N; i++) {
      arr[i] = sc.nextInt();
    }

    while (true) {
      boolean isOdd = true;
      for (int i = 0; i < arr.length; i++) {
        if (arr[i] % 2 == 0) {
          arr[i] = arr[i] / 2;
        } else {
          isOdd = false;
        }
      }
      if (!isOdd) break;
      cnt++;
    }
    System.out.println(cnt);
  }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	int d,e,f;
	scanf("%d%d%d",&a,&b,&c);
	d=max(a,max(b,c));
	f=min(a,min(b,c));
	e=a+b+c-d-f;
	printf("%d\n",e+f);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;
const ll MOD = 1e9 + 7;
int main()
{
  ll n,k;
  cin>>n>>k;
  V<ll>h(n);
  for(int i=0;i<n;i++)
    cin>>h[i];
  V<ll>dp(n,INT_INF);
  dp[0]=0;
  for(ll i=0;i<n;i++)
  {
    for(ll j=i+1;j<=i+k;j++)
    {
      if(j<n)
        dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
    }
  }
  cout<<dp[n-1]<<"\n";
}
  

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

int main() {
  char c;
  cin >> c;
  
  if (c == 'a'||c=='i'||c=='u'||c=='e'||c=='o') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

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

int dp[MAX][MAX], G[MAX][MAX];

int getLargestSquare(int H, int W) {
    int maxWidth = 0;
    rep(i, H) {
        rep(j,W) {
            dp[i][j] = (G[i][j] + 1) % 2;
            maxWidth |= dp[i][j];
        }
    }

    rep(i,H) {
        rep(j,W) {
            if (G[i][j]) {
                dp[i][j] = 0;
            } else {
                dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
                maxWidth = max(maxWidth, dp[i][j]);
            }
        }
    }

    return maxWidth * maxWidth;
}

int main(void) {
    int H, W;
    scanf("%d %d", &H, &W);

    rep(i,H) {
        rep(j,W) {
            scanf("%d", &G[i][j]);
        }
    }

    printf("%d\n", getLargestSquare(H, W));

    return 0;
}


Measured memory_bytes: 18516
/*
    Reference :-
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forn1(i, n) for (int i = 1; i < int(n); i++)
#define PI pair<int,int>
#define all(vec) vec.begin(),vec.end()
ll mod=1000000007;
ll power(ll n,ll k){
    ll ans=1;
    while(k){
        if(k&1)ans=(ans*n)%mod;
        k/=2;
        n=(n*n)%mod;
    }
    //ans=(ans-1+mod)%mod;
    return ans;
}

int main(){
    //std::ios::sync_with_stdio(false);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int ar[3];
    forn(i,3)cin>>ar[i];
    sort(ar,ar+3);
    bool fl1=(ar[0]==ar[1]),fl2=(ar[1]==ar[2]);
    if(fl1^fl2)cout<<"Yes";
    else cout<<"No";

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int A = scn.nextInt(), B = scn.nextInt(),C = scn.nextInt(), D = scn.nextInt();
		boolean ans = Math.abs(A-C) <= D ||((Math.abs(A-B)<=D)&&(Math.abs(C-B)<=D));

		System.out.println(ans?"Yes":"No");
	}

}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define node first
#define weight second
#define MOD 1000000007
typedef pair <int, int> ii;

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef LOCAL_PROJECT
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	int n;
	cin >> n;
	int happiness[n+5][3] = {0}, dp[n][3] = {0};
	for(int i = 1; i <= n; i++)
		for(int j = 0; j < 3; j++)
			cin >> happiness[i][j];
	for(int i = 1; i <= n; i++)
		for(int j = 0; j < 3; j++)
			dp[i][j] = max(dp[i-1][(j+1)%3], dp[i-1][(j+2)%3]) + happiness[i][j];
	cout << max(dp[n][0], max(dp[n][1], dp[n][2]));
}

Measured memory_bytes: 4992
import sys
def input(): return sys.stdin.readline().strip()
n=int(input())
hh=list(reversed(list(map(int,input().split()))))
for i in range(len(hh)-1):
    if hh[i] >= hh[i+1]:
        continue
    if hh[i]+1 == hh[i+1]:
        hh[i+1] -= 1
        continue
    else:
        print('No')
        break
else:
    print('Yes')

Measured memory_bytes: 15020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define x first
#define y second
#define mp make_pair
#define pb push_back
template <typename TYPE> inline void chkmax(TYPE &x,TYPE y){x<y?x=y:TYPE();}
template <typename TYPE> inline void chkmin(TYPE &x,TYPE y){y<x?x=y:TYPE();}
template <typename TYPE> void readint(TYPE &x)
{
    x=0;int f=1;char c;
    for(c=getchar();!isdigit(c);c=getchar())if(c=='-')f=-1;
    for(;isdigit(c);c=getchar())x=x*10+c-'0';
    x*=f;
}
const int MAXN=100005,MOD=998244353,BASE=716070898;

int n;
vector<int> G[3][MAXN];
int sg[3][MAXN];
int m,a[3][MAXN];
int b[MAXN],c[MAXN],pw[MAXN];

int main()
{
	readint(n);
	pw[0]=1;
	for(int i=1;i<=n;++i)pw[i]=1ll*pw[i-1]*BASE%MOD;
	for(int t=0;t<3;++t)
	{
		int E,u,v;
		readint(E);
		while(E--)readint(u),readint(v),G[t][u].pb(v),G[t][v].pb(u);
		for(int i=n;i;--i)
		{
			unordered_set<int> st;
			for(auto j:G[t][i])if(j>i)st.insert(sg[t][j]);
			for(int k=0;;++k)if(!st.count(k)){sg[t][i]=k;break;}
			a[t][sg[t][i]]=(a[t][sg[t][i]]+pw[i])%MOD;
			chkmax(m,sg[t][i]+1);
		}
	}
	int M;
	for(M=1;M<=m;M<<=1);
	for(int i=0;i<M;++i)
		for(int j=0;j<M;++j)
			c[i^j]=(c[i^j]+1ll*a[0][i]*a[1][j])%MOD;
	for(int i=0;i<M;++i)
		for(int j=0;j<M;++j)
			b[i^j]=(b[i^j]+1ll*c[i]*a[2][j])%MOD;
	printf("%d\n",b[0]);
	return 0;
}

Measured memory_bytes: 17536
#include <iostream>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
int main()
{
  	fast;
 	int x,y,x1,y1,x2,y2;
	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
	x=x1,y=y1;
	while(x1<x2)x1++,printf("R");
	while(y1<y2)y1++,printf("U");
	while(x1>x)x1--,printf("L");
	while(y1>y)y1--,printf("D");
	printf("D");
	while(x1<x2)x1++,printf("R");
	printf("R");printf("U");
	while(y1<y2)y1++,printf("U");
	printf("L");
	printf("U");
	while(x1>x)x1--,printf("L");
	printf("L");printf("D");
	while(y1>y)y1--,printf("D");
	printf("R");
}

Measured memory_bytes: 256
import java.io.*
import java.util.*
import java.lang.*
import java.lang.Math.*


fun solve() {
    val (H, W, M) = rd.readIntArray()
    val X = IntArray(M); val Y = IntArray(M)
    val rowSum = IntArray(H){0}
    val colSum = IntArray(W){0}
    val st = mutableSetOf<IntPair>()
    for (i in 0 until M) {
        val (x, y) = rd.readIntArray().map{ it - 1 }
        X[i] = x; Y[i] = y
        rowSum[x]++
        colSum[y]++
        st.add(IntPair(x, y))
    }

    val rsMax = rowSum.max()!!
    val bxs = rowSum.withIndex()
            .filter { it.value == rsMax }.map{ it.index }

    val csMax = colSum.max()!!
    val bys = colSum.withIndex()
            .filter { it.value == csMax }.map { it.index }

    var occupied = true
    for (bx in bxs) {
        for (by in bys) {
            if (!st.contains(IntPair(bx, by))) {
                occupied = false
                break
            }
        }
        if (!occupied) break
    }

    val ans = if (occupied) rsMax+csMax-1 else rsMax+csMax
    print(ans)
}


//val rd = debug.Reader("abc", "176", "e", "sample-1")
val rd = Reader()


fun main(args: Array<String>) {
    try {
        var exception: Throwable? = null
        val sth = Thread(null, SolveThread(), "solveThread", 128 * 1024 * 1024)
        sth.setUncaughtExceptionHandler { _, e -> exception = e }
        sth.start(); sth.join()
        if (exception != null) throw exception!! }
    catch (e: Exception) { throw e }
    finally { rd.close() }
}
const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
const val EPS = 1e-9; fun DBLEQ(a: Double, b: Double): Boolean {return abs(a - b) < EPS}
data class IntPair(val first: Int, val second: Int)
data class To(val idx: Int, val cost: Long)
fun <T>edge(V: Int): Array<ArrayList<T>> { return Array(V){ArrayList<T>()} }
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
fun rAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("EAssert Error: $msg"); throw Error(msg) }
}
fun tAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("TAssert Error: $msg"); Thread.sleep(3000) }
}
class SolveThread : Runnable {
    override fun run() { solve() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
    val readListIntCol: (Int) -> List<Int> = { N -> (0 until N).map { readInt() } }
    val readListLongCol: (Int) -> List<Long> = { N -> (0 until N).map { readLong() } }
    val close: () -> Unit = { br.close() }
    protected fun finalize() { close() }
}


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

int main(){
	int n, ans = 100;
	cin >> n;
	rep(i, 0, n){
		int a, cnt = 0;
		cin >> a;
		while(a % 2 == 0){
			cnt++;
			a /= 2;
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#AC出てから！ファイル整理！
#コンテストはatcoder.pyで！
#A:
#B:
#C:
#D:
#DP
#ナップザックの残り
#56と復習

import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations
#from itertools import accumulate, product
from bisect import bisect_left,bisect_right
from math import floor, ceil
#from operator import itemgetter

#mod = 1000000007

def main():
    from sys import stdin
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    S = list(stdin.readline().rstrip())
    Q = int(input())
    mae = []
    usiro =[]
    s = True
    for _ in range(Q):
        q = stdin.readline()
        if q[0]=='1':
            s = not s
        else:
            if q[2]=='1' and s:
                mae.append(q[4])
            elif q[2]=='2' and s:
                usiro.append(q[4])
            elif q[2]=='2' and not s:
                mae.append(q[4])
            else:
                usiro.append(q[4])
    if s:
        print(''.join(mae[::-1]+S+usiro))
    else:
        print(''.join(usiro[::-1]+S[::-1]+mae))


if __name__ == '__main__':
    main()


Measured memory_bytes: 10248
n=int(input())

L=[[] for i in range(n+1)]

for i in range(n-1):
    a,b=map(int,input().split())
    L[a].append(b)
    L[b].append(a)

fe=[0 for i in range(n+1)]
que=[(1,0)]
visited=[0 for i in range(n+1)]
visited[1]=1
head=0

while len(que)>head:
    now=que[head]
    head+=1
    fe[now[0]]=now[1]
    for nex in L[now[0]]:
        if visited[nex]==0:
            visited[nex]=1
            que.append((nex,now[1]+1))
            
sn=[0 for i in range(n+1)]
que=[(n,0)]
visited=[0 for i in range(n+1)]
visited[-1]=1
head=0

while len(que)>head:
    now=que[head]
    head+=1
    sn[now[0]]=now[1]
    for nex in L[now[0]]:
        if visited[nex]==0:
            visited[nex]=1
            que.append((nex,now[1]+1))

kaname=[]
for i in range(1,n+1):
    ck=fe[i]-sn[i]
    if ck==1 or ck==2:
        kaname.append(i)

cnt=0
que=[(1,0)]
visited=[0 for i in range(n+1)]
visited[1]=1
head=0

while len(que)>head:
    now=que[head]
    head+=1
    cnt+=1
    for nex in L[now[0]]:
        if visited[nex]==0 and not nex in kaname:
            visited[nex]=1
            que.append((nex,now[1]+1))

if cnt*2>n:
    print("Fennec")
else:
    print("Snuke")

Measured memory_bytes: 118104
from math import radians,sin,cos,pi
def main():
    x = 0
    y = 0
    a = 0
    while True:
        d,_a = map(int,input().split(","))
        if(d == _a == 0):
            break
        x = x + d*cos(radians(a))
        y = y + d*sin(radians(a))
        a = a + _a
    print(int(y))
    print(int(x))

if __name__ == '__main__':
    main()

Measured memory_bytes: 5716
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll n, m;
  cin >> n >> m;
  if (n == 0) {
    if (m == 100) {
      cout << 101 << endl;
    } else {
      cout << m << endl;
    }
  } else if (n == 1) {
    ll tmp = 0, res = 0;
    for (ll i = 100; tmp < m; i += 100) {
      if (i%10000 == 0) continue;
      tmp++;
      res = i;
    }
    cout << res << endl;
  } else {
    ll tmp = 0, res = 0;
    for (ll i = 10000; tmp < m; i += 10000) {
      if (i%1000000 == 0) continue;
      tmp++;
      res = i;
    }
    cout << res << endl;
  }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

public class Main {

  public void run() throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    String in = reader.readLine();

    //?????????????????????
    HashMap<String, Integer> usedWordCount = new HashMap<>();
    String[] splitedSentence = in.split(" ");
    for (String word : splitedSentence) {
      if (usedWordCount.containsKey(word))
        usedWordCount.put(word, usedWordCount.get(word) + 1);
      else
        usedWordCount.put(word, 1);
    }

    //???????????¨??????????????????????????????
    Entry<String, Integer> modeOfWord = usedWordCount
            .entrySet()
            .stream()
            .max((Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) -> o1.getValue() < o2.getValue() ? -1 : o1.getValue() == o2.getValue() ? 0 : 1)
            .get();

    //??????????????°????????????????????????
    Entry<String, Integer> maxLengthWord = usedWordCount
            .entrySet()
            .stream()
            .max((Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) -> o1.getKey().length() < o2.getKey().length() ? -1 : o1.getKey().length() == o2.getKey().length() ? 0 : 1)
            .get();

    //??????
    System.out.println(modeOfWord.getKey() + " " + maxLengthWord.getKey());
    
    /*
     while ((in = reader.readLine()) != null) {
      
     }
     */
  }

  public static void main(String[] args) throws IOException {
    Main main = new Main();
    main.run();
  }

}

Measured memory_bytes: 30464
#include<stdio.h>
#define WHITE 1
#define BLACK 0

int mat[101][101];
int d[101];
int pi[101];
int color[101];
int n;

void prim(int r){
  int i,mincost,u;
  for(i = 1; i <= n; i++ ){
    d[i] = 200000;
    pi[i] = -1;
    color[i] = WHITE;
  }

  d[r] = 0;

  while(1){
    mincost = 200000;
    for( i = 1; i <= n; i++){
      if(color[i] != BLACK && d[i] < mincost){
	mincost = d[i];
	u = i;
      }
    }
    if(mincost == 200000) break;
    

    color[u] = BLACK;

    for(i = 1;i <= n; i++){
      if(color[i] != BLACK && mat[u][i] != -1 && d[u] + mat[u][i] < d[i]){
	pi[i] = u;
	d[i] =d[u] + mat[u][i];
      }
    }
  }
  
}

int main(){
  int i,j,k,l,num;

  scanf("%d",&n);

for(i = 1; i <= n; i++){
    for(j = 1; j <= n; j++){
      mat[i][j] = -1;
    }
  }

  for(i = 1; i <= n; i++){
    scanf("%d %d",&num,&k);
    for(j = 1; j <= k; j++){
      scanf("%d",&l);
      scanf("%d",&mat[i][l+1]);
    }
  }
  

  prim(1);
  for(i = 1; i <= n ; i++)printf("%d %d\n",i - 1,d[i]);
  
  
}



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

int main(){
  char S[4];
  cin >> S;
  int i;
  for(i=0;i<3;i++){
    if(S[i] == S[i+1]){
      printf("Bad\n");
      return 0;
    }
  }
  printf("Good\n");
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string a; cin >> a ;
  rep(i,a.size()){
    if(a[i] == ',') a[i] = ' ';
  }
  cout << a << endl;
  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
s_dash = gets.chomp.split("")
t = gets.chomp.split("")

answers = []
 
s_dash.length.times { |i|
    count = 0
    s_dash_tmp = Marshal.load(Marshal.dump(s_dash))
    t.length.times { |j|
        if s_dash_tmp[i+j] == t[j] || s_dash_tmp[i+j] == "?"
            count += 1
        end
        if count == t.length
            s_dash_tmp[i..i+t.length-1] = t
            answers << s_dash_tmp.join("").gsub(/\?/, "a")
        end
    }
}
if answers.length == 0
    puts "UNRESTORABLE"
else
    puts answers.sort[0]
end

Measured memory_bytes: 1916
//666yuchen
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<cstdlib>
using namespace std;
long long a,b,c;
int main()
{
  cin>>a>>b;
  c=a*b;
  if(c%2==0)cout<<"Even";
  else cout<<"Odd";
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func powInt(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

func sumInts(x []int) int {

	total := 0
	for _, v := range x {
		total += v
	}

	return total
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var X int

func main() {
	sc.Split(bufio.ScanWords)

	X = nextInt()
	if X < 100 {
		fmt.Println(0)
		return
	}
	N := X / 100
	M := X % 100
	for i := 0; i < N; i++ {
		if M-5 >= 0 {
			M -= 5
		} else if M-4 >= 0 {
			M -= 4
		} else if M-3 >= 0 {
			M -= 3
		} else if M-2 >= 0 {
			M -= 2
		} else if M-1 >= 0 {
			M -= 1
		}
	}

	if M == 0 {
		fmt.Println(1)
	} else {
		fmt.Println(0)
	}
}


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

using namespace std;
using ll = long long;

int main() {
    int N, T;
    cin >> N >> T;
    vector<pair<int, int>> ct(N);
    for (int i = 0; i < N; i++) {
        cin >> ct[i].first >> ct[i].second;
    }

    sort(ct.begin(), ct.end(), [](auto a, auto b) { return a.first < b.first; });
    for (int i = 0; i < N; i++) {
        if (ct[i].second <= T) {
            cout << ct[i].first << endl;
            return 0;
        }
    }
    cout << "TLE" << endl;


    return 0;
}

Measured memory_bytes: 256
A,B = map(int, input().split())

ans = 0

for x in range(A, B + 1):
    x_1 = x % 10
    x = x // 10
    x_2 = x % 10
    x = x // 10
    x_3 = x % 10
    x = x // 10
    x_4 = x % 10
    x = x // 10
    x_5 = x % 10
    if (x_1 == x_5) and (x_2 == x_4):
        ans += 1

print(ans)

Measured memory_bytes: 3064
package main

import "fmt"

func main() {
	var s string
	fmt.Scanf("%s\n", &s)

	var ans = "keyence"

	flg := "NO"
	for i := 0; i <= len(ans); i++ {

		if (s[:i] == ans[:i]) && (s[len(s)-7+i:] == ans[i:]) {
			flg = "YES"
			break
		}
	}

	fmt.Println(flg)

}


Measured memory_bytes: 1840
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << "\n"; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " <<to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif


void solve(){
  int n;
  cin>>n;
  vector<int>v(n);
  rep(i,n)cin>>v[i];
  int minv=2e5,cnt=0;
  rep(i,n){
    
    if(minv>=v[i])++cnt;
    chmin(minv,v[i]);
  }
  cout<<cnt<<endl;
}
 
int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  int l[N];
  for (int i = 0; i < N; i++) cin >> l[i];

  sort(l, l + N);
  reverse(l, l + N);
  int ans = 0;
  for (int i = 0; i < K; i++) ans += l[i];

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int H,W;
int width[2001][2001];
int height[2001][2001];

string S[3000];

void rec_w(int row) {
    for(int j = 0;j < W;j++) {
        if(S[row][j] == '#')
            continue;
        
        width[row][j] = (j == 0 ? 1 : width[row][j-1] + 1);
    }

    for(int j = W-1;j >= 0;j--) {
        if(S[row][j] == '#')
            continue;
        width[row][j] = (j == W-1 ? width[row][j] : max(width[row][j],width[row][j+1]));
    }

    return;
}

void rec_h(int col) {
    for(int i = 0;i < H;i++) {
        if(S[i][col] == '#')
            continue;

        height[i][col] = (i == 0 ? 1 : height[i-1][col] + 1);
    }

    for(int i = H-1;i >= 0;i--) {
        if(S[i][col] == '#')
            continue;

        height[i][col] = (i == H-1 ? height[i][col] : max(height[i][col],height[i+1][col]));
    }

    return;
}

int solve(void) {
    //row+col-1でok

   for(int i = 0;i < H;i++) {
       rec_w(i);
   }

   for(int j = 0;j < W;j++) {
       rec_h(j);
   }

    int ans = -1;
    for(int i = 0;i < H;i++) {
        for(int j = 0;j < W;j++) {
            ans = max(ans,width[i][j]+height[i][j]-1);
        }
    }

    return ans;
}

int main(void) {
    cin>>H>>W;

    for(int i = 0;i < H;i++) {
        cin>>S[i];
    }

    cout<<solve()<<endl;

    return 0;
}





Measured memory_bytes: 35584
//
//*****************
//Created by corol
//*****************
//

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define wv(a, n) for (int i=0;i<(n);i++) {cin >> (a)[i];}
#define w(t) while (t--)
#define vi vector <int>
#define vs vector <string>
#define vll vector <long long>
#define vii vector <pair <int,int>>
#define MM <<
#define all(x) sort((x).begin(), (x).end());
#define rall(x) sort((x).rbegin(), (x).rend());
#define it int64_t
it mod = 1000000007;


template<class A>
void read(vector<A> &v);

template<class A, size_t S>
void read(array<A, S> &a);

template<class T>
void read(T &x) {
    cin >> x;
}

template<class H, class... T>
void read(H &h, T &... t) {
    read(h);
    read(t...);
}

template<class T>
void print(T &x) {
    cout << x;
}

struct graph {
    int first, second;
};

bool cmputd(pair<int, int> a, pair<int, int> b) {
    return a.first > b.first;
}

bool cmpdtu(pair<int, int> a, pair<int, int> b) {
    return a.first < b.first;
}

bool cmpdtu_struct(graph a, graph b) {
    return a.first < b.first;
}

void test_cases();

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    test_cases();
    //cout << "Time elapsed: " << 1.000 * clock() / CLOCKS_PER_SEC << " ms. \n";
    return 0;
}

int d_min(vector<int> &a, int p) {
    int l = -1;
    int r = (int) a.size();
    while (r > l + 1) {
        int m = (l + r) / 2;
        if (a[m] <= p) l = m;
        else r = m;
    }
    return l;
}

int d_max(vector<int> &a, int p) {
    int l = -1;
    int r = (int) a.size();
    while (r > l + 1) {
        int m = (l + r) / 2;
        if (a[m] < p) l = m;
        else r = m;
    }
    return r;
}

void test_cases() {
    string a;
    cin >> a;
    int n = a.size();
    if (a[n-1]!='s') {
        cout << a << 's';
    }
    else if (a[n-1]=='s') {
        cout << a << "es";
    }
}



Measured memory_bytes: 3660