akhauriyash/Code-Regression huggingface dataset:
/********************************
*MAHBUBCSEJU                    *
*CSE 22                         *
*JAHANGIRNAGAR UNIVERSITY       *
*TIMUS:164273FU                 *
*UVA>>LIGHTOJ>>HUST:mahbubcseju */
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d\n",a)
#define PL(a) printf("%lld\n",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())
//#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
template <class T>string NTS ( T Number )
{
    stringstream ss;
    ss << Number;
    return ss.str();
}
template <class T>T stringtonumber ( const string &Text )
{
    istringstream ss(Text);
    T result;
    return ss >> result ? result : 0;
}
template <class T>bool ISLEFT ( T a,T b,T c)
{
    if(((a.xx-b.xx)*(b.yy-c.yy)-(b.xx-c.xx)*(a.yy-b.yy))<0.0)return 1;//Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
#define mx 100000
#define md 1000000007ll
#define maxp 2050180000

typedef pair<int ,int > P;

////////define value/////
ll fac[200002];
ll n,m;
ll res(ll i,ll b)
{
    ll x=(fac[i-1]*fac[b-1])%md;
    x=mdINV(x,md);
    x=fac[i-1+b-1]*x;
    x%=md;
    return x;
}
int main()
{


    L2(n,m);
    ll a,b;
    L2(a,b);
    fac[0]=1ll;
    for(ll i=1; i<=2*mx; i++)fac[i]=(i*fac[i-1])%md;
    ll ans=0;
    for(ll i=1; i<=n-a; i++)
    {

        ll re=res(i,b);
       // cout<<re<<endl;
       // cout<<n-i+1<<" "<<m-b<<endl;
        re=re*res(n-i+1,m-b);

        re%=md;
        ans+=re;
        ans%=md;
    }
    PL(ans);

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

vector<int> E[100000];
int D[100000];

bool dfs(int cur, int to, vector<int>& path) {
    if (cur == to) return true;
    vector<int> res;
    rep(i, E[cur].size()) {
        if (D[E[cur][i]-1] != -1) continue;
        path.emplace_back(E[cur][i]);
        D[E[cur][i]-1] = D[cur] + 1;
        if (dfs(E[cur][i], to, path)) return true;
        path.pop_back();
    }
    return false;
}

void paint(int from, int mine, vector<int>& used) {
    vector<int> e = E[from];
    rep(i, e.size()) {
        if (e[i] != from && used[e[i] - 1] == 0) {
            used[e[i] - 1] = mine;
            paint(e[i], mine, used);
        }
    }
}

int main() {
    int N; cin >> N;
    rep(i, N-1) {
        int a,b; cin >> a >> b;
        E[a].emplace_back(b);
        E[b].emplace_back(a);
    }
    vector<int> path;
    path.emplace_back(1);
    fill(D, D+100000, -1);
    D[0] = 0;
    int s = dfs(1, N, path);
    if (s == 0) {
        fprintf(stderr, "No path to N found.");
        exit(1);
    }

    vector<int> used(N);
    used[0] = 1;
    used[N-1] = -1;
    int fs = 1;
    int ss = 1;

    int tmp = path.size();
    for (int i = 1; i < (tmp + 1) / 2; i++) {
        used[path[i] - 1] = 1; fs++;
        if (used[path[tmp -1 - i] - 1] == 0) {
            used[path[tmp -1 - i] - 1] = -1; ss++;
        }
    }

    int fp = 1;
    int fonp = 0;
    int sp = N;
    int sonp = path.size() - 1;
    while (used[fp - 1] != -1) {
        paint(fp, 1, used);
        fonp++;
        fp = path[fonp];
    }

    while (used[sp - 1] != 1) {
        paint(sp, -1, used);
        sonp--;
        sp = path[sonp];
    }

    fs = std::count(used.begin(), used.end(), 1);
    ss = used.size() - fs;
    if (fs > ss) {
        cout << "Fennec" << endl;
    } else {
        cout << "Snuke" << endl;
    }
}


Measured memory_bytes: 14840
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define ARRAY_LENGTH( array ) ( sizeof( array ) / sizeof( array[ 0 ] ))

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	int N;
	cin >> N;
	string a, b;
	cin >> a >> b;
	string ans(N*2, 'a');
	rep(i,0, N){
		ans[i*2] = a[i];
		ans[i*2+1] = b[i];
	}
	cout << ans << endl;

}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}


Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main()
{
	int n, max = 0, min = 1e8, i, a, b, c = 0, d;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d %d", &a, &b);
		if (min > a) {
			min = a;
		}
		if (max < a) {
			max = a;
			c = b;
		}
	}

	d = (max - min + 1) + (min - 1) + c;

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

	return 0;
}

Measured memory_bytes: 128
package main

import "fmt"

func main() {
	var N int
	var a int
	set := make(map[int]struct{})
	fmt.Scanf("%d", &N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &a)
		if _, ok := set[a]; ok {
			fmt.Println("NO")
			return
		}
		set[a] = struct{}{}
	}
	fmt.Println("YES")
}


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

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

