akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

const ll mx=1e18;

void solve(){
 ll n;
 cin >> n;
 vll a(n),b(n);
 rep(i,0,n) cin >> a[i] >> b[i];
 sort(all(a));
 sort(all(b));
 
 if(n%2){
  cout << b[n/2]-a[n/2]+1 << endl; 
 }else{
  cout << b[n/2-1]+b[n/2]-a[n/2-1]-a[n/2]+1 << endl;
 }
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}  

Measured memory_bytes: 6352
#include <bits/stdc++.h>
#define il inline
const int N=1e5+5;

int n,m,x,ans,a[N],b[N]; bool p[N];
int to[N+N],nx[N+N],hd[N],sze;
std::unordered_map<int,int> o;

il void add(int u,int v){to[++sze]=v,nx[sze]=hd[u],hd[u]=sze;}

il void dfs(int u){p[u]=1; for (int i=hd[u],v; i; i=nx[i]) if (!p[v=to[i]]) dfs(v);}

int main()
{
	scanf("%d",&n); int i;
	for (i=1; i<=n; i++) scanf("%d",a+i),o[a[i]]++,x^=a[i];
	o[x]++; for (i=1; i<=n; i++) scanf("%d",b+i),o[b[i]]--;
	for (auto &j:o)
		if (j.second<0) return puts("-1"),0;
		else j.second=++m;
	for (i=1; i<=n; i++) if (a[i]!=b[i])
		add(o[a[i]],o[b[i]]),add(o[b[i]],o[a[i]]),ans++;
	
	for (i=1; i<=m; i++) if (!p[i]&&hd[i]) ans++,dfs(i);
	(hd[o[x]])&&(ans--),printf("%d",ans);
	
	return 0;
}

Measured memory_bytes: 14708
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		
		if(x>=400 && x<600) System.out.println(8);
		else if(x>=600 && x<800) System.out.println(7);
		else if(x>=800 && x<1000) System.out.println(6);
		else if(x>=1000 && x<1200) System.out.println(5);
		else if(x>=1200 && x<1400) System.out.println(4);
		else if(x>=1400 && x<1600) System.out.println(3);
		else if(x>=1600 && x<1800) System.out.println(2);
		else if(x>=1800 && x<2000) System.out.println(1);
		
	}
}


Measured memory_bytes: 35580
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  vll p(N);
  
  for(int i = 0; i < N; i++){
    cin >> p.at(i);
  }

  ll ans = 0;
  ll counter = 0;
  for(int i = 0; i < N; i++){
    if(p.at(i) == i+1){
      while(i < N && p[i] == i+1){
        counter++;
        i++;
      }
      i--;
      ans += (counter+1)/2;
      counter = 0;
    }
  }
  cout << ans << endl;
}

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

int main() {
  string s;
  cin >> s;
  int l = s.size();
  string y = "AC";
  
  if(s[0] != 'A'){
    y = "WA";
  }
  
  int count = 0;
  int x = 0;
  int z = 0;
  int w = 0;
  
  for(int i = 0; i< l; i++){
    if(0 < i && i < l -1){
      if(s.at(i) == 'C'){
        count++;
      }
    }
    if(isupper(s[i])){
      x++;
    }
    if(s[i] == 'C'){
      w++;
      if(i < 2 || i == l-1){
        z++;
      }
    }
  }
  
  if(count != 1 || x != 2 || z != 0 || w != 1){
    y = "WA";
  }
  
  cout << y << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int N = sc.nextInt(), W = sc.nextInt();
			int[] v = new int[N], w = new int[N];
			for(int i = 0; i < N; i++) {
				w[i] = sc.nextInt();
				v[i] = sc.nextInt();
			}
			long[][] dp = new long[N + 1][100001];
			for(int i = 0; i <= N; i++) {
				for(int j = 0; j <= 100000; j++) {
					dp[i][j] = W + 1;
				}
			}
			dp[0][0] = 0;
			for(int i = 0; i < N; i++) {
				for(int j = 0; j <= 100000; j++) {
					if(dp[i][j] != W + 1) {
						dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j]);
						dp[i + 1][j + v[i]] = Math.min(dp[i][j] + (long)w[i], dp[i + 1][j + v[i]]);
					}
				}
			}
			long ans = 0;
			for(int i = 0; i <= 100000; i++) {
				if(dp[N][i] != W + 1) ans = Math.max(ans, i);
			}
			System.out.println(ans);
		}
	}
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

