akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<ll, ll> P;

int inf = 1010000;
int main(){
    int h, w;   cin >> h >> w;
    int dp[110][110][2];
    int s[110][110];

    for(int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            char c;
            cin >> c;
            if (c == '.') {
                s[i][j] = 0;
            } else {
                s[i][j] = 1;
            }
        }
    }

    for(int i = 0; i < h+1; i++){
        for(int j = 0; j < w+1; j++){
            for(int k = 0; k < 2; k++){
                dp[i][j][k] = inf;
            }
        }
    }

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(i == 0 && j == 0){
                if(s[i][j] == 0) dp[i][j][0] = 0;
                else dp[i][j][1] = 1;
                continue;
            }
            if(i > 0){
                if(s[i][j] == 0){
                    dp[i][j][0] = min(dp[i-1][j][0], dp[i][j][0]);
                    dp[i][j][0] = min(dp[i-1][j][1], dp[i][j][0]);
                }
                else{
                    dp[i][j][1] = min(dp[i-1][j][0] + 1, dp[i][j][1]);
                    dp[i][j][1] = min(dp[i-1][j][1], dp[i][j][1]);
                }
            }
            if(j > 0){
                if(s[i][j] == 0){
                    dp[i][j][0] = min(dp[i][j-1][0], dp[i][j][0]);
                    dp[i][j][0] = min(dp[i][j-1][1], dp[i][j][0]);
                }
                else{
                    dp[i][j][1] = min(dp[i][j-1][0] + 1, dp[i][j][1]);
                    dp[i][j][1] = min(dp[i][j-1][1], dp[i][j][1]);
                }
            }
        }
    }

    cout << min(dp[h-1][w-1][0], dp[h-1][w-1][1]) << endl;

    return 0;
}


Measured memory_bytes: 384
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 62;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

