akhauriyash/Code-Regression huggingface dataset:
#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++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll l = 2, r = 2;
    rrep(i, n) {
        if (((l - 1) / a[i]) == (r / a[i])) {
            cout << -1 << endl;
            return 0;
        }
        ll lset = ((i == (n - 1)) ? 1 : ((l + (a[i] - 1)) / a[i]));
        ll rset = ((i == (n - 1)) ? 1 : (r / a[i]));
        l = lset * a[i];
        r = (rset + 1) * a[i] - 1;
        // printf("l=%d, r=%d\n", l, r);
    }
    cout << l << " " << r << endl;
    return 0;
}


Measured memory_bytes: 1024
//InTheNameOfGod
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,j,k) for(int i=j;i<k;++i)
#define rrep(i,j,k) for(int i=j;i>=k;i--)
#define pb push_back
#define int ll
const int maxn =2e5;
const int inf =1e18;
int n,e,t,dp[maxn],x[maxn],pm[4*maxn];
main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);
    cin>>n>>e>>t;
    rep(i,1,n+1)cin>>x[i];
    int g=0;
    pm[0]=-2*x[1];
    rep(i,1,n+1)
    {
        while(x[g+1]<=x[i]-t/2.0)g++;
        dp[i]=min(t+dp[g],g>=1?2*x[i]+pm[g-1]:inf);
        pm[i]= min(pm[i-1],dp[i]-2*x[i+1]);
    }
    cout<<dp[n]+e;
}


Measured memory_bytes: 3584
N, M = map(int,input().split())

Q = [] # 1-index
for i in range(M):
  Q.append(list(map(int,input().split())))

Red = [0] * N # 0-index
Count = [1] * N # 0-index

Red[0] = 1

for i in range(M):
  x, y = Q[i]
  x, y = x-1, y-1 # 0-1_index
  Count[x] -= 1
  Count[y] += 1
  if Red[x] == 1:
    Red[y] = 1
  if Count[x] == 0:
    Red[x] = 0
    
print(sum(Red))


Measured memory_bytes: 28964
#include<iostream>
using namespace std;
 
int main(){
 int N,W;
 cin>>N>>W;
 
 int v[N],w[N];
 
 for(int i=0;i<N;i++){
    cin>>v[i]>>w[i];
 }
 
 int DP[N+1][W+1];
 
 for(int j=0;j<=W;j++){
    DP[0][j]=0;
 }
 
 for(int i=1;i<=N;i++){
    for(int j=0;j<=W;j++){
        if(j<w[i-1]){
            DP[i][j]=DP[i-1][j];
        }else{
            if(DP[i-1][j]>DP[i][j-w[i-1]]+v[i-1]){
                DP[i][j]=DP[i-1][j];
            }else{
                DP[i][j]=DP[i][j-w[i-1]]+v[i-1];
            }
        }
    }
 }
 cout<<DP[N][W]<<endl;
return 0;
}

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

int main()
{
    int n;
    cin>>n;
    for (int i = 1; i <= 9; i++)
    {
        for (int j = 1; j <= 9; j++)
        {
            if(n==i*j){
                cout<<"Yes";
                return 0;
            }

        }
        
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

fun main(args: Array<String>){
    val scanner = Scanner(System.`in`)
    val result = D0427A(
                    interval     = scanner.nextInt()
                   ,createAmount = scanner.nextInt()
                   ,limit        = scanner.nextInt()
                 ).judge()
    println(result)
}

class D0427A(
  val interval:     Int
 ,val createAmount: Int
 ,val limit:        Int
){
    private val ADD_TO_LIMIT = 0.5
    fun judge(): Int{
        val timesCreated = ((limit + ADD_TO_LIMIT) / interval).toInt()
        return timesCreated * createAmount
    }
}

Measured memory_bytes: 31392
///
// File:  a.cpp
// Author: ymiyamoto
//
// Created on Thu Oct  5 17:51:07 2017
//

#include <cstdint>
#include <iostream>

using namespace std;

static bool is_5_or_7(uint32_t val)
{
  return val == 5 || val == 7;
}

int32_t main()
{
  uint32_t A, B, C;
  cin >> A >> B >> C;
  if (A + B + C == 5 + 7 + 5) {
    if (is_5_or_7(A) && is_5_or_7(B) && is_5_or_7(C)) {
      cout << "YES" << endl;
      return 0;
    }
  }

  cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
 ll a,b;
  ci(a>>b)
    co((b-a)*(b-a+1)/2-b)
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();
        sc.close();

        long ans = 0;
        if(a == 0) {
            ans = b / x + 1;
        } else {
            ans = b / x - (a - 1) / x;
        }
        System.out.println(ans);
    }
}


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

int main(){
    int N;
    int d[110];
    cin>>N;
    for(int i=0;i<N;i++) cin >>d[i];
    int num[110]={0};
    for(int i=0;i<N;i++){
        num[d[i]]++;
    }
    int ans=0;
    for(int i=0;i<110;i++){
        if(num[i]!=0){
            ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
P p[100005];
ll ans;
int main(void){
	ll n,m; cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>p[i].first>>p[i].second;
	}
	sort(p,p+n);
	priority_queue<ll> q;
	int j=0;
	//cout<<"aa"<<endl;
	for(int i=1;i<=m;i++){
		while(p[j].first==i){
			q.push(p[j].second);
			j++;
		}
		if(!q.empty()){
			ans+=q.top();
			q.pop();
		}
		//cout<<"aaa"<<endl;
	}
	cout<<ans<<endl;
	
}


Measured memory_bytes: 2936
#include <iostream>

int main() {
  int n; std::cin >> n;
  int d1 = n%10;
  if (d1 == 3) std::cout << "bon" << std::endl;
  else if (d1 == 0 || d1 == 1 || d1 == 6 || d1 == 8) std::cout << "pon" << std::endl;
  else std::cout << "hon" << std::endl;
  
  return 0;
}

Measured memory_bytes: 3608
import java.util.*;

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

        if(n[0]==n[1] && n[0]==n[2]){
            System.out.println("Yes");    
        }else if(n[1]==n[2] && n[1]==n[3]){
            System.out.println("Yes");
        }else{
            System.out.println("No");
    }
}
}


Measured memory_bytes: 35680
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

int main(){

    int a, b, c;
    cin >> a >> b >> c;
    if( a == b && b == c) cout << "Yes" << endl;
    else cout << "No" << endl;

}

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

typedef long long ll;
typedef long double ld;

#define n1		      "\n"
#define B                     begin()
#define E                     end()
#define F                     first
#define S                     second
#define pb                    push_back
#define pf                    push_front
#define popb                  pop_back()
#define popf                  pop_front()

const int BIG=1e5+55;
const int BIGG=1e9+7;
const ll BIGGE=1e12+55;
const double SML=(1e-7);

using namespace std;

    int x,n,mi = BIG , ans;
    set <int> s;

int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL);
    cout.tie(NULL);
    for (int i=0; i<=101; i++)
        s.insert(i);
    cin >>x >>n;
    for (int i=0; i<n; i++) {
        int a; cin >>a;
        s.erase(a);
    }
    for (auto it = s.B; it != s.E; it++) {
        if ( abs(*it - x) < mi) {
            ans = *it;
            mi  = abs(*it - x);
        }
    }

    cout <<ans;

    return 0;
}


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

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}

bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

long long h,w, men, mi, ans = LLONG_MAX, ma;

int main(){
    cin >> h >> w;
    
    for(int i = 1; i < h; i++){
        men = i * w;
        if(h-i >= 2){
            ma = max((h-i-(h-i)/2)*w, max(men, (h-i)/2*w));
            mi = min((h-i-(h-i)/2)*w, min(men, (h-i)/2*w));
            ans = min(ans, ma - mi);
        }

        ma = max((w-w/2) * (h-i), max(men, w/2 * (h-i)));
        mi = min((w-w/2) * (h-i), min(men, w/2 * (h-i)));
        ans = min(ans,ma-mi);
    }

    for(int i = 1; i < w; i++){
        men = i * h;
        if(w-i > 2){
            ma = max((w-i-(w-i)/2)*h, max(men, (w-i)/2*h));
            mi = min((w-i-(w-i)/2)*h, min(men, (w-i)/2*h));
            ans = min(ans, ma - mi);
        }

        ma = max((h-h/2) * (w-i), max(men, h/2*(w-i)));
        mi = min((h-h/2) * (w-i), min(men, h/2*(w-i)));
        ans = min(ans,ma-mi);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import numpy as np
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
a = np.zeros(n + 1, dtype=int)
for _ in range(m):
    x, y = map(int, input().split())
    a[x] = (a[x] + 1) & 1
    a[y] = (a[y] + 1) & 1
print("YES" if np.sum(a) == 0 else "NO")


Measured memory_bytes: 27640
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.AGC_Challenge
{
    class _006_A
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            string ps = Read();
            string ss = Read();
            for (int i = 0; i <= n; i++)
            {
                int shareCnt = 0;
                for (int j = 0; j < n - i; j++)
                {
                    if (ps[i + j] == ss[j]) shareCnt++;
                }
                if (shareCnt == n - i)
                {
                    Console.WriteLine(n + i);
                    return;
                }
            }
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
using System.Collections.Generic;
using System;

public class Fee
{
    public int L { get; set; }
    public int w { get; set; }
    public int f { get; set; }

    public class hello
    {
        public static void Main()
        {
            while (true)
            {
                var fees = new List<Fee>();
                FeeSet(fees);
                var n = int.Parse(Console.ReadLine().Trim());
                if (n == 0) break;
                var ans = 0;
                for (int i = 0; i < n; i++)
                {
                    string[] line = Console.ReadLine().Trim().Split(' ');
                    var a = Array.ConvertAll(line, int.Parse);
                    var L = a[0] + a[1] + a[2];
                    for (int j = 0; j < 6; j++)
                        if (L <= fees[j].L && a[3] <= fees[j].w) { ans += fees[j].f; break; }
                }
                Console.WriteLine(ans);
            }
        }
        public static void FeeSet(List<Fee> f)
        {
            var a = new int[] { 60, 80, 100, 120, 140, 160 };
            var b = new int[] { 2, 5, 10, 15, 20, 25 };
            var c = new int[] { 600, 800, 1000, 1200, 1400, 1600 };
            for (int i = 0; i < 6; i++)
                f.Add(new Fee { L = a[i], w = b[i], f = c[i] });
        }
    }
}

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

int main (){
   string S;
   cin>>S;
    if (S == "SAT"s) cout << 1;
    if (S == "SUN"s) cout << 7;
    if (S == "MON"s) cout<< 6;
    if (S == "TUE"s) cout << 5;
    if (S == "WED"s) cout << 4;
    if (S == "THU"s) cout << 3;
    if (S == "FRI"s) cout <<2;
    return 0;
}

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

using namespace std;

typedef long long int ll;

const ll mod = 1e9 + 7;
const ll MAXN = 2e5 + 5;

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

  ll n;
  cin >> n;
  vector < ll > a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  ll ans = 0;
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      ll b = lower_bound(a.begin(), a.end(), a[i] + a[j]) - a.begin();
      b = b - j - 1;
      if(b > 0) ans += b;
    }
  }

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


Measured memory_bytes: 256
def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    absA = [abs(Ai) for Ai in A]
    rA = [-1 if Ai < 0 else 1 for Ai in A]
    # すべてひっくり返せるか, 端だけ負になるかを検索する
    for i in range(N - 1):
        if rA[i] < 0:
            rA[i] *= -1
            rA[i + 1] *= -1
    # すべてひっくり返せるならすべての合計
    if rA[-1] == 1:
        result = sum(absA)
    else:
        # 無理なら一番小さい値を引いた数
        result = sum(absA) - (min(absA) * 2)
    print(result)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 14412
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);