bool good(string sleft, string sright, ll left, ll right) {
    if((left - right) % 2) return sleft == sright;
    else return sleft != sright;
}

int main(void) {
    ll N;
    ll l = 0, r;
    string L, R;
    cin >> N;
    r = N - 1;
    cout << l << endl;
    cin >> L;
    if(L == "Vacant") return 0;
    cout << r << endl;
    cin >> R;
    if(R == "Vacant") return 0;
    if(!good(L, R, l, r)) swap(L, R), l = r, r = N;
    while(true) {
        string temp;
        ll mid = (l + r) / 2;
        cout << mid << endl;
        cin >> temp;
        if(temp == "Vacant") break;
        if(good(L, temp, l, mid)) R = temp, r = mid;
        else L = temp, l = mid;
    }
    return 0;
}


Measured memory_bytes: 852
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, a, b, c, d;
  cin >> N;
  a = N / 1000;
  b = N / 100 % 10;
  c = N / 10 % 10;
  d = N % 10;
  if ((a == b && b == c) || (b == c && c == d))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define ll long long
#define pii pair<int,int> 
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
int inf=1000001000;
ll INF=100000000000000000;
ll MOD=1000000007;
//g++ code.cpp   ./a.out 

int main() {
   int n,m; cin >> n >> m;
   vector<int> cnt(m);
   rep(i,n){
      int k; cin >> k;
      rep(j,k){
         int a; cin >> a;
         a--;
         cnt[a]++;
      }
   }
   int ans=0;
   rep(i,m){
      if(cnt[i]==n) ans++;
   }
   cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<queue>
#include<map>
#include<stack>
#include<set>
using namespace std;
int main(){
	string s;
	cin >> s;
	for(int i = 0;i < s.size();i++){
		if(s[i]==',')printf(" ");
		else printf("%c",s[i]);
		}
	return 0;
	}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
ans = 0
c = 0
for i in a:
	if i % 2 == 0:
		c += 1
		if i % 3 == 0 or i % 5 == 0:
			ans += 1
		else:
			ans -= 1
			
if ans == c:
	print('APPROVED')
else:
	print('DENIED')

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};


int main(){
  
  string s;
  cin >> s;
  bool flag = false;
  if(s[0] == s[1] && s[0] == s[2])flag = true;
  if(s[1] == s[2] && s[2] == s[3])flag = true;
  if(flag)cout << "Yes" << endl;
  else cout << "No" << endl;



  
  


  return 0;
}


Measured memory_bytes: 256
void main()
{
    long n = readln.chomp.to!long;
    long[] a = new long[n];
    long[][] x = new long[][](n), y = new long[][](n);
    foreach (i; 0 .. n)
    {
        a[i] = readln.chomp.to!long;
        foreach (j; 0 .. a[i])
        {
            long[] tmp = readln.split.to!(long[]);
            x[i] ~= tmp[0] - 1, y[i] ~= tmp[1];
        }
    }

    long result;
    foreach (i; 0 .. (1 << n))
    {
        bool ok = true;
        foreach (j; 0 .. n)
        {
            if (!((1 << j) & i)) continue;

            foreach (k; 0 .. a[j])
            {
                if (((i >> x[j][k]) & 1) ^ y[j][k]) ok = false;
            }
        }

        if (ok) result = max(result, popcnt(i));
    }

    result.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>	
#define pb push_back
#define mp make_pair
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;

const int inf = int(2e9);
const int mod = inf + 7;
using namespace std;

void solve()
{
	string s;
	cin >> s;
	int ones = 0, zeros = 0;
	rep(i, s.size()){
		if(i % 2 == 0){
			if(s[i] == '0') ones++;
			else zeros++;
		}
		else{
			if(s[i] == '0') zeros++;
			else ones++;
		}
	}
	cout << min(ones, zeros);
}

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


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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 void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    double r;
    cin >> r;
    cout << r * 2 * 3.1415 << endl;
}


Measured memory_bytes: 3804
#include <iostream>
#include <string>

using namespace std;


int main(int argc, char* argv[]){
    int N;
    string S;

    cin >> N;
    cin >> S;

    int minCount = N;
    int rightW = 0;
    int leftB = 0;

    for(int j = 0; j < N; j++){
        if(S[j] == '.')rightW++;
    }
    
    for(int i = 0; i < N; i++){
        if(minCount > leftB + rightW)minCount = leftB + rightW;
        if(S[i] == '.'){
            rightW--;
            //
        }else{
            leftB++;
        }
       // cout << i << ":[w] " << rightW <<   ", :B "<< leftB<< endl;

        if(minCount > leftB + rightW)minCount = leftB + rightW;
    }
    cout << minCount << endl;

    return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,v.size())
