akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>

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

ll mypow(ll x, ll n) {
	ll ans = 1;
	while (n > 0) {
		if ((n & 1) == 1) {
			ans = ans * x;
			ans %= 1000000007;
		}
		x = x * x;
		x %= 1000000007;;
		n >>= 1;
	}
	return ans;
}


int main() {

	int N, M;

	scanf("%d%d", &N, &M);

	vector<int> primes;

	int m = M;
	for (int i = 2; m > 1; ++i) {
		if (!(m % i)) {
			primes.push_back(i);
			m /= i;
			i = 1;
			continue;
		}
	}

	map<int, int> map;
	for (auto p : primes) ++map[p];

	ll ans = 1;
	for (auto p : map) {
		ll sub = 1;
		for (ll i = 1; i < N; ++i) {
			sub *= p.second + i;
			sub %= 1000000007;
			sub *= mypow(i, 1000000007-2);
			sub %= 1000000007;
		}
		ans *= sub;
		ans %= 1000000007;
	}

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

	return 0;
}


Measured memory_bytes: 256
import numpy as np
import bisect

n, m, k = map(int, input().split())
A = [0] + list(map(int,input().split())) # '0'冊目も入れとく
B = [0] + list(map(int,input().split())) # 同上

a = np.cumsum(A) # 'A'の累積
b = np.cumsum(B) # 'B'同上

ans = 0
for i in range(n+1): # 二分探索_方針: A側で読む本の冊数を固定する！
    time = k - a[i] # ↑で固定した時の残り時間
    if time < 0: # 残り時間がない場合は探索中止
        break
    tmp = bisect.bisect_right(b, time) - 1 # 残りタイム内で読めるB側の本のmax冊数を探索_0冊目とbisect右/左を考慮して'-1'
    ans = max(ans, tmp + i)

print(ans)

Measured memory_bytes: 59624
#include<bits/stdc++.h>
#include<iostream>
#define ll long long 
#define ld long double
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define sz(v) sizeof(v)
#define MOD 1000000007
#define MAX (ll)1e12+5


using namespace std;


int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
//////
// prime Seive
/*
bitset<1000005> bt;
//unordered_map<ll,bool> is_prime;
vector<ll> primes;
void pS(ll n){
    ll val = min(n+1,(ll)1000006);
    for(ll i=3;i<=val;i+=2){
        bt[i] =true;
    }
    bt[0] =false;
    bt[1] =false;
    bt[2] =false;
    //is_prime[2] =true;
    primes.pb((ll)2);
    for(ll i=3;i<=val;i+=2){
        if(bt[i])
            for(ll j=i*i;j<=val;j+=2*i)
                bt[j] =false;
    }
    for(ll i=3;i<=val;i+=2){
        if(bt[i]){primes.pb(i);
        //is_prime[i]=true;
        //cout<<i<<" :PRIME\n";
        }
    }
    return;
}
*/          
/////
// Fenwick Tree
/*
BIT[200005] ={0};
//BUILD BIT
// for(int i=1;i<1;i++){ cin>>a[i];update(i,a[i],n);};
 
void update(int i,int val,int n){
    while(i<=n){
    BIT[i]+= inc;
    i+= (i&(-i));
    }
}
ll query(int i){
    ll ans =0;
    while(i>0){
        ans+= BIT[i];
        i-=(i&(-i));
    }
    return ans;
}
 
*/
//__builtin_popcount(4)
ll logPow(ll a,ll b){
    ll ans=1;
    while(b>0){
        if(b&1){
            ans*=a;
        }
        a*=a;
        b= b>>1;
    }
    return ans;
}

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



/*
// dsu
const int N = 500009;
int p[N],cmp[N];
int getP(int cn){
    return ((cn==p[cn])?cn:(p[cn]=getP(p[cn])));
}

void unite(int a,int b){
    a = getP(a);
    b = getP(b);
    if(a==b) return ;
    if(cmp[a]<cmp[b])
        swap(a,b);
    p[b] = a;
    cmp[a] += cmp[b];
}
*/

/*
//dfs
bool dfs(ll src ,ll dest,unordered_map<ll,bool> &vis,unordered_map<ll,vector<ll>> &g){
    vis[src] =true;
    if(src== dest) return true;
    bool  ans =false;
    for(auto nbr: g[src]){
        if(!vis[nbr])
            ans = ans|dfs(nbr,dest,vis,g);
    }
    return ans;
}

*/
// bfs
/*
ll bfs(ll i,unordered_map<ll,bool> &vis){
    queue<ll> q;q.push(i);vis[i] =true;ll ans =0;
    while(!q.empty()){
        ans++;ll cur = q.front();q.pop();
        for(auto nbr: g[cur]){
            if(!vis[nbr]){
                vis[nbr] =true;q.push(nbr);
    }}}
    return ans;
}
*/

unordered_map<ll,vector<ll>> g;