int main()
{

    int n;
    cin >> n;
    map<int, string> mp;
    P d[105];
    REP(i, n)
    {
        string s;
        int p;
        cin >> s >> p;

        //        mp.insert(make_pair(p, s));
        d[i] = make_pair(make_pair(s, -p), i);
    }

    sort(d, d + n);
    for (auto i = 0; i < n; i++)
    {
        cout << d[i].second + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int cx = 0, cy = 0, ct = 0;
            for (int i = 0; i < n; i++) {
                int t = in.nextInt() - ct;
                int x = in.nextInt();
                int y = in.nextInt();

                int dist = Math.abs(cx - x) + Math.abs(cy - y);
                if (dist <= t && (t - dist) % 2 == 0) {
                    cx = x;
                    cy = y;
                    ct = t + ct;
                } else {
                    out.println("No");
                    return;
                }
            }
            out.println("Yes");
        }

    }

    static class InputReader {
        final InputStream is;
        final byte[] buffer = new byte[1024];
        int curCharIdx;
        int nChars;

        public InputReader(InputStream is) {
            this.is = is;
        }

        public int read() {
            if (curCharIdx >= nChars) {
                try {
                    curCharIdx = 0;
                    nChars = is.read(buffer);
                    if (nChars == -1) {
                        return -1;
                    }
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return buffer[curCharIdx++];
        }

        public int nextInt() {
            int sign = 1;
            int c = skipDelims();
            if (c == '-') {
                sign = -1;
                c = read();
                if (isDelim(c)) {
                    throw new RuntimeException("Incorrect format");
                }
            }
            int val = 0;
            while (c != -1 && !isDelim(c)) {
                if (!isDigit(c)) {
                    throw new RuntimeException("Incorrect format");
                }
                val = 10 * val + (c - '0');
                c = read();
            }
            return val * sign;
        }

        private final int skipDelims() {
            int c = read();
            while (isDelim(c)) {
                c = read();
            }
            return c;
        }

        private static boolean isDelim(final int c) {
            return c == ' ' ||
                   c == '\n' ||
                   c == '\t' ||
                   c == '\r' ||
                   c == '\f';
        }

        private static boolean isDigit(final int c) {
            return '0' <= c && c <= '9';
        }

    }
}



Measured memory_bytes: 32844
n, m = gets.split.map(&:to_i)
cond = m.times.map {
  k, *ss = gets.split.map(&:to_i)
  bit = 0
  ss.each {|s| bit = bit | (1 << (s - 1))}
  bit
}
ps = gets.split.map(&:to_i)

count = 0
(2 ** n).times do |switches|
  f = cond.map.with_index {|c, i| (switches & c).to_s(2).count("1") % 2 == ps[i]}.all?
  count += 1 if f
end

puts count

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e3 + 5;
const int M = 2e4 + 5;

int a[N], b[N];
int dp[N][M];

int main()
{
    int h, n;
    cin >> h >> n;
    for(int i = 1; i <= n; ++i) 
        cin >> a[i] >> b[i];
    memset(dp, 0x3f, sizeof dp);
    dp[0][0] = 0;
    for(int i = 1; i <= n; ++i) {
        for(int j = 0; j <= h; ++j) {
            dp[i][j] = min(dp[i - 1][j], dp[i][max(0, j - a[i])] + b[i]);
        }
    }
    cout << dp[n][h] << endl;
    return 0;
}

Measured memory_bytes: 78848
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long k = sc.nextLong();
		HashMap<Long, Long> map = new HashMap<>();
		for(long n2 = 1 ; n2 <= k ; n2++) {
			long n = n2;
		for(long i = 2 ; i <= Math.sqrt(n) ; i++) {
			if(n % i != 0)
				continue;
			n /= i;
			map.put(i, map.getOrDefault(i,  0L) + 1L);
			if(n == 1)
				break;
          i--;
		}
      if(n != 1) {
        map.put(n, map.getOrDefault(n,  0L) + 1L);
        }
      }
      int num74 = 0;
      int num24 = 0;
      int num14 = 0;
      int num4 = 0;
      int num2 = 0;

      for(long l : map.keySet()) {
    	 long num = map.get(l);
    	 if(num >= 74) {
    		 num74++;
    	 }
    	 else if(num >= 24) {
    		 num24++;
    	 }
    	 else if(num >= 14) {
    		 num14++;
    	 }
    	 else if(num >= 4) {
    		 num4++;
    	 }
    	 else if(num >= 2) {
    		 num2++;
    	 }
  	    }
      int count = 0;
      count += num74; //75
      if(num2 + num4 + num14 + num24 + num74 >= 2)
      count += (num2 + num4 + num14 + num24 + num74 - 1) * (num24 + num74); // 3 * 25
      if(num2 + num4 + num14 + num24 + num74 >= 3 && num4 + num14 + num24 + num74 >= 2)
      count += (num2 + num4 + num14 + num24 + num74 - 2) * (num4 + num14 + num24 + num74) * (num4 + num14 + num24 + num74 - 1) / 2; // 3 * 5 * 5
      if(num4 + num14 + num24 + num74 >= 2)
      count += (num4 + num14 + num24 + num74 - 1) * (num14 + num24 + num74); // 5 * 15
      System.out.println(count);
	}
	public static long pow(long ml, long a, long b){
    if(b == 1)
      return ml;
      ml *= a;
      b--;
		return b == 0 ? ml : pow(ml , a ,b);
	}
}



Measured memory_bytes: 35804
n = int(input())
A = list(map(int,input().split()))
ans = 0

import collections
c = collections.Counter(A)

A = sorted(set(A))

for i in A:
    a = c[i]
    
    if a > i:
        ans += a-i
        
    elif a < i:
        ans += a
        
print(ans)

Measured memory_bytes: 20580
count = {'AC':0,'WA':0,'TLE':0,'RE':0}
N = int(input())
for _ in range(N):
    S = str(input())
    count[S] += 1
