akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
  #define endl "\n"
  #define ll long long int
  #define vi vector<int>
  #define vll vector<ll>
  #define vvi vector < vi >
  #define pii pair<int,int>
  #define pll pair<long long, long long>
  #define mod 1000000007
  #define inf 1000000000000000001;
  #define all(c) c.begin(),c.end()
  #define mp(x,y) make_pair(x,y)
  #define mem(a,val) memset(a,val,sizeof(a))
  #define pb push_back
  #define f first
  #define se second
  
  using namespace std;
  int main()
  {
    std::ios::sync_with_stdio(false);
    ll n,W;    cin>>n>>W;
    vll v(101),w(101);        vector<vll> dp(101,vll(100001));

    v[0]=inf; w[0]=inf;
    for (ll i = 0; i < n+1; ++i)
    {
      for (ll j = 0; j < 100001; ++j)
      {
        dp[i][j]=inf;
      }
    }
    for (ll i = 1; i < n+1; ++i){
      cin>>w[i]>>v[i];
       // dp[0][i] will be infinite because it is not possible. We have already initialized it inf.
    }    
    dp[1][0]=0;
    dp[0][0]=0;
    dp[1][v[1]]=w[1]; // here I was making error. I was using v[0] & w[0] which is incorrect becuase 
                      // I'am using 1 based indexing.
    
    for (ll i = 2; i < n+1; ++i) // when starting loop from 1 the above 2 dp conditions become useless
    {
      dp[i][0]=0;
      
      for (ll j = 0; j < 100001; ++j)
      {
        dp[i][j]=dp[i-1][j];

        if(j-v[i]>=0){ // maxm weight can be 0.
          dp[i][j]=min(dp[i][j],w[i]+dp[i-1][j-v[i]]);
        }
      }
    }
    for(ll i=100000; i>=0; i--){ // max element can be 0. This loop is important in this question
      if(dp[n][i]<=W)   {
        cout<<i; break; }
    }
    return 0;
  }

Measured memory_bytes: 83236
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int n, m; cin >> n >> m;
	m += n * 3;
	cout << m / 2 << endl;
	cerr << "a" << endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(lambda x:int(x)%2,input().split()))
ans=[0]*n
for i in range(n,0,-1):
    b=n//i
    c=0
    for j in range(1,b+1):
        c+=ans[j*i-1]
    if (c-a[i-1])%2==1:
        ans[i-1]=1

print(sum(ans))
ans1=[]
for i,v in enumerate(ans):
    if v==1:
       ans1.append(i+1)
if len(ans1)>0:
    print(' '.join(map(str,ans1))) 


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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

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

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

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

