akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> A(n), B(n), C(n), dpa(n+1, 0), dpb(n+1, 0), dpc(n+1, 0);
    for(int i = 0; i < n; i++)
        cin >> A[i] >> B[i] >> C[i];
    for(int i = 1; i <= n; i++) {
        dpa[i] = max(dpb[i-1], dpc[i-1]) + A[i-1];
        dpb[i] = max(dpa[i-1], dpc[i-1]) + B[i-1];
        dpc[i] = max(dpb[i-1], dpa[i-1]) + C[i-1];
        // cout << dpa[i] << " " << dpb[i] << " " << dpc[i] << endl;
    }
    cout << max(dpa[n], max(dpb[n], dpc[n])) << endl;
}

Measured memory_bytes: 5544
#include <stdio.h>

int main(void) {
  unsigned long int x;
  unsigned long int m=100;
  int i;
  scanf("%ld",&x);
  for(i=1;m<x;i++){
    m=m+m*0.01;
  }
  printf("%d",i-1);
  return 0;
}

Measured memory_bytes: 2152
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll i = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll i = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll i = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

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

	if(k < 2e6){
		ll p = 0;
		rep(i, k) p = a[p];
		co(p + 1);
		return 0;
	}

	ll p = 0;
	unordered_map<ll, ll> ump;
	Vec r;
	rep(i, 2e6){
		r.pb(p);
		ump[p] = i;
		p = a[p];
		if(ump.find(p) != ump.end()){
			r.erase(r.begin(), r.begin() + ump[p]);
			k -= ump[p];
			k %= r.size();
			co(r[k] + 1);
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 12932
#include<iostream>
using namespace std;
int dax[]={1,0,1};
int day[]={0,1,1};
int dbx[]={0,0,0};
int dby[]={1,2,3};
int dcx[]={1,2,3};
int dcy[]={0,0,0};
int ddx[]={0,-1,-1};
int ddy[]={1,1,2};
int dex[]={1,1,2};
int dey[]={0,1,1};
int dfx[]={0,1,1};
int dfy[]={1,1,2};
int dgx[]={1,0,-1};
int dgy[]={0,1,1};

int main()
{
	char f[10][10];

	while(cin>>f[0][0])
	{
		for(int i = 0; i < 8; ++i)
		{
			for(int j = 0; j < 8; j++)
			{
				if(i==0&&j==0) continue;
				cin>>f[i][j];
			}
		}
		/*cout<<"Complete!"<<endl;
		for(int i = 0; i < 8; ++i)
		{
			for(int j = 0; j < 8; j++)
			{
				cout<<f[i][j];
			}
			cout<<endl;
		}
*/
		bool flag=false;
		for(int i = 0; i < 8; ++i)
		{
			for(int j = 0; j < 8; ++j)
			{
				if(f[i][j]=='1')
				{
					for(int k = 0; k < 3; ++k)
					{
						if(j+dax[k]<0||j+dax[k]>7||i+day[k]<0||i+day[k]>7||f[i+day[k]][j+dax[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"A"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dbx[k]<0||j+dbx[k]>7||i+dby[k]<0||i+dby[k]>7||f[i+dby[k]][j+dbx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"B"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dcx[k]<0||j+dcx[k]>7||i+dcy[k]<0||i+dcy[k]>7||f[i+dcy[k]][j+dcx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"C"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+ddx[k]<0||j+ddx[k]>7||i+ddy[k]<0||i+ddy[k]>7||f[i+ddy[k]][j+ddx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"D"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dex[k]<0||j+dex[k]>7||i+dey[k]<0||i+dey[k]>7||f[i+dey[k]][j+dex[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"E"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dfx[k]<0||j+dfx[k]>7||i+dfy[k]<0||i+dfy[k]>7||f[i+dfy[k]][j+dfx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"F"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dgx[k]<0||j+dgx[k]>7||i+dgy[k]<0||i+dgy[k]>7||f[i+dgy[k]][j+dgx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"G"<<endl;
							break;
						}
					}
				}
			}
			if(flag) break;
		}
	}
  return 0;
}

Measured memory_bytes: 1136
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int n;
  int a, min_a = INF, max_a=-INF;
  
  scanf("%d",&n);

  for(int i=0;i<n;i++){
    scanf("%d",&a);
    min_a = min(min_a, a);
    max_a = max(max_a, a);
  }

  printf("%d\n",max_a - min_a);
  
  return 0;
}


Measured memory_bytes: 256
N = int(input())
x = [0]*N
y = [0]*N
z = [0]*N
for i in range(0,N):
    z[i] = list(map(int, input().split()))
    x[i] = z[i][0]
    y[i] = z[i][1]
sum = 0
for i in range(0,N-1):
    for j in range(i+1,N):
        sum = sum + ((x[i]-x[j])**2+(y[i]-y[j])**2)**(1/2)
ans = sum*2 / N
print(ans)

Measured memory_bytes: 3188
#include <stdio.h>
#include <string.h>

int main(){
  int co=0,i;
  char a[100],b[100];

  scanf("%s",b);
  for(i=0;b[i]!='\0';i++) if('A'<=b[i] && b[i]<='Z') b[i]+=('a'-'A');

  while(1){
    scanf("%s",a);
    if(!strcmp(a,"END_OF_TEXT")) break;
    for(i=0;a[i]!='\0';i++) if('A'<=a[i] && a[i]<='Z') a[i]+=('a'-'A');
    if(!strcmp(a,b)) co++;
  }
  printf("%d\n",co);
 
  return 0;
}

Measured memory_bytes: 548
/*版权所有，拷贝必究！*/
/*若想获得，请联系许希泉*/
#include<bits/stdc++.h>
#pragma GCC optimize("O999")
const int INF = 0x3f3f3f3f;
int maxn=5000005;
using namespace std;
struct node{

};
bool is_pal(string a)
{
    string s=a;
    reverse(s.begin(),s.end());
    if(s==a)
    return true;
    else
    return false;
}
bool is_prime(int n)
{
    if(n==1)
	return false;
    if(n==2||n==3)
	return true;
    if(n%6!=1&&n%6!=5)
	return false;
    for(register int i=5;i*i<=n;i+=6)
    if(n%i==0||n%(i+2)==0)
	return false;
    return true;
}
int main()
{
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(0);
	string s1,s2,s;
    int a,b,c,n,t,m,x,y,p,mut=1,sum=0,maxv=0,minv=1E5;
    cin>>n;
    for(int i=1;i<n;i++)
    {
    	x=n/i;
    	if(n%i==0)
    	x--;
    	sum+=x;
	}
    cout<<sum;
    return 0;
}


Measured memory_bytes: 3652
//----------------------------------------------------------------------
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
//----------------------------------------------------------------------
using namespace std;

int main(int argc, char *argv[]) {
    int n; cin >> n;

    map<string, int> mp;
    vector<string> v;
    for(int i = 0; i < n; ++i) {
        string s; cin >> s;
        mp[s]++;
    }
    int mx = 0;
    for(auto p : mp) {
        mx = max(mx,p.second);
    }
    for(auto m : mp) {
        if(m.second == mx) {
            v.push_back(m.first);
        }
    }
    sort(v.begin(),v.end());
    for(auto e : v) {
        cout << e << endl;
    }
}



Measured memory_bytes: 26868
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <cassert>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using ld = long double;

#define st first
#define nd second

const int MAXN = 1e6 + 5, inf = 1e9;
const ll INF = 1e18;
const ld PI = 3.1415926535897932384626433832795;

int cnt[MAXN];
ll dp[MAXN], tab[MAXN];
bool vis[MAXN], used[MAXN];

vector<int> G[MAXN];
vector<ll> V;
set<ll> S;
map<ll, int> M;
stack<ll> St;
queue<ll> Q;

void dfs(int v) {
    vis[v] = 1;
    for (int u : G[v]) {
        if (not vis[u]) {
            dfs(u);
        }
        dp[v] = max(dp[v], dp[u] + 1);
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << setprecision(13) << fixed;

    //////////////////////////////////////////
    //////////////////////////////////////////

    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
    }

    for (int i = 1; i <= n; i++) {
        G[0].push_back(i);
    }

    dfs(0);
    cout << dp[0] - 1 << "\n";
}


Measured memory_bytes: 32632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String[] tokens = in.nextLine().split(" ");
		int d = Integer.parseInt(tokens[0]);
		int n = Integer.parseInt(tokens[1]);

		if (d == 0) {
			if (n <= 99) {
				System.out.println(n);
			} else {
				System.out.println(101);
			}
		} else if (d == 1) {
			if (n <= 99) {
				System.out.println(n * 100);
			} else {
				System.out.println(10100);
			}
		} else {
			if (n <= 99) {
				System.out.println(n * 10000);
			} else {
				System.out.println(1010000);
			}
		}

		in.close();

	}

}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  int d, t, s;
  cin >> d >> t >> s;
  cout << (d <= t * s ? "Yes" : "No");
}

int main()
{
  fastio;
  solve();

  return 0;
}

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

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2369>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

bool rec(const string& S,int& i){
    if(S[i] != 'm') return false;
    i++;
    if(S[i] == 'm'){
        if(!rec(S,i)) return false;
    }
    if(S[i] != 'e') return false;
    i++;
    if(S[i] == 'm'){
        if(!rec(S,i)) return false;
    }
    if(S[i] != 'w') return false;
    i++;
    return true;
}
string solve(){
    string S;
    cin >> S;
    
    // m CAT e CAT w // m (m (mew) e (mew) w) e (mew)  w
    int i = 0;
    return rec(S,i)?(i!=S.length()?"Rabbit":"Cat"):"Rabbit";
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}



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

using namespace std;

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

const int MAX_N = 2010;
const ll MOD = 1e9 + 7;

struct UEdge {
    int u, v, w;

    bool operator<(const UEdge &rhs) const { return w < rhs.w; }
} uedge[MAX_N];

int N, M;
ll X;
vector<pii> edge[MAX_N];

struct DSU {
    int pa[MAX_N];

    void init(int n) {
        for (int i = 1; i <= n; i++) pa[i] = i;
    }

    int find(int x) { return pa[x] == x ? x : pa[x] = find(pa[x]); }

    bool merge(int a, int b) {
        a = find(a); b = find(b);
        return a == b ? false : (pa[a] = b, true);
    }
} dsu;

int path_max(int x, int y, int z, int v) {
    if (x == z) return v;
    for (pii i : edge[x]) {
        if (i.first == y) continue;
        int t = path_max(i.first, x, z, max(v, i.second));
        if (t != -1) return t;
    }
    return -1;
}

int main() {
    scanf("%d%d%lld", &N, &M, &X);
    for (int i = 1; i <= M; i++) {
        scanf("%d%d%d", &uedge[i].u, &uedge[i].v, &uedge[i].w);
    }
    sort(uedge + 1, uedge + M + 1);
    dsu.init(N);
    ll opt = 0;
    for (int i = 1; i <= M; i++) {
        if (dsu.merge(uedge[i].u, uedge[i].v)) {
            edge[uedge[i].u].emplace_back(uedge[i].v, uedge[i].w);
            edge[uedge[i].v].emplace_back(uedge[i].u, uedge[i].w);
            opt += uedge[i].w;
        }
    }
    int cnt1 = 0, cnt2 = 0;
    for (int i = 1; i <= M; i++) {
        int t = path_max(uedge[i].u, 0, uedge[i].v, 0);
        if (uedge[i].w - t == X - opt) cnt1++;
        else if (uedge[i].w - t > X - opt) cnt2++;
    }
    ll ans;
    if (X < opt) ans = 0;
    else if (X == opt) {
        ans = 1;
        for (int i = 1; i <= cnt1; i++) (ans *= 2) %= MOD;
        (ans += MOD - 2) %= MOD;
        for (int i = 1; i <= cnt2; i++) (ans *= 2) %= MOD;
    } else {
        ans = 1;
        for (int i = 1; i <= cnt1; i++) (ans *= 2) %= MOD;
        (ans += MOD - 1) %= MOD;
        for (int i = 1; i <= cnt2 + 1; i++) (ans *= 2) %= MOD;
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define int long long
#define FASTIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
double fun(int a,int b,int c,int d)
{
    int r=(a-c)*(a-c);
    int s=(b-d)*(b-d);
    int t=r+s;
    return sqrt(t);
}
int32_t main()
{
    int n,d;
    cin>>n>>d;
    vector<pair<int,int> >v;
    int x,y;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        v.push_back({x,y});
    }
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        pair<int,int>p=v[i];
        double dist=fun(0,0,p.first,p.second);
        if(dist<=d)
            cnt++;
    }
    cout<<cnt;
    return 0;
}



Measured memory_bytes: 7464
import sys


def main():
  n, *lst = map(int, sys.stdin.read().split())
  max1 = max(lst)
  idx = lst.index(max1)
  max2 = max(lst[:idx] + lst[idx+1:])
  if max2 < max1:
    print(*[max1 if j != max1 else max2 for j in lst], sep='\n')
  else:
    print(*[max1]*n, sep='\n')

    
if __name__ == '__main__':
  main()


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

int a[100005],b[100005];

int main() {
    int n,k;
    scanf("%d",&n);
    long long ans=0;
    for(int i=1; i<=n; i++) {
        scanf("%d",&a[i]);
        ans+=a[i];
    }
    scanf("%d",&k);
    for(int i=1; i<=n; i++) {
        b[a[i]]++;
    }
    while(k--) {
        int p,q;
        scanf("%d%d",&p,&q);
        ans+=(q-p)*b[p];
        b[q]+=b[p];
        b[p]=0;
        printf("%lld\n",ans);
    }
}


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

int main(){
    int N,K;
    int d,A;
    cin >> N >> K;
    set<int> people;
    for(int i=0;i < K;i++){
        cin >> d;
        for(int j=0;j < d;j++){
            cin >> A;
            people.insert(A);
        }
    }
    cout << N - people.size() << endl;
}

Measured memory_bytes: 3628
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 
const ll INF = 1e9 + 10 ;
const int N = 110 ; 
int main(){
    fastio
    string s ;
    cin >> s ; 
    if ( s == "Sunny" ) cout << "Cloudy" << endl;
    else if ( s == "Cloudy" ) cout << "Rainy" << endl;
    else if ( s == "Rainy" ) cout << "Sunny" << endl;
    return 0 ;
}




Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }

#define INF (1LL<<60)

/*
同じのを3つ選んで2減らせる→すべて1or2個にできる
3 3 4 4のとき3 4 4を選んで3 4を残せる→余剰分が偶数なら2が0個, 奇数なら1個にできる
奇数の場合 1種類へる
*/
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H;
	while(cin>>N) {
		VI A(N);
		REP(i, N) cin>>A[i];
		map<ll, ll> h;
		REP(i, N) h[A[i]]++;
		ll sum=0;
		for(auto kv: h) sum+=kv.SE-1;
//		DD(h);
		ll ans = h.size();
		if(sum%2==1) ans--;
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 7296
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int n, k;
    cin >> n >> k;
    vl h(n + 1, 0);
    for (int i = 0; i < n; ++i) {
        cin >> h[i + 1];
    }
    h.push_back(0);
    vvl dp(n + 2, vl(k + 1, INF));
    for (int i = 0; i <= k; ++i) {
        dp[0][i] = 0;
    }
    for (int i = 1; i <= n+1; ++i) {
        for (int j = 0; j <= k; ++j) {
            dp[i][j] = dp[i - 1][j] + max(0LL, h[i - 1] - h[i]);
            for (int l = 1; l <= j; ++l) {
                if (i - 1 - l >= 0)
                    chmin(dp[i][j], dp[i - 1 - l][j - l] + max(0LL, h[i - 1 - l] - h[i]));
            }
        }
    }
    ll ret = INF;
    for (int j = 0; j <= k; ++j) {
        chmin(ret, dp[n+1][j]);
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main()
{
  int A[100], N, sw, i;

  scanf("%d",&N);
  
  for( i = 1 ; i < N + 1 ; i++ )
    {
      scanf("%d",&A[i]);
    }

  sw = bubbleSort(A, N);
  
  printf("%d\n",sw);
 
  return 0;
}

int bubbleSort(int A[],int N)
{
  int sw = 0, i, j, temp;

  for( i = 1 ; i < N + 1 ; i++ )
    {
      for( j = N ; j > i ; j-- )
	{
	  if(A[j] < A[j - 1])
	    {
	      sw++;
	      temp = A[j];
	      A[j] = A[j - 1];
	      A[j - 1] = temp;
	    }
	}
      if(i > 1)
	{
	  printf(" ");
	}
      printf("%d",A[i]);
    }
  printf("\n");
  
  return sw;
}

Measured memory_bytes: 604
def resolve():
    N=int(input())
    c=0
    if N %2 ==1:
        print(0)
        return
    N//=10
    c=N
    while N!=0:
        N//=5
        c+=N
    print(c)
 
 
 
 
 
if __name__ == "__main__":
    resolve()

Measured memory_bytes: 3060
#ARC61-C

s=input() #0～(n-1)番
n=len(s) 
total=0
for i in range(pow(2,(n-1))): 
    list=s[0]
    for j in range(1,n): #1～(n-1)
        if (i>>(j-1))&1: #(j-1)番目が１なら、s[j]を追加する前に＋を加える。
            list=list+"+"+s[j]
        else:
            list+=s[j]
    total+=eval(list)
    #print(list)

print(total)

Measured memory_bytes: 3060
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

H, N = getNM()
magic = []
for i in range(N):
    a, b = getNM()
    # AがATC,BがMP
    magic.append([a, b])

dp = [float('inf')] * (H + 1)
dp[0] = 0
# HP = iを削るための最小MP
for i in range(1, H + 1):
    for j in magic:
        if i < j[0]:
            dp[i] = min(dp[i], j[1])
        else:
            dp[i] = min(dp[i], dp[i - j[0]] + j[1])
print(dp[-1])


Measured memory_bytes: 42348
maxi =[]
mini =[]
n,m =map(int, input().split())
for i in range(m):
    k =[int(s) for s in input().split()]
    mini.append(min(k))
    maxi.append(max(k))
if min(maxi)- max(mini) >= 0:
    print(min(maxi)-max(mini)+1)
else:
    print(0)
    

Measured memory_bytes: 11052
#include<iostream> 
#include<iomanip>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
using namespace std;
 
int main() {
	long W,H,x,y;
	cin>>W>>H>>x>>y;
	double val = (float)(W*H)/2.0;
	int flag = (x*2 == W && y*2 == H)?1:0;
	cout<<val<<" "<<flag<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<complex>
#include<sstream>
#include<climits>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int MAX_N = 200000, MAX_M = 200000;
int N, M;
int a[MAX_M], b[MAX_N];
                            
struct edge { 
  edge(int t, int c) {
    to = t; cost = c;
  }
  int to, cost; 
};
const int MAX_V = MAX_N, INF = 10000000;

int V;
vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s) {
  fill(d, d+V, INF);
  priority_queue<pii, vector<pii>, greater<pii> > pque;
  d[s] = 0;
  pque.push(pii(0, s));


  while (!pque.empty()) {
    pii p = pque.top(); pque.pop();
    int v = p.second;
    if (d[v] < p.first) continue;
    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; 
        pque.push(pii(d[v]+ e.cost, e.to));
      }
    }
  }
}

int main() {
  cin >> N >> M;
  rep(i,M) cin >> a[i] >> b[i];
  V = N;

  for (int i = 0; i < M; ++i) {
    G[a[i]-1].push_back(edge(b[i]-1, 1));
    G[b[i]-1].push_back(edge(a[i]-1, 1));
  }

  dijkstra(0);

  if (d[N-1] == 2) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;

  return 0;
}


Measured memory_bytes: 16616
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=500010, inf=1e9;
int n;
int a[maxn];

template<typename T>
inline void read(T &k)
{
	int f=1; k=0; char c=getchar();
	while(c<'0' || c>'9') c=='-'&&(f=-1), c=getchar();
	while(c<='9' && c>='0') k=k*10+c-'0', c=getchar();
	k*=f;	
}
 
int main()
{
	read(n);
	for(int i=1;i<=n;i++) read(a[i]);
	int ans=0;
	for(int i=1;i<n;i++) ans+=(a[i]==a[i+1]), a[i+1]=(a[i]==a[i+1])?0:a[i+1];
	printf("%d\n", ans);
}

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

int main() {
  int a, b, c, d;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  if (abs(a - c) <= d) {
    printf("Yes");
  } else if (abs(a - b) <= d && abs(b - c) <= d) {
    printf("Yes");
  } else {
    printf("No");
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <numeric>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF (LL)1e15
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

LL change_div_mul_mod(LL divisor, LL mod_minus_2, LL mod){
    if(mod_minus_2 == 0) return 1;
    else if(mod_minus_2 % 2 == 0){
        LL d = change_div_mul_mod(divisor, mod_minus_2/2, mod);
        return (d * d) % mod;
    }else{
        return (divisor * change_div_mul_mod(divisor, mod_minus_2-1, mod)) % mod;
    }
}

//#define int long long

/*************** using variables ***************/
int n;
vector<LL> a;
int odd_cnt = 0, even_cnt = 0;
/**********************************************/

signed main(){
    cin >> n;
    a.resize(n);

    REP(i, n){
        cin >> a[i];
        if(a[i] % 2 == 0) even_cnt++;
        else odd_cnt++;
    }

    if(odd_cnt % 2 != 0){
        cout << "NO" << endl;
        return 0;
    }

    cout << "YES" << endl; 


}


Measured memory_bytes: 1152
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue = BinaryHeap!(Array!long, "a<b");
// dfmt on

void main()
{
    auto S = sread();
    foreach (i; 0 .. S.length)
    {
        if ((i + 1) & 1)
        {
            if (S[i] == 'L')
            {
                writeln("No");
                return;
            }
        }
        else
        {
            if (S[i] == 'R')
            {
                writeln("No");
                return;
            }
        }
    }
    writeln("Yes");
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	vector<int> num;
	int now = 1, cnt = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == (char)('0' + now))cnt++;
		else {
			num.push_back(cnt);
			now = 1 - now;
			cnt = 1;
		}
	}
	if (cnt != 0)num.push_back(cnt);
	if (num.size() % 2 == 0)num.push_back(0);

	int ad = 2 * k + 1;

	vector<int> sum(num.size() + 1);
	for (int i = 0; i < num.size(); i++) {
		sum[i + 1] += sum[i] + num[i];
	}
	int ans = 0;
	for (int i = 0; i < num.size(); i+=2) {
		int l = i;
		int r = min(i + ad, (int)num.size());
		int temp = sum[r] - sum[l];
		ans = max(temp, ans);
	}
	cout << ans << endl;

	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl;
#define CNO cout<<"No"<<endl;

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int n;
    cin >> n;
    if(n==0) return 0;
    vector<int> x(n),y(n);
    rep(i,n) cin >> x[i] >> y[i];
    vector<pair<int,int>> c(4);
    rep(i,4) cin >> c[i].first >> c[i].second;
    sort(all(c));
    LL l=c[0].first,r=c[2].first,u=c[1].second+30000,d=c[0].second+30000;
    LL ans=0;
    rep(i,n){
      LL px=x[i];
      LL py=y[i]+30000;
      LL nx=x[(i+1)%n];
      LL ny=y[(i+1)%n]+30000;
      if(px==nx) continue;
      if(px<nx){
        if(nx<=l||r<=px){
          ans-=(nx-px)*ny;
          goto next;
        }
        ans-=(max(l-px,0ll)+max(nx-r,0ll))*ny+min(ny,d)*(min(r,nx)-max(l,px))+max(ny-u,0ll)*(min(r,nx)-max(l,px));
      }else{
        swap(px,nx);
        if(nx<=l||r<=px){
          ans+=(nx-px)*ny;
          goto next;
        }
        ans+=(max(l-px,0ll)+max(nx-r,0ll))*ny+min(ny,d)*(min(r,nx)-max(l,px))+max(ny-u,0ll)*(min(r,nx)-max(l,px));
      }
      next:;
    }
    cout << ans << endl;
  }
  return 0;
}



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

int main(){
  int N;
  string S;
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>S;
    if(S=="Y"){
      break;
    }
  }
  if(S=="Y"){
    cout<<"Four";
  }
  else{
    cout<<"Three";
  }
}



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

int main() {
  string a, b, c;
  cin >> a >> b >> c;

  int diff = 'a' - 'A';

  a[0] -= diff;
  b[0] -= diff;
  c[0] -= diff;
  cout << a[0] << b[0]<< c[0];
}


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

int main()
{
    string S,T;
    cin >> S >> T;
    int count_max = 0;
    for (int i = 0; i < S.size()-T.size()+1; i++)
    {
        int count = 0;
        for (int j = 0; j < T.size(); j++)
        {
            if(S[i+j] == T[j])
            {
                count++;
            }
        }
        count_max = max(count_max,count);
    }
    cout << T.size() - count_max << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<map>
#include<unordered_map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long double ld;
#define mp make_pair
#define pb push_back
const ll mod = 1000000007;
// const ll mod = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

void No() {
	cout << "No" << endl;
}

void Yes() {
	cout << "Yes" << endl;
}

// 約数列挙
vector< ll > divisor(ll n) {
	vector< ll > ret;
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret), greater<ll>());
	return (ret);
}

int main() {
	ll N;
	cin >> N;
	vector<double> V(N);

	for (int i = 0; i < N; i++) {
		cin >> V[i];
	}
	sort(V.begin(), V.end());
	double ans = V[0];

	for (int i = 1; i < N; i++) {
		ans = (ans + V[i]) / 2.0;
	}

	printf("%.10f", ans);
	cout << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
	int i, n;
	int s[1000];
	double temp, m, dispersion, standard_deviation;

	while (1) {
		cin >> n;
		if (n == 0) break;

		temp = 0;

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

		m = temp / n;
		temp = 0;

		for (i = 0; i < n; i++) {
			temp += pow(s[i] - m, 2);
		}

		dispersion = temp / n;
		standard_deviation = sqrt(dispersion);

		cout << fixed << setprecision(8) << standard_deviation << endl;
	}

	return 0;
}



Measured memory_bytes: 3288
#include <iostream>
#include <cmath>
#include <string>
#include <typeinfo>
#include <climits>
#include <algorithm>
#include <cctype>
#include <cstring>
#include <stdio.h>
#include <cstdlib>
using namespace std;

int main(){
    char a[11],b[11],c[11];
    cin >> a >> b >>c;
    cout << static_cast<char>(toupper(a[0])) << static_cast<char>(toupper(b[0])) <<static_cast<char>(toupper(c[0]));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long l,r,d,cnt=0;
    cin>>l>>r>>d;
    for(int i=l;i<=r;i++)
    {
        if(i%d==0)
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;
}


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

#define dd ch=getchar()
inline int read()
{
	int x=0;bool f=false;char dd;
	while(!isdigit(ch))f|=ch=='-',dd;
	while(isdigit(ch))x=(x<<1)+(x<<3)+ch-48,dd;
	return f?-x:x;
}
#undef dd
void write(int x)
{
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);
	putchar(x%10+48);
}
#define writeln(x) (write(x),putchar('\n'))
#define writesp(x) (write(x),putchar(' '))

const int N=2e5+5,INF=0x3f3f3f3f;
bool a[N];
int val[N],n,midid;
inline int dis(int x){return abs(midid-x);}
inline bool check(int k)
{
	bool f0=true,f1=true;
	for(int i=1;i<=n;i++)
	{
		a[i]=(val[i]>=k);
		if(i&1)f0&=a[i]^1,f1&=a[i];
		else f0&=a[i],f1&=a[i]^1;
	}
	if(f0)return false;
	if(f1)return true;
	int minn[2]={INF,INF};
	for(int i=2;i<=n;i++)
		if(a[i]==a[i-1])
			minn[a[i]]=min(minn[a[i]],min(dis(i),dis(i-1)));
	return minn[1]<minn[0];
}
int main()
{
	n=(midid=read())*2-1;
	for(int i=1;i<=n;i++)
		val[i]=read();
	int l=0,r=INF;
	while(r-l>1)
	{
		int mid=(l+r)>>1;
		if(check(mid))l=mid;
		else r=mid;
	}
	write(l);
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    ll X, Y;
    cin >> X >> Y;
    ll now = X;
    int ans = 0;
    while (now <= Y) {
        now *= 2;
        ans += 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);// TODO Auto-generated method stub
		String alfa=input.next();
		if(alfa.equals(alfa.toLowerCase())) {
			System.out.println("a");
		}
		else {
			System.out.println("A");
		}
	}

}

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

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

Measured memory_bytes: 3632
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAXN 1000+2
long long map1[MAXN][MAXN];
int n,m;
void input(){
	cin>>n>>m;
	int we,xx,yy;
	for(int i=0;i<n;++i){
		for(int j=0;j<n;++j){
			map1[i][j]=10000000000000000;
		}
	}
	for(int i=0;i<n;++i){
		map1[i][i]=0;
	}
	for(int i=0;i<m;++i){
		cin>>xx>>yy>>we;
		map1[xx][yy]=we;
	}
}
void floyd(){
	for(int k=0;k<n;++k){
		for(int i=0;i<n;++i){
			for(int j=0;j<n;++j){
				if(map1[i][k]<10000000000000000&&map1[k][j]<10000000000000000){
				    map1[i][j]=min(map1[i][k]+map1[k][j],map1[i][j]);
				}
			}
		}
	}
	for(int i=0;i<n;++i){
		if(map1[i][i]<0) {
			cout<<"NEGATIVE CYCLE"<<endl;
	        return;
		}
	}
	for(int i=0;i<n;++i){
		for(int j=0;j<n-1;++j){
			if(map1[i][j]<10000000000000000) cout<<map1[i][j]<<" ";
		    else cout<<"INF"<<" ";
		}
		if(map1[i][n-1]<10000000000000000) cout<<map1[i][n-1]<<endl;
	    else cout<<"INF"<<endl;
	}
}
int main(){
	input();
	floyd();
	return 0;
}

Measured memory_bytes: 3536
#include <stdio.h>

int main()
{
	char str[256];
	int i;
	scanf("%[^\n]%*c",str);
	for(i=0;str[i];i++)
		if('a'<=str[i] && str[i]<='z') str[i]-=32;
	
	printf(str);
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;


void solve(long long A, long long B){
  if (A<=9 && B<=9) {
    cout << A*B << endl;
  } else {
    cout << -1 << endl;
  }
}

int main(){
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  solve(A, B);
  return 0;
}


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

int main(){
    int n, k;
    cin>>n>>k;
    
    int arr[n];
    for(int i=0; i<n; i++) cin>>arr[i];
    
    int dp[k+1]={0};
    
    for(int i=1; i<=k; i++){
        for(int j=0; j<n; j++){
            if(i-arr[j]>=0 and dp[i-arr[j]]==0){
                dp[i]=1;
            }
        }
    }
    
    if(dp[k]==1) cout<<"First";
    else cout<<"Second";
    return 0; 
} 

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

int main(){
	int N,dam;
	vector<int> p;
	int cmp=0;
	bool t=true;
	for(int i=0;i<12;i++){
		scanf("%d",&dam);
		p.push_back(dam);
	}
	sort(p.begin(),p.end());
	for(int i=0;i<12;i++){
		if(i%4==0)
		cmp=p[i];
		if(p[i]!=cmp){
			t=false;
			break;
		}
	}
	if(t==true)
	printf("yes\n");
	else
	printf("no\n");
}


Measured memory_bytes: 3168
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


x,y = map(int, input().split())
l = [(sx*x, sy*y, (sx==-1)+(sy==-1)) for sx in (-1,1) for sy in (-1,1)]
ans = float("inf")
for lx, ly,v in l:
    if lx<=ly:
        ans = min(ans, ly-lx+v)
print(ans)
# if 0<=x<y:
#     ans = y-x
# elif x<y<=0:
#     ans = y-x
# elif x<=0<=y:
#     if abs(x)<=abs(y):
#         ans = min(y-x, 1+abs(y)-abs(x))
#     else:
#         ans = y-x
# elif 0<=y<x:
#     ans = min(1 + y + x, 1 + abs(x)-abs(y) + 1)
# elif y<x<=0:
#     ans = min(1 + (-y) + (-x), 1 + abs(y)-abs(x) + 1)
# elif y<=0<=x:
#     ans = abs(abs(x)-abs(y)) + 1

Measured memory_bytes: 61940
#include<iostream>
#include<set>
using namespace std;
int main(){
  string s; cin >> s;
  set<char> st;
  for(int i = 0; i < s.size(); i++){
    if(s[i]=='a')st.insert(s[i]);
    else if(s[i]=='b')st.insert(s[i]);
    else st.insert(s[i]);
  }
  if(st.size()==3)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

int const N = 2000;
bitset<N> dpl[N], dpr[N], all[N], alr[N], yay[N], win[N];
char s[N + 1];

int main(){
	int n;
	scanf("%d", &n);
	f(i, 1, n){
		scanf("%s", s);
		f(j, 0, i){
			int t = s[j] == '1';
			win[i][j] = t;
			win[j][i] = !t;
		}
	}
	f(i, 0, n)dpl[i][i] = true;
	f(i, 0, n)dpr[i][i] = true;
	f(i, 0, n)all[i][i] = true;
	f(i, 0, n)alr[i][i] = true;
	f(ln, 2, n + 1)f(i, 0, n - ln + 1){
		int j = i + ln - 1;
		yay[i][j] = yay[j][i] = (dpl[i] & (dpr[j] >> 1)).any();
		if ((win[i] & yay[i] & all[j]).any())dpl[i][j] = true, all[j][i] = true;
		if ((win[j] & yay[j] & alr[i]).any())dpr[j][i] = true, alr[i][j] = true;
	}
	int an = 0;
	f(i, 0, n)if (dpl[i][n - 1] && dpr[i][0])++an;
	printf("%d\n", an);
}

Measured memory_bytes: 3200
n = int(input())
a,b = map(int,input().split())
l = list(map(int,input().split()))
c = [0,0,0]
for i in l:
    if i <= a:
        c[0] += 1
    elif i > b:
        c[2] += 1
    else:
        c[1] += 1
print(min(c))

Measured memory_bytes: 9048
dp = [0]*31
#print(dp)

dp[0] = 1
dp[1] = 1
dp[2] = 2

for i in range(3,31):
    dp[i] = dp[i-1] + dp[i-2] + dp[i-3]

while True:
    n = int(input())
    if n == 0:
        break
    print(dp[n]//(365*10) + 1)


Measured memory_bytes: 5596
#include <cstdio>
using namespace std;

void insertionSort(int* a, int n) {
    for (int i = 1; i < n; i++) {
        for (int k = 0; k < n - 1; k++) {
            printf("%d%s", a[k], " ");
        }
        printf("%d", a[n - 1]);
        printf("\n");
        int v = a[i];
        int j = i - 1;
        while (j >= 0 && a[j] > v) {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = v;
    }
    for (int k = 0; k < n - 1; k++) {
        printf("%d%s", a[k], " ");
    }
    printf("%d", a[n - 1]);
    printf("\n");
}

int main()
{
    int n;
    scanf("%d", &n);
    int* a = new int[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    insertionSort(a, n);
    delete[] a;
    return 0;
}

Measured memory_bytes: 2640
/*
 * @Author: Luisvacson
 * @LastEditors: Luisvacson
 * @Descriptions: None
 * @Date: 2020-05-02 20:22:00
 * @LastEditTime: 2020-05-02 20:23:52
 * @FilePath: \VSC\C++\Practice\AC abc165 A.cpp
 */
#include<bits/stdc++.h>
using namespace std;

int k,a,b;
signed main(){
    scanf("%d%d%d",&k,&a,&b);
    int t=b/k;
    if(t*k>=a) puts("OK");
    else puts("NG");
    return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
int main(){
int A,B,C;
  cin>>A>>B>>C;
  int d=100*A + 10*B + C;
  if(d%4==0){
 cout<<"YES"<<endl;
 }
  else{
  cout<<"NO"<<endl;
  }

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
int main(){
	int N;
	std::cin>>N;
	std::vector<int> mochis;

	for(int i=0;i<N;++i){
		int diameter;
		std::cin>>diameter;
		auto itr = std::find(mochis.begin(),mochis.end(),diameter);
		if(itr == mochis.end()){
			mochis.push_back(diameter);
		}
	}
	std::cout<<(mochis.size());
	return 0;
}


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

int main () {
    string s;
    char answer = 'a';
    cin >> s;

    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());

    for (char w='a'; w < 'z'+1; w++) {
        for (int i=0; i < s.size(); i++) {
            if (s.at(i) == w) {
                answer = w+1;
                break;
            }
        }
        if (answer == w) break;
    }

    if (answer == 'z'+1) cout << "None" << endl;
    else cout << answer << endl;

}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,e;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>e;
    if(e%2==0)
      if(e%3!=0 && e%5!=0){
        cout<<"DENIED"<<endl;
        return 0;
      }
  }
  cout<<"APPROVED"<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    
    boolean sieve[] = new boolean [1000000];
    for(int n = 2; n < sieve.length; n++){
      if (sieve[n]) continue;
      for (int m = 2 * n; m < sieve.length; m += n) {
        sieve[m] = true;
      }
    }
    while (in.hasNext()) {
      int num = in.nextInt();
      int count = 0;
      for (int i = 2; i <= num; i++) {
        if (!sieve[i]) count++;
      }
      System.out.println(count);
    }
  }
}

Measured memory_bytes: 22528
#include <iostream>
#include <vector>

int main()
{
    int A, B, C, X;
    std::cin >> A >> B >> C >> X;
    
    int ans = 0;
    for(int a = 0; a <= A; ++a)
        for(int b = 0; b <= B; ++b)
            for(int c = 0; c <= C; ++c)
                if(500 * a + 100 * b + 50 * c == X)
                    ++ans;
    std::cout << ans;
}


Measured memory_bytes: 256