akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	static class Point {
		private int x;
		private int y;
		private int a;

		Point(int x, int y ,int a) {
			this.x = x;
			this.y = y;
			this.a = a;
		}
	}

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int point_W = sc.nextInt();
		int point_H = sc.nextInt();
		int lines = sc.nextInt();

		List<Point> list = new ArrayList<>();
		for (int i =  0;  i < lines; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int a = sc.nextInt();
			list.add(new Point(x, y, a));
		}

		int cells[][] = new int[point_H][point_W];
		fillCells(cells, 0);
		for (Point pt : list) {
			FlipCells(cells, pt, 1);
		}

		int areaNum = 0; 
		for (int i =  0; i < cells.length; i++) {
			for (int j = 0; j < cells[0].length; j++) {
				if (cells[i][j] == 0) {
					areaNum++; 
				}
			}
		}	
		System.out.println(areaNum);
	}

	static void fillCells(int cells[][], int value) {
		for (int[] cell : cells) {
			for (int j = 0; j < cell.length; j++) {
				cell[j] = value;
			}
		}	
	}	

	static void FlipCells(int cells[][], Point pt, int value) {
		switch(pt.a) {
			case 1:
			{
				for (int i =  0; i < cells.length; i++) {
					for (int j = 0; j < pt.x; j++) {
						cells[i][j] = value;
					}
				}	
			}
			break;
			case 2:
			{
				for (int i =  0; i < cells.length; i++) {
					for (int j = pt.x; j < cells[i].length; j++) {
						cells[i][j] = value;
					}
				}	
			}
			break;
			case 3:
			{
				for (int i = 0; i < pt.y; i++) {
					for (int j = 0 ; j <cells[i].length; j++) {
						cells[i][j] = value;
					}
				}	
			}
			break;
			case 4:
			{
				for (int i = pt.y; i < cells.length; i++) {
					for (int j =  0; j < cells[i].length; j++) {
						cells[i][j] = value;
					}
				}	
			}
			break;
		}
	} 

}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    ll N,D;
    cin>>N>>D;
    int cnt = 0;
    for (size_t i = 0; i < N; i++)
    {
        ll x,y;
        cin>>x>>y;
        if(x*x+y*y <= D*D)cnt++;
    }
    cout<<cnt<<endl;   
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10

int N, M;
vector<vector<int>>g;

int ans;

vector<int> stamp;
vector<int> retstamp_s;
vector<int> parent(100, -1);

int dfs(int cur, int tstamp) {
	stamp[cur] = tstamp;
	int retstamp = tstamp;
	for (int nx : g[cur]) {
		if (parent[cur] == nx)continue;
		if (stamp[nx] == 0) {
			parent[nx] = cur;
			retstamp = min(retstamp, dfs(nx, tstamp + 1));
		}
		else {
			retstamp = min(retstamp, stamp[nx]);
		}
	}
	if (retstamp == stamp[cur]) {
		ans++;
	}
	retstamp_s[cur] = retstamp;
	return retstamp;
}

int main() {
	cin >> N >> M;
	g.assign(N, vector<int>());
	stamp.assign(N,0);
	retstamp_s.assign(N, 0);
	for (int i = 0; i < M; i++) {
		int a, b; cin >> a >> b;
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	dfs(0,1);

	cout << ans - 1 << endl;



	return 0;
}


Measured memory_bytes: 256
#if 0
2019.12.15

每次考虑当前未被考虑的权值最小的点，设该点权值为 w ，检查与该点相连的每个点 v ，
如果 v 权值未知，另 v 的权值为 w + 1 即可。
用优先队列找出每次权值最小的点。
#endif
#include <cstdio>
#include <queue>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;
typedef std::pair<int, int> Par;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

const int maxn = 100010;
int head[maxn], nxt[maxn << 1], to[maxn << 1], hp = 1;
int a[maxn];
bool get[maxn];

inline void add(int u, int v) {
	nxt[++ hp] = head[u];
	head[u] = hp;
	to[hp] = v;
}

int main() {
	int n = read;

	for(int i = 1; i < n; i ++) {
		int u = read, v = read;
		add(u, v);
		add(v, u);
	}

	std::priority_queue<Par> qu;

	int k = read;
	while(k --) {
		int u = read;
		read(a[u]);
		qu.push(Par(- a[u], u));
		get[u] = 1;
	}

	while(!qu.empty()) {
		int u = qu.top().second;
		qu.pop();

		for(int i = head[u]; i; i = nxt[i]) {
			int v = to[i];
			if(get[v] and a[v] != a[u] + 1 and a[v] != a[u] - 1)
				return puts("No"), 0;
			if(!get[v]) {
				a[v] = a[u] + 1;
				get[v] = 1;
				qu.push(Par(- a[v], v));
			}
		}
	}

	puts("Yes");
	for(int i = 1; i <= n; i ++)
		printf("%d\n", a[i]);
}


Measured memory_bytes: 4212
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
    vector<int> a, b;
    string u;
    b.push_back(0);
    while (true) {
        cin >> u;
        int s, t;
        sscanf(u.c_str(), "%d,%d", &s, &t);
        if (!(s | t)) break;
        a.push_back(s);
        b.push_back(t);
    }
    int n = a.size();
    int deg = 0;
    double x = 0, y = 0;
    for (int i = 0; i < n; ++i) {
        deg += b[i];
        x += a[i] * sin(M_PI * deg / 180.0);
        y += a[i] * cos(M_PI * deg / 180.0);
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
    return 0;
}

Measured memory_bytes: 0
// uno {{{
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(c) begin(c),end(c)
#define REP(i,n) for ( int i=0; i<(int)(n); i++ )
#define REP1(i,a,b) for ( int i=(int)(a); i<=(int)(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long LL;

void RI() {}

template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}

