akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define tc printf("Case %d: ", cs)
#define tcn printf("Case %d:\n", cs);
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);

#define dbg1(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define dbg4(w,x, y, z) cerr << #w << " = " << w << ", " <<#x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    for (auto it = v.begin(); it != v.end(); ++it) {
        if ( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    for (auto it = v.begin(); it != v.end(); ++it) {
        if ( it != v.begin()) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    for (auto it = v.begin(); it != v.end(); ++it) {
        if ( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () { cerr << endl; }

template <typename T>
void faltu( T a[], int n ) {
    for (int i = 0; i < n; ++i) cerr << a[i] << ' ';
    cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) { cerr << arg << ' '; faltu(rest...); }
// Program showing a policy-based data structure.
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less 
#include <iostream>
using namespace __gnu_pbds;
using namespace std;
// GNU link : https://goo.gl/WVDL6g
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;

/**___________________________________________________**/



int main()
{
    FASTIO
    ///*
// #ifndef ONLINE_JUDGE
//     freopen("in.txt", "r", stdin);
//     freopen("out.txt", "w", stdout);
//     freopen("error.txt", "w", stderr);
// #endif
//*/
    int a, b;
    cin >> a >> b;
    cout << max(a * b, max(a + b, a - b)) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int [n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        doing(array, n);
 
    }
 
   static void doing(int[] array, int n){;
        for(int i = 0; i < n; i++){
            int value = array[i];
            int j = i -1;
 
            while (j >= 0 && array[j] > value){
                array[j+1] = array[j];
                j--;
            }
            array[++ j] = value;
            
            
            
            
            for (j = 0; j < n; j++){
                System.out.print(array[j]);
                if (j != n-1)
                    System.out.print(" ");
            }
            System.out.println();
        }
    }
}

Measured memory_bytes: 33320
/*
for (int i = 0; i < N; ++i){}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}


*/
typedef long long ll;
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>

using namespace std;

int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}


int main() {
    // 入力
    ll N;
    cin >> N;
    
    ll S = findSumOfDigits(N);
    //cout << S << endl;
    
    if (N%S==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}
 


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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;
typedef tuple<int, int, int> Tp;

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> s(H + 2, vector<char>(W + 2, '#'));
    int black = 0;
    REP (i, 1, H + 1) REP (j, 1, W + 1) {
        cin >> s[i][j];
        if (s[i][j] == '#') black++;
    }
    int dx[4] = {1, 0, -1, 0};
    int dy[4] = {0, 1, 0, -1};
    queue<Tp> q;
    q.emplace(1, 1, -1);
    const int inf = 1 << 29;
    vector<vector<int>> memo(H + 2, vector<int>(W + 2, inf));
    memo[1][1] = 0;
    while (q.size()) {
        auto tp = q.front();
        q.pop();
        int x = get<0>(tp);
        int y = get<1>(tp);
        int cost = get<2>(tp);
        if (memo[y][x] <= cost) continue;
        memo[y][x] = cost;
        REP (k, 0, 4) {
            int nx = x + dx[k];
            int ny = y + dy[k];
            if (s[ny][nx] == '#') continue;
            q.emplace(nx, ny, cost + 1);
        }
    }
    cout << (memo[H][W] == inf ? -1 : H * W - memo[H][W] - black - 2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <string>
#include <iomanip>

using namespace std;

#define pi 3.141592653589
#define repeat(i,n) for(int i=0;i<n;i++)

int main()
{
	char array[1201] = { 0 };
	int moji[26] = { 0 };
	int i = 0;
	while (scanf("%c", &array[i])!=EOF)
	{
		int t;
		t = array[i] - 'a';
		if (t >= 0 && t <= 26) moji[t]++;
		t = array[i] - 'A';
		if (t >= 0 && t <= 26) moji[t]++;
		i++;
	}
	
	for (int i = 0; i < 26; i++)
	{
		printf("%c : %d\n", i + 'a', moji[i]);
	}
	return 0;
}

Measured memory_bytes: 1136
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
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")
}

const MAX: usize = 1 << 50;

fn main() {
    let s = read::<String>().chars().collect::<Vec<char>>();
    let t = read::<String>().chars().collect::<Vec<char>>();
    let l = s.len();
    let mut nexts = vec![vec![MAX; l]; 26];
    for i in 0..l {
        let c = (s[i] as u8 - b'a') as usize;
        for j in 1..l + 1 {
            let index = (l + i - j) % l;
            nexts[c][index] = j;
            if s[i] == s[index] {
                break;
            }
        }
    }
    let mut ans = 0;
    let mut index = l - 1;
    for i in 0..t.len() {
        let c = (t[i] as u8 - b'a') as usize;
        ans += nexts[c][index];
        index = (index + nexts[c][index]) % l;
    }
    if ans >= MAX {
        println!("-1");
    } else {
        println!("{}", ans);
    }
}


Measured memory_bytes: 31100
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;


int main(int argc, char const *argv[]) {
  string s;
  std::cin >> s;
  vvi ans = vv(0, 2, 0, int);
  bool flag = true;
  if(s[s.size()-1]=='1'||s[0]!='1') flag = false;
  for(int i=0;i<s.size()-1;i++) if(s[i]!=s[s.size()-2-i]) flag = false;
  if(!flag){
    std::cout << -1 << '\n';
    return 0;
  }
  int now = 1, par = 1;
  for(int i=0;i<s.size()-1;i++, now++){
    if(s[i]=='1') ans.push_back(vector<int> {now+1, par}), par = now+1;
    else ans.push_back(vector<int> {par, now+1});
  }
  for(int i=0;i<s.size()-1;i++) std::cout << ans[i][0] << " " << ans[i][1] << '\n';
  return 0;
}


Measured memory_bytes: 7664
#include<bits/stdc++.h>
using namespace std;
int main(){
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    int n, y, x = 0;
    cin >> n; //101
    y = n;
    while(n != 0){
        x += n%10; //0+1//+0//+1=2
        n /= 10; //10//1//0
    }
    if(y%x == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
	int check=0;
	string s;
	cin>>s;
	size_t size=s.length();
	for(int i=0;i<size;i++)
	{
		
		if(s[i]=='h'&&s[i+1]=='i')
		{
			check=0;
		}
		else
		{
			check=1;
		}
		i++;
	}
	if(check==1)
	{
		cout<<"No"<<endl;
	}
	else 
	{
		cout<<"Yes"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
    int n,f=0;

    cin >> n;

    FORQ(i,0,n/7){
        if((n - i*7) % 4 == 0)f = 1;
    }
    if(f == 1)cout << "Yes";
    else cout << "No";

    return 0;
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <list>

using namespace std;

void read(long long &w){
    cin >> w;
}

int main(int argc, char * argv [] )
{
/**
4 3
2
4
8
1
2
9
3
https://code-festival-2016-qualb.contest.atcoder.jp/submit?task_id=2081
*/
    int w, h;
    cin >> w >> h;
    vector<long long> p(w);
    vector<long long> q(h);

    for_each(p.begin(), p.end(), read);
    for_each(q.begin(), q.end(), read);

    sort(p.begin(), p.end());
    sort(q.begin(), q.end());

    long long sum = 0;

    for (int i = 0, j = 0; i != w || j != h;) {
        if (i < w && j < h) {
            if (p.at(i) < q.at(j)) {
                sum += p.at(i++) * (h - j + 1);
            } else {
                sum += q.at(j++) * (w - i + 1);
            }
        } else if (i < w) {
            sum += p.at(i++) * (h - j + 1);
        } else {
            sum += q.at(j++) * (w - i + 1);
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 1920
N, K = map(int, input().split())
li = [0]*(K+1)

out = 0
mod = 10**9+7

for i in range(K, 0, -1):
  li[i] = pow(K//i, N, mod) 
  for j in range(i*2, K+1, i):
    li[i] -= li[j]
  out += li[i] * i
print(out%mod)


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

int main(){
	int N;
	cin >> N;
	int prime[15] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
	int index[15];
	for(int i=0; i<15; i++){
		index[i] = 0;
	}
	int n;
	for(int i=0; i<15; i++){
		n = N;
		while(n/prime[i] >= 1){
			index[i] = index[i] + n/prime[i];
			n = n/prime[i];
		}
	}
	int i = 0, j = 0, k = 0, ans = 0;
	while(i<15 && index[i]>=4){
		j = i + 1;
		while(j<15 && index[j]>=4){
			k = 0;
			while(k<15 && index[k]>=2){
				if(k != i && k != j){
					ans++;
				}
				k++;
			}
			j++;
		}
		i++;
	}
	i = 0;
	while(i<15 && index[i]>=24){
		j = 0;
		while(j<15 && index[j]>=2){
			if(i != j){
				ans++;
			}
			j++;
		}
		i++;
	}
	i = 0;
	while(i<15 && index[i]>=14){
		j = 0;
		while(j<15 && index[j]>=4){
			if(i != j){
				ans++;
			}
			j++;
		}
		i++;
	}
	i = 0;
	while(i<15 && index[i]>=74){
		ans++;
		i++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(){
  int n,k;
  cin >> n >> k;
  vector<ll>h(n);
  rep(i,n) cin >> h[i];
  sort(h.begin(),h.end());
  ll ans=1e9;
  rep(i,n-k+1){
    ll num=h[i+k-1]-h[i];
    if(ans>num)ans=num;
  }
  cout << ans << endl;
  
  return 0;
}

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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
typedef pair<ll, ll>   pairl;
typedef vector<ll>     vl;
typedef vector<ll>     vll;
typedef vector<vector<ll> > vvl;
const   int            infi = numeric_limits<int>::max();
const   ll             infl = numeric_limits<ll>::max();
const   double         eps = 0;
const   int            ms  = 0;



int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);
    
    int N;
    cin >> N;
    string S;
    cin >> S;
    vl m(100, 0);
    rep(i, N){
        m[S[i]-'a']++;
    }
    ll ans = 1;
    rep(i, 100){
        ans = (ans * (m[i]+1))%1000000007;
    }
    cout << ans -1 << "\n";
    return 0;
}

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

using namespace std;

long long a[3];

int main() {
	
    for(int i = 0; i < 3; i++)
    {
    	cin >> a[i];
    }
    
    sort(a, a+3);
    
    long long a1 = a[2]/2;
    long long a2 = a[2] - a1;
    
    long long ans = abs(a1-a2);
    
    ans = ans * a[1] * a[0];
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3552
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
          

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n , k , x , y;
    cin >> n >> k >> x >> y;
    if ( n >= k ) {
        cout << k * x + ( n - k ) * y;
    } else {
        cout << n * x;
    }
}

Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
while(true){
   var np=Arr.shift();
   if(np=="0 0")break;
   np=np.split(" ").map(Number);
   var n=np[0];
   var p=np[1];
   var arr=[];
   for(var i=0;i<n;i++)arr.push(0);
   var j=0;
   for(var i=0;i<1000000;i++){
      if(j==arr.length)j=0;
      if(p>0){
         p--;
         arr[j]++;
         if(p==0){
            var sum=arr.reduce(function(a,b){return a+b;});
            if(sum-arr[j]==0){console.log(j);break;}
         }
      }else{
         p=arr[j];
         arr[j]=0;
      }
      j++;
   }
}

Measured memory_bytes: 10204
#include <iostream>
#include <algorithm>
using namespace std; 
  
void swap(int *xp, int *yp)  
{  
    int temp = *xp;  
    *xp = *yp;  
    *yp = temp;  
}  
  
// A function to implement bubble sort  
void bubbleSort(int arr[], int n)  
{  
    int i, j;  
    for (i = 0; i < n-1; i++)   
    {   
        // Last i elements are already in place  
        for (j = 0; j < n-i-1; j++)  
            if (arr[j] > arr[j+1])  
                swap(&arr[j], &arr[j+1]); 
    } 
}  

int search(int arr[], int size, int x) 
{ 
    for (int i = 0; i < size; i ++)
    {
        if (arr[i] == x)
        {
            return 1;
        }
    }
    return -1;
} 

int main()
{
    int x, n;
    cin >> x; cin >> n;
    int *nums = (int*)malloc(n*sizeof(int));
    for (int i = 0; i < n; i ++)
    {
        cin >> nums[i];
    }

    bubbleSort(nums, n);

    if (search(nums, n, x) == -1)
    {
        cout << x;
        return 0;
    }
    bool stop = 0;
    int i = 1;
    while (!stop)
    {
        int tempLeft = search(nums, n, x - i);
        int tempRight = search(nums, n, x + i);
        if (tempLeft == -1 && tempRight == -1)
        {
            cout << min(x+i, x-i);
            i ++;
            return 0;
        }
        else if (tempLeft != -1 && tempRight == -1)
        {
            cout << x+i;
            i ++;
            return 0;
        }
        else if (tempLeft == -1 && tempRight != -1)
        {
            cout << x-i;
            i ++;
            return 0;
        }
        else
        {
            i ++;
            continue;
        }
        
        
    }

}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
long long n,m,ans;
set<long long>st;
int main()
{
  cin>>n;
  m=n-1;
  for(long long i=2;i*i<=n;i++)
  {
	if(n%i!=0)continue;
	long long qwq=n;
	while(qwq%i==0)qwq/=i;
	qwq%=i;
	if(qwq==1)
    	ans++;
  }
	for(long long i=2;i*i<=m;i++)
		if(m%i==0)
			ans+=2;
	ans++;
	if(m!=1&&(int)sqrt(m)*sqrt(m)!=m)ans++;
	cout<<ans<<"\n";
}


Measured memory_bytes: 256
n, a, b = map(int, input().split())

mod = 10**9 + 7


def cmb(n, r, mod):
    r = min(n-r, r)
    if r == 0:
        return 1
    over, under = 1, 1
    for i in range(1, r+1):
        over = over * (n-i+1) % mod
        under = under * i % mod
    inv = pow(under, mod-2, mod)
    return over * inv % mod


A = cmb(n, a, mod)
B = cmb(n, b, mod)

print((pow(2, n, mod) - A - B - 1) % mod)


Measured memory_bytes: 3188
import java.util.*;
import java.math.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		Map<String, List<Integer>> numMap = new TreeMap<>();
		Map<Integer, Integer> countMap = new HashMap<>();

		for (int i = 1; i <= n; i++) {
			String s = sc.next();
			int p = sc.nextInt();
			countMap.put(p,i);

			if(numMap.containsKey(s)){
				List<Integer> list =numMap.get(s);
				list.add(p);
				numMap.put(s,list);
			}else{
				List<Integer> list = new ArrayList<>();
				list.add(p);
				numMap.put(s,list);
			}
		}

		for (String key : numMap.keySet()) {
			List<Integer> list =numMap.get(key);
			// System.out.println(key + ":" + numMap.get(key));
			Collections.sort(list);
			Collections.reverse(list);

			for(int i=0;i<list.size();i++){
				int score = list.get(i);
				System.out.println(countMap.get(score));
			}

		}

	}

}


Measured memory_bytes: 21844
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
#define ifYN(x) cout<<(x?"Yes":"No")<<"\n"

ll GCD(ll a,ll b) { return b ? GCD(b,a%b) : a; }
ll LCM(ll a,ll b) { return a/GCD(a,b)*b; }
ll Factorial(ll n){ ll m=1;while(n>=1)m*=n--;return m; }
ll modPow(ll x,ll n,ll mod=MOD){
    return (!n?1:!n%2?modPow(x*x,n/2,mod)%mod:x%mod*modPow(x,n-1,mod)%mod);
}
using namespace std;
//-------------------------------------------

int main(void){
  ll A,B;cin>>A>>B;
  cout<<LCM(A,B);
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
using namespace std;
int main()
{
	int n, m = 0, i;
	string s, t;
	cin >> t;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> s;
		s+=s;
		if (s.find(t) != string::npos)
			m++;
	}
	cout << m << endl;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define int long long
#define for0(i, n) for(int i = 0; i < (n); i++)
#define puts(x) cout << x << "\n"
constexpr int mod = 998244353;
using namespace std;
int f1(int a, int p) {
	if (p == 1)return a;
	if (p % 2)return f1(a, p - 1) * a % mod;
	else return f1(a * a % mod, p / 2) % mod;
}
signed main() {
	int n, m, k, ans = 0; cin >> n >> m >> k;
	int p1 = m, p2 = 1;
	for0(i, n) {
		if (n - i - 1 <= k)ans += p1 * p2 % mod;
		ans %= mod;
		p1 *= m - 1; p1 %= mod;
		p2 *= n - 1 - i; p2 %= mod;
		p2 *= f1(i + 1, mod - 2); p2 %= mod;
	}
	puts(ans);
}

Measured memory_bytes: 3636
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
          
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    if ( n < 1200 ) cout << "ABC";
    else cout << "ARC";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<cstdlib>

using namespace std;

typedef pair<int,int> P;

int min_cost(const P& start, const P& goal){

  int sx = start.first;
  int sy = start.second;
  int gx = goal.first;
  int gy = goal.second;

  if((sx-gx)*(sy-gy) <= 0) return abs(sx-gx)+abs(sy-gy);

  if(sx < gx){
    int diff = min(gx-sx, gy-sy);
    sx += diff;
    sy += diff;
    return diff + abs(sx-gx)+abs(sy-gy);
  }else{
    int diff = min(sx-gx, sy-gy);
    sx -= diff;
    sy -= diff;
    return diff + abs(sx-gx)+abs(sy-gy);
  }
}

int main(){
  int W,H,N;  
  cin >> W >> H >> N;
  P now;
  cin >> now.first >> now.second;
  int ans = 0;
  for(int i = 0; i < N-1; i++){
    P nex;
    cin >> nex.first >> nex.second;
    ans += min_cost(now, nex);
    now = nex;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
const int mo=1e9+7;
#define ll long long
ll dp[305][305][305],n,m;
int main()
{
	cin>>n>>m;
	dp[0][1][1]=1;
	for(int i=1;i<=m;i++)
		for(int j=1;j<=n;j++)
			for(int k=1;k<=n;k++){
				(dp[i][j][k]+=dp[i-1][j-1][k]*(n-j+1)%mo)%=mo;
				(dp[i][j][k]+=dp[i-1][j][k]*(j-k)%mo)%=mo;
				(dp[i][j][j]+=dp[i-1][j][k]*k%mo)%=mo;
			}
	cout<<dp[m][n][n]%mo<<endl;
}

Measured memory_bytes: 218624
def isCLKWISE(ph) : return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P):
    P = sorted(P)
    phU = [P[0],P[1]]
    for p in P[2:]:
        phU.append(p)
        while(True):
            if isCLKWISE(phU) : break
            else :
                del phU[-2]
                if len(phU) == 2 : break
    phL = [P[-1],P[-2]]
    for p in P[-3::-1]:
        phL.append(p)
        while(True):
            if isCLKWISE(phL) : break
            else :
                del phL[-2]
                if len(phL) == 2 : break
    ph = phU + phL[1:-1]
    return ph
  
n = range(int(input()))
P = [[int(x) for x in input().split()] for _ in n]
Q = ConvexHullScan(P)
Q.reverse()
print(len(Q))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(Q)])[2]
R = Q[idx:] + Q[:idx]
for r in R : print(r[0],r[1])

Measured memory_bytes: 33780
#include <iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
int inf = (1e9);
int main() {

  string s;
  cin >> s;
  if( s.find("AC") != -1 ) cout << "Yes" << endl;
  else cout << "No" << endl;


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A[10],a,b;
  for(int i=0;i<=8;i++){
    cin>>A[i];
  }
  a=A[0]+A[1]+A[2]+A[3];
  b=A[4]+A[5]+A[6]+A[7];
  if(a>=b)cout<<a<<endl;
  else cout<<b<<endl;

 return 0;
}

Measured memory_bytes: 3080
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

h, w = MAP()
a = [[1 if i == '#' else 0 for i in STR()] for _ in range(h)]
s = 0
for i in range(h):
    s += sum(a[i])
if s != h + w - 1:
    print('Impossible')
    exit()
y = 0
x = 0
while y < h - 1 or x < w - 1:
    flag1 = False
    flag2 = False
    if y + 1 < h and a[y + 1][x] == 1:
        flag1 = True
    if x + 1 < w and a[y][x + 1] == 1:
        flag2 = True
    if (flag1 and flag2) or (not flag1 and not flag2):
        print('Impossible')
        exit()
    if flag1:
        y += 1
    if flag2:
        x += 1
print('Possible')


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

LL powm(LL x, LL y, LL m){
  if(y == 0) return 1;
  return powm(x*x%m, y/2, m) * (y%2==1?x:1) % m;
}
LL inv(LL x, LL m){
  return powm(x, m-2, m);
}

int N1, N2, M;
PLL dp[300000];
PLL dp2[300000];

const LL M1 = 1000000007;
const LL M2 = 1000000009;
LL R1, R2;
PLL thash(int u, int p, VVI& G){
  int sz = SZ(G[u]);
  PLL res(sz, sz);

  for(int v: G[u]){
    if(v == p) continue;
    PLL x = thash(v, u, G);
	(res.FF *= (R1 + x.FF)) %= M1;
	(res.SS *= (R2 + x.SS)) %= M2;
  }
 
  return res;
}


int getsz(int u, vector<bool>& used, VVI& G){
  used[u] = true;
  int res = 1;
  for(int to: G[u])
	if(!used[to])
	  res += getsz(to, used, G);
  return res;
}

void dfs1(int u, int p, VVI& G){
  int sz = SZ(G[u]);
  dp[u] = MP(sz, sz);

  for(int v: G[u]){
    if(v == p) continue;
    dfs1(v, u, G);
	(dp[u].FF *= (R1 + dp[v].FF)) %= M1;
	(dp[u].SS *= (R2 + dp[v].SS)) %= M2;
  }
}

int dfs2(int u, int p, VVI& G, PLL acc, PLL& target){
  if(p != -1){
	dp2[u].FF = dp[u].FF * (R1 + acc.FF) % M1;
	dp2[u].SS = dp[u].SS * (R2 + acc.SS) % M2;
  }
  else
	dp2[u] = dp[u];

  if(dp2[u] == target)
	return 1;
  
  for(int to: G[u]){
	if(to == p) continue;
	PLL tmp = dp2[u];
	(tmp.FF *= inv((R1 + dp[to].FF) % M1, M1)) %= M1;
	(tmp.SS *= inv((R2 + dp[to].SS) % M2, M2)) %= M2;
	if(dfs2(to, u, G, tmp, target))
	  return 1;
  }
  return 0;
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  random_device rd;
  R1 = rd();
  R2 = rd();

  cin >> N1 >> M;
  VVI G(N1);
  REP(i,M){
	int u, v; cin >> u >> v;
	--u, --v;
	G[u].PB(v);
	G[v].PB(u);
  }

  cin >> N2;
  VVI T(N2);
  REP(i,N2-1){
	int u, v;
	cin >> u >> v;
	--u, --v;
	T[u].PB(v);
	T[v].PB(u);
  }

  int ans = 0;
  PLL th = thash(0, -1, T);
  vector<bool> used(N1);
  REP(i,N1){
	if(used[i]) continue;
	int sz = getsz(i, used, G);
	if(sz != N2) continue;
	dfs1(i, -1, G);
	ans += dfs2(i, -1, G, MP(1,1), th);
  }
  cout << ans << endl;

  return 0;
}

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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n,x,t;
  cin >> n >> x >> t;
  ANS((n+x-1)/x*t);
  return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>

int main()
{
    int n, m;
    std::cin >> n >> m;

    int mat[n][m];
    int vec[m];

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            std::cin >> mat[i][j];
        }
    }

    for (int i = 0; i < m; ++i) {
        std::cin >> vec[i];
    }

    for (int i = 0; i < n; ++i) {
        int col = 0;
        for (int j = 0; j < m; ++j) {
            col += mat[i][j] * vec[j];
        }
        std::cout << col << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3120
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Double;
import java.util.*;
  
public class Main {
    Scanner sc = new Scanner(System.in);
  
    public static void main(String[] args) {
        new Main(); 
    }
  
    public Main() {
        new aoj1157().doIt();
    }
    class aoj1157{
    	void doIt(){
    		String str = sc.next();
    		char ctr[] = str.toCharArray();
    		int num[] = new int [12];
    		int v = 0;
    		int cnt = 0;
    		int ans = 0;
    		for(int i = 0;i < ctr.length;i++){
    			if(ctr[i] == '?'){
    				v = 11 - i;
    			}else{
    				num[11 - i] = ctr[i] - '0';
    			}
    		}
    		for(int i = 0;i < 10;i++){
    			int sum = 0;int q = 0;
    			num[v] = i;
    			for(int j = 1;j < 12;j++){
    				if(j <= 6)q = j + 1;
    				else q = j - 5;
    				sum = sum + q*num[j];
    			}
//    			System.out.print(sum);
    			if(sum % 11 == 1)sum = 0;
    			else sum = sum % 11;
    			if((11 - sum)%11 == num[0]){
    				cnt++;
    				ans = i;
    			}
//    			System.out.println(" "+(11 - sum));
    		}
    		if(cnt == 1)System.out.println(ans);
    		else System.out.println("MULTIPLE");
    	}
    }
}

Measured memory_bytes: 26252
package main

import (
	"fmt"
	"sort"
)

func main() {

	var N int
	fmt.Scanf("%d", &N)

	A := make([]int64, N)

	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A[i])
	}

	sort.Slice(A, func(i, j int) bool {
		return A[i] < A[j]
	})

	var Result int64
	Result = 1

	flag := 0
	if A[0] == 0 {
		fmt.Println("0")
		flag = 1
	} else {
		for i := 0; i < N; i++ {
			if A[i] <= 1000000000000000000/Result {
				Result = Result * A[i]
			} else {
				fmt.Println("-1")
				flag = 1
				break
			}
		}
	}

	if flag == 0 {
		fmt.Println(Result)
	}
}

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

int main(){
  int n;
  string s = "YES";
  cin >> n;
  vector<long long> a(n);
  set<long long> st;
  for(int i=0; i < n; i++){
    cin >> a.at(i);
  }
  for(int i=0; i < n; i++){
    st.insert(a.at(i));
  }
  if (n==st.size())
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

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

int main(){
    int N;
    cin >> N;
    map<string, int> S;
    S["AC"]= 0;
    S["WA"] = 0;
    S["TLE"] = 0;
    S["RE"] = 0;
    for (int i = 0; i < N; i++){
        string s;
        cin >> s;
        for (auto p : S){
            if (p.first == s){
                S[s] += 1;
            }
        }   
    }

    cout << "AC x " << S["AC"] << endl;
    cout << "WA x " << S["WA"] << endl;
    cout << "TLE x " << S["TLE"] << endl;
    cout << "RE x " << S["RE"] << endl;

   
   return 0;
}

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

using namespace std;

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

#define int ll

int d;
int c[26];
int s[365][26];

main(){
	cin >> d;
	for(int i=0;i<26;i++) cin >> c[i];
	for(int i=0;i<d;i++){
		for(int j=0;j<26;j++){
			cin >> s[i][j];
		}
	}

	for(int i=0;i<d;i++){
		int m = 0;
		for(int j=0;j<26;j++){
			if(s[i][m] < s[i][j]){
				m = j;
			}
		}
		cout << m+1 << endl;
	}

	return 0;
}


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

int main() {
  int n, k , x, y;
  cin >> n >> k >> x >> y;
  if (n > k) {
    cout << x*k + y*(n-k) << endl;
    return 0;
  }
  cout << x*n << endl;

  return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;

#define rep(i,x) for(Int i = 0; i < (Int)(x); i++)
#define rrep(i,x) for(Int i = ((Int)(x) - 1); i >= 0; i--)
#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back


template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}

Int dx[4] = {1,0,-1,0};
Int dy[4] = {0,1,0,-1};
const Int INF = 1001002003004005006ll;
const Int mod = 1e9 + 7;
const double PI = 3.14159265358979323846;


// ****************************************CODE***************************************//





int main(){
        string s,t,a = "maerd", b = "remaerd", c = "esare", d = "resare";
        cin >> s;
        for(int i = s.size()-1; i >= 0; i--){
                t += s[i];
                if(t==a || t==b || t==c || t==d){
                        t = "";
                }
        }

        if(t.size() == 0){
                cout << "YES" << endl;
        }
        else{
                cout << "NO" << endl;
        }
}













































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

using namespace std;

int main(){
    string str;
    cin >> str;
    if(str == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
    return 0;
}


Measured memory_bytes: 3592
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>

using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 999999
#define rep(i,j) for(int i=0;i<(j);++i)
#define reps(i,j,k) for(int i=j;i<k;++i)
typedef long long ll;
typedef unsigned long long ull;

int main(){
	int n;
	scanf("%d",&n);
	int cnt = 0;
	bool res = false;
	rep(i,n){
		char c;
		int num;
		cin >> c >> num;
		if(c == '('){
			cnt += num;
		}
		else{
			cnt -= num;
			if(cnt < 0){
				res = true;
			}
		}
	}
	if(cnt != 0)res = true;
	(!res) ? puts("YES") : puts("NO");
	return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
#include <queue>
using namespace std;
int main(){
	long long int N; cin >> N; 
	vector<long long int> D; 
	for(long long int i = 1; i * i <= N; i++){
		if(N % i == 0){
			D.push_back(i-1); 
			if(i * i != N) D.push_back(N/i-1); 
		}
	}
	long long int ans = 0; 
	for(int i = 0; i < D.size(); i++){
		if(D.at(i) == 0) continue; 
		long long int a = N / D.at(i); 
		long long int b = N % (D.at(i)); 
		if(a == b) ans += D.at(i); 
	}
	cout << ans << endl; 
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define log(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline void print(T&& x){cout<<x<<endl;}// 改行付き出力
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}

// TODO: write
int main() {
  
  int k;cin>>k;
  string s;cin>>s;
  if(s.size() <= k)print(s);
  else cout<<s.substr(0,k)<<"..."<<endl;

  
  return 0; 
}


Measured memory_bytes: 3628
const line = require('fs').readFileSync('/dev/stdin', 'utf-8').split('\n');

const csort = (arr) => {
    const k = arr.reduce((acc, x) => acc < x ? x : acc);
    const c = [...Array(k+1)].map(_ => 0);
    const result = [...Array(arr.length)];
    for (let i = 0; i < arr.length; i++) {
        c[arr[i]]++;
    }

    for (let i = 1; i <= k; i++) {
        c[i] += c[i-1];
    }
    
    for (let i = arr.length-1; i >= 0; i--) {
        result[c[arr[i]]-1] = arr[i];
        c[arr[i]]--;
    }

    return result;
};

const data = line[1].split(' ').map(Number);
console.log(csort(data).join(' '));



Measured memory_bytes: 301580
//In The Name of Allah
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define X first
#define Y second

const int N = 3e3 + 10;
const int M = 2e5 + 10;
const ll mod = 1e9 + 7;

pair < ll , ll > a[N];
ll dp[N], fact[M], inv[M];

ll Pow(ll a, ll b){
    if (b == 0)
        return 1;
    ll res = Pow(a, b / 2);
    res = res * res % mod;
    if (b % 2)
        res = res * a % mod;
    return res;
}

ll C(ll n, ll m){
    if (n < m || m < 0)
        return 0;
    return fact[n] * inv[m] % mod * inv[n - m] % mod;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll n, h, w;
    cin >> h >> w >> n;
    for (int i = 0; i < n; i ++)
        cin >> a[i].first >> a[i].second;
    a[n] = {h, w};
    sort(a, a + n + 1);
    fact[0] = 1;
    for (ll i = 1; i < M; i ++)
        fact[i] = fact[i - 1] * i % mod;
    for (ll i = 0; i < M; i ++)
        inv[i] = Pow(fact[i], mod - 2);
    for (int i = 0; i <= n; i ++){
        dp[i] = C(a[i].X + a[i].Y - 2, a[i].X - 1);
        for (int j = 0; j < i; j ++)
            dp[i] = (dp[i] - dp[j] * C(a[i].X + a[i].Y - a[j].X - a[j].Y, a[i].X - a[j].X) % mod + mod) % mod;
    }
    cout << dp[n];
    return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  unordered_set<int> res;
  for (int i = 0; i < n; i++) {
    int a; cin >> a;
    res.insert(a);
  }
  string ans = (res.size() == n) ? "YES" : "NO";
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 8520
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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() {
    int n,k;
    cin >> n >> k;
    vector<ll> a(n,0);
    rep(i,n)cin >> a[i];
    sort(a.begin(),a.end());
    ll res = 0;
    rep(i,k)res += a[i];
    cout << res << endl;
    return 0;
}

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

int main() {

	int num = 0, sum = 0;
	int yu = 0, hi = 0, no = 0;       //yu 10   hi  5   no  1
	int ex = 0;


	int key = 0;

	cin >> num >> sum;

	sum = sum / 1000;


	for (int i = 0; i <= num; i++) {
		for (int j = 0; i+j <= num; j++) {
			if (10 * i + 5 * j + 1*(num - i - j)==sum) {
				cout << i << ' ' << j << ' ' << num - i - j << endl;
				key = 1;
				break;
			}
			if (key == 1) { break; }
		}
		if (key == 1) { break; }
	}

	if (key == 0) { cout << -1 << ' ' << -1 << ' ' << -1 << endl; }


	return 0;
}

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

int main (void){
    int i, N, K;
    cin >> N >> K;
    K--;
    string S; cin >> S;

    if(S.at(K) == 'A'){
        S.at(K) = 'a';
    }else if(S.at(K) == 'B'){
        S.at(K) = 'b';
    }else {
        S.at(K) = 'c';
    }

    cout << S << endl;

    return 0;
}

Measured memory_bytes: 256
n, t = map(int, input().split())
tlist = list(map(int, input().split()))

total = 0
for i in range(n):
    if i == n-1:
        total += t
    else:
        aida = tlist[i+1] - tlist[i]
        if aida <= t:
            total += aida
        else:
            total += t
print(total)

Measured memory_bytes: 25200
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int X=scan.nextInt();
		int Y=scan.nextInt();
		int Z=scan.nextInt();
		int a=0;
		a=X;
		X=Y;
		Y=a;
		a=X;
		X=Z;
		Z=a;
		System.out.println(X+" "+Y+" "+Z);

	}

}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> //required
// #include <ext/pb_ds/tree_policy.hpp> //required

// using namespace __gnu_pbds; 
using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
// template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // ordered_set <ynt> s; // order_of_key(value)

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define st first
#define nd second


const int N = 200100;
int n, k, m, a, b, nrc, l, use[N], ans[N], f[N];
vector <int> v[N], g[N], c[N];

void dfs(int node, vector <int> *v, int cc = 0) {
	// dbg(node);
	if(cc == 0) use[node] = 1;
	else use[node] = cc;

	for(auto i : v[node])
		if(!use[i])
			dfs(i, v, cc);
	if(!cc)
		c[nrc].push_back(node);
}

int main() {
	ios_base::sync_with_stdio(false);

	cin >> n;
	cin >> k >> l;
	for(int i = 1; i <= k; i++) {
		cin >> a >> b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	for(int i = 1; i <= l; i++) {
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	for(int i = 1; i <= n; ++i)
		if(!use[i])
			dfs(i, v), nrc++;
	
	memset(use, 0, sizeof use);

	for(int i = 1; i <= n; ++i)
		if(!use[i])
			dfs(i, g, i);

	// dbg(c[0]);
	// dbg_v(use, 5);
	for(int i = 0; i < nrc; i++) {
		for(auto j : c[i]) f[use[j]]++;
		for(auto j : c[i]) ans[j] = f[use[j]];
		for(auto j : c[i]) f[use[j]]--;
	}

	for(int i = 1; i <= n; i++)
		cout << ans[i] << ' ';

}	


Measured memory_bytes: 27000
#include <bits/stdc++.h>
using namespace std;
int main() {
	string s;
	cin>>s;
	if(s[0]==s[s.size()-1]){
		if(s.size()%2==1) printf("Second");
		else printf("First");
	}
	else {
		if(s.size()%2==1) printf("First");
		else printf("Second"); 
	}
	return 0;
}


Measured memory_bytes: 512
#include <iostream>

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

    int mi, ms;
    std::cin >> mi >> ms;
    for (int i = 1; i < n; i++) {
        int a, b;
        std::cin >> a >> b;
        if (mi < a) {
            ms = b;
            mi = a;
        }
    }
    std::cout << ms + mi << std::endl;
}

Measured memory_bytes: 256
/*
ID: Sho10
LANG: C++
TASK:race
*/
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n,dp[10000],a[10000],b[10000],h;
int32_t main(){
CODE_START;
cin>>h>>n;
for(ll i=0;i<n;i++)
{
    cin>>a[i]>>b[i];
}
for(ll i=1;i<=h;i++)
    dp[i]=mod;
for(ll i=0;i<n;i++){
    for(ll j=1;j<min(a[i],h+1);j++)
        dp[j]=min(dp[j],b[i]);
    for(ll j=a[i];j<=h;j++)
        dp[j]=min(dp[j],dp[j-a[i]]+b[i]);
}
cout<<dp[h]<<endl;
}




Measured memory_bytes: 384