akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <queue>

struct Pos {
    int h, w, step;
};
int main(void)
{
    using namespace std;
    int H, W;
    vector<vector<char>> S;

    cin >> H >> W;

    auto nWhite = 0;

    for (int i = 0; i < H; i++) {
        S.push_back(vector<char>());
        for (int j = 0; j < W; j++) {
            char s;
            cin >> s;
            if (s == '.') {
                nWhite++;
            }
            S[i].push_back(s);
        }
    }

    queue<Pos> q;
    q.push({ 0, 0, 1 });
    
    while (!q.empty()) {
        const auto c = q.front();
        q.pop();
        if (c.h == H - 1 && c.w == W - 1) {
            cout << nWhite - c.step << endl;
            return 0;
        }
        array<int, 4> dw = { 0, 1, -1, 0 };
        array<int, 4> dh = { 1, 0, 0, -1 };

        for (int i = 0; i < 4; i++) {
            const auto nw = c.w + dw[i];
            const auto nh = c.h + dh[i];
            if (nw < 0 || nh < 0 || nw > W - 1 || nh > H - 1) {
                continue;
            }
            if (S[nh][nw] == '.') {
                q.push({ nh, nw, c.step + 1 });
                S[nh][nw] = ' ';
            }
        }
    }
    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a>b)
        printf("a > b\n");
    else if(a<b)
        printf("a < b\n");
    else
        printf("a == b\n");
    return 0;
}



Measured memory_bytes: 2120
#include <bits/stdc++.h>
using intl = long long;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)((n) - 1); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define INF = 1e9;
#define debug(x) cout << #x << ":" << x << endl
using namespace std;
int main(){
    intl a[3][3];
    rep(i, 3){
        rep(j,3){
            cin >> a[i][j];
        }
    }
    intl n;
    cin >> n;
    intl b[n];
    rep(i,n){
        cin >> b[i];
    }
    bool c[3][3];
    rep(i, 3){
        rep(j,3){
            c[i][j] = false;
        }
    }
    rep(k,n){
        rep(i, 3){
            rep(j,3){
                if(b[k] == a[i][j]){
                    c[i][j] = true;
                }
            }
        }
    }
    bool flag = false;
    rep(i,3){
        if((c[i][0])&&(c[i][1])&&(c[i][2])){
            flag = true;
            
        }
    }
    rep(i,3){
        if((c[0][i])&&(c[1][i])&&(c[2][i])){
            flag = true;
            
        }
    }
    if((c[0][0])&&(c[1][1])&&(c[2][2])){
            flag = true;
            
        }
    if((c[2][0])&&(c[1][1])&&(c[0][2])){
            flag = true;
            
        }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int N;cin>>N;
    for(;;){
        int m = pow(N,0.5);
        if(pow(m,2)==N){
            cout<<N<<endl;
            return 0;
        }
        N--;
    }
}

Measured memory_bytes: 512
class UnionFind:
    def __init__(self, size):
        self.data = [-1] * size
    def find(self, x):
        if self.data[x] < 0:
            return x
        else:
            self.data[x] = self.find(self.data[x])
            return self.data[x]
    def union(self, x, y):
        x, y = self.find(x), self.find(y)
        if x != y:
            if self.data[y] < self.data[x]:
                x, y = y, x
            self.data[x] += self.data[y]
            self.data[y] = x
        return (x != y)
    def same(self, x, y):
        return (self.find(x) == self.find(y))
    def size(self, x):
        return -self.data[self.find(x)]

N, M, *AB = map(int, open(0).read().split())

uf = UnionFind(N)
for a, b in zip(*[iter(AB)] * 2):
    uf.union(a - 1, b - 1)

print(len({uf.find(i) for i in range(N)}) - 1)

Measured memory_bytes: 31788
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

const double pi=3.1415926535897932384626;

void koch(int n,pair<double,double> a,pair<double,double> b){
    if(n==0)return;
    decp(10);
    pair<double,double> s=mp((2*a.first+b.first)/3,(2*a.second+b.second)/3);
    pair<double,double> t=mp((a.first+2*b.first)/3,(a.second+2*b.second)/3);
    pair<double,double> u=mp((t.first-s.first)*cos(pi/3)-(t.second-s.second)*sin(pi/3)+s.first,(t.first-s.first)*sin(pi/3)+(t.second-s.second)*cos(pi/3)+s.second);
    koch(n-1,a,s);
    cout<<s.first<<" "<<s.second<<endl;
    koch(n-1,s,u);
    cout<<u.first<<" "<<u.second<<endl;
    koch(n-1,u,t);
    cout<<t.first<<" "<<t.second<<endl;
    koch(n-1,t,b);
}