int main(){
    FIN;
    int h,w; cin >> h >> w;
    vector<string> grid(h);
    for(int i=0;i<h;i++){
        string s; cin >> s;
        grid[i] = s;
    }

    vector<vector<int>> Left(h,vector<int>(w,0));
    vector<vector<int>> Right(h,vector<int>(w,0));
    vector<vector<int>> Up(h,vector<int>(w,0));
    vector<vector<int>> Down(h,vector<int>(w,0));

    //Left
    for(int i=0;i<h;i++){
        int cur = 1;
        for(int j=0;j<w;j++){
            if(grid[i][j] == '#') cur = 0;
            Left[i][j] = cur;
            cur++;
        }
    }

    //Right
    for(int i=0;i<h;i++){
        int cur = 1;
        for(int j=w-1;j>=0;j--){
            if(grid[i][j] == '#') cur = 0;
            Right[i][j] = cur;
            cur++;
        }
    }

    //Up
    for(int j=0;j<w;j++){
        int cur = 1;
        for(int i=0;i<h;i++){
            if(grid[i][j] == '#') cur = 0;
            Up[i][j] = cur;
            cur++;
        }
    }

    //Down
    for(int j=0;j<w;j++){
        int cur = 1;
        for(int i=h-1;i>=0;i--){
            if(grid[i][j] == '#') cur = 0;
            Down[i][j] = cur;
            cur++;
        }
    }


    int ans = -10;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            ans = max(ans,Left[i][j]+Right[i][j]+Up[i][j]+Down[i][j]-3);
        }
    }

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 67328
#include<cstdio>
#include<algorithm>
using namespace std;
char p[301000];
int S[301000], n, res = 1e9;
int main() {
	int i;
	scanf("%d", &n);
	scanf("%s", p + 1);
	for (i = 1; i <= n; i++) {
		S[i] = S[i - 1];
		if (p[i] == 'E')S[i]++;
	}
	for (i = 1; i <= n; i++) {
		res = min(res, (i - 1 - S[i - 1]) + S[n] - S[i]);
	}
	printf("%d\n", res);
}

Measured memory_bytes: 1664
import itertools

def check(a, b, c):
  if not (a != b and b != c and c != a):
    return False
  if a+b>c and b+c>a and c+a>b:
    return True
  return False

n = int(input())
l = map(int, input().split())
res = 0
for a, b, c in itertools.combinations(l, 3):
  if check(a,b,c):
    res += 1

print(res)

Measured memory_bytes: 9184
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author hakamada
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC114_2 solver = new ABC114_2();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC114_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String S = in.next();
            int Diff = Integer.MAX_VALUE;
            for (int i = 0; i < S.length() - 2; i++) {
                int three = Integer.parseInt(S.substring(i, i + 3));
                if (Diff > Math.abs(753 - three)) {
                    Diff = Math.abs(753 - three);
                }
            }
            out.println(Diff);
        }

    }
}



Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

int n;
int a[200001];
int cnt;

