akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws Exception {
    	Scanner sc = new Scanner(System.in);   		
    	int N = sc.nextInt();
    	int min = 200;
    	int max = 0;
    	int[] arr = new int[N];
    	for(int i=0;i<N;i++) {
    		int x= sc.nextInt();
    		arr[i]=x;
    		if(x >max)
    			max=x;
    		if(x <min)
    			min = x;
    	}
    	long minStamina =1000000000;
    	for(int j=min;j<=max;j++) {
    		int stamina=0;
    		for(int k=0;k<arr.length;k++) {
    			stamina += Math.pow((arr[k]-j),2);
    		}
    		if (stamina < minStamina) {
    			minStamina = stamina;
    		}
    	}
    	System.out.println(minStamina);
    	
    		}
    }

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

class Scanner 
{
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

	public String next() throws IOException 
	{
		while (st == null || !st.hasMoreTokens()) 
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public int nextInt() throws IOException {return Integer.parseInt(next());}
	
	public long nextLong() throws IOException {return Long.parseLong(next());}

	public String nextLine() throws IOException {return br.readLine();}
	
	public double nextDouble() throws IOException
	{
		String x = next();
		StringBuilder sb = new StringBuilder("0");
		double res = 0, f = 1;
		boolean dec = false, neg = false;
		int start = 0;
		if(x.charAt(0) == '-')
		{
			neg = true;
			start++;
		}
		for(int i = start; i < x.length(); i++)
			if(x.charAt(i) == '.')
			{
				res = Long.parseLong(sb.toString());
				sb = new StringBuilder("0");
				dec = true;
			}
			else
			{
				sb.append(x.charAt(i));
				if(dec)
					f *= 10;
			}
		res += Long.parseLong(sb.toString()) / f;
		return res * (neg?-1:1);
	}
	
	public boolean ready() throws IOException {return br.ready();}
}


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


int main()
{
    int A,B,K;
    cin >> A >> B >> K;
    int count=0;
    int ans;
    for(int i=min(A,B); ; i--)
    {
        if((A%i==0)&&(B%i==0))
        {
            count++;
        }
        if(count==K)
        {
            ans=i;
            break;
        }
    }
    cout << ans << endl;
}


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

int main(void){
    string s, t;
    cin >> s >> t;
    int mn = 1001;
    rep(i, s.size() - t.size() + 1){
        int cnt = 0;
        rep(j, t.size()){
            if(s[i + j] != t[j]) ++cnt;
        }
        mn = min(mn, cnt);
    }
    cout << mn << endl;
    return 0;
}

Measured memory_bytes: 3624
n,m = gets.strip.split.map(&:to_i)
#約数列挙
require 'prime'
def _divisors(primes, k)
  Enumerator.new do |y|
    if primes.size == k
      y << 1
    else
      p, e = primes[k]
      _divisors(primes, k + 1).each {|d|
        (e + 1).times {|e1|
          y << p ** e1 * d
        }
      }
    end
  end
end
def divisors(n)
  _divisors(Prime.prime_division(n), 0).to_a.sort
end
ary = divisors(m)
k = 0
for i in 0..ary.size-1
  if ary[i] <= m.to_f/n
    k += 1
  end
end
puts ary[k-1]

Measured memory_bytes: 14296
#include <cstdio>
#define sign(x) ((x)<0 ? -1 : (x)>0 ? 1 : 0)
int main()
{
	const char *str[] = {"Negative", "Zero", "Positive"};
	int A, B, s;
	scanf("%d%d", &A, &B);
	s = sign(A) * sign(B);
	if(s < 0) s = 0;
	if(s && sign(A)==-1 && ((B-A+1)&1)) s = -1;
	puts(str[s+1]);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
/*
#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
void reader(int *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}
template <class T, class S> void reader(T *x, S *y){reader(x);reader(y);}
void writer(int x, char c){int s=0,m=0;char f[10];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);}
template<class T> void writerLn(T x){writer(x,'\n');}
*/
 
#define incID(i, l, r) for(int i = (l); i < (r); i++)
#define inc(i, n) incID(i, 0, n)
template<typename T> bool setmin(T &a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T &a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
 
 
// ---- ----
 
int n, k;
vector<int> vec[100000];
bool has[100000];
int mi[100000];
int ma[100000];
 
void prod(int x, int y) {
	if(has[y]) {
		bool flag = true;
		if(has[x] && (mi[x] - mi[y]) % 2 == 0) { flag = false; }
		setmax(mi[x], mi[y] - 1);
		setmin(ma[x], ma[y] + 1);
		has[x] = true;
		if(mi[x] > ma[x]) { flag = false; }
		if(! flag) {
			cout << "No" << endl;
			exit(0);
		}
	}
}
 
bool dfs(int node, int pre) {
	if(pre != -1) { prod(node, pre); }
	for(auto && e : vec[node]) {
		if(e != pre) {
			dfs(e, node);
			prod(node, e);
		}
	}
}
 
int main() {
	// cin.tie(0);
	// ios::sync_with_stdio(false);
	
	cin >> n;
	inc(i, n - 1) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	fill(mi, mi + n, -1000000);
	fill(ma, ma + n,  2000000);
	cin >> k;
	inc(j, k) {
		int v, p;
		cin >> v >> p;
		v--;
		mi[v] = p;
		ma[v] = p;
		has[v] = true;
	}
	
	dfs(0, -1);
	dfs(0, -1);
	
	cout << "Yes" << endl;
	inc(i, n) { cout << mi[i] << endl; }
	
	return 0;
}

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

int main() {
	long long n = 0, a = 0, b = 0, c = 0, x = 0, y = 0;
	
	
	cin >> n;
	
	if(n == 25){
		cout << "Christmas" << endl;
	}else if(n == 24){
		cout << "Christmas Eve" << endl;
	}else if(n == 23){
		cout << "Christmas Eve Eve" << endl;
	}else if(n == 22){
		cout << "Christmas Eve Eve Eve" << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
a = gets.split.map(&:to_i)

h = {}
a.each do |aa|
    (-1..1).each do |d|
        if h[aa + d].nil?
            h[aa + d] = 1
        else
            h[aa + d] += 1
        end
    end
end

p h.values.max

Measured memory_bytes: 14980
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx2")

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

#include <x86intrin.h>

using namespace std;

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

const ll mod = 1000000007;

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

  int n;
  cin >> n;
  vector<ll> a(n);
  for (auto &x: a) cin >> x;

/*
  if (n % 2 == 0) {
    ll now = 0;
    for (int i = 0; i < n; i += 2) now += a[i];
    ll maximum = now;
    for (int i = n-2; i >= 0; i -= 2) {
      now += (a[i+1] - a[i]);
      if (now > maximum) maximum = now;
    }

    cout << maximum << endl;
  }
  else {
    vector<vector<ll> > dp(n+2, vector<ll>(3, (ll) -1e18));
    dp[0][0] = a[0];
    dp[1][1] = a[1];
    dp[2][2] = a[2];
    for (int i = 0; i < n; i++) {
      if (i+2 < n) dp[i+2][0] = max(dp[i+2][0], dp[i][0] + a[i+2]);
      if (i+2 < n) dp[i+2][1] = max(dp[i+2][1], dp[i][1] + a[i+2]);
      if (i+2 < n) dp[i+2][2] = max(dp[i+2][2], dp[i][2] + a[i+2]);
      if (i+3 < n) dp[i+3][1] = max(dp[i+3][1], dp[i][0] + a[i+3]);
      if (i+3 < n) dp[i+3][2] = max(dp[i+3][2], dp[i][1] + a[i+3]);
      if (i+4 < n) dp[i+4][2] = max(dp[i+4][2], dp[i][0] + a[i+4]);
    }

    cout << max(max(dp[n-3][0], dp[n-2][1]), dp[n-1][2]) << endl;
  }
*/

  vector<ll> even(n/2+16);
  vector<ll> odd(n/2+16);
  for (int i = 0; i < n; i += 2) even[i/2] = a[i];
  for (int i = 1; i < n; i += 2) odd[i/2] = a[i];

  vector<vector<ll> > dp(3, vector<ll>(n/2+16, (ll) -1e18));
  dp[0][0] = even[0];
  for (int i = 0; i < n/2; i++) {
    dp[0][i+1] = dp[0][i] + even[i+1];
  }
  dp[1][0] = odd[0];
  for (int i = 0; i < n/2; i++) {
    dp[1][i+1] = max(dp[0][i], dp[1][i]) + odd[i+1];
  }
  dp[2][0] = even[1];
  for (int i = 0; i < n/2; i++) {
    dp[2][i+1] = max(max(dp[0][i], dp[1][i]), dp[2][i]) + even[i+2];
  }

  ll ans = max(dp[0][n/2-1], dp[1][n/2-1]);
  if (n % 2 == 1) ans = max(ans, dp[2][n/2-1]);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9540
#include<iostream>
using namespace std;
int main() {
  long N;
  cin >> N;
  long a = 1;
  for (long i = 1;i * i <= N;++ i) if (N % i == 0) a = i;
  a = N / a;
  int ans = 1;
  while(a /= 10) ++ ans;
  cout << ans;
}

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

//INSERT ABOVE HERE
Int dp[505][505];

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

  string s;
  cin>>s;
  Int n=s.size();
  if(n%3){
    cout<<"Rabbit"<<newl;
    return 0;
  }

  memset(dp,0,sizeof(dp));
  for(Int i=0;i<=n;i++) dp[i][i]=1;

  for(Int w=3;w<=n;w+=3){
    for(Int l=0;l+w<=n;l++){
      Int r=l+w-1;
      if(s[l]!='m') continue;
      if(s[r]!='w') continue;
      for(Int m=l+1;m<r;m++){
        if(s[m]!='e') continue;
        dp[l][l+w]|=dp[l+1][m] and dp[m+1][r];
      }
    }
  }

  cout<<(dp[0][n]?"Cat":"Rabbit")<<newl;
  return 0;
}



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

#define ll long long
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define vii vector<int,int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define umii unordered_map<int,int>
#define mii map<int,int>
#define pii pair<int,int>
#define rep(i,a,b) for(int i=a ; i<b ; i++)

const long long MOD = 1e9+7;

void solve() {
    string s,t;
    cin >> s >> t;
    int n=s.size(), m=t.size();
    int ans=INT_MAX;
    for(int i=0; i+m<=n; i++) {
        int moves=0, start=i;
        for(int j=0; j<m; j++) {
            if(s[start]!=t[j]) {
                moves++;
            }
            start++;
        }
        // cout << moves << endl;
        ans=min(ans,moves);
    }
    cout << ans;
}

signed main() 
{
    int t=1;
    // cin>>t;
    for(int i=1; i<=t; i++) {
        solve();
    }
}

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

#define ll int

int main(){
  ll i,j,o;
  ll res=0;
  ll k,s;cin>>k>>s;
  for(i=0;i<=k;i++){
    if(i>s)break;
    if(i<s-2*k)continue;
    for(j=i;j<=k;j++){
      if(i+j>s)break;
      if(i+j<s-k)continue;
      for(o=j;o<=k;o++){
        if(i+j+o>s)break;
        if(i+j+o==s){
          if(i==j&&j==o)res++;
          else if(i==j||j==o||o==i)res+=3;
          else res+=6;
        }
      }
    }
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>

const long long mod = 1e9 + 7;
long long cnt[100005], a[100005];

int main(void) {
	int n;
	std::cin >> n;	
	for (int i = 0; i < n; ++i) std::cin >> a[i];

	long long ans = 1;
	for (int i = 0; i < n; ++i) {
		if (a[i] == 0) ans = (ans * (3 - cnt[0])) % mod;
		else ans = (ans * (cnt[a[i]-1] - cnt[a[i]])) % mod;
		cnt[a[i]]++;
	}

	std::cout << ans % mod << '\n';
	return 0;
}


Measured memory_bytes: 5020
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        n: usize,
        a: [usize; 3],
        b: [usize; 3],
    }

    let mut dp = vec![0; n + 5001];
    for i in 0..n {
        for j in 0..3 {
            dp[i + a[j]] = std::cmp::max(dp[i + a[j]], dp[i] + (b[j].saturating_sub(a[j])));
        }
    }
    let m = dp[..=n]
        .iter()
        .enumerate()
        .map(|(i, m)| i + m)
        .max()
        .unwrap();

    let mut dp = vec![0; m + 5001];
    for i in 0..m {
        for j in 0..3 {
            dp[i + b[j]] = std::cmp::max(dp[i + b[j]], dp[i] + (a[j].saturating_sub(b[j])));
        }
    }
    let n = dp[..=m]
        .iter()
        .enumerate()
        .map(|(i, n)| i + n)
        .max()
        .unwrap();
    println!("{}", n);
}


Measured memory_bytes: 197304
#include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef long double LD;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LD, LD> PDD;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VCH;
typedef vector<LD> VLD;
typedef vector<VI> VVI;
typedef vector<VLL> VVLL;
typedef vector<VCH> VVCH;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<PDD> VPDD;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define next fake_next
#define previous fake_previous
#define left fake_left
#define right fake_right

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const int MAXN = 100007;
const int MOD = 1000000007;
const ll INF = 1000000000LL * 1000000000;
const LL LINF = INF * (LL)INF;
const LD PI = acos(-1.0);
int n , m;
char field[505][505] , field1[505][505] , field2[505][505];
int main()
{
	//freopen("input.txt" , "r" , stdin);
	scanf("%d %d\n" , &n , &m);
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			scanf("%c" , &field[i][j]);
			field1[i][j] = field[i][j];
			field2[i][j] = field[i][j];
		}
		scanf("\n");
	}
	for(int i = 0; i < n; i++)
	{
		if(i != n - 1)
			field1[i][0] = '#';
		if(i != 0)
			field2[i][m - 1] = '#';
	}
	for(int i = 0; i < m; i++)
	{
		if(i != 0)
		field2[n - 1][i] = '#';
		if(i != m - 1)
			field1[0][i] = '#';
	}

	for(int i = 1; i < n - 1; i += 2)
	{
		for(int j = 1; j < m - 1; j++)
			field1[i][j] = '#';
	}
	for(int i = 2; i < n - 1; i += 2)
	{
		for(int j = 1; j < m - 1; j++)
			field2[i][j] = '#';
	}
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
			cout << field1[i][j];
		cout << endl;
	}
	cout << endl;
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
			cout << field2[i][j];
		cout << endl;
	}
}


