akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        int n = ni();
        ArrayList<Pair> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int a = ni() - 1;
            list.add(new Pair(i, a));
        }

        Collections.sort(list);

        TreeSet<Integer> set = new TreeSet<>();
        set.add(-1);
        set.add(n);

        long ans = 0;

        for (int i = 0; i < n; i++) {
            int idx = list.get(i).x;
            int higher = set.higher(idx);
            int lower = set.lower(idx);
            ans += (long) (higher - idx) * (idx - lower) * (i + 1);
            set.add(idx);
        }

        out.println(ans);
    }

    public class Pair implements Comparable<Pair> {
        int x, y;

        public Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int compareTo(Pair p) {
            return y - p.y;
        }
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 40516
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <sstream>


using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	long long n, sum = 0, nu = 0;
	cin >> n;
	vector<int> num;
	for (int i = 0; i < n; i++)
	{
	cin >> nu;
	num.push_back(nu);
	sum += num[i];
	}
	sort(num.begin(), num.end());
	cout << num[0] << " " << num[n - 1] << " " << sum << endl;
	cin >> sum;
	return 0;
}

Measured memory_bytes: 3316
using System;

namespace A
{
    class Node
    {
        public int key = -1;
        public int id;
        public int left = -1;
        public int right = -1;
        public void node()
        {
            key = -1;
        }
    }

    class Tree
    {
        public Node[] node = new Node[500001];
    }

    class Output
    {
        public void insert(ref Tree tree, int key, int nowid)
        {
            if (tree.node[0].key == -1)
            {
                tree.node[0].key = key;
            }
            else
            {
                int x = 0, parent=0;
                while (x!= -1)
                {
                    parent = tree.node[x].id;
                    if (key < tree.node[x].key)
                    {
                        x = tree.node[x].left;
                    }
                    else
                    {
                        x = tree.node[x].right;
                    }
                }

                if (key < tree.node[parent].key)
                {
                    tree.node[parent].left = nowid;
                }
                else
                {
                    tree.node[parent].right = nowid;
                }
                tree.node[nowid].key = key;
            }
        }

        public void inorder(Tree tree, int key)
        {
            if (tree.node[key].left != -1)
            {
                inorder(tree, tree.node[key].left);
            }
            Console.Write(" " + tree.node[key].key);
            if (tree.node[key].right != -1)
            {
                inorder(tree, tree.node[key].right);
            }
        }

        public void preorder(Tree tree, int key)
        {
            Console.Write(" " + tree.node[key].key);
            if (tree.node[key].left != -1)
            {
                preorder(tree, tree.node[key].left);
            }
            if (tree.node[key].right != -1)
            {
                preorder(tree, tree.node[key].right);
            }
        }
    }

    class A
    {
        static void Main(string[] args)
        {
            string input1 = Console.ReadLine();
            int n = int.Parse(input1), i;
            string[] input2 = new string[2];
            Output output = new Output();
            Tree tree = new Tree();
            int count = 0;
            for (i = 0; i < tree.node.Length; i++)
            {
                tree.node[i] = new Node();
                tree.node[i].id = i;
            }
            for (i = 0; i < n; i++)
            {
                input2 = Console.ReadLine().Split(' ');
                if (input2[0] =="print")
                {
                    output.inorder(tree, 0);
                    Console.WriteLine();
                    output.preorder(tree, 0);
                    Console.WriteLine();
                }
                else
                {
                    output.insert(ref tree, int.Parse(input2[1]), count);
                    count++;
                }
            }
        }
    }
}



Measured memory_bytes: 41668
#include<bits/stdc++.h>
using namespace std;
 
 
const int mod = 1e9+7;
long long A[1001];
 
