akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

set<int> ss;

int main(){
    int n; scanf("%d", &n);
    for(int x; n--; ){ scanf("%d", &x); ss.insert(x); }
    printf("%d\n", ss.size() % 2 ? ss.size() : ss.size() - 1);
}

Measured memory_bytes: 4992
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#define INF (2000000000)
#define MOD (1000000007)
using namespace std;

typedef vector<int> VI;
typedef vector<int>::iterator VII;
typedef vector<double> VD;
typedef vector<double>::iterator VDI;
typedef pair<int, int> P;
typedef map<int, int> MII;
typedef map<int, int>::iterator MIII;


int h[2000], w[2000];
map<int, int> x;
map<int, int> y;

int main()
{
	int N, M;
	while (scanf("%d %d", &N, &M), N + M){
		for (int i = 1; i <= N; i++){
			scanf("%d", &h[i]);
			h[i] += h[i - 1];
		}
		for (int j = 1; j <= M; j++){
			scanf("%d", &w[j]);
			w[j] += w[j - 1];
		}
		
		for (int i = 0; i <= N; i++){
			for (int j = i + 1; j <= N; j++){
				if (!y.count(h[j] - h[i])){
					y.insert(make_pair(h[j] - h[i], 1));
				}
				else {
					y[h[j] - h[i]]++;
				}
			}
		}
		
		for (int i = 0; i <= M; i++){
			for (int j = i + 1; j <= M; j++){
				if (!x.count(w[j] - w[i])){
					x.insert(make_pair(w[j] - w[i], 1));
				}
				else {
					x[w[j] - w[i]]++;
				}
			}
		}
		
		int cnt = 0;
		for (MIII ite = y.begin(); ite != y.end(); ite++){
			if (x.count(ite->first)){
				cnt += ite->second * x[ite->first];
			}
		}
		
		printf("%d\n", cnt);
		
		y.clear();
		x.clear();
	}
}

Measured memory_bytes: 27984
#include <stdio.h>
 
int main(void){
  long long int i;
  long long int n, k, sum=0, max=0, min=0;
  
  scanf("%lld %lld", &n, &k);
  
  for(i = k; i <= n+1; i++){
      min = i*(i-1)/2;
      max = i*(2*n-i+1)/2;
    sum += max-min+1;
  }
  printf("%lld", sum%1000000007);
  
  return 0;
}

Measured memory_bytes: 1712
#pragma GCC optimize("Ofast")
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

const long long INFL = 1e17+7;
const long long INFI = 1e9+7;
const long long MOD = 1e9+7;
const double EPS = 1e-8;
const double PI=acos(-1);

using namespace std;


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	int ans=0;
	for(int i=1;i<=n;i++){
		int temp;
		cin >> temp;
		if(temp%2!=0 && i%2!=0)ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3636
#include <cstdio>
#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>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n, k;
	cin>>n>>k;
	int h[100000];
	for(int i=0; i<n; i++){
		cin>>h[i];
	}
	sort(h, h+n);
	int ans=1e9+7;
	for(int i=0; i<=n-k; i++){
		ans=min(ans, h[i+k-1]-h[i]);
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(void){
	ll n;
	cin >> n;
	ll ans = 0LL;
	for(ll k = 1; k <= sqrt(n); ++k){
		if(n%k!=0) continue;
		ll m = n / k - 1;
		if(k<m) ans+=m;
		// if(n/m==n%m){
		// 	ans += m;
		// }
	}
	cout << ans << endl;
}

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

int main(){
	int n, k;
	int count = 0;
	cin >> n >> k;
	unordered_map<int, int> m;
	for(int i=0; i<n; i++){
		int a;
		cin >> a;
		m[a]++;
	}
	vector<int> v;
	for (auto itr = m.begin(); itr != m.end(); ++itr){
		v.push_back(itr->second);
	}
	sort(v.begin(), v.end());
	int i=0;
	int num = m.size();
	while(k < num){
		count += v[i];
		num--;
		i++;
	}
	cout << count;
}



Measured memory_bytes: 10312
#include <stdio.h>
void print_c(int a[100][100], int b[100][100], int n, int m, int l)
{
    int i, j, k;
    long long c[100][100] = {0};
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < l; j++)
        {
            for (k = 0; k < m; k++)
            {
                c[i][j] += a[i][k] * b[k][j];
            }
        }
    }
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < l - 1; j++)
        {
            printf("%lld ", c[i][j]);
        }
        printf("%lld\n", c[i][l - 1]);
    }
}
int main(void)
{
    int n, m, l;
    int a[100][100];
    int b[100][100];

    scanf("%d %d %d", &n, &m, &l);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            scanf("%d", &a[i][j]);
        }
    }
    for (int i = 0; i < m; i++)
    {
        for (int j = 0; j < l; j++)
        {
            scanf("%d", &b[i][j]);
        }
    }

    print_c(a, b, n, m, l);
    return 0;
}