Measured memory_bytes: 1536
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int s;
    s=n%10;

        if(s==3)
        {
        cout<<"bon"<<endl;
        }
        else if(s==0||s==1||s==6||s==8)
        {
        cout<<"pon"<<endl;
        }
        else if(s==2||s==4||s==5||s==7||s==9)
        {
        cout<<"hon"<<endl;
        }


    return 0;

}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << min(min(a+b,b+c),c+a) << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

const int N = 3e4;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);	
	
	int n;
	cin >> n;
	if (n == 3) {
		cout << "2 5 63" << endl;
		return 0;
	}
	if (n == 4) {
		cout << "2 5 20 63" << endl;
		return 0;
	}
	vector<int> ans = {2, 8, 14, 3, 9};
	int p2 = 14 + 6;
	int p3 = 9 + 6;
	int p4 = 4;
	int p6 = 6;
	while ((int)ans.size() + 3 <= n && p2 + 12 <= N) {
		ans.push_back(p2);
		p2 += 6;
		ans.push_back(p2);
		p2 += 6;
		ans.push_back(p2);
		p2 += 6;	
	}
	while ((int)ans.size() + 3 <= n && p4 + 12 <= N) {
		ans.push_back(p4);
		p4 += 6;
		ans.push_back(p4);
		p4 += 6;
		ans.push_back(p4);
		p4 += 6;	
	}
	while ((int)ans.size() + 2 <= n && p3 + 6 <= N) {
		ans.push_back(p3);
		p3 += 6;
		ans.push_back(p3);
		p3 += 6;
	}
	while ((int)ans.size() + 2 <= n && p2 <= N && p4 <= N) {
		ans.push_back(p2);
		p2 += 6;
		ans.push_back(p4);
		p4 += 6;
	}
	while ((int)ans.size() + 1 <= n && p6 <= N) {
		ans.push_back(p6);
		p6 += 6;
	}
	for (auto t : ans) {
		cout << t << ' ';
	} 
	cout << endl;
}