int main(){
	long long n,a,sum=1;;
	cin >> n;
	
	for(int i=2;i<=n;i++){
		a=i;
		for(int j=2;a>1;j++){
			while(a%j==0){
				A[j]++;
				a/=j;
			}
		}
	}
	
	for(int i=2;i<=n;i++){
		sum = (sum*(A[i]+1))%mod;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef pair<int, int> P;

int a[200004], b[200004];
int s[600004];
int d[600004];

int main()
{
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    for(int i = 0; i < n; i++){
        s[i] = (a[i] ^ a[(i + n - 1) % n]);
        s[i + n] = s[i + n * 2] = (b[i] ^ b[(i + n - 1) % n]);
    }
    int i = 1, j = 0;
    while(i < n * 3){
        while(i + j < n * 3 && s[i + j] == s[j]) j++;
        d[i] = j;
        if(j == 0){
            i++;
            continue;
        }
        int k = 1;
        while(i + k < n * 3 && k + d[k] < j){
            d[i + k] = d[k];
            k++;
        }
        i += k;
        j -= k;
    }
    vector<P> ans;
    for(int i = n; i < n * 2; i++){
        if(d[i] >= n){
            ans.push_back(P((n * 2 - i) % n, (b[i - n] ^ a[0])));
        }
    }
    sort(ans.begin(), ans.end());
    for(P p : ans) cout << p.first << " " << p.second << endl;
}

Measured memory_bytes: 11376
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

//Main
var sc = bufio.NewScanner(os.Stdin)
var c [][]int

func main() {
	sc.Split(bufio.ScanWords)
	c = make([][]int, 3)
	for i := 0; i < 3; i++ {
		c[i] = []int{nextInt(), nextInt(), nextInt()}
	}

	ans := "No"

	for a1 := 0; a1 <= 100; a1++ {
		b1 := c[0][0] - a1
		b2 := c[0][1] - a1
		b3 := c[0][2] - a1
		if b1 < 0 || b2 < 0 || b3 < 0 {
			continue
		}
		if c[1][0]-b1 != c[1][1]-b2 || c[1][1]-b2 != c[1][2]-b3 {
			continue
		}
		if c[2][0]-b1 != c[2][1]-b2 || c[2][1]-b2 != c[2][2]-b3 {
			continue
		}
		ans = "Yes"
		break
	}

	fmt.Println(ans)

}


Measured memory_bytes: 640
#include <stdio.h>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int SIZE = 4001;
int bsum[SIZE][SIZE];
int wsum[SIZE][SIZE];

inline int f(int sum[SIZE][SIZE], int x1, int y1, int x2, int y2, int xd, int yd) {
  x1 += xd; x2 += xd; y1 += yd; y2 += yd;
  int ret = sum[x2][y2];
  ret -= sum[x1][y2];
  ret -= sum[x2][y1];
  ret += sum[x1][y1];
  //  printf("%d %d %d %d %d\n", x1, x2, y1, y2, ret);                                  
  return ret;
}

int main() {
  int N, K; cin>>N>>K;
  const int K2 = K * 2;
  for(int i = 0; i < N; i++) {
    int x, y; string c; cin>>x>>y>>c;
    x = x % K2 + 1;
    y = y % K2 + 1;
    if(c[0] == 'B') {
      bsum[x][y] ++;
      bsum[x+K2][y] ++;
      bsum[x][y+K2] ++;
      bsum[x+K2][y+K2] ++;
    } else {
      wsum[x][y] ++;
      wsum[x+K2][y] ++;
      wsum[x][y+K2] ++;
      wsum[x+K2][y+K2] ++;
    }
  }
  for(int i = 1; i <= 2*K2; i++) {
    for(int j = 1; j <= 2*K2; j++) {
      bsum[i][j] += (bsum[i-1][j]+bsum[i][j-1]-bsum[i-1][j-1]);
      wsum[i][j] += (wsum[i-1][j]+wsum[i][j-1]-wsum[i-1][j-1]);
    }
  }

  int ans = 0;
  for(int xd = 0; xd < K; xd++) {
    for(int yd = 0; yd < K; yd++) {
      int v1 = 0, v2 = 0;
      v1 += f(bsum, 0, 0, K, K, xd, yd);
      v1 += f(wsum, K, 0, K*2, K, xd, yd);
      v1 += f(wsum, 0, K, K, K*2, xd, yd);
      v1 += f(bsum, K, K, K*2, K*2, xd, yd);
      v2 += f(wsum, 0, 0, K, K, xd, yd);
      v2 += f(bsum, K, 0, K*2, K, xd, yd);
      v2 += f(bsum, 0, K, K, K*2, xd, yd);
      v2 += f(wsum, K, K, K*2, K*2, xd, yd);
      ans = max(ans, max(v1, v2));
      //      cout << xd << " " << yd << " " << v1 << " " << v2 << " " << ans << endl;  
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 125312
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }
    let sum_ = a.iter().sum::<i64>();

    let mut dist = 10000;
    let mut idx = 100000;
    for i in 0..n {
        let acc = (n as i64 * a[i] - sum_).abs();
        if acc < dist {
            idx = i;
            dist = acc;
        }
    }
    println!("{}", idx);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 




////////////////////////////////////////////////////////

ll modpow(ll a, ll b){
    ll re = 1;
    while(b){
        re *= a;
        re %= MOD;
        b--;
    }
    return re;
}

int main() {
    ll n; cin >> n;
    string s; cin >> s;
    map<char, ll> ma;
    rep(i, 0, n){
        ma[s[i]]++;
    }
    ll ans = 1;
    for(auto c : ma){
        ans *= (c.second+1)%MOD;
        ans %= MOD;
    }
    if(ans - 1 < 0) ans += MOD;
    co(ans - 1);

    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

    long int n;
    cin>>n;
    long long int ans=0;
    vector<long long int>v(n+1,0);
    for(long int i=1;i<=n;i++)
    {
        for(long int j=0;j<=n;j+=i)
        {
            v[j]++;
        }
    }
    for(long int i=1;i<=n;i++)
    {
        ans+=i*v[i];
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 81304
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    int aa=0;
    int bb=0;
    string s;
    string t;
    char c=' ';
    bool aru[2][30]={};
    
    cin >> s;
    cin >> t;
    
    for(int i=0; i<s.size(); i++){
        
        aru[0][s[i]-'a'] = true;
        aru[1][t[i]-'a'] = true;
        
    }
    
    for(int i=0;i<26;i++){
        
        if(aru[0][i]){
            
            aa += 1;
            
        }
        
        if(aru[1][i]){
            
            bb += 1;
            
        }
        
    }
    
    if(aa!=bb){
        
        cout << "No" << endl;
        
        return 0;
        
    }
    
    for(int i=0; i<=25; i++){
        
        c = ' ';
        
        for(int j=0; j<t.size(); j++){
            
            if(t[j]-'a'==i){
                
                if(c==' '){
                    
                    c = s[j];
                    
                } else if(c!=s[j]){
                    
                    cout << "No" << endl;
                    
                    return 0;
                    
                }
                
            }
            
        }
        
    }
    
    cout << "Yes" << endl;

    return 0;
    
}

Measured memory_bytes: 904
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;


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

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

 struct UF {
	vector<int>par;//親
	vector<int>Rank;//木の深さ
    vector<int>sz;//要素数

    UF(int n){init(n);}

	//初期化
	void init(int n) {
		par.resize(n); Rank.resize(n);sz.resize(n);
		for (int i = 0; i < n; i++) {
			par[i]= i;
			Rank[i] = 0;
            sz[i]=1;
		}
	}

	//木の根を求める
	int find(int x) {
		if (par[x] == x) {
			return x;
		}
		else {
			return par[x] = find(par[x]);
		}
	}

	//xとyの属する集合を併合
	bool unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)return false;//すでに同じ集合に属している

		if (Rank[x] < Rank[y]) {//高さが小さい方を下に
			par[x] = y;
            sz[y]+=sz[x];
		}
		else {
			par[y] = x;
			if (Rank[x] == Rank[y])Rank[x]++;//同じだとrankが変わらないままになるので増やす（それ以外は大きい方のrankが採用される）
            sz[x]+=sz[y];
		}
		return true;
	}

	//xとyが同じ集合に属するかを判定
	bool same(int x, int y) {
		return find(x) == find(y);
	}

    int size(int k){//要素数を求める
        return sz[find(k)];
    }
};

void solve(){
	ll n,m;
	cin>>n>>m;
	UF tree(n);
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--;b--;
		tree.unite(a,b);
	}
	int ans=0;
	rep(i,n){
		chmax(ans,tree.size(tree.find(i)));
	}
	cout<<ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 5556
def check(c):
    if c == 'A' or c == 'C' or c == 'G' or c == 'T':
        return True
    return False
s = input()
dem  = 0
demmax = 0
for i in range(len(s)):
    if check(s[i]):
        dem+=1
        if dem > demmax: demmax = dem
    else: dem = 0
print (demmax)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>

using namespace std;
typedef long long ll;

ll ans, mx, mn, flag, sum, cnt;

int main(){
	ll n;
	cin>>n;
	if(n%2!=0) cout<<n*2;
	else cout<<n;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main( void )
{

	int n;
	while ( cin >> n && n )
	{
		vector <string> M(n);
		for ( int i = 0; i < n; i++ )
		{
			cin >> M[i];
		}

		int kotae = 0;
		int cnt = 1;
		while ( cnt <= n )
		{
			bool found = false;
			for ( int i = 0; !found && i < n; i++ ) for ( int j = 0 ; !found && j < n; j++ )
			{
				if ( M[i][j] == '*' )
					continue;

				if ( j+cnt-1 >= n || i+cnt-1 >= n )
					continue;

				bool ok = true;
				for ( int y = 0; ok && y < cnt; y++ ) for ( int x = 0; ok && x < cnt; x++ )
				{
					if ( M[i+y][j+x] == '*' )
						ok = false;
				}

				if ( ok )
					found = true;
			}

			if ( found )
			{
				kotae = cnt;
			}
			else
			{
				break;
			}

			cnt++;
		}

		cout << kotae << endl;

	}

	return 0;
}

Measured memory_bytes: 1720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    string s;
    cin >> s;
    int cnt_0=0,cnt_1=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='0'){
            cnt_0++;
        }
        else{
            cnt_1++;
        }
    }
    int ans=min(cnt_0,cnt_1);
    ans*=2;
    cout << ans << endl;
}


Measured memory_bytes: 3768
#include<stdio.h>
int main(void)
{
	int a,b,c,d,p,x,y;
	scanf("%d %d %d %d %d", &a, &b, &c, &d, &p);
	x=a*p;
	y=b;
	if(c<p)
	y+=(p-c)*d;
	if(x>y)
	x=y;
	printf("%d\n", x);
	
	return 0;
}


Measured memory_bytes: 2108
n,m = map(int,input().split())
elevations = [ int(x) for x in input().split()]
adj_list = [ [] for x in range(n)]

for _ in range(m):
  a,b = [ int(x)-1 for x in input().split()]
  adj_list[a].append(b)
  adj_list[b].append(a)
    
count=0
for i,neighbours in enumerate(adj_list):
  for neighbour in neighbours:
    if(elevations[i]<=elevations[neighbour]):
      break
  else: 
    count+=1
      
print(count)

Measured memory_bytes: 92588
#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
// #define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define eprintf(...) 42
#define dump(x) 42
#define debug(x) 42
#endif

typedef long long ll;

const ll MOD = 1e9 + 7;

void solve(int N, vector<int>& d) {
    int answer = 0;
    vector<int> counts(1e5+1, 0);
    REP(i,0,N) {
        counts[d[i]]++;
    }

    int abc = 0;
    int arc = N;
    REP(k,2,1e5+1) {
        abc += counts[k-1];
        arc -= counts[k-1];
//        cout << abc << '\n';
//        cout << arc << '\n';
        if (abc == arc) answer++;
        else if (abc > arc) break;
    }

	stringstream ss;
    ss << answer;
	cout << ss.str() << '\n';

    return;
}

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

    vector<int> A(N);
    REP(i,0,N) cin >> A[i];

    solve(N, A);

    return 0;
}



