akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define maxn 200005
#define inf 1e17
#define eps 1e-6
#define ll long long
#define ull unsigned long long
#define main() int main()
#define pii pair<int, ll>
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define sa(x) scanf("%d",&x)
#define sab(x,y) scanf("%d%d",&x,&y)
#define pa(x) printf("%d",&x)
#define pab(x,y) printf("%d%d",x,y) 
#define ms(a,x) memset(a,x,sizeof(a))
#define IO ios::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define ff0(i,n) for(int i=0;i<n;++i)
#define ff1(i,n) for(int i=1;i<=n;++i)
main()
{
    IO;
    ull x,y;
    cin>>x>>y;
    ull c=0;
    ull ans=1;
    while(ans<=x)
    {
    	c++;
    	ans*=y;
	}
	cout<<c<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {

		Scanner sc=new Scanner(System.in);

		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();

		boolean flg=true;
		
		for(int i=1;i<=b;i++) {
			
			if(a*i%b==c) {
				System.out.println("YES");
				flg=false;
				break;
			}
			
			
		}
		
		if(flg) {
			System.out.println("NO");
		}
		
		
		
		
		
		sc.close();


	}


}



Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define INF 1e9+7
typedef long long int ll;
const int maxn = 100000;
ll mod = INF;

int n;
int a[maxn];

int main(){
    cin >> n;
    for(int i=0;i<n;i++)cin >> a[i];
    sort(a,a+n);
    // n/2-1 n/2
    cout << a[n/2]-(a[n/2-1]+1)+1<<endl;
    return 0;
}

Measured memory_bytes: 4020
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  if(a%2==0 || b%2==0 || c%2==0){
    printf("0\n");
  } else {
    int x=MIN(a,MIN(b,c));
    int y=MIN(a,b)+MIN(b,c)+MIN(c,a)-2*x;
    printf("%lld\n",(int64)x*y);
  }
}

int main(void){
  run();
  return 0;
}

Measured memory_bytes: 128
#include<iostream> 
#include<stdio.h>
#include<string>
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (ll i = 0; i < (n); ++i)	
//setprecision(16)

void outi(int x) { cout << x << endl; }
void outl(ll x) { cout << x << endl; }
void outs(string x) { cout << x << endl; }
ll max(ll a, ll b) {
	ll max;
	if (a > b) max = a;
	else max = b;
	return max;
}
ll min(ll a, ll b) {
	ll min;
	if (a < b) min = a;
	else min = b;
	return min;
}
//---------------------------------------------------------------

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

	vector<int> d(102);
	rep(i, n) {
		int p;
		cin >> p;
		d[p] = 1;
	}

	pii ans(9999, -1);
	for (int i = 0; i <= 101; ++i) {
		if (d[i] == 1) continue;
		int dif = abs(x - i);
		ans = min(ans, pii(dif, i));
	}

	cout << ans.second << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int N,M;
ll X[100010];
vector<pair<int,ll>> g[100010];

class DisjointSet{
public:
  vector<int> rank;
  vector<pair<int,ll>> p;

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

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

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

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

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

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

  ll findSecond(int x){
    return p[findSet(x)].second;
  }
};

vector<pair<ll,pair<int,int>>> edge;
map<pair<int,int>,int> mp;
bool used[100010];

void dfs(int now,ll lim){
  used[now]=true;
  for(int i=0;i<g[now].size();i++){
    int u=g[now][i].first;
    //if(used[u]) continue;
    if(now<u){
      if(g[now][i].second<=lim){
        mp[make_pair(now,u)]=2;
        if(!used[u]) dfs(u,lim);
      }
    }else{
      if(g[now][i].second<=lim){
        mp[make_pair(u,now)]=2;
        if(!used[u]) dfs(u,lim);
      }
    }
  }
  return;
}

int main(){
  cin>>N>>M;
  
  for(int i=0;i<N;i++){
    cin>>X[i];
  }
  for(int i=0;i<M;i++){
    int a,b;
    ll y;
    cin>>a>>b>>y;
    a--;
    b--;
    g[a].push_back(make_pair(b,y));
    g[b].push_back(make_pair(a,y));
    edge.push_back(make_pair(y,make_pair(a,b)));
  }

  DisjointSet us(N+1);
  sort(edge.begin(),edge.end());
  
  for(int i=0;i<edge.size();i++){
    pair<int,int> tp=edge[i].second;
    if(!us.same(tp.first,tp.second)) us.unite(tp.first,tp.second);
    ll z=us.findSecond(tp.first);
    if(z>=edge[i].first) mp[tp]=1;
    else mp[tp]=-1;
  }

  //reverse(edge.begin(),edge.end());
  int nans=0;
  for(int i=edge.size()-1;i>=0;i--){
    pair<int,int> tp=edge[i].second;
    if(mp[tp]==2) continue;
    else if(mp[tp]==1){
      dfs(tp.first,edge[i].first);
    }else nans++;
  }
  cout<<nans<<endl;

  return 0;
}