Measured memory_bytes: 2852
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int a = scan.nextInt();
		int b = scan.nextInt();
		int ans = 0;
		if (a > b + w) {
			ans = a - (b + w);
		} else if (a + w < b) {
			ans = b - (a + w);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
import sys
 
L, R = map(int, input().split())
 
if R-L >= 2019:
  print('0')
  sys.exit()
 
L = L % 2019
R = R % 2019
if L > R:
  print('0')
 
mmin = 2019
for i in range(L, R):
  for j in range(i+1, R+1):
    mmin = min(mmin, (i*j)%2019)
print(mmin)

Measured memory_bytes: 40812
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main()
{
	char s[4]{ 0 };
	char firstTwo[2]{ 0 };
	int first = 0;
	char secondTwo[2]{ 0 };
	int second = 0;

	cin >> s;

	// copy manually
	firstTwo[0] = s[0];
	firstTwo[1] = s[1];
	secondTwo[0] = s[2];
	secondTwo[1] = s[3];

	// convert to integer
	first = stoi(std::string(firstTwo, sizeof(firstTwo)));
	second = stoi(std::string(secondTwo, sizeof(secondTwo)));

	// check
	bool mmyy = false;
	bool yymm = false;

	if ((first >= 1) && (first <= 12))
	{
		mmyy = true;
	}

	if ((second >= 1) && (second <= 12))
	{
		yymm = true;
	}

	if (mmyy && !yymm)
	{
		cout << "MMYY";
	}
	else if (!mmyy && yymm)
	{
		cout << "YYMM";
	}
	else if (mmyy && yymm)
	{
		cout << "AMBIGUOUS";
	}
	else
	{
		cout << "NA";
	}

	return 0;

}

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

using namespace std;

main() {
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, x;
    cin >> n;
    n = (1 << n);
    multiset < int > a, b;
    for (int i = 1; i <= n; ++i) {
        cin >> x;
        a.insert(-1 * x);
    }
    x = (*a.begin());
    b.insert(x);
    a.erase(a.find(x));
    int t = 0;
    while ((int)a.size() > 0) {
        multiset < int > c;
        for (auto key : b) c.insert(key);
        for (int i = 0; i < (1 << t); ++i) {
            x = (*b.begin());
            auto it = a.upper_bound(x);
            if (it == a.end()) {
                cout << "No" << '\n';
                return 0;
            }
            c.insert((*it));
            a.erase(it);
            b.erase(b.find(x));
        }
        b = c;
        t++;
    }
    cout << "Yes" << '\n';
    return 0;
}


Measured memory_bytes: 24832
// https://atcoder.jp/contests/abc150/tasks/abc150_c

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N;
  cin >> N;

  VL ps(N);
  VL qs(N);
  rep(i, N) cin >> ps[i];
  rep(i, N) cin >> qs[i];

  VL a(N);
  rep(i, N) a[i] = i + 1;

  ll pi;
  ll qi;

  ll ct = 0;
  do {
    if (a == ps) pi = ct;
    if (a == qs) qi = ct;
    ct++;
  } while (next_permutation(all(a)));

  cout << abs(pi - qi) << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
w,h,n = map(int,input().split())
xya = [list(map(int,input().split())) for i in range(n)]

ans = [[1]*h for _ in range(w)]

for i in range(n):
    if xya[i][2] == 1:
        for j in range(xya[i][0]):
            for k in range(h):
                ans[j][k] = 0
    elif xya[i][2] == 2:
        for j in range(xya[i][0],w):
            for k in range(h):
                ans[j][k] = 0
    elif xya[i][2] == 3:
        for j in range(xya[i][1]):
            for k in range(w):
                ans[k][j] = 0
    else:
        for j in range(xya[i][1],h):
            for k in range(w):
                ans[k][j] = 0

total = 0
for i in ans:
    total += sum(i)
print(total)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	int a[100005],b[100005];
	cin >> n;
	for(int i=0;i<=n;i++){
		cin >> a[i];
	}
	for(int i=0;i<n;i++){
		cin >> b[i];
	}
	long long cnt=0;
	for(int i=0;i<n;i++){
		if((a[i] + a[i+1]) <= b[i]){
			cnt=cnt+a[i]+a[i+1];
			a[i+1]=0;			
		}
		else{
			cnt=cnt+b[i];
			if(a[i] <= b[i]){
				b[i]=b[i]-a[i];
				a[i+1]=a[i+1]-b[i];
			}
		} 				
	}
	printf("%lld\n",cnt);
	
	return 0;
}

Measured memory_bytes: 1024
N, D = gets.chomp.split(" ").map(&:to_i)
X = []
N.times{
  X << gets.chomp.split(" ").map(&:to_i)
}

def is_integer(y, z)
  tmp = 0
  y.zip (z){|yi, zi| tmp += (yi - zi) ** 2}
  tmp == (Math.sqrt(tmp).floor) ** 2
end

ans = 0
(0..N - 2).each{|i|
  (i + 1..N - 1).each{|j|
    ans += 1 if is_integer(X[i], X[j])
  }
}

puts ans