ll modPow(ll a,ll b){
    ll ans =1;
    while(b>0){
        if(b&1){
            ans*=a;
            ans= (ans+MOD)%MOD;
        }
        a*=a;
        a= (a+MOD)%MOD;
        b = b>>1;
    }
    return  ans;
}


int main(){
    ll t=1; 
    //cin>>t;
    while(t--){
       string a,b; cin>>a>>b;
       ll ans =0;
       for(ll i=0;i<a.size();i++){
           if(a[i]!=b[i]) ans++;
       }
       cout<<ans<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3920
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int x=0;
        int[] arr = new int[n];
        for (int i =0;i<n;i++){
            arr[i] = s.nextInt();
        }
        for(int i=0;i<arr.length-1;i+=2){
            x = x^arr[i]^arr[i+1];
//            System.out.println(x + " " + arr[i] + arr[i+1]);
        }
//        System.out.println(x);
        for(int i =0;i<arr.length;i++){
            arr[i] = x^arr[i];
            System.out.print(arr[i] +" ");
        }
    }
}


Measured memory_bytes: 62016
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>

int main(void) {

int N , M;
scanf("%d %d",&N,&M);

int array[M];

for (int i = 0;i<M;i++)
    scanf("%d",&array[i]);

int sum = N;
 for (int i = 0;i<M;i++)
 {
   sum-=array[i];
 }

  if (sum<0)printf("-1");
  else printf("%d",sum);

 return EXIT_SUCCESS;
}



Measured memory_bytes: 1764
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n), b(n + 1, 0);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }
  reverse(a.begin(), a.end());
  a.push_back(a[0]);
  reverse(a.begin(), a.end());

  ll sum = 0;
  for(int i = 1; i <= n; i++) {
    sum *= -1;
    sum += a[i] * 2;
  }
  b[1] = sum / 2;
  for(int i = 2; i <= n; i++) {
    b[i] = a[i - 1] * 2 - b[i - 1];
  }
  for(int i = 1; i <= n; i++) {
    cout << b[i] << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 2928
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size)
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	int len = v.size();
	for (int i = 0; i < len; ++i) {
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	int len = vv.size();
	for (int i = 0; i < len; ++i) {
		s << vv[i] << endl;
	}
	return s;
}

int main(){
    int h,w; cin >> h >> w;
    string a[h]; 
    rep(i,h) cin >> a[i];
    string ans[h+2];
    rep(i,w+2){
        ans[0] += "#";
        ans[h+1] += "#";
    }
    for(int i = 1;i<=h;i++){
        ans[i] += "#" + a[i-1] + "#";
    }
    rep(i,h+2) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var str = ReadLine();
        var res = int.MaxValue;
        for(var i = 0; i < Input.Alfa.Length; i++)
        {
            var s = Input.Alfa[i];
            if (!str.Contains(s))
                continue;
            res = Min(res, str.Split(s).Max(st=>st.Length));
        }
        WriteLine(res);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public  static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if(A + B > C + D)
	cout << "Left" << endl;
  if(A + B == C + D)
    cout << "Balanced" << endl;
  if(A + B < C + D)
    cout << "Right" << endl;
}

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

#define watch(x) cout << (#x) << " = " << x << endl;
#define mkp make_pair
#define mkt make_tuple
#define pb push_back
#define ll long long
#define ld long double

using namespace std;

int main(){
	int n, dp[100010], h[100010];

	scanf("%d", &n);

	for(int i = 1; i <= n; i++) scanf("%d", &h[i]);

	dp[0] = 1e9;
	dp[1] = 0;
	
	for(int i = 2; i <= n; i++){
		dp[i] = min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2]) + dp[i - 2]);
	}

	printf("%d\n", dp[n]);

	return 0;
}

Measured memory_bytes: 1024
from itertools import product
from copy import deepcopy

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

ans = 0
for row in product(['.', '%'], repeat=H):
    if row == tuple(['%']*H):
        continue
    tmp1 = deepcopy(board)
    for h in range(H):
        if row[h] == '%':
            tmp1[h] = ['%']*W
    for col in product(['.', '%'], repeat=W):
        if col == tuple(['%']*W):
            continue
        tmp2 = deepcopy(tmp1)
        for w in range(W):
            if col[w] == '%':
                for h in range(H):
                    tmp2[h][w] = '%'
        if sum(tmp2, []).count('#') == K:
            ans += 1
print(ans)


Measured memory_bytes: 74752
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int N, K;
	long[] A;

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		K = Integer.parseInt(tokens[1]);
		tokens = in.readLine().split(" ");
		A = new long[N];
		for (int i = 0; i < N; ++i) {
			A[i] = Long.parseLong(tokens[i]);
		}
	}

	void calc() {
		long sum = 0;
		for (int i = 0; i < K; ++i) {
			sum += A[i];
		}
		for (int i = K; i < N; ++i) {
			long next = sum;
			next -= A[i - (K)];
			next += A[i];
			if (next > sum) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
			sum = next;
		}

	}

	void showResult() {
	}
}


