akhauriyash/Code-Regression huggingface dataset:
def permutation(lst):
    if len(lst) == 0:
        return []
    if len(lst) == 1:
        return [lst]
    res = []
    for i in range(len(lst)):
       m = lst[i]
       remLst = lst[:i] + lst[i+1:]
       for p in permutation(remLst):
           res.append([m] + p)
    return res

dist = lambda x1, y1, x2, y2 : ((x1-x2)**2 + (y1-y2)**2)**.5
n = int(input())
d = [[0] * n for _ in range(n)]
pnts = []
for _ in range(n):
	x, y = map(int, input().split())
	pnts.append((x, y))
for i in range(n):
	for j in range(n):
		d[i][j] = d[j][i] = dist(pnts[i][0], pnts[i][1], pnts[j][0], pnts[j][1])
paths = permutation(list(range(n)))
res = 0
for path in paths:
    for j in range(n-1):
        res += d[path[j]][path[j+1]]
print(round(res/len(paths), 6))

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

typedef long long ll;

void solve() {
	int n, k;
	cin >> n >> k;
	vector<int> x(n);
	for (int i = 0; i < n; ++i) cin >> x[i];
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		ans += min(2 * abs(x[i] - 0), 2 * abs(k - x[i]));
	}
	cout << ans;
}


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

	int tt = 1;
	// cin >> tt;
	for (int i = 1; i <= tt; ++i) {
		// cout << "Case #" << i << ": ";
		solve();
	}

	return 0;
}


Measured memory_bytes: 3652
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=100005;
struct line{int A,B,val;}w[MAXN];
bool cmp(line n1,line n2){return n1.val>n2.val;}
int n;LL pre[MAXN],S,mn1[MAXN],mn2[MAXN];
LL getval(int a,int b){return a<b?pre[a]:pre[a]-w[b].val;}
LL gcd(LL a,LL b){return a==0?b:gcd(b%a,a);}
int main()
{
//	freopen("01-10.txt","r",stdin);
	n=read();
	for(int i=1;i<=n;i++)w[i].A=read(),w[i].B=read(),w[i].val=max(w[i].A,w[i].B),S+=w[i].A;
	sort(w+1,w+1+n,cmp);
	for(int i=1;i<=n;i++)pre[i]=pre[i-1]+w[i].val;
	LL ansx=0,ansy=1;
	for(int i=1;i<=n;i++)
	{
		int l=1,r=n,ps=-1;
		while(l<=r)
		{
			int mid=(l+r)/2;
			if(getval(mid,i)>=S)r=mid-1;
			else if(getval(mid,i)+w[i].B<S)l=mid+1;
			else {ps=mid;r=mid-1;}
		}if(ps==-1)continue;
		int id=i;LL S2=getval(ps,i)+w[i].B-S;
		LL nowx=n-ps-(ps<i),nowy=1;
		LL fx=S2,fy=w[id].B;LL d=gcd(fx,fy);fx/=d;fy/=d;
		nowy=fy;nowx=fx+fy*nowx;d=gcd(nowx,nowy);nowx/=d;nowy/=d;
		if(1.0*ansx*nowy<=1.0*ansy*nowx)ansx=nowx,ansy=nowy;
	}
	ansy=1LL*ansy*n;LL d=gcd(ansx,ansy);ansx/=d;ansy/=d;
	pr1(ansx);pr2(ansy);
//	if(1.0*2730399553711*372637208115>1.0*2981097664920*186319854506)puts("YES");
	return 0;
}
//2730399553711 2981097664920
//186319854506  372637208115

Measured memory_bytes: 2176
N = int(input())
L = list(map(int, input().split()))
L.sort()
answer = 0
for i in range(N-1, 1, -1): # iは辺の最大値
    s = 0 # sは1番短い辺
    l = i-1
    while l > s:
        if L[s] + L[l] > L[i]:
            answer += l - s
            l -= 1
        else:
            s += 1
print(answer)


Measured memory_bytes: 41452
n,k = list(map(int,input().split()))

arr = list(map(int,input().split()))
dp = [0 for i in range(k+1)]

for i in range(1,k+1):
    for j in range(n):
        if(i>=arr[j] and (dp[i-arr[j]] == 0)):
            dp[i] = 1
            break

if(dp[k] == 1):
    print('First')

else:
    print('Second')


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

const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,r,n) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()

using ll = long long int;
using ull = unsigned long long int;
using vi = vector<ll>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/


int main() {
	cin >> n;
	ull A[n+1], B[n];
	REP(i,n+1) {
    	cin >> A[i];
    	cnt += A[i];
    }
	REP(i,n) {
    	cin >> B[i];
    }
	REP(i,n) {
    	if (A[i] >= B[i]) {
        	A[i] -= B[i];
        } else if (A[i] < B[i]) {
        	B[i] -= A[i];
        	A[i] = 0;
         	if (A[i+1] > B[i]) {
            	A[i+1] -= B[i];
            	B[i] = 0;
            } else {
            	B[i] -= A[i+1];
            	A[i+1] = 0;
            }
        }
    }
  	REP(i,n+1) {
    	sum += A[i];
    }
	cout << cnt - sum << endl;
}

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

int main()
{
  int64_t n,a,b,c,ans;
  a=1;
  b=2;
  c=1;
  cin>>n;
  for(int i=0;i<n;i++)
  {
    a*=10;
    a=a%1000000007;
    b*=9;
    b=b%1000000007;
    c*=8;
    c=c%1000000007;
  }
  ans=(a+c-b)%1000000007;
  while(ans<0)
  {
    ans+=1000000007;
  }
  cout<<ans<<endl;
}

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


