akhauriyash/Code-Regression huggingface dataset:
/*
	Created by : imay_10
	" It won't be EASY, but I'll make it "
*/

#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
const int mod = 1e9+7;
const ll inf = 1e18;
const double pi = 3.1415926535897932384626;

// Utility for fast exponentiation
ll mpow(ll a,ll b,ll m){
    ll res=1;
    //a%=m;
    while(b){
    	if(b%2) res=res*a%m;
		a=a*a%m;
		b/=2;
	}
	return res;
}

// Utility for modular inverse
ll inv(ll a,ll m){
	return mpow(a,m-2,m);
}

// Utility for GCD Calculation
ll gcd(ll a,ll b){
	if(b==0) return a;
	return gcd(b,a%b);
}

void solve(){
	//code
	ll n;
    cin>>n;
    if(n%2==1){ 
        cout<<0;
    }
	else{
        ll ans=0;
        for(ll i=10;i<=n;i*=5)
            ans += n/i;
        
        cout<<ans;
    }
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	solve();
 	return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int flag=1;
  int nums[101];
  int n;
  int i=0;
  int k;
  int count=0;
  int temp;
  scanf("%d\n",&n );
  while (i<n) {
    scanf("%d",&nums[i]);
    i++;
  }
  while (flag) {
    /* code */
    flag=0;
    for (i =n-1; i >0; i--) {
      if (nums[i]<nums[i-1]) {
        temp=nums[i];
        nums[i]=nums[i-1];
        nums[i-1]=temp;
        flag=1;
        count++;
        /* code */
      }
    }

  }




  k=0;



  while(k<n){
    printf("%d",nums[k]);
    k++;
    if(k!=n)
    printf(" ");
  }
    printf("\n");
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 2708
#include <bits/stdc++.h>
#define int long long
using namespace std;


int32_t main() {
    int n,k;
    cin>>n>>k;
    int a[n+1];
    bool dp[100005]={false};
    for(int i=0;i<n;i++){
        cin>>a[i];
        dp[a[i]]=true;
    }
    for(int i=1;i<=k;i++){
        for(int j=0;j<n;j++){
            if(i>=a[j]){
                if(!dp[i-a[j]]) dp[i]=true;
            }
        }
    }
    if(dp[k]) cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}


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

int main() {
  string a;
  cin>>a;
  
 int p=a.size();
  
  int j=0;
  
    for(int i=0;i<p;i++){
      if(i%2==0){
        if(a.at(i)=='0'){
          j++;
        }
      }
      else{
        if(a.at(i)=='1'){
          j++;
        }
      }
    }
    
      cout<<min(j,p-j)<<endl;
}

Measured memory_bytes: 512
use std::io::stdin;

fn read() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

fn main() {
    let s = read();
    let bs = s.as_bytes();
    println!(
        "{}{}{}",
        char::from(bs[0]),
        bs.len() - 2,
        char::from(bs[bs.len() - 1])
    );
}


Measured memory_bytes: 4352
N, M, X = map(int, input().split())
C = [0] * N
A = [[0] * M for _ in range(N)]
for i in range(N):
    C[i], *A[i] = map(int, input().split())
ans = float('inf')
for bit in range(1 << N):
    score = [0] * M
    price = 0
    for i in range(N):
        if bit >> i & 1:
            price += C[i]
            for j in range(M):
                score[j] += A[i][j]
    if all(s >= X for s in score):
        ans = min(ans, price)
print(ans if ans < float('inf') else -1)

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

Measured memory_bytes: 3556
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let s: Vec<char> = input::<String>().chars().collect();
    const MOD: i64 = 1000000007;

    let n = s.len();
    let mut dp = vec![vec![0i64; 13]; n + 1];
    dp[0][0] = 1;
    for i in 0..n {
        if s[i] == '?' {
            for k in 0..10 {
                for j in 0..13 {
                    let m = (j * 10 + k) % 13;
                    dp[i + 1][m] += dp[i][j];
                    dp[i + 1][m] %= MOD;
                }
            }
        } else {
            let d = (s[i] as u8 - b'0') as usize;
            for j in 0..13 {
                let m = (j * 10 + d) % 13;
                dp[i + 1][m] += dp[i][j];
                dp[i + 1][m] %= MOD;
            }
        }
    }

    println!("{}", dp[n][5]);
}


Measured memory_bytes: 18684
import math
A,B,H,M = map(int,input().split())

c1 = (H/12+M/(60*12))*360
c2 = (M/60)*360

th = min(abs(c1-c2),abs(360-(c1-c2)))
th = (th / 180) * math.pi
print(math.sqrt((A**2)+(B**2)-2*A*B*math.cos(th)))


Measured memory_bytes: 9500
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
using namespace std;
int main(){
  int x,a,b;
  cin>>x>>a>>b;
  cout<<(x-a)%b;
  system ("pause");
  return 0;
  }

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
#define mp make_pair