int main() {
  int n, h, w;
  cin >> n >> h >> w;

  int c = 0;
  rep(i, n) {
    int a, b;
    cin >> a >> b;

    if (a >= h && b >= w) c++;
  }
  p(c);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define COUT(x) cout<<(x)<<"\n"
#define REP(i,n) for(int i=0;i<n;i++)

int a,b;
const int h=100,w=100;
char g[h][w];

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

  REP(i,h) REP(j,w) g[i][j] = i<h/2 ? '#' : '.';

  for (int i = 0; i < h; i+=2) {
    if (h/2+(h/2)%2+2 == i) swap(a,b);
    for (int j = 0; j < w; j+=2) {
      if (a==0) break;
      g[i][j] = g[i][j] == '.' ? '#' : '.';
      a--;
    }
  }

  cout << h << " " << w << endl;
  REP(i,h) REP(j,w) {
    cout << g[i][j];
    j == w-1 && cout << endl;
  }
  return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <utility>
#include <stdlib.h>
#include <fstream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main() {
    FIO;
    string s, t;
    cin >> s >> t;
    if(s == t.substr(0, t.size()-1))
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int n, x;
  cin >> n >> x;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());

  ll sum = 0, rec = 0;
  for (int i = 0; i < n; i++) {
    sum += a[i];
    if (sum >= x) {
      sum == x ? (rec = i + 1) : (rec = i);
      break;
    }
    if (sum < x && i == n - 1) {
      rec = i;
    }
  }

  cout << rec << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)

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

    int n, m;
    cin >> n >> m;

    vector<int> A(m), B(m);
    REP(i, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        A[i] = a;
        B[i] = b;
    }

    int cnt = 0;
    REP(i, m){
        int D[n + 1][n + 1];
        REP(j, n){
            REP(k, n){
                D[j][k] = (j == k ? 0 : 1e9);
            }
        }

        REP(j, m){
            if(i == j) continue;
            D[A[j]][B[j]] = 1;
            D[B[j]][A[j]] = 1;
        }

        REP(j, n){
            REP(k, n){
                REP(l, n){
                    D[k][l] = min(D[k][l], D[k][j] + D[j][l]);
                }
            }
        }

        bool f = false;
        REP(j, n){
            REP(k, n){
                if(D[j][k] == 1e9){
                    cnt++;
                    f = true;
                    break;
                }
            }
            if(f) break;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x) \
  ll x;      \
  cin >> x;  \
  while (x--) 

void cpc()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

int main()
{
  cpc();
  string s;
  cin>>s;
  if(s =="ABC"){
    cout<<"ARC"<<"\n";
  }
  else{
    cout<<"ABC"<<"\n";
  }
}


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


struct job
{
    ll delay;
    ll money;

    job(ll a, ll b)
    {
        delay = a;
        money = b;
    }

    bool operator < (const job &x) const
    {
        return delay < x.delay;
    };

    bool operator > (const job &x) const 
    {
        return money < x.money;
    };
};

void print_jobs(vector<job> v)
{
    cout << "Current possible jobs" << endl;
    for(vector<job>::iterator u = v.begin(); u != v.end(); u++)
    {
        cout << (*u).delay << " " << (*u).money << endl;
    }
}

void print_queue(priority_queue<job,vector<job>,greater<job> > que)
{
    cout << "-- print queue --" << endl;
    priority_queue<job,vector<job>,greater<job> > p = que;
    while(!p.empty())
    {
        job j = p.top();
        p.pop();
        cout << j.delay << " " << j.money << endl;
    }
    cout << "-----------------" << endl;
}


int main()
{
    ll n,m;
    cin >> n >> m;
    vector<job> jobs;
    for (ll i = 0; i < n; i++)
    {
        ll a,b;
        cin >> a >> b;
        // delay, money
        jobs.push_back(job(a,b));
    }
    sort(jobs.begin(),jobs.end());

    priority_queue<job,vector<job>,greater<job> > que;

    ll tmp = 0;
    ll i = 0;

    for (ll x = 1; x <= m; x++)
    {
       while(jobs[i].delay<=x && i< n)
       {
           que.push(jobs[i]);
           i++;
       }
       //print_queue(que);
       if(!que.empty())
       {
            tmp += que.top().money;
            que.pop();
       }
       //cout << "x=" << x << " tmp=" << tmp << endl;
    }
    
    cout << tmp << endl;
        
    return 0;
}

Measured memory_bytes: 4848
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define f(i, a, b) for(int i=a; i<b; i++)
#define fr(i, a, b) for(int i=a; i>=b; i--)
#define l long int
#define max 200000
using namespace std;
//ll MOD=1000000000000007;
int main()
{
ll sum=0;
string s;
cin>>s;
int i=0;
while(s[i]!='\0')
{
	sum+=(s[i]-48);
//	scanf("%1d",&s); 
//	if(s>1 && s<9)
//	break;
i++;
//cout<<sum<<endl;
}
if(sum%9==0)
cout<<"Yes";
else
cout<<"No";

}






Measured memory_bytes: 3684
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 998244353
using namespace std;
typedef pair<llint, llint> P;
typedef pair<P, llint> E;

llint n;
llint x[200005], c;
llint sum[200005];

int main(void)
{
	cin >> n >> c;
	for(int i = 1; i <= n; i++) cin >> x[i];
	for(int i = 1; i <= n; i++) sum[i] = sum[i-1] + x[i];
	
	llint ans = inf;
	for(int i = 1; i <= n; i++){
		llint tmp = 0, mul = 5;
		for(int j = 1; j <= n; j+=i){
			tmp += mul*(sum[n+1-j] - sum[max(0LL, n+1-j-i)]);
			tmp = min(tmp, (llint)inf+1);
			if(j > 1) mul += 2;
		}
		ans = min(ans, tmp+c*i);
	}
	ans += n*c;
	cout << ans << endl;
	
	return 0;
}


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

int main(){
  int N;
  cin >> N;
  int count = 0;
  for (int i=1; i<=N; i++) {
    if (i%2 == 0) continue;
    int yakusuu = 0;
    for (int j=1; j<=i; j++) {
      if (i%j == 0) yakusuu++;
    }
    if (yakusuu == 8) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define long long ll
int main(){
    int n;
    cin >> n;
    vector<int> a;
    rep(i,n){
        int temp;
        cin >> temp;
        a.push_back(temp);
    }
    int min_cnt =INT_MAX;
    for(int j = -100; j < 101; j++){
        int cnt = 0;
        rep(i,a.size()){
            cnt += abs(j-a[i])*abs(j-a[i]);
        }
        min_cnt = min(min_cnt , cnt);
    }
    cout << min_cnt << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"log"
	"math"
	"os"
)

const (
	ARG_NUM = 4
)

func main() {
	var a, b, c, d float64
	num, _ := fmt.Fscanln(os.Stdin, &a, &b, &c, &d)
	if num != ARG_NUM {
		log.Fatalf("dont mach args num! actual args num: %d", num)
	}
	result := canTalk(a, b, c, d)

	fmt.Println(result)
}

func canTalk(a, b, c, d float64) string {
	if math.Abs(a-c) <= d || (math.Abs(a-b) <= d && math.Abs(b-c) <= d) {
		return "Yes"
	}
	return "No"
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>

using namespace std;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define INF 11111111111111111
#define MOD 1000000007
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<ll, ll> pll;

ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, temp = 0;
string s;
bool flag;

//-------------------------------------------------------------------------------

#define MAX 10000

int main(void) {
  cin >> n;
  vll p;

  FOR(i, 0, n) {
	cin >> temp;
	p.push_back(temp);
  }

  FOR(i, 0, n - 1) {
	if (p[i] == i + 1) {
	  temp = p[i];
	  p[i] = p[i + 1];
	  p[i + 1] = temp;
	  cnt++;
	}
  }

  if (p[n - 1] == n) cnt++;

  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 1400
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        while(true){
            c -= b;
            if(c<=0){
                System.out.println("Yes");
                break;
            }
            a -= d;
            if(a<=0){
                System.out.println("No");
                break;
            }
        }
    }
}

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

	int w;
	while (cin >> w && w >= 0){

		int n = 1150;
		if (w > 30){

			n += 160 * (w - 30);
			w = 30;
		}
		if (w > 20){

			n += 140 * (w - 20);
			w = 20;
		}
		if (w > 10){

			n += 125 * (w - 10);
		}

		cout << 4280 - n << endl;
	}
}

Measured memory_bytes: 1160
<?php

fscanf(STDIN, '%d', $n);

$a = explode(' ', rtrim(fgets(STDIN), PHP_EOL));

//sort($a);
$hoge = [];
for ($i = 0; $i < $n; $i++) {
    if (isset($hoge[$a[$i]])) {
        echo 'NO' . PHP_EOL;
        return;
    }
    $hoge[$a[$i]] = 0;
}

echo "YES" . PHP_EOL;



Measured memory_bytes: 33780
import re
import sys
from collections import (
    Counter,
    defaultdict as ddict,
    deque,
)
from functools import lru_cache
from heapq import *
from itertools import *
from string import (
    ascii_letters as letters,
    ascii_lowercase as ucletters,
    ascii_uppercase as lcletters,
    digits,
)

alnum=digits+letters
hexdigits=digits+'ABCDEFabcdef'

cache=lru_cache(None)

inf=float('inf')
ansmod=1000000007
int8_min=-128
int16_min=-32768
int32_min=-2147483648
int64_min=-9223372036854775808
int8_max=127
int16_max=32767
int32_max=2147483647
int64_max=9223372036854775807
uint8_max=255
uint16_max=65535
uint32_max=4294967295
uint64_max=18446744073709551615

rfs=lambda:rl().split()
ri=lambda:int(rl())
ris=lambda:list(map(int,rfs()))
rl=lambda:next(sys.stdin)
rrs=lambda:list(map(str.strip,sys.stdin))
rs=lambda:rl().strip()
rt=lambda:sys.stdin.read()
rg=lambda:list(map(list,rrs()))
rig=lambda:[[*map(int,x.split())] for x in rls()]

def nbs4(i,j):
    return [
                (i-1,j),
        (i,j-1),        (i,j+1),
                (i+1,j),
    ]

def nbs8(i,j):
    return [
        (i-1,j-1),(i-1,j),(i-1,j+1),
        (  i,j-1),        (  i,j+1),
        (i+1,j-1),(i+1,j),(i+1,j+1),
    ]

inb=lambda i,j,m,n:0<=i<m and 0<=j<n

sys.setrecursionlimit(int32_max)

################################################

S=input()
ans=k=0
for x in S:
    if x=='R':
        k+=1
    else:
        k=0
    ans=max(ans,k)
print(ans)


Measured memory_bytes: 9988
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define repp(i,a,n) for(i=a;i<n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpowmod(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll modInverse(ll n, ll p)
{
    return binpowmod(n, p-2, p);
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,m,n,i,f=0,j,ans=0,k,x;
    cin >> n >> k ;
    ll cnt[n+1]={0};
    rep(i,k)
    {
        cin >> m ;
        rep(j,m)
        {
            cin >> x ;
            cnt[x]++;
        }
    }
    
    for(i=1;i<=n;++i) if(cnt[i]==0) ans++;
    cout <<ans << endl;
    return 0;
}

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

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

    vector<vector<int>> vc(3, vector<int>(3));
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> vc[i][j];
        }
    }
    vector<int> x(3);
    vector<int> y(3);

    for(int i = 0; i < 3; i++) y[i] = vc[0][i] - x[0];
    for(int i = 0; i < 3; i++) x[i] = vc[i][0] - y[0];
    
    bool ans = true;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            if(vc[i][j] != x[i] + y[j]) ans = false;
        }
    }
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 5e+5+5;