Measured memory_bytes: 3836
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <queue>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rrep(i,n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef pair<int,int> P;
const int INF = 1000000000;

int main(){
	/*
	int N,R,L;
	int n,t,s;
	int nowN=-1,befT=0,maxS;
	static int scr[114514],time[114514];
	scanf("%d%d%d",&N,&R,&L);
	rep(i,R){
		maxS=-INF;
		scanf("%d%d%d",&n,&t,&s);
		if(nowN>-1)time[nowN]+=t-befT;
		scr[n-1]+=s;
		rep(i,N)maxS=max(scr[i],maxS);
		rep(i,N)if(scr[i]==maxS){nowN=i;break;}
		befT=t;
	}
		maxS=-INF;
		t=L;
		time[nowN]+=t-befT;
		rep(i,N)maxS=max(time[i],maxS);
		rep(i,N)if(time[i]==maxS){nowN=i;break;}
		printf("%d\n",nowN+1);
	return 0;*/
	
	int N,R,L;
	int n,t,s;
	int nowN=-1,befT=0,maxS;
	static int scr[114514],time[114514];
	scanf("%d%d%d",&N,&R,&L);
	rep(i,R){
		maxS=-INF;
		scanf("%d%d%d",&n,&t,&s);
		if(nowN>-1)time[nowN]+=t-befT;
		scr[n-1]+=s;
		if(nowN==-1){
		if(scr[n-1]>0)nowN=n-1;
		else if(n==0)nowN=1;
		else nowN=0;
		//else nowN = (scr[n-1]==scr[nowN]?min(n-1,nowN):(scr[n-1]>scr[nowN]?n-1:nowN));
		}else if(n-1!=nowN){
			if(scr[n-1]>=scr[nowN]){
				if(scr[n-1]==scr[nowN])nowN=min(n-1,nowN);
				else nowN=n-1;
			}
		}else if(n-1==nowN){
			if(s<0){
				nowN=0;
				rep(i,N)if(scr[i]>scr[nowN])nowN=i;
			}else{
			
			}
			//rep(i,N)if(scr[i]==maxS){nowN=i;break;}
		}
		befT=t;
	}
		maxS=-INF;
		t=L;
		time[nowN]+=t-befT;
		rep(i,N)maxS=max(time[i],maxS);
		rep(i,N)if(time[i]==maxS){nowN=i;break;}
		printf("%d\n",nowN + 1);
	return 0;
}

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

using namespace std;

int main(){
  
  	int cnt = 0,n;
  
  	cin >> n;
  	bool f = false;
  
  	for(int i = 0; i < n; i++){
     	
      int a,b;
      
      cin >> a >> b;
      
      if(a == b) cnt++;
      else cnt = 0;
      
      if(cnt >= 3) f = true;
    }
  
  	if( f ) cout <<"Yes" << endl;
  	else cout << "No" << endl;
  
 	return 0; 
}

Measured memory_bytes: 3580
string = input()
#days = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

if string =="SUN":
  print(str(7))
elif string == "MON":
  print(str(6))
elif string == "TUE":
  print(str(5))
elif string == "WED":
  print(str(4))
elif string == "THU":
  print(str(3))
elif string == "FRI":
  print(str(2))
elif string == "SAT":
  print(str(1))
 

Measured memory_bytes: 2940
// バケット法による解
#include <bits/stdc++.h>
using namespace std;

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

    int bucket[110] = {0}; // バケット
    for (int i = 0; i < N; i++) {
        bucket[d[i]]++; // d[i]が1増える
    }

    int res = 0; // 答えを格納
    for (int i = 1; i <= 100; i++) { // 1 <= d[i] <= 100
        if (bucket[i]) res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class Main {
  import java.io._
  import java.util.StringTokenizer

  import scala.collection.mutable
  import scala.util.Sorting
  import math.{abs, max, min}
  import mutable.{ArrayBuffer, ListBuffer}
  import scala.reflect.ClassTag

  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val A, B, C = ni()
    val ans = min(C, B / A)
    out.println(ans)
  }


  def debug(as: Array[Boolean]): Unit = {
    System.err.println(as.map(x => if(x) "1" else "0").mkString)
  }

  def debug(as: Array[Int]): Unit = {
    System.err.println(as.mkString(" "))
  }

  def debug(as: Array[Long]): Unit = {
    System.err.println(as.mkString(" "))
  }

  def debug(s: String): Unit = {
    System.err.println(s)
  }

  def debug(num: Long): Unit = {
    System.err.println(num)
  }

  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int, offset: Int = 0): Array[Int] = map(n)(_ => ni() + offset)
  def na2(n: Int, offset: Int = 0): (Array[Int], Array[Int]) = {
    val A1, A2 = Array.ofDim[Int](n)
    REP(n) { i =>
      A1(i) = ni() + offset
      A2(i) = ni() + offset
    }
    (A1, A2)
  }
  def nm(n: Int, m: Int): Array[Array[Int]] = {
    val A = Array.ofDim[Int](n, m)
    REP(n) { i =>
      REP(m) { j =>
        A(i)(j) = ni()
      }
    }
    A
  }
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm_c(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  def REP(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def REP_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int, offset: Int = 0)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    REP(n)(i => res(i) = f(i + offset))
    res
  }


  def sumL(as: Array[Int]): Long = {
    var s = 0L
    REP(as.length)(i => s += as(i))
    s
  }

  def cumSum(as: Array[Int]) = {
    val cum = Array.ofDim[Long](as.length + 1)
    REP(as.length) { i =>
      cum(i + 1) = cum(i) + as(i)
    }
    cum
  }
}


Measured memory_bytes: 27212
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

int main() {
	int A, B;
	cin >> A >> B;

	cout << max(A - 2 * B, 0) << endl;
}

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

//ユークリッドの互除法
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b,a%b);
}

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i=0; i<N; i++) cin >> A[i];
    
    vector<ll> gcd_left(N+1), gcd_right(N+1);
    gcd_left[0] = gcd_right[0] = 0;
    gcd_left[1] = A[0];
    gcd_right[1] = A[N-1];
    
    for (int i=1; i<N; i++) {
        gcd_left[i+1] = gcd(A[i], gcd_left[i]);
        gcd_right[i+1] = gcd(A[N-i-1], gcd_right[i]);
    }
    
    ll ans = 0;
    for (int i=0; i<N; i++) {
        ans = max(ans, gcd(gcd_left[i], gcd_right[N-i-1]));
    }
    
    cout << ans << endl;
    
}

Measured memory_bytes: 2560
n=int(input())
s=[]
ctr=0
ctr_a=0
ctr_b=0
ctr_ab=0
for i in range(n):
    s.append(str(input()))
    if "AB" in s[i]:
        ctr+=s[i].count("AB")
    if s[i][-1]=="A" and s[i][0]!="B":
        ctr_a+=1
    if s[i][0]=="B" and s[i][-1]!="A":
        ctr_b+=1
    if s[i][-1]=="A" and s[i][0]=="B":
        ctr_ab+=1
