akhauriyash/Code-Regression huggingface dataset:
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 3);
  (v[0], v[1], v[2])
}

fn main() {
    let (n, k, c) = read_touple::<usize>();
    let mut s: Vec<char> = read::<String>().chars().collect();

    let mut L = Vec::new();
    let mut R = Vec::new();

    let mut pre = 0;
    for i in 0..n {
      if s[i] == 'o' && i == 0 {
         L.push(i);
         pre = i; 
      } else if i > pre && i - pre > c && s[i] == 'o' {
        L.push(i);
        pre = i;
      }
    }

    s.reverse();
    pre = 0;
    for i in 0..n {
      if s[i] == 'o' && i == 0 {
         R.push(n-1-i);
         pre = i; 
      } else if i > pre && i - pre > c && s[i] == 'o' {
        R.push(n-1-i);
        pre = i;
      }
    }  
    R.reverse();
    // println!("{:?}", L);
    // println!("{:?}",R);
    if L.len() > k {
      println!("");
      return;
    }
    for i in 0..std::cmp::min(L.len(), R.len()) {
      if L[i] == R[i] {
        println!("{}", L[i]+1);
      }
    }

}


Measured memory_bytes: 12052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll MOD=1e9+7;
const ll N=2e5+5;
const ld pi=3.14159265359;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(a) (ll)a.size()

ll a,b;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>a>>b;
	cout<<max(a-b,max(a+b,a*b));
	return 0;
}




Measured memory_bytes: 256
#include <stdio.h>

#define MAX 1000

int main(void){
	int n;
	int id[MAX], p[MAX], q[MAX], r[MAX], c[MAX];
	int pLim, qLim, rLim, cLim;
	int valids;
	
	while (scanf("%d", &n), n){
		valids = 0;
		for (int i=0; i<n; i++){
			scanf("%d %d %d %d", &id[i], &p[i], &q[i], &r[i]);
			c[i] = p[i]*4 + q[i]*9 + r[i]*4;
		}
		scanf("%d %d %d %d", &pLim, &qLim, &rLim, &cLim);
		for (int i=0; i<n; i++){
			if (p[i] > pLim) continue;
			if (q[i] > qLim) continue;
			if (r[i] > rLim) continue;
			if (c[i] > cLim) continue;
			printf("%d\n", id[i]);
			valids++;
		}
		if (valids==0) puts("NA");
	}
	
	return 0;
}
		

Measured memory_bytes: 1060
package main

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

func main() {
	fmt.Println(abc178a(os.Stdin))
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func abc178a(r io.Reader) int {
	sc := bufio.NewScanner(r)
	sc.Split(bufio.ScanWords)

	x := nextInt(sc)

	if x == 0 {
		return 1
	}

	return 0
}


Measured memory_bytes: 1776
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var s = next();
  if(s.indexOf("A") == -1 || s.indexOf("B") == -1){
     myout("No");
     }else{
      myout("Yes"); 
     }
}

Measured memory_bytes: 21956
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    # sys.stdin = open("sample.txt")
    N = Scanner.int()
    A = Scanner.map_int()
    A.sort(reverse=True)
    print(sum(A[1:N * 2:2]))
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 106828
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

int main(){
	int N; cin >> N;
	ll T; cin >> T;
	vector<ll> t(N);
	rep(i,N) cin >> t[i];
	ll ans = t[0];
	rep(i,N-1){
		ans += min(t[i+1]-t[i],T);
	}
	ans += T;
	cout << ans << endl;
	
}



Measured memory_bytes: 1792
package main

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

var sc = bufio.NewScanner(os.Stdin)

const inf = 1 << 60
const mod int = 1e9 + 7

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func bs(a []int, t int) int {
	l, r := -1, len(a)
	for r-l > 1 {
		m := l + (r-l)/2
		if a[m] < t {
			r = m
		} else {
			l = m
		}
	}
	return r
}

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

	colors := make([]int, 100010)
	for i := 0; i < len(colors); i++ {
		colors[i] = -1
	}

	for i := 0; i < len(a); i++ {
		x := bs(colors, a[i])
		colors[x] = a[i]
	}

	ans := 0
	for _, v := range colors {
		if v == -1 {
			break
		}
		ans++
	}
	fmt.Println(ans)
}


