akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

	static Scanner sc = new Scanner(System.in);

	static class FastScanner {
		private final InputStream in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		public FastScanner(InputStream source) {
			in = source;
		}

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte()) return buffer[ptr++];
			else return -1;
		}

		private static boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
			return hasNextByte();
		}

		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		public int nextInt() {
			long nl = nextLong();
			if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
				throw new NumberFormatException();
			return (int) nl;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] args){

		solve_abc164_c();
	}
  
  	public static void solve_abc164_c(){

		FastScanner sc = new FastScanner(System.in);

		Set<String> s = new HashSet<>();
		
		int n = sc.nextInt();
		
		for(int i=0;i<n;i++){
			String si = sc.next();
			if(!s.contains(si))	s.add(si);
		}
		
		System.out.println(s.size());
	}
  
}

Measured memory_bytes: 64276
n=gets.to_i
scr=[]
n.times{scr << gets.to_i}

sum=scr.inject(:+)
if sum%10==0
  # scr.sort!
  s=0
  scr.each do |e|
    s=[s, (sum-e)%10==0 ? 0 : sum-e].max
  end
  puts s
else
  puts sum
end


Measured memory_bytes: 3836
from operator import itemgetter
N,M=(int(i) for i in input().split())
data = [[int(i) for i in input().split()] for i in range(M)]

j=0
for i in data:
    i.append(j)
    j=j+1

data.sort(key=itemgetter(1))
data.sort(key=itemgetter(0))

def addzero(n):
    addnum = 6-len(str(n))
    return '0'*addnum+str(n)

pref=0
yearLank=0
for i in data:
    if pref!=i[0]:
        pref=i[0]
        yearLank=1
    i.append(addzero(pref)+addzero(yearLank))
    yearLank = yearLank+1

data.sort(key=itemgetter(2))

for i in data:
    print(i[3])

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

int main()
{
    long long n,k;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++){
            cin>>arr[i];

    }
    sort (arr,arr+n);
    if(k==n)
        cout << 0;
    else {
        long long sum=0;
        for ( int i=(n-1)-k;i>=0;i-- )
            sum+=arr[i];

        cout << sum << endl;
    }
    return 0;
    }




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

