akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc145_c
{
    class Program
    {
        public class Point
        {

            public Point(double x, double y)
            {
                X = x;
                Y = y;
            }

            public double X;
            public double Y;
        }

        static void Main(string[] args)
        {
            
            var N = int.Parse(Console.ReadLine());
            var pl = new List<Point>();
            string ci = "";

            for (int i = 1; i <= N; i++)
            {
                var xy = Console.ReadLine().Split(' ').Select( x => double.Parse(x)).ToList();
                pl.Add(new Point(xy[0], xy[1]));
                ci += i.ToString();
            }

            //2点間の重複なし組み合わせ
            var rc = Combination.Enumerate(ci, 2, withRepetition: false);

            double k = 0;
            foreach (var c in rc) 
            {
                var p1 = pl[int.Parse(c[0].ToString()) - 1];
                var p2 = pl[int.Parse(c[1].ToString()) - 1];
                k += Math.Sqrt(Math.Pow(p1.X - p2.X, 2) + Math.Pow(p1.Y - p2.Y, 2));
            }

            Console.WriteLine(k / rc.Count() * (N - 1));

        }

        public static class Combination
        {
            public static IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items, int k, bool withRepetition)
            {
                if (k == 1)
                {
                    foreach (var item in items)
                        yield return new T[] { item };
                    yield break;
                }
                foreach (var item in items)
                {
                    var leftside = new T[] { item };

                    // item よりも前のものを除く （順列と組み合わせの違い)
                    // 重複を許さないので、unusedから item そのものも取り除く
                    var unused = withRepetition
                                ? items
                                : items.SkipWhile(e => !e.Equals(item)).Skip(1).ToList();

                    foreach (var rightside in Enumerate(unused, k - 1, withRepetition))
                    {
                        yield return leftside.Concat(rightside).ToArray();
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
const double PI=3.14159265358979323846;
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
int main(void){
    int n;cin>>n;
    int d[n];rep(i,n)cin>>d[i];
    ll ans=0;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            ans+=d[i]*d[j];
        }
    }
    co(ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
typedef long long ll;
const int mmax=1e5+10;
map<ll,ll> s;
ll book[mmax],num[mmax];
int main()
{
	ll n,k;
	while(cin>>n>>k)
	{
		memset(book,0,sizeof(book));
		memset(num,0,sizeof(num));
		s.clear();
		for(int i=1;i<=n;i++)
		{
			ll a,b;
			cin>>a>>b;
			s[a]+=b;
			//cout<<s[a]<<endl;
			num[i]=a;
		}
		ll sum=0;
		sort(num+1,num+n+1);
		for(int i=1;i<=n;i++)
		{
			if(num[i]!=num[i-1])
				book[i]=num[i];
		}
		sort(book+1,book+n+1);
//		for(int i=1;i<=n;i++)
//			cout<<book[i]<<endl;
//		for(int i=1;i<=n;i++)
//			cout<<s[book[i]]<<endl;
		for(int i=1;i<=n;i++)
		{
			//cout<<book[i]<<endl;
			if(book[i]==0)
				continue;
			else
			{
				sum+=s[book[i]];
			//	cout<<sum<<endl;
				if(sum>k||sum==k)
				{
					cout<<book[i]<<endl;
					break;
				}
			}	
		}
	}
	return 0;
 } 

Measured memory_bytes: 5760
H1,M1,H2,M2,K = map(int,input().split())

H1_min = H1*60
H2_min = H2*60
HM1 = H1_min+M1
HM2 = H2_min+M2

HM = HM2 - HM1

if (HM > K):
  print(HM-K)
else:
  print(0)



Measured memory_bytes: 9164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    
    ll x, y, z;
    cin >> x >> y >> z;
    ll ans = 0;
    for(ll i = 1; i <= x; i++){
        ll l = y * i + z * (i + 1);
        if(l <= x)ans = max(ans, i);
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
import kotlin.math.abs

fun main() {
    val line = readLine()!!.split(" ").map { it.toInt() }
    val x = line[0]
    val n = line[1]
    val pList = if (n > 0) {
        readLine()!!.split(" ").map { it.toInt() }
    } else {
        readLine()
        listOf()
    }

    if (n == 0) {
        print(x)
        return
    }

    if (!pList.contains(x)) {
        print(x)
        return
    }

    var i = x - 1
    while (true) {
        if (pList.contains(i)) {
            i -= 1
        } else {
            break
        }
    }

    var j = x + 1
    while (true) {
        if (pList.contains(j)) {
            j += 1
        } else {
            break
        }
    }

    val result = if (abs(x - i) > abs(j - x)) {
        j
    } else {
        i
    }
    print(result)

}

Measured memory_bytes: 36424
#include<bits/stdc++.h>
#define Fst first
#define Snd second
#define RG register
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
template<typename T> inline void read(T& x) {
	char c = getchar();
	bool f = false;
	for (x = 0; !isdigit(c); c = getchar()) {
		if (c == '-') {
			f = true;
		}
	}
	for (; isdigit(c); c = getchar()) {
		x = x * 10 + c - '0';
	}
	if (f) {
		x = -x;
	}
}
template<typename T, typename... U> inline void read(T& x, U& ... y) {
	read(x), read(y...);
}
int n,m,K;
bool vis[810][810];
char s[810][810];
int dx[4]={-1,0,1,0};
int dy[4]={0,1,0,-1};
vector<pair<int,int> > GG;
struct Data {
  int x,y,d;
  Data () {}
  Data (int x,int y,int d) :x(x),y(y),d(d) {}
};
//#define rua
int main() {
//	ios::sync_with_stdio(false);
#ifdef rua
	freopen("GG.in","r",stdin);
#endif
  read(n,m,K);
  for(int i=1;i<=n;++i) scanf("%s",s[i]+1);
  int X,Y;
  for(int i=1;i<=n;++i) {
    for(int j=1;j<=m;++j) {
      if(s[i][j]=='S') {
        X=i,Y=j;
      }
    }
  }
  queue<Data> Q;
  Q.push(Data(X,Y,0));
  while(!Q.empty()) {
    Data A=Q.front(); Q.pop();
    int x=A.x,y=A.y,d=A.d;
    GG.push_back(mp(x,y));
    if(d==K||vis[x][y]) continue;
    vis[x][y]=true;
    for(int i=0;i<4;++i) {
      int tx=x+dx[i],ty=y+dy[i];
      if(tx<1||ty<1||tx>n||ty>m||vis[tx][ty]||s[tx][ty]=='#') continue;
      Q.push(Data(tx,ty,d+1));
    }
  }
  int res=1e9;
  for(auto t: GG) {
    int d=min(min(t.Fst-1,n-t.Fst),min(t.Snd-1,m-t.Snd));
    int g=d/K;
    if(d%K) ++g;
    res=min(res,g);
  }
  printf("%d\n",res+1);
  return 0;
}



Measured memory_bytes: 18800
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
    int m;
    cin>>m;
    string s;
    cin>>s;
    int n = 0;
    for(int i = 0; i < s.size() - 2; i++){
        if(s.at(i) == 'A' && s.at(i + 1) == 'B' && s.at(i + 2) == 'C'){
        n++;
        }
    }
    cout << n << endl;
}


Measured memory_bytes: 3600
import java.util.HashMap;
import java.util.Objects;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int H = scanner.nextInt();
    int W = scanner.nextInt();
    int N = scanner.nextInt();
    HashMap<Point, Integer> freq = new HashMap<>();
    for (int i = 0; i < N; i++) {
      int x = scanner.nextInt();
      int y = scanner.nextInt();
      for (int j = -1; j <= 1; j++) {
        for (int k = -1; k <= 1; k++) {
          int sx = x + j;
          int sy = y + k;
          if (sx > 1 && sx < H && sy > 1 && sy < W) {
            Point p = new Point(sx, sy);
            freq.put(p, freq.getOrDefault(p, 0) + 1);
          }
        }
      }
    }

    long[] total = new long[10];
    total[0] = (long) (H - 2) * (W - 2) - freq.size();
    for (int f : freq.values()) total[f]++;
    for (long t : total) {
      System.out.println(t);
    }
  }

  private static class Point {
    public final int x;
    public final int y;

    private Point(int x, int y) {
      this.x = x;
      this.y = y;
    }

    @Override public boolean equals(Object o) {
      if (this == o) return true;
      if (o == null || getClass() != o.getClass()) return false;
      Point point = (Point) o;
      return x == point.x &&
          y == point.y;
    }

    @Override public int hashCode() {
      return Objects.hash(x, y);
    }
  }
}


Measured memory_bytes: 207508
#include <stdio.h>

int main() {
  int i, j, H, W;

  while (1) {
    scanf("%d %d", &H, &W);
    if (H == 0 && W == 0)
      break;
    for (i = 0; i < H; i++) {
      for (j = 0; j < W; j++) {
        if ((i + j) % 2 == 0)
          putchar('#');
        else
          putchar('.');
      }
      putchar('\n');
    }
    putchar('\n');
  }
  return 0;
}

Measured memory_bytes: 572
import sys

def isort(A, n, g):
    cnt = 0
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j -= g
            cnt += 1
        A[j + g] = v
    return cnt

def ssort(A, n):
    cnt = 0
    G = []
    h = 1
    while h <= n:
        G.append(h)
        h = 3 * h + 1
    m = len(G)
    G.reverse()
    print(m)
    print(*G, sep = " ")
    for g in G:
        cnt += isort(A, n, g)
    return cnt

n = int(input())
A = list(map(int, sys.stdin.readlines()))
cnt = ssort(A, n)
print(cnt)
print(*A, sep = "\n")

Measured memory_bytes: 118472
#include <iostream>

using namespace std;

int main(){
  int A, B, C;

  cin >> A >> B >> C;

  if((A == 5 && C == 5 && B == 7) || (A == 5 && B == 5 && C == 7) || B == 5 && C == 5 && A == 7){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N;
    cin >> N ;
    // すべてが偶数になるように調整する
    bool f = true;
    rep(i,N){
        int a;
        cin >> a;
        if(a%2==1){
            f = false;
        }
    }
    if(f) cout << "second" << endl;
    else  cout << "first"  << endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
n,m,x=map(int,input().split())
A=[]
ALL=[]
ans=10**7
for i in range(n):
    A.append(list(map(int,input().split())))
for i in range(2**n):
    S=[0 for _ in range(m+1)]
    buy=[]
    for j in range(n):
        if ((i>>j) & 1):
            buy.append(A[j])
        #for k in range(m+1):
    for j in range(m+1):
        for k in range(len(buy)):
            S[j]+=buy[k][j]
    #print(S)
    flag=0
    for j in range(1,m+1):
        if S[j]<x:
            flag=1
    if flag==0:
        ans=min(ans,S[0])
if ans==10**7:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9160
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n,k=gsmi
A,B,C=gsmi
t=gs

def score(sign)
  case sign
  when 'r'
    A
  when 's'
    B
  when 'p'
    C
  end
end

def hand(sign)
  case sign
  when 'r'
    'p'
  when 's'
    'r'
  when 'p'
    's'
  end
end

ans=[]
cnt=0
n.times do |i|
  hand = hand(t[i])

  # k会前と同じなら適当なの入れる
  if i>=k && ans[i-k]==hand
    ans<<""
    next
  end
  ans<<hand
  cnt+=score(hand)
  #puts "i:#{i},cnt:#{cnt}"
end

puts cnt

Measured memory_bytes: 9852
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++){
    cin >> a[i];
  }
  int ans = 0;
  for (int i = 0; i < N; i += 2){
    if (a[i] % 2 == 1){
      ans++;
    }
  }
  cout << ans << endl;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define RALL(a)     (a).rbegin(),(a).rend()
#define PRINT(a)   cout << (a) << endl

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

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

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main(){
  int n;
  cin >> n;
  int cnt=0;
  bool ok=false;
  REP(i,n){
    int x, y;
    cin >> x >> y;
    if(x==y){
      cnt++;
      if(cnt>=3)ok=true;
    }else{
      cnt=0;
    }
  }
  cout << (ok ? "Yes" : "No") << endl;
}



Measured memory_bytes: 3632
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;

int MOD = 998244353;
ll bitpow(ll x,ll n){
    ll ans = 1;
    while(n > 0){
        if(n%2 == 1) ans = ans * x % MOD;
        x = x * x %MOD;
        n = n >> 1;
    }
    return ans;
}
int fac[100101];

signed main(){

    fac[0] = 1;
    for(int i = 1;i <= 100010;i++){
        fac[i] = fac[i-1]*i%MOD;
    }

    ll n;
    string s;
    cin >> n >> s;

    ll mo[3] = {0}; // rgb
    ll bi[3] = {0}; // rgb
    ll ans = 1;
    rep(i,3*n){
        ll x,y,z;
        if(s[i] == 'R'){
            x = 0;
            y = 1;
            z = 2;
        }else if(s[i] == 'G'){
            x = 1;
            y = 2;
            z = 0;
        }else{
            x = 2;
            y = 0;
            z = 1;
        }
        if(bi[x] >= 1){
            ans *= bi[x];ans %= MOD;
            bi[x]--;
        }else if(mo[y] >= 1){
            ans *= mo[y];ans %= MOD;
            mo[y]--;
            bi[z]++;
        }else if(mo[z] >= 1){
            ans *= mo[z];ans %= MOD;
            mo[z]--;
            bi[y]++;
        }else{
            mo[x]++;
        }
    }
    cout << ans*fac[n]%MOD << endl;





    



    

    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://agc037.contest.atcoder.jp/tasks/agc037_a

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

int main(){
    int n;
    char a,b;
    cin >> n;
    int ans = n;
    cin >> a;
    for(int i=1;i<n;i++){
        cin >> b;
        if(a==b){
            ans--;
        }else{
            a = b;
        }
    }
    cout << ans << endl;
}


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

using namespace std;

#define ll long long
#define db double
#define clr(a, b) memset(a, b, sizeof(a))

const int maxn = 5e5 + 10;
const int inf = 0x7ffffff;
const db pi = acos(-1.0);
void solve()
{
    int r;
    cin >> r;
    cout.precision(20);
    cout << (db)pi * r * 2 << "\n";

}

int main()
{
    //freopen("out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T = 1;
    //cin >> T;
    while(T-- > 0)
        solve();

}

Measured memory_bytes: 3800
/**
*    created: 10.07.2020 17:16:26
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int a, b, c, d; cin >> a >> b >> c >> d;
    int x = c - a;
    int y = d - b;
    rep(i,y) cout << 'U';
    rep(i,x) cout << 'R';
    rep(i,y) cout << 'D';
    rep(i,x) cout << 'L';
    cout << 'L';
    rep(i,y+1) cout << 'U';
    rep(i,x+1) cout << 'R';
    cout << 'D';
    cout << 'R';
    rep(i,y+1) cout << 'D';
    rep(i,x+1) cout << 'L';
    cout << 'U';
    cout << endl;
    return 0;
}


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

char dict[30600000];

char word[128];

long encode(const char *key){
  int n=strlen(key),i;
  long sum=0;
  long keta=1;
  for(i=0;i<n;i++){
    int keyi=key[i];
    sum = sum + keta * word[keyi];
    keta=(keta<<2)+keta;
  }
  return (sum);
}

void insert(const char *key2) {
  long key=encode(key2);
  long keta=key/8;
  dict[keta]=(dict[keta]|(1<<(key%8)));
}

int find_h(const char *key2) {
  long key=encode(key2);
  return (dict[key/8] & 1<<(key%8));
}

int main(void) {
  long n,i;
  word['A'] = 1;
  word['C'] = 2;
  word['G'] = 3;
  word['T'] = 4;
  scanf("%ld\n",&n);
  for(i=0;i<n;i++){
    char cmd[8], str[14]; scanf("%s %s\n",cmd, str);
    if(cmd[0]=='i') {
      //      insert(str);
      long key=encode(str);
      long keta=key/8;
      dict[keta]=(dict[keta]|(1<<(key%8)));
    }
    else {
      long key=encode(str);
      if (dict[key/8] & 1<<(key%8)) 
	//      if(find_h(str)) 
	printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

Measured memory_bytes: 1436
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 
 
 typedef tree<pair<int, int>,null_type,less<pair<int, int> >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
 
#define ll          long long
#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
//#define hell          1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
// mp::cpp_int
 
const int hell=1000000007;


int power(int a,int b)
{
  if(b==0)return 1;
   int t=power(a,b/2);
   t*=t;
   t%=hell;
   if(b&1)t*=a;
   t%=hell;
   return t;
}

int inverse(int a)
{
  return power(a,hell-2);
}


int solve()
{
  

int n;
cin>>n;
vi a(n-1);
rep(i,0,n-1)cin>>a[i];
int ans=a[n-2];
int mn=a[n-2];
for(int i=n-3;i>=0;i--)
{
  if(a[i]>mn)
   {
    ans+=mn;
    mn=a[i];
  }
  else 
  {
    ans+=a[i];
    mn=min(a[i],mn);
  }
}
cout<<ans+mn;


 return 0;
}
 

signed main()
{  int t=1;

//pri();
  
 ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
  
   cin.exceptions(cin.failbit);                                                                    
 
 

  
 
  clock_t time_req;
 
    // Without ung pow function
                                                                                                                   
 //cin>>t;
 
    int k=1;
     
   while(t--)
     {
      // cout<<"Case #"<<k<<":"<<endl;k++;
     // cout<<endl;
      solve();
     }
        exit(0);
 
         time_req = clock() - time_req;
    cout <<endl<< "Processor time taken is "
      << (double)time_req/CLOCKS_PER_SEC << " seconds" << endl;
 
 
    return 0;
}

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

int main() {
  int h,n;
  cin >> h >> n;
  
  vector<int> a(n);
  int sum = 0;
  
  for(int i = 0; i < n; i++){
    cin >> a.at(i);
    sum += a.at(i);
  }
  
  if(sum>=h){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
using namespace std;
using ll = long long;
ll dp[110][100010];

int main() {

  int N, W;
  cin >> N >> W;

  vector<ll> weights(N+1, 0);
  vector<ll> values(N+1, 0);
  for (int i = 1; i <= N; i++) {
    cin >> weights[i] >> values[i];
  }

  memset(dp, 0, sizeof(dp));

  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= W; j++) {
      dp[i][j] = dp[i-1][j];
      if (j == 0){
        dp[i][j] = 0;
        continue;
      }
      else if (j >= weights[i]) {
        dp[i][j] = max(dp[i][j], dp[i-1][j - weights[i]] + values[i]);
      }
    }
  }

  /*for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= W; j++) {
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }*/

  cout << dp[N][W] << '\n';

}


Measured memory_bytes: 86144
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace B_ABC136
{
    class MainClass
    {

        static int[] s;

        public static void Main(string[] args)
        {
            int cnt = 0;
            s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            for(int i=1;i<=s[0];i++){
                if(i.ToString().Length%2==1){
                    cnt++;

                }
            }
            WriteLine(cnt);
        }
    }
}


Measured memory_bytes: 13268
import java.util.Scanner;


public final class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n= scan.nextInt();
		
		int count=0;
		for (int i=0;i<n;i++) {
			if (isPrime(scan.nextInt()))count++;
		}
		System.out.println(count);
	}
	static boolean isPrime(int n) {
		if (n<2) return false;
		for (int i=2;i*i<=n;i++) {
			if (n%i==0) return false;
		}
		return true;
	}
}

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

int main() {
  int N,a=0;
  cin>>N;
  int n=N;
  for(int i=0;i<8;i++){
    a+=n%10;
    n/=10;
  };
  if(N%a==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  
}


Measured memory_bytes: 256
# -*- coding:utf-8 -*-
import sys

sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
mod = 1000000007
inf = float("INF")


def I(): return int(input().rstrip())


def IR(n): return [I() for _ in range(n)]


def LI(): return list(map(int, input().rstrip().split()))


def LIR(n): return [LI() for _ in range(n)]


def LI_(): return list(map(lambda x: int(x) - 1, input().rstrip().split()))


def LIR_(n): return [LI_() for _ in range(n)]


def F(): return float(input().rstrip())


def FR(n): return [F() for _ in range(n)]


def LF(): return list(map(float, input().rstrip().split()))


def LFR(n): return [LI() for _ in range(n)]


def S(): return input().rstrip()


def SR(n): return [S() for _ in range(n)]


def LS(): return list(sys.stdin.readline().rstrip().split())


def LSR(n): return [LS() for _ in range(n)]


x, a, b = IR(3)
print((x - a) % b)


Measured memory_bytes: 9168
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int n;
int t[10002];
int dp[5002][2], tmp[5002][2];

int minCost(const int &a, const int &b){
  if(a == -1) return b;
  if(b == -1) return a;
  return a > b ? b : a;
}

int solve(){
  memset(tmp, -1, sizeof(tmp));
  tmp[1][0] = tmp[0][1] = 0;

  for(int i = 1; i < n; i++){
    memset(dp, -1, sizeof(dp));

    int to = min(i, n / 2);

    for(int j = 0; j <= to; j++){
      for(int pre = 0; pre < 2; pre++){
        if(tmp[j][pre] == -1) continue;

        for(int next = 0; next < 2; next++){
          if(pre == next){
            if(next == 0) dp[j + 1][next] = minCost(dp[j + 1][next], tmp[j][pre]);
            else          dp[j][next] = minCost(dp[j][next], tmp[j][pre]);
          }
          else{
            if(next == 0) dp[j + 1][next] = minCost(dp[j + 1][next], tmp[j][pre] + t[i - 1]);
            else          dp[j][next] = minCost(dp[j][next], tmp[j][pre] + t[i - 1]);
          }
        }
      }
    }

    for(int j = 0; j <= n / 2; j++){
      for(int k = 0; k < 2; k++){
        tmp[j][k] = dp[j][k];
      }
    }
  }

  return minCost(dp[n / 2][0], dp[n / 2][1]);
}

int main(){
  scanf("%d", &n);
  for(int i = 0; i < n - 1; i++){
    scanf("%d", &t[i]);
  }
  printf("%d\n", solve());
}

Measured memory_bytes: 952
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N, M;
        cin >> N >> M;
        vllvll roads(N+1);
        rep(i, 0, M) {
                ll a, b;
                cin >> a >> b;
                roads[a].push_back(b);
                roads[b].push_back(a);
        }
        rep(i, 1, N+1) {
                cout << len(roads[i]) << endl;
        }
}

Measured memory_bytes: 256
object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val a = Array.fill(n)(sc.nextLong())
  println(a.foldLeft(0L)((x, y) => x + div(y, 0)))
  
  def div(num: Long, acc: Long): Long = {
    if (num % 2L == 0L) {
      div(num/2L, acc+1L)
    } else {
      acc
    }
  }
}


Measured memory_bytes: 58248
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
int main (){
	vector <int> a;
	for (int i=0;i<3;i++){
		int k; cin>>k;
		a.push_back(k);
	}
	sort(a.begin(),a.end());
	cout<<a[0]+a[1]<<endl;
}	

Measured memory_bytes: 256
#include <stdio.h>
int main(){
int a[6],i,k;
int max=0;
int min=123;

for(i=1; i<=5; i++ ){
scanf("%d",&a[i]);
if(max<a[i]) max=a[i];
if(min>a[i]) min=a[i];
}
scanf("%d",&k);

if(max-min>k) printf(":(");
else printf("Yay!");

return 0;
}


Measured memory_bytes: 128
#include<iostream>

using namespace std;

int a,b,c,x,t;
int main(){
	cin>>a>>b>>c>>x;
	for(int i=0;i<=a;i++){
		for(int j=0;j<=b;j++){
			for(int k=0;k<=c;k++){
				if(i*500+j*100+k*50==x)t++;
			}
		}
	}
	cout<<t;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;cin>>a>>b;
  	int l = max(-1000000,b-a+1);
  	int r = min(1000000,b+a-1);
  	for(int i=l;i<=r;i++){cout<<i<<" ";}
}

Measured memory_bytes: 256
#include <stdio.h>
int T,F,R,c,a,t;char s[9];
main()
{
for(;c-48&&scanf("%s",s);a+=T)
{
c=*s;
c<60?a&&printf("%d\n",a),a=0,T=1,F=2,R=3:0;
c==78?t=T,T=F,F=7-t:0;
c==83?t=F,F=T,T=7-t:0;
c==69?t=R,R=T,T=7-t:0;
c==87?t=T,T=R,R=7-t:0;
c==82?t=F,F=R,R=7-t:0;
c==76?t=R,R=F,F=7-t:0;
}}

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

class Solve {
private:

public:
	bool is_last_query_{};
	Solve()
	{
		using vi = std::vector<int>;
		using vvi = std::vector<vi>;
		using vvvi = std::vector<vvi>;
		int W, H;
		scanf("%d%d", &W, &H);
		if (W == 0)
		{
			is_last_query_ = true;
			return;
		}
		vvi room(H + 2, vi(W + 2, -1));
		int begin[2]{};
		std::map<std::pair<int, int>, int> dirt;
		for (int i{1}; i <= H; i++)
			for (int j{1}; j <= W; j++)
			{
				char tmp;
				scanf(" %c", &tmp);
				if (tmp == '.') room[i][j] = 0;
				else if (tmp == '*')
				{
					room[i][j] = 1;
					int tmp{(int)dirt.size()};
					dirt[{i, j}] = tmp;
				}
				else if (tmp == 'o')
				{
					room[i][j] = 0;
					begin[0] = i;
					begin[1] = j;
				}
			}
		vvvi distance(H + 2, vvi(W + 2, vi(1 << dirt.size(), INT_MAX)));
		using i3 = std::array<int, 3>;
		std::queue<i3> bfs;
		bfs.push({begin[0], begin[1], 0});
		distance[begin[0]][begin[1]][0] = 0;
		int goal{-1};
		int dir[4][2]{{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
		while (!bfs.empty())
		{
			auto now{bfs.front()};
			bfs.pop();
			if (now[2] == ((1 << dirt.size()) - 1))
			{
				goal = distance[now[0]][now[1]][now[2]];
				break;
			}
			for (int i{}; i < 4; i++)
			{
				i3 next;
				next[0] = now[0] + dir[i][0];
				next[1] = now[1] + dir[i][1];
				if (room[next[0]][next[1]] == -1) continue;
				next[2] = now[2];
				if (room[next[0]][next[1]] == 1)
					next[2] |= 1 << dirt[{next[0], next[1]}];
				if (distance[next[0]][next[1]][next[2]] != INT_MAX) continue;
				distance[next[0]][next[1]][next[2]] = distance[now[0]][now[1]][now[2]] + 1;
				bfs.push(next);
			}
		}
		
		printf("%d\n", goal);
		return;
	}
};

int main()
{
	while (!Solve().is_last_query_);
	return 0;
}


Measured memory_bytes: 3956
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;


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

  if(N%9==0) cout << "Yes" << endl;
  else cout<< "No" << endl;
}
    

Measured memory_bytes: 3716
from math import ceil

n, m = map(int, input().split())

a = [int(i) for i in input().split()]

all_vote = sum(a) 

m4 = ceil(1/4/m * all_vote)


for i in a:
    if i >= m4:
        m -= 1

        if m == 0:
            print("Yes")
            break

if m != 0:
    print("No")

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

#define times(n, i)      uptil(0, n, i)
#define upto(f, t, i)    for(decltype(t) _##i = (t), i = (f); i <= _##i; i++)
#define uptil(f, t, i)   for(decltype(t) _##i = (t), i = (f); i < _##i; i++)
#define downto(f, t, i)  for(decltype(t) _##i = (t), i = (f); i >= _##i; i--)
#define downtil(f, t, i) for(decltype(t) _##i = (t), i = (f); i > _##i; i--)
#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define all(v) v.begin(), v.end()
#define ln << "\n"

struct line{};

template<class T> istream& operator>>(istream& in, vector<T>& v) {
    times(v.capacity(), i) in >> v[i];
    return in;
}

template<class T> const ostream& operator<<(ostream& out, const vector<T>& v) {
    times(v.size(), i) out << (i ? " " : "") << v[i];
    return out;
}

template<class T, class...U> typename enable_if<is_same<T, line>::value, string>::type next(istream& in, const U&... args) {
    string s;
    getline(in, s, args...);
    return move(s);
}

template<class T, class...U> typename enable_if<!is_same<T, line>::value, T>::type next(istream& in, const U&... args) {
    T t(args...);
    in >> t;
    return move(t);
}
template<class T, class...U> auto next(const U&... args) -> decltype(next<T>(cin)) {
    return next<T>(cin, args...);
}

template<class T> T sum(const vector<T>& v) {
    T ans = T();
    for(const T& t : v) ans += t;
    return ans;
}

template<class T> T sum(const typename vector<T>::iterator& begin, const typename vector<T>::iterator& end) {
    T ans = T();
    for(typename vector<T>::iterator t = begin; t != end; t++) ans += *t;
    return ans;
}

template<class T> T min(const vector<T>& v) {
    return *min_element(v.begin(), v.end());
}

template<class T> T min(const typename vector<T>::iterator& begin, const typename vector<T>::iterator& end) {
    return *min_element(begin, end);
}

template<class T> T max(const vector<T>& v) {
    return *max_element(v.begin(), v.end());
}

template<class T> T max(const typename vector<T>::iterator& begin, const typename vector<T>::iterator& end) {
    return *max_element(begin, end);
}

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

    loop {
        int N = next<int>(), M = next<int>();
        unless(N && M) break;
        vector<vector<int>> friends(N);
        times(M, i) {
            int A = next<int>() - 1, B = next<int>() - 1;
            friends[A].push_back(B);
            friends[B].push_back(A);
        }
        vector<int> part(N, false);
        for(int f : friends[0]) {
            part[f] = true;
            for(int ff : friends[f]) part[ff] = true;
        }
        part[0] = false;
        cout << sum(part) ln;
    }

    return 0;
}

Measured memory_bytes: 1364
#include <cstdint>
#include <iostream>
#include <string>

using namespace std;

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

  bool result = true;
  for (uint32_t i = 0; i < str.size(); i++) {
    if (str[i] != str[str.size() - 1 - i]) {
      result = false;
    }
  }

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

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool comp(pair<long long int,long long int>a,pair<long long int,long long int>b)
{
    if(a.first==b.first)
    {
        if(a.second<=b.second)
        return true;
        else
        return false;
    }
    if(a.first>b.first)
    return true;
    else return false;
}
bool rev(long long int a,long long int b)
{
    if(a>b)return true;
    else return false;
}
bool compa(pair<string,pair<int,int>>a,pair<string,pair<int,int>>b)
{
    if(a.first==b.first)
    {
        if(a.second.first>b.second.first)
        return true;
        else
        return false;
    }
    if(a.first<b.first)
    return true;
    else 
    return false;
}
long long int gcd(long long int bdda,long long int chota)
{
    if(chota==0)
        return bdda;
    return gcd(chota,bdda%chota);
}
void solve()
{
    long long int n;cin>>n;
    long long int a[n],b[n];
    for(long long int i=0;i<n;i++)cin>>a[i];for(long long int i=0;i<n;i++)cin>>b[i];
    long long int ans=0,v=0;
    for(long long int i=0;i<n;i++)
    {
        ans=0;
        for(long long int j=0;j<=i;j++)
        ans+=a[j];
        for(long long int j=i;j<n;j++)
        ans+=b[j];
        v=max(ans,v);
    }
    cout<<v;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;    
    t=1;

    //cin>>t;
    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 3628
x, n = map(int, input().split())
lst = list(map(int, input().split()))
is_exist = [False] * 120
for i in lst:
    is_exist[i] = True
ans = 0
diff = 0
while True:
    if is_exist[x - diff] == False:
        ans = x - diff
        break
    elif is_exist[x + diff] == False:
        ans = x + diff
        break
    diff += 1
print(ans)

Measured memory_bytes: 9056
/**
            ▄█▀ ▀█▀ ▄▀▄ █▀ █▄█▄█ ▄▀▄ █▀ ▄█▀
            <⇋⇋⇋⋛∰≓⊂(⌒,_ゝ⌒)⊃≓∰⋛⇋⇋⇋>

    ♔♕♖♗♘♙ ☜❷☞✪ ィℋ६ ≈ ᗫẵℜℵĬŊĞ ✪☜❷☞ ♚♛♜♝♞♟
    ♔♕♖♗♘♙                             ♚♛♜♝♞♟
                ˙·٠•●♥ Ƹ̵̡Ӝ̵̨̄Ʒ ♥●•٠·˙
**/

#include <bits/stdc++.h>

#define sz(s) s.size()
#define pb push_back
#define fr first
#define sc second
#define mk make_pair
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 1e5 + 5;
int a, b, c, cnt, ans = N;
main()
{
    cin >> a >> b >> c;
    int sum = a + b + c;
    a = max( a, max( b, c ) );
    c = min( b, min( a, c ) );
    b = sum - a - c;
    if( c % 2 == b % 2 )
    {
        sum = ans;
        ans = 0;
        ans += ( b - c ) / 2;
        ans += ( a - b );
        ans = min( ans, sum );
    }
    if( c % 2 == a % 2 )
    {
        sum = ans;
        ans = 0;
        ans += ( a - c ) / 2;
        ans ++;
        ans += ( a + 1 - b ) / 2;
        ans = min ( ans, sum );
    }
    if( b % 2 == a % 2 )
    {
        sum = ans;
        ans = 0;
        ans += ( a - b ) / 2;
        ans ++;
        ans += ( a + 1 - c ) / 2;
        ans = min( ans, sum );
    }
    cout << ans;

}







Measured memory_bytes: 256
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<size_t I,class H,class...T>struct TupleReaderWriter{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple_cat(tuple<H>(v),TupleReaderWriter<sizeof...(T)-1,T...>::r(i));}static void w(ostream&o,tuple<H,T...>&t,string d){TupleReaderWriter<I-1,H,T...>::w(o,t,d);o<<d<<get<I>(t);}};
template<class H,class...T>struct TupleReaderWriter<0,H,T...>{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple<H>(v);}static void w(ostream&o,tuple<H,T...>&t,string d){o<<get<0>(t);}};
template<class...T>istream&operator>>(istream&i,tuple<T...>&t){t=TupleReaderWriter<sizeof...(T),T...>::r(i);return i;}
template<class...T>ostream&operator<<(ostream&o,tuple<T...>&t){string delim=" ";TupleReaderWriter<sizeof...(T)-1,T...>::w(o,t,delim);return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(auto&x:v)i>>x;return i;}
template<class T>ostream&operator<<(ostream&o,vector<T>&v){string delim="";for(auto&x:v)o<<delim<<x,delim=" ";return o;}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int x;fixprec(int d):x(d){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.x);}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
int main() {
    i64 N;
    cin >> N;
    if(N % 2 != 0) {
        cout << 0 << endl;
        return 0;
    }
    N /= 2;
    i64 ans = 0;
    for(i64 x = 5; x <= N; x *= 5) {
        ans += N / x;
    }
    cout << ans << endl;
}



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

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