#define all(v)(v).begin(),(v).end()
#define bit(n)(1ll<<(n))
#define uniq(v)sort(all(v));v.erase(unique(all(v)),v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&s){}template<class T,class...U>void _print(ostream&s,T&&t,U&&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(T&&...t){_print(cout,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#else
template<class...T>void dprint(T&&...t){_print(cerr,t...);}
#endif
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>ostream&operator<<(ostream&o,const multiset<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

class UnionFind{
private:
	vi data;
public:
	UnionFind(int size):data(size,-1){}
	bool unite(int x,int y){
		x=root(x);y=root(y);
		if(x!=y){
			if(data[y]<data[x])swap(x,y);
			data[x]+=data[y];data[y]=x;
		}
		return x!=y;
	}
	bool find(int x,int y){
		return root(x)==root(y);
	}
	int root(int x){
		return data[x]<0?x:data[x]=root(data[x]);
	}
	int size(int x){
		return -data[root(x)];
	}
};

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n,k,l;
    cin>>n>>k>>l;
    UnionFind a(n),b(n);
    REP(i,k){
        int p,q;
        cin>>p>>q;
        a.unite(p-1,q-1);
    }
    REP(i,l){
        int r,s;
        cin>>r>>s;
        b.unite(r-1, s-1);
    }
    map<P, int> p;
    REP(i,n){
        p[P(a.root(i), b.root(i))]++;
    }
    REP(i,n){
        cout<<p[P(a.root(i), b.root(i))]<<' ';
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 13568
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();

        char[] c = new char[26];
        char[] c2 = new char[26];
        for (int i = 0; i < 26; i++) {
            c[i] = '0';
            c2[i] = '0';
        }

        for (int i = 0; i < s.length(); i++) {
            char sChar = s.charAt(i);
            char tChar = t.charAt(i);

            if (c[sChar - 97] == '0') {
                c[sChar - 97] = tChar;
            } else if (c[sChar - 97] != tChar) {
                System.out.println("No");
                return;
            }

            if (c2[tChar - 97] == '0') {
                c2[tChar - 97] = sChar;
            } else if (c2[tChar - 97] != sChar) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}


Measured memory_bytes: 28128
#include<iostream>
#include<iomanip>
#include<cmath>
#include<utility>
using namespace std;

struct Point{
    double x;
    double y;
    Point(double x, double y) : x(x), y(y) {}
    Point operator-(Point p){
        return Point(x - p.x, y - p.y);
    }
    Point operator+(Point p){
        return Point(x + p.x, y + p.y);
    }
    Point operator*(double d){
        return Point(x * d, y * d);
    }
};
typedef Point Vector;
double dot(Vector v1, Vector v2){
    return v1.x * v2.x + v1.y * v2.y;
}
double cross(Vector v1, Vector v2){
    return v1.x * v2.y - v1.y * v2.x;
}
struct Line{
    Point p1;
    Point p2;
    Line(Point p1, Point p2) : p1(p1), p2(p2) {}
};
struct Circle{
    Point c;
    double r;
    Circle(Point c, double r): c(c), r(r) {}
};

pair<Point, Point> cross_point(Circle c, Line l){
    Vector b = l.p2 - l.p1;
    Vector h = c.c - l.p1;
    double d = fabs(cross(b, h)) / sqrt(dot(b, b));
    Point x =  l.p1 + b * (dot(h, b) / dot(b, b));
    Point alpha = b * (sqrt(c.r * c.r - d * d) / sqrt(dot(b, b)));
    return make_pair(x + alpha, x - alpha);
}

void disp(pair<Point, Point> p){
    Point f = p.first;
    Point s = p.second;
    if (f.x > s.x || (f.x == s.x && f.y > s.y)) swap(f, s);
    cout << fixed << setprecision(10);
    cout << f.x << " " << f.y << " " << s.x << " " << s.y << endl;
}

int main(){
    int cx, cy, r;
    cin >> cx >> cy >> r;
    Circle c(Point(cx, cy), r);
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        Line l(Point(x1, y1), Point(x2, y2));
        disp(cross_point(c, l));
    }
    return 0;
}



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

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

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

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

  cout << lcm(A, B) << endl;
}