if ctr_ab==0:
    print(ctr+min(ctr_a,ctr_b))
else:
    if ctr_a+ctr_b>0:
        print(ctr+min(ctr_a,ctr_b)+ctr_ab)
    else:
        print(ctr+ctr_ab-1)


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

int main() {
    ll n,sol=0,x,y;
    cin >> n;
    for (int i=1;i<=n;i++) {
        x=n/i;
        y=(x+1)*x/2;
        sol+=i*y;
    }
    cout << sol;
}


Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");
    int n = Integer.parseInt(sl[0]);
    int x = Integer.parseInt(sl[1]);

    System.out.println(500 * n >= x ? "Yes" : "No");
  }

}

class RemRing
{
  long module;

  public RemRing(long module)
  {
    this.module = module;
  }

  public long sum(long a, long b)
  {
    return (a + b + module) % module;
  }

  public long sub(long a, long b)
  {
    return (a - b + module) % module;
  }

  public long prod(long a, long b)
  {
    return (a * b) % module;
  }

  public long div(long a, long b)
  {
    return (a * inv(b)) % module;
  }

  public long inv(long a)
  {
    long b = this.module;
    long u = 1;
    long v = 0;
    while (b > 0)
    {
      long t = a / b;
      a -= t * b;
      u -= t * v;
      long z = a;
      a = b;
      b = z;
      z = u;
      u = v;
      v = z;
    }
    u %= this.module;
    if (u < 0)
      u += this.module;
    return u;
  }
}


Measured memory_bytes: 19540
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <numeric>

int main(void) {
	int n, t, a;

	std::cin >> n >> t >> a;

	int ans = 0;
	double min = 10000000;

	for (size_t i = 0; i < n; i++) {
		double h;
		std::cin >> h;

		double temperature = t - h * 0.006;

		if (min > std::abs(a - temperature)) {
			min = std::abs(a - temperature);
			ans = i;
		}
	}

	std::cout << ans + 1 << std::endl;

	return 0;
}

Measured memory_bytes: 256
S = list(input())
ans = "AC"

if S[0] != "A":
  ans = "WA"

if S[2:-1].count("C") != 1:
  ans = "WA"
else:
  S.pop(S[2:-1].index("C") + 2)

if not "".join(S[1:]).islower():
  ans = "WA"

print(ans)


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

int main(){

	int W,H,x,y,r;
	cin >> W >> H >> x >> y >> r;

	if((0<=(x-r))&&((x+r)<=W)&&(0<=(y-r))&&((y+r)<=H)){
	cout << "Yes" << endl;
	}else{
	cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
<?php

fscanf(STDIN, "%d", $row);

$min = 100 ;

for($i=0;$i<$row;$i++){
  fscanf(STDIN, "%d", $int);
  
  if($int < $min && $int % 10 != 0){
  	$min = $int;
  }
  
  $sun = $int + $sun;
}


if($sun % 10 == 0){
	$sun = $sun - $min ;
}

if($sun % 10 == 0){
  echo 0;
  return;
}

echo $sun;



?>


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

int main() {
  int a, b;
  cin >> a >> b;

  int x = a / b;
  int y = a % b;
  double z = (double)a / (double)b;

  //cout << x << " " << y << " " << z << endl;
  printf("%d %d %lf\n", x, y, z);
}



Measured memory_bytes: 3232
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a, n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a  ,min(b, c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a, n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;

int32_t main()
{
    int n;
    cin>>n;
    int arr[n+1][4];
    for(int i=1;i<n+1;i++)
    {
        cin>>arr[i][1]>>arr[i][2]>>arr[i][3];
    }
    vector< vector<int> > dp(n+1, vector<int> (4));
    for(int i=1;i<4;i++)
    {
        dp[0][i] = 0;
        dp[1][i] = arr[1][i];
    }
    for(int i=2;i<n+1;i++)
    {
        for(int j=1;j<4;j++)
        {
            int maxm = -1;
            for(int k=1;k<4;k++)
            {
                if(dp[i-1][k] > maxm && k!=j)
                {
                    maxm = dp[i-1][k];
                }
            }
            dp[i][j] = arr[i][j] + maxm;
        }
    }
    cout<< *max_element(dp[n].begin()+1, dp[n].end());
    return 0;
}


Measured memory_bytes: 10368
N,M=map(int,input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]

for i in range(N-M+1):
    for j in range(N-M+1):
        flag1=0
        for k in range(M):
            if B[k] != A[i+k][j:j+M]:
                flag1=1
                break
        if flag1==0:
            break
    if flag1==0:
        break
if flag1 == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <cstdio>
#define N 200010
using namespace std;

int n, a[N], max1, max2, p;

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &a[i]);
		if (a[i] >= max1)
			max2 = max1, max1 = a[i], p = i;
		else if (a[i] > max2)
			max2 = a[i];
	}
	for (int i = 1; i <= n; ++i)
		printf("%d\n", i == p ? max2 : max1);
	return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
#define rep(i,n) ;for( int i =0; i < n ; i ++)
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int abs(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int fiv(int n){
  if(n==0){
    return 0;
  }
  else if(n==1){
    return 1;
  }
  return fiv(n-1)+fiv(n-2);
}
ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}
int main(){
  int n,ans=0;
  cin>>n;
  vector<ll> a(n);
  rep(i,n){
    cin>> a[i];
    if(a[i]%2 ==0){
      while(a[i]%2 != 1){
        a[i] /=2;
        ans ++;
        
      }
    }
  }
  cout<<ans <<endl;
 
  
}


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

using namespace std;

#define allof(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 105;

int N;

int main(){
    cin.tie(0);
    cin.sync_with_stdio(0);

    cin >> N;

    int prv = -1;
    int len = 0;
    int ans = 0;

    for(int a = 1; a <= N; a++){
        int x;
        cin >> x;
        if(x != prv){
            prv = x;
            ans += len / 2;
            len = 0;
        }

        len++;
    }

    ans += len / 2;
    cout << ans;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

int main(){
  ll i, j;
  ll a, b;
  cin >> a >> b;
  //string s; cin >> s;
  ll result = 0;
  bool judge = true;
  cout << max({a+b,a-b,a*b}) << endl;

  /*
  vector<ll> a(n);
  for(i = 0; i < n; i++)
    cin >> a[i];
  //for(i = 0; i < n; i++)
  */
  
  /*
  if(judge)
    //cout << "Yes" << endl;
    //cout << "YES" << endl;
    //cout << "Yay!" << endl;
  else
    //cout << "No" << endl;
    //cout << "NO" << endl;
    //cout << ":(" << endl;
  */
  
  //cout << result << endl;

  return 0;
}

Measured memory_bytes: 256
s=input()
l=len(s)
amari=[0]*2019
amari[0]=1

d=0
digi=1

for c in s[::-1]:
    d=(int(c)*digi + d)%2019
    amari[d]+=1
    digi=(digi*10)%2019

ans=0
for i in amari:
    ans+=i*(i-1)//2
print(ans)

Measured memory_bytes: 68480
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
const int N = 301;
int ptr[N], a[N][N], n, m, cnt[N];
bool ban[N];
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    cin >> n >> m;
    for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) cin >> a[i][j];
    int ans = N;
    for (int t = 0; t < m; ++t) {
        for (int i = 0; i < N; ++i) cnt[i] = 0;
        for (int i = 0; i < n; ++i) ++cnt[a[i][ptr[i]]];
        int mx = 0;
        for (int i = 1; i <= m; ++i) {
            if (cnt[i] > cnt[mx]) mx = i;
        }   
        ans = min(ans, cnt[mx]);
        ban[mx] = 1;
        for (int i = 0; i < n; ++i) {
            while (ptr[i] < m && ban[a[i][ptr[i]]]) ++ptr[i];
        }
    }   
    cout << ans << '\n';
}   


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

