akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(itr,c) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
ll dp[100005];
int main(){
	ll N,W;
	cin>>N>>W;
	ll w[N],v[N];
	rep(i,N){
		cin>>w[i]>>v[i];
	}
	rep(i,W+1){
		dp[i]=-INF;
	}
	dp[0]=0;
	rep(i,N){
		ford(j,W+1){
			if(dp[j]>=0&&j+w[i]<W+1){
				dp[j+w[i]]=max(dp[j+w[i]],dp[j]+v[i]);
			}
		}
	}
	ll ans=0;
	rep(i,W+1){
		ans=max(ans,dp[i]);
	}
	cout<<ans;
	re 0;
}

Measured memory_bytes: 1024
use std::io;


fn main() {
    let mut n = read::<usize>();
    n.sort();
    n.dedup();
    println!("{}", n.len());
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str;
      
      n=3;
      
      set<ll>s;
      
      for(i=0; i<n; i++)
      {
          cin>>a;
          
          s.insert(a);
      }
      
      cout<<s.size()<<endl;
      
      













}



Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LLP;

int main() {
  
  int N;
  cin >> N;
  vector A(2, vector<int>(N));
  rep(i,2) rep(j,N) cin >> A[i][j];

  int ans = 0;
  rep(i,N) {
    int count = 0;
    rep(j,N) {
      if (j <= i) count += A[0][j];
      if (i <= j) count += A[1][j];
    }
    ans = max(ans, count);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3604
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Map<Integer, Integer> even = new HashMap<>();
    Map<Integer, Integer> odd = new HashMap<>();
    for(int i = 0; i < N; i++){
      int a = sc.nextInt();
      Map<Integer, Integer> tmpMap = (i % 2 == 0) ? even : odd;
      int count = 1;
      if(tmpMap.containsKey(a)){
        count += tmpMap.get(a);
      }
      tmpMap.put(a, count);
    }
    int[] maxEven = new int[2];
    int[] maxEvenKey = new int[2];
    int[] maxOdd  = new int[2];
    int[] maxOddKey = new int[2];
    maxEven[0] = 0;
    maxEven[1] = 0;
    maxOdd[0] = 0;
    maxOdd[1] = 0;
    for(int key : even.keySet()){
      int tmp = even.get(key);
      if(maxEven[0] < tmp){
        maxEven[1] = maxEven[0];
        maxEven[0] = tmp;
        maxEvenKey[1] = maxEvenKey[0];
        maxEvenKey[0] = key;
      }else if(maxEven[1] < tmp){
        maxEven[1] = tmp;
        maxEvenKey[1] = key;
      }
    }
    for(int key : odd.keySet()){
      int tmp = odd.get(key);
      if(maxOdd[0] < tmp){
        maxOdd[1] = maxOdd[0];
        maxOdd[0] = tmp;
        maxOddKey[1] = maxOddKey[0];
        maxOddKey[0] = key;
      }else if(maxOdd[1] < tmp){
        maxOdd[1] = tmp;
        maxOddKey[1] = key;
      }      
    }
    if(maxEvenKey[0] != maxOddKey[0]){
      System.out.println(N - (maxEven[0] + maxOdd[0]));
    }else if(maxEven[0] + maxOdd[1] > maxOdd[0] + maxEven[1]){
      System.out.println(N - (maxEven[0] + maxOdd[1]));
    }else{
      System.out.println(N - (maxOdd[0] + maxEven[1]));
    }
  }
}