int com2(int n) {
    return n*(n-1) / 2;
}
signed main() {
    cin >> n;
    for (int i=0;i<n;i++) cin >> a[i];

    int l = 0, r = 0;
    int sum = 0;
    while(r<n) {
        if ((sum^a[r]) == (sum+a[r])) {
            // cout << r+1 << " " << (sum^a[r]) << " " << cnt << endl;
            sum += a[r];
            r++;
        } else if (l != r) {
            cnt += r-l;
            sum -= a[l];
            l++;
        } else {
            l++; r++;
            sum = 0;
            cnt++;
        }

        // cout << l+1 << " " << r+1 << " " << cnt << endl;
    }
    if (l != n) cnt += com2(n-l) + (n-l);
    cout << cnt << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define pb push_back
#define ll long long int
using namespace std;
const int inf=1e9+10;
const ll llinf=1e16+10;
const int maxn=2e5+10;
const int maxm=1e3+10;
const int mod=1e9+7;
int n;
vector<int> v[30];
char s[maxn];
int dp[maxn];
int nch=26;
int querry(int pos,int ch)
{
    vector<int>::iterator it;
    it=lower_bound(v[ch].begin(),v[ch].end(),pos);
    if(it==v[ch].end()) return n;
    else return *it;
}
void solve()
{
    dp[n+1]=0;
    for(int i=n-1;i>=0;i--)
    {
        for(int j=0;j<nch;j++)
            dp[i]=min(dp[i],dp[querry(i,j)+1]+1);
    }
    int pos=0;
    while(pos<n)
    {
        for(int j=0;j<nch;j++)
        {
            int t=querry(pos,j)+1;
            if(dp[pos]==dp[t]+1)
            {
                printf("%c",j+'a');
                pos=t;
                break;
            }
        }
    }
    printf("\n");
}
int main()
{
    //freopen("in.txt","r",stdin);
       cin>>s;
    
        for(int i=0;i<nch;i++)
            v[i].clear();
        n=strlen(s);
        for(int i=0;i<=n;i++)
            dp[i]=inf;
        for(int i=0;i<n;i++)
            v[s[i]-'a'].pb(i);
        solve();
    
    return 0;
}

Measured memory_bytes: 5252
#include<bits/stdc++.h>
using namespace std;
int main(){
    double s,x,t;
    int q=0;
    cin>>s>>x>>t;
    double p=s/x;
    if(int(s)%int(x)>0){
        q=(int(s)/int(x))+1;
    }
    else{
        q=(int(s)/int(x));
    }
    long int r=q*t;
    cout<<r;
}

Measured memory_bytes: 3720
N = int(input())
listA = []
listB = []
d = ["M","A","R","C","H"]
ans = 0
for i in range(N):
    listA.append(input()[0])
for i in d:
    listB.append(listA.count(i))
listB = list(map(int,listB))
listB = [i for i in listB if i != 0]
length = len(listB)
if length < 3:
    print(0)
    exit()
total = 0
for i in range(length-2):
    for j in range(i+1,length):
        for k in range(j+1,length):
            total += listB[i] * listB[j] * listB[k]
            pass
print(total)

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

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

    ll first, second;
    if (A > B) {
        first = A;
        second = B;
    } else {
        first = B;
        second = A;
    }
    // cout << first << " " << second << "\n";

    for (ll i=1; i<LONG_MAX; i++) {
        ll val = first*i;
        // cout << i << " " << val << "\n";
        if (val%second == 0) {
            cout << val;
            return 0;
        }
    }
    
    return 0;
}


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

int main() {
	ll K;
	cin >> K;
	ll q=K/50, r=K%50;
	vector<ll> ans(50, 49+q);
	for(ll i=0; i<50; ++i){
	    if(i<r) ans[i] += 51-r;
	    else ans[i] -= r;
	}
	cout << 50 << endl;
	cout << ans[0];
	for(int i=1; i<50; ++i) cout << ' ' << ans[i];
	return 0;
}


Measured memory_bytes: 256
//do not think about past and stay in this moment
//organize and work - Abhinav IIITA
#include <bits/stdc++.h>
#include <ctime>
using namespace std;
#define int long long
#define ld long double
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end() 
const ld pi = acos(-1.0);
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


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

// -----------------------------------------------------------------------
int fre[10];
void solve(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	fre[a]++;
	fre[b]++;
	fre[c]++;
	fre[d]++;
	if(fre[1]==1 && fre[4]==1 && fre[7]==1 && fre[9]==1)
	cout<<"YES";
	else
	cout<<"NO";	
	
}


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


int32_t main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); 	
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}


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

static int cnt;

void check(int pw,int ph,char **dt,int w,int h);
void dtallput(int h,int w,char **dt);

int main(void){
	int w,h;
	int ph,pw;
	char c;

	while(1){

	//入力
	cin >> w >> h;
	if(w==0&&h==0)break;

	char **dt = new char*[h+2];
	for(int i=0; i<h+2; i++){
		dt[i] = new char[w+2];
		memset(dt[i],'#',sizeof(char)*(w+2));
	}
	
	c=getchar();
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			c=getchar();
			if(c=='.'||c=='#')
				dt[i+1][j+1]=c;
			else if(c=='@'){
				dt[i+1][j+1]=c;
				ph=i+1; pw=j+1;
			}
		}
		c=getchar();
	}
	
	//測定
	cnt=1;
	check(pw,ph,dt,w,h);

	//出力
	cout << cnt << endl;

	}
	return 0;
}

void check(int pw,int ph,char **dt,int w,int h){
	int dw[]={0,0,1,-1};
	int dh[]={1,-1,0,0};

	for(int i=0; i<4; i++){
		if(dt[ph+dh[i]][pw+dw[i]]=='.'){	
			dt[ph+dh[i]][pw+dw[i]]='@';
			cnt++;
			check(pw+dw[i],ph+dh[i],dt,w,h);
		}
	}
}