int main() {
  int N;
  cin >> N;
  vector<int> l(N);
  vector<int> r(N);
  for (int i=0; i<N; ++i) {
    cin >> l.at(i) >> r.at(i);
  }
  
  // lとrの差を求めて埋まったN組の席数を求める
  vector<int> m(N);
  for (int i=0; i<N; ++i) {
    m.at(i) = r.at(i) - l.at(i) + 1;
  }
  
  // 埋まった席の合計を求める
  int sum = 0;
  for (int i=0; i<N; ++i) {
    sum += m.at(i);
  }
  
  cout << sum << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int main()
{
  int a, b, c;
  cin >> a>> b >> c;
  if(a*c <= b){
    cout << c << endl;
  }else{
    cout << b/a << endl;
  }

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n, m;
    cin >> n >> m;
    vector<ll> x(n), y(n), z(n);
    for(int i = 0; i < n; ++i)  cin >> x[i] >> y[i] >> z[i];
    ll ans = 0;
    for(int bit = 0; bit < (1 << 3); ++bit){
        vector<int> sign(3);
        for(int i = 0; i < 3; ++i)  sign[i] = ((bit >> i) & 1) ? 1 : -1;
        vector<ll> sum(n);
        for(int i = 0; i < n; ++i)  sum[i] = sign[0] * x[i] + sign[1] * y[i] + sign[2] * z[i];
        sort(sum.begin(), sum.end(), greater<ll>());
        ll S = accumulate(sum.begin(), sum.begin() + m, 0ll);
        chmax(ans, S);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
dts = input().split(" ")
d = int(dts[0])
t = int(dts[1])
s = int(dts[2])
cond1 = d >= 1 and d <= 10000
cond2 = t >= 1 and t <= 10000
cond3 = s >= 1 and s <= 10000
temp = 0
if cond1 == True and cond2 == True and cond3 == True:
    temp = t * s
    if temp >= d:
        print("Yes")
    else:
        print("No")
else:
    print()


Measured memory_bytes: 9184
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

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

using namespace std;

namespace Dump {
#define dump(...) Dump::print(#__VA_ARGS__, __VA_ARGS__)
static std::vector<string> dumpKey;
static string dumpKeyBuf;

void print() { cerr << endl; }
template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
  if (dumpKey.empty()) {
    dumpKeyBuf = head;
    dumpKeyBuf.erase(std::remove_if(dumpKeyBuf.begin(), dumpKeyBuf.end(),
                                    [](char c) { return c == ' '; }),
                     dumpKeyBuf.end());

    std::istringstream stream(dumpKeyBuf);
    string field;
    while (std::getline(stream, field, ','))
      dumpKey.push_back(field);

    reverse(dumpKey.begin(), dumpKey.end());
  } else {
    cerr << dumpKey.back() << ":" << head << "  ";
    dumpKey.pop_back();
  }
  Dump::print(std::move(tail)...);
}
}

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<long long> vll;
typedef vector<unsigned long long> vull;
typedef pair<int, int> pii; // p.first p.second

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

void solve(long long X, long long Y, long long Z) {
  ll ans = 0;
  REP(i, X + 1) {
    ll buf = i * Y + (i + 1) * Z;
    if (buf > X)
      break;
    ans = i;
  }

  cout << ans << endl;
}

int main() {
  ios::sync_with_stdio(false);
  long long Y;
  long long Z;
  long long X;
  cin >> X;
  cin >> Y;
  cin >> Z;
  solve(X, Y, Z);
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	
	public static void main(String[] args) {
		try {

			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			String number = reader.readLine();
			int n = Integer.parseInt(number);

			String cards;
			String[] card = new String[2];
			int judge;
			int taro = 0;
			int hanako = 0;
			for (int i = 0; i < n; i++) {
				cards = reader.readLine();
				card = cards.split(" ");
				judge =  card[0].compareTo(card[1]);
				if (judge > 0) {
					taro += 3;
				} else if (judge < 0) {
					hanako += 3;
				} else {
					taro++;
					hanako++;
				}
			}
			System.out.println(taro + " " + hanako);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 25600
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)

int main() {
	ll N; cin >> N;
	set<ll> se;
	rep(i, 0, N) {
		ll d; cin >> d;
		se.insert(d);
	}
	cout << se.size() << endl;

	return 0;
}

Measured memory_bytes: 256
a,b=gets.split.map &:to_i
M=1250
i=0
ar=[]
br=[]
while i<M
  as=(i*0.08).floor
  bs=(i*0.1).floor
  ar << i if (as == a)
  br << i if (bs == b)
  i+=1
end
rs = ar & br
puts rs.empty? ? '-1' : rs.min

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

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        int q = Integer.parseInt(sc.next());
        int[] a = new int[q];
        int[] score = new int[n];
        for (int i = 0; i < q; i++) {
            a[i] = Integer.parseInt(sc.next());
            score[a[i] - 1]++;
        }

        // 主処理
        String[] result = new String[n];
        int sum = Arrays.stream(score).sum();
        for (int i = 0; i < n; i++) {
            result[i] = k <= sum - score[i] ? "No" : "Yes";
        }

        // 出力
        System.out.println(String.join("\r\n", result));
        sc.close();
    }
}

Measured memory_bytes: 51284
def main():
    N = int(input())
    *a, = map(int, input().split())

    *b, = sorted(a)

    h = N // 2
    L = b[h - 1]
    R = b[h]

    for x in a:
        if x <= L:
            print(R)
        else:
            print(L)


if __name__ == '__main__':
    main()


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  int64_t n, m, d; cin >> n >> m >> d;
  if (d == 0) {
    printf("%.10f\n", double(m - 1) / n);
  } else {
    printf("%.10f\n", 2.0 * (n - d) / n / n * (m - 1));
  }
}


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

using namespace std;


int main(){
	char buf1[101],buf2[101];
	bool overflowFLG;
	int n,length1,length2,kuriagari,tmp,output[101];
	scanf("%d",&n);

	for(int loop=0;loop<n;loop++){
		length1 = length2 = 0;
		scanf("%s",buf1);
		scanf("%s",buf2);
		for(int i=0; buf1[i] !='\0';i++)length1++;
		for(int i=0; buf2[i] !='\0';i++)length2++;

		if(length1 >=81 || length2 >= 81)printf("overflow\n");
		else{
			overflowFLG=false;
			kuriagari=0;
			if(length1>length2){
				for(int k=0;length1-1-k>=0;k++){
					tmp = kuriagari;
					if(length2-1-k>=0){
						tmp += (buf1[length1-1-k]-'0')+(buf2[length2-1-k]-'0');
						if(tmp>=10){
							tmp %= 10;
							kuriagari = 1;
							if(k==79)overflowFLG=true;
						}else{
							kuriagari = 0;
						}
						output[length1-1-k] = tmp;
					}else{
						if(kuriagari == 0){
							output[length1-1-k] = buf1[length1-1-k]-'0';
						}else{
							output[length1-1-k] = buf1[length1-1-k]-'0' + kuriagari;
							if(output[length1-1-k]>=10){
								output[length1-1-k] %= 10;
								kuriagari = 1;
								if(k==79)overflowFLG=true;
							}else{
								kuriagari = 0;
							}
						}
					}
				}
				if(overflowFLG){
					printf("overflow\n");
				}else{
					if(kuriagari == 1)printf("1");
					for(int k=0;k<=length1-1;k++){
						printf("%d",output[k]);
					}
					printf("\n");
				}
			}else{
				for(int k=0;length2-1-k>=0;k++){
					tmp = kuriagari;
					if(length1-1-k>=0){
						tmp += (buf2[length2-1-k]-'0')+(buf1[length1-1-k]-'0');
						if(tmp>=10){
							tmp %= 10;
							kuriagari = 1;
							if(k==79)overflowFLG=true;

						}else{
							kuriagari = 0;
						}
						output[length2-1-k] = tmp;
					}else{
						if(kuriagari == 0){
							output[length2-1-k] = buf2[length2-1-k]-'0';
						}else{
							output[length2-1-k] = buf2[length2-1-k]-'0' + kuriagari;
							if(output[length2-1-k]>=10){
								output[length2-1-k] %= 10;
								kuriagari = 1;
								if(k==79)overflowFLG=true;
							}else{
								kuriagari = 0;
							}
						}
					}
				}
				if(overflowFLG){
					printf("overflow\n");
				}else{
					if(kuriagari == 1)printf("1");
					for(int k=0;k<=length2-1;k++){
						printf("%d",output[k]);
					}
					printf("\n");
				}
			}
		}
	}

    return 0;
}

Measured memory_bytes: 2672
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

int lcm(int a,int b){
  if(a==0||b==0)return 1;
  if(a<b) swap(a,b);
  while(a%b!=0){
    a%=b;
    swap(a,b);
  }
  return b;
}

int main(){ _;
  string s;
  while(cin>>s,s[0]!='#'){
    int a,b=1,i=s.size()-1;
    if(s[i]=='t'){a=1;i-=4;}
    else{a=0;i-=5;}
    while(i>=0){
      if(s[i]=='t'){a=a*2+1;b*=2;i-=4;}
      else if(s[i]=='h'){a=a*2-1;b*=2;i-=5;}
    }
    a*=90;
    int l=lcm(a,b);
    if(b==l)cout<<a/b<<endl;
    else cout<<a/l<<"/"<<b/l<<endl;
  }
}

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

using namespace std;

int main(){


    string s1, s2;
    cin >> s1 >> s2;

    sort(s1.begin(), s1.end());
    sort(s2.begin(), s2.end());
    reverse(s2.begin(), s2.end());

    if (s1 < s2){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    // cout << s1 << " " << s2 << endl;


    return 0;
}

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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Int32.Parse(Console.ReadLine());
            var list = new List<string>();
            for (int i = 0; i < n; i++)
            {
                list.Add(Console.ReadLine());
            }
            Console.WriteLine(list.Distinct().Count());
        }
    }
}