Measured memory_bytes: 1024
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p = sorted(p)[a-x:]
q = sorted(q)[b-y:]
r = sorted(r, reverse=True)

pi = 0
qi = 0
ri = 0
while True:
    if ri > c-1: break
    if pi <= x-1 and qi <= y-1:
        if p[pi] < q[qi]:
            if p[pi] < r[ri]:
                p[pi] = r[ri]
                pi += 1
                ri += 1
            else:
                break
        else:
            if q[qi] < r[ri]:
                q[qi] = r[ri]
                qi += 1
                ri += 1
            else:
                break
    elif pi <= x-1:
        if p[pi] < r[ri]:
            p[pi] = r[ri]
            pi += 1
            ri += 1
        else:
            break
    elif qi <= y-1:
        if q[qi] < r[ri]:
            q[qi] = r[ri]
            qi += 1
            ri += 1
        else:
            break
    else:
        break

print(sum(p)+sum(q))

Measured memory_bytes: 22720
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import defaultdict


def main():
    n_in = int(input().strip())

    n_to_xyz = defaultdict(set)
    for x in range(1, 100):
        for y in range(1, 100):
            for z in range(1, 100):
                n = x * x + y * y + z * z + x * y + y * z + z * x
                n_to_xyz[n].add((x, y, z))

    for i in range(1, n_in + 1):
        print(len(n_to_xyz[i]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 137620
n, k, q = map(int,input().split())
a = [0] * n
for _ in range(q):
    a_i = int(input())
    a[a_i - 1] += 1

for i, aa in enumerate(a):
    score = k - q + aa
    if score > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 4680
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(b%a == 0){
      System.out.print(a+b);
    }else{
      System.out.print(b-a);
    }
  }
}

