akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;
ll n,k;
ll xs[50],ys[50],ds[50],xe[50],ye[50],de[50];
ll X1[50],Y1[50],D1[50],X2[50],Y2[50],D2[50];
bool ok[100][100][100];
vector<ll> X,Y,D;
/*
bool judge(ll x,ll y,ll d){
	ll cnt=0;
	for(ll i=0;i<2*n;i++){
		if(X1[i]<=x&&x<X2[i]&&Y1[i]<=y&&y<Y2[i]&&D1[i]<=d&&d<D2[i]) cnt++;
	}
	if(cnt>=k) ok[x][y][z]=0;
}
*/
int main()
{
	ll ans=0;
	scanf("%lld%lld",&n,&k);
	for(ll i=0;i<n;i++){
		scanf("%lld%lld%lld%lld%lld%lld",&xs[i],&ys[i],&ds[i],&xe[i],&ye[i],&de[i]);
		X.push_back(xs[i]);
		X.push_back(xe[i]);
		Y.push_back(ys[i]);
		Y.push_back(ye[i]);
		D.push_back(ds[i]);
		D.push_back(de[i]);
	}
	sort(X.begin(),X.end());
	sort(Y.begin(),Y.end());
	sort(D.begin(),D.end());
	//for(ll i=0;i<n;i++){
		/*X1[i]=lower_bound(X.begin(),X.end(),xs[i])-X.begin();
		X2[i]=lower_bound(X.begin(),X.end(),xe[i])-X.begin();
		Y1[i]=lower_bound(Y.begin(),Y.end(),ys[i])-Y.begin();
		Y2[i]=lower_bound(Y.begin(),Y.end(),ye[i])-Y.begin();
		D1[i]=lower_bound(D.begin(),D.end(),ds[i])-D.begin();
		D2[i]=lower_bound(D.begin(),D.end(),de[i])-D.//*/
	for(ll i=0;i<2*n-1;i++){
		for(ll j=0;j<2*n-1;j++){
			for(ll d=0;d<2*n-1;d++){
				ll cnt=0;
				for(ll p=0;p<n;p++){
					if(xs[p]<=X[i]&&X[i]<xe[p]&&ys[p]<=Y[j]&&Y[j]<ye[p]&&ds[p]<=D[d]&&D[d]<de[p]) cnt++;
				}
				if(cnt>=k) ans+=(X[i+1]-X[i])*(Y[j+1]-Y[j])*(D[d+1]-D[d]);
			}
		}
	}
	printf("%lld\n",ans);
}

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

int main() {
  long long int n, a, b;
  cin >> n >> a >>b;
  if ((b-a)%2 == 0){
    cout << (b-a)/2 << endl;
  }
  else if ((a-1) <= (n-b)) {
    cout << a+(b-a-1)/2 << endl;
  }
  else {
    cout << n-b+1+(b-a-1)/2<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <set>
#include <unordered_map>
#include <cstring>
#include <vector>

using namespace std ;

#define int long long 
#define endl "\n" 

const int N = 1e5 + 5 ;
const int mod = 1e9 + 7 ; 
vector<int>g[N] ;
int  n , dp[N][2] ; // 1 black and 0 for white 

int multiply( int x , int y )
{
     x*=y ;
     if(x >= mod ) x = x % mod ;
     return x ;
}
int add(int x , int y )
{
     x+=y ;
     if(x >= mod ) x-= mod ;
     return x ;
}

int dfs(int u , int papa ,int pc )
{

    int &ans = dp[u][pc] ;
    if(ans != -1 ) return ans ;
    ans = 1 ;
    
    for(auto &v :g[u])
    {
         if(v == papa) continue ;
         if(!pc)
         {
             int sum = (dfs(v,u,0) + dfs(v,u,1)) % mod ;
             ans = (ans*sum ) % mod ;
         }
             
         else
         {
             ans = (ans * dfs(v,u,0)) % mod ;
         } 
            
    } 
    
    return ans ;

}

int32_t main()
{
     /*#ifndef ONLINE_JUDGE 
     freopen("input.txt","r",stdin) ;
     freopen("output.txt","w",stdout) ;
     #endif */
     ios::sync_with_stdio(0) ;cin.tie(0) ; cout.tie(0);
     memset(dp,-1,sizeof(dp));
     int u , v ; 
     cin >> n ;
     for(int i = 1 ; i < n ; i++ )
     {
         cin >> u >> v ;
         g[u].push_back(v) ;
         g[v].push_back(u) ;
     }

     int ans = (dfs(1,0,0)+dfs(1,0,1)) % mod ;
     cout<<ans<<endl;
     return 0 ;
}

Measured memory_bytes: 14208
s = input()
n = len(s)

A = [[0, 0] for i in range(n)]

A[0] = [1, -float("inf")]
A[1] = [2 if s[0]!=s[1] else -float("inf"), 1]

for i in range(2, n):
    if s[i] == s[i-1]:
        A[i][0] = A[i-1][1] + 1
    else:
        A[i][0] = max(A[i-1]) + 1

    if s[i] == s[i-2] and (i >= 3 and s[i-1] == s[i-3]):
        A[i][1] = A[i-2][0] + 1
    else:
        A[i][1] = max(A[i-2]) + 1
    # print(A)

print(max(A[-1]))

Measured memory_bytes: 70688
import collections
import sys
sys.setrecursionlimit(10**7)

N,K = list(map(int,input().split()))
h = list(map(int,input().split()))

dq = collections.deque([0])

for i in range(1,N):
    l = []
    if i<K+1:
        for k in range(1,i+1):
            l.append(dq[i-k]+abs(h[i]-h[i-k]))

        dq.append(min(l))
    else:
        for k in range(1,K+1):
            l.append(dq[k]+abs(h[i]-h[i-K+k-1]))
        dq.append(min(l))
        dq.popleft()
print(dq.pop())

Measured memory_bytes: 85628
//package AtCoder;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		if((a==b && b!=c) || (b==c && b!=a) || (a==c && c!=b))
			System.out.println("Yes");
		else
			System.out.println("No");
		

	}

}


