akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(){
    
    int a,b,kali;
    
    scanf("%d" , &kali);
    scanf("%d %d" , &a, &b);
    
    for(int i = a;i <= b;i++){
        if(i % kali == 0){
            printf("OK");
            return 0;
          }
    }
    printf("NG");    
    return 0;
}

Measured memory_bytes: 1712
c=0
for W in iter(input,'0'):
 c+=1
 W=int(W)
 d=[0]*-~W
 for _ in[0]*int(input()):
  v,w=map(int,input().split(','))
  for i in range(W,w-1,-1):
   if d[i]<d[i-w]+v:d[i]=d[i-w]+v
 print(f'Case {c}:\n{d[W]}\n{d.index(d[W])}')


Measured memory_bytes: 5632
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 
#define ALL(a)  (a).begin(),(a).end()



using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int a, int b)
{
	return a == 0 ? b : gcd(b % a, a);
}
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}

long long kaijo(long long x){
  long long l=10*10*10*10*10*10*10*10*10+7;
  long long sum=1;
  for(int i=x;i>0;i--){
    sum*=i;
    if(sum>l){
      sum%=l;
    }
  }
  return sum;
}






int main(){
  long long A,B,C;
  cin>>A>>B>>C;
  if(A%2!=0||B%2!=0||C%2!=0){
    cout<<0<<endl;
  }else if(A==B&&B==C){
    cout<<-1<<endl;
  }else{
    int sum=0;
    while(true){
      if(A%2!=0||B%2!=0||C%2!=0){
        break;
      }
      long long aa=B/2+C/2;
      long long bb=A/2+C/2;
      long long cc=A/2+B/2;
      A=aa;
      B=bb;
      C=cc;
      sum++;
    }
    cout<<sum<<endl;
  
}}





  
  


  

Measured memory_bytes: 256
n, m = gets.split(" ").map(&:to_i)
ary = gets.split(" ").map(&:to_i).sort.reverse
sum = ary.inject(:+)
div = sum / (4 * m).to_f
 
m.times do |i|
  if ary[i] < div
    puts "No"
    exit
  end
end
 
puts "Yes"

Measured memory_bytes: 1788
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<math.h>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll h;
    cin >> h;
    ll answer = 0;
    ll count = 0;
    while(h>1){
        h/=2;
        count++;
    }
    //cout << count << endl;
    cout << (ll)pow(2,count)*2-1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#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)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("0"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;



int main() {
  vi a(3);
  cin >> a;
  rep(i,3) {
    if (a[i]%2 == 0) {
      cout<<0<<endl;
      return 0;
    }
  }
  ll ans = LINF;
  rep(i,3) {
    ll now = 1;
    rep(j,3) if (j != i) now *= a[j];
    mins(ans,now);
  }
  cout<<ans<<endl;
  return 0;
}







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

int main(){
    int n;
    int ac=0,wa=0,tle=0,re=0;
    cin>>n;

    string s[n];
    for(int i=0; i<n; i++) cin>>s[i];
    for(int i=0; i<n; i++){
        if(s[i]=="AC") ac++;
        if(s[i]=="WA") wa++;
        if(s[i]=="TLE") tle++;
        if(s[i]=="RE") re++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;

}

Measured memory_bytes: 6724
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;

int main(void) {
	int N;

	cin >> N;

	vector<string>s(N + 5);
	int a[4];

	for (int i = 0; i < 4; i++) {
		a[i] = 0;
	}


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

	for (int i = 0; i < N; i++) {
		if (s[i] == "AC") {
			a[0]++;
		}
		else if (s[i] == "WA") {
			a[1]++;
		}
		else if (s[i] == "TLE") {
			a[2]++;
		}
		else {
			a[3]++;
		}
	}

	cout << "AC x " << a[0] << endl;
	cout << "WA x " << a[1] << endl;
	cout << "TLE x " << a[2] << endl;
	cout << "RE x " << a[3] << endl;

	return 0;
}

Measured memory_bytes: 6432
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=998244353;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	int n,i,m,S,T;cin>>n>>m>>S>>T;S--;T--;
	vector<vector<int>>go(n);
	for(i=0;i<m;i++){
		int a,b;cin>>a>>b;a--;b--;
		go[a].pub(b);
		go[b].pub(a);
	}
	vector<int>ki(n,mod);
	vector<int>gu(n,mod);
	gu[S]=0;
	queue<pair<int,int>>que;
	que.push(mp(S,0));
	while(que.size()){
		
		int ter=que.front().fir;
		int kaz=que.front().sec;
		que.pop();
		//cerr<<ter<<" "<<kaz<<endl;
		if(kaz==2&&ter==T){break;}
		if(kaz%2==1&&kaz>1&&ter==T){break;}
		if(kaz%2){
			for(auto it:go[ter]){
				if(mineq(gu[it],kaz+1)){que.push(mp(it,kaz+1));}
			}
		}else{
			for(auto it:go[ter]){
				if(mineq(ki[it],kaz+1)){que.push(mp(it,kaz+1));}
			}
		}
	}
	if(gu[T]==2){cout<<2<<endl;}
	else if(ki[T]!=mod){
		if(ki[T]==1){ki[T]=3;}
		while(-1){
			bool dame=false;
			for(i=2;i*i<=ki[T];i++){
				if(ki[T]%i==0){dame=true;break;}
			}
			if(!dame){break;}
			ki[T]++;
		}
		cout<<ki[T]<<endl;
	}else{cout<<-1<<endl;}
	return 0;
}