int n,L;
struct key_point{
	int tim;
	db x,y;
	key_point(const int tim_=0,const db x_=0,const db y_=0){tim=tim_;x=x_;y=y_;}
}a[N];
int he,ta;
LL prex[N],prey[N];

key_point getpoint(key_point u,int i){
	u.x=u.x+prex[i]-prex[u.tim];
	u.y=u.y+prey[i]-prey[u.tim];
	return u;
}

db get_tan(key_point u,int i){
	return (u.y+prey[i]-prey[u.tim])/(u.x+prex[i]-prex[u.tim]);
}

int main(){
	n=get();L=get();
	fo(i,1,n){
		LL t=get(),v=get();
		prey[i]=prey[i-1]+t*v;
		prex[i]=prex[i-1]+v;
	}
	int he=n,ta=n;
	a[n]=key_point(0,0,0);
	fo(i,1,n){
		while(he<ta&&a[ta].x+prex[i]-prex[a[ta].tim]>L+1e-7){
			if (a[ta-1].x+prex[i]-prex[a[ta-1].tim]>L+1e-7)ta--;
			else{
				key_point u=getpoint(a[ta-1],i),v=getpoint(a[ta],i);
				a[ta].y=u.y+(v.y-u.y)/(v.x-u.x)*(1.0*L-u.x);
				a[ta].x=L;
				a[ta].tim=i;
			}
		}
		while(he<ta&&get_tan(a[he],i)<get_tan(a[he+1],i))he++;
		a[--he]=key_point(i,0,0);
		printf("%.7lf\n",getpoint(a[ta],i).y/L);
	}
	return 0;
}

