akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);


  Int N, Q;
  cin>>N>>Q;
  set<Int> A, B; //A:select max, B:select near x
  Int sumA = 0;
  Int sumB = 0;
  {
    vector<Int> tmp(N);
    cin>>tmp;
    for(Int i=N-1;i>=0;i--){
      if((N-1 - i)%2 == 0) {
	A.insert(tmp[i]);
	sumA += tmp[i];
      }
      else B.insert(tmp[i]), sumB += tmp[i];
    }
  }

  auto getMax = [](set<Int> &S){return *(--S.end());};
  auto getNearX = [](Int X, set<Int> &S){
    auto it = S.lower_bound(X);
    if(it == S.begin()) return P(-INF,*it);
    auto it2 = --S.lower_bound(X);
    return P(*it2, *it);
  };
  
  auto aplly= [&](Int X){
    while(1){
      Int b = getMax(B);
      Int l, r;
      tie(l, r) = getNearX(X, A);
      Int x = abs(X - l) <= abs(X - r)? l:r;
      //prArr(A);
      //prArr(B);
      //pr(X, b, x, l, r);
      if( b < X ) break;
      if( b < x ) x = l;
      if( b < x ) break;
      if((abs(X - b) > abs(X - x)) || (abs(X - b) == abs(X - x) && x < b)){
	B.erase(b);
	A.erase(x);
	B.insert(x);
	A.insert(b);
	sumA += b - x;
	sumB += x - b;
      }
      else break;
    }
  };
  

  vector<P> X;
  for(Int i=0;i<Q;i++){
    Int x;
    cin>>x;
    X.push_back(P(x, i));
  }
  sort(X.begin(), X.end(), greater<P>());
  vector<Int> ans(Q);
  for(Int i=0;i<Q;i++){
    aplly(X[i].first);
    ans[X[i].second] = sumA;
  }
  cout<<ans<<endl;
  

  return 0;
}


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

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

    if(c % 2 == 1){
        cout << "Odd" << endl;
    }

    else if(c % 2 == 0){
        cout << "Even" << endl;
    }

}

Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
vector<int>pat[1010101];
bool flag[1010101];
vector<int>topo;
int rt[1010101];
bool f = false;
void dfs(int node)
{
	if (flag[node])return;
	flag[node] = true;
	for (int i = 0; i < pat[node].size(); i++)dfs(pat[node][i]);
	topo.push_back(node);
	rt[node] = topo.size();
}
int main()
{
	int num, way;
	scanf("%d%d", &num, &way);
	string s;
	cin >> s;
	for (int i = 0; i < way; i++)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		x--, y--;
		if (s[x] == 'A'&&s[y] == 'A')pat[x].push_back(y + num), pat[y].push_back(x + num);
		if (s[x] == 'A'&&s[y] == 'B')pat[x + num].push_back(y + num + num), pat[y + num + num + num].push_back(x);
		if (s[x] == 'B'&&s[y] == 'B')pat[x + num + num].push_back(y + num + num + num), pat[y + num + num].push_back(x + num + num + num);
		if (s[x] == 'B'&&s[y] == 'A')pat[x + num + num + num].push_back(y), pat[y + num].push_back(x + num + num);
	}
	int pt = 0;
	for (int i = 0; i < num * 4; i++)dfs(i);
	for (int i = 0; i < num * 4; i++)
	{
		for (int j = 0; j < pat[i].size(); j++)
		{
			if (rt[i] < rt[pat[i][j]])f = true;
		}
	}
	printf(f ? "Yes\n" : "No\n");
}

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

int main(void) {
	int N;
	vector<char> S;
	cin >> N;
	for (int i = 0; i < N; i++) {
		char x; cin >> x; S.push_back(x);
	}
	int aa=0;
	for (int i = 1; i < N; i++) {
		set<char> X(S.begin(),S.begin()+i),Y(S.begin()+i,S.end());
		vector<char> result;
		set_intersection(X.begin(), X.end(), Y.begin(), Y.end(), back_inserter(result));
		aa = max(aa, (int)result.size());
	}

	cout << aa;
 return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]
 
flag = True
for a in A:
  if a%2 == 0:
    if a%3 != 0 and a%5 != 0:
      flag = False
 
if flag:
  print('APPROVED')
else:
  print('DENIED')  

Measured memory_bytes: 2940
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<bitset>

#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.bigin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vi>
#define vvi64 vector<vi64>

using namespace std;