Measured memory_bytes: 2304
import java.util.*;

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

        int N = sc.nextInt();
        int W = sc.nextInt();
        int[] w = new int[N];
        int[] v = new int[N];
        Map<Integer, List<Integer>> map = new HashMap<>();
        for (int i = 0; i < 4; i++) {
            map.put(i, new ArrayList<>());
        }

        int[] t = new int[4];

        for (int i = 0; i < N; i++) {
            w[i] = sc.nextInt();
            v[i] = sc.nextInt();
            if (i == 0) {
                t[0]++;
                map.get(0).add(v[i]);
            } else {
                int idx = w[i] - w[0];
                t[idx]++;
                map.get(idx).add(v[i]);
            }
        }

        for (int i = 0; i < 4; i++) {
            map.get(i).sort(Integer::compare);
            Collections.reverse(map.get(i));
        }

        long ans = 0;
        long vsum0 = 0;
        for (int i0 = 0; i0 <= t[0]; i0++) {
            if (i0 != 0) {
                vsum0 += map.get(0).get(i0 - 1);
            }
            long vsum1 = 0;
            for (int i1 = 0; i1 <= t[1]; i1++) {
                if (i1 != 0) {
                    vsum1 += map.get(1).get(i1 - 1);
                }
                long vsum2 = 0;
                for (int i2 = 0; i2 <= t[2]; i2++) {
                    if (i2 != 0) {
                        vsum2 += map.get(2).get(i2 - 1);
                    }
                    long vsum3 = 0;
                    for (int i3 = 0; i3 <= t[3]; i3++) {
                        if (i3 != 0) {
                            vsum3 += map.get(3).get(i3 - 1);
                        }
                        long wsum = 0;
                        wsum += (long) i0 * w[0];
                        wsum += (long) i1 * (w[0] + 1);
                        wsum += (long) i2 * (w[0] + 2);
                        wsum += (long) i3 * (w[0] + 3);

                        long vsum = vsum0 + vsum1 + vsum2 + vsum3;

                        if (wsum <= W) {
                            ans = Math.max(vsum, ans);
                        }
                    }
                }
            }
        }

        System.out.println(ans);
    }
}


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

// #define int long long

/* cpp template {{{ */

/* short */
#define pb push_back
#define print(x) cout << x << '\n'
#define Fi first
#define Se second

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define DEPS(i, a, n) for (int i = (a); i >= n; i--)
#define DEP(i, n) for (int i = (n); i >= 0; i--)

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = 999999999;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}
inline bool is_inside(int y, int x, int H, int W) {return (y >= 0 && x >= 0 && y < H && x < W);}

/* }}} */

signed main()
{
  ios::sync_with_stdio(false);
  int N, ans = 0;
  string s;

  cin >> N >> s;
  while (N--){
    string in;
    cin >> in;
    bool next = false;
    REP(i, in.size()){
      REP(j, in.size()){
        int sNow = 0;
        string res;
        for (int k = j; k < in.size(); k += i + 1){
          if (in[k] == s[sNow]){
            res += in[k];
            sNow++;
          } else {
            break;
          }

          if (res == s){
            ans++;
            next = true;
            break;
          }
        }
        if (next) break;
      }
      if (next) break;
    }
  }

  print(ans);

  return (0);
}

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

int main(){
  long long  n,k,s,i,j;
  cin >> n >> k >> s;
  
  if(s<n-k+1){
    for(i=0; i<s+k-1; i++){
      cout << 1 << ' ';
    }
    for(i=s+k-1; i<n; i++){
      cout << s+1 << ' ';
    }
  }else{
    for(i=0; i<n; i++){
      if(i%(n-k+1)==0){
        cout << s-n+k << ' ';
      }else{
        cout << 1 << ' ';
      }
    }
  }
}

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

#define rep(i, s, n) for(int i = s; i < n; ++i)
#define rrep(i, n) for(int i = n - 1; i > -1; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int l;
    cin >> l;
    double ans = (double)l/3 * (double)l/3 * (double)l/3;
    cout << fixed << setprecision(12) << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
double PI=acos(-1);
string s1,s2,s3;
int n,m,dp[3010][3010];
string table[3010][3010];
int c1;
string solve(int r,int c){
    /*cout<<c1<<'\n';
    c1++;*/
    if(r>=n || c>=m) return "";
    if(table[r][c]!="") return table[r][c];
    if(dp[r][c]>dp[r+1][c] && dp[r][c]>dp[r][c+1]) return table[r][c]=solve(r+1,c+1)+s1[r];
    if(dp[r+1][c]>=dp[r][c+1]) return table[r][c]=solve(r+1,c);
    else return table[r][c+1]=solve(r,c+1);
}


int main(){
    IO
    cin>>s1>>s2;

    n=s1.length(),m=s2.length();
    for(int i=n-1;i>=0;i--){
        for(int j=m-1;j>=0;j--){
            if(s1[i]!=s2[j]) dp[i][j]=max(dp[i][j+1],dp[i+1][j]);
            else dp[i][j]=dp[i+1][j+1]+1;
        }
    }
    s3=solve(0,0);
    reverse(s3.begin(),s3.end());
    cout<<s3;
    return 0;
}


Measured memory_bytes: 331164
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    int n, m;

    cin >> n >> m;

    queue<int> a;
    vector<ll> dp(n + 1, 0);

    for (int i = 0; i < m; i++)
    {
        int x;
        cin >> x;
        a.push(x);
    }

    dp[0] = 1;
    dp[1] = 1;

    if (a.front() == 1)
    {
        dp[1] = 0;
        a.pop();
    }

    for (int i = 2; i <= n; i++)
    {
        if (i == a.front() && a.size())
        {
            dp[i] = 0;
            a.pop();
            continue;
        }

        dp[i] = (dp[i - 1] + dp[i - 2]) % MOD;
        dp[i] %= MOD;
    }

    cout << dp[n] << endl;
}

