akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ad(x) ((x - 1 ^ 1) + 1)

const int N = 200054, M = N * 3;

int n, R1, R2, E = 0;
int to[M], first[N], next[M];
int deg[N], eg[N];
bool used[M], dir[M];

inline void addedge(int u, int v) {
	to[++E] = v, next[E] = first[u], first[u] = E;
	to[++E] = u, next[E] = first[v], first[v] = E;
}

void dfs(int x) {
	for (int &i = first[x]; i; i = next[i])
		if (!used[i])
			used[ad(i)] = used[i] = dir[i] = true, dfs(to[i]);
}

int main() {
	int i, x;
	scanf("%d", &n);
	for (i = 1; i <= n; ++i) scanf("%d", &x), ~x ? (addedge(i, x), ++deg[x]) : (R1 = i);
	for (; i <= 2 * n; ++i) scanf("%d", &x), ~x ? (addedge(i, x + n), ++deg[x + n]) : (R2 = i);
	addedge(R1, R2);
	for (i = 1; i <= n; ++i)
		if ((deg[i] ^ deg[i + n]) & 1) return puts("IMPOSSIBLE"), 0;
		else if (~deg[i] & 1) addedge(i, i + n), eg[i] = E;
	for (i = 1; i <= 2 * n; ++i) dfs(i);
	puts("POSSIBLE");
	for (i = 1; i <= n; ++i) printf("%d%c", deg[i] & 1 ? 0 : dir[eg[i]] ? 1 : -1, i == n ? 10 : 32);
	return 0;
}

Measured memory_bytes: 12928
#include<bits/stdc++.h>
      using namespace std;
      #define ll long long
      #define pb push_back
      #define pll  pair <long long,long long>
      #define mp make_pair
      #define ss second
      #define ff first
      #define maa 1000000007
      #define endl '\n'
      #define ld long double
      #define all(x) x.begin(),x.end()
      ll  power(ll  i,ll  j)
      {
        if(j==0)
        return 1 ;
        ll t=power(i,j/2)%maa ;
        if(j%2==0)
        return (t%maa*t%maa)%maa ;
        else
        return ((t%maa*t%maa)%maa*(i%maa)%maa)%maa ;
      }
      bool is(ll  i)
      {
        if(i==1)
            return 0 ;
        ll  f=0 ;
        for(ll  j=2;j<=sqrt(i);j++)
        {
            if(i%j==0)
            {
                f=1 ;
                break ;
            }
        }
        return !f ;
      }
      ll n ;
      ll ar[3001] ;
      ll dp[3001][3001] ;
      ll fun(ll i,ll j)
      {
          if(i>j)
          return 0 ;
          else if(i==j)
          return ar[i] ;
          else if(dp[i][j]!=-1)
          return dp[i][j] ;
          else
          {
              ll ans=max(ar[i]+min(fun(i+1,j-1),fun(i+2,j)),ar[j]+min(fun(i+1,j-1),fun(i,j-2))) ;
              
              return dp[i][j]=ans ;
          }
      }
      int main()
      {

        /// 50-4
        /// freopen("input.txt","r",stdin);
        /// freopen("output.txt","w",stdout);
        cin>>n ;
        ll sum=0 ;
        for(ll i=1;i<=n;i++)
        {cin>>ar[i] ;
         sum+=ar[i] ;
        }
        
        for(ll i=0;i<3001;i++)
        {
            for(ll j=0;j<3001;j++)
            dp[i][j]=-1 ;
        }
        cout<<(2*fun(1,n)-sum)<<endl ;
        
       
        
        

      }








Measured memory_bytes: 70784
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

#define MOD 1000000007
#define PI 3.14159265358979

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};

typedef vector< edge > edges;
typedef vector< edges > graph;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;