typedef long long ll;
typedef pair<int, int> ii;

const double PI = atan(1) * 4.0;

int main()
{
    int a, b, x;
    scanf("%d %d %d", &a, &b, &x);

    int total = a * a * b;

    double ans = 0.0;
    // case 1
    double z = (2.0 * (total - x)) / (1.0 * a * a);
    if (z <= b) {
        // printf("z1 = %.15lf, ans = %.15lf\n", z, ans);
        ans = atan(z / a);
    } else {
        // case 2
        z = (2.0 * x) / (1.0 * b * a);
        ans = PI / 2 - atan(z / (1.0 * b));
        // printf("z2 = %.15lf, ans = %.15lf\n", z, ans);
    }

    printf("%.15lf\n", ans * 180.0 / PI);

    return 0;
}


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

int main()
{
    double N, count = 0, tmp;

    cin >> N;

    for (int i = 1; i <= N; i++){
        if(i%2==1){
            count++;
        }
    }
    tmp = count / N;
    cout << tmp << endl;
}

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

using namespace std;
typedef int lli;

list<lli> l;
lli n;

int main(){
    string c;
    lli x;
    list<lli>::iterator itr;
    cin >> n;
    for(lli i = 0;i < n;i++){

        cin >> c;
        if(c == "insert"){
            cin >> x;
            l.push_front(x);
        }else if(c == "delete"){
            cin >> x;
            for(itr = l.begin();itr != l.end();itr++){
                if(*itr == x){
                    l.erase(itr);
                    break;
                }
            }
        }else if(c == "deleteFirst"){
            l.pop_front();
        }else if(c == "deleteLast"){
            l.pop_back();
        }
    }
    bool flag = false;
    for(itr=l.begin();itr!=l.end();++itr){
        if(flag==false){
            cout << *itr;
            flag=true;
        }
        else cout << " " << *itr;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 34324
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x;
  cin >> x;
  vector<bool> dp(x+110);
  dp[0] = true;
  for (int i = 0; i <= x; i++) {
    if (dp[i]) {
      for (int j = 0; j <= 5; j++)
        dp[i+j+100] = true;
    }
  }
  if (dp[x])
    cout << 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
// #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
// #include <bitset>
const int oo=2139063143;
const int N=310;
const int P=1000000007;
using namespace std;
typedef long long LL;
typedef double db;
#define pritnf printf
//char buf[1<<22],*p1=buf,*p2=buf,obuf[1<<22],*O=obuf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <typename T>
inline void sc (T &x)
{
    x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
}
template <typename T>
inline void print (T x)
{
	if (x< 0) putchar('-'),x=-x;
	if (x>=10) print(x/10);
	putchar(x%10+'0');
}
template <typename T>
inline void pr (T x) { print(x),putchar('\n'); }
void chkmax (int &A,int B) { A=A>=B?A:B; }
char s[N];
int f[N][N][N];
int main ()
{
	// freopen (".in","r",stdin);
	// freopen (".out","w",stdout);
	scanf ("%s",s+1);
	int n=strlen (s+1),k; sc(k);
	for (int i=1; i<=n; i++)
		f[i][i][0]=1;
	for (int len=2; len<=n; len++)
	{
		for (int l=1,r=len; r<=n; l++,r++)
		{
			for (int i=0; i<=k; i++)
			{
				f[l][r][i]=max (f[l+1][r][i],f[l][r-1][i]);
				if (s[l]==s[r]) chkmax (f[l][r][i],f[l+1][r-1][i]+2);
				if (i) chkmax (f[l][r][i],f[l+1][r-1][i-1]+2);
			}
		}
	}
	int ans=0;
	for (int i=0; i<=k; i++)
		chkmax (ans,f[1][n][i]);
	pr(ans);

	return 0;
}


Measured memory_bytes: 114432
H,W,d = map(int,input().strip().split())
colors = ('R','Y','G','B')
for i in range(H):
    line = []
    for j in range(W):
        x = (i+j)%(2*d) >= d
        y = (i-j)%(2*d) >= d
        line.append(colors[2*x+y])
    print(''.join(line))

Measured memory_bytes: 3316
using namespace std;

#include <cstdint>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>

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

    long     N = 0;
    long     n = 0;
    cin >> N;
    long     ans = 0;
    for(n = 1; n<N+1; n++){
        if(n%3 != 0 && n%5 != 0){
            ans = ans + n;
        }
    }
    cout << ans << "\n";
    return 0;
    
}


Measured memory_bytes: 3652
import math
def euqlid(x,y):
    while x % y != 0:
        tmp = x % y
        x = y
        y = tmp
    return y
a, b = map(int, input().split())
if a < b:
    tmp = a
    a = b
    b = tmp
k = euqlid(a, b)
sum = 0
i = 2
if k == 1:
    print(1)
    exit()
while i <= math.sqrt(k):
    flag = False
    while k % i == 0:
        k = k // i
        flag = True
    if flag:
        sum += 1
    i += 1
if i <= k:
    sum += 1
print(sum + 1)


Measured memory_bytes: 3064
n, x, m = map(int, input().split())
nxt = [-1] * m
now = x
while nxt[now] == -1:
    nxt[now] = now * now % m
    now = nxt[now]
junction = now
ans = x
now = x
n = n - 1
while n and now != junction:
    now = nxt[now]
    n -= 1
    ans += now
if n == 0:
    print(ans)
    exit()

llen = 1
lsum = junction
now = nxt[junction]
while now != junction:
    llen += 1
    lsum += now
    now = nxt[now]
ans += lsum * (n // llen)
n = n % llen

now = junction
while n:
    now = nxt[now]
    n -= 1
    ans += now
print(ans)

Measured memory_bytes: 65720
using System;

namespace _106_1
{
    class Program
    {
        static void Main(string[] args)
        {
			string[] str = Console.ReadLine().Split(' ');
			int A = int.Parse(str[0]);
			int B = int.Parse(str[1]);
			Console.WriteLine(A * B - A - B + 1);
        }
    }
}


Measured memory_bytes: 11092
import java.util.*;

class calArea{
    int Area(int w, int h ){
        int area = w * h;
        return area;
    }
}

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<Integer> arr = new ArrayList<>();
        
        for(int i = 0; i < 4;i++){
            arr.add(Integer.parseInt(sc.next()));
        }
        
        calArea ab = new calArea();
        int area1 = ab.Area(arr.get(0),arr.get(1));
        int area2 = ab.Area(arr.get(2),arr.get(3));
        
        if(area1 > area2){
            System.out.println(area1);
        }else if(area1 < area2){
            System.out.println(area2);
        }else if(area1 == area2){
            System.out.println(area1);
        }   
        
    }
    
}

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

