akhauriyash/Code-Regression huggingface dataset:
INF = 1<<29
def dijkstra(n, from, route, time)
  arr = [from]
  dist = [INF]*n
  dist[from] = 0
  until arr.empty?
    a = arr.min{ |x, y| dist[x] <=> dist[y] }
    arr.delete(a)
    route[a].each do |b|
      d = dist[a] + time[a][b]
      if (old = dist[b]) > d
        dist[b] = d
        if old == INF
          arr << b 
        end
      end
    end
  end
  dist
end
 
loop do
  n, m = gets.split.map(&:to_i)
  break if n == 0
  route_l = n.times.map{ [] }
  time_l = n.times.map{ [] }
  route_s = n.times.map{ [] }
  time_s = n.times.map{ [] }
  m.times do
    tmp = gets.split
    x, y, t = tmp[0,3].map(&:to_i)
    x -= 1; y -= 1
    if tmp[-1] == "L"
      route_l[x] << y; route_l[y] << x
      time_l[x][y] = time_l[y][x] = t
    else
      route_s[x] << y; route_s[y] << x
      time_s[x][y] = time_s[y][x] = t
    end
  end
  l_time = n.times.map{ |i| dijkstra(n, i, route_l, time_l) }
  s_time = n.times.map{ |i| dijkstra(n, i, route_s, time_s) }.map{|a| a.map.with_index{|x, i| [x, i] }.sort}
  gets  
  dest = gets.split.map(&:to_i).map{ |i| i-1 }
  bpos = [INF]*n
  bpos[dest[0]] = 0
  dest.each_cons(2) do |s, t|
    new_bpos = [INF]*n
    n.times do |nxt|
      min_t = bpos[nxt] + l_time[s][t]
      s_time[nxt].each do |x, pre|
        break if x + l_time[nxt][t] >= min_t
        time = bpos[pre] + l_time[s][pre] + x + l_time[nxt][t]
        min_t = time if time < min_t
      end
      new_bpos[nxt] = min_t
    end
    bpos = new_bpos
  end
  p bpos.min
end

Measured memory_bytes: 16508
a,b,c,d,e,f=map(int,input().split())
max=0
ans=[0,0]

