akhauriyash/Code-Regression huggingface dataset:
//  Copyright © 2020 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 200005
#define INF 1e18
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
#define forn(i,a,b) for (ll i = a; i <= b; i ++ )
#define mod(n,k) (((n%k)+k)%k)
using namespace std;
typedef long long ll;

struct node {
    ll x, s, t;
    bool operator < ( const node & a ) const {
        return t > a.t;
    }
};

struct ari {
    ll v, p, t;
};

const ll LIM = 5000;
ll N, M, S;
vector < ari > ady[MAX];
ll ci[MAX];
ll ti[MAX];
ll ans[MAX];
bool vis[55][5005];
ll dist[55][5005];

// ll x, bstp, s, t; 
void solve() {
    priority_queue < node > q;
    q.push( { 1 , min( LIM , S ) , 0 } );
    while( ! q.empty() ) {
        node x = q.top();
        q.pop();
        if( vis[x.x][x.s] )
            continue;
        vis[x.x][x.s] = 1;
        dist[x.x][x.s] = x.t;
        ans[x.x] = min( ans[x.x] , x.t );
        // Carga
        if( x.s < LIM ) {
            node nxt = x;
            nxt.s += ci[x.x];
            nxt.s = min( nxt.s , LIM );
            nxt.t += ti[x.x];
            if( ! vis[nxt.x][nxt.s] )
                q.push( nxt );
        }
        
        // Muevete
        for( auto v : ady[x.x] ) {
            node nxt;
            nxt.x = v.v;
            nxt.s = x.s - v.p;
            nxt.t = x.t + v.t;
            if( nxt.s < 0 )
                continue;
            if( vis[nxt.x][nxt.s] )
                continue;
            q.push( nxt );
        }
    }
}

int main() {
    optimiza_io
    cin >> N >> M >> S;
    while( M -- ) {
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        ady[u].push_back( { v , a , b } ) ;
        ady[v].push_back( { u , a , b } ) ;
    }
    
    for( ll i = 1; i <= N; i ++ ) {
        cin >> ci[i] >> ti[i];
        ans[i] = INF;
    }
    
    solve();
    
    for( int i = 2; i <= N; i ++ )
        cout << ans[i] << "\n";
    return 0;
}

// CHECAR LIMITES 

Measured memory_bytes: 22244
ans=list(map(int,input().split()))
dic={}
flg=0
for x in ans:
    if(x!=5 and x!=7):
        flg=-1
        break
    else:
        dic[str(x)]=dic.get(str(x),0)+1
if(flg==-1):
    print("NO")
else:
    if(dic["5"]!=2 or dic["7"]!=1):
	       print("NO")
    else:
 	      print("YES")


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

public class Main {
    public static void main(String[] args) throws Exception {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

            String[] tmp = br.readLine().split(" ");
            int n = Integer.parseInt(tmp[0]);
            int m = Integer.parseInt(tmp[1]);

            List<List<Integer>> g = new ArrayList<>(n);
            for (int i = 0; i < n; i++) {
                g.add(new ArrayList<>());
            }

            for (int i = 0; i < m; i++) {
                tmp = br.readLine().split(" ");
                int a = Integer.parseInt(tmp[0]) - 1;
                int b = Integer.parseInt(tmp[1]) - 1;
                g.get(a).add(b);
                g.get(b).add(a);
            }

            int[] ans = new int[n];

            Queue<Integer> q = new ArrayDeque<>();
            q.offer(0);
            while (!q.isEmpty()) {
                int p = q.poll();
                for (int v : g.get(p)) {
                    if (ans[v] == 0) {
                        ans[v] = p + 1;
                        q.add(v);
                    }
                }
            }

            PrintWriter pw = new PrintWriter(System.out);
            pw.println("Yes");
            for (int i = 1; i < n; i++) {
                pw.println(ans[i]);
            }
            pw.flush();

        }
    }
}

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

int main(){
  char c;
  cin >> c;

  if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
}

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

N = input()
m = 0
a = 0
r = 0
c = 0
h = 0
for i in range(N):
	S = raw_input()
	if S[:1] == "M":
		m += 1
	elif S[:1] == "A":
		a += 1
	elif S[:1] == "R":
		r += 1
	elif S[:1] == "C":
		c += 1
	elif S[:1] == "H":
		h += 1
print m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h	

Measured memory_bytes: 5764
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int M,N;
    cin >> M >> N;
    if(M == N) cout << "Yes" << "\n";
    else cout << "No" << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	ll sum=0;
	for(ll i=1;i<=n;i++){
		if(i%3!=0 && i%5!=0) sum+=i;
	}
	cout<<sum;
 	
	return 0;
}

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer cur= nil->next;
  while(cur!=nil && cur->key!=key){
    cur=cur->next;
  }
  return cur;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  if(t==nil) return;
  t->prev->next=t->next;
  t->next->prev=t->prev;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  NodePointer t = nil->prev;
  if(t==nil) return;
  deleteNode(t);
}