void dtallput(int h,int w,char **dt){
	cout << endl;
	for(int i=0; i<h+2; i++){
		for(int j=0; j<w+2; j++){
			cout << dt[i][j];
		}
		cout << endl;
	}
	cout << endl;
}

Measured memory_bytes: 0
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        n: usize,
        m: usize,
        x: i64,
        ca: [(i64, [i64; m]); n],
    }

    let mut res = None;
    for i in 0..1 << n {
        let mut r = 0;
        let mut rikai = vec![0; m];
        for j in 0..n {
            if (i >> j) & 1 == 0 {
                continue;
            }
            r += ca[j].0;
            for k in 0..m {
                rikai[k] += ca[j].1[k];
            }
        }
        if *rikai.iter().min().unwrap() < x {
            continue;
        }
        if let Some(x) = res {
            res = Some(std::cmp::min(x, r));
        } else {
            res = Some(r);
        }
    }
    println!("{}", res.unwrap_or(-1));
}


Measured memory_bytes: 2188
#include<iostream>
#include<vector>

int main(void){
    int n, k;
    std::cin >> n >> k;
    std::vector<int> a(n);
    for(int i = 0; i < n; i++){
        std::cin >> a[i];
    }
    int l = 1, r = 1e9;
    while(l < r){
        int mid = (l + r) / 2;
        int cnt = 0;
        for(int i = 0; i < n; i++){
            cnt += (a[i] - 1) / mid;
        }
        if(cnt > k){
            l = mid + 1;
        }else{
            r = mid;
        }
    }

    std::cout << r << std::endl;
    return 0;
}


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

using namespace std;

const int MAXN = 111;

int N, K, cur, M;

bool graph[MAXN][MAXN];

inline void add( int a, int b ) {
	
	if (!graph[a][b]) {
		graph[a][b] = graph[b][a] = true;
		M++;
	}
}

inline void erase( int a, int b) {
	
	if (graph[a][b]) {
		graph[a][b] = graph[b][a] = false;
		M--;
	}
}

inline void write() {

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

	for( int i=1 ; i <= N ; i++ ) {
		for( int j=i + 1 ; j <= N ; j++ ) {
			if (graph[i][j]) {
				printf("%d %d\n", i, j);
			}
		}
	}
}