Measured memory_bytes: 1144
n = int(input())
d = [[int(i) for i in input().split()] for _ in range(n)]
for i in range(n - 2):
    if d[i][0] == d[i][1] and d[i + 1][0] == d[i + 1][1] and d[i + 2][0] == d[i + 2][1]:
        print("Yes")
        break
else:
    print("No")


Measured memory_bytes: 9180
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string str;
    cin >> str;
    int sum = 700;
    if(str[0] == 'o') sum += 100;
    if(str[1] == 'o') sum += 100;
    if(str[2] == 'o') sum += 100;
    cout << sum << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) {
		FastReader scan = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		Task solver = new Task();
		solver.solve(1, scan, out);
		out.close();
	}
	
	static class Task {
		public void solve(int testNumber, FastReader scan, PrintWriter out) {
			long n = scan.nextInt();
			out.println((n-1)*n/2);
		}
	}
	
	static void shuffle(int[] a) {
		Random get = new Random();
		for(int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			int temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}
	
	static void shuffle(long[] a) {
		Random get = new Random();
		for(int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			long temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}
	

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		public FastReader(String s) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(new File(s)));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

}


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

int main() {
  int X;
  cin>>X;
  if (X==7) {
    cout<<"YES"<<endl;
  }
  else if (X==5) {
    cout<<"YES"<<endl;
  }
  else if (X==3) {
    cout<<"YES"<<endl;
  }
  else {
    cout<<"NO"<<endl;
  }
  
}