template < typename T >
bool chmin(T &x, const T &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T >
bool chmax(T &x, const T &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
int main() {
	int N;
	cin >> N;
	string ans = "No";
	for (int i = 1; i <= 9; i++)
		for (int j = 1; j <= 9; j++) {
			if (i * j == N) {
				ans = "Yes";
			}
		}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define M 251
#define NIL 2000000001

struct nodef{
  int p,k,l,r;
};
typedef struct nodef node;

node T[M];
int C[M];

int main(){
  int a,i;
  scanf("%d",&a);

  for(i=0;i<=a;i++)T[i].p=T[i].l=T[i].r=NIL;
  
  for(i=1;i<=a;i++){
    scanf("%d",&T[i].k);
    if(i!=1){
    if(i%2==0){T[i/2].l=T[i].k;T[i].p=T[i/2].k;}
    else {T[i/2].r=T[i].k;T[i].p=T[i/2].k;}
    }
  }
  for(i=1;i<=a;i++){
    printf("node %d: key = %d, ",i,T[i].k);
    if(T[i].p!=NIL)printf("parent key = %d, ",T[i].p);
    if(T[i].l!=NIL)printf("left key = %d, ",T[i].l);
    if(T[i].r!=NIL)printf("right key = %d, ",T[i].r);
    printf("\n");
  }
}



Measured memory_bytes: 2032
class Dice
	attr_reader :top

  def initialize(ary)
    @top, @front, @right, @left, @back, @bottom = ary
  end

  def roll(way)
    case way.downcase
    when 'e'
      tmp = @top
      @top = @left
			@left = @bottom
			@bottom = @right
			@right = tmp
    when 'w'
			tmp = @top
			@top = @right
			@right = @bottom
			@bottom = @left
			@left = tmp
    when 's'
			tmp = @top
			@top = @back
			@back = @bottom
			@bottom = @front
			@front = tmp
    when 'n'
			tmp = @top
			@top = @front
			@front = @bottom
			@bottom = @back
			@back = tmp
    end
  end

  def top
		@top
  end
end

dice = Dice.new(gets.chomp.split(/\s/).map(&:to_i))
order = gets.chomp.split('')
order.each{ |way| dice.roll(way) }
puts dice.top

Measured memory_bytes: 8688
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int[] b = new int[4];
		LinkedList<String> c = new LinkedList<String>();
		while(s.hasNext()){
		    String[] a = s.next().split(",");
		    c.add(a[1]);
		}
		for(int i=0 ; i<c.size() ; i++){
		    if("A".equals(c.get(i)))
			b[0]++;
		    if("B".equals(c.get(i)))
			b[1]++;
		    if("AB".equals(c.get(i)))
			b[2]++;
		    if("O".equals(c.get(i)))
			b[3]++;
		}
		for(int i=0 ; i<4 ; i++)
		    System.out.println(b[i]);
	}
}

Measured memory_bytes: 12000
/*input
81
*/

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

int main() {
    int n;
    cin >> n;
    bool ans = false;
    for (int i = 1; i <= 9; i++) {
        if (n%i == 0 && n/i <= 9) {
            ans = true;
        }
    }
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

using vll = vector<ll>;

void solve();

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

  solve();

  return 0;
}

#define ini(...)   \
  int __VA_ARGS__; \
  in(__VA_ARGS__)

#define inl(...)  \
  ll __VA_ARGS__; \
  in(__VA_ARGS__)

#define ins(...)      \
  string __VA_ARGS__; \
  in(__VA_ARGS__);

#define invll(v, n)                              \
  vector<long long> v(n);                        \
  for (long long i = 0; i < n; i++) cin >> v[i];

void in() {}
template <typename T, class... U>
void in(T& t, U&... u) {
  cin >> t;
  in(u...);
}

void out() {
  cout << endl;
}
template <typename T, class... U>
void out(const T& t, const U&... u) {
  cout << t;
  if (sizeof...(u))
    cout << " ";
  out(u...);
}

#define rep(i, n) for (long long i = 0; i < n; i++)

void solve();
#ifndef ONLINE_JUDGE
#include "./lib.hpp"
#endif

#include <iomanip>

ll comb(ll n, ll k) {
    if (k > n) return 0LL;
    if (k * 2LL > n) k = n - k;
    if (k == 0LL) return 1LL;

    ll result = n;
    for(ll i = 2LL; i <= k; i++) {
        result *= (n - i + 1LL);
        result /= i;
    }
    return result;
}

void solve() {
    ini(N, A, B);
    invll(v, N);
    sort(v.begin(), v.end(), greater<ll>());

    auto num_vA = (int)count(v.begin(), v.end(), v[A - 1]);
    ll left = 0;
    while (v[left] != v[A - 1]) left++;
    ll right = N - 1;
    while (v[right] != v[A - 1]) right--;

    ll sum = accumulate(&v[0], &v[A], 0LL);
    cout << fixed << setprecision(6) << static_cast<double>(sum) / static_cast<double>(A) << endl;

    ll min_use = A - left;
    ll max_use = left == 0 ? min(num_vA, B) : min_use;
    
    ll ret = 0;
    for (ll i = min_use; i <= max_use; i++) {
        ret += comb(num_vA, i);
    }
    out(ret);
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define vpli vector<pair<long long,int>>
#define deb(x) cout<<x<<endl;
#define all(x) x.begin(),x.end()
ll MOD = 1e9+7;
const int M = 1e6+5;
vi sieve(M,0);

int helper()
{
    for(int i=1;i<M;i++)
    {
        if(sieve[i]> 0)
        {
            for(int j=i+i;j<M;j+=i)
            {
                if(sieve[j]>0)
                    sieve[j]++;
            }
        }
    }
    int count = 0;
    for(int i =0;i<M;i++)
    {
        if(sieve[i] == 1) count++;
    }
    return count;
}

void solve()
{
    int n,x;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        sieve[x]++;
    }
    cout<<helper();
}

int main()
{
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 7044
package main

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

func calc(lW, lE, rW, rE int) int {
	return lW + rE
}

func main() {
	defer stdout.Flush()
	_ = readInt()
	s := readString()
	rW := 0
	rE := 0
	for _, r := range s {
		if r == 'W' {
			rW++
		} else if r == 'E' {
			rE++
		} else {
			panic("not W and E")
		}
	}
	lW := 0
	lE := 0
	min := 3*100000 + 100
	for _, r := range s {
		if r == 'W' {
			rW--
		} else if r == 'E' {
			rE--
		}
		x := calc(lW, lE, rW, rE)
		if x < min {
			min = x
		}
		if r == 'W' {
			lW++
		} else if r == 'E' {
			lE++
		}
	}
	println(min)
}

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	i, err := strconv.Atoi(readString())
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  int N, T; cin >> N >> T;
  int ans = 9999;
  rep(i, N) {
    int c, t; cin >> c >> t;
    if( t <=T && c < ans) {
      ans = c;
    }
  }
  if(ans == 9999) cout << "TLE" << endl;
  else cout << ans << endl;
}

Measured memory_bytes: 256
import sys
from collections import deque
from collections import defaultdict
import math
import copy
#input = sys.stdin.readline
sys.setrecursionlimit(20000000)
s = input()
s = s[::-1]
n = len(s)
dp = [0]*(n+1)
k = 1
a = defaultdict(int)
a[0]+=1
for i in range(n):
  dp[i] = (dp[i-1]+int(s[i])*k)%2019
  k*=10
  k%=2019
  a[dp[i]] += 1
ans = 0
for i in a.keys():
  ans += a[i]*(a[i]-1)/2
print(int(ans))


Measured memory_bytes: 16864
INFTY = 100000000
n = int( raw_input() )
graph = {}
for i in range(n):
  In = map( int , raw_input().split(' ') )
  u = In[0]
  k = In[1]
  graph[u] = {}
  for j in range(k):
    v = In[2+j*2]
    c = In[2+j*2+1]
    graph[u][v] = c
 
da = {}
visited = {}
for i in range(n):
  da[i] = INFTY
  visited[i] = False
s = 0
da[s] = 0
visited[s] = True
 
while True:
  for i in range(n):
    if not visited[i] and i in graph[s] and da[i] > da[s] + graph[s][i]:
      da[i] = da[s] + graph[s][i]
  cost = INFTY
  node = -1
  for i in range(n):
    if not visited[i] and da[i] < cost:
      cost = da[i]
      node = i
  if cost == INFTY: break
  visited[node] = True
  s = node
  
for i in range(n):
  print i,da[i]

Measured memory_bytes: 6660
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define FAST {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pll pair<ll,ll>
#define LB lower_bound
#define UB upper_bound
#define endl "\n"
using namespace std;

int main()
{
    FAST
    ll M=1e9+7;
    ll n;cin>>n;
    ll a[n];
    f(i,0,n) cin>>a[i];
    ll suf[n];
    suf[n-1]=a[n-1];
    fr(i,n-2,0) suf[i]=(a[i]+suf[i+1])%M;
    ll ans=0;
    f(i,0,n-1)
    {
        ans = (ans + a[i]*suf[i+1])%M;
    }
    ans = (ans+M)%M;
    cout<<ans<<endl;
}


Measured memory_bytes: 6760
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val K = readLine()!!.toInt()


    var ans = 1
    for (i in 1..N) {
        val a = ans * 2
        var b = ans + K
        ans = if (a<b) a else b
    }
    println(ans)
}

Measured memory_bytes: 31872
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<string>
using namespace std;
int ans = -1;
int a[2][100];
int n;

void search(int x,int y,int now){
  now+=a[y][x];
  if(y==1&&x==n-1){
    ans = max(ans,now);
    return;
  }
  if(y==0)
    search(x,y+1,now);
  if(x!=n-1)
    search(x+1,y,now);

}

int main(){

  cin>>n;
  
  for(int i=0;i<n;i++)
    cin>>a[0][i];
  for(int i=0;i<n;i++)
    cin>>a[1][i];

  search(0,0,0);

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mx 100005
#define PI 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define x first
#define y second
using namespace std;
typedef long long ll;
int BIT[mx], n, a, b;

void update(int idx, int val)
{
	for(;idx <= n; idx +=(idx&(-idx))) 
	{
		BIT[idx] += val;
	}
}

int query(int idx)
{
	int sum = 0;
	for(;idx > 0; idx -= (idx&(-idx))) sum += BIT[idx];
	return sum;
}

int sum(int L, int R)
{
	return query(R) - query(L - 1);
}

int main()
{
	cin >> n;
	while(n--)
	{
		cin >> a;
		if(a&1) b++;
	}

	if(!(b&1)) cout << "YES";
	else cout << "NO";
}	

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define pb push_back
#define ff first
#define ss second
#define sz size()
#define mp make_pair
#define p(x) cout<< x << " ";
#define pe(x) cout<< x << endl ;
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define debug(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define el endl
#define MOD 1000000007 
#define int long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROR(i,a,b) for(int i=a;i>=b;i--)
const int N = 4e5 + 5;


int32_t main() 
{ 
    FAST;
    int n,k;
    cin>>n>>k;
    vector<pair<int,int> > ans;
    if(k>((n-1)*(n-2))/2)
    {
        cout<<"-1";
        return 0;
    }
    int cnt=0;
    for(int i=2;i<=n;i++)
    {
        ans.pb(mp(1,i));
        cnt++;
    }
    int pa=((n-1)*(n-2))/2,j=2;
    //cout<<pa<<" ";
    while(k<pa)
    {
        for(int i=j+1;i<=n;i++)
        {
            ans.pb(mp(j,i));
            cnt++;
            pa--;
            if(k>=pa)
            break;
            
            
        }
        j++;
    }
    cout<<cnt<<endl;
    for(int i=0;i<cnt;i++)
    {
        cout<<ans[i].ff<<" "<<ans[i].ss<<endl;
    }
    
}

Measured memory_bytes: 512
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
lint bs[1001001];
//lint dp[1001001];
vector<int> a,b,c;
int n;string s;
lint cal(int K){
	lint ret=0,bn=0,cn=0,now=0;
	int it=a[0];
	rep(i,a.size()){
		while(it<a[i]+K && it<n){
			if(s[it]=='M') bn++;
			if(s[it]=='C'){
				now+=bn;cn++;
			}
			it++;
		}
		ret+=now;
		if(i<a.size()-1){
			REP(j,a[i],a[i+1]){
				if(s[j]=='M'){
					bn--;now-=cn;
				}
				if(s[j]=='C') cn--;
			}
		}
	}
	return ret;
}
int main()
{
	int q,K;cin>>n;cin>>s;
	lint out=0;
	rep(i,n){
		if(s[i]=='D') a.pb(i);
		if(s[i]=='M') b.pb(i);
		if(s[i]=='C') c.pb(i);
	}
	cin>>q;
	rep(i,q){
		cin>>K;
		cout<<cal(K)<<endl;
	}
}


Measured memory_bytes: 7292
use proconio::input;

fn dfs(ans: &mut i64, a: &[i64], b: &mut Vec<i64>) {
    if b.len() == a.len() {
        let mut y = 1_i64;
        for &b_i in b.iter() {
            y *= b_i;
        }
        if y % 2 == 0 {
            *ans += 1;
        }
        return;
    }
    let i = b.len();
    for &d in [-1, 0, 1].iter() {
        b.push(a[i] + d);
        dfs(ans, a, b);
        b.pop();
    }
}

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    };
    let mut ans = 0;
    dfs(&mut ans, &a, &mut vec![]);
    println!("{}", ans);
}


Measured memory_bytes: 2156
// 5/2 リアルタイム参加

#include <iostream>
using namespace std;

int main() {
    int K, A, B;
    cin >> K >> A >> B;

    if (B % K == 0 || A % K == 0) {
        cout << "OK" << endl;
        return 0;
    }
    else {
        int v = (B / K) - (A / K);

        if (v > 0) cout << "OK" << endl;
        else cout << "NG" << endl;
    }
    
}


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

namespace AtCoder
{
	public class Program
	{
		// ABC132-A
		static void Main(string[] args)
		{
			string str = Console.ReadLine();

			Dictionary<char, int> dic = new Dictionary<char, int>();
			foreach (var c in str) {
				if (dic.ContainsKey(c)) {
					dic[c]++;
				} else {
					dic[c] = 1;
				}
			}
			if (dic.Count == 2 && dic.All(p => p.Value == 2)) {
				Console.WriteLine("Yes");
			} else {
				Console.WriteLine("No");
			}
		}
	}
}


Measured memory_bytes: 11228
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    A=LI()
    from collections import defaultdict
    dd = defaultdict(int)
    
    for i in range(N):
        dd[A[i]]+=1
    
    ans=0
    for k,v in dd.items():
        ans+=(v*(v-1))//2
        
    for i in range(N):
        a=A[i]
        v=dd[A[i]]
        temp=ans
        temp-=(v*(v-1))//2
        temp+=((v-1)*(v-2))//2
        
        print(temp)
    
main()


Measured memory_bytes: 107936
from copy import deepcopy

R, C, K = [int(x) for x in input().split()]

gridOriginal = [list(input()) for r in range(R)]

initBlack = 0
for r in range(R):
    for c in range(C):
        if gridOriginal[r][c] == "#":
            initBlack += 1

count = 0
for rowMask in range(1 << R):
    for colMask in range(1 << C):
        grid = deepcopy(gridOriginal)
        removed = 0
        for r in range(R):
            for c in range(C):
                if grid[r][c] == "#" and (rowMask & (1 << r) or colMask & (1 << c)):
                    removed += 1
                    grid[r][c] = "R"

        if initBlack - removed == K:
            count += 1

print(count)


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

int main(){
	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	int sa = (n % a == 0 ? n / a : n / a + 1) * b;
	int sb = (n % c == 0 ? n / c : n / c + 1) * d;
	cout << min(sa, sb) << endl;
	return 0;
}


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

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop(i,b,n) for(int i=b;i<(n);++i)
#define each(e,v) for(auto &&e : v)

#define all(v) (v).begin(),(v).end()
#define sz(v) (int)v.size()

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const double EPS = 1e-9;
const ll MOD = 1e+9 + 7;

template<typename A,typename B> inline void chmin(A &a,B b){ if(a>b) a=b; }
template<typename A,typename B> inline void chmax(A &a,B b){ if(a<b) a=b; }
template <typename T> inline void print(const T& x) { cout << x << endl; }

int main() {
    int x;
    cin >> x;

    if(x<600) print(8);
    else if(x<800) print(7);
    else if(x<1000) print(6);
    else if(x<1200) print(5);
    else if(x<1400) print(4);
    else if(x<1600) print(3);
    else if(x<1800) print(2);
    else print(1);

    return 0;
}


Measured memory_bytes: 3628
S = map(int, list(raw_input()))

val_list = [S[0]]
exp_list = []

for i in xrange(1, len(S)):
    new_val_list = []
    new_exp_list = []
    for val in val_list:
        new_val_list.append(val + S[i])
        new_exp_list.append([val, S[i]])
    for exp in exp_list:
        new_val_list.append(exp[0] + (exp[1] * 10 + S[i]))
        new_exp_list.append([exp[0], exp[1] * 10 + S[i]])
    new_val_list.append(int(''.join(map(str, S[:i+1]))))
    val_list = new_val_list
    exp_list = new_exp_list

print sum(val_list)

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

using namespace std;

#define forn(i,l,r) for (int i=(l); i<(r); ++i)
#define sz(x) (int)(x).size()
#define dbg(x) cout << (#x) << ' ' << (x) << endl
#define str string

typedef long long int64;
typedef vector<int> vec_i;
typedef vector<int64> vec_ll;
typedef pair<int,int> pii;

const int MOD = 1000000007;
const int INF = 0x3f3f3f3f;

/*-------- CONSTANTS --------*/

int main() {
    int a, b, c;
    scanf("%i%i%i",&a,&b,&c);
    printf("%i %i %i",c,a,b);
}

Measured memory_bytes: 3796
package main

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

const (
	maxBufSize = 1024 * 1024
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

func main() {
	defer out.Flush()

	h := nextInt()
	w := nextInt()
	as := make([]string, h)
	for i := int64(0); i < h; i ++ {
		as[i] = next()
	}

	aas := make([]string, 0, h)
	ws := make([]bool, w)
	for _, a := range(as) {
		if !strings.Contains(a, "#") {
			continue
		}
		aas = append(aas, a)
		for x, c := range(a) {
			ws[x] = ws[x] || c == '#'
		}
	}

	for _, a := range(aas) {
		for x, c := range(a) {
			if ! ws[x] {
				continue
			}
			fmt.Fprintf(out, "%c", c)
		}
		fmt.Fprintln(out)
	}
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 1776
let rec seq a b = if a > b then [] else a :: seq (a+1) b
let rec take n = function
  | [] -> []
  | (x::xs) -> if n <= 0 then [] else (x :: take (n-1) xs)
let is_prime n = 
  let rec f d =
    if d * d > n then true
    else if n mod d = 0 then false
    else f (d+1) in
  n >= 2 && f 2
let () =
  let n = Scanf.scanf "%d" (fun x -> x) in
  seq 1 55555 |> List.filter (fun x -> is_prime x && x mod 5 = 1) |> take n
  |> List.iteri (fun i x -> (if i > 0 then print_string " "); print_int x);
  print_newline ()


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

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

    if(S == "Sunny"){
        cout << "Cloudy" << endl;
    }
    else if(S == "Cloudy"){
        cout << "Rainy" << endl;
    }
    else if(S == "Rainy"){
        cout << "Sunny" << endl;
    }
}

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

int main() {
  int A, B, C, D, R, L;
  cin >> A >> B >> C >> D;
  
  L = A + B;
  R = C + D;
  
  if (L > R){
      cout << "Left" << endl;
  }
  else if (R > L){
      cout << "Right" << endl;
  }
  else {
      cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

s = int(input())

seq = set()
seq.add(s)

_next = s
while True:
    if _next % 2 == 0:
        _next //= 2
    else:
        _next = _next * 3 + 1
    if _next in seq:
        break
    else:
        seq.add(_next)

print(len(seq) + 1)


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


typedef struct pp{
  char name[100];
  int t;
}P;

P Q[100000];
int head,tail,n;

void enqueue(P x){
  Q[tail]=x;
  tail=(tail+1)%100000;
}
P dequeue(){
  P x =Q[head];
  head=(head+1)%100000;
  return x;
}

int min(int a,int b){return a<b ? a:b;}
int main(){

  int elaps=0,c,i,q;
  P u;
  
  
  scanf("%d %d",&n,&q);

  for(i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);
  }
  head =1; tail =n+1;

  while(head !=tail){
    u= dequeue();
    c =min(q,u.t);
    u.t -=c;
    elaps +=c;
    if(u.t>0)enqueue(u);
    else{
      printf("%s %d\n",u.name,elaps);
    }
  }

  return 0;

}



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

int main(){
  int A, B, K, i;
  cin >> A >> B >> K;
  for(i=0; i<K; i++){
    if(i%2 == 0){
      A /= 2;
      B = A+B;
    }else{
      B /= 2;
      A = A+B;
    }
  }
  cout << A <<  " " << B << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

int main(){
    int x,y,z;
    cin >> x >> y >> z;
    cout << z<<" " << x <<" "<< y<< endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) v.begin(), v.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main() 
{
  int a, b; cin >> a >> b;
  if(a+b < 24){
    cout << a+b << endl;
  }
  else cout << (a+b)%24 << endl;
  system("pause");
}

Measured memory_bytes: 504
#!/usr/bin/env python3
#ABC74 D

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = [LI() for _ in range(n)]
ans = 0
for i in range(n):
    for j in range(i+1,n):
        ans += a[i][j]

for i in range(n):
    for j in range(i+1,n):
        for k in range(n):
            if i == k or j == k:
                continue
            if a[i][j] > a[i][k] + a[k][j]:
                print(-1)
                quit()
            if a[i][j] == a[i][k] + a[k][j]:
                ans -= a[i][j]
                break
print(ans)

Measured memory_bytes: 43356
#include <iostream>
#include <vector>
#include<string>
#include <set>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
	int N;
	int K;
	cin >> N >> K;
	int ans = 0;
	while(N>0){
		N /= K;
		ans++;
	}
	
	std::cout << ans << endl; 
	return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int n; cin >> n;
        vector<int> v;
        lp(i, n) { int a; cin >> a; v.push_back(a); }
        int an = 0;
        for (int i = 0; i < n; i++) {
                while(v[i]) {
                        bool b = 0;
                        for (int j = i; j < n && v[j]; j++) { b = 1; v[j]--; }
                        an += b;
                }
        }
        cout << an;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;


template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
  int h,w,k;
  cin>>h>>w>>k;
  vs c(h);
  REP(i, h) cin >> c[i];
  int mh = 1<<h;
  int mw = 1<<w;
  int ans = 0;
  REP(i, mh) {
    REP(j, mw) {
      int now = 0;
      REP(ii, h) {
        REP(jj, w) {
          int ih = i>>ii&1;
          int jw = j>>jj&1;
          if(ih || jw) continue;
          if(c[ii][jj] == '#') now++;
        }
      }
      if(now==k) ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <set>
using namespace std;

const int MAX_N=10000;
int n,c;

int main(){
	cin >> n >> c;
	cout << n*c << endl;
	return 0;
}

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

typedef long long ll;

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< typename G >
struct LowLink {
  const G &g;
  vector< int > used, ord, low;
  vector< int > articulation;
  vector< pair< int, int > > bridge;
 
  LowLink(const G &g) : g(g) {}
 
  int dfs(int idx, int k, int par) {
    used[idx] = true;
    ord[idx] = k++;
    low[idx] = ord[idx];
    bool is_articulation = false;
    int cnt = 0;
    for(auto &to : g[idx]) {
      if(!used[to]) {
        ++cnt;
        k = dfs(to, k, idx);
        low[idx] = min(low[idx], low[to]);
        is_articulation |= ~par && low[to] >= ord[idx];
        if(ord[idx] < low[to]) bridge.emplace_back(minmax(idx, (int) to));
      } else if(to != par) {
        low[idx] = min(low[idx], ord[to]);
      }
    }
    is_articulation |= par == -1 && cnt > 1;
    if(is_articulation) articulation.push_back(idx);
    return k;
  }
 
  virtual void build() {
    used.assign(g.size(), 0);
    ord.assign(g.size(), 0);
    low.assign(g.size(), 0);
    int k = 0;
    for(int i = 0; i < g.size(); i++) {
      if(!used[i]) k = dfs(i, k, -1);
    }
  }
};


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

    int n,m;
    cin >> n >> m;
    UnWeightedGraph g(n);
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    LowLink< UnWeightedGraph > lowlink(g);
    lowlink.build();
    sort(lowlink.bridge.begin(), lowlink.bridge.end());
    int ans = 0;
    for(auto &p : lowlink.bridge) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n, m = [int(i) for i in input().split()]
obs = []
idou = []
 
for i in range(m):
  obs.append(int(input()))
  
obs = set(obs)
  
#i段目にいる確率
for i in range(n+1):
  if i==0:
    idou.append(1)
  elif i==1 and not(i in obs):
    idou.append(1)
  elif i in obs:
    idou.append(0)
  else:
    tasu = idou[-1] + idou[-2]
    tasu = tasu%1000000007
    idou.append(tasu)
    
print(idou[-1])

Measured memory_bytes: 13216
#include <bits/stdc++.h>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define all(v)   v.begin(), v.end()
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define THINK_TWICE_CODE_ONCE cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define isOdd(n)    (n&1)
#define LLMAX LLONG_MAX
#define LLMIN LLONG_MIN
#define IMN INT_MIN
#define IMX INT_MAX
#define pow(n, m) power((ll)n, (ll)m)
#define numOfDigits(n)  ((n)? (ll)(log10(n)+1) : 1)
#define mem(x, val)    memset(x, val, sizeof(x))
#define MOD 1000000007

typedef long long ll;
typedef long double ld;
typedef double dd;
typedef string str;
typedef pair<int, int> pii;

int n;
string s, cur;
ll sum;
ll func(string x){
    //cout<<x<<endl;
    string tmp;
    stringstream ss(x);
    ll tot = 0;
    while(getline(ss, tmp, '+'))
        tot += stoll(tmp);
    //cout<<tot<<endl;
    return tot;
}
ll solve(int i, string cur, bool last){
    if(i==n) {
        //cout<<cur<<endl;
        return func(cur);
    }

    ll cnt = 0;
    cur.pb('+'), cur.pb(s[i]), cnt += solve(i+1, cur, 1);
    cur.pop_back(), cur.pop_back(), cur.push_back(s[i]);
    cnt += solve(i+1, cur, 0);
    return cnt;
}
int main()
{
    THINK_TWICE_CODE_ONCE
    //freopen("test cases\\.txt", "r", stdin) ;
    cin>>s;
    n = s.size();
    cur.pb(s[0]);
    cout<<solve(1, cur, 0)<<endl;
	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
const int mod = 1000000007;
struct mint {
ll x;
mint(ll x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint a) {
if ((x += mod-a.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res+=a;
}
mint operator-(const mint a) const {
mint res(*this);
return res-=a;
}
mint operator*(const mint a) const {
mint res(*this);
return res*=a;
}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
mint inv() const {
return pow(mod-2);
}
mint& operator/=(const mint a) {
return (*this) *= a.inv();
}
mint operator/(const mint a) const {
mint res(*this);
return res/=a;
}
};
struct combination {
vector<mint> fact, ifact;
combination(int n):fact(n+1),ifact(n+1) {
assert(n < mod);
fact[0] = 1;
for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
ifact[n] = fact[n].inv();
for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
}
mint operator()(int n, int k) {
if (k < 0 || k > n) return 0;
return fact[n]*ifact[k]*ifact[n-k];
}
};
vl prime(ll m){
    vl res;
    ll cm=m;
    for(int i=2;i*i<=m;i++){
        ll cnt=0;
        if(cm%i==0){
            while(cm%i==0){
                cm/=i;
                cnt++;
            }
            res.push_back(cnt);
        }
    }
    if(cm!=1) res.push_back(1);
    return res;
}
int main(){
    ll n,m;cin>>n>>m;
    vl p=prime(m);
    mint ans=1;
    
    combination c(110000);
    for(auto pp: p){
        ans*=c(pp+n-1,n-1);
    }
    cout<<ans.x<<endl;
    return 0;
}

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

int main() {

	int D, L;
	cin >> D >> L;
	int cnt = 0;
	int Ljump=0;
	int jump = 0;

	Ljump = D / L;
	jump = D%L;

	cout << Ljump + jump << endl;

	return 0;

}

Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;

ll n;
ll h[100005];

int main() {
    bool f = true;
    
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }

    ll maxv = h[0];
    for (int i = 1; i < n; i++) {
        if (maxv > h[i] + 1) {
            f = false;
        }

        maxv = max(h[i], maxv);
    }

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

    return 0;
}


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

int main(void){
    int a,b;
    double t;
    cin >> a >> b >> t;
    t += 0.5;
    
    int ans = 0;
    
    for(int i=1;i<30;i++){
        t -= a;
        if(t>0){
            ans += b;
        }
        else{
            break;
        }
    }
    
    cout << ans <<endl;
    
    return 0;
}
































Measured memory_bytes: 256
import java.util.*;

public class Main{

    static int mod = (int) 1e9 + 7;
    static int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
    static int INF = Integer.MAX_VALUE/2;

    public static void main(String args[]){

        Scanner scan = new Scanner(System.in);

        //Queue<int[]> q = new ArrayDeque<int[]>();
        Integer n = new Integer(scan.nextInt());
        ArrayList<Long> a = new ArrayList<Long>();

        for(int i=0;i<n;i++) a.add(scan.nextLong());
    
        Collections.sort(a);

        long bef = a.get(0);
        boolean flag = true;
        for(int i=1;i<a.size();i++){
            if(bef == a.get(i)){
                flag = false;
            }
            bef = a.get(i);
        }

        if(flag)
            System.out.println("YES");
        else
        System.out.println("NO");
    }

    static int factorial(int n){
        if(n == 0){
          return 1;
        }
        return n * factorial(n-1);
    }


}

Measured memory_bytes: 94892
#include <stdio.h>

int main() {
  int n, max = 0, ans = 0;
  scanf("%d", &n);
  int p[n];
  for (size_t i = 0; i < n; i++) {
    scanf("%d", p+i);
    ans += p[i];
    max = (max < p[i]) ? p[i] : max ;
  }
  printf("%d\n", ans - max/2);
  return 0;
}


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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    string ans = "No";
    if (a <= c && c <= b) ans = "Yes";
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define nn 65536*4
#define lf double
int n;int leng[nn];
int maxi,mini=12432342;int cnt[nn];
#define err {puts("Impossible");exit(0);}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&leng[i]);
		maxi=max(maxi,leng[i]);mini=min(mini,leng[i]);
		cnt[leng[i]]++;
	}
	if(n==2) 
	{
		puts("Possible");
		exit(0);	
	}
//	if(cnt[1]>=2) err;
	if(maxi%2==0)
	{
		if(mini!=maxi/2) err;
		for(int i=maxi;i>mini;i--) if(cnt[i]<2) err;
		if(cnt[mini]!=1) err;
	}
	else
	{
		if(mini!=maxi/2+1) err;
		for(int i=maxi;i>=mini;i--) if(cnt[i]<2) err;
		if(cnt[mini]!=2) err;
	}
	puts("Possible");
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl; 
    return 0;
}

Measured memory_bytes: 256
import os, sys, re, math

N,K = list(map(int,input().split(' ')))
trees = []

for _ in range(N):
	h = int(input())
	trees.append(h)

trees.sort(reverse=True)
ret = trees[0]

for i in range(N-K+1):
	tmp = trees[i] - trees[i+K-1]
	ret = min(ret, tmp)

print(ret)


Measured memory_bytes: 7712
n, m = map(int, input().split())
a = []

for i in range(n):
    a.append(list(map(int, input().split())))

b = []
for i in range(m):
    b.append(int(input()))
for i in range(n):
    c = 0
    for j in range(m):
        c += a[i][j] * b[j]
    print(c)



Measured memory_bytes: 6008
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
int main()
{
    char a[3];
    int i,s=700;
    for(i=0;i<3;i++)
        {
            scanf("%c",&a[i]);
            if(a[i]=='o')
             s=s+100;
        }

    printf("%d",s);
    return 0;
}


Measured memory_bytes: 256
import itertools

n,m,q = map(int, input().split())
numbers_list = [list(map(int, input().split())) for _ in range(q)]
ans = 0

def saitenn(suuretu):
    global numbers_list
    score = 0
    for numbers in numbers_list:
        a = numbers[0] - 1
        b = numbers[1] - 1
        c = numbers[2]
        d = numbers[3]

        if suuretu[b] - suuretu[a] == c:
            score += d
    return score

for A in itertools.combinations_with_replacement(range(1, m+1), n):
    score = saitenn(A)
    ans = max(ans, score)

print(ans)


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

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

typedef long long int ll;

const ll INF=(ll)1e18;

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



Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		String S = sc.next();

		sc.close();

		if (N % 2 != 0) {
			out.println("No");
		} else {
			String a = S.substring(0, N / 2);
			String b = S.substring(N / 2);
			if (a.equals(b)) {
				out.println("Yes");
			} else {
				out.println("No");
			}

		}

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 21972
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <locale>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

ll factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
    }
    return ans;
}

ll extended_factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
        ans %= (ll)(1e9+7);
    }
    return ans;
}

vector<ll> Eratosthenes(ll N){
    bool arr[N+1];
    //initialization
    arr[0] = false;
    arr[1] = false;
	for(ll i = 2; i < N+1; i++){
		arr[i] = true;
	}
    //eratosthenes
	for(ll i = 2; i <= sqrt(N); i++){
		if(arr[i]){
			for(ll j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = false;//not prime number
			}
		}
	}
    vector<ll> prime;
    llRep(i,N){
        if (arr[i]==true){
            prime.push_back(i);
        }
    }
    return prime;
}

char alphabet[] = {
    'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'
};

// 二分探索
// llrep(i,N){
//     b = B[i];
//     auto cntA = lower_bound(A.begin(), A.end(), b);//イテレータなのでそのままllに変換とかはできない
//     auto cntC = upper_bound(C.begin(), C.end(), b);
//     ll cntA_ll = distance(A.begin(), cntA);
//     ll cntC_ll = C.size() - distance(C.begin(), cntC);
//     cnt += (cntA_ll * cntC_ll);
// }

// ll A[200002],B[200002];

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

int main(){
    ll r, D, x, cur;
    cin >> r >> D >> x;
    ll prev = x;
    llrep(i,10){
        cur = r * prev - D;
        cout << cur << endl;
        prev = cur;
    }
    return 0;
}


Measured memory_bytes: 256