akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
struct edge{int from,to,cost;};
signed main(){
  int a,b;
  cin>>a>>b;
  rep1(i,100000){
  double d=i;
    double e=i*0.08;
    double f=i*0.1;
    if(floor(e)==a&&floor(f)==b){
      cout<<i<<endl;
        return 0;
        }
  }
  cout<<-1;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i=0; i < N; i++) {
      cin >> vec.at(i);
  }
  int ans=0;
  float MIN = INFINITY;
  for (int i=0; i < N; i++) {
      if (vec.at(i) <= MIN) {
          ans++;
          MIN = vec.at(i);
      } 
  }
  cout << ans << endl;
}

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

int f(string s){
     int n=s.size();
     if(n==0) return 0;

     int ans=0;
     int cnt=0;
     for(int i=n-1;i>=0;i--){
          if(s[i]=='A')ans+=cnt;
          else cnt++;
     }
     return ans;
}

int32_t main(){
     string s;
     cin>>s;

     int n=s.size();
    int ans=0;
     string ns="";
     for(int i=0;i<n;i++){
          if(s[i]=='A')ns+=s[i];
          else if(i+1<n and s[i]=='B' and s[i+1]=='C'){
               ns+='X';
               i++;
          }
          else{
               ans+=f(ns);
               ns="";
          }
     }
     ans+=f(ns);
     cout<<ans;
}

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

using namespace std;
typedef long long ll;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
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<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  ll n,m;cin>>n>>m;
  ll sum=0;
  rep(i,0,m){
    ll a;cin>>a;
    sum+=a;
  }

  if(sum>n)out(-1);
  else out(n-sum);


  return 0;
}


Measured memory_bytes: 3636
n,x=map(int,input().split())
if x in [1,2*n-1]:print("No")
else:
  print("Yes")
  a=[i for i in range(1,2*n)]
  b=[]
  b.append(a.pop(x))
  b.append(a.pop(x-1))
  b.append(a.pop(x-2))
  for i in a[:n-2]+b+a[n-2:]:print(i)

Measured memory_bytes: 14652
///*****************************************************///
///*.......................Faiyaj Bin Amin............................*///
///*...................................................................*///
///*.........................KUET CSE 2K17......................*///
///*...................................................*///
///*****************************************************///

#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define fastio      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define ret return
#define rep(q, i, n) for(int q=i; q<n; q++)
#define forn(i, n) for(int i=0; i<n; i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define ll long long
#define pb push_back
#define em emplace_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define ff first
#define ss second
#define pii pair<int,int>
#define pdd pair<double, double>

#define see(x)        cerr<< __LINE__ << ": " << (#x) << " is "<< (x) <<'\n';
#define seecontent(v) for(auto x : v) { cout << x << " ";} cout << "\n\n";

#define PI 2*acos(0.0)
#define lcm(a, b)  ((a / __gcd(a, b) ) * b)

#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)

#define mx 100005
#define INF 1e18
#define MOD 1000000007
#define MIN 0

//template <typename T>  using orderedSet =
//    tree<T, null_type, less_equal<T>,
//    rb_tree_tag, tree_order_statistics_node_update>; //find_by_order, order_of_key


/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0}; // Directional
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

/**------------------------------------BITMASK------------------------------------------**/
//int Change(int N, int pos){return N= N^(1<<pos);}
//bool Check(int N, int pos){return (bool)(N &(1<<pos));}  /// check bit 0 or 1
/**-----------------------------------------------------------------------------------------------**/

//using namespace __gnu_pbds;
using namespace std;

int main()
{
////    fastio;


    ll w,h,x,y;

    cin >>w>>h>>x>>y;

    double l = (w*h)/2.0;
    printf("%lf ", l);
    if(w%2==0 && h%2==0)
    {
        if(x==w/2 && y==h/2)
        {
            cout << "1\n";
        }
        else
            cout << "0\n";
    }
    else
        cout << "0\n";
    return 0;
}

Measured memory_bytes: 3756
#!/usr/bin/env python3

import collections
import sys
input=sys.stdin.readline

h,w,m=map(int,input().split())
items=set()
count_h=[0]*(h+1)
count_w=[0]*(w+1)
for _ in range(m):
    y,x=map(int,input().split())
    items.add((y,x))
    count_h[y]+=1
    count_w[x]+=1
max_h=max(count_h)
max_w=max(count_w)
cand_h=[]
cand_w=[]
for y in range(1,h+1):
  if count_h[y]==max_h:
    cand_h.append(y)
for x in range(1,w+1):
  if count_w[x]==max_w:
    cand_w.append(x)
ans=max_h+max_w
for y in cand_h:
  for x in cand_w:
    if (y,x) not in items:
      print(ans)
      exit()
else:
  print(ans-1)

Measured memory_bytes: 163744
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define ep emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n, d, x; cin >> n >> d >> x;
  int ans = 0;

  rep(i, n) {
    int a; cin >> a;
    ans += (d + a - 1) / a;
  }

  cout << ans + x << endl;

  return (0);
}


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