public class hello
{
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var n = int.Parse(line[0]);
            var m = int.Parse(line[1]);
            if (n == 0 && m == 0) break;
            var taro = new int[n];
            var hana = new int[m];
            for (int i = 0; i < n; i++) taro[i] = int.Parse(Console.ReadLine().Trim());
            for (int i = 0; i < m; i++) hana[i] = int.Parse(Console.ReadLine().Trim());
            Array.Sort(taro);
            Array.Sort(hana);
            var sumtaro = taro.Sum();
            var sumhana = hana.Sum();
            if ((sumtaro+sumhana)  % 2 == 1) { Console.WriteLine(-1); goto loopend; }
            var def = (sumtaro + sumhana) / 2 - sumtaro;
            for (int i = 0; i < n; i++)
                for (int j = 0; j < m; j++)
                {
                    if (hana[j] == taro[i] +def)
                    {
                        Console.WriteLine("{0} {1}", taro[i], hana[j]);
                        goto loopend;
                    }
                }
            Console.WriteLine(-1);
            loopend:;
       }
    }
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll LL_INF = 1e17 + 10;
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

char s[MAXN];
int n, q;
char sym[MAXN][2], t[MAXN][2];

int process(int pos) {
	REP(i, 0, q) {
		if (s[pos] == sym[i][0]) {
			if (t[i][0] == 'L') {
				pos--;
			} else if (t[i][0] == 'R') {
				pos++;
			}
		}
	}
	return pos;
}

void solve(){
	scanf("%d%d%s", &n, &q, &s[1]);
	REP(i, 0, q) {
		scanf("%s%s", &sym[i][0], &t[i][0]);
	}
	int l1 = 0, r1 = n + 1;
	for(; l1 + 1 < r1; ) {
		int m = (l1 + r1) / 2;
		int v = process(m);
		if (v == 0) {
			l1 = m;
		} else {
			r1 = m;
		}
	}
	int l2 = 0, r2 = n + 1;
	for(; l2 + 1 < r2; ) {
		int m = (l2 + r2) / 2;
		int v = process(m);
		if (v <= n) {
			l2 = m;
		} else {
			r2 = m;
		}
	}
	printf("%d\n", r2 - l1 - 1);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 1280
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using namespace std;
using namespace boost::multiprecision;

typedef long long ll;
typedef long double ld;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mis map<int,string>
#define msi map<string,int>
#define mll map<ll,ll>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep1(i,n) for(int i=1; i<=(int)(n); i++)
#define all(c) c.begin(),c.end()
#define srta(a) sort(all(a))
#define srtd(a) sort(all(a),greater<型>())
#define rvs(s) reverse(all(s))
#define psb push_back
#define ppb pop_back
#define isu isupper
#define isl islower
#define lb(a,k) lower_bound(all(a),k)
#define ub(a,k) upper_bound(all(a),k)
#define bs(a,k) binary_search(all(a),k)
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

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

const int I_INF = 1001001001;
const ll LL_INF = 1001001001001001001;
const ld EPS = 0.001;

int main() {
    ll A, B, C, K;
    cin >> A >> B >> C >> K;

    if (B > A && C > B) {
        cout << "Yes" << endl;
        return 0;
    }

    int idx = 0;
    rep1 (i, K) {
        if (B <= A) {
            B *= 2;
            idx = i;
        }
    }
    rep (i, K-idx) {
        if (C <= B) C *= 2;
    }

    string ans = "No";
    if (B > A && C > B) ans = "Yes";

    cout << ans << endl;
}


Measured memory_bytes: 3600
object Main {

	def main(arg:Array[String]) = {
		val n = scala.io.StdIn.readLine().toInt;
		var list = scala.io.StdIn.readLine().split(" ").map(_.toInt);
  		list.reverse;

  		val sorted = list.sorted;
  		val left = sorted(sorted.size / 2 - 1);
  		val right = sorted(sorted.size / 2);

  		/*
  		for (x <- list) {
  			if (x <= left) println(right);
  			else println(left);
  		}
  		*/
  		list.foreach(x => {
  			println(if (x <= left) (right) else (left));
  		})
	}
}


Measured memory_bytes: 65216
#include <stdio.h>
#include <stdlib.h>

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

	int W[101] = {0};
	int i;
	for (i = 1; i <= N; i++) {
		int x;
		scanf("%d", &x);
		W[i] = W[i - 1] + x;
	}

	int T, ans = 100000;
	for (T = 1; T < N; T++) {
		int dif = abs(W[T] - (W[N] - W[T]));
		if (ans > dif)
			ans = dif;
	}

	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 128
/**
 *
 * AtCoder Beginner Contest 105 - Problema A: AtCoder Crackers (https://abc105.contest.atcoder.jp/tasks/abc105_a)
 *
 * Find the minimum possible absolute difference between the largest and the smallest number
 * of crackers received by a user.
 *
 * Math solution: if M is a multiple of K, each user receive the same amount. Otherwise, 
 * (N % K) users will receive one more cracker.
 */
#include <iostream>

using namespace std;

void solve(int N, int K)
{
    cout << (N % K ? 1 : 0) << endl;
}

int main()
{
    ios::sync_with_stdio(false);

    int N, K;
    cin >> N >> K;

    solve(N, K);

    return 0;
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>

int main(){
    int N; cin>>N;
    vector<pii> v;
    if(N%2==1){
        for(int i=1;i<N;++i){
            v.push_back( make_pair(i,N) ); // Nに接続しきる
        }
        for(int i=1;i<N;++i){
            for(int j=i+1;j<N;++j){
                if(i+j!=N){
                    v.push_back( make_pair(i,j) );
                }
            }
        }
    }else{
        for(int i=2;i<N;++i){
            v.push_back( make_pair(1,i) ); // 1に接続しきる
        }
        for(int i=2;i<N;++i){
            v.push_back( make_pair(N,i) ); // Nに接続しきる
        }
        for(int i=2;i<N;++i){
            for(int j=i+1;j<N;++j){
                if(i+j!=(N+1)){
                    v.push_back( make_pair(i,j) );
                }
            }
        }
    }
    cout << v.size() << "\n";
    for(pii p:v){
        printf("%d %d\n",p.first,p.second);
    }
    
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		long [] s = new long[n + 1];
		for(int i = 1;i <= n;i ++) {
			s[i] = in.nextLong();
			s[i] += s[i - 1];
		}
		int l = 1,r = 3;
		long ans = s[n];
		for(int i = 2;i < n - 1;i ++) {
			long last = s[n];
			while(l < i) {
				long d = Math.abs(s[i] - s[l] * 2);
				if(d > last) break;
				else last = d;
				l ++;
			}
			l --;
			last = s[n];
			while(r < n) {
				long d = Math.abs(s[n] + s[i] - s[r] * 2);
				if(d > last) break;
				else last = d;
				r ++;
			}
			r --;
			long max = Math.max(Math.max(Math.max(s[l], s[i] - s[l]), s[r] - s[i]), s[n] - s[r]);
			long min = Math.min(Math.min(Math.min(s[l], s[i] - s[l]), s[r] - s[i]), s[n] - s[r]);
			ans = Math.min(max - min, ans);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 85632
N = int(input())
A = [0]*N
B = list(map(int,input().split()))
A[0] = B[0]
A[1] = B[0]
for i in range(1,N-1):
    x = B[i]
    y = B[i-1]
    if x < y:
        A[i] = B[i]
        A[i+1] = B[i]
    else:
        A[i+1] = B[i]
ans = sum(A)
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] a = new int[n];
		for (int i = 0; i < n - 1; i++) {
			int jousi = Integer.parseInt(sc.next());
			a[--jousi]++;
		}
		for (int i = 0; i < n; i++) {
			System.out.println(a[i]);
		}
	}

}


Measured memory_bytes: 50564
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin >> N >> K;
  vector<int> h(N),cost(N,INT_MAX);
  for(int i = 0; i < N; ++i) cin >> h[i];
  cost[0] = 0;
  for(int i = 1; i < N; ++i){
    for(int j = max(0,i-K); j < i; ++j){
      cost[i] = min(cost[i],cost[j]+abs(h[j]-h[i]));
    }
  }
  cout << cost[N-1];
  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main()
{

  int i, j, N, minj, b, count;

  count = 0;
  
  scanf("%d",&N);

  int A[N];
  
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }

  for(i=0;i<N;i++){
    minj = i;
    for(j=i;j<N;j++){
      if(A[j]<A[minj]){
	minj = j;
      }
    }
    if(i!=minj) count++;
    b = A[i];
    A[i] = A[minj];
    A[minj] = b;
  }

  for(i=0;i<N;i++){
    if(i==N-1) printf("%d\n",A[i]);
    else printf("%d ",A[i]);
  }

  printf("%d\n",count);

  return 0;

}