Measured memory_bytes: 29296
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(K: int):
    N = 50
    div, mod = divmod(K, N)
    ans = [i+div for i in range(N)]
    for i in range(mod):
        ans[i] += N
        for j in range(N):
            if i == j:
                continue
            ans[j] -= 1

    print(N)
    print(*ans, sep=" ")

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
wx=[]
wy=[]

def readdata():
    it=0
    x=[]
    y=[]
    while True:
        try: tmp = map(int,raw_input())
        except:
            return x,y
        if it%2==0:
            x.append(tmp)
        else:
            y.append(tmp)
        it +=1

def nextpath(p, dir0):
    tmp = ispath(p, (dir0+3)%4)
    if tmp!=[]: return tmp
    tmp = ispath(p, dir0)
    if tmp!=[]: return tmp
    tmp = ispath(p, (dir0+1)%4)
    if tmp!=[]: return tmp
    tmp = ispath(p, (dir0+2)%4)
    if tmp!=[]: return tmp
    return tmp

def ispath(p,dir1):
    y,x = p
    if dir1==0:
        if y>0 and wy[y-1][x]==1: return [-1,0]
        else: return []
    elif dir1==1:
        if x<len(wx[0]) and wx[y][x]==1: return [0,1]
        else: return []
    elif dir1==2:
        if y<len(wy[0])-1 and wy[y][x]==1: return [1,0]
        else: return []
    elif dir1==3:
        if x>0 and wx[y][x-1]==1: return [0,-1]
        else: return []
    return []

def f0037():
    p =[0,0]
    direction = 1
    msg = []
    while True:
        dp = nextpath(p, direction)
        p[0] += dp[0]
        p[1] += dp[1]
        if dp == [0,1]:
            direction = 1
            msg.append("R")
        elif dp == [0,-1]:
            direction = 3
            msg.append("L")
        elif dp == [1,0]:
            direction = 2
            msg.append("D")
        elif dp == [-1,0]:
            direction = 0
            msg.append("U")
        if p==[0,0]: break            
    return msg

wx, wy = readdata()
msg = f0037()    
print "".join(msg)

Measured memory_bytes: 4360
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1ll << 60;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

#ifdef WIN32
#define dump(x) cout << #x << " = " << (x) << "\n"
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n"
#else
#define dump(x)
#define debug(x)
#endif

string str;

void solve() {
	for ( int i = 7; i <= str.size(); i++ ) {
		if ( str.substr( i - 7, 7 ) == "Hoshino" ) {
			str = str.substr( 0, i - 7 ) + "Hoshina" + str.substr( i, str.size() - i );
		}
	}
	printf( "%s\n", str.c_str() );
}