Measured memory_bytes: 28344
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <climits>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);

//const ll INFL = LLONG_MAX;//10^18 = 2^60
const ll INFL = 1LL<<60;
//const int INF = INT_MAX;
const ll INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;
double EPS = 1e-10;

vector<ll> dy = {0, 1, 0, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, 0, -1, 0, 1, -1, 1, -1, 0};

void pres(double A, ll x = 30){cout << fixed << setprecision(x) << A << endl;}
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}
ll cnt_bit(ll x){return __builtin_popcountll(x);}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x; k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

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

//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

const int MAXkai = 200010;
ll kai_memo[MAXkai];
ll kai(ll N){
  if(kai_memo[N] != 0) return kai_memo[N];
  if(N <= 1) return 1;
  return kai_memo[N] = N * kai(N-1) % MOD;
}



void solve(){
  ll H, W, N;
  cin >> H >> W >> N;
  if(H > W) swap(H, W);
  cout << (N + W - 1) / W << endl;
}

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


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

using i16 = std::int16_t;
using i32 = std::int32_t;
using i64 = std::int64_t;
using usize = std::size_t;
using namespace std;

#define rep(i, max) for(usize i = 0; i < max; ++i)
#define loop while(true)
#define allOf(collection) collection.begin(), collection.end()

unique_ptr<string> readLine() { unique_ptr<string> line(new string()); getline(cin, *line); return line; }
template<typename T1, typename T2> pair<T1, T2> readPair() { T1 res1; cin >> res1; T2 res2; cin >> res2; readLine(); return make_pair(res1, res2);}
template<typename T> unique_ptr<vector<T>> readVector(usize num) { unique_ptr<vector<T>> list(new vector<T>(num)); rep(i, num) cin >> (*list)[i]; readLine(); return list; }
void readValues() { readLine(); }
template<typename H, typename... T> void readValues(H& head, T&&... tails){ H a; cin >> a; head = a; readValues(forward<T>(tails)...); }
void writeLine() { cout << endl; }
template<typename T> void write(const T& arg) { cout << arg; }
template<typename T> void writeLine(const vector<T>& arg){ if(arg.empty()) { writeLine(); return; } write(arg[0]); for(int i = 1; i < arg.size(); ++i){ write(" "); write(arg[i]); } writeLine(); }
template<typename T> void writeLine(const T& arg) { cout << arg << endl; }
void recursiveCombination(vector<i32>& indexes, i32 s, i32 rest, function<void(vector<i32>&)> f) { if (rest == 0) { f(indexes); } else { if (s < 0) return; recursiveCombination(indexes, s - 1, rest, f); indexes[rest - 1] = s; recursiveCombination(indexes, s - 1, rest - 1, f); } }
void foreachWithCombination(i32 n, i32 k, function<void(vector<i32>&)> f) { auto indexes = vector<i32>(k); recursiveCombination(indexes, n - 1, k, f); }
void foreachWithPermutaton(i32 n, function<void(vector<i32>&)> f) { auto indexes = vector<i32>(); indexes.reserve(n); rep(i, n) indexes.push_back(i); do f(indexes); while (next_permutation(allOf(indexes))); }
void foreachWithPermutaton(i32 n, i32 k, function<void(vector<i32>&)> f){ foreachWithCombination(n, k, [=](vector<i32>& combIndexes){ foreachWithPermutaton(k, [=](vector<i32>& permIndexes){ auto indexes = vector<i32>(); indexes.reserve(k); rep(i, k){ indexes.push_back(combIndexes[permIndexes[i]]); } f(indexes); }); }); }
void program();
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    program();
}

