akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
    
using namespace std;
    
typedef long long int ll;
    
int main(){
    int t;
    cin>>t;
    int flag =0;
    while(t>0){
        int dig = t%10;
        if(dig == 7){
            cout<<"Yes"<<endl;
            flag = 1;
            break;
        }
        t = t/10;
    }
    if(flag == 1)return 0;
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3632
use std::io;
use std::collections::HashMap;
use std::mem;
use std::cmp;

fn read_line() -> String{
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

fn read_ints() -> Vec<i64>{
    let s = read_line();
    let split:Vec<&str> = s.trim().split(" ").collect();
    split.iter().map(|&x| x.to_string().parse().unwrap()).collect()
}

fn main(){
    let temp = read_ints();
    let n = temp[0];
    let a = temp[1];
    let b = temp[2];
    
    let atotal = a * n;
    let btotal = b;
    
    println!("{}",cmp::min(atotal,btotal));
}







/*
DOCS


let mut h = HashMap::new();
let a = 5;
h.insert(a,true);
match h.get(&a){
    Some(v) => println!("{}",v),
    None    => println!("none"),
}


use std::mem;

let mut x = 5;
let mut y = 1;
mem::swap(&mut x,&mut y);


let v = vec![0;2]; // [0,0]







*/

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i(0);i<n;++i)
#define all(v) (v.begin(),v.end())
const int p=31;
const int MOD=1e9+9;

ll hash(string s){
	ll cnt=0;
	ll p_pow=1;
	for(char c : s){
		cnt=(cnt+(c-'a'+1)*p_pow)%MOD;
		p_pow=(p_pow*p)%MOD;
	}
	return cnt;
}

signed main(){
	string s;
	cin >> s;
	int n=s.length();
	if(s[n-1]!='s'){
		cout << s+'s';
	}
	else{
		cout << s +"es";
	}
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
      int tmp;
      int dp[100];
      cin>> tmp;
      do{
            fill(dp,dp+100,0);
            dp[0] = 1;
            for (int i = 0; i<tmp;i++)
            {
                  for(int j = 1;j < 4;j++)
                        dp[i+j] += dp[i];
            }
            cout << dp[tmp]/3650 + 1<<endl;
            cin >> tmp;
      }while(tmp);

}

Measured memory_bytes: 1156
#include <iostream>
#include <stdio.h>
#include <math.h>

using namespace std;
bool PrimeNum(int prime);
int main()
{
    int n, count = 0, temp;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> temp;
        if (PrimeNum(temp))
            count++;
    }
    cout << count << endl;
    return 0;
}
bool PrimeNum(int prime)
{
    if (prime < 2)
        return false;
    for (int i = 2; i <= sqrt(prime); i++)
    {
        if (prime % i == 0)
            return false;
    }
    return true;
}


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

int main() {

  int N;
  cin >> N;
  for(int i = 0; i < N; i++) {

    string a;
    cin >> a;
    
    if(a == "Y"){
    cout << "Four" << endl;
      
      break;
      
    }
    else if (i < N-1)
      continue;
    
    else
      cout << "Three" << endl;
    
  }
    
    
    
  
  
  
    
  
  }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
int dh[4] = {-1, 0, 0, 1};
int dw[4] = {0, -1, 1, 0}; 
using P = pair<int, int>;
const double pi = acos(-1.0);

int main(){
  string s;
  cin>>s;
  
  int cnt=0;
  Rep(i,1,s.size()){
    if(s[i]!=s[i-1])cnt++;
  }

  cout<<cnt<<endl;
    
  return 0;
}


Measured memory_bytes: 3756
#!/usr/bin/env python
# -*= coding:utf-8 -*-

D,N = map(int,input().split())

if D==0 and N<100:
    print(N)
    exit()
if D==0 and N==100:
    print(101)
    exit()
if D==1 and N==100:
    print(10100)
    exit()
if D==2 and N==100:
    print(1010000)
    exit()
print(N*(100**D))


Measured memory_bytes: 2940
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    a = list(map(int, input().split()))
    tmp = 0
    for i in range(N):
        tmp ^= a[i]
    if tmp == 0:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()


Measured memory_bytes: 14212
#include <cstdio>
 #include <cstdlib>
 #include <iostream>
 #include <fstream>
 #include <sstream>
 #include <set>
 #include <map>
 #include <vector>
 #include <list>
 #include <algorithm>
 #include <cstring>
 #include <cmath>
 #include <string>
 #include <stack>
 #include <queue>
 #include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
 #include <cassert>
 #include <iomanip>        //do setprecision
 #include <ctime>
 #include <complex>
 using namespace std;

 #define FOR(i,b,e) for(int i=(b);i<(e);++i)
 #define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
 #define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
 #define REP(x, n) for(int x = 0; x < (n); ++x)

 #define ST first
 #define ND second
 #define PB push_back
 #define PF push_front
 #define MP make_pair
 #define LL long long
 #define ULL unsigned LL
 #define LD long double
 #define pii pair<int,int>
 #define pll pair<LL,LL>

 const double pi = 3.14159265358979323846264;
 const int mod=1000000007;