int main(){
    int n;cin>>n;
    pair<double,double> a=mp(0,0);
    pair<double,double> b=mp(100,0);
    cout<<0<<" "<<0<<endl;
    koch(n,a,b);
    cout<<100<<" "<<0<<endl;
}


Measured memory_bytes: 3280
n=int(input())
s=[""]*n
st=set()
d={}
for ii in range(n):
  ss=list(input())
  ss.sort()
  ss="".join(ss)
  if ss in st:
    d[ss]+=1
  else:
    d[ss]=1
    st.add(ss)

if len(st)==n:
  print(0)
  exit()
if len(st)==1:
  print((n*(n-1))//2)
  exit()

r=0
for sss in st:
  c=d[sss]
  if c>1:
    r+=(c*(c-1))//2
    
print(r)

Measured memory_bytes: 21960
def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table
n = input()
pdlist = prime_decomposition(n)
pdset = set(pdlist)
if len(pdlist)==1:
    for x in pdset:
        print x-1
else:
    ans = n
    for x in pdset:
        ans *= 1-1.0/x
    print int(ans)

Measured memory_bytes: 6376
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
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);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
*/

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

int A,B,C,D;
  cin>>A>>B>>C>>D;
  if(A+B>C+D){
    cout<<"Left"<<endl;
  }
  if(A+B<C+D){
    cout<<"Right"<<endl;
  }
  if(A+B==C+D){
    cout<<"Balanced"<<endl;
  }

}




Measured memory_bytes: 256
import java.util.HashSet;
import java.util.ArrayList;
import java.io.*;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		final int n=Integer.parseInt(br.readLine());
		HashSet<Integer> elements=new HashSet<Integer>();
		elements.add(0);
		String[] str=br.readLine().split(" ");
		for (int i=0;i<n;i++){
			int e=Integer.parseInt(str[i]);
			ArrayList<Integer> tmp=new ArrayList<Integer>(elements);
			int size=tmp.size();
			for (int j=0;j<size;j++){
				elements.add(e+tmp.get(j));
			}
		}
		final int q=Integer.parseInt(br.readLine());
		String[] que=br.readLine().split(" ");
		for (int i=0;i<q;i++){
			if (elements.contains(Integer.parseInt(que[i]))){
				System.out.println("yes");
			} else System.out.println("no");
		}
	}
}

Measured memory_bytes: 24460
#include <bits/stdc++.h>
#define ll long long

#define endl '\n'

using namespace std;

int n, x[100], p, a;