template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__);

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

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }

// }}}

const int MAX_N = 100005;
int n, k, a[MAX_N];
LL ans = 0;
map<LL, LL> m;
void input()
{
    RI(n, k);
    REP(i, n)
    RI(a[i]);
}

void solve() {
    LL s = 0;
    m[0] = 1;
    REP(i, n)
    {
        s = (s + a[i]) % k;
        ans += m[s];
        m[s]++;
    }
    printf("%lld\n", ans);
}

int main( int argc, char *argv[] ) {
    input();
    solve();
    return 0;
}


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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
typedef complex<ld> Point;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1e5 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

ll dp[105][100005];
int weight[105];
int value[105];

int main() {
    int n, w;
    cin >> n >> w;
    rep(i, n) {
        cin >> weight[i] >> value[i];
    }
    repeat(i, 1, w + 1) {
        dp[0][i] = -INF;
    }

    rep(i, n) {
        rep(x, w + 1) {
            if (x - weight[i] >= 0)
                dp[i + 1][x] = max(dp[i][x], dp[i][x - weight[i]] + value[i]);
            else
                dp[i + 1][x] = dp[i][x];

            // debug(i);
            // debug(x);
            // debug(dp[i][x]);
        }
    }

    ll res = -INF;
    rep(i, w + 1) {
        res = max(res, dp[n][i]);
    }
    out(res);
    return 0;
}


Measured memory_bytes: 80128
N,k=gets.chomp.split(' ').map{|n| n.to_i}
H=gets.chomp.split(' ').map{|n| n.to_i}

H.sort!{|x,y| y<=>x}

kougeki = 0
H.each do |item|
  if k > 0 then
    k = k - 1
    next
  else
    kougeki = kougeki + item
  end
end

puts kougeki

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

int main(){
  int h,w;
  cin >> h>>w;
  vector<string> s(h);
  for(int i=0;i<h;i++)
    cin >> s[i];
  
  for (int i=0;i<w+2;i++)
    cout <<'#';
  cout<<endl;
  for(int i=0;i<h;i++)
    cout<<'#'<<s[i]<<'#'<<endl;
  for (int i=0;i<w+2;i++)
    cout <<'#';
       
       
}

Measured memory_bytes: 256
import numpy as np


N, K = map(int, input().split())
S = input()
s_arr = np.fromiter(map(int, S), int)

# search where 1
arr = np.array([0] + s_arr.tolist() + [0])
diff = np.diff(arr)
heads = np.where(diff == 1)[0]
tails = np.where(diff == -1)[0]
assert heads.size == tails.size

if s_arr[0] == 0:
    heads = np.array([0] + heads.tolist())
    tails = np.array([0] + tails.tolist())

if s_arr[-1] == 0:
    heads = np.array(heads.tolist() + [len(s_arr)])
    tails = np.array(tails.tolist() + [len(s_arr)])

ans = 0
for i, head in enumerate(heads):
    idx = min(i + K, len(tails) - 1)
    tail = tails[idx]
    ans = max(ans, tail - head)

print(ans)


Measured memory_bytes: 18600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define eb emplace_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"LINE %d: (%s) = ",__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;


int main(){
    int n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    for (int i=0;i<n;++i) {
        bool fg = true;
        for (int j=0;j<n;++j) {
            if (i + j >= n) break;
            if (s[i+j] != t[j]) fg = false;
        }
        if (fg) return cout << n + i << endl,0;
    }
    cout << 2 * n << endl;
}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;