int main() {
    int64_t n, ans = 0;
    cin >> n;
    vi64 a(n);
    Srep(n) cin >> a[i];
    rep(i,n-1){
        if(a[i] > a[i+1]){
            ans += a[i] - a[i+1];
            a[i+1] += a[i] - a[i+1];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4808
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class Equals {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            int[] p = new int[n + 1];
            UnionFind uf = new UnionFind(n + 1);

            for (int i = 1; i <= n; i++) {
                p[i] = Integer.parseInt(in.next());
                uf.makeSet(i);
            }

            for (int i = 1; i <= m; i++) {
                int x = Integer.parseInt(in.next());
                int y = Integer.parseInt(in.next());
                uf.unite(x, y);
            }

            long result = 0;
            for (int i = 1; i <= n; i++) {
                int goal = p[i];
                if (uf.same(i, goal)) {
                    result++;
                }
            }
            out.println(result);

        }

        public class UnionFind {
            private int[] size;
            private int[] parents;

            public UnionFind() {
            }

            public UnionFind(int size) {
                this.size = new int[size];
                this.parents = new int[size];
                for (int i = 0; i < size; i++) {
                    makeSet(i);
                }
            }

            public void makeSet(int x) {
                parents[x] = x;
                size[x] = 1;
            }

            public int findSet(int x) {
                if (x != parents[x]) {
                    parents[x] = findSet(parents[x]);
                }
                return parents[x];
            }

            public boolean unite(int x, int y) {
                if (same(x, y)) {
                    return false;
                }
                link(findSet(x), findSet(y));
                return true;
            }

            public boolean same(int x, int y) {
                return findSet(x) == findSet(y);
            }

            private void link(int x, int y) {
                if (size[x] > size[y]) {
                    parents[y] = parents[x];
                    size[x] += size[y];
                } else {
                    parents[x] = parents[y];
                    size[y] += size[x];
                }
            }

        }

    }
}



Measured memory_bytes: 60736
#include<stdio.h>
int main()
{
    int a[10]= {1,3,5,7,8,10,12};
    int b[10]= {4,6,9,11};
    int c[10]= {2},x,y,i,count=0,count2=0;
    scanf("%d %d",&x,&y);
    if(x,y>=1&&x,y<=12)
    {
        for(i=0; i<7; i++)
        {
            if(a[i]==x|a[i]==y)
            {
                count++;
            }
        }
        for(i=0; i<4; i++)
        {
            if(b[i]==x|b[i]==y)
            {
                count2++;
            }
        }
        if(count==2|count2==2)
        {
            printf("Yes");
        }
        else
        {
            printf("No");
        }
    }
    return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) {
		if ((ct = getcha()) == '-') {
			while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';;
			return -A;
		}
		else {
			A = ct - '0';
			while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';;
			return A;
		}
	}
	else {
		if ((ct = *ci++) == '-') { 
			while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';;
			return -A;
		}
		else {
			A = ct - '0';
			while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';;
			return A;
		}
	}
}

const int mod = 1e9 + 7;
const int IMAX = 100000;
constexpr ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}
class unko {
public:
	int fac[IMAX + 1], ifac[IMAX + 1], inv[IMAX + 1];
	constexpr unko() : fac(), ifac(), inv() {
		fac[0] = 1;
		rep1(i, IMAX) fac[i] = ll(fac[i - 1]) * i % mod;
		ifac[IMAX] = modpow(fac[IMAX], mod - 2);
		for (int i = IMAX; i > 0; i--) ifac[i - 1] = ll(ifac[i]) * i % mod;
		inv[0] = 1;
		rep1(i, IMAX) inv[i] = ll(ifac[i]) * fac[i - 1] % mod;
	}
	int comb(int A, int B) {
		return ll(fac[A]) * ifac[B] % mod * ifac[A - B] % mod;
	}
} f;
void pakuri_sort(int N, int A[]) {
	const int b = 8;
	int tmp[100001];
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint(), K = getint();

	int A[100000];
	rep(i, N) A[i] = getint() + (1 << 30);
	pakuri_sort(N, A);

	ll kotae = 0;
	for (int i = K - 1; i < N; i++) {
		kotae += (ll)f.comb(i, K - 1) * A[i] % mod;
	}
	kotae %= mod;
	for (int i = N - K; i >= 0; i--) {
		kotae -= (ll)f.comb(N - i - 1, K - 1) * A[i] % mod;
	}
	kotae %= mod;

	printf("%lld", (kotae + mod) % mod);

	Would you please return 0;
}

Measured memory_bytes: 1024
package main

import (
        "fmt"
        "sort"
)

func solution(n int, a []int) int {
        sort.Ints(a)
        amax := a[n-1]

        memo := make([]int, amax+1)
        for i := 0; i < n; i++ {
                for j := 1; a[i]*j <= amax; j++ {
                        if j == 1 && memo[a[i]] == 1 {
                                memo[a[i]]++
                                break
                        }
                        memo[a[i]*j]++
                }
        }
        c := 0
        for i := range a {
                if memo[a[i]] == 1 {
                        c++
                }
        }
        return c
}

func main() {
        var n int
        fmt.Scan(&n)
        a := make([]int, n)
        for i := range a {
                fmt.Scan(&a[i])
        }
        fmt.Println(solution(n, a))
}