int main(){
	int m,k;
	cin>>m>>k;
	LL thres=1LL<<m;
	if(k==0){
		FOR(i,0,(1LL<<m)){
			cout<<i<<" "<<i<<" ";
		}
		return 0;
	}
	if(m==1){
		cout<<-1<<endl;
		return 0;
	}
	if(thres<=k){
		cout<<-1<<endl;
		return 0;
	}
	int t=0;
	cout<<k<<" ";
	FOR(i,0,(1LL<<m)){
		if(i!=k&&i!=t)cout<<i<<" ";
	}
	cout<<k<<" "<<t<<" ";
	FORD(i,(1LL<<m),0){
		if(i!=k&&i!=t)cout<<i<<" ";
	}
	cout<<t<<endl;
	return 0;
}


Measured memory_bytes: 1792
using System;

namespace ITP1_4_A
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] vs = Console.ReadLine().Split(' ');
			long a = long.Parse(vs[0]);
			long b = long.Parse(vs[1]);

			long a1 = a / b;
			long a2 = a % b;
			double a3 = (double)a / (double)b;

			Console.WriteLine($"{a1} {a2} {a3:f5}");
		}
	}
}



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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
  int H1, M1, H2, M2, K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  int tmp1 = H1 * 60 + M1;
  int tmp2 = H2 * 60 + M2;
  cout << tmp2 - tmp1 - K << endl;
  return 0;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;

//諸機能
#pragma region MACRO 
#define putans(x)  std::cerr << "[ answer ]: " ; cout << (x) << endl
#define dputans(x) std::cerr << "[ answer ]: "; cout << setprecision(27) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,a,n) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define equals(a,b) (fabs((a)-(b)) < EPS)
#ifdef _DEBUG //ファイルからテストデータを読み込む
std::ifstream ifs("data.txt");
#define put ifs >>
#else //ジャッジシステムでいい感じにやる
#define put cin >>
#endif
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#ifdef _DEBUG
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#else
#define dbg(var0) {}
#define dbg2(var0, var1) {}
#define dbg3(var0, var1, var2) {}
#define dbgArray(a,n) {}
#endif 
#pragma endregion 
//typedef（書き換える、書き足す可能性ある）
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-10)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(2*1e9)
#pragma endregion