Measured memory_bytes: 62660
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
using namespace std;
const int MOD = 1000000007;
const long long INF = 1000000000000000000;
typedef pair<int, int> P;
int par[100000];
int rank1[100000];
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		rank1[i] = 0;
	}
}
int find1(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find1(par[x]);
	}
}
void unite1(int x, int y) {
	x = find1(x);
	y = find1(y);
	if (x == y)return;
	if (rank1[x] < rank1[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank1[x] == rank1[y])rank1[x]++;
	}
}
bool same(int x, int y) {
	return find1(x) == find1(y);
}
pair<long long,int> cost[100000];
int main(){
	int n, m, x, y, i;
	long long a;
	cin >> n>>m;
	init(n);
	for (i = 0; i < n; i++) {
		cin >> a;
		cost[i] = { a,i };
	}
	int tree=1;
	int X[100000]; int Y[100000];
	for (i = 0; i < m; i++) {
		cin >> x >> y;
		X[i] = x; Y[i] = y;
		unite1(x, y);
	}
	for (i = 1; i < n; i++) {
		if (!same(0, i)) {
			tree++;
			unite1(0, i);
		}
	}
	init(n);
	for (i = 0; i < m; i++) {
		unite1(X[i], Y[i]);
	}
	sort(cost, cost + n);
	long long sum = 0;int sup = 1;
	if (2*(tree-1) > n) {
		cout << "Impossible" << endl;
		return 0;
	}
	if (tree > 1) {
		sum += cost[0].first;
		for (i = 1; i < n; i++) {
			if (sup < tree - 1 && same(cost[0].second, cost[i].second)) {
				sum += cost[i].first;
				sup++;
			}
			else if (!same(cost[0].second, cost[i].second)) {
				sum += cost[i].first;
				unite1(cost[0].second, cost[i].second);
			}
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>
 
int main()
{
	int i, j, N, M, k[11], s[11][11], p[11];
	scanf("%d %d", &N, &M);
	for (i = 1; i <= M; i++) {
		scanf("%d", &(k[i]));
		for (j = 1; j <= k[i]; j++) scanf("%d", &(s[i][j]));
	}
	for (i = 1; i <= M; i++) scanf("%d", &(p[i]));
	
	int count = 0, flag[11] = {}, tmp;
	while (1) {
		for (i = 1; i <= M; i++) {
			tmp = 0;
			for (j = 1; j <= k[i]; j++) {
              if (flag[s[i][j]] == 1) tmp ^= 1;
            }
			if (tmp != p[i]) break;
		}
		
		if (i > M) count++;
		for (i = 1; i <= N; i++) if (flag[i] == 0) break;
		if (i > N) break;
		flag[i] = 1;
		for (i--; i >= 1; i--) flag[i] = 0;
	}
	
	printf("%d\n", count);
	fflush(stdout);
	return 0;
}

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

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

  Int n,m;
  cin>>n>>m;
  using P = pair<Int, Int>;
  vector<vector<P> > G(n);
  vector<Int> ind(n,0);
  for(Int i=0;i<m;i++){
    Int a,b,c;
    cin>>a>>b>>c;
    G[a].emplace_back(b,c);
    ind[b]++;
  }

  vector<Int> dp(n,0);
  queue<Int> que;
  que.emplace(0);
  while(!que.empty()){
    Int v=que.front();que.pop();
    for(auto e:G[v]){
      Int u=e.first,c=e.second;
      chmax(dp[u],dp[v]+c);
      ind[u]--;
      if(ind[u]==0) que.emplace(u);
    }
  }

  cout<<dp.back()<<endl;
  return 0;
}



Measured memory_bytes: 3252
#coding: utf-8

rooms = [[0 for i in range(10)] for j in range(12)]
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    b -= 1
    f -= 1
    r -= 1
    rooms[b * 3 + f][r] += v
for i in range(12):
    if i > 0 and i % 3 == 0:
        print('####################')
    for j in range(10):
        print(' %d' % rooms[i][j], end = '')
    print('')


Measured memory_bytes: 5624
#include<stdio.h>

int mult(int x,int y){
	if(y==0)return -1;	
	if(x%y==0)return 1;
	return 0;
}

int main(){
	int n,i,t,current,k;
	int c[500],s[500],f[500],a[500];
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d%d",&c[i],&s[i],&f[i]);
	}
	
	for(i=0;i<n;i++){
		t=0;
		current=i;
		while(1){
			if(current==n-1){
				a[i]=t;
				break;
			}
			while(1){
				if(t>=s[current]){
					if(mult(t-s[current],f[current])==1){
						t+=c[current];
						current++;
						break;
					}
				}
				t++;
			}
		}
	}
	for(i=0;i<n;i++){
		printf("%d\n",a[i]);
	}
	
	return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> vec(m, 0);
  for (int i  = 0; i < n; i++) {
    int k; cin >> k;
    for (int j = 0; j < k; j++) {
      int a;
      cin >> a;
      vec.at(a-1)++;
    }
  }
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    if (vec.at(i) == n) {
      cnt++;
    }
  }
  cout << cnt << endl;
}

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

#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ll long long
#define ld long double
#define pb push_back
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define LDMX LDBL_MAX
#define LDMN LDBL_MIN
#define MAX 1000000
#define pll pair<ll, ll>
#define vl vector<ll>
#define vll vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >    