Measured memory_bytes: 3596
package main
import "fmt"
func main(){
	var N, M int
	fmt.Scan(&N, &M)
	DP := make([]int, N+101)
	for i:=0; i<M; i++{
		var V int
		fmt.Scan(&V)
		DP[V] = -1
	}
	if DP[1] == 0{
		DP[1]= 1
	}
	if DP[2] == 0{
		if DP[1] > 0{
			DP[2] = 2
		}else{
			DP[2] = 1
		}
	}
	for i:=3; i<=N; i++{
		if DP[i] == -1{
			continue
		}
		if DP[i-2] > 0{
			DP[i] += DP[i-2]
		}
		if DP[i-1] > 0{
			DP[i] += DP[i-1]
		}
		DP[i] %= (int(1e9)+7)
	}
	fmt.Println(DP[N])
}

Measured memory_bytes: 6244
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
sum=0
for i in range(0,N):
    sum=sum+B[i]
    if i<=N-2 and A[i+1]-A[i]==1:
        sum=sum+C[A[i]-1]
    
print(sum)

Measured memory_bytes: 9124
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
 
typedef long long ll;
 
int main() {
	int a = 0;
	std::cin >> a;
	if (a - ((a / 10)*10) == 9 || a == 9 || a >= 90) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}
}

Measured memory_bytes: 256
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	static class State implements Comparable<State> {
		int time;
		State(int time){
			this.time = time;
		}
		public int compareTo(State s) {
			if((10 - (time+9)%10) > (10 - (s.time+9)%10)) {
				return 1;
			}
			return -1;
		}
	}

    public static void main(String[] args) throws Exception {
    	try(Scanner sc = new Scanner(System.in)) {

    		PriorityQueue<State> pq = new PriorityQueue<State>();
    		for(int i=0; i<5; i++) {
    			int time = sc.nextInt();
    			pq.add(new State(time));
    		}
    		int ans = 0;
    		for(int i=0; i<4; i++){
    			State next = pq.remove();
    			//System.out.println(next.time);
    			ans += (next.time + 9)/10 *10;
    		}
    		ans += pq.remove().time;
    		System.out.println(ans);
    	}
    }
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef vector<int> V;