int main() {
  int n;
  cin >> n;
  double t, a;
  cin >> t >> a;
  vector<double> b(n);
  rep (i, n) {
    int x;
    cin >> x;
    b[i] = t - 0.006 * x;
  }
  double mi = inf;
  int ans = -1;
  rep (i, n) {
    if (abs(b[i] - a) < mi) {
      ans = i;
      mi = abs(b[i] - a);
    }
  }
  cout << ans + 1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using boost::adaptors::reversed;
using boost::irange;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    ll N, C;
    cin >> N >> C;
    vector<vector<ll>> ds(C, vector<ll>(C));
    vector<vector<ll>> cs(N, vector<ll>(N));

    for (auto &&i: irange(0LL, C)) {
        for (auto &&j: irange(0LL, C)) {
            cin >> ds.at(i).at(j);
        }
    }
    for (auto &&i: irange(0LL, N)) {
        for (auto &&j: irange(0LL, N)) {
            ll c;
            cin >> c;
            c--;
            cs.at(i).at(j) = c;
        }
    }

    vector<vector<ll>> c_another_struct(3, vector<ll>{});
    for (auto &&i: irange(0LL, N)) {
        for (auto &&j: irange(0LL, N)) {
            c_another_struct.at((i + j) % 3).emplace_back(cs.at(i).at(j));
        }
    }
    vector<vector<ll>> cost(3, vector<ll>(C, 0));
    for (auto &&i: irange(0LL, 3LL)){
        for (auto &&color_to: irange(0LL, C)){
            for (auto &&color_from: c_another_struct.at(i)){
                cost.at(i).at(color_to)+=ds.at(color_from).at(color_to);
            }
        }
    }
    ll min_cost{numeric_limits<ll>::max()};
    for (auto &&color_1: irange(0LL, C)){
        for (auto &&color_2: irange(0LL, C)){
            if (color_2 == color_1) continue;
            for (auto &&color_3: irange(0LL, C)){
                if (color_3 == color_1 || color_3 == color_2) continue;
                min_cost = min(min_cost, cost.at(0).at(color_1) + cost.at(1).at(color_2) + cost.at(2).at(color_3));
            }
        }
    }
    cout << min_cost;
    return 0;
}

Measured memory_bytes: 4588
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
class Program
{
    static void Main()
    {
        //入力
        //int n = 100;
        /*
        long n = long.Parse(Console.ReadLine());
        long[] input = new long[5];
        for(int a = 0; a < 5; a++)
        {
            input[a]=long.Parse(Console.ReadLine());
        }
        */
        int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        Console.WriteLine(input[0]+(double)input[1]/2);


        /*
        //処理速度計測
        var sw = new System.Diagnostics.Stopwatch();
        sw.Start();
        //解法
 
        //処理速度表示
        sw.Stop();
        TimeSpan ts = sw.Elapsed;
        Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms");
        */
        Console.ReadLine();

    }
}

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

int main(){
    ll n,m,k;
    cin >> n >> m >> k;
    vector <ll> a(n+1),b(m+2);
    b[m+1]=1001001001001;
    a[0]=0;
    b[0]=0;
    ll aa,bb;
    rep(i,n){
        cin >> aa;
        a[i+1]=a[i]+aa;
        
    }

    rep(i,m){
        cin >> bb;
        
        b[i+1]=b[i]+bb;
    
    }
    ll ans=0;
    ll no,mm;
    ll r,l;
    rep(i,n+1){
        no=k-a[i];
        if(no>=0){
            r=m+1;
            l=0;
            while((r-l)!=1){
                mm=(r+l)/2;
                if(no>=b[mm]){
                    l=mm;
                }
                else{
                    r=mm;
                }
            }
            ans=max(ans,i+l);
        }
    }

    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 6424
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <complex>
#include <numeric>
#include <string.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const ll MOD = 998244353;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

constexpr ll V = 1000000;

ll mod_pow (ll x, ll y) {
    ll ret = 1;
    while (y) {
        if (y&1) ret = ret * x % MOD;
        x = x * x % MOD;
        y /= 2;
    }
    return ret;
}

ll N;
ll A[200000];
ll C[V+1];
ll w[V+1];
ll fac[V+1];

ll dfs (vector<pl>& v, ll pos, ll val) {
    if (pos == v.size()) return w[val];
    ll ret = 0;
    ll tmp = 1;
    for (ll i = 0; i <= v[pos].second; i++) {
        ret = (ret + dfs(v, pos+1, val*tmp%MOD)) % MOD;
        tmp = tmp * v[pos].first % MOD;
    }
    return ret;
}

void init() {
    for (ll i = 2; i <= V; i++) {
        if (fac[i] != 0) continue;
        fac[i] = i;
        for (ll j = i*2; j <= V; j+= i) {
            if (fac[j] == 0) fac[j] = i;
        }
    }
    w[1] = 1;
    for (ll i = 2; i <= V; i++) {
        vector<pl> v;
        ll x = i;
        while (x != 1) {
            if (v.size() == 0 || v.back().first != fac[x]) {
                v.push_back(pl(fac[x], 1));
            } else {
                v[v.size()-1].second++;
            }
            x /= fac[x];
        }
        ll del = dfs(v, 0, 1);
        w[i] = (mod_pow(i, MOD-2) - del + MOD) % MOD;
    }
}

int main() {
    init();
    cin >> N;
    rep(i,N) cin >> A[i];
    rep(i,N) C[A[i]]++;
    ll ans = 0;
    for (ll i = 1; i <= V; i++) {
        ll add = 0;
        ll sum1 = 0, sum2 = 0;
        for (ll j = i; j <= V; j += i) {
            sum1 = (sum1 + C[j]*j) % MOD;
            sum2 = (sum2 + C[j]*(j*j%MOD)) % MOD;
        }
        add = (sum1*sum1-sum2+MOD)%MOD;
        add = add * mod_pow(2, MOD-2) % MOD;

        ans = (ans + add*w[i]) % MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 25216
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            int n = scanner.nextInt();
            if (n == 0) {
                break;
            }
            int sum = 0;
            for (int i = 1; i <= Math.sqrt(n); i++) {
                if (n % i == 0) {
                    if (i * i == n) {
                        sum += i;
                    }
                    else {
                        sum += i + n / i;
                    }
                }
            }
            sum -=  n;
            if (sum > n) {
                System.out.println("abundant number");
            }
            else if (sum < n) {
                System.out.println("deficient number");
            }
            else {
                System.out.println("perfect number");
            }
        }
        scanner.close();
    }
}



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