Measured memory_bytes: 28544
s = input()
if 'N' in s and 'S' not in s:
    print('No')
elif 'S' in s and 'N' not in s:
    print('No')
elif 'W' in s and 'E' not in s:
    print('No')
elif 'E' in s and 'W' not in s:
    print('No')
else:
    print("Yes")

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

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;}
ll lcm(ll x, ll y) {return x/gcd(x,y)*y;}


int main(){
    int n;
    ll m;
    cin>>n>>m;
    vector<ll> a(n);
    rep(i,n){
        cin>>a[i];
        a[i]/=2;
    }

    bool same=true;
    while(a[0]%2==0){
        for(int i=0;i<n;i++){
            if(a[i]%2!=0){
                cout<<0<<endl;
                return 0;
            }
            a[i]/=2;
        }
        m/=2;
    }

    rep(i,n){
        if(a[i]%2==0){
            cout<<0<<endl;
            return 0;
        }
    }

    ll lcm=1;
    rep(i,n){
        ll g=gcd(lcm,a[i]);
        lcm=lcm/g*a[i];
        if(lcm>m){
            cout<<0<<endl;
            return 0;
        }
    }

    cout<<(m/lcm+1)/2<<endl;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    int n, x; cin >> n >> x;
    vector<int> m(n);
    rep(i, n) cin >> m[i];
    sort(m.begin(), m.end());
    int total = 0;
    rep(i, n) total += m[i];
    x -= total;
    cout << x/m[0] + n;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
#define CENTINEL 2000000000
#define MAX 200000
typedef long long int llong;
int n,A[200000];
int L[MAX/2+2],R[MAX/2+2];
llong merge(int A[],int left,int mid,int right){
  int na=mid-left;
  int nb=right-mid;
  llong sum=0;
  for(int i=0;i<na;i++)L[i]=A[left+i];
  for(int i=0;i<nb;i++)R[i]=A[mid+i];
  L[na]=R[nb]=CENTINEL;
  int i=0,j=0;
  for(int k=left;k<right;k++){
    if(L[i]<=R[j])A[k]=L[i++];
    else {A[k]=R[j++];sum+=na-i;}
  }
  return sum;
}
llong mergesort(int A[],int left,int right){
  llong v1,v2,v3;
  if(left+1<right){
    int mid=(left+right)/2;
    v1=mergesort(A,left,mid);
    v2=mergesort(A,mid,right);
    v3=merge(A,left,mid,right);
    return v1+v2+v3;
  } else return 0;
}
int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++)scanf("%d",&A[i]);
  llong cnt;
  cnt=mergesort(A,0,n);
  printf("%lld\n",cnt);
  return 0;
}



Measured memory_bytes: 4784
import numpy as np

N,M = (int(x) for x in input().split())
H = [int(x) for x in input().split()]
count = 0
x=np.zeros(N)
y=np.zeros(N)

for i in range(M):
    A,B = (int(x) for x in input().split())
    x[A-1] = x[A-1] + 1
    x[B-1] = x[B-1] + 1
    
    if H[A-1] != 0 and H[B-1] != 0 and H[A-1] > H[B-1]:
        y[A-1] = y[A-1] + 1
    elif H[A-1] != 0 and H[B-1] != 0 and H[A-1] < H[B-1]:
        y[B-1] = y[B-1] + 1

for i in range(N):
    if x[i] == y[i]:
        count = count + 1
print(count)