int main(){
	cin>>N;
	string S;
	cin>>S;
	LL ans=0;
	REP(i,N){
		int r[3];
		int l[3];
		REP(j,3){
			r[j]=0;
			l[j]=0;
		}
		/*REP(j,3){
			cout<<i<<" "<<r[j]<<" "<<l[j]<<endl;
		}*/
		REP(j,i){
			if(S[j]=='R'){
				r[0]++;
			}
			if(S[j]=='B'){
				r[1]++;
			}
			if(S[j]=='G'){
				r[2]++;
			}
		}
		for(int j=i+1;j<N;j++){
			if(S[j]=='R'){
				l[0]++;
			}
			if(S[j]=='B'){
				l[1]++;
			}
			if(S[j]=='G'){
				l[2]++;
			}
		}
		/*REP(j,3){
			cout<<i<<" "<<r[j]<<" "<<l[j]<<endl;
		}*/
		if(S[i]=='R'){
			ans+=r[1]*l[2]+r[2]*l[1];
		}
		if(S[i]=='G'){
			ans+=r[0]*l[1]+r[1]*l[0];
		}
		if(S[i]=='B'){
			ans+=r[0]*l[2]+r[2]*l[0];
		}
		REP(j,N){
			int x=i-j-1;
			int y=i+j+1;
			if(x<0)continue;
			if(y>=N)continue;
			if((S[i]!=S[x])&&(S[i]!=S[y])&&(S[x]!=S[y])){
				ans--;
			}
		}
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3628
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

a = ini()


def solve():
    return a + a * a + a * a * a


print(solve())


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

int n, val, cnt;
unordered_set<int> s;

int main() {
	scanf("%d", &n);
	for(int i = 0; i < n; ++i) {
		scanf("%d", &val);
		if(s.find(val) == s.end())
			s.insert(val);
		else 
			s.erase(val);
	}
	printf("%d\n", (int) s.size());
}

Measured memory_bytes: 4388
eval'N,K,*A='+`dd`.split*?,
K.times{b=[t=0]*-~N
N.times{b[[0,_1-A[_1]].max]+=1
b[[N,_1-~A[_1]].min]-=1}
b.pop
A=b.map{t+=_1}
A.min<N||break}
p *A

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const int MOD=1e9+7;

int main(){
    ll A; cin >> A;
    string B; cin >> B;
    ll res;
    ll num1, num2;
    num1=A*(B[0]-'0');
    num2=A*((B[2]-'0')*10+B[3]-'0')/100;
    res=num1+num2;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<cstring>
#include<deque>
#include<algorithm>
using namespace std;
    long long i,j,k,n,x,y,z,winner,start,res,flag=0;
    char a[1005],b[1005],c[1005],ch,temp;
deque<char>v[3];

int main()
{
    

    cin>>a>>b>>c;
    x=strlen(a);
    y=strlen(b);
    z=strlen(c);
    for(i=0;i<x;i++)
      v[0].push_back(a[i]);
    for(i=0;i<y;i++)
      v[1].push_back(b[i]);
    for(i=0;i<z;i++)
      v[2].push_back(c[i]);
    for(i=0;i<3;i++)
      v[i].push_back('#');
    i=j=k=0;
    start=0;
    ch='a';
    while(1)
    {
        //cout<<ch<<" ";
        
        deque<char>::iterator it=v[ch-'a'].begin();
        temp=*it;
        //cout<<temp<<endl;
        v[(ch-'a')].pop_front();
        for(i=0;i<3;i++)
        {
            //cout<<v[i].size()<<" ";
            if(v[i].size()==0)
            {
                   cout<<(char)('A'+i);
                   flag=1;
                   break;
            }
               
        }
        //cout<<flag<<endl;
        if(flag==1)
          break;
        ch=temp;
    }
    //cout<<ch;
}

Measured memory_bytes: 256
#include <stdio.h>
#define long long long 
long arr[200003];

int main()
{
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	// freopen("input.in", "r", stdin);

	int n; scanf("%d", &n);
	for(int i = 0; i < n; i++)
		scanf("%lld", &arr[i]);

	long res = 0;
	long psum = 0, xsum = 0;
	int l = 0;
	for(int i = 0; i < n; i++)
	{
		psum += arr[i];
		xsum ^= arr[i];
		while(psum != xsum)
		{
			psum -= arr[l];
			xsum ^= arr[l];
			l++;
		}
		res += (long)(i-l+1);
	}
	printf("%lld\n", res);
}	










 

Measured memory_bytes: 1664
#include <stdio.h>
#define MAX(maxN,m) ((maxN) > (m) ? (maxN) : (m))

int main(){
    int n;

    scanf("%d", &n);

    int maxN = 0, total = 0;
    for (int i = 0; i<n; i++) {
        int m;

        scanf("%d", &m);

        maxN = MAX(maxN, m);
        total += m;
    }

    printf("%s", maxN < total - maxN ? "Yes" : "No");
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main() {
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    int N; cin >> N;
    int A[1010][1010];
    for(int i=0; i<N; i++){
        for(int j=0; j<N-1; j++){
            int a; cin >> a;
            a--;
            A[i][j] = a;
        }
    }
    
    int cur[1010];
    for(int i=0; i<1010; i++) cur[i]=0;

    
    int cnt = 0;
    while(1){
        
        
        bool nopair = true;

        bool used[1010] = {};

        for(int i=0; i<N; i++){
            if(cur[i]==N-1) continue;
            int aite = A[i][cur[i]];
            
            if(used[i] || used[aite]) continue;
            if(i==A[aite][cur[aite]]){
                cur[i]++;
                cur[aite]++;
                used[i] = true;
                used[aite] = true;
                nopair = false;
            }
        }
        
        
        if(nopair){
            cout << -1 << endl;
            return 0;
        }
        
        cnt++;
        
        bool allend = true;
        for(int i=0; i<N; i++){
            if(cur[i]!=N-1) allend = false;
        }
        
        
        if(allend){
            cout << cnt << endl;
            return 0;
        }
        
    }
    
    return 0;
}



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


int bit[20];
int N, M;

void make_bit(int n){
    for(int i=0; i<N; i++){
        bit[i+1]=n%2;
        n /=2;
    }
}

int main(){

    cin >> N >> M;
    vector<int> s[11]; //スイッチ毎に覚える
    for(int i=0; i<M; i++){
        int k; cin >> k;
        for(int j=0; j<k; j++){
            int t; cin >>t; 
            s[t].push_back(i+1);
        }
    }
    int p[11];
    for(int i=0; i<M; i++){
        cin >> p[i+1];
    }
    int cnt[11];
    int res=0;
    for(int i=0; i<pow(2,N); i++){
        for(int j=0; j<20; j++){
            bit[j]=0;
        }
        for(int j=1; j<=M; j++){
            cnt[j]=0;
        }
        make_bit(i);
        for(int j=1; j<=N; j++){
            if(bit[j]==1){
                for(auto x : s[j]){
                    cnt[x] = 1-cnt[x];
                }
            }
        }
        bool flag=true;
        for(int j=1; j<=M; j++){
            if(cnt[j]!=p[j]){
                flag=false;
            }
        }
        if(flag) res++;
    }

    cout << res << endl;
    
}

Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
  int N;
  cin >> N;
  vector<int> A(N + 1), B(N);
  for (auto& v : A) cin >> v;
  for (auto& v : B) cin >> v;

  long long cnt = 0;
  for (size_t i = 0; i < B.size(); ++i) {
    int r = min(A[i], B[i]);
    A[i] -= r;
    B[i] -= r;
    cnt += r;
    r = min(A[i + 1], B[i]);
    A[i + 1] -= r;
    B[i] -= r;
    cnt += r;
  }
  cout << cnt << endl;
  return 0;
}


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

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {


            Console.WriteLine(Console.ReadLine().Replace(',',' '));

            Console.ReadKey();
        }



        #region MyRegion

        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        /// <summary>
        /// 空白区切の数値を取得する
        /// </summary>
        /// <returns>The read split int.</returns>
        public static int[] ReadSplitInt()
        {
            return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        }

        /// <summary>
        /// 空白区切の数値を取得
        /// </summary>
        /// <returns>The read split long.</returns>
        public static long[] ReadSplitLong()
        {
            return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        }


        public static int[][] ReadSplitIntLines(int n)
        {
            return Enumerable.Range(0, n).Select(x => ReadSplitInt()).ToArray();
        }

        public static long[][] ReadSplitLongLines(int n)
        {
            return Enumerable.Range(0, n).Select(x => ReadSplitLong()).ToArray();
        }

        public static long[][] ReadSplitLongLines(long n)
        {
            var ret = new List<long[]>();
            for (long i = 0; i < n; i++)
            {
                ret.Add(ReadSplitLong().ToArray());
            }

            return ret.ToArray();
        }

        #endregion

    }
}


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

#define ll long long int
#define f(i, a, b) for(ll i=a;i<b;i++)
#define fi(i, a, b) for(ll i=b-1;i>=a;i--)
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define ml map<ll,ll>
#define pll pair<ll,ll>
int main(){
  int n;
  ll d;
  cin>>n>>d;

int res=0;
  for(int i=0;i<n;i++){
     ll x,y;
   cin>>x>>y;
      ll k =  abs(x*x) + abs(y*y) ;
  ll len  =  ceil(sqrtl(  k  ) );
  //cout<<len<<"\n";
   if( len<=d  )
        res++;
      }

  cout<<res;
 }


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

    class Program
    {
        static void Main(string[] args)
        {
            long a = long.Parse(Console.ReadLine());
            string[] b = new string[a];

            for (long i = 0; i < a; i++)
            {
                b[i] = Console.ReadLine();
            }

            Dictionary<string,long> keihin = new Dictionary<string,long>();

            for (long i = 0; i < a; i++)
            {
                if (!keihin.ContainsKey(b[i]))
                {
                    keihin.Add(b[i], 1);
                }
            }

            Console.WriteLine(keihin.Count.ToString()); 

        }


    }

Measured memory_bytes: 52940
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    int A,B,C;
    cin >> A >> B >>C;
    if(A<=C&&C<=B){
      cout <<"Yes";
    }else{
      cout <<"No";
    }
    return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        n,m = LI()
        if n == 0:
            break

        s,g = LI()
        a = [LI() for _ in range(m)]
        e = collections.defaultdict(list)
        for x,y,d,c in a:
            e[x].append((y,d,c))
            e[y].append((x,d,c))

        def search(s):
            d = collections.defaultdict(lambda: inf)
            d[(s,0,-1)] = 0
            q = []
            heapq.heappush(q, (0, (s, 0, -1)))
            v = collections.defaultdict(bool)
            while len(q):
                k, u = heapq.heappop(q)
                if v[u]:
                    continue
                v[u] = True
                if u[0] == g and u[1] == 1:
                    return '{:0.9f}'.format(k)
                c = u[1]
                b = u[2]

                for uv, ud, uc in e[u[0]]:
                    if uv == b:
                        continue
                    for tc in range(max(c-1,1),min(uc+1,c+2)):
                        nuv = (uv, tc, u[0])
                        if v[nuv]:
                            continue
                        vd = k + ud / tc
                        if d[nuv] > vd:
                            d[nuv] = vd
                            heapq.heappush(q, (vd, nuv))

            return 'unreachable'

        rr.append(search(s))

    return '\n'.join(map(str, rr))



print(main())



Measured memory_bytes: 15892
#include <stdio.h>
int main(void){
   int r,c;
   int i,j;
  
   scanf("%d %d",&r,&c);
   int table[r+1][c+1];
  
   for(i=0;i<=r;i++)
       for(j=0;j<=c;j++) table[i][j]=0;
  
   for(i=0;i<r;i++){
       for(j=0;j<c;j++){
           scanf("%d",&table[i][j]);
       }
   }
   
   for(i=0;i<=r;i++){
       for(j=0;j<=c;j++){
           if(i!=r){
               printf("%d",table[i][j]);
                table[r][j]=table[r][j]+table[i][j];
                if(j==c) break;
                table[i][c]=table[i][c]+table[i][j];
                printf(" ");
           }
           else {
               printf("%d",table[i][j]);
               if(j==c) break;
               printf(" ");
           }
       }
       printf("\n");
   }
   return 0;
}
 


Measured memory_bytes: 2104
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (ll i = 0;i < (a);++i)
#define FOR(i,a,b) for (ll i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll x;
    cin >>x;

    REP(i,4000){
        REP(j,4000){
            ll tempi = i,tempj = j;
            
            REP(k,4){
                tempi*=i;
                tempj*=j;
            }
            
            if(tempi-tempj == x){
                cout << i << " " << j << endl;
                return 0;
            }
            else if(tempi+tempj == x){
                cout << i << " " << -j << endl;
                return 0;
            }
        }
    }
    cout << "None" << endl;
    return 0;
}

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

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	sumJPY := 0
	sumBTC := 0.0
	var (
		x float64
		u string
	)
	for i := 0; i < n; i++ {
		fmt.Scan(&x, &u)
		if u == "JPY" {
			sumJPY += int(x)
		} else {
			sumBTC += x
		}
	}

	fmt.Println(float64(sumJPY) + sumBTC*380000.0)
}