int main() {
  int n;
  cin >> n;
  if (n == 25) dump("Christmas");
  else if (n == 24) dump("Christmas Eve");
  else if (n == 23) dump("Christmas Eve Eve");
  else if (n == 22) dump("Christmas Eve Eve Eve");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, K, a, b;
vector<int>v[100000];
bool vis[100000];
ll res;

void dfs(int x) {
	vis[x] = true;
	bool f = false;
	for (int i : v[x]) {
		f |= vis[i];
	}
	if (f) {
		for (ll i = 0; i < v[x].size() - 1; ++i) {
			res *= (K - 2 - i);
			res %= mod;
		}
	}
	else {
		for (ll i = 0; i < v[x].size(); ++i) {
			res *= (K - 1 - i);
			res %= mod;
		}
	}
	for (int i : v[x]) {
		if (!vis[i]) {
			dfs(i);
		}
	}
}

int main() {
	cin >> N >> K;
	for (int i = 0; i < N - 1; ++i) {
		cin >> a >> b;
		--a;
		--b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	res = K;
	dfs(0);
	cout << res << endl;
}

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

int main()
{
    string s, t;
    cin >> s >> t;
    vector< vector<int> > dp(s.length() + 2, vector<int>(t.length()+2, 0));
    // dp[i][j] = max length of common substring uptil i & j
    for(int i = 0; i <= (int) s.length(); i++){
        for(int j = 0; j <= (int) t.length(); j++){
            dp[i][j+1] = max(dp[i][j+1], dp[i][j]);
            dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
            if(s[i] == t[j]){
                dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1);
            }
        }
    }
    string ans;
    int i = s.length(), j = t.length();
    while(i || j){
        if(i && dp[i-1][j] == dp[i][j]) i--;
        else if(j && dp[i][j-1] == dp[i][j]) j--;
        else{
            i--;
            j--;
            ans += s[i];
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 35584
//in the name of ALLAH
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
   int k,a,b;
   cin>>k>>a>>b;
   int f=1;
   for(int i=a;i<=b;i++)
   {
       if(i%k==0)
       {
           f=0;break;
       }
   }
   if(f==0)
    cout<<"OK"<<endl;
   else
    cout<<"NG"<<endl;
}



Measured memory_bytes: 3624
#!/usr/bin/env python3
import sys


def solve(P: int, Q: int, R: int):
    ret = min(P + Q, Q + R, P + R)
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    P = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(P, Q, R)

if __name__ == '__main__':
    main()


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

string st;
int p;
pii term_calc;

pii term();
pii and_expr();
pii or_expr();

pii term()
{
    pii ret;
    if (st[p] == '(') {
        p++;
        ret = or_expr();
        p++;
        return ret;
    } else if (st[p] == '?') {
        p++;
        return term_calc;
    } else {
        assert(0);
        return {-1, -1};
    }
}

pii and_expr()
{
    pii ret = term();
    int ret_1 = ret.first;
    int ret_0 = ret.second;
    int ret_sum = ret.first;
    while (st[p] == '&') {
        p++;
        ret = and_expr();
        ret_1 += ret.first;
        ret_0 = min(ret_sum + ret.second, ret_0);
        ret_sum += ret.first;
    }
    return {ret_1, ret_0};
}

pii or_expr()
{
    pii ret = and_expr();
    int ret_0 = ret.second;
    int ret_1 = ret.first;
    int ret_sum = ret.second;
    while (st[p] == '|') {
        p++;
        ret = and_expr();
        ret_0 += ret.second;
        ret_1 = min(ret_sum + ret.first, ret_1);
        ret_sum += ret.second;
    }
    return {ret_1, ret_0};
}

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

    term_calc = {1, 1};
    cin >> st;
    p = 0;

    auto ans = or_expr();
    std::cout << ans.sec << " " << ans.fir << endl;

    return 0;
}



Measured memory_bytes: 3452
#include <cstdio>

char opr[10];
int top=1,front=2,right=3,n=0,sum=1,swap;

int dice(int n){
	//scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%s",opr);
		switch (opr[0]){
		case 'N':
			swap=top;
			top=front;
			front=(7-swap);
			break;
		case 'E':
			swap=right;
			right=top;
			top=(7-swap);
			break;
		case 'W':
			swap=top;
			top=right;
			right=(7-swap);
			break;
		case 'S':
			swap=front;
			front=top;
			top=(7-swap);
			break;
		case 'R':
			swap=front;
			front=right;
			right=(7-swap);
			break;
		case 'L':
			swap=right;
			right=front;
			front=(7-swap);
			break;

		}
		sum+=top;
	}
	if(n!=0) printf("%d\n",sum);
	//int top=1,front=2,right=3,sum=1,swap;
	return 0;
}

int main(){
	while(1) {
	scanf("%d",&n); 
	dice(n);
	top=1,front=2,right=3,sum=1,swap;
	if(n==0) break;
	}
	return 0;
}

Measured memory_bytes: 1032
#include<bits/stdc++.h>
using namespace std;
#define int long long

const int N = 1e5+10;
int w[101],v[101];

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

  int n,W; cin >> n >> W;
  for(int i = 0; i < n; i++){
    cin >> w[i] >> v[i];
  }

  vector<int> dp(W+1,0);
  for(int i = 0; i < n; i++){
    for(int j = W; j > 0; j--){
      if(j - w[i] >= 0){
        dp[j] = max(dp[j],dp[j-w[i]] + v[i]);
      }
    }
  }
  cout << dp[W] << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

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

	long long N, A, B;
	cin >> N >> A >> B;

	long long small = (N - 1) * A + B;
	long long large = (N - 1) * B + A;

	cout << max(large - small + 1, 0LL);

	return 0;
}

Measured memory_bytes: 256
// READ & UNDERSTAND
// ll, int overflow, array bounds
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n,q; string s;
	cin >> n >> q >> s;
	int l,r;
	int dp[n];
	memset(dp,0,sizeof(dp));
	for(int i=1; i<n; i++){
		if(s[i]=='C'&&s[i-1]=='A')dp[i]++;
		dp[i] += dp[i-1];
	}
	while(q--){
		cin >> l >> r;
		l--; r--;
		cout << dp[r]-dp[l] << endl;
	}
}	


Measured memory_bytes: 1488
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<utility>
#include<queue>
#include<cmath>

using namespace std;

typedef long long int64;