int main() {
	string s; put s;
	string moto = "CODEFESTIVAL2016";
	int cnt = 0;
	rep(i, 16) {
		if (s[i] != moto[i]) cnt++;
	}
	putans(cnt);
	//int n, k; put n >> k;
	//vi vec; vec.resize(n);
	//rep(i, n) {
	//	put  vec[i];
	//}

END:
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  while(K > 0){
    if(A >= B){
      B *= 2;
      K--;
      continue;
    }
    if(B >= C){
      C *= 2;
      K--;
      continue;
    }
    if(A < B && B < C)break;
  }
  if(A < B && B < C)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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


int main() {
  
  int x , y , z ;
  cin >> x >> y >> z ;
  
  int sum=z;
  int c=0;
  while(x-(y+z)>=sum){
    sum+=y+z;
    c++;
  }
  
  cout << c << endl;
}

Measured memory_bytes: 256
H,W=map(int,input().split())
S = [list(input()) for _ in range(H)]

white = 0
for i in range(H):
  white += S[i].count('.')

q = [(0,0)]
S[0][0] = 0
while q:
  qq = []
  for xy in q:
    x,y = xy
    for dx,dy in ((1,0),(-1,0),(0,1),(0,-1)):
      if not(0 <= x+dx < W) or not(0 <= y+dy < H):
        continue
      elif S[y+dy][x+dx] != '.':
        continue
      S[y+dy][x+dx] = S[y][x] + 1
      qq.append((x+dx,y+dy))
  q = qq

print(white - S[-1][-1] -1 if S[-1][-1] != '.' else -1)


Measured memory_bytes: 3064
s = list(input())
n = len(s)
a = (n - 1) // 2
b = (n + 3) // 2

judge = 1

for i in range(n // 2):
  if s[i] != s[-(i + 1)]:
    judge = 0
    break

if judge == 0:
  print('No')
else:
  al = s[:a]
  bl = s[b - 1:]
  for j in range(a // 2):
    if al[j] != al[-(j + 1)]:
      judge = 0
      break
  if judge == 0:
    print('No')
  else:
    for k in range((n - b) // 2):
      if bl[k] != bl[-(k + 1)]:
        judge = 0
        break
    if judge == 0:
      print('No')
    else:
      print('Yes')

Measured memory_bytes: 9164
#include <stdio.h>

int main()
{
    char a[4];

    scanf("%s",a);

    int i,j,c=0;

    for(i=0; i<4; i++)
    {
        if(a[i]==a[i+1])
        {
            c++;
        }

    }

    if(c==0)
        printf("Good");
    else
        printf("Bad");


}

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

#define debug(x) cout << '[' << #x << " is: " << x << "] " << endl;
#define imod(a , n) (a % n + n ) % n

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define inF freopen("gymnastics.in","r",stdin );
#define outF freopen("gymnastics.out" , "w" , stdout ) ;
#define sum(a)a * (a + 1 ) / 2
#define ll long long

const double eps = 1e-9 , PI = acos(-1) ;
const int N = 1e6, oo = 1e7 , M = 4 * N, mod = 1<<30 , K = 12;
int n ;

int32_t main(){

    //inF;
    // Dont Forget memset


    //calculate constraints please!!!

    fastio;
   map<int , int >mp;
   for(int  i = 0 ; i < 3 ; i++){
    int a ;
    cin >> a;
    mp[a]++;
   }
   cout << (mp.size() == 2 ? "Yes" : "No");

     return 0 ;
}



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

int main(){
    int x;
    cin >> x;
    int a, b, c, d;
    a = x/1000;
    b = x/100-a*10;
    c = x/10-a*100-b*10;
    d = x-a*1000-b*100-c*10;
    //cout << a << b << c << d;

    if(a+b+c+d==7){
        cout << a << '+' << b << '+' << c << '+' << d << "=7";
    }
    else if(a-b+c+d==7){
        cout << a << '-' << b << '+' << c << '+' << d<< "=7";
    }
    else if(a+b-c+d==7){
        cout << a << '+' << b << '-' << c << '+' << d<< "=7";
    }
    else if(a-b-c+d==7){
        cout << a << '-' << b << '-' << c << '+' << d<< "=7";
    }
    else if(a+b+c-d==7){
        cout << a << '+' << b << '+' << c << '-' << d<< "=7";
    }
    else if(a-b+c-d==7){
        cout << a << '-' << b << '+' << c << '-' << d<< "=7";
    }
    else if(a+b-c-d==7){
        cout << a << '+' << b << '-' << c << '-' << d<< "=7";
    }
    else if(a-b-c-d==7){
        cout <<a << '-' << b << '-' << c << '-' << d<< "=7";
    }
}

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

int main(){
  int t;
  int n;
  int b[110];


  cin >> t;
  while( t-- ){
    cin >> n;
    for( int i=0;i<n;i++ )
      cin >> b[i];

    int mx=-10,mn=10000;
    int d;
    for( int i=1;i<n;i++ ){
      d=b[i]-b[i-1];
      mx=max( mx,d );
      mn=min( mn,d );
    }

    if( mn>0 ) mn=0;
    if( mx<0 ) mx=0;
    mn = abs(mn);
    cout << mx << " " << mn << endl;
  }

  return 0;
}

Measured memory_bytes: 0
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  Name:- OMHARI 
  Institution:- UNIVERSIT OF CALCUTTA(INFORMATION TECHNOLOGY)
  Email:- omharicu@gmail.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include<bits/stdc++.h>
using namespace std; 

#define F               first
#define S               second
#define ull             unsigned long long
#define ll              long long
#define ul              unsigned long
#define db              double
#define ST              string
#define pb              push_back
#define mp              make_pair
#define el              "\n"
#define vll             vector <ll>
#define vl              vector <long int>
#define vi              vector <int>
#define all(v)          (v.begin(), v.end()) 
#define rall(v)         (v.rbegin(), v.rend()) 
#define is_sort(v)      is_sorted all(v)
#define max_of(v)       *max_element all(v)
#define min_of(v)       *min_element all(v)
#define itos(s)         to_string(s)
#define cntone(x)       __builtin_popcountll(x)
#define cntzro(x)       __builtin_clz(x)
#define For(i, a, b)    for(int i=a; i<b; i++)
#define Forr(i, a, b)    for(int i=a; i>=b; i--)
const ll mod = 1e9+7;

void solve()
{
    ll n, ans=0;
    cin>>n;
    vll v(n+1), sum(n+1);
    For(i, 1, n+1) cin>>v[i];

    For(i, 1, n+1)
    sum[i]=(sum[i-1]%mod+v[i]%mod)%mod;

    For(i, 1, n)
    ans=(ans%mod+((v[i]%mod)*((sum[n]-sum[i]+mod)%mod))%mod)%mod;

    cout<<(ll)ans%mod;
}

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

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    /***************-Code starts from here-***************/
    // int t;
    // cin>>t;
    // while(t--)
    solve();
    return 0; 
} 


Measured memory_bytes: 6376
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int ans=700;
  string s;cin>>s;
  FOR(i,0,3) ans+=(s[i]=='o')*100;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		
		int a = scan.nextInt();
		int b = scan.nextInt();
		
		if(a >= 1 && a <= 9 && b >= 1 && b <= 9) {
			System.out.println(a * b);
		}else {
			System.out.println("-1");
		}
		
		
	}
	
}

Measured memory_bytes: 21972
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <random>
#include <fstream>
#define rep(i, n) for (int i = 0; i < n; i++)
#define PI 3.14159265358979323846
#define MOD 1000000007
using namespace std;
using ll = long long;

const int MAX = 1000000;

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

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b)
{
  ll r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}

template <class T> struct cord{
  T x,y;
};

template <class T> double dist(cord<T> a, cord<T> b){
  T dx=a.x-b.x;
  T dy=a.y-b.y;
  return sqrt(dx*dx+dy*dy);
}

int main()
{

  //cout << fixed << setprecision(10);

  int n,m; cin >> n >> m;
  cout << (n-1)*(m-1);
  //if (s[0]==s[2]){cout << "Yes";}
  //else {cout << "No";}

  return 0;
}


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

int main() {
    int n, limit_weight;
    std::cin >> n >> limit_weight;
    int min_weight = 1001;
    for (int i = 0; i < n; ++i) {
        int temp;
        std::cin >> temp;
        limit_weight -= temp;
        if (temp < min_weight) {
            min_weight = temp;
        }
    }
    int ans = n + limit_weight/min_weight;
    std::cout << ans << std::endl;
    return 0;
}



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

using namespace std;

const int size = 2e5 + 7;
int arr[size], height[size];