Measured memory_bytes: 38408
def kaibun(S):
    return all([S[i] == S[-i-1] for i in range(len(S)//2)])

S = input()
if kaibun(S) & kaibun(S[:(len(S)-1)//2]) & kaibun(S[(len(S)+1)//2:]):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	string s; cin >> s;
	int n = s.length();
	int x = 0;
	for (int i = 0; i < n; i++)
		x += s[i] - '0';
	cout << (x % 9 == 0 ? "Yes" : "No") << '\n';
	return 0;
}


Measured memory_bytes: 3720
N = int(input())
C1 = input().split()
C2 = [i for i in C1]


def cVal(s):
    return int(s[1])


def BubbleSort(C, N):
    for i in range(N):
        for j in range(N - 1, i, -1):
            if cVal(C[j]) < cVal(C[j - 1]):
                C[j], C[j - 1] = C[j - 1], C[j]


def SelectionSort(C, N):
    for i in range(N):
        minj = i
        for j in range(i, N):
            if cVal(C[j]) < cVal(C[minj]):
                minj = j
        C[i], C[minj] = C[minj], C[i]


def isStable(C1, C2):
    for i1, i2 in zip(C1, C2):
        if i1 != i2:
            return False
    return True

BubbleSort(C1, N)
print(' '.join(C1))
print('Stable')

SelectionSort(C2, N)
print(' '.join(C2))
ans = 'Stable' if isStable(C1, C2) else 'Not stable'
print(ans)


Measured memory_bytes: 5608
import sys
from itertools import product
from string import digits

def main():
    n, s = sys.stdin.read().split()
    n = int(n)

    cand = list(''.join(p) for p in product(digits, repeat=3))

    res = set()
    for c in cand:
        i = s.find(c[0])
        if i == -1:
            continue
        j = s.find(c[1], i+1)
        if j == -1:
            continue
        k = s.find(c[2], j+1)
        if k == -1:
            continue
        
        res.add(c)
        
    ans = len(res)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3956
import java.util.Scanner;

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

		int n = sc.nextInt();
		int k = sc.nextInt();
		long ans = 0;
		long mod = 1000000007;

		for (long i = k; i <= n + 1; i++) {

			ans += ((n - i + 1) * i + 1) % mod;
			ans = ans % mod;
		}

		System.out.println(ans);
	}

}


Measured memory_bytes: 27240
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
  int N,M,best=0,count;
  cin >> N;
  vector<string> s(N);
  for(int i=0;i<N;i++)cin >> s.at(i);
  cin >> M;
  vector<string> t(M);
  for(int i=0;i<M;i++)cin >> t.at(i);
  for(int i=0;i<N;i++){
    count=0;
    for(int j=0;j<N;j++){
      if(s.at(i)==s.at(j))count++;
    }
    for(int j=0;j<M;j++){
      if(s.at(i)==t.at(j))count--;
    }
    if(count>best)best=count;
  }
  cout << best << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

shortage = [b - a for a, b in zip(A, B) if a < b]
over = sorted([a - b for a, b in zip(A, B) if a > b], reverse=True)

sum_shortage = sum(shortage)
sum_over = 0
count = -1
if sum_shortage == 0:
    count = 0
elif sum_shortage > sum_over:
    for i, v in enumerate(over):
        sum_over += v
        if sum_shortage <= sum_over:
            count = len(shortage) + i + 1
            break
print(count)

Measured memory_bytes: 24108
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

int main() {
    cout << fixed << setprecision(10);
    
    int N; cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    ll gcd_v = A[0];
    rep(i, N-1) {
        gcd_v = gcd(gcd_v, A[i+1]);
    }
    cout << gcd_v << endl;
    return 0;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace LogicSummoner
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var line = Console.ReadLine().Trim();
                var sum = line.Select(x => x - '0').Sum();
                if (line.Length == 1 && sum == 0)
                {
                    break;
                }

                System.Console.WriteLine(sum);
            }
        }

        //static StreamReader Console = new StreamReader("input.txt");

        static int GetNumber()
        {
            return int.Parse(Console.ReadLine().Trim());
        }

        static double GetDounble()
        {
            return double.Parse(Console.ReadLine().Trim());
        }

        static int[] GetNumbersInt(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        static long[] GetNumbersLong(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToArray();
        }

        static double[] GetNumbersDouble(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => double.Parse(x)).ToArray();
        }

        static string[] GetStrings(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToArray();
        }
    }
}

Measured memory_bytes: 9396
o=->a,n{n<1?1:a**n[0]*o[a,n/2]**2%M}
eval'N,A,B='+`dd`.split*?,
a=o[A*=t=o[A+B,-2+M=10**9+7],N]
b=o[B*=t,N]
f=f=1,*(1..2*N).map{|i|f=f*i%M}
N.times{|i|$.=($.+f[N+i]*o[f[N-1]*f[i],M-2]*(a+b)*100*t)%M
a=a*B%M
b=b*A%M}
p$.

Measured memory_bytes: 5124
use std::io;
use std::cmp;

fn main() {
    let mut i = String::new();
    let _ = io::stdin().read_line(&mut i);

    let	n: i32 = i.trim().parse::<i32>().unwrap();

    for _ in 0..n {
        let mut input = String::new();
        let _ = io::stdin().read_line(&mut input);

        let mut iter = input.split_whitespace();

        let x = iter.next().unwrap().parse::<i32>().unwrap();
        let y = iter.next().unwrap().parse::<i32>().unwrap();
        let z = iter.next().unwrap().parse::<i32>().unwrap();

        if cmp::min(x, y).pow(2) + cmp::min(z, cmp::max(x, y)).pow(2) == cmp::max(z, cmp::max(x, y)).pow(2) {
            println!("YES");
        } else {
            println!("NO");
        }
    }
}



Measured memory_bytes: 5028
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

ll gcd(ll a, ll b) {
  if (b == 0) return a;
  else return gcd(b, a % b);
}