print('AC x {}'.format(count['AC']))
print('WA x {}'.format(count['WA']))
print('TLE x {}'.format(count['TLE']))
print('RE x {}'.format(count['RE']))

Measured memory_bytes: 9204
#include<iostream>
using namespace std;
int main()
{
  int x[5];
  for(int i=0;i<5;i++)
  {
    cin>>x[i];
  }
  int ans;
  for(int i=0;i<5;i++)
  {
    if(x[i]==0) ans=i+1;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3584
#include <stdio.h>
#include <iostream>
using namespace std;

int main(){
    int* a=new int[4];
    for(int i=0;i<4;i++){
        cin>>a[i];
    }
    if((a[0]+a[1])<(a[2]+a[3])){
        cout<<"Right"<<endl;
    }else if((a[0]+a[1])>(a[2]+a[3])){
        cout<<"Left"<<endl;
    }else{
        cout<<"Balanced"<<endl;
    }
    
    return 0;
}


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

int main(){
  long long N;
  cin >> N;
  string ans;
  while(N > 0){
    --N;
    ans += (N%26) + 'a';
    N /= 26;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}


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

using namespace std;

int main(){
	int N;
	cin >> N;
	vector<int> A;

	int sort_A[N];

	for (int n=0; n<N; n++){
		int a;
		cin >> a;
		A.push_back(a);
	}

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

	if (N % 2 == 0){
		for (int n=0; n<N; n++){
			if (n % 2 == 0){
				sort_A[n] = A[(N - n)/2 - 1];
			}
			else{
				sort_A[n] = A[N - (1+n)/2];
			}
		}
	}
	else{
		if (A[(N+1)/2]- A[(N-1)/2] < A[(N-1)/2] - A[(N-3)/2]){
			sort(A.begin(), A.end(), greater<int>());
		}

		sort_A[0] = A[(N-1)/2];
		for (int n=1; n<N; n++){
			if (n % 2 == 0){
				sort_A[n] = A[n/2 - 1];
			}
			else{
				sort_A[n] = A[N - (1+n)/2];
			}
		}
	}

	long long ans = 0;

	for (int n=1; n<N; n++){
		ans += abs(sort_A[n] - sort_A[n-1]);
	}

	cout << ans << endl;
}

Measured memory_bytes: 1144
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define db double
#define pint pair<int,int>
#define mk make_pair
#define pb push_back
#define eb emplace_back
#define ins insert
#define fi first
#define se second
#define Rep(x,y,z) for(int x=y;x<=z;x++)
#define Red(x,y,z) for(int x=y;x>=z;x--)
using namespace std;
const int MAXN=1e3+5;
char buf[1<<12],*pp1=buf,*pp2=buf,nc;int ny;
inline char gc() {return pp1==pp2&&(pp2=(pp1=buf)+fread(buf,1,1<<12,stdin),pp1==pp2)?EOF:*pp1++;}
//inline char gc(){return getchar();}
inline int read(){
	int x=0;for(ny=1;nc=gc(),(nc<48||nc>57)&&nc!=EOF;)if(nc==45)ny=-1;if(nc<0)return nc;
	for(x=nc-48;nc=gc(),47<nc&&nc<58&&nc!=EOF;x=(x<<3)+(x<<1)+(nc^48));return x*ny;
}
int n,m=40,p1[30],p2[30],type;ll c[50];pint a[MAXN];
inline void print(pint x){
	int Mx=19-type;
	int opta=0,optb=0,a=x.fi,b=x.se;
	if(a<0)opta=1,a=-a;if(b<0)optb=1,b=-b;
	memset(p1,0,sizeof(p1)),memset(p2,0,sizeof(p2));
	for(int t=a,i=0;t;p1[i]=t%3,t/=3,i++);
	for(int t=b,i=0;t;p2[i]=t%3,t/=3,i++);
	Rep(i,0,Mx){
		if(p1[i]&&p2[i]){
			if(p1[i]==1)putchar("RL"[opta]);
			else{
				putchar("LR"[opta]),p1[i+1]++;
				for(int t=i+1;p1[t]>=3;p1[t]-=3,p1[t+1]++,t++);
			}
			if(p2[i]==1)putchar("UD"[optb]);
			else{
				putchar("DU"[optb]),p2[i+1]++;
				for(int t=i+1;p2[t]>=3;p2[t]-=3,p2[t+1]++,t++);
			}
		}else if(p1[i]){
			if(p1[i]==1){
				putchar("LR"[opta]),putchar("LR"[opta]),p1[i+1]++;
				for(int t=i+1;p1[t]>=3;p1[t]-=3,p1[t+1]++,t++);
			}else putchar("RL"[opta]),putchar("RL"[opta]);
		}else if(p2[i]){
			if(p2[i]==1){
				putchar("DU"[optb]),putchar("DU"[optb]),p2[i+1]++;
				for(int t=i+1;p2[t]>=3;p2[t]-=3,p2[t+1]++,t++);
			}else putchar("UD"[optb]),putchar("UD"[optb]);
		}else putchar('L'),putchar('R');
	}if(type){
		if(p1[19])putchar("RL"[opta]);
		else if(p2[19])putchar("UD"[optb]);
	}
	puts("");
}
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	n=read();
	Rep(i,1,n)a[i].fi=read(),a[i].se=read();type=(abs(a[1].fi)+abs(a[1].se))%2;
	Rep(i,1,n)if((abs(a[i].fi)+abs(a[i].se))%2!=type)return puts("-1"),0;
	m-=type;cout<<m<<'\n';int tmp=1;
	Rep(i,1,20)c[i*2-1]=c[i*2]=tmp,tmp*=3;
	Rep(i,1,m)cout<<c[i]<<" ";cout<<'\n';
	Rep(i,1,n)print(a[i]);
	return 0;
}





Measured memory_bytes: 3640
h,w = gets.split.map(&:to_i)
a = []
h.times do
  a << gets.split("")
end
buf = []
buf.push([0,0,1])
mem = Array.new(h){Array.new(w,false)}
minr = false
while(!buf.empty?())
  now = buf.shift
  y, x = now[0],now[1]
  next if(y < 0 or x < 0 or w <= x or h <= y or a[y][x] == "#" or mem[y][x])
  if([y, x] == [(h-1), (w-1)])
    minr = now[2]
    break
  end
  mem[y][x] = true
  buf.push([y + 1, x, now[2] + 1])
  buf.push([y, x + 1, now[2] + 1])
  buf.push([y - 1, x, now[2] + 1])
  buf.push([y, x - 1, now[2] + 1])
end
puts (minr)? h * w - minr - a.flatten.count("#") : -1

Measured memory_bytes: 2172
object Main extends App {
  val src = io.Source.stdin.getLines

  def gcd(i: Long, reminder: Long): Long =
    if (reminder == 0) i else gcd(reminder, i % reminder)

  def lcm(n: Long, m: Long): Long = (n*m) / gcd(m, n)

  for (str <- src) {
    val Array(n, m) = str.split(" ").map(_.toLong)
    println(s"${gcd(n, m)} ${lcm(n, m)}")
  }
}

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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

    int Alice = 0;
    int Bob = 0;
    sort(all(a),greater<int>());
    rep(i,N)
    {
        if((i+2)%2==0) Alice += a[i];
        else Bob += a[i];
    }
    cout << Alice - Bob << endl;
}


Measured memory_bytes: 256
def main():
  import itertools
  n,m=map(int,input().split())
  li=[list(map(int,input().split()))[1:] for _ in range(m)]
  li=[set(x) for x in li]
  p=list(map(int,input().split()))
  
  q=set()
  for x in li:
    q|=x
  
  r=set(range(1,n+1))
  v=r-q
  
  ans=0
  
  for i in range(0,len(q)+1):
    for s in itertools.combinations(q,i):
      s=set(s)
      for j,t in enumerate(li):
        u=s&t
        if len(u)%2==p[j]:
          continue
        else:
          break
      else:
        ans+=2**(len(v))
   
  print(ans)
  
  
if __name__=="__main__":
  main()

Measured memory_bytes: 3064
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    A = LI()

    # dct = defaultdict(lambda: 0)
    # for a in A:
    #     dct[a] += 1
    # print(dct)
    MOD = 1000000007
    sm = sum(A)
    ans = 0
    for a in A[:-1]:
        sm -= a
        # print(sm)
        ans += a * sm
        ans %= MOD

    print(ans % MOD)



if __name__ == '__main__':
    solve()



Measured memory_bytes: 32532
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	K := sc.nextInt()
	ans := 0
	var dp [201][201]int
	for i := 0; i < 201; i++ {
		for j := 0; j < 201; j++ {
			dp[i][j] = -1
		}
	}
	for i := 1; i <= K; i++ {
		for j := 1; j <= K; j++ {
			for k := 1; k <= K; k++ {
				ans += gcd(gcd(i, j), k)
			}
		}
	}

	fmt.Fprintln(wtr, ans)
}