int main(){
  int64_t N,A0,M;
  cin >> N >> A0 >> M;

  unordered_map<int64_t, int> data;
  vector<int64_t> cumsum;
  int64_t cs= 0;
  cumsum.emplace_back(cs);

  int64_t Ai= A0 % M;
  int cnt= 1;
  while(!data.count(Ai)){
    data[Ai]= cnt;
    cs+= Ai;
    cumsum.emplace_back(cs);

    Ai= (Ai* Ai) % M;
    cnt++;
  }
  int s_loop= data.at(Ai); 
  int len_cycle= int(cumsum.size())- s_loop;
  int64_t Nloop= (N- (s_loop-1))/ len_cycle;
  int64_t Nrem = (N- (s_loop-1))% len_cycle;

  int64_t sum_cycle= cumsum.back()- cumsum.at(s_loop-1);
  int64_t sum_remain= cumsum.at(s_loop+ Nrem-1)- cumsum.at(s_loop-1);

  int64_t ans= (N < int(cumsum.size())) ? cumsum.at(N)
                                        : cumsum.at(s_loop-1)+ Nloop* sum_cycle+ sum_remain;
  
  cout << ans << endl;
}

Measured memory_bytes: 5604
#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;
#define rep(i, n) for(long i = 0; i < (n); i++)

using Graph = vector<vector<long>>;

Graph to;
vector<long> ans;

int dfs(long v, long p = -1) {
    for (long u : to[v]) {
        if (u == p) continue;
        ans[u] += ans[v];
        dfs(u, v);
    }
    return 0;
}