Measured memory_bytes: 764
import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int n = sc.nextInt();
		int[] numbers = new int[n];
		for (int i=0;i<n;i++) {
			numbers[i] = sc.nextInt();
		}
		int numbers_length = numbers.length;
		Set<Integer> linkedHashSet = new LinkedHashSet<Integer>();
		for (int i = 0; i < numbers.length; i++) {
			linkedHashSet.add(numbers[i]);
		}
		int numbers_length2 =linkedHashSet.size();
		
	if(numbers_length==numbers_length2){
		System.out.println("YES");
	} else{
		System.out.println("NO");
	}
		
		//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	}
}

Measured memory_bytes: 74480
using System;
using System.Text;

class Program
{
	static void Main()
	{
		var size = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => int.Parse(number));
		var height = size[0];
		var width = size[1];
		Console.ReadLine();
		var colorCounts = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => int.Parse(number));

		var answerData = new int[width + 2, height + 2];
		for (var y = 0; y < height; ++y) {
			for (var x = 0; x < width; ++x) {
				answerData[x + 1, y + 1] = -1;
			}
		}

		var vectorX = 1;
		var vectorY = 0;
		var currentX = 1;
		var currentY = 1;
		for(var i = 0; i < colorCounts.Length; ++i) {
			for (var j = 0; j < colorCounts[i]; ++j) {
				answerData[currentX, currentY] = i + 1;

				if (answerData[currentX + vectorX, currentY + vectorY] != -1) {
					var newVectorX = vectorY * -1;
					vectorY = vectorX;
					vectorX = newVectorX;
				}

				currentX += vectorX;
				currentY += vectorY;
			}
		}

		var answerText = new StringBuilder();
		for (var y = 0; y < height; ++y) {
			for (var x = 0; x < width; ++x) {
				answerText.Append(answerData[x + 1, y + 1]);
				if (x < width - 1) {
					answerText.Append(" ");
				}
			}

			answerText.Append(Environment.NewLine);
		}

		Console.Write(answerText);
	}
}


Measured memory_bytes: 13408
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  int N, K, ans;
  cin >> N >> K;
  ans=K;
  if (N>=2) {
    for (int i=0; i<N-1; i++) {
      ans=ans*(K-1);
    }
  }
  cout << ans << endl;
}


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

int main()
{
    int current = 0;
    int count = 1;
    int n, x;
    cin >> n >> x;
    for (int i = 0; i < n; i++) {
        int l;
        cin >> l;
        current += l;
        if (current <= x) {
            count++;
        }
    }
    cout << count;
    return 0;
}


Measured memory_bytes: 888
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {
        n:i64,m:usize,
        a:[i64;m],
    }
    let mut ans = 0;
    let sm = a.iter().fold(0, |sm, x| sm + x);
    if n < sm {
        println!("{}", -1);
    } else {
        println!("{}", n - sm);
    }
}


Measured memory_bytes: 2176
import java.util.*;

// さっきの提出がWAになるのでとりあえずintをlongにしてみる
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());

		long a[];
		a = new long[5];
		for (int i = 0; i < n; i++) {
			String str = sc.next();
			if (str.matches("M.*")) {
				a[0]++;
			}
			if (str.matches("A.*")) {
				a[1]++;
			}
			if (str.matches("R.*")) {
				a[2]++;
			}
			if (str.matches("C.*")) {
				a[3]++;
			}
			if (str.matches("H.*")) {
				a[4]++;
			}
		}

		long result = 0;

		result += a[0] * a[1] * a[2];
		result += a[0] * a[1] * a[3];
		result += a[0] * a[1] * a[4];
		result += a[0] * a[2] * a[3];
		result += a[0] * a[2] * a[4];
		result += a[0] * a[3] * a[4];
		result += a[1] * a[2] * a[3];
		result += a[1] * a[2] * a[4];
		result += a[1] * a[3] * a[4];
		result += a[2] * a[3] * a[4];
		System.out.println(result);

	}
}

Measured memory_bytes: 60524
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitsf(n) __builtin_popcount(n)
#define in_edges(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B);}
#define endl "\n"
ll power(ll x, ll y); 