struct UnionFind
{

    vector<i32> list;

    UnionFind(i32 size){
        list = vector<i32>(size, -1);
    }

    i32 root(i32 x){
        if(list[x] < 0) return x;
        else return root(list[x]);
    }

    void unite(i32 x, i32 y){
        i32 xRoot = root(x);
        i32 yRoot = root(y);
        if(xRoot == yRoot) return;
        if(list[xRoot] > list[yRoot]) swap(xRoot, yRoot);
        list[xRoot] += list[yRoot];
        list[yRoot] = xRoot;
    }

    i32 sizeAt(i32 n){
        return max(0, -list[n]);
    }
};

int n; int m;

void program() {
    readValues(n, m);
    UnionFind uf = UnionFind(n);
    rep(i, m){
        auto info = readPair<i32, i32>();
        uf.unite(info.first - 1, info.second - 1);
    }
    i32 maxi = 0;
    rep(i, n){
        maxi = max(maxi, uf.sizeAt(i));
    }
    writeLine(maxi);
}

Measured memory_bytes: 4000
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi, factorial
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

MOD = 10**9+7

class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    __radd__ = __add__

    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )

    __rmul__ = __mul__

    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )

    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )

def main():
    N,K = map(int, input().split())
    aa = list(map(int, input().split()))
    ans = ModInt(0)

    # inside aa
    tmp = 0
    for i in range(N):
        for j in range(i,N):
            if i == j:
                continue
            if aa[i]>aa[j]:
                tmp += 1
    ans += tmp * K

    # between two aa
    tmp = 0
    for i in range(N):
        for j in range(N):
            if aa[i]>aa[j]:
                tmp += 1
    ans += tmp * (K*(K-1)//2)
    print(ans)

if __name__ == '__main__':
    main()

   

Measured memory_bytes: 5304
K, N = map(int, input().split())
A = list(map(int, input().split()))
tot_sum = 0
curr_max = 0
i = 0
while i < N - 1:
    temp = A[i + 1] - A[i]
    tot_sum += temp
    curr_max = max(curr_max, temp)
    i += 1

curr_max = max(curr_max, (K - A[i]) + A[0])
tot_sum += (K - A[i]) + A[0]

print(tot_sum - curr_max)

Measured memory_bytes: 26444
local A, B, C, K = io.read("*n", "*n", "*n" , "*n")

for i = 1, K do
	if C <= B then
		C = C * 2
	elseif B <= A then
		B = B * 2
	else
		break
	end
end

local out = "Yes"
if C <= B or B <= A then
	out = "No"
end

print(out)


Measured memory_bytes: 2696
#include <bits/stdc++.h>
#define maxk 100001
#define maxn 101
using namespace std;
typedef long long ll;

int main()
{
    int N, K;
    cin >> N >> K;
    int a[N];
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    bool dp[K + 1];
    for(int i = 0;i <= K;i++){
        dp[i] = false;
    }
    for (int i = 1; i <= K; i++)
    {
        for (int j = 0; j < N; j++)
        {
            if (i >= a[j])
            {
                dp[i] |= !dp[i - a[j]];
            }
        }
    }
    cout << (dp[K] ? "First" : "Second") << endl;
}


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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	for (int i=1; i<=9; i++)
		for (int j=1; j<=9; j++)
			if(i*j==n) {
				cout<<"Yes\n";
				return 0;
			}
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
from fractions import gcd


def main():

    N = int(input())
    A = list(map(int, input().split()))
    MOD = 10**9 + 7

    lcm = 1
    for a in A:
        lcm = lcm * a // gcd(lcm, a)


    ans = 0
    for a in A:
        ans += lcm // a

    print(ans % MOD)    

if __name__ == "__main__":
    main()

Measured memory_bytes: 6112
n,k = map(int,input().split())
s = input()

if s[0] == '1':
    length_01 = [0]
else:
    length_01 = [0,0]

for i in range(n-1):
    if s[i] != s[i+1]:
        length_01.append(i+1)

if s[n-1] == '1':
    length_01.append(n)
else:
    length_01.append(n)
    length_01.append(n)

num_0 = int(len(length_01)/2)
if num_0 - k >= 1:
    answer = 0
    for i in range(num_0 - k):
        if answer < length_01[2*(i+k)+1] - length_01[2*i]:
            answer = length_01[2*(i+k)+1] - length_01[2*i]
else:
    answer = n

print(answer)


Measured memory_bytes: 7156
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
	public static void main(String[] args) throws IOException {		
		InputStreamReader reader = new InputStreamReader(System.in);
		
		int key,i,a[];
		a=new int[100];
		key='.';
	key=reader.read();
	
		while(true){
			i=0;
			a[i]=0;
			
			if(key=='.')
				break;
			while(true){
				if(key=='['||key=='('){
					i++;
					a[i]=key;
				}
				else if(key==']'){
					if(a[i]!='['){
						while(key!='.'){
							key=reader.read();
						
						}
						System.out.println("no");
						break;
					}
					i--;
				}
				else if(key==')'){
					if(a[i]!='('){
						while(key!='.'){
							key=reader.read();
					
						}
						System.out.println("no");
						break;
					}
					i--;
				}
				key=reader.read();
		
				if(key=='.'){
					if(i==0){
						System.out.println("yes");
						break;
					}
					else{
						System.out.println("no");
						break;
					}
				}
			}
			while(key!='\n'){
			key=reader.read();
		
			}
		key=reader.read();
		
		} 
	} 
}