Measured memory_bytes: 1780
# 二項係数nCk mod p
# 前処理
MOD = 10**9 + 7
@fac, @finv, @inv = [], [], []
def comInit
    @fac[0] = @fac[1] = 1
    @finv[0] = @finv[1] = 1
    @inv[1] = 1
    (2...(10 ** 6)).each {|i|
        @fac[i] = @fac[i-1] * i % MOD
        @inv[i] = MOD - @inv[MOD % i] * (MOD / i) % MOD
        @finv[i] = @finv[i-1] * @inv[i] % MOD
    }
end

def com n, k
    if (n < k)
        return 0
    end
    if (n < 0 || k < 0)
        return 0
    end
    return @fac[n] * (@finv[k] * @finv[n - k] % MOD) % MOD;
end

X, Y = gets.split(' ').map(&:to_i)

def func x, y
    a = (2 * x - y) / 3
    b = (2 * y - x) / 3
    return a, b
end

if (X + Y) % 3 != 0
    puts 0
    exit
end

A, B = func X, Y

comInit

puts (com A + B, B)

Measured memory_bytes: 31276
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define N 1000000007
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,i,sum = 0,ans,ts = 0;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        sum += a[i];
    }
    ans = sum;
    for(i=0;i<n;i++)
    {
        sum -= a[i];
        ts += a[i];
        ans = min(ans, abs(sum-ts));
    }
    cout<<ans;
    return 0;
}

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

void fun(int n, string text){
    for(int i = 0; i < text.length(); i++){
        int s;
            char q;
            s = text.at(i) + n;
            if(s > 90){
                int f = s - 91;
                s = f + 65;
            }
            q = (char) s;
            cout<<q;
    }
}
int main()
{
    int n;
    string text;
    cin>>n;
    cin>>text;
    fun(n, text);
    return 0;
}


Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
signed main(){
  string s;
  cin >> s;
  int idx=0;
  char vls[30]={};
  for(char c:s){
    if(c=='B') idx = max(0,idx-1);
    else{
      vls[idx++] = c;
    }
  }
  for(int i=0;i<idx;i++) cout << vls[i];
  cout << endl;
}


