akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		new Main().run();
	}
	public void run(){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			int k = scan.nextInt();
			if(n == 0 && k == 0){
				break;
			}
			int[] s = new int[k];
			for(int i = 0;i < k;i++){
				s[i] = scan.nextInt();
			}
			for(int i = 0;i < n;i++){
				for(int j = 0;j < k;j++){
					s[j] -= scan.nextInt();
				}
			}
			boolean fl = true;
			for(int i = 0;i < k;i++){
				if(s[i] < 0){
					fl = false;
					break;
				}
			}
			System.out.println((fl)?"Yes":"No");
		}
	}
}

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

int main()
{
	std::string S;
	std::cin >> S;

	long long dp[100001][4] = { 0 };

	for ( int i = S.length(); i >= 0; i-- )
	{
		for ( int j = 3; j >= 0; j-- )
		{
			if ( i >= S.length() )	//	全部見終えた
			{
				if ( j >= 3 )
				{
					// 最後までチェックが終わったので、正常終了
					dp[i][j] = 1;
				}
				else
				{
					// ABCの順になっている部分文字列が見つからず
					dp[i][j] = 0;
				}
			}
			else
			{
				// ABCを探している最中
				// ?が見つかれば3通り、そうでなければ1通りあり、
				// ?またはABCのj番目の文字が見つかった場合は1通り増える
				dp[i][j] = dp[i + 1][j] * ( S.at( i ) == '?' ? 3ll : 1ll );

				if ( ( j < 3 ) && ( ( S.at( i ) == '?' ) || ( S.at( i ) == "ABC"[j] ) ) )
				{
					dp[i][j] += dp[i + 1][j + 1];
				}

				dp[i][j] %= 1000000007;
			}
		}
	}

	// 結果出力
	std::cout << dp[0][0] << std::endl;

	return ( 0 );
}


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

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

    int x[n], y[n], h[n];
    for(int i = 0; i < n; i++)  cin >> x[i] >> y[i] >> h[i];

    int select;
    for(select = 0;;select++){
        if(h[select] != 0)  break;
    }

    int ax, ay, tmph, pos;
    for(ax = 0; ax <= 100; ax++){
        for(ay = 0; ay <= 100; ay++){
            tmph = h[select] + abs(ax-x[select]) + abs(ay-y[select]);
            if(tmph < 1)    continue;
            for(pos = 0; pos < n; pos++){
                if(max(tmph-abs(ax-x[pos])-abs(ay-y[pos]), 0) != h[pos])  break;
            }
            if(pos == n)    break;
        }
        if(pos == n)    break;
    }

    cout << ax << " " << ay << " " << tmph << endl;

    return 0;
}

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