Measured memory_bytes: 23636
#include <cstdio>
using namespace std;

int main(){
	int start[3], end[3];
	
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++) scanf("%d", &start[j]);
		for(int j = 0; j < 3; j++) scanf("%d", &end[j]);
		
		for(int j = 0; j < 3; j++){
			end[j] -= start[j];
			if(j > 0 && end[j] < 0){
				end[j - 1]--; end[j] += 60;
				if(j - 1 > 0 && end[j - 1] < 0){
					end[j - 2]--; end[j - 1] += 60;
				}
			}
		}
		
		for(int j = 0; j < 3; j++){
			printf("%d%s", end[j], (j + 1 == 3)? "\n" : " ");
		}
	}
	
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main{ 

   public static void main(String args[]) {
	 
    Scanner s=new Scanner(System.in);
    
    	int n=s.nextInt();
    	int k=s.nextInt();
    	long h[]=new long[n];
    	for(int i=0;i<n;i++) {
    		h[i]=s.nextLong();
    	}
    	long dp[]=new long[n];
    	dp[0]=0;
    	dp[1]=Math.abs(h[1]-h[0]);
    	
    	for(int i=2;i<n;i++) {
    		dp[i]=Long.MAX_VALUE;
    		for(int j=1;j<=k;j++) {
    		 if(i-j>=0) {
	    		 long op1=dp[i-j] + Math.abs(h[i]-h[i-j]);
	    		 dp[i]=Math.min(dp[i], op1);
    		 }else {
    			 break;
    		 }
    	 }
    	}
    	System.out.println(dp[n-1]);
    	
    }
}

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

using namespace std;