int main(){
	int n;

	cin>>n;
	for(int x=0;x<n;x++) cin>>height[x];
	arr[0] = 0;
	if(n > 1) arr[1] = abs(height[0]-height[1]);
	for(int x=2;x<n;x++){
		arr[x] = min(arr[x-2] + abs(height[x-2] - height[x]), arr[x-1] + abs(height[x-1] - height[x]));
	}
	cout<<arr[n-1];
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(i) begin(i), end(i)

const int INF = 0x3fffffff;
const ll MINF = 0x7fffffffffff;
const ld DINF = numeric_limits<ld>::infinity();
const int MOD = 1000000007;
const int MODD = 998244353;
const ld EPS = 1e-9;
const ld PI = 3.1415926535897932;

template<class T> bool chmin(T &a, const T &b){ if(a > b){ a = b; return 1; } else return 0; }
template<class T> bool chmax(T &a, const T &b){ if(a < b){ a = b; return 1; } else return 0; }
template<class T> auto min(const T& a){ return *min_element(all(a)); }
template<class T> auto max(const T& a){ return *max_element(all(a)); }

ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }
ll pow_mod(ll n,ll k,ll m){ll r = 1;for(; k > 0;k >>= 1) {if (k & 1) r = (r * n) % m; n = (n * n) % m;}return r;}