const ll MOD = 2019;
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
    string s;
    cin >> s;

    int hsh[2300] = {0};
    hsh[0] = 1;
    ll d, suf = 0, pot = 1, res = 0;

    rrep(i, s.size() - 1, 0){
        d = s[i] - '0';
        suf = (suf + d*pot) % MOD;
        pot = (pot * 10) % MOD;
        res += hsh[suf]++;
    }

    cout << res;
}

ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

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

ll n,m;

int main(){
  cin>>n>>m;
  if(n==1 && m==1)cout<<1<<endl;
  else if(n==1 || m==1)cout<<max((ll)0,max(m-2,n-2))<<endl;
  else{
    cout<<(n-2)*(m-2)<<endl;
  }
  return 0;
}



Measured memory_bytes: 384
num = [[[0 for i in range(10)]for i in range(3)]for i in range(4)]

n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    num[b-1][f-1][r-1] += v
    
for b in range(4):
    for f in range(3):
        print(" " + " ".join(map(str, num[b][f])))
    if b < 3:
        print("#"*20)
        


Measured memory_bytes: 5608
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    deque<ll> deq;
    ll n; cin >> n;
    for(int i = 0; i < n;i++){
        ll a; cin >> a;
        if(i%2 == 0){
            deq.push_front(a);
        }else{
            deq.push_back(a);
        }
    }
    vector<ll> vec(deq.begin(),deq.end());
    if(n%2 == 0) reverse(vec.begin(),vec.end());
    cout << vec << endl;
    return 0;
}


Measured memory_bytes: 6912
#include <stdio.h>
int main(void){
    int i=0,j,k,sum,n,month[100],date[100],md[12]={31,29,31,30,31,30,31,31,30,31,30,31};
    while(1){
        scanf("%d %d",&month[i],&date[i]);
        if(month[i]==0) break;
        i++;
    }
    for(j=0;j<i;j++){
        sum=0;
        for(k=0;k<month[j]-1;k++) sum+=md[k];
        sum+=date[j];
        n=sum%7;
        switch (n) {
            case 1:
                printf("Thursday\n");
                break;
            case 2:
                printf("Friday\n");
                break;
            case 3:
                printf("Saturday\n");
                break;
            case 4:
                printf("Sunday\n");
                break;
            case 5:
                printf("Monday\n");
                break;
            case 6:
                printf("Tuesday\n");
                break;
            case 0:
                printf("Wednesday\n");
                break;
                 
        }
    }
    return 0;
}

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

int main(){

    long long n, k; cin >> n >> k;
    long long ans = 0;
    for(int b = k + 1; b <= n; b++){
        long long c = (n + 1) / b;
        ans += c * (b - k);
        long long temp = (n + 1) % b;
        if(temp > k) ans += temp - k;
    }

    if(k == 0) cout << n*n << endl;
    else cout << ans << endl;
    return 0;
}

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