int main(){

  string A,B,C;
  cin >> A >> B >> C;
  if(A[A.size()-1]==B[0]&&B[B.size()-1]==C[0]){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
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; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


signed main(void) 
{
    string f;
    string r;
    cin >>f;
    cin >>r;
    
    int c = 0;
    if (f[0] == r[0])  c ++;
    if (f[1] == r[1])  c ++;
    if (f[2] == r[2])  c ++;
    
    mes(c);
    

}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};

const int MAX=510000;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n;
  cin >> n;
  vector<ll>vec(n);
  rep(i,n) cin >> vec[i];
  int ans = 0;
  rep(i,n)rep(j,n)rep(k,n){
    if(i<j && j<k){
      if(vec[i]==vec[j] || vec[j]== vec[k]||vec[k]==vec[i])continue;
      if(abs(vec[i]-vec[j])<vec[k] && vec[k] < vec[i]+vec[j])ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
#include<stdio.h>
int p[100010],ta[100010],to[200010],nt[200010],co[200010];
void f(int s,int t){
  int i;
  for(i=ta[s];i+1;i=nt[i]){
    if(to[i]==t)continue;
    p[to[i]]=(p[s]+co[i])%2;
    f(to[i],s);
  }
}
int main(){
  int n,i,a,b,c;
  scanf("%d",&n);
  for(i=0;i<=n;i++)ta[i]=-1;
  for(i=0;i<n-1;i++){
    scanf("%d %d %d",&a,&b,&c);
    nt[i]=ta[to[i+n-1]=a];
    nt[i+n-1]=ta[to[i]=b];
    co[ta[a]=i]=co[ta[b]=i+n-1]=c;
  }
  p[1]=0;
  f(1,0);
  for(i=0;i<n;i++)printf("%d\n",p[i+1]);
  return 0;
}


Measured memory_bytes: 5632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		if (2019 <= r - l) {
			System.out.println(0);
			return;
		}
		long m = 0;
		long min = 2019l;
		long calc = 0;
		for (long i = l; i < r; i++) {
			m = i * i;
			for (long j = i + 1; j <= r; j++) {
				m += i;
				calc = m % 2019;
				if (calc < min) {
					min = calc;
				}
			}
		}

		System.out.println(min);
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define INF 0x7fffffff
#define LL long long
using namespace std;
LL fx[5]={-1,1,0,0};
LL fy[5]={0,0,-1,1};
LL x[1010],y[1010],cc[50];
char Fx[5]={'L','R','D','U'};
LL read()
{
	LL s=0,fh=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')fh=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){s=s*10+(ch-'0');ch=getchar();}
	return s*fh;
}
LL DIS(LL xx1,LL yy1,LL xx2,LL yy2){return (LL)fabs(xx2-xx1)+(LL)fabs(yy2-yy1);}
int main()
{
	LL i,xx,yy,xx1,yy1,n,s,lcc,mn,jj,k,j,dis;
	bool js,os;
	n=read();
	js=os=false;
	for(i=1;i<=n;i++){x[i]=read();y[i]=read();s=(LL)fabs(x[i])+(LL)fabs(y[i]);if(s%2LL==0LL)os=true;else js=true;}
	if(js==true&&os==true){printf("-1");return 0;}
	else
	{
		lcc=0LL;for(i=30LL;i>=0LL;i--)cc[++lcc]=(1LL<<i);
		if(((LL)fabs(x[1])+(LL)fabs(y[1]))%2LL==0LL)cc[++lcc]=1LL;
		printf("%lld\n",lcc);
		for(i=1;i<=lcc;i++)printf("%lld ",cc[i]);
		printf("\n");
		for(i=1;i<=n;i++)
		{
			xx=0LL;yy=0LL;
			for(k=1;k<=lcc;k++)
			{
				mn=INF;jj=0LL;
				for(j=0;j<=3;j++)
				{
					xx1=xx+fx[j]*cc[k];yy1=yy+fy[j]*cc[k];
					dis=DIS(xx1,yy1,x[i],y[i]);
					if(dis<mn)
					{
						mn=dis;
						jj=j;
					}
				}
				printf("%c",Fx[jj]);
				xx=xx+fx[jj]*cc[k];yy=yy+fy[jj]*cc[k];
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.Scanner;

public class Main {

	public static final MyScanner in = new MyScanner();

	public static void main(String[] args) {

		BigDecimal a = BigDecimal.valueOf(in.nextLong());
		BigDecimal b = BigDecimal.valueOf(in.nextLong());
		BigDecimal c = BigDecimal.valueOf(in.nextLong());

		String answer =  sqrt(a).add(sqrt(b)).compareTo(sqrt(c)) == -1 ? "Yes" : "No";

		System.out.println(answer);
	}

    public static BigDecimal sqrt(BigDecimal a){
    	int scale = 50;
    	BigDecimal x = new BigDecimal(
                Math.sqrt(a.doubleValue()), MathContext.DECIMAL64);

        BigDecimal b2 = new BigDecimal(2);
        for(int tempScale = 16; tempScale < scale; tempScale *= 2){
            x = x.subtract(
                    x.multiply(x).subtract(a).divide(
                    x.multiply(b2), scale, BigDecimal.ROUND_HALF_EVEN));
        }
        return x;
    }

	public static class MyScanner {
		Scanner sc = new Scanner(System.in);
		String next() { return sc.next();}
		int nextInt() { return Integer.valueOf(sc.next());}
		long nextLong() { return Long.valueOf(sc.next()); }
	}
}

Measured memory_bytes: 23892
N = int(input())
S = []
count = 0
for i in range(0, N):
    s = input()
    S.append(s)

S.sort()

for i in range(0, N - 1):
    if S[i] == S[i+1]:
        count += 1

ans = len(S) - count
print(str(ans))

Measured memory_bytes: 23828
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(void) {
	int N, p[50], q[50],i,j,count=0,flag=0,temp;
	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%d", &p[i]);
	}

	for (i = 0; i < N; i++) {//配列複製
		q[i] = p[i];
	}

	for (i = 0; i < N - 1; i++) { //昇順ソート
		for (j = i + 1; j < N; j++) {
			if (q[i] > q[j]) {
				temp = q[i];
				q[i] = q[j];
				q[j] = temp;
			}
		}
	}
	
	for (i = 0; i < N; i++) {
		if (q[i] != p[i]) {
			count++;
		}
	}
	
	if (count>=3) {
		puts("NO");
	}
	else {
		puts("YES");
	}

	return 0;
}


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

int main() {
  int n, m;
  while (true) {
    cin >> n >> m;
    if (n == 0 && m == 0) {
      break;
    }

    int list[m][2];
    int i, j;
    for (i = 0; i < m; i++) {
      cin >> list[i][0] >> list[i][1];
    }
    vector<int> my_friends;
    vector<bool> menber(n);
    for (i = 0; i < m; i++) {
      if (list[i][0] == 1) {
        my_friends.push_back(list[i][1]);
        menber[list[i][1] - 1] = true;
      }
    }
    for (i = 0; i < my_friends.size(); i++) {
      for (j = 0; j < m; j++) {
        if (my_friends[i] == list[j][0]) {
          menber[list[j][1] - 1] = true;
        } else if (my_friends[i] == list[j][1]) {
          menber[list[j][0] - 1] = true;
        }
      }
    }
    menber[0] = false;
    int count = 0;
    for (i = 0; i < n; i++) {
      if (menber[i]) {
        count++;
      }
    }
    cout << count << endl;
  }
  return 0;
}



Measured memory_bytes: 3212
#include <cstdio>

/// @brief Counts combinations.
int main() {
    long counts[256] = {}, march[5], N, sum = 0;
    char S_i[11];

    scanf("%ld", &N);

    for (int i = 1; i <= N; ++i) {
        scanf("%s", S_i);
        ++counts[S_i[0]];
    }

    march[0] = counts['M'];
    march[1] = counts['A'];
    march[2] = counts['R'];
    march[3] = counts['C'];
    march[4] = counts['H'];

    for (int i = 0; i <= 4; ++i) {  // Combination of (5, 3).
        for (int j = i + 1; j <= 4; ++j) {
            for (int k = j + 1; k <= 4; ++k) {
                sum += march[i] * march[j] * march[k];
            }
        }
    }

    printf("%ld\n", sum);
}


Measured memory_bytes: 128
from collections import Counter
n=int(input())
a=[]
for i in range(n):
  a.append(input())
ac=Counter(a)
acs=sorted(ac.items(),key=lambda x:x[1],reverse=1)
z=len(acs)
i=0
temp=[]

while i<=z-1 and acs[i][1]==acs[0][1] :
  temp.append(acs[i][0])
  i+=1
temp.sort()
for i in temp:
  print(i)

Measured memory_bytes: 50176
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main() {
	int n;
	cin >> n;
	double sum = 0;
	vector<double> x(n);
	vector<string> u(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> u[i];
		if (u[i] == "JPY")sum += x[i];
		if (u[i] == "BTC")sum += ((x[i]*100000000) * 38)/10000;
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A;
  cin>>A;
  vector<vector<int>>train(A-1,vector<int>(3));
  for(int i=0;i<A-1;i++){
    cin>>train.at(i).at(0);
    cin>>train.at(i).at(1);
    cin>>train.at(i).at(2);
  }
  for(int i=0;i<A-1;i++){
    int c;
    c=train.at(i).at(0)+train.at(i).at(1);
    for(int j=1;j<(A-i-1);j++){
      if(c<train.at(i+j).at(1)){
        c=train.at(i+j).at(1);
      }
      
      else if(c%train.at(i+j).at(2)!=0){
        c=train.at(i+j).at(2)*(c/train.at(i+j).at(2)+1);
      }
      c+=train.at(i+j).at(0);
    }
    cout<<c<<endl;
  }
  cout<<0<<endl;
}

    


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int stones[n];
    for (int i = 0; i < n; i++)
    {
        cin >> stones[i];
    }

    vector<int> dp(n, 0);
    dp[1] = abs(stones[1] - stones[0]);
    for (int i = 2; i < n; i++)
    {
        dp[i] = min(abs(stones[i] - stones[i - 1]) + dp[i - 1], abs(stones[i] - stones[i - 2]) + dp[i - 2]);
    }
    cout << dp[n - 1];
    return 0;
}

Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
using ll = long long;
using ull = unsigned long long;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
const ll md = 1000000007;
vector<ll> fact(1e6 + 7), invfact(1e6 + 7);

ll fn(ll a, ll r, ll n, ll mod = md) {
    ll res = 1, x = r%mod;
    ll ans = 0;
    while(n) {
        if(n&1) ans = (x*ans + res)%mod;
        res = ((res*x)%mod + res%mod)%mod;
        x = (x*x)%mod;
        n = n/2;
    }
    ans = (ans*a)%mod;
    return ans;
}

ll nCr(ll n, ll r) {
    if(r == 0) return 1;
    ll num = fact[n];
    ll den = (invfact[r] % md *invfact[n-r] % md)%md;
    return (num*den)%md;
}

ll mul(ll a, ll b, ll mod = md) {
    ll res = (a%mod * b%mod)%mod;
    return res;
}

ll mulm(ll a, ll b, ll mod = md) {
    ll r = 0;
    a %= mod;
    while (b) {
        if (b & 1) r = (r+a)%mod;
        a = (a+a)%mod;
        b = b/2;
    }
    r %= mod;
    return r;
}

ll power(ll x, ll n, ll mod = md) {
    ll res = 1;
    x %= mod;
    while (n) {
        if (n & 1)  res = (res*x)%mod;
        n = n/2;
        x = (x*x)%mod;
    }
    return res;
}

ll power2(ll x, ll n) {
    ll res = 1;
    while (n)  
    {  
        if (n & 1)  res = (res*x);  
        n = n/2; 
        x = (x*x);  
    }  
    return res;
}

bool is_prime(ll x) {
    if(x == 1 || x == 0) return false;
    for(int i=2; i*i <= x; i++) {
        if(x%i == 0) return false;
    }
    return true;
}

ll compgcd(ll n, vector<ll> const &primes) { 
    ll res = n; 
    for (ll i=0; primes[i]*primes[i] <= n; i++) {
        if (n % primes[i]== 0) { 
            res -= (res / primes[i]); 
            while (n%primes[i]== 0) {
               n/=primes[i]; 
            }
        } 
    } 
    if (n > 1) {
       res -= (res / n); 
    }
    return res; 
} 

void sieve(vector<bool> &prime, vector<ll> &primes, ll lim) {
    for(int i = 2; i*i <= lim; i++) {
        if(prime[i]) {
            for(int j = 2; j*i <= lim; j++) {
                prime[j*i] = false;
            }
        }
    }
    for(int i = 2; i <= lim; i++) {
        if(prime[i]) {
            primes.push_back(i);
        }
    }
}

void sieveGCD(ll lim, vector<ll> &tab, vector<ll> const &primes) {
    for(int  i = 1; i <= lim; i++) {
        tab[i] = i;
    }
    for(int i = 0; i<primes.size() && primes[i] <= lim; i++) {
        tab[primes[i]] = primes[i]-1;
        for(int j = 2; primes[i]*j <= lim; j++) {
            tab[primes[i]*j] = (tab[primes[i]*j]/primes[i])*(primes[i]-1);
        }
    }
}

ll calc(ll a, ll b, ll r) {
    ll total = r+1;
    ll tmp = a*b;
    ll count = (r/tmp)*max(a,b) + max(a,b);
    if((r/tmp)*tmp + max(a,b) > r) {
        count -= ((r/tmp)*tmp + max(a,b) - r - 1);
    }
    total -= count;
    return total;
}

int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b, c;
    cin >> a >> b >> c;
    if ((a!=b && a!=c && b!=c) || (a==b && a==c && b==c)) {
        cout << "No\n";
    } else {
        cout << "Yes\n";
    }
    return 0;
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
int n;
int nMax = 0;
int a[16], x[16][16], y[16][16];

void check(int color[]){
//  cout << "---" << endl;
  for(int i = 1; i <= n; i++){
    for ( int j = 0; j < a[i]; j++){
      int X = x[i][j];
      int Y = y[i][j];
//      cout << X << " " << Y << " " << color[X] << endl;
      if (color[X] != Y && color[i] ){
        return;
      }
    }
  }
  int sum = 0;
  for ( int i = 1; i <= n; i++){
    sum += color[i];
  }
  nMax = max(nMax, sum);
}

void rec(int u, int flag, int color[]){
  if ( u > n){
    check(color);
    return;
  }
  color[u] = flag;
  rec(u+1, 1, color);
  rec(u+1, 0, color);
}

int main(){
  cin >> n;
  for ( int i = 1; i <= n; i++){
    cin >> a[i];
    for ( int j = 0; j < a[i]; j++){
      cin >> x[i][j] >> y[i][j];
    }
  }
  int color[n+1];

  rec(0, 1, color);
  rec(0, 0, color);

  cout << nMax << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
      string s,t;
      cin>>s>>t;
      int a[s.length()+1][t.length()+1];
      int i=0,j=0;
      memset(a[0],0,sizeof(a[0]));
      for(j=0;j<=s.length();j++)
        a[j][0]=0;
      string p="";
      //cout<<"LOL"<<endl;
      for(i=1;i<=s.length();i++)
      {
       for(j=1;j<=t.length();j++)
       {
         if(s[i-1]==t[j-1])
         {
          a[i][j]=1+a[i-1][j-1]; 
         }
         else
         {
           a[i][j]=max(a[i-1][j],a[i][j-1]); 
         }
         //cout<<a[i][j]<<" ";
       }
       //cout<<endl;
      }
     // cout<<"LOL"<<endl;
      stack<char> st;
      i=s.length();
      j=t.length();
      while(i!=0 && j!=0)
      {
        if(s[i-1]==t[j-1])
        {
          st.push(s[i-1]);
         // cout<<s[i-1]<<" "<<i<<" "<<j<<endl;
          i--;
          j--;
        }
        else if(a[i][j]==a[i-1][j])
        {
         i--; 
        }
        else
          j--;
      }
      while(st.empty()!=true)
      {
       cout<<st.top();
        st.pop();
      }
      return 0; 
    }

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

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

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

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

void main() {
    int n;
    R(n);
    int ans=0;
    for ( int i=1; i<=n; i++ ) {
        for ( int j=1; j*i<=n; j++ ) {
            int k=n-i*j;
            if ( k<=0 ) continue;
            ans++;
        }
    }
    W(ans);
}

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


Measured memory_bytes: 3860
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] fib = new int[45];
            fib[0] = fib[1] = 1;

            int n = int.Parse(Console.ReadLine());

            for (int i = 2; i <= n; i++) fib[i] = fib[i - 1] + fib[i - 2];

            Console.WriteLine(fib[n]);
        }
    }
}

Measured memory_bytes: 9204
from math import gcd

k = int(input())

ans = 0
for a in range(1, k+1):
   for b in range(1, k+1):
      tmp = gcd(a, b)
      if tmp == 1:
         ans += 1 * k
      else:
         for c in range(1, k+1):
            ans += gcd(tmp, c)

print(ans)


Measured memory_bytes: 9176
use whiteread::parse_line;

fn main() {
    let (n, d): (usize, usize) = parse_line().unwrap();
    let mut point: Vec<Vec<i32>> = Vec::new();
    let mut cnt = 0;
    for _ in 0..n {
        point.push(parse_line().unwrap());
    }

    for j in 0..n {
        for i in 0..j {
            let mut dist = 0;
            for s in 0..d {
                dist += (point[j][s] - point[i][s]).pow(2);
            }
            for t in 0..=(dist as f64).sqrt().ceil() as i32 {
                if t * t == dist {
                    cnt += 1;
                }
            }
        }
    }
    println!("{}", cnt);
}


Measured memory_bytes: 2664
A=gets.to_i
B=gets.to_i
C=gets.to_i
X=gets.to_i
r=0
(0..A).each do |a|
  (0..B).each do |b|
    (0..C).each do |c|
      r+=1 if 500*a+100*b+50*c == X
    end
  end
end
puts r


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define 	pb 				push_back
#define 	MOD 			1000000007
#define 	pp 				pop_back
#define 	MAXN   			1000001
#define 	mp 				make_pair
#define 	endl 			'\n'
#define 	ff 				first
#define 	ss 				second
#define 	mapcl 			map<char,ll>
#define 	mapll 			map<ll,ll>
#define 	pll 			pair<ll,ll>
#define 	cmp 			complex<double>
#define 	pi 				3.141592653589793238462643383279502884197169399375105820974944592307816406286 
#define 	inf 			1000
#define 	vll 			vector<ll>
#define 	all(v) 			v.begin(),v.end()
#define 	fr(i,z,n) 		for(ll i=z;i<n;i++)
#define 	sqrt 			sqrtl
#define 	cbrt 			cbrtl
#define		ll 				long long
#define 	ld 				long double
bool 		coll(pll p1,pll p2,pll p3)		{if((p3.ss-p2.ss)*(p2.ff-p1.ff)==(p2.ss-p1.ss)*(p3.ff-p2.ff))return true;else return false;}
void		print(auto x)					{cout<<x<<endl;}
void 		pv(vector<auto> v)				{for(ll i=0;i<(ll)v.size();i++)cout<<v[i]<<" ";cout<<endl;}
void 		pvsl(vector<auto> v)			{for(ll i=0;i<(ll)v.size();i++)cout<<v[i]<<" ";}
void 		in(vector<auto> &v, ll n)		{v.resize(n);for(ll i=0;i<n;i++)cin>>v[i];}
void 		sortv(vector<auto> &v)			{sort(v.begin(),v.end());}
void 		fast()							{ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
ll maxi(ll a, ll b){ 
	if (a > b)
		return a;
	return b;
}
ll mini(ll a, ll b){
	if (a > b)
		return b;
	return a;
}
string increment(string s){
	ll size = (ll)s.size();
	bool flag = true;
	//aaa
	for (ll i=size-1;i>=0;i--){
		s[i] += 1;
		if (s[i] > 'z'){
			s[i] = 'a';
		}
		else{
			flag = false;
			break;
		}
	}
	if (flag){
		s = 'a' + s;
	}
	return s;
}
int main(){
	ll n, m;
	cin >> n >> m;
	if (n > m){
		for (ll i=0;i<n;i++){
			cout << m;
		}
		cout << endl;
	}
	else{
		for (ll i=0;i<m;i++){
			cout << n;
		}
		cout << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;

void dfs(long& ans, set<vector<bool>>& a, string& S, vector<bool> b, int c = 0) {
	if (S.size() != c) {
		dfs(ans, a, S, b, 1 + c);
		b[c] = true;
		if (!a.count(b)) {
			a.insert(b);
			int d = 0;
			long e = 0;
			for (int i = 0; i < b.size(); ++i) {
				if (b[i]) {
					e += stol(S.substr(d, 1 + i - d));
					d = 1 + i;
				}
			}
			e += stol(S.substr(d, S.size() - d));
			ans += e;
		}
		dfs(ans, a, S, b, 1 + c);
	}
}

int main() {
	string S;
	cin >> S;
	long ans = 0;
	set<vector<bool>> a;
	vector<bool> b(S.size() - 1);
	dfs(ans, a, S, b);
	cout << ans;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

#define LEN 100005
typedef struct pp{
	char name[100];
	int t;	
}P;
P Q[LEN];
int head,tail, n;

void enqueue(P x){
	Q[tail] = x;
	tail = (tail + 1) % LEN;
}
P dequeue(){
	P x = Q [head];
	head = (head + 1) % LEN;
	return x; 
}
int min(int a, int b){
	return a < b ?a : b; 
}
int main(){
	int elaps = 0,c;
	int i,q;
	P u;
	scanf("%d %d",&n,&q);
	for(i=1;i<=n;i++)
	{
		scanf("%s",Q[i].name);
		scanf("%d",&Q[i].t);
	}
	head = 1;tail = n + 1;
	while(head != tail){
		u = dequeue();
		c = min(q,u.t);
		u.t -= c;
		elaps += c;
		if(u.t > 0)
		enqueue(u);
		
	else
	{
		printf("%s %d\n",u.name,elaps);
	}
}
	return 0;
}


Measured memory_bytes: 11960