using namespace std;   


        
int main()
 {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	string st;
  	ll t=0;
	cin>>st;
    for(ll i=0; i<st.length(); i++){
	t=t+ st[i] - '0';
    }
  	if(t%9 == 0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3780
H,W=map(int,input().split())
S=[list(input()) for _ in range(H)]
A=[False]*H
B=[False]*W
for i in range(H):
  for j in range(W):
    if S[i][j]=='#':
      A[i]=True
      B[j]=True

for i in range(H):
  if A[i]:
    for j in range(W):
      if B[j]:
        print(S[i][j], end = '')
    print()

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

int main(){
    int64_t n, k;
    cin >> n >> k;

    int64_t ans = n;
    n = abs(n - (n / k) * k);
    ans = min(n, ans);

    n = abs(n - k);
    ans = min(n, ans);

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

Measured memory_bytes: 256
d, g = map(int, input().split())
pc = [tuple(map(int, input().split())) for _ in range(d)]
ans = 1001001001
for s in range(1 << d):
    now = 0
    rest = g
    for i in range(d):
        if s >> i & 1:
            p, c = pc[i]
            rest -= p * (i+1) * 100 + c
            now += p
    if rest > 0:
        free = d-1
        while d >= 0 and s >> free & 1:
            free -= 1
        if free < 0:
            continue
        t = (rest + (free+1) * 100 - 1) // ((free+1) * 100)
        #print(rest,t)
        if t >= pc[free][0]:
            continue
        now += t
    ans = min(ans, now)
print(ans)

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

using namespace std;
using ll = long long;
constexpr ll mod = 1e9+7;
constexpr ll md = mod;
constexpr ll inf = 1e15;
vector<pair<int,int>> vec = {{0,-1},{-1,0},{0,1},{1,0}};
int main(){
    int n,k;
    cin>>n>>k;
    cout << n%k<< endl;
    return 0;
}



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

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

    int x = (a+k-1)/k * k;
    if(a % k == 0 || b % k == 0 || x <= b) cout << "OK" << endl;
    else cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <stdio.h>

main(){
  int i,j,len,mini,count=0,A[100],tmp;
  
  scanf("%d",&len);
  for(i=0;i<len;i++){
    scanf("%d",&A[i]);
  }
  
  for(i=0;i<len;i++){
    mini=i;
    for(j=i;j<=len-1;j++){
      if(A[j]<A[mini]){
	mini=j;    
      }
    }
    if(mini!=i)count++;
    tmp=A[i];
    A[i]=A[mini];
    A[mini]=tmp; 
  }
  
  for(i=0;i<len;i++){
    printf("%d",A[i]);
    if(i<len-1) printf(" ");
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 604
#include <stdio.h>
#include <math.h>

int main(void) {

    int a, b, h, m;
    scanf("%d %d %d %d", &a, &b, &h, &m);

    double theta1 = (double)m / 60.0 * 2 * (double)M_PI;
    double theta2 = ((double)h + (double)m / 60.0) / 12.0 * 2.0 * (double)M_PI;
    double theta = fabs(theta1 - theta2);

    double l;
    l = sqrt(a * a + b * b - 2 * a * b * cos(theta));

    if (11 * m == 60 * h) {
        l = fabs((double)a - (double)b);
    }

    printf("%.10lf", l);

    return 0;
}

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


using namespace std;


int number_of_row,number_of_column;
int g,h,i,j,count_dotto,k,l;

int main() {
  cin >> number_of_row>>number_of_column;
  vector<vector<char>> data(number_of_row,vector<char>(number_of_column));
  
  
  for ( i = 0; i < number_of_row; i++) {
    for ( j = 0; j < number_of_column; j++) {
      
        cin >> data.at(i).at(j);
      }
    }
	
  
 

  for ( i = 0; i < number_of_row; i++) {
  
    
    count_dotto = 0;
    for ( j = 0; j < number_of_column; j++) {
      
        if (data.at(i).at(j) == '.') {
          count_dotto++;
        }
	
      }
      if (count_dotto == number_of_column){
        for (k = i;k < number_of_row-1;k++){
          data.at(k) = data.at(k+1);  
        }
        i=i-1;
        number_of_row--;
      }
    
    }
  for ( j = 0; j < number_of_column; j++) {
   
    count_dotto = 0;
    for ( i = 0; i < number_of_row; i++) {
      if (data.at(i).at(j) == '.') {
          count_dotto++;
        }
    }
    if(count_dotto == number_of_row){
      for(l = 0;l< number_of_row;l++){
        for(k = j;k< number_of_column-1;k++){
          data.at(l).at(k) = data.at(l).at(k+1);
          }
      }
     number_of_column --;
     j=j-1;
    }
  }
    for ( g = 0; g < number_of_row; g++) {
    
      for ( h = 0; h < number_of_column; h++) {
        cout << data.at(g).at(h) ;
      }
      cout << endl;
    }
}

Measured memory_bytes: 3612
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def solve():
    s = input()
    if s == "ABC":
        print("ARC")
    else:
        print("ABC")

    return 0

if __name__ == "__main__":# {{{
    solve()

# vim: set foldmethod=marker: }}}


Measured memory_bytes: 79596
import java.util.*;
import static java.lang.Math.*;

public class Main{

    static long gcd(long m, long n){
        if(m < n) return gcd(n,m);
        if(n == 0) return m;
        return gcd(n,m % n); 
    }
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long a[] = new long[n];
        boolean flag = true;
        int min = Integer.MAX_VALUE;
        for(int i=0; i<n; i++){
            a[i] = sc.nextLong();
        }

        long ans = a[0];
        for(int i=1; i<n; i++){
            ans = gcd(ans,a[i]);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 62264
//
// Created by Hideaki Imamura on 2020-03-20.
//
# include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair <ll, ll> l_l;
typedef pair<int, int> i_i;

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;
}

# define EPS (1e-7)
# define INF (1e9)
# define PI (acos(-1))
//const ll mod = 1000000007;

ll N, M;
vector<ll> a;

ll f(ll x) {
    ll ans = 0;
    while (x % 2 == 0) {
        x /= 2;
        ans++;
    }
    return ans;
}

//ll gcd(ll a, ll b) {
//    if (a % b == 0) return (b);
//    else return (gcd(b, a % b));
//}
ll gcd(ll a, ll b) {
    if(a < b) return gcd(b, a);
    ll r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

ll lcm_many(vector<ll> v) {
    ll x = v[0];
    for (int i = 0; i < v.size(); ++i) {
        x = lcm(x, v[i]);
        if (x > M) return -1;
    }
    return x;
}

ll solve() {
    for (int i = 1; i < N; ++i) if (f(a[0]) != f(a[i])) return 0;

    ll x = lcm_many(a);
    //cout << x << endl;

    if (x == -1) return 0;
    return (M - x) / (2 * x) + 1;
}

int main() {
    cin >> N >> M;
    a.resize(N);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
        a[i] /= 2;
    }

    cout << solve() << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
 
int main()
{
long long int A,B,K,x,y;
scanf("%ld %ld",&A,&B);
K=(A*A-B*B)/(2*A-2*B);
x=A-K;
y=B-K;
if(abs(x)==abs(y)){ printf("%ld\n",K);}
else{ printf("IMPOSSIBLE\n");}
return 0;
} 

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

int main() {
  int N, a, b, c, d;
  cin >> N;
    a = N / 1000;
    b = N % 1000 /100;
    c = N % 1000 %100 / 10;
    d = N % 1000 % 100 % 10;
  if( a == b && b == c ) {
    cout << "Yes" << endl;
  } else if (b == c && c == d) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N = int(input())
L = list(map(int, input().split()))
ans = 0
for i in range(N-2):
  for j in range(i+1, N-1):
    for k in range(j+1, N):
      a = L[i]
      b = L[j]
      c = L[k]
      if a + b > c and a + c > b and b + c > a and a != b and a != c and b != c:
        ans += 1
print(ans)

Measured memory_bytes: 73792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		final String expected = "CODEFESTIVAL2016";
		final String[] expArr = expected.split("");
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String[] sArr = s.split("");
		int count = 0;
		for (int i = 0; i < expArr.length; i++) {
			if (!sArr[i].equals(expArr[i])) {
				count++;
			}
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const LL INF = 1e18;
const LL MOD = 1e9 + 7;

template<class T> inline bool chmin(T &a, T b){if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){if (a < b) {a = b; return true;} return false;}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  LL n;
  cin >> n;
  LL ans = INF;
  for (LL i = 1; i*i <= n; i++) if (n % i == 0) chmin(ans, i + n/i - 2);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>

template <class T>
inline void read(T &x) {
    x = 0;
    int f = 0;
    char ch = getchar();
    while (!isdigit(ch))    { f |= ch == '-'; ch = getchar(); }
    while (isdigit(ch))     { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    x = f ? -x : x;
    return;
}

typedef long long LL;

LL a, b, n, ans;

int main() {
    read(a), read(b), read(n);
    ans = a * std::min(b - 1, n) / b;
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3728
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include <fstream>
using namespace std;
typedef long long ll;
const ll INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int mod = 1e9+7;
const int maxn =2e5+500;
int pre[maxn];
int n,m,k,d;
void _init(){
	for(int i=0;i<=n;i++)
		pre[i] = i;
}
int _find(int x){
	if(x==pre[x]) return x;
	else {
		int z = _find(pre[x]);
		return pre[x] = z;
	}
}
void _union(int x,int y){
	x = _find(x);
	y = _find(y);
	if(x!=y) pre[y] = pre[x];
}
vector<int>p1[maxn],p2[maxn];
int num[maxn];
int main(){
	cin>>n>>m>>k;
	_init();
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		_union(a,b);
		p1[a].push_back(b);
		p1[b].push_back(a);
	}
	for(int i=0;i<k;i++){
		int a,b;
		cin>>a>>b;
		p2[a].push_back(b);
		p2[b].push_back(a);
	}
	for(int i=1;i<=n;i++){
		num[_find(i)]++; 
	}
//	for(int i=1;i<=n;i++){
//		cout<<_find(i)<<endl;
//	}
	for(int i=1;i<=n;i++){
		int ans = num[_find(i)]-1;
		//cout<<ans<<" ";
		for(int j=0;j<p1[i].size();j++){
			if(_find(i)==_find(p1[i][j])){
			//	cout<<p1[i][j]<<"    ";
				ans--;
			}
		}
		//cout<<ans<<" ";
		for(int j=0;j<p2[i].size();j++){
			if(_find(i)==_find(p2[i][j])){
				ans--;
			}
		}
		cout<<ans<<" ";
		
	}
	return 0;
}


Measured memory_bytes: 17528
#include<iostream>
using namespace std;
const int N=10010;
int n;
int main()
{
    cin>>n;
    if(n%10==3) cout<<"bon"<<endl;
    else if(n%10==1||n%10==0||n%10==6||n%10==8) cout<<"pon"<<endl;
    else cout<<"hon"<<endl;
    return 0;
    
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>
#include <sstream>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

int main(){
    int N;
    cin >> N;
    ll p,q;
    vector<int>P(N),Q(N);

    for(int i = 0;i < N;i++)
        cin >> P.at(i);
    for(int i = 0;i < N;i++)
        cin >> Q.at(i);

    vector<int>Dp(N),Dq(N);

    for(int i = 0;i < N;i++){
        Dp.at(i) = i+1;
    }

    bool pfla,qfla;
    ll cnt = 0;
    do{
        pfla = true;
        qfla = true;
        for(int i = 0;i < N;i++){
            if(Dp.at(i) != P.at(i))
                pfla = false;
            if(Dp.at(i) != Q.at(i))
                qfla = false;
        }

        if(pfla)
            p = cnt;
        if(qfla)
            q = cnt;
        cnt++;

    }while(next_permutation(Dp.begin(),Dp.end()));

    cout << abs(p - q) << endl;

} 

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using lint         = long long;
constexpr lint inf = 1LL << 60;
constexpr lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> c(h);
    for (int i = 0; i < h; ++i) {
        cin >> c[i];
    }
    int ret = 0;
    for (int i = 0; i < 1 << h; ++i) {
        for (int j = 0; j < 1 << w; ++j) {
            int cnt = 0;
            for (int k = 0; k < h; ++k) {
                for (int l = 0; l < w; ++l) {
                    if ((i >> k & 1) || (j >> l & 1))
                        continue;
                    if (c[k][l] == '#')
                        cnt++;
                }
            }
            if (cnt == k)
                ret++;
        }
    }
    cout << ret << "\n";
    return 0;
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n, m, c;
    cin >> n >> m >> c;
    vector<int> a(c);
    for (int i = 0; i < c; ++i)
        cin >> a[i];
    vector< vector<int> > odp(n, vector<int>(m));
    int nr1 = 0, nr2 = 0;
    for (int i = 0; i < n; ++i)
    {
        if (i % 2 == 0)
        {
            for (int j = 0; j < m; ++j)
            {
                if (nr2 < a[nr1])
                {
                    odp[i][j] = nr1;
                    ++nr2;
                }
                else
                {
                    ++nr1;
                    nr2 = 0;
                    odp[i][j] = nr1;
                    ++nr2;
                }
            }
        }
        else
        {
            for (int j = m - 1; j >= 0; --j)
            {
                if (nr2 < a[nr1])
                {
                    odp[i][j] = nr1;
                    ++nr2;
                }
                else
                {
                    ++nr1;
                    nr2 = 0;
                    odp[i][j] = nr1;
                    ++nr2;
                }
            }
        }
    }
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
            cout << odp[i][j] + 1 << " ";
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
 int main(){
     int n;
     cin >> n;
     n %= 10;
     if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9){
         cout << "hon" << endl;
     }
     else if (n == 3){
         cout << "bon" << endl;
     }
     else{
         cout << "pon" << endl;
     }
 }

Measured memory_bytes: 3584
// https://atcoder.jp/contests/abc081/tasks/abc081_b
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

  vector<int> A(N);
  rep(i, N) { cin >> A[i]; }

  int sum = 0;
  bool run = true;
  while (run) {
    rep(i, N) {
      if (A[i] % 2 == 1) {
        run = false;
        break;
      }
      A[i] /= 2;
    }
    if (run) sum++;
  }

  cout << sum;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	printf("%s\n",c%gcd(a,b)?"NO":"YES");
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main(void){
    int n;
    int v[50], c[50];
    int i;
    int ans=0;

    scanf("%d",&n);

    for(i = 0; i < n; i++){
        scanf("%d", &v[i]);
    }
    
    
    for(i = 0; i < n; i++){
        scanf("%d", &c[i]);
    }


    for(i = 0; i < n; i++){
        if(v[i] - c[i] > 0){
            ans += v[i] - c[i];
        }
    }

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

    return 0;
}

Measured memory_bytes: 128
x, y, z, k = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

ABC = []

for i in range(x):
    for j in range(y):
        if (i + 1) * (j + 1)  > k:
            break
        for h in range(z):
            if (i + 1) * (j + 1) * (h + 1) > k:
                break
            ABC.append(A[i] + B[j] + C[h])


ABC.sort(reverse=True)

for i in range(k):
    print(ABC[i])



Measured memory_bytes: 8732
x=int(input())
flag=False
flag2=True
if x==2:
  ans=2
  flag=True
if flag==False:
  if x%2==0:
    x+=1
  while 1:
    for i in range(3,int(x**0.5+1),2):
      #print("i",i,"x",x)
      if x%i==0:
        flag2=False
        break
    if flag2==True:
      ans=x
      break
    else:
      x+=2
      flag2=True
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            System.out.println(Math.max(A + B, Math.max(A - B, A * B)));
        }
    }
}


Measured memory_bytes: 21844
import java.util.*;
import java.io.*;

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

        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int C = Integer.parseInt(sc.next());
        int D = Integer.parseInt(sc.next());
        sc.close();

        int trainMin = Math.min(A, B);
        int busMin = Math.min(C, D);

        out.printf("%d\n", trainMin + busMin);
        out.flush();
    }
}


Measured memory_bytes: 21972
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }




// ***************************************


int main(){

    int N, M;
    cin >> N >> M;
    
    vector<ll> H(N);
    for(auto& h: H){
        cin >> h;
    }

    vector<set<int>> vec(N);
    REP(i, M){
        int a, b;
        cin >> a >> b;
        a--; b--;

        vec[a].insert(b);
        vec[b].insert(a);
    }

    ll ans = 0;
    REP(i, N){
        auto& v = vec[i];
        if (v.empty()) {
            ans++;
            continue;
        }

        bool flag = true;
        for(auto& x: v){
            if(H[i] <= H[x]) {
                flag = false;
                break;
            }
        }
        if (flag) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 18000
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
inf=float('inf')
mod = 2019
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    L,R = MI()
    ans = inf
    if R-L >= 2019:
        print(0)
    else:
        for i in range(L,R+1):
            for j in range(i+1, R+1):
                ans = min(ans,(i*j)%mod)
        print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 40176
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    int N, M; cin >> N >> M;
    vector<pair<int, int>> V(N);
    for (int i = 0; i < N; i++) {
        int A, B; cin >> A >> B;
        V[i] = make_pair(B, A);
    }
    sort(rbegin(V), rend(V));
    set<int> S;
    for (int i = 0; i < M; i++) S.insert(end(S), i);
    Int ans = 0;
    for (int i = 0; i < N; i++) {
        int b, a; tie(b, a) = V[i];
        auto it = S.upper_bound(M - a);
        if (it != begin(S)) {
            S.erase(prev(it));
            ans += b;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5760
N = int(input())
hs = list(map(int, input().split()))

if N == 2:
  print(abs(hs[1] - hs[0]))
  exit()

total_cost = [-1 for _ in range(N)]
total_cost[0] = 0
total_cost[1] = abs(hs[1]-hs[0])

for i in range(2, N):
  total_cost[i] = min(abs(hs[i]-hs[i-1]) + total_cost[i-1], abs(hs[i]-hs[i-2]) + total_cost[i-2])

print(total_cost[N-1])


Measured memory_bytes: 52720
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	int n,k,a=0;
	cin>>n>>k;
	std::vector<int> v(n,0);
	for (int i = 0; i < n; ++i)
	{
		cin>>v[i];
		if(v[i]>= k){
			a++;
		}
	}
	cout<<a<<endl;
	return 0;
}

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

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    int ans = 0;
    for(int i = 1; i <= n; i++){
        int tmp = i;
        int sum = 0;
        while(tmp){
            sum += tmp%10;
            tmp /= 10;
        }
        if(sum >= a && sum <= b) ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3540
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
  
  char str[11];
  char c;

  while(scanf("%s",str) != EOF){

    int flg=1;
    
    c = str[0];
    if(c != 's'){
      if(c==str[1] && c==str[2] && flg){
	printf("%c\n",c);
	flg = 0;
      }
      if(c==str[4] && c==str[8] && flg){
	printf("%c\n",c);
	flg = 0;   
      }
      if(c==str[3] && c==str[6] && flg){
	printf("%c\n",c);
	flg = 0;    
      }
    }
    
    c = str[1];
    if(c != 's'){
      if(c==str[4] && c==str[7] && flg){
	printf("%c\n",c);
	flg = 0;    
      }
    }

    c = str[2];
    if(c != 's'){
      if(c==str[4] && c==str[6] && flg){
	printf("%c\n",c);
	flg = 0;    
      }
      if(c==str[5] && c==str[8] && flg){
	printf("%c\n",c);
	flg = 0;    
      }
    }
    
    c = str[3];
    if(c != 's'){
      if(c==str[4] && c==str[5] && flg){
	printf("%c\n",c);
	flg = 0;    
      }
    }

    c = str[6];
    if(c != 's'){
      if(c==str[7] && c==str[8] && flg){
	printf("%c\n",c);
	flg = 0;    
      }
    }

    if(flg) printf("d\n");

  }
  return 0;
}

Measured memory_bytes: 1144
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(n*a,b) << endl;
	//printf((a==b) ? "H\n" : "D\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define Q int q; cin >> q; while (q--)
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    set<int> a;
    REP(i, n) {
        int x; cin >> x;
        a.emplace(x);
    }
    int m;
    cin >> m;
    set<int> b;
    REP(i, m) {
        int x; cin >> x;
        b.emplace(x);
    }
    set<int> c;
    set_intersection(ALL(a), ALL(b), inserter(c, end(c)));

    for (auto x : c) cout << x << endl;
}



Measured memory_bytes: 23760
#include<bits/stdc++.h>
using namespace std;
priority_queue<pair<int,int> > pqAB,pqBC,pqAC;
int where[100010];
int a[100010],b[100010],c[100010];
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int x,y,z;
	cin>>x>>y>>z;
	long long int ans = 0;
	for(int i=1;i<=x+y+z;i++){
		cin>>a[i]>>b[i]>>c[i];
		pqAB.emplace(b[i]-a[i],i);
		pqAC.emplace(c[i]-a[i],i);
		ans+=a[i];
	}
	while(y--){
		auto it = pqAB.top();pqAB.pop();
		ans+=it.first;
		where[it.second]=1;
		pqBC.emplace(c[it.second]-b[it.second],it.second);
	}
	while(z--){
		while(!pqAC.empty()&&where[pqAC.top().second]!=0)	pqAC.pop();
		while(!pqAB.empty()&&where[pqAB.top().second]!=0)	pqAB.pop();
		auto itbc = pqBC.top();
		auto itac = pqAC.top();
		auto itab = pqAB.top();
		if(itbc.first+itab.first>=itac.first){
			ans+=itbc.first+itab.first;
			pqBC.pop();
			pqAB.pop();
			where[itbc.second] = 2;
			where[itab.second] = 1;
			pqBC.emplace(c[itab.second]-b[itab.second],itab.second);
		}
		else{
			ans+=itac.first;
			pqAC.pop();
			where[itac.second] = 2;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 4972
n = int(input())
s = list(input())
for i in range(n):
    if i:
        s[i] = s[i - 1] + int(s[i] == "E")
    else:
        s[i] = int(s[i] == "E")
s.append(s[n - 1])
ans = float("inf")
for i in range(n):
    rightE = s[n] - s[i]
    if i == 0:
        ans = min(ans, rightE)
    else:
        leftW = i - s[i - 1]
        ans = min(ans, leftW + rightE)
print(ans)

Measured memory_bytes: 15180
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int m, n, a, b, x, y, gcd, lcm, btmp;
	int i;
	
	while ((scanf("%d %d", &m, &n)) != EOF){
		
		a = m;
		b = n;
		x = m;
		y = n;
		/*最大公約数*/
		if (b == 0){
			gcd = a;
		}
		else {
			while (1){
				if (b == 0){
					break;
				}
				btmp = b;
				b = a % b;
				a = btmp;
			}
			gcd = a;
		}
		/*最小公倍数*/
		//lcm = (x * y) / gcd; ←x * yするとオーバーフローする可能性
		lcm = x / gcd * y;
		
		printf("%d %d\n", gcd, lcm);
		
	}
	return (0);
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000009LL
#define maxn 200005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pii;



int main()
{
    i64 a , b , c , x , y ;

    cin>>a>>b>>c>>x>>y ;

    c = min(2*c , a+b) ;

    i64 mn = min(x,y) ;

    i64 ans = mn*c ;

    x -= mn ;
    y -= mn ;

    ans += x*min(a,c) + y*min(b,c) ;

    cout<<ans<<endl ;

    return 0 ;
}


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

bool checkDis(ll x, set<ll> &dislike){
    ll digit;
    while(x > 0){
        digit = x%10;
        if(dislike.count(digit)) return false;
        x /= 10;
    }
    return true;
}

void solve(long long N, long long K, std::vector<long long> D){
    set<ll> dislike(D.begin(), D.end());
    for(ll i=N; ; i++){
        if (checkDis(i, dislike)) {
            cout << i << endl;
            return;
        }
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> D(K);
    for(int i = 0 ; i < K ; i++){
        scanf("%lld",&D[i]);
    }
    solve(N, K, std::move(D));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int cnt = 1;
        while(a[i] == a[i+1]){
            i++;
            cnt++;
        }
        ans += (cnt/2);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from sys import maxsize

n = int(input())
s = input()

count_e = [0]
count_w = [0]
for i in range(1, n+1):
    if s[i-1] == 'E':
        count_e.append(count_e[i-1]+1)
        count_w.append(count_w[i-1])
    else:
        count_e.append(count_e[i-1])
        count_w.append(count_w[i-1]+1)

min = maxsize
for i in range(n):
    val = count_w[i] + count_e[n] - count_e[i+1]
    if val < min:
        min = val

print(min)


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

int main(){
    int n;
    int a[110];
    cin >> n;
    for(int i=0;i<n;i++)cin >> a[i];
    sort(a, a+n, greater<int>());
    int Alice = 0;
    int Bob = 0;
    for(int i=0;i<n;i++){
        if(i%2==0){
            Alice += a[i];
        }else{
            Bob += a[i];
        }
    }
    cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin >> a;
  if (a == 25) {
    cout << "Christmas";
  } else if (a == 24) {
    cout << "Christmas Eve";
  } else if (a == 23) {
    cout << "Christmas Eve Eve";
  } else {
    cout << "Christmas Eve Eve Eve";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long; using PII = pair<LL, LL>; using VI = vector<LL>; using VVI = vector<VI>;
using VB = vector<bool>; using VS = vector<string>; using VP = vector<PII>;
#define VV(T)        vector<vector<T>>
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define $(x)         {cout << #x << " = " << (x) << endl;}

const string YES = "YES";
const string NO = "NO";

void solve(LL N, LL A, LL B, LL C, LL D){
    LL X = abs(A - B);
    LL l = -(N - 1) * D, u = -(N - 1) * C;
    if (l <= X && X <= u) {
        cout << YES << endl;
        return;
    }
    REP(i, N - 1) {
        l += C + D;
        u += C + D;
        if (l <= X && X <= u) {
            cout << YES << endl;
            return;
        }
    }
    cout << NO << endl;
}

int main(){
    LL N;
    scanf("%lld",&N);
    LL A;
    scanf("%lld",&A);
    LL B;
    scanf("%lld",&B);
    LL C;
    scanf("%lld",&C);
    LL D;
    scanf("%lld",&D);
    solve(N, A, B, C, D);
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] l = new int[n];
		long count = 0;

		for(int i = 0; i < n; i++) {
			l[i] = sc.nextInt();
		}

		Arrays.parallelSort(l);

		for(int i = n-1; i >= 2; i--) {
			//if(i != n-1 && l[i] == l[i+1]) continue;

			for(int a = i-1; a >= 1; a--) {
				//if(a != i-1 && l[a] == l[a+1]) continue;

				for(int b = a-1; b >= 0; b--) {
					//if(b != a-1 && l[b] == l[b+1]) continue;

					if(l[i] < l[a]+l[b]) {
						count++;
						//System.out.printf("%d %d %d%n", l[i], l[a],l[b]);
					}else {
						break;
					}

				}

			}

		}

		System.out.println(count);

		sc.close();
	}
}

Measured memory_bytes: 26212
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace AtCoder {
    class Program {
        static void Main(string[] args) {

            var count = 0;
            var input1 = Console.ReadLine().Split(' ').Select(n => int.Parse(n)).ToArray();
            var N = input1[0];
            var M = input1[1];
            var C = input1[2];
            var B = Console.ReadLine().Split(' ').Select(n => int.Parse(n)).ToArray();
            for (int i = 0; i < N; i++) {
                var A = Console.ReadLine().Split(' ').Select(n => int.Parse(n)).ToArray();
                var result = 0;
                for(int j =0; j < M; j++) {
                    result += A[j] * B[j];
                }
                if (result + C > 0) {
                    count++;
                }
            }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 13268
n, m = map(int, input().split())
x = list(map(int, input().split()))

rem_memo = {}
rem_pair_memo = {}
cnt_memo = {}
for i in range(n):
    rem = x[i] % m
    if rem not in rem_memo:
        rem_memo[rem] = 1
    else:
        rem_memo[rem] += 1
        
    if x[i] not in cnt_memo:
        cnt_memo[x[i]] = 1
    else:
        cnt_memo[x[i]] += 1
        if cnt_memo[x[i]] % 2 == 0:
            if rem not in rem_pair_memo:
                rem_pair_memo[rem] = 1
            else:
                rem_pair_memo[rem] += 1

ans = 0
for i in rem_memo:
    if i == 0 or i == m-i:
        tmp = rem_memo[i] // 2
        ans += tmp
        rem_memo[i] -= tmp * 2
        continue
    if m-i in rem_memo:
        tmp = min(rem_memo[i], rem_memo[m-i])
        ans += tmp
        rem_memo[i] -= tmp
        rem_memo[m-i] -= tmp

for i in rem_memo:
    if i in rem_pair_memo:
        ans += min(rem_pair_memo[i], rem_memo[i] // 2)
print(ans)

Measured memory_bytes: 24600