int main()
{
  ll N, M;
  cin >> N >> M;
  string S, T;
  cin >> S >> T;
  
  ll L = N*M/gcd(N, M);
  ll ln = M/gcd(N, M);
  ll lm = N/gcd(N, M);
  ll tL = ln * lm;

  int i = 0;
  while (1) {
    int idxs = i * tL / ln;
    int idxt = i * tL / lm;
    if (idxs >= N || idxt >= M) break;
    if (S[idxs] != T[idxt]) {
      cout << -1 << endl;
      return 0;
    }
    i++;
  }
  cout << L << endl;

	return 0;
}



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

int main() {
int n;
cin >> n;
int w[n];
for(int i=0;i<n;i++){
    cin >> w[i];
}
int dist=32768;
int sum=0;
for(int i=0;i<n;i++){
    sum+=w[i];
}
int sone=0;
for(int i=0;i<n;i++){
    sone+=w[i];
dist=min(dist,abs(2*sone-sum));
}
cout << dist;
}


Measured memory_bytes: 256
import math
n = int(input())
num1 = []
ans = 0
for i in range(1,n+1):
  for j in range(1,n+1):
    for k in range(1,n+1):
      dum = math.gcd(i,j)
      ans += math.gcd(dum,k)
print(ans)

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define int long long

signed main(){
    string s; int k;
    cin >> s >> k;
    int ans = 1;
    rep(i,min((int)s.length(), k)){
        if(s[i]!='1'){
            ans = s[i] - '0';
            break;
        }
    }
    cout << ans << endl;
}

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

ll myabs(ll x)
{
	return x<0?-x:x;
}