Measured memory_bytes: 256
card = {
	'S':[1,2,3,4,5,6,7,8,9,10,11,12,13],
	'H':[1,2,3,4,5,6,7,8,9,10,11,12,13],
	'C':[1,2,3,4,5,6,7,8,9,10,11,12,13],
	'D':[1,2,3,4,5,6,7,8,9,10,11,12,13],
	}
dr = ['S','H','C','D']

n = int(raw_input())

for i in xrange(n):
	fffff,ddddd = map(str,raw_input().split())
	card[fffff].remove(int(ddddd))
	
for var in card:
	card[var].sort()
	
for var in dr:
	for i in xrange(len(card[var])):
		print var,card[var][i]

Measured memory_bytes: 6428
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define fill(a,val) memset(a,val,sizeof(a))
#define REP(i,a,b) for (auto i = a; i < b; i++)
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 998244353
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define pb push_back
#define SQ(a) (a)*(a)
#define M 315
using namespace std;

int main()
{
    std::ios::sync_with_stdio(false);
    
    ll n;
    cin>>n;
    vector<int> a(n);
    vi b(n);
    vi c(n);
    REP(i,0,n)
    {
        cin>>a[i];
    }
    REP(i,0,n)
    {
        cin>>b[i];
    }
    REP(i,0,n-1)
    {
        cin>>c[i];
    }
    ll ans = 0;
    ans += b[a[0]-1];

    for(int i = 1;i<n;i++)
    {
        ans += b[a[i]-1];
        if(a[i-1] == a[i] - 1)
        {
            ans += c[a[i-1] - 1];
        }
    }
    cout<<ans<<endl;
}





Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
#define fin(ans) cout << (ans) << endl
const int INF = 1<<30;
const ll MOD = 1000000007;

ll calcNumOfCombination(int n, int r){
        ll num = 1;
        for(int i = 1; i <= r; i++){
            num = num * (n - i + 1) / i;
        }
        return num;
}

int main() {
    ll N,sum;
    string S;
    cin >> N >> S;
    ll r=0,g=0,b=0;
    for (int i = 0; i < N; i++){
        if(S[i]=='R') r++;
        if(S[i]=='G') g++;
        if(S[i]=='B') b++;
    }
    sum=r*g*b;
    for (int i = 0; i < N-1; i++){
        for(int j=i+1; j < N; j++){
            if(2*j-i<N){
               if(S[2*j-i]!=S[i]&&S[i]!=S[j]&&S[2*j-i]!=S[j]) sum--;
            }
        }
        
    } 
    cout << sum << endl;
}

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

int main(){
	int n, runner, run, out, i;
	char str[7];
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		runner = run = out = 0;
		while(1){
			scanf("%s", &str);
			if(str[0] == 'H'){
				if(str[1] == 'I'){
					runner++;
					if(runner == 4){
						run++;
						runner--;
					}
				}else{
					run += runner + 1;
					runner = 0;
				}
			}else{
				out++;
				if(out == 3) break;
			}
		}
		printf("%d\n", run);
	}
	return 0;
}

Measured memory_bytes: 596
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i ++)
    {
        if(s[i] + n <= 'Z')
            s[i] += n;
        else
        {
            s[i] = s[i] + n - 'Z' + 'A' - 1;
        }
    }
    cout << s;
    return 0;
}


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

#define range 524289
#define mod 1000000007
#define eps 1e-9
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define _ <<" "<<

using namespace std;

typedef  long long int ll;
typedef vector <ll> vi;
typedef vector<vi> vvi;
typedef pair <ll, ll> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
typedef vector<iii> viii;



int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	int t = 1;
	// cin>>t;
	while(t--){

        int n, k;
        cin>>n;
        vi a(n);
        ll sum = 0;
        for (int i = 0; i < n; ++i)
        {
            /* code */
            cin>>a[i];
            sum += a[i];
        }
        vvi dp(n, vi(n));
        k = 0;


        for(int l=n-1; l>=0; l--){
            for(int r=l; r<n; r++){
                dp[l][r] = max(a[l]-(l+1<=r ? dp[l+1][r]:0), a[r]-(r-1>=l?dp[l][r-1]:0));
            }
        }
        cout<<dp[0][n-1];




	}

    return 0;
}


Measured memory_bytes: 70784
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  string s;
  cin >> s;

  int n = s.size();
  int cnt = 0;
  int j = n-1;
  rep(i,n/2){
    if(s[i]!=s[i+j]) cnt++;
    j-=2;
  }
  cout << cnt << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<sstream>
#include<vector>
#include<map>
#include<cctype>
#include<cstdlib>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
const int N = 26;

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

map<char, char> makeMap(int a, int b){
    map<char, char> ret;
    REP(i, N){
        char bef = 'a' + i;
        char aft = 'a' + ((a * i + b) % N);
        ret[bef] = aft;
    }
    return ret;
}

bool isAns(string str){
    vector<string> v;
    stringstream ss(str);
    string tmp;
    while(getline(ss, tmp, ' ')) v.push_back(tmp);
    REP(i, v.size()) if(v[i] == "that" || v[i] == "this") return true;
    return false;
}