Measured memory_bytes: 74848
#include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod=1e9 + 7;
 
int dx[]={-1, 0, 1, 0};
int dy[]={0, -1, 0, 1};
 


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

 
 
 int n,m;
 cin>>n>>m;
 int a=0,b=0;
map<int,int>mp,mp2;
  while(m--)
  {
      int x; cin>>x;
      string s; cin>>s;

      if(s=="WA")
      {
          if(mp.find(x)==mp.end())
            mp2[x]++;
      }

      if(s=="AC")
      {
          if(mp.find(x)==mp.end())
          {
              a++; mp[x]++;
          }
      }
  }
  for(auto i : mp)
  {
      b+=mp2[i.first];
  }

  cout<<a<<" "<<b<<"\n";

}

Measured memory_bytes: 12800
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    int N, M; cin >> N >> M;
    int left = 0;
    int right = N-1;
    for (int i = 0; i < M; ++i){
        int l, r; cin >> l >> r;
        --l, --r;
        left = max(left, l);
        right = min(right, r);
    }
    int res = max(0, 1 + right - left);
    cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define MAX 1000003
#define pii pair<ll,ll>
#define VP vector< pii >
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(ll (i) = (a); (i) < (b); (i)++)
#define all(v) (v).begin(),(v).end()
#define S(x) scanf("%d",&(x))
#define S2(x,y) scanf("%d%d",&(x),&(y))
#define SL(x) scanf("%lld",&(x))
#define SL2(x) scanf("%lld%lld",&(x),&(y))
#define P(x) printf("%d\n",(x))
#define FF first
#define SS second
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll k;
cin>>k;
ll sum=0;
rep(a,1,k+1)
	{
		rep(b,1,k+1){
			rep(c,1,k+1){
				ll gcd=__gcd(a,__gcd(b,c));
				sum+=gcd;

			}
		}
	}
cout<<sum;
return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
 
using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i< (int) n; i++)
#define PI  3.14159265358979323846264338327950
 
 
int main () {
    int N;
    cin >> N;

    vector<int>a(3*N);
    rep(i,3*N)cin >> a[i];

    sort(a.begin(),a.end());

    long long ans=0;
    for(int i=N; i < 3*N ; i+=2){
        ans += a[i];


    }

    cout << ans << endl;
}


Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<complex>
#include<vector>
#include<algorithm>
#include<functional>
#include<array>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9


int main() {
	string s;
	int n;
	cin >> s;
	cin >> n;
	for (int i = 0;i < s.length();i += n) {
		cout << s[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <chrono>
#include <regex>
using namespace std;
#define len(_x) (sizeof((_x)) / sizeof(_x)[0])
#define ll long long
#define fastIO  ios_base::sync_with_stdio(false); cin.tie(0); 
#define Ichar(_x) char _x=_getchar_nolock();
#define Iint(_x) int _x;scanf("%d",&_x); 
#define Ill(_x)  ll _x;scanf("%lld",&_x);
#define Istring(_x) string _x;cin>>_x; 
#define inc(a,b,x)(x)>=a && (x)<=b	
#define incE(a,b,x)(x)>=a && (x)<=b	
#define fileIO 	freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
//#define DEBUG
template<typename T>
int sUm(T* t1, T* t2)
{
	int s = 0;

	for (T* pi = t1; pi != t2; pi++)
	{
		s += *pi;
	}
	return s;
}

ll modo(ll a)
{
	return a % (int)(1e9+7);
}

int main()
{
	ll a, b;
	std::cin >> a >>b;
	std::cout << abs(a-2)*abs(b-2);
}





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

#define OK 1
#define NG 0

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

int N,A,B,C,D;
string S;
bool field[2000000+10];

int main(void) {
    cin>>N>>A>>B>>C>>D;
    cin>>S;
    S = "#"+S+"#";

    bool flag = false;
    for(int i = A+1;i <= max(C,D);i++) {
        if(S[i-1] == '#' && S[i] == '#') {
            flag = true;
        }
        else {
            flag = (flag | false);
        }
    }

    if(flag) {
        cout<<"No"<<endl;

        return 0;
    }

    if(D < C) {
        bool ok = false;

        for(int k = B;k <= D;k++) {
            if(S[k-1] == '.' && S[k] == '.' && S[k+1] == '.') {
                ok = true;
                break;
            }
        }

        if(ok) {
            cout<<"Yes"<<endl;

            return 0;
        } else {
            cout<<"No"<<endl;

            return 0;
        }
    }

    cout<<"Yes"<<endl;

    return 0;
}


Measured memory_bytes: 772
#include <bits/stdc++.h>
using namespace std;
using ld = long double;

int main()
{
	cout << fixed << setprecision(10);
	int N;
	cin >> N;
	vector<int> cnt(3);
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		cnt[a - 1] += 1;
	}
	vector<vector<vector<ld>>> dp(N + 1, vector<vector<ld>>(N + 1, vector<ld>(N + 1)));
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N; j++) {
			for (int k = 0; i + j + k <= N; k++) {
				if (i + j + k == 0) continue;
				ld p = (ld)N / (i + j + k);
				if (0 <= i - 1) dp[i][j][k] += (dp[i - 1][j + 1][k] + p) * ((ld)i / (i + j + k));
				if (0 <= j - 1) dp[i][j][k] += (dp[i][j - 1][k + 1] + p) * ((ld)j / (i + j + k));
				if (0 <= k - 1) dp[i][j][k] += (dp[i][j][k - 1] + p) * ((ld)k / (i + j + k));
			}
		}
	}
	cout << dp[cnt[2]][cnt[1]][cnt[0]] << endl;
	return 0;
}