ll solve() {
    ll H, W;
    cin >> H >> W;
    vector<vector<ll>> C(10, vector<ll>(10));
    for ( int i = 0; i < 10; i++ ) {
        for ( int j = 0; j < 10; j++ ) {
            cin >> C[i][j];
        }
    }
    vector<vector<ll>> A(H, vector<ll>(W));
    for ( int h = 0; h < H; h++ ) {
        for ( int w = 0; w < W; w++ ) {
            cin >> A[h][w];
        }
    }
    for ( int k = 0; k < 10; k++ ) {
        for ( int i = 0; i < 10; i++ ) {
            for ( int j = 0; j < 10; j++ ) {
                C[i][j] = min(C[i][j], C[i][k] + C[k][j]);
            }
        }
    }
    ll ans = 0;
    for ( int h = 0; h < H; h++ ) {
        for ( int w = 0; w < W; w++ ) {
            if ( A[h][w] != -1 ) {
                ans += C[A[h][w]][1];
            }
        }
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<list>

using namespace std;

int main()
{
	int N;
	cin >> N;
	int r=0, b=0;
	string s;
	cin >> s;
	for (int i = 0; i < N; i++)
	{
		if (s[i] == 'R') r++;
		else b++;


	}
	if (r > b)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int rec[5010][5010];
signed main() {
    int N, M; cin >> N >> M;
    for(int i=0; i<M; i++) {
        int a, b, x; cin >> a >> b >> x;
        a--; b--;
        chmax(rec[a][b], x + 1);
    }
    int ans = 0;
    for(int i=0; i<N; i++) {
        for(int j=0; j<=i; j++) {
            if(rec[i][j] > 0) {
                ans++;
                chmax(rec[i+1][j  ], rec[i][j] - 1);
                chmax(rec[i+1][j+1], rec[i][j] - 1);
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}



Measured memory_bytes: 119896
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);};};
const int MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


int main(void) {

    string s;
    cin>>s;
    bool ch=true;
    for(int i=0;i<s.size()/2;i++){
        if(s[i]!=s[s.size()-1-i])ch=false;
    }
    if(ch){
        cout<<0<<endl;
        return 0;
    }
    int l=0,r=s.size()-1;
    int ans=0;
    ch=true;
    while(l<r){
        if(s[l]==s[r]){
            l++;r--;
        } else if(s[l]=='x'){
            l++;
            ans++;
        } else if(s[r]=='x'){
            r--;
            ans++;
        } else {
            ch=false;
            break;
        }
    }
    if(!ch){
        fin(-1);
    } else {
        fin(ans);
    }
}



Measured memory_bytes: 512
/* by Natsu Kinmoe */
#include <bits/stdc++.h>
using namespace std;
#define SZ(x)               ((int)(x).size())
#define all(x)              (x).begin(), (x).end()
#define loop(i, n)          for(int i = 0; i < (n); i++)
#define cont(i, n)          for(int i = 1; i <= (n); i++)
#define circ(i, a, b)       for(int i = (a); i <= (b); i++)
#define range(i, a, b, c)   for(int i = (a); ((c) > 0 ? i <= (b) : i >= (b)); i += (c))
#define foreach(it, v)      for(__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define y0          y0O0OO00OO0OO0OO0OOO00OO0OO0O0O000OO0
#define y1          y1II11II11III11I1III11II111IIII1II1I1
#define pub         push_back
#define pob         pop_back
#define mak         make_pair
typedef long long   ll;
typedef long double lf;
const int   Inf = 0x3f3f3f3f;
const ll    INF = 0x3f3f3f3f3f3f3f3fll;
/* Source code starts here */

int n;
vector<int> nei[1 << 17];
int msk[1 << 17], ans;

void dfs(int now, int lst) {
	vector<int> cnt(20);
	loop(i, SZ(nei[now])) {
		int to = nei[now][i];
		if(to == lst) continue;
		dfs(to, now);
		msk[now] |= msk[to];
		loop(i, 20) if((msk[to] >> i) & 1) cnt[i]++;
	}
	int sel = 19;
	while(sel > 0 && cnt[sel] < 2) sel--;
	while(cnt[sel]) sel++;
	ans = max(ans, sel);
	msk[now] = (msk[now] >> sel << sel) | (1 << sel);
}

int main() {
	scanf("%d", &n);
	cont(i, n - 1) {
		int a, b; scanf("%d%d", &a, &b);
		nei[a].pub(b); nei[b].pub(a);
	}
	dfs(1, 0);
	return 0 & printf("%d\n", ans);
}


Measured memory_bytes: 22872
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        // 主処理
        long result = 0;
        for (int i = 0; i < n; i++) {
            result += i;
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <string>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
typedef pair<int, int> ii;
typedef pair<int64, int64> int64int64;
typedef vector<int> vint;
typedef vector<int64> vint64;
typedef vector<uint64> vuint64;
typedef vector<vint> vvint;
typedef vector<vint64> vvint64;
typedef vector<vuint64> vvuint64;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;

#define mp make_pair
#define pb push_back
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define fori(n) for(int i = 0; i < n; ++i)
#define forj(n) for(int j = 0; j < n; ++j)
#define fork(n) for(int k = 0; k < n; ++k)

template<typename T>
void prinMatrix(string txt, vector<vector<T>> &a){
	cout << txt;
	fori(a.size()){
		forj(a[i].size())
			cout << a[i][j] << ' ';

		cout << endl;
	}
}

template<typename T>
void printVector(string txt, vector<T> &a){
	cout << txt;
	for (int i = 0; i < a.size(); ++i)
		cout << a[i] << ' ';
	cout << endl;
}

int n, m;
vint a, b;

map<int, int64> cost;
int64 l;
vint64 dp;

vvint key;

int getCode(vint &arr){
	int p = 1;
	int code = 0;
	for (int i = n - 1; i >= 0; --i){
		code += arr[i] * p;
		p *= 2;
	}

	return code;
}

int getCode(unsigned int val){
	int p = 1;
	int code = 0;
	for (int i = n - 1; i >= 0; --i){
		code += ((val >> i) & 1) * p;
		p *= 2;
	}

	return code;
}


#define INF (int64)(1e12)

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie();

	cin >> n >> m;
	l = pow(2, n);

	dp.resize(l, INF);
	key.resize(m);
	a.resize(m);
	b.resize(m);
	dp[0] = 0;

	fori(m){
		cin >> a[i] >> b[i];
		key[i].resize(n);
		forj(b[i]){
			int x;
			cin >> x;
			key[i][x -1] = 1;
		}

		int cd = getCode(key[i]);
		if (cost.find(cd) == cost.end())
			cost[cd] = a[i];
		else
			cost[cd] = min(cost[cd], (int64)a[i]);
	}

	fori(l){
		for (auto it = cost.begin(); it != cost.end(); ++it){
			int cd = it->first;
			int ind = i | cd;
			dp[ind] = min(dp[ind], dp[i] + it->second);
		}
	}

	if (dp[l - 1] == INF)
		cout << -1 << endl;
	else
		cout << dp[l - 1] << endl;

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <set>
using namespace std;
using pii = pair<int,int>;
using pll = pair<long long, long long>;
const long long INF = 1<<29;

const int MOD = 1000000007;
long long ruizyou(long long m,long long n){
  if(m == 0)return 0;
  if(m == 1)return 1;
  long long ans = 1;
  long long tmp = m;
  for(int i=0;i<=30;i++){
    if(n & (1<<i)){
      ans *= tmp;
      ans %= MOD;
    }
    tmp *= tmp;
    tmp %= MOD;
  }
  return ans;
}
long long kaizyou(long long x){
  if(x == 0)return 1;
  return x * kaizyou(x-1) % MOD;
}
long long comb(long long x,long long y){
  long long bunsi = kaizyou(x);
  long long bunbo = kaizyou(x-y) * kaizyou(y) % MOD;
  return bunsi * ruizyou(bunbo,MOD-2) % MOD;
}
struct unionfind{
  vector<int> par;
  vector<vector<int>> children;
  vector<int> hukasa;
  vector<int> kazu;
  unionfind(int n){
    par = vector<int>(n);
    hukasa = vector<int>(n,0);
    kazu = vector<int>(n,1);
    for(int i=0;i<n;i++){
      par.at(i) = i;
    }
  }
  int root(int x){
    if(par.at(x) == x)return x;
    return root(par.at(x));
  }
  void unite(int x,int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry)return;
    if(hukasa.at(rx) >= hukasa.at(ry)){
      par.at(ry) = rx;
      hukasa.at(rx) = max(hukasa.at(ry) + 1,hukasa.at(rx));
      kazu.at(rx) += kazu.at(ry);
    }
    else{
      par.at(rx) = ry;
      kazu.at(ry) += kazu.at(rx);
    }
  }
  void newkazu(){
    int n = kazu.size();
    for(int i=0;i<n;i++){
      kazu.at(i) = kazu.at(root(i));
    }
  }
  bool same(int x,int y){
    return root(x) == root(y);
  }
};
int ctoi(char a){
  return a - '0';
}
long long gcd(long long a,long long b){
  long long c = max(a,b);
  long long d = min(a,b);
  if(d % c == 0)return c;
  return gcd(c,d%c);
}
long long lcm(long long a,long long b){
  return a * b / gcd(a,b);
}
void hukasa(vector<vector<int>> s,vector<vector<int>> table,int &ans,pii frm,int n,int m){
  int x,y;
  tie(x,y) = frm;
  set<pii> se;
  if(x-1 >= 0)se.insert(pii(x-1,y));
  if(x+1 < n)se.insert(pii(x+1,y));
  if(y-1 >= 0)se.insert(pii(x,y-1));
  if(y+1 < m)se.insert(pii(x,y+1));
  for(auto t:se){
    int tx,ty;
    tie(tx,ty) = t;
    if(s.at(tx).at(ty) && table.at(tx).at(ty) == -1){
      table.at(tx).at(ty) = table.at(x).at(y) + 1;
      ans = max(ans,table.at(tx).at(ty));
      hukasa(s,table,ans,t,n,m);
      table.at(tx).at(ty) = -1;
    }
  }
}
void daiku(int frm,vector<vector<pii>> g,vector<int> &cost,int n){
  priority_queue<pii,vector<pii>,greater<pii>> q;
  q.push(pii(cost.at(frm),frm));
  vector<bool> kakutei(n,false);
  while(!q.empty()){
    pii now = q.top();
    q.pop();
    int n1,n2;
    tie(n1,n2) = now;
    if(kakutei.at(n2))continue;
    kakutei.at(n2) = true;
    for(auto t:g.at(n2)){
      int tx,ty;
      tie(tx,ty) = t;
      if(cost.at(tx) > n1 + ty){
        cost.at(tx) = n1 + ty;
        q.push(pii(cost.at(tx),tx));
      }
    }
  }
}

int main(){
  long long n;
  cin >> n;
  if(n % 2 != 0)cout << 0;
  else{
    n /= 2;
    long long ans = 0;
    while(n/5){
      n /= 5;
      ans += n;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3636
S = input().split()
D=int(S[0])
N=int(S[1])
Ncnt = N

cnt = 1
ans_list = []
if D == 0:
    cnt = 1
    while True:
        if cnt % 100 == 0:
            cnt += 1
        else:
            ans_list.append(cnt)
            if len(ans_list) == Ncnt:
                break
            else:
                cnt += 1
elif D == 1:
    cnt = 100
    while True:
        if cnt % 10000 == 0:
            cnt += 100
        else:
            ans_list.append(cnt)
            if len(ans_list) == Ncnt:
                break
            else:
                cnt += 100
elif D==2:
    cnt = 10000
    while True:
        if cnt % 1000000 == 0:
            cnt += 10000
        else:
            ans_list.append(cnt)
            if len(ans_list) == Ncnt:
                break
            else:
                cnt += 10000  
else:
    exit()

for ans in ans_list:
    temp_ans = ans

print(temp_ans)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include <numeric>
#include<queue>
#include<climits>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
//#define INF LLONG_MAX / 2;
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;
typedef pair<ll,int> LL_IP;

const ll INF = LLONG_MAX;

#define ARRAY_MAX 100005
#define INF 1e9+7


/*nまでの素数を列挙して配列に保持*/
vector<ll> Eratosthenes(ll n,vector<ll>& arr){
    
    for(ll i = 0; i < n;i++){
        arr[i] = 1;
    }
    arr[1] = arr[0] = 0;
    for(ll i = 2; i < sqrt(n); i++){
        if(arr[i]){
            for(ll j = 0; i * (j + 2) < n; j++){
                arr[i *(j + 2)] = 0;
            }
        }
    }
    return arr;
}


int main(){


    int q;
    cin >> q;
    vector<ll> arr(ARRAY_MAX);/*素数判定用配列*/
    arr = Eratosthenes(ARRAY_MAX,arr);/*エラトステネスのふるいで素数判定*/
    vector<ll> prime(ARRAY_MAX,0);/*2017に似た整数の累積和*/

    for(int i = 3; i < arr.size(); i += 2){
        /*奇数のみ調べる*/
        if(arr[i] == 1 && arr[(i+1)/2] == 1){
            /*2017に似た整数であれば1を格納、つまり１つある*/
            prime[i] = 1;
        }else{
            prime[i] = 0;
        }
    }

    for(int i = 0;i < arr.size()-1;i++){
        /*2017に似た整数の累積和を求める*/
        prime[i+1] += prime[i];
    }

    ll l,r;
    REP(i,q){
        /*q個のクエリに対して処理*/
        cin >> l >> r;
        cout << prime[r] - prime[l-1] << endl;
    }
    
    return 0;
}

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

using namespace std;

#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define MP make_pair
#define PB push_back
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

#define int long long
#define trace(x) cerr << #x << ": " << x << " " << endl;


inline int add(int a, int b){a += b; if(a >= MOD)a -= MOD; return a;}
inline int sub(int a, int b){a -= b; if(a < 0)a += MOD; return a;}
inline int mul(int a, int b){return (int)((int) a * b %MOD);}


#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int a[200000+5];
signed main()
{
    IOS
    
    int n;
    cin >> n;
    bool pos = false;
    REP(i, n)
    {
        cin >> a[i];
        if(a[i] == 1)   pos= true;
    }
    if(!pos)
    {
        cout << -1 << "\n";
        return 0;
    }

    int cc = 0;
    REP(i, n)
    {
        if(a[i] == cc+1)
            cc++;
    }
    cout << n - cc;

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
const ll INF=1e18L+5;
ll m,n;
vector<ll>adj[100005];
bool vis[100005];
ll dp[100005];
void dfs(ll s){
    vis[s]=1;
    for(int i=0;i<adj[s].size();i++){
        if(!vis[adj[s][i]])
                dfs(adj[s][i]);
                dp[s]=max(dp[s],dp[adj[s][i]]+1);



}
}

int main()
{
   ll n,m,x,y;
   cin>>n>>m;
   memset(vis,0,sizeof(vis));
   memset(dp,0,sizeof(dp));
   for(int i=1;i<=m;i++){
    cin>>x>>y;
    adj[x].push_back(y);
   }
   for(int i=1;i<=n;i++){
    if(!vis[i])dfs(i);
   }
   ll ans=0;
   for(int i=1;i<=n;i++){
    ans=max(ans,dp[i]);
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 8576
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
int A[SIZE];
int main(){
    DRII(N,K);
    REP(i,N)RI(A[i]);
    sort(A,A+N);
    if(K>A[N-1])return 0*puts("IMPOSSIBLE");
    int gg=A[0];
    REPP(i,1,N)gg=__gcd(gg,A[i]);
    puts(K%gg==0?"POSSIBLE":"IMPOSSIBLE");
    return 0;
}


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

const int INF = 1e9;

int main() {
  int d;
  cin>>d;
  if (d == 25) {
    cout<<"Christmas"<<endl;
  } else if (d == 24) {
    cout<<"Christmas Eve"<<endl;
  } else if (d == 23) {
    cout<<"Christmas Eve Eve"<<endl;
  } else {
    cout<<"Christmas Eve Eve Eve"<<endl;

  }

}

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

public class Main {
	public static void main(String[] args){
		new Main().combination();
	}
	void combination(){
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = 0;
		try {
			String str;
			while((str=br.readLine())!=null){
				n = Integer.parseInt(str);
				count(n);
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	void count(int n){		
		int count =0;
		for(int i=0; i<=9; i++){
			for(int j=0; j<=9; j++){
				for(int k=0; k<=9; k++){
					for(int l=0; l<=9; l++){
						if((i+j+k+l)==n) count++;
					}
				}
			}
		}
		System.out.println(count);
	}
}

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

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

  const uint s_len = s.size();
  const uint t_len = t.size();

  vector<int> index['z' + 1];
  int last_index['z' + 1]{0};

  for(uint i = 0; i < s_len; i++) index[s[i]].push_back(i);

  uint64_t n = 0;
  int current_index = -1;

  for(uint i = 0; i < t_len;) {
    if(index[t[i]].size() == 0) {
      cout << -1 << endl;
      return 0;
    }
    if(current_index >= index[t[i]].back()) {
      n += s_len - current_index - 1;
      current_index = -1;
      for(uint j = 'a'; j <= 'z'; j++) last_index[j] = 0;
    }

    for(uint j = last_index[t[i]]; j < index[t[i]].size(); j++) {
      if(current_index < index[t[i]][j]) {
        n += index[t[i]][j] - current_index;
        current_index = index[t[i]][j];
        last_index[t[i]] = j;
        i++;
        break;
      }
    }
  }


  cout << n << endl;

  return 0;
}


Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
void sand(int x, int t){
       if(x>t){
        cout<<(x-t)<<endl;
       }
       if(x<=t){
        cout<<0<<endl;
       }
}
int main(){
  unsigned long long int x,t;
  cin>>x>>t;
  sand(x,t);
  return 0;
}


Measured memory_bytes: 3544
using System;
using System.Linq;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var (a, b, c, d) = (inputs[0], inputs[1], inputs[2], inputs[3]);

            long max = a * c;
            if (max < a * d) max = a * d;
            if (max < b * c) max = b * c;
            if (max < b * d) max = b * d;
            
            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 28228
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        int a=Integer.parseInt(str[0]);
        int b=Integer.parseInt(str[1]);
        int c=Integer.parseInt(str[2]);
        int d=Integer.parseInt(str[3]);
        int tak=(int)Math.ceil((double)c/b);
        int aok=(int)Math.ceil((double)a/d);
        if(tak<=aok)
        pw.println("Yes");
        else
        pw.println("No");
        pw.flush();
        pw.close();
    }
}

Measured memory_bytes: 32596
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
a = [[0] * 10 for i in range(10)]
for i in range(1,N+1):
    s = int(str(i)[0])
    g = int(str(i)[-1])
    a[s][g] += 1
ans = 0
for i in range(1,10):
    for j in range(1,10):
        ans += a[i][j] * a[j][i]
print(ans)
            
            

Measured memory_bytes: 9200
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int t = sc.nextInt();
		int i = 0;
		for(;n > 0; i++) {
			n -= x;
		}
		System.out.println(i * t);
	}
}


Measured memory_bytes: 35608
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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 add(ll& a, ll b){a = (a+b) % MOD;}

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m,k;
    cin>>n>>m>>k;
    REP(i,n+1){
        REP(j,m+1){
            if(i*(m-j)+(n-i)*j==k){
                cout<<"Yes";
                return 0;
            }
        }
    }
    cout<<"No";
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = max((a),(b))
#define chmin(a, b) a = min((a),(b))
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;

bool double_check(int a){
    rep(i,inf){
        if(i*i==a){
            return true;
        }
        else if(i*i>a){
            return false;
        }
    }
}

int table[100][100];

int main(){
    int n,d;
    cin>>n>>d;
    cout<<ceil((float)n/(1+2*d))<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }

signed main()
{
	int N;
	int A[100];
	cin >> N;
	REP(i, N)
	{
		cin >> A[i];
	}
	ARY_SORT(A, N);
	ARY_REVERSE(A, N);

	A[0] = A[0] / 2;

	int ans = 0;
	REP(i, N)
	{
		ans += A[i];
	}
	cout << ans << endl;
}



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

int main()
{
    char str[10];
    int a[10];
    int i, len, num, min, tmp;
    scanf("%s", str);
    len = strlen(str);
    for (i = 0; i < len; ++i)
        a[i] = str[i] - '0';

    num = 100 * a[0] + 10 * a[1] + a[2];
    min = (num < 753) ? (753 - num) : (num - 753);

    for (i = 1; i <= len - 3; ++i)
    {
        num = 100 * a[i] + 10 * a[i + 1] + a[i + 2];
        tmp = (num < 753) ? (753 - num) : (num - 753);
        if (tmp < min)
            min = tmp;
    }
    printf("%d\n", min);
}

Measured memory_bytes: 128
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
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; }

string S,S1,S2,S3,S4;
ul i;
bool flag,is_ok;

string reverse(string s){
  string res;
  ul size=s.size();
  REP(i,size)res+=s[size-1-i];
  return res;
}

inline void solve(){
  IN(S);
  S=reverse(S);
  S1="dreamer";
  S2="dream";
  S3="eraser";
  S4="erase";
  S1=reverse(S1);
  S2=reverse(S2);
  S3=reverse(S3);
  S4=reverse(S4);
  REP(i,S.size()-1){
    flag=false;
    if(S.substr(i,7)==S1){
      flag=true;
      i+=6;
    }else if(S.substr(i,5)==S2){
      flag=true;
      i+=4;
    }else if(S.substr(i,6)==S3){
      flag=true;
      i+=5;
    }else if(S.substr(i,5)==S4){
      flag=true;
      i+=4;
    }
    if(!flag){
      OUT("NO");
      return;
    }
    if(i==S.size()-1){
      is_ok=true;
      break;
    }
  }
  if(is_ok)OUT("YES");
  else OUT("NO");
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 720
#include<stdio.h>
int main(void)
{
	int seki[5], t, n, i;
	for (i = 1; i <= 4; i++)
	{
		seki[1] = 6000;
		seki[2] = 4000;
		seki[3] = 3000;
		seki[4] = 2000;
		scanf("%d %d", &t, &n);
		printf("%d\n", seki[t] * n);
	}
		return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
typedef  long long int ll;
typedef  long double ld;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define mod 1000000007
#define F first
#define S second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//recursions\
#pragma comment(linker, "/stack:200000000")
//loops\
#pragma GCC optimize("unroll-loops")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
int main()
{
	sync;
	string s,t;
	cin>>s>>t;
	ll cnt=0;
	if(s[0]==t[0])cnt++;
	if(s[1]==t[1])cnt++;
	if(s[2]==t[2])cnt++;
	cout<<cnt;
	
	
}

Measured memory_bytes: 256
#include <cstring>
#include <algorithm>
#include <map>
#include <stack>
#include <cassert>
#include <cmath>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <vector>
#include <iostream>
#include <set>
#define MP make_pair
#define F first
#define PB push_back
#define S second
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 50;
const int mod = 1e9 + 7;
const int inf = (1 << 30);
ll a[10];

int main() {
    ios_base::sync_with_stdio(false);
    for (int i = 0; i < 3; i++)
        cin >> a[i];
    sort (a, a + 3);
    ll ans = 1e18;
    for (int i = 0; i < 3; i++)
        if (a[i] % 2 == 0)
            ans = 0;
    ans = min (ans, a[0] * a[1]);
    cout << ans << endl;
}

Measured memory_bytes: 256
N=int(input())
import bisect
w=0
r=[]
b=[]
for i in range(N):
    x,y=map(int,input().split())
    r.append((x,y))
for i in range(N):
    x,y=map(int,input().split())
    b.append((x,y))
b.sort()
r.sort()   
for i,j in b:
    u=[]
    for k in range(len(r)):
        if i>r[k][0] and j>r[k][1]:
            u.append((r[k][1],r[k][0]))
    if u:        
        u.sort()   
        (p,q)=u[-1]
        r.remove((q,p))
        w+=1
print(w)        
    

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

using namespace std;

int main()
{
    int a,b,c,d,e,k;
    cin >> a >> b >> c >> d >> e >> k;
    if(abs(a-b) > k || abs(a-c) > k ||abs(a-d) > k ||abs(a-e) > k ||abs(b-c) > k ||abs(b-d) > k ||abs(b-e) > k ||abs(c-d) > k ||abs(c-e) > k ||abs(d-e) > k)
    {
        cout << ":(";
    }
    else
    {
        cout << "Yay!";
    }

    return 0;
}


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

int main() {
    int a, b;
    cin >> a;
    cin >> b;
    
    if ((a+b) == 3) {
        cout << 3 << endl;
    }
    else if ((a+b) == 4) {
        cout << 2 << endl;
    }
    else if ((a+b) == 5) {
        cout << 1 << endl;
    }

}

Measured memory_bytes: 256
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <complex>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;

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

  int ans = 0;
  for (int i = 0; i + 2 < s.size(); i++) {
    if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<queue>
#include<bitset>
#include<complex>
#include<cmath>
using namespace std;
template<typename __T>
inline void read(__T &x)
{
    x=0;
    int f=1;char c=getchar();
    while(!isdigit(c)){if(c=='-')	f=-1;c=getchar();}
    while(isdigit(c))	{x=x*10+c-'0';c=getchar();}
    x*=f;
}
int n;
int a[1005];
bool vis[1005];
int que[1005],tot=0;
void del(int x)
{
	que[tot++]=x;
	if(x==0)
	{
		for(int i=1;i<n;i++)
		{
			a[i-1]=a[i];
			vis[i-1]=vis[i];
		}
		n--;
	}
	else if(x==n-1)
	{
		n--;
	}
	else
	{
		a[x-1]=a[x-1]+a[x+1];
		vis[x-1]|=vis[x+1];
		for(int i=x;i<n;i++)
		{
			a[i]=a[i+2];
			vis[i]=vis[i+2];
		}
		n-=2;
	}
}
int main()
{
	read(n);
	long long mx=-12123213213213ll;
	for(int i=0;i<n;i++)
	{
		read(a[i]);
		mx=max(mx,0ll+a[i]);
	}
	if(mx<0)
	{
		cout<<mx<<endl;
		int gg;
		for(int i=0;i<n;i++)
			if(mx==a[i])
			{
				gg=i;
				break;
			}
		cout<<n-1<<endl;
		for(int i=0;i<gg;i++)
			cout<<1<<endl;
		for(int i=0;i<n-gg-1;i++)
			cout<<n-gg-i<<endl;
		return 0;
	}
	long long ans1=0;
	long long ans2=0;
	for(int i=0;i<n;i+=2)
		ans1+=max(a[i],0);
	for(int i=1;i<n;i+=2)
		ans2+=max(a[i],0);
	if(ans1>ans2)
	{
		for(int i=0;i<n;i+=2)
			if(a[i]>=0)	vis[i]=1;
		cout<<ans1<<endl;
	}
	else
	{
		for(int i=1;i<n;i+=2)
			if(a[i]>=0)	vis[i]=1;
		cout<<ans2<<endl;
	}
	while(n)
	{
		if(vis[0]==0)
		{
			del(0);
			continue;
		}
		if(vis[n-1]==0)
		{
			del(n-1);
			continue;
		}
		bool fg=0;
		for(int i=1;i<n-1;i++)
			if(vis[i-1]==vis[i+1] && vis[i]==0)
			{
				del(i);
				fg=1;
				break;
			}
		if(fg)	continue;
		break;
	}
	cout<<tot<<endl;
	for(int i=0;i<tot;i++)
		cout<<que[i]+1<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc.Split(bufio.ScanWords)
	n, m := nextInt(), nextInt()
	ans := make([]int, n)
	for i := 0; i < m; i++ {
		a, b := nextInt(), nextInt()
		ans[a-1]++
		ans[b-1]++
	}
	for i := range ans {
		puts(ans[i])
	}
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
#include<cstdio>
#include<cstdlib>
#include<vector>
const int N=1e5+3;
int n,a[N],rt,s,f[N];
std::vector<int>g[N];
void Dfs(int u,int fa){
	int v;
	for(int i=0;i<g[u].size();i++)if((v=g[u][i])!=fa)
	  a[u]-=a[v],Dfs(v,u);
}
void Dfs1(int u,int fa){
	int v,mx=0;
	for(int i=0;i<g[u].size();i++)if((v=g[u][i])!=fa)
	  Dfs1(v,u),f[u]+=f[v],mx=std::max(mx,f[v]);
	if(g[u].size()>1&&a[u]>0)exit(0*puts("NO"));
	if(g[u].size()>1&&a[u]<0){
	  if(std::min(f[u]-mx,f[u]/2)<-a[u])exit(0*puts("NO"));
	  f[u]+=a[u]*2;
	  a[fa]-=a[u],a[u]=0;
	}
	if(g[u].size()==1)f[u]=a[u];
}
int main(){
	int u,v;
	scanf("%d",&n);
	for(u=1;u<=n;u++)scanf("%d",a+u);
	for(int i=1;i<n;i++)
	  scanf("%d%d",&u,&v),
	  g[u].push_back(v),g[v].push_back(u);
	if(n==2)return 0*puts(a[1]==a[2]?"YES":"NO");
	for(u=1;u<=n;u++)if(g[u].size()>1)rt=u;
	a[0]-=a[rt],Dfs(rt,0);
	Dfs1(rt,0);
	return 0*puts(a[0]?"NO":"YES");
}

Measured memory_bytes: 16428
from math import atan2, pi
a,b,x = map(int, input().split())

S = a * a * b

if x / S >= 0.5:
    n = 2*(x - S) / (a * a)
    print(abs(atan2(n, a) * 180 / pi))
else:
    n = 2 * x / (a * b)
    print(abs(atan2(b, n) * 180 / pi))


Measured memory_bytes: 3060
import java.util.Scanner;

//A Symmetric Point
public class Main{
	
	public static class P{
		public double x;
		public double y;
		public P(double x, double y) {
			this.x = x;
			this.y = y;
		}
	}

	public static class Vec{
		public P s;
		public P t;
		public double dx;
		public double dy;
		public Vec(P t){
			this.s = new P(0, 0);
			this.t = t;
			dx = t.x-s.x;
			dy = t.y-s.y;
		}
		public Vec(P s, P t) {
			this.s = s;
			this.t = t;
			dx = t.x-s.x;
			dy = t.y-s.y;
		}
		public P symmetricPoint(P p){
			if(s.x==t.x){
				return new P(p.x+(s.x-p.x)*2, p.y);
			}
			else if(s.y==t.y){
				return new P(p.x, p.y+(s.y-p.y)*2);
			}
			else{
				double alpha = (s.y-t.y)/(s.x-t.x);
				double beta = s.y-s.x*alpha;
				double x = (2*p.y*alpha-2*alpha*beta+p.x-alpha*alpha*p.x)/(alpha*alpha+1);
				double y = (p.x-x)/alpha+p.y;
				return new P(x, y);
			}
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			String[] s = sc.next().split(",");
			double x1 = Double.parseDouble(s[0]);
			double y1 = Double.parseDouble(s[1]);
			double x2 = Double.parseDouble(s[2]);
			double y2 = Double.parseDouble(s[3]);
			double x3 = Double.parseDouble(s[4]);
			double y3 = Double.parseDouble(s[5]);
			P p1 = new P(x1,y1);
			P p2 = new P(x2,y2);
			P q = new P(x3,y3);
			P r = (new Vec(p1,p2)).symmetricPoint(q);
			System.out.println(r.x+" "+r.y);
		}
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#define Rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define Repe(i,a,b) for(register int i=(a);i>=(b);--i)
#define Chkmin(a,b) a=a<b?a:b
using namespace std;
inline void read(int &x){
    char c=getchar();
    int p=1;
    x=0;
    while(!isdigit(c)){
        if(c=='-')p=-1;
        c=getchar();
    }
    while(isdigit(c)){
        x=(x<<1)+(x<<3)+(c^'0');
        c=getchar();
    }
    x*=p;
}

const int MAXN=1e5+7;

static int n,k,x[MAXN];

inline void init()
{
	read(n);read(k);
	Rep(i,1,n)read(x[i]);
}

static int fps;

static int ans=1e9+7;

inline void solve()
{
	fps=1;
	Rep(i,1,n)if(x[i]>=0){fps=i;break;}
	if(x[n]<0)fps=n+1;
	if(fps>k)ans=-x[fps-k];
	if(n-fps+1>=k)Chkmin(ans,x[fps+k-1]);
	Repe(i,fps-1,max(fps-k,1))
		if(i+k-1<=n)Chkmin(ans,-2*x[i]+x[i+k-1]);
	Rep(i,fps,min(fps+k-1,n))
		if(i-k+1>=1)Chkmin(ans,2*x[i]-x[i-k+1]);
	printf("%d\n",ans);
}

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


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

using namespace std;

const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
    int h, w;
    cin >> h >> w;

    char g[55][55];
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> g[i][j];
        }
    }

    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if(g[i][j] == '.') continue;

            int cnt = 0;
            for (int k = 0; k < 4; ++k) {
                int nx = i + dx[k], ny = j + dy[k];
                if (0 <= nx && nx < h && 0 <= ny && ny < w &&
                    g[nx][ny] == '#') {
                    cnt++;
                }
            }
            if (cnt == 0) {
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include  <bits/stdc++.h>
using namespace std;
//vector<int> vec(N,0);
int main() {
  int N,ans=0;
  cin >> N;
  vector<int> vec(2*N,0);
  
  for(int i=0;i<2*N;i++){
   cin >> vec.at(i)  ;
  }
  
  sort(vec.begin(),vec.end());
  
  for(int i=0;i<2*N;i++){
    if(i%2 == 0){
      ans+=vec.at(i);
    }
  }
  cout << ans << endl;
  
}

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

#define MS(ARRAY,VALUE) memset(ARRAY,VALUE,sizeof(ARRAY))
#define Fin freopen("input.txt","r",stdin)
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Fout freopen("output.txt","w",stdout)
#define rep(i,a,b) for(i=a;i<=b;i++)
#define EPS 0.00000001
#define INF INT_MAX
#define PI 2*acos(0.0)
#define P1(XX) cout<<"db1: "<<XX<<endl
#define P2(XX,YY) cout<<"db2: "<<XX<<" "<<YY<<endl
#define P3(XX,YY,ZZ) cout<<"db3: "<<XX<<" "<<YY<<" "<<ZZ<<endl
#define set(XX,POS) XX|=(1<<POS)
#define reset(XX,POS) XX&=(~(1<<POS))
#define check(XX,POS) (bool)(XX&(1<<POS))
#define toggle(XX,POS) (XX^(1<<POS))
#define SORT(v) sort(v.begin(),v.end())
#define REVERSE(V) reverse(v.begin(),v.end())
#define VALID(X,Y,R,C) X>=0 && X<R && Y>=0 && Y<C
#define SIZE(ARRAY) sizeof(ARRAY)/sizeof(ARRAY[0])
#define RT printf("Run Time : %0.3lf seconds\n", clock()/(CLOCKS_PER_SEC*1.0))
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>


using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree< pair<int,int> , null_type, less< pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> odrst;

#define MOD 1000000007LL
#define MX 2000006


/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

ll a[10],b[10];

ll n, k,h,w;
string s[10];
map<string, int>p;
int main()
{
    int test, tc=0, i, j;
    ll m, d=0, l, ans=0,sum=0;
    int t;
    //scanf("%d", &test);
    test=1;
    while(test--)
    {
        //MS(a,0);
        cin>>h>>w>>k;
        if(h>w)swap(h,w);
        l=(h-1)/k;
        d=w/k;

        ans=(d-l);
                cout<<ans<<endl;

    }
    return 0;
}



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

int main() {
	string a, b;
	while (cin >> a >> b) {
		if (a == "0"&&b == "0")break;

		int h = 0, v = 0;
		for (int i = 0;i < 4;i++) {
			for (int j = 0;j < 4;j++) {
				if (a[i] == b[j]) {
					if (i == j)h++;
					else v++;
				}
			}
		}
		cout << h << ' ' << v << endl;
	}
	return 0;
}

Measured memory_bytes: 3028
#include <stdio.h>
int y,m,d,era[][3]={{1868,9,8},{1912,7,30},{1926,12,25},{1989,1,8}};
int checkera(int i){
	if(y>era[i][0])return 1;
	if(y==era[i][0]){
		if(m>era[i][1])return 1;
		if(m==era[i][1] && d>=era[i][2])return 1;
	}
	return 0;
}
void answer(int i,char t[]){
	printf("%s %d %d %d\n",t,y+1-era[i][0],m,d);
}
int main(void){
	while(scanf("%d %d %d",&y,&m,&d)!=EOF){
		if(checkera(3))answer(3,"heisei");
		else if(checkera(2))answer(2,"showa");
		else if(checkera(1))answer(1,"taisho");
		else if(checkera(0))answer(0,"meiji");
		else printf("pre-meiji\n");
	}
	return 0;
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
#define INF 1000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

struct edge {int from, to, cost;};

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

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

// 単一始点最短経路
// 始点 s
int V, E, s; cin >> V >> E >> s;
vector<edge> edges; // 辺の集合
rep(i, 0, E){
    edge add;
    cin >> add.from >> add.to >> add.cost;
    edges.push_back(add);
}
VI d(V, INF); // d[i] = 頂点 s から i への最短距離
d[s] = 0;

// 負の閉路検出
rep(i, 0, V)
    for (edge e : edges)
        if (d[e.from] != INF && chmin(d[e.to], d[e.from] + e.cost))
            if (i == V - 1) {
                cout << "NEGATIVE CYCLE\n";
                return 0;
            }

for (int i : d) {
    if (i == INF) cout << "INF\n";
    else cout << i << "\n";
}

}

// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり




Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;

int H,W,K;
char cake[320][320];
int ans[320][320];
bool e[320];

// aをbにcopy
void paint(int a,int b) {
  for (int i = 0; i < W; i++) {
    ans[b][i] = ans[a][i];
  }
  return ;
}

int main() {
  int num = 1;
  cin >> H >> W >> K;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> cake[i][j];
      ans[i][j] = -1;
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (cake[i][j] == '#') {
        e[i] = true;
        ans[i][j] = num;
        for (int k = j-1; k >= 0; k--) {
          if (cake[i][k] == '#') {
            break;
          } else {
            ans[i][k] = num;
          }
        }
        for (int k = j+1; k < W; k++) {
          if (cake[i][k] == '#') {
            break;
          } else {
            ans[i][k] = num;
          }
        }
        num++;
      }
    }
  }

  for (int i = 0; i < H; i++) {
    if (e[i]) {
      for (int j = i-1; j >= 0; j--) {
        if (e[j]) {
          break;
        } else {
          paint(i,j);
        }
      }
      for (int j = i+1; j < H; j++) {
        if (e[j]) {
          break;
        } else {
          paint(i,j);
        }
      }
    }
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cout << ans[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 4060