akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
using namespace std;
#define int long long
string s,new_s;

signed main(){
	cin>>s>>new_s;
	int size=s.size();
	for(int i=0;i<size;i++){
		if(s[i]!=new_s[i]){cout<<"No"<<endl;return 0;
		}
	}cout<<"Yes"<<endl;
	}

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

int main() {
  int N;
  cin >> N;
  int i=1;
  string s;
  int flag=0;
  for(i;i<=N;i++){
    cin>>s;
    if(s=="Y"){
      flag=1;
      break;
    }
  }
  if(flag)
    cout<<"Four"<<endl;
  else
    cout<<"Three"<<endl;
}


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

using namespace std;

int N, a,b;

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin>>N;
	
	for(int i = 0; i < N; i++){
		cin>>b;
		a = __gcd(a,b);
		if(a==1)break;
	}
	
	cout<<a<<endl;
	
	return 0;
}

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

int main() {
    int n; cin >> n;
    vector<pair<double, double> > p(n);
    for (int i = 0; i < n; i++) {
        double pi; cin >> pi;
        p.at(i).first = pi;
        p.at(i).second = 1 - pi;
    }
    vector<vector<double> > dp(n+1, vector<double> (n+1, 0));
    dp.at(0).at(0) = 1;
    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            dp.at(i).at(j+1) += dp.at(i).at(j) * p.at(j).second;
            dp.at(i+1).at(j+1) += dp.at(i).at(j) * p.at(j).first;
        }
    }
    double ans = 0;
    for (int i = (n + 1) / 2; i <= n; i++) {
        ans += dp.at(i).at(n);
    } 
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{

    ll a,n,c=0;
    cin>>n;
    a=10;
    if(n & 1){
        cout<<0<<endl;
        return 0;
    }
    while(a<=n)
    {
        c+=n/a;
        a*=5;
    }
    cout<<c<<endl;

    return 0;
}


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