int const N = 10000;
vector<int> tr[N + 1];
int x[N], an[N + 1], dg[N + 1];

int main(){
	int n;
	scanf("%d", &n);
	f(i, 1, n){
		int a, b;
		scanf("%d%d", &a, &b);
		tr[a].push_back(b);
		tr[b].push_back(a);
		++dg[a];
		++dg[b];
	}
	f(i, 0, n)scanf("%d", x + i);
	sort(x, x + n);
	stack<int> z;
	f(i, 1, n + 1)if (dg[i] == 1)z.push(i);
	int j = 0;
	while (!z.empty()){
		int v = z.top();
		z.pop();
		an[v] = x[j++];
		for (int u: tr[v])if (--dg[u] == 1)z.push(u);
	}
	int s = 0;
	f(i, 0, n - 1)s += x[i];
	printf("%d\n%d", s, an[1]);
	f(i, 2, n + 1)printf(" %d", an[i]);
	printf("\n");
}

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

int main() {
    int n, numb, seen[5][14] = {};
    char mark;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> mark >> numb;
        if (mark == 'S') seen[0][numb] = 1;
        else if (mark == 'H') seen[1][numb] = 1;
        else if (mark == 'C') seen[2][numb] = 1;
        else if (mark == 'D') seen[3][numb] = 1;
    }
    for (int i = 0; i <=3; ++i) {
        for (int j = 1; j <= 13; ++j) {
            if (seen[i][j] == 0) {
                if (i == 0) cout << 'S';
                else if (i == 1) cout << 'H';
                else if (i == 2) cout << 'C';
                else if (i == 3) cout << 'D';
                cout << ' ' << j << endl;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3096
mod = 1000000000 + 7

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr

n = int(input())
dat = [0] * 2000 # 約数として求められたある数の合計

# N! の各要素の素因数分解をする
res = 1
for i in range(1, n + 1):
    d = factorization(i)
    for j in range(len(d)):
        dat[d[j][0]] += d[j][1]

for i in range(2, n + 1):
    res *= (dat[i] + 1)
    res %= mod

print(res)

Measured memory_bytes: 9508
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define ll long long

int main() {
  int n,l,p;cin>>n>>l;
  int apple=1000000000,ans=0;
  for(int i=1;i<=n;i++)
  {
    ans+=i+l-1;
    if(apple>abs(i+l-1))
    {
      apple=min(apple,abs(i+l-1));
      p=i+l-1;
    }
    
  }
  cout<<ans-p;
}


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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

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

    int L, R;
    const int M = 2019;
    cin >> L >> R;
    int ret;

    if (R - L >= 672)
    {
        ret = 0;
    }
    else
    {
        L %= M;
        R %= M;
        if (L > R)
        {
            ret = 0;
        }
        else
        {
            ret = L * (L + 1) % M;
            for (int i = L; i <= R; ++i)
            {
                for (int j = i + 1; j <= R; ++j)
                {
                    ret = MIN(ret, i * j % M);
                }
            }
        }
    }

    cout << ret << "\n";

    return 0;
}



Measured memory_bytes: 896
#include<stdio.h>
typedef long long ll;
ll a,b,k;
int main(){
	scanf("%lld %lld %lld",&a,&b,&k);
  if (b-a+1 <= 2*k){
		for(ll i = a ; i <= b ; i++){
			printf("%lld\n",i);
		}
	}else{
		
		for(ll i = a ; i < a+k ; i++){
			printf("%lld\n",i);
		}
		for(ll i = b-k+1 ; i <= b ; i++){
			printf("%lld\n",i);
		}
	}
}



Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>

using namespace std;
int main(void){
 int N,K;
 long long int a;
 long long int sum=0;
 long long int ans=0;
 long long int bit=1;
 vector<long long int>A;
 vector<long long int>B;

 cin>>N;
 cin>>K;
 for(int i=0; i<N;i++){
	 cin>>a;
     A.push_back(a);
 }

 for(int i=0; i<N; i++){
  sum=0;
  sum+=A[i];
  B.push_back(sum);
  for(int j=i+1; j<N; j++){
   sum+=A[j];
   B.push_back(sum);
  }
 } 
 /*
 for(int i=0; i<B.size(); i++){
  std::cout<<"B size "<<B[i]<<std::endl;
 }
 */ 
 for(int i=60; i>=0; i--){
    vector<long long int> C;	
	//std::cout<<"(1<<i)"<< (1<<i) <<std::endl;
    for(int j=0; j<B.size();j++){
		if((B[j] & (bit<<i) )){
			C.push_back(B[j]);
			//std::cout<<" i B[j] "<<i<<" "<<B[j]<<std::endl;
		}
	}
	if(C.size()>=K){
	 //std::cout<<" i "<<i<<std::endl;
	 ans+=((long long int)1)<<i;
     B=C;
	}
 }
 std::cout<<ans<<std::endl; 
}

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

using namespace std;
using ll  = long long;
using ii  = pair < int , int >;
using i3  = pair < int , ii >;
using vi  = vector < int >;
using vii = vector < ii >;
using vi3 = vector < i3 >;

const int N = 2e5 + 5 , mod = 2019;
const ll INF = 1e12;
const double eps = 1e-9 , PI = acos(-1);

int L , R;

void solve(){
    scanf("%d %d" , &L , &R);
    if(R - L + 1 >= mod){
            printf("0\n");
            return;
    }

    L %= mod;
    R %= mod;

    if(R < L)swap(L , R);

    int mn = 2e9 + 5;
    for(int i = L ; i <= R ; i ++){
            for(int j = i+1 ; j <= R ; j ++){
                mn = min(mn , ((i%mod) * (j%mod) )%mod);
            }
    }
    printf("%d\n" , mn);
}

main(){
    int t = 1;
    //scanf("%d" , &t);

    while( t -- ){
            solve();
    }

    return 0;
}



Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

//constexpr int inf = 2147483647;
//constexpr int64_t inf64 = 9223372036854775807;
//constexpr int mod = 1e9+7;

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

  int64_t a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;

  if(v < w) { cout << "NO" << endl; return 0; }

  if(abs(a-b) <= abs(w*t-v*t)) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
using namespace std;

const int MAX = 105;
const int INF = 1<<29;
struct Matrix
{
    int r, c;
};
Matrix M[MAX];
int dp[MAX][MAX], n;

int DP(int i, int j)
{
    int &ans = dp[i][j];
    if(ans!=-1) return ans;
    ans = INF;
    for(int k=i; k<j; k++)
    {
        ans = min(ans, DP(i, k)+DP(k+1, j)+M[i].r*M[k].c*M[j].c);
    }
    return ans;
}
int main()
{
    scanf("%d", &n);
    memset(dp, -1, sizeof(dp));
    for(int i=1; i<=n; i++)
    {
        scanf("%d%d", &M[i].r, &M[i].c);
        dp[i][i] = 0;
    }
    printf("%d\n", DP(1, n));
    return 0;
}



Measured memory_bytes: 3256
#include<iostream>
#include<ios>
using namespace std;
template<int N>
struct ans{
	int a[N];
	constexpr ans():a(){
		for(int i=1;i<N;i++){
			a[i]=(i%10==i/10000&&i/1000%10==i/10%10)+a[i-1];
		}
	}
};
constexpr auto a=ans<100000>();
int N,M;
main(){
	scanf("%d%d",&N,&M);
	printf("%d",a.a[M]-a.a[N-1]);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using uint = uint32_t;
using ll = long long;
using ld = long double;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define REP(i,n) for(auto i = 0 * n; i < (n); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,e) for (ll i = s; i < (ll)e; i++)
#define TEN(x) ((ll)1e##x)


struct Edge{ uint32_t to, id; };
typedef vector<vector<Edge>> Graph;

template<class T> struct Prim {
	Prim(const Graph & es, const vector<T> & ws) : g(es.size()) {
		typedef uint32_t U;
		typedef tuple<T, U, U, U> P;
		U n = es.size();
		vector<U> unexp(n, 1);
		priority_queue<P, vector<P>, greater<P>> q; q.emplace(0, n, 0, 0);
		while (!q.empty()) {
			T w; U u, v, i; tie(w, u, v, i) = q.top(); q.pop();
			if (unexp[v]) {
				unexp[v] = 0;
				if (u != n) { g[u].push_back({ v, i }); g[v].push_back({ u, i }); cost += w; }
				for (auto e : es[v]) if (unexp[e.to]) q.emplace(ws[e.id], v, e.to, e.id);
			}
		}
	}
	Graph g; T cost = 0;
};

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);

	uint n; cin >> n;
	Graph g(n);
	vl w;
	REP(i, n) REP(j, n) {
		ll x; cin >> x;
		if (x != -1) {
			g[i].push_back({j, (uint)w.size()});
			g[j].push_back({i, (uint)w.size()});
			w.push_back(x);
		}
	}
	Prim<ll> mst(g, w);
	cout << mst.cost << endl;
}

Measured memory_bytes: 3296
void main() {
	auto S = rs;
	auto K = readAs!ulong;
	ulong z_c;
	bool gotNonZero = false;
	char nonZeroNum;
	if(S[0] != '1') {
		writeln(S[0]);
		return;
	}
	foreach(i; S~' ') {
		if(gotNonZero) {
			if(z_c >= K) writeln(1);
			else writeln(nonZeroNum);
			return;
		}
		if(S[0] == '1') {
			z_c++;
			if(S.length == 1) {
				writeln(1);
				return;
			}
			S = S[1..$];
		} else {
			gotNonZero = true;
			nonZeroNum = S[0];
		}
	}
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
n = int(input())
ans = 'No'
if n % 4 == 0:
    ans = 'Yes'
elif n % 7 == 0:
    ans = 'Yes'
else:
    tmp = 4
    while tmp <= n:
        if (n - tmp) % 7 == 0:
            ans = 'Yes'
            break
        else:
            tmp += 4
    if ans != 'Yes':
        tmp = 7
        while tmp <= n:
            if (n - tmp) % 4 == 0:
                ans = 'Yes'
                break
            else:
                tmp += 7

print(ans)




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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

#define MAX 10000001
vector<ll> hurui(MAX);

void prepare() {
    hurui[1] = 1;
    rep2(i, 2, MAX) {
        if(hurui[i] == 0) {
            for(ll j = i;j < MAX;j += i) hurui[j] = i;
        }
    }
}

void factor(ll n, map<ll, ll> &factors) {
    if(n == 1) {
        factors[1]++;
        return;
    }
    while(true) {
        ll temp = hurui[n];
        factors[temp]++;
        if(temp == n) break;
        n = n / temp;
    }
}

int main(void) {
    ll N;
    vector<int> a;
    prepare();
    ll ans = 1;
    cin >> N;
    repi2(i, 2, N) {
        map<ll, ll> m;
        factor(i, m);
        ll temp = 1;
        iter(j, m) {
            temp *= j.second + 1;
        }
        // cout << temp << endl;
        ans += i * temp;
    }
    cout << ans << endl;
    // map<ll, ll> m;
    // factor(100, m);
    // cout << m << endl;
    return 0;
}


Measured memory_bytes: 81168
import sys

H, N = map(int, input().split())
M = [tuple(map(int, x.split())) for x in sys.stdin.readlines()]
# A = [0] * N
# B = [0] * N
# for i, (a, b) in enumerate(M):
#     A[i] = a
#     B[i] = b


INF = 10 ** 9
dp = [INF] * (H + 1)
dp[0] = 0

for i in range(H):
    for j in range(N):
        ni = min(H, i + M[j][0])
        b = M[j][1]
        dp[ni] = min(dp[ni], dp[i] + b)

print(dp[H])


Measured memory_bytes: 42604
#include<bits/stdc++.h>
#define me(a,x) memset(a,x,sizeof(a))
#define IN freopen("in.txt","r",stdin);
#define OUT freopen("out.txt","w",stdout);
#define sc scanf
#define itn int
#define STR clock_t startTime = clock();
#define END clock_t endTime = clock();cout << double(endTime - startTime) / CLOCKS_PER_SEC *1000<< "ms" << endl;
using namespace std;
const int N=1e6+5;
const long long mod=1e9+7;
const long long mod2=998244353;
const int oo=0x7fffffff;
const int sup=0x80000000;
typedef long long ll;
typedef unsigned long long ull;
template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}
template <typename it>
string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}
template <typename it>int o(it a){cout<<a<<endl;return 0;}
inline ll mul_64(ll x,ll y,ll c){return (x*y-(ll)((long double)x/c*y)*c+c)%c;}
inline ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=a*a%c)if(b&1)ans=ans*a%c;return ans;}
inline void exgcd(ll a,ll b,ll &x,ll &y){if(!b)x=1,y=0;else exgcd(b,a%b,y,x),y-=x*(a/b);}
int n;
ll a[N];
ll dp[65];
bool vis[65]={0};
void insert(ll x){
  for(int i=60;i>=0;i--){
    if(!vis[i])continue; 
    if(x>>i&1){
      if(!dp[i]){
        dp[i]=x;
        break;
      }
      x^=dp[i];
    }
  }
}
ll Q(){
  ll ans=0;
  for(int i=60;i>=0;i--)if(vis[i]&&(ans>>i&1)==0)ans^=dp[i];
  return ans;
}
int main(){
  cin>>n;
  ll sum=0;
  for(int i=1;i<=n;i++){
    sc("%lld",&a[i]);
    sum^=a[i];
  }
  for(int i=0;i<=60;i++){
    if(sum>>i&1)continue;
    vis[i]=1;
  }
  for(int i=1;i<=n;i++)insert(a[i]);
  ll g=Q();
  o((sum^g)+g);
}