string findAns(string str){
    if(isAns(str)) return str;
    FOR(a, 1, N){
        if(gcd(N, a) != 1) continue;
        FOR(b, 1, N){
            map<char, char> m = makeMap(a, b);
            string tmp = str;
            REP(i, tmp.length()) if(isalpha(tmp[i])) tmp[i] = m[tmp[i]];
            if(isAns(tmp)) return tmp;
        }
    }
    return "error";
}


int main(){
    int n; cin >>n;
    string str;
    getline(cin, str);
    REP(z, n){
        getline(cin, str);
        cout <<findAns(str) <<endl;
    }
    return 0;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t n,d;
  cin>>n>>d;
  int c=0;
  for(int _=0;_<n;_++){
    int64_t x,y;
    cin>>x>>y;
    c+=(x*x+y*y<=d*d?1:0);
  }
  cout<<c<<endl;
}

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

int main(){
    int n;
    cin >> n;
    int P[n];
    for(int i = 0; i < n; i++){
        cin >> P[i];
    }
    int count = 0;
    for(int i = 1 ; i < n-1; i++){
        if((P[i-1] < P[i] && P[i] < P[i+1]) || (P[i-1] > P[i] && P[i] > P[i+1])){
            count += 1;
        }
    }
    cout << count << endl;    
    return 0;
}


Measured memory_bytes: 256
import itertools


def main():
    n,m,q = map(int,input().split())
    C_list = [list(map(int,input().split())) for _ in range(q)]

    A_list = itertools.combinations_with_replacement(range(1,m+1),n)
    ans = 0
    for A in A_list:
        tmp = 0
        for C in C_list:
            if A[C[1]-1]-A[C[0]-1] == C[2]:
                tmp += C[3]
        ans = max(ans,tmp)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 67888
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if a <= b:
    if w >= v:
        print('NO')
    else:
        if a + v * t >= b + w * t:
            print('YES')
        else:
            print('NO')
else:
    if w >= v:
        print('NO')
    else:
        if a - v * t <= b - w * t:
            print('YES')
        else:
            print('NO')

Measured memory_bytes: 61780
#include<iostream>
#include<vector>
#include<cstring>
#define inf 1000000
using namespace std;
int n;
int dp[1000000];
int h[100000];
int min_cost(int i)
{
    if(i == n)
        return 0;
    if(i>n)
        return inf;
    if(dp[i] != -1)
        return dp[i];
    dp[i] = min(min_cost(i+1)+abs(h[i]-h[i+1]), min_cost(i+2)+abs(h[i]-h[i+2]));
    return dp[i];
}
int main()
{
    memset(dp,-1,sizeof(dp));
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>h[i];
    cout<<min_cost(1);
    return 0;
}


Measured memory_bytes: 6144
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            consoleReader.ReadLine();
            var As = consoleReader.ReadLineSplitInt32();

            bool evenMinus;
            int min = (evenMinus = (As[0] >= 0)) ? As[0] : -As[0];

            ulong res = 0;

            for (int i = 1; i < As.Length; i++)
            {
                int a = As[i];
                if(a < 0)
                {
                    evenMinus = !evenMinus;
                    a = -a;
                }


                if (a < min)
                {
                    res += (ulong)min;
                    min = a;
                }
                else
                {
                    res += (ulong)a;
                }
            }

            if (evenMinus)
            {
                res += (ulong)min;
            } else
            {
                res -= (ulong)min;
            }

            return res;
        }

        private readonly ConsoleReader consoleReader;
        public Program() : this(new ConsoleReader()) { }
        public Program(ConsoleReader consoleReader)
        {
            this.consoleReader = consoleReader;
        }
        static void Main() => Console.WriteLine(new Program().Calc());
    }

    public class ConsoleReader
    {
        public virtual string ReadLine() => Console.ReadLine();
        public int ReadLineInt32() => int.Parse(ReadLine());
        public long ReadLineInt64() => long.Parse(ReadLine());
        public ulong ReadLineUInt64() => ulong.Parse(ReadLine());
        public double ReadLineDouble() => double.Parse(ReadLine());
        public string[] ReadLineSplit() => ReadLine().Split().ToArray();
        public int[] ReadLineSplitInt32() => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public long[] ReadLineSplitInt64() => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public ulong[] ReadLineSplitUInt64() => ReadLine().Split().Select(s => ulong.Parse(s)).ToArray();
        public double[] ReadLineSplitDouble() => ReadLine().Split().Select(s => double.Parse(s)).ToArray();

        public IEnumerable<string> RepeatReadLines(int count)
        {
            for (int i = 0; i < count; i++)
                yield return ReadLine();
        }
        public IEnumerable<int> RepeatReadLinesInt32(int count)
        {
            for (int i = 0; i < count; i++)
                yield return ReadLineInt32();
        }
        public IEnumerable<string[]> RepeatReadLinesSplit(int count)
        {
            for (int i = 0; i < count; i++)
                yield return ReadLineSplit();
        }
    }
    static class DicExt
    {
        public static double GetOrDefault(this Dictionary<int, double> dic, int key)
        {
            double val;
            return dic.TryGetValue(key, out val) ? val : 1;
        }
    }
}


Measured memory_bytes: 30172
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define forinc(i,a,b) for(int i=a;i<=b;++i)
#define fordec(i,a,b) for(int i=a;i>=b;--i)
#define fi first
#define se second
#define pii pair<int,int>