int main(void){
    string s;
    cin>>s;
    cout<<s[0]<<s[1]<<s[2]<<endl;
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
long long int fnc(int a[],int b[],int i,int n,int w,long long int dp[][100])
{
 if(i<n)
 {
     if(dp[w][i]==-1)
     {
   if(w>=a[i])
     dp[w][i]= max(fnc(a,b,i+1,n,w,dp),b[i]+fnc(a,b,i+1,n,w-a[i],dp));
   else
    dp[w][i]=fnc(a,b,i+1,n,w,dp);
     }
    return dp[w][i];
 }
  else 
    return 0;
}
int main()
{
  int n,w;
  cin>>n>>w;
  int a[n],b[n];
  int i;
  for(i=0;i<n;i++)
  {
   cin>>a[i]>>b[i]; 
  }
  long long int dp[w+1][100];
  for(i=0;i<w+1;i++)
  {
      memset(dp[i],-1,sizeof(dp[0]));
  }
cout<<fnc(a,b,0,n,w,dp);
  return 0;
}

Measured memory_bytes: 78336
#include<iostream>
#include<string>

using namespace std;

int main(){
    string s;
    long long k, p = 0;
    cin >> s >> k;
    while(p < s.size() && s[p] == '1'){
        p++;
    }
    if(k <= p){
        cout << s[k - 1] << endl;
    }else{
        cout << s[p] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define  forloop for(int i=0;i<n;i++)
#define pb push_back 
#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define MOD 998244353;
#define unmap unordered_map
#define pi 3.1415926536
#define testcases ll t;cin>>t;while(t--)
#define  mp make_pair
#define  vcp vector<pair<ll,ll>>
#define preci(x,y)  fixed<<setprecision(y)<<x
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define fast ios::sync_with_stdio(false);   cin.tie(0); cout.tie(0);
#define preinc priority_queue <ll, vector<ll>, greater<ll>>
#define predec priority_queue<ll> 
#define vll vector<ll>
#define f(a,b) for(ll i=a;i<=b;i++)
ll path( vector<vector<char>>&ch,int i,int j,vector<vector<ll>>&v,int n,int m)
{
    if(i==n-1&&j==m-1)
        return 1;
    if(i>=n||j>=m)
        return 0;
   if(ch[i][j]=='#')
    return 0;
    if(v[i][j]!=-1)
        return v[i][j];
    int ans=0,ans1=0;
    if(i+1<n&&ch[i+1][j]!='#')
ans=path(ch,i+1,j,v,n,m)%mod;
if(j+1<m&&ch[i][j+1]!='#')
ans1=path(ch,i,j+1,v,n,m)%mod;
    v[i][j]=(ans+ans1)%mod;
   return v[i][j]; 
}
int main() {
    #ifndef ONLINE_JUDGE
   freopen("inp.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
   #endif
   fast
   int n,m;
   cin>>n>>m;
   vector<vector<char>> ch(n,vector<char>(m));
   for(int i=0;i<n;i++)
   {
    for(int j=0;j<m;j++)
        cin>>ch[i][j];
   }
   vector<vector<ll>>v(n+1,vector<ll>(m+1,-1));
   cout<<path(ch,0,0,v,n,m);
    // your code goes here
    return 0;
}

Measured memory_bytes: 12176
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int main(void)
{
	string s;
	cin >> s;
	LL val = stoll(s);
	int n = s.size();
	vector<int>ten;
	for (int i = 0; i < 10; ++i)ten.push_back(i);
	LL tenten = 1;
	for (int i = 0; i < n; ++i)tenten *= 10;
	LL score = -1;
	LL value = INT_MAX;
	do
	{
		LL nw = 0;
		for (int i = 0; i < n; ++i)
		{
			nw *= 10;
			nw += ten[i];
		}
		LL sc = abs(nw - val);
		sc = min(sc, tenten - sc);
		if (sc > score || (sc == score && nw < value))
		{
			score = sc;
			value = nw;
		}
	} while (next_permutation(ten.begin(), ten.end()));
	char tmp[123];
	sprintf(tmp, "%lld", value);
	string ans = tmp;
	while (ans.size() < n)ans.insert(ans.begin(), '0');
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3340
#include <stdio.h>

int main(){
    int n;
    int i,j,flag=0;
    long h[100000];
    int x[100000];

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%ld",&h[i]);
    }

    if(n==1){
        printf("Yes\n");
        return 0;
    }
//    printf("%d\n",flag);
    if(n==2){
        if(h[0]-1 <= h[1]){
            printf("Yes\n");
            return 0;
        }else{
            printf("No\n");
            return 0;
        }
    }

    if(h[0]-h[1]>=2){
        printf("No\n");
        return 0;
    }
    for(i=n-1;i>=1;i--){
        if(h[i-1]-h[i] >= 2){
            printf("No\n");
            return 0;
        }

        // if(h[i+1]<h[i] && h[i+2]<h[i+1]){
        //     printf("No\n");
        //     return 0;
        // }

        if(h[i-1] > h[i]){
            h[i-1]--;
        }

    }


//     for(i=1;i<n-1;i++){
//         if(h[i] > h[i+1]){
//             h[i]--;
//             if(h[i-1]>h[i] || h[i]>h[i+1]){
//                 flag = 1;
//             }
//         }
// //        printf("%d\n",flag);
//     }

    // for(i=0;i<n;i++){
    //     printf("%d",h[i]);
    // }

    if(flag==0){
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    return 0;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
#define Size(n) (n).size()

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//long long int kaizyo(long long int hh){
  //  cmp=1;
    //while(hh>1){
      //  cmp=(cmp*hh)%MOD;
        //hh--;
    //}
    //return cmp;
//}

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n,cnt=0,ans=0,a,b,c,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=false,fll=false;

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

      cin >> s;
      rep(i,Size(s)-8){
          cout << s[i];
      }
      cout << endl;
return 0;
}


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

int main(){
	int n;
	cin>>n;
	pair<pair<string,int>,int> q[n];
	rep(i,n){
		string s;
		int p;
		cin>>s>>p;
		q[i]={{s,-p},i+1};
	}
	sort(q,q+n);
	rep(i,n)puts(q[i].second);
}


Measured memory_bytes: 256
n=int(input())
if n>=400 and n<600:
  print(8)
elif n>=600 and n<800:
  print(7)
elif n>=800 and n<1000:
  print(6)
elif n>=1000 and n<1200:
  print(5)
elif n>=1200 and n<1400:
  print(4)
elif n>=1400 and n<1600:
  print(3)
elif n>=1600 and n<1800:
  print(2)
elif n>=1800 and n<2000:
  print(1)

Measured memory_bytes: 9192
import java.util.*;

class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        long sum=0;
        long[] nums=new long[n];
        for(int i=0;i<n;i++){
            nums[i]=sc.nextInt();
            sum+=nums[i];
        }
        long[] sums=new long[n*2];
        sums[0]=nums[0];
        for(int i=1;i<n;i++){
            sums[i]=sums[i-1]+nums[i*2%n];
        }
        for(int i=0;i<n;i++){
            sums[n+i]=sums[n+i-1]+nums[i*2%n];
        }
        for(int i=0;i<n;i++){
            if(i%2==1){
                System.out.print(sum-(sums[(i+n)/2+n-1]-sums[(i+n)/2+n-n/2-1])*2+" ");
            }else{
                System.out.print(sum-(sums[i/2+n-1]-sums[i/2+n-n/2-1])*2+" ");
            }
        }
        System.out.println();
    }
}


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

int main (){
    int a,b;
    cin>>a>>b;
    if(a==1){
        if(b==2)puts("3");
        else puts("2");
    }else if(a==2){
        if(b==1)puts("3");
        else puts("1");
    }else{
        if(b==1)puts("2");
        else puts("1");
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    int k=1,sum=0;
    for(int i=1;i<n;i++)
    {
        if(a[i]!=a[i-1]){sum+=k%2;k=1;}
        else k++;
    }
    sum+=k%2;
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL a,b;
    cin>>a>>b;
    // x = a * 100/8
    // x = b * 100/10
    FOR(x, 1, 10000){
        if(x * 8 / 100 == a && x /10 == b){
            PUTS(x);
            return 0;
        }
    }
    PUTS(-1);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    long long x,y;

	
    cin  >> x >> y;
    if(x==y)cout << 1 << " " << 0 << endl;
    else if(x%2==0||y%2==0)cout << 1 << " " << 1 << endl;
    else {
      if(x>y)swap(x,y);
      if(y%x==0){
	y/=x;
	x/=x;
      }
      while(1){
	int f=0;
	for(int j=2;j*j<y;j++){
	  if(x%j==0&&y%j==0){
	    f=1;
	    x/=j;
	    y/=j;
	  }
	}
	if(f==0)break;
      }
      // cout << x << y << endl;
      cout << x*y/2+1 << " " << x*y/2<< endl;
    }
  }
  return 0;
  
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
#include <iomanip>
#include <iostream>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

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

int main(void){
    int N; cin >> N;
    vector<ll> h(N+10,0), dp(N+10,INF); for(int i = 0; i < N; i++) cin >> h[i];
    
    dp[0] = 0;
    for(int i = 0; i < N; i++){
        chmin(dp[i+2],dp[i] + abs(h[i+2] - h[i]));
        chmin(dp[i+1],dp[i] + abs(h[i+1] - h[i]));
    }
    cout << dp[N-1] << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;

int main(){
	string n;
	int cnt=0;
	while(cin>>n){
	bool f=1;
	for(int i=0;i<n.size();i++)if(n[i]!=n[n.size()-1-i])f=0;
	if(f)cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,x,w;
	scanf("%lld%lld%lld",&a,&b,&x);
	if(a==0)
	w=(b/x)+1;
	else{
		w=(b/x)-(a-1)/x;
	}
	cout<<w;
	
}

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

int main() {
  ll h, w;
  cin >> h >> w;
  if (h == 1 || w == 1) {
    cout << 1 << endl;
  } else {
    cout << (h * w + 1) / 2 << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
using namespace std;
const int MAXN = 16;
const LL INF = (LL)1e18 + 5;
const LL MOD = 998244353;

int N;
LL a[MAXN][MAXN], profit[1 << MAXN], dp[1 << MAXN];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> a[i][j];
		}
	}
	
	for (int m = 0; m < (1 << N); m++) {
		LL sum = 0;
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < i; j++) {
				if ((m >> i & 1) && (m >> j & 1)) {
					sum += a[i][j];
				}
			}
		}
		profit[m] = sum;
	}
	
	dp[0] = 0;
	for (int m = 1; m < (1 << N); m++) {
		int sub = m;
		dp[m] = -INF;
		do {
			sub = m & (sub - 1);
			dp[m] = max(dp[m], profit[m ^ sub] + dp[sub]);
		}
		while (sub > 0);
	}
	
	cout << dp[(1 << N) - 1] << "\n";
}


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

using namespace std;

#define ff(i, a, b) for(int i = (a); (i <= (b)); ++i)
#define FF(i, a, b) for(int i = (a); (i >= (b)); --i)
#define ll long long

const int M = 1000000000 + 7;
const int N = 100000 + 10;

struct re {
    int x, y;
};

string s, t;
int f[N * 2][26], n, m;

int main() {
    //ios_base::sync_with_stdio(false); cin.tie(0);
    //freopen("", "r" , stdin);
    //freopen("", "w", stdout);
    cin >> s >> t;
    n = s.size();
    m = t.size();
    s = s + s;
    memset(f, 255, sizeof(f));
    FF(i, n * 2 - 1, 0) {
        ff(j, 0, 25) f[i][j] = f[i + 1][j];
        f[i][s[i] - 'a'] = i;
    }

    FF(i, n, 0) {
        ff(j, 0, 25)
        if (f[i][j] >= n) f[i][j] -= n;
    }

    ll j = 0, mul = 0;
    ff(i, 0, m - 1) {
        if (f[j][t[i] - 'a'] == -1) {
            cout << -1;
            return 0;
        }

        if (f[j][t[i] - 'a'] < j) ++mul;
        j = f[j][t[i] - 'a'] + 1;
    }

    cout << 1LL * mul * n + j << endl;
}
//This code belongs to s34vv1nd


Measured memory_bytes: 21120
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;



int main(){
  int a,b,c;
  std::cin >> a>>b>>c;
  int num[a+1]={0};
  for(int i=0;i<b;i++){
    int tmp;
    std::cin >> tmp;
    num[tmp]=1;
  }

  int cost1=0;
  int cost2=0;
  for(int i=c-1;i>=0;i--){
    if(num[i]==1)cost1++;
  }
  for(int i=c+1;i<=a;i++){
    if(num[i]==1)cost2++;
  }
  if(cost1<cost2){
    std::cout << cost1 << '\n';
  }else{
    std::cout << cost2 << '\n';
  }
  // for(int i=0;i<=a;i++){
  //   std::cout << num[i] << '\n';
  // }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

const int MAX_N = 200005;
VI A;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin >> n;
    A.resize(n);
    REP(i, n) cin >> A[i];
    VI B=A;
    sort(ALL(B));
    int m=n/2;
    REP(i, n) {
        if(A[i]<B[m]) cout << B[m] << endl;
        else cout << B[m-1] << endl;
    }

    return 0;
}

Measured memory_bytes: 3840
#include <string>
#include <string.h>
#include <vector>
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
    string s;
    cin>>s;
    long long int m=s.length();
    long long int a[26];
    long long int j;
	long long int ans=0;
    memset(a,0,sizeof(a));
	for (long long int i=0;i<m;i++)
	{
	    j=s[i]-'a';
	    a[j]++;
	}
	for (long long int i=0;i<26;i++)
	{
	    ans+=(m-a[i])*a[i];   
	}
	ans=ans/2+1;
	cout<<ans<<endl;
	return 0;
}
	

Measured memory_bytes: 640