Measured memory_bytes: 512
a,b,c,x,y=map(int,input().split())
ans1=2*c*max(x,y)
ans2=2*c*min(x,y)+a*(x-min(x,y))+b*(y-min(x,y))
ans3=a*x+b*y
print(min(ans1,ans2,ans3))

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

int N,K;
string P[10000] = {""};
bool isUsed[10000] = {false};

int main(){
    cin >> N >> K;
    for(int i=0;i<N;i++){
        cin >> P[i];
    }
    
    vector<int> alpha(26,0);
    for(int i=0;i<N;i++){
        alpha[P[i][0] - 'A']++;
    }
    sort(alpha.begin(),alpha.end(),greater<int>());
    int count = 0;
    int ans = 0;
    while(1){
        for(int i=0;i<26;i++){
            if(alpha[i]>0){
                alpha[i]--;
                count++;
            }
            if(count==K) break;
        }
        if(count==K){
            ans++;
            count=0;
            sort(alpha.begin(),alpha.end(),greater<int>());
        }else{
            break;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
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;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll r, g, b, n;
  cin >> r >> g >> b >> n;
  ll res = 0;
  for (ll i = 0; i*r <= n; i++) {
    for (ll j = 0; j*g <= n-i*r; j++) {
      if ((n-i*r-j*g)%b == 0) res++;
    }
  }
  cout << res << endl;
}

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

dp = [0] * (10**6+1)

for a in A:
    dp[a] += 1

for i in range(1, len(dp)):
    if dp[i]:
        for j in range(i+i, len(dp), i):
            dp[j] = 0
print(dp.count(1))


Measured memory_bytes: 32036
#include<stdio.h>
long long int kai(long long int n,long long int p)
{
	long long int res = 1;
	long long int i;
	for (i = 1; i <= n; i++)
		res = res * i % p;
	return res;
}
int main()
{
	int n, k;
	scanf("%d %d", &n, &k);
	int i, j, l;
	int a[102];
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	long long int dp[102][102][300];
	long long int p = 1000000007;
	for (i = 0; i < 102; i++)
		for (j = 0; j < 102; j++)
			for (l = 0; l < 300; l++)
				dp[i][j][l] = 0;
	dp[0][0][0] = 1;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j <= i; j++)
		{
			for (l = 0; l < 300; l++)
			{
				if (dp[i][j][l] > 0)
				{
					dp[i + 1][j][l] = (dp[i + 1][j][l] + dp[i][j][l]) % p;
					dp[i + 1][j + 1][l ^ a[i]] = (dp[i + 1][j + 1][l ^ a[i]] + dp[i][j][l]) % p;
				}
			}
		}
	}
	long long int ans = 0;
	for (i = 0; i <= n; i++)
		ans = (ans + dp[n][i][k] * kai(i, p)) % p;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 24576
#include <iostream>
#include <queue>
#include <string>

using namespace std;

typedef struct pp{
    string name;
    int t;
} P;

int main() {
    int n, q, i, t;
    string name;
    queue<P> Q;
    cin >> n >> q;
    for (int i = 0; i < n; i++) {
        P p;
        cin >> p.name >> p.t;
        Q.push(p);
    }
    int elaps = 0;
    while (!Q.empty()) {
        P a = Q.front(); Q.pop();
        t = min(a.t, q);
        elaps += t;
        a.t -= t;
        if (a.t == 0) {
            std::cout << a.name <<  " " << elaps << endl;
        } else {
            Q.push(a);
        }
    }
}



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

int main()
{
	double t1, t2;
	while (1)
	{
		cin >> t1 >> t2;
		if (cin.eof()) break;

		if (t1<35.5 && t2<71){
			cout << "AAA" << endl;
		}
		else if (t1<37.5 && t2<77){
			cout << "AA" << endl;
		}
		else if (t1<40 && t2<83){
			cout << "A" << endl;
		}
		else if (t1<43 && t2<89){
			cout << "B" << endl;
		}
		else if (t1<50 && t2<105){
			cout << "C" << endl;
		}
		else if (t1<55 && t2<116){
			cout << "D" << endl;
		}
		else if (t1<70 && t2<148){
			cout << "E" << endl;
		}
		else{
			cout << "NA" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;



int main() {
    int a, b;
    cin >> a >> b;
    int ans = max(a+b, max(a-b, a*b));
    cout << ans << endl;
    return 0;
}

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

#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define MOD 1000000007

const int MAX_M = 100000;


int main(){
  ll n, k;
  //string s;
  cin >> n >> k;
  
  ll ans = 0;
  
  rep(i,k,n+2){		// 選ぶ個数(k〜n+1)
    
    if(i == n+1)
      ans += 1;
    
    else{
      ll min = 0, max = 0;
      min = (i-1)*i/2;
      max = min + (n-i+1)*i;
      
      //cout << i << " " << max << " " << min << endl;
      ans += max + 1 - min;
    }
  }
  
  cout << ans%MOD << endl;
}

Measured memory_bytes: 3616
#include <iostream>

using namespace std;

int main()
{
	int n;
	cin >> n;
	double sum = 0.0;
	for (int i = 0; i < n; ++i) {
		double a;
		cin >> a;
		sum += ((double)1 / a);
	}
	cout << ((double)1 / sum);

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define  inf 2e18
#define  mod 1000000007
#define  bg begin()
#define  en end()
#define  ll long long int
#define  pb push_back
#define  mp make_pair
#define  vi vector<int>
#define  vll vector<long long int>
#define  vpll vector<pair<long long int,long long int> >
#define  vpii vector<pair<int,int> >
#define  vstr vector<string>
#define  mpii map<int ,int>
#define  mpll map<long long int,long long int >
#define  max3(a,b,c) max(a,max(b,c))
#define  min3(a,b,c) min(a,min(b,c))
#define  w(t) ll t; cin>>t; while(t--)
#define  vin(v,n) for(int i=0;i<n;i++){cin>>x; v.pb(x);  }
#define  for0(i,n) for(int i=0;i<n;i++)
#define  for1(i,n) for(int i=1;i<=n;i++)
#define  forv(it,v) for(auto it=v.begin();it!=v.end();it++)
#define  mem(a,val) memset(a,val,sizeof(a))
#define  Sort(vec) sort(vec.begin(),vec.end())
#define  RSort(vec) sort(vec.rbegin(),vec.rend())
#define  eb emplace_back
#define  bs binary_search
#define  lb(v,a) lower_bound(v.begin(),v.end(),a)
#define  ub(v,a) upper_bound(v.begin(),v.end(),a)
#define  deb1(x) cerr<<#x<<": "<<x<<" "<<endl
#define  deb2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define  deb3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define  deb4(a, b, c, dp) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#dp<<": "<<dp<<endl
#define  FIFO ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define  yes "YES"
#define  no "NO"
#define  PI 3.141592653589793238462643383279502884L
ll Ceil(ll a, ll b) {return a / b + (a % b != 0);}
ll fastModExp(ll a, ll b) { ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b = b >> 1;} return res;}
// 2- Dimensional vector:- vector<vector<int> > v(n, vector<int> (26, 0));

mpll mpx;

int main() {
    ll z = 1000000000000000000;
    ll n;
    cin >> n;
    ll x;
    vll v;
    vin(v, n);
    ll ans = 1;
    bool p = true;
    for0(i, n) {
        if (v[i] == 0) {
            cout << 0 << endl;
            p = false;
            return 0;
        }
    }
    for0(i, n) {
        if (v[i] == 0) {
            cout << 0 << endl;
            p = false;
            break;
        }
        ll r = floor(log10(ans) + 1);
        ll r2 = floor(log10(v[i]) + 1);
        if (v[i] > (z / ans)) {
            cout << -1 << endl;
            p = false;
            break;
        }
        ans = ans * v[i];
    }
    if (p)
        cout << ans << endl;

    return 0;
}

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

using ll = long long;
using ull = unsigned long long;
#define countof(a) (sizeof(a)/sizeof((a)[0]))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define bzero(p, n) memset(p, 0, n)
#define all(a) begin(a),end(a)
template<class T> inline void sort_uniq(T& c) { sort(ALL(c)); c.erase(unique(ALL(c)), c.end()); }
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
inline int powi(int x,int y) {int p=1; while(y--) p*=x; return p;}
inline ll powll(ll x,ll y) {ll p=1; while(y--) p*=x; return p;}
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}

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

    int N, M; cin >>N >>M;
    vector<pair<int, int>> PY(M);
    vector<pair<int, int>> PY_sorted;
    rep(i, M) {
        cin >> PY[i].first >> PY[i].second;
    }
    PY_sorted = PY;
    sort(all(PY_sorted));

    map<pair<int, int>, int> x_map;
    int P_prev = -1;
    int x;
    rep(i, M) {
        if (PY_sorted[i].first != P_prev) {
            x = 1;
        } else {
            x++;
        }
        x_map.emplace(PY_sorted[i], x);
        P_prev = PY_sorted[i].first;
    }

    rep(i, M) {
        printf("%06d%06d\n", PY[i].first, x_map[PY[i]]);
        //cout << setw(6) << setfill('0') << PY[i].first  << setw(6) << setfill('0') << x_map[PY[i]] << endl;
    }
}


Measured memory_bytes: 9344
open Printf
open Scanf

let solve x y =
  let a, b = 4 * x - y, y - 2 * x in
  if a mod 2 = 0 && b mod 2 = 0 && a >= 0 && b >= 0 then "Yes" else "No"

let () =
  scanf "%d %d " solve |> printf "%s\n"


Measured memory_bytes: 3784
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String[] tokens = in.nextLine().split(" ");
		in.close();
		Set<Integer> values = new HashSet<>();
		for (int i = 0; i < tokens.length; ++i) {
			values.add(Integer.parseInt(tokens[i]));
		}
		if (values.contains(1) && values.contains(9) && values.contains(7) && values.contains(4)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

}

Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main(void){
    int n,i,ans=0;
    double t,a,min=100000;
    cin >> n >> t >> a;
    vector<int> h(n);
    for(i=0;i<n;i++) cin >> h[i];
    for(i=0;i<n;i++){
        double tmp = t-h[i]*0.006;
        if(min>fabs(a-tmp)){
            min = fabs(a-tmp);
            ans=i+1;
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rapido ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define mod 1000000007



void solve()
{
    string s;cin>>s;
    if(s[2]==s[3] && s[4]==s[5])
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
}
int32_t main() 
{
    rapido;
    int t;
    //cin>>t;
    t=1;
    while(t--)
    solve();
    return 0;
}



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

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

    cout << a * a * a << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner


object Main {
  def read() = {
    val sc = new Scanner(System.in)
    val hh, ww, h, w = sc.nextInt()
    (hh, ww, h, w)
  }


  def main(args: Array[String]): Unit = {
    val (hh, ww, h, w) = read()
    println((hh-h) * (ww-w))
  }
}

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

const int N = 500005; 

using namespace std; 

int n; 
char s[N]; 

int pre[N], nxt[N], f[N]; 

int main() {

	scanf("%d", &n); 
	scanf("\n%s", s+1);

	s[0] = '0';
	s[++n] = '0'; 

	for(int i=0; i<=n; ++i) {
		if(s[i] == '0') pre[i] = i; 
		else pre[i] = pre[i-1]; 
	}

	for(int i=n; i>=0; --i) {
		if(s[i] == '0')	nxt[i] = i; 
		else nxt[i] = nxt[i+1]; 
	}

	for(int i=0; i<=n; ++i) {
		if(i>=3) {
			if(s[i-2] == '1' && s[i-1] == '0' && s[i] == '1') {
				int j = pre[i-2]; 
				f[i] = max(f[i], f[j] + i - j - 2); 
				if(j != i-3) f[i] = max(f[i], f[j+1] + i - j - 3); 
			}
		} 	
		if(i+3<=n) {
			if(s[i] == '1' && s[i+1] == '0' && s[i+2] == '1') {
				int j = nxt[i+2]; 
				f[j-1] = max(f[j-1], f[i-1] + j - i - 2); 
				if(j != i+3) f[j-2] = max(f[j-2], f[i-1] + j - i - 3); 
			}
		}
		if(i>=1) f[i] = max(f[i], f[i-1]); 
	}

	printf("%d\n", f[n]); 

	return 0; 

}

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

int main(){
  int n;
  cin >> n;
  int m=n;
  int a=0;
  int x;
  for(int i=0; i<n; i++){
    //int x;
    cin >> x;
    m = min(m,x);
    if(m>=x) a++;
  }
  cout << "";
  printf("%d", a);
  //printf("%d", a);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }


int main() {
    int n;
    cin >> n;
    bool ans = false;

    for(int i = 1; i <=9; i++){
        int nw = n/i;
        if(n % i == 0 && nw <= 9){
            ans = true;
            break;
        }
    }
  if(ans == true){
      cout << "Yes" << endl;
  }else{
      cout << "No" << endl;
  }

    return 0;
}


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

cnt = 0
for i in range(n):
    if p_l[i] != min(p_l) + i:
        cnt += 1
if cnt == 2 or p_l == sorted(p_l):
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define input(array) repi(array##_itr, array) { cin >> *(array##_itr); }
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main() {
	int n, x, y;
	// int ans=0;
	cin >> n >> x >> y;
	vector<vector<int>> path(n);
	rep(i, n) {
		if (i != 0) {
			path[i].push_back(i - 1);
	
		}
		if (i != n - 1) {
			path[i].push_back(i + 1);
		}
	}
	x--;
	y--;
	path[x].push_back(y);
	path[y].push_back(x);
	vector<int> ans(n ,0);
	vector<int> dis(n, INF);
	queue<int> q;
	int at;
	rep(i, n) {
		q.push(i);
		rep(j, n) { dis[j] = INF; }
		dis[i] = 0;
		while (!q.empty()) {
			at = q.front();
			q.pop();
			repi(itr, path[at]) {
				if (chmin(dis[*itr], dis[at] + 1)) {
					q.push(*itr);
				}
			}
		}
	//	rep(j, n) { clog << dis[j] << " "; }
	//	clog << endl;
		for (int j = i + 1; j < n;j++) {
			if (dis[j] == INF) continue;
			ans[dis[j]]++;
		}
	}
	for (int i = 1; i < n; i++) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n,m,v;
	cin>>n>>m>>v;

	char ar[n+1][m+1];
	for(i=0;i<n;i++){
		cin>>ar[i];
	}	

	ll cur=0;
	int ans[n+1][m+1];
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			ans[i][j]=0;
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			if(ar[i][j]=='#'){
				k=j; cur+=1;
				while(k>=0&&ans[i][k]==0){
					ans[i][k]=cur;
					k--;
				}
				k=j+1;
				while(k<m&&ans[i][k]==0&&ar[i][k]=='.'){
					ans[i][k]=cur;
					k++;
				}
			}
		}
	}

	for(i=0;i<n;i++){
		if(ans[i][0]==0){
			j=i+1;
			while(j<n&&ans[j][0]==0){
				j++;
			}
			if(j<n){
				for(k=i;k<j;k++){
					for(l=0;l<m;l++){
						ans[k][l]=ans[j][l];
					}
				}
			}
			else{
				j=i-1;
				while(j>=0&&ans[j][0]==0){
					j--;
				}
				if(j>=0){
					for(k=j+1;k<=i;k++){
						for(l=0;l<m;l++){
							ans[k][l]=ans[j][l];
						}
					}
				}
			}
		}
	}

	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			cout<<ans[i][j]<<" ";
		}cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main() {
long long int N,M,a,b,c;
cin>>N>>M;
if(M<=2*N){
        a=M/2;
    }
if(M>2*N){
       b=M-2*N;
       c=b/4;
       a=N+c;
   }
cout<<a;


    return 0;
}



Measured memory_bytes: 256