Measured memory_bytes: 1408
#include <iostream>

using namespace std;

int main()
{
    int n ,c=0;
    cin>>n;
    int arr[n];
    for(int i=0 ; i<n ; i++){
        cin>>arr[i];
    }
    for(int i=1 ; i<n+1 ; i+=2){
        if(arr[i-1]%2==1){
            c++;
        }
    }
    cout<<c;
    return 0;
}



Measured memory_bytes: 3596
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N, A, B = map(int, input().split())
    # if N == 2:
    #     print('Draw')
    if (B-A-1) % 2 == 1:
        print('Alice')
    else:
        print('Borys') 

if __name__ == "__main__":
    main()


Measured memory_bytes: 9404
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int result = 0;
		int N = sc.nextInt();
		String[] s = new String[N];
		for(int i = 0; i < N; i++) {
			s[i] = sc.next();
		}

		int M = sc.nextInt();
		String[] t = new String[M];
		for(int i = 0; i < M; i++) {
			t[i] = sc.next();
		}

		for(int i = 0; i < N; i++) {
			int count = 0;
			for(int j = i; j < N; j++) {
					if(s[i].equals(s[j])) {
						count++;
				}
			}
			for(int j = 0; j < M; j++) {
				if(s[i].equals(t[j])) {
					count--;
				}
			}
			result = Math.max(result, count);
		}

		System.out.println(result);
	}
}


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

int main() {
    int a,b;
    for(int M=0; M<99999999; M++){
    cin >> a >> b;
    if(a==0 && b==0){
        break;
    }
    for(int i=0; i<a; i++){
        for(int o=0; o<b; o++){
            cout << "#";
            }
        cout << endl;
        }
        cout << endl;
    }
}



Measured memory_bytes: 3096
import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
	int x,y,tmp;
	Scanner scan=new Scanner(System.in);
	while(true)
	    {
		x=scan.nextInt();
		y=scan.nextInt();
		if((x==0) && (y==0))break;
		if(x>y)
		    {
			tmp=x;
			x=y;
			y=tmp;
		    }
		System.out.println(x+" "+y);
	    }
    }
}

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

#define PI 3.14159265

int main(void) {
	double t_x = 0;
	double t_y = 0;
	int t_rad = 0;
	int x = 0;
	int k = 1;

	scanf("%d", &x);

	t_y = 1;
	t_rad = -x;

	int roopFlag = 1;
	while (roopFlag) {
		k++;

		double tmp = t_rad * PI / 180;
		t_x += sin(tmp);
		t_y += cos(tmp);

		t_rad -= x;
		if (t_rad >= 360) {
			t_rad -= 360;
		}
		else if (t_rad <= -360) {
			t_rad += 360;
		}

		if (fabs(t_x) <= 0.00001 && fabs(t_y) <= 0.00001) {
			roopFlag = 0;
		}
	}

	printf("%d", k);

	return 0;
}


Measured memory_bytes: 2452
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000