Measured memory_bytes: 11000
N = int(input())
c = []
ans = 1

import collections
ans = 1
all_ans = 0
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

for i in range(1, N):
  ans = 1
  c = collections.Counter(prime_factorize(N-i))
  for i in c.values():
    ans *= (i+1)
  all_ans += ans

print(all_ans)

Measured memory_bytes: 70396
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  char S;
  cin >> N;
  bool arare = false;
  for(int i = 0; i < N; i++){
    cin >> S;
      if(S == 'Y'){
    arare = true;
 }
}
   if(arare){
     cout << "Four" << endl;
   }
    else{
      cout << "Three" << endl;
    }
  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
	std::vector<int> v;
	for (int i = 0; i < 3; ++i)
	{
		int a; cin >> a;
		v.push_back(a);
	}

	sort(v.begin(),v.end());

	cout << v[0] + v[1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200005;
int n,k,a[N],cnt[N],b[N];
int main(){
	//freopen("aa.in","r",stdin);
	int i,j;
	scanf("%d%d",&n,&k);
	for(i=1;i<=n;++i){
		scanf("%d",&a[i]);
		cnt[a[i]]++;
	}
	int t=1,tot=0;
	for(i=1;i<=n;++i){
		if(cnt[i])++tot;
		if(cnt[i]>cnt[t])t=i;
	}
	if(tot<=k)return puts("0"),0;
	for(j=0,i=1;i<=n;++i)if(i!=t&&cnt[i]){
		b[++j]=cnt[i];
	}
	sort(b+1,b+1+j);
	int tmp=tot-k;
	int ans=0;
	for(i=1;i<=j;++i){
		--tmp;
		ans+=b[i];
		if(!tmp)break;
	}
	printf("%d",ans);
	return 0;
} 

Measured memory_bytes: 2560
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int64_t N;
  cin >> N;
  
  vector<int> nums(N);
  vector<int> sorted(N);
  for (int n = 0; n < N; ++n) {
    cin >> nums[n];
    sorted[n] = nums[n];
  }
  sort(sorted.begin(), sorted.end());
  int64_t mid1 = sorted[N/2-1];
  int64_t mid2 = sorted[N/2];
  
  for (int64_t n : nums) {
    if (n <= mid1) {
      cout << mid2 << endl;
    } else {
      cout << mid1 << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 4792
# coding: utf-8

# https://atcoder.jp/contests/abc095/tasks/arc096_a
# 16:32-16:44


def main():
    a, b, c, x, y = map(int, input().split())

    if y > x:
        a, b, x, y = b, a, y, x
    # aの方が枚数（x)多い

    ans = 0
    if a+b > 2*c:
        ans += 2*c*y

        if a > 2*c:
            ans += 2*c*(x-y)
        else:
            ans += a*(x-y)
    else:
        ans += a*x + b*y

    return ans


print(main())


Measured memory_bytes: 3060
#include <stdio.h>
 
int main(){
  int H,W,i,j;
  while(1){
    scanf("%d %d",&H,&W);
    if(H==0&&W==0){
      break;
    }
    for(i=0; i<H; i++){
      for(j=0; j<W; j++){
        if((i%2==0&&j%2==0)||(i%2==1&&j%2==1))
        printf("#");
        else printf(".");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}


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

int main() {
    const int MAX = 1000001;
    bool isPrime[MAX];
    fill_n(isPrime, MAX, true);
    isPrime[0] = false;
    isPrime[1] = false;
    for (int i = 4; i < MAX; i += 2) {
        isPrime[i] = false;
    }
    for (int i = 3; i * i <= MAX; i += 2) {
        if (isPrime[i]) {
            for (int j = i * 2; j < MAX; j += i) {
                isPrime[j] = false;
            }
        }
    }
    while (true) {
        int a, b;
        cin >> a >> b;
        if ((a | b) == 0) {
            break;
        }
        int sum[2] = {}, max[2] = {};
        if (a % 2 == 0) {
            sum[0] = max[0] = 2;
        }
        for (int i = 3; i <= a; i += 2) {
            if (a % i == 0 && isPrime[i]) {
                sum[0] += i;
                max[0] = i;
            }
        }
        if (b % 2 == 0) {
            sum[1] = max[1] = 2;
        }
        for (int i = 3; i <= b; i += 2) {
            if (b % i == 0 && isPrime[i]) {
                sum[1] += i;
                max[1] = i;
            }
        }
        int key[2] = {max[0] * 2 - sum[0], max[1] * 2 - sum[1]};
        if (key[0] > key[1]) {
            cout << "a" << endl;
        } else {
            cout << "b" << endl;
        }
    }
}

Measured memory_bytes: 1828
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

using namespace std;

bool sosu(int n)
{
    if (n == 1){
        return false;
    }
    else if (n == 2){
        return true;
    }
    else if (n == 3){
        return true;
    }
    else if (n%6 == 0 || n%6 == 2 || n%6 == 3 || n%6 == 4){
        return false;
    }
    else {
        for (int i = 2;i <= sqrt(n);i++){
            if (n%i == 0){
                return false;
            }
        }
        return true;
    }
}

int main()
{
    int N,K,R,S,P;
    char T[100005];
    cin >> N >> K;
    cin >> R >> S >> P;
    cin >> T;
    char hand[100005] = {0};
    int c = 0;
    
    for (int i = 0;i < K;i++){
        if (T[i] == 'p'){
            hand[i] = 's';
            c += S;
        }
        if (T[i] == 'r'){
            hand[i] = 'p';
            c += P;
        }
        if (T[i] == 's'){
            hand[i] = 'r';
            c += R;
        }
    }
    for (int i = K;i < N;i++){
        if (T[i] == 'p'){
            if (hand[i-K] != 's'){
                hand[i] = 's';
                c += S;
            }
            else if (T[i+K] == 's' || i+K >= N){
                hand[i] = 'p';
            }
            else {
                hand[i] = 'r';
            }
        }
        if (T[i] == 'r'){
            if (hand[i-K] != 'p'){
                hand[i] = 'p';
                c += P;
            }
            else if (T[i+K] == 'p' || i+K >= N){
                hand[i] = 'r';
            }
            else {
                hand[i] = 'q';
            }
        }
        if (T[i] == 's'){
            if (hand[i-K] != 'r'){
                hand[i] = 'r';
                c += R;
            }
            else if (T[i+K] == 'r' || i+K >= N){
                hand[i] = 's';
            }
            else {
                hand[i] = 'p';
            }
        }
    }
    cout << c << endl;
    
}


Measured memory_bytes: 384
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

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

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}
struct uf{
  static const int MAXN=200005;
  int par[MAXN];
  int size[MAXN];
  void init(){
    memset(par,-1,sizeof(par));
    REP(i,MAXN) size[i]=1;
  }
  int root(int a){
    if(par[a]==-1) return a;
    return par[a]=root(par[a]);
  }
  void unite(int a,int b){
    a=root(a);b=root(b);
    if(a==b) return;
    if(size[a]<size[b]) swap(a,b);

    par[b]=a;
    size[a]+=size[b];
  }
  bool same(int a,int b){
    return root(a)==root(b);
  }
};

uf u;
//const int INF=5e8;
int n;
pi ar[200005];

bool enable[200005];
int main(){
  u.init();
  cin>>n;
  REP(i,n){
    int a;scanf("%d",&a);
    ar[i]=mp(a,i);
  }
  sort(ar,ar+n,greater<pi>());
  lint res=0;
  REP(i,n){
    int p=ar[i].sc,val=ar[i].fr;
    enable[p]=1;
    int lch=0,rch=0;
    if(p>0 && enable[p-1]){
      lch=u.size[u.root(p-1)];
      u.unite(p,p-1);
    }
    if(p+1<n && enable[p+1]){
      rch=u.size[u.root(p+1)];
      u.unite(p,p+1);
    }
    res+=val*(lint)(lch+1)*(rch+1);
  }
  cout<<res<<endl;


  return 0;
}



Measured memory_bytes: 3584
<?php
$n = trim(fgets(STDIN));

$sum = 0;
for ($i = 0; $i < strlen($n); $i++) {
    $sum += (int)$n[$i];
}

if ((int)$n % $sum === 0) {
    echo 'Yes' . PHP_EOL;
} else {
    echo 'No' . PHP_EOL;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
int a, b;
  cin >> a >> b;
  int ans = max(a - 2 * b, 0);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define p (int)(1e9 + 7)

int MOD(int a){
	a %= p;
	return a >= 0 ? a : a + p;
}

signed main(){
	int H, W, K, i;
	scanf("%lld%lld%lld", &H, &W, &K);
	int *fact = (int *)malloc(sizeof(int) * (H + W + 1));
	fact[0] = 1;
	for(i = 1; i <= H + W; i++){
		fact[i] = MOD(fact[i - 1] * i);
	}
	int *inverse = (int *)malloc(sizeof(int) * (H + W + 1));
	inverse[0] = -1;
	inverse[1] = 1;
	for(i = 2; i <= H + W; i++){
		inverse[i] = MOD(-(p / i) * inverse[p % i]);
	}
	int *fact_inv = (int *)malloc(sizeof(int) * (H + W + 1));
	fact_inv[0] = 1;
	for(i = 1; i <= H + W; i++){
		fact_inv[i] = MOD(fact_inv[i - 1] * inverse[i]);
	}
	int ans = K, C = MOD(inverse[H + W] * MOD(inverse[H + W - 1] * MOD(H * W)));
	for(i = 1; i <= K; i++){
		ans = MOD(ans + 2 * MOD(C * MOD((i - 1) * (K - i + 1))) + (K - i + 1));
	}
	printf("%lld\n", MOD(ans * MOD(fact[H + W] * fact_inv[H + W - K])));
	return 0;
}

Measured memory_bytes: 468864
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstring>
using namespace std;

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

const int MAXL = 6, MAXI = 20;
int a[MAXI + 1];

int main()
{
    int l;
    while(cin >> a[0] >> l && l)
    {
        int ansj = 0, ansi = 0;
        for(int i = 1; i < 25; i++)
        {
            int tmp = a[i - 1];
            vector<int> dig;
            rep(j, l){ dig.push_back(tmp % 10); tmp /= 10;}   
            sort(all(dig)); //rep(j,l) cout << dig[j] ; cout << endl;
            int maxa = 0, mina = 0;
            rep(j, l)
            {
                mina *= 10; mina += dig[j];
                maxa *= 10; maxa += dig[l - j - 1];
            }
            a[i] = maxa - mina;
            rep(j,i)if(a[i] == a[j]){ ansi = i; ansj = j; break;}
            if(ansi > 0) break;
        }
        cout << ansj << " " << a[ansi]<<" " << ansi - ansj << endl;
    }

    return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  string s;
  cin >> s;
  int q;
  cin >> q;
  int count = 0;
  
  deque<char> dq;
  rep(i, s.length()){
    dq.push_back(s[i]);
  }

  rep(i, q){
    int t;
    cin >> t;
    if(t == 1){
      count++;
    } else {

      int f;
      char c;
      cin >> f >> c;
      if((count + f) % 2){
        dq.push_front(c);
      } else {
        dq.push_back(c);
      }
    }
  }
  if(count % 2) reverse(dq.begin(), dq.end());
  rep(i, dq.size()) cout << dq[i];
  cout << endl;
}

Measured memory_bytes: 1024
N=int(input())
D=[]
count=1
for i in range(N):
  D.append(int(input()))
x=max(D)  
D.sort()
for i in range(N):
  if D[i]==x:
    break
  elif D[i]==D[i+1]:
    continue
  elif D[i]<D[i+1]:
    count+=1
print(count)

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

const int N = 100005;

int n;
long long W;
long long f[2][N];

int main() {
	scanf("%d %lld", &n, &W);
	memset(f, 123, sizeof f);
	f[0][0] = 0;
	for (int i = 1; i <= n; ++i) {
		long long u; int v;
		scanf("%lld %d", &u, &v);
		for (int j = 0; j < N; ++j) {
			f[1][j] = min(f[1][j], f[0][j]);
			if (j + v < N) {
				f[1][j + v] = min(f[1][j + v], f[0][j] + u);
			}
		}
		for (int j = 0; j < N; ++j) {
			f[0][j] = f[1][j];
			f[1][j] = 1e18;
		}
	}
	for (int i = N - 1; i >= 0; --i) if (f[0][i] <= W) {
		printf("%d\n", i); return 0;
	}
}

Measured memory_bytes: 1792
#include <cstdio>

bool dp[100001];

int main()
{
  int x;
  scanf("%d", &x);
  dp[0] = true;
  for (int i = 100; i <= x; ++i)
  {
    for (int j = 100; j <= 105; ++j)
    {
      if (i - j >= 0)
      {
        dp[i] |= dp[i - j];
      }
    }
  }
  printf("%d\n", dp[x] ? 1 : 0);
  return 0;
}

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

int main(){
    int N,T,A;
    cin>>N>>T>>A;
    int k[1000] = {0}; 
    int res = 100000000;
    int x = 0;
    for(int i = 1;i <= N;i++){
        cin>>k[i];
        
        k[i] = (T*1000 - k[i]*6);
        int tmp = 0;
        tmp = abs(k[i] - 1000*A);
        if(res > tmp){
        res = tmp;
        x = i;
        }
        
        }
        cout<<x<<endl;
    
    return 0;
}

Measured memory_bytes: 256
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
ll n,m;
ll dp[2010][2010];

const ll MOD = 1e9+7;

int main(){
    ll s[2010],t[2010];
    std::cin >> n>>m;
    for (int i = 0; i < n; i++) {
        std::cin >> s[i];
    }
    for (int i = 0; i < m; i++) {
        std::cin >> t[i];
    }
    
    Fill(dp,0);
    
    ll sum[2010][2010];
    
    for (int i = 0; i < n+10; i++) {
        sum[i][0] = 1;
    }
    
    for (int i = 0; i < m+10; i++) {
        sum[0][i] = 1;
    }
	
  	ll result = 1;
    
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if(s[i-1] == t[j-1]){
                dp[i][j] = sum[i-1][j-1];
              	result += dp[i][j];
             	result %= MOD;
            }
            sum[i][j] = sum[i][j-1] + sum[i-1][j]+MOD - sum[i-1][j-1] + dp[i][j];
          	sum[i][j] %= MOD;
        }
    }
    

    std::cout << result%MOD << std::endl;
}


Measured memory_bytes: 63360
#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;

int main() {
	int N, M;
	int ans = 0;
	map<string, int> m;

	cin >> N;
	
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;
		m[s]++;
	}

	cin >> M;

	for (int i = 0; i < M; i++) {
		string s;
		cin >> s;
		m[s]--;
	}

	for (map<string, int>::iterator it = m.begin(); it != m.end(); it++) {
		if (it->second >= ans)ans = it->second;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
const long long MOD = 1000000007;

typedef long long ll;

int main(void) {
  int n;
  ll a[200010];
  cin >> n;
  rep(i, n) cin >> a[i];

  ll sum[200010];
  sum[0] = 0;
  rep(i, n) sum[i + 1] = sum[i] + a[i];

  sort(sum, sum + (n + 1));
  //rep(i, n + 1) cout << sum[i] << endl;

  ll k = 0, ans = 0;
  while (k < n +1) {
    ll key = k;
    while (k < n + 1 && sum[key] == sum[k]) k++;
    ans += (k - key) * (k - key - 1) / 2;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main () {
	const double PI = 3.141592653589793238462643;
	cout << setprecision(11);
	double a, b, x;
	cin >> a >> b >> x;
	if (2*x <= a*a*b) cout << 90-atan(2*x/(a*b*b))*180/PI;
	else cout << atan(2*(a*a*b-x)/(a*a*a))*180/PI;
}


Measured memory_bytes: 256
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws FileNotFoundException {

//    	File file = new File("src/in.txt");
//    	Scanner sc = new Scanner(file);

    	Scanner sc = new Scanner(System.in);

    	int X = sc.nextInt();
    	int Y = sc.nextInt();
    	long p = 1000000007;

    	int a = 2*X-Y;
    	int b = 2*Y-X;

    	if(a<0||(a%3!=0)||b<0||(b%3!=0)) {
    		System.out.println("0");
    	} else {
    		a /= 3;
    		b /= 3;
    		if(a<b) {
    			int tmp = a;
    			a = b;
    			b = tmp;
    		}
    		long times = 1;
    		for(int i = b+1;i<=a+b;i++) {
    			times *= i;
    			times = times %p;

    		}
    		long fracA = 1;
    		for(int i=1;i<=a;i++) {
    			fracA *= i;
    			fracA = fracA%p;
    		}
    		long times2 = modPow(fracA,p-2,p);
    		if(times*times2<p) {
    			System.out.println(times*times2);
    		} else {
    			System.out.println((times*times2)%p);
    		}
    	}
    }
    public static final long modPow(long x, long n, final long mod) {
        long sum = 1;
        while (n > 0) {
            if ((n & 1) == 1) {      //ビットが立っていたら
                sum = sum * x % mod; //x^2^k1 * x^2^k2 * x^2^k3 * ・・・
            }
            x = x * x % mod;         //((x^2)^2)^2 ・・・
            n >>= 1;
        }
        return sum;
    }

}


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

using namespace std;

int main()
{
    int N; cin >> N;
    vector<long long> A(N), B(N), C(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) cin >> C[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    vector<long long> BC(N + 1, 0);
    for(int i=N-1; i>=0; --i)
    {
        auto itr = upper_bound(C.begin(), C.end(), B[i]);
        BC[i] = BC[i+1] + (C.end() - itr);
    }

    long long ans = 0;
    for(int i=0; i<N; ++i)
    {
        auto itr = upper_bound(B.begin(), B.end(), A[i]);
        
        if(itr != B.end()) ans += BC[itr - B.begin()];
    }

    cout << ans << endl;
}

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

int main() {
  int n;
  cin>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++) cin>>a[i];
  sort(a.begin(),a.end());
  string ans="YES";
  for(int i=0;i<n-1;i++){
    if(a[i]==a[i+1]){
      ans="NO";
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main {
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	String t = sc.next();
    int a = sc.nextInt();
    int b = sc.nextInt();
	String u = sc.next();

    if (s.equals(u)) {
      a--;
    }else{
      b--;
    }
	System.out.println(a + " " + b);
  }
}





Measured memory_bytes: 22868
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::ios;

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

    int min, max;
    int a, b;
    cin >> a >> b;
    if (a > b) {
        max = a, min = b;
    } else {
        max = b, min = a;
    }

    for (long i = min; i < max; i++) {
        if (abs(a - i) == abs(b - i)) {
            cout << i << endl;
            return 0;
        }
    }

    cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<time.h>
#include<ctime>
#include<functional>
#define int long long
#define itn int
#define f(n) for(int i=0;i<(n);i++)
using namespace std;
typedef pair<int, int> P;
signed main() {
	int a, b;
	cin >> a >> b;
	if ((a*b) % 2) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256