Measured memory_bytes: 14564
#include <bits/stdc++.h>
using namespace std;
class Flow {
public:
    static constexpr int INF = 1E9;
    int n;
    vector<pair<int, int>> e;
    vector<vector<int>> g;
    vector<int> cur, h;
    bool bfs(int s, int t) {
        h.assign(n, -1);
        queue<int> que;
        h[s] = 0;
        que.push(s);
        while (!que.empty()) {
            int u = que.front();
            que.pop();
            for (int i : g[u]) {
                int v, c;
                tie(v, c) = e[i];
                if (c > 0 && h[v] == -1) {
                    h[v] = h[u] + 1;
                    if (v == t)
                        return true;
                    que.push(v);
                }
            }
        }
        return false;
    }
    int dfs(int u, int t, int f) {
        if (u == t)
            return f;
        int r = f;
        for (int &i = cur[u]; i < g[u].size(); ++i) {
            int j = g[u][i];
            int v, c;
            tie(v, c) = e[j];
            if (c > 0 && h[v] == h[u] + 1) {
                int a = dfs(v, t, min(r, c));
                e[j].second -= a;
                e[j ^ 1].second += a;
                r -= a;
                if (r == 0)
                    return f;
            }
        }
        return f - r;
    }
    Flow(int n) : n(n) {g.resize(n);}
    void addEdge(int u, int v, int c) {
        g[u].push_back(e.size());
        e.emplace_back(v, c);
        g[v].push_back(e.size());
        e.emplace_back(u, 0);
    }
    int maxFlow(int s, int t) {
        int ans = 0;
        while (bfs(s, t)) {
            cur.assign(n, 0);
            ans += dfs(s, t, INF);
        }
        return ans;
    }
};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<vector<int>> e(n - 1);
    Flow f(2 * n);
    int s = 0, t = 2 * n - 1;
    for (int i = 0; i < n - 1; ++i) {
        f.addEdge(s, i + 1, 1);
        f.addEdge(i + n, t, 1);
    }
    for (int i = 0; i < n - 1; ++i) {
        int c;
        cin >> c;
        e[i].resize(c);
        for (int &j : e[i]) {
            cin >> j;
            --j;
            if (j != 0)
                f.addEdge(j, i + n, 1);
        }
    }
    if (f.maxFlow(s, t) != n - 1) {
        cout << -1 << "\n";
        return 0;
    }
    vector<int> match(n);
    for (int i = 1; i < n; ++i) {
        for (int j : f.g[i]) {
            int v, c;
            tie(v, c) = f.e[j];
            if (v >= n && c == 0) {
                match[i] = v - n;
                break;
            }
        }
    }
    vector<int> u(n - 1), v(n - 1, -1);
    vector<vector<int>> g(n);
    for (int i = 1; i < n; ++i) {
        for (int j : e[match[i]])
            if (i != j)
                g[j].push_back(i);
        u[match[i]] = i;
    }
    function<void(int)> dfs = [&](int u) {
        for (int _v : g[u]) {
            if (v[match[_v]] == -1) {
                v[match[_v]] = u;
                dfs(_v);
            }
        }
    };
    dfs(0);
    for (int i = 0; i < n - 1; ++i)
        cout << u[i] + 1 << " " << v[i] + 1 << "\n";
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

struct node{
	int id, val;
};

struct edge{
	int x,y,val;
};

// node の　val の　昇順
int cmp(node a,node b){ return a.val < b.val;}

// edge の　val の　昇順
int cmp2(edge a,edge b){ return a.val < b.val;}

int f[100000];

int find(int x){
	if(f[x]!=x) f[x] = find(f[x]);
	return f[x];
}