const int maxn=2e5+10;
int n,a[maxn];
set<int> cnt[maxn];
int ret;
int d[maxn];
main()
{
    //freopen("test")
    cin>>n;
    forinc(i,1,n) {cin>>a[i];cnt[a[i]].insert(i);}
    forinc(i,1,n) if(cnt[i].size()>=2)
    {
        int tmp=cnt[i].size();
        ret+=tmp*(tmp-1)/2;
        d[i]=(tmp*(tmp-1)/2)-((tmp-1)*(tmp-2)/2);
    }
    forinc(i,1,n)
    {
        cout<<ret-d[a[i]]<<"\n";
    }
}


Measured memory_bytes: 23424
#include <iostream>

using namespace std;

int64_t calc(int64_t width,int64_t height){
  if(height > width){
    const int64_t q = height / width;
    const int64_t r = height % width;
    //cout << "(" << width << ", " << height << ")\n";
    if(r == 0)
      return 2 * q * width - width;
    else
      return 2 * q * width + calc(width,r);
  }else if(height < width){
    //cout << "(" << width << ", " << height << ")\n";
    const int64_t q = width / height;
    const int64_t r = width % height;
    if(r == 0)
      return 2 * q * height - height;
    else
      return 2 * q * height + calc(r,height);
  }else{
    return height;
  }
  /*
  if(height > width)
    return 2 * width + calc(width,height - width);
  else if(height < width)
    return 2 * height + calc(width - height,height);
  else
    return height;
  */
}

int main(int argc,char *argv[]){
  int64_t ans=0;
  int64_t N,X;
  cin >> N >> X;
  
  ans = calc(X,N-X);
  cout << ans + N << endl;
  
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define debug(x) cerr << #x << " = " << x << "\n";
#define debug_v(x) cerr << #x << " ="; for(auto i : x) {cerr << " [" <<  i << "]";} cerr << "\n";
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vii = vector<pii>;
const double PI = acos(-1);
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 1e18 + 100;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cout << fixed << setprecision(20);
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll qan = b - a + 1;
	ll temp1  = a / c;
	ll temp2 = b / c;
	if(temp1 * c < a){
		temp1++;
	}
	if(temp2 * c > b){
		temp2--;
	}
	qan -= (temp2 - temp1 + 1);
	temp1 = a / d;
	temp2 = b / d;
	if(temp1 * d < a){
		temp1++;
	}
	if(temp2 * d > b){
		temp2--;
	}
	qan -= (temp2 - temp1 + 1);
	ll tiv = c * d / __gcd(c, d);
	if(tiv <= b){
		temp1 = a / tiv;
		temp2 = b / tiv;
		if(temp1 * tiv < a){
			temp1++;
		}
		if(temp2 * tiv > b){
			temp2--;
		}
		qan += temp2 - temp1 + 1;
	}
	cout << qan << "\n";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<list>

using namespace std;

int main(){


        int n,q;
        int ins,sin;
        list<int> t;
        list<int> s;

        cin >> n;
        for(int i=0;i<n;i++) {
                cin>>ins;
                t.push_back(ins);
        }
        cin >> q;
        for(int i=0;i<q;i++) {
                cin>>sin;
                s.push_back(sin);
        }
        t.sort();
        t.unique();
        int fir=t.back();
        int j=0;
        int count=0;

        while(q>j){
        for(;;){
        if(s.front()==t.front()){
                t.pop_front();
                count++;
                break;
        } else{
                t.push_back(t.front());
                t.pop_front();
        }
        if(fir==t.front()) break;
        }

        s.pop_front();
        fir=t.back();
        j++;
        }
        cout<<count<<endl;


        return 0;
}



Measured memory_bytes: 3416
lines = $stdin.read
array = lines.split("\n")

X = array[0].split(" ")[0].to_i
A = array[0].split(" ")[1].to_i
B = array[0].split(" ")[2].to_i

if (B - A) < 1
  puts "delicious"
elsif (B - A) < X+1
  puts "safe"
else
  puts "dangerous"
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vv(T) vector<vector<T>>
using namespace std;
using ll = long long;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;
using vbool = vector<bool>;
using vvbool = vector<vector<bool>>;
using qint = queue<int>;
using sint = stack<int>;
using pii = pair<int, int>;


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

    int ans = 0;
    if(x == 0){
        ans = 1;
    }

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


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0; i<(n);i++)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main() {
	int N, K, Q;
	cin >> N >> K >> Q;
	vector<int>A(Q);
	rep(i, Q) cin >> A[i];
	rep(i, Q)A[i]--;
	vector<int>seikai(N,0);
	rep(i, Q)seikai[A[i]]++;
	//rep(i, N)cout << seikai[i] << endl;//debug
	vector<bool> ans(N,false);
	rep(i, N)if (seikai[i] >= Q - K + 1)ans[i] = true;
	rep(i, N) {
		if (ans[i] == true) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	return 0;

	


}

Measured memory_bytes: 1408
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


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

    ll H[N + 1];
    H[0] = 0;
    ll moves = 0;
    ll movesMax = 0;
    REP(i, N){
        cin >> H[i];
        if(H[i] > H[i - 1]){
            moves = 0;
        }else{
            moves++;
            movesMax = max(movesMax, moves);
        }
    }

    cout << movesMax << endl;

    return 0;
}

Measured memory_bytes: 4376
process.stdin.resume();
process.stdin.setEncoding('utf8');
var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
  var x = lines[0].split(' ');
  if(parseInt(x[0]) / parseInt(x[2]) <= parseInt(x[1])){
    console.log('Yes');
  }else if(parseInt(x[0]) / parseInt(x[2]) > parseInt(x[1])){
  console.log('No');
  }
});