int main(void) {
    long n, q;
    cin >> n >> q;
    to = Graph(n);
    rep(i, n - 1) {
        long a, b;
        cin >> a >> b;
        a--, b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    ans.resize(n, 0);
    rep(i, q) {
        int p, x;
        cin >> p >> x;
        p--;
        ans[p] += x;
    }

    dfs(0);

    rep(i, n) {
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double EPS = 1e-8, INF = 1e12, PI = acos(-1.0);
typedef complex<double> P;
namespace std{
	bool operator<(const P& a, const P& b){
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
inline double cross(const P& a, const P& b){ return imag(conj(a)*b); }
inline double dot(const P& a, const P& b){ return real(conj(a)*b); }
struct L : public vector<P>{
	L(const P &a, const P &b) {
		push_back(a); push_back(b);
	}
};
typedef vector<P> G;
inline int ccw(P a, P b, P c) {
	b -= a; c -= a;
	if(cross(b, c) > EPS)   return +1;		// counter clockwise
	if(cross(b, c) <-EPS)   return -1;		// clockwise
	if(dot(b, c)   < EPS)     return +2;		// c--a--b on line
	if(norm(b)+EPS < norm(c)) return -2;		// a--b--c on line
	return 0;
}
bool intersectSP(const L &s, const P &p) {
	return ccw(p, s[0], s[1]) == 2;
	//return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}
P projection(const L &l, const P &p) {
  double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
  return l[0] + t*(l[0]-l[1]);
}
double distanceSP(const L &s, const P &p) {
  const P r = projection(s, p);
  if (intersectSP(s, r)) return abs(r - p);
  return min(abs(s[0] - p), abs(s[1] - p));
}


int n, m, x, y, p[5001], q[5001];
bool use[5001];
double dist[5001], dd[5001][5001];

int main(){
	G g;
	cin >> n >> m >> x >> y; g.pb(P(x, y));
	rep(i, n){
		cin >> p[i] >> q[i];
		g.pb(P(p[i], q[i]));
	}
	n++;
	rep(i, n) rep(j, i) dd[i][j] = dd[j][i] = abs(g[i] - g[j]);
	
	double ans = 0;
	rep(i, n) dist[i] = dd[0][i];
	use[0] = 1;
	
	rep(it, m){
		double mn = INF; int mni;
		rep(i, n) if(!use[i]){
			if(dist[i] + EPS < mn){ mn = dist[i], mni = i; }
		}
		double mn2 = INF; int mni2;
		rep(i, n) if(use[i]){
			double d = dd[mni][i];
			if(d + EPS < mn2){ mn2 = d, mni2 = i; }
		}
		
		use[mni] = 1;
		rep(i, n) if(!use[i]){
			double d = distanceSP(L(g[mni], g[mni2]), g[i]);
			dist[i] = min(dist[i], d);
		}
		ans += dd[mni][mni2];
		/*
		cerr<<"taberu: "<<mni<<" from: "<<mni2<<endl;
		dbg(mn);*/
	}
	printf("%.9f\n", ans);
	
	return 0;
}

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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define MOD 1000000007
typedef pair<li, li> PI;

li p[200200];

int main(void) {
	li n;
	cin >> n;
	rep(i, n) {
		cin >> p[i];
	}

	li mi = n * 2;
	li res = 0;
	rep(i, n) {
		if (mi > p[i]) {
			res++;
		}
		mi = min(mi, p[i]);
	}
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <fstream>

using namespace std;

//方針 S で0,1 が隣り合っていたら、削除、を繰り返す

int main(){

//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());
    string S;
    int res = 0;

    cin >> S;

    int zeroCnt = 0;
    int ichiCnt = 0;

    for(auto c: S)
    {
        if(c == '0')zeroCnt++;
    }

    ichiCnt = S.size() - zeroCnt;

    res = min(zeroCnt,ichiCnt) * 2;

    cout << res << endl;
}


Measured memory_bytes: 512
import java.util.Arrays;
import java.util.Scanner;
public class Main{
	public static void main(String[]args) {
		Scanner sc=new Scanner(System.in);
		int []array=new int[2];
		int c=0;
		long sum=0;
		int max=0;
		for(int i=0;i<2;i++) {
			array[i]=sc.nextInt();
		}
		int []arr=new int[array[0]];
		for(int i=0;i<array[0];i++) {
			arr[i]=sc.nextInt();
			if(arr[i]>max)
				max=arr[i];
		}
		Arrays.sort(arr);
		if(array[1]>=array[0])
			System.out.println(0);
		else {
			c=array[0]-array[1];
		    for(int i=0;i<c;i++) {
			   sum=sum+arr[i];
		}
		   System.out.println(sum);  
		}
	}
	
}

Measured memory_bytes: 64516
#include<stdio.h>
  int LS(int A[],int n,int key){
    int i=0;
    A[n]=key;
    while(A[i]!=key){
      i++;
    }
    return i!=n;
  }
  int main(){
    int i,n,q,key,sum=0;
    int A[10000];
    scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf("%d",&A[i]);
    }
    scanf("%d",&q);
    for(i=0;i<q;i++){
      scanf("%d",&key);
      if (LS(A,n,key)==1){
        sum++;
      }
    }
    printf("%d\n",sum);
    return 0;
  }



Measured memory_bytes: 2108
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
inp = sys.stdin.buffer.readline
def inpS(): return inp().rstrip().decode()
readlines = sys.stdin.buffer.readlines 

N, M, K = map(int, inp().split())
friends = [set() for _ in range(N+1)]
blocked = [set() for _ in range(N+1)]

for _ in range(M):
  a, b = map(int, inp().split())
  friends[a].add(b)
  friends[b].add(a)
for _ in range(K):
  c, d = map(int, inp().split())
  blocked[c].add(d)
  blocked[d].add(c)  

checked = set()
ans = [0]*(N+1)
for i in range(1, N+1):
  if i in checked:
    continue
  chain = set()
  
  stack = list(friends[i])
  while stack:
    friend = stack.pop()
    if friend in checked:
      continue
      
    checked.add(friend)
    chain.add(friend)
    stack.extend(friends[friend])
  cnt = len(chain) - 1 # 自分を引く
  for c in chain:
    ans[c] += cnt - len(chain & (friends[c] | blocked[c]))
    
print(*ans[1:])    
    
  

Measured memory_bytes: 87716
# coding=UTF-8
from collections import deque
from collections import Counter
from operator import itemgetter
from bisect import bisect_left, bisect
from decimal import *
import itertools
import sys
import math
import numpy as np
import time
sys.setrecursionlimit(10**6)
input = sys.stdin.readline



def main():
    a = int(input())
    print(int(a+a**2+a**3))


if __name__ == '__main__':
    main()


Measured memory_bytes: 27152
fun main(args: Array<String>) {
    val btc = 380000.0
    val N = readInputLine().toInt()
    
    var ans = 0.0
    
    for (i in 1..N) {
        val (x, u) = readInputLine().split(" ")
        
        if (u == "JPY") {
            ans += x.toInt()
        } else {
            ans += x.toDouble() * btc
        }
    }
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 37808
using System;
using System.Linq;
using static System.Console;
class Atcoder{
    public static void Main(){
        var raw = ReadLine().Split().Select(int.Parse).ToArray();
        var n = raw[0];
        var a = raw[1];
        var b = raw[2];
        WriteLine(Math.Min(a*n,b));
    }
}

Measured memory_bytes: 11348
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define N 100000
#define INF 1000000000
using namespace std;

typedef long long ll;

int main()
{
    int n;
    int l[10] = {};
    cin >> n;
    FOR(i,0,n)
        cin >> l[i];
    int m = 0, sum = 0;
    FOR(i,0,n)
    {
        m = max(m,l[i]);
        sum += l[i];
    }

    if(sum-2*m>0)
        cout << "Yes\n";
    else
        cout << "No\n";
    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int N;
int A[200];
 
int main()
{
  int ans = 0;
  cin >> N;
  for(int i=0;i<N;++i) cin >> A[i];
  for(int i=0;i<N;++i)for(int j=0;j<N;++j) ans=max(ans,abs(A[i]-A[j]));
  cout << ans << endl;
}

Measured memory_bytes: 256
import collections

n = int(input())
v = list(map(int, input().split()))
v1 = []
v2 = []
ans = 0

for i in range(n):
    if i % 2 == 0:
        v1.append(v[i])
    else:
        v2.append(v[i])

c1 = collections.Counter(v1)
mostChar1, mostCount1 = c1.most_common()[0]
#ndChar1, ndCount1 = c1.most_common()[1]

c2 = collections.Counter(v2)
mostChar2, mostCount2 = c2.most_common()[0]
#ndChar2, ndCount2 = c2.most_common()[1]

if mostChar1 == mostChar2:
    if len(c1.most_common()) == 1 and len(c1.most_common()) == 1:
        ans = n // 2
    elif len(c1.most_common()) == 1:
        ndChar2, ndCount2 = c2.most_common()[1]
        ans = n - mostCount1 - ndCount2
    elif len(c2.most_common()) == 1:
        ndChar1, ndCount1 = c1.most_common()[1]
        ans = n - mostCount2 - ndCount1
    else:
        ndChar1, ndCount1 = c1.most_common()[1]
        ndChar2, ndCount2 = c2.most_common()[1]
        temp1 = n - mostCount1 - ndCount2
        temp2 = n - mostCount2 - ndCount1
        ans = min(temp1, temp2)
else:
    ans = n - mostCount1 - mostCount2

print(ans)



Measured memory_bytes: 80516
using System;

public class Test
{
	public static void Main()
	{
		// your code goes here
		string[] s = Console.ReadLine().Split(' ');
		long[] n = new long[s.Length];
		for(int i = 0; i < s.Length; i++) {
			n[i] = long.Parse(s[i]);
		}
		
		var a = n[0];
		var b = n[1];
		decimal f = a / (decimal)b;
		
		Console.WriteLine(string.Format("{0} {1} {2:f6}", a/b, a%b, f));
	}
}

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

using namespace std;

int main()
{
  int N, T, L, B;
  while(cin >> N >> T >> L >> B, N || T || L || B){
    int mas[101] = {0};
    for(int i = 0; i < L; i++){
      int l; cin >> l;
      mas[l] = 1;
    }
    for(int i = 0; i < B; i++){
      int b; cin >> b;
      mas[b] = 2;
    }
    double dp[111][111];
    fill(dp[0], dp[111], 0.0);
    dp[0][0] = 1.0;
    for(int i = 0; i < T; i++){
      for(int j = 0; j < N; j++){
	if(dp[i][j] == 0.0) continue;
	for(int k = 1; k <= 6; k++){
	  int x = j + k;
	  if(x > N) x = N - (x - N);
	  if(mas[x] == 1) dp[i + 2][x] += dp[i][j] * (1.0/6.0);
	  else if(mas[x] == 2) dp[i + 1][0] += dp[i][j] * (1.0/6.0);
	  else dp[i + 1][x] += dp[i][j] * (1.0/6.0);
	}
      }
    }
    double ans = 0.0;
    for(int i = 0; i <= T; i++) ans += dp[i][N];
    printf("%.10f\n", ans);
  }
  return 0;
}

Measured memory_bytes: 1284
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdint>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <sys/timeb.h>
#include <vector>
using namespace std;

const string YES = "Yes";
const string NO = "No";

void solve(std::string S)
{
    if (S[2] == S[3] && S[4] == S[5])
        cout << YES << endl;
    else
        cout << NO << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cassert>
#include<climits>
#include<cstdio>
#include<iomanip>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define MAX 500

using namespace std;

double C[MAX][MAX];
 
void makeC()
{
  C[0][0] = 1;
  rep(i,MAX-1)rep(j,i+1)
    {
      C[i+1][j] += C[i][j];
      if(j+1<MAX)C[i+1][j+1] += C[i][j];
    }
}


int N,M;
double L;


int main(){

  makeC();

  cin >> N >> M >> L;
  vector<double> P(N),T(N),V(N),PB[N],TM[N];

  //cout << "C[" << M << "][" << 0 << "] = " << C[M][0] << endl;

  rep(i,N){
    cin >> P[i] >> T[i] >> V[i];
    double p = P[i] / 100.0;
    rep(j,M+1){
      TM[i].push_back( L / V[i] + j * T[i] );
      PB[i].push_back( C[M][j] * pow(p,j) * pow(1-p,M-j) );
    }
  }

  rep(sp,N){
    double ans = 0;
    rep(i,TM[sp].size()){
      double cost = 1;
      rep(gp,N){
	double cost2 = 0;
	if(sp == gp)continue;
	rep(j,TM[gp].size()){
	  if(TM[sp][i] >= TM[gp][j]){
	    cost2 += PB[gp][j];
	  } else break;
	}
	cost *= ( 1 - cost2 );
      }
      ans += cost * PB[sp][i];
    }
    printf("%.10f\n",ans);
  }

  return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
typedef long long ll;
char s[N];
ll dp[N][2];
int main()
{
    scanf("%s",s+1);
    int n=strlen(s+1);
    dp[0][1]=1000;
    for(int i=1;i<=n;i++)
    {
        int x=s[i]-'0';
        dp[i][0]=dp[i-1][0]+min(x,10-x+1);
        dp[i][0]=min(dp[i][0],dp[i-1][1]+10-x);
        dp[i][1]=min(dp[i-1][0]+10-x,dp[i-1][1]+10-x-1);
    }
    printf("%lld\n",min(dp[n][0],dp[n][1]+1));
}


Measured memory_bytes: 16896
package main

import (
	"fmt"
	"math"
)

func main() {
	var N,K int

	fmt.Scan(&N)
	fmt.Scan(&K)
	

	if 1.0 <= math.Abs(float64(N % K)) {
		fmt.Println(1)
	}else{
		fmt.Println(0)
	}
	
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define INF 0X3f3f3f3f
#define ll long long
#define eps 1e-8
using namespace std;
typedef pair<ll,ll> node;
const ll maxn = 1e6 + 5;
const ll mod = 1e9 + 7;
ll n,a,b,m,t;
int main()
{
    cin >> a >> b;
    if(a >= 10)
        cout << b << endl;
    else
        cout << b + (100 * (10 - a)) <<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int cmp(const void *a,const void *b)
{
	return *(int *)a-*(int *)b;
}
int main()
{
	int n,c,k,t[100005],i,sum=0,ans=0;
	long long int x=0;
	scanf("%d%d%d",&n,&c,&k);
	for(i=0;i<n;i++)
	scanf("%d",&t[i]);
	qsort(t,n,sizeof(t[0]),cmp);
	x=t[0]+k;
	ans++;
	for(i=0;i<n;i++)
	{
		if(x>=t[i]&&sum<c)sum++;
		else{
			ans++;
			x=t[i]+k;
			sum=1;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 892
<?php
fscanf(STDIN, "%d", $n);
$nmbr = [];
$cnt = 0;

while($n--){
    fscanf(STDIN, "%d", $v);
    $nmbr[$v] = array_key_exists($v, $nmbr) ? ++$nmbr[$v] : 1;
}
foreach($nmbr as $v) $cnt = $v % 2 ? ++$cnt : $cnt;

print $cnt;

Measured memory_bytes: 13048
import sys
N1 = int(input())
temp = N1 -1
temp = list(map(int,list(str(temp))))
N2 = list(map(int,list(str(N1))))
# print(N2)
# print(temp)
if len(temp) != len(N2):
    print(sum(temp))
    sys.exit()
else:
    count = 0
    for i in range(1,len(N2)):
        if N2[i] == 9:
            count +=1
    if count == len(N2)-1:
        print(sum(N2)) 
        sys.exit()
    else:
        N2[0] = N2[0]-1
        for i in range(1,len(N2)):
            N2[i] = 9
        print(sum(N2))
        sys.exit()

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

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

int main(){
    string S;
    cin >> S;

    int cnt = 0, ans = 0;
    for (int i = 0; i < 3; i++) {
        if (S.at(i) == 'R') cnt++;
        if (S.at(i) == 'S') cnt = 0;
        ans = max(ans, cnt);
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
import sys
import os

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B, C = list(map(int, sys.stdin.buffer.readline().decode().split()))
    print(C if A == B else A if B == C else B)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
n,k=map(int,input().split())
arr=list(map(int,input().split()))
m=max(arr)
if(k==0):
	print(m)
else:
	low=1
	high=m
	while(low<=high):
		mid=low+(high-low)//2
		if(mid==1):
			print(mid)
			break
		count=0
		count2=0
		for i in range(n):
			count+=(arr[i]-1)//mid
			count2+=(arr[i]-1)//(mid-1)
		if(count<=k and count2>k):
			print(mid)
			break
		elif(count<k or (count<=k and count2<=k+1)):
			high=mid-1
		else:
			low=mid+1

Measured memory_bytes: 93824
import java.util.*;
fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val L = sc.nextLong()
    val R = sc.nextLong()
    
    if(R-L>2019){
        println(0);
    }
    else{
    	var ans:Long=2000000000000000000
        for(i in L..R){
            for(j in i+1..R){
                var tmp:Long=i*j
                ans=Math.min(tmp%2019,ans)
            }
        }
        println(ans)
    }
}

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

using namespace std;
int gcd(int a,int b)
{
    int r;
    while(b>0)
    {
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}

int main()
{
    int k;
    cin>>k;
    int y=gcd(360,k);
    cout<<360/y<<endl;

    return 0;
}


Measured memory_bytes: 3568
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll smaller = 1e18;
    ll a[5]; rep(i, 5) {cin >> a[i]; smaller = min(smaller, a[i]);}
    ll ans = 5;
    n -= smaller;
    if (n <= 0) {
        cout << ans << endl;
        return 0;
    }
    if (n % smaller == 0) ans += n / smaller;
    else ans += n / smaller + 1;
    cout << ans << endl;
    
}




Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000
void CountingSort(short unsigned int *,short unsigned  int*, int);
int n;
int main(){
  unsigned short *A, *B;
  int  i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);
  for(i=1;i<=n;i++)
    scanf("%d",&A[i]);
  
  CountingSort(A,B,VMAX);
  
  free(A);
  free(B);
  return 0;
}

void CountingSort(short unsigned int *A,short unsigned int*B, int k){
  int C[VMAX+1],i,j;
  for(i=0;i<=k;i++)C[i]=0;

  for(j=1;j<=n;j++)C[A[j]]++;

  
  for(i=1;i<=k;i++)
    C[i]=C[i]+C[i-1];
  
  for(j=n;j>=1;j--){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  
  for(i=1;i<=n;i++){
    if(i>1)printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
  


}



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

if B - A <= 2:
    print(K+1)
else:
    m = max(0, (K-A+1)//2)
    # print(m, B-A)
    ans = m * (B-A) + K - m * 2 + 1
    print(ans)


Measured memory_bytes: 2940
//https://atcoder.jp/contests/abc121/tasks/abc121_b

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <bitset>


using namespace std;
int main(){
	int s,i,answer;
	cin>>s;	
	answer=0;
	i=1;

	vector<int> list(1);
	list.at(0)=s;

	while(answer==0){
		if(list.at(i-1)%2==0) list.push_back(list.at(i-1)/2);
		else list.push_back(1+3*list.at(i-1));

		for(int j=0; j<i; j++){
			if(list.at(j)==list.at(i)) answer=i+1;
		}
		i++;
	}

	cout<<answer<<endl;

}





Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define deb(x) cout << #x << " = "<< x << "\n";
#define mod 1000000007
#define N 21

int n;
int a[N][N];
int dp[(1<<N)];
int allmask;

int solve(int mask)
{
	if(mask == allmask)
		return 1;
	int &res = dp[mask];
	if(res != -1)
		return res;
	res = 0;
	int idx = __builtin_popcount(mask);
	for(int i = 0; i < n; i++)
	{
		if(mask & (1<<i)) continue;
		if(a[idx][i] == 0) continue;
		res += solve(mask | (1<<i));
		if(res >= mod)
			res -= mod;
	}
	return res;
		
}

signed main()
{
	//freopen("in.txt", "r",stdin);
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	cin >> n;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < n; j++)
			cin >> a[i][j];
	
	allmask = (1<<n) - 1;
	memset(dp, -1, sizeof(dp));
	
	int ans = solve(0);
	
	cout << ans << "\n";

}


Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
bool cmp(long long int x,long long int y)
{
   return x>y;
}
int main(void)
{
   long long int t,d,k,l,r,ans=0;
   vector<long long int> v,v1,v2;
   vector< pair <long long int,long long int> >p,p1,p2;
   set<long long int> st;
   priority_queue<long long int> pq;
   priority_queue< long long int,vector<long long int>,greater<long long int> > lpq;
   priority_queue< pair<long long int,long long int>,vector< pair<long long int,long long int> >,greater< pair <long long int,long long int> > > plpq;
   string s;
      cin>>l>>r>>d;
      for(long long int i=l;i<=r;i++)
      {
         if(i%d==0)
            ans++;
      }
      cout<<ans<<endl;
   return 0;
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int h,w,m; cin >> h >> w >> m;
  int br[300001];
  int bc[300001];
  int cntr[300001] = {};
  int cntc[300001] = {};
  int maxr=0,maxc=0;
  for(int i = 0; i < m; ++i){
    cin >> br[i] >> bc[i];
    ChangeMax(maxr,++cntr[br[i]]);
    ChangeMax(maxc,++cntc[bc[i]]);    
  }
  bitset<300001>r,c;
  int cr=0,cc=0;
  // for(int i = max(h,w); i >= 1; --i){
    
  // }
  for(int i = 1; i <= h; ++i)if(maxr == cntr[i])cr+=r[i] = 1;
  for(int i = 1; i <= w; ++i)if(maxc == cntc[i])cc+=c[i] = 1;
  int cntd = 0;
  for(int i = 0; i < m; ++i)
    cntd += r[br[i]]&c[bc[i]];
  cout << maxr + maxc - (cntd == cr*cc) << endl;
}


Measured memory_bytes: 8428
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;


int main(){
  ll n; cin >> n; ll sum = 0;
  vl a(n); vl b(n); vl c(n);
  rep(i,n){
    ll x; cin >> x;
    a.at(i) = x;
  }
  rep(i,n){
    ll x; cin >> x;
    b.at(i) = x;
  }
  rep(i,n){
    ll x; cin >> x;
    c.at(i) = x;
  }
  
  rep(i,n) sum += b.at(i);
    
  rep(i,n-1){
    if(a.at(i) == a.at(i+1)-1){
      sum += c.at(a.at(i)-1);
    }
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 256
# your code goes here

string = input()
N = int(input())

alpha = list(string)
soeji = 0
ans = []
length = len(alpha)
while len(ans) < N:
	fst = sorted(alpha)[soeji]
	indexes = [i for i, x in enumerate(string) if x == fst]
	for i in indexes:
		for j in range(N):
			if i+j+1 < length+1: 
				ans.append(''.join(alpha[i:i+j+1]))
				ans = list(set(ans))
	soeji += 1
print(sorted(ans)[N-1])

Measured memory_bytes: 3188
S = input()
n = len(S)
def kaibun(S):
    if S == S[::-1]:
        return 1
    else:
        return 0
if kaibun(S) == 0:
    print("No")
else:
    s1 = S[0:n // 2]
    if kaibun(s1) == 1:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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 (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  vector<ll> p(n);
  ll sum=0;
  rep(i,n){
    cin>>p[i];
    sum+=p[i];
  }

  vector<ll> ans(n);
  ans[0]=sum;
  rep(i,n){
    if(i%2==1) ans[0]-=2*p[i];
  }  
  p[0]-=ans[0]/2;

  repo(i,n){
    ans[i]=2*p[i-1];
    p[i]-=ans[i]/2;
  }

  rep(i,n){
    cout << ans[i];
    if(i!=n-1) cout << " ";
    if(i==n-1) cout << endl;
  }

}

Measured memory_bytes: 2944
h,w = map(int,input().split())
L =["b"*(w+2)] + ["b"+ input() + "b" for i in range(h)] + ["b"*(w+2)]
ans = "ahe"
for i in range(1,h+1):
    for j in range(1,w+1):
        if L[i][j]=="#" and (L[i+1][j]!="#" and L[i-1][j]!="#" and L[i][j+1]!="#" and L[i][j-1]!="#"):
            ans="No"
if ans!="No":
    ans="Yes"
print(ans)

Measured memory_bytes: 3064
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String n = scanner.nextLine();
        if (n.charAt(1) == n.charAt(2) && (n.charAt(1) == n.charAt(0) || n.charAt(1) == n.charAt(3))) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define SZ(n) (int)(n).size()
#define ALL(n) (n).begin(), (n).end()
using namespace std;
typedef long long ll;
typedef vector<int> VI;

int main() {
	int x, a, b;
	cin >> x >> a >> b;
	if(abs(x - a) > abs(x - b)) cout << "B" << endl;
	else cout << "A" << endl;
	return 0;
}

Measured memory_bytes: 256
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}




signed main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int c = count(s.begin(), s.end(), 'R');
    cout << count(s.begin(), next(s.begin(), c), 'W') << endl;
    return 0;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#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 pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const ll MOD = 1e9 + 7;

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1}; 

int solve(int xs, int ys, vector<string>& mz) {
    queue<pair<int, int>> st;
    int h = mz.size(); 
    int w = mz[0].size();
    vector<vector<int>> dp(h, vector<int>(w, -1));
    st.emplace(xs, ys);
    dp[xs][ys] = 0;
    int ans = 0;
    while (!st.empty()) {
        auto p = st.front(); st.pop();
        int x = p.first, y = p.second; 
        //cout << x << "," << y << endl;
        //cout << "***" << endl;
        rep(l, 4) {
            int nx = x + dx[l], ny = y + dy[l];
            //cout << nx << "," << ny << endl;
            if (0 <= nx && nx < h && 0 <= ny && ny < w 
                && mz[nx][ny] == '.' && dp[nx][ny] == -1) {
                    st.emplace(nx, ny);
                    dp[nx][ny] = dp[x][y] + 1;
                    ans = max(ans, dp[nx][ny]);
                }
        } 
    }
    /*
    rep(i, h) {
        rep(j, w) cout << dp[i][j] << ":";
        cout << endl;
    }
    cout << endl;
    */
    return ans;
}

int main() {
    int h,w; 
    cin >> h >> w;
    vector<string> mz(h);
    rep(i, h) cin >> mz[i]; 
    int ans = 0;
    rep(i, h) {
        rep(j, w) {
            if (mz[i][j] == '#') continue;
            ans = max(ans, solve(i, j, mz));
        }
    } 
    cout << ans << endl;
    return 0;
}

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

int main(void) {
    int64_t N, h, n, a, b;
    bool ffound = false;

    cin>>N;

    for (h = N/3; h <= 3500; h++) {
        for (n = h; n <= 3500; n++) {
            a = 4 * h * n - N * (n + h);
            b = N * h * n;
            if ( a > 0 && b % a == 0 ) {
                cout<<h<<" "<<n<<" "<<(b/a)<<endl;
                ffound = true;
                break;
            }
        }
        if (ffound == true)
            break;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main() {
  vector<int> vec(5);
  for (auto &v : vec)
    cin >> v;
  int k;
  cin >> k;
  bool flag = true;
  for (auto &v1 : vec)
    for (auto &v2 : vec)
      if (k < abs(v1 - v2))
        flag = false;
  cout << (flag ? "Yay!" : ":(") << endl;
}

Measured memory_bytes: 3508
#include<algorithm>
#include<cstdio>
#include<cstring>

const int Maxv = 5005, INF = 0x6ffffff, MOD = 1e9 + 7; 
long long dp[Maxv][Maxv]; 
char c[Maxv]; 

inline int read(){
    int x = 0, f = 1; 
    char ch = getchar(); 
    while (ch < '0' || ch > '9') {
        if (ch == '-') {
            f = -1; 
        }
        ch = getchar(); 
    }
    while (ch >= '0' && ch <= '9') {
        x = (x << 3) + (x << 1) + ch - '0'; 
        ch = getchar(); 
    }
    return x * f; 
}

int main(){
    int n = read(); 
    scanf("%s", c + 1); 
    int len = strlen(c + 1); 
    if (n < len) {
        printf("0\n"); 
        return 0; 
    }
    memset(dp, 0, sizeof(dp)); 
    dp[0][0] = 1; 
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            if (j) {
                dp[i][j - 1] = (dp[i][j - 1] + dp[i - 1][j]) % MOD; 
            }
            else {
                dp[i][j] = (dp[i][j] + dp[i - 1][j]) % MOD; 
            }
            dp[i][j + 1] = (dp[i][j + 1] + dp[i - 1][j] * 2) % MOD; 
        }
    }
    for (int i = 1; i <= len; i++) {
        dp[n][len] = (dp[n][len] * 500000004) % MOD; 
    }
    printf("%d\n", dp[n][len]); 
    return 0; 
}

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

// 小数点以下桁数
// fixed << setprecision(i)

int64_t gcd(int64_t a,int64_t b){return (a%b==0?b:gcd(b, a%b));}
int64_t lcm(int a,int b){return (int64_t)a*b/gcd(a, b);}
int factorial(int a){int b=1;while(a){b*=a--;}return b;} //13以下対応
bool is_prime(int a){if(a<=1)return false;for(int i=2;(int64_t)i*i<=a;i++){if(a%i==0)return false;}return true;}
int get_adp(double x, int n){return (int)round((x-(int)x)*pow(10,n))%10;} // 小数点以下の指定桁の値を取得
int64_t sigma(int64_t s, int64_t n){return n*(2*s+n-1)/2;}

//順列の全列挙
// vector<int> v(N);
// iota(v.begin(), v.end(), 1);       // v に 1, 2, ... N を設定
// do {
//	for(auto x : v) cout << x << " "; cout << "\n";     // v の要素を表示
// } while( next_permutation(v.begin(), v.end()) ); 

//bit全探索
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//	bitset<ビット数> s(tmp);
//	// (ビット列sに対する処理)
// }

int main()
{
  string s, t;
  int ans;

  cin >> s >> t;
  for (int i = 0; i < s.size() - t.size() + 1; i++)
  {
    int temp = 0;
    for (int j = 0; j < t.size(); j++)
    {
      if (s[i + j] == t[j])
        temp++;
    }
    ans = max(ans, temp);
  }
  cout << t.size() - ans << endl;
}


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

int main() {
  long a, b;
  cin >> a >> b;
  long ans = 0;
  if (a % 2 == 1) {
    ans ^= a;
    a++;
  }
  if (b % 2 == 0) {
    ans ^= b;
    b--;
  }
  if (a < b) {
    ans ^= (b - a + 1) / 2 % 2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3132
using System;

namespace abc050A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int A = int.Parse(str[0]);
            string B = (str[1]);
            int C = int.Parse(str[2]);
            if (B == "+")
                Console.WriteLine(A + C);
            else
                Console.WriteLine(A - C);
        }
    }
}


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

int main(){
    ll n,k;
    ll mx = 0;
    cin >> n >> k;
    vector<ll> p(n);
    rep(i,n) cin >> p[i];
    rep(i,n) p[i]++;
    vector<ll> sum(n+1,0);
    rep(i,n) sum[i+1] = sum[i] + p[i];
    rep(i,n-k+1){
        ll s = sum[k+i] - sum[i];
        mx = max(s, mx);
    }
    double ans = mx;
  	ans /= 2;
    printf("%.12f\n",ans);
    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }


int main() {
	IOS;
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	ll m = LLONG_MAX;
	ll res = 0;
	REP(i, n) {
		cin >> a[i] >> b[i];
		if (a[i] > b[i]) {
			chmin(m, b[i]);
		}
		res += b[i];
	}
	if (m == LLONG_MAX) {
		put(0);
		return 0;
	}
	put(res - m);
	return 0;
}


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

char maze[52][52];
int visited[52][52];

bool is_in_field(int h, int w, pair<int,int> now){
    if(now.first < 0 || now.first >= h){return false;}
    if(now.second < 0 || now.second >= w){return false;}
    return true;
}

int bfs(int h, int w){
    queue<pair<int,int>> q;
    pair<int,int> start = {0,0};
    pair<int,int> goal = {h-1,w-1};
    pair<int,int> d[4] = {{1,0},{-1,0},{0,1},{0,-1}};
    q.push(start);
    visited[start.first][start.second] = 0;
    while(!q.empty()){
        pair<int,int> now = q.front();
        q.pop();
        if(now == goal){
            return visited[h-1][w-1];
        }

        for(int i = 0; i < 4; i++){
            pair<int,int> next = {now.first + d[i].first, now.second + d[i].second};
            if(is_in_field(h, w, next)){
                char state = maze[next.first][next.second];
                if(state == '.'){
                    if(visited[next.first][next.second] == -1){
                        q.push(next);
                        visited[next.first][next.second] = visited[now.first][now.second] + 1;
                    }
                }
            }
        }


    }

    return -1;
}

int main(){
    int h, w, cnt = 0;
    cin >> h >> w;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> maze[i][j];
            if(maze[i][j] == '.'){cnt++;}
            visited[i][j] = -1;
        }
    }
    int distance = 0;
    distance = bfs(h, w);
    if(distance == -1){cout << distance << endl;}
    else{cout << cnt - distance - 1 << endl;}

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>
#include <random>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  int n, m, a;
  while (cin >> n >> m >> a, n || m || a)
  {
    vector<pair<int, pair<int, int>>> v(m);
    for (auto &e : v)
      cin >> e.first >> e.second.first >> e.second.second;
    sort(v.begin(), v.end(), greater<pair<int, pair<int, int>>>());
    int ans = a;
    for (int i = 0; i < m; ++i)
    {
      if (ans == v[i].second.first)
        ans = v[i].second.second;
      else if (ans == v[i].second.second)
        ans = v[i].second.first;
    }
    cout << ans << endl;
  }

  return 0;
}



Measured memory_bytes: 3024
#include <iostream>
#include <vector>
#include <ios>
#include <iomanip>


int main() {
  using namespace std;
  int N, K;
  cin >> N >> K;

  long c1 = N / K;
  long c2 = K % 2 == 0 ? (N + K/2)/K : 0;

  cout << c1*c1*c1 + c2*c2*c2 << endl;
}

Measured memory_bytes: 3148
#include<iostream>
#include<vector>
using namespace std;
struct Point { long double px, py; };
Point Minus(Point a, Point b) { Point C; C.px = a.px - b.px; C.py = a.py - b.py; return C; }
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
int contain(vector<Point> v, Point p) {
	bool in = false;
	for (int i = 0; i < v.size(); ++i) {
		Point a = Minus(v[i], p), b = Minus(v[(i + 1) % v.size()], p);
		if (a.py > b.py) swap(a, b);
		if (a.py <= 0 && 0 < b.py)
			if (crs(a, b) < 0) in = !in;
		if (crs(a, b) == 0 && dot(a, b) <= 0) return 1;
	}
	return in ? 2 : 0;
}
int main() {
	vector<Point>vec;
	Point P;
	while (cin >> P.px >> P.py) {
		vec.clear();
		vec.push_back(P);
		for (int j = 0; j < 2; j++) { cin >> P.px >> P.py; vec.push_back(P); }
		cin >> P.px >> P.py;
		int v = contain(vec, P);
		if (v == 2) { cout << "YES" << endl; }
		else { cout << "NO" << endl; }
	}
}

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

int main()
{
  int a, b;
  cin >> a >> b;
  int b_size = 1;
  int bb = b;
  while (bb != 0) {
    b_size *= 10;
    bb /= 10;
  }
  int num = (a * b_size) + b;

  for (int i = 1; i <= 317; i++) {
    if (i * i == num) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256