Measured memory_bytes: 2080
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n;
    cin >> n;
    vector<lint> a(n);
    lint tot  = 0;
    lint mini = inf;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        tot += a[i];
        chmin(mini, a[i]);
    }
    if (n % 2 == 1) { // no flip
        if (tot % 2 == 0)
            cout << "Second"
                 << "\n";
        else
            cout << "First"
                 << "\n";
    } else {
        if (tot % 2 == 0) {
            if (mini % 2 == 1)
                cout << "First"
                     << "\n";
            else
                cout << "Second"
                     << "\n";
        } else {
            cout << "First"
                 << "\n";
        }
    }
    return 0;
}


Measured memory_bytes: 4356
"use strict"

const main = arg => {
  arg = arg.trim().split("\n");
  const N = parseInt(arg[0]);
  const s = arg[1].split(" ").map(n=>parseInt(n));

  const points = [0, ...s, 0];
  const diff   = [];
  const answer = [];

  points.forEach((p, i, self) => {
    if (i < self.length - 1) diff.push(self[i + 1] - self[i]);
  });

  const sum = diff.map(n=>Math.abs(n)).reduce((a,b) =>a+b);

  for(let i=1; i<points.length - 1; i++) {
    const skipped = Math.abs(points[i - 1] - points[i + 1]);
    const stepped = Math.abs(points[i - 1] - points[i]) + Math.abs(points[i] - points[i + 1]);

    const changed = skipped - stepped;

    answer.push(sum + changed);
  }

  console.log(answer.join("\n"));
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

using namespace std;

typedef long long int ll;

int main(void)
{
    ll a,b;

    cin >> a >> b;

    ll k = (a+b)/2;

    if(abs(a-k) == abs(b-k))
        cout << k << endl;
    else
        cout << "IMPOSSIBLE" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<stack>
#include<tuple>
using namespace std;
#define INF 1100000000000
#define MaX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

//https://kyopro-friends.hatenablog.com/entry/2019/01/12/231000

bool dp[110000];

int main(){
    int N,a[110],K; cin>>N>>K;
    for(int i=0;i<N;i++) cin>>a[i];
    for(int i=0;i<110000;i++) dp[i]=false;
    for(int i=1;i<=K;i++){
        for(int j=0;j<N;j++){
            if(i-a[j]>=0 && dp[i-a[j]]==false) dp[i]=true;
        }
    }
    if(dp[K]) cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}



Measured memory_bytes: 384
package main
// 台形の面積
import (
	"fmt"
	"bufio"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	a, b, h := readInt(), readInt(), readInt()
	area := ((a + b) * h) / 2
	fmt.Println(area)
}

Measured memory_bytes: 640
using System;
using System.Linq;
using System.Collections.Generic;

public static class Program
{
  public static void Main(string[] args)
  {
    string[] input1=Console.ReadLine().Split(' ');
    int N=int.Parse(input1[0]);
    int M=int.Parse(input1[1]);
    int[] Observatory=Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();
    int[] ma=new int[N];
    


    for(int i=0;i<M;i++) {
        int[] Path=Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();
        ma[Path[0]-1]=Math.Max(ma[Path[0]-1],Observatory[Path[1]-1]);
        ma[Path[1]-1]=Math.Max(ma[Path[1]-1],Observatory[Path[0]-1]);
    }
    
    
    int count=0;
    for(int i=0;i<N;i++) {
        if(ma[i]<Observatory[i]) {
            count++;
        }
    }
 
    Console.WriteLine(count);
 
  }


}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


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

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

using ll = long long;

#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 ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vvs = vector<vs>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    string t; std::cin >> t;
    rep(i, t.size()) std::cout << (t[i] == '?' ? 'D' : t[i]) << (i+1 < t.size() ? "" : "\n");
}


Measured memory_bytes: 3788
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,a[200010],p[200010];
int main()
{
	scanf("%d",&n);
	ll ans=0;
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=1;i<=n;i++)
	{
		if (a[i]>i-1||i!=n&&a[i]<a[i+1]-1) { puts("-1");return 0;}
		p[i-a[i]]=a[i];
	}
	for (int i=1;i<=n;i++) ans+=p[i];
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 1792
n = int(input())
x = list(map(int,input().split()))

ans = 10**20 #答えになるので初期化
for i in range(1,101): #1<=P<=100の範囲について消費する体力の総和を計算
    dis = 0
    for j in x:
        dis += (i-j)**2
    ans = min(ans,dis)

print(ans)

Measured memory_bytes: 38640
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p


MOD = 10**9 + 7
N = 10**6
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    factinv.append((factinv[-1] * inv[-1]) % MOD)

s = int(input())

ans = 0
for i in range(1, s // 3 + 1):
    rest = s - 3 * i
    ans += cmb(rest + i - 1, rest, MOD)

print(ans % MOD)

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

constexpr int64 P = 1000000007;

struct FiniteField {
 private:
  int64 x;
  static inline int64 Normalize(int64 x) {
    if (0 <= x && x < P) return x; x %= P; if (x < 0) x += P; return x;
  }
 public:
  FiniteField(int64 x) : x(Normalize(x)) {}
  FiniteField() : x(0) {}
  int64 Value() const { return x; }
  inline FiniteField operator+(FiniteField o) const {
    FiniteField r(*this); r += o; return r;
  }
  inline FiniteField operator-(FiniteField o) const {
    FiniteField r(*this); r -= o; return r;
  }
  inline FiniteField operator* (FiniteField o) const {
    FiniteField r(*this); r *= o; return r;
  }
  inline FiniteField operator/ (FiniteField o) const {
    FiniteField r(*this); r /= o; return r;
  }
  inline void operator+= (FiniteField o) { x = (x + o.x) % P; }
  inline void operator-= (FiniteField o) { x = (x + P - o.x) % P; }
  inline void operator*= (FiniteField o) { x = (x * o.x) % P; }
  void operator/=(FiniteField o) {
    int64 p = P - 2; while (p) { if (p % 2) { *this *= o; } o *= o; p /= 2; }
  }
};

ostream& operator<<(ostream& s, const FiniteField& v) { s << v.Value(); return s; }

tuple<vector<FiniteField>, vector<FiniteField>> MakeFactorialTables(int n) {
  vector<FiniteField> factorials(n + 1);
  vector<FiniteField> inverse_factorials(n + 1);
  factorials[0] = 1;
  for (int i = 1; i <= n; i++) {
    factorials[i] = factorials[i - 1] * i;
  }
  inverse_factorials[n] = FiniteField(1) / factorials[n];
  for (int i = n; i >= 1; i--) {
    inverse_factorials[i - 1] = inverse_factorials[i] * i;
  }
  return make_tuple(factorials, inverse_factorials);
}

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

  int n, a, b, c;
  cin >> n >> a >> b >> c;

  vector<FiniteField> fs, i_fs;
  tie(fs, i_fs) = MakeFactorialTables(2 * n);

  auto c_fn = [&](int x, int y) -> FiniteField {
    if (y < 0 || x < y ) return 0;
    return fs[x] * i_fs[y] * i_fs[x - y];
  };

  FiniteField p = FiniteField(a) / (FiniteField(a) + FiniteField(b));
  FiniteField q = FiniteField(b) / (FiniteField(a) + FiniteField(b));

  vector<FiniteField> p_powers(n + 1), q_powers(n + 1);
  p_powers[0] = 1;
  q_powers[0] = 1;
  for (int i = 1; i <= n; i++) {
    p_powers[i] = p_powers[i - 1] * p;
    q_powers[i] = q_powers[i - 1] * q;
  }

  FiniteField ans = 0;

  for (int k = 0; k < n; k++) {
    ans += FiniteField(n + k) * p_powers[n] * q_powers[k] * c_fn(n - 1 + k, k);
    ans += FiniteField(n + k) * q_powers[n] * p_powers[k] * c_fn(n - 1 + k, k);
  }

  // cout << ans << endl;

  ans *= FiniteField(100) / (FiniteField(100) - FiniteField(c));

  cout << ans << endl;
}

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

int main() {
    int n,y;
    cin >> n >> y;
    int a= -1, b = -1, c = -1;
    for (int i = 0; i < n + 1; i++) {
        if (y < i * 10000) break;
        for (int j = 0; j < n - i + 1; j++) {
            int n_d = n - i - j;
            int total = 10000 * i + 5000 * j + 1000 * n_d;
            if (total == y) {
                a = i;
                b = j;
                c = n_d;
                cout << a << ' ' << b << ' ' << c << endl;
                return 0;
            }
        }
    }
    cout << a << ' ' << b << ' ' << c << endl;
    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#define ll long long
using namespace std;

ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a % b);
}