int main()
{
	ll n;
	cin>>n;
	ll a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	ll s1=0,s2=0,f=1,now1=0,now2=0;
	for(int i=0;i<n;i++)
	{
		now1+=a[i];
		now2+=a[i];
		if(now1*f<=0) s1+=myabs(f-now1),now1=f;
		if(now2*f>=0) s2+=myabs(-f-now2),now2=-f;
//		cout<<now1<<' '<<now2<<endl;
		f=-f;
	}
//	cout<<s1<<' '<<s2<<endl;
	cout<<min(s1,s2)<<endl;
	return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

ll n,a[100010];
ll cnt[100010];
ll ans[100010];
ll out[100010];

int main(void){
	cin >> n;
	rep(i,n) cin >> a[i];

	using state=tuple<int,int>;
	vector<state> cand;
	cand.push_back(state(0,-1));
	
	rep(i,n) if(get<0>(cand.back())<a[i]) cand.push_back(state(a[i],i));

	rep(i,n){
		int idx=lower_bound(begin(cand),end(cand),state(a[i],-1))-begin(cand);
		ans[idx]+=a[i]-get<0>(cand[idx-1]);	
		cnt[idx-1]++;
	}

	const int m=cand.size();

	rrep(i,m,1){
		cnt[i]+=cnt[i+1];
		ans[i]+=1LL*cnt[i]*(get<0>(cand[i])-get<0>(cand[i-1]));
	}
		
	rep(i,1,m) out[get<1>(cand[i])]=ans[i];

	rep(i,n) cout << out[i] << endl;

	return 0;
}

Measured memory_bytes: 5108
#pragma GCC optimize(2)
#pragma G++ optimize(2)
#include<bits/stdc++.h>
using namespace std;
std::mt19937 rnd(time(0));//std::mt19937_64 rnd(time(0));
namespace Sakurajima_Mai{
	#define si(a) scanf("%d",&a)
	#define sl(a) scanf("%lld",&a)
	#define sd(a) scanf("%lf",&a)
	#define ss(a) scanf("%s",a)
	#define ms(a) memset(a,0,sizeof(a))
	#define reg register
	#define repi(i,a,b) for(reg int i=a,bbb=b;i<=bbb;++i)//attention reg int or reg ll ?
	#define repd(i,a,b) for(reg int i=a,bbb=b;i>=bbb;--i)
	#define reps(s) for(reg int i=head[s],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
	#define ce(i,r) i==r?'\n':' '
	#define pb push_back 
	#define all(x) x.begin(),x.end()
	#define gmn(a,b) a=min(a,b)
	#define gmx(a,b) a=max(a,b)
	#define fi first
	#define se second
	#define pr(x) cout<<#x<<": "<<x<<endl
	typedef long long ll;
	typedef unsigned long long ull;
	typedef double db;
	const int infi=2e9;
	const ll infl=4e18;
	inline int qi(){
    int f=0,fu=1; char c=getchar();
    while(c<'0'||c>'9'){ if(c=='-')fu=-1; c=getchar(); }
    while(c>='0'&&c<='9'){ f=(f<<3)+(f<<1)+c-48; c=getchar(); }
    return f*fu;
	}
	inline ll ql(){
		ll f=0;int fu=1; char c=getchar();
	    while(c<'0'||c>'9'){ if(c=='-')fu=-1; c=getchar(); }
	    while(c>='0'&&c<='9'){ f=(f<<3)+(f<<1)+c-48; c=getchar(); }
	    return f*fu;
	}
	inline db qd(){
	    char c=getchar();int flag=1;double ans=0;
	    while((!(c>='0'&&c<='9'))&&c!='-') c=getchar();
	    if(c=='-') flag=-1,c=getchar();
	    while(c>='0'&&c<='9') ans=ans*10+(c^48),c=getchar();
	    if(c=='.'){c=getchar();for(register int Bit=10;c>='0'&&c<='9';Bit=(Bit<<3)+(Bit<<1)) ans+=(double)(c^48)*1.0/Bit,c=getchar();}
	    return ans*flag;
	}
	inline ll ceil_div(ll a,ll b){ return (a+b-1)/b; }
}
using namespace Sakurajima_Mai;
const int MAX_N=1e5+5;
struct Union_Find{
	int fa[MAX_N];
	void init(int n){repi(i,0,n)fa[i]=i;} 
	int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
	void unit(int x,int y){x=find(x),y=find(y);if(x!=y)fa[y]=x;}
	bool same(int x,int y){return find(x)==find(y);}
}uf;
int main()
{
	int n=qi(),m=qi(); uf.init(n);
	repi(i,1,m) uf.unit(qi(),qi());
	int ans=0;
	repi(i,1,n)if(i==uf.find(i)) ans++;
	printf("%d\n",ans-1);
	return 0;
}

Measured memory_bytes: 4160
#include<iostream>
#include<string>
 
using namespace std;
 
int main(){
  string str;
  string c;
  int i;
  bool flg = true;
  
  cin >> str;
  
  for(i=0;i<str.length();i++){
    c = str.substr(i,1);
    if(((i+1)%2 == 1 && c == "L")
      ||((i+1)%2 == 0 && c == "R")){
      flg = false;
    }
  }
  if(flg) {
    cout << "Yes";
  }
  else {
    cout << "No";
  }
  
  return 0;
}

Measured memory_bytes: 256
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 1000000007
//P pa(114,514);   ,vector<P>vec(N,0);
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}
int kaijou(int n){
    int a=1;
  if(n==0){
    return 1;
  }
    REP(i,n){
        a*=i+1;
    }
    return a;
}
int ncr(int n,int r){
  int a;
  if(n<0||r<0||n<r){
    return 0;
  }
  a=kaijou(n)/kaijou(r)/kaijou(n-r);
  return a;
}
//cout << setprecision(123);
int main(){
  int N,A,B;
  cin>>N>>A>>B;
  cout<<min(N*A,B)<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
 
typedef struct{
  char m[2];
  int n;
  int o;
} Card;
 
int partition(Card *A, int p, int r){
  int i, j, a;
  Card x;
  a = A[r].n;
  i = p - 1;
  for(j = p; j < r; j++){
    if(A[j].n <= a){
      i++;
      x = A[i];
      A[i] = A[j];
      A[j] = x;
    }
  }
  x = A[i + 1];
  A[i + 1] = A[r];
  A[r] = x;
  return i + 1;
}
 


void quickSort(Card *A, int p, int r){
  int q; 
  if(p < r){
    q = partition(A, p, r);
    quickSort(A, p, q - 1);
    quickSort(A, q + 1, r);
  }
}
 int main(){
  Card A[100000];
  int n2, i, j, v = 0;
 
  scanf("%d",&n2);
  for(i = 0; i < n2; i++){
    scanf("%s %d",A[i].m, &A[i].n);
    A[i].o = i + 1;
  }
  quickSort(A, 0, n2 - 1);
  for(i = 0; i < n2; i++){
    if(A[i].o > A[i + 1].o && A[i].n == A[i + 1].n){
      v++;
      break;
    }
  }
  if(v == 0) printf("Stable\n");
  else printf("Not stable\n");
  for(i = 0; i < n2; i++) printf("%s %d\n",A[i].m, A[i].n);
  return 0;
}

Measured memory_bytes: 1784
#include<stdio.h>

int main(){
	
	int A,B;
	int x;
	
	scanf("%d", &A);
	scanf("%d", &B);
	
	x = A+B;
	
	if (x > 23){
		
		x = x-24;
		printf("%d", x);
	} else {
		
		printf("%d",x);
	}

	return 0;
}

Measured memory_bytes: 128
def main():
  size = int(input())
  array = []
  for i in range(size):
    array.append(list(map(int, input().split())))
                    
  flg = "Yes"           
  pre_time = 0
  pos = [0, 0] 
  for i in range (size):
    time = array[i][0] - pre_time
    distance = abs(array[i][1]-pos[0]) + abs(array[i][2]-pos[1])
    
    if time == distance or ((distance<time) and (time-distance)%2 == 0):
      pre_time = array[i][0]
      pos = array[i][1:]
    else:
      flg = "No"
                    
  print(flg)
                    
main()

Measured memory_bytes: 27380
#include <stdio.h>

int main() {
	char a[11];
	scanf("%s", &a);
	
//	(a[0] == a[1] && a[1] == a[2]) ? puts("No") : puts("Yes");
	
	if(a[0] == a[1] && a[1] == a[2]) {
			puts("No");
		} else {
			puts("Yes");
		}
	
	return 0;
}

Measured memory_bytes: 1612
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 200005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;



int main() {
  int a,b;
  scanf("%d%d",&a,&b);
  int c,d;
  scanf("%d%d",&c,&d);
  int ans = min(b,d)-max(a,c);
  maxs(ans,0);
  cout<<ans<<endl;
  return 0;
}






















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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;


signed main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);
  
  int n; cin >> n;
  string s; cin >> s;

  rep(i, si(s)) {
    if (i >= n) {
      cout << "..." << endl;
      return 0;
    }
    cout << s[i];
  }
  cout << endl;
}