int main() {
#ifdef WIN32
	printf( "Debug Mode\n" );
#endif
	int n;
	scanf( "%d\n", &n );
	while ( n-- ) {
		getline( cin, str );
		solve();
	}
	return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define forn(low,high,i) for(i = low;i < high;i++)
#define forrev(high,low,i) for(i = high; i >= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define dbg2(a,b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';        
#define debug(x) cerr << __LINE__ << ' ' << #x << " = " << x << '\n';
#define dln cerr << '\n';
#define dsp cerr << ' ';
#define pln cout << '\n';
#define psp cout << ' ';

typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int inf = 1e9;
const ll INF = 1e18;
const ll mod = 1e9 + 7;

clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

int main(){
  fastio

  ll n, i;cin >> n;
  string s;
  cin >> s;
  string r = "";
  r += s[0];
  forn(1, n, i){
    if(s[i] != s[i - 1]){
      r += s[i];
    }
  }

  cout << sz(r) << '\n';

  ktj();
}


Measured memory_bytes: 592
/*
    title: E.cpp
    author: Akhil
    date: 2020-09-19
    time: 18:32:13
*/

#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <climits>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <numeric>
#include <cmath>
#include <stdio.h>

using namespace std;

int main()
{
    long long n, x, m; cin >> n >> x >> m;
    vector<long long> v;
    v.push_back(x);
    unordered_set<long long> s;
    s.insert(x);
    while (true)
    {
        x = (x * x) % m;
        if (s.count(x)) break;
        else v.push_back(x), s.insert(x);
    }
    long long idx = -1; 
    for (int i = 0; i < (int) v.size(); i++) if (v[i] == x) {idx = i; break;}
    long long ans = accumulate(v.begin(), v.begin() + (int) min(n, idx), 0LL); 
    n -= idx;
    if (n <= 0) {cout << ans << endl; return 0;}
    ans += n / (v.size() - idx) * accumulate(v.begin() + idx, v.end(), 0LL);
    n %= (v.size() - idx);
    ans += accumulate(v.begin() + idx, v.begin() + idx + n, 0LL); 
    cout << ans << endl;
    return 0;
}

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

int h, w;
priority_queue<int> pq;
vector<int> cnt(26, 0);

int main() {
  cin >> h >> w;
  for (int i = 0; i < h; ++i) {
    string s;
    cin >> s;
    for (auto c : s) ++cnt[c - 'a'];
  }
  for (int i = 0; i < 26; ++i) pq.push(cnt[i]);
  vector<int> v;
  for (int i = 0; i < (h + 1) / 2; ++i)
    for (int j = 0; j < (w + 1) / 2; ++j) {
      int now = 4;
      if ((h & 1) && i == h / 2) now >>= 1;
      if ((w & 1) && j == w / 2) now >>= 1;
      v.push_back(now);
    }
  sort(v.begin(), v.end(), greater<int>());
  for (auto p : v) {
    if (p > pq.top()) {
      cout << "No" << endl;
      return 0;
    }
    p = pq.top() - p;
    pq.pop();
    pq.push(p);
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3616
use std::io::stdin;
use std::vec::Vec;

mod utils {
    use std::io::BufRead;
    use std::str::{self, FromStr};

    pub struct StdinReader<R: BufRead> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: BufRead> StdinReader<R> {
        pub fn new(reader: R) -> StdinReader<R> {
            StdinReader {
                reader: reader,
                buf: Vec::new(),
            }
        }

        #[allow(unused)]
        #[inline]
        pub fn reads<T: FromStr>(&mut self) -> T {
            self.read_until(b' ')
        }

        #[allow(unused)]
        #[inline]
        pub fn readl<T: FromStr>(&mut self) -> T {
            self.read_until(b'\n')
        }

        #[allow(unused)]
        #[inline]
        pub fn read_vec<T: FromStr>(&mut self) -> Vec<T> {
            return self.read_until::<String>(b'\n').trim().split_whitespace().map(|c| c.parse().ok().unwrap()).collect();
        }

        #[inline]
        pub fn read_until<T: FromStr>(&mut self, delim: u8) -> T {
            loop {
                self.buf.clear();
                let len = self.reader
                    .read_until(delim, &mut self.buf)
                    .expect("failed reading bytes");
                match len {
                    0 => panic!("early eof"),
                    1 if self.buf[0] == delim => (),
                    _ => {
                        if self.buf[len - 1] == delim {
                            self.buf.truncate(len - 1);
                        }
                        break;
                    }
                }
            }

            let elem = unsafe { str::from_utf8_unchecked(&self.buf) };
            elem.parse().unwrap_or_else(|_| panic!(format!("failed parsing: {}", elem)))
         }
    }
}


fn main(){
    let stdin = stdin();
    let mut r = utils::StdinReader::new(stdin.lock());
    let a:usize = r.reads();
    let b:usize = r.readl();
    let mut ans = 0;
    if a > b * 2 {
        ans = a - b * 2;
    }
    println!("{}",ans);

}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
//using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int dh[8] = {0, 0, 1, 1, 1, -1, -1, -1};
const int dw[8] = {1, -1, 0, 1, -1, 0, 1, -1};
  
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * (B / gcd(A, B));
}
using Graph = vector<vector<int>>;
Graph G;
  
/*------------------------------------------------------------------*/

int main(){
    int n, m;  cin >> n >> m;
    Graph G(n);

    rep(i, m){
        int a, b; cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> dis(n, -1);
    vector<int> ans_pos(n, -1);
    queue<int> que;

    dis[0] = 0;
    que.push(0);

    while(!que.empty()){
        int v = que.front(); que.pop();

        for(int next_v : G[v]){
            if(dis[next_v] != -1) continue;

            dis[next_v] = dis[v] + 1;
            ans_pos[next_v] = v + 1;
            que.push(next_v);
        }
    }
    if(*min_element(dis.begin(), dis.end()) == -1){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
        _rep(i, 1, n) cout << ans_pos[i] << endl;
    }
}

Measured memory_bytes: 10664
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)

int main() {
	int n,d,x;
	cin>>n>>d>>x;
	vector<int>a(n);
	rep(i,n)cin>>a[i];
	rep(i,d)rep(j,n){
	    if(i%a[j]==0)x++;
	}
	cout<<x;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main(){
    int count=0;
    string str1,str2,str3;
    cin>>str1;
    while(1){
        str3="";
        cin>>str2;
        if(str2=="END_OF_TEXT"){
            break;
        }
        for(int i=0;i<str2.size();i++){
            str3+=tolower(str2[i]);
        }
        if(str3==str1){
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}


Measured memory_bytes: 3296
#include "bits/stdc++.h"

using namespace std;
#define rep(i, n) for (int64_t i = 0; i < n; i++)

const double PI = 3.14159265358979323846;

vector<vector<int64_t>> data1;

void search(vector<int64_t> data, int depth)
{
}


int main()
{
	int h1, m1, h2, m2, k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	int a = (h2 - h1) * 60;
	int b = (m2 - m1) - k;
	cout << a + b << endl;
	return 0;
}

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

int main(void) {
  int N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  A--;
  B--;
  C--;
  D--;
  string S;
  cin >> S;
  bool flag = true;
  for (int i = A; i < max(C, D) - 1; i++) {
    if (S[i] == '#' && S[i + 1] == '#') {
      flag = false;
      break;
    }
  }

  if (flag && C > D) {
    flag = false;
    for (int i = B; i <= D; i++) {
      if (S[i - 1] == '.' && S[i] == '.' && S[i + 1] == '.') {
        flag = true;
        break;
      }
    }
  }

  cout << (flag ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 3736
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#define ll long long
#define rep(i, a, b) for(int i = a; i < b; i++)
using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  rep(i, 0, (int)s.size()+1) {
    int f = 0;
    rep(j, 0, (int)s.size()) {
      if(s[j] != t[(i+j)%(int)s.size()]) {
        f = 1;
        break;
      }
    }
    if(f == 0) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
}


Measured memory_bytes: 3588
using System;
using static System.Console;
using static System.Math;
using System.Numerics;
using System.Collections.Generic;
using System.Linq;


namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int n = myRead.readInt();
            var l = myRead.readLongArray();
            var ans = 0;
            if (l.Length != 0)
            {
                for (int i = 0; i < l.Length - 2; i++)
                {
                    for (int j = i + 1; j < l.Length - 1; j++)
                    {
                        for (int k = j + 1; k < l.Length; k++)
                        {
                            if (l[i] + l[j] > l[k]
                            && l[i] + l[k] > l[j]
                            && l[j] + l[k] > l[i]
                            && (l[i] != l[j] && l[i] != l[k] && l[j] != l[k]))
                                ans++;
                        }
                    }
                }

            }
            WriteLine(ans);
        }
    }
    public static class myRead
    {
        public static int readInt() { return int.Parse(ReadLine()); }
        public static long readLong() { return long.Parse(ReadLine()); }
        public static string reatStr() { return ReadLine(); }
        public static int[] readIntArray() { return ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        public static long[] readLongArray() { return ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        public static string[] readStrArray() { return ReadLine().Split(' '); }
    }


    public static class MyMath
    {
        public static long Factorical(long n)
        { return n <= 1 ? 1L : n * Factorical(n - 1); }
        public static long Permutation(long n, long m)
        { return m == 0 ? 1L : (m == n) ? Permutation(n, m - 1) : n * Permutation(n - 1, m - 1); }
        public static long Combination(long n, long m)
        { return n - m > m ? Permutation(n, m) / Factorical(m) : Permutation(n, n - m) / Factorical(n - m); }
        public static long Gcd(long n, long m)
        { return n % m == 0 ? m : Gcd(m, n % m); }
        public static long Lcm(long n, long m)
        { return n * m / Gcd(n, m); }
        public static long Pow(long n, long m)
        { return m == 0 ? 1L : m == 1 ? n : n * Pow(n, m - 1); }
    }


}

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

using namespace std;

string change(string str){
	for (size_t i = 0; i < str.size(); i++) {
		if (str[i] == '?') {
			str[i] = 'a';
		}
	}
	return str;
}

int main(int argc, char const *argv[]) {
	string sd,t;
	std::cin >> sd;
	std::cin >> t;

	if (sd.size() < t.size()) {
		std::cout << "UNRESTORABLE" << '\n';
		return 0;
	}

	bool flag = true;
	// 後ろから順番に一致するかを見て行く
	for (size_t i = 0; i <= sd.size() - t.size(); i++) {
		flag = true;
		for (size_t j = 0; j < t.size(); j++) {
			if ((sd[sd.size() - t.size() - i + j] != t[j]) && (sd[sd.size() - t.size() - i + j] != '?')){
				flag = false;
				break;
			}
		}
		if (flag) {
			for (size_t j = 0; j < t.size(); j++) {
				sd[sd.size() - t.size() - i + j] = t[j];
			}
			sd = change(sd);
			std::cout << sd << '\n';
			return 0;
		}
	}
	std::cout << "UNRESTORABLE" << '\n';
	return 0;
}


Measured memory_bytes: 256
N = int(input())

nn = str(N)

Sum = []
s = 0
for n in nn:
    s += int(n)
Sum.append(s)

for i in range(len(nn)):
    s = 0
    for j,n in enumerate(nn):
        if j < i:
            s += int(n)
        elif j == i:
            s += int(n)-1
        else:
            s += 9
    Sum.append(s)

print(max(Sum))

Measured memory_bytes: 3064
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout()]
fn main() {
    input! {
        n: i64
    }
    let ans = 1000 - n % 1000;
    if ans == 1000 {
        println!("0");
    } else {
        println!("{}", ans);
    }
}


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

using namespace std;

int main(){

    string s;

    long long res = 0,i,j,len;

    cin>>s;


    len = s.size();
    for(i = 0;i < len;i++){
        if(i < len-2 ){
            if(s[i] == s[i+1]){

                i += 2;
                res++;
            }
            res++;
        }
        else if(i == len-2 && s[i] == s[i+1]){
            continue;
        }
        else if(i == len-2 && s[i] != s[i+1]){
           res += 2;
           i += 1;
        }
        else if(i == len-1){
           res += 1;
        }
    }
    cout<<res;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int n[12][345],a,b;
bool u[10];
void d(int l,int c){
	n[l][c]++;if(l==10)return;
	for(int i=0;i<10;i++)if(!u[i]){
		u[i]=1;
		d(l+1,c+(l+1)*i);
		u[i]=0;
	}
}
int main(){
	for(int i=0;i<10;i++)u[i]=0;d(0,0);
	while(cin>>a>>b)cout<<(b<345?n[a][b]:0)<<endl;
	return 0;
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
//printf("%.10f\n", n);
ll iro[601][601];
signed main() {
	ll n, c, a, cnt = 0, ans = INF; cin >> n >> c;
	vector<ll> v0, v1, v2;
	vector<vector<ll>> v(4, vector<ll>(c + 2));
	for (int h = 1; h <= c; h++) {
		for (int i = 1; i <= c; i++) {
			cin >> iro[h][i];
		}
	}
	for (int h = 1; h <= n; h++) {
		for (int i = 1; i <= n; i++) {
			cin >> a;
			v[(h + i) % 3][a]++;
		}
	}
	for (int h = 1; h <= c; h++) {
		for (int i = 1; i <= c; i++) {
			if (i == h) { continue; }
			for (int j = 1; j <= c; j++) {
				if (h == j || i == j) { continue; }
				cnt = 0;
				for (int k = 1; k <= c; k++) {
					cnt += iro[k][h] * v[0][k];
				}
				for (int k = 1; k <= c; k++) {
					cnt += iro[k][i] * v[1][k];
				}
				for (int k = 1; k <= c; k++) {
					cnt += iro[k][j] * v[2][k];
				}
				ans = min(ans, cnt);
			}
		}
	}
	cout << ans << endl;
	cin >> n; return 0;
}

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

int main() {
  int n;
  cin >> n;
  bool flag = false;

  while(n > 0){
    if(n % 10 == 7) {
      flag = true;
      break;
    }
    n /= 10;
  }

  if(flag) cout << "Yes";
  else cout << "No";

}



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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000001
#define INFL (1LL << 60)
#define MOD 998244353
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<int, int>

ll gcd(ll a, ll b){
    if(a<b){
      ll tp = a;
      a = b;
      b = tp;
    }
  if(b == 0) return a;
  return gcd(b, a%b);
}

int main() {
  int t;
  cin >> t;
  REP(i, t){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    if(b > d || a < b){
      cout << "No" << endl;
      continue;
    }
    if(d % b == 0){
      ll x = a % b;
      if(c < x && x <= d) cout << "No" << endl;
      else cout << "Yes" << endl;
      continue;
    }
    ll x = a % b;
    ll y = d % b;
    ll p = gcd(b, y);
    if(c < (b-p) && (b-p) <= d){
      cout << "No" << endl;
    }
    else cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>
#include <string>
#include <bitset>
#include <functional>
#include <iomanip>

using namespace std;
using lint = long long;
using vb = vector<bool>;
using vi = vector<int>;
using vl = vector<int>;
using pii = pair<int, int>;
using pll = pair<lint, lint>;
using pqi = priority_queue<int>;
using pql = priority_queue<lint>;
#define mii = map<int, int>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n); i > 0; i--)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define repf(i, f, n) for (int i = (f); i < (n); i++)
#define mp(x, y) make_pair((x), (y))
#define pb(x) push_back((x))
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define foreach(it, x) for (auto it = (x).begin(); it != (x).end(); it++)
#define space (char)0x20
#define yes "Yes"
#define no "No"

constexpr lint MOD = 1e9 + 7;
lint A, B, C, D, E, F, G, H, I, J, K, L, M, N;
lint O, P, Q, R, S, T, U, V, W, X, Y, Z;
// string s;
// int ans = 1;
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
 
	cin >> N >> K;
    
    cout << min(N % K, K - N % K) << endl;
    return 0;
}

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

int main() {
  long long n, m, k;
  cin >> n >> m >> k;
  vector<long long> a(n+1), b(m+1);
  int ans = 0, ar, br = 0;
  for(int i = 1; i <= n; i++){
    cin >> a.at(i);
    a.at(i) += a.at(i-1);
    if(a.at(i) <= k) ar = i;
  }
  for(int i = 1; i <= m; i++){
    cin >> b.at(i);
    b.at(i) += b.at(i-1);
  }
  
  for(int i = ar; i >= 0; i--){
    for(int j = br; j <= m; j++){
      if(a.at(i) + b.at(j) <= k){
        br = j;
        ans = max(ans, i + br);
      }
      else break;
    }
    if(br == m) break;
  }
  
  cout << ans << endl;
}

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

int main() {
    string s, t;
    cin >> s;
    cin >> t;
    int cnt = 0;
    for(int i = 0; i < s.length(); i++)
        if(s[i] != t[i])
            cnt++;
    cout << cnt;
}


Measured memory_bytes: 3820
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

int main(void){
    string s;
    cin>>s;
    int n=SZ(s);
    REP(i,n){
        vector<int> na(26,0);
        REP(j,n-i){
            vector<int> nb(26,0);
            FOR(k,j,j+i+1)
                if(nb[s[k]-'a']==0){
                    na[s[k]-'a']++;
                    nb[s[k]-'a']++;
                }
        }
        int j=0;
        for(j=0;j<26;j++)
            if(na[j]==n-i)
                break;
        if(j<26){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}

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

int main(){
	double A,B,C,D,E,F;
	cin>>A>>B>>C>>D>>E>>F;
	double water=0;
	double suger=0;
	double ans=0;
	double tmp; 
	for(int a=0;a<=F/(100*A);++a){
		for(int b=0;b<=(F-100*A*a)/(100*B);++b){
			for(int c=0;c<=min(((F-100*A*a-100*B*b)/C),E*(A*a+B*b)/C);++c){
				int d=min((F-100*A*a-100*B*b-C*c)/D,(E*(A*a+B*b)-C*c)/D);
				if(((c!=0)||(d!=0))&&((a!=0)||(b!=0))) tmp=100*(C*c+D*d)/(100*A*a+100*B*b+C*c+D*d);
				else tmp=0;
				if(ans<=tmp){
					ans=tmp;
					water=100*A*a+100*B*b+C*c+D*d;
					suger=C*c+D*d;
				}
			}
		}
	}
	cout<<water<<" "<<suger<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;
template<class T, class T2> inline void chkmax(T &x, const T2 &y) { if(x < y) x = y; }
template<class T, class T2> inline void chkmin(T &x, const T2 &y) { if(x > y) x = y; }
const int MAXN = (1 << 20);

template<class T>
struct monotonous_queue_min
{
	int64_t len;
	deque<pair<T, int64_t> > Q;

	monotonous_queue_min() { Q.clear(); len = 0; }

	void init(int64_t _l)
	{
		len = _l;
		Q.clear();
	}

	void push_back(T x, int64_t X)
	{
		while(!Q.empty() && X - Q.front().second > len) Q.pop_front();
		while(!Q.empty() && x <= Q.back().first) Q.pop_back();
		Q.push_back({x, X});
	}

	T query()
	{
		if(Q.empty()) return (T)1e18;
		return Q.front().first;
	}
};

int64_t n, t, e, L;
int64_t x[MAXN];

void read()
{
	cin >> n >> e >> t;
	for(int i = 1; i <= n; i++)
		cin >> x[i];
}

int64_t dp[MAXN];

/*

   dp[i] = MIN ( 2 * x[i] - 2 * x[j] + dp[j - 1] - x[j - 1] + x[i] + MAX(t - 2 * x[i] + 2 * x[j], 0) )
   dp[i] = 3 * x[i] + MIN(dp[j - 1] - x[j] * 2 - x[j - 1])  
   dp[i] = 3 * x[i] + MIN(dp[j - 1] - x[j] * 2 - x[j - 1] + t - 2 * x[i] + 2 * x[j])

   dp[i] = dp[j - 1] + 3 * x[i] - 2 * x[j] - x[j - 1] 

   t >= x[i] * 2 - x[j] * 2
   floor(t / 2) >= x[i] - x[j]
*/

int64_t mn[MAXN];

monotonous_queue_min<int64_t> mq;

void solve()
{
	x[0] = 0;
	dp[0] = 0;
	mn[0] = (int64_t)1e18;
	L = t / 2;

	mq.init(L);	

	int last = 1;
	for(int i = 1; i <= n; i++)
	{
		/*for(int j = i; j >= 1; j--)
		{
			int64_t wait_t = max((int64_t)0, t - 2 * (x[i] - x[j]));
			chkmin(dp[i], -x[j - 1] + wait_t + (-x[j]) * (int64_t)2 + dp[j - 1]);
		}*/

		mn[i] = min(mn[i - 1], dp[i - 1] - x[i] * (int64_t)2 - x[i - 1]);
		mq.push_back(dp[i - 1] - x[i - 1], x[i]);
		dp[i] = mq.query() + t - 2 * x[i];
		while(i >= last && (x[i] - x[last]) > L) last++;
		chkmin(dp[i], mn[last - 1]);
		dp[i] += 3ll * x[i];
	}

	cout << dp[n] + e - x[n] << endl;
}

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

	read();
	solve();
	return 0;
}



Measured memory_bytes: 5888
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<string,int>> vpsi;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
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;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;

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

ll a,b,k;
cin >> a >> b >> k;
if(a+b<=k){
    cout << 0 << " " << 0 << endl;
    return 0;
}
if(a<=k){
    cout << 0 << " " << b-(k-a) << endl;
}else{
    cout << a-k << " " << b << endl;
}

//////////////////////////////////////////////////////
return 0;}

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

int main()
{
    ll M,N;
    cin >> N >> M;
    ll a[N],b[N];
    map<ll,ll> A;
    for(ll i = 0; i < M; i++)
    {
        cin >> a[i] >> b[i];
        if(a[i] == 1)A[b[i]]++;
        if(b[i] == N)A[a[i]]++;
    }

    for(auto e:A)
    {
        if(e.second == 2)
        {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }

    cout << "IMPOSSIBLE" << endl;
    return 0;

}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x,t,i,p;
  cin>>n>>x>>t;
  for(i=0;i<n;i++){
      i=i+x;
  }
  p=i/x;
  cout<<p*t<<'\n';
  return(0);
}


Measured memory_bytes: 3604
// A - Biscuits

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

const int N_MAX = 50;

ll comb[N_MAX + 1][N_MAX + 1];

void init_comb() {
	comb[0][0] = 1;
	for (int i=1; i<=N_MAX; i++) {
		for (int j=0; j<=i; j++) {
			comb[i][j] += comb[i-1][j];
			if (j > 0) comb[i][j] += comb[i-1][j-1];
		}
	}
}

int main() {
	int N, P;
	cin >> N >> P;

	int E = 0, O = 0;
	for (int i=0; i<N; i++) {
		int A;
		cin >> A;
		if (A % 2 == 0) E++;
		else O++;
	}

	//cout << "E=" << E << " O=" << O << endl; // **** debug ****

	init_comb();

	ll even_comb = 0;
	for (int i=0; i<=E; i++) {
		even_comb += comb[E][i];
	}
	//cout << "choose from even " << even_comb << endl; // **** debug ****

	ll odd_comb = 0;
	for (int i=0; i<=O; i++) {
		odd_comb += comb[O][i];
	}
	//cout << "choose from odd " << odd_comb << endl; // **** debug ****


	ll odd_cases = 0;
	for (int i=1; i<=O; i+=2) {
		odd_cases += comb[O][i];
	}
	//cout << "odd cases in choose from odd " << odd_cases << endl; // **** debug ****


	ll ans;
	if (P == 1) {
		ans = odd_cases * even_comb;
	} else {
		ans = (odd_comb - odd_cases) * even_comb;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3624
using System;
using System.Linq;

namespace ALDS1_4_B_BinarySearch
{
	class Program
	{
		static void Main ( string[] args )
		{
			//input
			Console.ReadLine ();
			int[] searchArray = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray ();

			Console.ReadLine ();
			int[] elementArray = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray ();

			//process
			int count = 0;

			foreach (var item in elementArray)
			{
				bool isFind = BinarySearch (searchArray, item);

				if (isFind)
				{
					count++;
				}
			}

			Console.WriteLine (count);
		}

		static bool BinarySearch ( int[] numArray, int searchNum )
		{
			int lowerIndex = 0;
			int upperIndex = numArray.Length;

			while (lowerIndex < upperIndex)
			{
				int middleIndex = (lowerIndex + upperIndex) / 2;
				int item = numArray[middleIndex];

				bool isFind = item == searchNum;

				if (isFind)
				{
					return true;
				}
				else if (item < searchNum)
				{
					lowerIndex = middleIndex + 1;
				}
				else
				{
					upperIndex = middleIndex;
				}
			}

			return false;
		}
	}
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> v(n, 0);
    int tmp;
    for (int i = 0; i < n - 1; i++)
    {
        cin >> tmp;
        tmp--;
        v[tmp]++;
    }

    for (int i = 0; i < n; i++)
    {
        cout << v[i] << endl;
    }
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//print
#define pv(val) cerr << #val << '=' << (val) << endl

const int INF = 1e9;

int main(void){

	ll Q, H, S, D; cin >> Q >> H >> S >> D;
	ll N; cin >> N;

	ll x = min(min(4*Q, 2*H), S);

	ll ans = min(D*(N/2)+x*(N%2), x*N);
	cout << ans << endl;


	return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
    int X; cin >> X;
    if(X == 1){
        cout << 1 << endl;
        return 0;
    }
    int ans = 0;
    repr(i,2,X){
        int now = i*i;
        while(now <= X){
            ans = max(ans,now);
            now *= i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    ll a,v; cin >> a >> v;
    ll b,w; cin >> b >> w;
    ll t; cin >> t;
    ll meter = abs(a-b);
    ll c = v-w;
    if(c <= 0) cout << "NO" << endl;
    else {
        if(meter <= c*t) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 3628
N,M,X,Y=gets.split.map(&:to_i)
x,y=gets.split.map(&:to_i).max,gets.split.map(&:to_i).min
-100.upto(100) do |z|
  next unless X < z
  next unless z <= Y
  next unless x < z
  next unless y >= z
  puts "No War"
  exit
end
puts :War


Measured memory_bytes: 1788
#include <iostream>
#include <string>

int main()
{
    const std::string str_false = "Hoshino";
    const std::string str_true = "Hoshina";

    u_int num_of_data;
    std::cin >> num_of_data;
    std::cin.ignore();
    
    for(u_int i = 0; i < num_of_data; ++i){
        std::string text;
        getline(std::cin, text);
        
        std::string::size_type index = 0;
        while((index = text.find(str_false, index)) != std::string::npos){
            text.replace(index, str_false.size(), str_true);
            index += str_true.size();
        }
        std::cout  << text << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




int main(){

    string s,t;
    cin >> s >> t;
    
    int n = s.length();
    int m = t.length();
    
    vvi dp(n+1,vi(m+1,0));
    
    rep(i,n){
        rep(j,m){
            
            chmax(dp[i+1][j+1],dp[i+1][j]);
            chmax(dp[i+1][j+1],dp[i][j+1]);
            
            if(s[i] == t[j]) chmax(dp[i+1][j+1],dp[i][j]+1);
            
            
            
        }
    }
    
    
    //outmat(dp);
    
    string res = "";
    int x = n,y = m;
    while (x > 0 && y > 0) {
        if(dp[x][y] == dp[x-1][y]) x--;
        else if(dp[x][y] == dp[x][y-1]) y--;
        else x--,y--,res = s[x]+res;
    }
    
    cout << res << endl;
    
    
    

    return 0;
}


Measured memory_bytes: 35584
s = input()
t = input()
minl = len(s)
l = len(t)
for i in range(len(s)-len(t)+1):
    c = 0
    for j in range(l):
        if t[j]!=s[j+i]:
            c += 1
    if minl >= c:
        minl = c
print(minl)

Measured memory_bytes: 9028
<?php
error_reporting(0);
$stdin = file_get_contents('php://stdin');
$line = explode("\n",$stdin);
$fi = 0;
$cnt = 0;
$list = array();
$key = new stdclass();
foreach($line as $l) {
  if (strlen($l)==0) continue;
  if ($fi == 0) {
    $a = explode(" ",$l);
    $key->A = $a;
    $fi++;
    continue;
  }
  if ($fi > 0) {
    $a = explode(" ",$l);
    $key->X[] = $a;
  }
}
//N頂点
$N = $key->A[0];
//M辺
$M = $key->A[1];

foreach($key->X as $v) {
  if ($v[0]==1) $s[$v[1]]=true;
  if ($v[1]==$N) $t[$v[0]]=true;
}
foreach($s as $k=>$v) {
  if ($t[$k]==true) {
    printf("POSSIBLE\n");
    exit;
  }
}
printf("IMPOSSIBLE\n");


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

using namespace std;
#define int long long
const int MOD = 1000000007;
  
signed main(){
    int w,h;
    cin>>w >>h;
    int a[w],b[h];
    for(int i=0;i<w;i++)cin>>a[i];
    for(int i=0;i<h;i++)cin>>b[i];
    sort(a,a+w);
    sort(b,b+h);
    int p=0,q=0,ans=0;
    while(p<w&&q<h){
        if(a[p]<b[q]){
            ans+=a[p]*(h+1-q);
            p++;
        }else{
            ans+=b[q]*(w+1-p);
            q++;
        }
    }
    while(p<w){
        ans+=a[p];
        p++;
    }
    while(q<h){
        ans+=b[q];
        q++;
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 1792
import math

def is_prime(n):
  if n == 1: return False
  

  for k in range(2, int(math.sqrt(n)) + 1):
    if n % k == 0:
      
      return False
  return True
  
Q=int(input())
L=[0]*100000
S=[0]*100001
for i in range(100000):
  if is_prime(i+1) and is_prime((i+2)/2):
    L[i]=1
L[1]=0    
for i in range(len(L)):
  S[i+1]=S[i]+L[i]
  
#print(L[:50],S[:50])
for i in range(Q):
  l,r=map(int, input().split())
  print(S[r]-S[l-1])




Measured memory_bytes: 7124
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	string s,t;
	cin >> s >> t;
	sort(ALL(s));//一番小さくする
	sort(ALL(t),greater<char>());//一番でかくする（辞書順で）
	int n = min(s.size(),t.size());
	int flag = -1;
	for(int i = 0; i < n; i++) {
		if (s[i] < t[i]){
			flag = 0;
			break;
		}
		else if(s[i]== t[i]){
			continue;
		}
		else{
			flag = 1;
			break;
		}
	}
	if (flag == -1){
		if(s.size() < t.size()){
			flag = 0;
		}
	}
	if (flag == 0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define dcout cout<<fixed<<setprecision(20)
#define Accepted_MAGIC cin.tie(0);ios::sync_with_stdio(false)

// typedef long long ll;
using Real = long double;
#define int long long

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;
constexpr Real eps = 1e-9, pi = acos(-1);

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

int N;
vector<string> ans;

void dfs(int dep, string s, char mx){
  if(dep == N-1){
    cout << s << endl;
    return;
  }
  for(char nx = 'a'; nx <= mx+1; nx++){
    if(nx == mx+1) dfs(dep+1, s+nx, mx+1);
    else dfs(dep+1, s+nx, mx);
  }
}

signed main(void){
  Accepted_MAGIC;
  
  cin >> N;
  dfs(0, "a", 'a');
}

Measured memory_bytes: 1536
#include<stdio.h>
int main()
{
	int n, s, tmp;

	s = 0;

	scanf("%d", &n);

	tmp = n;

	for (; tmp >= 1; tmp /= 10)
		s += (tmp % 10);

	if ((n % s) == 0)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 128