int main () {

	scanf("%d%d", &N, &K);

	for( int i=1 ; i < N ; i++ ) {
		add(i, N);
	}

	cur = ((N - 1) * (N - 2)) / 2;

	if (K > cur) {
		puts("-1");
		return 0;
	}

	if (cur == K) {
		write();
		return 0;
	}

	for( int i=1 ; i < N ; i++ ) {
		for( int j=i + 1 ; j < N ; j++ ) {

			if (i == j) {
				continue;
			}

			if (cur == K) {
				write();
				return 0;
			}

			if (!graph[i][j]) {
				add(i, j);
				cur--;
			}

			if (cur == K) {
				write();
				return 0;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 256
lines = readlines

lines.each{|line|
    a,op,b = line.split
    a = a.to_i
    b = b.to_i
    
    case op
    when '+' then
        puts (a+b).to_s
    when '-' then
        puts (a-b).to_s
    when '*' then
        puts (a*b).to_s
    when '/' then
        puts (a/b).to_s
    end
}


Measured memory_bytes: 6880
// {{{ by unolight
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

namespace { namespace unolight {
// Read Input
template<class T> void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( int64_t &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }
void R() {}
template<class T, class... U> void R( T& head, U&... tail ) { _R(head); R(tail...); }
// Write Output
template<class T> void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
void _W( const int64_t &x ) { printf("%" PRId64,x); }
void _W( const double &x ) { printf("%.16f\n",x); }
void _W( const char &x ) { putchar(x); }
void _W( const char *x ) { printf("%s",x); }
template<class T> void _W( const vector<T> &x ) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W( const T& head, const U&... tail ) { _W(head); putchar(sizeof...(tail)?' ':'\n'); W(tail...); }

#ifdef UNOLIGHT
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}
// }}}

void main() {
    int n,k;
    R(n,k);
    vector<PII> e(n);
    REP(i,n) {
        R(e[i].first);
        --e[i].first;
    }
    REP(i,n) {
        R(e[i].second);
    }
    VI vis(n);
    LL ans=-1e18;
    REP(i,n) {
        if ( vis[i] ) continue;
        VI es;
        // dump(i);
        vis[i]=1;
        int u=e[i].first;
        while ( u^i ) {
            es.PB(u);
            vis[u]=1;
            u=e[u].first;
        }
        es.PB(u);
        int m=SZ(es);
        LL res=-1e18;
        LL tot=0;
        REP(j,m) {
            tot+=e[es[j]].second;
        }
        REP(j,m) {
            LL sum=0;
            REP(t,min(m,k)) {
                int nj=es[(j+t+1)%m];
                sum+=e[nj].second;
                chmax(ans, sum+(k-(t+1))/m*tot);
                chmax(ans,sum);
            }
        }
        chmax(ans,res);
    }
    W(ans);
}

}} // {{{ main
int main() { unolight::main(); return 0; }
// }}}

Measured memory_bytes: 3900
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

inline void checkmax(ll &a, const ll &b) {if(a < b) a = b;}

int N, gA, gB, sA, sB, bA, bB;
ll ans = 0, f[25000005];

int main(){
	getint(N), getint(gA), getint(sA), getint(bA), getint(gB), getint(sB), getint(bB);
	for(register int i = 0; i <= N; i++){
		if(i + gA <= N && gA < gB) checkmax(f[i + gA], f[i] + gB);
		if(i + sA <= N && sA < sB) checkmax(f[i + sA], f[i] + sB);
		if(i + bA <= N && bA < bB) checkmax(f[i + bA], f[i] + bB);
	}
	for(register int i = 0; i <= N; i++) checkmax(ans, N + f[i] - i);
	memset(f, 0, sizeof(f)), N = ans;
	for(register int i = 0; i <= N; i++){
		if(i + gB <= N && gB < gA) checkmax(f[i + gB], f[i] + gA);
		if(i + sB <= N && sB < sA) checkmax(f[i + sB], f[i] + sA);
		if(i + bB <= N && bB < bA) checkmax(f[i + bB], f[i] + bA);
	}
	for(register int i = 0; i <= N; i++) checkmax(ans, N + f[i] - i);
	return printf("%lld\n", ans), 0;
}

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

int main() {
    int n,m;
    cin >> n;
    vector<int> t(n);
    int s=0;
    for (int i=0;i<n;i++) {
        cin >> t[i];
        s+=t[i];
    }
    cin >> m;
    vector<int> p(m),x(m);
    for (int i=0;i<m;i++) {
        cin >> p[i] >> x[i];
        p[i]--;
    }
    for (int i=0;i<m;i++) cout << s-t[p[i]]+x[i] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<28;
const long long MOD =1000000000+7;

int main(){
    int h,w;
    cin >>h>>w;
    vector<string> data(h+5,"");
    for(int i=0;i<h;i++){
        cin>>data[i];
    }
    vector<vector<long long>>dp(h+5,vector<long long>(w+5,0));
    dp[0][0]=1;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(data[i][j]=='.'){
                dp[i][j+1]+=dp[i][j];
                dp[i][j+1]%=MOD;
                dp[i+1][j]+=dp[i][j];
                dp[i+1][j] %= MOD;
            }
        }
    }
    cout<<dp[h-1][w-1];
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int N;
    cin >>N;
    long long int A[N];
    for(int i=0;i<N;i++)
        cin >>A[i];
    int count =0;
    for(int i=0;i<N;i++)
    {
        if((i+1)%2!=0&&A[i]%2!=0)
            count++;
    }
    cout <<count<<endl;
    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;//×Ô¶¯È¡Ä£2^64 
const double pi=acos(-1.0);
const int mod = 1e9+7; // 998244353;
const int inf = 0x7fffffff;//2^31-1	
const ll INF = 0x7fffffffffffffff;
const int dx[]={-1,0,1,0},dy[]={0,1,0,-1};
//ll begin_time=clock();    ll end_time=clock();  cout<<"time = "<<end_time-begin_time<<" ms!"<<endl;
//bool operator < (const mmp &a) const{return x<a.x||x==a.x&&y<a.y;}       //map<int,map<int,int> >z;
//map<int,int>::iterator it;for(it=z.begin();it!=z.end();it++)printf("%d %d\n",it->first,it->second);
//ll poww(ll a,ll b){ll s=1;while(b){if(b&1)s=(s*a)%mod;a=(a*a)%mod;b>>=1;}return s%mod;}  //¿ìËÙÃÝÈ¡Ä£ 
//lower_bound(begin,end,num); µÚÒ»¸ö>=numµÄÊý×Ö upper_bound(begin,end,num); µÚÒ»¸ö>numµÄÊý×Ö,·µ»ØµØÖ·
//freopen("input.in","r",stdin);     freopen("output.out","w",stdout);      //ÎÄ¼þ¶ÁÐ´Ìá½» 
//reverse(s.begin(),s.end());   //·­×ª×Ö·û´®        floor(); ÏòÏÂÈ¡Õû  ceil(); ÏòÉÏÈ¡Õû
//ÊýÖáÉÏµÄn¸öµãÒÆ¶¯µ½Í¬Ò»Î»ÖÃ£¬ÒÆ¶¯µ½¸Ã×éÊý×ÖµÄÖÐÎ»ÊýµÄ×Ü¾àÀë×î¶Ì
//bool isPrime(int n){if(n==2||n==3)return 1;if(n%6!=1&&n%6!=5)return 0;
//int t=sqrt(n);for(int i=5;i<=t;i+=6)if(n%i==0||n%(i+2)==0)return 0;return 1;}//ÅÐ¶ÏËØÊý   


int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	ll a,b,c,d,e,f,T;
//	cin>>T;
//	while(T--)
	{
		cin>>a>>b;
		cout<<a*b<<endl;
		
	}
 
 
 
}




Measured memory_bytes: 3636
#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)<(n);(i)++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
bool custom1 (pair<int, int> a, pair<int, int> b) {
  return (a.first < b.first);
}
bool custom2(pair<int, int> a, pair<int, int> b) {
  return (a.second < b.second);
}

const int MAX = 200005;
const long long MOD = 1000000007;
const long long MODMOD = 998244353;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

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

int main() {
  int n;
  cin >> n;
  vector<ll> subSum(n);
  for(int i=0;i<n;i++) {
    ll a;
    cin >> a;
    if(i == 0) subSum[i] = a;
    else subSum[i] = subSum[i-1] + a;
  }
  map<ll, ll> count;
  rep(i, n) count[subSum[i]]++;
  ll ans = 0LL;
  for(auto it=count.begin();it!=count.end();it++) {
    if(it->first == 0) ans += it->second * (it->second + 1) / 2;
    else ans += it->second * (it->second - 1) / 2;

  }
  cout << ans << endl;
}


Measured memory_bytes: 14336
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#define SIZE 300005

using namespace std;
typedef long long int ll;

int X[SIZE];
bool RL[SIZE],LR[SIZE];
bool zero[SIZE];

int main()
{
	int n,L;
	scanf("%d %d",&n,&L);
	for(int i=0;i<n;i++) scanf("%d",&X[i]);
	ll cnt=0;
	for(int i=0;i<n;i++)
	{
		int len;
		scanf("%d",&len);
		cnt+=len/(2*L);
		len%=2*L;
		if(len<=X[i]*2) LR[i]=true;
		if(len<=(L-X[i])*2) RL[i]=true;
		if(len==0) zero[i]=true;
	}
	int rl=1,ch=0;
	if(RL[n-1]) cnt++;
	else cnt+=2;
	for(int i=n-2;i>=0;i--)
	{
		if(zero[i]) continue;
		if(LR[i])
		{
			if(rl>1)
			{
				rl--;
				if(RL[i]) ch++;
			}
			else
			{
				cnt++;
				if(RL[i]) rl++;
				else if(ch>0) ch--,rl++;
			}
		}
		else
		{
			cnt++;
			if(RL[i]) rl++;
		}
		//printf("%d %d * %d %d : %lld\n",LR[i],RL[i],rl,ch,cnt);
	}
	printf("%lld\n",cnt*2LL*(ll) L);
	return 0;
}


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

int cell[101][101];
int max_i, max_j;
int goal_i, goal_j;
bool ret;

void search(int i, int j, int c){
	if(i<1 || j<1 || i>max_i || j>max_j) return;
	if(cell[i][j]!=c) return;
	else cell[i][j] = 0;
	if(i==goal_i && j==goal_j){
		ret = true;
		return;
	}

	search(i+1, j, c);
	if(ret) return;
	search(i-1, j, c);
	if(ret) return;
	search(i, j+1, c);
	if(ret) return;
	search(i, j-1, c);
	return;
}

int main(){
	while(1){
		cin >> max_i >> max_j;

		if(!max_i && !max_j) break;

		int start_i, start_j;
		cin >> start_i >> start_j;
		cin >> goal_i >> goal_j;

		int n;
		cin >> n;

		for(int i=0;i<max_i;i++){
			for(int j=0;j<max_j;j++){
				cell[i][j] = 0;
			}
		}

		for(int k=0;k<n;k++){
			int c, vec, i, j;
			cin >> c >> vec >> i >> j;
			cell[i][j] = cell[i+1][j] = cell[i][j+1] = cell[i+1][j+1] = c;
			if(vec){
				cell[i][j+2] = cell[i][j+3] = cell[i+1][j+2] = cell[i+1][j+3] = c;
			}else{
				cell[i+2][j] = cell[i+3][j] = cell[i+2][j+1] = cell[i+3][j+1] = c;
			}
		}
		
		ret = false;
		if(cell[start_i][start_j]){
			search(start_i, start_j, cell[start_i][start_j]);
		}

		if(ret) cout << "OK" << endl;
		else cout << "NG" << endl;
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define F first
#define S second
#define SHN 1e9
#define lSHN 1e18
using namespace std;
int n;
int a,b,ab;
int res;
int main()
{
	cin >>n;
	for (int i=0;i<n;i++)
	{
        string s;
		cin >>s;
		for (int j=0;j<s.size()-1;j++) if (s[j]=='A' && s[j+1]=='B') res++;
		if (s[0]=='B' && s[s.size()-1]=='A') ab++;
		else if (s[0]=='B') b++;
		else if (s[s.size()-1]=='A') a++;
	}
	if (!ab)
	{
		cout <<min(a,b)+res;
		return 0;
	}
	if (a+b)
	{
		cout <<min(a,b)+ab+res;
		return 0;
	}
	else
	{
		cout <<ab-1+res;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
int main(){
    string s,t; cin >> s >> t;
    string ans = "";
    ans += t; ans += s;
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());

            int[] s = ReadLine().Split(' ').Select(int.Parse).ToArray();
            var dic = new SortedDictionary<int, int>();
            for (int i = 0; i < n; i++)
            {
                dic[s[i]] = i+1;
            }
            WriteLine(string.Join(" ", dic.Values));
        }
    }
}

Measured memory_bytes: 34964
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef tuple<int, int, int> iii;
typedef vector<iii> viii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef vector<iil> viil;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000

void solve() {
    int n;
    cin >> n;
    int ans = 0;
    ans += (n / 500) * 1000;
    n = n % 500;
    ans += (n / 5) * 5;
    cout << ans << endl;
}

void querySolve() {
    int n;
    cin >> n;
    while (n--) {
        solve();
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    //querySolve();
    solve();
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("7");
            //4
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("32");
            //32
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("1");
            //1
        }
        else if (InputPattern == "Input4") {
            WillReturn.Add("100");
            //64
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int N = int.Parse(InputList[0]);

        if (N >= 64) { Console.WriteLine(64); return; }
        if (N >= 32) { Console.WriteLine(32); return; }
        if (N >= 16) { Console.WriteLine(16); return; }
        if (N >= 8) { Console.WriteLine(8); return; }
        if (N >= 4) { Console.WriteLine(4); return; }
        if (N >= 2) { Console.WriteLine(2); return; }
        if (N >= 1) { Console.WriteLine(1); return; }
    }
}


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

int main() {
	int n;
	cin >> n;
	string k = "No";
	for(int i = 1;i<10;i++)
	{
		for(int j=1;j<10;j++)
		{
			if(i * j == n)
			{
				k = "Yes";
			}
		}
	}
	cout << k << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (unsigned int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD =  1000000007 ;
const int INF = 2000000000;


    ll A,B,C,D,N;
    ll ans=0;
    ll X[4];
    string S,T;
int main(){
    cin>>N>>A>>B;
    cout<<min(A,B)<<" "<<(A+B-N>0?A+B-N:0);
    return 0;
}


Measured memory_bytes: 256
n,d=map(int,input().split())
point=[list(map(int,input().split())) for i in range (n)]

#print(point)

count=0
for i in range(n):
    if (point[i][0]**2+point[i][1]**2)**(1/2)<=d:
        count+=1
    else:
        count+=0
print(count)

Measured memory_bytes: 45676
#include<stdio.h>
long long lks(int n)
{
	long long l[86];
	int i;
	l[0]=2;
	l[1]=1;
	if(n==1){
		return 1;
	}else{
	for(i=2;i<=n;i++){
		l[i]=l[i-1]+l[i-2];
	}
	return l[i-1];
    }
}

int main()
{
    int n;
    n=1;
	scanf("%d",&n);
	printf("%lld",lks(n));	
}

Measured memory_bytes: 128
#include<bitset>
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, a, n) for(int i=(a);i<(int)(n);i++)
#define repc(i, a, n) for(int i=(a);i<=(int)(n);i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout<<(cond? "Yes":"No")<<endl;
#define YES(cond) cout<<(cond? "YES":"NO")<<endl;

#define DBG(str) cerr<<(str)<<endl;
bool lc(char a) {
	return 'a' <= a&&a <= 'z';
}
int main() {
	string s;
	cin >> s;
	string ss = s.substr(2, s.length() - 3);
	if (s[0] == 'A'&&lc(s[1]) && lc(s[s.length() - 1])) {
		int ccount = 0;
		int capitalCount = 0;
		rep(i, 2, s.length()-1) {
			if (!lc(s[i])) {
				++capitalCount;
				if (s[i] == 'C')++ccount;
			}
		}
		if (ccount == 1 && capitalCount == 1)cout << "AC";
		else cout << "WA";

	}
	else {
		cout << "WA";
	}
	return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007 
#define all(n)      (n).begin(), (n).end()
#define ll long long 
#define PI 3.14159265358979323846

void solve(){
	int r; cin >> r; 
	long double ans;
	ans = (2 * PI * r);
	cout << setprecision(20) << ans << endl;
	

}


int main (){
	#ifndef ONLINE_JUDGE
		freopen ("input.txt","r",stdin);
		freopen ("output.txt", "w", stdout);
	#endif
	ios::sync_with_stdio(0);
	cin.tie(0);
	//Write from here.
	
		solve();
	
	return 0;
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    string s = "";
    cin>>n;
    while(n>0){
        n = n-1;
        long long int d = n%26;
        char c = 'a'+d;
        s = s+c;
        n/=26;
    }
    reverse(s.begin(), s.end());
    cout<<s<<endl;
}

Measured memory_bytes: 3640
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce, lru_cache  # @lru_cache(None)
from fractions import gcd
import sys  # def input(): return sys.stdin.readline().rstrip() # sys.setrecursionlimit(10**6)

n, k = (int(x) for x in input().split())
P = list(int(x) for x in input().split())
P.sort()
print(sum(P[:k]))

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

using namespace std;

int main(void) {

	string Str, Str1, Str2, Str3;

	Str1 = "Sunny";
	Str2 = "Cloudy";
	Str3 = "Rainy";

	cin >> Str;

	if (Str == Str1) {
		cout << Str2;
	}
	else if (Str == Str2) {
		cout << Str3;
	}
		
	else {
		cout << Str1;
	}

	return 0;

}

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }

void solve() {
  vector<int> A(3);
  for (int i = 0; i < 3; i++) {
    cin >> A[i];
  }
  sort(all(A));
  A.erase(unique(all(A)), A.end());
  cout << A.size() << endl;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}

Measured memory_bytes: 256