wlist=[]
for ia in range((f//100*a)+1):
  for ib in range(((f-ia)//100*b)+1):
    if 100*a*ia+100*b*ib<=f and 100*a*ia+100*b*ib not in wlist:
      wlist.append(100*a*ia+100*b*ib)
wlist.sort()
wlist.remove(0)

if c==1 or d==1:
  slist=[j for j in range(f+1)]
else:
  slist=set()
  for ic in range((f//c)+1):
    for id in range(((f-ic)//d)+1):
      if c*ic+d*id<=f:
        slist.add(c*ic+d*id)
  slist=list(slist)
slist.sort()

for w in wlist:
  for s in slist:
    if w+s>f or e/100<s/w:
      break
    if max<=100*s/(w+s):
      max=100*s/(w+s)
      ans=[w+s,s]
print(ans[0],ans[1])

Measured memory_bytes: 3188
#include <stdlib.h>
#include <stdio.h>

typedef struct node {
  int k;
  struct node *p;
  struct node *l;
  struct node *r;
} node;

static node *build_node(int k) {
  node *n;
  n = (node *) malloc(sizeof(node));
  n->p = n->l = n->r = NULL;
  n->k = k;
  return n;
}

static void insert_node(node *r, node *n) {
  if (n->k <= r->k) {
    if (r->l == NULL) {
      r->l = n;
      n->p = r;
    } else {
      insert_node(r->l, n);
    }
  } else {
    if (r->r == NULL) {
      r->r = n;
      n->p = r;
    } else {
      insert_node(r->r, n);
    }
  }
}

static void print_inorder(node *n) {
  if (n->l != NULL) print_inorder(n->l);
  printf(" %d", n->k);
  if (n->r != NULL) print_inorder(n->r);
}

static void print_preorder(node *n) {
  printf(" %d", n->k);
  if (n->l != NULL) print_preorder(n->l);
  if (n->r != NULL) print_preorder(n->r);
}

static void free_node(node *n) {
  if (n == NULL) return;
  free_node(n->l);
  free_node(n->r);
  free(n);
}

int main(int argc, char **argv) {
  int m, i, k;
  char cmd[8];
  node *r = NULL;
  node *n;

  scanf("%d", &m);
  for (i = 0; i < m; ++i) {
    scanf("%s", cmd);
    if (cmd[0] == 'i') {
      scanf("%d", &k);
      n = build_node(k);
      if (r == NULL) {
        r = n;
      } else {
        insert_node(r, n);
      }
    } else {
      print_inorder(r); printf("\n");
      print_preorder(r); printf("\n");
    }
  }
  free_node(r);
  exit(0);
}


Measured memory_bytes: 25152
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_B&lang=jp
#?????\???
#??????????????¨????§?????????¨?????¨?????????????????????????????????????????????????????????
def rrs(quantum, process):
    finished_process = []
    queue = Queue()
    current_time = 0
    i = 0
    
    while not len(finished_process) == len(process):
        
        if i < len(process):
            p_info = process[i]
            i += 1
        else:
            p_info = queue.dequeue()
        time = int(p_info[1])
        name = p_info[0]
        
        if time <= quantum:
            current_time += time
            finished_process.append((name, current_time))
        else:
            current_time += quantum
            queue.enqueue((name, time - quantum))
            
    return finished_process


class Queue:
    def __init__(self):
        self.data = []

    def enqueue(self, d):
        self.data.append(d)

    def dequeue(self):
        r = self.data[0]
        self.data = self.data[1:]
        return r
    
def main():
    info = input().split()
    n_list = int(info[0])
    quantum = int(info[1])
    target_list = [tuple(input().split()) for i in range(n_list)]
    print("\n".join([p + " " + str(t) for p,t in rrs(quantum, target_list)]))
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 22784
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <functional>
#include <bitset>
#include <queue>

#include <boost/range/irange.hpp>
using boost::irange;

#include <boost/utility/string_ref.hpp>
using string_view = boost::string_ref;

#include <boost/function_output_iterator.hpp>

using namespace std;

struct shop_t {
    int64_t price;
    int64_t stock;
};

int main()
{
    int N,M;
    cin >> N >> M;
    vector<shop_t> shops(N);
    for(auto& s : shops) cin >> s.price >> s.stock;
    sort(begin(shops), end(shops), [](auto& a, auto& b){ return a.price < b.price; });
    
    int64_t total = 0;
    int64_t remain = M;
    for(const auto s : shops)
    {
        auto buy = min(remain, s.stock);
        total += buy * s.price;
        if((remain -= buy) <= 0)
            break;
    }
    cout << total << '\n';
    
    return 0;
}


Measured memory_bytes: 1792
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N, M, K = map(int, input().split())
uf = UnionFind(N)
not_friend_candidates = [1]*N
for _ in range(M):
    A, B = map(int, input().split())
    uf.union(A-1, B-1)
    not_friend_candidates[A-1] += 1
    not_friend_candidates[B-1] += 1
for _ in range(K):
    C, D = map(int, input().split())
    if uf.same(C-1, D-1):
        not_friend_candidates[C-1] += 1
        not_friend_candidates[D-1] += 1
for hito in range(N):
    print(uf.size(hito) - not_friend_candidates[hito], end=" ")
print()

Measured memory_bytes: 9844
# class Map(dict):
#     def __missing__(self, key):
#         # この割当てなしのほうが速い。
#         # self[key] = 0
#         return 0


def main():
    int(input())

    d = {}
    ans = 0
    for i, height in enumerate(input().split()):
        height = int(height)
        # 引き算のほうの i は足し算のよりも大きい。
        # 従って，このように順番に見ていく必要がある。
        d.setdefault(i + height, 0)
        d[i + height] += 1
        ans += d.setdefault(i - height, 0)

    return ans


if __name__ == '__main__':
    print(main())

# 大いに参考にした。
# https://kmjp.hatenablog.jp/entry/2020/05/03/1030


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

void Main()
{
    int n;
    cin >> n;
    vector<int> ans(n+1);
    for (int x = 1; x <= 100; x++)
        for (int y = 1; y <= 100; y++)
            for (int z = 1; z <= 100; z++)
            {
                int rt = x*x + y*y + z*z + x*y + y*z + z*x;
                if(rt <= n) ans[rt]++;
            }
    for (int i = 1; i <= n; i++)
    {
        cout << ans[i] << endl;
    }
   
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define NMAX (int)(2e5+4)
#define all(x) x.begin(),x.end()
#define rep(i, l, r) for(int i = l; i < r; ++i)
#define rev(i, r, l) for(int i = r - 1; i >= l; --i)
#define ft first
#define sd second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;

int a,b,c;

int main(){
    cin>>a>>b>>c;
    swap(a, b);
    swap(a, c);
    cout<<a<<' '<<b<<' '<<c;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
// using namespace __gnu_pbds;
// template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define ll long long int
#define ull unsigned long long int
 
#define lp(i,n) 	    for(int i=0;i<(int)(n);i++)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);i++)
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);i--)
 
#define all(v)  	 ((v).begin()), ((v).end())
#define sz(v)    	 ((int)((v).size()))
#define clr(v, d)    memset(v, d, sizeof(v))
#define PB           push_back
#define MP           make_pair
#define N 100005
 
#define PI 3.14159265359
 
 
ll nChooseR(int n,int k);
ll gcd(ll a, ll b);
vector<string> split(string target,unsigned char c );


ll n,k,t,m,x,y,a[N*2];

bool isPrime(ll h);
string s;

 

ll ans;

ll mod=1e9 +7;




int main() {
// freopen("pyramid.in","r",stdin); 
  //freopen("output.txt","w",stdout); 
cout.precision(10);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

cin>>n;
ans=1;
while(n>>=1)(ans<<=1)+=1;

cout<<ans;
}
 
	
ll nChooseR( int n, int k )
{
    if (k > n) return 0;
    if (k * 2 > n) k = n-k;
    if (k == 0) return 1;
   	ll result = n;
    for( int i = 2; i <= k; ++i ) {
        result *= (n-i+1);
        result /= i;
    }
    return result;
}
 
ll gcd(ll a, ll b){
	return b==0?a:gcd(b,a%b);
	}
 
 
vector<string> split(string target,unsigned char c ){
	string d="";
	vector<string>arr;
	for(auto n:target)
	{
		if(n!=c)
		d+=n;
		else if(d!="")
		arr.push_back(d),d="";
	}
	if (d!="")
	arr.push_back(d),d="";
	return arr;
}
// bool isPrime(ll h){
//      for(ll i=0;primes[i]*primes[i]<= h;i++)
//      if (h%primes[i]==0)
//      	return 0;
//      return h!=1;
//  }
 bool isPrime(ll g){
   if((g%2==0 && g>2) || g==1)return 0;
   for(ll i=3;i*i<=g;i+=2)if(g%i==0)return 0;
   return 1;   
 
 }

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>

#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
using ll = long long;
using namespace std;

ll calculate_expression_without_brackets(const string&exprwb)
{
	auto my_stoll = [](const string&str) {
		if (str[0] != '-') {
			return stoll(str);
		} else {
			for (ll i = 0;; ++i) {
				if (str[i] != '-') {
					return stoll(str.substr(i - i % 2));
				}
			}
		}
	};
	vector<ll>arg;
	vector<char>opr;
	ll head = 0;
	REP1(i, exprwb.size() - 2) {
		if (exprwb[i] == '+' || exprwb[i] == '-' && i != 0 && [](char c) {return '0' <= c && c <= '9'; }(exprwb[i - 1]) || exprwb[i] == '*' || exprwb[i] == '/') {
			arg.push_back(my_stoll(exprwb.substr(head, i - head)));
			opr.push_back(exprwb[i]);
			head = i + 1;
		}
	}
	arg.push_back(my_stoll(exprwb.substr(head)));
	if (arg.size() == 1) {
		return arg[0];
	} else {
		for (ll i = 0; i < opr.size(); ++i) {
			if (opr[i] == '*') {
				arg[i] *= arg[i + 1];
				arg.erase(arg.begin() + i + 1);
				opr.erase(opr.begin() + i);
				--i;
			} else if (opr[i] == '/') {
				arg[i] /= arg[i + 1];
				arg.erase(arg.begin() + i + 1);
				opr.erase(opr.begin() + i);
				--i;
			}
		}
		if (arg.size() == 1) {
			return arg[0];
		} else {
			for (ll i = 0; i < opr.size(); ++i) {
				if (opr[i] == '+') {
					arg[i] += arg[i + 1];
					arg.erase(arg.begin() + i + 1);
					opr.erase(opr.begin() + i);
					--i;
				} else if (opr[i] == '-') {
					arg[i] -= arg[i + 1];
					arg.erase(arg.begin() + i + 1);
					opr.erase(opr.begin() + i);
					--i;
				}
			}
			return arg[0];
		}
	}
}
string calculate_expression(const string&expr) {
	ll open = expr.find('(');
	if (open != string::npos) {
		ll close = [expr, open]() {
			ll cnt = 0;
			for (ll i = open + 1;; ++i) {
				if (expr[i] == '(') {
					++cnt;
				} else if (expr[i] == ')') {
					if (cnt == 0) {
						return i;
					}
					--cnt;
				}
			}
		}();
		return calculate_expression(expr.substr(0, open) + calculate_expression(expr.substr(open + 1, close - open - 1)) + expr.substr(close + 1));
	} else {
		return to_string(calculate_expression_without_brackets(expr));
	}
}
signed main()
{
	ll n;
	cin >> n;
	for (ll i = 0; i < n; ++i) {
		string expr;
		cin >> expr;
		expr.pop_back();
		cout << calculate_expression(expr) << endl;
	}
	return 0;
}


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

#define fr(i,n) for(int i = 0; i<n; i++)
#define sz(v) (int)(v.size())
#define prin(a) cout << #a << " = " << a << endl
#define prinv(v) cout << #v << " = "; for(auto it : v) cout << it << ", "; cout << endl
#define all(v) (v).begin(),(v).end()

typedef long long ll;

#define rmin(a,b) a = min(a,b)
#define rmax(a,b) a = max(a,b)

#define fi first
#define se second

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	string s; cin >> s;
	
	int i = 0;
	int ans = 0;
	
	while(i<sz(s)){
		while(i<sz(s) and s[i]=='S') i++;
		int cur = 0;
		while(i<sz(s) and s[i]=='R') i++, cur++;
		rmax(ans,cur);
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <cmath>
#include <functional>
#include <string>
using namespace std;

#define int long long
#define rep(n, i) for (int i = 0; i < n; i++)
#define rep2(n, m, i) for (int i = m; i < n; i++)
#define rep_r(n, i) for (int i = n - 1; i >= 0; i--)

bool judge(int a, int b, string s) {
    if (s[a] != '-') return false;
    rep(a + b + 1, i) {
        if (i == a) continue;
        if (s[i] < '0' || s[i] > '9') return false;
    }
    return true;
}

signed main() {
    int a, b;
    string s;
    cin >> a >> b >> s;
    if (judge(a, b, s)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n;
    cin >> n;
    vector<int> arr(n, 0);
    for(int& val: arr)
        cin >> val;
    sort(arr.begin(), arr.end());
    ll mod = 1e9 + 7;
    if (n % 2 == 0) {
        for(int i = 0; i < n; i++) {
            if ((i/2)*2+1 != arr[i]) {
                cout << 0 << endl;
                return 0;
            }
        }
    } else {
        for(int i = 0; i < n; i++) {
            if (((i+1)/2)*2 != arr[i]) {
                cout << 0 << endl;
                return 0;
            }
        }
    }
    ll ans = 1LL;
    for(int i = 0; i < n/2; i++)
        ans = (ans << 1) % mod;
    cout << ans << endl;
    return 0;
}




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

using namespace std;

int n;
int x[10],y[10];

double dist(int i,int j){
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx * dx + dy * dy,0.5);
}

void solve(){
    cin>>n;
    for(int i=1;i<=n;i++) cin >> x[i] >> y[i];
    double sum = 0.0;
    vector<int> v(n);
    for(int i=0;i<n;i++) v[i] = i+1;
    do{
        for(int i=0;i<n-1;i++) sum+=dist(v[i],v[i+1]);
    }while(next_permutation(v.begin(),v.end()));
    int Factorial = 1;
    for(int i=2;i<=n;i++) Factorial *= i;
    cout << fixed << setprecision(10) << sum /Factorial << endl;
    return;
}

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


Measured memory_bytes: 256
def main():
    a, b, c, d = map(int, input().split())

    if a <= c:
        if b <= c:
            ans = 0
        elif b <= d:
            ans = b - c
        else:
            ans = d - c
    else:
        if d <= a:
            ans = 0
        elif d <= b:
            ans = d - a
        else:
            ans = b - a


    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include<stdio.h>
#include<math.h>
int x[10000000];
int main(){
  int n,i,j,count=0,f=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&x[i]);
    }
  
  
  for(i=0;i<n;i++){
    if(x[i]==1) continue;
    if(x[i]==2){
      count++;
      continue;
    }
    if(x[i]%2==0) continue;
    
    else {
      for(j=2;j<=sqrt(x[i]);j++){
	if((x[i]%j)==0) {
	  f=1;
	  break;
	}
      }
      if(f==0) {
	count++;
      }
      f=0;
      // printf("count: %d\n",count);
    }   
  }
  
  printf("%d\n",count);
  
  return 0;
}

Measured memory_bytes: 628
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i=0;i<n;++i){
    cin >> a[i];
  }

  vector<bool> list(8);
  int free=0;
  for (int i=0;i<n;++i){
    int lank = a[i]/400;
    if (lank < 8)
      list[lank]=true;
    else
      free++;
  }

  int ranks=0;
  for (int i=0;i<list.size();++i){
    if (list[i])
      ranks++;
  }
  
  int minColors=max(ranks,1);
  int maxColors=ranks+free;
  
  cout << minColors << " " << maxColors << endl;
  
  return 0;
}


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

int main() {
    int arr[100], n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }

    for (int i = (n - 1); i >= 0; i--) {
        cout << arr[i];
        if (i != 0) {
            cout << " ";
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 3020
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <complex>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

const double EPS = 1e-8;
const double INF = 1e12;
// http://www.prefield.com/algorithm/geometry/geometry.html
typedef complex<ll> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

typedef vector<P> G;

struct C {
  P p; double r;
  C(const P &p, double r) : p(p), r(r) { }
};

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

typedef P point;



vector<point> convex_hull(vector<point> ps) {
  int n = ps.size(), k = 0;
  sort(ps.begin(), ps.end());
  vector<point> ch(2*n);
  for (int i = 0; i < n; ch[k++] = ps[i++]) // lower-hull
    while (k >= 2 && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;
  for (int i = n-2, t = k+1; i >= 0; ch[k++] = ps[i--]) // upper-hull
    while (k >= t && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;
  ch.resize(k-1);
  return ch;
}

int main(void) {
  double pi = acos(-1.0);
  int n;
  scanf("%d", &n);
  vector<ll> x(n), y(n);
  vector<P> pt(n);
  map<P, int> tbl;
  REP(i, 0, n) {
    scanf("%lld%lld", &x[i], &y[i]);
    pt[i] = P(x[i], y[i]);
    tbl[pt[i]] = i;
  }
  if (n == 2) {
    printf("0.5\n0.5\n");
    return 0;
  }
  vector<P> ch = convex_hull(pt);
  int m = ch.size();
  vector<double> div(m);
  REP(i, 0, m) {
    P d = (ch[(i + 1) % m] - ch[i]);
    double del = arg(complex<double>(d.real(), d.imag()));
    div[i] = del;
  }
  vector<double> ans(n);
  REP(i, 0, m) {
    int idx = tbl[ch[i]];
    double diff = div[i] - div[(i + m - 1) % m];
    if (diff < 0) {
      diff += 2 * pi;
    }
    ans[idx] = diff / (2 * pi);
  }
  REP(i, 0, n) {
    printf("%.15f\n", ans[i]);
  }
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);


int main(){
    IOS;
   ld d,t,s;cin>>d>>t>>s;
   ld tt=d/s;
   if(tt<=t)cout<<"Yes";
   else cout<<"No";
    return 0;  
} 





Measured memory_bytes: 3740
n = int(input())
a = list(map(int, input().split()))

dp = [[0 for _ in range(n)] for _ in range(n)]

m = n % 2

if m == 0:
    for i in range(n):
        dp[i][i] = -a[i]
else:
    for i in range(n):
        dp[i][i] = a[i]

for i in range(1, n):
    for x in range(n-i):
        y = x + i
        if i % 2 == m:
            dp[x][y] = min(dp[x+1][y] - a[x], dp[x][y-1] - a[y])
        else:
            dp[x][y] = max(dp[x + 1][y] + a[x], dp[x][y - 1] + a[y])

print(dp[0][n-1])

Measured memory_bytes: 120028
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>


int main() {
	int n, k; std::cin >> n >> k;
	std::vector<int> initial(n), point; point.reserve(n - k); for (auto& i : initial) std::cin >> i;
	std::vector<std::vector<int>> next(n); next.back() = std::vector<int>(10, -1); next.back()[initial.back()] = n - 1;
	for (int i = n - 2; i >= 0; --i) {
		next[i] = next[i + 1];
		next[i][initial[i]] = i;
	}
	const auto limit = n - k;
	for (auto i = 0; i < n && point.size() < limit; ++i) {
		int max = 9;
		while (next[i][max] == -1 || next[i][max] - i > k) --max;
		k -= next[i][max] - i;
		i = next[i][max];
		point.push_back(initial[i]);
	}
	for (const auto p : point) std::cout << p;
	std::cout << '\n';
}


Measured memory_bytes: 18104
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    r = inp()
    print(r*2*math.pi)
    
if __name__ == "__main__":
    main()

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

struct Event {
    int time,dist,type;
    Event(int time,int dist,int type) : time(time), dist(dist), type(type){}
    bool operator<(const Event &e) const {
        return time < e.time;
    }
};

int N,Q,s,t,x,d;

int main() {
    scanf("%d%d",&N,&Q);
    vector<Event> events;
    REP(i,N){
        scanf("%d%d%d",&s,&t,&x);
        events.emplace_back(s-x,x,1);
        events.emplace_back(t-x,x,0);
    }
    sort(events.rbegin(),events.rend());
    multiset<int> stop;

    REP(i,Q){
        scanf("%d",&d);

        while(events.size() && events.back().time <= d){
            if(events.back().type) stop.insert(events.back().dist);
            else stop.erase(stop.find(events.back().dist));
            events.pop_back();
        }
        cout << (stop.size() ? *stop.begin() : -1) << '\n';
    }
    return 0;
}

Measured memory_bytes: 15340
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		int count = 0;
		long ans = 0;
		long M = 0; long m = 0;
		long[] a = new long[s.length];
		a[0] = 1;

		for(int i = 1; i < s.length; i++) {
			if(s[i] == s[i-1]) {
				a[count]++;
			}else{
				count++;
				a[count]++;
			}
		}

		if(s[0] == '>') {
			if(s[s.length-1] == '<') {
				ans += (a[0]+1)*a[0]/2;
				for (int i = 0; i < (count-1)/2; i++) {
					M = Math.max(a[2*i+1], a[2*i+2]);
					m = Math.min(a[2*i+1], a[2*i+2]);
					ans += (m-1)*m/2;
					ans += (M+1)*M/2;
				}
				ans += a[count]*(a[count]+1)/2;
			}else {
				ans += (a[0]+1)*a[0]/2;
				for (int i = 0; i < count/2; i++) {
					M = Math.max(a[2*i+1], a[2*i+2]);
					m = Math.min(a[2*i+1], a[2*i+2]);
					ans += (m-1)*m/2;
					ans += (M+1)*M/2;
				}
			}
		}else {
			if(s[s.length-1] == '<') {
				for (int i = 0; i < count/2; i++) {
					M = Math.max(a[2*i], a[2*i+1]);
					m = Math.min(a[2*i], a[2*i+1]);
					ans += (m-1)*m/2;
					ans += (M+1)*M/2;
				}
				ans += a[count]*(a[count]+1)/2;
			}else {
				for (int i = 0; i < (count+1)/2; i++) {
					M = Math.max(a[2*i], a[2*i+1]);
					m = Math.min(a[2*i], a[2*i+1]);
					ans += (m-1)*m/2;
					ans += (M+1)*M/2;
				}
			}
		}

		System.out.println(ans);
		sc.close();
	}
}

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

int main()
{
    string s;
    cin >> s;
    int lm = 0, l = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (s.at(i) == 'A' || s.at(i) == 'T' || s.at(i) == 'G' || s.at(i) == 'C')
            l++;
        else
        {
            lm = max(lm, l);
            l = 0;
        }
    }
    cout << max(lm, l) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const ll INF=1LL<<50;
int n;
ll ans,a[510][510],dp[510][510],s[2][510][510];
void update(ll &x,ll y) {
	if (x>y) x=y;
}
ll S(int k,int x1,int x2,int y1,int y2) {
	return s[k][x2][y2]-s[k][x1-1][y2]-s[k][x2][y1-1]+s[k][x1-1][y1-1];
}
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	for (int i=1;i<=n;i++)
	for (int j=1;j<=n;j++)
		if (i!=j) read(a[i][j]);
	for (int i=1;i<=n;i++)
	for (int j=1;j<=n;j++) {
		for (int k=0;k<2;k++) {
			s[k][i][j]=s[k][i-1][j]+s[k][i][j-1]-s[k][i-1][j-1];
		}
		s[i>j][i][j]+=a[i][j];
	}
	for (int i=0;i<=n;i++)
	for (int j=0;j<=n;j++) dp[i][j]=INF;
	dp[0][0]=0;
	for (int i=0;i<n;i++)
	for (int j=0;j<=i;j++) {
		if (dp[i][j]==INF) continue;
		//printf("%d %d %lld\n",i,j,dp[i][j]);
		for (int x=i+1;x<=n;x++)
			update(dp[x][i],dp[i][j]+S(0,i+1,x,i+1,x)+S(1,x+1,n,j+1,i));
	}
	ans=INF;
	for (int i=1;i<=n;i++) update(ans,dp[n][i]);
	printf("%lld\n",ans);
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Interger overflow?
  
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/

Measured memory_bytes: 8320
#include<bits/stdc++.h>
#define MSET(x,y) memset(x,y,sizeof(x))
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
// #define M 100005
#define ll long long
#define ld long double
#define INF 1e18
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define vll vector<ll>
#define sorrt(a) sort(a.begin(), a.end())
using namespace std;
ll MOD = 1000000007;
string yes = "YES\n";
string no = "NO\n";
#define PI 3.1415926535 


int32_t main() {
  fastio;
  ll M = 1e4+5;
  vector<ll> a(M, 0);
  for(ll x=1;x<=100;x++) {
    for(ll y=1;y<=100;y++) {
      for(ll z=1;z<=100;z++) {
        ll num = x*x + y*y + z*z + x*y + y*z + z*x;
        if(num>1e4) continue;
        a[num]++;
      }
    }
  }
  ll n;
  cin>>n;
  for(ll i=1;i<=n;i++) {
    cout<<a[i]<<endl;
  }
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
class UnionFind
{
public:
    vector<T> par;
    vector<T> rank;
    T index;
    UnionFind(T n) : par(n, 0), index(n), rank(n, 0)
    {
        init(n);
    }
    void init(T n)
    {
        for (ll i = 0; i < n; i++)
        {
            par[i] = i;
        }
    }
    int find(T x)
    {
        if (par[x] == x)
        {
            return x;
        }
        else
            return par[x] = find(par[x]);
    }
    void unite(T x, T y)
    {
        x = find(x);
        y = find(y);
        if (x == y)
            return;
        if (rank[x] < rank[y])
            par[x] = y;
        else
            par[y] = x;
        if (rank[x] == rank[y])
            rank[x]++;
    }
    bool same(T x, T y)
    {
        return find(x) == find(y);
    }
};

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    vector<pair<int, int>> graph(m);
    for (int i = 0; i < m; i++)
    {
        scanf("%d%d", &graph[i].first, &graph[i].second);
        graph[i].first--;
        graph[i].second--;
    }
    int ans = 0;
    UnionFind<int> tree(n);
    for (int i = 0; i < m; i++)
    {
          UnionFind<int> tree(n);
        for (int j = 0; j < m; j++)
        {
            if (i != j && !tree.same(graph[j].first, graph[j].second))
            {
                tree.unite(graph[j].first, graph[j].second);
            }
        }
            if(!tree.same(graph[i].first,graph[i].second))
            ans++;
    }
    printf("%d\n", ans);
}

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

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

    static class DarumaOtoshi {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            while (true) {
                int n = in.Int();
                if (n == 0) return;
                int[] w = in.Int(n);
                int[][] dp = new int[n + 1][n + 1];
                for (int i = 0; i < n; i++) {
                    Arrays.fill(dp[i], -1);
                }
                int ans = calc(w, dp, 0, n);
                out.println(ans);
            }
        }

        private int calc(int[] w, int[][] dp, int l, int r) {
            if (dp[l][r] != -1) {
                return dp[l][r];
            }
            if (r <= l) {
                return 0;
            }
            int ret = 0;
            if (Math.abs(w[l] - w[r - 1]) <= 1 && calc(w, dp, l + 1, r - 1) == r - l - 2) {
                ret = r - l;
            }
            for (int i = l + 1; i < r; i++) {
                ret = Math.max(ret, calc(w, dp, l, i) + calc(w, dp, i, r));
            }
            return dp[l][r] = ret;
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

        public int[] Int(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Int();
            }
            return a;
        }

    }
}




Measured memory_bytes: 47896
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextLong()
    val a = sc.nextLong()
    val b = sc.nextLong()
    println(problem041a(n, a, b))
}

fun problem041a(n: Long, a: Long, b: Long): Long {
    if (((a % 2 == 0L && b % 2 == 0L) || (a % 2 != 0L && b % 2 != 0L)) && b - a < Math.max(a - 1, b - 1) && b - a < Math.max(n - a, n - b)) {
        return (b - a) / 2
    } else if (b - 1 <  n - a) {
        // 0に向かう
        return if (b - a == 1L) {
            b - 1
        } else {
            ((a - 1) * 2 + 1 + b - a) / 2
        }
    } else {
        // nに向かう
        return if (b - a == 1L) {
            n - a
        } else {
            ((n - b) * 2 + 1 + b - a) / 2
        }
    }
}

Measured memory_bytes: 31268
#!/usr/bin/env python3
import sys


def solve(N: int):
    print(N * N * N)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin >> n;
  map<ll,int> mp;
  rep(i,n){
    ll a;
    cin  >> a;
    mp[a]++;
  }
  vl ans;
  for(auto it:mp){
    it.se/=2;
    rep(i,it.se)ans.push_back(it.fi);
  }
  sort(rng(ans),greater<ll>());
  if(sz(ans)<2){
    cout<<0<<endl;
    return 0;
  }
  ll a = ans[0], b = ans[1];
  cout<<a*b<<endl;

  return 0;
}

Measured memory_bytes: 6528
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    auto s = read!string;
    writeln("aeiou".canFind(s) ? "vowel" : "consonant");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  long long a[n];
  for (int i=0;i<n;i++){
  	cin>>a[i];
  }
  long long x=1000;
  long long y=0;
  for (int i=0;i<n-1;i++){
    y=0;
    if (a[i]<a[i+1]){
      y=x/a[i];
      x%=a[i];
    }
  	x+=a[i+1]*y;
 	
  }
 
  cout<<x<<endl;

}

Measured memory_bytes: 3604
n,m = map(int,input().split())
stu = []
che = []
kyori = []
ans = []
for _ in range(n):
  stu.append(list(map(int,input().split())))
for _ in range(m):
  che.append(list(map(int,input().split())))
for x in range(n):
  for y in range(m):
    kyori.append(abs(stu[x][0]-che[y][0])+abs(stu[x][1]-che[y][1]))
  z = min(kyori)
  ans.append(kyori.index(z)+1)
  kyori = []
for i in range(len(ans)):
  print(ans[i])

Measured memory_bytes: 8872
def geta(n=0)
  return gets.to_i if n==0
  ar = []
  n.times do 
    ar << $stdin.gets.split
  end
  return ar[0] if n==1
  return ar
end

n = geta
ar = geta(2)
max = 0
n.times do |i|
  ans = ar[0][i].to_i - ar[1][i].to_i
  max += ans if ans > 0
end
puts max

Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args)
	{
		Scanner s=new Scanner(System.in);
		
		long a=s.nextLong();
		long b=s.nextLong();
		long c=s.nextLong();
		
		System.out.println(c+" "+a+" "+b);
		
	}
	
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 998244353
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

bool prime(ll n)
{
	if(n<=1)return false;
	if(n<=3)return true;
	if(n%2==0||n%3==0)return false;
	for(ll i=5;i*i<=n;i+=6)
	{
		if(n%i==0||n%(i+2)==0)return false;
	}
	return true;
}

ll modexp(ll a,ll b,ll m)
{
	ll r=1;
	a=a%m;
	while(b>0)
	{
		if(b&1)
		    r=(r*a)%m;
		b>>1;
		a=(a*a)%m;
	}
	return r%m;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll n; cin>>n;
	vi arr(n);
	unordered_map<ll,ll>mp;
	rep(i,0,n)cin>>arr[i],mp[arr[i]]++;
	ll sum = 0;
	for(auto x:mp)
    {
        sum+=(x.se*(x.se-1))/2;
    }

    rep(i,0,n)
    {
        cout<<sum-mp[arr[i]]+1<<endl;
    }
	return 0;
}


Measured memory_bytes: 10184
import sys
sys.setrecursionlimit(100000000)
N, K = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N-1)]
graph = [[] for _ in range(N)]
used = [-1]*N
ans = K
mod = 10**9+7