int main()
{
    ll ans = 0, k;
    cin >> k;

    for (int i = 1; i <= k; i++)
        for (int j = 1; j <= k; j++)
            for (int l = 1; l <= k; l++)
                ans += gcd(gcd(i, j), l);
    cout << ans << endl;
}

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;


int main(){

    long long  a,b,c;
    cin>>a>>b>>c;
    long long d=(c-a-b);
    long long K=d*d;
    long long L=4*a*b;
    if(K>L && d>0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;

}
/*


*/


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

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N, M; cin >> N >> M;
	int s = 0;
	vector<int> V; V.assign(N, 1);
	map<int, int> mp;
	mp[0] = 1;
	for(int i=0; i<M; i++){
		int x, y; cin >> x >> y;
		x--; y--;
		V[x]--; V[y]++;
		if(mp.count(x) != 0){
			mp[y] = 1;
			s = y;
		}
		if(V[x] == 0) mp.erase(x);
	}
	int ans = 0;
	printf("%d\n", (int)mp.size());
	return 0;
}

Measured memory_bytes: 8220
#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int inf = 1012345678;
int main() {
	int H, W;
	cin >> W >> H;
	vector<vector<int> > a(H + 1, vector<int>(W + 1));
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			cin >> a[i][j];
		}
	}
	vector<vector<int> > sv = a, sh = a;
	for (int i = 0; i < W; ++i) {
		for (int j = H - 1; j >= 0; --j) {
			sv[j][i] += sv[j + 1][i];
		}
	}
	for (int i = 0; i < H; ++i) {
		for (int j = W - 1; j >= 0; --j) {
			sh[i][j] += sh[i][j + 1];
		}
	}
	vector<vector<int> > dp(H + 1, vector<int>(W + 1));
	for (int i = H; i >= 0; --i) {
		for (int j = W; j >= 0; --j) {
			if (i == H && j == W) continue;
			int turn = (i + j) % 2;
			if (turn == 0) {
				dp[i][j] = -inf;
				if (i != H) {
					dp[i][j] = max(dp[i][j], dp[i + 1][j] + sh[i][j]);
				}
				if (j != W) {
					dp[i][j] = max(dp[i][j], dp[i][j + 1] - sv[i][j]);
				}
			}
			else {
				dp[i][j] = inf;
				if (i != H) {
					dp[i][j] = min(dp[i][j], dp[i + 1][j] + sh[i][j]);
				}
				if (j != W) {
					dp[i][j] = min(dp[i][j], dp[i][j + 1] - sv[i][j]);
				}
			}
		}
	}
	cout << abs(dp[0][0]) << endl;
	return 0;
}