int main(){
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> x[i];
        p+=x[i];
    }
    p = round((p+.0)/n);
    for(int i = 0; i < n; i++)a += (x[i] - p)*(x[i] - p);
    cout << a;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ld  = long double;
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int n;
   cin >> n;
   vector<int> a(n);
   f(i,0,n){
      a[i] = i;
   }
   int fct = 1;
   vector<pii> coo(n);
   f(i,0,n){
      fct = fct*(i+1);
      cin >> coo[i].F >> coo[i].S;
   }
   ld ans = 0;
   do{
      f(i,1,n){
         ans += sqrt((coo[a[i]].F-coo[a[i-1]].F)*(coo[a[i]].F-coo[a[i-1]].F)+(coo[a[i]].S-coo[a[i-1]].S)*(coo[a[i]].S-coo[a[i-1]].S));
      }
   }while(next_permutation(all(a)));
   ans = ans/fct;
   cout << setprecision(14) << fixed << ans <<'\n'; 
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    INT(n);
    OUT(n/3);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e,v); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  auto c = make_v<int>(3,3);
  cin >> c;
  for (int i = 0; i <= 100; i++) {
    vector<int> b(3);
    for (int j = 0; j < 3; j++) {
      b[j] = c[0][j] - i;
    }
    if (c[1][0] - b[0] != c[1][1] - b[1] || c[1][1] - b[1] != c[1][2] - b[2]) continue;
    if (c[2][0] - b[0] != c[2][1] - b[1] || c[2][1] - b[1] != c[2][2] - b[2]) continue;
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
typedef struct {
	int p,
		left,
		right;
}NODE;
NODE *node, tmp;

int main() {
	int n,i,id,k,j,c,r;
	int depth,t;
	fscanf(stdin, "%d", &n);
	node =(NODE*) malloc(sizeof(NODE)*n);
	for (i = 0; i < n; i++)
		node[i].p = node[i].left = node[i].right = -1;
	
	for (i = 0; i < n; i++) {
		fscanf(stdin, "%d%d", &id, &k);
		for (j = 0; j < k; j++) {
			fscanf(stdin, "%d", &c);
			if (j == 0)node[id].left = c;
			else node[r].right = c;
			node[c].p = id;
			r = c;
		}
	}
	for (i = 0; i < n; i++) {
		depth = 0;
		t = node[i].p;
		while (t != -1) {
			t = node[t].p;
			depth++;
		}
		if (node[i].p == -1)
			fprintf(stdout, "node %d: parent = %d, depth = %d, root, [", i, node[i].p, depth);
		else if( node[i].left==-1)
			fprintf(stdout,"node %d: parent = %d, depth = %d, leaf, [",i, node[i].p, depth);
		else 
			fprintf(stdout,"node %d: parent = %d, depth = %d, internal node, [",i, node[i].p, depth);
		t = node[i].left;
		if (t != -1) fprintf(stdout, "%d", t);
		while (t != -1) {
			t = node[t].right;
			if (t != -1)printf(", %d", t);
		}
		P(s, "]");
	}
	free(node);
	return 0;
}



Measured memory_bytes: 2520
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<long long int> H(N);
  rep(i, N)
  {
    cin >> H[i];
  }
  int pre = -100;
  rep(i, N)
  {
    if (pre <= H[i] - 1)
    {
      pre = H[i] - 1;
    }
    else if (pre <= H[i])
    {
      pre = H[i];
    }
    else
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    ll n,x,y;
    cin>>n>>x>>y;
    ll dis[n+1][n+1]={0};
    ll cc[n]={0};
    rep(i,1,n){
        rep(j,i+1,n){
            dis[i][j]=j-i;
            if(i<=x && j>=y) dis[i][j]=min(dis[i][j],x-i+1+j-y);
            if(i<=x && j>x && j<=y) dis[i][j]=min(dis[i][j],x-i+1+y-j);
            if(i>=x && j<=y) dis[i][j]=min(dis[i][j],i-x+1+y-j);
            if(i>=x && i<y && j>=y) dis[i][j]=min(dis[i][j],i-x+1+j-y);
            cc[dis[i][j]]++;
        }
    }
    rep(i,1,n-1) cout<<cc[i]<<endl;
    // rep(i,1,n)
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << (b?"YES\n":"NO\n");}
void Yes(bool b) {cout << (b?"Yes\n":"No\n");}
void yes(bool b) {cout << (b?"yes\n":"no\n");}
void Yay(bool b) {cout << (b?"Yay!\n":":(\n");}

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll n;
	cin >> n;
	cout << n*(n-1)/2 << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
ans = 100000

for A in range(1, N+1):
    if 0 < N - A and N - A <= 100000:
        tempA = A
        tempB = N - A
        sumOfB = 0
        sumOfA = 0
        while tempA != 0 or tempB != 0:
            a = tempA % 10
            b = tempB % 10
            sumOfA += a
            sumOfB += b
            tempA = tempA // 10
            tempB = tempB // 10
        if sumOfA + sumOfB < ans:
            ans = sumOfA + sumOfB

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

int a[15];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    for(int i=0;i<10;i++)
    {
        cin>>a[i];
    }
    sort(a,a+10);
    for(int i=9;i>=7;i--)
    {
        cout<<a[i]<<"\n";
    }

    return 0;
}

Measured memory_bytes: 3160
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f3f3f3f
#define pi 3.1415926535898
using namespace std;
const double eps=1e-12;
struct Point
{
    double x,y;
} a[500005];
Point o;
int n;
double ri;
double dis(Point a,Point b)
{
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}