int32_t main()
{
 int n;
 cin>>n;
 set<string> c;
 for(int i = 0; i<n; i++){
 	string s;
 	cin>>s;
 	c.insert(s);


 }
 cout<<c.size()<<endl;
}


Measured memory_bytes: 19140
#include <iostream>

using namespace std;

typedef long long ll;

const int size = 200005;
const ll mod = 1e9+7;

ll inv[size], fac[size], finv[size];

void comInit() {
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;

		for (int i = 2; i < size; i++) {
				inv[i] = mod - inv[mod%i] * (mod/i) % mod;
				fac[i] = fac[i-1] * (ll)i % mod;
				finv[i] = finv[i-1] * inv[i] % mod;
		}
}

ll com(int a, int b) {
		if (a < b) return 0;
		return fac[a] * (finv[b] * finv[a-b] % mod) % mod;
}

ll modPow(ll x, ll t) {
		if (t == 0) return 1;
		ll res = modPow(x, t/2);
		res = res * res % mod;
		if (t % 2 == 1) res = res * x % mod;
		return res;
}

int main() {
		comInit();
		int N, A, B, C;
		cin >> N >> A >> B >> C;
		ll pa = (ll)A * inv[A+B] % mod;
		ll pb = (ll)B * inv[B+A] % mod;
		ll ans = 0;

		for (int k = 0; k < N; k++) {
				ans += com(k+N-1, k) * modPow(pb, k) % mod * modPow(pa, N) % mod * (ll)(k+N) % mod;
				ans += com(k+N-1, k) * modPow(pa, k) % mod * modPow(pb, N) % mod * (ll)(k+N) % mod;
				ans %= mod;
		}

		ans = ans * inv[A+B] % mod * 100LL % mod;
		cout << ans << endl;
		return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll a[200005],b[200005],cnt[200005],A[2005],B[2005],ans=0;
int main() {
	cin>>n;
	for(int i=1;i<=n;i++){
		long double x;
		scanf("%Lf",&x),a[i]=round(x*1e9);
		if(a[i]%1000000000==0)ans--;
	}
	for(ll i=0,p2=1;p2<=1000000000000000000ll;i++,p2<<=1){
		for(ll j=0,p5=1;p2*p5<=1000000000000000000ll;j++,p5*=5)b[++b[0]]=p2*p5,A[b[0]]=i,B[b[0]]=j;
	}
	for(ll i=1;i<=n;i++){
		for(ll j=1;j<=b[0];j++){
			if(a[i]%b[j]==0&&a[i]%(b[j]*2)!=0&&a[i]%(b[j]*5)!=0){
				cnt[j]++;//cout<<b[j]<<' '<<A[j]<<' '<<B[j]<<endl;
				break;
			}
		}
	}
	for(int i=1;i<=b[0];i++){
		for(int j=1;j<=b[0];j++)if(A[i]+A[j]>=18&&B[i]+B[j]>=18)ans+=cnt[i]*cnt[j];
	}
	cout<<ans/2<<endl;
	return 0;
}

Measured memory_bytes: 5404
N = int(input())
S = input()
B = [0]*(N+1)
for i in range(N):
    B[i+1] = B[i] + (S[i] == 'E')
ans = N
for i in range(N):
    ans = min(ans, (i-B[i]) + (B[N]-B[i+1]))
print(ans)

Measured memory_bytes: 15244
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
const int maxn=200+10;
int dis[15][15],a[maxn][maxn],n,m;
int s[maxn][maxn],ans;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<=9;i++)
		for(int j=0;j<=9;j++)
			scanf("%d",&dis[i][j]);
	for(int k=0;k<=9;k++)
		for(int i=0;i<=9;i++)
			for(int j=0;j<=9;j++)
				if(dis[i][k]+dis[k][j]<dis[i][j])
					dis[i][j]=dis[i][k]+dis[k][j];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++){
			scanf("%d",&s[i][j]);
			ans+=dis[s[i][j]][1];
		}
	printf("%d\n",ans);
	return 0;	
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    ll N;
    cin >> N;
    ll ans = 0;
    for(ll i = 2; i*i <= N; i++){
        ll cnt = 0;
        while(N%i == 0){
            N /= i, cnt++;
        }
        ll j = 0;
        while(j*(j+1)/2 <= cnt) j++;
        ans += j-1;
    }
    if(N > 1) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3636