Measured memory_bytes: 18724
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    int N; cin >> N;
    vector<int> H(N); for (auto &h : H) cin >> h;
    int ans = 0, curr = 0;
    for (int i = 1; i < N; i++) {
        if (H[i-1] >= H[i]) curr++;
        else curr = 0;
        ans = max(ans, curr);
    }
    cout << ans << '\n';
    return 0;
}

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

using namespace std;

int main() {
	string s; cin >> s;
	int n = s.size();
	s += '@';
	long long pre = 0;
	long long ans = 0;
	for (int i = 0; i < n; ++i) {
		long long cnt = 1;
		while (s[i] == s[i + 1]) cnt++, i++;
		//if (cnt != 1) i--;
		if (s[i] == '<') ans += cnt * (cnt - 1) / 2, pre = cnt;
		else {
			if (pre < cnt) ans += (cnt + 1) * cnt / 2;
			else ans += pre + cnt * (cnt - 1) / 2;
			pre = 0;
		}
	}
	ans += pre;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 

bool sosuflag[101];
vi sosuar;
void sosumake(){
  REP(i, 101) sosuflag[i] = true;
  sosuflag[0] = false;
  sosuflag[1] = false;
  for(int i = 2; i <= 100; i++){
    if(sosuflag[i] == false) continue;
    for(int j = i * 2; j <= 100; j+=i){
      sosuflag[j] = false;
    }
  }
  REP(i, 101) if(sosuflag[i]) sosuar.pb(i);
}

map<int, int> bunkai(map<int, int> res, int x){
  REP(i, sosuar.size()){
    while(1){
      if(x % sosuar[i] != 0) break;
      x /= sosuar[i];
      if(res.count(i) == 0) res[i] = 0;
      res[i]++;
    }
  }
  
  return res;
}

int nck(int n, int k){

}
int main(){
  sosumake();
  int n;
  cin >> n;
  map<int, int> res;
  FOR(i, 1, n+1){
    res = bunkai(res, i);
  }

  int ijo2 = 0;
  int ijo4 = 0;
  int ijo14 = 0;
  int ijo24 = 0;
  int ijo74 = 0;
  for(auto iter = res.begin(); iter != res.end(); iter++){
    int key = iter->first;
    int val = iter->second;
    // cout << sosuar[key] << " " << val << endl;
    if(val >= 2) ijo2++;
    if(val >= 4) ijo4++;
    if(val >= 14) ijo14++;
    if(val >= 24) ijo24++;
    if(val >= 74) ijo74++;
  }

  int ans = 0;
  if(ijo74 > 0){
    ans++;
  }
  if(ijo24 >= 1 && ijo2 >= 1){
    ans += (ijo24 * (ijo2 - 1));
  }
  if(ijo2 >= 1 && ijo4 >= 2){
    ans += (ijo4 * (ijo4 - 1) * (ijo2 - 2) / 2);
  }
  if(ijo4 >= 1 && ijo14 >= 1){
    ans += (ijo14 * (ijo4 - 1));
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
#include<chrono>
using namespace std;
using namespace std::chrono;
//using namespace __gnu_pbds;
#define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fi         first
#define se         second
#define int         long long
#define pb         push_back
#define emp        emplace_back
#define vv(x)      vector<x>
#define mp(x,y)    map<x,y>
#define dq(x)      deque<x>
#define pql(x)     priority_queue<x>
#define pqs(x)     priority_queue<x,vv(x),greater<x> >
#define mod         1000000007
#define forf(i,a,b) for(int i=a;i<b;i++)
#define it(x)      x::iterator
#define ll         long long
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
#define vii        vector<int>
#define big        3e18
#define sm         -2e9
#define mkr        make_pair
#define vpi        vector<pair<int,int> >
#define pii        pair<int,int>
#define rng        500005
#define sz(x)      (int)x.size()
#define rv(x)      reverse(x.begin(),x.end())
#define out(x)     cout<<x.fi<<" "<<x.se<<endl;
 
//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
 
void pr_init()
{
 
#ifndef ONLINE_JUDGE
  freopen("gin.txt", "r", stdin);
  freopen("gout.txt", "w", stdout);
 
#endif
}

void solve()
{
  
int n,k;
cin >> n >> k;

int a[n];
forf(i,0,n) cin >> a[i];
 
for(int i=k;i<n;i++)
{
    if(a[i]>a[i-k]) cout<<"Yes\n";
    else cout<<"No\n";
}  
  
}
 
 
int32_t main()
{
  pr_init();
  //fastio;
 
  auto start = high_resolution_clock::now();
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start);
  // cout << "Time taken by function: "
  //       << duration.count() << " microseconds" << endl;
 
}
 

Measured memory_bytes: 5192
D, G = map(int, input().split())
P = [0] * D
C = [0] * D
ans = float("inf")

for i in range(D):
    P[i], C[i] = map(int, input().split())

for bit in range(1 << D):
    score = 0
    cnt = 0
    unused = set(range(1, D+1))
    for i in range(D):
        if (bit >> i) & 1 == 1:
            cnt += P[i]
            score += 100 * (i + 1) * P[i] + C[i]
            unused.discard(i + 1)

    if score < G:
        use = max(unused)
        num = min(P[use - 1], -(-(G - score) // (use * 100)))
        cnt += num
        score += use * 100 * num

    if score >= G:
        ans = min(ans, cnt)

print(ans)


Measured memory_bytes: 3188
fun main(args: Array<String>) {
    val (S,T) = readLine()!!.split(" ")
    val (N,M) = readLine()!!.split(" ").map(String::toInt)
    val D = readLine()!!
    println(
        if(S==D){
            ""+(N-1)+" $M"
        }else{
            "$N "+(M-1)
        }
    )
}

Measured memory_bytes: 36004
#どっちで出すか注意, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    H,W,K = map(int, input().split())
    table = [list(map(int, list(input().rstrip()))) for _ in range(H)]
    

        #tableの累積和dを返す
    def csum_gen(h, w, table):
        d = [[0]*w for _ in range(h)]
        d[0][0] = table[0][0]
        for i in range(1, w):
            d[0][i] = d[0][i-1]+table[0][i]
        #上のマスとその行の和を足す
        for i in range(1, h):
            total = 0
            for j in range(w):
                total += table[i][j]
                d[i][j] = d[i-1][j]+total
        return d
    
    d = csum_gen(H, W, table)

    #座標(p, q)を含む長方形の和
    def csum_cal(p, q, x, y, d):
        #p<=x and q<=y
        if p>x or q>y:
            return 0
        if p==0 and q==0:
            return d[x][y]
        if p==0:
            return d[x][y] - d[x][q-1]
        if q==0:
            return d[x][y] - d[p-1][y]
        return d[x][y]-d[p-1][y]-d[x][q-1]+d[p-1][q-1]

    res = 10**15
    for i in range(2**(H-1)):
        tate = [0]
        for j in range(H-1):
            if i & 2**j:
                tate.append(j+1)
        l = len(tate)
        tate.append(H)
        start = 0
        cnt = 0
        flag = 0
        for j in range(W-1):
            for k in range(l):
                if K < csum_cal(tate[k], start, tate[k+1]-1, j, d):
                    flag = 1
            for k in range(l):
                if K < csum_cal(tate[k], start, tate[k+1]-1, j+1, d):
                    cnt += 1
                    start = j+1
                    break
            if flag:
                break
        else:
            res = min(res, cnt+l-1)
    print(res)




if __name__ == '__main__':
    main()


Measured memory_bytes: 47324
IDENTIFICATION DIVISION.
 PROGRAM-ID.    TEST154.
 
 DATA DIVISION.
 WORKING-STORAGE SECTION.

 01 INP       PIC X(30).
 01 S         PIC X(10).
 01 T         PIC X(10).
 01 A         PIC 9(2).
 01 B         PIC 9(2).
 01 U         PIC X(10).
 01 ANS-A     PIC Z9.
 01 ANS-B     PIC Z9.

 PROCEDURE DIVISION.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ALL ' '
      INTO S T.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ALL ' '
      INTO A B.
  ACCEPT INP.
  MOVE INP  TO U.

  IF S = U
    COMPUTE ANS-A = A - 1
    MOVE B  TO ANS-B
  ELSE
    MOVE A  TO ANS-A
    COMPUTE ANS-B = B - 1
  END-IF.
  
  DISPLAY ANS-A ANS-B.
 STOP RUN.   

Measured memory_bytes: 764
import java.util.ArrayList;
import java.util.Scanner;


public class Main {
//	配列
	static ArrayList<Integer> arrA = new ArrayList<Integer>();
//	最大値/最小値
	static int max = 0, min = 0;
	
	public static void main(String[] args) {
		
//		必要なパラメータを用意する処理
//		個数情報を扱う変数
		int iNumVar = 0;
//		クエリの種類(0,1)を扱う変数
		int iQueryComm = 0;
//		配列の範囲b/e
		int start = 0, end = 0;

		
//		入力値を取得する処理
		Scanner scInputData = new Scanner(System.in);
//		配列の要素数を取得
		iNumVar = scInputData.nextInt();
		for(int iNumArr=0; iNumArr < iNumVar; iNumArr++) {
			arrA.add(scInputData.nextInt());
		}
//		クエリの数を取得
		iNumVar = scInputData.nextInt();
		
		for(int iNumQuery=0; iNumQuery < iNumVar; iNumQuery++) {
			iQueryComm = scInputData.nextInt();
			start = scInputData.nextInt();
			end = scInputData.nextInt();
			switch(iQueryComm) {
			case 0:
				calcMin(start, end);
				break;
			case 1:
				calcMax(start, end);
				break;
			}
		}		
		scInputData.close();

	}

	private static void calcMax(int start, int end) {
		max = arrA.get(start);
		for(int iFactorNum=start+1; iFactorNum < end; iFactorNum++) {
			max = Math.max(arrA.get(iFactorNum), max);
		}
		System.out.println(max);
	}

	private static void calcMin(int start, int end) {
		min = arrA.get(start);
		for(int iFactorNum=start+1; iFactorNum < end; iFactorNum++) {
			min = Math.min(arrA.get(iFactorNum), min);
		}
		System.out.println(min);
	}

}



Measured memory_bytes: 35400
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
using namespace std;
#pragma comment(linker, "/stck:1024000000,1024000000")
#define lowbit(x) (x&(-x))
#define max(x,y) (x>=y?x:y)
#define min(x,y) (x<=y?x:y)
//#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.1415926535897932384626433832
#define ios() ios::sync_with_stdio(true)
#define INF (1<<31)-1;
#define mem(a) (memset(a,0,sizeof(a)))
struct P{
    int x,y;
}H[200000];
vector<int>G[200000];
int POS(int k,int value){
    int mid;
    int left = 0;
    int len = G[k].size();
    int right = len - 1;
    //cout<<" "<<k<<"A"<<value<<endl;
    while(left <= right){
 
        // 确保中点靠近区间的起点
        mid = left + (right-left)/2;
        //cout<<mid<<endl;
        //cout<<"mid= "<<mid<<" "<<left<<" "<<right<<endl;
        // 如果找到则返回
        if(G[k][mid] == value) return mid;
        // 将中点赋给终点
        else if(G[k][mid] > value) right = mid;
        // 将中点加一赋给起点
        else left = mid + 1;
    }
    return -1;
}
set<int>::iterator it;
int main()
{
    set<int>s;
    int N,M;
    int x,y;
    cin>>N>>M;
    for(int i=1;i<=M;i++){
        cin>>x>>y;
        H[i].x = x;
        H[i].y = y;
        G[x].push_back(y);
        s.insert(x);
    }
    for(int i=1;i<=N;i++){
        sort(G[i].begin(),G[i].end());
    }
 
 
    for(int i=1;i<=M;i++){
        cout<<setw(6)<<setfill('0')<<H[i].x;
        cout<<setw(6)<<setfill('0')<<POS(H[i].x,H[i].y)+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 15488
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


N =  int(sys.stdin.readline())
A =  int(sys.stdin.readline())

if N % 500 > A:
    print("No")
else:
    print("Yes")

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

int main(){
  long long a, c;
  double b;
  
  cin >> a >> b;
  
  c = b * 100 + 0.5;
  
  a *= c;
  
  cout << a/100 << endl;
  
  return 0;
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
#define endl             "\n"
// -----------------<Container manipulation / traversal macros>------------------
#define mp                 make_pair
#define pb                 push_back
#define ff                 first
#define ss                 second
#define sz(x)             ((int)((x).size()))
#define all(x)             (x).begin(),(x).end()
#define rep(i,n)         for(ll (i)=0;(i)<(n);(i)++)
#define forn(i,a,b)     for(ll (i)=(a);(i)<=(b);(i)++)
#define fill(l,a)        memset((l) , (a) , sizeof(l))
// -----------------<Some common useful functions>------------------
#define maX(a,b)        ( (a) > (b) ? (a) : (b))
#define miN(a,b)        ( (a) < (b) ? (a) : (b))
#define checkbit(n,b)   ( (n >> b) & 1)
#define INDEX(arr,i)      ( lower_bound(all(arr),i)-arr.begin())
#define in(b,a)         ( (b).find(a) != (b).end())
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector< std::vector<ll> > matrix;
typedef map<ll,ll> mii;
typedef vector<pii> vpii;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;

int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}
ll lcm(ll a,ll b)
{
    return(a/gcd(a,b)*b);
}
/*ll power(ll a,ll b,ll p)
{
    ll res=1;
    a%=p;
    while(b>0)
    {
        if(b&1)
        res=res*a%p;
        a=a*a%p;
        b>>=1;
    }
    return(res);
}
ll modInverse(ll a, ll m)
{
    ll g = gcd(a, m);
    return(power(a,m-2,m));
}*/
/*ll b_search(ll arr[],ll n,ll s)
{
    ll l=0,r=n-1;
    while(l<=r)
    {
        ll mid=l+(r-l)/2;
        if(arr[mid]==s)
        return(mid);
        if(arr[mid]<s)
        l=mid+1;
        else
        r=mid-1;
    }
    return(-1);
}*/
bool isprime(ll x)
{
    if(x==1)
        return(false);
    for(ll i=2;i*i<=x;i++)
    {
        if(x%i==0)
            return(false);
    }
    return(true);
}
/*vector<ll> v[100005];
bool vis[100005]={false};
long combi(int n,int k)
{
    long ans=1;
    k=k>n-k?n-k:k;
    int j=1;
    for(;j<=k;j++,n--)
    {
        if(n%j==0)
        {
            ans*=n/j;
        }else
        if(ans%j==0)
        {
            ans=ans/j*n;
        }else
        {
            ans=(ans*n)/j;
        }
    }
    return ans;
}*/

void solve()
{
    string s,t;
    cin>>s>>t;
    ll c=0;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]!=t[i])
            c++;
    }
    cout<<c<<endl;
}


int main()
{
    IOS
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return(0);
}


Measured memory_bytes: 3796
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
#define MOD 1000000007
using namespace std;

int main() {
	int W, H, N;
	cin >> W >> H >> N;
	int mx, my, Mx, My;
	vector<int>a(N),x(N),y(N);
	REP(i, N) {
		cin >> x[i] >> y[i] >> a[i];
	}
	mx = 0, my = 0;
	Mx = W, My = H;
	REP(i, N) {
		switch (a[i]) {
		case 1:
			if (mx < x[i]) {
				mx = x[i];
			}
			break;
		case 2:
			if (Mx > x[i]) {
				Mx = x[i];
			}
			break;
		case 3:
			if (my < y[i]) {
				my = y[i];
			}
			break;
		case 4:
			if (My > y[i]) {
				My = y[i];
			}
			break;
		}
	}
	if (mx < Mx&&my < My) {
		cout << (Mx - mx)*(My - my) << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

ll f(ll &x, ll k) {
    if( x > abs(x - k)) {
        x = abs(x - k);
        cout << x << endl;
        f(x, k);
    }
    return x;
}


int main() {
    ll k;
    cin >> k ;
    queue<ll> q;
    FOR(i,1,10){
        q.push(i);
    }
    ll enq = 0;
    REP(i, k) {
        enq = q.front(); q.pop();
        if(enq % 10 == 0){
            q.push(enq * 10);
            q.push(enq * 10 + 1);
        }
        else if (enq % 10 == 9) {
            q.push(enq * 10 + 8);
            q.push(enq * 10 + 9);
        }
        else {
            q.push(enq * 10 + enq % 10 - 1);
            q.push(enq * 10 + enq % 10);
            q.push(enq * 10 + enq % 10 + 1);
        }

    }
    cout << enq << endl;

}

Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>

#define len 3

int main(void) {
  char s[4];
  int count = 0;
  scanf("%s", s);
  for(int i = 0; i < len - 1; i++) {
    if(s[i] != s[i+1]) {
      count++;
    }
  }
  if(s[len-1] != s[0]) {
    count++;
  }
  if(count > 0) {
    printf("Yes");
  } else {
    printf("No");
  }
  return 0;
}


Measured memory_bytes: 1732