const int INF = 1e9;
const int mod = 1e9+7;

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> pm[n],p(m),y(m);

    for(int i = 0; i < m; i++){
        cin >> p[i] >> y[i];
        pm[p[i]-1].push_back(y[i]);
    }

    for(int i = 0; i < n; i++) sort(pm[i].begin(),pm[i].end());
    for(int i = 0; i < m; i++){
        printf("%06d%06d\n",p[i],lower_bound(pm[p[i]-1].begin(),pm[p[i]-1].end(),y[i])-pm[p[i]-1].begin()+1); 
    }
}

Measured memory_bytes: 7808
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<stack>
#include<vector>
#define INFTY 10000000000
using namespace std;

int main(){
  int n;
  cin>>n;
  int h[110000];
  long long dp[110000];
  for(int i=0;i<n;i++){
    cin>>h[i];
    dp[i]=INFTY;
  }
  dp[0]=0;
  for(int i=0;i<n-1;i++){
    dp[i+1]=min(dp[i+1],dp[i]+abs(h[i+1]-h[i]));
    if((i+2)<n){
      dp[i+2]=min(dp[i+2],dp[i]+abs(h[i+2]-h[i]));
    }
  }
  cout<<dp[n-1]<<endl;
  
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
long long int a[120]={0,1,31,211,781,2101,4651,9031,15961,26281,40951,61051,87781,122461,166531,221551,289201,371281,469711,586531,723901,884101,1069531,1282711,1526281,1803001,2115751,2467531,2861461,3300781,3788851,4329151,4925281,5580961,6300031,7086451,7944301,8877781,9891211,10989031,12175801,13456201,14835031,16317211,17907781,19611901,21434851,23382031,25458961,27671281,30024751,32525251,35178781,37991461,40969531,44119351,47447401,50960281,54664711,58567531,62675701,66996301,71536531,76303711,81305281,86548801,92041951,97792531,103808461,110097781,116668651,123529351,130688281,138153961,145935031,154040251,162478501,171258781,180390211,189882031,199743601,209984401,220614031,231642211,243078781,254933701,267217051,279939031,293109961,306740281,320840551,335421451,350493781,366068461,382156531,398769151,415917601,433613281,451867711,470692531,490099501,510100501,530707531,551932711,573788281,596286601,619440151,643261531,667763461,692958781,718860451,745481551,772835281,800934961,829794031,859426051,889844701,921063781,953097211,985959031};
int main() {
	for(int i=2;i<=119;i++){
		a[i]+=a[i-1];
	}
	int n;
	cin>>n;
	for(int i=0;i<=119;i++){
		for(int j=i;j<=119;j++){
			if(a[j]-a[i]==n){
				cout<<j<<" "<<i;
				return 0;
			}
			else if(a[j]+a[i]==n){
				cout<<j<<" "<<-i;
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3636
S=gets.chomp

min = 100
('a'..'z').each do |c|
    next unless S.index(c)
    i = 0
    max = 0
    while j = S.index(c,i)
        max = j-i if max < j-i
        i = j+1
    end
    n = [max, S.length - S.rindex(c)-1].max
    min = n if n < min
    # p [c,min,max,S.length - S.rindex(c)-1]
end

puts min


Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,k[112345],l[112345],m[112345],sum=0;
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>k[i];
    sum+=k[i];
  }
  cin>>b;
  for(int i=0;i<b;i++){
    cin>>l[i]>>m[i];
  }
  
  for(int i=0;i<b;i++){
      cout<<sum-k[l[i]-1]+m[i]<<endl;
  }
}

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

int main(int argc, char const *argv[])
{
  string s;
  cin >> s;
  string ans = "";

  for(int i = 0; i < s.length(); i++)
  {
    if(s[i] == 'B')
    {
       if(!ans.empty())
          ans.erase(--ans.end());
    }
    else
      ans += s[i];
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

void Main() {
    int N, K;
    cin >> N >> K;
    vector<int> h(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> h[i];
    }

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

    int ans = h[N - 1] - h[0] + 100;
    for (int i = 0; i < N - K + 1; ++i) {
        ans = min(ans, h[i + K - 1] - h[i]);
    }
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

#define MAX 10000001
vector<ll> hurui(MAX);

void prepare() {
    hurui[1] = 1;
    rep2(i, 2, MAX) {
        if(hurui[i] == 0) {
            for(ll j = i;j < MAX;j += i) hurui[j] = i;
        }
    }
}

void factor(ll n, map<ll, ll> &factors) {
    if(n == 1) {
        factors[1]++;
        return;
    }
    while(true) {
        ll temp = hurui[n];
        factors[temp]++;
        if(temp == n) break;
        n = n / temp;
    }
}

int main(void) {
    ll N;
    vector<int> a;
    prepare();
    ll ans = 1;
    cin >> N;
    repi2(i, 2, N) {
        map<ll, ll> m;
        factor(i, m);
        ll temp = 1;
        iter(j, m) temp *= j.second + 1;
        ans += i * temp;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 81140
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String str = scanner.nextLine();

    char[] ch = str.toCharArray();

    for (int i = 0; i < str.length(); ++i) {
      if (Character.isLowerCase(ch[i])) ch[i] -= 32;
      else if (Character.isUpperCase(ch[i])) ch[i] += 32;
    }

    System.out.println(ch);
  }
}


Measured memory_bytes: 26168
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll N = 2000009;
const ll p = 31;
const ll m = 1e9 + 7;
const ll inf= 1e14;
ll mod = 1e9+7;
ll powm(ll a, ll b) { ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }
// ll fact[N];


// ll ncr(ll n,ll r){
//      return (((fact[n]*powm(fact[r],mod-2))%mod)*powm(fact[n-r],mod-2))%mod;
// }
 int main() {   
     ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
     // #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
     // #endif
     ll t = 1;
     // cin>>t;
     while(t--){
          ll n,k,q;cin>>n>>k>>q;
          ll cor[n];
          memset(cor,0,sizeof(cor));
          for(int i = 0;i<q;i++){
               ll b;cin>>b;b--;
               cor[b]++;
          }
          for(int i = 0;i<n;i++){
               if(cor[i] - q + k<=0){
                    cout<<"No"<<'\n';
               }
               else{
                    cout<<"Yes"<<'\n';
               }
          }
     }
}            


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

int main(void)
{
    int N, M;
    cin >> N >> M;
    vector<vector<int>> edge(N, vector<int>());
    for(int i=0;i<M;i++){
        int a, b;
        cin >> a >> b;
        a--;b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    vector<int> ans(N, -1);
    queue<pair<int, int>> que;
    pair<int, int> fir = make_pair(-1, 0);
    que.push(fir);
    while(!que.empty()){
        auto p = que.front();que.pop();
        if(ans[p.second]==-1){
            ans[p.second] = p.first + 1;
            for(int c:edge[p.second]){
                que.push(make_pair(p.second, c));
            }
        }
    }
    cout << "Yes" << endl;
    for(int i=1;i<N;i++){
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 12148