void tt(Point p1,Point p2,Point p3)
{
    double a,b,c,d,e,f;
    a=p2.y-p1.y;
    b=p3.y-p1.y;
    c=p2.x-p1.x;
    d=p3.x-p1.x;
    f=p3.x*p3.x+p3.y*p3.y-p1.x*p1.x-p1.y*p1.y;
    e=p2.x*p2.x+p2.y*p2.y-p1.x*p1.x-p1.y*p1.y;
    o.x=(a*f-b*e)/(2*a*d-2*b*c);
    o.y=(d*e-c*f)/(2*a*d-2*b*c);
    ri=dis(o,p1);
}

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%lf%lf",&a[i].x,&a[i].y);
    }
    random_shuffle(a+1,a+n+1);//打乱顺序
    o=a[1];
    ri=0;
    for(int i=1;i<=n;i++)
    {
        if(dis(a[i],o)>ri+eps)
        {
            o=a[i];
            ri=0;
            for(int j=1;j<=i-1;j++)
            {
                if(dis(o,a[j])>ri+eps)
                {
                    o.x=(a[i].x+a[j].x)/2;
                    o.y=(a[i].y+a[j].y)/2;
                    ri=dis(o,a[j]);
                    for(int k=1;k<=j-1;k++)
                    {
                        if(dis(o,a[k])>ri+eps)
                        {
                            tt(a[i],a[j],a[k]);
                        }
                    }
                }
            }
        }
    }
    printf("%.16lf\n",ri);
    return 0;
}


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

bool is_palindrome(string s){
    string t(s.rbegin(),s.rend());
    return s == t;
}

int main(){
    double x;
    cin>>x;
    x=x/3;
    double y=x*x;
    y=y*x;
    cout<<fixed <<y << endl;
}


Measured memory_bytes: 256
S=input()
if S=="SUN":
    print("7")
elif S=="MON":
    print("6")
elif S=="TUE":
    print("5")
elif S=="WED":
    print("4")
elif S=="THU":
    print("3")
elif S=="FRI":
    print("2")
elif S=="SAT":
    print("1")

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

int main()
{
    char s[200];

    scanf("%s", s);

    int len = 0;
    for(int i=0; s[i]!=0; i++){
    len++;
    }

    int cnt =0;
    for(int i=0, j=len-1; i<=j; i++, j--)
    {
    if(s[i]!=s[j]) {cnt++;}

    }
    printf("%d", cnt);
    return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  for (int i = 0; i <= N; i++) {
    if (i * 108 / 100 == N) {
      cout << i << '\n';
      return 0;
    }
  }
  cout << ":(" << '\n';
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long t=1,a=1;
		for(int i=0; i<N; i++) {
			int T = sc.nextInt();
			int A = sc.nextInt();
			
			long nt = (t+T-1)/T*T;
			long na = (t+T-1)/T*A;
			if((t+T-1)/T*A<=a) {
				nt = (a+A-1)/A*T;
				na = (a+A-1)/A*A;
			}
			t = nt;
			a = na;
		}
		
		System.out.println(t+a);
		sc.close();
	}
}


Measured memory_bytes: 13168
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    n,k = I2()
    h = intl()
    cnt = 0
    for i in range(n):
        if h[i] >= k:cnt += 1
    print(cnt)