//ここから。
int main(){
    int N;
    cin >> N;
    vector<pll> robot(N);
    ll X,L;
    rep(i,N){
        cin >> X >> L;
        robot[i] = make_pair(X+L,X - L);
    }
    sort(all(robot));
    ll ans = 0;
    ll bs = -INF;

    rep(i,N){
        if(robot[i].second >= bs){
            bs = robot[i].first;
            ans++;
        }
    }
    cout << ans << endl;
}

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

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

    int voteNumSum = 0;

    vector<int> voteVec;
    for (int i = 0; i < n; ++i)
    {
        int input;
        cin >> input;

        voteVec.push_back(input);

        voteNumSum += input;
    }

    sort(voteVec.begin(), voteVec.end(), greater<int>());

    int popularLimit = (voteNumSum + 4 * m - 1) / (4 * m);

    int popularCount = 0;
    for (const int &singleVoteNum : voteVec)
    {
        if (singleVoteNum >= popularLimit)
        {
            ++popularCount;
        }
    }

    cout << (popularCount >= m ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
import sys
 
line = [l for l in sys.stdin][0]
digits = line.split(' ')
num = [int(s) for s in digits]
 
res = 'No'
if num[0] == num[1]:
  if num[0] != num[2]:
    res = 'Yes'
    
if num[1] == num[2]:
  if num[1] != num[0]:
    res = 'Yes'

if num[2] == num[0]:
  if num[2] != num[1]:
    res = 'Yes'
    
print(res)


Measured memory_bytes: 3064
prime1 = []
numberlist = []
for i in range(2, 55556):
	numberlist.append(i)
while numberlist[0] < 236:
	now = numberlist.pop(0)
	prime1.append(now)
	newnumberlist = []
	for i in range(0, len(numberlist)):
		if numberlist[i] % now != 0:
			newnumberlist.append(numberlist[i])
	numberlist = newnumberlist
prime2 = prime1 + numberlist

N = int(input())
anslist = []
for i in range(0, len(prime2)):
	if prime2[i]%5 == 1:
		anslist.append(prime2[i])
	if len(anslist) == N:
		break
ans = str(anslist[0])
for i in range(1, N):
	ans = ans + ' ' + str(anslist[i])
print(ans)

Measured memory_bytes: 42860
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <chrono>
#include <random>
#include <stack>
#include <ctime>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

void swap(int *X, int *Y){
    int t = *X; *X = *Y; *Y = t;
}

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((abs(a-b) <= d && abs(b - c) <= d) || abs(a - c) <= d) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main ()
{
    int y=1,i=1,j=1,k=0,m,n,x,z;
    scanf("%d%d",&m,&n);
    int a[210][210]={0};
    scanf("%d",&z);
    while(z--){
        scanf("%d",&x);
        while(x--){
            if(k<n&&a[j][k+1]==0){
                a[j][++k]=y;
            }
            else if(j<m&&a[j+1][k]==0){
                a[++j][k]=y;
            }
            else if(k>1&&a[j][k-1]==0){
                a[j][--k]=y;
            }
            else {
                a[--j][k]=y;
            }
        }
        y++;
    }
    j=1;k=1;
    for(i=1;i<=m*n;i++){
        if(i%n==0) {
            printf("%d ",a[j][k]);
            j++;
            k=1;
            printf("\n");
        }
        else printf("%d ",a[j][k++]);
    }
    return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  long long ans=1;
  if(abs(n-m)>=2) {
    cout << 0 << endl;
    return 0;
  }
  if(n-m==0) {
    ans*=2;
  }
  for(int i=1; i<=max(n,m); i++) {
    ans*=i;
    ans%=1000000007;
  }
  for(int i=1; i<=min(n,m); i++) {
    ans*=i;
    ans%=1000000007;
  }
  cout << ans << endl;
}

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

using namespace std;

int n;
int W;
const int maxn = 1e5 + 5;

typedef long long LL;

LL f[maxn];
int w[maxn], v[maxn];

int main(){
    cin >> n >> W;
    for(int i = 1;i <= n;i++){
        scanf("%d%d", &w[i], &v[i]);
    }
    memset(f, 0, sizeof(f));
    for(int i = 1;i <= n;i++){
        for(int j = W;j >= w[i];j--){
            f[j] = max(f[j], f[j - w[i]] + v[i]);
        }
    }
    cout << f[W] << endl;
    return 0;
}


Measured memory_bytes: 1024
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::max;

fn main() {
    input!{
        l: usize,
        n: usize,
        v: [usize; n]
    }
    let mut ans = max(v[n - 1], l - v[0]);
    let mut sl: Vec<usize> = v.iter().clone().scan(0, |ac,&x| {*ac += x; Some(*ac)}).collect();
    let mut sr: Vec<usize> = v.iter().clone().rev().map(|x| l - x).scan(0, |ac,x| {*ac += x; Some(*ac)}).collect();
    sl.insert(0, 0);
    sr.insert(0, 0);
    for i in 1..n {
        let t = if 2 * i > n {
            let t1 = v[i - 1] + 2 * (sl[i - 1] - sl[2 * i - 1 - n] + sr[n - i]);
            let t2 = l - v[i] + 2 * (sl[i] - sl[2 * i - n] + sr[n - i - 1]);
            max(t1, t2)
        } else if 2 * i < n {
            let t1 = v[i - 1] + 2 * (sl[i - 1] + sr[n - i] - sr[n - 2 * i]);
            let t2 = l - v[i] + 2 * (sl[i] + sr[n - i - 1] - sr[n - 2 * i - 1]);
            max(t1, t2)
        } else {
            let t1 = v[i - 1] + 2 * (sl[i - 1] + sr[n - i]);
            let t2 = l - v[i] + 2 * (sl[i] + sr[n - i - 1]);
            max(t1, t2)
        };
        if t > ans {
            ans = t;
        }
    }
    println!("{}", ans);
}


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

int asc(const void* a, const void* b) {
    return *(int*)b - *(int*)a;
}
int main() {
    char str[110] = { 0 };
    int flag = 1;
    scanf("%s", str);
    for (int i = 0; i < strlen(str); i++) {
        if ((i + 1) % 2 == 1) {
            if (str[i] == 'L') {
                flag = 0;
            }
        }
        else {
            if (str[i] == 'R') {
                flag = 0;
            }
        }
    }
    if (flag) printf("Yes");
    else printf("No");
    return 0;
}



Measured memory_bytes: 128
N,A = map(int,input().split())
x = [0] + [int(i)-A for i in input().split()]

from collections import defaultdict

dp = defaultdict(int)

for i in range(N+1):
    for j in range(min(-2500,x[i]-2500),max(2501,2501+x[i])):
        if i == 0 and j == 0:
            dp[(i,j)] = 1
        else:
            dp[(i,j)] = dp[(i-1,j)] + dp[(i-1,j-x[i])]
print(dp[(N,0)]-1)

Measured memory_bytes: 71516
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
typedef long long ll;
// const ll MOD = 1000000007;
// const int INF = 2000000000;

int N;
vector<int> P;
unordered_map<int, int> mp;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  P.resize(N + 1);
  // 1-indexed
  for (int i = 1; i <= N; i++) {
    cin >> P[i];
    mp[P[i]] = i;
  }

  vector<int> dp(N + 1, 0);
  int prev_pos = 0;
  for (int i = 1; i <= N; i++) {
    int pos = mp[i];
    if (prev_pos < pos) {
      dp[i] = dp[i - 1] + 1;
    } else {
      dp[i] = 1;
    }
    prev_pos = pos;
  }

  int max_len = 0;
  for (int i = 1; i <= N; i++) {
    max_len = max(max_len, dp[i]);
  }

  int ans = N - max_len;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 10184
import Foundation

func solve(n: Int, aSizes: [Int], bSizes: [Int], cSizes: [Int]) -> Int {

    return bSizes
        .map {
            let lowerCases = corneredBounds(searchValue: $0, list: aSizes, policy: .lower).left + 1
            let upperCases = n - corneredBounds(searchValue: $0, list: cSizes, policy: .upper).right
            return lowerCases * upperCases
        }
        .reduce(0, +)
}

func corneredBounds(searchValue: Int, list: [Int], policy: Direction) -> (left: Int, right: Int) {

    var openedLeft = -1
    var openedRight = list.count

    while openedRight - openedLeft > 1 {

        let mid = (openedRight + openedLeft) / 2

        func midValueShouldBeInLeftSide() -> Bool {
            policy.midValueShouldBeInLeftSide(at: mid, on: list, with: searchValue)
        }

        if midValueShouldBeInLeftSide() {
            openedLeft = mid
        }
        else {
            openedRight = mid
        }
    }

    return (openedLeft, openedRight)
}

enum Direction {

    case lower
    case upper

    func midValueShouldBeInLeftSide(at index: Int, on list: [Int], with searchValue: Int) -> Bool {

        switch self {
            case .lower: return list[index] <  searchValue ? true : false
            case .upper: return list[index] <= searchValue ? true : false
        }
    }
}

let n = Int(readLine()!)!
let aSizes = readLine()!.split(separator: " ").compactMap{ Int($0) }.sorted()
let bSizes = readLine()!.split(separator: " ").compactMap{ Int($0) }.sorted()
let cSizes = readLine()!.split(separator: " ").compactMap{ Int($0) }.sorted()

let answer = solve(n: n, aSizes: aSizes, bSizes: bSizes, cSizes: cSizes)
print(answer)


Measured memory_bytes: 24280
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
ans=0
for i in range(60):
  o=0
  x=1<<i
  for j in a:
    if j&x:o+=1
  ans+=x*o*(n-o)
  ans%=mod
print(ans)

Measured memory_bytes: 122936
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;++i)
#define drep(i,n,m) for(int i = n;i >= m;--i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int mod = 1e9+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);