import collections
N = int(input())
D = [int(_) for _ in input().split()]
mod = 998244353
C = collections.Counter(D)
if D[0] + 1 == C[0] == 1:
    ans = 1
    for i in range(1, max(C.keys()) + 1):
        ans *= C[i - 1]**C[i]
        ans %= mod
    print(ans)
else:
    print(0)


Measured memory_bytes: 19936
N, M = map(int, input().split())
vote_nums = sorted([float(i) for i in input().split()], reverse=True)

border_rate = 1 / (4 * M)
target = vote_nums[:M]

for vote_num in target:
  if vote_num < border_rate * sum(vote_nums):
    print('No')
    exit()

print('Yes')

Measured memory_bytes: 3060
N,M = map(int, input().split())

X = list(map(int, input().split()))
Y = list(map(int, input().split()))
MOD = 10**9+7


sum_x = 0
sum_y = 0
for i in range(N):
    sum_x += (i - (N - i - 1))*X[i] % MOD

for j in range(M):
    sum_y += (j - (M - j - 1))*Y[j] % MOD


print(sum_x*sum_y%MOD)


Measured memory_bytes: 18556
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,k;
	cin>>a>>b>>k;
	if (k>a) k-=a,a=0; else a-=k,k=0;
	if (k>b) k-=b,b=0; else b-=k;
	cout<<a<<' '<<b;
	return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll X, Y;
    cin >> X >> Y;
    bool flg=false;
    rep(i,0,X+1){
        ll ans=i*2+(X-i)*4;
        if(Y==ans)flg=true;
    }
    cout << (flg ? "Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 3644
import sys
def input():
	return sys.stdin.buffer.readline()[:-1]

sys.setrecursionlimit(10**7)

class SCC():
	def __init__(self, n):
		self.n = n
		self.adj = [[] for _ in range(self.n)]
		self.inv = [[] for _ in range(self.n)]
		self.post_order = []
		self.visited = [False for _ in range(self.n)]
		self.dag_v_to_num = [-1 for _ in range(self.n)]
		self.dag_num_to_v = []
		return

	def add_edge(self, u, v):
		self.adj[u].append(v)
		self.inv[v].append(u)
		return

	def dfs1(self, i):
		for j in self.adj[i]:
			if not self.visited[j]:
				self.visited[j] = True
				self.dfs1(j)
		self.post_order.append(i)
		return

	def dfs2(self, i, num):
		self.dag_num_to_v[-1].append(i)
		self.dag_v_to_num[i] = num
		for j in self.inv[i]:
			if not self.visited[j]:
				self.visited[j] = True
				self.dfs2(j, num)
		return

	def make_scc(self):
		for i in range(self.n):
			if not self.visited[i]:
				self.visited[i] = True
				self.dfs1(i)

		self.visited = [False for _ in range(self.n)]
		num = 0
		for i in range(self.n-1, -1, -1):
			if not self.visited[self.post_order[i]]:
				self.visited[self.post_order[i]] = True
				self.dag_num_to_v.append(list())
				self.dfs2(self.post_order[i], num)
				num += 1

		return self.dag_v_to_num, self.dag_num_to_v


class TwoSAT(SCC):
	"""
	node 2*i  : x_i
	node 2*i+1: not x_i
	"""
	def __init__(self, n):
		super().__init__(2*n)
		return

	def add_clause(self, i, f, j, g):
		super().add_edge(2*i + (1^f), 2*j + g)
		super().add_edge(2*j + (1^g), 2*i + f)
		return

	def satisfy(self):
		topol, _ = super().make_scc()
		res = []
		for i in range(0, self.n, 2):
			x, y = topol[i], topol[i+1]
			if x == y:
				return False, None
			elif x > y:
				res.append(False)
			else:
				res.append(True)
		return True, res

n, d = map(int, input().split())
ts = TwoSAT(n)
flags = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
	for j in range(i+1, n):
		for k in range(4):
			f, g = k//2, k%2
			if abs(flags[i][f] - flags[j][g]) < d:
				ts.add_clause(i, f, j, g)

ok, ans = ts.satisfy()
if not ok:
	print("No")
else:
	print("Yes")
	for f, b in zip(flags, ans):
		print(f[1^b])

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

using ll=long long; 

void solve(){
	int h,w;
	cin>>h>>w;
	vector<string> fld(h);
	vector<vector<bool>> used(h,vector<bool>(w));
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			used[i][j]=0;
		}
	}
	for(int i=0; i<h; i++)cin>>fld[i];
	int cur=0;
	for(int i=0; i<h; i++){
		while(1){
			if(cur==w){
				cur--;
				break;
			}
			if(fld[i][cur]=='#'){
				used[i][cur]=1;
				cur++;
			}
			else{
				cur--;
				break;
			}
		}
	}
	/*
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			cout<<used[i][j];
		}
		cout<<endl;
	}
	*/
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(!((fld[i][j]=='#'&&used[i][j])||(fld[i][j]=='.'&&!used[i][j]))){
				cout<<"Impossible"<<endl;
				return;
			}
		}
	}
	cout<<"Possible"<<endl;
}