Measured memory_bytes: 23636
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		System.out.println((A+B)*C/2);
		

	}

}

Measured memory_bytes: 21844
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

    int N; cin >> N;
    vs S(N); REP(i, N) cin >> S[i];

    string ptn = "MARCH";
    map<char, ll> mp;
    for(string s : S) {
        if (ptn.find(s[0]) != string::npos) mp[s[0]]++;
    }
    
    ll ans = 0;
    if (mp.size() >= 3) {
        // 5C3 = 10
        // M,A, R
        ans += mp['M'] * mp['A'] * mp['R'];
        // M,A, C
        ans += mp['M'] * mp['A'] * mp['C'];
        // M,A, H
        ans += mp['M'] * mp['A'] * mp['H'];

        // M,R, C
        ans += mp['M'] * mp['R'] * mp['C'];
        // M,R, H
        ans += mp['M'] * mp['R'] * mp['H'];

        // M,C, H
        ans += mp['M'] * mp['C'] * mp['H'];
        // A,R, C
        ans += mp['A'] * mp['R'] * mp['C'];
        // A,R, H
        ans += mp['A'] * mp['R'] * mp['H'];
        // A,C, H
        ans += mp['A'] * mp['C'] * mp['H'];
        // R,C, H
        ans += mp['R'] * mp['C'] * mp['H'];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5760
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long ma = K;
		for(int i=0;i<N;i++){
			long d = 0;
			if(i + 1 < N){
				d = A[i + 1] - A[i];
			} else {
				d = A[0] + (K - A[i]);
			}
			ma = Math.Min(ma, K - d);
		}
		Console.WriteLine(ma);
		
		
	}
	long K;
	int N;
	long[] A;
	public Sol(){
		var d = rla();
		N = (int) d[1]; K = d[0];
		A = rla();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 34652
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
    for j in range(b+1):
        if (x-(500*i + 100*j))%50==0 and ((x-(500*i+100*j))//50)<=c and (500*i+100*j)<=x:
            ans += 1
            #print(i, j)
print(ans)

Measured memory_bytes: 9136
#include <bits/stdc++.h>
using namespace std;
long long a, b;
long long calc(long long x) {
    if (x%4==0) return x;
    else if (x%4==1) return 1;
    else if (x%4==2) return x+1;
    else return 0;
}
int main() {
    cin>>a>>b;
    cout<<(calc(b)^calc(a-1))<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
  
#define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
#define m tmp=d[r][1];d[r][1]=d[r][3];d[r][3]=d[r][4];d[r][4]=d[r][2];d[r][2]=tmp;
#define y tmp=d[r][0];d[r][0]=d[r][3];d[r][3]=d[r][5];d[r][5]=d[r][2];d[r][2]=tmp;
  
bool same(int d[][6],int q,int r){
 int tmp,cnt,j,a=1,i,k;
 check
   if(cnt==6)a=0;
  
 while(a){
  for(i=0;i<5;i++){
   for(k=0;k<4;k++){
    check
    if(cnt==6)break;
    m
   }
   check
   if(cnt==6)break;
   tmp=d[r][0];
   d[r][0]=d[r][1];
   d[r][1]=d[r][5];
   d[r][5]=d[r][4];
   d[r][4]=tmp;
  }
  if(cnt==6)break;
  y
  for(k=0;k<4;k++){
   check if(cnt==6)break;
   m
  }
  if(cnt==6)break;
  y y
  for(k=0;k<4;k++){
   check
   if(cnt==6)break;
   m
  }
  a=0;
 }
  
 if(cnt==6)return true;
 return false;
}

int main(){
 int n,judge=0;
 cin >> n;
 int d[n][6];
  
 for(int i=0;i<n;i++){
  for(int j=0;j<6;j++){
   cin >> d[i][j] ;
  }
 }
  
 for(int q=0;q<n-1;q++){
  for(int r=q+1;r<n;r++){
  if(same(d,q,r))judge++;
  }
 }

 if(judge>0)cout << "No" << endl ;
 else cout << "Yes" << endl ;
  
 return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int n,m,cnt=0,o,aa[220000],cntl=0;
pair<int,int> p[220000];
string s,ss[220000];
char c,cc[5000][5000]={};
queue<int> que;
signed main(){
    cin>>n;
    rep(i,n){
        if((1+i)%3!=0&&(1+i)%5!=0){
            cnt+=i+1;
        }
    }
    cout<<cnt;
}

Measured memory_bytes: 10508
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim_right().to_owned()
}

fn main() {
    let v: Vec<u32> = read_line()
        .split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect();
    println!("{}", v[0].pow(3));
}


Measured memory_bytes: 4352
from bisect import bisect_left as bl
n, t, q = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(n)]
qlst = [lst[int(input()) - 1] for _ in range(q)]

left = [a for a, d in lst if d == 2]
right = [a for a, d in lst if d == 1]
lenl = len(left)
lenr = len(right)
for a, d in qlst:
  if d == 1:
    coll_ind = bl(left, a)
    if coll_ind >= lenl:
      print(a + t)
    else:
      coll = left[coll_ind]
      coll2 = right[bl(right, coll) - 1]
      coll_pos = (coll + coll2) // 2
      print(min(a + t, coll_pos))

  else:
    coll_ind = bl(right, a) - 1
    if coll_ind == -1:
      print(a - t)
    else:
      coll = right[coll_ind]
      coll2 = left[bl(left, coll)]
      coll_pos = (coll + coll2) // 2
      print(max(a - t, coll_pos))



Measured memory_bytes: 20964
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - ISU
            var line = ReadLine();
            int X = line[0];
            int Y = line[1];
            int Z = line[2];
            int i = 0;

            while ((Y + Z) * (i + 1) + Z <= X)
            {
                i++;
            }

            Console.WriteLine(i);
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var array = line.Split(' ');

            return array.Select(x => int.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 11220
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		
		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		int C = scanner.nextInt();
		int D = scanner.nextInt();

		System.out.println(A*B>C*D?A*B:C*D);
		scanner.close();
	}

}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <bitset>
#include <map>
#include <math.h>
#include <utility>

using namespace std;

int main(){

    int N, count = 0;
    cin >> N;

    vector<int> d(N);
    for (int i = 0; i < N; i++){
        cin >> d[i];
    }
    sort(d.begin(), d.end());

    int low = d[N/2 - 1];
    int high = d[N/2];

    cout << high - low << endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
ll n;
int main()
{
    cin>>n;
    cin>>s;
    ll ans=0;
    ll cnt1=0,cnt2=0,cnt3=0,c=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R') cnt1++;
        if(s[i]=='G') cnt2++;
        if(s[i]=='B') cnt3++;
    }
    //printf("%d %d %d",cnt1,cnt2,cnt3);
    ans=cnt1*cnt2*cnt3;
    for(int i=0;i<n;i++){
        for(int j=i;j<n;j++){
            if(s[i]==s[j]) continue;
            ll k=2*j-i;
            if(k>=n||s[i]==s[k]||s[j]==s[k]) continue;
            c++;
        }
    }
    cout<<ans-c;
    return 0;
}

Measured memory_bytes: 3644
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
int main()
{
	ll n, m;
	scanf("%lld %lld", &n, &m);
	int gap = 1;
	while (1)
	{
		n += n;
		if (n > m)break;
		gap++;
	}
	printf("%d", gap);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
ll h;
map<ll,ll> m;
ll dfs(ll x){
	if(x==1)return 1;
	if(m.count(x))return m[x];
	return m[x]=2*dfs(x/2)+1;
}
int main(){
	h=read();
	cout << dfs(h);
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int n;
    string s;
    cin >> n >> s;

    int cnt = 0;
    for(int i=0; i<n; ++i){
        if(s[i] == '.')
            ++ cnt;
    }

    int ans = cnt;
    for(int i=0; i<n; ++i){
        if(s[i] == '.')
            -- cnt;
        else
            ++ cnt;
        ans = min(ans, cnt);
    }
    cout << ans << endl;

    return 0;
}


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

int main() {
    int n;
    std::cin >> n;
    std::map<std::string, int> m;
    std::string prev;
    std::cin >> prev;
    m[prev]++;
    for (int i = 1; i < n; i++) {
        std::string s;
        std::cin >> s;
        m[s]++;
        if (m[s] > 1) {
            std::cout << "No" << std::endl;
            return 0;
        }
        if (prev[prev.size() - 1] != s[0]) {
            std::cout << "No" << std::endl;
            return 0;
        }
        prev = s;
    }

    std::cout << "Yes" << std::endl;

    return 0;
}

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

int main(){
  bool bingo2[3][3];
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      bingo2[i][j] = false;
    }
  }
  int bingo[3][3];
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      cin >> bingo[i][j];
    }
  }
  int n;
  cin >> n;
  int b[n];
  for(int i=0; i<n; i++) cin >> b[i];
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      for(int k=0; k<n; k++){
        if(bingo[i][j] == b[k]){
          bingo2[i][j] = true;
          //cout << i << " " << j << endl;
        }
      }
    }
  }
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      if(bingo2[i][j] == false){
        break;
      }
      else{
        if(j == 2){
      	  cout << "Yes" << endl;
      	  return 0;
        }
      }
    }
  }
  for(int j=0; j<3; j++){
    for(int i=0; i<3; i++){
     if(bingo2[i][j] == false){
        break;
     }
     else{
       if(i==2){
     	 cout << "Yes" << endl;
     	 return 0;
       }
     }
    }
  }
  if(bingo2[0][0] == true){
    if(bingo2[1][1] == true){
      if(bingo2[2][2] == true){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  if(bingo2[0][2] == true){
    if(bingo2[1][1] == true){
      if(bingo2[2][0] == true){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}



Measured memory_bytes: 256
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    N,D= map(int, sys.stdin.readline().split())
    ans = math.ceil(N/(2*D+1))
    print(ans)

Measured memory_bytes: 5712
/* 
 * Project: AtCoder Beginners Contest 105 B - Cakes and Donuts
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/16
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
using namespace std;

int n;

void solve() {
   
    const int cake = 4;
    const int donut = 7;

    int rem = n % cake;
    if (rem == 0 || rem == donut) {
        printf("Yes\n");
        return;
    }
    rem = rem % donut;
    if (rem == 0) {
        printf("Yes\n");
        return;
    }

    rem = n % donut;
    if (rem == 0 || rem == cake) {
        printf("Yes\n");
        return;
    }
    rem = rem % cake;
    if (rem == 0) {
        printf("Yes\n");
        return;
    }
    for (int i=1;i<n/cake;i++) {
        for (int j=0;j<n/donut;j++) {
            if (n == i*cake+j*donut) {
                printf("Yes\n");
                return;
            }
        }
    }
    printf("No\n");



}

int main() {

    scanf("%d", &n);

    solve();

}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    assert!(1 <= n && n <= 100);
    let x: i32 = read();
    assert!(1 <= x && x <= 10000);
    let mut l_list: Vec<i32> = Vec::new();

    for _ in 0..n {
        l_list.push(read());
    }
    l_list.iter().map(|&l| {
        assert!(1 <= l && l <= 100)
    });
    let mut count: usize = 0;
    let mut d: i32 = 0;

    loop {
        if count == (n + 1){
            break;
        }

        if count > 0 {
            d += *l_list.get(count - 1).unwrap();
        }

        if d > x {
            break;
        }
        count += 1;
    }
    println!("{}", count);
}

// fn rounding() {
//     let x: i32 = read();
//     let a: i32 =  read();
    
//     let output: i32 = if x < a {
//          0
//     } else {
//          10
//     };

//     println!("{}", output);
// }

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


Measured memory_bytes: 4352
<?php
// Your code here!

function primeNumber($target) {
    $limit = ceil(sqrt($target));
    $res = NULL; 
    for($i=2;$i<=$limit ;$i++) {
        if($target%$i == 0) { 
            $res = $i;
            break;
        }
    }
    if ($res == NULL) { 
        return TRUE;
    }else { ////$resがNULLでない場合。(素数でない場合。)
        return FALSE;
    }
}

fscanf(STDIN,"%d",$x);
if($x == 2){
    echo "2";
    exit();
}

while(true){
    if(primeNumber($x)){
        echo $x;
        break;
    }else{
        $x++;
    }
}

Measured memory_bytes: 4728
import java.util.*;
public class Main {
	public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String A = sc.next();
	String B = sc.next();
	if(A.equals(B)){
		System.out.println("EQUAL");
	}else if(A.length() > B.length()){
		System.out.println("GREATER");		
	}else if(A.length() < B.length()){
		System.out.println("LESS");
	}else if(A.length() == B.length()){
		int a = Integer.parseInt(A.substring(0, 1));
		int b = Integer.parseInt(B.substring(0, 1));
		if(a > b){
			System.out.println("GREATER");					
		}else{
			System.out.println("LESS");			
		}
	}
	
	}	
}	
	



Measured memory_bytes: 23636
#include<bits/stdc++.h>
#define N 1000005
#define LL long long
using namespace std;

LL ans;
int h,w,k;
char a[66][66];
int bo1[14],bo2[14];

inline int qr()
{
	int x=0,w=1;char a=0;
	while(a<'0'||a>'9'){if(a=='-')w=-1;a=getchar();}
	while(a<='9'&&a>='0'){x=(x<<3)+(x<<1)+(a^48);a=getchar();}
	return x*w;
}

void dfs2(int lie)
{
	if(lie>w)
	{
//		for(int i=1;i<=h;i++)
//			cout<<bo1[i]<<' ';
//		cout<<endl;
//		for(int i=1;i<=w;i++)
//			cout<<bo2[i]<<' ';
//		cout<<endl;
		int cnt=0;
		for(register int i=1;i<=h;i++)
			for(register int j=1;j<=w;j++)
			{
				if(bo1[i]||bo2[j])
					continue;
				if(a[i][j]=='#')
					cnt++;
			}
		if(cnt==k)
			ans++;
		//cout<<cnt<<endl;
		return ;
	}
	bo2[lie]=1;
	dfs2(lie+1);
	bo2[lie]=0;
	dfs2(lie+1);
}

void dfs1(int hang)
{
	if(hang>h)
	{
//		for(int i=1;i<=h;i++)
//			cout<<bo1[i]<<' ';
//		cout<<endl;
		dfs2(1);
		return ;
	}
	bo1[hang]=1;
	dfs1(hang+1);
	bo1[hang]=0;
	dfs1(hang+1);
}

int main()
{
	h=qr();
	w=qr();
	k=qr();
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)	
			cin>>a[i][j];
	dfs1(1);
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 3568
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main() {
	int a[10];
	for (int i = 0; i < 10; i++) {
		cin >> a[i];
	}
	sort(a, a + 10);
	reverse(a, a + 10);
	cout << a[0] << endl << a[1] << endl << a[2] << endl;
}


Measured memory_bytes: 3108
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    a,b = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    TF = 'Odd' if a*b%2==1 else 'Even'
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)


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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int m, d;
    cin >> m >> d;
    int cnt = 0;
    For(i, 1, m) {
        For(j, 1, d) {
            int one = j % 10;
            int ten = j / 10;
            if (one > 1 and ten > 1 and one * ten == i) cnt++;
        }
    }
    print(cnt);

    return 0;
}


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

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    size_t N, M;
    cin >> N >> M;
    priority_queue<int64_t, vector<int64_t>, greater<>> heap;
    for (size_t i = 0; i < N; ++i) {
        int64_t a; cin >> a;
        heap.emplace(a);
    }
    vector<pair<int64_t, int64_t>> vec(M);
    for (size_t i = 0; i < M; ++i) {
        cin >> vec[i].second >> vec[i].first;
    }
    sort(vec.begin(), vec.end(), greater<>());
    for (auto &e : vec) {
        int64_t loop = e.second, value = e.first;
        while (loop--) {
            if (value <= heap.top()) {
                break;
            }
            heap.pop();
            heap.emplace(value);
        }
    }
    int64_t res = 0;
    while (!heap.empty()) {
        res += heap.top();
        heap.pop();
    }
    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 2676
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <list>
#include <queue>
using namespace std;

int inf = (1 << 30);
int mod = 1e9 + 7;
int64_t inf64 = (1LL << 60);

template <typename T>
T gcd(T a, T b) {
    if(b == 0) return a;
    else return gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
    T g = gcd(a, b);
    return a / g * b;
}

bool check(vector<int> a, int index, int key){
    if(a[index] >= key) return true;
    else return false;
}

int lower_bound(vector<int> a, int key){
    int left = -1, right = a.size();
    while(right - left > 1){
        int mid = left + (left + right) / 2;
        if(check(a, mid, key)) right = mid;
        else left = mid;
    }
    return right;
}

int main(){

    int64_t X, Y;
    cin >> X >> Y;

    if(abs(X - Y) <= 1) cout << "Brown" << endl;
    else cout << "Alice" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define N 3050
inline void upd(ll &x,ll y) {x=(x+y)%mod;}
ll f[N][N];
int s[N],n,m,rp[N];
char w[N];
int main() {
	scanf("%d%d%s",&n,&m,w+1);
	int i,j;
	for(i=1;i<=n;i++) s[i]=s[i-1]+w[i]-'0';
	s[n+1]=s[n];
	for(i=1;i<=n+1;i++) rp[i]=i;
	for(i=1;i<=m;i++) {
		int l,r;
		scanf("%d%d",&l,&r);
		rp[l]=max(rp[l],r);
	}
	for(i=1;i<=n;i++) rp[i]=max(rp[i],rp[i-1]);
	f[1][s[rp[1]]]=1;
	for(i=1;i<=n;i++) {
		for(j=0;j<=n;j++) if(f[i][j]) {
			int num=s[rp[i+1]]-s[rp[i]];
			if(j) upd(f[i+1][j-1+num],f[i][j]);
			if(j!=rp[i]-i+1) upd(f[i+1][j+num],f[i][j]);
		}
	}
	printf("%lld\n",f[n+1][0]);
}


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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359;
#define inf (1 << 21);
#define mod 1000000007;

int main() {
    double W, H; cin >> W >> H;
    double x, y; cin >> x >> y;
    cout << fixed << setprecision(10);
    if (x == W / 2 && y == H / 2) {
        cout << W * H / 2 << ' ' << 1 << endl;
    }
    else {
        cout << W * H / 2 << ' ' << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
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; }
using namespace std;

int n;
int a[400];
int dp[400][400];

const int inf=1000000000000000;

signed main(void){
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);  

    cin>>n;
    rep(i,n)cin>>a[i];

    rep(i,n)rep(j,n)dp[i][j]=inf;
    rep(i,n)dp[i][i]=0;
    for(int i=1; i<n; i++){
        for(int j=0; j+i<n; j++){
            int sum=0;
            for(int k=j; k<j+i; k++){
                sum+=a[k];
                chmin(dp[j][j+i],dp[j][k]+dp[k+1][j+i]);
            }
            dp[j][j+i]+=sum+a[j+i];
        }
    }

    cout<<dp[0][n-1]<<endl; 
    return 0;

}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int n,m,ac[100010],x[100010],ans,ppen,pos;
string s;
int main()
{
	memset(x,0,sizeof(x));
	memset(ac,0,sizeof(ac));
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;++i) {
		scanf("%d",&pos);
		cin>>s;
		if(!ac[pos]) {
			if(s=="WA") x[pos]++;
			else ac[pos]=1;
		}
	}
	for(int i=1;i<=n;++i)
		if(ac[i])
			ppen+=x[i],ans++;
	printf("%d %d",ans,ppen);
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] count = new int[100001];
        while (n-- > 0) {
            int num = sc.nextInt();
            if (num != 0) count[num-1]++;
            count[num]++;
            if (num != 100000) count[num+1]++;
        }
        
        int ans = 0;
        for (int i = 0; i < 100001; i++) {
            ans = Math.max(ans, count[i]);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 59804
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int mo=1000000007;
const int N=1<<19|5;
int n,p[N],w[N],s[N],ans;
void insert(int p,int v){
	for (;p!=1;p>>=1)
		v=1ll*v*p%mo,s[p]=(s[p]+v)%mo;
}
void update(int p,int v){
	for (;p!=1;p>>=1){
		v=1ll*v*p%mo;
		ans=(ans+1ll*v*s[p^1]%mo*(p>>1))%mo;
	}
}
void solve(int k,int l,int r){
	if (l!=r){
		int mid=(l+r)/2;
		solve(k*2,l,mid);
		solve(k*2+1,mid+1,r);
		For(i,l,mid) insert(p[i]+(1<<(n-1))-1,w[i]);
		For(i,mid+1,r) update(p[i]+(1<<(n-1))-1,1ll*w[i]*k%mo);
		For(i,l,mid) insert(p[i]+(1<<(n-1))-1,mo-w[i]);
	}
	For(i,l,r)
		w[i]=1ll*w[i]*k%mo;
}
int main(){
	scanf("%d",&n);
	For(i,0,(1<<(n-1))-1) scanf("%d",&p[i]);
	For(i,0,(1<<(n-1))-1) w[i]=1;
	solve(1,0,(1<<(n-1))-1);
	cout<<ans<<endl;
}

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

using namespace std;

int main()
{
	int N, K;
	cin >> N >> K;

	if ((N+1) / 2 >= K) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
  int n;
  std::cin >> n;
  bool contains_odd = false;
  for (int i = 0; i < n; i++) {
    int val;
    std::cin >> val;
    contains_odd = contains_odd || val % 2 == 1;
  }
  if (contains_odd) {
    std::cout << "first\n";
  } else {
    std::cout << "second\n";
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  int n, a, b;
  cin >> n;
  ll S = 0;
  cin >> a;
  for(int i = 1;i < n;i++) {
    cin >> b;
    if(a > b) {
      S += a - b;
    } else {
      a = b;
    }
  }
  cout << S << endl;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            while (true) {
                int n = sc.nextInt();
                if (n == 0) {
                    break;
                }
                int[] scores = new int[n];
                double sum = 0, sum2 = 0;
                for (int i = 0; i < scores.length; i++) {
                    scores[i] = sc.nextInt();
                    sum += scores[i];
                }
                double average = 0, variance = 0;
                average = sum / n;
                for (int i = 0; i < scores.length; i++) {
                    sum2 += (scores[i] - average) * (scores[i] - average);
                }
                variance = sum2 / n;
                System.out.println(String.format("%.8f", Math.sqrt(variance)));
            }
        }
    }
}


Measured memory_bytes: 31944
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define jam(t) cout<<"Case #"<<t<<": "
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}



void solve(){
    ll a,b;
    cin >> a >> b;
    cout << a*b << endl;
}
int main()
{
#ifndef ONLINE_JUDGE
input_from_file
#endif
 
    FASTIO
    cin.tie(NULL);
    fflush(stdout);
    ll t = 1;
  //  cin >> t;
    for(ll tcase = 1;tcase <= t;tcase++){
        solve();
        
    }
return 0;
}

Measured memory_bytes: 3660
#include <stdio.h>
int main(){
    char a[10];
    while(scanf("%s",a)!=EOF){
        for(int i=0;i<9;i++){
            for(int j=0;j<9-i;j++){
                a[j]=a[j]+a[j+1]-'0';
                if(a[j]-'0'>9)a[j]-=10;
            }
        }
        printf("%c\n",a[0]);
    }
}

Measured memory_bytes: 2720
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define N 1000005
typedef long long ll;
const ll LLINF=1ll<<60;
const int mx=1e6+7;
// int n;
//vector<int> a(mx),b(mx);
// vector<int> g[mx];
// int deg[mx];
// vector<int> adj[mx];
//vector<int> ans;
//---dfs--
//bool visited[mx];
//vector<ll> val(mx,0);

// void dfs(int s,int e,int c1,int c2){
// 	if(a[s]^c1!=b[s]) {ans.push_back(s), c1^=1;}
// 	for(auto u:adj[s]){
// 		if(u!=e){
// 			dfs(u,s,c2,c1);
// 		}
// 	}
// }
//---dfs---

//---primes---
// const int N = 1e7 + 10;

// bool prime[N];
 
// int spf[N];
 
// void calc(){
// 	for(int i = 2; i<1e4; i++){
// 		if(prime[i])
// 			continue;
// 		spf[i] = i;
// 		for(int j = i * i; j < N; j += i){
// 			prime[j] = 1;
// 			spf[j] = i;
// 		}
// 	}
// 	for(int i = 2; i < N; i++)
// 		if(!spf[i])
// 			spf[i] = i;
// }

// vector<pair<int,int>> getp(int x){
// 	int curr=x;
// 	vector<pair<int,int>> ans;
// 	while(curr>1){
// 		int a=spf[curr];
// 		int count=0;
// 		while(curr%a==0){ curr/=a; count++;}
// 		ans.push_back(make_pair(a,count));
// 	}
// 	return ans;
// }

// bool ispr(int n) {
// 	if(n==1) return false;
//     for (int i=2;i*i<=n;++i){
//         if(n%i==0){
//             return false;
//         }
//     }
//     return true;
// }
//---primes---

//---segment_tree---
// int upd(int t,int val,int l,int r,int y, int z){
// 	if(y<l||y>r) return tr[val];
// 	if(l==r) return tr[val]=z;
// 	int s=(l+r)/2;
// 	upd(t^1,2*val+1,l,s,y,z);
// 	upd(t^1,2*val+2,s+1,r,y,z);
// 	if(t) tr[val]=tr[2*val+1]|tr[2*val+2];
// 	else tr[val]=tr[2*val+1]^tr[2*val+2];
// 	return tr[val];
// }
//int query(){}
//---segment_tree---

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	int T=1;
	//cin>>T;
	while(T--){
		ll d,t,s;
		cin>>d>>t>>s;
		if(t*s>=d) cout<<"Yes\n";
		else cout<<"No\n";
 	}
}


Measured memory_bytes: 3604
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10000000000000
#define MOD 1000000007
#define mod 1000000007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define rep(i,n)for(ll i=0;i<(n);i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    ll n,q;cin>>n>>q;
    V<ll>a[1010];
    while(q--){
        int c;cin>>c;
        if(c==0){
            ll t,x;cin>>t>>x;
            a[t].pb(x);
        }
        else if(c==1){
            ll t;cin>>t;
            for(ll j=0;j<a[t].size();j++){
                if(j<a[t].size()-1)
                cout<<a[t][j]<<" ";
            else cout<<a[t][j];
            }
            cout<<endl;
        }
        else{
            ll t;cin>>t;
            a[t].clear();
        }
    }
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------













































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

Measured memory_bytes: 3632
#include <bits/stdc++.h>
typedef long long l1;
#define mod 1000000007
#define f first
#define se second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(),x.end()
#define set(a,b) memset(a,b,sizeof(a))
#define mn *min_element
#define mx *max_element
#define input l1 t; cin>>t; while(t--)
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);cout.tie(NULL);
  l1 n,x;
  cin>>n;
  x=n/500;
  cout<<x*1000+((n-x*500)/5)*5;
  return 0;
}

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

struct Node {
  int pre;
  int now;
  int tic;
  double tim;

  Node(int p, int n, int tc, double tm) {
    pre = p;
    now = n;
    tic = tc;
    tim = tm;
  }

  bool operator<(const Node &n) const {
    return tim > n.tim;
  }
};

int main() {
  while (true) {
    int n, m, p, a, b;
    cin >> n >> m >> p >> a >> b;

    if (n == 0) {
      break;
    }

    vector<int> t(n);
    for (int i = 0; i < n; i++) {
      cin >> t[i];
    }

    vector<vector<int> > z(m + 1);
    for (int i = 1; i <= m; i++) {
      z[i].resize(m + 1);
      fill(z[i].begin(), z[i].end(), -1);
    }

    for (int i = 1; i <= p; i++) {
      int x, y;
      cin >> x >> y;
      cin >> z[x][y];
      z[y][x] = z[x][y];
    }

    bool f[31][256];
    for (int i = 1; i <= 30; i++) {
      for (int j = 0; j < 256; j++) {
	f[i][j] = false;
      }
    }

    priority_queue<Node> q;
    Node sn(a, a, 0xFF, 0.0);
    q.push(sn);
    while (!q.empty()) {
      Node nd = q.top();

      if (nd.now == b) {
	cout << nd.tim << endl;
	break;
      }
      q.pop();

      if (f[nd.now][nd.tic]) {
	continue;
      }
      f[nd.now][nd.tic] = true;

      for (int i = 1; i <= m; i++) {
	if (z[nd.now][i] != -1) {
	  for (int j = 0; j < n; j++) {
	    int bit = 1 << j;
	    if (nd.tic & bit) {
	      Node nn(nd.now, i, nd.tic & ~bit,
		      nd.tim + (double)z[nd.now][i] / t[j]);
	      q.push(nn);
	    }
	  }
	}
      }
    }

    if (q.empty()) {
      cout << "Impossible" << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 25312
N = int(input())
C = [int(i) for i in input().split()]
mod = 10 ** 9 + 7

C.sort()

ret = 0
for i in range(N) :
  rest = N - i - 1
  if rest == 0 :
    ret += C[i] * pow(4, i, mod) * pow(2, N - i, mod) * pow(2, rest, mod) % mod
  else :
    ret += C[i] * pow(4, i, mod) * pow(2, N - i, mod) * (rest + 2) * pow(2, rest - 1, mod) % mod
  ret %= mod

print(ret)

Measured memory_bytes: 87628
n, h = map(int, input().split())
sords = [list(map(int, input().split())) for _ in range(n)]
best = sorted(sords)[-1][0]
throw_damage = 0
cnt = 0
for i in sords:
    if i[1] > best:
        throw_damage += i[1]
        cnt += 1
if throw_damage >= h:
    sords.sort(key = lambda x:(-x[1],x[0]))
    throw_damage = 0
    cnt = 0
    for i in sords:
        throw_damage += i[1]
        cnt += 1
        if throw_damage >= h:
            print(cnt)
            exit()
print(cnt + (h - throw_damage) // best + ((h - throw_damage)%best != 0))

Measured memory_bytes: 37840
import heapq
INF = 10**20

N, M, S = map(int, input().split())
adj = [[] for _ in range(N)]
for m in range(M):
    u,v,a,b = map(int, input().split())
    u -= 1
    v -= 1
    adj[u].append((v,a,b))
    adj[v].append((u,a,b))

C = []
D = []
for n in range(N):
    c, d = map(int, input().split())
    C.append(c)
    D.append(d)

M = 2500
S = min(S, M-1) # 2500枚あれば十分
dist = [[INF]*M for _ in range(N)] # dist[都市][銀貨の枚数]
dist[0][S] = 0
pq = [(0,S,0)] # (時間、銀貨の枚数、都市)

while pq:
    d, sil, node = heapq.heappop(pq)
    if dist[node][sil] < d: # 探索の対象にする必要があるか確認
        continue 
     # 銀貨に交換したとして、上限を超えないか、探索の必要があるか
    if sil+C[node] < M and d+D[node] < dist[node][sil+C[node]]:
        dist[node][sil+C[node]] = d + D[node] # 時間の更新
        heapq.heappush(pq, (d + D[node], sil+C[node] ,node))
    for next, a, b in adj[node]:
        # 銀貨が足りるか、探索の必要があるか
        if sil >= a and d + b < dist[next][sil-a]:
            dist[next][sil-a] = d + b
            heapq.heappush(pq, (d + b, sil-a ,next))

for i in range(1,N):
    print(min(dist[i])) # 残っている銀貨の枚数は問わない



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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#define TASKNAME somethinghere

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

	//freopen(TASKNAME".inp", "r", stdin);
	//freopen(TASKNAME".out", "w", stdout);

    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);

	ll res = 0;
    for(ll i = n-1; i >= 0; i--) {
        ll low = 0, high = i-1;
        while(low < high) {
			if(a[low] + a[high] > a[i]) {
				res += (high - low);
				high--;
			}
			else low++;
        }
    }

	cout << res;

	cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}

// g++ .cpp -o .exe -DEVAL -std=c++11 -pipe -O2 -s -static -Wall -Wshadow
/* stuff you should look for
	* array bounds
	* special cases (n=1?), set tle
	* do sth instead of nothing and stay organized
	* check for variables with close names
*/


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

using namespace std;

#define REP(i, a, n) for (int i = a, _n = n; i <= _n; ++i)
#define DREP(i, a, n) for (int i = a, _n = n; i >= _n; --i)
#define FOR(i, a, n) for (int i = a, _n = n; i < _n; ++i)
#define EREP(i, a) for (int i = first[a]; i; i = edge[i].nxt)
#define debug(x) cout << #x << " = " << x << endl

const int Mod = 2019;

int L, R, l, r;

int main () {
	scanf ("%d%d", &l, &r);
	L = l, R = r;
	L %= Mod;
	if (r - l >= Mod) R = L + Mod;
	else R = r % Mod;
	if (L >= R) R += Mod;

	int ans = 2e9;
	REP (i, L, R) REP (j, i + 1, R)
		ans = min(ans, i * j % Mod);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
lst1=list(input())
lst2=list(input())
l=[]
for i in range(len(lst1)-len(lst2)+1):
    if str(lst1[i:i+len(lst2)])==str(lst2):
        l.append(i)
    else:
        pass
for i in range(len(l)):
    print(l[i])


Measured memory_bytes: 5572