void delete(int key){
  NodePointer cur;
  cur=listSearch(key);
  deleteNode(cur);
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;

}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}



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

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define endl '\n'

#define pb push_back
#define mp make_pair

#define fi first
#define se second

#define r(a) cin>>a
#define r2(a,b) cin>>a>>b
#define r3(a,b,c) cin>>a>>b>>c
#define r4(a,b,c,d) cin>>a>>b>>c>>d

#define p(a) cout<<a<<' '
#define pn(a) cout<<a<<endl
#define p2n(a,b) cout<<a<<' '<<b<<endl
#define p3n(a,b,c) cout<<a<<' '<<b<<' '<<c<<endl
#define p4n(a,b,c,d) cout<<a<<' '<<b<<' '<<c<<' '<<d<<endl
#define psn cout<<endl

#define repeat(i,n) for(int i=0;i<n;++i)
#define repeat2(i,a,b) for(int i=a;i<b;++i)
#define rfor(i,n) for(int i=n-1;i>=0;--i)
#define range(i,a) for(auto &i:a)

#define readall(t) range(i,t)r(i)
#define printall(t) range(i,t)p(i);psn

#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)

#define sz(a) (int)a.size()
#define len(a) (int)a.length()
#define all(a) a.begin(),a.end()

const int MAXN = 100001;
const int ROCKY = -1;

vi adj[MAXN];
int dp[MAXN];

void init()
{
    repeat(i, MAXN)
        dp[i] = ROCKY;
}

int sol(int n)
{
    if (adj[n].empty())
        return 0;

    if (dp[n] == ROCKY)
    {
        int sum = 0;
        range(i, adj[n])
            chmax(sum, sol(i));
        dp[n] = sum + 1;
    }
    return dp[n];
}

int32_t main()
{
    ios::sync_with_stdio(false);
    init();    
    int n, m;
    r2(n, m);
    repeat(i, m)
    {
        int a, b;
        r2(a, b);
        adj[a].pb(b);
    }
    int ans = 0;

    repeat2(i, 1, n + 1)
        chmax(ans, sol(i));

    pn(ans);
    return 0;
}



Measured memory_bytes: 8192
#include<bits/stdc++.h>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
using namespace std;
typedef long long ll;
const int N=2e5+5;
const int MOD=1e9+7;
//ll a[N],sum[N];

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    
    ll a,b;
    cin >>a>>b;
    if(a+b==15) cout <<"+"<<endl;
    else    if(a*b==15) cout <<"*"<<endl;
    else    cout <<"x"<<endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;
using pll = pair<long,long>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back

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


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 1000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;



int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	int n;
	cin >> n;
	int a[n];
	int cnt = 0;
	for(int i=0; i<n; i++){
		cin >> a[i];
		if(a[i]%2 == 0)cnt++;
	}
	int ama = 0;
	for(int i=0; i<n; i++){
		if(a[i]%2 == 0){
			if(a[i]%3 == 0 || a[i]%5 == 0)ama++;
		}
	}
	if(ama == cnt){
		cout << "APPROVED" << endl;
	}else{
		cout << "DENIED" << endl;
	}
	return 0;
} 
//^-^

Measured memory_bytes: 3640
#include <map>
#include <algorithm>
#include <cassert>
#include <climits>
#include <complex>
#include <cstdio>
#include <string>
#include <iostream>
#include <queue>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;

template<class T> bool chmin(T &a, T b) { return a>b?(a=b,true):false; }
template<class T> bool chmax(T &a,T  b) { return a<b?(a=b,true):false; }
#define forn(i,x,y) for(int i=(x);i<(int)(y);i++)
#define rep(i,y) for(int i=0;i<(int)(y);i++)
#define repb(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)

template<class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << " ";
    os << *it;
  }
  return os;
}

string S,T;
int main() {
  cin >> S >> T;
  int n = S.size();
  int m = T.size();
  int ans=1e9+7;
  for (int i=0;i<n-m+1;i++) {
    int cnt=0;
    for (int j=0;j<m;j++) {
        if (S[i+j]==T[j]) cnt++;
    }
    chmin(ans, m-cnt);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
    cin >> n;
    int A[n];

    for(int i=0; i<n; i++) cin >> A[i];

	for(int i=1; i<n; i++){
		for(int j = 0; j < n; j++){
            cout << A[j];
            if(j != n-1) cout << " ";
        }
        cout << endl;
    	int v = A[i];
    	int j = i-1;
    	while(j>=0 && A[j]>v){
    		A[j+1] = A[j];
    		j--;
    	}
    	A[j+1] = v;
    }

    for(int i = 0; i < n; i++){
            cout << A[i];
            if(i != n-1) cout << " ";
        }
        cout<<endl;

return 0;
}


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

int main(){
  string s;
  cin>>s;
  if(s=="ABC") cout<<"ARC"<<endl;
  else cout<<"ABC"<<endl;
  return 0;
}


Measured memory_bytes: 3596
#include <iomanip>
#include <string>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
	long long int n, l[100];
	l[0] = 2, l[1] = 1;
	cin >> n;
	for (int i = 2; i <= n; i++) {
		l[i] = l[i - 1] + l[i - 2];
	}
	cout << l[n] << endl;
	return 0;
}	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define endl '\n'
#define MOD 1000000007
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define dbg(x) cout << #x << "  " << x << endl;
 
