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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, a, n) for (int i = (n); i < (a); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)

template<typename T,typename U>
void Inparray(T &f,U n){
  for(int i=0;i<n;i++) cin>>f[i];
}

template<typename T,typename U>
void Printarray(T f,U n){
  for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];
}

void flagfunc(bool flag,string A,string B){
  flag ? cout<<A<<endl : cout<<B<<endl;
}

void flag2func(bool flag){
  flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

void flag3func(bool flag){
  flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n;cin>>n;
  flagfunc(n>=1000,"ABD","ABC");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
const int mod=1e9+7;
ll dp[500][500];
vector<int> a(500);
ll sum(int i ,int j)
{
	ll ans=0;
for(int k=i;k<=j;++k)
ans+=a[k];	
return ans;
}

void solve()
{
	int n;
	cin>>n;
	
		for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	
	for(int i=n-1;i>=0;--i)
	{
		for(int j=i;j<n;++j)
		{
				if(i==j)
				dp[i][j]=0;
				else
			{ll s=sum(i,j);dp[i][j]=1e18;
				for(int k=i;k<=j-1;k++)
			{
			
				dp[i][j]=min(dp[i][k]+dp[k+1][j]+s,dp[i][j]);
				//else dp[i][j]=dp[i][i+k]+dp[i+k+1][j]+s;
			}}
		}
	}

		cout<<dp[0][n-1]<<endl;
}
int main()
{
	int t=1;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 1792
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,straa;
    ll x,y,z;
    char ca,cb,cc;
    cin>>a>>b;
    b+=a*3;
    cout<<b/2;

    return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define All(x) (x).begin(),(x).end()
#define pb emplace_back
#define mp make_pair
typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> PII;
const double PI=acos(-1.0);
const double eps=1e-6;
const long long mod=1e9+7;
const int inf=0x7fffffff;
const int maxn=100005;
ll qpow(ll x,ll y,ll Mod) {ll ans=1,base=x%Mod; while(y){if(y&1)ans=(ans*base)%Mod;base=(base*base)%Mod;y>>=1;} return ans;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
// fast read
template<class T> void read(T &x) {
	x=0;int f=0;char ch=getchar();
	while(ch<'0'||ch>'9'){f|=(ch=='-');ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	x=f?-x:x;
	return;
}

//fast write
inline void write(ll x){
	if(x<0)putchar('-'),x=-x;
    if(x>9)write(x/10);
    putchar(x%10+'0');
}

int n;
__int128 a[maxn];

int main(){
	//freopen("test.in","r",stdin);
	read(n);
	__int128 ans=1;
	rep(i,1,n){
		read(a[i]);
	}
	sort(a+1,a+1+n);
	rep(i,1,n){
		if(a[i]==0){
			return printf("0\n"),0;
		}
		ans*=a[i];
		if(ans>1000000000000000000){
			printf("-1\n");
			return 0;
		}
	}
	write(ans);
	return 0;
}

Measured memory_bytes: 5200
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

//Range Minimum Query
struct segment {
    int n;
    vector<int64_t> dat;
    // n_は範囲
    segment(int n_) { // nはn_以上の2^?
        n = 1<<(32-__builtin_clz(n_));
        if(n == 2*n_) n >>= 1;
        dat.assign(2*n-1, INT64_MAX);
    }
    //初期化(初期状態はINT64_MAX)
    void init(vector<int64_t> &vec) {
        int num = vec.size();
        rep(i, num) {
            dat[i+n-1] = vec[i];
        }
        rep(i, n-1) {
        dat[n-2-i] = min(dat[n*2-3-i*2], dat[n*2-2-i*2]);
        }
    }
    // k番目の値をaに変更
    void update(int k, int64_t a) {
        // 葉の節点
        k += n-1;
        dat[k] = a;
        // 登りながら更新
        while(k>0) {
            k = (k-1)/2;
            dat[k] = min(dat[k*2+1], dat[k*2+2]);
        }
    }
    // [a, b)の最小値
    int64_t query(int a, int b) {
        return query_(a, b, 0, 0, n);
    }
    //kは節点の番号, [l, r)に節点が対応
    // (a, b, 0, 0, .n)で呼ぶ
    int64_t query_(int a, int b, int k, int l, int r) {
        if(a>=r || l>=b) return INT64_MAX;
        if(a<=l && r<=b) return dat[k];
        else {
            int chl = k*2+1;
            int chr = k*2+2;
            int64_t vl = query_(a, b, chl, l, (l+r)/2);
            int64_t vr = query_(a, b, chr, (l+r)/2, r);
            return min(vl, vr);
        }
    }
};

int main() {
    int n;
    ll x;
    cin >> n >> x;
    vector<ll> a(n);
    rep(i, n) {
        cin >> a[i];
    }

    segment seg(n);
    seg.init(a);

    ll ans = LINF;
    rep(i, n) {
        ll now = i*x;
        ll n_;
        rep(j, n) {
            if(j < i) {
                n_ = min(seg.query(0, j+1), seg.query((j-i+n)%n, n));
            } else {
                n_ = seg.query(j-i, j+1);
            }
            now += n_;
        }
        ans = min(ans, now);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
//
// Created by reiji kobayashi on 2019/11/18.
//

#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

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

typedef long long ll;



int main() {
    int N;
    cin >> N;
    vector<int> As(N);
    REP(i,N) cin >> As[i];
    int count = 0;
    while (true) {
        bool all_div2 = true;
        REP(i,N) {
            if (As[i]%2 == 0) continue;
            else all_div2 = false;
        }
        if (all_div2) {
            REP(i,N) As[i] /= 2;
            count++;
        }
        else break;
    }
    cout << count << endl;

}


Measured memory_bytes: 256
#C問題
N,M = map(int, input().split())
H = input().split()
result = [True] * N
H_i = [int(s) for s in H]
bothCount = 0
for i in range(M):
    A,B = map(int, input().split())
    if(H_i[A-1] > H_i[B-1]):
        #AがBよりも高かったらAがいい展望台
        if(result[B-1] == True):
            result[B-1] = False
    elif(H_i[A-1] < H_i[B-1]):
        if(result[A-1] == True):
            result[A-1] = False
    else:
        result[A-1] = False
        result[B-1] = False
print(result.count(True))

Measured memory_bytes: 20924
#include<iostream>
#include<cstring>
using namespace std;
int a[100001], b[100001];
int m, n, dis;
int x, y, c;
int dismin = 999999;
int mina = 999999, minb = 999999;
int tmp;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin >> m >> n >> dis;
	for(int i = 1; i <= m; i++){
		cin >> a[i];
		if(mina > a[i]) mina = a[i];
	}
	for(int i = 1; i <= n; ++i){
		cin >> b[i];
		if(minb > b[i]) minb = b[i];
	}
	for(int i = 1; i <= dis; ++i){
		cin >> x >> y >> c;
		tmp = a[x] + b[y] - c;
		if(dismin > tmp) dismin = tmp;
	}
	int ans = (dismin < mina + minb ? dismin : mina + minb);
	cout << ans << endl;
	return 0;
}

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  bool flag = true;
  if (n%2 == 1) flag = false;
  for (int i = 0; i < n / 2; ++i) {
    if (s[i] != s[n/2+i]) {
      flag = false;
      break;
    }
  }
  cout << (flag ? "Yes" : "No") << endl;
  return 0;
}

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

public class Main{

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line[] = br.readLine().split(" ");
		int a = Integer.parseInt(line[0]);
		int b = Integer.parseInt(line[1]);
		int c = Integer.parseInt(line[2]);
		String ans = "NO";

		if (a <= c && c <= a + b) {
			ans = "YES";
		}

		System.out.println(ans);

	}

}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
string s;

int main(){
	cin>>s;
	n=s.size();
	bool B=1;
	if(s[0]!='A') B=0;
	int t=0;
	for(int i=2;i<n-1;i++){
		if(s[i]=='C') t++;
		else if('A'<=s[i]&&s[i]<='Z') B=0;
	}
	if(t!=1) B=0;
	if('A'<=s[1]&&s[1]<='Z') B=0;
	if('A'<=s[n-1]&&s[n-1]<='Z') B=0;
	cout<<(B?"AC":"WA")<<endl;
}

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

typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;

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

    bool ans(true);
    int count(0);
    if(s[0]!='A'){
        ans = false;
    }

    for(int i=1;i<=s.size()-1;i++){
        if(isupper(s[i])){
            if(s[i]=='C' && i>=2 && i<=s.size()-2){
                count++; 
            }else{
                ans = false;
            }
        }
    }

    if(ans){
        if(count==1){
            cout << "AC" << endl;
        }else{
            cout << "WA" << endl;
        }
    }else{
        cout << "WA" << endl;
    }

    return 0;
}

Measured memory_bytes: 3572
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s= sc.next();
    String t= sc.next();
    int count=0;
    for(int i=0;i<s.length();i++) {
    	if(s.charAt(i)!=t.charAt(i)) {
    		count++;
    	}
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 41232
#include <stdio.h>
int isprime1(int n){
	int i;
	for(i = 2; i < n; i++){
		if(n % i == 0) return 0;
	}
	return 1;
}
int main() {
	int n, p, q, i;
	scanf("%d", &n);
	while(1){
		if(n == 0) break;
		for(i = n; n >= 5; i--){
			if(isprime1(i) == 1 && isprime1(i-2) == 1){
				p = i-2;
				q = i;
				break;
			}
		}
		printf("%d %d\n", p, q );
		scanf("%d", &n);
	}
	return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  int n;
  cin>>n;
  long ans = 0;
  for(int i = 0;i<n;i++){
    int tmp;
    cin>>tmp;
    ans += tmp-1;
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    int x = 1;
    rep(i, 10000000) {
        if(x >= b) {
            cout << i << endl;
            break;
        }
        x = x + a - 1;
    }
}


Measured memory_bytes: 256
n=int(input())
s=input()
same=-1
for i in range(0,n):
  left=s[:i]
  right=s[i:]
  same_tmp=0
  while len(left)>0 and len(right)>0:
    char=left[0]
    if char in right:
      same_tmp+=1
      left=left.replace(char,'')
      right=right.replace(char,'')
    else:
      left=left.replace(char,'')
    left.replace(char,'')
  if same_tmp>same:
    same=same_tmp
print(same)

Measured memory_bytes: 3064
n = int(input())
a = list(map(int, input().split()))
a = [i-1 for i in a]
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
now = 999
for i in a:
    if now+1 == i:
        ans += b[i] + c[i-1]
    else:
        ans += b[i]
    now = i
print(ans)


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
public class Main {
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		int N=sc.nextInt();
		long[][] coord=new long[N][2];
		for(int i=0; i<N; i++) {
			coord[i][0]=sc.nextLong();
			coord[i][1]=sc.nextLong();
		}
		quick_sort(coord,0,N-1);
		long distmin=Long.MAX_VALUE;
		for(int i=1; i<N; i++) {
			distmin=Math.min(distmin, (coord[i][0]-coord[0][0])*(coord[i][0]-coord[0][0])+(coord[i][1]-coord[0][1])*(coord[i][1]-coord[0][1]));
		}
		for(int i=1; i<N-1; i++) {
			for(int j=i-1; j>=0; j--) {
				if(distmin<(coord[i][0]-coord[j][0])*(coord[i][0]-coord[j][0])) {
					break;
				}
				else {
					distmin=Math.min(distmin, (coord[i][0]-coord[j][0])*(coord[i][0]-coord[j][0])+(coord[i][1]-coord[j][1])*(coord[i][1]-coord[j][1]));
				}
			}
			for(int j=i+1; j<N; j++) {
				if(distmin<(coord[i][0]-coord[j][0])*(coord[i][0]-coord[j][0])) {
					break;
				}
				else {
					distmin=Math.min(distmin, (coord[i][0]-coord[j][0])*(coord[i][0]-coord[j][0])+(coord[i][1]-coord[j][1])*(coord[i][1]-coord[j][1]));
				}
			}
		}
		pl(distmin);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	static void quick_sort(long[][] d, int left, int right) {
		if (left>=right) {
			return;
		}
		long p = d[(left+right)/2][0];
		int l = left, r = right;
		long tmp,tmp1,tmp2;
		while(l<=r) {
			while(d[l][0] < p) { l++; }
			while(d[r][0] > p) { r--; }
			if (l<=r) {
				tmp = d[l][0]; d[l][0] = d[r][0]; d[r][0] = tmp;
				tmp1=d[l][1]; tmp2=d[r][1]; d[l][1]=tmp2; d[r][1]=tmp1;
				l++; r--;
			}
		}
		quick_sort(d, left, r);
		quick_sort(d, l, right);
	}
}



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

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

int G[10][10];

int main(void){
	int i, j, k, n, ma = 12345, x, y, z;
	for(;;){
		scanf("%d", &n);
		if(!n)break;
		rep(i, 10)rep(j, 10)G[i][j] = ma;
		rep(i, 10)G[i][i] = 0;
		rep(i, n){
			scanf("%d%d%d", &x, &y, &z);
			G[x][y] = z;
			G[y][x] = z;
		}
		rep(k, 10)rep(i, 10)rep(j, 10)G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
		pair<int,int> res = make_pair(-1, ma);
		rep(i, 10){
			int sum = 0;
			rep(j, 10)if(G[i][j] != ma)sum += G[i][j];
			if(sum != 0 && res.second > sum)res = make_pair(i, sum);
                        //printf("%d %d\n", i, sum);
		}
		printf("%d %d\n", res.first, res.second);
	}
	return 0;
}

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

bool Harshad(int n){
  int s = 0;
  int tmp;
  for (tmp = n; tmp > 0; tmp /= 10)
    s += tmp % 10;
  return (n%s == 0);
}
 

int main(){
  int num;
  cin >> num;
  
  if(Harshad(num))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

#define MAX_N 10000
#define INF 10000000LL

long long n, j, x[MAX_N][MAX_N], p[MAX_N + 2], sum;

int matrix() {
	for (int i = 0; i < n; i++) { x[i][i] = 0; }
	for (int h = 2; h <= n; h++) {
		for (int i = 1; i <= n - h + 1; i++) {
			j = i + h - 1;
			x[i][j] = INF;
			for (int k = i; k < j; k++) {
				x[i][j] = min(x[i][j], x[i][k] + x[k + 1][j] + p[i - 1] * p[k] * p[j]);
			}
		}
	}
	sum = x[1][n];
	return sum;
}

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> p[i - 1] >> p[i];
	}
	cout << matrix() << endl;
	return 0;
}


Measured memory_bytes: 3436
def resolve():
    N, K = map(int, input().split())
    H = list(map(int, input().split()))

    dp = [0] * N

    for i in range(1, N):
        s = max(0, i-K)
        dp[i] = min([c + abs(h - H[i]) for c, h in zip(dp[s:i], H[s:i])] )

    print(dp[N-1])

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 52576
n = int(input())
ans = len(str(n))
for i in range(2, int(n**0.5) + 1):
    if n % i == 0:
        b = int(n / i)
        f = max(len(str(i)), len(str(b)))
        if ans > f or ans == 0:
            ans = f
print(ans)

Measured memory_bytes: 39280
#include "bits/stdc++.h"
using namespace std;
int main()
{
    string s, t;
    cin >> s >> t;
    if ((s.length() + 1) != (t.length()))
    {
        cout << "No" << endl;
    }
    else
    {
        bool flag = true;
        for (int i = 0; i < s.length(); i++)
        {
            if (s[i] != t[i])
            {
                flag = false;
            }
        }
        if (flag)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pie acos(-1)
#define loop(i,a,n) for(int i=a;i<n;i++)
#define trav(a,x) for(auto &a:x)
#define vi vector<int>
#define vl vector<ll>
#define pii pair<ll,ll>
#define endl "\n"
#define w 1e5

void solve()
{
    int n,k;
    cin>>n>>k;
    vector<int>a(n);
    loop(i,0,n)
    cin>>a[i];
    //dp[i] is 1 if first wins
    vector<int>dp(k+1);
    for(int stones=1;stones<=k;stones++)
    {
        for(int val:a)
        {
            if(stones>=val && dp[stones-val]==0)
            dp[stones]=1;
        }
    }
    if(dp[k]==1)
    cout<<"First";
    else
    cout<<"Second";
    
}
int main() {
	// your code goes here
	io;
	int t ;
	
    solve();
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
#define f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back
typedef long long int ll;

void input(){
   int a;string s;
   cin >> a >> s;
   if(a >= 3200)cout << s  << endl;
   else cout << "red" <<endl;
}
int main()
{
 input();
 return 0;
}



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

int main(){
  int i, N;
  long tmp, pre, lucas;
  scanf("%d", &N);
  
  for(i=1;i<=N;i++){
    if(i==1){
      lucas=1;
      pre=2;
    }else{
      tmp=pre;
      pre=lucas;
      lucas+=tmp;
    }
    if(i==N)printf("%ld", lucas);
  }
  
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1'000'000'007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

vector<vector<char>> g;
int main(){
    ll h, w, k; cin >> h >> w >> k;
    g.resize(h, vector<char>(w));
    REP(i, h) REP(j, w) cin >> g[i][j];
    ll res=0;
    REP(bit, 1<<w+h){
        vector<vector<char>> cp = g;
        REP(on, h+w){
            if(bit & 1<<on){
                if(h<=on){
                    REP(i, h){
                        cp[i][on-h] = '.';
                    }
                }else{
                    REP(i, w){
                        cp[on][i] = '.';
                    }
                }
            }
        }
        ll tmp=0;
        REP(i, h)   REP(j, w) tmp += cp[i][j]=='#';
        if(tmp==k){
            //cout << bit << endl;
            res+= 1;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 3636
l=[]
for i in range(3):
  x,y,z=map(int,input().split())
  l.append([x,y,z])
c11=l[0][0]
c12=l[0][1]
c13=l[0][2]
c21=l[1][0]
c22=l[1][1]
c23=l[1][2]
c31=l[2][0]
c32=l[2][1]
c33=l[2][2]
if (c21-c11)==(c22-c12)==(c23-c13) and (c31-c11)==(c32-c12)==(c33-c13):
  print('Yes')
else:
  print('No')

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

int main(){
	int n;
	cin >> n;
	vector<int> t(n+1);
	vector<int> x(n+1);
	vector<int> y(n+1);
	for(int i = 1; i < n+1; i++) cin >> t.at(i) >> x.at(i) >> y.at(i);

	bool res = true;
	rep(i, n){
		int dt = t.at(i+1) - t.at(i);
		int dist = abs(x.at(i+1) - x.at(i) + y.at(i+1) - y.at(i));
		if(dt < dist) res = false;
		if(dt%2 != dist%2) res = false;
	}

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

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    string s ;
    cin >> s;
    reverse(s.begin(), s.end());
    vector<string> tes;
    tes.push_back("dreamer");
    tes.push_back("dream");
    tes.push_back("erase");
    tes.push_back("eraser");
    for(auto &v : tes) {
        reverse(v.begin(), v.end());
    }

    int index = 0;
    while(index < s.size() - 1) {
        bool ok = false;
        for(auto v : tes) {
            bool flag = true;
            for(int i = 0; i < v.size(); ++i) {
                if(s[index+i] != v[i]) {
                    flag = false;
                }
            }
            if(flag) {
                index += v.size();
                ok = true;
                break;
            }
        }
        if(!ok){
            cout << "NO" << endl;;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 512
N, M, X = [int(i) for i in input().split()]
C = []
B = []
for i in range(N):
    c, *a = [int(i) for i in input().split()]
    C.append(c)
    B.append(a)
minv = 10**18
for bit in range(1<<N):
    c = 0
    u = [0]*M
    for i in range(N):
        if(1 & bit >> i):
            c += C[i]
            for j in range(M):
                u[j] += B[i][j]

    if all([u[i] >= X for i in range(M)]):
        minv = min(minv, c)

if minv == 10**18:
    print(-1)
else:
    print(minv)

Measured memory_bytes: 9256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define Graph vector<vector<ll>>
#define INF (1ll<<60)
#define mod 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    ll n;cin>>n;
    Graph G(n);
    rep(i,n-1){
        ll a,b;cin>>a>>b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    queue<ll> que;
    que.push(0);
    que.push(n-1);

    ll f_can=0,s_can=0;//fennec snuke それぞれの個数
    vector<ll> visit(n,-1);
    ll black=0,white=1;
    visit[0]=black;
    visit[n-1]=white;

    while(que.size()!=0){
        ll now=que.front();
        que.pop();
    
        if(now!=-1){
            for(auto next:G[now]){
                if(visit[next]!=-1) continue;
                visit[next]=visit[now];

                que.push(next);
                if(visit[now]==black) f_can++;
                else s_can++;
            }
        }
    }

    if(f_can>s_can) cout<<"Fennec"<<endl;
    else cout<<"Snuke"<<endl;

    return 0;
}

Measured memory_bytes: 10124
#include <iostream>

using namespace std;

int main()
{
    long long int X, H;

    cin >> X;

    H = X / 500;
    X = X - (H*500);
    H = 1000 * H;
    
    H = H + (5 * (X / 5));

    cout << H << "\n";

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#define ll long long
#define ull unsigned long long
#define mn 1000020
#define FOR(a,b,c) for (int a=b;a<=c;a++)
#define FORD(a,b,c) for (int a=b;a>=c;a--)
using namespace std;
inline ll read(){
    ll x=0,f=1;
    char c=getchar();
    while (c<'0'||c>'9'){
        if (c=='-')f=-1;
        c=getchar();
    }
    while (c>='0'&&c<='9'){
        x=x*10+c-'0';
        c=getchar();
    }
    return x*f;
}
int Max(int a,int b){return (a>b)?a:b;}
int Min(int a,int b){return (a<b)?a:b;}

int main(){
	int n=read();
	if(n<1200)printf("ABC\n");else if(n<2800)printf("ARC\n");else printf("AGC\n");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,N) for(ll i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int k;
double R, L, p, e, t;

double solve(int cnt, double r, double l) {
	if (l + EPS < t - e || t + e + EPS < r)return 0.0;
	////cout << cnt << " " << r << " " << l << endl;
	double h = (r + l) / 2;
	if (cnt == 0) {
		//cout << r << " " << l << " " << h << endl;
		if (t - e < h + EPS&&h < t + e + EPS)return 1.0;
		return 0.0;
	}
	double res = 0;
	if (t < h + EPS) {
		res += (1 - p)*solve(cnt - 1, r, h);
		res += p*solve(cnt - 1, h, l);
	}
	else {
		res += (1 - p)*solve(cnt - 1, h, l);
		res += p*solve(cnt - 1, r, h);
	}
	//cout << "!" << cnt << " " << res << endl;
	return res;
}

int main() {
	cin >> k >> R >> L >> p >> e >> t;
	printf("%.10lf\n", solve(k, R, L));
}


Measured memory_bytes: 3292
#include <bits/stdc++.h> 
 
#define ll long long
using namespace std; 
 
int main() 
{ 
   ll n,i;
   cin>>n;
   ll a[n];
   ll sum=0;
   vector< ll >v;
   for(i=0;i<n;i++){
       cin>>a[i];
       sum+=a[i];
   }
   ll q;
   cin>>q;
   ll b , c;
   unordered_map< ll, ll > hm;
   for(ll j=0;j<n;j++){
               hm[a[j]]++;
           }
              
   for(i=0;i<q;i++){
            cin>>b>>c;
            sum=sum+hm[b]*(c-b);
            hm[c]+=hm[b];
            hm[b]=0;
            cout<<sum<<"\n";
   }
   return 0;
}
 
 
 

Measured memory_bytes: 7840
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }


set<string> s;
string s0, t;
int n,m;

void check(int index){
  // s0のi文字目からがtに一致しうるかどうかを判定。一致しうるならsに突っ込む。
  string ss = s0;
  bool ok = true;
  for (int i=0; i<m; i++){
    int ci = i + index;
    if (ss.at(ci) == '?'){
      ss.at(ci) = t.at(i);
    }else if (ss.at(ci) != t.at(i)){
      ok = false; break;
    }
  }
  if (ok){
    for (int i=0; i<n; i++) if (ss.at(i) == '?') ss.at(i) = 'a';
    s.insert(ss);
  }
}

int main() {
  cin >>s0 >>t;
  n = s0.size();
  m = t.size();

  string res = "UNRESTORABLE";
  if (n >= m){
    for (int i=0; i<=n-m; i++){
      check(i);
    }
    if (!s.empty()) res = *begin(s);
  }

  cout <<res <<endl;

}

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

int main(){
	int A,B,X;
	cin>>A>>B>>X;
	if(A<=X){
		if(A+B>=X){
			cout<<"YES"<<endl;
			return 0;
		}
		else{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	else{
		cout<<"NO"<<endl;
		return 0;
	}
}

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

int main(){
    int a, b, c;
    cin>>a>>b>>c;
    if(b-a == c-b){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
ll mod = 1e9 + 7;

int main()
{
	int n;
	cin >> n;
	vector<int> d(n);
	rep(i, n)cin >> d[i];
	int ans = 0;
	rep(i, n)
	{
		for (int j = i+1; j < n; j++)
		{
			ans += d[i] * d[j];
		}
	}
	co(ans);
	return 0;
}


Measured memory_bytes: 256
from math import *

def S(p):
	return sum([sin(angle*pi/180)/2 for angle in p])

while 1:
	m=input()
	if m==0:break
	p1=[int(raw_input()) for i in range(m-1)]
	p1.append(360-sum(p1))
	n=input()
	p2=[int(raw_input()) for i in range(n-1)]
	p2.append(360-sum(p2))
	s1,s2=S(p1),S(p2)
	if    s1-s2>1e-10: print 1
	elif  s2-s1>1e-10: print 2
	else:print 0

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

using namespace std;

int main(int argc, const char *argv[]) {
  string s, t;
  cin >> s >> t;
  if (t.size() - s.size() != 1) {
    cout << "No" << '\n';
    return 0;
  }

  for (int i = 0; i < s.size(); ++i) {
    if (s[i] != t[i]) {
      cout << "No" << '\n';
      return 0;
    }
  }

  cout << "Yes" << '\n';
  return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define allsort(v) sort(v.begin(),v.end())
#define allsortg(v)sort(v.begin(),v.end(),greater<int>());
const ll mod = 1e9 + 7;
const int INF = 1e9;

int main() {
	int H, W;
	cin >> H >> W;
	char a[100][100];
	rep(i, H) {
		rep(j, W)cin >> a[i][j];
	}
	rep(i, H+2) {
		cout << "#";
		rep(j, W) {
			if (i == 0 || i == H + 1)cout << "#";
			else cout << a[i-1][j];
		}
		cout << "#" << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
#define MOD 1000000007
#define MAX 1000005
#define MAX_NUM 300001
int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
    printf("%d",(n*(n-1)+m*(m-1))/2);
    return 0;
}


Measured memory_bytes: 256
from math import floor,ceil
n,d=map(int,input().split())
P=[list(map(int,input().split())) for _ in range(n)]
def judge(A,B):
    d=len(A)
    s=0
    for i in range(d):
        s+=(A[i]-B[i])**2
    s=s**0.5
    return floor(s)==ceil(s)
ans=0
for i in range(n):
    for j in range(i+1,n):
        ans+=judge(P[i],P[j])
print(ans)

Measured memory_bytes: 38384
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Map<Integer, Integer> map = new HashMap<>();

        for (int i = 1; i < n; i++) {
            int number = scanner.nextInt();
            if (!map.containsKey(number)) {
                map.put(number, 0);
            }
            map.put(number, map.get(number) + 1);
        }

        for (int i = 1; i <= n; i++) {
            if (map.containsKey(i)) {
                System.out.println(map.get(i));
            } else {
                System.out.println(0);
            }
        }
    }

}

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

long long power(long long n)
{
    long long ret = 1;
    long long x = 2;
    while (n > 0)
    {
        if (n & 1)
        {
            ret *= x;
        }
        x *= x;
        n >>= 1;
    }
    return ret;
}

long long f(long long n, long long idx)
{
    if (idx == 0)
    {
        return ((n + 1) / 2) % 2;
    }

    long long ret = 0;
    long long p = power(idx);
    ret += (n / (p * 2)) * p;
    n %= p * 2;
    if (n >= p)
    {
        return !(n % 2);
    }
    return ret % 2;
}

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

    long long ans = 0;
    for (int i = 0; i < 40; i++)
    {
        if (abs(f(B, i) - f(A - 1, i)) % 2 == 1)
        {
            ans += power(i);
        }
    }
    cout << ans << endl;
}


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

int main(void)
{
    int n,x[4];
    cin >> n;
    x[0] = n / 1000;
    x[1] = n / 100 - x[0] * 10;
    x[2] = n / 10 - x[1] * 10 - x[0] * 100;
    x[3] = n - x[2] * 10 - x[1] * 100 - x[0] * 1000;
    if(x[0] == x[1] && x[1] == x[2]){cout << "Yes" << endl;}
    else if(x[1] == x[2] && x[2] == x[3]){cout << "Yes" << endl;}
    else{cout << "No" << endl;}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e6 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(int, n);
	VEC(int, v, n);

	vector< int > p(MAX_N, 0);
	vector< int > q(MAX_N, 0);
	REP(i, n) {
		if (i & 1) {
			p[v[i]]++;
		} else {
			q[v[i]]++;
		}
	}

	int mx = 0;
	REP(i, MAX_N) {
		mx = max(mx, p[i]);
	}
	
	set< int > tmp;
	REP(i, MAX_N) {
		if (p[i] == mx) {
			tmp.insert(i);
		}
	}
	sort(ALL(p));
	reverse(ALL(p));

	int ans = 0;
	REP(i, n) {
		int N = v[i++];
		int res = q[N];

		if (tmp.count(N)) {
			res += p[1];
		} else {
			res += p[0];
		}

		ans = max(res, ans);
	}

	OUT(n - ans)BR;
	
  return 0;
}


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

int main(){
    //入力
    int a, b;
    cin >> a >> b;

    //判定して出力
    if (a * b % 2 == 0) {
        cout << "Even" << endl;
    }
    else {
        cout << "Odd" << endl;
    }
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var A = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var answer = Math.Min(A[0] + A[1], A[0] + A[2]);
            answer = Math.Min(answer, A[1] + A[2]);
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 27900
// C++ program for implementation of Ford Fulkerson algorithm 
#include <iostream> 
#include <limits.h> 
#include <string.h> 
#include <queue> 
#include <iostream> 
#include <set> 
#include <iterator> 

using namespace std; 

int main(){
set<int,greater<int>>sets;
int n,p1;

cin>>n;
for(int i=0;i<n;i++){
cin>>p1;
sets.insert(p1);
}
set<int>set2(sets.begin(),sets.end());
 set <int, greater <int> > :: iterator itr; 
if(set2.size()!=n){
  cout<<"NO";
}else
  cout<<"YES";

}

Measured memory_bytes: 18944
#include<stdio.h>

int main(void)
{
int W,H,x,y,r;

scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

if(x-r<0||y-r<0||x+r>W||y+r>H)
{
printf("No\n");
}
else{
printf("Yes\n");
}
return 0;
}

Measured memory_bytes: 584
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<functional>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#define lowbit(a) ((a)&(-(a)))
using namespace std;

void file(bool opt)
{
	if (opt&&fopen("in.txt", "r"))
	{
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}
}

long long ans = 0;
long long v[55];

priority_queue<long long, vector<long long>,greater< long long>>q2;

int main()
{
	int n, k;
	cin >> n>>k;
	for (int i = 1; i <= n; i++)
		cin >> v[i];
	for (int i = 0; i <= k / 2; i++)
	{
		int sum = k - i;
		for (int l = 0; l <= sum; l++)
		{
			long long sum2 = 0;
			while (!q2.empty())q2.pop();
			int fg = 0;
			for (int x = 1; x <= l && x<=n; x++)
				q2.push(v[x]),sum2+=v[x],fg=x;
			for(int x=1;x<=sum-l&&n-x+1>fg;x++)
				q2.push(v[n - x + 1]), sum2 += v[n - x + 1];

			int box = i;
			ans = max(ans, sum2);
			while (box--&&q2.size())
			{
				sum2 -= q2.top();
				q2.pop();
				ans = max(ans, sum2);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int n, m, cnt=0;
int k[12], p[12], s[12][12], ison[12];


void solve(int num){
  if(num <= n){
    ison[num] = 1;
    solve(num+1);
    ison[num] = 0;
    solve(num+1);
  }else{
    for(int i=0;i<m;++i){
      int oncnt = 0;
      for(int j=0;j<k[i];++j){
        if(ison[s[i][j]]) ++oncnt;
      }
      if((oncnt%2)!=p[i]) return;
    }
    ++cnt;
  }
}

int main(void){
  cin >> n >> m;
  for(int i=0;i<m;++i){
    cin >> k[i];
    for(int j=0;j<k[i];++j){
      cin >> s[i][j];
    }
  }
  for(int i=0;i<m;++i){
    cin >> p[i];
  }
  for(int i=0;i<=n;++i) ison[i] = 0;
  solve(1);
  cout << cnt << endl;
}


Measured memory_bytes: 256
import sys
def f(h,i,j,k):
 z=(j-h)*(y-k)-(k-i)*(x-j);return([-1,1][z>0],0)[z==0]
for e in sys.stdin:
 p,q,r,s,t,u,x,y=map(float,e.split())
 print(['NO','YES'][f(p,q,r,s)==f(r,s,t,u)==f(t,u,p,q)])


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

int main()
{
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort (a.begin(), a.end());
  cout << (a[1] - a[0]) + (a[2] - a[1]) << endl;
}

Measured memory_bytes: 256
n = int(input())
V = list(map(int,input().split()))
a = [0]*100000
b = [0]*100000
v1=[]
v2=[]

if len(set(V)) == 1:
    print(n//2)

else:
    for i in range(n):
        if i%2 == 0:
            a[V[i]-1] += 1
            v1.append(V[i])
        else:
            b[V[i]-1] += 1
            v2.append(V[i])

    max1 = 0
    max2 = 0

    for j in range(len(a)):
        if max1 < a[j]:
            max1 = a[j]
            c1 = j
    for k in range(len(b)):
        if max2 < b[k]:
            max2=b[k]
            c2=k

    if c1 != c2:
        print(n-max1-max2)
    else:
        a.sort()
        b.sort()
        print(min(n-max1-b[-2],n-max2-a[-2]))


Measured memory_bytes: 58988
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int f = 0;
  if(a == b) f++;
  if(b == c) f++;
  if(a == c) f++;
  
  if(f != 1){
  	cout << "No" << endl;
  }else{
  	cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef pair<int ,string> pis;
 
 
const int INF = 10000000;


vector<string> split(const string &s, char c = ' '){
	vector<string> ret;
	stringstream ss(s);
	string t;
	while(getline(ss,t,c)){
		ret.pb(t);
	}
	return ret;
}


int main(){
	int n;
	string s;
	char c;
	while(cin>>n && n > 0){
		cin.ignore();
		map<string, int> m;
		rep(i,n){
			getline(cin, s);
			vector<string> v = split(s);
			rep(j, v.size()) m[v[j]]++;
		}
		cin>>c;
		vector<pair<int,string> > v;
		for(auto it = m.begin(); it != m.end(); it++){
			if(it->fi[0] == c) v.pb(pis(-it->se, it->fi));
		}
		sort(all(v));
		for(int i = 0; i < min((int)v.size(), 5); i++){
			if(i != 0) cout<<" ";
			cout<<v[i].se; 
		}
		if(v.size() == 0) cout<<"NA";
		cout<<endl;
	}
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
const double PI = 3.14159265358979323846;
using namespace std;
int main()
{
  double R;
  cin >> R;
  //cout << 2 * PI * R << endl;
  printf("%.12lf", 2 * PI * R);
  return 0;
}

Measured memory_bytes: 3776
# include <iostream>
using namespace std;
int main(){

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

  if(a <= 0 && 0 <= b) cout << "Zero";
  else if(a > 0) cout << "Positive";
  else if((b-a)%2 == 1) cout << "Positive";
  else cout << "Negative";

  cout << endl;

  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

for i in range(n):
    v = a[i]
    j = i-1
    while j>=0 and a[j]>v:
        a[j+1] = a[j]
        j -= 1
        a[j+1] = v
    print(*a,sep=' ')


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

struct Graph
{
    int n;
    vector<vector<int>> g;
    
    Graph(int n) : n(n){
        g.resize(n);
    }
    
    void init(int n_){
        n = n_;
        g.resize(n_);
    }
    
    void add_edge(int from, int to){
        g[from].push_back(to);
    }
};

struct Tree	//create tree(directed) from graph(undirected)
{
    int n;
    int root;
    vector<vector<int>> t;
    vector<int> par;
    vector<int> dpt;
    
    void init(Graph &g, int root_){
        n = g.n;
        root = root_;
        t.resize(n);
        par.resize(n);
        dpt.resize(n);
        fill(dpt.begin(), dpt.end(), -1);
        queue<int> que;
        par[root] = -1;
        dpt[root] = 0;
        que.push(root);
        while(que.size()){
            int pa = que.front();
            que.pop();
            for(int ch : g.g[pa]){
                if(dpt[ch] == -1){
                    t[pa].push_back(ch);
                    par[ch] = pa;
                    dpt[ch] = dpt[pa] + 1;
                    que.push(ch);
                }
            }
        }
    }

    Tree(){}
    
    Tree(Graph &g, int root_){
        init(g, root_);
    }
    
    vector<int> toposort(){
        typedef pair<int, int> P;
        vector<P> p(n);
        for(int i = 0; i < n; i++) p[i] = P(dpt[i], i);
        sort(p.begin(), p.end(), greater<P>());
        vector<int> res(n);
        for(int i = 0; i < n; i++) res[i] = p[i].second;
        return res;
    }
};

int main()
{
    int n;
    cin >> n;
    Graph g(n);
    for(int i = 0; i < n - 1; i++){
        int u, v;
        cin >> u >> v;
        u--; v--;
        g.add_edge(u, v);
        g.add_edge(v, u);
    }
    Tree t1(g, 0);
    int l = 0;
    for(int i = 0; i < n; i++){
        if(t1.dpt[i] > t1.dpt[l]) l = i;
    }
    Tree t2(g, l);
    int r = 0;
    for(int i = 0; i < n; i++){
        if(t2.dpt[i] > t2.dpt[r]) r = i;
    }
    vector<int> v1;
    v1.push_back(1);
    int k = 2;
    int u = t2.par[r];
    while(u != l){
        for(int i = 0; i < (int)t2.t[u].size() - 1; i++){
            v1.push_back(k + i + 1);
        }
        v1.push_back(k);
        k += (int)t2.t[u].size();
        u = t2.par[u];
    }
    if(k != n){
        cout << -1 << endl;
        return 0;
    }
    v1.push_back(n);
    Tree t3(g, r);
    vector<int> v2;
    v2.push_back(1);
    k = 2;
    u = t3.par[l];
    while(u != r){
        for(int i = 0; i < (int)t3.t[u].size() - 1; i++){
            v2.push_back(k + i + 1);
        }
        v2.push_back(k);
        k += (int)t3.t[u].size();
        u = t3.par[u];
    }
    v2.push_back(n);
    if(v1 < v2){
        for(int i = 0; i < n; i++) cout << v1[i] << " ";
    }
    else{
        for(int i = 0; i < n; i++) cout << v2[i] << " ";
    }
    cout << endl;
}


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

int main(){
  string s,ans="";
  cin >> s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='B'&&s.size()!=0) ans.pop_back();
    else if(s[i]=='0') ans.push_back('0');
    else if(s[i]=='1') ans.push_back('1');
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
cin >> n;
map<string, int> u;
ll ans = 0;
rep(i,n){
    string s;
    cin >> s;
    if(!u.count(s)){
        u[s]++;
        ans++;
    }
}
cout << ans << endl;
//system("pause");
return 0;
}

Measured memory_bytes: 19248
#include <bits/stdc++.h>
#define newl "\n"
using namespace std;
using lli = long long int;
using vvint = vector <vector <int>>;
const int mod = 1e9 + 7;

void solve(){
	int k;
	cin >> k;
	int num = 7;
	if(k % 2 == 0 or k % 5 == 0){
		cout << -1 << newl;
		return;
	}
	for(int i = 1;i <= k;++i){
		if(num % k == 0){
			cout << i << newl;
			return;
		}
		num = (10 * num % mod + 7) % k;
	}
	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(10);
	#ifdef EXECUTE_LOCALLY
		   freopen("in.txt","r",stdin);
	#endif
	int t = 1;
	//cin >> t;
	while(t--) solve();
	#ifdef EXECUTE_LOCALLY
    	cout << setprecision(3) << "program time: " << (double)clock() / CLOCKS_PER_SEC << newl;
	#endif
	return 0;
}


Measured memory_bytes: 3608