int main(){
  vector<map<char, int>> v;
  
  int n;
  cin >> n;
  
  for(int i=0; i<n; i++){
    string s;
    cin >> s;
    
    map<char, int> mp;
    
    for(char c: s){
      mp[c]++;
    }
    
    v.push_back(mp);
    
  }
  
  map<char, int> tmp = v[0];
  
  for(auto p: v){
    for(auto itr = tmp.begin(); itr != tmp.end(); itr++){
      itr->second *= (p[itr->first]>0) ? 1 : 0;
    }
  }
  
  map<char, int> ans = tmp;
  
  for(auto p: v){
    for(auto itr = tmp.begin(); itr != tmp.end(); itr++){
      if(itr->second > 0){
        ans[itr->first] = min(ans[itr->first], p[itr->first]);
      }
    }
  }
  
  for(auto itr = ans.begin(); itr != ans.end(); itr++){
    for(int i=0; i< itr-> second; i++){
      cout << itr -> first;
    }
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <functional>

using namespace std;
static const int INF = 1e9;
typedef pair<int, int> P;

void solve()
{
	string s;
	cin >> s;
	if (s[0] == s[s.size() - 1])
	{
		if (s.size() % 2 == 0)
		{
			cout << "First" << endl;
		}
		else
		{
			cout << "Second" << endl;
		}
	}
	else
	{
		if (s.size() % 2 == 0)
		{
			cout << "Second" << endl;
		}
		else
		{
			cout << "First" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 512
import java.io.*;
import java.math.*;
import java.util.*;
 
public class Main {
	static final long MOD = 1000000007L;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		
		int N = sc.ni();
		long K = sc.nl();
		long[] nums = new long[N];
		for (int i = 0; i<  N; i++)
			nums[i] = sc.nl();
		int low = 1;
		int high = 1000000000;
		while (low < high) {
			int med = (low+high)/2;
			long cut = 0;
			for (int i = 0; i < N; i++) {
				cut += (nums[i]-1)/med;
			}
			if (cut <= K) {
				high = med;
			} else {
				low = med+1;
			}
		}
		pw.println(low);
		pw.close();
	}
	
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        }
        
        int ni() { 
            return Integer.parseInt(next()); 
        }
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() {
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str;
        }
    }
}

Measured memory_bytes: 57556
#!/bin/sh
read
N=`echo $REPLY | grep -o . | grep -c 'N'`
W=`echo $REPLY | grep -o . | grep -c 'W'`
E=`echo $REPLY | grep -o . | grep -c 'E'`
S=`echo $REPLY | grep -o . | grep -c 'S'`

if [ $N -eq 0 -a $S -eq 0 -a $W -eq 0 -a $E -ge 1 ]
then
	echo No
	exit
elif [ $N -eq 0 -a $S -eq 0 -a $W -ge 1 -a $E -eq 0 ]
then
	echo No
	exit
elif [ $N -eq 0 -a $S -ge 1 -a $W -eq 0 -a $E -eq 0 ]
then
	echo No
	exit
elif [ $N -ge 1 -a $S -eq 0 -a $W -eq 0 -a $E -eq 0 ]
then
	echo No
	exit
elif [ $N -ge 1 -a $S -ge 1 -a $W -ge 1 -a $E -eq 0 ]
then
	echo No
	exit
elif [ $N -ge 1 -a $S -ge 1 -a $W -eq 0 -a $E -ge 1 ]
then
	echo No
	exit
elif [ $N -ge 1 -a $S -eq 0 -a $W -ge 1 -a $E -ge 1 ]
then
	echo No
	exit
elif [ $N -eq 0 -a $S -ge 1 -a $W -ge 1 -a $E -ge 1 ]
then
	echo No
	exit
elif [ $N -ge 1 -a $S -eq 0 -a $W -ge 1 -a $E -eq 0 ]
then
	echo No
	exit
elif [ $N -ge 1 -a $S -eq 0 -a $W -eq 0 -a $E -ge 1 ]
then
	echo No
	exit
elif [ $N -eq 0 -a $S -ge 1 -a $W -eq 0 -a $E -ge 1 ]
then
	echo No
	exit
elif [ $N -eq 0 -a $S -ge 1 -a $W -ge 1 -a $E -eq 0 ]
then
	echo No
	exit
fi

echo Yes


Measured memory_bytes: 2684
#include<iostream>
#include <string>
#include<vector>
#include<algorithm>
#include <cstdlib>
using namespace std;
int main(){
    int n,ans=1;
    long long m;
    cin >> n >> m;
    int d = m/n;
    if(d < 100000000){
    for(int j=1;j<=d;j++){
        if(m%j == 0){
            ans = j;
        }
    }
    cout << ans << endl;
    }
    else{
        for(int i=n;i<100000;i++){
            if(m%i == 0){
                ans = m/i;
                break;
            }
        }
        cout << ans << endl;
    }
 
    return 0;
    
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define irep(i,a,b) for(int i=int(a);i>=int(b);i--)
using ll = long long;
using namespace std;

int main() {
	ll n, a, b, c, d, e;
	cin >> n >> a >> b >> c >> d >> e;
	ll mm = min(min(a, b), min(c, min(d, e)));
	ll ans1 = n / mm;
	if (n%mm == 0) ans1--;
	cout << (5 + ans1);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int MX = 100005;
int X[MX];

int main() {
  int n;
  cin >> n;
  REP(i,n){
    int a;
    cin >> a;

    X[a]++;
  }
  int q;
  cin >> q;
  vector<ll> sum(q+1);

  sum[0] = 0;
  REP(i,MX){
    sum[0] += i * X[i];
  }



  for(int i = 1; i <= q; ++i){
    int b, c;
    cin >> b >> c;
    ll tmp_b = X[b];
    X[b] = 0;
    X[c] += tmp_b;

    sum[i] = sum[i-1] - tmp_b*b + tmp_b*c;
  }

  for(int i = 1; i <= q; ++i) cout << sum[i]<< endl;

  return 0;
}

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



char cal(char op,char l1,char l2){
    int f=l1-'0';
    int s=l2-'0';
    if(op=='+')return static_cast<char>((f | s) + '0');
    if(op=='*')return static_cast<char>((f & s) + '0');
    if(op=='^')return static_cast<char>((f ^ s) + '0');
}

int main(){
    while(true){
        std::stack<char> h;
        std::string s;
        std::string p;
        int ans=0;
        std::cin>>s;
        if(s[0]=='.')break;
        std::cin>>p;
        for (char i : s) {
            switch (i){
                case 'a':
                    h.push(p[0]);
                    break;
                case 'b':
                    h.push(p[1]);
                    break;
                case 'c':
                    h.push(p[2]);
                    break;
                case 'd':
                    h.push(p[3]);
                    break;
                default:
                    h.push(i);
            }
            if(h.top()==']'){
                h.pop();
                char l2=h.top();
                h.pop();
                char l1=h.top();
                h.pop();
                char op=h.top();
                h.pop();
                h.pop();
                h.push(cal(op,l1,l2));
            }
        }
        char hv=h.top();
        h.pop();
        for (char d1 = '0'; d1 <= '9'; ++d1) {
            for (char d2 = '0'; d2 <= '9'; ++d2) {
                for (char d3 = '0'; d3 <= '9'; ++d3) {
                    for (char d4 = '0'; d4 <= '9'; ++d4) {
                        for (char i : s) {
                            switch (i){
                                case 'a':
                                    h.push(d1);
                                    break;
                                case 'b':
                                    h.push(d2);
                                    break;
                                case 'c':
                                    h.push(d3);
                                    break;
                                case 'd':
                                    h.push(d4);
                                    break;
                                default:
                                    h.push(i);
                            }
                            if(h.top()==']'){
                                h.pop();
                                char l2=h.top();
                                h.pop();
                                char l1=h.top();
                                h.pop();
                                char op=h.top();
                                h.pop();
                                h.pop();
                                h.push(cal(op,l1,l2));
                            }
                        }
                        if(hv==h.top())++ans;
                        h.pop();
                    }
                }
            }
        }
        int a=hv-'0';
        std::cout<<a<<" "<<ans<<std::endl;
    }
    return 0;
}



Measured memory_bytes: 3176
import java.util.Scanner;

public class Main {

    private static Scanner scan;

    private static void start() {
        scan = new Scanner(java.lang.System.in);
    }

    private static void finish() {
    }

    public static void main(String[] args) {
        start();

        int a = scan.nextInt();
        int b = scan.nextInt();
        if (a % b != 0) {
            System.out.println(a);
        } else {
            System.out.println(-1);
        }

        finish();
    }
}


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

struct LowLink {
  using A = vector<int>;
  using B = vector<pair<int, int>>;
  int n;
  vector<vector<int>> es;
  vector<bool> vis;
  vector<int> ord, low;
  A articulation;
  B bridge;
  LowLink(int n) : n(n), es(n) {}
  void add_edge(int v, int u) {
    es[v].push_back(u);
    es[u].push_back(v);
  }
  void dfs(int v, int p, int &k) {
    vis[v] = true;
    ord[v] = k++;
    low[v] = ord[v];
    bool is = false;
    int cnt = 0;
    for (auto u : es[v]) {
      if (vis[u])  {
        if (u != p) low[v] = min(low[v], ord[u]);
        continue;
      }
      cnt++;
      dfs(u, v, k);
      low[v] = min(low[v], low[u]);
      if (p != -1 && ord[v] <= low[u]) is = true;
      if (ord[v] < low[u]) bridge.emplace_back(min(v, u), max(v, u));
    }
    if (p == -1 && cnt > 1) is = true;
    if (is) articulation.push_back(v);
  }
  pair<A, B> build() {
    int k = 0;
    vis.assign(n, false);
    ord.assign(n, 0);
    low.assign(n, 0);
    articulation.clear();
    bridge.clear();
    dfs(0, -1, k);
    return pair<A, B>(articulation, bridge);
  }
};

int main() {
  int N, M; cin >> N >> M;
  auto low = LowLink(N);
  for (int i = 0; i < M; i++) {
    int v, u; cin >> v >> u;
    low.add_edge(v, u);
  }
  auto ans = low.build().first;
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << '\n';
  }
  return 0;
}



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

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

  int ans = 0;
  for (int i = 0; i < N.size() - 1; i++)
    if (N.at(i) != N.at(i + 1)) ans++;

  cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string.h>
using namespace std;
//BIT
long bit[1000001],n;
long MAX;
long sum(int i){
	long s=0;
	while(i>0){
		s+=bit[i];
		i-=i&-i;
	}
	return s;
}
void add(long i,long x){
	while(i<=MAX){
		bit[i]+=x;
		i+=i&-i;
	}
}
long a[100];
bool input(){
	cin >> n; if(!n) return false;
	for(int i=0;i<n;i++) cin >> a[i];
	MAX=a[0];
	for(int i=0;i<n;i++) MAX=max(MAX,a[i]);
	return true;
}
int main() {
	while(input()) {
		long long ans=0;
		for(int i=0;i<n;i++) {
			ans+=i-sum(a[i]);
			add(a[i],1);
		}
		cout << ans << '\n' ;
		memset(bit,0,sizeof(bit)); memset(a,0,sizeof(a));
	}
}

Measured memory_bytes: 8976
def main():
    n,m,k = map(int,input().split())
    mod = 998244353
    ans = 0
    def cmb(n,r,mod):
        if (r<0 or r>n):
            return 0
        r = min (r, n-r)
        return g1[n] * g2[r] * g2[n-r] %mod
    g1 = [1,1]
    g2 = [1,1]
    inverse = [0,1]
    for i in range(2, n+1):
        g1.append((g1[-1] * i) %mod)
        inverse.append((-inverse[mod % i ] * (mod//i)) % mod)
        g2.append((g2[-1]*inverse[-1]) % mod)
    for i in range(k+1):
        a = cmb(n-1,i,mod)
        a = a*m % mod
        a = a * pow(m-1,n-1-i,mod)
        ans += a
        ans = ans % mod
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 33132
A,B,K=map(int,input().split())

for i in range(K):
    if i%2==0:
        if A%2==1:
            A=(A-1)//2
            B+=A
        else:
            A=A//2
            B+=A
    else:
        if B%2==1:
            B=(B-1)//2
            A+=B
        else:
            B=B//2
            A+=B
print(A,B)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
const int maxn = 3000050;
using namespace std;
typedef long long ll;
int n,k;
int a[maxn],b[maxn];
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	cin>>n>>k;
	for(int i=0;i<n;i++)
	cin>>a[i];
	k=min(k,100);
	while(k--){
		for(int i=0;i<n;i++)
		b[i]=0;
		for(int i=0;i<n;i++){
			int l=max(0,i-a[i]);
			int r=min(n,i+a[i]+1);
			b[l]++;
			b[r]--;
		} 
		a[0]=b[0];
		for(int i=1;i<n;i++){
			b[i]+=b[i-1];
			a[i]=b[i];
		}
		
	}
	for(int i=0;i<n;i++)
	cout<<a[i]<<" ";
	return 0;
}


Measured memory_bytes: 5140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> a(n), from(n);
    rep(i, n) cin >> a[i];
    map<ll, ll> m;
    ll ans = 0;//, mv = LONG_LONG_MIN;
    rep(i, n) {
        from[i] = i - a[i];
        // if ((from[i] < 0) || (i < from[i]) || (mv > a[i])) {
        if ((from[i] < 0) || (i < from[i])) {
            cout << -1 << endl;
            return 0;
        }
        // mv = max(mv, a[i]);
        if ((i != 0) && (a[i] > (a[i - 1] + 1))) {
            cout << -1 << endl;
            return 0;
        }
        // printf("i=%lld, m[%lld]=%lld, ans=%lld, %lld\n", i, from[i], m[from[i]], ans, i - m[from[i]]);
        ans += i - max(from[i], m[from[i]]);
        m[from[i]] = i;
    }
    cout << ans << endl;
    // rep(i, n) printf("%lld%s", from[i], (i == (n - 1)) ? "\n" : " ");
    return 0;
}


Measured memory_bytes: 15872
N=int(input())
mod=10**9+7
t=0
a,b,c=1,1,1
for i in range(N):
    a*=10
    b*=9
    c*=8
    if i%10==0:
        a%=mod
        b%=mod
        c%=mod
ans=(a+c-(2*b))%mod
print(ans)

Measured memory_bytes: 73292
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007



int main()
{  
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll n,k,x;
    cin>>n>>k;
    ll a[n],dp[n];
    for(int i=0;i<n;i++)cin>>a[i];
    dp[0]=0;
    for(int i=1;i<n;i++)
    {
        dp[i]=INT_MAX;x=INT_MAX;
        for(int j=1;j<=k;j++)
        {
            if(i-j >= 0) x=dp[i-j]+abs(a[i]-a[i-j]);
            dp[i]=min(dp[i],x);
        }
    }
    cout<<dp[n-1]<<"\n";
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(){
	int a , b;
	int i;
	scanf("%d %d" , &a , &b);
	if(b%a == 0){
		printf("%d\n" , a+b);
		return 0;
	}
	printf("%d\n" , b-a);
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>

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

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RREP(i, n) for(int i = n - 1; i >= 0; i--)
#define REP2(i, n, k) for(int i = 0; i < n; i += k)


int main()
{
	int i;
	string s;

	cin >> s;

	if (s.size() == 1) {
		cout << s << endl;
	}
	else {
		if (s[0] == '9') {
			for (i = 0; i < s.size(); i++) {
				if (s[i] != '9') {
					break;
				}
			}
			if (i == s.size()) {
				cout << 9 * s.size() << endl;
			}
			else {
				cout << 8 + 9 * (s.size() - 1) << endl;
			}
			
		}
		else {
			for (i = 1; i < s.size(); i++) {
				if (s[i] != '9') {
					break;
				}
			}
			if (i == s.size()) {
				cout << (s[0] - '0') + 9 * (s.size() - 1) << endl;
			}
			else {
				s[0] -= 1;

				cout << (s[0] - '0') + 9 * (s.size() - 1) << endl;
			}
		}
	}
}

Measured memory_bytes: 256
class MinCostFlow:
    def __init__(self, n):
        self.n = n
        self.G = [[] for i in range(n)]

    def addEdge(self, f, t, cap, cost):
        # [to, cap, cost, rev]
        self.G[f].append([t, cap, cost, len(self.G[t])])
        self.G[t].append([f, 0, -cost, len(self.G[f])-1])

    def minCostFlow(self, s, t, f):
        n = self.n
        G = self.G
        prevv = [0]*n; preve = [0]*n
        INF = 10**9+7

        res = 0
        while f:
            dist = [INF]*n
            dist[s] = 0
            update = 1
            while update:
                update = 0
                for v in range(n):
                    if dist[v] == INF:
                        continue
                    gv = G[v]
                    for i in range(len(gv)):
                        to, cap, cost, rev = gv[i]
                        if cap > 0 and dist[v] + cost < dist[to]:
                            dist[to] = dist[v] + cost
                            prevv[to] = v; preve[to] = i
                            update = 1
            if dist[t] == INF:
                return -1

            d = f; v = t
            while v != s:
                d = min(d, G[prevv[v]][preve[v]][1])
                v = prevv[v]
            f -= d
            res += d * dist[t]
            v = t
            while v != s:
                e = G[prevv[v]][preve[v]]
                e[1] -= d
                G[v][e[3]][1] += d
                v = prevv[v]
        return res

n, m, f = map(int, input().split())
graph = MinCostFlow(n)
for i in range(m):
    u, v, c, d = map(int, input().split())
    graph.addEdge(u, v, c, d)
print(graph.minCostFlow(0, n-1, f))

Measured memory_bytes: 8024
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  ll n;
  cin >> n;

  ll c[12]={};
  for(int i=1;i<12;i++)c[i]=pow(26,i)+c[i-1];
  ll a;
  for(int i=0;i<12;i++){
    a=i;
    if(c[i]>=n)break;
  }
  //nはa桁で確定

  ll b=n-c[a-1]-1;//そのグループで何番目か

  vector<ll> v;
  ll m=b;
  for(int i=a-1;i>=0;i--){
    ll c;
    c=m/pow(26,i);
    v.push_back(c);
    m=m-c*pow(26,i);
  }

  for(int i=0;i<a;i++){
    cout << char(v[i]+97);
  }

  // vector<ll> v;
  // ll m=b;
  // ll c=0;
  // while(m>0){
  //   ll d=0;
  //   while(pow(26,a)<=m){
  //     d++;
  //   }
  //   a--;
  //   ll b=m/pow(26,d);
  //   if(m!=1 && m==pow(26,d))c=d;
  //   if(m==1){
  //     d=1;
  //     b=1;
  //   }
  //   v.push_back(b);
  //   m=m-b*pow(26,a);
  // }

  // for(ll i=0;i<v.size();i++){
  //    cout << char(v[i]+96);
  // }
  // for(int i=0;i<c-1;i++)cout << char(26+96);

}

Measured memory_bytes: 4060