ll cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
vector<vector<ll>> g;
vector<ll> a;
vector<ll> ans;
void dfs(ll now, ll pa, vector<ll> &dp){

    auto itr = lower_bound(all(dp), a[now]);
    ll tmp = *itr;
    *itr = a[now];
    ans[now] = lower_bound(all(dp), INF) - dp.begin();

    rep(i, g[now].size()){
        ll next = g[now][i];
        if(next == pa) continue;
        dfs(next, now, dp);
    }

    *itr = tmp;
}
int main(void){
    ll n;
    cin >> n;
    a.resize(n);
    ans.resize(n, 0);
    rep(i, n) cin >> a[i];
    g.resize(n);

    rep(i, n - 1){
        ll u, v;
        cin >> u >> v;
        u--, v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    vector<ll> dp(n, INF);
    dfs(0, -1, dp);
    rep(i, n){
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 33108
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#define LL long long
using namespace std;
int a[10010];
int main()
{
    int n,m,w,j=0,b;
    cin >> n >> m>> w;
    for(int k=1; k<=w; k++)
    {
        cin >> b;
        while(b--)
            a[j++]=k;
    }
    for(int i=0; i<n; i++)
    {
        if(i%2==0)
            for(j=0; j<m; j++)
            {
                if(j>0)
                    cout << " ";
                cout << a[i*m+j];
            }
        else
            for(j=m-1; j>=0; j--)
            {
                if(j<m-1)
                    cout << " ";
                cout << a[i*m+j];
            }
        cout << endl;
    }
    return 0;
}


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


int l[1000000];
int dp[1000000];

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

Measured memory_bytes: 2688
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10 ** 6)
    n = int(input())
    h = list(map(int, input().split()))

    lastHErasita = False

    for i in range(1, n):
        if h[i] > h[i - 1]:
            lastHErasita = False
            continue
        if h[i] == h[i - 1]:
            continue
        elif h[i] == h[i - 1] - 1 and lastHErasita == False:
            lastHErasita = True
        else:
            print('No')
            exit(0)
    print('Yes')


if __name__ == '__main__':
    main()


Measured memory_bytes: 14252
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int x = sc.nextInt();
        if(500*k >= x){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
    }
}

Measured memory_bytes: 21972
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define PI 3.14159265359
typedef long long LL;

template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

const int INF = 1 << 30;

int main(void) {
	int N;
	cin >> N;

	vector<int> seat(100010);
	for (int i = 0; i < N; i++)
	{
		int l, r;
		cin >> l >> r;
		for (int j = l; j <= r; j++)
		{
			seat[j] = 1;
		}
	}
	cout << accumulate(ALL(seat), 0) << 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;
using ll = long long;

int main()
{
    int n;
    cin >> n;
    int a[n];
    rep(i,n) cin >> a[i];

    int m = 0;
    rep(i,n) {
        if (a[i]-1 == m) m++;
    }

    int ans = m==0? -1 : n - m;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
N, K = map(int, input().split())
# K以上になるためには

total = 0.0

for n in range(1, N+1):
  count = 0
  in_score = n

  while (in_score < K):
    in_score *= 2
    count += 1

  total += 1 / N * (0.5)**count

print(total)


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



void print(vector<int> v){
	
	for(int i=0;i<v.size();i++){
		cout<<v[i];
	}
	//cout<<endl;
}
char b;
void solve(){
	cin>>b;
	
	if(b=='A')cout<<"T"<<endl;
	if(b=='T')cout<<"A"<<endl;
	if(b=='C')cout<<"G"<<endl;
	if(b=='G')cout<<"C"<<endl;
}


int main(){

    solve();
    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  ll n;
  cin >> n;
  int ans = 1e9;
  while(n>=100){
    ans = min(ans,abs(753-int(n%1000)));
    n /= 10;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int c1, c2, c3;
	int sum, over_no;
	int a, b;
	int han[10];
	
	
	sum = 0;
	while (scanf("%d %d %d", &c1, &c2, &c3) != EOF){
		over_no = 0;
		for (a = 1; a <= 10; a++) {
			if (a == c1 || a == c2 || a == c3) {
				han[a-1] = 0;
			}
			han[a-1] = a;
		}
		sum = c1 + c2;
		
		for (a = 0; a < 10; a++) {
			if (han[a] > 0) {
				if ((sum + han[a]) <= 20) {
					over_no++;
				}
			}
		}
		
		if (over_no >= 4) {
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	
	return (0);
}	
		

Measured memory_bytes: 580
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define ms_valtype pair

typedef struct {
	int num;
	int val;
}pair;

//比較関数
int compare_ms(ms_valtype a, ms_valtype b){
	return b.val - a.val;
}

//昇順
void sort_sub(ms_valtype *origin, int left, int right, ms_valtype *tmp){
	if(right - left > 1){
		int i, j, k, half = (left + right) / 2;
		sort_sub(origin, left, half, tmp);
		sort_sub(origin, half, right, tmp);
		for(i = left; i < right; i++){
			tmp[i] = origin[i];
		}
		for(i = left, j = left, k = half; i < right; i++){
			if(k == right){
				origin[i] = tmp[j];
				j++;
			}
			else if(compare_ms(tmp[j], tmp[k]) <= 0 && j < half){
				origin[i] = tmp[j];
				j++;
			}
			else{
				origin[i] = tmp[k];
				k++;
			}
		}
	}
}

void sort(ms_valtype *origin, int N){
	ms_valtype *tmp = (ms_valtype *)malloc(sizeof(ms_valtype) * N);
	sort_sub(origin, 0, N, tmp);
	free(tmp);
}

int max(int a, int b){
	return a >= b ? a : b;
}

signed main(){
	int N, i, j, ans = 0;
	scanf("%lld", &N);
	int *x = (int *)malloc(sizeof(int) * (N + 1));
	int *s = (int *)malloc(sizeof(int) * (N + 1));
	int *sum = (int *)malloc(sizeof(int) * (N + 1));
	pair *p = (pair *)malloc(sizeof(pair) * (N + 1));
	x[0] = 0;
	s[0] = 0;
	sum[0] = 0;
	p[0].num = 0;
	p[0].val = 0;
	for(i = 1; i <= N; i++){
		scanf("%lld%lld", &x[i], &s[i]);
		sum[i] = sum[i - 1] + s[i];
		p[i].num = i;
	}
	for(i = 1; i <= N; i++){
		p[i].val = sum[i] - x[i];
	}
/*	for(i = 1; i <= N; i++){
		printf("(i, num, val) = (%lld, %lld, %lld)\n", i, p[i].num, p[i].val);
	}
*/	sort(&p[1], N);
/*	for(i = 1; i <= N; i++){
		printf("(i, num, val) = (%lld, %lld, %lld)\n", i, p[i].num, p[i].val);
	}
*/	for(i = 1, j = 1; i <= N; i++){
//		printf("i = %lld\n", i);
		while(p[j].num < i){
			j++;
		}
//		printf("j = %lld\n", j);
		ans = max(ans, (sum[p[j].num] - sum[i - 1]) - (x[p[j].num] - x[i]));
	}
	printf("%lld\n", ans);
	return 0;
}

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int count=0;
		int k = sc.nextInt();
		int s = sc.nextInt();
		for(int i=0;i<=k;i++) {
			for(int w=0;w<=k;w++) {
				if(s-i-w>=0 && s-i-w<=k) {
					count++;
				}
			}
		}
		System.out.print(count);
	}
}


Measured memory_bytes: 21844
N,K = map(int,input().split())

xy = []
xlis = []
ylis = []

for i in range(N):

    x,y = map(int,input().split())

    xy.append([x,y])

    if x not in xlis:
        xlis.append(x)
    if y not in ylis:
        ylis.append(y)

ans = float("inf")
xlis.sort()
ylis.sort()

for rp in range(len(xlis)):

    right = xlis[rp]

    for lp in range(rp+1):

        left = xlis[lp]

        for upp in range(len(ylis)):

            up = ylis[upp]

            for dp in range(upp+1):

                down = ylis[dp]

                able = 0
                nable = 0
                for i in range(N):

                    nx = xy[i][0]
                    ny = xy[i][1]
                    if left <= nx and nx <= right and down <= ny and ny <= up:
                        able += 1
                    else:
                        nable += 1

                    if able >= K or nable > N-K:
                        break

                if able >= K:
                    now = max(1,right-left) * max(1,up-down)
                    ans = min(ans,now)

print (ans)


Measured memory_bytes: 58628
package main

import (
	"fmt"
)

const (
	frame    = '#'
	contents = '.'
)

func main() {
	var h, w int
	for {
		fmt.Scanln(&h, &w)
		if h == 0 && w == 0 {
			break
		}
		for i := 0; i < h; i++ {
			for j := 0; j < w; j++ {
				if j == 0 || j == w-1 || i == 0 || i == h-1 {
					fmt.Printf("%c", frame)
				} else {
					fmt.Printf("%c", contents)
				}
			}
			fmt.Printf("\n")
		}
		fmt.Printf("\n")
	}
	return
}



Measured memory_bytes: 1156
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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


int main() {

    ll N, M;
    cin >> N >> M;
    vector<P> v(N);
    REP(i, N) cin >> v[i].first >> v[i].second;

    sort(v.begin(), v.end(), [](P a, P b){
        return (a.first < b.first);
    });
    //REP(i, N) cout << v[i].first << v[i].second << endl;
    priority_queue<int> q;
    int inde = 0;
    ll tmp = 0;
    REP(i, M + 1){
        while(inde < N && v[inde].first <= i) q.push(v[inde++].second);
        if (q.empty()) continue;
        tmp += q.top();      
        //cout << "added" << i << ":" << q.top() << endl;
        q.pop();
    }

    cout << tmp << endl;
    return 0;
}


Measured memory_bytes: 2428
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

struct top2_t {
  vector<int> v;
  top2_t& operator+=(const top2_t& rhs) {
    v.insert(v.end(), rhs.v.begin(), rhs.v.end());
    sort(v.rbegin(), v.rend());
    if (v.size() > 2) v.resize(2);
    return *this;
  }
};

struct ans_t {
  ll less;
  ll over;
};

template <class T>
struct fenwick_tree {
  vector<T> x;
  fenwick_tree(int n)
      : x(n + 1) {
  }
  void add(int k, T a) {
    for (++k; k < x.size(); k += k & -k) x[k] += a;
  }
  T sum(int k) {
    T s;
    for (; k > 0; k &= k - 1) s += x[k];
    return s;
  }
};

vector<ans_t> solve(const vector<int>& P) {
  int N = P.size();
  fenwick_tree<top2_t> bit(N + 1);
  bit.add(0, {{-1, -1}});
  vector<ans_t> res(N);
  for (int i = 0; i < N; i++) {
    auto x = bit.sum(P[i]);
    auto v = x.v;
    assert(v.size() >= 2);
    res[i] = {i - v[0], v[0] - v[1]};
    bit.add(P[i], {{i}});
  }
  return res;
}

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int N;
  while (cin >> N) {
    vector<int> P(N);
    for (int& x : P) cin >> x;
    for (int& x : P) x = N + 1 - x;
    auto ans_f = solve(P);
    reverse(P.begin(), P.end());
    auto ans_b = solve(P);
    reverse(ans_b.begin(), ans_b.end());
    reverse(P.begin(), P.end());
    ll res = 0;
    for (int i = 0; i < N; i++) {
      auto f = ans_f[i], b = ans_b[i];
      res += (f.over * b.less + f.less * b.over) * (N + 1 - P[i]);
    }
    cout << res << endl;
  }
  return 0;
}


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

int main()
{
  string src;
  cin >> src;
  vector<int> out;

  for(int i = 0; i < src.size(); i++){
    switch (src[i])
    {
      case '0':
        out.push_back(0);
        break;
      case '1':
        out.push_back(1);
        break;
      case 'B':
        if(0 < out.size()){
          out.pop_back();
        }
        break;
      default:
        break;
    }
  }

  for(auto p = out.begin(); p != out.end(); p++){
    cout << *p;
  }
  cout << endl;

  return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int INF = 987654321;
const ll MOD = 1000000007LL;

ll ipow(ll base, ll exp)
{
    ll result = 1LL;
    for (;;)
    {
        if (exp & 1)
            result *= base;
        exp >>= 1;
        if (!exp)
            break;
        base *= base;
    }

    return result;
}

//const long double PI = (acos(-1));
//const long double EPS = 0.0000000001;

const int MAX_N = 100050;
int n;
vector<int> adj[2 * MAX_N];
bool vis[2 * MAX_N];

int xcnt;
int ycnt;
void dfs(int here) {
	if(vis[here]) return;

	vis[here] = true;

	if(here < MAX_N) {
		xcnt++;
	} else {
		ycnt++;
	}

	for(int there : adj[here]) {
		dfs(there);
	}
}


int main(void) {
	ios_base::sync_with_stdio(false); 
	cin.tie(0); 
	cout.tie(0);
	//freopen("in.txt", "r", stdin);
	memset(vis, false, sizeof(vis));
	cin >> n;
	rep(i,0,n) {
		int x, y;
		cin >> x >> y;
		adj[x].pb(y+MAX_N);
		adj[y+MAX_N].pb(x);
	}

	ll ret = 0;
	for(int i=0; i<MAX_N; ++i) {
		if(!vis[i]) {
			xcnt = 0;
			ycnt = 0;
			dfs(i);
			ret += (ll) xcnt * ycnt;
		}
	}
	cout << ret - n << endl;
	return 0;
}


Measured memory_bytes: 10240
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	UL A[300][300];
	UL P[300];
	bool F[300];

	void Solve() {
		UL N, M; cin >> N >> M;
		rep(i, N) rep(j, M) { cin >> A[i][j]; A[i][j]--; }
		rep(i, N) P[i] = 0;
		rep(i, M) F[i] = false;

		UL ans = 10000;
		rep(i, M) {
			UL p[300] = {};
			rep(j, N) p[A[j][P[j]]]++;
			UL ansbuf = 0;
			UL maxp = 0;
			rep(j, M) {
				if (ansbuf < p[j]) { maxp = j; ansbuf = p[j]; }
			}
			ans = min(ans, ansbuf);
			F[maxp] = true;
			//rep(j, N) cout << A[j][P[j]] << " "; cout << endl;
			if (i != M - 1) {
				rep(j, N) while (F[A[j][P[j]]]) P[j]++;
			}
		}
		cout << ans << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}

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

int main(){
    char name[4];
    scanf("%s", name);
    if(name[0]==name[2])printf("Yes\n");
    else printf("No\n");
    return 0;
}

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

bool mysort(const vector<int>& a,const vector<int>& b)
{
    for(int i = 0;i < 3;i++)
    {
        if(a[i] < b[i])
        {
            return true;
        }
        else if(a[i] > b[i])
        {
            return false;
        }
    }
    return false;
}

bool check(const vector<int>& a,const vector<int>& b)
{
    for(int i = 0;i < 3;i++)
    {
        if(a[i] != b[i])
        {
            return false;
        }
    }
    return true;
}


int main()
{

    int N;
    cin >> N;

    vector<vector<int> > Surface(N,vector<int>(3));

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

        sort(Surface[i].begin(),Surface[i].end());
    }

    sort(Surface.begin(),Surface.end(),mysort);

    cout << N -(unique(Surface.begin(),Surface.end(),check) - Surface.begin()) << endl;

    return 0;

}

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <stack>

using namespace std;

struct xl
{
    int x1,x2,l;
};

stack<int> s1,s3;
stack<xl> s2;
string i;
int x=0;
int Sum=0;
int k=1;
xl a;

int main()
{
    while(1)
    {
        i=cin.get();
        x+=1;
        if(i=="\n")
        {
            break;
        }
        else if(i=="\\")
        {
            s1.push(x);
        }
        else if(i=="/")
        {
            if(!s1.empty())
            {
                a.x1=s1.top();
                a.x2=x;
                a.l=a.x2-a.x1;
                s2.push(a);
                s1.pop();
                Sum+=a.l;
            }
            
        }
    }
    cout << Sum << endl;
    if(s2.empty())
    {
        cout << 0;
    }
    else
    {
        a=s2.top();
        x=a.x1;
        s2.pop();
        while(!s2.empty())
        {
            if(s2.top().x2>x)
            {
                a.l+=s2.top().l;
                s2.pop();
            }
            else
            {
                k+=1;
                s3.push(a.l);
                a=s2.top();
                x=a.x1;
                s2.pop();
            }
        }
        cout << k << " " << a.l;
    }
    while(!s3.empty())
    {
        cout << " " << s3.top();
        s3.pop();
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3320
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int n, k; cin >> n >> k;
    vector <int> a(n);
    int res = 0;
    for (auto &m: a) {
        cin >> m;
    }
	sort(a.begin(), a.end());
	for (int i = 0; i < k;i++) {
		res += a[i];
	}
	cout << res;
}

Measured memory_bytes: 3452
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_20190707_1
{    class Program
    {
        static void Main(string[] args)
        {
            string[] AB = Console.ReadLine().Split(' ');

            if(int.Parse(AB[0]) <= 8 && int.Parse(AB[1]) <= 8)
            {
                Console.WriteLine("Yay!");
                return;
            }

            Console.WriteLine(":(");
        }
        static int Compare(int[] x, int[] y)
        {
            return x[1].CompareTo(y[1]);            
        }
    }
}

Measured memory_bytes: 11092
using System.Linq;
using static System.Console;
class K
{
	static void Main()
	{
		var I = ReadLine().Split().Select(long.Parse).ToArray();
		long N = I[0], K = I[1], sum = 0L;
		for (var b = K + 1; b <= N; b++)
		{
			var q = N % b;
			sum += (b - K) * (N / b);
			if (K <= q) sum += q - K + 1;
			if (K == 0) sum--;
		}
		WriteLine(sum);
	}
}


Measured memory_bytes: 11348
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;

typedef  pair<int,int> P;
typedef long long LL;

const LL  INF=1<<31;



int main(){
 string a,b,c;
 cin>>a>>b>>c;
     cout<<"A"<<b[0]<<"C"<<endl;
}

Measured memory_bytes: 256
/*
 * short          2^15-1 ~ 3e4
 * int, long x86  2^31-1 ~ 2e9
 * long long      2^63-1 ~ 9e18
 */
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define fr(a, b) for (int a = 0; a < b; ++a)
using namespace std; typedef long long ll; const int inf = numeric_limits<int>::max(); void print() {cerr << endl;}
template<typename T, typename... Ts> void print(T&&a, Ts&&...etc) {cerr << a << ' '; print(etc...);}
template<typename T, typename U> ostream& operator<<(ostream& s, const pair<T,U>&p) {s << "<" << p.x << ", " << p.y << ">"; return s;} // ver. 2020-02-17
template<typename T> ostream& operator<<(ostream& s, const vector<T>&v) {s << "["; for (auto &x : v) s << x << ", "; if (!v.empty()) s << "\b\b"; s << "]"; return s;}
struct io{io(){ios_base::Init i; ios_base::sync_with_stdio(0); cin.tie(0);}}io;

int score(int p, vector<int> &a) {
    int s = 0;
    for (int x : a) {
        s += (x-p) * (x-p);
    }
    return s;
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    fr(i, n) cin >> a[i];

    int best = inf;
    for (int p = 0; p < 102; ++p) {
        int s = score(p, a);
        if (best > s) {
            best = s;
        }
    }
    cout << best << endl;


    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
   int n,b, reverse = 0;
   scanf("%d", &n);
   b=n;
   while (b != 0)
   {
      reverse = reverse * 10;
      reverse = reverse + b%10;
      b       = b/10;
   }
        if(n==reverse){
            printf("Yes\n");
        }
        else{
            printf("No\n");
        }
        return 0;
    }



Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)
#define loop(i,N,M) for(int i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

//変数
ll N;
vector<ll> vec;

//解法
void solve() {

	ll ans = 0;

	rep(i, 3) {
		if (N % 10 == 1) ans++;
		N /= 10;
	}

	cout << ans;

	return;
}

int main() {
	//入力

	cin >> N;


	solve();
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int X,A;
  cin >> X >> A;
  if(X < A) {
    cout << 0 << endl;
  } else {
    cout << 10 << endl;
  }
  return 0;
}

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

int main(){
    long long int v0,w0,v,w,t=0;
    cin >> v0>>v;
    cin >> w0>>w >> t;
    bool ans = false;
    if(v0 <= w0 && v0+v*t>= w0 +w*t){
       ans = true;
    }
    if(v0 >= w0 && v0-v*t<= w0 -w*t){
       ans = true;
    }
    if(ans){
        cout << "YES" << endl;
    }else{
        cout << "NO"<< endl;
    }
}


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

int main()
{
	int n;
	cin >> n;

	int max = 0;
	int sum = 0;
	for (int i = 0; i < n; ++i) {
		int l;
		cin >> l;
		if (max < l) {
			max = l;
		}
		sum += l;
	}

	if (sum - max > max) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

int main() {
    int a = 0, b = 0;
    cin >> a >> b;

    if (a > b) {
        cout << "a" << " > " << "b" << endl;
    } else if (a < b) {
        cout << "a" << " < " << "b" << endl;
    } else {
        cout << "a" << " == " << "b" << endl;
    }

    return 0;
}

Measured memory_bytes: 3004
from math import ceil

N = int(input())
is_possible = False

for i in range((N//4)+1):
    for j in range((N//7)+1):
        if 4*i+7*j == N:
            is_possible = True
            break
    if is_possible:
        break

if is_possible:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {
	
    public static void main(String[] args) {
	        Scanner scan = new Scanner(System.in);
	        int number = scan.nextInt();
	        int[] people = new int[number];
	        for(int i=0;i<number-1;i++){
	        	int no = scan.nextInt();
	        	people[no-1]++;
	        }
	        for(int i=0;i<number;i++){
	        	System.out.println(people[i]);
	        }
      }
}


Measured memory_bytes: 57176
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr =input.trim().split("\n");
var ndx=arr.shift().split(" ").map(Number);
var n=ndx[0];
var d=ndx[1];
var x=ndx[2];
var day=[];
for(var i=0;i<d;i++)day.push(arr.shift().split(" ").map(Number));
var item=[];
for(var i=0;i<d-1;i++){
   item[i]=[""];
   for(var j=0;j<n;j++){
      item[i].push([day[i][j],day[i+1][j]-day[i][j]]);
   }
}
function DP(k){
   var dp=[];
   for(var i=0;i<=n;i++){
      dp[i]=[];
      for(var j=0;j<=x;j++){
         dp[i][j]=0;
      }
   }
   for(var i=1;i<=n;i++){
      for(var j=1;j<=x;j++){
         var c=item[k][i][0];
         var w=(item[k][i][1]<0)?0:item[k][i][1];
         if(c<=j)dp[i][j]=Math.max(dp[i-1][j],w+dp[i-1][j-c],w+dp[i][j-c]);
         else dp[i][j]=dp[i-1][j];
      }
   }
   return x+dp[n][x];
}
for(var i=0;i<d-1;i++){
   x=DP(i);
}
console.log(x);

Measured memory_bytes: 24504
#Card Game for Two
a=int(input())
b=list(map(int,input().split()))
b.sort()
total=0
total2=0
for i in range(a):
    if i%2==0:
        total+=b[i]
    else:
        total2+=b[i]
print(max(total,total2)-min(total,total2))

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

using namespace std;

#define debug(n) cerr << #n << ' ' << n << endl;

inline bool ChangeMin(int&a, int b){
  if(a > b){
    a = b;
    return true;
  }
  return false;
}

void CheckReachableNode(const vector<unordered_set<int>>&movable_list
			, int pos
			, bitset<2500>&nodes){
  
  if(nodes[pos] == 1){
    return;
  } else {
    nodes[pos] = 1;
    for(auto&&node:movable_list[pos]){
      CheckReachableNode(movable_list, node, nodes);
    }
  }
}

int main(){
  int v, e, p;
  cin >> v >> e >> p;

  vector<tuple<int, int, int>> edges;
  vector<unordered_set<int>> in_list(v);
  vector<unordered_set<int>> out_list(v);
  bitset<2500> reachable_from_start = 0;
  bitset<2500> reachable_in_goal = 0;

  for(int i = 0; i < e; ++i){
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    edges.emplace_back(a,b,-(c-p));
    out_list[a].insert(b);
    in_list[b].insert(a);
  }


  CheckReachableNode(out_list, 0, reachable_from_start);
  CheckReachableNode(in_list, v - 1, reachable_in_goal);

  bitset<2500>on_path;
  for(int i = 0; i < 2500; ++i){
    on_path[i] = reachable_from_start[i] & reachable_in_goal[i];
  }

  vector<int> costs(v, 1e+9);
  int loop_count = 0;
  bool loop_fin = false;

  costs[0] = 0;

  while(!loop_fin){
    loop_fin = true;
    for(auto&&edge:edges){
      int a, b, c;
      tie(a,b,c) = edge;
      if(out_list[a].count(b) != 0  &&  on_path[a] & on_path[b]){
	if(ChangeMin(costs[b], costs[a] + c)){
	  loop_fin = false;
	}
      }
    }
    if(loop_count++ > v) {
      cout << -1 << endl;
      return 0;
    }
  }

  cout << max(-costs[v - 1], 0) << endl;
  
  return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int Ull;
typedef pair<int ,int> PII;
template <typename T>
inline T  read()
{
    char c=getchar();
    T x=0,f=1;
    while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
    while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return x*f;
}
template <typename T>
inline void write(T x) 
{
    if(x < 0) x = (~x) + 1, putchar('-');
    if(x / 10) write(x / 10);
    putchar(x % 10 | 48);
}
const int INF = 0x3f3f3f3f;
const int N = 1e5+10;
int arr[10];
int main(){
    //ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    
    int n = read<int>();
    for(int i = 0; i < n; i++){
        string str;
        cin>>str;
        if(str == "AC") arr[0]++;
        if(str== "WA") arr[1]++;
        if(str=="TLE") arr[2]++;
        if(str=="RE") arr[3]++;  
    }
    cout<<"AC x "<<arr[0]<<endl;
    cout<<"WA x "<<arr[1]<<endl;
    cout<<"TLE x "<<arr[2]<<endl;
    cout<<"RE x "<<arr[3]<<endl;
} 

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

char mas[1010][1010];
int dp[1010][1010];

signed main() {

    int h, w;
    cin >> h >> w;
    for ( int i = 1; i <= h; i++ ) {
        string s;
        cin >> s;
        for ( int j = 1; j <= w; j++ ) {
            mas[i][j] = s[j-1];
        }
    }

    dp[1][1] = 1;

    for ( int i = 1; i <= h; i++ ) {
        for ( int j = 1; j <= w; j++ ) {
            if ( mas[i][j] == '#' ) continue;
            dp[i][j] += dp[i-1][j] + dp[i][j-1];
            dp[i][j] %= (int)1e9+7;
        }
    }

    cout << dp[h][w] << endl;

    return 0;
}

Measured memory_bytes: 5248
N = int(input())
A = [int(x) for x in input().split()]

from collections import Counter
C = Counter(A)
if len(A)%2 == 0:
  for k, v in C.items():
    if v != 2:
      print(0)
      exit()
else:
  for k, v in C.items():
    if k == 0:
      if v != 1:
        print(0)
        exit()
    else:
      if v!=2:
        print(0)
        exit()

print(2**(N//2) % (10**9+7))
  

Measured memory_bytes: 13880
solve :: Int -> Int
solve n = foldl (+) 0 (map (\m -> if n == m then 1 else 0) [w + x + y + z | w <- ns, x <- ns, y <- ns, z <- ns])
    where ns = [0..9]

main :: IO ()
main = interact (unlines . map (show . solve . read) . lines)

Measured memory_bytes: 7544
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
#include <iomanip>
using namespace std;

int main(){
  int A, B, C ;
  cin >> A >> B >> C ;
  
  cout << C << " " << A << " " << B << endl ;
  return 0 ;
}  

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

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;

ll INF = (1ll << 32);
double EPS = 1e-4;

int main() {
  ll N, K;
  cin >> N >> K;

  vi a(N);
  for (ll i = 0; i < N; i++) {
    cin >> a[i];
  }

  vi b;
  b.push_back(0);
  for (ll i = 0; i < N; i++) {
    b.push_back(b.back() + a[i]);
  }

  vi v;
  for (ll i = 0; i < N + 1; i++) {
    for (ll j = i + 1; j < N + 1; j++) {
      v.push_back(b[j] - b[i]);
    }
  }

  ll ans = 0;
  for (ll i = 50; i >= 0; i--) {
    vi v2;
    for (auto j: v) {
      if ((1ll << i) & j) {
        v2.push_back(j);
      }
    }
    if (v2.size() >= K) {
      ans += (1ll << i);
      v.swap(v2);
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 6396
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int i,j,x,c;
		int max=0,maxn=0;
		int s=sc.nextInt();
		int o=sc.nextInt();
		
		int [][]sn = new int [s][2];
		int []ol = new int [o];

		for(i=0;i<s;i++){
			int m=sc.nextInt();
			sn[i][0]=m;
			sn[i][1]=0;
			
		}
		
		for(i=0;i<o;i++){
			int e=sc.nextInt();
			ol[i]=e;
			
		}
		
		
		for(i=0;i<o;i++){
			for(j=0;j<s;j++){
				if(ol[i]>=sn[j][0]) {
					sn[j][1]++;
					break;
				}
			}
		}
		
		for(i=0;i<s;i++){
			if(sn[i][1]>max) {
				max=sn[i][1];
				maxn=i+1;
			}
		}
		
		System.out.printf("%d\n",maxn);
		sc.close();
		System.exit(0);
	}
}

Measured memory_bytes: 25344
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Point
{
public:
    double y, x;
    Point(){}
    Point(double y0, double x0){
        y = y0;
        x = x0;
    }
    const Point operator-(const Point& p) const{
        return Point(y - p.y, x - p.x);
    }
    double cross(const Point& p) const{
        return x * p.y - y * p.x;
    }
    bool operator<(const Point& p) const{
        return x < p.x || (x == p.x && y < p.y);
    }
};

void convexHull(const vector<Point>& p1, vector<Point>& p2)
{
    vector<Point> p = p1;
    sort(p.begin(), p.end());
    int n = p.size();

    int j = 0;
    p2.clear();
    for(int i=0; i<2*n-1; ++i){
        Point tmp = (i<n? p[i]:p[2*(n-1)-i]);
        while(j >= 2 && (tmp-p2[j-2]).cross(p2[j-1]-p2[j-2]) < 0){
            p2.pop_back();
            -- j;
        }
        p2.push_back(tmp);
        ++ j;
    }
    p2.pop_back();
}

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        char c;
        vector<Point> p1(n), p2;
        for(int i=0; i<n; ++i)
            cin >> p1[i].x >> c >> p1[i].y;

        convexHull(p1, p2);
        cout << (n-p2.size()) << endl;
    }
}

Measured memory_bytes: 0
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
a=sorted(a)
ans=0
cnt=1
for i in range(n-1):

    if a[i]==a[i+1]:
        cnt+=1
    else:
        if cnt%2==1:ans+=1
        cnt=1
if cnt%2==1:ans+=1
print(ans)


Measured memory_bytes: 14116
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define uint unsigned int
#define MOD 1000000007
#define MAXN 200005
#define MAXH 4
#define MAXM 100
#define inf 1LL << 61
#define ll long long
#define ull unsigned long long
#define RNG mt19937
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;
const int N = 200005;

int main(){
	fast_io();
	int n;
	string s;cin >> s;
	n = s.length();
	ll k;cin >> k;
	cu(i,0,n){
		if(s[i] != '1' || i == k-1){
			cout << s[i] << '\n';
			return 0;
		}
	}
}



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

using namespace std;

const int mod = 998244353;

bool vis[1001][1001];
int a[1001], b[1001];
int stk[1001];
int mul[1001];
int ksm(int x, int y) { return mul[y]; }
int main( ) {
	int n;
	int ans = 0;
	scanf("%d", &n);
	mul[0] = 1;
	for (int i = 1; i <= n; i ++) mul[i] = mul[i - 1] * 2 % mod;
	for (int i = 1; i <= n; i ++) {
		scanf("%d %d", &a[i], &b[i]);
	}
	for (int i = 1; i <= n; i ++)
		for (int j = i + 1; j <= n; j ++) {
			if (vis[i][j]) continue;
			int cnt = 2;
			stk[1] = i, stk[2] = j;
			for (int k = 1; k <= n; k ++) {
				if (k == i || k == j) continue;
				pair<int, int> tmpx = make_pair(a[k] - a[i], b[k] - b[i]),
							   tmpy = make_pair(a[k] - a[j], b[k] - b[j]);
				if (tmpx.first * tmpy.second == tmpx.second * tmpy.first)
					stk[++ cnt] = k;
			}
			for (int k = 1; k <= cnt; k ++)
				for (int l = k + 1; l <= cnt; ++ l)
					vis[stk[k]][stk[l]] = true;
			ans += (0LL + ksm(2, cnt) - (cnt + 1) % mod + mod) % mod;
			ans %= mod;
		}
	printf("%d\n", ((1LL * ksm(2, n) - 1 - n - ans) % mod + mod) % mod);
	return 0;
}


Measured memory_bytes: 512
n = int(input(''))
stra = input('')

alist = stra.split(' ')
dic = {}
for i in range(0,len(alist)):
  if alist[i] in dic.keys():
    dic[alist[i]]+=1
  else:
    dic[alist[i]] = 1

all_cnt = 0    
for k,v in dic.items():
  all_cnt += (v*(v-1))/2

    
for k in range(0,n):
  cnt = 0
  key = alist[k]
  minus_cnt1 = (dic[key] * (dic[key]-1))/2
  minus_cnt2 = ((dic[key]-1) * (dic[key]-2))/2
  print(int(all_cnt -  minus_cnt1 + minus_cnt2))

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

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

ll n,k; 
vll G[100100];
vll c;
void dfs(ll v, ll p){
  ll color;
  if(v==0) color=k;
  else color=k-1;
  for(auto nv: G[v]){
    if(nv==p) continue;
    c[nv]=--color;
    dfs(nv,v);
  }
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  cin>>n>>k;
  c.resize(n);
  rep(i,n-1){
    ll a,b; cin>>a>>b; a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  c[0]=k;
  dfs(0,-1);
  
  ll ans=1;
  rep(i,n){
    (ans*=c[i])%=MOD;
  }
  cout<<ans<<endl;
  
}


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

using namespace std;

string a;
bool flag[2];

int main() {
	getline(cin, a);
	for(int i = 0; i < a.size(); ++i) {
		if(a[i] == 'C') flag[0] = 1;
		if(a[i] == 'F' && flag[0]) flag[1] = 1;
	}
	if(flag[0] && flag[1]) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
import std.stdio;
import std.range;
import std.conv;
import std.string;
import std.algorithm;

int[] read_numbers() {
  return readln.strip.chomp.split(" ").map!(to!(int)).array;
}

int arr_max(int[] arr) {
  return arr.reduce!(max);
}

int arr_sum(int[] arr) {
  return arr.reduce!((x, accum) => x + accum);
}

void main() {
  while (true) {
    auto line = read_numbers;
    int col = line[0], row = line[1], result = 0;
    if (col == 0 && row == 0) return;
    int[][] table = 0.iota(col).map!(_ => read_numbers).array;
    for (int i = 0; i < (1 << col); i++) {
      int sum = 0;
      for (int r = 0; r < row; r++) {
        int row_sum = 0;
        for (int c = 0; c < col; c++) {
          int inside_out = ((i >> c) & 1);
          if (inside_out == table[c][r]) {row_sum += 1;}
        }
        if (row_sum < col - row_sum) {row_sum = col - row_sum;}
        sum += row_sum;
      }
      if (result < sum) {
        result = sum;
      }
    }
    writeln(result);
  }
}

Measured memory_bytes: 3884
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << "(" << p.first << " " << p.second << ")";
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  //os << v[0]; for (ll i = 1; i < (ll)v.size(); i++){ os << " " << v[i]; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::map< T, S > m)
{
  ll i = 0; for (auto p : m){ os << " [" << i << "]" << p.first << "->" << p.second; i++;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  std::string S;
  std::cin >> S;

  std::sort(S.begin(), S.end());

  if (S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) {
    print("Yes");
  } else {
    print("No");
  }

  return 0;
}


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

using namespace std;
#define lint long long
#define P pair<lint, int>

lint F(lint a){
    lint ans = 0;
    int da = 0;
    {
        lint aa = a;
        while(aa > 0){
            da++;
            aa >>= 1;
        }
    }
    
    if(a == 0){
        return 0;
    }
    
    for(int i = da - 1; i > 0; --i){
        if(!((a >> i) & 1)){
            continue;
        } else {
            lint tmp;
            tmp = (a >> (i)) << (i);
            
            ans += ((1LL - (a - tmp) % 2) << i);
        }
    }
    if(((a - 1) % 4) / 2 == 0){
        ans++;
    }
    
    return ans;
}

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

    cout << (F(A - 1)^F(B)) << endl;
}

Measured memory_bytes: 256