Measured memory_bytes: 1024
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  string S, T; int q; cin >> S >> T >> q;
  int N = S.size(), M = T.size();
  int sas[N+1] = {}, sat[M+1] = {};
  rep(i, N){
    if(S[i]=='A') sas[i+1] = sas[i] + 1;
    else sas[i+1] = sas[i] - 1;
  }
  rep(i, M){
    if(T[i]=='A') sat[i+1] = sat[i] + 1;
    else sat[i+1] = sat[i] - 1;
  }
  rep(i, q){
    int a, b, c, d; cin >> a >> b >> c >> d;
    a--; c--;
    if(abs((sas[b]-sas[a]) - (sat[d] - sat[c]))%3==0){
      cout << "YES" << endl;
    }
    else cout << "NO" << endl;
  }
}

Measured memory_bytes: 1664
N, Y = map(int, input().split())

x, y, z = 10000, 5000, 1000
for i in range(N+1):
    for j in range(N-i+1):
        k = N-i-j
        if (x*i + y*j) == (Y - z*k):
            print(i, j, k)
            exit()
print("-1 -1 -1")

Measured memory_bytes: 3060
/***

    Muhammad Imdad-Ul-Haque Rakib(Attari)
    CSE'19
    Chittagong,Bangladesh

***/

#include<bits/stdc++.h>