Measured memory_bytes: 431360
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define veci(x,n) vector<int> x((int) (n))
#define vecs(x,n) vector<string> x((int) (n))
#define vecbf(x,n) vector<bool> x((int) (n), false)

vector<char> opans(3);

void search(vector<int> &a,vector<char> &op,int sum,int i) {
  bool con = true;
  if(i == 3){
    //cout << sum << endl;
    con = false;
    if(sum == 7){
      rep(i,3) opans.at(i) = op.at(i);
    }
  }
  
  int tmp = sum;
  if(con){
  op.at(i) = '+';
  sum += a.at(i+1);
  search(a,op,sum,i+1);
  }

  sum = tmp;
  if(con){
  op.at(i) = '-';
  sum -= a.at(i+1);
  search(a,op,sum,i+1);  
  }
  return;
}

int main(){
  string data;
  cin >> data;
  veci(a,4);
  rep(i,4){
    a.at(i) = data.at(i) - '0';
  }
  vector<char> op(3);
  int tmp = a.at(0);
  search(a,op,tmp,0);
  rep(i,3){
    cout << a.at(i) << opans.at(i);
  }
  cout << a.at(3) << "=7" << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	s := scanRunes()
	t := scanRunes()

	ans := []string{}
	for i := 0; i < len(s)-len(t)+1; i++ {
		f := true
		ss := make([]rune, len(s))
		copy(ss, s)

		for j := 0; j < len(t); j++ {
			if s[i+j] != t[j] && s[i+j] != '?' {
				f = false
				break
			} else {
				ss[i+j] = t[j]
			}
		}
		if f {
			ans = append(ans, strings.Replace(string(ss), "?", "a", -1))
		}
	}
	sort.Strings(ans)
	if len(ans) == 0 {
		fmt.Fprintln(wr, "UNRESTORABLE")
	} else {
		fmt.Fprintln(wr, ans[0])
	}
}


Measured memory_bytes: 1812
#include <iostream>

using namespace std;