for a, b in ab:
  a -= 1
  b -= 1
  graph[a] += [b]
  graph[b] += [a]


def npr(n, r, p):
  e = 1
  for i in range(n, n-r, -1):
    e *= i
    e %= p

  return e

def dfs(u, pre):
  global ans
  child = 0
  for v in graph[u]:
    if v != pre:
      dfs(v, u)
      child += 1
  if u == 0:
    ans *= npr(K-1, child, mod)
  else:
    ans *= npr(K-2, child, mod)

  ans %= mod

dfs(0, -1)
print(ans)


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

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

    for (; n > 0; n--) {
        if (n == 1) {
            cout << a[n-1] << endl;
            break;
        }
        cout << a[n-1] << ' ';
    }
}


Measured memory_bytes: 3080
package main

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

var sc = bufio.NewScanner(os.Stdin)

// 一行読み出し
func nextLine() string {
	sc.Scan()
	return sc.Text()
}

// 文字列リバース関数
func strReverse(s string) string {
	rs := []rune(s)
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		rs[i], rs[j] = rs[j], rs[i]
	}
	return string(rs)
}

func judge(t int, x int, y int) bool {

	if (x + y) > t {
		return false
	} else if t%2 == (x+y)%2 {
		return true
	} else {
		return false
	}
}

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

	ls := make([][3]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&ls[i][0], &ls[i][1], &ls[i][2])
	}

	for _, tri := range ls {
		t := tri[0]
		x := tri[1]
		y := tri[2]

		if !judge(t, x, y) {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")

}


Measured memory_bytes: 5760
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>

#define MAX_SIZE 100000000
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main() {
  string s; cin >> s;
  string ans;
  ans += s.front();
  const int len = s.size();
  ans += to_string(len - 2);
  ans += s.back();
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
#include <queue>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pl=pair<ll,ll>;
using vi=vector<int>;
using vl=vector<ll>;
using vvi=vector<vi>;
using vvl=vector<vl>;
using vs=vector<string>;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

void solve() {
    string N;
    cin >> N;
    ll sum = 0;
    rep(i, N.size()){
        sum += (N[i]-'0') % 9;
    }
    print(sum%9 ? "No" : "Yes");
}   

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}


Measured memory_bytes: 3740
a,b = map(int,input().split())

a,b = -a,-b
minA,minB = a // 0.08, b // 0.1
minA,minB = -minA,-minB

maxA,maxB = (a-1) // 0.08, (b-1) // 0.1
maxA,maxB = -maxA-1,-maxB-1

if minA > maxB or minB > maxA:
    print(-1)
else:
    if minA >= minB:
        print(int(minA))
    else:
        print(int(minB))


Measured memory_bytes: 38384
#include<iostream>
using namespace std;
bool has3(int x){
	while(x){
		if ( x % 10 == 3 ) return true;
		x /= 10;
	}
	return false;
}

void call(int n){
	for ( int x = 1; x <= n; x++ ){
		if ( x % 3 == 0 || has3(x) ){
			cout << " " << x;
		}
	}
	cout << endl;
}

int main(){
	int n;
	cin >> n;
	call(n);
	
	return 0;
}


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

using namespace std;

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

using ll = long long;
using ld =  long double;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int res = 0;
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep (i, h) cin >> s[i];
    rep (i, h) {
        rep (j, w) {
            if (s[i][j] == '#') continue;
            rep (k, h) {
                rep (l, w) {
                    if (s[k][l] == '#') continue;
                    vector<vector<int> > dist(h, vector<int>(w, Inf));
                    queue<pair<int, int> > q;
                    q.push(make_pair(i, j));
                    dist[i][j] = 0;
                    while (!q.empty() && dist[k][l] == Inf) {
                        int x, y;
                        x = q.front().first, y = q.front().second;
                        q.pop();
                        rep (id, 4) {
                            int nx, ny;
                            nx = x + dx[id], ny = y + dy[id];
                            if (nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
                            if (s[nx][ny] == '#') continue;
                            if (dist[nx][ny] != Inf) continue;
                            dist[nx][ny] = dist[x][y] + 1;
                            if (nx == k && ny == l) break;
                            q.push(make_pair(nx, ny));
                        }
                    }
                    res = max(res, dist[k][l]);
                }
            }
        }
    }
    cout << res << endl;
    
    return 0;
}



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

using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<int> used1(n,0), usedn(n,0);
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		if (a > b) swap(a, b);
		if (a == 0) used1[b] = 1;
		if (b == n - 1) usedn[a] = 1;
	}
	bool ans = false;
	for (int i = 1; i < n - 1; i++) {
		if (used1[i] && usedn[i]) {
			ans = true;
			break;
		}
	}
	cout << (ans ? "POSSIBLE" : "IMPOSSIBLE") << endl;
	return 0;
}

Measured memory_bytes: 1792