Measured memory_bytes: 9192
H, W = map(int, input().split())
tmp = '.' * (W + 2)
matrix = [tmp] * (H + 2)
for i in range(1,H+1):
    matrix[i] = '.' + input() + '.'
for i in range(1,H+1):
    for k in range(1,W+1):
        if matrix[i][k] == '.':
            continue
        elif matrix[i][k-1] == '.' and matrix[i][k+1] == '.' and matrix[i-1][k] == '.' and matrix[i+1][k] == '.':
            print('No')
            exit()
print('Yes')

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

int main(){
   int n,m;
    cin>>n>>m;
    int a[n][m];
    int sum[n];
    int sum2[m+1];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }
        sum[i]=0;
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cout<<a[i][j]<<" ";
            sum[i]+=a[i][j];
        }
        cout<<sum[i]<<endl;
    }
    for(int j=0;j<=m;j++){
        sum2[j]=0;
    }
    for(int j=0;j<m;j++){
        for(int i=0;i<n;i++){
            sum2[j]+=a[i][j];
        }
        cout<<sum2[j]<<" ";
        sum2[m]+=sum2[j];
    }
    cout<<sum2[m]<<endl;
    return(0);
}

Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N; cin >> N;
    vector<int> X(N), Y(N), H(N); int x, y, h;
    REP(i, 0, N) {
        cin >> X[i] >> Y[i] >> H[i];
        if (H[i] > 0) {
            x = X[i]; y = Y[i]; h = H[i];
        }
    }

    REP(i, 0, 101) {
        REP(j, 0, 101) {
            bool ok = true;
            int height = h + abs(i - x) + abs(j - y);
            REP(k, 0, N) {
                if (max(height - abs(i - X[k]) - abs(j - Y[k]), 0) != H[k]) {
                    ok = false; break;
                }
            }
            if (ok) {
                cout << i << " " << j << " " << height << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3640
using System;

class F
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var s = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

		long M = 0, t = 0;
		for (int i = 1; i < n / 2; i++, t = 0)
			for (int l = 0, r = n - 1; i < r && (l < r || r % i != 0); l += i, r -= i)
				M = Math.Max(M, t += s[l] + s[r]);
		Console.WriteLine(M);
	}
}


Measured memory_bytes: 28892
#include <iostream>
#include <stack>
#include <vector>
#include <algorithm>
using namespace std;
int n,m;
vector<int> v[100010];
int a[100010];
int d[100010];
stack<int> s;
int main()
{
	cin >>n>>m;
	for (int i=0;i<m;i++)
	{
		int x,y;
		cin >>x>>y;
		x--,y--;
		v[x].push_back(y);
		a[y]++;
	}
	for (int i=0;i<n;i++) if (!a[i]) s.push(i);
	while (!s.empty())
	{
		int x=s.top();
		s.pop();
		for (int i=0;i<v[x].size();i++)
		{
			int xi=v[x][i];
			a[xi]--;
			d[xi]=max(d[xi],d[x]+1);
			if (!a[xi]) s.push(xi);
		}
	}
	cout <<*max_element(d,d+n);
	return 0;
}

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

#define PI 3.141592653

typedef struct point{
  double x;
  double y;
}Point;

/* Prototype Declaration */
void kock(int, Point, Point);

int main() {
  int n;
  Point p1, p2;

  scanf("%d", &n);

  p1.x = 0.0;
  p1.y = 0.0;
  p2.x = 100.0;
  p2.y = 0.0;

  printf("%.8f %.8f\n", p1.x, p1.y);

  kock(n, p1, p2);

  printf("%.8f %.8f\n", p2.x, p2.y);

  return 0;
}

void kock(int n, Point p1, Point p2) {
  Point s, t, u;
  if ( n == 0 ) return;

  s.x = (2.0 * p1.x + p2.x) / 3.0;
  s.y = (2.0 * p1.y + p2.y) / 3.0;
  t.x = (p1.x + 2.0 * p2.x) / 3.0;
  t.y = (p1.y + 2.0 * p2.y) / 3.0;

  u.x = (t.x - s.x) * cos(PI/3.0) - (t.y - s.y) * sin(PI/3.0) + s.x;
  u.y = (t.x - s.x) * sin(PI/3.0) + (t.y - s.y) * cos(PI/3.0) + s.y;

  kock(n - 1, p1, s);
  printf("%.8f %.8f\n", s.x, s.y);
  kock(n - 1, s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  kock(n - 1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  kock(n - 1, t, p2);
	    
}

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

int a, b, c;

int main(){
	cin>>a>>b>>c;
	
	if(a==b){
		cout<<c<<endl;
	}
	else if(a==c){
		cout<<b<<endl;
	}
	else{
		cout<<a<<endl;
	}
}


Measured memory_bytes: 256
function gcd(a, b) {
    if (b === 0)
        return a;

    return gcd(b, a % b);
}

function main(arg) {
    arg = arg.split("\n")
    var tmp = arg[0].split(" ")
    var N = tmp[0]
    var X = tmp[1]
    var xi = arg[1].split(" ")
    
    X = Number(X)
    xi = xi.map(function(e){return Math.abs(parseInt(e,10)-X)})
    
    xi.sort(function(a,b) {
        if (a > b) {
            return 1
        }
        return -1
    })
    
    var ans = xi[0]
    for (var j = 1; j < xi.length;j++) {
        ans = gcd(
            ans,
            xi[j]
        )
    }
    console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 28740
from collections import deque
def topological_sort(n,G):
    seq_sorted = []
    st = deque()

    ct_to_edges = [0]*n
    for edges in G:
        for node in edges:
            ct_to_edges[node]+=1
    
    for i,ct in enumerate(ct_to_edges):
        if ct==0:
            st.append(i)
    
    while st:
        node = st.pop()
        seq_sorted.append(node)
        for node in G[node]:
            ct_to_edges[node]-=1
            if ct_to_edges[node]==0:
                st.append(node)
    
    return seq_sorted
def main():
    n,m = map(int,input().split())
    G = [[] for _ in range(n)]
    for _ in range(m):
        s,t = map(int,input().split())
        G[s].append(t)

    topo_seq =  topological_sort(n,G)
    for i in topo_seq:
        print(i)
main()


Measured memory_bytes: 9164
#include <bits/stdc++.h>
#define REP0(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define REPB0(i,n) for(int i=n-1;i>=0;i--)
#define REPB1(i,n) for(int i=n;i>0;i--)
#define llong long long
#define INF 2000000000
#define NIL -1
#define N 1000
using namespace std;
int LCS(string X,string Y){
  int C[N+1][N+1];
  int m=X.size();
  int n=Y.size();
  int maxl=0;
  X=' '+X;
  Y=' '+Y;
  C[0][0]=0;
  REP1(i,m) C[i][0]=0;
  REP1(i,n) C[0][i]=0;
  REP1(i,m){
    REP1(j,n){
      if(X[i]==Y[j]) C[i][j]=C[i-1][j-1]+1;
      else C[i][j]=max(C[i-1][j],C[i][j-1]);
      maxl=max(maxl,C[i][j]);
    }
  }
  return maxl;
}
int main(){
  string s1,s2;
  int n;
  scanf("%d",&n);
  REP0(i,n){
    cin>>s1>>s2;
    printf("%d\n",LCS(s1,s2));
  }
  return 0;
}

Measured memory_bytes: 7156
// Postal Code

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

int a, b;
string s;

int main() {
    cin >> a >> b;
    cin >> s;
    if (s[a] != '-') {
        cout << "No" << endl;
        return 0;
    }

    for (int i = 0; i < a; i++) {
        if (s[i] == '-') {
            cout << "No" << endl;
            return 0;
        }
    }

    for (int i = a+1; i < a+b+1; i++) {
        if (s[i] == '-') {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
import math
S = int(input())
n = 1#はじめは長さ1
ans = 0
while (S-3*n) >= 0:
    ans += math.factorial(S-2*n-1)//(math.factorial(S-3*n)*math.factorial(n-1))
    n += 1
print(ans%(10**9+7))


Measured memory_bytes: 9168
isTrue :: Char -> Bool
isTrue str = if str == 'o' then True else False

countTrue :: [Bool] -> Int
countTrue list = length $ filter (\x -> x) list

main = do
	s <- getLine
	let list = map isTrue s
	let price = 700 + 100 * (countTrue list)
	putStrLn $ show price


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

def main():
    s = input().strip()
    a = int(s[0])
    s = s[1:]
    for i in range(2**3):
        tmp = a
        ans = str(a)
        for j in range(3):
            if i&1:
                tmp += int(s[j])
                ans += "+" + s[j]
            else:
                tmp -= int(s[j])
                ans += "-" + s[j]
            i >>= 1
        
        if tmp == 7:
            print(ans + "=7")
            return
            





if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <deque>

using namespace std;

int N;
int A[300][300];
int c[300][300];

int main(int argc, const char * argv[]) {
    cin >> N;
    for (int i = 0; i < N; ++i)
        for (int j = 0; j < N; ++j) {
            cin >> A[i][j];
            c[i][j] = 0;
        }

    for (int i = 0; i < N; ++i) {
        for (int j = i + 1; j < N; ++j) {
            bool cf = false;
            int aij = A[i][j];
            for (int k = 0; k < N; ++k) {
                if (k == i || k == j)
                    continue;
                int d = A[i][k] + A[j][k];
                if (d < aij) {
                    cout << -1 << endl;
                    return 0;
                }
                if (d == aij)
                    cf = true;
            }
            if (cf)
                c[i][j] = 1;
        }
    }

    long x = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = i + 1; j < N; ++j) {
            if (c[i][j] == 0)
                x += A[i][j];
        }
    }
    
        

    cout << x << endl;
    return 0;
}


Measured memory_bytes: 896
function main(input) {

    let a = input;
    
    for (let i = 1000; i <= 10000; i+=1000) {
        if (i - a  >= 0) {
            console.log(i - a);
            break;
        }
    }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 30664
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >
#define vs vector<string>
#define vc vector<char>
#define vvc vector< vector<char> >

#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

using namespace std;



int main(){
	ll n; cin >> n;
	vl lnumber(n+1);
	lnumber[0] = 2;
	lnumber[1] = 1;
	for (ll i = 2; i <= n; ++i) lnumber[i] = lnumber[i - 1] + lnumber[i - 2];
	cout << lnumber[n] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF 1145141919
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)

using namespace std;

int main(void){
  int N,A,B,i;
  cin >> N >> A >> B;
  int ans=0,sum=0;
  for(i=1;i<=N;i++){
    sum++;
    if(i%10000==0) sum-=9;
    if(i%1000==0) sum-=9;
    if(i%100==0) sum-=9;
    if(i%10==0) sum-=9;
    if(sum>=A && sum<=B) ans+=i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
//package atcoder;
 
import java.util.*;
 
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int [N-1];
		for(int i=0;i<N-1;i++) {
			A[i] = sc.nextInt();
		}
		Map<Integer,Integer> map = new TreeMap<>();
		for(int i=1;i<=N;i++) {
			map.put(i,0);
		}
		for(int j=0;j<N-1;j++) {
			map.put(A[j],map.get(A[j])+1);
		}
		for(Integer value:map.values()) {
			System.out.println(value);
		}
	}
}

Measured memory_bytes: 73804
n=int(input())

A=[int(i) for i in input().split()]
B=[0 for i in range(n+1)]
C=[0 for i in range(n+1)]
D=[0 for i in range(n+1)]
ck=[0 for i in range(n+1)]


now=A[-1]
B[-1]=now
C[-1]=now
D[-1]=now
for i in range(n):
    q=n-1-i
    if now%2==1:
        ck[q]=1
    C[q]=now//2
    now=now//2+A[q]+now%2
    B[q]=now
    D[q]=D[q+1]+A[q]

ans=sum(B)

bonus=0
BON=[0]
for i in range(1,n):
    bonus*=2
    bonus+=ck[i-1]
    bonus=min(bonus,D[i]-B[i])
    BON.append(bonus)
    ans+=bonus

if B[0] != 1:
    print(-1)
else:
    print(ans)
    

Measured memory_bytes: 31296
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
LL N;
string str;
int main()
{
    int A,B,C,X;cin >> A >> B >> C >> X;
    int ans = 0;
    for(int a = 0;a < A+1;a++){
        for(int b = 0;b < B+1;b++){
            for(int c = 0;c < C+1;c++){
                if(a*500+b*100+c*50==X){
                    ans++;
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int h, w;
    cin >> h >> w;

    char s[h][w];
    for (int i = 0; i < h; i++) cin >> s[i];

    int dp[h][w];
    fill(dp[0], dp[h - 1] + w, 0);

    if (s[0][0] == '#') dp[0][0] = 1;

    for (int j = 1; j < w; j++) {
        dp[0][j] = dp[0][j - 1];
        if (s[0][j] != s[0][j - 1]) dp[0][j]++;
    }

    for (int i = 1; i < h; i++) {
        dp[i][0] = dp[i - 1][0];
        if (s[i][0] != s[i - 1][0]) dp[i][0]++;

        for (int j = 1; j < w; j++) {
            int tmp1 = dp[i - 1][j];
            if (s[i][j] != s[i - 1][j]) tmp1++;

            int tmp2 = dp[i][j - 1];
            if (s[i][j] != s[i][j - 1]) tmp2++;

            dp[i][j] = min(tmp1, tmp2);
        }
    }

    cout << (dp[h - 1][w - 1] + 1) / 2 << "\n";
    return 0;
}

Measured memory_bytes: 632
#include <bits/stdc++.h>
 
using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i< (int) n; i++)
#define PI  3.14159265358979323846264338327950
 
 
int main () {
    int N, M;
    cin >> N >> M;

    vector<int>tosi(N,0);

    rep(i,M){
        int a,b;
        cin >>a >> b;

        tosi[a-1] += 1;
        tosi[b-1] += 1;
    }

    rep(i,N){
            cout << tosi[i] << endl;
        }
    

}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;

int main() {
	int N, out;
	cin >> N;
	for (int i = 0; i < 7; i++) {
		if (pow(2, i) <= N && N < pow(2, i + 1)) out = pow(2, i);
	}
	cout << out << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

# refered to editorial

import numpy as np

N = int(input())
S = []
hash_table = {}

a_ascii = ord('a')
bins_of_char = np.zeros((N, 26),dtype=np.int)
num_of_anagram = 0

for i in range(N):
    S.append(''.join(sorted(input())))
S = sorted(S)

for i in range(N):
    if S[i] in hash_table:
        num_of_anagram += hash_table[S[i]]
        hash_table[S[i]] += 1
    else:
        hash_table[S[i]] = 1


print(num_of_anagram)

Measured memory_bytes: 28496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll f(ll k) {
  k += 1;
  ll ret = 0;
  ll cnt = 0;
  for (ll i = 2; i <= 1e13; i *= 2, cnt++) {
    ll g = k / i;
    ll lft = k - g * i;
    ll sum = g * (i / 2) + max(0LL, lft - i / 2);
    ret |= (1LL << cnt) * (sum & 1);
  }
  return ret;
}

int main() {
  ll a,b;
  cin >> a >> b;
  if (a == 0) {
    cout << f(b) << endl;
  } else {
    cout << (f(a-1)^f(b)) << endl;
  }
}

/*　【提出前に確認すること】
・コンパイルできるか
・テストケース試したか
・オーバーフローあるか
*/


Measured memory_bytes: 256
N = int(input())
abc = [[int(i) for i in input().split()] for j in range(N)]

DP = [[0 for i in range(3)] for j in range(N)]
DP[0][0] = abc[0][0]
DP[0][1] = abc[0][1]
DP[0][2] = abc[0][2]
preA = DP[0][0]
preB = DP[0][1]
preC = DP[0][2]

for i in range(1,N):
    DP[i][0] = max(preB,preC)+abc[i][0]
    DP[i][1] = max(preA,preC)+abc[i][1]
    DP[i][2] = max(preA,preB)+abc[i][2]
    preA = DP[i][0]
    preB = DP[i][1]
    preC = DP[i][2]
print(max(DP[N-1]))

Measured memory_bytes: 45684
l, r = map(int, input().split())

m = 2019 + 1
value = float("inf")
for i in range(l, min(r + 1, l + m * 2)):
    for j in range(i + 1, min(r + 1, i + m * 2)):
        value = min((i * j) % 2019, value)
print(value)


Measured memory_bytes: 42808
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int n;
	cin >> n;
	string s;
	cin >> s;

	int res = 0;
	//dp[i][j]: i文字目からとj文字目からとで最長の長さ(被りもok)
	vector<vector<int>> dp(n + 1, vector<int>(n + 1, 0));
	for (int i = n - 1; i >= 0; i--) {
		for (int j = n - 1; j > i; j--) {
			if (s[i] == s[j]) {
				chmax(dp[i][j], dp[i + 1][j + 1] + 1);
			}
			chmax(res, min(dp[i][j], j - i));
		}
	}
	
	out(res);

	return 0;
}

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


int main() {
  int n, x;
  cin >> n >> x;
  vector<int> l(n);
  rep(i,n) cin >> l[i];
  int ans = 1;
  int p = 0;
  rep(i,n){
    p += l[i];
    if (p <= x) ++ans;
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
class Dice():
 
    def __init__(self):
        self.number = [i for i in range(6)]
        self.work = [i for i in range(6)]
        self.order = 'NNNNWNNNWNNNENNNENNNWNNN'
 
    def set(self,n0,n1,n2,n3,n4,n5):
        self.number[0] = n0
        self.number[1] = n1
        self.number[2] = n2
        self.number[3] = n3
        self.number[4] = n4
        self.number[5] = n5
 
 
    def kaiten(self,loc):
        for i in range(6):
            self.work[i] = self.number[i]
 
        if loc == 'E':
            self.set(self.work[3],self.work[1],self.work[0],self.work[5],self.work[4],self.work[2])
        elif loc == 'N':
            self.set(self.work[1],self.work[5],self.work[2],self.work[3],self.work[0],self.work[4])
        elif loc == 'S':
            self.set(self.work[4],self.work[0],self.work[2],self.work[3],self.work[5],self.work[1])
        elif loc == 'W':
            self.set(self.work[2],self.work[1],self.work[5],self.work[0],self.work[4],self.work[3])
 
 
    def tansaku(self,top_num,front_num):
 
        self.save = [i for i in range(6)]
        for i in range(len(self.number)):
            self.save[i] = self.number[i]
 
        ret = -1;
 
        for i in range(len(self.order)):
            self.kaiten(self.order[i])
            if self.number[0] == top_num and self.number[1] == front_num:
                ret = self.number[2]
                break
        
        for i in range(len(self.number)):
            self.number[i] = self.save[i]
 
        return ret;
 
    def hyouka(self,b):
        for i in range(len(self.order)):
            self.kaiten(self.order[i])
            FLG = True
            for k in range(6):
                if self.number[k] != b.number[k]: 
                    FLG = False
                    break
            if FLG == True:
                return True
        
        return False
        
 
 
N = int(input())
D = []

for i in range(N):
    table = list(map(int,input().split()))
    dice = Dice()
    dice.set(table[0], table[1], table[2], table[3], table[4], table[5])
    D.append(dice)
    
FLG = True

for i in range(N-1):
    for k in range(i+1,N):
        if D[i].hyouka(D[k]) == True:
            FLG = False
            break

if FLG == True:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 5624
import sys
import numpy as np

sys.setrecursionlimit(10 ** 9)
def input():
    return sys.stdin.readline()[:-1]

N = int(input())
P = list(map(float,input().split()))

dp = np.zeros(N+1, dtype=float)
dp[0] = 1

for c in P:
#    prev = dp.copy()
    dp = np.append(dp[:-1] * (1-c), 0) + np.append(0, dp[:-1] * c)
#    print(dp)

ans = np.sum(dp[N//2+1:])
print(ans)

Measured memory_bytes: 12504
import itertools

n,m= map(int, input().split())
a= [list(map(int, input().split())) for i in range(m)]
# 経路全探索
ans=0
for v in itertools.combinations(a, n-1):
    b=[[] for i in range(n)]
    for x,y in v:
        b[x - 1].append(y - 1)
        b[y - 1].append(x - 1)

    import collections
    from collections import deque


    def tree(s):

        INF = -10 ** 9
        dis = [INF for i in range(n)]
        dis[s] = 0

        def bfs():
            d = deque()
            d.append(s)

            while len(d):
                x = d.popleft()

                for i in range(len(b[x])):
                    y = b[x][i]
                    if dis[y] == INF:
                        d.append(y)
                        dis[y] = dis[x] + 1

            return max(dis)

        return bfs()
    if tree(0)==n-1:
        ans+=1

print(ans)

Measured memory_bytes: 53340
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
typedef long long ll;
typedef std::pair<int,int> ii;
using namespace std;
int main(){
	int n;cin >> n;int a[4] = {n/1000,n%1000/100,n%100/10,n%10};
	if(a[0]+a[1]+a[2]+a[3] == 7) cout << a[0] << "+" << a[1] << '+' << a[2] << '+' << a[3] << '=' << 7;
	else if(a[0]+a[1]+a[2]-a[3] == 7) cout << a[0] << "+" << a[1] << '+' << a[2] << '-' << a[3] << '=' << 7;
	else if(a[0]+a[1]-a[2]+a[3] == 7) cout << a[0] << "+" << a[1] << '-' << a[2] << '+' << a[3] << '=' << 7;
	else if(a[0]+a[1]-a[2]-a[3] == 7) cout << a[0] << "+" << a[1] << '-' << a[2] << '-' << a[3] << '=' << 7;
	else if(a[0]-a[1]+a[2]+a[3] == 7) cout << a[0] << "-" << a[1] << '+' << a[2] << '+' << a[3] << '=' << 7;
	else if(a[0]-a[1]+a[2]-a[3] == 7) cout << a[0] << "-" << a[1] << '+' << a[2] << '-' << a[3] << '=' << 7;
	else if(a[0]-a[1]-a[2]+a[3] == 7) cout << a[0] << "-" << a[1] << '-' << a[2] << '+' << a[3] << '=' << 7;
	else if(a[0]-a[1]-a[2]-a[3] == 7) cout << a[0] << "-" << a[1] << '-' << a[2] << '-' << a[3] << '=' << 7;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int K;
    cin >> K;
    if (K % 2 == 0)
    {
        cout << K * K / 4 << endl;
    }
    else
    {
        cout << K / 2 * (K / 2 + 1) << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    string s;
    cin>>s;
    int len= s.length();
    len--;
    if(s[len] == '3') cout<<"bon";
    else if( s[len] == '0' || s[len] == '1' || s[len] == '6' || s[len] == '8') cout<<"pon";
    else cout<<"hon";

    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <ctype.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

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

	int N = S.size();

	int now = 0;
	int abs = 0;
	for (int i = 0; i < N; i++) {
		if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
			now++;
		}
		else {
			now = 0;
		}
		abs = max(abs, now);
	}
	cout << abs << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
typedef long long ll;

#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN
#define MAX_INT 100000
#define MOD 1000000007
#define forf(i,a,b) for(int i=a;i<b;i++)


vector<int> adj[1000002];
int vis[1000002],dep[1000002],siz[1000002];


// void dfs(ll cur,ll par)
// {
//     vis[cur]=1;
//     siz[cur]=1;
//     for(auto x:adj[cur])
//     {
//         if(vis[x]!=1)
//         {
//             dep[x]=dep[cur]+1;
//             dfs(x,cur);
//             siz[cur]+=siz[x];
//         }    
//     }
// }


void solve()
{
    ll n;cin>>n;
    // ll m;cin>>m;
    // ll k;cin>>k;
    // string s="",s1="",s2="";
    ll tmp=0,cnt=0,ans=0,tmp1=0,fg=0,fg1=0;
    forf(i,2,n+1)
    {
        ll x,y;cin>>x;
        siz[x]++;
    }
    forf(i,1,n+1) cout<<siz[i]<<endl;
    
}
    
int main()
{
    IOS;
    
    // ll t;cin>>t;while(t--)
        solve();
 
    return 0;
}

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

#define int long long int
#define float long double
#define pb push_back
#define fi first
#define se second
#define vii vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define pq priority_queue<int>
#define test int tcase; cin>>tcase; for(int tc = 1; tc <= tcase; tc++)
#define inp(a,n,f) int a[n+f];for(int hh=f;hh<n+f;hh++)cin>>a[hh];
#define prdec(k) cout<<fixed<<setprecision(k);
#define mem(a,k) memset(a,k,sizeof(a))
#define ub upper_bound
#define lb lower_bound
#define mii map<int,int>
#define all(v) v.begin(),v.end()
#define inf LLONG_MAX
int exp(int x,int y,int mod){int res=1;x=x%mod;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
int modinv(int x,int mod){return exp(x,mod-2,mod);}


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int x;
    cin>>x;
    x=1-x;
    cout<<x;
    return 0;
}

Measured memory_bytes: 3644
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    k = I()
    s = S()
    if len(s) <= k:
        print(s)
    else:
        print(s[:k] + '...')

main()



Measured memory_bytes: 10916
#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <sstream>
#include <cstring>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef long long ll;

const int MAX_SIZE = 10000;

struct edge{
	int to;
	int cost;
	int money;
};

class Situation{
public:
	int cost;
	int idx;
	int prvEdgeMoney;
	Situation(int cost_,int idx_,int pem_){
		cost=cost_;
		idx=idx_;
		prvEdgeMoney=pem_;
	}
	Situation();

	bool operator<(const Situation &s)const{
		if(s.cost==this->cost)return s.prvEdgeMoney<this->prvEdgeMoney;
		return s.cost < this->cost;
	}
};

int V;
const int MAX_V = 10001;
vector<edge> G[MAX_V];
int d[MAX_V];
int prvAdd[MAX_V];
const int INF = 1000000000;
void dijkstra(int s,int &res){
	priority_queue<Situation> que;
	fill(d,d+MAX_V,INF);
	memset(prvAdd,0,sizeof(prvAdd));
	d[s] = 0;
	que.push(Situation(0,s,0));
	while(!que.empty()){
		Situation p = que.top();
		que.pop();
		int v = p.idx;
		if(d[v] < p.cost)continue;
		if(prvAdd[v]!=0){
			if(prvAdd[v]>p.prvEdgeMoney){
				res-=prvAdd[v];
				res+=p.prvEdgeMoney;
				prvAdd[v]=p.prvEdgeMoney;
			}
			else continue;
		}
		else{
			res+=p.prvEdgeMoney;
			prvAdd[v]=p.prvEdgeMoney;
		}
		for(int i = 0; i < (int)G[v].size(); i++){
			edge e = G[v][i];
			if(d[e.to] >= d[v] + e.cost){
				d[e.to] = d[v] + e.cost;
				que.push(Situation(d[e.to],e.to,e.money));
			}
		}
	}
}

int n,m;

int main(){

	while(cin>>n>>m&&(n|m)){
		int res=0;
		for(int i=1;i<=n;i++)G[i].clear();
		for(int i=0;i<m;i++){
			int u,v,d,c;
			cin>>u>>v>>d>>c;
			edge e;
			e.to=v;
			e.cost=d;
			e.money=c;
			G[u].push_back(e);
			e.to=u;
			G[v].push_back(e);
		}
		dijkstra(1,res);
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 2848
use std::collections::HashMap;

fn main() {
    let _n = read::<usize>();
    let v = read_vec::<u64>();
    let mut hm = HashMap::new();

    for &vi in &v {
        let c = hm.entry(vi).or_insert(0);
        *c += 1;
    }

    let total: u64 = {
        let mut t = 0;
        for (_, v) in &hm {
            t += v * (v - 1) / 2;
        }
        t
    };

    for &vi in &v {
        let c = hm.entry(vi).or_insert(0);
        if *c >= 2 {
            println!(
                "{}",
                total - (*c * (*c - 1) / 2) + ((*c - 1) * (*c - 2) / 2)
            );
        } else {
            println!("{}", total);
        }
    }
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

int main() {

    int n;
    cin >> n;
    vector<int> a(n);
    int maxv = -1;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            int num = abs(a[i] - a[j]);
            maxv = max(maxv, num);
        }
        
    }
    cout << maxv << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {

    int L=0;
    int R=0;
    int d=0;
    int i=0;
    int cou=0;
    
    scanf("%d",&L);
    scanf("%d",&R);
    scanf("%d",&d);
    
    
    
    for (i=L;i<=R;i++){
        if(i % d == 0){
            cou++;
        }
    }
    
    printf("%d",cou);
    return 0;
}


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

int main()
{

  int a[3];

  cin >> a[0] >> a[1] >> a[2];

  sort(a,a+3);

  if(a[0] == a[1] && a[1] != a[2]) cout << "Yes" << endl;
  else if(a[0] != a[1] && a[1] == a[2]) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;

}


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

public class Main
{
  private static ArrayList<Integer> primeNumberList = new ArrayList<>();

  public static void main(String[] args) throws NumberFormatException, IOException
  {
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    ArrayList<Integer> inputList = new ArrayList<>(50);

    while (input.ready())
    {
      int inputNum = Integer.valueOf(input.readLine());
      if (inputNum == 0)
      {
        break;
      }
      inputList.add(inputNum);
    }

    int max = 0;
    for (Integer each : inputList)
    {
      if (max < each)
        max = each;
    }

    setPrimeNumberList(max);

    for (int num : inputList)
    {
      System.out.println(sumOfPrimeNumbers(num));
    }
  }

  private static int sumOfPrimeNumbers(int count)
  {
    int ans = 0;
    for (int i = 0; i < count; i++)
    {
      ans += primeNumberList.get(i);
    }
    return ans;
  }

  private static void setPrimeNumberList(int listSize)
  {
    int num = 3;

    primeNumberList.add(2);
    while (primeNumberList.size() < listSize)
    {
      if (isPrimeNumber(num))
      {
        primeNumberList.add(num);
      }
      num++;
    }
  }

  private static boolean isPrimeNumber(int number)
  {
    if (number % 2 == 0)
    {
      return false;
    }

    final int limit = (int) Math.sqrt(number);
    for (int each : primeNumberList)
    {
      if (number % each == 0)
      {
        return false;
      }
      if (each > limit)
      {
        break;
      }
    }
    return true;
  }
}

Measured memory_bytes: 28112
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;


void solve() {
    int N, M; cin >> N >> M;
    int ans = N * (N-1) + M * (M-1);
    cout << ans / 2 << endl;
}


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

Measured memory_bytes: 256
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

a, b, c = map(int, input().split())

cnt = 0
for i in range(c):
    if b >= a:
        cnt += 1
        b -= a
    else:
        break
print(cnt)





Measured memory_bytes: 6864
#include<bits/stdc++.h>
using namespace std;
main(){
long long i,j,k,l,m,n,p;

while(cin>>p){
i=0; j=p;
while(p>0){
    i+=(p%10);
    p/=10;
}
if(j%i==0)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
} return 0;
}


Measured memory_bytes: 256
-- | Main entry point to the application.
module Main where
 
import Control.Applicative
import Control.Monad
import Data.List
import Data.Maybe
import Text.Printf

-- | The main entry point.
main :: IO ()
main = do
    [a, b] <- concatMap (fmap (read :: String -> Int) . words) . lines <$> getContents
    printf "%d %d\n" (a * b) (2 * a + 2 * b)

Measured memory_bytes: 3596
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

template<class T, class S>
bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}


int main(){
    int H, A; cin >> H >> A;
    cout << (H + A - 1) / A << endl;
    return 0;
}


Measured memory_bytes: 256
package main
 
import (
	"fmt"
	"os"
)
 
func main() {
	var N int
 
	fmt.Scan(&N)
	hashMap := make(map[int]int, N)
	A := make([]int, N, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&A[i])
		hashMap[A[i]]++
	}
 
	for _, count := range hashMap {
		if count > 1 {
			fmt.Println("NO")
			os.Exit(0)
		}
	}
	fmt.Println("YES")
}

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

int nari(int,int);

int main(){

  int a,b;
  cin >> a >> b;

  cout <<  nari(a,b) << endl;
  return 0;
}

int nari(int a,int b)
{
  int r = a%b;
  while(r>0)
    {
      a=b;
      b=r;
      r=a%b;
    }
  return b;
}

Measured memory_bytes: 0
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;

ll dp[501][501];
void solve() {
  int h, w, a, b;
  cin >> h >> w >> a >> b;
  ll s = 0;
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      if(i%a == a-1 && j%b == b-1) dp[i][j] = -1e8 - a*b + 1;
      else if(i%a == 0 && j%b == 0) dp[i][j] = 1e8;
      else dp[i][j] = 1;
      s += dp[i][j];
    }
  }
  if(s <= 0) cout << "No\n";
  else {
    cout << "Yes\n";
    for(int i = 0; i < h; i++) {
      for(int j = 0; j < w; j++) {
        cout << dp[i][j] << " ";
      }
      cout << "\n";
    }
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define REP(i, a, b) for (ll i = (a); i < (b); ++i)

using namespace std;
using ll = long long;

static const ll N_MAX = 2 * 1e5;

/**
 * main
 */
int main () {
  ll A[N_MAX];
  ll S[N_MAX + 1];
  ll N; cin >> N;

  for (ll i = 1; i <= N; i++) S[i] = 0;

  REP(i, 0, N) {
    cin >> A[i];
    S[A[i]]++;
  }

#ifdef DEBUG
  printf("--\n");
  for (ll i = 1; i <= N; i++) {
    printf("%lld %lld\n", i, S[i]);
  }
  printf("--\n");
#endif

  ll T[N_MAX + 1];
  ll sum = 0;

  for (ll i = 1; i <= N; i++) {
    ll k = S[i];

    T[i] = k * (k - 1) / 2;
    sum += T[i];
  }

  for (ll i = 0; i < N; i++) {
    ll j = A[i];
    ll k = S[j] - 1;
    ll l = k * (k - 1) / 2;

    printf("%lld\n", sum - T[j] + l);
  }
}


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

int main() {
  int N, K;
  cin >> N;
  cin >> K;
  int l = 0;
  for(int i = 0; i < N; i++) {
    int temp = 0;
    cin >> temp;
    l += (temp > abs(temp - K)) ? abs(temp - K) : temp;
  }
  cout << 2 * l << endl;
  return 0;
}

Measured memory_bytes: 256