ll power(ll base, ll exp) 
{ll res=1;while(exp>0) {if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return res;}
ll mod(ll a, ll b) {return (a % b + b) % b;}
ll powerm(ll base,ll exp,ll mod) 
{ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
 
struct custom_hash 
{
    static uint64_t splitmix64(uint64_t x) 
	{
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const 
	{
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
/* DSU 
int find_set(int v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}
void make_set(int v) {
    parent[v] = v;
    rank[v] = 0;
}
void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (rank[a] < rank[b])
            swap(a, b);
        parent[b] = a;
        if (rank[a] == rank[b])
            rank[a]++;
    }
}
*/ 
int main()
{  
	fast; 
	ll n,m,k; cin>>n>>m>>k;
	char matrix[n][m];
	for(ll i = 0; i < n; i++)
		for(ll j = 0; j < m; j++)
			cin>>matrix[i][j];
	ll bs = 0;
	vector<pair<ll,pair<ll,char>>>arr;
	for(ll i = 0; i < n; i++)
	{
		ll ans = 0;
		for(ll j = 0; j < m; j++)
		{
			if(matrix[i][j] == '#') ans++,bs++;
		}
		arr.push_back({ans,{i,'R'}});
	}
	for(ll j = 0; j < m; j++)
	{
		ll ans = 0;
		for(ll i = 0; i < n; i++)
		{
			if(matrix[i][j] == '#') ans++;
		}
		arr.push_back({ans,{j,'C'}});
	} 
	ll fans = 0; ll sz = arr.size();
	for(ll bmk = 0; bmk < (1 << sz); bmk++)
	{
		ll a = 0; vector<ll>r,c;
		for(ll i = 0; i < sz; i++)
		{
			if(bmk & (1 << i))
			{
				a += arr[i].first;
				if(arr[i].second.second == 'R') r.push_back(arr[i].second.first);
				if(arr[i].second.second == 'C') c.push_back(arr[i].second.first);
			}
		}
		for(ll i = 0; i < r.size(); i++)
		{
			for(ll j = 0; j < c.size(); j++)
			{
				if(matrix[r[i]][c[j]] == '#') a--;
			}
		}
		if(bs - a == k) fans++;
	}
	cout << fans << endl;
	return 0;
}

Measured memory_bytes: 3640
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

A, B = mi()

if B > A:
    A, B = B, A

if A-1 >= B:
    print(2*A-1)
else:
    print(A+B)

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



int main() {
    long int h;
    cin >> h;
    
    long int n = 1;
    long int sum = 0;
    while(h > 1) {
        sum += n;
        
        h /= 2;
        n *= 2;
    }
    
    cout << sum + n << endl;
    
    
    return 0;
}




Measured memory_bytes: 3572
#include <stdio.h>

int  main(void){
         int h,w,i,j;
          while(1){
          scanf("%d %d",&h,&w);
           if( h==0 && w==0)
              break;
           for(i=1; i<=h; i++){
            for(j=1; j<=w; j++){
              printf("#");
             }printf("\n");
            }printf("\n");
           }
            return 0;
}


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

int main() {

  int a,i;
  string b;
  cin >> a;
  int c = 0;
  for (i = 0; i < a; i++) {
    cin >> b;
    if (b == "Y"){
      c ++;
    }
  }
  if (c == 0){
    cout << "Three" << endl;
  }
  else{
    cout << "Four" << endl;
  }

}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <unordered_set>
//#include <unordered_map>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=INT_MAX;

void mainmain(){
	int m,n,k,d;
	while(cin>>m>>n>>k>>d,m||n||k||d){
		vvint dp;
		initvv(dp,m+n+2,1<<m,INF);
		VV(pii) vv(m+n+2);
		vint cake(m+1,0);
		rep(i,m){
			cin>>cake[i+1];
		}
		rep(i,d){
			string s1,s2;
			int c;
			cin>>s1>>s2>>c;
			int a,b;
			if(s1[0]=='H'){
				a=0;
			}
			if(s1[0]=='C'){
				a=s1[1]-'0';
			}
			if(s1[0]=='L'){
				int t;
				convert(s1.substr(1),t);
				// cout<<t<<endl;
				a=t+m;
			}
			if(s1[0]=='D'){
				a=n+m+1;
			}

			if(s2[0]=='H'){
				b=0;
			}
			if(s2[0]=='C'){
				b=s2[1]-'0';
			}
			if(s2[0]=='L'){
				int t;
				convert(s2.substr(1),t);
				b=t+m;
			}
			if(s2[0]=='D'){
				b=n+m+1;
			}
			vv[a].PB(pii(b,k*c));
			vv[b].PB(pii(a,k*c));
		}
		priority_queue<pair<int,pii>> pq;
		pq.push(mkp(0,pii(0,0)));
		while(!pq.empty()){
			pair<int,pii> top=pq.top();
			pq.pop();
			if(dp[top.S.F][top.S.S]!=INF){
				continue;
			}
			// cout<<top.S.F<<" "<<top.S.S<<" "<<-top.F<<endl;
			dp[top.S.F][top.S.S]=-top.F;
			int now=top.S.F;
			rep(i,vv[now].size()){
				int next=vv[now][i].F;
				if(1<=next&&next<=m&&(top.S.S&(1<<(next-1)))){
					continue;
				}
				pair<int,pii> t=top;
				if(1<=next&&next<=m){
					t.S.S+=1<<(next-1);
					// t.F+=cake[next];
				}
				t.F-=vv[now][i].S;
				t.S.F=next;
				if(dp[t.S.F][t.S.S]==INF){
					pq.push(t);
				}
			}
		}
		int ans=INF;
		rep(i,1<<m){
			int tmp=dp[n+m+1][i];
			rep(j,m){
				if(i&(1<<j)){
					tmp-=cake[j+1];
				}
			}
			ans=min(ans,tmp);
		}
		cout<<ans<<endl;
	}
}



}
main() try{
    mainmain();
}
catch(...){
}

Measured memory_bytes: 1416
#include<iostream>
#include<algorithm>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
LL mod=1000000007;
LL LINF=1LL<<52;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



int main(){
    int n;cin >> n;
    int l[n];
    for (int i = 0; i < n; i++) {
        scanf("%d",l+i);
    }
    sort(l,l+n);
    int ans = 0;
    for (int i = 0; i < n-2; i++) {
        for (int j = i+1; j < n-1;j++) {
            for (int k = j+1; k < n; k++) {
                if(l[i]+l[j]>l[k]) ans++;
            }
        }
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 384
num = int(input())
xs = [int(x) for x in input().split() if int(x) % 2 == 0]

approved = True
for x in xs:
  if x % 3 ==0 or x % 5 == 0:
    continue
  else:
    print("DENIED")
    approved = False
    break
    
if approved:
  print("APPROVED")

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

int main() {

  int M,d1,d2,d3;
  cin >> M >> d1 >> d2 >> d3;

  if(M != d2) cout << 1 << endl;
  else cout << 0 << endl;

}





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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll n=5,k;
ll a[5];

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

  rep(i,n)cin>>a[i];
  cin>>k;
  if(a[4]-a[0]>k)cout<<":("<<endl;
  else cout<<"Yay!"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    char S[3];
    cin>>S;
    //cout<<S[0]<<":"<<S[1]<<":"<<S[0]<<'\n';
    
    if((S[0]=='A'&&S[1]=='A'&&S[2]=='A')||(S[0]=='B'&&S[1]=='B'&&S[2]=='B')){
        cout<<"No"<<'\n';
    }else{
        cout<<"Yes"<<'\n';
    }
    
}


Measured memory_bytes: 256
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut input = s
        .split_whitespace()
        .nth(0)
        .unwrap()
        .parse::<i128>()
        .unwrap()
        - 1;
    let mut result = String::new();
    loop {
        let v = input % 26;
        match v {
            0 => result.push('a'),
            1 => result.push('b'),
            2 => result.push('c'),
            3 => result.push('d'),
            4 => result.push('e'),
            5 => result.push('f'),
            6 => result.push('g'),
            7 => result.push('h'),
            8 => result.push('i'),
            9 => result.push('j'),
            10 => result.push('k'),
            11 => result.push('l'),
            12 => result.push('m'),
            13 => result.push('n'),
            14 => result.push('o'),
            15 => result.push('p'),
            16 => result.push('q'),
            17 => result.push('r'),
            18 => result.push('s'),
            19 => result.push('t'),
            20 => result.push('u'),
            21 => result.push('v'),
            22 => result.push('w'),
            23 => result.push('x'),
            24 => result.push('y'),
            25 => result.push('z'),
            _ => {}
        }
        //result = ('a' + v) as char +s result;

        input = input / 26 - 1;
        if input < 0 {
            break;
        }
    }
    println!("{}", result.chars().rev().collect::<String>());
}


Measured memory_bytes: 2092
#include<bits/stdc++.h>
using namespace std;
const int N=200010;
map<int,bool>mp;
map<int,bool>::iterator t;
int n;
long long ans,num;
int a[N],pos[N];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		pos[a[i]]=i;
	}
	mp[0]=1;mp[n+1]=1;
	for(int i=1;i<=n;i++)
	{
		t=mp.lower_bound(pos[i]);
		num=t->first-pos[i];
		t--;
		num*=pos[i]-t->first;
		ans+=num*i;
		mp[pos[i]]=1;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 11136
#include <stdio.h>

int tests, a, b, c;

int main(void)
{
  scanf("%d",&tests);
  while(tests--)
  {
    scanf("%d %d %d",&a,&b,&c);
    if (a*a == b*b + c*c || b*b == a*a + c*c || c*c == a*a + b*b)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second　//pairの二つ目の要素

int main(){
    double a,b;
    cin>>a>>b;
    double a_min,a_max,b_min,b_max;
    a_min=a/0.08;
    a_max=(a+1.0)/0.08;
    b_min=b/0.1;
    b_max=(b+1)/0.1;
    int ans=ceil(max(a_min,b_min));
    if(ans>=a_max || ans>=b_max)ans=-1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    int a,b;
    cin >>a >> b;
    cout << ((b-1) + (a-1) - 1)/(a-1) << endl;
}

Measured memory_bytes: 256
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

const int N = 1e4 + 5;

int fr[N];

int main()
{
  for(int x = 1; x * x <= N; x++) {
    for(int y = 1; y * y <= N; y++) {
      for(int z = 1; z * z <= N; z++) {
        int ans = x * x + y * y + z * z + x * y + x * z + y * z;
        if(ans < N)
          fr[ans]++;
      }
    }
  }
  int n;
  cin >> n;
  for(int i = 1; i <= n; i++) {
    cout << fr[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3664
#include <cmath>
#include <iostream>
#include <vector>
using std::pair;
using std::vector;
using Prime_Power = pair<long long, long long>;
using PPvec       = vector<Prime_Power>;

PPvec prime_factorize(long long N) {
    PPvec res;
    for (long long a = 2LL; a * a <= N; ++a) {
        if (N % a != 0LL) continue;
        long long ex = 0LL;  // 指数

        // 割れる限り割り続ける
        while (N % a == 0LL) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});

    return res;
}

int main() {
    using std::cin;
    using std::cout;
    using std::endl;

    long long n;
    cin >> n;
    if (n == 1LL) {
        cout << "0\n";
        return 0;
    }
    if (n == 2LL) {
        cout << "1\n";
        return 0;
    }

    const PPvec &res = prime_factorize(n);
    long long ans    = 0LL;
    for (const Prime_Power &p : res) {
        // p.second >= z(z+1)/2
        long long z = -0.5L + sqrt(0.25 + (2 * p.second));
        ans += z;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3716
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    N = int(input())
    res = INF
    for i in range(1, int(math.sqrt(N))+1):
        if N%i==0:
            res = min(res, i + N//i - 2)
    print(res)


if __name__ == '__main__':
    main()

Measured memory_bytes: 64364
#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }

const LL MOD = 1000000007;

LL M = MOD;

vector<vector<int>> edges;
vector<vector<LL>> dp;

//! Fill vars on edges that are visited from the dfs that start from node 0 
LL dfs(int from, int curr) 
{
	LL vars = 1;
	for (int i = 0; i < edges[curr].size(); ++i) {
		if (edges[curr][i] != from) {
			dp[curr][i] = dfs(curr, edges[curr][i]);
			vars = (vars * (dp[curr][i] + 1)) % M;
		}
	}
	return vars;
}

//! Fill vars that are are not filled with dfs
void rev(int from, int curr, LL add) 
{
	for (int i = 0; i < edges[curr].size(); ++i) {
		if (edges[curr][i] == from) {
			dp[curr][i] = add;
			break;
		}
	}

    const int deg = edges[curr].size();
    vector<LL> l(deg), r(deg);
    for (int i = 0; i < deg; ++i) r[i] = ((l[i] = (dp[curr][i] + 1)) %= M);
    for (int i = 1; i < deg; ++i) (l[i] *= l[i - 1]) %= M;
    for (int i = deg - 2; 0 <= i; --i) (r[i] *= r[i + 1]) %= M;

    for (int i = 0; i < deg; ++i) {
        if (edges[curr][i] == from) continue;

        LL add_c = 1;
        if (i != 0) (add_c *= l[i - 1]) %= M;
        if (i != deg - 1) (add_c *= r[i + 1]) %= M;
        rev(curr, edges[curr][i], add_c);
    }
}


int main() 
{
	int N;
	cin >> N >> M;
	edges.resize(N);
	rep(i, N-1) {
		int x, y;
		cin >> x >> y;
		--x; --y;
		edges[x].push_back(y);
		edges[y].push_back(x);
	}
	dp.resize(N);
	rep(i, N) {
		dp[i].resize(edges[i].size());
	}

	dfs(-1, 0);
	rev(-1, 0, 0);

	rep(from, N) {
		LL vars = 1;
		for (LL v: dp[from]) {
			vars = (vars * (v+1)) % M;
		}
		cout << vars << '\n';
	}

	return 0;
}

Measured memory_bytes: 22144
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int X, Y, Z;
  cin>>X>>Y>>Z;
  cout<<(X-Z)/(Y+Z)<<endl;
}


Measured memory_bytes: 3568
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,d=MI()
count=0
for i in range(n):
    x,y=MI()
    if x**2+y**2<=d**2:
        count+=1
        
print(count)

Measured memory_bytes: 68584
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define ALL(x) x.begin(), x.end()
#define DEBUG(args...) { string _s = #args; replace(ALL(_s), ' ', '\0');\
replace(ALL(_s), ',', ' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); _debug(_it, args);}
#define endl "\n"
#define F first
#define S second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void _debug(istream_iterator<string>) {}
template<typename T, typename... Args>
void _debug(istream_iterator<string> it, T first, Args... args) {
    cerr << ">> " << *it << " : " << first << endl; _debug(++it, args...);
}
template <typename T1, typename T2>
inline ostream& operator << (ostream& out, const pair<T1, T2>& p) {
    return out << "(" << p.F << ", " << p.S << ")";
}
template<typename T>
inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty()) return out << "[]";
    else { out << '['; for (auto& e : v) { out << e << ", "; } return out << "\b\b]"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const set<T>& s) {
    if (s.empty()) return out << "{}";
    else { out << '{'; for (auto& e : s) { out << e << ", "; } return out << "\b\b}"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const unordered_set<T>& s) {
    return out << set<T>(ALL(s));
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const map<T1, T2>& m) {
    if (m.empty()) return out << "{}";
    out << '{'; for (auto& p : m) { out << p << ", "; } return out << "\b\b}";
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const unordered_map<T1, T2>& m) {
    return out << map<T1, T2>(ALL(m));
}
template<typename T>
inline ostream& operator << (ostream& out, const ordered_set<T>& s) {
    return out << set<T>(ALL(s));
}

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef pair<ll, ll> pll;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;
/************************************** MAIN PROGRAM ********************************************/

int main()
{
    //freopen("input.txt", "r", stdin);
    SPEED
    int n;
    cin >> n;
    set<int> a;
    FOR(i, 0, n) {
        int x;
        cin >> x;
        a.insert(x);
    }
    cout << (a.size() == n ? "YES" : "NO");
}
/************************************** END OF PROGRAM ******************************************/
/** Stuff you should look for:
 * int overflow, array bounds, over-counting, graph is not a tree/connected
 * special cases (n=1?), set/unordered_set TLE, multi-set/set error
 * do something instead of nothing and stay organized
 */


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int ans = 0;
    rep(i, min(a, k))
    {
        ans += 1;
    }
    k -= a;
    k = max(k, 0);
    rep(i, min(b, k))
    {
        continue;
    }
    k -= b;
    k = max(k, 0);
    rep(i, min(c, k))
    {
        ans--;
    }

    cout << ans << endl;

    return 0;
}

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

ll inf=1e18;

int main() {
  ll n,m,r;
  cin >> n >> m >> r;
  vector<ll> town(r);
  for(ll i=0;i<r;i++) {
    ll temp;
    cin >> temp;
    town[i]=temp-1;
  }
  sort(town.begin(),town.end());
  vector<vector<ll>> d(n,vector<ll> (n,inf)); 
  for(ll i=0;i<n;i++) {
    d[i][i]=0;
  }
  for(ll i=0;i<m;i++) {
    ll a,b,c;
    cin >> a >> b >> c;
    a--;
    b--;
    d[a][b]=c;
    d[b][a]=c;
  }

  for(ll k=0;k<n;k++) {
    for(ll i=0;i<n;i++) {
      for(ll j=0;j<n;j++) {
        d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
      }
    }
  }
  ll ans=inf;
  while(1) {
    ll tans=0;
    for(ll i=0;i<r-1;i++) {
      tans+=d[town[i]][town[i+1]];
    }
    ans=min(ans,tans);
    if(!next_permutation(town.begin(),town.end())) {
      break;
    }
  }
  cout << ans << endl;
}

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

int main(void){
  int n,k; cin >> n >> k;
  double p[n];
  rep(i,n) cin >> p[i];
  double s[n],r[n];
  rep(i,n){
    s[i] = (p[i]+1)/2;
    if(i == 0) r[i] = s[i];
    else r[i] = r[i-1] + s[i];
  }
  double ans = r[k-1];
  for(int i = k; i < n; i++){
    ans = max(ans,r[i] - r[i-k]);
  }
  printf("%f",ans);
  return 0;
}

Measured memory_bytes: 4992
#include<queue>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
inline void read(int &x)
{
	x=0;
	int p=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')p=-1;c=getchar();}
	while(isdigit(c)) {x=(x<<1)+(x<<3)+(c^'0');c=getchar();}
	x*=p;
}
int n;
int a[15];
int b[15];
int ans;
void dfs(int x)
{
	if(x==n+1)
	{
		long long sum=1;
		for(int i=1;i<=n;i++)
		{
			if(abs(a[i]-b[i])>1)return;
			sum*=b[i];
		}
		if(sum%2==0)ans++;
		return;
	}
	for(int i=a[x]-1;i<=a[x]+1;i++)
	{
		b[x]=i;
		dfs(x+1);
		b[x]=0;
	}
}
int main()
{
	read(n);
	for(int i=1;i<=n;i++)
		read(a[i]);
	dfs(1);
	cout<<ans<<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 all(x) (x).begin(),(x).end()
#define INF (1e9)
int N,M,C,B[30],A[30][30],ans = 0;
int main(){
  cin >> N >> M >> C;
  rep(i,M){
    cin >> B[i];
  }
    rep(i,N){
      rep(j,M){
      cin >> A[i][j];
      }
  }
  rep(i,N){
    int sum = 0;
    rep(j,M){
      sum += A[i][j]*B[j];
    }
    sum += C;
    if(sum>0){
      ans++;
    }
  }
  cout << ans << endl;
}

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

int main() {
	int w, h;
	do {
		cin >> h >> w;
		if (h == 0 && w == 0)
			break;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if ((i % 2 == 1 && j % 2 == 1) || (i % 2 == 0 && j % 2 == 0))
					cout << "#";
				else
					cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	} while (true);
	return 0;
}


Measured memory_bytes: 3092
PROGRAM-ID.                      ABC_106_B.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 N       PIC 9(3).
    01 i       PIC 9(3).
    01 j       PIC 9(3).
    01 tmp     PIC 9(3).
    01 cnt     PIC 9(3).

    01 d       PIC 9(3).
    01 m       PIC 9(3).

    01 ans     PIC X(3).

    01 ZS      PIC Z(3)9.
    01 DUMMY   PIC X(1).


PROCEDURE                        DIVISION.
    ACCEPT N.

    MOVE ZERO TO cnt.

    PERFORM VARYING i FROM 1 BY 2 UNTIL N < i
        MOVE ZERO TO tmp
        PERFORM VARYING j FROM 1 BY 1 UNTIL i < j
            DIVIDE j INTO i GIVING D REMAINDER m
            IF ZERO = m
                ADD 1 TO tmp
            END-IF
        END-PERFORM
        IF 8 = tmp
            ADD 1 TO cnt
        END-IF
    END-PERFORM

    MOVE cnt TO ZS.

    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

typedef tuple<ll, ll, ll> T;

int main(){
    ll N, Q; cin >> N >> Q;
    vector<T> a(N);
    vector<ll> res(Q, -1);

    for(int i=0; i<N; i++){
        ll s, t, x;
        cin >> s >> t >> x;
        s -= x;
        t -= x;
        a[i] = make_tuple(x, s, t);
    }
    sort(a.begin(), a.end());
    set<pair<ll, ll>> s;
    for(int i=0; i<Q; i++){
        ll d; cin >> d;
        s.insert(make_pair(d, i));
    }
    for(int i=0; i<N; i++){
        ll x, l, r;
        tie(x, l, r) = a[i];
        auto itr = s.lower_bound(make_pair(l, -1));
        while(itr != s.end()){
            if(itr->first >= r) break;

            res[itr->second] = x;
            s.erase(itr++);
        }
    }
    for(int i=0; i<Q; i++) cout << res[i] << endl;

    return 0;
}

Measured memory_bytes: 20608
package main

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

const mod = 1e9 + 7

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	n, k := io.NextInt(), io.NextInt()
	cnt := 0
	for i := k; i <= n+1; i++ {
		cnt += (i*(n-i+1) + 1) % mod
		cnt %= mod
	}
	io.Println(cnt)
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// NextInt returns an integer from stdin
func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 1776
n = int(input())
x = 0
mn = 100
for i in range(n):
  s = int(input())
  x += s
  if s % 10 != 0:
    if s <= mn:
      mn = s
if x % 10 != 0:
  print(x)
else:
  x -= mn
  if x % 10 == 0:
    print(0)
  else:
    if x < 0:
      print(0)
      exit()
    print(x)
        

Measured memory_bytes: 9124
import java.io.*;
public class Main {
	static int[] dx = {1, 0, -1, 0};
	static int[] dy = {0, 1, 0, -1};
	static int[][] map;
	public static void main(String[] args) throws IOException {
		BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		while (true) {
			int m = Integer.valueOf(s.readLine());
			int n = Integer.valueOf(s.readLine());
			if (m == 0 && n == 0) {
				break;
			}
			map = new int[n][m];
			for (int i = 0 ; i < n ; i++) {
				String[] data = s.readLine().split(" ");
				for (int j = 0 ; j < m ; j++) {
					map[i][j] = Integer.valueOf(data[j]);
				}
			}
			int max = 0;
			H = n;
			W = m;
			for (int i = 0 ; i < n ; i++) {
				for (int j = 0 ; j < m ; j++) {
					if (map[i][j] == 1) {
						boolean[][] broken = new boolean[n][m];
						max = Math.max(max, dfs(i, j, broken));
					}
				}
			}
			out.println(max);
		}
		out.flush();
	}
	static int H;
	static int W;
	private static int dfs(int y, int x, boolean[][] brk) {
		int ret = 0;
		for (int d = 0 ; d < 4 ; d++) {
			int tx = x + dx[d];
			int ty = y + dy[d];
			if (tx < 0 || ty < 0 || tx >= W || ty >= H || map[ty][tx] == 0 || brk[ty][tx]) {
				continue;
			}
			brk[ty][tx] = true;
			ret = Math.max(ret, 1 + dfs(ty, tx, brk));
			brk[ty][tx] = false;
		}
		return ret;
	}
}

Measured memory_bytes: 11000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool prime(ll n) {
  if (n == 1) {
    return false;
  } else {
    for (ll i = 2; i <= (ll)pow(n, 0.5); i++) {
      if (n%i == 0) return false;
    }
  }
  return true;
}
ll RepeatSquaring(ll n, ll p, ll m) {
  if (p == 0) return 1;
  if (p%2 == 0) {
    ll t = RepeatSquaring(n, p/2, m);
    return (t*t)%m;
  }
  return (n*RepeatSquaring(n, p-1, m))%m;
}

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll ans = RepeatSquaring(2, n, mod) - 1;
  ll x = 1, y = 1;
  rep(i, a) {
    x *= n-i;
    x %= mod;
    y *= i+1;
    y %= mod;
  }
  ans -= (x*RepeatSquaring(y, mod-2, mod)) % mod;
  ans %= mod;
  x = 1, y = 1;
  rep(i, b) {
    x *= n-i;
    x %= mod;
    y *= i+1;
    y %= mod;
  }
  ans -= (x*RepeatSquaring(y, mod-2, mod)) % mod;
  if (ans%mod < 0) {
    cout << (ans%mod) + mod << endl;
  } else {
    cout << ans%mod << endl;
  }
}

Measured memory_bytes: 256
A, B, H, M = map(int, input().split())
from math import cos, radians, sqrt

aH = H*30 + M/2
aM = M*6

c = A**2+B**2-2*A*B*cos(radians(min(360-abs(aH-aM), abs(aH-aM))))

print(sqrt(c))


Measured memory_bytes: 9504
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int main() {
	string s, a, b;
	cin >> s;
	while (1) {
		s.erase(s.begin() + s.size() - 1);
		a = s.substr(0, s.size() / 2);
		b = s.substr(s.size() / 2, s.size());
		if (s.size() % 2 == 0) {
			if (a == b) {
				break;
			}
		}
	}
	cout << s.size();
	return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priotity_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ld PI=abs(acos(-1));
string s;

int main(){
	cin >> s;
	
	bool f=true;
	int r=s.size()-1, l=0, c=0;
	while(l<=r){
		if(s[l]!=s[r]){
			if(s[l]=='x') c++, l++;
			else if(s[r]=='x') c++, r--;
			else{f=false; break;}
		}else{
			l++; r--;
		}
	}
	
	cout << (f?c:-1) << endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <string>
using namespace std;
void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}


int main() {
    init();
    int a,c=0,m=0;
    cin>>a;
   if(a<105){
    cout<<0;
    return 0;
    }
    
    for(int i=105;i<=a;i++){
            c=0;
        if(i%2!=0){
        for(int o=1;o<=i;o++){

            if(i%o==0){
                c++;
            }

            }
        }
        if(c>=8){
                m++;
                
        }
    }
    cout<<m;
   }


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define dl double
template <class T>
void rd(T &x){
  x=0;T f=1;char ch=getchar();
  while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
  while(ch<='9' && ch>='0')x=x*10+ch-'0',ch=getchar();x*=f;
}
const int N=105;
using namespace std;
int n,a[N],cnt;
int main(){
 // freopen("in.txt","r",stdin);
 // freopen("o.txt","w",stdout);
 rd(n);for(int i=1;i<=n;i++)rd(a[i]);
 for(int i=1;i<=n;i+=2)cnt+=(a[i]%2);
 printf("%d\n",cnt);
 return 0;
}
/**/

Measured memory_bytes: 3664