Measured memory_bytes: 11916
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] arr = reader.readLine().split(" ");
        int a = Integer.parseInt(arr[0]);
        int b = Integer.parseInt(arr[1]);
        int ans = 0;
        if (a < b) {
            for (int i = 0; i < b; i++)
                ans = 10 * ans + a;
        } else {
            for (int i = 0; i < a; i++)
                ans = 10 * ans + b;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 20692
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#include <iostream>
#define fastinput ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);


int main()
{    
    fastinput;
    LL n,i,j,k,t,temp;
    cin>>n>>k;
    LL ans=0;
    map<LL,LL> freq;
    freq[0]++;
    LL sum=0;
    for(i=0;i<n;i++)
    {
        cin>>j;        
        sum+=j;
        ans+=freq[sum%k]; 
        freq[sum%k]++; 
        
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 4224
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N = INT()
T = [INT() for _ in range(N)]

ans = 1

for i in T:
	ans = ans*i//gcd(i, ans)

print(ans)

Measured memory_bytes: 5460
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  set<char> kind;
  string s;
  cin >> s;
  rep(i,0,s.size()){
    if(kind.count(s[i])) {
      cout << "no" << endl;
      return 0;
    }
    else kind.insert(s[i]);
  }
  cout << "yes" << endl;
  return 0 ;
}


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

int main() {
	int n ; cin>>n;
	n = 2*n;
	int arr [n];
	for (int i = 0;  i < n; i++){
	    cin >> arr[i];
	}
    sort(arr , arr+n);
    long long ans =0;
    for (int i = 0; i< n;i+=2){
        ans+=arr[i];
    }
    cout << ans;
}


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

using namespace std;

int main(void)
{
  int a,b,c,d,e;
  int bef;
  int aft;

  cin>>a>>b>>c>>d>>e;

  bef= a*60 + b;
  aft = c * 60 + d;
  cout<<aft-bef-e<<endl;
}


Measured memory_bytes: 3624
#include<cstdio>
#include<cmath>
int isp(int x) 
{
	for(int i=2;i<=sqrt(x);i++)
	if(x%i==0) return 0;
	return 1;
} 
int main()
{
	int n;scanf("%d",&n);
	for(int i=1,j=5;i<=n;j++)
	if(isp(j)&&j%5==1) printf("%d ",j),i++; 
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    if (s.at(2) == s.at(3) && s.at(4) == s.at(5)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int dp[200009][3];
int fun(int idx, int prev){
    if(idx==s.size()) return 0;
    if(idx>s.size()) return -99999;
    if(dp[idx][prev]!=-1) return dp[idx][prev];
    int ans=0;
    if(prev==1){
        if(idx>0 and s[idx]!=s[idx-1]) ans=max(ans,fun(idx+1,1)+1);
        ans=max(ans,fun(idx+2,2)+1);
    }
    else{
        if(idx>1 and (s[idx]!=s[idx-2] or s[idx-1]!=s[idx+1])) ans=max(ans,fun(idx+2,2)+1);
        ans=max(ans,fun(idx+1,1)+1);
    }
    return dp[idx][prev]=ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>s;
    memset(dp,-1,sizeof(dp));
    cout<<max(fun(0,1),fun(0,2))<<"\n";
}

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

int toss(int dice, int point) {
    int count = 0;
    while (dice < point) {
        dice *= 2;
        count++;
    }

    return count;
}

int main() {
    int n, k;

    cin >> n >> k;

    double ans = 0.0;
    rep(i,n) {
        ans += (1 / (double)n) * (double)pow(0.5, toss(i+1, k));
    }

    printf("%.15f\n", ans);

    return 0;
}

Measured memory_bytes: 4132
#include<stdio.h>
int main(){

    int a,b,c,n,i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d %d %d",&a,&b,&c);
        int x,y,z;
        x=a*a;
        y=b*b;
        z=c*c;
        if(x+y ==z || x+z==y || z+y== x){
            printf("YES\n");
        }
    else{
        printf("NO\n");
     }
  }
}



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

vector<long long > vi;

int main(){
    long long n;
    scanf("%lld",&n);
    do{
        if(n%26==0){
           vi.push_back(26);
           n--;
        }
        else vi.push_back(n%26);
        n/=26;
    }while(n);
    for(int i=vi.size()-1;i>=0;i--){
        printf("%c",vi[i]+'a'-1);
    }
    return 0;
}


Measured memory_bytes: 3864
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	vector<long long> h(n);
	for(int i =0;i<n;i++)
		cin>>h[i];
	sort(h.begin(),h.end());
	int num = max(n-k,0);
	long long ans = 0;
	for(int i =0;i<num;i++)
	{
		ans+=h[i];
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 1792
using System;

namespace Project
{
    class Mains
    {
        public static void Main()
        {
            string[] args = Console.ReadLine().Split(' ');
            int a = int.Parse(args[0]);
            int b = int.Parse(args[1]);
            int c = int.Parse(args[2]);
            Console.WriteLine((a < c && c < b) || (b < c && c < a) ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
#include <numeric>
#include <bitset>
#define ll long long
#define INF INT_MAX 
using namespace std;
int main(){
    int N;
    cin >> N;
    int A[N];
    int k=0,g=0;
    for(int i=0;i<N;i++){
        cin >> A[i];
        if(A[i]%2==0)g++;
        else k++;
    }
    if(k%2==1){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }

}

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

int main() {
	// your code goes here
	long long debt=100000;
	int n;
	cin >>n;
	for(int i=0;i<n;i++){
		debt = ((debt*1.05)+999)/1000;
		debt*=1000;
	}
	cout<<debt<<endl;
	return 0;
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
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(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r,g; cin>>r>>g;
    cout<<g*2-r<<endl;
}

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

for a in a_list:
    if(a % 2 == 0):
        if(a % 3 == 0) or (a % 5 == 0):
            pass
        else:
            print("DENIED")
            break
else:
    print("APPROVED") 

Measured memory_bytes: 3060
from fractions import Fraction
def S(n):
  res = 0
  while n:
    n, r = divmod(n, 10)
    res += r
  return res
k = int(input())
n = 1
for _ in range(k):
  print(n)
  n += 1
  m = Fraction(n, S(n))
  temp = n
  for d in range(len(str(n))+1):
    x = 10**(d+1)*(n//(10**(d+1))+1)-1
    if Fraction(x, S(x)) < m:
      m = Fraction(x, S(x))
      temp = x
  n = temp

Measured memory_bytes: 10244
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <cstdio>
#include <cstdlib>

typedef long long int lld;
typedef unsigned long long int ulld;
const int mod = 1000000007;

using namespace std;

int main (void) {
	ios::sync_with_stdio (false);
	int a, b;
	cin >> a >> b;
	if ((a % 3 == 0) ||
	    (b % 3 == 0) ||
	    ((a + b) % 3 == 0))
		cout << "Possible" << endl;
	else
		cout << "Impossible" << endl;
	
	return 0;
}

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

int main()
{
	int n,max=-1,cnt=0;
	cin >> n;
	
	vector<int> h(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> h[i];
	}
	
	for (int i = n-1; i >= 0; --i)
	{
		if (h[i-1] >= h[i])
		{
			//cout << h[i] << endl;
			cnt++;
		}
		else
		{
			if (cnt > max)
			{
				max = cnt;
			}
			cnt = 0;
		}
	}
	cout << max << endl;
	
	return 0;
}

Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskD {
        int[] A;
        int N;
        int Z;
        int W;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            N = in.nextInt();
            Z = in.nextInt();
            W = in.nextInt();
            A = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = in.nextInt();
            }

            int ans = Math.abs(A[N - 1] - W);
            if (N > 1) {
                ans = Math.max(ans, Math.abs(A[N - 1] - A[N - 2]));
            }

            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
const int N=100010,Mod=998244353;
const double pi=acos(-1.0);
typedef long long int ll;
typedef pair<int,int> pii;
int main()
{
  int x,k;
  cin>>k>>x;
  int l=max(x-k+1,-1000000);
  int r=min(x+k-1,1000000);
  for(int i=l;i<=r;i++) cout<<i<<" ";
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int S=1000001;

bool f[S];
int im[S];

int main(){

    fill_n(f,S,true);
    f[0]=f[1]=false;

    for(int i=2;i<S;i++){
        if(f[i])im[i]++;
        im[i]+=im[i-1];
        if(!f[i])continue;
        for(int j=2;i*j<S;j++)f[i*j]=false;
    }

    int n;
    while(cin>>n,n){
        int ans=0;
        while(n--){
            int p,m;
            cin>>p>>m;
            int v=im[min(S-1,p+m)]-im[max(0,p-m-1)];
            ans+=v-1;
        }

        cout<<max(0,ans)<<endl;
    }
}

Measured memory_bytes: 6044
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <ctime>
#include <map>
#include <stack>
#include <sstream>
#include <set>

using namespace std;

int main()
{
	int W, H, N;
	int x, y, a;
	int map[100][100] = { 0, };
	cin >> W >> H >> N;
	
	for (int i = 0; i < N; i++)
	{
		cin >> x >> y >> a;
		if (a == 1)
		{
			for (int i = 0; i < x; i++)
			{
				for (int j = 0; j < H; j++)
				{
					map[j][i] = 1;
				}
			}
		}
		else if (a == 2)
		{
			for (int i = x; i < W; i++)
			{
				for (int j = 0; j < H; j++)
				{
					map[j][i] = 1;
				}
			}
		}
		else if (a == 3)
		{
			for (int i = 0; i < W; i++)
			{
				for (int j = 0; j < y; j++)
				{
					map[j][i] = 1;
				}
			}
		}
		else
		{
			for (int i = 0; i < W; i++)
			{
				for (int j = y; j < H; j++)
				{
					map[j][i] = 1;
				}
			}
		}
	}

	int res = 0;

	for (int i = 0; i < W; i++)
	{
		for (int j = 0; j < H; j++)
		{
			if (map[j][i] == 0)
			{
				res++;
			}
		}
	}

	cout << res << endl;
	return 0;
}

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

typedef vector<int> veci;
typedef pair<int,int> pii;
typedef vector<pii> vecii;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vecl;
typedef vector<pll> vecll;
#define EPS (1e-9)
#define MOD (1e9+7)
#define fi first
#define se second

int main()
{
    ios::sync_with_stdio(false);
#ifdef LOCAL_TEST    
    int tcs;
    cin >> tcs;
    while (tcs-->0)
#endif        
{
    int n;
    cin >> n;
    
    veci v(n);
    vecl cum(n);
    for (int i=0; i<n; ++i) {
        cin >> v[i];
        cum[i] = v[i] + (i?cum[i-1]:0);
    }
    ll tot = cum.back();
    ll mid = tot / 2;

    cum.erase(cum.begin()+n-1);
    sort(cum.begin(), cum.end());
    auto it = lower_bound(cum.begin(), cum.end(), mid);
    if (it!=cum.end() && it!=cum.begin() && abs(mid-*it)>abs(mid-*prev(it)))
        it = prev(it);
    if (it==cum.end())
        it = prev(it);

    cout << abs(tot-(*it*2)) << endl;
}}

Measured memory_bytes: 2560
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

char str0[55];
char str1[55];

void solve()
{
    scanf("%s%s", str0, str1);
    int n0 = strlen(str0), n1 = strlen(str1);
    vector<string> z;
    int i,j;
    for (i = 0; i <= n0-n1; i++) {
        string a;
        for (j = 0; j < n0; j++) {
            if (j < i || j >= i + n1) {
                char c = (str0[j] == '?' ? 'a' : str0[j]);
                a = a + c;
            }
            else if (str0[j] == '?' || str0[j] == str1[j - i]) a = a + str1[j - i];
            else break;
        }
        if (j < n0) continue;
        z.push_back(a);
    }
    if (z.empty()) {
        printf("UNRESTORABLE\n"); return;
    }
    sort(z.begin(), z.end());
    printf("%s\n", z[0].c_str());

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
public class Main{
  public static void main(String args[]) throws IOException {
    InputStreamReader isr = new InputStreamReader(System.in);
    int pos = -1;
    
    for(int next; (next = isr.read()) != ' '; pos = next);
    if((pos & 1) == 0){
      System.out.println("Even");
      return;
    }
    
    for(int next; (next = isr.read()) != '\n'; pos = next);
    if((pos & 1) == 0){
      System.out.println("Even");
      return;
    }
    
    System.out.println("Odd");
  }
}

Measured memory_bytes: 22612
#include<iostream>
#include<string>
using namespace std;
int main(){
  int n,m;
  string user[1000];
  
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>user[i];
  }
  
  bool locked=true;
  cin>>m;
  for(int i=0;i<m;i++){
    string str;
    cin>>str;
    bool found=false;
    for(int i=0;i<n&&!found;i++){
      if(user[i]==str){
	found=true;
	if(locked){
	  cout<<"Opened by "<<user[i]<<endl;
	  locked=false;
	}else{
	  cout<<"Closed by "<<user[i]<<endl;
	  locked=true;
	}
      }
    }
    if(!found){
      cout<<"Unknown "<<str<<endl;
    }
  }
  return(0);
}



Measured memory_bytes: 3244
#include <bits/stdc++.h>
 
using namespace std;
 
#define endl "\n";
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
typedef pair<pair<long long,long long>,bool> pllb;
typedef pair<pair<ll,ll>,ll> plll;
 
const ll N = 1e5+10;
const ll INF = 1e9;
const ll N2 = 1010;
const int MOD = 1e9+7;

int n;
int arr[N];

int memo[N];

int dp(int idx)
{
    int &ret = memo[idx];
    if(~ret)
        return ret;
    ret = 0;
    if(idx<n-1)
        ret = abs(arr[idx+1]-arr[idx])+dp(idx+1);
    if(idx<n-2)
        ret = min(ret,abs(arr[idx+2]-arr[idx])+dp(idx+2));
    return ret;
}



int main()
{
	fastio
	#ifndef ONLINE_JUDGE
		//freopen("input.txt","r",stdin);
		//freopen("out.txt","w",stdout);
	#endif

    memset(memo,-1,sizeof memo);
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    cout << dp(0);
}

Measured memory_bytes: 4224
// Score: /200

#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	int N, X;
	cin >> N >> X;
	int min_m = 10000;
	for(int i=0;i<N;++i){
		int m;
		cin >> m;
		X -= m;
		min_m = min(m, min_m);
	}
	cout << (N+X/min_m);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265358979323846264338327950L
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl '\n'
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1)
    {
        cerr << name << " = " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args)
    {
        const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " = " << arg1 << " || ";
        __f(comma+1, args...);
    }
#else
#define debug(...)
#endif
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}
template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
    return os << "[ " << p.first << ", " << p.second << "]" ;
}
ll power(ll x, ll y, ll p)
{ 
    ll res = 1;  
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
}
ll dp[3000];
ll rec(ll ind) {
    if (dp[ind] != -1) return dp[ind];
    dp[ind] = 0;
    for (ll i = 3; i <= 3000; i++) {
        if (ind >= i)
            dp[ind] = (dp[ind] + rec(ind - i)) % mod;
    }
    return dp[ind];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll s;
    cin >> s;
    memset(dp, -1, sizeof(dp));
    dp[0] = 1;
    cout << rec(s) << endl;   
    return 0;
}

Measured memory_bytes: 3668
N, M = map(int, input().split())

lights = []
for _ in range(M):
    S = list(map(int, input().split()))
    mask = 0
    for a in S[1:]:
        mask |= (1 << (a - 1))
    lights.append(mask)

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

ans = 0
for mask in range(1 << N):
    for state, p in zip(lights, P):
        cnt = 0
        for d in range(N):
            if ((1 << d) & state) > 0 and ((1 << d) & mask) > 0:
                cnt += 1
        if cnt % 2 != p:
            break
    else:
        ans += 1

print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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 (b<a) { a=b; return 1; } return 0; }

ll v[1<<18];
int main(){
    int n;
    cin>>n;
    int m=(1<<n);
    //st に入っているのはまだ生成していない生成したいスライム
    multiset<ll> st;
    rep(i,(1<<n)) cin>>v[i];
    sort(v,v+(1<<n));
    rep(i,m-1) st.insert(v[i]);

    vector<ll> slimes;
    slimes.push_back(v[m-1]);

    rep(day,n){
        //スライムは１日に1スライムしか生まないからvectorを入れ替えてシミュレート
        vector<ll> slimesNew=slimes;
        for(auto& x:slimes){
            //各スライムについてstに残っているそれより小さい最大のスライムを生成
            auto ite=st.lower_bound(x);

            if(ite==st.begin()){
                cout<<"No"<<endl;
                return 0;
            }
            ite--;
            slimesNew.push_back(*ite);
            st.erase(ite);
        }
        sort(ALL(slimesNew));
        reverse(ALL(slimesNew));
        swap(slimes,slimesNew);
    }

    //yesのほうがおかしい
    cout<<"Yes"<<endl;
    return 0;
}


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

      int main(){
         int n,m;
         cin >> n >> m;
         vector<int> wa(n,0);
         vector<bool> ac(n,false);
         rep(i,m){
            int p;
            string st;
            cin >> p >> st;
            if (st == "WA" && ac[p-1] == false) wa[p-1]++;
            else if (st == "WA" && ac[p-1] == true);
            else if (st == "AC" && ac[p-1] == false) ac[p-1] = true;
            else;
         }
         ll cnt=0,pcnt=0;
         rep(i,n){
            if (ac[i]) cnt++;
            if (ac[i]) pcnt += wa[i];
         }
         cout << cnt << " " << pcnt << endl;

   

         
         return 0;
         
      }



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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n, k, ans = INF;
  cin >> n >> k;
  vector<int> x(n);
  rep(i, n) cin >> x[i];
  for (int i = 0; i < n - k + 1; ++i)
    ans = min({abs(x[i]) + abs(x[i + k - 1] - x[i]),
               abs(x[i + k - 1]) + abs(x[i + k - 1] - x[i]), ans});

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


Measured memory_bytes: 640