def num2alpha(num):
    if num<=26:
        return chr(96+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(122)
    else:
        return num2alpha(num//26)+chr(96+num%26)

def main():
    print(num2alpha(int(input())))

if __name__ == '__main__':
    main()

Measured memory_bytes: 9176
#include <limits>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <bitset>
#include <map>
#include <cstdint>
using namespace std;


int main(){
    int a,b;
    cin >> a >> b;
    
    int d = b - a;
    cout << (d*(d+1)/2 -b) << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main (){
int a,b;
int n;
cin >> a >> b >> n;
int s[200],t[200],x[2000];
x[a]=1;
x[b+1]=-1;
for(int i=1;i<=n;i++){
    cin >> s[i] >> t[i];
    x[s[i]]=1;
    if(a>=s[i]&&a<t[i]){
        cout << 1 << endl;
        return 0;
    }
}
for(int i=a+1;i<b;i++){
   
     if(x[i]==1){
        cout << 1 << endl;
        return 0;
    }
   
   
}
cout << 0 << endl;
    return 0;
}


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

template<typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}

signed main(){
  int a,b,c,k;cin>>a>>b>>c>>k;
  while(a>=b)b*=2,k--;
  while(b>=c)c*=2,k--;
  if(k>=0)fin("Yes");
  fin("No");
}


Measured memory_bytes: 3620
'''
全通り列挙して数える
'''

h,w,k = map(int, input().split())

c = []
cnt = 0
ans = 0

for i in range(h):
    c.append(str(input()))

for i in range(2**h):
    for j in range(2**w):
        cnt = 0
        for ib in range(h):
            for jb in range(w):
                #h,wどっちかフラグ経ったら無視する
                if (i>>ib)&1 or (j>>jb)&1:
                    pass
                elif c[ib][jb] == "#":
                    cnt += 1
        if cnt == k:
            ans += 1

print(ans)


Measured memory_bytes: 9248
n = int(input())
H = list(map(int,input().split()))

dp = [0]*(n+1)
dp[0]=0
dp[1]=abs(H[1]-H[0])
for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(H[i]-H[i-1]),dp[i-2]+abs(H[i]-H[i-2]))
print(dp[n-1])

Measured memory_bytes: 13908
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::collections::HashMap;
use std::collections::HashSet;
use std::cmp::max;
// use std::cmp::min;


fn main() {
    input! {
        N: usize,
    }

    let mut XYs: Vec<Vec<(usize, i64)>> = vec![Vec::new(); N];

    for n in 0..N {
        input! {
            A: usize,
            mut tmpXYs: [(usize, i64); A],
        }

        // 0-origin
        for tpl_ref in tmpXYs.iter_mut() {
            tpl_ref.0 -= 1;
        }

        XYs[n].extend_from_slice(&tmpXYs);
    }



    // N<=15なので、2^15のビット全探索でいけそう
    // 正直者である人たちの集合を全探索
    // https://qiita.com/Cassin01/items/246e795d0d9003c64d0f
    let mut ans = 0;
    for i in 0..1 << N {
        let mut cand = 0;

        // 正直者によって得られた証言セット
        let mut map: HashMap<usize, i64> = HashMap::new();

        let mut is_ok = true;
        // let mut honest_set: HashSet<usize> = HashSet::new();

        // 証言記録フェーズ
        for j in 0..N {
            if (1 << j) & i == 0 {
                cand += 1;
                // honest_set.insert(j);

                for &(x, y) in XYs[j].iter() {
                    match map.get(&x) {
                        Some(&val) => {
                            if val != y {
                                is_ok = false;
                                break;
                            }
                        }
                        None => {
                            map.insert(x, y);
                        }
                    }
                }
            }
        }

        if !is_ok {
            // eprintln!("NG ptn1: {:?}", honest_set);
            continue;
        }

        // 証言の中で言及された正直者/不親切が実際にそうなのか確認フェーズ
        for j in 0..N {
            let j_is_honest = (1 << j) & i == 0;
            let honest_val = if j_is_honest { 1 } else { 0 };

            match map.get(&j) {
                Some(&val) => {
                    if val == honest_val {
                        // ok
                    } else {
                        is_ok = false;
                    }
                }
                None => {
                    // ok
                }
            }
        }

        if is_ok {
            ans = max(ans, cand);
        } else {
            // eprintln!("NG ptn2: {:?}", honest_set);
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2208
#include <bits/stdc++.h>
using namespace std;
int main(){
   long N;
   long D;
   cin >> N >> D;
   int count = 0;
    long long x, y;
  for(int i = 0; i < N; i++){
      cin >> x >> y;
      if(hypot(x, y) <= D) count++;
  }
  cout << count << endl;

   return 0;
}

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

int main()
{
  int	n;
  string str;
  int x=0;
  int ans=x;
  cin>>n>>str;
  for(int i=0 ; i<n ; ++i)
  {
  	if(str[i]=='I')
    ++x;
    else if(str[i]=='D')
    --x;
    ans=max(x,ans);
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
  string s;
  cin>>s;
  int sum=0;
for(int i=0;i<s.size();i++){
    string c;
    c=s[i];
    int d=stoi(c);
    sum+=d;
}

if(sum%9==0){
    cout<<"Yes";
    
}
else{
    cout<<"No";
}
    return 0;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define ll long long int
using namespace std;
int main()
{
    ll a,b,c,n,x,y,z,cnt=0,sum=0;
    string str;
    cin>>str;
    cout<<str[0]<<str[1]<<str[2]<<endl;


}


Measured memory_bytes: 3596
s=input()
l=len(s)

res0=0
res1=0

for i in range(0,l,2):
	if s[i]=="0":
		res0+=1
	else:
		res1+=1
		
for i in range(1,l,2):
	if s[i]=="1":
		res0+=1
	else:
		res1+=1

print(min(res0,res1))	

Measured memory_bytes: 3188
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<ctime>
#include<list>
#include<deque>
#include<bitset>
#include<fstream>
#define ld double
#define ull unsigned long long 
#define ll long long 
#define pii pair<int,int >
#define iiii pair<int,pii >
#define mp make_pair 
#define INF 1000000000
#define MOD 1000000007 
#define MAXN 200
using namespace std;

int Dp[MAXN][MAXN],a[2][MAXN],n; 



int main()
{
	scanf("%d",&n);
	for (int i=0;i<2;i++)	
		for(int j=0;j<n;j++)scanf("%d",&a[i][j]);
	Dp[0][0]=a[0][0];
	
	for(int i=1;i<n;i++)Dp[0][i]=a[0][i]+Dp[0][i-1];
	
	Dp[1][0]=a[1][0]+a[0][0];
	for(int i=1;i<n;i++)Dp[1][i]=max(Dp[1][i-1],Dp[0][i])+a[1][i];
	
	printf("%d\n",Dp[1][n-1]);	
	

	return 0;	
} 

Measured memory_bytes: 256
N = int(input())

ai = input().split()

ai = list(map(int,ai))

ai.sort(reverse=True)

sum1 = 0;
sum2 = 0;

for i in range(N):
	if i%2 == 1:
		sum2+=ai[i]
	else:
		sum1 +=ai[i]

print(sum1-sum2) 

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

long long int N, A[200202];
vector<long long> top;

int main(){
    scanf("%lld", &N);
    for(int i = 0; i < N; ++i){
        scanf("%lld", A + i);
        if(i && (A[i] <= A[i - 1]) && (A[i - 1] > 0)){
            top.push_back(i - 1);
        }
        if(!i && A[i])return 0 & puts("-1");
        if(i && A[i] > A[i - 1] + 1)return 0 & puts("-1");
    }
    top.push_back(N - 1);
    for(auto i : top){
        A[200201] += A[i];
    }
    printf("%lld", A[200201]);
    return 0;
}

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

int main()
{
    int n,a,b,c,d;
    cin >> n;
    a = n / 1000;
    b = (n - a * 1000) / 100;
    c = (n - a * 1000 - b * 100) / 10;
    d = n - 1000 * a - 100*b - 10 * c;
    if((a==b&&b==c)||(b==c&&c==d)){
        cout << "Yes" << "\n";
    }else{
    cout << "No" << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
    	int m = scn.nextInt();
    	char[][] aa = new char[n][n];
    	char[][] bb = new char[m][m];
    	for(int i=0; i<n; i++){
      		String a = scn.next();
      		for(int j=0; j<n; j++){
        		aa[i][j]=a.charAt(j);
      		}
    	}
    	for(int i=0; i<m; i++){
      		String b = scn.next();
      		for(int j=0;j<m;j++){
        		bb[i][j]=b.charAt(j);
      		}
    	}
      	for(int i=0; i<n; i++){
      		for(int j=0; j<n; j++){
        		if(i+m>n || j+m>n){
          			break;
        		}
              	String ans = "Yes";
        		for(int k=0; k<m; k++){
          			for(int l=0; l<m; l++){
            			if(aa[i+k][j+l]!=bb[k][l]){
              				ans = "No";
              				break;
            			}
          			}
        		}
              	if(ans.equals("Yes")){
                  System.out.println(ans);
                  return;
                }
            }
      	}
    	System.out.println("No");
	}
}

Measured memory_bytes: 35808
/*
  GOOD is not Enough
  You've got to be GREAT.
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define pii pair<int,int>
#define dbg(x) cout << (#x) << " is " << (x) << '\n' 
#define F first
#define S second
#define sz(x) (int)(x).size()
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

void solve()
{
  int h1,h2,m1,m2,k;
  cin >> h1>>m1>>h2>>m2 >> k;
  m1=60*h1 + m1;
  if(h2==0)
    h2=24;
  m2=60*h2 + m2;
  int diff=m2-m1-k;
  if(diff<=0)
    diff=0;
  cout << diff << '\n';
    return;
} 

signed main()
{
  FAST
  int T=1;
//   cin >> T;
  while(T--)
  {
    solve();
  }
  return 0;
}

Measured memory_bytes: 3656
import sys
read=sys.stdin.buffer.readline

class BIT:
    def __init__(self,N):
        self.N=N
        self.bit=[0]*N
    def add(self,a,w):
        x=a
        while(x<self.N):
            self.bit[x]+=w
            x|=x+1
    def get(self,a):
        ret,x=0,a-1
        while(x>=0):
            ret+=self.bit[x]
            x=(x&(x+1))-1
        return ret
    def cum(self,l,r):
        return self.get(r)-self.get(l)

def main():
    def update(x,i):
        if good[x]==-1:
            good[x]=i
            bit.add(i,1)
        else:
            bit.add(good[x],-1)
            good[x]=i
            bit.add(good[x],1)
        return
    
    N,Q=map(int,read().split())
    c=tuple(map(int,read().split()))
    li=[list(map(lambda x:int(x)-1,read().split()))+[i] for i in range(Q)]
    Query=[(li[i][0],li[i][1],i) for i in range(Q)]
    Query.sort(key=lambda x:x[1])
    ans=[-1]*Q
    good=[-1]*(N+1)
    bit=BIT(N)

    i=0
    for L,R,w in Query:
        while(i<=R):
            update(c[i],i)
            i+=1
        ans[w]=bit.cum(L,R+1)

    print(*ans,sep='\n')
    return
    
if __name__=='__main__':
    main()


Measured memory_bytes: 267212
using System;
using System.Collections.Generic;
using System.Linq;
using static AtCoder.Io;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var x = ReadInt();

            var ans = 0;
            while (true)
            {
                if (ans * (ans + 1) / 2 >= x)
                {
                    Console.WriteLine($"{ans}");
                    break; ;
                }
                ans++;
            }
        }
    }

    public static class Io
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static long ReadLong() => long.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static long[] ReadLongArray() => ReadStringArray().ParseLong().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(int.Parse);
        public static IEnumerable<long> ParseLong(this IEnumerable<string> source) => source.Select(long.Parse);
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, k; cin >> n >> k;
	int ans = 0;
	for(; n; n /= k) ans++;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;
using namespace std;

#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (int i = (a); i < (b); i++)
#define rrrep(i, a, b) for (int i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define Cerr(x) cerr << (x) << endl
#define fi first
#define se second

ll n, cnt, ans = LINF, a, b, c, d, tmp, tmpp, m, h, w, x, y, sum, pos, k, l[ohara];
ld doua;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl;
struct edge
{
    int to, cost;
};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin >> n >> a >> b >> c;
    rep(i, n) cin >> l[i];
    for (int bit = 0; bit < (1 << 2 * n); bit++)
    {
        ll _a = 0, _b = 0, _c = 0, syn = 0;
        rep(i, n)
        {
            if (((bit >> (2 * i)) & 3) == 0)
                continue;
            if (((bit >> (2 * i)) & 3) == 1)
            {
                if (_a != 0)syn++;
                _a += l[i];
            }
            if (((bit >> (2 * i)) & 3) == 2)
            {
                if (_b != 0)syn++;
                _b += l[i];
            }
            if (((bit >> (2 * i)) & 3) == 3)
            {
                if (_c != 0)syn++;
                _c += l[i];
            }
        }
        if (_a == 0 || _b == 0 || _c == 0)continue;
        cnt = abs(a - _a) + abs(b - _b) + abs(c - _c) + syn * 10;
        ans = min(ans, cnt);
    }
    Cout(ans);
    return 0;
}


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

using namespace std;

#define INF 9999999999;
#define D(x) cout << x << endl;

typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;

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

  if (a == 1) {
    a = 14;
  }

  if (b == 1) {
    b = 14;
  }

  if (a == b) {
    cout << "Draw" << endl;
  } else { 
    cout << (a > b ? "Alice" : "Bob") << endl;
  }

  return 0;
}


Measured memory_bytes: 384
N = int(input())
H = list(map(int,input().split()))

def main():
    if N==2:
        print(abs(H[1] - H[0]))
        return

    costs = [0 for _ in range(N)]
    costs[1] = abs(H[1]-H[0])
    costs[2] = min(costs[0]+abs(H[1]-H[0]), abs(H[2]-H[0]))

    for i in range(2,N):
        cost_1 = abs(H[i] - H[i-1]) # 1段上る
        cost_2 = abs(H[i] - H[i-2]) # 2段上る
        costs[i] = min(costs[i-1] + cost_1, costs[i-2] + cost_2) 
    print(costs[-1])
    

if __name__ == "__main__":
    main()

Measured memory_bytes: 54588
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <deque> 

using namespace std;


struct Node
{
	int belongsTo;
	int pos;
	std::vector<int> connects;
};

int n, m;
Node nodes[100010];
int typeCount = 0;

void doFloodFill(int p)
{
	typeCount++;	
	
	std::queue<int> q;
	q.push(p);
	nodes[p].belongsTo = typeCount;
	
	int curP;
	
	while (!q.empty())
	{
		curP = q.front();
		q.pop();
		
		for (int i = 0 ; i < nodes[curP].connects.size() ; i++)
		{
			int newP = nodes[curP].connects[i];
			if (nodes[newP].belongsTo != -1)
				continue;
				
			nodes[newP].belongsTo = typeCount;
			q.push(newP);
		}
	}
}

int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 1 ; i <= n ; i++)
	{
		nodes[i].pos = i;		
		nodes[i].belongsTo = -1;		
	}
	
	int u, v, w;
	for (int i = 0 ; i < m ; i++)
	{
		scanf("%d%d%d", &u, &v, &w);
		nodes[u].connects.push_back(v);
		nodes[v].connects.push_back(u);
	}
	
	for (int i = 1 ; i <= n ; i++)
	{
		if (nodes[i].belongsTo != -1)
			continue;
			
		doFloodFill(i);
	}
	
	printf("%d\n", typeCount);
	
	return 0;
}



Measured memory_bytes: 7288
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X,Y,A,B,C = map(int,readline().split())
P = list(map(int,readline().split()))
Q = list(map(int,readline().split()))
R = list(map(int,readline().split()))
P = sorted(P,reverse=True)
Q = sorted(Q,reverse=True)
R = sorted(R,reverse=True)
P = P[:X]
Q = Q[:Y]
PQR = sorted(P+Q+R,reverse = True)
ans = sum(PQR[:X+Y])
print(ans)

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

typedef long long ll;
const ll INF = 1LL<<60, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(v) (v).begin(), (v).end()

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n;
  cin >> n;
  vector<string> s(n);
  vector<ll> p(n);
  vector<pair<pair<string,ll>, ll>> pa(n);
  rep(i,n){
    cin >> s[i] >> p[i];
    pa[i] = make_pair(make_pair(s[i],-p[i]),i);
  }
  sort(all(pa));
  rep(i,n){
    cout << pa[i].second+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
class Array
  def uniq?
    return true if size <= 1
    s = sort
    x = s[-1] 
    s.each do |a|
      return false if x == a
      x = a
    end
    return true
  end
end

n = gets.to_s.to_i
a = gets.to_s.split.map{|i|i.to_i}.sort

puts a.uniq? ? "YES" : "NO"

Measured memory_bytes: 20580
def count_fee_station(a, n_list):
    cost = 0
    for i in n_list:
        if i in a:
            cost += 1
    return cost


def main():
    n, m, x = map(int, input().split())
    a = list(map(int, input().split()))
    n_list_a = list(range(0, x + 1))
    n_list_b = list(range(x, n + 1))
    cost_a = count_fee_station(a, n_list_a)
    cost_b = count_fee_station(a, n_list_b)
    print(min(cost_a, cost_b))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9136
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
#define B 1
#define W 2
int N;
vector<int> G[100001];
int Order[100001];
int Order2[100001];
int Prev[100001];
int color[100001];
int cnt=0;
void dfs(int v,int p,int *order){
  order[v]=order[p]+1;
  Prev[v]=p;
  for(int i=0;i<G[v].size();i++){
    int u=G[v][i];
    if(u==p)continue;
    dfs(u,v,order);
  }
}

void paint(int v,int p,int c){
  color[v]=c;
  for(int i=0;i<G[v].size();i++){
    int u=G[v][i];
    if(u==p || (color[u]!=c && color[u]!=0))continue;
    paint(u,v,c);
  }
}
int main(){
  cin >> N;
  for(int i=0;i<N-1;i++){
    int s,t;
    cin >> s >> t;
    G[s].push_back(t);
    G[t].push_back(s);
  }

  for(int i=0;i<=N;i++){
    Order[i]=-1;
    Order2[i]=-1;
  }
  dfs(1,0,Order);
  dfs(N,0,Order2);

  vector<int> path;
  int t=1;
  while(1){
    if(t==0)break;
    path.push_back(t);
    t=Prev[t];
  }
  for(int i=0;i<path.size();i++){
    int v=path[i];
    if(Order[v]<=Order2[v])color[v]=B;
    else color[v]=W;
  }
 
  paint(1,0,B);
  paint(N,0,W);
  for(int i=1;i<=N;i++){
    if(color[i]==B)cnt++;
  }
  //for(int i=1;i<=N;i++)printf("%d ",color[i]);
  if(cnt>N-cnt)printf("Fennec\n");
  else printf("Snuke\n");
  return 0;
}


Measured memory_bytes: 14072
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

string lcs(string s,string t)
{
    int n = s.size(), m = t.size();
    int i,j,dp[n+1][m+1];
    for(i=0;i<=n;i++)
        dp[i][0]=0;
    for(j=0;j<=m;j++)
        dp[0][j]=0;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=m;j++)
        {
            if(s[i-1]==t[j-1])
            dp[i][j]=dp[i-1][j-1]+1;
            else
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    int l=dp[n][m];
    i=n;j=m;
    string S;
    while(l!=0)
    {
        if(dp[i][j]==dp[i-1][j])
            i--;
        else if(dp[i][j]==dp[i][j-1])
            j--;
        else
        {
            S+=s[i-1];
            i--;
            j--;
            l--;
        }
    }
    reverse(S.begin(),S.end());
    return S;
}

int main(void)
{
    int n;
    cin >> n;
    vector<string> S(n);
    for (int i = 0; i < n; i++) {
        cin >> S[i];
        SORT(S[i]);
    }
    string ans = S[0];
    Rep(i, 1, n){
        ans = lcs(ans, S[i]);
    }
    pr(ans);
}

Measured memory_bytes: 256
using System;
using System.Linq;

public class Program
{
	public static void Main()
	{
		int[] NAB = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int N = NAB[0], A = NAB[1], B = NAB[2];
		int[] X = Console.ReadLine().Split().Select(int.Parse).ToArray();
		long ans = 0;
		for (int i = 1; i < N; i++)
		{
			ans += Math.Min((long)(X[i] - X[i - 1]) * A, B);
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13400
s=gets.chomp
ss=gets.chomp
c=false
ci=nil
if s.length >= ss.length
  (s.length-ss.length).downto(0) do |i|
    c=true
    g = s[i..ss.length+i-1]
    ss.length.times do |j|
      if g[j] != ?? && g[j]!=ss[j]
        c=false
        break
      end
    end
    if c
      ci=i
      break
    end
  end
end
if c
  s.length.times do |i|
    if ci>i || i-ci>=ss.length
      s[i]=?a if s[i]==??
    else
      s[i]=ss[i-ci]
    end
  end
  puts s
else
  puts :UNRESTORABLE
end

Measured memory_bytes: 1788
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 1000000007
#define SIZE 10005
#define PI 	3.14159265358979323846

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; } //最大公倍数

ll input(){
  ll a;
  cin >> a;
  return a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    if((a+b)%2)cout << "IMPOSSIBLE"<< endl;
    else cout << (a+b)/2 << endl;
}


Measured memory_bytes: 256
n = gets.to_i
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
infr = [a,b,c,d,e]

mini = infr.min

if mini >= n
  steps = 5
else
  indx = infr.index(mini)
  steps = (n-1)/mini + 5
end

puts steps

Measured memory_bytes: 1788
n = gets.to_i

Pair = Struct.new(:val, :point)

a = Array.new(n).map{Pair.new(0,0)}
b = Array.new(n).map{Pair.new(0,0)}
for i in 0...n
    a[i].val, b[i].val = gets.split.map(&:to_i)
    a[i].point = a[i].val + b[i].val
    b[i].point = a[i].val + b[i].val
end

a = a.sort do |x, y|
    x.point <=> y.point
end

b = b.sort do |x, y|
    x.point <=> y.point
end

a.reverse!
b.reverse!

suma = 0
sumb = 0
for i in 0...n
    if i % 2 == 0
        suma += a[i].val
    else
        sumb += b[i].val
    end
end

puts suma - sumb

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

int main() {
  string a,b="No";
  cin>>a;
  if(a[0]==a[1]&&a[2]==a[3]&&a[0]!=a[2])
    b="Yes";
  else if(a[0]==a[2]&&a[1]==a[3]&&a[0]!=a[1])
    b="Yes";
  else if(a[0]==a[3]&&a[1]==a[2]&&a[0]!=a[1])
    b="Yes";
  cout<<b;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N=int(input())

EDGE=[[1]*(N+1) for i in range(N+1)]
for i in range(N+1):
    EDGE[i][i]=0
    EDGE[0][i]=EDGE[i][0]=0

SUM=[N*(N+1)//2]
for i in range(N):
    SUM.append(SUM[-1]-1)

SUM[0]=0

if N%2==0:
    ANSSUM=N*(N+1)//2-1-N
else:
    ANSSUM=N*(N+1)//2-1-(N-1)

#print(ANSSUM)

for i in range(1,N+1):
    x=SUM[i]-ANSSUM
    EDGE[i][x]=EDGE[x][i]=0

ANS=[]
ANSCOUNT=0
for i in range(1,N+1):
    for j in range(1,N+1):
        if EDGE[i][j]==1:
            ANS.append([i,j])
            ANSCOUNT+=1
            EDGE[i][j]=EDGE[j][i]=0

print(ANSCOUNT)
for ans in ANS:
    print(*ans)
    


Measured memory_bytes: 45552
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;

int main(){
    int N,K;
    string S;

    cin >> N >> K >> S;
    S[K - 1] = S[K - 1] - 'A' + 'a';
    cout << S << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make(map[int]int)
	var curr int
	for i := 1; i <= n; i++ {
		fmt.Scan(&curr)
		a[i] = curr
	}

	// find if they like
	likes := 0
	for i := 1; i <= n; i++ {
		j := a[i]
		if a[j] == i {
			likes++   // opponnent likes each other
			a[j] = -1 // set as seen
		}
	}
	fmt.Println(likes)
}


Measured memory_bytes: 7936
#include<bits/stdc++.h>
using namespace std;
 
int main(void){
  int a,b,c;
  cin>>a>>b>>c;
  if((a==b)&&(b!=c)){cout<<"Yes";}
  else if((a!=b)&&(b==c)){cout<<"Yes";}
  else if((a==c)&&(c!=b)){cout<<"Yes";}
  else cout<<"No";
} 

Measured memory_bytes: 256
def chmin(a, b) a < b ? a : b end

N = gets.strip.to_i
A = gets.strip.split.map(&:to_i)

if N > 2
  res = 10 ** 6
  (1..(N - 2)).each do |i|
    sum = (A[0..i].inject(:+) - A[(i + 1)..-1].inject(:+)).abs
    res = chmin(sum, res)
  end
  puts res
else
  puts (A.first - A.last).abs
end



Measured memory_bytes: 1788
import math
N,K=[int(h) for h in input().split()]


ans=0

for i in range(1,N+1):
  if i>=K:
    ans+=1/N
  else:
    m=math.ceil(math.log2(K/i))
    ans+=1/N*pow(2,-m)  #N*2^m>=K m>=log2(K/N)

print(ans)

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
String line = br.readLine();
int x=Integer. parseInt(line);
int y=0;

for(int i=1;i<x+1;i++){
y=y+i;
}
System. out. println(y);
}}
		

Measured memory_bytes: 20564
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename F>
struct FixPoint : F{
  FixPoint(F&& f):F(forward<F>(f)){}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const{
    return F::operator()(*this,forward<Args>(args)...);
  }
};
template<typename F>
inline decltype(auto) MFP(F&& f){
  return FixPoint<F>{forward<F>(f)};
}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> as(n);
  for(Int i=0;i<n;i++) cin>>as[i];

  if(n==2){
    cout<<as[0]+as[1]<<endl;
    return 0;
  }

  const Int INF = 1e18;
  auto T=[&](Int l,Int r,Int x,Int y){
           Int res=l*100+r;
           res=res*1000000+x;
           res=res*1000000+y;
           return res;
         };

  map<Int, Int> dp;
  // [l, r]
  MFP([&](auto dfs,Int l,Int r,Int x,Int y)->Int{
        if(r-l<=1) return 0;
        if(dp.count(T(l,r,x,y))) return dp[T(l,r,x,y)];
        Int &res=dp[T(l,r,x,y)];
        res=INF;
        for(Int m=l+1;m<r;m++)
          chmin(res,dfs(l,m,x,x+y)+dfs(m,r,x+y,y)+as[m]*(x+y));
        if(l==0&&r==n-1) cout<<res+as[l]+as[r]<<endl;
        return res;
      })(0,n-1,1,1);

  return 0;
}


Measured memory_bytes: 16572
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    string s; cin >> s;
    int sl = s.size();
    ll ans = 0;
    bool keta = false;
    for(int i = sl-1; i >= 0; i--) {
        int d = s[i] - '0';
        if (keta) d++;
        keta = false;
        if (d > 5 || (d == 5 && i > 0 && s[i-1] - '0' > 4) ) {
            ans += 10 - d;
            keta = true;
        }
        else ans += d;
    }
    if (keta) ans++;

    cout << ans << '\n';

    return 0;
}

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

int main() {
  int N,K;
  cin >> N >> K;
  int num = 1;
  for(int i=0; i<N; i++){
    if(num*2 <= num+K){
      num *= 2;
    }else{
      num += K;
    }
  }
  cout << num << endl;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import math,string,itertools,fractions,heapq,collections,re,array,bisect

def s():
    return raw_input().strip()
def n():
    return int(raw_input())
def d():
    return float(raw_input())

def ls():
    return raw_input().strip().split()
def ln():
    return map(int, raw_input().strip().split())
def ld():
    return map(float, raw_input().strip().split())

def fs():
    return [raw_input().strip() for i in xrange(input())]
def fn():
    return [int(raw_input().strip()) for i in xrange(input())]
def fd():
    return [float(raw_input().strip()) for i in xrange(input())]

EPS = 1e-9

#http://www.deqnotes.net/acmicpc/2d_geometry/lines
def dot(a, b):
    return a.real * b.real + a.imag * b.imag

def cross(a, b):
    return a.real * b.imag - a.imag * b.real

def distance(a, b, c):
    if dot(b-a, c-a) <= EPS:
        return abs(c-a)
    if dot(a-b, c-b) <= EPS:
        return abs(c-b)
    return abs(cross(b-a, c-a)/(b-a))

N = n()
A = ln()

A.sort()

cum = [A[0]]
for a in A[1:]:
    cum.append(cum[-1] + a)

#print cum

#for i, a in enumerate(A):
#    print i, a

x2 = len(A) - 1
result = 1
for i in xrange(len(A) - 2, -1, -1):
    #while A[x2] > 2 * A[i] and x2 > 0:
    #    x2 -= 1
    #cum[x2] - A[i]
    if cum[i] * 2 < A[i + 1]:
       break
    
    result += 1

print result


Measured memory_bytes: 48204
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(25);

  string a;
  cin >> a;

  int n = a.length();
  a = 'a' + a;
  vector<vector<int>> G(n + 1);
  vector<int> res(26, inf), dp(n + 1, 0);
  repr(i, n) {
    G[i] = res;
    int cnt = inf;
    rep(j, 26) {
      if (res[j] == inf) cnt = 0;
      else chmin(cnt, dp[res[j]] + 1);
    }
    dp[i] = cnt;
    res[a[i] - 'a'] = i;
  }
  string ans = "";
  int idx = 0;
  while (idx <= n) {
    bool ok = false;
    rep(i, 26) {
      if (G[idx][i] == inf || dp[idx] - dp[G[idx][i]] == 1) {
        ans += (char)('a' + i);
        idx = G[idx][i];
        ok = true;
        break;
      }
    }
    if (ok) continue;
    ans += 'a';
    idx = G[idx][0];
  }
  cout << ans << '\n';
  //rep(i, n + 1) cout << dp[i];






  
  return 0;
}


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

int main() {
    int n;
    string s;
    cin >> n >> s;
    int b = 0, w = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == '.') w++;
    }
    int ans = w;
    for (int i = 0; i < n; i++) {
        if (s[i] == '#') b++;
        if (s[i] == '.') w--;
        ans = min(ans, w + b);
    }
    cout << ans << endl;
    return 0;
}


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


int main(){
    int a, b, x;
    cin >> a >> b >> x;
    if(a <= x && x <= a+b){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000000000000LL
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1LL<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1LL<<(i))))
#define setbit1(n,i) ((n)|(1LL<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define DBG(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define EN cout<<"\n"
#define fi first
#define se second
#define PI (acos(-1))
#define fastread ios::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 2000005
template<class T,class V> ostream& operator<<(ostream &s,pair<T,V> a)
{
    s<<a.fi<<' '<<a.se;
    return s;
}
int main()
{
    fastread;
    int T=1;
//    cin>>T;
    for(int qq=1; qq<=T; qq++)
    {
        int n,m;
        cin>>n>>m;
        ll sum=0,ans=0;
        map<ll,ll> mp;
        mp[0]=1;
        for(int i=0;i<n;i++){
            ll x;
            cin>>x;
            sum+=x;
            ans+=mp[sum%m];
            mp[sum%m]++;
        }
        cout<<ans<<endl;
    }
}


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

int main(void)
{
    int n;
    cin >> n;
    vector<string> S(n);
    vector<vector<int>> alphCount(26, vector<int>(n, 0));
    for (int i = 0; i < n; i++)
    {
        string inStr;
        cin >> inStr;

        for(int j = 0; j < inStr.size(); j++){
            alphCount[inStr[j]-97][i]++;
        }
    }

    vector<int> minCount(26, 0);
    string outStr = "";
    for(int i = 0; i < 26; i++){
        minCount[i] = *min_element(alphCount[i].begin(), alphCount[i].end());
        for(int k = 0; k < minCount[i]; k++){
            outStr += (char) (i+97);
        }
    }

    cout << outStr << endl;
    
    return 0;
}


Measured memory_bytes: 3568
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <complex>

using namespace std;
using pii = pair<int, int>;
using ll = long long;

ll getgcd(ll a, ll b)
{
	return (a % b == 0) ? b : getgcd(b, a % b);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, m;
	cin >> n >> m;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	ll gcd = a[0];
	ll lcm = gcd;
	for (int i = 1; i < n; i++) {
		gcd = getgcd(lcm, a[i]);
		lcm = lcm * a[i] / gcd;
	}
	for (int i = 0; i < n; i++) {
		if ((lcm / a[i]) % 2 == 0) {
			cout << 0;
			return 0;
		}
	}
	int answer = (2 * m >= lcm) ? 1 : 0;
	answer += max(0LL, 2 * m - lcm) / (2 * lcm);
	cout << answer;

	return 0;
}


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

int main(){
    int A,B;
    cin >> A >> B;
    if(A==B){
        cout << "Draw" << endl;
    }else if((B!=1&&A>B)||A==1){
        cout << "Alice" << endl;
    }else{
        cout << "Bob" << endl;
    }
}

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

int main()
{
	string s; cin >> s;
	
	int cnt_a = 0;
	int cnt_b = 0;
	int cnt_c = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s.at(i) == 'a') cnt_a++;
		else if (s.at(i) == 'b') cnt_b++;
		else if(s.at(i) == 'c') cnt_c++;
	}
	
	string ans = "No";

	if (cnt_a == 1 && cnt_b == 1 && cnt_c == 1) ans = "Yes";

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main (String[] args) {
        Scanner s = new Scanner(System.in);
          double number = Double.parseDouble(s.next());
          double base = 100;
      	int count = 0;
      	while(number > base) {
          base *= 1.01;
          base = Math.floor(base);
          count++;
        }
      	
      	System.out.println(count);
    }
} 


Measured memory_bytes: 35840
// time-limit: 2000
#include <bits/stdc++.h>
using namespace std;

void solve() {
    int d,t,s;
    cin >> d >> t >> s;
    cout << (t*s >= d ? "Yes\n" : "No\n");
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin >> t;
    while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 3668
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#include<cmath>
#include<deque>
#include<set>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define INF 1LL << 60
#define MAX 1000000000
#define mod 1000000007
ll power(ll x,ll p){ll a=1;while(p>0){if(p%2==0){x*=x;p/=2;}else{a*=x;p--;}}return a;}
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 0, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll k) { ll a = 1, b = 1; rep(i, 0, k) { a = a * (n - i + 1) % mod; b = b * i % mod; }return a * mpower(b, mod - 2) % mod; }

const double PI = 3.14159265358979323846;
int gcd(int a, int b) { return a % b == 0 ? b : gcd(b, a % b); }
int main() {
	ll N, m = 1LL << 60, t;
	scanf("%lld", &N);
	rep(i, 0, 5) {
		scanf("%lld", &t);
		m = min(m, t);
	}
	printf("%lld\n", (N - 1) / m + 1 + 4);
	return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

#include <climits>
#include <cmath>
#include <cstring>

#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;

int main()
{
	FAST;
	ll n,m;
	cin >> n >> m;
	int arr[n];
	ll ans[n] = {0};

	priority_queue<int> p;
	
	for(int i=0 ; i<n ; i++)
	{
		int temp;
		cin >> temp;
		p.push(temp);
	}
    
	while(m--)
	{
		int temp = p.top();
		p.pop();
		p.push(temp/2);
	}

	ll sum = 0;
	for(int i=0 ; i<n ; i++)
	{
		sum += p.top();
		p.pop();
	}

	cout << sum;
	return 0;
}

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

using namespace std;

int main(){

    string s;

    cin >> s;

    if(s[2] == s[3] && s[4] == s[5]){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int[] chars = new int[256];
    for(int i=0;i<256;i++){
      chars[i]=0;
    }
    while(sc.hasNextLine()){
      String line = sc.nextLine();
      for(int i=0;i<line.length();i++){
        char ch = Character.toLowerCase(line.charAt(i));
        chars[ch]++;
      }
    }
    for(char ch ='a';ch <='z';ch++){
      System.out.println(ch+" : "+chars[ch]);
    }
  }
}

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

int main(){
    int N;
    int A;
    int B;

    int train;
    int taxi;
    int res;

    cin >> N >> A >> B;

    train = N*A;
    taxi = B;
    res = train <= taxi ? train : taxi;
    cout << res << endl;
    return 0;
}


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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(ll it=0;it<n;it++) cout<<a[it]<<" ";cout<<endl;
#define pcont(a)                     for(auto it:a) cout<<it<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

/*constants*/
#define MAXN                         100005
#define PI                           3.14159265358979323846

/*debug*/
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>void __f(const char* name, Arg1&& arg1){ std::cout << name << " : " << arg1 << '\n';}
    template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ','); std::cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

using namespace std;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	ll i,j,n,m,k,cnt=0,ans=0,t=1;
	ll a[3];
	rep(i,0,3) cin>>a[i];
	sort(a,a+3);
	ret(a[0]+a[1])	
	
	return 0;
}

Measured memory_bytes: 256