Measured memory_bytes: 3620
// ナップサック問題

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

struct Goods {int value, weight;};

int main() {
    int N, W;
    while(cin >> N >> W) {
        vector<Goods> goods(N);
        for(auto& g: goods) cin >> g.value >> g.weight;

        vector<int> dp(W + 1, 0);
        for(const auto& g: goods) for(int w = W; w - g.weight >= 0; --w) dp[w] = max(dp[w], dp[w - g.weight] + g.value);
        cout << *max_element(dp.begin(), dp.end()) << endl;
    }
}

Measured memory_bytes: 1232
//#if 1
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
//#endif
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
	int N, X;
	int m[1000];
	int ans = 0;
	cin >> N >> X;
	for (int i = 0; i < N; i++) {
		cin >> m[i];
	}
	sort(m, m + N);
	for (int i = 0; i < N; i++) {
		if (X - m[i] >= 0) {
			X -= m[i];
			ans++;
		}
		else {
			cout << ans << endl;
			return 0;
		}
	}
	cout << ans + X / m[0] << endl;


	return(0);
}

Measured memory_bytes: 256
import sys
N, Y = map(int, input().split())

for i in range(N+1): #10000
    for j in range(N-i+1): #5000
        if i*10000 + j*5000 + (N-i-j)*1000 == Y:
            print(i, j, N-i-j, sep=" ")
            sys.exit(0)
print(-1, -1, -1, sep=" ")

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

int main()
{
	string str;

	while(cin >> str){
		if(str == "0")
			break;

		int count = 0;
		for(int i=0;i<str.size();++i)
			count += (int)str[i]-'0';
		

		cout << count << endl;

	}
	return 0;
}

Measured memory_bytes: 1188
n = int(input())
a = list(map(int, input().split())) # 横入力

cs = [0]
aa = 0
for i in range(n):
    aa += a[i]
    cs.append(aa)

cs.sort()
cnt = 1
ans = 0
for i in range(n):
    if cs[i] == cs[i+1]:
        cnt += 1
    else:
        if cnt != 1:
            ans += cnt*(cnt-1)//2
            cnt = 1
if cnt != 1:
    ans += cnt*(cnt-1)//2
print(ans)

Measured memory_bytes: 25976
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
int A[100111];

int main() {
    scanf("%d", &N);
    int s = 0;
    for (int i=1; ; i++) {
	s += i;
	if (s >= N) {
	    while (N) {
		while (N < i) i--;
		printf("%d\n", i);
		N -= i;
		i--;
	    }
	    return 0;
	}
    }


    return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef struct pair<int,int> P;
typedef struct pair<int,P> P2;

int n,a,b;


const ll INF=100000000001;
int main() {

	cin>>n;
	a=0;
	int k=n;
	for(int i=0;i<9;i++){
		a+=n%10;
		n=n/10;
	}
	if(k%a==0){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define rg register
#define LL long long
using namespace std;
LL a,b;

inline LL calc_(LL x){
    if(x%4==1) return 1;
    else if(x%4==2) return x+1;
    else if(x%4==3||x==0) return 0;
    else return x;
}

signed main(){
	scanf("%lld%lld",&a,&b);
	
	if(a==0) printf("%lld\n",calc_(b));
	else printf("%lld\n",calc_(b)^calc_(a-1));
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000000000+7
using namespace std;
typedef long long ll;

int n;
string s;
ll ans = 0;
void solve(ll x, ll y){
  if(n == x){
    ans += y;
    return;
  }
  ll cur = 0;
  rep(i, x, n){
    cur = 10*cur + (s[i]-'0');
    solve(i+1, y+cur);
  }
}


int main(){
  cin >> s;
  n = s.length();
  solve(0, 0);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>

using namespace std;

int main()
{
	long long n,k,numK=1,num=1;
	cin >> n >> k;

		for (int i = 0; i < n-1; i++)num *= k-1;
	
	cout << k * num << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#define REP0(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REP1(i,n) for((i)=1;(i)<=(int)(n);(i)++)
#define ll long long
using namespace std;

int i,j,k;
const ll MOD = 1000000000 + 7;

int main(){
    int a,b,c,k,ans;
    ans=0;
    cin>>a>>b>>c>>k;
    if(a>=k){
        ans=k;
    }
    else if(k-a<=b&&k-a-b>=c){
        ans=a;
    }
    else{
        ans=a-(k-a-b);
    }
    

    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 3636