akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

map<int64_t, int> prime_factor(int64_t n) {
  map<int64_t, int> ret;
  for (int64_t i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}

int main(void) {
  ios::sync_with_stdio(false);
  int64_t N, P;
  cin >> N >> P;

  int64_t answer = 1;
  for (auto p : prime_factor(P)) {
    int64_t times = (p.second / N);
    while (times--) answer *= p.first;
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include "bits/stdc++.h"
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

int main(){
    string s,t;
    cin>>s>>t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    
    if(s<t) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    n = I()
    print(n*800-200*(n//15))

#B
def B():
    k = I()
    ans = 0
    for i in range(1,k):
        for j in range(i+1,k+1):
            if (i%2)^(j%2):
                ans += 1
    print(ans)

#C
def C():
    x,t = LI()
    print(max(0,x-t))

#D
def D():
    n = I()
    ans = 1
    for i in range(1,n+1):
        ans *= i
        ans %= mod
    print(ans)

#E
def E():
    x,y,s,t = LI()
    print(s+y-t,s+t-x,x+y-t,s+y-x)

#F
def F():
    n = I()
    x = LI()
    a = sorted(x)
    for i in range(n):
        j = bisect.bisect_left(a,x[i])
        if j >= n//2:
            print(a[n//2-1])
        else:
            print(a[n//2])

#G
def G():
    n,m = LI()
    if m <= 2*n:print(m//2)
    else:
        ans = n
        m -= 2*n
        ans += m//4
        print(ans)

#H
def H():
    n,k = LI()
    if k%2:
        l = n//k
        print(l**3)
    else:
        l = n//(k/2)
        m = n//k
        l -= m
        print(int(l**3+m**3))

def J():
    n = I()
    d = defaultdict(int)
    for i in range(n):
        a = I()
        if d[a]:
            d[a] -= 1
        else:
            d[a] += 1
    print(sum(d.values()))

def K():
    n,h = LI()
    v = LIR(n)
    s = 0
    i = 0
    v.sort()
    m = v[-1][0]
    v.sort(key = lambda x:-x[1])
    for a,b in v:
        if b > m:
            s += b
            i += 1
            if s >= h:break
    ans = i+(max(0,h-s)//m)
    if max(0,h-s)%m>0:
        ans += 1
    print(ans)
#Solve
if __name__ == "__main__":
    E()


Measured memory_bytes: 40560
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

int main()
{
	int A, B;
	cin >> A;
	cin >> B;
	int M = max(A, B);
	if (A!=B)
	{
		cout << 2 * M - 1 << endl;
	}
	else
	{
		cout << 2 * M << endl;
	}
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	nums := ScanNums(5)
	minRem := 10
	totalMin := 0
	for _, num := range nums {
		modulo := num % 10
		if modulo == 0 {
			totalMin += num
		} else {
			if modulo < minRem {
				minRem = modulo
			}
			totalMin += num + 10 - modulo
		}
	}

	fmt.Println(totalMin - (10 - minRem))
}

func ScanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}


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

/*
提出前に確認!
- setとmultisetを間違えない
*/

/*
1 1
2 2
3 2
4 3
5 2
6 4
7 2
8 4
9 3
10 4
11 2
12 6
13 2
14 4
15 4
16 5
17 2
18 6
19 2
20 6
21 4
22 4
23 2
24 8
25 3
26 4
27 4
28 6
29 2
30 8
31 2
32 6
33 4
34 4
35 4
36 9
37 2
38 4
39 4
40 8
41 2
42 8
43 2
44 6
45 6
46 4
47 2
48 10
49 3
50 6
51 4
52 6
53 2
54 8
55 4
56 8
57 4
58 4
59 2
60 12
61 2
62 4
63 6
64 7
65 4
66 8
67 2
68 6
69 4
70 8
71 2
72 12
73 2
74 4
75 6
76 6
77 4
78 8
79 2
80 10
81 5
82 4
83 2
84 12
85 4
86 4
87 4
88 8
89 2
90 12
91 4
92 6
93 4
94 4
95 4
96 12
97 2
98 6
99 6
*/

/*
素数がきたらかけてあげれば良さげ
pの何乗かの判定が面倒そう
割ってかければいいのか
3163
*/

int cnt_add(int a, int b)
{
	int res = 1;
	while (a != 0 && a % b == 0)
	{
		res++;
		a /= b;
	}
	return (res);
}

int	main(void)
{
	vector<long long> prime(1e7 + 1, 1);
	for (int i = 2; (long long)i * 2 <= 1e7; i++)
	{
		if (prime[i] == 1)
		{
			int next = 2;
			while ((long long)i * next <= 1e7)
			{
				prime[i * next] *= cnt_add(i * next, i);
				next++;
			}
		}
	}
	int n;
	cin >> n;
	long long ans = 1;
	for (int i = 2; i <= n; i++)
	{
		ans += (long long)i * (prime[i] + (prime[i] == 1));
	}
	cout << ans << endl;
	return (0);
}

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

int main() {
    int s[5];
    for(int i=0;i<5;i++) s[i]=0;
    for(int i=0;i<6;i++){
        int a;
        cin >> a;
        s[a]++;
    }
    if(s[1]<=2&&s[2]<=2&&s[3]<=2&&s[4]<=2) cout << "YES" <<endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


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

    map<int, int> mp;
    auto mppush = [&](int x){
        if (mp.find(x) == mp.end()){
            mp.insert({x, 1});
        } else {
            mp[x]++;
        }
    };


    for (int p = 2; p <= n; p++)
    {
        int num = p;
        for (int i = 1; i*i <= num; i++)
        {
            if (num%i == 0){
                if (i == 1) continue; 
                while(num%i==0){
                    mppush(i);
                    num/=i;
                }
            }
        }
        mppush(num);
    }
    
    ll ans = 1;
    for (auto i = mp.begin(); i != mp.end(); i++)
    {
        if ((*i).first != 1){
            //cout << (*i).first << " " << (*i).second << endl;
            ans *= (*i).second+1;
            ans %= MOD;
        }
    }
        
    cout << ans << endl;

}



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

int main(){
	int n;
	cin >> n;
	int r = 2*n-1;
	int a[r];
	for(int i = 0; i < r; i++) cin >> a[i];
	int s = 2; //is at least s
	int e = r;
	while(s + 1 < e){
		int m = (s+e)/2;
		int newa[r];
		for(int i = 0; i < r; i++) newa[i] = (a[i] >= m);
		int st = n-1;
		int ans = newa[0];
		int dist = 1000000;
		for(int i = st; i + 1 < r; i++){
			if(newa[i] == newa[i+1]){
				if(abs(i-st) <= dist){
					dist = abs(i-st);
					ans = newa[i];
				}
			}
		}
		for(int i = st; i -1 >= 0; i--){
			if(newa[i] == newa[i-1]){
				if(abs(i-st) <= dist){
					dist = abs(i-st);
					ans = newa[i];
				}
			}
		}
		if(ans){
			s = m;
		} else {
			e = m;
		}
	}
	cout << s << endl;
}

Measured memory_bytes: 1920
n = int(input())
num2alpha = lambda c: chr(c+96)
li = []
while n>26:
    b = n%26
    n//=26
    if b==0:
        li.append("z")
        n-=1
    else:
        li.append(num2alpha(b))

if n<=26:
    li.append(num2alpha(n))

li.reverse()
print("".join(li))


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

int main(){
  int l, r, d;
  cin >> l >> r >> d;
  int ans = 0;
  for(int i = l; i <= r; i++){
    if(i % d == 0) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3616
import java.util.Scanner;
public class Main{
     
    public void solve(){
		Scanner sc = new Scanner(System.in);
		
        int h,m,s;
		int jikan = sc.nextInt();
		
			h = jikan / 3600;
			m = (jikan - h * 3600 ) / 60;
			s = ((jikan - h * 3600 ) - m *60);
			
			System.out.println(h+":"+m+":"+s);
		
    }

       public static void main(String[]args){
        Main obj = new Main();
        obj.solve();
     }
}

Measured memory_bytes: 17356
#include<stdio.h>

int main()
{
	int A,B,C,i,r=-1;
	scanf("%d%d%d",&A,&B,&C);
	for(;C<10000000;C+=60)
	{
		i=C%(A+B);
		if(i<=A)
		{
			r=C;
			break;
		}
	}
	printf("%d\n",r);
	return 0;
}

Measured memory_bytes: 596
use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::str::FromStr;

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

fn main() {
    let h: usize = read();
    let w: usize = read();
    let a: usize = read();
    let b: usize = read();
    let mut wid = vec![0; h];
    let mut hei = vec![0; w];
    let mut matrix: Vec<Vec<i64>> = vec![vec![100; w]; h];
    for i in 0..h {
        for j in 0..w {
            if wid[i] < w - a && hei[j] <h - b {
                matrix[i][j] = 0;
                wid[i] += 1;
                hei[j] += 1;
            } else {
                matrix[i][j] = 1;
            }
        }
    }
    for i in 0..h {
        for j in 0..w {
            if j < w - 1 {
                print!("{}", matrix[i][j]);
            } else {
                println!("{}", matrix[i][j]);
            }
        }
    }
}

Measured memory_bytes: 9932
// #include <bits/stdc++.h>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<map>
#include<set>
#include<vector>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<numeric>
#include<string>
#include<tuple>
using namespace std;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline void                             in(T &p){cin>>p;}
template<class T1,class T2>inline void                   in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void          in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T>inline void                             ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
template<class T>inline void                             outs(T p){for_each(all(p),out<decltype(p[0])>);}
string S,s="CODEFESTIVAL2016";
long N,ans;
inline void solve(void){
  in(S);
  N=S.size();
  rep(i,N){
    if(S[i]!=s[i])ans++;
  }
  out(ans);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll                          long long
#define in(a)                       ll a; cin>>a;
#define in2(a,b)                    ll a,b; cin>>a>>b;
#define in3(a,b,c)                  ll a,b,c; cin>>a>>b>>c;
#define in4(a,b,c,d)                ll a,b,c,d; cin>>a>>b>>c>>d;
#define in5(a,b,c,d,e)              ll a,b,c,d,e; cin>>a>>b>>c>>d>>e;
#define lelo(b)                     for(auto &i:b)cin>>i;
#define ff                          first
#define ss                          second
#define call(v)                     v.begin(),v.end()
#define rall(v)                     v.rbegin(),v.rend()
#define show(x)                     for(auto t:x)cout<<t<<" ";
#define pb                          push_back
#define bhar(s,v)                   memset(s,v,sizeof(s))
#define endl                        "\n"                       
#define ce(x)                       cout<<x<<"\n";
#define nl                          cout<<endl;
#define jaldi                       ios_base::sync_with_stdio(false);cin.tie(NULL);
#define dekh_lo                     ce("dekh_lo");
#define sz(x)                       (ll)x.size()
#define re                          return

typedef pair<ll,ll> pii;
typedef vector<pii> vii;
typedef vector<ll> vi;

const ll mod=1e9+7;
const ll N=4e5+5;

void solve(){
    in3(h,w,m);

    ll s=m;
    vii cor;
    while(s--){
        in2(x,y);
        cor.pb({x,y});
    }

    vi row(h+1,0),col(w+1,0);
    map<pii,bool> hash;

    for(ll i=0;i<sz(cor);i++){
        row[cor[i].ff]++;
        col[cor[i].ss]++;
        hash[{cor[i].ff,cor[i].ss}]=1;
    }

    ll maxi1=-1e9;
    vi ind1;
    for(ll i=1;i<=h;i++){
        if(row[i]>maxi1){
            maxi1=row[i];
        }
    }

    for(ll i=1;i<=h;i++){
        if(row[i]==maxi1){
            ind1.pb(i);
        }
    }

    ll maxi2=-1e9;
    vi ind2;
    for(ll i=1;i<=w;i++){
        if(col[i]>maxi2){
            maxi2=col[i];
        }
    }

    for(ll i=1;i<=w;i++){
        if(col[i]==maxi2){
            ind2.pb(i);
        }
    }

    bool f=1;
    for(auto j:ind1){
        for(auto i:ind2){
            if(!hash[{j,i}]){
                cout<<maxi2+maxi1<<endl;
                re;
            }
        }   
    }
   

    ce(maxi1+maxi2-1);

   
}

int32_t main(){
    // jaldi
    ll t; 
    // cin>>t;
    t=1;     
    while(t--){
        solve();
    }
}

/*


*/

  

Measured memory_bytes: 40084
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <stack>
#include <vector>
#include <random>
#include <set>
#include <map>
#include <queue>
#include <bitset>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)

int main(){
	int m,n,k,t;
	cin >> m >> n;
	if(m==2){
		int ans1=0,ans2=0;
		vector<int> a(n),b(n),c(n);
		FOR(i,0,n){
			cin >> a[i];
			b[i] = 2-(i&1);
			c[i] = 3-b[i];
			ans1 += a[i]!=b[i];
			ans2 += a[i]!=c[i];
		}
		cout << min(ans1,ans2) << endl;
	}else{
		int ans = 0;
		cin >> k;
		FOR(i,0,n-1){
			cin >> t;
			if(t==k){
				ans++;
				k = -1;
			}else{
				k = t;
			}
		}
		cout << ans << endl;
	}
}



Measured memory_bytes: 3844
//control+option+n to run!
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define NEGFOR(i, a, b) for (ll i = (a); i > (b); i--)
#define vll vector <long long>
#define sll set <long long>
#define ld long double
#define inf 1000000000000000000;
#define mll multiset <long long>
#define nn <<"\n"
#define F(i,b) for (ll i=0; i<b; i++)
//10^8 operations per second
//greatest int is 2,147,483,647
//greates long long is 9.22337204e18

//ALL FUNCTIONS SHOULD BE LL!!!!
long long power(long long a, long long b) {
    if (b == 0)
        return 1;
    long long res = power(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}


ll log(ll base, ll number)
{

  int x = base;
  int count = 1;
  while (base < number)
  {
    base *= x;
    count++;
  }
  return count;
}

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

  
  ll d ,t ,s;
  cin>>d>>t>>s;

  if (t*s>=d){
    cout<<"Yes \n";
  }else{
    cout<<"No \n";
  }
  
}


Measured memory_bytes: 3592
A,B,C=map(int,input().split())
if A==B==C and A%2==B%2==C%2==0:
  print('-1')
elif A%2!=0 or B%2!=0 or C%2!=0:
  print('0')
else:
  ans=0
  while A%2==0 and B%2==0 and C%2==0:
    a=A
    b=B
    c=C
    A=int((b+c)/2)
    B=int((c+a)/2)
    C=int((a+b)/2)
    ans+=1
  print(ans)
   

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

namespace ABC119D
{
    static class MainClass
    {

        //static int[] s;
        static int[] abq;
        static List<long> s,t,u;



        public static void Main(string[] args)
        {

            abq = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);
            s = new List<long>();
            t = new List<long>();
           
           s.Add(-(long)(Math.Pow(10,10)*2));
           t.Add(-(long)(Math.Pow(10,10)*2));
            for(int i = 0; i < abq[0]; i++)
            {
                s.Add(long.Parse(Console.ReadLine()));
            }
            for (int i = 0; i < abq[1]; i++)
            {
                t.Add(long.Parse(Console.ReadLine()));
            }
            s.Add((long)(Math.Pow(10,10)*2));
            t.Add((long)(Math.Pow(10,10)*2));

            var anslist = new List<long>();

            for(int i=0;i<abq[2];i++){
                long q = long.Parse(Console.ReadLine());
                long sl = s[LowerBound(s,q)];
                long sr = s[UpperBound(s,q)];
                long tl = t[LowerBound(t,q)];
                long tr = t[UpperBound(t,q)];
                //Console.WriteLine(sl + " " + sr + " " + tl + " " + tr);

                long ans = Math.Min(Math.Abs(sl-q)+Math.Abs(tl-sl),Math.Abs(sl-q)+Math.Abs(tr-sl));
                ans = Math.Min(ans,Math.Abs(sr-q)+Math.Abs(tl-sr));
                ans = Math.Min(ans,Math.Abs(sr-q)+Math.Abs(tr-sr));
                ans = Math.Min(ans,Math.Abs(tl-q)+Math.Abs(tl-sl));
                ans = Math.Min(ans,Math.Abs(tl-q)+Math.Abs(tl-sr));
                ans = Math.Min(ans,Math.Abs(tr-q)+Math.Abs(tr-sl));
                ans = Math.Min(ans,Math.Abs(tr-q)+Math.Abs(tr-sr));
                anslist.Add(ans);
            }

            anslist.ForEach(Console.WriteLine);
            return;


        }
        public static int LowerBound<T>(List<T> list, T item){
            int idx = list.BinarySearch(item);
            if(idx<0){
                return ~idx -1;
            }else{
                return idx;
            }
        }
        public static int UpperBound<T>(List<T> list, T item){
            int idx = list.BinarySearch(item);
            if(idx<0){
                return ~idx;
            }else{
                return idx;
            }
        }
    }
}


Measured memory_bytes: 22100
# 写経

n,m=map(int,input().split())
ab=[]

for i in range(m):
    ab.append(tuple((map(int,input().split()))))

sep=[0]*n

ab.sort(key=lambda x:x[1])

ans=0
pre=0

for i in range(m):
    if pre<=ab[i][0]:
        ans+=1
        pre=ab[i][1]
    else:
        pre=min(pre,ab[i][1])    
print(ans)

Measured memory_bytes: 19008
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <set>
#define lowbit(x) (x&(-x))
#define MAX(a,b) (a<b?b:a)
#define MIN(a,b) (a<b?a:b)
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int N = 1e5;
const int maxn = 3e5 + 5;
ll mod = 1e9 + 7;

int n, a[maxn];

int main()
{
	scanf("%d", &n);
	n <<= 1;
	for (int i = 1; i <= n; i++) scanf("%d", a + i);
	sort(a + 1, a + n + 1);
	ll ans = 0;
	for (int i = 1; i <= n; i += 2)
	{
		ans += a[i];
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>
#include <string>
#include <bitset>
#include <functional>
#include <iomanip>

using namespace std;
using lint = long long;
using vb = vector<bool>;
using vi = vector<int>;
using vl = vector<int>;
using pii = pair<int, int>;
using pll = pair<lint, lint>;
using pqi = priority_queue<int>;
using pql = priority_queue<lint>;
#define mii = map<int, int>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n); i > 0; i--)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define repf(i, f, n) for (int i = (f); i < (n); i++)
#define mp(x, y) make_pair((x), (y))
#define pb(x) push_back((x))
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define foreach(it, x) for (auto it = (x).begin(); it != (x).end(); it++)
#define space (char)0x20
#define yes "Yes"
#define no "No"

constexpr lint MOD = 1e9 + 7;
lint A, B, C, D, E, F, G, H, I, J, K, L, M, N;
lint O, P, Q, R, S, T, U, V, W, X, Y, Z;
string s;
// int ans = 1;
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
 
	cin >> s;
    
    cout << (s.find("7") != string::npos ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
    ll c[13];
    ll a[13][13];
    ll n,m,x;
ll mini=1e18;
ll flag=0;
void rec(string s)
{
    if(s.length()==n)
    {
        ll cost=0;
        ll ar[m+1];
                for(ll j=1;j<=m;j++)
                {
                    ar[j]=0;
                }
        for(ll i=1;i<=n;i++)
        {
            if(s[i-1]=='1')
            {
                cost+=c[i];
                for(ll j=1;j<=m;j++)
                {
                    ar[j]+=a[i][j];
                }
            }
        }
        ll f=1;
        for(ll i=1;i<=m;i++)
        {
            if(ar[i]<x)
                f=0;
        }
        if(f==1)
        {
            flag=1;
            mini=min(mini,cost);
        }
    }
    else
    {
        rec(s+"0");
        rec(s+"1");
    }
}
int main() {
    cin>>n>>m>>x;
    for(ll i=1;i<=n;i++)
    {
        cin>>c[i];
        for(ll j=1;j<=m;j++)
        {
            cin>>a[i][j];
        }
    }
    string s="";
    rec(s);
    if(flag==0)
    {
        cout<<"-1";
        
    }
    else
    {
        cout<<mini;
    }
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll x, ll y) {
	ll res = 1;
	for (ll i = 0; i < y; i++) res = res * x % mod;
	return res;
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

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: 3552
#include <bits/stdc++.h>
using namespace std;
char s[60][60];
int main()
{
    int h,w; cin>>h>>w;
    char x;
    for(int i=0;i<h;i++) scanf("%s",s[i]);
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if(s[i][j]=='#')
            {
                if((s[i][j+1]=='#')+(s[i][j-1]=='#')+(s[i+1][j]=='#')+(s[i-1][j]=='#')==0)
                    return !printf("No");
            }
        }
    }
    return !printf("Yes");
}


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

int isX(string s){
  int i;
  string t="";
  for(i=0;i<s.size();i++){
    if(s[i]!='x')t+=s[i];
  }
  if(t=="")return 0;
  for(i=0;i<=(t.size()-1)/2;i++){
    if(t[i]!=t[t.size()-1-i])return -1;
  }
  return 1;
}

int main(){
  int i,j;ll cnt=0;
  string s;
  cin>>s;
  if(isX(s)==-1){
    cout<<-1;
    return 0;
  }
  if(isX(s)==0){
    cout<<0;
    return 0;
  }
  int c[s.size()+1];
  for(i=0;i<=s.size();i++)c[i]=0;
  int n=s.size();
  for(i=0;i<n;i++){
    if(s[i]=='x')c[cnt]++;
    else cnt++;
  }
  int m=cnt+1;cnt=0;
  for(i=0;i<=(m-1)/2;i++){
    cnt+=max(c[i]-c[m-1-i],c[m-1-i]-c[i]);
  }
  cout<<cnt;
}

Measured memory_bytes: 1040
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;
ll const MAX_N = 510000;
ll const MOD = 1000000007;

int main() {
    ll K, S;
    cin >> K >> S;

    ll cnt = 0;
    rep(i, K + 1) {
        rep(j, K + 1) {
            ll k = S - (i + j);
            if (k >= 0 && k <= K) {
                // cout << "(i,j,k) = "
                //      << "(" << i << "," << j << "," << k << ")" << endl;
                cnt++;
            }
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3584
/*  Success may not come to me immediately,
 *  but it will come definitely....
 */
#include <bits/stdc++.h>
//=====================================================================
using namespace std;
//=====================================================================
#define opt ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//=====================================================================
#define li      int64_t
#define ld      double_t
#define ulli    uint64_t
//=====================================================================
#define rep(i,a,b)  for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define repi(i,v)   for(i=v.begin();i!=v.end();i++)
#define repir(i,v)  for(i=v.rbegin();i!=v.rend();i++)
#define elif        else if
#define mset(a,b)   memset(a,b,sizeof(a))
#define nl          cout<<'\n'
//=====================================================================
typedef vector<li>       vli;
typedef vector<string>   vstr;
typedef pair<li,li>      pli;
typedef pair<li,pli >    ppli;
typedef pair<li,ppli >   pppli;
typedef vector<pli >     vpl;
typedef vector<ppli >    vppli;
typedef vector<pppli >   vpppli;
//=====================================================================
#define pb  push_back
#define pob pop_back
#define pf  push_front
#define pof pop_front
#define all(v)  v.begin(),v.end()
#define itr iterator
#define rtr reverse_iterator
#define sz  size()
#define lb  lower_bound
#define ub  upper_bound
#define bs  binary_search
#define mp  make_pair
#define F   first
#define S   second
//=====================================================================
#define mod (li)(1e9+7)
#define inf (li)(1e18)
#define MX1 (li)(1e5+5)
#define MX2 (li)(1e6+5)
#define pi  acos(-1)
//=====================================================================
li power(li a,li b){li ans=1;while(b){if(b&1){ans=(ans*a)%mod;}
a=(a*a)%mod;b>>=1;}return ans;}
//=====================================================================
li mmi(li n){return power(n,mod-2);}
//=====================================================================
li two(li n){return (1LL<<n);}
//=====================================================================
void onbit(li &n,li x){n|=two(x);}
//=====================================================================
void offbit(li &n,li x){n&=~two(x);}
//=====================================================================
li cntbit(li n){li res=0;while(n and ++res)n-=n&-n;return res;}
//=====================================================================
li dx[]={-1,0,1,0},dy[]={0,-1,0,1};
//=====================================================================
/*------------------------MAIN CODE BEGINS NOW!------------------------*/

li n,a[MX1];

void solve(){
  li i;cin>>n;
  rep(i,1,n+1) cin>>a[i];
  li cnt=0;
  rep(i,1,n+1){
    if(a[a[i]]==i) cnt++;
  }
  cout<<cnt/2;nl;
}

int main(){
  opt
  li t=1;
  //cin>>t;
  while(t--){
    solve();
  }
  return 0;
}

Measured memory_bytes: 1024
n, x = map(int, input().split())
xl = list(map(int, input().split()))

if n == 1:
    print(abs(xl[0] - x))
    exit()

xl.append(x)
xl.sort()
xl.reverse()

_d = []
d = 1

for i in range(n):
    if i == n:
        break

    _d.append(xl[i] - xl[i + 1])

for i in range(2, min(_d) + 1):
    for j in _d:
        if j % i != 0:
            break
    else:
        d = i

print(d)

Measured memory_bytes: 14224
#import numpy as np
#from numpy import*
from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    h,w=map(int,input().split())
    grid=[list(map(int,input().split()))for i in range(10)]
    
    c=0
    grid=shortest_path(csgraph=csr_matrix(grid))
    for i in range(h):
        for j in map(int,input().split()):
            if j!=-1:
                c+=grid[j][1]
#    print(grid)
    print(int(c))
if __name__ == '__main__':
    main()

Measured memory_bytes: 18616
#include"iostream"
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<list>
#include<map>
#include<string>
#include<algorithm> 
#include <queue> 
#include <sstream>
#include <fstream>
#include<cmath>
#define INF 1000000000
#define LL long long
using namespace std;

vector<LL> v;

long long N, M,K, ans, A[100000],use[10];
string s;
LL P[50],al[50];//パティと全体

LL burg(LL N, LL X) {
	if (P[0] == -1) {
		P[0] = 1;
		for (int i = 1; i < N; i++) {
			P[i] = 2 * P[i - 1] + 1;
		}
	}
	if (al[0] == -1) {
		al [0] = 1;
		for (int i = 1; i < N; i++) {
			al[i] = 2 * al[i - 1] + 3;
		}
	}
	if (N == 0) {
		if (X > 0)	return 1;
		else return 0;
	}
	else {
		if (X <= al[N-1]+1) {
			return burg(N - 1, X - 1);
		}
		else {
			return P[N - 1] + 1 + burg(N - 1, X - (al[N - 1] + 1) - 1);
		}
	}
}

int main() {
	cin >> N>>K;
	P[0] = -1;
	al[0] = -1;
	cout << burg(N,K)<<endl;
	return 0;
}

Measured memory_bytes: 256
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 4010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int n, a[MAXN];
vector<int> f[3];
string s;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> s;
    s = " " + s;
    FOR(i,1,n)
        if (s[i] == 'R') a[i] = 0;
        else if (s[i] == 'G') a[i] = 1;
        else a[i] = 2;
    FOR(i,1,n) f[a[i]].push_back(i);
    ll res = 0;
    FOR(i,1,n)
        FOR(j,i+1,n) {
            if (a[i] == a[j]) continue;
            int l = j+1, val = 3 - a[i] - a[j], diff = j - i;
            int dau = 0, cuoi = SZ(f[val])-1;
            while (dau <= cuoi) {
                int mid = (dau + cuoi) >> 1;
                if (f[val][mid] >= l) cuoi = mid-1;
                else dau = mid+1;
            }
            if (dau >= 0 && dau < SZ(f[val])) {
                int num = SZ(f[val]) - dau;
                if (j + diff <= n && a[j + diff] == val) num--;
                res += num;
            }
        }
    cout << res;
    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#define RED '#'
#define BLACK '.'
using namespace std;

int w,h;
char tiles[20][20];

int rc(int x,int y){
  if( x<0 || x>=h )
    return 0;
  if( y<0 || y>=w )
    return 0;
  if( tiles[x][y]==RED )
    return 0;
  tiles[x][y]=RED;

  int rtn=1;
  rtn += rc( x+1,y  );
  rtn += rc( x-1,y  );
  rtn += rc( x,y+1  );
  rtn += rc( x,y-1  );

  return rtn;
}
void pr(){
  for( int i=0;i<h;i++){
    for(int j=0;j<w;j++ )
      cout << tiles[i][j];
    cout << endl;
  }
}

int main(){
  int x,y;

  while( true ){
    cin >> w >> h;
    if( !w&&!h ) break;

    for( int i=0;i<h;i++ )
      for( int j=0;j<w;j++ ){
	cin >> tiles[i][j];
	if( tiles[i][j]=='@' ){
	  tiles[i][j]=BLACK;
	  x=i; y=j;
	}
      }
    //   pr();
    cout << rc( x,y ) << endl;
    //pr();
    //break;
  }

  return 0;
}

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

int main()
{
    int a[3], c=1;
    std:: cin>> a[0]>> a[1]>> a[2];

    std:: sort(a, a+3);

    for(int i=0; i<2; i++)
    {
        if(a[i]==a[i+1])
        c++;
    }

    std:: cout<< (c==2? "Yes\n" : "No\n");
    return 0;
}


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

int main() {
    int a, p;
    cin >> a >> p;
    a *= 3;
    a += p;
    cout << (int)a / 2 << endl;
}

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

signed main(){
	string s;
	bool f = 1;

	cin >> s;
	for (int i = 0; i < 3; i++){
		if (s[i] == s[i + 1]) f = 0;
	}

	cout << (f ? "Good" : "Bad") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long double pi = acos(-1.0); 
typedef long long ll;

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

	ll n;
	cin >> n;
	vector<char> v;
	while(n > 0) {
		int m = n % 26;
		n = n / 26;
		if(m == 0) {
			n -= 1;
			v.push_back(122);
		}else {
			v.push_back(96 + m);
		}
	}
	for(int i = (int)v.size() - 1; i >= 0; i--) {
		cout << v[i];
	}
}

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

int main(){
    int N;
    long ans=0;

    cin>>N;
    vector<long> tt(N);

    for(auto &x:tt){
        cin>>x;
        x%=2;
        ans+=x;
    }

    if(ans==0){
        cout<<"second"<<endl;
    }else{
        cout<<"first"<<endl;
    }
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <assert.h>
#include <string>
#include <algorithm>
#include <sstream>
#include <iostream>

typedef long long ll;
const int maxl = 100010;
const int mod = 1e9 + 7;

struct node {
    int p, y;
    int idx, rank;
} nd[maxl];

int n, m;

bool cmp(const node &a, const node &b) {
    if (a.p != b.p)
        return a.p < b.p;
    return a.y < b.y;
}

bool cmp2(const node &a, const node &b) {
    return a.idx < b.idx;
}

int main() {
    while (scanf("%d%d", &m, &n) != EOF) {
        for (int i = 1; i <= n; i++) {
            scanf("%d%d", &nd[i].p, &nd[i].y);
            nd[i].idx = i;
        }
        std::sort(nd + 1, nd + 1 + n, cmp);

        int rank = 0;
        for (int i = 1; i <= n; i++) {
            if (i == 1 || nd[i].p != nd[i-1].p)
                rank = 0;
            rank++;
            // printf("%d %d %d %d\n", i, nd[i].p, nd[i].y, rank);
            nd[i].rank = rank;
        }
        std::sort(nd + 1, nd + 1 + n, cmp2);
        for (int i = 1; i <= n; i++) {
            printf("%06d%06d\n", nd[i].p, nd[i].rank);
        }
    }

    return 0;
}


Measured memory_bytes: 3072
#include<cstdio>
int n,k,a[300005];
int main(){
	scanf("%d%d",&k,&n);
	if(k&1){
		for(int i=1;i<=n;++i) a[i]=k+1>>1;
		int t=n,x=n/2;
		while(x--)
			if(a[t]==1) a[t--]=k;
			else --a[t],t=n;
		for(int i=1;i<=t;++i) printf("%d ",a[i]);
	}
	else{
		printf("%d ",k/2);
		for(int i=1;i<n;++i) printf("%d ",k);
	}
}

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

const int maxn = 2e5 + 5;

long long s[maxn],a[maxn];
long long sum,x,ans,n,j,y;

int main()
{
    while(scanf("%lld",&n) != EOF)
    {
        map<long long,long long> q;
        sum = 0;
        j = 0;
        ans = 0;
        for(int i = 1;i <= n;i++)
        {
            scanf("%lld",&a[i]);
            sum += a[i];
            s[++j] = sum;
            q[sum]++;
        }
        for(int i = 1;i <= j;i++)
        {
            x = s[i];
            y = q[x];
            if(x == 0) ans++;
            ans += y * (y - 1) / 2;
            q[x] = 1;
        }
        printf("%lld\n",ans);
    }
    return 0;
}

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

VV g;
vector<bool> used;
V topo;

void dfs(ll now){
    if(used[now])return;
    used[now]=true;
    for(ll to:g[now]){
        dfs(to);
    }
    topo.push_back(now);
}

int main(){
    ll n,m;
    cin>>n>>m;
    g.assign(n, V());
    rep(i,m){
        ll x,y;
        cin>>x>>y;
        g[x].push_back(y);
    }
    used.assign(n, false);
    rep(i,n)dfs(i);
    reverse(topo.begin(), topo.end());
    rep(i,n)cout<<topo[i]<<endl;
}



Measured memory_bytes: 3936
import java.util.Scanner;

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

        while (true) {
            int n = inScanner.nextInt();
            int m = inScanner.nextInt();

            if (n == 0 && m == 0) {
                break;
            }

            int[] tarou = new int[n];
            int[] hanako = new int[m];
            int wa_tarou = 0;
            int wa_hanako = 0;

            for (int i = 0; i < n; i++) {
                int tmp = inScanner.nextInt();
                tarou[i] = tmp;
                wa_tarou += tmp;
            }
            for (int i = 0; i < m; i++) {
                int tmp = inScanner.nextInt();
                hanako[i] = tmp;
                wa_hanako += tmp;
            }

            int t_ans = 101;
            int h_ans = 101;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if (wa_tarou - tarou[i] + hanako[j] == wa_hanako - hanako[j] + tarou[i]) {
                        if (t_ans + h_ans >= tarou[i] + hanako[j]) {
                            t_ans = tarou[i];
                            h_ans = hanako[j];
                        }
                    }
                }
            }
            if (t_ans == 101 && h_ans == 101)
                System.out.println("-1");
            else
                System.out.println(t_ans + " " + h_ans);
        }
    }
}

Measured memory_bytes: 28896
#include <iostream>
#include <queue>
#include <algorithm>
#include <set>
#include <vector>
#include <string>

using namespace std; using ll=long long; const int INF=1e9; using P=pair<ll,ll>;
struct tp {ll c,i,j; bool operator<(const tp t) const {if (c!=t.c) return c<t.c; else if (i!=t.i) return i<t.i; else return j<t.j;}
bool operator>(const tp t) const {if (c!=t.c) return c>t.c; else if (i!=t.i) return i>t.i; else return j>t.j;}};
struct unf {
  vector<int> v; unf(int n){v.resize(n); for(int i=0;i<n;i++) v[i]=i;}
  int root(int x) { if (v[x]==x) return x; return v[x]=root(v[x]);}
  void unite(int x,int y) {int p=root(x), q=root(y); if (p==q) return; v[p]=q;}
  bool same(int x, int y) {return root(x)==root(y);}
  void print() {for(int x:v) cout<<x<<" "; cout<<endl;}
};

int main() {
  int n; cin>>n;
  P x[n], y[n]; unf uu(n);
  for(int i=0;i<n;i++) cin>>x[i].first>>y[i].first;
  for(int i=0;i<n;i++) x[i].second=y[i].second=i;

  sort(x,x+n); sort(y,y+n);

  priority_queue<tp, vector<tp>, greater<tp>> que;
  for(int i=0;i<n-1;i++) {
    que.push({x[i+1].first-x[i].first, x[i+1].second, x[i].second});
    que.push({y[i+1].first-y[i].first, y[i+1].second, y[i].second});
  }

  ll an=0;
  while(!que.empty()) {
    tp o = que.top(); que.pop();
    //cout<<o.c<<" "<<o.i<<" "<<o.j<<endl;
    if (uu.same(o.i, o.j)) continue;
    an += o.c;
    uu.unite(o.i, o.j);
  }
  cout<<an<<endl;
}

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

int main() {
  int n; cin>>n;
  string s;
  map <string, int> mp;
  rep(i, n){
    cin>>s;
    sort(s.begin(), s.end());
    mp[s]++;
  }
  ll ans=0;
  for(auto& p : mp){
    int s = p.second;
    ans += (ll)s*(s-1)/2;
  }
  cout << ans << endl;
  return 0;
}
  
  


Measured memory_bytes: 11136
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  vector<int> A(3);
  for(int i = 0; i < 3; ++i) cin >> A[i];
  int ans = 0;
  sort(A.begin(), A.end());
  while(A[0] != A[2]){
    if(A[0] != A[1]){
      A[0] += 2;
      ++ans;
      sort(A.begin(), A.end());
    }
    if(A[1] != A[2]){
      --A[2];
      ++ans;
      sort(A.begin(), A.end());
    }
  }
  cout << ans << endl;
 return 0;
}


Measured memory_bytes: 256
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

a,b = inpm()

#lcm
def lcm(A):
    x = A[0]
    for a in A:
        x = (x * a) // math.gcd(x, a)
    return x

print(lcm([a,b]))

Measured memory_bytes: 31220
#include<bits/stdc++.h>
    using namespace std;
    int main() {
      int n, k;
      cin>>n>>k;
      vector<int>vec(n+1);
      vector<int>dp(n+1, INT_MAX);
      
      for(int i=1;i<=n;i++)
        cin>>vec[i];
      
      dp[0]=0;
      dp[1]=0;
      dp[2]=abs(vec[2]-vec[1]);  
     
      for(int i=3;i<=n;i++) 
      	for(int j=1;j<=k && i>j;j++) 
        	dp[i]=min(dp[i-j]+abs(vec[i-j]-vec[i]), dp[i]);
      
      cout<<dp[n]<<endl;
      
    }  

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

void printVec(vector<int> &v, int len){
	for(int i=0; i<len; ++i){
		cerr << v[i] << ", ";
	}
	cerr << endl;
}

int main(){
	string S;
	cin >> S;
	int N = S.length();

	vector<int> A(N); //A[i] <=> i番目の右側に何個Lが連続しているか(i番目も含む)
	vector<int> B(N); //B[i] <=> i番目の左側に何個Rが連続しているか(i番目も含む)
	vector<int> ans(N, 0);
	
	int count = 0;
	for(int i=0; i<N; ++i){
		if(S[i] == 'R'){
			++count;
		}
		else{
			count = 0;
		}
		B[i] = count;
	}
	
	count = 0;
	for(int i=N-1; i>=0; --i){
		if(S[i] == 'L'){
			++count;
		}
		else{
			count = 0;
		}
		A[i] = count;
	}
	
	//cerr << S << endl;
	//printVec(A, N);
	//printVec(B, N);

	/*
	  RRLRL
A:  0, 0, 1, 0, 1,
B:  1, 2, 0, 1, 0,
	*/

	for(int i=0; i<N-1; ++i){
		if(B[i] != 0 && B[i+1] == 0){
			ans[i] += (B[i]+1)/2;
			ans[i+1] += B[i]/2;
		}
	}

	for(int i=N-1; i>=1; --i){
		if(A[i] != 0 && A[i-1] == 0){
			ans[i] += (A[i]+1)/2;
			ans[i-1] += A[i]/2;
		}
	}


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


Measured memory_bytes: 1792
R, G, B, N = list(map(int, input().split()))

count = 0
for r in range(3001):
    if r*R > N:
        break
    for g in range(3001):
        n = N-(r*R+g*G)
        if n<0:
            break
        if n%B == 0:
            count += 1
print(count)


Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace AtCoder
{
    class ABC179B
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            //string[] str = Console.ReadLine().Split(' ');
            int max = 0;
            int count =0;
            for(int i = 0; i < n; i++)
            {
                string[] str = Console.ReadLine().Split(' ');
                int a = int.Parse(str[0]);
                int b = int.Parse(str[1]);
                if(a==b)
                {
                    count++;
                    if(max < count)
                    {
                        max = count;
                    }
                }
                else
                {
                    count = 0;
                }
            }
            if(max >= 3)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 27552
// abc079_b
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <utility>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define FOR(i, a) for (auto i : a)
#define pb push_back
#define all(in) in.begin(), in.end()
#define shosu(x) fixed << setprecision(x)
#define show1d(v)                                                              \
  rep(i, v.size()) cout << " " << v[i];                                        \
  cout << endl << endl;
#define show2d(v)                                                              \
  rep(i, v.size()) {                                                           \
    rep(j, v[i].size()) cout << " " << v[i][j];                                \
    cout << endl;                                                              \
  }                                                                            \
  cout << endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def, Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def, pii> pip;
typedef vector<pip> vip;
template <typename A, typename B> bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int main(int argc, char *argv[]) {
  int n;
  vector<ll> l;
  l.push_back(2);
  l.push_back(1);
  cin >> n;
  if (n == 1) {
    cout << l.at(1) << endl;
    return 0;
  } else {
    for (int i = 2; i <= n; ++i) {
      l.push_back(l.at(i - 2) + l.at(i - 1));
    }
  }
  cout << l.back() << endl;
  return 0;
}


Measured memory_bytes: 256