akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

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

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}


void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}


int a , b ;
string str ;
vector < int > hyphen ;

int main(){

   cin >> a >> b ;
   cin >> str ;
   if( a + b + 1 != sz( str ) ){
     cout << "No\n" ;
     return 0 ;
   }

   forn( int , i , 0 , a + b + 1 ){
      if( str[ i ] == '-' )
        hyphen.pb( i + 1 ) ;
   }

   if( sz( hyphen ) != 1 || hyphen.back() != a + 1 ){
     cout << "No\n" ;
     return 0 ;
   }


   cout << "Yes\n" ;




   return 0 ;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        int result = b * a / 2;
      
        System.out.println(result);
    }
}


Measured memory_bytes: 35920
#pragma GCC optimize("Ofast")
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include<bits/stdc++.h>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include "bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int powm(int a, int b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
void F(); 
signed main() {
	fast_cin();
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(5);
	int t=1;
	// cin>>t;
	fr(i,1,t) {
		F();
	}

return 0;
}
void F() {
	int n ; 
	cin >> n ; 
	cout <<(n*n) << endl ; 
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    n, k = map(int, input().split())
    a_list = [0] + list(map(int, input().split()))

    prevs = {}
    c = 0
    pos = 1
    while c < k and pos not in prevs:
        prevs[pos] = c
        pos = a_list[pos]
        c += 1

    if c >= k:
        print(pos)
    else:
        loop_count = c - prevs[pos]
        c_base = prevs[pos]
        kmod = (k - c_base) % loop_count
        prev_poss = list(prevs.keys())[c_base:]
        print(prev_poss[kmod])


if __name__ == '__main__':
    main()


Measured memory_bytes: 32380
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

def K(n):
  a=0
  while n>0:
    n=n//10
    a=a+1
  return a

n=int(input())
D=make_divisors(n)
print(K(D[len(D)//2]))

Measured memory_bytes: 3064
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize,
        dvec: [(u8, u8); n]
    }

    for i in 0..n - 2 {
        if dvec[i].0 == dvec[i].1 && dvec[i + 1].0 == dvec[i + 1].1 && dvec[i + 2].0 == dvec[i + 2].1 {
            println!("Yes");
            return;
        }
    }

    println!("No");
}


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

using namespace std;

int main() {
  string c1, c2;
  cin >> c1 >> c2;
  if (c1[0] == c2[2] && c1[1] == c2[1] && c1[2] == c2[0]) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(int argc, char const *argv[]) {

  int N, K, R, S, P;
  char T[100000];
  scanf("%d", &N);
  scanf("%d", &K);
  scanf("%d", &R);
  scanf("%d", &S);
  scanf("%d", &P);
  scanf("%s", T);

  int pnt = 0;

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

    if (i < K) {

      switch (T[i]) {

        case 'r':
        pnt = pnt + P;
        break;

        case 's':
        pnt = pnt + R;
        break;

        case 'p':
        pnt = pnt + S;
        break;

      }

    }

    if (i >= K) {

      if (T[i] == T[i - K]) {

        pnt += 0;
        T[i] = 'n';

      }else{

        switch (T[i]) {

          case 'r':
          pnt = pnt + P;
          break;

          case 's':
          pnt = pnt + R;
          break;

          case 'p':
          pnt = pnt + S;
          break;

        }

      }

    }

  }

  printf("%d\n", pnt);

  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cctype>
using namespace std;
int main()
{
	long long n, m;
	while(scanf("%lld%lld", &n, &m) != EOF)
	{
		if(n * 2 == m) printf("%lld\n", n);
		else if(n * 2 < m) 
		{
			long long k = m - 2 * n;
			n += k / 4;
			printf("%lld\n", n);
		}
		else 
		{
			printf("%lld\n", m / 2);
		}
	}
	return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

ll N;
vector<ll> prime;
ll ans = LINF;

vector<ll> prime_factor(ll N) {
    vector<ll> res;
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;

        while (N % a == 0) {
            N /= a;
            res.push_back(a);
        }
    }
    if (N != 1) res.push_back(N);
    return res;
}

int main() {
    cin >> N;
    ll ans = LINF;
    for (ll i = 1; i*i <= N; i++) {
       if(N % i == 0){
           ll left = i;
           ll right = N / i;
           ans = min(ans,left+right-2);
       } 
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640
<?php
$s=trim(fgets(STDIN));
$n=strlen($s);
$arr=array("A"=>"T","T"=>"A","G"=>"C","C"=>"G");
$ans=0;
$c=0;
$i=0;
while($i<$n){
	if(array_key_exists($s[$i],$arr)){
		++$c;
	}else{
		$ans=max($ans,$c);
		$c=0;
	}
	++$i;
}
echo max($ans,$c);

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

LL gcd(LL a,LL b) {
	LL bigger = max(a,b);
	LL smaller = min(a,b);
	if (bigger % smaller != 0) {
		return gcd(smaller,(bigger % smaller));
	}
	return smaller;
}

int main(int argc, char const* argv[])
{
	LL n,m;
	string s,t;
	cin >> n >> m >> s >> t;
	LL x;
	x = n*m/gcd(n,m);
	LL n_div = x/n, m_div = x/m;
	string ss = "",tt = "";
	for (int i = 0; i < s.size(); i++) {
		if (i % m_div == 0) {
			ss += s[i];
		}
	}
	for (int i = 0; i < t.size(); i++) {
		if (i % n_div == 0) {
			tt += t[i];
		}
	}

	for (int i = 0; i < min(ss.size(),tt.size()); i++) {
		if (ss[i] != tt[i]) {
				cout << -1 << endl;
				return 0;
		}
	}

	cout << x << endl;
	return 0;
}


Measured memory_bytes: 512
// organize and work - Abhinav IIITA
#include <bits/stdc++.h>
using namespace std;
#define int long long 
void solve(){
	int a,b;
	cin>>a>>b;
	cout<<6-a-b;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;//cin>>t;
	t=1;
	while(t--)//
	solve();
	return 0;
}


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

using namespace std;

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

    if( A <= B ){
        if( C >= A && C <= B ) cout << "Yes" << endl;
        else cout << "No" << endl;
    }else{
        if( C <= A && C >= B ) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
/*
      @author: Charan Sai
*/
#include <bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define ppi pair<int, int>
#define INT INT_MAX
#define endl "\n"
#define nl cout << "\n"
#define deb(x) cout << #x << " " << x << endl;

const int M = 3002;
int dp[M][M];

string s, t;
int ns, nt;


int Top_Down(int i, int j) {
    // Base Case
    if(i < 0 || j < 0) return 0;
    if(dp[i][j] != -1) return dp[i][j];
    // Choice
    if(s[i] == t[j])
        return (dp[i][j] = 1 + Top_Down(i - 1, j - 1));
    return (dp[i][j] = max(Top_Down(i, j - 1), Top_Down(i - 1, j)));
}

string tostring(char c) {
    string s = "";
    s += c;
    return s;
}

string print_LCS() {
    string LCS = "";
    if(dp[ns][nt] == 0) return LCS;
    while(ns >= 0 && nt >= 0) {
        if(s[ns] == t[nt]) {
            LCS += tostring(s[ns]);
            ns--;
            nt--;
        }
        else {
            if(dp[ns][nt] == dp[ns][nt-1]) {
                nt--;
            }
            else {
                ns--;
            }
        }
    }
    reverse(LCS.begin(), LCS.end());
    return LCS;
}

int32_t main() {
    IOS;
    memset(dp, -1, sizeof(dp));
    cin >> s >> t;
    //
    ns = s.length() - 1; nt = t.length() - 1;
    Top_Down(ns, nt);
    //
    cout << print_LCS() << endl;
}

Measured memory_bytes: 70912
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int a[10];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    FOR(i,1,5) cin >> a[i];
    FOR(i,1,5)
        if (a[i] == 0) {
            cout << i;
            return 0;
        }
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1e9 + 7

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

    int n;

    cin >> n;

    vector<int> a(n),b(n);

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

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

    int me = a[n/2-1];

    for(int i = 0;i < n;i++)
    {
        if(b[i]<=me) cout << a[n/2] << endl;
        else cout << me << endl;
    }
}


Measured memory_bytes: 3840
package main

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

func readLine(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func strToInts(s string) []int {
	var ints []int
	for _, str := range strings.Split(s, " ") {
		i, _ := strconv.Atoi(str)
		ints = append(ints, i)
	}
	return ints
}

func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	r := a % b
	for r != 0 {
		a, b = b, r
		r = a % b
	}
	return b
}

func reverse(is []int) []int {
	var res []int
	for i := len(is) - 1; i >= 0; i-- {
		res = append(res, is[i])
	}
	return res
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, 10000)
	sc.Buffer(buf, 10000000)

	as := strToInts(readLine(sc))

	var ls []int
	ls = append(ls, 0)
	for i, a := range as {
		ls = append(ls, gcd(ls[i], a))
	}

	var rs []int
	rs = append(rs, 0)
	for i, a := range reverse(as) {
		rs = append(rs, gcd(rs[i], a))
	}
	rs = reverse(rs)

	var res int
	for i := 0; i < n; i++ {
		res = max(res, gcd(ls[i], rs[i+1]))
	}
	fmt.Println(res)
}


Measured memory_bytes: 11008
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string O,E;
  cin >> O >> E;
 
  for(int i=0;i<O.size();i++)
  {
    cout << O.at(i);
    if(i<E.size())
    {
      cout << E.at(i);
    }
  }
    
}
    


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

int main()
{
	ll x;
	cin>>x;
	if(x==2)
	{
		cout<<2;
		return 0;
	}
	else
	{
		for(ll i=x;i<=10000000;i++)
	{
		ll temp=0;
		if(i%2==0)
		{
			temp++;
		}
		for(ll j=3;j<=sqrt(x);j+=2)
		{
			if(i%j==0)
			{
				temp++;
			}
		}
		if(temp==0)
		{
			cout<<i;
			break;
		}
	}
	}
	
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import itertools


def main():
    N = int(input())
    S = [input() for i in range(N)]
    S_cnt = [0]*5
    E = ["M", "A", "R", "C", "H"]
    for s in S:
        for i in range(5):
            if s[0] ==E[i]:
                S_cnt[i] += 1
    E_list = list(itertools.combinations(E, 3))
    tmp = 1
    ans = 0
    for e in E_list:
        for i in range(3):
            for j in range(5):
                if e[i] == E[j]:
                    tmp *= S_cnt[j]
        ans += tmp
        tmp = 1
    print(ans)


if __name__ == "__main__":
    main()


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

int main(){
	vector < int > pos; static int arr[200003] , val[200003] = {} , N;
	cin >> N;
	for(int i = 1 ; i <= N ; ++i) cin >> arr[i];
	for(int i = N ; i ; --i){
		int sum = 0;
		for(int j = 2 * i ; j <= N ; j += i)
			sum += val[j];
		sum = (sum % 2) ^ arr[i];
		if(sum){
			val[i] = 1; pos.push_back(i);
		}
	}
	reverse(pos.begin() , pos.end());
	cout << pos.size() << endl;
	for(int i = 0 ; i < pos.size() ; ++i) cout << pos[i] << ' ';
	return 0;
}


Measured memory_bytes: 2936
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int maxn=0x7fffff;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9')if(ch=='-')f=-f,ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
string c[100001];
int main(){
	int n,m,i,j;
	cin>>n>>m;
	for(i=1;i<=n;i++){
		cin>>c[i];
	}
	for(i=1;i<=m+2;i++){
		cout<<'#';
	}
	cout<<endl;
	for(i=1;i<=n;i++){
		cout<<"#";
		cout<<c[i];
		cout<<"#"<<endl;
	}
	for(i=1;i<=m+2;i++){
		cout<<'#';
	}
	return 0;
}



Measured memory_bytes: 1024
N = input()
a = []
for i in range(N):
	a.append(input())
a.sort()
if(N % 2 == 1):
	print((sum(a[N/2+1:])-sum(a[:N/2]))*2-min([a[N/2]-a[N/2-1],a[N/2+1]-a[N/2]]))
else:
	print((sum(a[N/2:])-sum(a[:N/2]))*2-(a[N/2]-a[N/2-1]))

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

void sort_atoz(vector<int> &v){
  int i,j,tmp;
  for(i = 0 ; i < v.size() - 1 ; i++){
    for(j = 0 ; j < v.size() - 1 ; j ++){
      
      if( v.at( j + 1 ) < v.at(j) ){
        tmp = v.at( j + 1 );
        v.at( j + 1 ) = v.at(j);
        v.at(j) = tmp;
      }
      
    }
  }
}

int main(){
  int n;
  cin >> n;
  vector<int> input(n),tmp(n),mochi(0);
  
  int i;
  for(i = 0 ; i < n ; i++)	cin >> input.at(i);
  
  tmp = input;
  sort_atoz(tmp);
  
  for(i = 0 ; i < n ; i++){
    mochi.push_back( tmp.at( tmp.size() - 1 ) );
    if( mochi.size() > 1 && mochi.at( mochi.size() - 1 ) == mochi.at( mochi.size() - 2 ) )	mochi.pop_back();
    tmp.pop_back();
  }
  
  cout << mochi.size() << endl;
  
}

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

int main() {
    int n;
    double x,ans=0;
    string u;
    cin >> n;
    rep(i,n){
        cin >> x >> u;
        if (u=="JPY") ans += x;
        else ans += x*380000;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3800
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string s;
	cin >> s;
	for (char c = 'a'; c <= 'z'; c++) {
		if (s.find(c) == string::npos) {
			cout << c << endl;
			return 0;
		}
	}
	cout << "None" << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define MOD 1000000007
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define alla(a,n) a, a + n
using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<string> vs;
using namespace std;

int n,x,t;
int main() {
    //freopen("input.txt", "r", stdin) ;
    //freopen("output.txt", "w", stdout) ;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL) ;
    cin>>n>>x>>t;
    if(n%x==0) cout<<(n/x)*t;
    else cout<<((n/x)*t)+t;
    return 0;
}




Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int n,t,s,i,a[10001];
bool cmp(int x,int y){
	return x>y;
}
int main(){
	cin>>n>>t;
	for(i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+1+n,cmp);
	for(i=1;i<=t;i++){
		s+=a[i];
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>

using namespace std;

int main()
{ 
    using i64 = int64_t;
    
    const i64 mod = 1000000000 + 7;

    i64 n, m, k;
    
    cin >> n >> m >> k;
    
    vector<i64> inv(n * m + 1);
    vector<i64> fact(n * m + 1);
    vector<i64> fact_inv(n * m + 1);

    for (i64 i = 1; i < n * m + 1; i++) {
        inv[i] = (i == 1) ? 1 : (mod - (mod / i) * inv[mod % i] % mod);
    }

    fact[0] = 1;
    fact_inv[0] = 1;

    for(int i = 1; i < n * m + 1; ++i) {
        fact[i] = fact[i - 1] * i % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }

    auto comb = [&](int n, int k) {
        if (n < 0 || n < k) {
            return i64(0);
        }

        return fact[n] * fact_inv[n - k] % mod * fact_inv[k] % mod;
    };
    
    i64 ans = 0;
    
    i64 c = comb(n * m - 2, k - 2);
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            
            ans += ((m - j - 1) * (m - j) / 2) % mod * c % mod * n % mod;
            ans %= mod;
            ans += ((n - i - 1) * (n - i) / 2) % mod * c % mod * m % mod;
            ans %= mod;
        }
    }
    
    cout << ans << endl;
}


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

int main(){

  ll x;
  cin >> x;
  ll cnt  = 0;

  if (x >= 11) {
    cnt = (x/11)*2;
    x %= 11;
  }
  if ( 6 < x ) {
    cnt++;
    x -= 6;
  }

  if ( 0 < x && x <= 6 ) {
    cnt++;
    x = 0;
  }

  cout << cnt << endl;



}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iomanip>
int main()
{
    long N;
    double A[100];
    std::cin >> N;
    for(long i=0; i<N; i++){
        std::cin >> A[i];
    }
    double sum=0;
    for(long i=0; i<N; i++){
        sum+=(double)1.0/A[i];
    }
    sum=(double)1.0/sum;
    std::cout << std::setprecision(9) << sum << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm> 
#include <iostream>
using namespace std;
int a[200],b[200];
int n,ans;
string s;
int main(){
	while(cin >> n >> s){
		ans = 0;
		memset(a,0,sizeof(a));
		for (int i = 0;i < n;i++){
			a[s[i]] = 1;
			memset(b,0,sizeof(b));
			for (int j = i+1;j < n;j++){
				b[s[j]] = 1;
			}
			int num = 0;
			for (int k = 'a';k <= 'z';k++){
				if (a[k] & b[k]) num++;
			}
			ans = max(ans,num);
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
//nCr mod m
#define MOD 1000000007
#define M 1000000
vector<ll> fact;
bool h=false;
void init(){
	h=true;
	fact=vector<ll>(M);
	fact[0]=fact[1]=1;
	loop(i,2,M)fact[i]=fact[i-1]*i%MOD;
}
// a^b mod MOD
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
//nCr
ll nCr(ll n,ll r,ll m=MOD){
	if(!h)init();
	if(n<0||r<0||n<r)return 1;//??????
	ll out=fact[n]*powmod(fact[r]*fact[n-r]%m,m-2,m)%m;
	return out;
}
signed main(){
	int n,x,y;
	cin>>n>>x>>y;
	vvi in(n,vi(2));
	rep(i,n)rep(j,2)cin>>in[i][j];
	
	vi used(200100);
	rep(i,n)used[in[i][0]]=1;
	int t=0;
	rep(i,200100)if(used[i])used[i]=t++;
	vvi G(t);
	rep(i,n)G[used[in[i][0]]].pb(in[i][1]);

	rep(i,t)sort(all(G[i]));
	sort(all(G));
	
	// show2d(G);
	vi co(t);
	rep(i,t){
		int w=G[0][0];
		if(t-1&&i==0)w=G[1][0];
		if(w+G[i][0]<=y)co[i]=max(
			upper_bound(all(G[i]),y-w)-G[i].begin(),
			upper_bound(all(G[i]),x-G[i][0])-G[i].begin()
		);
	}
	int sum=0,out=1;
	rep(i,t)sum+=co[i];
	rep(i,t)(out*=nCr(sum,co[i]))%=MOD,sum-=co[i];
	cout<<out<<endl;
}

















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

int main() {
	int a,b,c,d;
	cin>>a>>b>>c;
	int q=min(b,c);
	int p=max(b,c);
//	cout<<p<<" "<<q<<endl;
	if(p<=q+a && p>=q) cout<<0;
	else cout<<p-q-a;
	cout<<endl;
}

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define IOS             ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define read            freopen("in.txt","r",stdin)
#define write           freopen("out.txt","w",stdout)
#define loop(i,a,b)     for (ll i = a; i <= b; i++)
#define rloop(i,a,b)    for (ll i = a; i >= b; i--)
#define ms(a,x)         memset(a,x,sizeof a)
#define ll              long long int
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rall(a)         a.rbegin(),a.rend()
#define pb              push_back
#define nl              cout<<"\n"
#define gcd(a,b)        __gcd((a),(b))
#define lcm(a,b)        ((a)*(b))/(gcd(a,b))
#define sq(a)           (a)*(a)
#define sz(a)           a.size()
#define mod             1000000007
#define PI              (2*acos(0.0))

set<ll> factor(ll n)
{
    set<ll> s;
    while (n%2 == 0)
    {
        s.insert(2);
        n = n/2;
    }

    // n must be odd at this point.  So we can skip
    // one element (Note i = i +2)
    for (ll i = 3; i <= sqrt(n); i = i+2)
    {
        // While i divides n, print i and divide n
        while (n%i == 0)
        {
            s.insert(i);
            n = n/i;
        }
    }

    // This condition is to handle the case when n
    // is a prime number greater than 2
    if (n > 2)
        s.insert(n);
    return s;
}
int main()
{
    IOS
    int T=1;
    //cin>>T;
    while(T--)
    {
        ll n,x;
        cin>>n>>x;
        set<ll> s=factor(gcd(n,x));
        cout<<sz(s)+1;

    }
    return 0;
}


Measured memory_bytes: 3652
//#pragma GCC optimize "trapv"
//-D_GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define ii pair<int,int>
#define Max 100000+5
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f first
#define s second
#define pb push_back
int mod = 1000000007;
int mod1 = 998244353;
vector<int> g[Max];
bool vis[Max];
int d, x, y;
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
void ex(int A, int B) {
    if(B == 0) {
        d = A;
        x = 1;
        y = 0;
    }
    else {
        ex(B, A%B);
        int temp = x;
        x = y;
        y = temp - (A/B)*y;
    }
}


void dfs(int u){

	vis[u]=1;
	for(int i=0;i<g[u].size();i++){
		int v=g[u][i];
		if(vis[v]!=1)
			dfs(v);
	}
}



int power(int a,int b){
    if(b==1)return a;
    if(a>mod)a%=mod;
    int r=1;
    while(b){
        if(b&1)r=r%mod*a%mod;
        a=a%mod*a%mod;
        b/=2;
    }
    return r;
}
class uf{
    vector<int> v;
    vector<int> sz;
    
    
    public :
    uf(int n){
        v.resize(n+1);
        iota(v.begin()+1,v.end(),1);
        sz.resize(n+1,1);
        //1 to sz
    }
    int root(int b){
        while(v[b]!=b){
            b = v[b];
        }   
        return b;
    }
    void u(int a, int b){
        //combine a and b
        
        int ra=root(a);
        int rb=root(b);
        if(ra==rb)return ;
        if(sz[ra]<sz[rb]){
            v[ra] = v[rb];
            sz[rb]+=sz[ra];
        }else{
            v[rb]=v[ra];
            sz[ra]+=sz[rb];
        }
    }
    bool f(int a,int b){
        //same set
        return (root(a)==root(b));
    }
   
    
};
vector<int> matmul(vector<int> a,vector<int> b){
    vector<int> c(4,0);
    c[0] = (a[0]%mod*b[0]%mod + a[1]%mod*b[2]%mod)%mod;
    c[1] = (a[0]%mod*b[1]%mod + a[1]%mod*b[3]%mod)%mod;
    c[2] = (a[2]%mod*b[0]%mod + a[3]%mod*b[2]%mod)%mod;
    c[3] = (a[2]%mod*b[1]%mod + a[3]%mod*b[3]%mod)%mod;
    return c;
}
vector<int> id={1,0,0,1};

int32_t main(){
	IO
	//freopen("input.txt","r",stdin);
    	//freopen("output.txt","w",stdout);
	int n;
  	cin>>n;
  	vector<int> v(n);
  	for(int i=0;i<n;i++)cin>>v[i];
  	sort(all(v));
  	cout<<v[n/2]-v[n/2-1];
}


Measured memory_bytes: 6304
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int64_t Cost(const vector<int64_t> &vec, bool positive_sum)
{
    int64_t cost = 0;
    int64_t sum = 0;

    for (const auto &num : vec) {
        sum += num;
        if (sum >= 0 && !positive_sum) {
            cost += sum + 1;
            sum = -1;
        } else if (sum <= 0 && positive_sum) {
            cost += 1 - sum;
            sum = 1;
        }
        positive_sum = !positive_sum;
    }
    return cost;
}

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

    vector<int64_t> vec(n);
    for (auto &num : vec) {
        cin >> num;
    }

    auto res = min(Cost(vec, true), Cost(vec, false));
    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int a,b,c,d,ans;
	cin>>a>>b>>c>>d;
	vector<long long int>v;
	v.push_back(a*c);
	v.push_back(a*d);
	v.push_back(b*c);
	v.push_back(b*d);
	sort(v.begin(),v.end());
	cout<<v[3];
	return 0;
}

Measured memory_bytes: 3636
N = int(input())
*A, = map(int, input().split())

l = 0
r = 0
ans = 0
x = 0
for l in range(N):
    while r < N and x & A[r] == 0:
        x ^= A[r]
        r += 1

    ans += r-l

    if l == r:
        r += 1
        x = 0
    else:
        x ^= A[l]
print(ans)


Measured memory_bytes: 32016
s = input()
k = int(input())
n = len(s)

s = list(s)
ans = []
for i in range(n + 1):
    for j in range(i + 1, min(i + 1 + k, n + 1)):
        ans.append(str(''.join(s[i:j])))

ans = sorted(list(set(ans)))
print(ans[k - 1])


Measured memory_bytes: 5084
#include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;

int main()
{
  int n, m, p[1000];
  while(cin >> n >> m, n) {
    for(int i = 0; i < n; i++) {
      cin >> p[i];
    }
    sort(p, p + n);
    int ret = accumulate(p, p + n, 0);
    for(int i = n - m; i >= 0; i -= m) {
      ret -= p[i];
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 1176
# include <bits/stdc++.h>
# define lli long long int
# define pb push_back
# define pf pop_front()
# define loop(i,a,b) for(int i=a;i<b;i++)
# define loopl(i,a,b) for(lli i=a;i<b;i++)
# define lb lower_bound
# define ub upper_bound
# define INF 1000000000
# define mod 1000000007

using namespace std ;

int gcd(int a, int b)
{
    if (a == 0)   return b;
    if(b==0)      return a;
    if (a == b)   return a;
    if (a > b)    return gcd(a%b, b);
    return gcd(a, b%a);
}
int main()
{
   ios::sync_with_stdio(0);
   cin.tie(0);
   
   lli a,b;
   cin>>a>>b;
   
   if(a<=8 && b<=8) cout<<"Yay!";
   else cout<<":(";   
    
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
 
int main(){
  auto a = std::vector<int>{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  std::cin >> K;
  std::cout << a[K-1] << std::endl;
  
  return 0;
}
    

Measured memory_bytes: 256
from collections import defaultdict
p = 2019
s = input()
n = len(s)
dd = defaultdict(int)
digits = 0
remainder = 0
for i in reversed(range(n)):
    x = (remainder+int(s[i])*pow(10, digits, p)) % p
    dd[x] += 1
    remainder = x
    digits += 1
ans = 0
for k, v in dd.items():
    if k == 0:
        ans += v
    ans += v*(v-1)//2
print(ans)

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vdbl;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define IREP(i, v) for (auto i = v.begin(); i != v.end(); i++)
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes()
{
    cout << "Yes" << endl;
}
void no()
{
    cout << "No" << endl;
}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x ;
    cin >> x ;
    ll ans = 0 ;
    ll a = 100 ;
    while(1){
        if(a>=x){
            cout << ans <<endl ;
            return 0 ;
        }
        a *= 1.01 ;
        ans++ ;
    }
    

    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, flg = 0;
  string s[100];

  cin >> n;
  for(int i = 0; i < n; i++)
  {
      cin >> s[i];
      if(s[i] == "Y")
      {
          flg = 1;
          break;
      }
  }

  if(flg == 0)
  {
      cout << "Three" << endl;
  }
  else if(flg == 1)
  {
      cout << "Four" << endl;
  }
  
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

Int calc(Int M) {
	Int ans = 1;
	while (M) {
		ans *= M;
		ans %= MOD;
		M--;
	}
	return ans;

}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N, M;
	cin >> N >> M;

	Int ans = 0;
	if (N == M) {
		ans = 2 * calc(M) * calc(M) % MOD;
	}
	else if (abs(M - N) == 1) {
		ans = calc(M) * calc(N) % MOD;
	}

	cout << ans << "\n";
}

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

int main() {
  int n;
  double x1, y1, x2, y2, x3, y3;
  double a1, b1, c1, a2, b2, c2;
  double x, y, r;
  cin >> n;
  while (n--) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    a1 = x2-x1;
    b1 = y2-y1;
    c1 = -a1*(x1+x2)*0.5 - b1*(y1+y2)*0.5;
    
    a2 = x3-x2;
    b2 = y3-y2;
    c2 = -a2*(x2+x3)*0.5 - b2*(y2+y3)*0.5;

    y = (a2*c1-a1*c2)/(a1*b2-a2*b1);
    if (a1) {
      x = -(b1*y+c1)/a1;
    } else {
      x = -(b2*y+c2)/a2;
    }
    r = sqrt((x1-x)*(x1-x) + (y1-y)*(y1-y));

    cout.setf(ios::fixed);
    cout.precision(3);
    cout << x << " " << y << " " << r << endl;
  }
}

Measured memory_bytes: 1288
#include<bits/stdc++.h>
using namespace std;
int main(int argc, const char** argv) {
    int N,K,i,k;
    cin>>N>>K;
    int H[N];
    for(i=0;i<N;i++)
        cin>>H[i];
    int ans[N];
    ans[0] = 0;
    ans[1] = abs(H[1]-H[0]);
    for(i=2;i<N;i++){
        int j = min(i,K);
        int temp = INT_MAX;
        for(k=1;k<=j;k++)
            temp = min(temp,ans[i-k]+abs(H[i]-H[i-k]));
        ans[i] = temp;
    }
    cout<<ans[N-1];
    return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#include "string"
#define int long long
#define pi pair <int, int>
#define ff first
#define ss second
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define endl '\n'

int32_t main() {
	boost;
	int n;
	cin >> n;
	vector < pi > a(n);
	vector < int > plus,mis;
	for(auto &i :a){
		cin >> i.ff >> i.ss;
		plus.push_back(i.ff + i.ss);
		mis.push_back(i.ff - i.ss);
	}
	sort(plus.begin(), plus.end());
	sort(mis.begin(),mis.end());
	int ans = 0;
	ans = max(ans , plus.back() - plus[0]);
	ans = max(ans, mis.back() - mis[0]);
	cout << ans << endl;
}

Measured memory_bytes: 9816
#include <bits/stdc++.h>
#include <random>
#include <ctime>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2")
#define ll long long
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define pll pair<ll,ll>
#define ld double
#define pld pair<ld,ld>
#define pii pair<int,int>
#define sqr(a) ((a)*(a))
#define all(v) v.begin(),v.end()

using namespace std;
//using namespace __gnu_pbds;

ll MOD = 998244353;
const ll INF = 1e18;
const ld E = 1e-18;
const ld PI=acos(-1);
mt19937_64 rnd(time(0));
ll p1 = 31, p2 = 37, p3 = 7, p4 = rnd() % 100 + 1, md1 = MOD, md2 = 998244353, md3 = 998244357, md4 = rnd() % 1000000000;

//using ord_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

ll n, m, T;
vector<ll> c[100001];
bool tt[100001];
vector<ll> v;

ll binpow(ll h, ll r, ll md = MOD)
{
    ll l = 1;
    while (r)
    {
        if (r & 1) l *= h;
        h *= h;
        //h %= md;
        r /= 2;
    }
    return l;
}

ll gcd(ll x, ll y)
{
    if (x < y) swap(x, y);
    while (x && y)
    {
        x %= y;
        swap(x, y);
    }
    return x + y;
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //freopen("capitals.in","r",stdin);
    //freopen("capitals.out","w",stdout);
    //ios::sync_with_stdio(0);
    //cin.tie(0);
    ll l, r, n;
    cin >> l >> r >> n;
    cout << r/n-(l-1)/n;
    return 0;
}

/*
3
4 2
1 1
1 0
3 2
2 2

3 1
1 1
1 0
3 2

3 2
1 1
1 0
3 2
*/


Measured memory_bytes: 5988
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t = sc.nextInt();
		List<Integer> array = new ArrayList<>();
		long count = 0;
		for (int i = 0; i < n; i++) {
			int temp = sc.nextInt();
			array.add(temp);
			if (i != 0 && temp - array.get(i - 1) >= t) {
				count += t;
			} else if (i != 0) {
				int sa = temp - array.get(i - 1);
				count += sa;
			}
			
		}
		
		System.out.println(count+t);

	}
}


Measured memory_bytes: 91776
my ($h,$w)=+<<get.words;
my@s=lines>>.comb>>.List;
for (^$h) ->$i {
	say |map {@s[$i][$_]eq'.'??+grep {$h>.[0]>=0&&$w>.[1]>=0&&@s[.[0]][.[1]]eq'#'},
		($i-1,$_-1),($i-1,$_),($i-1,$_+1),($i,$_-1),($i,$_+1),($i+1,$_-1),($i+1,$_),($i+1,$_+1)!!'#'},^$w
}

Measured memory_bytes: 79028
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using T = tuple<ll,ll,ll>;
using Map = map<char,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

int main(){
    string sa;
    cin >> sa;
    string sb;
    cin >> sb;
    string sc;
    cin >> sc;
    char next='a';
    char ans;
    while(1){
        if(next=='a'){
            if(!sa.size()){ans='A';break;}
            next=sa[0];
            if(sa.size()>1)
            sa=sa.substr(1);
            else sa="";
        }
        else if(next=='b'){
            if(!sb.size()){ans='B';break;}
            next=sb[0];
            if(sb.size()>1)
            sb=sb.substr(1);
            else sb="";
        }
        else if(next=='c'){
            if(!sc.size()){ans='C';break;}
            next=sc[0];
            if(sc.size()>1)
            sc=sc.substr(1);
            else sc="";
        }

    }
    cout<<ans<<endl;

    
return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
count = {}
ans = 0
for i in a:
    if i not in count:
        count[i] = 1
    else:
        count[i] += 1
for i,c in count.items():
    if i > c:
        ans += c
    elif i < c:
        ans += c - i
print(ans)


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

int main(int argc, char const *argv[])
{
    int n,q;cin>>n>>q;
    string s;
    cin>>s  ;
    vector<int> l(q);
    vector<int> r(q);
    for(int i=0;i<q;++i){
        cin>>l[i]>>r[i];
    }
    vector<int> v(n);
    v[0]=0;
    for(int i=1;i<n;++i){
        if(s[i]=='C' && s[i-1]=='A')v[i]=v[i-1]+1;
        else v[i]=v[i-1];
    }
    // for(int vi:v)cout<<vi<<endl;
    for(int i=0;i<q;++i){
        cout<<v[r[i]-1]-v[l[i]-1]<< endl;
    }
    return 0;
}


Measured memory_bytes: 2176
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A: Entrance Examination
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int t, x;
  scanf("%d%d", &t, &x);
  printf("%.10lf\n", (double)t / x);
  return 0;
}


Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
ll dp[23][1LL<<22] = {};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll a[25][25];
    rep(i,0,N){
        rep(j,0,N){
            cin >> a[i][j];
        }
    }

    dp[0][0] = 1;
    rep(i,0,N){
        rep(bit,0,(1LL<<N)){
            ll cnt = __builtin_popcount(bit);
            if(cnt != i) continue;
            rep(j,0,N){
                if((bit>>j) & 1) continue;
                if(a[i][j] == 1){
                    dp[i+1][bit | (1LL<<j)] += dp[i][bit];
                    dp[i+1][bit | (1LL<<j)] %= MOD;
                }
            }
        }
    }
    print(dp[N][(1LL<<N)-1]);

    

}

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

int digits_sum(int n){
    int tmp = n;
    int ans = 0;
    while(tmp>0){
        ans += tmp % 10;
        tmp = tmp / 10;
    }
    return ans;
}

int main(){
    int n;
    cin >> n;
    int ans = 10000;

    for(int i=1;i<n/2+1;i++){
        int tmp = digits_sum(i) + digits_sum(n-i);
        if(tmp<ans){
            ans = tmp;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 764
import sys


if(__name__ == "__main__"):

    N = int( input().strip() )
    results=[0]*4 #AC, WA, TLE, RE
    for i in range(N):
        result = input().strip()
        if(result=="AC"):
            results[0] += 1
        elif(result=="WA"):
            results[1] += 1
        elif(result=="TLE"):
            results[2] += 1
        else:
            results[3] += 1
    Str = "AC x " + str(results[0])
    print(Str)

    Str = "WA x " + str(results[1])
    print(Str)

    Str = "TLE x " + str(results[2])
    print(Str)

    Str = "RE x " + str(results[3])
    print(Str)


Measured memory_bytes: 9160
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
int main()
{
    int H, W;
    cin >> H >> W;

    char a[H][W];
    rep(i, H) {
        rep(j, W) {
            cin >> a[i][j];
        }
    }

    rep(i, H + 2) {
        rep(j, W + 2) {
            if (i == 0 || i == H + 1 || j == 0 || j == W + 1) cout << "#";
            else cout << a[i - 1][j - 1]; 
        }
        cout << 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;

int main()
{
    ll n, a[300000], ans = 0, count = 1;
    cin >> n;
    rep(i, n) cin >> a[i];
    rep(i, n)
    {
        if (a[i] == count)
        {
            count++;
        }
        else
        {
            ans++;
        }
    }
    if (ans == n)
        cout << -1 << endl;
    else
        cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5204
#include"bits/stdc++.h"
using namespace std;
 const int N=1e6+3;
 int f[N],g;
int main()
{

  #ifndef ONLINE_JUDGE
  freopen("in","r",stdin);
  freopen("out","w",stdout);
  #endif
  int n;
  cin>>n;
  for(int i=0;i<n;i++)
  { int x;
    cin>>x;f[x]++;
  }
  for(int i=0;i<N;i++)
  {
    if(f[i])g=__gcd(g,i);
  }
  if(g>1){cout<<"not coprime";return 0;}

  for(int i=2;i<N;i++)
  {
    int cur=0;
    for(int j=i;j<N;j+=i)
      if(f[j])cur++;
    if(cur>1){cout<<"setwise coprime";return 0;}
  }
  cout<<"pairwise coprime";

}

Measured memory_bytes: 7484
#include <iostream>

using namespace std;

int main() {
  int N, D1, D2, c{}, f{};
  cin >> N;
  while(cin >> D1 >> D2) {
    if (D1 == D2) ++c;
    else c = 0;
    if (c >= 3) {
      f = 1;
      break;
    }
  }
  cout << (f ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3592