/**Definitions**/

#define   ld             long double
#define   ll             long long
#define   boost_         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define   pb             push_back
#define   ppb            pop_back
#define   ull            unsigned long long
#define   over           return 0
#define   scan(i,n,a)    for(i=0;i<n;i++) cin>>a[i]
#define   MP             make_pair
#define   spc            " "

using namespace std;

/** Predefined Functions **/

int gcd(int x,int y){
    if(x==0) return y;
    else return gcd(y%x,x);
}
bool sortbysec(const pair<int,int>&a, const pair<int,int>&b){ return (a.second<b.second); }
bool sortbysecinrev(const pair<int,int>&a, const pair<int,int>&b){ return (a.second>b.second); }
bool sortbysize(string &s1,string &s2){ return s1.size() < s2.size(); }
bool sortinrev(const pair<int,int> &a, const pair<int,int> &b){ return (a.first > b.first); }


int main(){

    boost_;

    string s,t;
    cin>>s>>t;
    int cnt=0,i;

    for(i=0;i<s.size();++i){
        if(s[i]!=t[i]) ++cnt;
    }

    cout<<cnt<<endl;
}


Measured memory_bytes: 3696
using System;
//using System.Collections.Generic;
//using System.Linq;
class Program
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split();
        long n, x;
        n = long.Parse(s[0]);
        x = long.Parse(s[1]);
        C.WriteLine(f(n, x));
    }
    static long f(long n, long x)
    {
        if (x == 0)
            return 0;
        return 3 * (n - GCD(n, x));
    }
    static long GCD(long u, long v)
    {
        long k, t;
        k = 0;
        while ((0 == (u & 1)) && (0 == (v & 1)))
        {
            k++;
            u /= 2;
            v /= 2;
        }
        if ((u & 1) == 0)
            t = u / 2;
        else
            t = -v;
        do
        {
            while ((t & 1) == 0) t /= 2;
            if (t > 0)
                u = t;
            else
                v = -t;
            t = u - v;
        } while (0 != t);
        return u * (1 << (int)k);
    }
}
//以下標準出力用のクラス
static class C
{
    [System.Runtime.InteropServices.DllImport("msvcrt.dll")]
    private static extern void printf(string s);
    public static void Write(string s) { printf(s); }
    public static void Write(char c) { printf(c.ToString()); }
    public static void Write(long n) { printf(n.ToString()); }
    public static void Write(int n) { printf(n.ToString()); }
    public static void Write(double d) { printf(d.ToString()); }
    public static void WriteLine() { printf("\n"); }
    public static void WriteLine(string s) { printf(s + "\n"); }
    public static void WriteLine(char c) { WriteLine(c.ToString()); }
    public static void WriteLine(long n) { WriteLine(n.ToString()); }
    public static void WriteLine(int n) { WriteLine(n.ToString()); }
    public static void WriteLine(double d) { WriteLine(d.ToString()); }
    public static void WriteLines(string[] s) { foreach (var i in s) WriteLine(i); }
    public static void WriteLines(char[] c) { foreach (var i in c) WriteLine(i); }
    public static void WriteLines(long[] c) { foreach (var i in c) WriteLine(i); }
    public static void WriteLines(int[] c) { foreach (var i in c) WriteLine(i); }
    public static void WriteLines(double[] d) { foreach (var i in d) WriteLine(i); }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define fr(x,i,n) for(int x = i; x < n; ++x)
#define fb(x,i,n) for(int x = i; x >= n; --x)
#define pr pair<int,int>
#define ll long long int
const int mod=1e9+7;
int n;
ll a[200001];
ll dp1[200001];
void ev(){

    ll ans=max(dp1[0],dp1[1]);
    ll sum=0;
    for(int i=0;i<n;i+=2){
        sum+=a[i];
        ans=max(ans,sum+dp1[i+3]);
    }
    cout<<ans;
}
void od(){
    ll ans=max({dp1[0],dp1[1],dp1[2]}); // case 4,6
    ll sum=0;
    for(int i=0;i<n;i+=2){ // case 1
        sum+=a[i];
        ans=max(ans,sum+dp1[i+4]);
    }
    sum=0;
    for(int i=0;i<n;i+=2){ // case 3
        sum+=a[i];
        ans=max(ans,sum+dp1[i+3]);
    }
    sum=0;
    for(int i=1;i<n;i+=2){ // case 5
        sum+=a[i];
        ans=max(ans,sum+dp1[i+3]);
    }
    if(n<7)
    {
        cout<<ans;
        return;
    }
    //case 2
    ll dp2p[n][2],dp2s[n][2];
    //dp2p[i][0]... prefix...no 2 steps taken
    //dp2p[i][1]... prefix...one 2 steps taken
    dp2p[2][0]=a[0]+a[2];
    dp2p[3][0]=a[1]+a[3];
    dp2p[3][1]=a[0]+a[3];
    dp2p[4][0]=a[0]+a[2]+a[4];
    dp2p[4][1]=INT_MIN;
    fr(i,5,n-3){
        dp2p[i][0]=dp2p[i-2][0]+a[i];
        if(i%2==0)
        dp2p[i][1]=INT_MIN;
        else
        dp2p[i][1]=max(a[i]+dp2p[i-3][0],a[i]+dp2p[i-2][1]);
    }
    dp2s[n-1-2][0]=a[n-1]+a[n-3];
    dp2s[n-1-3][0]=a[n-1-1]+a[n-1-3];
    dp2s[n-1-3][1]=a[n-1-0]+a[n-1-3];
    dp2s[n-1-4][0]=a[n-1-0]+a[n-1-2]+a[n-1-4];
    dp2s[n-1-4][1]=INT_MIN;
    fb(i,n-1-5,2){
        dp2s[i][0]=dp2s[i+2][0]+a[i];
        if(i%2==0)
        dp2s[i][1]=INT_MIN;
        else
        dp2s[i][1]=max(a[i]+dp2s[i+3][0],a[i]+dp2s[i+2][1]);
    }
    fr(i,3,n-3)
    if(i%2==1)
    ans=max(ans,dp2p[i][1]+dp2s[i][1]-a[i]);
    cout<<ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n;
    fr(i,0,n)
    cin>>a[i];
    dp1[n-1]=a[n-1];
    dp1[n-2]=a[n-2];
    fb(i,n-3,0)
    dp1[i]=a[i]+dp1[i+2];
    if(n%2==0)
    ev();
    else
    od();
}


Measured memory_bytes: 12992
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <queue>
#include <cctype>
#include <climits>
#include <stack>
using namespace std;
   
  
   
int main(){
   
    int n; 
    int r[1000],w[1000];
    int sum_r=0,sum_w=0,idx=0;
	
    while(scanf("%d",&n),n){
         
        sum_r=sum_w=idx=0;
        for(int i=0;i<n;i++){
            scanf("%d %d",&r[i],&w[i]);
            sum_r+=r[i];
            sum_w+=w[i];
            if(r[idx]<r[i]) idx=i;
        }
  
        int r0=r[idx],r=sum_r-r0;
        w[idx]=0;
 
        if(r0 <= r){
            cout<<sum_r+sum_w<<endl;
        }else{
  
            int res=2*r0;
            //vector<vector<bool> > dp(1001,vector<bool>(1000,false));
  
//			bool cur[1001]={};
			bool *cur = (bool*)malloc( 1002 );
            cur[0]=true;
            for(int i=0;i<n;i++){
				bool *next = (bool*)malloc( 1002 );
                for(int j=0;j<=r0-r;j++){
                    if(cur[j]){
                        next[j]=true; 
                        if(j+w[i]<=r0-r)
                            next[j+w[i]]=true; 
                    }
                }
				swap(cur,next);
            }
  
            int opt=r0-r;
            while(!cur[opt]) opt--;
  
            res+=sum_w-opt;
            printf("%d\n",res);
  
  
  
        }
          
          
    }
}

Measured memory_bytes: 7332
#!/usr/bin/env python3
n = int(input())
p = [int(x) for x in input().split()]

ans = 0
for i in range(1, len(p) - 1):
    a, b, c = p[i - 1:i + 2]
    if a < b < c or a > b > c:
        ans += 1

print(ans)


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

class Dice
{
public:
	int top;
	int front;
	int right;
	int left;
	int back;
	int bottom;
	Dice(int a,int b,int c,int d,int e,int f){
		top = a;
		front = b;
		right = c;
		left = d;
		back = e;
		bottom = f;
	}
	void rotateN(){
		int t = top;
		top = front;
		front = bottom;
		bottom = back;
		back = t;
	}
	void rotateE(){
		int t = top;
		top = left;
		left = bottom;
		bottom = right;
		right = t;
	}
	void rotateS(){
		int t = top;
		top = back;
		back = bottom;
		bottom = front;
		front = t;
	}
	void rotateW(){
		int t = top;
		top = right;
		right = bottom;
		bottom = left;
		left = t;
	}
};

int main()
{
	int a,b,c,d,e,f;
	cin >> a >> b >> c >> d >> e >> f;
	Dice obj(a,b,c,d,e,f);
	string s;
	cin >> s;
	int l = s.length();
	for(int i=0; i<l; i++){
		switch(s[i]){
			case 'N': obj.rotateN(); break;
			case 'E': obj.rotateE(); break;
			case 'S': obj.rotateS(); break;
			case 'W': obj.rotateW(); break;
		}
	}
	cout << obj.top << endl;
	return 0;
}

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

int main(int argc, char const *argv[]) {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin>>s;
	for (int i = 0; i < (int)s.size(); i++) {
		cout<<"x";
	}
	cout<<'\n';
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

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

		int N = in.nextInt();
		int prev = 0;
		int diff = 0;
		boolean first = true;
		int ans = 1;
		for(int i=0;i<N;i++) {
			int d = in.nextInt();
			if(first) {
				prev = d;
				first = false;
				diff = 0;
				continue;
			}
			// 単調増加していたのに減った
			if(diff > 0 && !(d >= prev)) {
				ans += 1;
				diff = 0;
				prev = d;
				continue;
			}
			if(diff < 0 && !(d <= prev)) {
				ans += 1;
				diff = 0;
				prev = d;
				continue;
			}
			if (d - prev != 0) {
				diff = d - prev;
			}
			prev = d;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 48592
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
for i in range(n):
  for j in range(n):
    for k in range(n):
      if 0 < p[i] <= a:
        if a+1 <= p[j] <= b:
          if b+1 <= p[k]:
            ans += 1
            p[i] = 0
            p[j] = 0
            p[k] = 0

print(ans)    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int main() {
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	if (s == "abc") {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 2e5 + 5;
struct data {
	int x, p;
	bool friend operator < (const data &a, const data &b) {
		return a.x < b.x;
	}
} a[maxn];
int n;
int p[maxn];
int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) {
		scanf("%d", &a[i].x);
		a[i].p = i;
	}
	sort(a + 1, a + n + 1);
	for(int i = 1; i <= n; ++i) {
		p[a[i].p] = i;
	}
	int o = (n + 1) / 2;
	for(int i = 1; i <= n; ++i) {
		if(p[i] <= o) {
			printf("%d\n", a[o + ((n & 1) ^ 1)].x);
		} else {
			printf("%d\n", a[o - (n & 1)].x);
		}
	}
	return 0;
}


Measured memory_bytes: 4480
N, M, X, Y = map(int, input().split())
xlist = list(map(int, input().split()))
ylist = list(map(int, input().split()))
xmax = max(xlist)
ymin = min(ylist)
if xmax<ymin:
    for z in range(xmax+1, ymin+1):
        if X<z<=Y:
            print("No War")
            break
    else:
        print("War")
else:
    print("War")


Measured memory_bytes: 3060
class Entry
  attr_reader :spell, :nodes

  def initialize(spell, nodes)
    @spell = spell
    @nodes = nodes
  end
end
 
class Arrow
  attr_reader :source, :sink, :label

  def initialize(source, sink, label)
    @source = source
    @sink = sink
    @label = label
  end
end

def push(queue, spell)
  size = queue.size
  index = queue.index{|entry| entry.spell >= spell} || size
  return queue[index].nodes if index < size && queue[index].spell == spell

  return nil if index > 0 && !spell.start_with?(queue[index - 1].spell)
  queue.slice!(index..-1) if index < size && !queue[index].spell.start_with?(spell)

  nodes = {}
  queue.insert(index, Entry.new(spell, nodes))
  nodes
end

def calc(n, arrows, start, goal)
  ins = Array.new(n){[]}
  arrows.each do |arrow|
    ins[arrow.sink] << arrow.source
  end

  reachable_from = {}
  stack = [goal]
  until stack.empty?
    node = stack.pop
    reachable_from[node] = true
    ins[node].each do |source|
      stack << source unless reachable_from[source]
    end
  end

  return nil unless reachable_from[start]
  arrows.select!{|arrow| reachable_from[arrow.sink]}

  outs = Array.new(n){[]}
  arrows.each do |arrow|
    outs[arrow.source] << arrow
  end

  limit = n * arrows.map{|arrow| arrow.label.size}.max

  queue = [Entry.new('', {start => true})]
  until queue.empty?
    entry = queue.shift
    spell = entry.spell
    nodes = entry.nodes
    return spell if nodes[goal]
    return nil if spell.size > limit

    nodes.each do |node, _|
      outs[node].each do |arrow|
        new_nodes = push(queue, spell + arrow.label)
        new_nodes[arrow.sink] = true if new_nodes
      end
    end
  end
  nil
end

loop do
  n, a, s, g = gets.split.map(&:to_i)
  break if n == 0

  arrows = (0...a).map do |i|
    x, y, lab = gets.split
    Arrow.new(x.to_i, y.to_i, lab)
  end

  puts calc(n, arrows, s, g) || 'NO'
end

Measured memory_bytes: 10848
N =int(raw_input())
S =[]
P =[]
for i in range(N):
    s,p=map(str,raw_input().split())
    S.append(s)
    P.append(int(p))
ss=sorted(list(set(S)))
for sss in ss:
    a =[]
    b =[]
    for j in range(N):
        if sss==S[j]:
            a.append(j)
            b.append(P[j])
    if len(b)>0:
        c = sorted(b,reverse=True)
        #print c,b
        for k in c:
            for j in range(len(b)):
                if k == b[j]:
                    print(a[j]+1)



Measured memory_bytes: 2568
N = int(input())
A = list(map(lambda x:int(x), input().split(" ")))
B = list(map(lambda x:int(x), input().split(" ")))
C = list(map(lambda x:int(x), input().split(" ")))

sum = 0
for ia, i in enumerate(A):
    sum += B[i - 1]
    if ia > 0:
        if A[ia-1] == i - 1:
            sum += C[i-2]
print(sum)


Measured memory_bytes: 3064
/*
    Written by Nitrogens
    Desire for getting accepted!!
*/
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <bitset>
#include <stack>
#include <set>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 4e2+5;
const int Mod = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e = exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl

ll a[maxn];
ll dp[maxn][maxn];
ll prefix[maxn];

int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);

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

    memset(dp, 0x3f, sizeof(dp));
    for(int i = 1; i <= n; i++) scanf("%lld", &dp[i][i]);
    for(int i = 1; i <= n; i++) prefix[i] = prefix[i - 1] + dp[i][i];
    for(int i = 1; i <= n; i++)
    {
        for(int u = 1; u < n; u++)
        {
            int v = u + i - 1;
            if(v > n)   break;
            for(int k = 1; k < v; k++)
            {
                dp[u][v] = min(dp[u][v], dp[u][k] + dp[k + 1][v] + prefix[v] - prefix[u - 1]);
            }
        }
    }
    printf("%lld\n", dp[1][n] - prefix[n]);


    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}


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

const int N = 1e6+10;
int n;
long long int m;
long long int v[N];


int main(){
	cin >> m >> n;
	for(int i=0; i < n; i++) cin >> v[i];
	sort(v, v+n);
	
	long long sum = 0;
	for(int i=0; i < n; i++) sum += v[i];
	
	if(sum <= m) cout << m-sum << endl;
	else cout << -1 << endl;
}


Measured memory_bytes: 3680
#include<iostream>
#include<algorithm>
using namespace std;
int step;
int  a[3];
int main(){
    while(cin>>a[0]>>a[1]>>a[2])
    {step=0;
        while(a[0]!=a[1]||a[1]!=a[2])
            {
            sort(a,a+3);
        if(a[1]==a[2]){a[0]+=2;step++;}
        else if(a[0]==a[1]){a[0]++;a[1]++;step++;}
        else {a[0]+=2;step++;}

    }
    cout<<step<<endl;}}


Measured memory_bytes: 256