// 最小全域木をクラスカル法で求める
// 対象の辺はx座標でソートして隣接する頂点間の辺、
//         y座標でソートして隣接する頂点間の辺だけでよい

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

	int n;
	cin >> n;

	node a[n],b[n];
	edge c[2*n-2];

	rep(i,n){
		int x,y;
		cin >> x >> y;
		a[i].id = i;
		a[i].val = x;
		b[i].id = i;
		b[i].val = y;
	}
	
	sort(a,a+n,cmp);
	sort(b,b+n,cmp);
	rep(i,n) f[i] = i;

	ll ans = 0;
	rep(i,n-1){
		c[i].x = a[i].id;
		c[i].y = a[i+1].id;
		c[i].val = abs(a[i+1].val - a[i].val);
	}
	rep(i,n-1){
		c[i+n-1].x = b[i].id;
		c[i+n-1].y = b[i+1].id;
		c[i+n-1].val = abs(b[i+1].val - b[i].val);
	}

	sort(c,c+2*n-2,cmp2);

	rep(i,2*n-2){
		int x = find(c[i].x);
		int y = find(c[i].y);
		if(x!=y){
			ans += c[i].val;
			f[x] = y;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 4608
#include <iostream>
#include <list>
#include <string>
#include <tuple>
using namespace std;

int main()
{
	char c;
	cin >> c;
	if (c=='a'||c=='i'||c=='u'||c=='e'||c=='o')
	{
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <string.h>
#include <algorithm>
#include <stdio.h>
#include <bitset>
#include <complex>
#include <iomanip>
using namespace std;
using ll = long long;
#define MM 1000000000
#define MOD MM+7
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
ll dp[303][90090];
int N,a[303],sum;
const int mm = 998244353;
ll ans = 1;
int main(){
    cin >> N;
    for (int i = 0; i < N; i++){
        cin >> a[i];
        sum += a[i];
        ans *= 3;
        ans %= mm;
    }
    dp[0][0] = 1;
    for (int i = 0; i < N; i++){
        for (int l = 0; l <= sum; l++){
            dp[i+1][l+a[i]] += dp[i][l];
            dp[i+1][l+a[i]] %= mm;
            dp[i+1][l] += dp[i][l]*2;
            dp[i+1][l] %= mm;
        }
    }
    for (int l = (sum+1)/2; l <= sum; l++){
        ans -= dp[N][l]*3;
        if (ans < 0) ans += mm;
        ans %= mm;
    }
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    for(int i = 0; i < N; i++){
        for(int l = 0; l <= sum; l++){
            dp[i+1][l+a[i]] += dp[i][l];
            dp[i+1][l+a[i]] %= mm;
            dp[i+1][l] += dp[i][l];
            dp[i+1][l] %= mm;
        }
    }
    if ((sum & 1) == 0) ans += dp[N][sum/2]*3;
    cout << ans % mm << endl;
}
  



Measured memory_bytes: 213504
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	a := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&a[i])
	}
	l := make([]int, N+1)
	r := make([]int, N+1)

	for i := 0; i < N; i++ {
		l[i+1] = gcd(l[i], a[i])
	}
	for i := N - 1; i >= 0; i-- {
		r[i] = gcd(r[i+1], a[i])
	}
	w := 0
	for i := 0; i < N; i++ {
		wl := l[i]
		wr := r[i+1]
		w = max(w, gcd(wl, wr))
	}
	fmt.Println(w)
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func max(a, b int) int {
	if b > a {
		return b
	}
	return a
}

Measured memory_bytes: 5504
import math
abx = list(map(int,input().split()))
a = abx[0]
b = abx[1]
x = abx[2]
if x < a*a*b/2:
    c = 2*x/(b*a)
    d = math.atan(b/c)

else :
    c = 2*(a*a*b-x)/(a*a)
    d = math.atan(c/a)
print(math.degrees(d))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,Ain;
    cin >> N;
    int A[N];
    int exist[1000001]={0};
    vector<vector<int>> yakusu(N);
    for(int i=0; i<N; i++){
        cin >> Ain;
        A[i]=Ain;
        exist[Ain]++;
        for(int j=1; j*j<=Ain; j++){
            if(Ain%j==0){
                yakusu.at(i).push_back(j);
                if(j!=Ain/j) yakusu.at(i).push_back(Ain/j);
            }
        }
    }
    int flag=0;
    int ans=0;
    for(int i=0; i<N; i++){
        flag=1;
        for(int j=0; j<yakusu.at(i).size(); j++){
            if(yakusu.at(i).at(j)==A[i]){
                if(exist[A[i]]>1) flag=0;
            }else{
                if(exist[yakusu.at(i).at(j)]>0) flag=0;
            }
        }
        if(flag>0) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 65584
# coding: utf-8

if __name__ == "__main__":
	n, w = map(int, input().split())
	vs, ws = [], []

	for i in range(n):
		w_, v_ = map(int, input().split())
		ws.append(w_)
		vs.append(v_)

	nap_memo = {}
	def nap(i, j):
		key = str(i)+':'+str(j)

		if key in nap_memo:
			return nap_memo[key]

		r = 0
		if i == n:
			r = 0
		elif j < ws[i]:
			r = nap(i+1, j)
		else:
			r = max(nap(i+1, j),
					nap(i+1, j-ws[i]) + vs[i])

		nap_memo[key] = r
		return r

	print(nap(0, w))


Measured memory_bytes: 19012
h,w=map(int,input().split())

s=[]
t=[]
for hh in range(h):
    s.append(list(input()))
    t.append([1]*w)

for hh in range(h):
    for ww in range(w):
        if s[hh][ww]==".":
            t[hh][ww]=0
        else:
            if hh==0:
                if s[hh+1][ww]=="#":
                    t[hh][ww]=0
            elif hh==h-1:
                if s[hh-1][ww]=="#":
                    t[hh][ww]=0
            else:
                if s[hh+1][ww]=="#":
                    t[hh][ww]=0
                if s[hh-1][ww]=="#":
                    t[hh][ww]=0
            if ww==0:
                if s[hh][ww+1]=="#":
                    t[hh][ww]=0
            elif ww==w-1:
                if s[hh][ww-1]=="#":
                    t[hh][ww]=0
            else:
                if s[hh][ww+1]=="#":
                    t[hh][ww]=0
                if s[hh][ww-1]=="#":
                    t[hh][ww]=0
tmax=0
for hh in range(h):
    if max(t[hh])>0:
        tmax=1

if tmax==0:
    print("Yes")
else:
    print("No")
    

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

#define  Infile			freopen("input.txt", "r", stdin)
#define  Outfile		freopen("output.txt", "w", stdout)
#define  lowb(a,x) 		lower_bound(a.begin(),a.end(),x)-a.begin();
#define  upb(a,x) 		upper_bound(a.begin(),a.end(),x)-a.begin();
#define  fu(i,a,b)		for(long long i=(a); i<=(b); ++i)
#define  fd(i,a,b)		for(long long i=(a); i>=(b); --i)
#define  fo(i,n)		for(long long i=0; i<(n); ++i)
#define  show(a) 		cout<<"\n-> "<<#a<<" = "<<(a)<<endl;
#define  fix_set(x)		fixed<<setprecision(x)
#define  ms(a)			memset(a, 0, sizeof(a))
#define  all(x)			(x).begin(), (x).end()
#define  pb(x)			push_back(x)
#define  ar(x, n)		(x),(x)+(n)
#define  mp(a,b)		make_pair(a, b)
#define	 fst			first
#define	 snd			second

typedef long long ll;
typedef vector <ll> vtll;

clock_t TimeBegin, TimeEnd;
ll LX[] = {-1,0,0,1,-1,-1,1,1}; // 8 - 4
ll LY[] = {0,-1,1,0,-1,1,-1,1}; 
ll const INF = LLONG_MAX;


inline ll mod(string num, ll Base);
inline ll diMod(ll A, ll B, ll Base);
inline ll fpow(ll a, ll x, ll Base);
inline string toString(ll n);
inline void Tstart();
inline void Tstop();


//Declare Here
ll n, v[100], c[100];
ll a[100], ans = 0;


//============//

void Solve()
{
	cin >> n;
	fo(i, n)
		cin >> v[i];
	fo(i, n)
		cin >> c[i];
	fo(i, n)
		a[i] = v[i] - c[i];
	sort(ar(a, n), greater<int>());
	
	ll i = 0;
	while(i < n && a[i] >= 0)
	{
		ans += a[i];
		i++;
	}
	cout << ans;
}


//=============================================================================//

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

	#ifdef RAVENCLAW
		Infile;
		//Outfile;
	#endif
		Solve();

	return 0;
}

//=============================================================================//
//=============================================================================//

inline ll mod(string num, ll Base) 
{ 
    ll res = 0; 
    fo(i, num.length()) 
        res = (res*10 + (ll)num[i] - '0') % Base;
    return res; 
} 

inline ll fpow(ll a, ll x, ll Base)
{
	if(x==0)return 1;	
	if(x&1) 
	{
		return a*fpow(a, x-1, Base)%Base;
	} 
	else
	{
		ll t=fpow(a, x/2, Base);
		return t*t%Base;
	}
}

inline ll diMod(ll A, ll B, ll Base)
{
	//(A/B)%Base
	ll result = (A * fpow(B, Base-2, Base)) % Base; 
	return result;
}

inline string toString(ll n) 
{
	stringstream ss; ss << n;
	return ss.str();
}	

inline void Tstart()
{
	TimeBegin = clock();
}

inline void Tstop()
{
	TimeEnd = clock();
	cout << "\nTime elapsed: " << 1000 * (TimeEnd - TimeBegin) / CLOCKS_PER_SEC << " ms\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
i64 mod = 1000000007;
int int_max = 2147483647;
int max_n = 1e5;
using mat2d_t = std::vector<std::vector<int64_t>>;


template<typename IntType>
struct union_find_tree {
    union_find_tree(std::size_t sz) : parent(sz), depth(sz, 1) {
        for (IntType i=0; i<sz; ++i) {
            parent[i] = i;
        }
    }
    IntType find(IntType x) {
        if (parent[x] == x) {
            return x;
        } else {
            return parent[x] = find(parent[x]);
        }
    }
    bool unite(IntType x, IntType y) {
        x = find(x);
        y = find(y);
        if(x == y) return false;

        if (depth[x] < depth[y]) swap(x, y);
        depth[x] += depth[y];
        parent[y] = x;
        return true;
    }
    bool is_same(IntType x, IntType y) {
        return find(x) == find(y);
    }
    IntType size(IntType x) {
        return depth[x];
    }
    void count() {
        for (int i=0; i<parent.size(); ++i) {
            int rt = find(i);
            auto it = counter.find(rt);
            if (it == counter.end()) counter[rt] = 1;
            else ++(it->second);
        }
        counted = true;
    }
    int union_size(IntType x) {
        if (!counted) count();
        return counter[find(x)];
    }

private:
    bool counted{false};
    std::vector<IntType> parent;
    std::vector<int> depth;
    std::unordered_map<int, int> counter;
};

int main(int argc, char **argv) {
    int n, m, k;

    cin >> n >> m >> k;

    union_find_tree<int> uft(n+1);

    unordered_map<int, set<int>> fr, bl;
    for (int i=0; i<m; ++i) {
        int a, b;
        cin >> a >> b;
        auto it = fr.find(a);
        if (it == fr.end()) fr[a] = set<int>();
        fr[a].insert(b);
        it = fr.find(b);
        if (it == fr.end()) fr[b] = set<int>();
        fr[b].insert(a);

        uft.unite(a, b);
    }

    for (int i=0; i<k; ++i) {
        int c, d;
        cin >> c >> d;
        auto it = bl.find(c);
        if (it == bl.end()) bl[c] = set<int>();
        bl[c].insert(d);
        it = bl.find(d);
        if (it == bl.end()) bl[d] = set<int>();
        bl[d].insert(c);
    }

    for (int i=1; i<=n; ++i) {
        int union_size = uft.union_size(i);
        int num_friends = ((fr.find(i) == fr.end()) ? 0 : fr[i].size());
        if (bl.find(i) != bl.end()) {
            for (int j : bl[i]) {
                if (uft.is_same(i,j)) --union_size;
            }
        }
        cout << (union_size - num_friends - 1)<< " ";
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 36900
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll t1,t2;cin>>t1>>t2;
  ll a1,a2,b1,b2;
  cin>>a1>>a2>>b1>>b2;
  ll p = (a1-b1)*t1;
  ll q = (a2-b2)*t2;
  if(p>0){p*=-1;q*=-1;}
  if(p+q < 0)cout<<0<<endl;
  else if(p+q == 0)cout<<"infinity"<<endl;
  else{
    ll s = -p/(p+q);
    ll t = -p%(p+q);
    if(t == 0){
      cout<<s*2<<endl;
    }else cout<<s*2+1<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
def framod(x,y,p=10**9+7):
  for i in range(x+1,y+1):
    x = (x*i)%p
  return x
    
#########################################

n,a,b=map(int,input().split())
p=10**9+7

ans=0
for i in [a,b]:
  upper = framod(n-i+1,n,p)
  lower = framod(1,i,p)
  ret = (upper*pow(lower,p-2,p))%p
  ans = (ans+ret)%p
print((pow(2,n,p)-ans-1)%p)

Measured memory_bytes: 3064
H,W=map(int,input().split())
S=[input() for i in range(H)]

ans=0
tate=[]

for i in range(W):
    c=0
    ad=[]
    while(c<H):
        ad.append(S[c][i])
        c+=1
    tate.append(ad)

left=[]
right=[]
up=[]
down=[]

for i in range(H):
    tmp=S[i]
    cnt=0
    al = [0 for _ in range(W)]
    for j in range(W):
        if tmp[j]==".":
            cnt+=1
            al[j]=cnt
        else:
            cnt=0
    left.append(al)

for i in range(H):
    tmp = S[i]
    tmp=tmp[::-1]
    cnt = 0
    ar = [0 for _ in range(W)]
    for j in range(W):
        if tmp[j] == ".":
            cnt += 1
            ar[j] = cnt
        else:
            cnt = 0
    ar=ar[::-1]
    right.append(ar)

for j in range(W):
    tt=tate[j]
    cnt=0
    bl=[0 for i in range(H)]
    for k in range(H):
        if tt[k]==".":
            cnt+=1
            bl[k]=cnt
        else:
            cnt=0
    up.append(bl)

for j in range(W):
    tt=tate[j]
    tt=tt[::-1]
    cnt=0
    br=[0 for i in range(H)]
    for k in range(H):
        if tt[k]==".":
            cnt+=1
            br[k]=cnt
        else:
            cnt=0
    br=br[::-1]
    down.append(br)

for i in range(H):
    for j in range(W):
        gh=left[i][j]+right[i][j]+up[j][i]+down[j][i]-3
        ans=max(gh,ans)

print(ans)






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

using namespace std;
const int INF = numeric_limits<int>::max() / 2;

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

  int n,ma,mb;cin>>n>>ma>>mb;
  int a[n+1],b[n+1],c[n+1];
  for(int i=1;i<=n;i++) cin>>a[i]>>b[i]>>c[i];
  int dp[n+1][401][401];
  for(int i=0;i<401;i++)for(int j=0;j<401;j++) dp[0][i][j]=INF;
  dp[0][0][0]=0;
  for(int i=1;i<=n;i++)for(int j=0;j<=400;j++)for(int k=0;k<=400;k++){
      if(j-a[i]>=0 && k-b[i]>=0)dp[i][j][k]=min(dp[i-1][j][k],dp[i-1][j-a[i]][k-b[i]]+c[i]);
      else dp[i][j][k]=dp[i-1][j][k];
  }
  int res=INF;
  for(int i=1;i<401;i++)for(int j=1;j<401;j++){
      if(i*mb==j*ma) res=min(res,dp[n][i][j]);
  }
  if(res>5000)cout<<-1<<endl;
  else cout<<res<<endl;
}


Measured memory_bytes: 25984
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int> >;
using vii = vector<pair<int, int> >;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

int main() {
	int n; cin >> n;
	vi a(n), b(n), c(n - 1);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	rep(i, n - 1) cin >> c[i];

	int ans = 0;
	rep(i, n) {
		ans += b[a[i] - 1];
		if (i != 0 && a[i - 1] + 1 == a[i]) {
			ans += c[a[i - 1] - 1];
		}
	}
	cout << ans << endl;
}

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

int main(){
	int K; cin>>K;
	int r = 0;
	for(int i=1; i<=K; ++i){
		r = (r*10 + 7) % K;
		if(r == 0){
			cout<< i <<endl;
			return 0;
		}
	}
	puts("-1");
}


Measured memory_bytes: 3600
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <cmath>

#define mst(a,b)memset(a, b, sizeof(a))
#define repi(a,b)for(int i = a; i < b; i++)
#define repj(a,b)for(int j = a; j < b; j++)
#define pii pair<int,int>

#ifdef LOCAL
#define fre()freopen("in.txt","r",stdin)
#endif
#ifndef LOCAL
#define fre()
#endif

//static int x = []() {
//	std::ios::sync_with_stdio(false);
//	std::cin.tie(NULL);
//	return 0;
//}();

#define FASTIO
#ifdef FASTIO
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
//#define scanf abcabc
//#define printf abcabc
#endif
//#ifndef FASTIO
//#define cin abcabc
//#define cout abcabc
//#endif

typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;

using namespace std;


ll gcd(ll a, ll b) {
	if (!a)return b;
	return gcd(b % a, a);
}
int main() {
	ll a, b, c, d; cin >> a >> b >> c >> d;
	a--;
	ll tmp = c * d / gcd(c, d);
	ll c1 = a / c, c2 = a / d, c3 = a / tmp, ca = c1 + c2 - c3;
	c1 = b / c, c2 = b / d, c3 = b / tmp;
	ll cb = c1 + c2 - c3;
	ll ans = (b - a) - (cb - ca);
	cout << ans << endl;
	return 0;
}

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

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

#define MOD 1000000007

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

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

int main(void) {
    map<char, ll> winScore;
    vector<vector<char>> group;
    ll N, K;
    string T;
    ll count = 0;
    cin >> N >> K;
    cin >> winScore['s'] >> winScore['p'] >> winScore['r'];
    cin >> T;
    group.resize(K);
    rep(i, T.size()) group[i % K].push_back(T[i]);
    rep(i, K) {
        bool lose = true;
        char previous = ' ';
        iter(j, group[i]) {
            if(j == previous) {
                if(lose) count += winScore[j];
                lose = !lose;
            } else {
                lose = false;
                count += winScore[j];
            }
            previous = j;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 5120
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << "No\n"; return;}

const int N = 2e5 + 7;

int p[N], cnt[N], deg[N] = {1};

void solve() {
    loop1(i, N - 1)
        deg[i] = deg[i - 1] * 10 % 2019;
    string s;
    cin >> s;
    for (int i = s.size() - 1; i >= 0; --i) {
        p[i] = (p[i + 1] + (s[i] - '0') * deg[s.size() - i - 1]) % 2019;
        ++cnt[p[i]];
    }
    int ans = cnt[0] * (cnt[0] - 1) / 2 + cnt[0];
    loop1(i, 2019)
        ans += cnt[i] * (cnt[i] - 1) / 2;
    cout << ans;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}


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

using namespace std;

typedef long long ll;

const int N = 3e5+5;

const int mod = 1e9+7;

int n;
int k;
int h[N];

int main(){
    scanf("%d%d " , &n , &k);
    for(int i = 1; i <= n; i++){
        scanf("%d" , &h[i]);
    }
    int mn = 1e9;
    sort(h + 1 , h + n + 1);
    for(int i = 1; i <= n; i++){
        if(i + k - 1 <= n){
            mn = min(mn , h[i + k - 1] - h[i]);
        }
    }
    printf("%d\n" , mn);
}


Measured memory_bytes: 4224
#include <stdio.h>

int main(void){
	int i,j;
	int h,w;
	scanf("%d %d",&h,&w);

	while(h!=0 && w != 0){
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				if(i==0 || i==h-1 || j==0 || j== w-1){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
		scanf("%d %d",&h,&w);
		printf("\n");
	}
	return 0;
}

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

int main()
{
  int n, i, j, ans = 0;
  cin >> n;
  for (i = 1; i <= n; i+=2) {
    int c = 0;
    for (j = 1; j <= i; j++) {
      if (i % j == 0)
        c++;
    }
    if (c == 8)
      ans++;
  }
  cout << ans << endl;
}


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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;

ll mod = 1e9 + 7;



int main() {
    int n;
    scanf("%d", &n);
    vector<int> data(n);
    int sum = 0;
    rp(i, 0, n) {
        scanf("%d", &data.at(i));
        sum += data.at(i);
    }
    int m = *max_element(data.begin(), data.end());
    if (m < sum - m) {
        printf("Yes");
    } else {
        printf("No");
    }
    return 0;
    
} 

Measured memory_bytes: 256
mn = input().split()
ob = input().split()

n = int(mn[0])
m = int(mn[1])

votes = 0

for i in range(n):
    ob[i] = int(ob[i])
    votes += ob[i]

ob.sort(reverse = True)

line = votes/4/m

ans = 0

for i in range(m):
    if ob[i] < line:
        ans += 1

if ans == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9188
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#include<bitset>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	string s;
	scan(s);
	int ans=0;
	rep(i,3){
		if(s[i]=='7') ans=1;
	}
	if(ans) prin("Yes");
	else prin("No");
	return 0;
}


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

using namespace std;

typedef long long ll;

#define faster ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define read freopen("in.txt", "r", stdin)
#define write freopen("out.txt", "w", stdout)
#define mem(x, n) memset(x, n, sizeof(x))
#define all(x) x.begin(), x.end()
#define endl "\n"

int main() {
	faster;

	
		float d, t, s;
		cin >> d >> t >> s;

		if(d/s <= t){
			cout << "Yes" << endl;
		}else {
			cout << "No" << endl;
		}
	return 0;
}

Measured memory_bytes: 3736
#include "bits/stdc++.h"
using namespace std;

#define rep(i, n) for (int i = 0; i < (int) (n); i++)
typedef long long ll;


int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int    n;
    double sum = 0.0;
    cin >> n;
    vector <int> seq(n);
    rep(i, n) {
        cin >> seq.at(i);
        sum += (double) (1.0 / seq.at(i));
        // cout << sum << endl;
    }

    cout << 1 / sum << endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) (v).begin(), (v).end()
#define fr(i, a, b) for (int i = (a); i <= (b); ++i)
// int dp[100005][4];
void solve();
int inf = 1e18+9;
signed main () {
    clock_t beg = clock();
    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    #endif 
    int t=1; 
    int tt = t;
    while (t--) {

        int n;
        cin>>n;
        int maxi;
        cin>> maxi;
        int weight[n+1],value[n+1];
        int maxvalue = 0;
        rep(i,1,n+1){
            cin>>weight[i]>>value[i];
            maxvalue+=value[i];
        }
        // cout<<maxvalue<<endl;
        int dp[n+1][maxvalue+1];
        // memset(dp,0,sizeof(dp));
        for(int i=0;i<=n;i++){
            for(int j=0;j<=maxvalue;j++){
                dp[i][j]= inf;
            }
        }
        dp[0][0]=0;
        for(int i=1;i<=n;i++){
            for(int j=0;j<=maxvalue;j++){
            //MAximum weight that we can carry for any value
            if(j>=value[i]){
                dp[i][j]=min( dp[i-1][j], dp[i-1][j-value[i]]+weight[i]);
            }
            dp[i][j]= min(dp[i][j],dp[i-1][j]);
            }
        }

        // cout<<endl;
        int ans= 0;
        for(int j=1;j<=maxvalue;j++){
            // cout<<j<<" "<<dp[n][j]<<endl; 
            if(dp[n][j]<=maxi){
                ans = max(ans,j);
            }
        }
        
        cout<<ans<<endl;

    }
    return 0;
}


Measured memory_bytes: 82456
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define gcd __gcd
#define all(x) (x).begin(), (x).end()
const int INF = 1e18, MOD = 1e9 + 7;
template<class T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<class T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
signed main() {
    INCANT;
    int n;
    int a[11], b[11], c[11];
    bool flag1 = true, flag2 = true;
    cin>>n;
    rep(i, n){
        cin>>a[i];
        if(a[i]) flag1 = false;
        else flag2 = false;
    }
    if(flag1 || flag2){
        cout<<0<<endl;
        return 0;
    }
    rep(i, 11){
        b[i] = c[i] = INF;
    }
    rep(i, n){
        if(a[i]) cin>>c[i];
        else cin>>b[i];
    }
    sort(b, b + n);
    sort(c, c + n);
    cout<<b[0] + c[0]<<endl;
}



Measured memory_bytes: 3224
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <tuple>
#include <cmath>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> d(N);
    for (int i = 0; i < N; i++) cin >> d[i];
    sort(d.begin(), d.end());
    int cnt = 1;
    for (int i = 1; i < N; i++) {
        if (d[i-1] < d[i]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 384
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		
		while(true){
			final int N = sc.nextInt();
			
			if(N == 0){
				break;
			}
			
			boolean[][] is_visited = new boolean[N][N];
			boolean[][] tmp = new boolean[N][N];
			
			int[][] x_pos = new int[N][N];
			int[][] y_pos = new int[N][N];
			
			for(int i = 0; i < N; i++){
				for(int j = 0; j < N; j++){
					x_pos[i][j] = sc.nextInt();
					y_pos[i][j] = sc.nextInt();
				}
			}
			
			int count = 0;
			for(int i = 0; i < N; i++){
				for(int j = 0; j < N; j++){
					if(is_visited[i][j]){
						continue;
					}
					
					int x_p = j;
					int y_p = i;
					
					while(!is_visited[y_p][x_p] && !tmp[y_p][x_p]){
						tmp[y_p][x_p] = true;
						int x_o = x_p, y_o = y_p;
						
						x_p = x_pos[y_o][x_o];
						y_p = y_pos[y_o][x_o];
					}
					
					if (!is_visited[y_p][x_p]) {
						count++;
					}
					
					for (int k = 0; k < N; k++) {
						for (int l = 0; l < N; l++) {
							if (tmp[k][l]) {
								is_visited[k][l] = true;
								tmp[k][l] = false;
							}
						}
					}

				}
			}
			
			System.out.println(count);
			
		}
	}

}

Measured memory_bytes: 13000