signed main(){
	//while(1)
	solve();
}

Measured memory_bytes: 256
#include "stdio.h"
int main()
{
	char x[3];
	while(gets(x))
	{
		int m,n,k=1;
		for(m=0,n=2;m<n;m++,n--)
			if(x[m]!=x[n])
			{
				k=0;
				break;
			}
		if(k==1)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
N,M = [int(i) for i in input().split()]
c = [1, N]
for _ in range(M):
    a,b = [int(i) for i in input().split()]
    a,b = min(a,b), max(a,b)
    if c[0] <= a <= b <= c[1]:
        c = [a,b]
    elif a < c[0] <= b < c[1]:
        c = [c[0], b]
    elif c[0] < a <= c[1] < b:
        c = [a, c[1]]
    elif a <= b < c[0]:
        print(0)
        break
    elif c[1] < a <= b:
        print(0)
        break
else:
    print(c[1] - c[0] + 1)

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;

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

    if(500*k>=x){
        cout<<"Yes"<<endl;
    }
    else {
        cout<<"No"<<endl;
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
	while(cin >> n) {
		int ret = 0;
		for(int i = 0; i < 10; i++) {
			for(int j = 0; j < 10; j++) {
				for(int k = 0; k < 10; k++) {
					for(int l = 0; l < 10; l++) {
						if(i + j + k + l == n) ret++;
					}
				}
			}
		}
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 3088
#include <iostream>

int main() {
  int X;
  int A;
  int B;

  std::cin >> X >> A >> B;

  if (A >= B) {
    std::cout << "delicious" << std::endl;
  } else if ((B - A) <= X) {
    std::cout << "safe" << std::endl;
  } else {
    std::cout << "dangerous" << std::endl;
  }

  return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        
        String s =sc.next();
        String A;
        int num[] = new int[3];
        int ans = 0;
        int answer = 0;
        int result = 1000;
        
        String slist[] = s.split("");
        
        for(int i = 2; i < slist.length; i++){
            A = slist[i-2] + slist[i-1] + slist[i];
            ans = Integer.parseInt(A);
            answer = Math.abs(753-ans);
            if(answer < result){
                result = answer;
            }
        }
        System.out.println(result);
    }
}

Measured memory_bytes: 39416
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    static final Scanner     sc = new Scanner(System.in);
    static final PrintStream so = System.out;

    public static void main(String[] args) {
        int q = nint();
        for (int i = 0; i < q; i++) {
            String a = nstr();
            String b = nstr();
            so.println(lcsLength(a, b));
        }
    }
    
    private static int lcsLength(String a, String b) {
        int lenA = a.length();
        int lenB = b.length();
        int[][] c = new int[lenA+1][lenB+1];
        for (int iA = 1; iA <= lenA; iA++) {
            for (int iB = 1; iB <= lenB; iB++) {
                if (a.charAt(iA-1) == b.charAt(iB-1)) {
                    c[iA][iB] = c[iA-1][iB-1] + 1;
                } else {
                    c[iA][iB] = Math.max(c[iA-1][iB], c[iA][iB-1]);
                }
            }
        }
        return  c[lenA][lenB];
    }

    private static long nlong() {
        return sc.nextLong();
    }

    private static int nint() {
        return sc.nextInt();
    }

    private static String nstr() {
        return sc.next();
    }

    private static char[] nsToChars() {
        return sc.next().toCharArray();
    }

    private static long[] nlongs(int n) {
        return nlongs(n, 0, 0);
    }

    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static long[] nlongs(int n, int padL, int padR) {
        long[] a = new long[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nlong();
        return a;
    }

    private static String[] nstrs(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = nstr();
        return a;
    }

    private static char[][] nsToChars2D(int h, int w) {
        return nsToChars2D(h, w, 0);
    }

    private static char[][] nsToChars2D(int h, int w, int pad) {
        char[][] a2 = new char[h + pad * 2][w + pad * 2];
        for (int i = 0; i < h; i++)
            System.arraycopy(nsToChars(), 0, a2[pad + i], pad, w);
        return a2;
    }
}



Measured memory_bytes: 64892