int n,x,y;

signed main()
{

    cin >> n;

    cin >> x >> y;

    int ans=min(n*x,y);

    cout << ans << endl;
    return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<vector<int>> tree(N, vector<int>());
    for(int i=0; i<N-1; i++){
        int a, b;  cin >> a >> b;
        a--;  b--; // 頂点の番号を 0-indexed とする。
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    vector<int> c(N);
    for(int i=0; i<N; i++){
        cin >> c[i];
    }
    // c を降順にソートする
    sort(c.begin(), c.end(), greater<int>());

    vector<int> d(N);          // d[i] は頂点 i に書き込む整数
    int idx = 0;               // 探索で到達した頂点に c[idx] を書き込む
    queue<pair<int,int>> que;  // pair<int,int> = {現在の頂点, 現在の頂点の親}
    que.push({0, -1});         // 頂点 0 からスタートする。0 の親は適当に -1 としておく。

    // 幅優先探索
    while(!que.empty()){
        int now = que.front().first;   // 現在の頂点
        int pre = que.front().second;  // 現在の頂点の親
        que.pop();

        d[now] = c[idx];               // 現在の頂点には c[idx] を書き込む
        idx++;

        for(int i=0; i<tree[now].size(); i++){
            // 現在の頂点と直接つながる頂点のうち、親以外へ遷移する
            int nxt = tree[now][i];    
            if(nxt!=pre) que.push({nxt, now});
        }
    }

    int M = 0; // M は c[0] 以外の和
    for(int i=1; i<N; i++){
        M += c[i];
    }

    cout << M << endl;
    for(int i=0; i<N; i++){
        cout << d[i] << " ";
    }cout << endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
    int n,c[100001],d[100001],max1=0,max2=0,ans,i,x,y,p=0,q=0,min1=0,min2=0;
    scanf("%i",&n);
    int a[n/2],b[n/2];
    for(i=0;i<=100000;i++){c[i]=0;d[i]=0;}
    for(i=0;i<n/2;i++)
    {
        scanf("%i %i",&a[i],&b[i]);
        c[a[i]]++;
        d[b[i]]++;
    }
    for(i=0;i<=100000;i++)
    {
        if(max1<c[i]){max1=c[i];x=i;}
        if(max2<d[i]){max2=d[i];y=i;}
    }
    for(i=0;i<=100000;i++)
    {
        if(max1==c[i]){p++;}
        if(max1>c[i]&&c[i]>min1){min1=c[i];}
        if(max2==d[i]){q++;}
        if(max2>d[i]&&d[i]>min2){min2=d[i];}
    }
    if(p==1&&q==1)
    {
        if(x!=y)ans=n-max1-max2;
        else if(min1<min2)ans=n-max1-min2;
        else if(min2<min1)ans=n-max2-min1;
        else ans=n-max1-min2;
    }
    else
    {
        if(x!=y)ans=n-max1-max2;
        else if(x==y&&max2==max1)ans=n-2*max2;
        else if(x==y)ans=ans-max1-max2;
    }
    printf("%i",ans);
}


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

#pragma warning(disable:4996)


int main(void) {
	int N;
	int V[50];
	int C[50];

	scanf("%d", &N);
	for (int i = 0; i < N; ++i) {
		scanf("%d", &V[i]);
	}
	for (int i = 0; i < N; ++i) {
		scanf("%d", &C[i]);
	}
	int sum = 0;
	for (int i = 0; i < N; ++i) {
		if (V[i] - C[i] > 0) {
			sum += V[i] - C[i];
		}
	}
	printf("%d", sum);
	return 0;
}

Measured memory_bytes: 128
import sys
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    ls = [True] * 100001
    ls[0] = False
    ls[1] = False
    p = collections.deque()
    for i in range(2, 100000):
        if ls[i]:
            p.append(i)
            for j in range(i, 100000, i):
                if ls[j]:
                    ls[j] = False
    ans = []
    while True:
        if len(ans) == n:
            break
        else:
            pv = p.popleft()
            if pv % 5 == 1:
                ans.append(pv)
    print(*ans)


if __name__ == '__main__':
    solve()


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

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

    if (a == b and b == c){
        cout << 1 << endl;
    }
    else if (a == b and a != c){
        cout << 2 << endl;
    }
    else if (a == c and a != b){
        cout << 2 << endl;
    }
    else if (b == c and a != b){
        cout << 2 << endl;
    }
    else{
        cout << 3 << endl;
    }
    
    return(0);
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <cstdio>

using namespace std;


int main(void) {

    while (true) {
        int M, F, R;
        cin >> M >> F >> R;
        if (M + F + R == -3) { break; }
        char seiseki = 'A';
        int total = M + F;
        if (M == -1 || F == -1 || total < 30) {
            seiseki = 'F';
        }
        else if (total < 50) {
            seiseki = (R < 50) ? 'D' : 'C';
        }
        else if (total < 65) {
            seiseki = 'C';
        }
        else if (total < 80) {
            seiseki = 'B';
        }

        printf("%c\n", seiseki);
    }

    return 0;
}

Measured memory_bytes: 1144
S = input()

HEAD = int(S[:2])
TAIL = int(S[2:])

if HEAD > 0 and HEAD < 13:
  if TAIL > 0 and TAIL < 13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
elif TAIL > 0 and TAIL < 13:
  if HEAD > 0 and HEAD < 13:
    print("AMBIGUOUS")
  else:
    print("YYMM")
else:
  print("NA")

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

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define ten(n) ((int)1e##n)
#define fst first
#define snd second
using ll=long long;
using pii=pair<int,int>;using pll=pair<ll,ll>;using pil=pair<int,ll>;using pli=pair<ll,int>;
using vs=vector<string>;using vvs=vector<vs>;using vvvs=vector<vvs>;
using vb=vector<bool>;using vvb=vector<vb>;using vvvb=vector<vvb>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template<class T> bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
ll ri(){ll l;cin>>l;return l;} string rs(){string s;cin>>s;return s;}
template<class T>T read(){T t;cin>>t;return t;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<'('<<p.fst<<", "<<p.snd<<')';}
ostream&operator<<(ostream&o,const vb&t){forr(e,t)o<<"#."[e];return o;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&t){o<<"{";forr(e,t)o<<e<<",";o<<"}"<<endl;return o;}
#ifdef LOCAL
vs s_p_l_i_t(const string&s,char c){vs v;stringstream ss(s);string x;while(getline(ss,x,c))v.emplace_back(x);return move(v);}
void e_r_r(vs::iterator it){cerr<<endl;}
template<class T,class... Args>void e_r_r(vs::iterator it,T a,Args... args){cerr<<it->substr((*it)[0]==' ',it->length())<<" = "<<a<<", ";e_r_r(++it,args...);}
#define out(args...){vs a_r_g_s=s_p_l_i_t(#args,',');e_r_r(a_r_g_s.begin(),args);}
#else
#define out(args...)
#endif

void Main() {
  int n = ri();
  int m = ri();

  vi X(n), Y(n);

  rep(i, n) {
    X[i] = ri();
    Y[i] = ri();
  }

  vi C(m), D(m);
  rep(i, m) {
    C[i] = ri();
    D[i] = ri();
  }

  vi ans(n);
  vi dist(n, 1e9);
  rep(i, n) rep(j, m) {
    int d = abs(X[i] - C[j]) + abs(Y[i] - D[j]);
    if (amin(dist[i], d)) {
      ans[i] = j+1;
    }
  }
  rep(i, n) {
    cout << ans[i]<< endl;
  }
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    string s; cin >> s;
    reverse(s.begin(), s.end());

    vector<string> words = {"dream", "dreamer", "erase", "eraser"};
    for(int i = 0; i < 4; i++){
        reverse(words[i].begin(), words[i].end());
    }

    string cal;
    for(int i = 0; i < (int)s.size(); i++){
        cal += s[i];
        for(int j = 0; j < 4; j++){
            if((string)cal == words[j]){
                cal = "";
            }
        }
    }

    cout << (cal == "" ? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 3768
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, A, B = mapint()

if B<A:
    print(0)
elif A!=B and N==1:
    print(0)
elif N<=2:
    print(1)
else:
    MIN = A*(N-1)+B
    MAX = B*(N-1)+A
    print(MAX-MIN+1)

Measured memory_bytes: 61876
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;

  vector<int> l(N);
  for (int i = 0; i < N; ++i)
    cin >> l[i];

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

  long long ret = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      int a = l[i];
      int b = l[j];
      for (int k = j + 1; k < N; ++k) {
        int c = l[k];
        if (c >= a + b)
          break;
        if (a + b > c && b + c > a && c + a > b) {
          ++ret;
        }
      }
    }
  }

  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <climits>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<long long,int> NODE;
#define cost first
#define pos second
#define INF INT_MAX
long long info[100][100];
int n;

long long dijk(int a,int b){
	priority_queue<NODE,vector<NODE>,greater<NODE> > Q;
	long long memo[100];
	rep(i,100)memo[i] = INT_MAX;
	Q.push(make_pair(0,a));
	
	while(Q.size()){
		NODE q = Q.top();
		Q.pop();
		if(q.pos == b){
			return q.cost;
		}
		for(int i=0;i<n;i++){
			if(info[q.pos][i] != INF){
				if( q.cost + info[q.pos][i] < memo[i] ){
					memo[i] = q.cost + info[q.pos][i];
					Q.push(make_pair(memo[i],i));
				}
			}
		}
				
	}

	return -1;
}

int main(){
	int m,r,a,b,c;

	while(cin >> n >> m && n || m){
		rep(i,100)rep(j,100)info[i][j] = INT_MAX;
		 
		rep(y,m){
			cin >> r;
			if(r){
				cin >> a >> b >> c;
				a--;b--;
				info[a][b] = info[b][a] = min<long long>(info[a][b],c);
			}else{
				cin >> a >> b;
				a--;b--;
				cout << dijk(a,b) << endl;
			}
		}
	}
}

Measured memory_bytes: 992
#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define st first
#define nd second
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
template <class T> T read(T &a) {
    a=0;char x=getchar();bool f=0;
    for(;x<'0'||x>'9';x=getchar())f|=x=='-';
	for(;x>='0'&&x<='9';x=getchar())a=(a<<3)+(a<<1)+x-'0';
    if(f)a=-a;
    return a;
}
using namespace std;

const int N = 2e5 + 5;

typedef bitset<26> bst;

struct tp {
	tp *child[26];
	int cnt[26];
	tp() {
		for (int i = 0; i < 26; ++i) {
			child[i] = 0;
			cnt[i] = 0;
		}
	}
}*root;

int n;
char s[10 * N];

bst update(int u, tp *cur) {
	if (u == 0) {
		bst c;
		return c;
	}
	int a = s[u] - 'a';
	if (!cur->child[a]) cur->child[a] = new tp();
	bst b = update(u - 1, cur->child[a]);
	if (!b[a]) b[a] = 1;
	for (int i = 0; i < 26; ++i) {
		cur->cnt[i] += b[i];
	}
	return b;
}

int query(tp *cur, int len) {
	int a = s[len] - 'a';
	if (!cur) {
		return 0;
	}
	if (len == 1) {
		return cur->cnt[a];
	}
	return query(cur->child[a], len - 1);
}

string str[N];

int main() {
	root = new tp();
	read(n);
	LL ans = 0;
	for (int i = 1; i <= n; ++i) {
		cin >> str[i];
		int len = str[i].size();
		for (int j = 0; j < len; ++j) {
			s[j + 1] = str[i][j];
		}
		update(len, root);
	}
	for (int i = 1; i <= n; ++i) {
		int len = str[i].size();
		for (int j = 0; j < len; ++j) {
			s[j + 1] = str[i][j];
		}
		ans += query(root, len);
	}
	printf("%lld\n", ans - n);
    return 0;
}


Measured memory_bytes: 364224
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
//i64 mod = 1000000007;
i64 mod = 998244353;
int int_max = 2147483647;
i64 INF = 1e16;
int max_n = 1e5;


int main(int argc, char **argv) {
    char c;
    cin >> c;
    cout << ((c - 'a') >= 0 ? 'a' : 'A') <<endl;

    return 0;
}


Measured memory_bytes: 3620
#include<stdio.h>
#define MAX 1400
struct rect {
  int height;
  int pos;
};
int buffer[MAX][MAX], table[MAX][MAX];
int large_rectangle(int w, int *t);
int main(void)
{
  int i, j, h, w, max = 0;
  scanf("%d%d", &h, &w);
  for (i = 0; i < h; i++) {
    for (j = 0; j < w; j++) {
      scanf("%d", &buffer[i][j]);
    }
  }
  for (i = 0; i < h; i++) {
    for (j = 0; j < w; j++) {
      if (buffer[i][j]) table[i][j] = 0;
      else table[i][j] = (i > 0) ? table[i-1][j] + 1 : 1;
    }
  }
  for (i = 0; i < h; i++) {
    int temp = large_rectangle(w, table[i]);
    if (max < temp) max = temp;
  }
  printf("%d\n", max);
}
int large_rectangle(int w, int *t)
{
  int i, sp = 0, max = 0;
  struct rect stack[MAX];
  t[w] = 0;
  for (i = 0; i <= w; i++) {
    struct rect r;
    r.height = t[i];
    r.pos = i;
    if (!sp || stack[sp-1].height < r.height) stack[sp++] = r;
    else if (stack[sp-1].height > r.height){
      int target = i;
        while (sp && stack[sp-1].height >= r.height) {
        struct rect pre = stack[--sp];
          int area = pre.height * (i - pre.pos);
          if (max < area) max = area;
          target = pre.pos;
        }
        r.pos = target;
        stack[sp++] = r;
    }
  }
  return max;
}


Measured memory_bytes: 17048
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000009
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;





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

cout<<max(n*n-a,0)<<endl;

 return 0;
}


Measured memory_bytes: 3604
//
//  main.cpp
//  atcoder
//
//  Created by Hisaki Kobayashi on 2020/04/14.
//  Copyright © 2020 Hisaki Kobayashi. All rights reserved.
//

#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bitset>
typedef long long ll;
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
const int MAX_N = 200000;

int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}



int main(int argc, const char * argv[]) {
    long long X; cin >> X;
    long long value=100;
    
    long long cnt=0;
    while(true){
        cnt++;
        value *= 1.01;
        if(value>=X){
            cout << cnt << endl;
            return 0;
        }
    }
    return 0;
}




Measured memory_bytes: 3636
import java.io.*;
import java.util.*;

public class Main{
    static MyReader in = new MyReader();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args){
        long A, B;
        {long[] a = in.ll(); A = a[0]; B = a[1];}
        if(B < A){
            long tmp = A;
            A = B;
            B = tmp;
        }
        
        long g = gcd(A, B);
        
        int ans = 1;
        double C = Math.sqrt(g+1);
        for(int i = 2; i < C; i++){
            if(g%i == 0){
                ans++;
                while(g%i == 0)
                    g /= i;
            }
        }
        if(g != 1){
            ans++;
        }
        out.println(ans);
        
        out.flush();
    }
    
    static long gcd(long a, long b){
        long r;
        while((r = b%a) > 0){
            b = a;
            a = r;
        }
        return a;
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


Measured memory_bytes: 23508