int main(){
	int a[N];
	f(i, N)a[i] = 0;
	int n, k;
	int x, y, z;
	int s, ans;
	bool v = true;
	s = 1000000000;
	ans = 0;
	scanf("%d", &n);
	scanf("%d %d", &x, &y);
	x = x * 1000;
	y = y * 1000;
	f(i, n){
		scanf("%d", &a[i]);
		z = x - (a[i] * 6);
		z = z - y;
		z = abs(z);
		if (z < s){
			s = z;
			ans = i + 1;
		}
	}

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


	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using LL = long long;
using ULL = unsigned long long;


void solve() {
	int n; cin >> n;
	pair<int, int> xy[8]; rep(i, n) cin >> xy[i].first >> xy[i].second;
	double d[8][8];
	rep(a, n)rep(b, n){
		int dx = xy[a].first - xy[b].first, dy = xy[a].second - xy[b].second;
		d[a][b] = sqrt(double(dx * dx + dy * dy));
	}
	double ans = 0;
	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			ans += d[i][j];
	ans *= 2.0;
	ans /= double(n);
	cout << setprecision(10) << ans << endl;
}

int main() {

	solve();

	return 0;
}


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


public class Main {
    public static void main(String[] args) throws Exception {
        //スキャン
        final Scanner s = new Scanner(System.in);
        String str = s.next();
        //高さ
        if( str.charAt(2) == str.charAt(3) && str.charAt(4) == str.charAt(5) ){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e18 + 4)
template<class T> bool chmax(T &a,  T b) {if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a,  T b) {if(a>b){a=b; return 1;} return 0;}
bool Add(int &a,int b){a = (a + b) % MOD;}
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

signed main(){
    int n;
    cin >> n;
    pair<int,int> A[n];
    int ma = -1,mi = INF;
    REP(i,n){
        cin >> A[i].fi >> A[i].se;
        if(A[i].fi < A[i].se) swap(A[i].fi,A[i].se);
        chmax(ma,A[i].fi);
        chmin(mi,A[i].se);
    }
    if(n == 1){
        cout << 0 << endl;
        return 0;
    }
    sort(A,A+n);
    int ans = INF;
    int hoge = INF,huga = -1;
    REP(i,n){
        chmin(hoge,A[i].fi);
        chmax(huga,A[i].se);
    }
    chmin(ans,(ma-hoge) * (huga - mi));

    reverse(A,A+n);
    if(A[0].se > mi){
        huga = A[n-1].fi;
        int se_max = A[0].se;
        FOR(i,1,n){
            chmin(ans,(ma - mi) * ( max(se_max, A[i].fi) - huga));
            if(i == n - 1) break;
            chmax(se_max,A[i].se);
            huga = min(huga,A[i].se);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3328
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
	w[i], v[i] = map(int, input().split())

sum_v = sum(v)

dp = [[10**18] * (sum_v + 1) for _ in range(N + 1)]

for i in range(N+1):
    dp[i][0] = 0
    
# dp[i][j](j=0,1,...,W)の値が求まっている状態で、dp[i+1][j]を更新することを考える
for i in range(N):
    for j in range(sum_v + 1):
		# 品物(w[i],v[i])を選ぶとき、j-w[i]>=0に限って、価値v[i]が加算される
        if j - v[i] == 0:
            dp[i + 1][j] = min(w[i],dp[i][j])
        if dp[i][j] != 10**18:
            dp[i+1][j+v[i]] = min(dp[i][j+v[i]],dp[i][j]+w[i])
		# 品物(w[i],v[i])を選ばないとき、何も加算しない
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])

for i in range(sum_v + 1):
    #print(dp[N][sum_v - i],i)
    if dp[N][sum_v - i] <= W and dp[N][sum_v - i] != 0:
        print(sum_v - i)
        exit()

print(0)

Measured memory_bytes: 120812
n = int(input())
t = [int(input()) for _ in range(n)]

def scm(a, b):
    x, y = max(a, b), min(a, b)
    while x%y > 0:
        tmp = x%y
        x = y
        y = tmp
    return a*b//y

scm_ = t[0]
for i in range(1, n):
    scm_ = scm(scm_, t[i])
print(scm_)


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

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max(a*b,c*d)<<endl;
    
    }

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

static const auto speedup = []() { 
	std::ios::sync_with_stdio(false); 
	std::cin.tie(NULL); 
	std::cout.tie(NULL);
	return 0; 
}();

#define ll long long int

void test_case(){
	int n;
	scanf("%d", &n);
	int arr[2][3] = {0};
	for(int i=0;i<n;i++){
		scanf("%d%d%d", &arr[1][0], &arr[1][1], &arr[1][2]);
		arr[1][0] += max(arr[0][1], arr[0][2]);
		arr[1][1] += max(arr[0][0], arr[0][2]);
		arr[1][2] += max(arr[0][0], arr[0][1]);
		arr[0][0] = arr[1][0];
		arr[0][1] = arr[1][1];
		arr[0][2] = arr[1][2];
	}
	printf("%d\n", max(arr[0][0], max(arr[0][1], arr[0][2])));
}

int main(){
	int testcases = 1;
	// scanf("%d", &testcases);
	for(int testcase = 0;testcase < testcases;testcase++){
		test_case();
	}
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int x=0,y=0,z=0,count=0;
    scanf("%d %d %d",&x,&y,&z);
    for(int i=x;i<=y;i++){
        if(z%i==0){
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
}



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

int main()
{
    
    /*
    string s1;
    getline( cin, s1 );
    int n1 = s1.size();
    */
    int p, q, r;
    cin >> p >> q >> r;
    
    cout << (p+q+r-max(max(p,q),r)) << endl;
      
    return 0;
}


Measured memory_bytes: 256
import sys
import numpy as np

def main():
    input = sys.stdin.readline
    N = int(input())
    A = np.array([list(map(int, input().split())) for i in range(N)])
    #A = [list(map(int, input().split())) for _ in range(N)]
    #A = np.array(A)

    INF = 10**10
    for i in range(N):
        A[i][i] = INF

    ans = 0
    for i in range(N):
        for j in range(i):
            #bipas = min(map(sum, zip(A[i], A[j])))
            bipas = np.min(A[i] + A[j])

            if A[i][j] > bipas:
                print(-1)
                return 0
            elif A[i][j] < bipas:
                ans += A[i][j]

    print(ans)


if __name__ == '__main__':
    main()


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  vector<vector<int>> bsum(20, vector<int>(n, 0));
  rep(i, 20) rep(j, n) {
    bsum[i][j] = (a[j] >> i) & 1;
    if (j > 0) bsum[i][j] += bsum[i][j - 1];
  }

  ll ans = 0;
  rep(i, n) {
    int r = n - 1;
    rep(j, 20) {
      int target = bsum[j][i] + ((a[i] >> j) & 1 ? 1 : 2);
      int k = lower_bound(all(bsum[j]), target) - bsum[j].begin() - 1;
      r = min(r, k);
    }
    ans += (r - i + 1);
  }

  cout << ans << endl;
}


Measured memory_bytes: 17536
#include<bits/stdc++.h>
using namespace std;
int main()
{
  char mat[3][3];
  int i,j;
  for(i=0;i<3;i++)
  {
    for(j=0;j<3;j++)
    {
      cin>>mat[i][j];
    }
  }
  string s ="";
  s=s+mat[0][0]+mat[1][1]+mat[2][2];
  cout<<s;
  return 0;
}

Measured memory_bytes: 3612
#include<stdio.h>
int main()
{
    int a,b,h,v;
    scanf("%d %d %d",&a,&b,&h);
    if(a>=1&&b>=1&&h>=1&&a<=100&&b<=100&&h<=100)
    {
       v=(a+b)*h/2;
    }
    printf("%d",v);
    return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define OP ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> pii;
const int inf = int(1e9);
const int mod = inf + 7;
const double PI = acos(-1.0);
using namespace std;
const int N = 1e5 + 155;
template<typename T>
inline void read(T&x){
    x=0;int f=1;char ch = getchar();
    while(ch<'0' ||ch>'9'){ if(ch=='-')f=-1;ch=getchar(); }
    while(ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
    x*=f;
}

void solve(){
    int n, k;
    cin >> n >> k;
    int a[n];
    rep(i, n) cin >> a[i];
    int ans = inf;
    sort(a, a + n);
    for(int i = 0; i < n - k + 1; i++) {
        ans = min(ans, a[k + i - 1] - a[i]);
    }
    cout << ans;
}
 
int main(){
    OP
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    while(t--)
    solve();
    return 0;
}

Measured memory_bytes: 640
plr = Struct.new(:point)
N,K,Q = gets.split(" ").map(&:to_i)
players = []
for i in 0...N
	players << plr.new(K)
end
for i in 0...Q
	players[gets.to_i-1].point += 2
end
for i in 0...N
	puts (players[i].point + K > Q << 1) ? "Yes" : "No"
end

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

const int LIMIT = 1000000;

int main()
{
	bool* prime = new bool[ LIMIT + 1 ]();
	prime[ 0 ] = prime[ 1 ] = true;
	for( int i = 2; i < LIMIT + 1; ++i ){
		if( prime[ i ] ) continue;
		for( int j = i + i; j < LIMIT + 1; j += i ){
			prime[ j ] = true;
		}
	}

	int n, x;
	while( cin >> n >> x && ( n || x ) ){
		bool* price = new bool[ x + 1 ]();
		set< int > menu;
		for( int i = 0; i < n; ++i ){
			int p;
			cin >> p;
			if( p <= x ){
				menu.insert( p );
				price[ p ] = true;
			}
		}
		int ans = 0;
		for( int i = 0; i <= x; ++i ){
			if( !price[ i ] ) continue;
			if( !prime[ i ] ){
				ans = i;
			}
			set< int >::iterator itr = menu.begin();
			while( itr != menu.end() ){
				int a = i + *itr;
				if( a <= x ){
					price[ a ] = true;
				}
				++itr;
			}
		}

		if( ans != 0 ){
			cout << ans << endl;
		}else{
			cout << "NA" << endl;
		}

		delete[] price;
	}

	delete[] prime;

	return 0;
}

Measured memory_bytes: 3948
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <math.h>
using namespace std;

typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) a.begin(),a.end()

int main() {
	int n, k;
	cin >> n >> k;
	int cnt = 0;
	int now = 1;
	while (now <= k) {
		now *= 2;
		cnt++;
		if (cnt == n)break;
	}
	for (int i = cnt; i < n; i++) {
		now += k;
	}
	cout << now << endl;

	return 0;
}

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

int main() {
  int n;
  cin>>n;
  vector<int> Ais(n), Mis(n), Lis(n), Ris(n+1);
  for(int i=0;i<n;i++){cin>>Ais.at(i);}
  for(int i=0;i<n;i++){
    if(i==0)Lis.at(i)=0;
    else Lis.at(i)=__gcd(Lis.at(i-1),Ais.at(i-1));
  }
  for(int i=n;i>=0;i--){
    if(i==n)Ris.at(i)=0;
    else Ris.at(i)=__gcd(Ris.at(i+1),Ais.at(i));
  }
  for(int i=0;i<n;i++){Mis.at(i)=__gcd(Lis.at(i),Ris.at(i+1));}
  int max_mi=*max_element(Mis.begin(),Mis.end());
  cout<<max_mi<<endl;
}

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll a,b,c,d;
    string s;
    cin >> a >> b >> c >> d;
    if(a+b == c+d)s = "Balanced";
    else if(a+b > c+d)s = "Left";
    else s = "Right";
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = input()
b = input()
c = input()

x = 0
for i in range(n):
    if a[i] == b[i] and b[i] == c[i]:
        continue
    if a[i] == b[i] or b[i] == c[i] or c[i] == a[i]:
        x = x + 1
    else:
        x = x + 2

print(x)

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

typedef struct {
  char S[12];
  int P;
  int ID;
} Data;

int main(void) {
  int N;
  Data data[N], tmp;

  scanf("%d", &N);

  for (int i = 0; i < N; i++) {
    scanf("%s", data[i].S);
    scanf("%d", &data[i].P);
    data[i].ID = i + 1;
  }

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N - 1; j++) {
      if (strcmp(data[j].S, data[j + 1].S) > 0) {
        tmp = data[j];
        data[j] = data[j + 1];
        data[j + 1] = tmp;
      } else if (strcmp(data[j].S, data[j + 1].S) == 0 &&
                 data[j].P < data[j + 1].P) {
        tmp = data[j];
        data[j] = data[j + 1];
        data[j + 1] = tmp;
      }
    }
  }

  for (int i = 0; i < N; i++) {
    printf("%d\n", data[i].ID);
  }

  return 0;
}

Measured memory_bytes: 128
#include <cstdlib>
#include <iostream>
#include <stack>
#include <sstream>
#include <string>
#include <list>

typedef std::list<std::string> TList;
TList GetInputStrings(std::istream& Input)
{
    TList List;
    std::string s;
    while(true){
        std::string s;
        Input >> s;
        if(Input.good() == false) break;
        List.push_back(s);
    }
    return List;
}
int Rpn(const TList& List)
{
    std::stack<int> Stack;
    for(TList::const_iterator It = List.begin();
        It != List.end();
        ++It)
    {
        switch((*It)[0]){
        case '+':{
            int a = Stack.top(); Stack.pop();
            int b = Stack.top(); Stack.pop();
            Stack.push(b + a);
            break;
        }
        case '-':{
            int a = Stack.top(); Stack.pop();
            int b = Stack.top(); Stack.pop();
            Stack.push(b - a);
            break;
        }
        case '*':{
            int a = Stack.top(); Stack.pop();
            int b = Stack.top(); Stack.pop();
            Stack.push(b * a);
            break;
        }
        default:{
            Stack.push(std::atoi(It->c_str()));
            break;
        }
    }
    }
    return Stack.top();
}
int main()
{
    TList List = GetInputStrings(std::cin);
    std::cout << Rpn(List) << std::endl;
    return 0;
}

Measured memory_bytes: 1212
from collections import defaultdict

lens = int(input())
cards = defaultdict(set)
for index in range(lens):
    card, number = input().split()
    cards[card].add(int(number))

numbers = set(range(1, 14))
for design in "SHCD":
    remains = numbers - cards[design]
    for number in sorted(list(remains)):
        print(f"{design} {number}")


Measured memory_bytes: 6004
#!/usr/bin/env python3
def main():
    import sys
    from collections import defaultdict
    input = sys.stdin.readline
    h, w, m = map(int, input().split())
    cnt_h = [0] * h
    cnt_w = [0] * w
    bomb = defaultdict(lambda : 0)
    for _ in range(m):
        y, x = map(lambda x:int(x) - 1, input().split())
        cnt_h[y] += 1
        cnt_w[x] += 1
        bomb[(y, x)] = 1
        
    kouho_h = []
    kouho_w = []
    max_h = max(cnt_h)
    max_w = max(cnt_w)
    for i in range(h):
        if cnt_h[i] == max_h:
            kouho_h.append(i)
    for i in range(w):
        if cnt_w[i] == max_w:
            kouho_w.append(i)
    
    for i in kouho_h:
        for j in kouho_w:
            if bomb[(i, j)] == False:
                print(max_h + max_w)
                exit()
    print(max_h + max_w - 1)



if __name__ == '__main__':
    main()

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

using namespace std;

int main()
{
    string t;
    cin >> t;

    for (size_t i = 0; i < t.size(); ++i) {
        if (t[i] == '?')
            t[i] = 'D';
    }
    cout << t << endl;

    return 0;
}


Measured memory_bytes: 3748
#include <iostream>
using namespace std;
int main() {
  int a; cin >> a;
  if(a>=3){
   int b=a%3;
   if(b==1||b==2) {
    cout << (a-b)/3 << endl;
    }
    else if (b==0){
    cout << a/3 << endl;
    }
  }
  else if (a<3) {
    cout << 0 << endl;
  }
}


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

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }   //コンストラクタ:を使うことで実行時間を短縮できる
                                        //ここではparを()内で初期化
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

int main() {
    int N, K, L; cin >> N >> K >> L;
    UnionFind uf1(N), uf2(N);
    for (int i = 0; i < K; ++i) {
        int a, b; cin >> a >> b; --a, --b;
        uf1.merge(a, b);
    }
    for (int i = 0; i < L; ++i) {
        int a, b; cin >> a >> b; --a, --b;
        uf2.merge(a, b);
    }

    using pint = pair<int,int>;
    map<pint, int> ma;
    for (int v = 0; v < N; ++v) {
        //(道路の親, 線路の親)をインデックスとするmapをつくる。
        //p(uf1.root(v), uf2.root(v))=p(uf1.root(v+2), uf2.root(v+2))なら同じma[p]が加算される
        pint p(uf1.root(v), uf2.root(v));
        ma[p]++;
    }

    for (int v = 0; v < N; ++v) {
        pint p(uf1.root(v), uf2.root(v));
        cout << ma[p] << " ";
    }
}

Measured memory_bytes: 13568
#include<bits/stdc++.h>
using namespace std;
const int N=200002;
int n,m,i,s,mid,l,r,ans,a[N];
inline char gc(){
	static char buf[100000],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
inline int rd(){
	int x=0,fl=1;char ch=gc();
	for(;ch<48||ch>57;ch=gc())if(ch=='-')fl=-1;
	for(;48<=ch&&ch<=57;ch=gc())x=(x<<3)+(x<<1)+(ch^48);
	return x*fl;
}
bool chk(int mid){
	for (int i=mid*2+1,j=n*2;i<=j;i++,j--)
		if (a[i]+a[j]<m) return 0;
	return 1;
}
int main(){
	n=rd(),m=rd();
	for (i=1;i<=n*2;i++) a[i]=rd();
	sort(a+1,a+n*2+1);
	l=0,r=n;
	while (l<=r){
		mid=l+r>>1;
		if (chk(mid)) s=mid,r=mid-1;
		else l=mid+1;
	}
	for (i=1;i<=s*2;i++) ans=max(ans,a[i]+a[s*2-i+1]);
	for (i=s*2+1;i<=n*2;i++) ans=max(ans,a[i]+a[n*2+1-i+s*2]-m);
	printf("%d",ans);
}

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

int main() {
  int n, k, l;
  cin >> n >> k;
  l = 0;
  for ( int i = 0; i < n; i++ ){
    int x;
    cin >> x;
    if ( x < k-x ){
      l += 2*x;
    }
    else {
      l += 2*(k-x);
    }
  }
  cout << l << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
int N;

int main(){
  int A, B;
  cin >> A >> B;
  cout << max(max(A*B, A-B),A+B) << endl;
					
}


Measured memory_bytes: 256
#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>;
 
int main() {
  int n;
  cin >> n;
  int f,l;
  f = n / 100;
  l = n % 100;
  if((f > 12 || f == 0) && (l > 12 || l == 0)) cout << "NA" << endl;
  if((f <= 12 && f != 0) && (l > 12 || l == 0)) cout << "MMYY" << endl;
  if((f <= 12 && f != 0) && (l <= 12 && l != 0)) cout << "AMBIGUOUS" <<  endl;
  if((f > 12 || f == 0) && (l <= 12 && l != 0)) cout << "YYMM" << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()

void solve();

signed main () {
    clock_t beg = clock();
    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif
    int t = 1; 
    // cin >> t;    
    int tt = t;
    while (t--) { 
        solve();
    }
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
    return 0;
}
const int N = 2e5 + 55;
int arr[N];
void solve() {
	int n;
	cin >> n;
	rep(i, 1, n + 1)
		cin >> arr[i];
	sort(arr + 1, arr + n + 1);
	rep(i, 2, n + 1) {
		if (arr[i] == arr[i - 1]) {
			cout << "NO";
			return;
		}
	}
	cout << "YES";
}   

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <iterator>
#include <string>
#include <sstream>
#include <limits.h>

using namespace std;

string GetStr()
{
	string str;
	getline(cin,str);
	return str;
}

vector<int> GetIntVector()
{
	string str;
	getline(cin,str);
	istringstream line( str );

	istream_iterator<int> iit(line);
	istream_iterator<int> iit_eof;

	vector<int> ret;

	for(;iit != iit_eof; iit++){
		ret.push_back(*iit);
	}

	return ret;
}


typedef struct _Size
{
	int w,h;

	bool IsZero(){return w == 0 || h == 0;}

	
	static struct _Size GetSize()
	{
		struct _Size s;
		vector<int> vec = GetIntVector();
		s.w = vec[0];
		s.h = vec[1];
		return s;
	}

} Size;

void GoNextFloor(Size& s,vector<vector<int> >& vwhole,vector<vector<int> >& hwhole,vector<vector<int> >& floor,int x,int y,int step)
{
	floor[y][x] = step;
	if(y == s.h-1 && x == s.w-1) return ;

	step++;

	//ã
	if(y > 0 && hwhole[y-1][x] == 0 && floor[y-1][x] > step)
		GoNextFloor(s,vwhole,hwhole,floor,x,y-1,step);

	//º
	if(y < s.h - 1 && hwhole[y][x] == 0 && floor[y+1][x] > step)
		GoNextFloor(s,vwhole,hwhole,floor,x,y+1,step);

	//¶
	if(x > 0 && vwhole[y][x-1] == 0 && floor[y][x-1] > step)
		GoNextFloor(s,vwhole,hwhole,floor,x-1,y,step);

	//E
	if(x < s.w - 1 && vwhole[y][x] == 0 && floor[y][x+1] > step)
		GoNextFloor(s,vwhole,hwhole,floor,x+1,y,step);

	//SÄÌ×Ì°ðà¢½ÌÅAé
	return;
}

void EscapeMaze(Size& s)
{
	//cA¡ÌÇ(v,h)
	vector<vector<int> > vwhole,hwhole;

	vwhole.push_back(GetIntVector());
	for(int i = 0; i < s.h - 1; i++){
		hwhole.push_back(GetIntVector());
		vwhole.push_back(GetIntVector());
	}

	vector<vector<int> > floor(s.h);
	for(int i = 0; i < s.h; i++){
		floor[i].resize(s.w);
		for(int j = 0; j < s.w; j++){
			floor[i][j] = INT_MAX;
		}
	}

	GoNextFloor(s,vwhole,hwhole,floor,0,0,1);

	int ans = floor[s.h - 1][s.w - 1];
	ans = (ans == INT_MAX) ? 0 : ans;

	cout << ans << endl;
}

void B()
{
	Size size = Size::GetSize();
	while(!size.IsZero()){
		EscapeMaze(size);
		size = Size::GetSize();
	}
}

int main()
{
	B();

	return 0;
}

Measured memory_bytes: 0
/*==============================================*\
ID:          shahidul_brur

Name:     Md. Shahidul Islam
Study:      CSE, BRUR
Address:  Rangpur, Bangladesh

 mail: shahidul.cse.brur@gmail.com
 FB  : fb.com/shahidul.brur
 Blog: shahidul-brur.blogspot.com(in Bengali),
       shahidul-brur-en.blogspot.com(in English)
\*===============================================*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};

const double pi = acos(-1.0);
const double eps = 1e-6;
const int mod = (int)1e9+7;
const int maxn = (int)2e5+5;
const int logn = 20;
int a[200002], b[maxn];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    int n;
    cin>>n;
    f1(i,n+1) cin>>a[i];
    f1(i,n) cin>>b[i];
    ll tot = 0;
    f1(i,n)
    {
        if(a[i]>=b[i]){
            tot+=b[i];
        }
        else
        {
            tot+=a[i];
            int r = b[i]-a[i];
            tot+=min(a[i+1], r);
            a[i+1]-=min(a[i+1], r);

        }
    }
    cout << tot << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<utility>
using namespace std;
#define MS(m,z) memset(m,z,sizeof(m))
typedef unsigned U;typedef long long ll;typedef pair<int,int > P;
void inp();
int main(){
#ifdef XS
	//freopen(".in","r",stdin);
#endif
	//int ttt;scanf("%d",&ttt);for(int i=1;i<=ttt;i++)
	inp();
	return 0;
}
const int N = 2e5 + 1000;
ll T[N];
void inp(){
	ll n,t;scanf("%lld%lld", &n,&t);
	for(int i =0;i<n;i++)scanf("%lld", &T[i]);
	ll ans = 0;
	ll cur = 0;
	for(int i =1;i<n;i++){
		if( T[i] - cur >= t){
			ans += t;
		}
		else {
			ans += T[i] - cur;
		}
		cur = T[i];
	}
	ans += t;
	printf("%lld", ans);
}
//c.cc by xsthunder at Sun Aug 12 13:35:29 2018


Measured memory_bytes: 1664
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace ConsoleApplication21
{
	class Program
	{
		static void Main(string[] args)
		{
			int a = int.Parse(Console.ReadLine());
			string b = Console.ReadLine();
			if (a >= 3200)
				Console.WriteLine(b);
			else
				Console.WriteLine("red");
 
		}
	}
}

Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

#define INF 1e18
#define int long long

vector<pair<int, int>> factorize(int n) {
    vector<pair<int, int>> ret;
    for(int i = 2; i * i <= n; i++) {
        if(n % i) continue;
        ret.emplace_back(i, 0);
        while(n % i == 0) {
            n /= i;
            ret.back().second++;
        }
    }
    if(n != 1) ret.emplace_back(n, 1);
    return ret;
}

signed main() {
    int n, p; cin >> n >> p;

    vector<pair<int, int>> f = factorize(p);

    int ans = 1;
    for(int i = 0; i < f.size(); i++) {
        ans *= pow(f[i].first, f[i].second / n);
    }

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


Measured memory_bytes: 256
/*
  Contest 062
  A - Grouping
  Rakesh Kumar --> 28/08/2020
 */

#include <bits/stdc++.h>



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

    std::vector<int> v1 = {1, 3, 5, 7, 8, 10, 12};
    std::vector<int> v2 = {4, 6, 9 , 11};
    int x = 0, y = 0;
    std::cin >> x >> y;
    if ((std::find(v1.begin(), v1.end(), x) != v1.end() && std::find(v1.begin(), v1.end(), y) != v1.end()) ||
        (std::find(v2.begin(), v2.end(), x) != v2.end() && std::find(v2.begin(), v2.end(), y) != v2.end()))
        std::cout << "Yes" << std::endl;
    else
        std::cout << "No" << std::endl;

    return 0;
}


Measured memory_bytes: 3576