Measured memory_bytes: 30136
import sys
from itertools import *
from math import *
input=sys.stdin.readline
D, G = map(int, input().split())
probs = [list(map(int, input().split())) for _ in range(D)]
G2 = G
seq = tuple(range(D))
x=[]
for i in range(0,D+1):
    l=combinations(seq,i)
    for j in l:
        x.append(j)
x=tuple(x)
#print(x)
infty=100000
#print(x)
ans = infty
for cand in x:
    cnt = 0
    G=G2
    l=[0]*D
    for ind in cand:
        probpoint = (ind + 1) * 100
        G=G-(probpoint * probs[ind][0]+probs[ind][1])
        cnt = cnt + probs[ind][0]
        l[ind]=1
    #print(l,G,cnt)
    for i in range(D-1,-1,-1):
        if G<=0:
            break
        elif l[i]==0:
            probpoint = (i + 1) * 100
            num=ceil(G/probpoint)
            if num<probs[i][0]:
                G=G-num*probpoint
                cnt=cnt+num
            #print(cnt)
            break
    if G<=0:
        ans=min(ans,cnt)
print(ans)



Measured memory_bytes: 72204
N,K = map(int,input().split())
h = [int(input()) for _ in range(N)]

h = sorted(h)
hK = h[0:K]
ans = hK[K-1]-h[0]
for i in range(N-K+1):
    ans = min(ans,h[i+K-1]-h[i])

print(ans)


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

int main() {

  int a[4];
  int b;
  cin >> b;
  for(int i=3; i>-1; i--){ 
    a[i] = b%10;
    b /= 10;
  }

  int ans = a[0];
  for(int i=0; i<8; i++) {
    ans = a[0];
    for(int j=0; j<3; j++) {
    if(i & (1 << j)) 
      ans += a[j+1];
    else
      ans -= a[j+1];
    }
    if(ans == 7) {
      cout << a[0];
      for(int j=0; j<3; j++) {
	if(i & (1 << j))
	  cout << '+';
	else
	  cout << '-';
	cout << a[j+1];
      }
      cout << "=7" << endl;
      break;
    }
  }
  return 0;
}
    
   
      


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

void solve(double lx, double ly, double rx, double ry, int depth) {
	if (depth == 0) {
		printf("%.8f %.8f\n", lx, ly);
	} else {
		double sx, sy, ux, uy, tx, ty;
		sx = (2.0 * lx + rx) / 3.0;
		sy = (2.0 * ly + ry) / 3.0;
		tx = (lx + 2.0 * rx) / 3.0;
		ty = (ly + 2.0 * ry) / 3.0;
		ux = (tx + sx - sqrt(3.0) * (ty - sy)) / 2.0;
		uy = (sqrt(3.0) * (tx - sx) + ty + sy) / 2.0;
		solve(lx, ly, sx, sy, depth - 1);
		solve(sx, sy, ux, uy, depth - 1);
		solve(ux, uy, tx, ty, depth - 1);
		solve(tx, ty, rx, ry, depth - 1);
	}
}

int main() {
	int n;
	cin >> n;
	solve(0.0, 0.0, 100.0, 0.0, n);
	printf("%.8f %.8f\n", 100.0, 0.0);
	return 0;
}


Measured memory_bytes: 3204
#include <iostream>
#include <string>
#include <vector>                                                               #include <utility>
#include <map>                                                                  #include <algorithm>

using namespace std;

int main()
{
  long X, Y;
  cin >> X >> Y;
  long A = X;
  int n = 0;
  for (; A <= Y; ++n) A *= 2;
  cout << n << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> 
#define ff first 
#define endl "\n"
#define ss second 
#define li list<int>
#define vi vector<int>
#define ll long long int
#define pii pair<int,int>
#define vii vector<pair<int,int> >
#define mp make_pair
#define pb push_back
#define setbits(x) __builtin_popcountll(x)
#define custom  pair<int,pair<int,int> >
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> pbds; 
#define mod 1000000007
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;cin>>n;
    custom arr[n];
    int a,b,c;
    for(int i=0;i<n;i++){
        cin>>a>>b>>c;
        arr[i]={a,{b,c}};
    }
    int op1,op2,op3;
    custom dp[n+1];
    dp[0]={0,{0,0}};
    for(int i=1;i<n+1;i++){
        op1=arr[i-1].ff+max(dp[i-1].ss.ff,dp[i-1].ss.ss);
        op2=arr[i-1].ss.ff+max(dp[i-1].ff,dp[i-1].ss.ss);
        op3=arr[i-1].ss.ss+max(dp[i-1].ss.ff,dp[i-1].ff);
        dp[i]={op1,{op2,op3}};
    }
    cout<<max(dp[n].ff,max(dp[n].ss.ff,dp[n].ss.ss));
    return 0;
}

Measured memory_bytes: 5992
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
  
int main(){
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    s[k-1]=s[k-1]+32;
    cout<<s<<endl;
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<string> s(N);
    for(int i=0; i<N; ++i) {
        cin >> s[i];
        sort(begin(s[i]), end(s[i]));
    }
    sort(begin(s), end(s));

    long long res = 0;
    string prev = s[0];
    long long cnt = 1;
    for(int i=1; i<N; ++i) {
        if(prev == s[i]) {
            ++cnt;
            if(i + 1 == N) res += cnt * (cnt - 1) / 2LL;
        } else {
            res += cnt * (cnt - 1) / 2LL;
            prev = s[i];
            cnt = 1;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 7296