int main(void){
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	int L, R;
	L = A + B;
	R = C + D;
	if(L > R){
		cout << "Left" << endl;
	}else if(L < R){
		cout << "Right" << endl;
	}else if(L == R){
		cout << "Balanced" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {
    int[] a;
    private void solve() {
        a = new int[5];
        for(int i = 0;i < 5;i++) {
            a[i] = nextInt();
        }

        int k = nextInt();
        int ans = 0;
        for(int i = 0;i < 5;i++) {
            for(int j = i + 1;j < 5;j++) {
                if (a[j] - a[i] > k) {
                    ans++;
                }
            }
        }

        out.println(ans == 0 ? "Yay!" : ":(");
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 22484
#include <stdio.h>

int main(void) {
	int a, b, times;

	scanf("%d",&a);
	scanf("%d", &b);

	times = (a * b) % 2;
	if (times == 0)
	{
		printf("Even\n");
	}
	else 
	{
		printf("Odd\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
static const int MAX_N = 100000;

int N, M;
vector<P> p[MAX_N];

int main(){
	scanf("%d %d", &N, &M);
	for(int i = 0; i < M; i++){
		int X, Y;
		scanf("%d %d", &X, &Y);
		X--;
		p[X].push_back(P(Y, i));
	}
	vector<P> res(M);
	for(int i = 0; i < N; i++){
		sort(p[i].begin(), p[i].end());
		for(int j = 0; j < p[i].size(); j++){
			res[p[i][j].second] = P(i + 1, j + 1);
		}
	}
	for(int i = 0; i < M; i++) printf("%06d%06d\n", res[i].first, res[i].second);
	return 0;
}

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

int main(){
  int x;
  cin >> x;
  int ans=0;
  if(x>=500){
    ans=ans+x/500*1000;
    x=x-x/500*500;
  }
  if(x>5){
    ans=ans+x/5*5;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;;
 
int main(){
    string s,t;
    cin >> s >> t;
    int ssize,tsize;
    ssize = s.length();
    tsize = t.length();
    int ans = tsize;
    for (int i = 0; i <= ssize-tsize; i++){
        int count = 0;
        for (int j = 0; j < tsize; j++){
            if (s[i+j] != t[j]){
                count++;
            }
        }
        ans = min(ans,count);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <iostream>

using namespace std;

void solve()
{
	int a, b;
	while(cin >> a >> b)
	{
		int sum = a + b;
		int ans = 0;
		while(sum)
		{
			sum /= 10;
			++ans;
		}
		cout << ans << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

int main(){
  int N,M,A,B;
  int koho = 0;
  int d[1000] = {};
  int haiki[1000] = {};

  cin >> N >> M >> A >> B ;

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

  for(int i = 0;i < N;i++){
    if(d[i] >= A){
      koho++;
      haiki[koho] = d[i];
    }else{
      break;
    }
  }
  if(N - koho < M){
    for(int i = koho;i > 0;i--){
      if(haiki[i] <= B){
        koho--;
      }else{
        break;
      }
    }
    }
      cout << koho << endl;



}

Measured memory_bytes: 1168
pow9 = [1, 9, 81, 729, 6561, 59049]
pow6 = [1, 6, 36, 216, 1296, 7776, 46656]
memo={1:1}
def cand(n):
    if memo.get(n):
        return memo[n]
    else:
        for c in pow6[::-1]:
            if c == n:
                memo[n] = 1
                return 1
            elif c < n:
                a = 1 + cand(n - c)
                break
        for c in pow9[::-1]:
            if c == n:
                return 1
            elif c < n:
                b = 1 + cand(n - c)
                break
        memo[n] = min(a,b)
        return memo[n]
n = int(input())
print(cand(n))

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define collect(arr, size) rep(i,size) cin >> arr[i];
#define int long long

signed main(){
    int D; cin >> D;
    cout << "Christmas";
    rep(i,25-D){
        cout << " Eve";
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
	int main() {
		int A, B, C;
		cin >> A >> B >> C;
		int tmp =A*B ;
		if (tmp >=C) {
			cout << C;
		} 
		else if ((tmp) < C) {
			cout << tmp;
		}
	}

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

char table[52][52];

int main() {

    int h,w;

    cin >> h >> w;

    for(int i=0;i<=h+1;i++){
        table[i][0] = '-';
        table[i][w+1] = '-';
    }

    for(int i=0;i<=w+1;i++){
        table[0][i] = '-';
        table[h+1][i] = '-';
    }

    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cin >> table[i][j];
        }
    }

    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(table[i][j] == '.') {
                int count = 0;
                if (table[i + 1][j + 1] == '#') count++;
                if (table[i + 1][j] == '#') count++;
                if (table[i + 1][j - 1] == '#') count++;
                if (table[i][j + 1] == '#') count++;
                if (table[i][j - 1] == '#') count++;
                if (table[i - 1][j + 1] == '#') count++;
                if (table[i - 1][j] == '#') count++;
                if (table[i - 1][j - 1] == '#') count++;
                stringstream ss;
                ss << count;
                ss >> table[i][j];
            }
        }
    }

    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cout << table[i][j];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a=n%10;
  int b=((n-a)%100)/10;
  int c=(n-a-b)/100;
  while(a!=b||b!=c){
    n++;
    a=n%10;
    b=((n-a)%100)/10;
    c=(n-a-b)/100;
  }
  cout<<n<<endl;
}

Measured memory_bytes: 256
list_t = []
n,c,k = map(int, input().split())
for i in range(n):
    list_t.append(int(input()))
list_t.sort()
count = 0
j = 0
start_time = list_t[j]
start_j = j

while j < n:
    if j - start_j + 1 > c:
        count += 1
        start_j = j
        start_time = list_t[j]
        j += 1
    elif list_t[j] - k > start_time:
        count += 1
        start_j = j
        start_time = list_t[j]
        j += 1
    else:
        j += 1
print(count+1)


Measured memory_bytes: 7384
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ios>//左右揃え
#include<iomanip>//setwで幅指定

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007LL

int main(void) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while (1) {
        c -= b;
        if (c <= 0) break;
        a -= d;
        if (a <= 0) break;
    }
    c <= 0 ? cout << "Yes" << endl : cout << "No" << endl;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);
#define ppp(a) (cout << (a) << endl); 
#define cop(a) for(auto x:(a)){cout << x << endl;}


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

constexpr char sp = ' ';
constexpr char cmm = ',';
constexpr ll MOD = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
inline void Yes(){cout << "Yes" << endl;}
inline void No(){cout << "No" << endl;}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){cout << "YES" << endl;}
inline void NO(){cout << "NO" << endl;}
inline void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

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; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        // comment this out when you use scanf or printf
        // cin.tie(0); ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){
    
    int n;
    scanf("%d", &n);
    vector<int> d(n);
    rep(i, n) scanf("%d", &d[i]);
    
    map<int, int> dis;
    int mx = 0;
    rep(i, n){
        dis[d[i]]++;
        chmax(mx, d[i]);
    }

    if(d[0] != 0 or dis[0] > 1){
       ppp(0);
       return 0;
    }
    ll ans = 1;
    for(int i = 1; i <= mx; ++i){
        (ans *= powmod(dis[i], dis[i+1])) %= MOD;
    }
    ppp(ans);
    
    
    
    
    return 0;
}


Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int n,x = 1000,y;
    cin>>n;
    while(n>x)
    {
        x+=1000;
    }
    if(x==n)
        cout<<0<<endl;
    else
    {
    y = x - n;
     cout<<y<<endl;
    }
    return 0;
}


Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        if (Character.isUpperCase(a.charAt(0))) {
            System.out.println("A");
        } else {
            System.out.println("a");
        }
        sc.close();
    }
}

Measured memory_bytes: 35632
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char ma[255][255];
    int n;
    while(cin>>n,n){
        int pillar[255]={},ans=0;
        for(int i=0;i<n;i++){
                int lo=0;
            for(int j=0;j<n;j++){
                cin>>ma[i][j];
                if(ma[i][j]=='1'){
                        pillar[j]++;
                        lo++;
                }
                else{
                    ans=max(pillar[j],ans);
                    ans=max(ans,lo);
                    lo=0;
                    pillar[j]=0;
                }

            }
            ans=max(ans,lo);
        }
        for(int i=0;i<n;i++){
                int kawa[4]={};
                ans=max(ans,pillar[i]);
                for(int j=0;j<=i;j++){
                    if(ma[j][i-j]=='1')kawa[0]++;
                    else{
                        ans=max(ans,kawa[0]);
                        kawa[0]=0;
                    }
                    if(ma[n-1-i+j][n-1-j]=='1')kawa[1]++;
                    else{;
                        ans=max(ans,kawa[1]);
                        kawa[1]=0;
                    }
                    if(ma[j][n-1-i+j]=='1')kawa[2]++;
                    else{
                        ans=max(ans,kawa[2]);
                        kawa[2]=0;
                    }
                    if(ma[n-1-i+j][j]=='1')kawa[3]++;
                    else {
                        ans=max(ans,kawa[3]);
                        kawa[3]=0;
                    }
                }
                ans=max(ans,kawa[0]);
                ans=max(ans,kawa[1]);
                ans=max(ans,kawa[2]);
                ans=max(ans,kawa[3]);
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 1224
#include<iostream>
using namespace std;
int main()
{
    int n,m;
    while(cin>>n>>m){
        int i,j,k,c=0;
        for(i=0;i<=n;i++){
            for(j=0;j<=n;j++){
                k=m-i-j;
                if(k<=n && k>=0){
                   // cout<<i<<" "<<j<<" "<<k<<endl;
                    c++;
                }
            }
        }
        cout<<c<<endl;
    }
return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()	{
  int a;
  cin >> a;
  if (a % 10 == 9 || a / 10 == 9)	{
    cout << "Yes" << endl;
  }
  else	{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(long long i=0; i<(int)n; i++)
#define rep2(i,a,n) for(long long i=(a); i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using psi = pair<string, int>;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};
const int mod = 1e9+7;
int gcd(int a, int b){if(a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}

int N, M, K, H, W, L, R, X;
//string S, T;

signed main(){
  cin >> N;
  if(N>=1200) cout << "ARC" << endl;
  else cout << "ABC" << endl;
  return 0;
}

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

using namespace std;
typedef long long ll;
#define FOR(i,n) for(int i=0; i<int(n); i++)
#define FOR1(i,m,n) for(int i=int(m); i<int(n); i++)

vector<int> f(int h, int w) {
    vector<int> c1, c2;
    int ww = w / 2;
    int hh = h / 2;
    c1.push_back(ww * h);
    c1.push_back((w-ww) * h);
    c2.push_back(w * hh);
    c2.push_back(w * (h-hh));
    if (abs(c1[0] - c1[1]) < abs(c2[0] - c2[1]))
        return c1;
    else
        return c2;
}

int g(int h, int w) {
    int ws[2] = {w/3, (w+2)/3};
    int hs[2] = {h/3, (h+2)/3};
    int mindiff = INT_MAX;
    vector<int> v;

    FOR(i, 2) {
        v = f(h, w-ws[i]);
        v.push_back(h * ws[i]);
        auto mn = min_element(v.begin(), v.end());
        auto mx = max_element(v.begin(), v.end());
        if (*mx - *mn < mindiff)
            mindiff = *mx - *mn;

        v = f(h-hs[i], w);
        v.push_back(hs[i] * w);
        mn = min_element(v.begin(), v.end());
        mx = max_element(v.begin(), v.end());
        if (*mx - *mn < mindiff)
            mindiff = *mx - *mn;
    }

    return mindiff;
}

int main(int argc, char *argv[])
{
    int H, W;

    cin >> H >> W;
    cout << g(H, W) << endl;;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<ii> vii;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define fr(be, en) for(int i = be; i <= en; i++) 
ll mod = LLONG_MAX;
ll power(ll a, ll b)
{
	if(b == 0) return 1;
	ll ans = power(a, b/2);
	ans = (ans*ans)%mod;
	if(b%2) ans*=a;
	return ans%mod;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cout.tie(NULL);
	cin.tie(NULL);
	int n, k;
	cin >> n >> k;
	vi v(n);
	fr(1, k) cin >> v[i - 1];
	ll sum = accumulate(v.begin(),v.end(), 0);
	if(sum > n) cout << -1;
	else cout << n - sum;
}

Measured memory_bytes: 7160
#include<stdio.h>
#include<algorithm>
using namespace std;
int a[5];
int main()
{
    for(int i=1;i<=3;i++)
    {
     scanf("%d",&a[i]);
    }
    sort(a+1,a+4);
   printf("%d\n",a[1]+a[2]);
    return 0;
}


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

#define ten(n) ((int)1e##n)
// dump macro{{{
// http://www.creativ.xyz/dump-cpp-652
#define DUMPOUT cerr // 変数ダンプ先。coutかcerr

#ifdef PCM
// 引数はいくつでもどんな型でも可（ストリーム出力演算子があればOK）
#define dump(...) DUMPOUT<<"  "; \
  DUMPOUT<<#__VA_ARGS__; \
  DUMPOUT<<":=> "; \
  dump_func(__VA_ARGS__); DUMPOUT<<"in ["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl;
#define dump_1d(x,n) DUMPOUT <<"  " \
  <<#x<<"["<<#n<<"]"<<":=> {"; \
  rep(i,n){ DUMPOUT << x[i] << (((i)==(n-1))?"}":", "); } DUMPOUT <<" in [" << __LINE__ << "]" << endl;

#define dump_2d(x,n,m) DUMPOUT <<"  " \
    <<#x<<"["<<#n<<"]"<<"["<<#m<<"]"<<":=> \n"; \
    rep(i,n)rep(j,m){ DUMPOUT << ((j==0)?"     |":" ") << x[i][j] << (((j)==(m-1))?"|\n":" "); } \
    DUMPOUT <<"  in [" << __LINE__ << "]" << endl;
#else
#define dump(...) 42
#define dump_1d(...) 42
#define dump_2d(...) 42
#endif

// デバッグ用変数ダンプ関数
void dump_func() {
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail)
{
    DUMPOUT << head;
    if (sizeof...(Tail) == 0) {
        DUMPOUT << " ";
    }
    else {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i<vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}/*}}}*/

#define rep(i, x) for(int i = 0; i < (int)(x); i++)/*{{{*/
#define reps(i,x) for(int i = 1; i <= (int)(x); i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define foreach(x,a) for(auto& (x) : (a) )
#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0)
#define sz(x) ((int)(x).size())
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define INF 2147483647
#define INFLL 1000000000000000000LL
#define MOD 1000000007/*}}}*/

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;/*{{{*/
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<vii> vvii;
typedef tuple<int,int,int> iii;
typedef set<int> si;
typedef complex<double> pnt;
typedef vector<pnt> vpnt;
typedef priority_queue<pii,vii,greater<pii> > spq;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

/*}}}*/

// global variables

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

  int c[3]={};
  rep(i,n){
    int tmp;cin>>tmp;
    if (tmp%4==0) c[2]++;
    else if (tmp%2==0) c[1]++;
    else c[0]++;
  }

  if (c[2]>=c[0]){
    cout << "Yes" << endl;
  }
  else if (c[2] >= c[0]-1 and c[1]==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;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)

const ll MOD = 998244353;

template<class T> T gcdi(T m, T n){
    T x1 = 0;
    T y1 = 1;
    T x2 = 1;
    T y2 = 0;
    T r, q, tmp;
    T mod = n;
    while(n)
    {
        r = m%n;
        q = m/n;
        m = n;
        n = r;

        tmp = x1;
        x1 = x2 - q*x1;
        x2 = tmp;

        tmp = y1;
        y1 = y2 - q*y1;
        y2 = tmp;
    }
    if (x2<0) x2 += mod;
    x2 %= mod;
    return x2;
}

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) {
        freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);
        //freopen("d:\\code\\cpp\\contests\\stdout", "w", stdout);
    }

    int n;
    cin >> n;
    vector<ll> a(n), v(1e6+1);
    ll sa = 0;
    FOR(i, n) {
        cin >> a[i];
        v[a[i]]++;
        sa += a[i];
    }

    vector<ll> c(1e6+1);
    FOR1(i, 1e6)
        c[i] = gcdi((ll)i, MOD);
    FOR1(i, 1e6){
        for(int j = 2*i; j <= 1e6; j+=i)
            c[j] += MOD-c[i];
        c[i] %= MOD;
    }

    ll sol = 0;
    FOR1(d, 1e6){
        ll sum = 0;
        for(int x = d; x<=1e6; x+=d)
            sum += x * v[x] % MOD;
        sum %= MOD;
        sol += sum * sum % MOD * c[d] % MOD;
        sum %= MOD;
    }
    sol += MOD - sa%MOD;
    sol %= MOD;
    sol *= gcdi(2ll, MOD);
    sol %= MOD;
    cout << sol << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789)        cerr << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

Measured memory_bytes: 17408
#include<stdio.h>

int main(){
	int N,i,j,temp,cout=0;
	scanf("%d",&N);
	int A[N];
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	for(i=0;i<N-1;i++){
		for(j=N-1;j>=i+1;j--){
			if(A[j]<A[j-1]){
				temp=A[j-1];
				A[j-1]=A[j];
				A[j]=temp;
				cout++;
			}
		}
	}
		printf("%d",A[0]);
	for(i=1;i<N;i++){
		printf(" %d",A[i]);
	}
	printf("\n");
	printf("%d\n",cout);
	return 0;
}



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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int A = nextInt();
  int B = nextInt();
  if (A * B % 2 == 1) 
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 256
N, K, Q = input().strip().split()
N, K, Q = [int(N), int(K), int(Q)]
A = [0] * (Q+1)  # index調整のため、長さQ+1のリストとする
for i in range(1, Q+1):
    A[i] = int(input())

# まず、全員が毎回負けた場合の点数は
points = [K - Q] * (N+1)

for i in range(1, Q+1): # 各ラウンドについて勝者に+1ポイント与える
    points[A[i]] += 1

for i in range(1, N+1):
    print('Yes' if points[i] > 0 else 'No')


Measured memory_bytes: 10412
import java.util.Scanner;

public class Main {
	
	static boolean findSum(int [] arr, int n, int sum) {
		if(sum == 0) {
			
			return true;
		}
		
		 if(n == 0 && sum != 0) {
			
			return false;
		}
		
		if(arr[n - 1] > sum) {
			return findSum(arr, n - 1, sum);
		}
		
		else {
			return findSum(arr, n - 1, sum) || findSum(arr, n-1, sum - arr[n - 1]);
		}
	}
	
	public static void main(String [] args) {
	
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int [] arr = new int [n];
		
		for(int i = 0; i < n; i ++) {
			arr[i] = in.nextInt();
		}
		
		int q = in.nextInt();
		
		int [] sums = new int [q];
		for(int i = 0; i < q; i++) {
			sums[i] = in.nextInt();
		}
		
		for(int i = 0; i < q; i++) {
			if(findSum(arr, arr.length, sums[i])) {
				System.out.println("yes");
			}
			
			else {
				System.out.println("no");
			}
		}
		
		
	}
}



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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	string s, t;

	cin >> s >> t;

	bool flag = false;

	REP(i, s.size()) {
		s = s.substr(1) + s[0];
		if (s == t) {
			flag = true;
			break;
		}
	}

	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main () {

	int a, b;
	cin >> a >> b;
	int br = 0;
	for (int i = a; i <= b; i ++) {
		int x = i;
		int y = 0;
		while (x > 0) {
			y = y * 10 + (x % 10);
			x /= 10;
		}
		
		if (i == y) br ++;
	}
	cout << br;

	return 0;
}


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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)

#ifdef DEBUG
#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__);
#else
#define dump(...)
#endif

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// IN
void IN() {}
template <class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

// OUTS
void OUTS() {}
template <class Head, class... Tail>
void OUTS(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  OUTS(forward<Tail>(tail)...);
}

template <class T>
void OUTS(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void OUTS(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// OUTL
void OUTL() {}
template <class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

template <class T>
void OUTL(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// OUTN
void OUTN() {}
template <class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}

template <class T>
void OUTN(vector<T> &vec) { for (auto &e : vec) cout << e; }

// DEGUG
template <class T>
void _dump(const char *s, T&& x) {
    clog << '{';
    while(*s != '\0') clog << *(s++);
    clog << ": " << x << '}' << "\n";
}

template <class Head, class... Tail>
void _dump(const char *s, Head&& head, Tail&&... tail) {
  clog << '{';
  while(*s != ',') clog << *(s++);
  clog << ": " << head << "}, ";
  for (++s; !isgraph(*s); ++s);
  _dump(s, forward<Tail>(tail)...);
}
// }}} End

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  VAR(int, a, b);

  i64 res = 0;
  i64 norm = 1;
  while (true) {
    if (norm >= b) { OUTL(res); return 0; }
    --norm;
    norm += a;
    ++res;
  }

  return 0;
}


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

#define PI 3.14159265358

int main(void)
{
	int a,b,deg_c;
	double rad_c;
	double S,L,h;
	double c;
	
	scanf("%d %d %d",&a,&b,&deg_c);
	
	rad_c = (double)PI * ((double)deg_c / 180);
	
	S = (double)a*(b*sin(rad_c))/2;
	
	c = (double)sqrt(a*a + b*b - 2*a*b*(cos(rad_c)));
	L = a+b+c;
	
	h = b*sin(rad_c);
	
	printf("%lf\n%lf\n%lf\n",S,L,h);
}


Measured memory_bytes: 2096