akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define tr(container, it) \
for(__typeof__(container.begin()) it = container.begin(); it != container.end(); it++)
#define all(c) c.begin(), c.end()
#define sum(v) accumulate(all(v),0LL)
#define rep(i,s,n) for (int i=s; i<n; i++)
#define lli long long int
#define MOD 1000000007
#define pii pair <int,int> 
#define pll pair <lli, lli>
#define endl '\n'
#define debugv(c) for(auto hnvx : c) cout << hnvx <<" "; cout << endl;
#define debug(c) cout<<#c<<" := "<<c<<endl;
#define printarr(c,size) rep(i,0,size) cout<<c[i]<<" "; cout<<endl;
#define printmat(c,dim1,dim2) rep(i,0,dim1) {rep(j,0,dim2) cout<<c[i][j]<<" "; cout<<endl; }

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n,w;
    cin>>n>>w;
    lli a[n][2];
    rep(i,0,n) rep(j,0,2) cin>>a[i][j];
    lli dp[n+1][w+1];
    rep(i,0,w+1) dp[0][i]=0;
    rep(i,0,n+1) dp[i][0]=0;
    rep(i,1,n+1) rep(j,1,w+1)
    {
        if (j<a[i-1][0]) dp[i][j]=dp[i-1][j];
        else
        {
            dp[i][j]=max(dp[i-1][j],a[i-1][1]+dp[i-1][j-a[i-1][0]]);
        }
    }
    //printmat(dp,n+1,w+1);
    cout<<dp[n][w];
}


Measured memory_bytes: 79232
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
#define all(a)  (a).begin(),(a).end()
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x,y)* mod_pow(kai(y,y), mod - 2, mod) % mod;
}
int per(int n, int r) {
	r = n - r;
	int sum = 1;
	int i;
	for (i = n; i >= r + 1; i--)sum *= i;
	return sum;
}
struct UnionFind {
	vector<int> par;

	UnionFind(int n) : par(n, -1) { }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

signed main() {
	int a, b;
	cin >> a >> b;
	Rep(i, 100010) {
		if ((i * 8) / 100 == a && (i * 10) / 100 == b) {
			cout << i << endl; return 0;
		}
	}
	cout << -1 << endl; return 0;
}


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

int main(){
  int N,cnt=0;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; i++) {
    cin >> p.at(i);
    if (!(p.at(i)==i+1)) cnt++;
  }

  if (cnt<=2) cout << "YES" <<endl;
  else cout << "NO" <<endl;
}


Measured memory_bytes: 256
#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;

#define ll long long int
#define endl "\n"
#define db(x) cout<<#x<<" ->"<<x<<endl
#define db2(x,y) cout<<#x<<"->"<<x<<", "<<#y<<" -> "<<y<<endl
#define db3(x,y,z) cout<<#x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define db4(w,x,y,z) cout<<#w <<" -> " << w << " , " << #x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define prt(x) for(auto it = x.begin(); it!=x.end(); it++) { cout<<*it<<" "; } cout<< endl
#define IN freopen("input.txt","r",stdin)

//template<typename T>
//using ordered_set =
//tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int N = (int)501;

int d , g;
pair< int , int > V[15];

int32_t main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
//    IN ;
    cin >> d >> g;
    for(int i = 0; i < d; i++){
        cin >> V[i].first >> V[i].second;
    }
    int ans = 1 << 30;
    for(int mask = 0; mask < (1<<d) ; mask++){
        int score = 0 ;
        int q = 0;
        for(int i = 0; i < d ; i++){
            if( ( mask & (1<<i) )== 0 ) { continue ; }
            score+=( (i+1) * 100 * V[i].first ) + V[i].second ;
            q+=V[i].first;
        }
        if( score >= g){
            ans = min(ans,q); continue;
        }
        for(int i = d - 1; i >= 0; i--){
            if(mask&(1<<i)){ continue ; }
            int res = V[i].first;
            bool fl = 0;
            for(int j = 1; j < res; j++){
                int cur = ( 100 * (i+1)  * j );
                if( cur < (g-score) ){ continue; }
                score+=cur;
                q+=j;
                fl = 1;
                break;
            }
            if(fl){ break; }
        }
        if(score >= g){
            ans = min(ans,q);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N,M = map(int, input().split())
good = [1 for i in range(N)]
height = list(map(int, input().split()))

for i in range(M):
  a,b = map(int, input().split())
  a -= 1
  b -= 1
  if height[a]<=height[b]:
    good[a] = 0
  if height[a]>=height[b]:
    good[b] = 0
    
print(sum(good))

Measured memory_bytes: 20896
S = input()

Judge = True
for i,s in enumerate(S):

    if i == 0:
        if s == "R" or s == "U" or s == "D":
            continue
        else:
            Judge = False
            # print(i)
            break

    elif i % 2 == 0:
        if s == "R" or s == "U" or s == "D":
            continue
        else:
            Judge = False
            # print(i)
            break

    else:
        if s == "L" or s == "U" or s == "D":
            continue
        else:
            Judge = False
            # print(i)
            break

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



Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <stdio.h>
#include <cstdio>

//コンパイラ最適化
#pragma GCC optimize("Ofast")

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
//FORAは範囲for文(使いにくかったら消す)
#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(), x.end()
#define SIZE(x) ll(x.size())
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

typedef long long ll;

using namespace std;
int main()
{
    ll D, N;
    cin >> D >> N;
    ll num;
    if (D == 0)
    {
        if (N != 100)
        {
            cout << N;
        }
        else
        {
            cout << 101;
        }
    }
    else if (D == 1)
    {
        if (N != 100)
        {
            num = N * 100;
            cout << num;
        }
        else
        {
            num = N * 100 + 100;
            cout << num;
        }
    }
    else
    {
        if (N != 100)
        {
            num = N * 10000;
            cout << num;
        }
        else
        {
            num = N * 10000 + 10000;
            cout << num;
        }
    }
    return 0;
}

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

int main()
{
    int n,m,x;
    cin >> n >> m >> x;

    int c[n],a[n][m];

    for (int i = 0; i < n; i++)
    {
        cin >> c[i];
        for (int j = 0; j < m; j++)
        {
            cin >> a[i][j];
        }
    }
    
    int ans = INT_MAX;
    int i,j,k;
    for (i = 0; i < (1 << n); i++)
    {

        bitset<20> bit(i);
        int r[m] = {0};
        int money = 0;
        for (j = 0; j < n; j++)
        {
            if(bit[j] & 1)
            {
                money += c[j];
                for (k = 0; k < m; k++)
                {
                    r[k] += a[j][k];
                }
            }
        }
        
        for (j = 0; j < m; j++)
        {
            if(r[j] < x)break;
        }
        if(j == m)ans = min(ans, money);
    }

    if(ans == INT_MAX)cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    ll r, d, x; cin >> r >> d >> x;
    ll ans = x;
    for(int i=0; i<10; i++){
        ans = r*ans - d;
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<queue>
#include<cmath>
#include<stack>
#include<algorithm>
#include<fstream>

#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.14159265358979323846

// VECTOR DEFINITION 
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vi vector<int>
#define vl vector<long long>

//VECTOR PAIR
#define vpi vector<pair<int,int>>
#define mp make_pair
#define ff first
#define ss second
 
#define pb push_back

//MAXIMUM / MINIMUM ELEMENT IN VECTOR
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())

//SORTING OR REVERSING ANY VECTOR OR STRING
#define srt(a) sort(a.begin(),a.end());
#define rvr(a) reverse(a.begin(),a.end());
 
//LOOPS : s- start , e -end
#define loop(i,s,e) for(int i = s; i<e ; i++)
#define  rloop(i,s,e) for(int i = s; i>=e ;i--)
#define dloop(i,j,m,n) for(int i =0 ;i<m;i++){for(int j = 0;j<n;j++)} //double loop

typedef long long ll;
#define bits(n) __builtin_popcount(n);

#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;

using namespace std;

ll hcf(ll a,ll b){
    if(b==0) return a;
    return hcf(b,a%b);
}
 
ll lcm(ll a,ll b){
    return (a*b)/hcf(a,b);
}
void rdarr(vi& v, ll n){
    int x;
    loop(i,0,n){
        cin>>x;
        v.pb(x);
    }
}
void div(int n, vector<int>& di){
    for(int i =2;i<=sqrt(n);i++){
        if(n%i == 0){
            if(n/i !=i){
                di.pb(n/i);
            }
            di.pb(i);
        }
    }
    di.pb(1);
}
void solve(int t){
    int n;
    cin>>n;
    string s; cin>>s;
    bool fl =0;
    loop(i,0,s.length()){
        if(i>=n) {fl = 1;break;}
        else cout<<s[i];
    }
    if(fl==1)
   cout<<"...";
}
signed main(){
   fast;
    //freopen("in.txt", "r", stdin);   
	//freopen("out.txt", "w", stdout);
    int t =1;
    // cin>>t;
    while(t--){
        solve(t);
    }
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;

struct UnionFind{
  vi data;
  UnionFind(int N): data(N, -1){ }

  int root(int x){
    if(data[x]<0){return x;}
    else{return root(data[x]);}
  }
  
  int size(int x){return -data[root(x)];}
  
  void unite(int x, int y){
    x=root(x);y=root(y);
    if(x!=y){
      if(data[x]>data[y]){swap(x,y);}
      data[x]+=data[y];
      data[y]=x;
    }
  }
};

ll n_pairs(int n){return (ll)n*(n-1)/2;}

int main(){
  int N, M;cin>>N>>M;
  vi a, b;
  for (int i=0;i<M;++i){
    int a_, b_;cin>>a_>>b_;
    a.push_back(a_-1);
    b.push_back(b_-1);
  }

  vll ans(M);
  ll incombeniency=n_pairs(N);
  UnionFind uf(N);

  for (int i=M-1;i>=0;--i){
    ans[i]=incombeniency;
    int ra=uf.root(a[i]);int rb=uf.root(b[i]);
    if(ra!=rb){
      int sa=uf.size(ra);int sb=uf.size(rb);
      incombeniency+=n_pairs(sa)+n_pairs(sb);
      uf.unite(a[i], b[i]);
      int r=uf.root(a[i]);int s=uf.size(r);
      incombeniency-=n_pairs(s);
    }
  }

  for (int i=0;i<M;++i){
    cout << ans[i]<< endl;
  }
  return 0;
}

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
using edge = pair<int, long long>;
using Graph = vector<vector<edge>>;
const long long INF = 1e15;
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }


vector<long long> dijkstra(const Graph &G, int s){
    using Pi = pair<long long, int>;
    vector<long long> dist(G.size(), INF); 
    priority_queue<Pi, vector<Pi>, greater<Pi>> que;
    dist[s] = 0; que.emplace(dist[s], s);
    while (!que.empty()) {
        long long sum_dist; int node;
        tie(sum_dist, node) = que.top(); que.pop();
        if (dist[node] < sum_dist) continue;
        for (auto &e : G[node]) {
            int next_node; long long dis;
            tie(next_node, dis) = e;
            if (chmin(dist[next_node], dist[node] + dis)) {
                que.emplace(dist[next_node], next_node);
            }
        }
    }
    return dist;
}

int main(){
    int N, Q, K;
    cin >> N;
    Graph G(N, vector<edge>());
    for (int i = 1; i < N; i++) {
        int a, b;
        long long c;
        cin >> a >> b >> c;
        a--;
        b--;
        G[a].emplace_back(b, c);
        G[b].emplace_back(a, c);
    }
    cin >> Q >> K;
    K--;
    vector<long long> ans = dijkstra(G, K);
    for (int i = 0; i < Q; i++) {
        int s, g;
        cin >> s >> g;
        s--;
        g--;
        long long res = ans[s] + ans[g];
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 11120
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m;
  cin >> n >> m;
  vector<int> c(n);
  int a,b;
  for(int i=0;i<m;i++){
    cin >> a >> b;
    c.at(a-1)++;
    c.at(b-1)++;
  }
  //--output--
  for(int i=0;i<n;i++)
    cout << c.at(i) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int p=998244353;
int n,m,a[505][505],pw[505];
bitset<505> b[505];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		bitset<505> x;
		for(int j=1,y;j<=m;j++){
			scanf("%d",&y);
			x[j-1]=y;
		}
		for(int j=m-1;j>=0;j--)
			if(x[j]){
				if(b[j].any())x^=b[j];
				else{b[j]=x;break;}
			}
	}
	for(int i=pw[0]=1;i<=n||i<=m;i++)pw[i]=2*pw[i-1]%p;
	int rk=0;
	for(int i=0;i<=m-1;i++)if(b[i].any())rk++;
	int ans=1ll*(pw[n]-pw[n-rk])*pw[m-1]%p;
	printf("%d\n",(ans+p)%p);
	return 0;
}


Measured memory_bytes: 256
a = input().split()
if a[0]==a[1] and a[0]!=a[2]:
    print("Yes")
elif a[0]==a[2] and a[0]!=a[1]:
	print("Yes")
elif a[1]==a[2] and a[1]!=a[0]:
	print("Yes")
else:
	print("No")    

Measured memory_bytes: 3064
while (1):
    x,op,y = input().split()
    x=int(x)
    y=int(y)
    if op == "+":
        print(x+y)
    elif op == "-":
        print(x-y)
    elif op == "*":
        print(x*y)
    elif op == "/":
        print(int(x/y))
    else:
        break
    


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

int main(){
	int N, K, ans=0;
	int h[100000];

	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> h[i];
	}

	for (int i = 0; i < N; i++) {
		if (K <= h[i])ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define mp(a,b) make_pair(a,b)
#define vi vector<int>
#define mii map<int,int>
#define mpi map<pair<int,int>,int>
#define vp vector<pair<int,int> >
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define F first
#define S second
#define endl "\n"
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define dom 998244353
#define pi 3.14159265
#define sl(a) (int)a.length()
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define pii pair<int,int> 
#define mini 2000000000000000000
#define time_taken 1.0 * clock() / CLOCKS_PER_SEC
//mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
void shikhar7s(int cas)
{
    int a,b;
    cin>>a>>b;
    cout<<a*b;
}
signed main()
{
    fast;
    int t=1;
    //cin>>t;
    int cas=1;
    while(cas<=t)
    {
    shikhar7s(cas);
    cas++;
    }
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000           // 2000000000
#define LINF 1000000000000000000 // 9000000000000000000
#define DINF 1000000000000000.0
#define PI 3.14159265358979

//.size()はunsigned int　0-1をするとオーバーフローする

using namespace std;
typedef long long int ll;
typedef pair<long long int, long long int> P;

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

int main(void) {
    int n;

    cin>>n;
    vector<int> d(n);
    FOR(i,0,n-1){
        cin>>d[i];
    }
    sort(d.begin(),d.end());
    cout<<d[n/2]-d[(n/2)-1]<<endl;
}


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

typedef long long int ll;
int ind[100005]={0};
int ini[100005];
vector<int> otd[100005];
vector<pair<int,int> > edge;
queue<int>q;
int dis[100005];
bool vis[100005];
int n, m, i, a, b;

void bfs(int s){
    for(i=1; i<=n; i++)vis[i]=false;
    dis[s]=0;
    q.push(s);
    vis[s]=true;
    while(!q.empty()){
        a=q.front();
        q.pop();
        for(i=0; i<otd[a].size(); i++){
            b=otd[a][i];
            if(ind[b]==1){
            if(!vis[b]){
                vis[b]=true;
                ini[b]=a;
                q.push(b);
                dis[b]=dis[a]+1;
            }
            }
            else{ ind[b]--;}
        }
    }
}

int main()
{
    cin>> n>> m;
    for(i=0; i<n-1+m; i++){
        cin>> a>> b;
        ind[b]++;
        otd[a].push_back(b);
        edge.push_back(make_pair(a,b));
    }
    int trav=0, x;
    //cout<< endl;
    //for(i=1; i<=n; i++)cout<< i<< " "<< ind[i].size()<< " "<< otd[i].size()<< endl;
    for(i=1; i<=n; i++){
        vis[i]=false;
        if(ind[i]==0)x=i;
    }
    bfs(x);
    //cout<< endl;
    //for(int o=1; o<=n; o++)cout<< dis[o]<< " ";
    //cout<< endl;

//    for(i=0; i<m; i++){
//        for(int j=1; j<=n; j++){
//            if(ind[j].size()>1){
//                for(int k=0; k<ind[j].size(); k++){
//                    b=ind[j][k];
//                    if(dis[b]<dis[j]){
//                        ind[j].erase(find(ind[j].begin(),ind[j].end(),b));
//                        otd[b].erase(find(otd[b].begin(),otd[b].end(),j));
//                        edge.erase(find(edge.begin(),edge.end(),make_pair(b,j)));
//                        //cout<< b<< " "<< j<< endl;
//                        //for(int o=1; o<=n; o++)cout<< dis[o]<< " ";
//                        //cout<< endl;
//                        bfs(x);
//                    }
//                }
//            }
//        }
//    }
//    //cout<< endl;
//    //for(i=1; i<=n; i++)cout<< i<< " "<< ind[i].size()<< " "<< otd[i].size()<< endl;
//    //cout<< endl;
    for(i=1; i<=n; i++)cout<< ini[i]<< endl;
}


Measured memory_bytes: 8308
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
	int n;
	double q,a,b,c;
	while(cin >> n, n != -1){
		q = (double)(n) / 2.0;
		while(abs(q * q * q - (double)(n)) > (0.00001 * n)){
		/*	a = q * q * q;
			b = q * q;
			c = (a - q)/(3 * b);*/
			q = q - (q * q * q - (double)(n))/(3 * q * q);
		}
		cout << fixed << setprecision(6) << q << endl;
	}
}

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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

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

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

bool ok(int w,const vi& sum,int sp)
{
	int n=sum.size()-1;
	
	vi dp(n+1); dp[0]=1;
	int l=0,r=0,cnt=0;
	rep(i,n){
		for(;l<i;cnt-=!!dp[l++]) if(sum[i+1]-sum[l]+(i-l)<=w) break;
		for(;r<i;cnt+=!!dp[r++]) if(sum[i+1]-sum[r]+(i-r)*sp<w) break;
		dp[i+1]=!!cnt;
	}
	
	int res=dp[n];
	for(int i=n;i--;){
		if(sum[n]-sum[i]+(n-i-1)>w) break;
		res|=dp[i];
	}
	
	return res;
}

int main()
{
	for(int w,n;~scanf("%d%d",&w,&n) && w|n;){
		vi xs(n);
		rep(i,n) scanf("%d",&xs[i]);
		
		vi sum(n+1);
		rep(i,n) sum[i+1]=sum[i]+xs[i];
		
		int lo=1,hi=w;
		while(lo<hi){
			int mi=(lo+hi)/2;
			if(ok(w,sum,mi))
				hi=mi;
			else
				lo=mi+1;
		}
		printf("%d\n",lo);
	}
}

Measured memory_bytes: 1736
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int H, W; cin >> H >> W;
    vs g(H); REP(i, H) cin >> g[i];

    vb r(H, false), c(W, false);

    REP(i,H) {
        REP(j,W) {
            if (g[i][j]=='#') {
                r[i] = true;
                c[j] = true;
            }
        }
    }
    
    REP(i,H) {
        if (!r[i]) continue;
        REP(j,W) {
            if (!c[j]) continue;
            cout << g[i][j];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 892
//https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_e
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
constexpr ll MOD=1e9+7;
int main() {
  ll N; cin>>N;
  vector<ll> an(N);
  for(auto&& a:an) cin>>a;
  vector<ll> num(3);
  ll ans=1;
  for(const auto& a:an){
    ll mul=0; //みつからないと0になる
    FOR(i,0,3){
      if(num[i]==a) ++mul;
    }
    FOR(i,0,3){
      if(num[i]==a) {
        ++num[i];
        break;
      }
    }
    ans *= mul;
    ans %= MOD;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
A,B = map(int,input().split())

S = []
S.append('#'*100)
a = A-1
while (a>0):
  k = min(50,a)
  S.append('.#'*k+'##'*(50-k))
  S.append('#'*100)
  a -= k
S.append('.'*100)
b = B-1
while (b>0):
  k = min(50,b)
  S.append('.#'*k+'..'*(50-k))
  S.append('.'*100)
  b -= k
print(len(S),100)
for s in S:
  print(s)


Measured memory_bytes: 38512
import java.util.*;
import java.io.*;
public class Main{
/// functions
static long gcd(long a,long b){if(b==0){return a;}return gcd(b,a%b);}
static long Modpow(long a,long p,long m){if(p==1){return a;}long x=Modpow(a,p/2,m);x=(x*x)%m;return (p&1l)!=0? (x*a)%m:x;}
static long Modmul(long a,long b,long m){return ((a%m)*(b%m))%m;}
static long ModInv(long a,long m){return Modpow(a,m-2,m);}
static long nck(int n,int r,long m){if(r>n){return 0l;}return Modmul(f[n],ModInv(Modmul(f[n-r],f[r],m),m),m);}
// end
static long[] f;

public static void main(String[] args) throws FileNotFoundException, IOException{
       Scanner s=new Scanner(System.in);
       StringBuilder sb=new StringBuilder();
       BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
       int n=s.nextInt();
        int[] arr=new int[n];
        long mod=(long)1e9+7;
        Map<Integer,Integer>map=new HashMap<>();
        for(int i=0;i<n;i++){arr[i]=s.nextInt();}
        	long res=0;
        for(int i=0;i<n;i++){
        	int tmp=arr[i];
        	for(int j=2;j*j<=arr[i];j++){
        			int count=0;
        		while(tmp%j==0){count++;tmp/=j;}
        		if(count!=0) map.put(j,Math.max(map.getOrDefault(j,0),count));
        	}
        	if(tmp!=1){map.put(tmp,Math.max(map.getOrDefault(tmp,0),1));}
        }
        long lcm=1;
        for(int x:map.keySet()){
        	lcm=Modmul(lcm,Modpow(x,map.get(x),mod),mod);
        }
        for(int i=0;i<n;i++){
        	res=(res+Modmul(lcm,ModInv(arr[i],mod),mod))%mod;
        }
       out.write(res+"");
        out.flush();
  }
}


Measured memory_bytes: 31920
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define sz(v)           (int)v.size()
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
const int inf =         1e18;
const int mod =         1e9+7;
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p,int m = inf) {int ans=1;x%=m;while(p>0){if(p&1)ans=(ans*x)%m;p=p>>1;x=(x*x)%m;}return ans;}
int inv(int x,int m=mod){return po(x,m-2,m)%m;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=================================================================================




const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r,f;








void sol()
{   
    cin>>n;
    
    
    
    
    cout<<(n+1)/2  <<endl;
}





int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //sp(10);
    // w(t)
    sol();
    return 0;
}

Measured memory_bytes: 3624
import random

import sys
sys.setrecursionlimit(100000000)

# N = 5000
# P = [[random.randint(1,10000) for i in range(3)] for i in range(N)]
N = int(raw_input())
P = [list(map(int, raw_input().split())) for i in range(N)]
memo = {}
ACTIVITIES = set([0,1,2])
def get_point(activity, day):
    if day >= N:
        return 0
    return P[day][activity]

def get_max_vaccation_point_from_day(last_activity, day):
    if day >= N:
        return 0

    if (last_activity, day) in memo:
        return memo[last_activity, day]

    possible_activities = ACTIVITIES - set([last_activity])
    ans = max(
        get_point(activity, day) + get_max_vaccation_point_from_day(activity, day+1) for activity in possible_activities)

    memo[last_activity, day] = ans
    return ans


print get_max_vaccation_point_from_day(-1, 0)


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=acos(-1);
const ll MOD=1e9+7;
const ll INF=(1LL<<60);

int main() {
    int n;
    cin>>n;
    ll a[3*n+1];
    rep(i,3*n)cin>>a[i+1];
    ll dp1[3*n+1],dp2[3*n+1];
    priority_queue<ll,vector<ll>,greater<ll>> q1;
    ll now=0;
    for (int i=1;i<3*n+1;i++){
        if (i<=n){
            now+=a[i];
            q1.push(a[i]);
            dp1[i]=0;
            if (i==n)dp1[i]=now;
        }
        else{
            if (a[i]>q1.top()){
                now-=q1.top();
                now+=a[i];
                q1.pop();
                q1.push(a[i]);
            }
            dp1[i]=now;
        }
    }
    priority_queue<ll> q2;
    now=0;
    for (int i=3*n;i>0;i--){
        if (i>=2*n+1){
            now+=a[i];
            q2.push(a[i]);
            dp2[i]=0;
            if (i==2*n+1)dp2[i]=now;
        }
        else{
            if (a[i]<q2.top()){
                now-=q2.top();
                now+=a[i];
                q2.pop();
                q2.push(a[i]);
            }
            dp2[i]=now;
        }
    }
    ll ans=-INF;
    for (int i=n;i<2*n+1;i++){
        ans=max(ans,dp1[i]-dp2[i+1]);
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 9588
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <string.h>
using namespace std;
int main() {
   string s,t;
   int ans=0;
   cin>>s>>t;
   for(int i=0;i<int(s.length());i++){
       if(s[i]!=t[i])ans++;
   }
   cout<<ans;
    return 0;
}

Measured memory_bytes: 3920
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

int main() {
    int N;
    char s[110];
    cin >> N;
    for (int i=0; i<N; i++) cin >> s[i];

    int cnt=0;
    for (int i=0; i<N; i++){
        if (s[i] == 'Y') cnt++;
    }

    puts(cnt >=1 ? "Four" : "Three");
}


Measured memory_bytes: 256
import itertools
n,m,q = map(int,input().split())
input_lines = [[int(j) for j in input().split()]for i in range(q)]

#数列の列挙
li = list(itertools.combinations_with_replacement(range(1,m+1),n))

ans=0
for l in li:
    result = 0
    for line in input_lines:
        if (l[line[1]-1]-l[line[0]-1])==(line[2]):
            result+=line[3]
    if result>ans:
        ans=result
print(ans)

Measured memory_bytes: 21620
n, y = map(int, input().split())
for i in range(n + 1):
    for j in range(n - i + 1):
        if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print("-1 -1 -1")

Measured memory_bytes: 9076
#include <bits/stdc++.h>
using namespace std;
int main(){
	double a,b,c,d;
	while(cin>>a>>b>>c>>d,(b>-0.5)){
		a=a*M_PI/180;
		b=b*M_PI/180;
		c=c*M_PI/180;
		d=d*M_PI/180;
		double x1=cos(a)*cos(b),y1=cos(a)*sin(b),z1=sin(a),x2=cos(c)*cos(d),y2=cos(c)*sin(d),z2=sin(c);
		double n=x1*x2+y1*y2+z1*z2;
		double r1=sqrt(x1*x1+y1*y1+z1*z1);
		double r2=sqrt(x2*x2+y2*y2+z2*z2);
		double rad=acos(n/(r1*r2));
		cout<<(int)(rad*6378.1+0.5)<<endl;
	}
	
	return 0;
}


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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int n, m;
    cin >> n >> m;
    int a;
    int b;
    int c[n] = {};
    rep(i, m) {
        cin >> a >> b;
        c[a - 1]++;
        c[b - 1]++;
    }

    // 処理
    // 出力
    rep(i, n) {
        { cout << c[i] << endl; }
    }

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <queue>
#include <cstdio>
#include <cmath>
#include <string>
#include <stack>
#define PI acos(-1.0)
#define inf 0x3f3f3f3f
#define E exp(double(1))
#define maxn 51000
using namespace std;

struct Edge{
    int from,to,dis,next;
    int w;
} edge[maxn];

int b[maxn];
int head[maxn];
int vis[maxn];
int dis[maxn];
int tt[maxn];
int p[maxn];
int cnt;
int n;
int ll;
void add(int q,int h,int len,int w) {
    edge[cnt].from=q;
    edge[cnt].to=h;
    edge[cnt].dis=len;
    edge[cnt].w=w;
    edge[cnt].next=head[q];
    head[q]=cnt;
    cnt++;
}

vector<int>vct[maxn];

int Dijkstra(){
	int i,j,k,tmp,v;
	int flag;
	int yy;
	memset(dis,inf,sizeof(dis));
	memset(vis,0,sizeof(vis));
	memset(tt,0,sizeof(tt));
	memset(p,0,sizeof(p));
	dis[1]=0;
	vis[1]=1;
	int next;
	int s=1;
	yy=0;
	for(int i=0;i<maxn;i++) vct[i].clear();
	while(1){
		tmp=inf;
		next=-1;
		for(int i=head[s]; i!=-1; i=edge[i].next){
            v=edge[i].to;
            if(vis[v])continue;
            if(edge[i].dis+dis[s]<dis[v]){
                dis[v]=edge[i].dis+dis[s];
                tt[v]=edge[i].w;
                p[v]=1;
                vct[v].clear();
                vct[v].push_back(i);
            }else if(edge[i].dis+dis[s]==dis[v]){
                tt[v]=max(tt[v],edge[i].w);
                p[v]++;
                vct[v].push_back(i);
            }
		}
        for(int i=1;i<=n;i++){
            if(vis[i])continue;;
            if(dis[i]<tmp){
                tmp=dis[i];
                next=i;
            }
        }
		if(next==-1)break;

		for(i=0;i<vct[next].size();i++){
         //   printf("%d __>  %d\n",edge[vct[next][i]].from,edge[vct[next][i]].to);
            if(b[vct[next][i]])continue;
            ll+=edge[vct[next][i]].w;
            b[vct[next][i]]=1;
		}
		vis[next]=1;
		s=next;
		if(p[next]>=2){
            yy+=tt[next];
		}
	}
	return yy;
}



int main(){
    int m;
    int q,h,len,w,i,j;
    int ans;
    int ff;
    while(scanf("%d%d",&n,&m)!=EOF,n+m){
        ll=0;
        cnt=0;
        memset(b,0,sizeof(b));
        memset(head,-1,sizeof(head));
        for(i=0;i<m;i++){
            scanf("%d%d%d%d",&q,&h,&len,&w);
            add(q,h,len,w);
            add(h,q,len,w);
        }

        ff=Dijkstra();
     //   printf("%d\n",ll);
        printf("%d\n",ll-ff);
    }
    return 0;
}

Measured memory_bytes: 4668
/*
                   _ooOoo_
                  o8888888o
                  88" . "88　AC!AC!
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rep3(var, min, max) for (ll (var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll (var) = (max) - 1; (var) + 1 > (min); --(var))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll MOD = 1e9 + 7;
const int N = pow(10,6);
ll conbi(ll x){
    return x*(x-1)/2;
}

int main(){
    ll n;
    cin>>n;
    V vec(n);
    rep(i,n)cin>>vec[i];
    rep3(i,1,n)vec[i]+=vec[i-1];
    map<ll,ll> mp;
    mp[0]++;
    rep(i,n)mp[vec[i]]++;
    ll sum=0;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        int x=itr->second;
      //  cout<<x<<endl;
        if(x>=2)sum+=conbi(x);
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 14336
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		doIt();

	}
	
	public static void doIt(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int[] num = new int[100 + 2];
			int from = sc.nextInt();
			int to = sc.nextInt();
			while(from + to > 0){
				num[from - 1]++;
				num[to - 1]++;
				from = sc.nextInt();
				to = sc.nextInt();
			}
			int odd = 0;
			for(int n : num){
				if(n % 2 == 1){
					odd++;
				}
			}
			if(odd == 2 && num[0] % 2 == 1 && num[1] % 2 == 1){
				System.out.println("OK");
			}
			else{
				System.out.println("NG");
			}
		}
	}

}

Measured memory_bytes: 12000
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	char s[5];
	scanf("%s",s);
	for(int i=0;i<strlen(s);i++)
	{
		if(s[i]=='7')
		{
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
} 


Measured memory_bytes: 1660
#include <stdio.h>
#include <unistd.h>
#include <math.h>

#define NUM (1000)
int main(){
	int n;
	scanf("%d",&n);
	int cnt=0;
	for(int i=0;i<n;i++){
		int a;
		scanf("%d",&a);
		while(a>0){
			
			if(a%2!=0)break;
			a /=2;
			cnt++;
		}
	}
	printf("%d\n",cnt);

}


Measured memory_bytes: 128
import java.util.*;
import java.io.*;

class Main {
	static PrintStream out = System.out;
	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		int n = in.nextInt();

		List<Dice> dl = new ArrayList<Dice>(n);
		for (int i = 0; i < n; i++) {
			int[] m = new int[6];
			for (int j = 0; j < 6; j++) {
				m[j] = in.nextInt();
			}
			dl.add(new Dice(m));
		}
		for (int i = 0; i < dl.size(); i++) {
			Dice d = dl.get(i);
			for (int h = i + 1; h < dl.size(); h++) {
				Dice dd = dl.get(h);
				boolean	match = false;
				for (int l = 0; l < 4; l++) {
					d.moveE();
					for (int j = 0; j < 4; j++) {
						d.moveN();
						for (int k = 0; k < 4; k++) {
							d.moveE();
							if (d.equals(dd)) {
								match = true;
								break;
							}
						}
						if (match) break;
					}
					if (match) break;
				}
				if (match) {
					out.println("No");
					return;
				}
			}
		}
		out.println("Yes");
	}

	private static class Dice {
		private int[] no;
		Dice(int[] no) {
			if (no.length != 6) throw new RuntimeException();
			this.no = Arrays.copyOf(no, no.length);
		}
		public boolean equals(Object o) {
			if (o == null || !(o instanceof Dice)) {
				return false;
			}
			int[] n = ((Dice)o).getNo();
			for (int i = 0; i < 6; i++) {
				if (this.no[i] != n[i]) {
					return false;
				}
			}
			return true;
		}
		private void moveX(boolean rev) {
			int temp = no[0];
			if (rev) {
				no[0] = no[4];
				no[4] = no[5];
				no[5] = no[1];
				no[1] = temp;
			} else {
				no[0] = no[1];
				no[1] = no[5];
				no[5] = no[4];
				no[4] = temp;
			}
		}
		void moveN(){moveX(false);}
		void moveS(){moveX(true);}

		private void moveY(boolean rev) {
			int temp = no[0];
			if (rev) {
				no[0] = no[3];
				no[3] = no[5];
				no[5] = no[2];
				no[2] = temp;
			} else {
				no[0] = no[2];
				no[2] = no[5];
				no[5] = no[3];
				no[3] = temp;
			}
		}
		void moveW(){moveY(false);}
		void moveE(){moveY(true);}

		int[] getNo(){return Arrays.copyOf(no, no.length);};
	}
}

Measured memory_bytes: 33712
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

#include <bits/stdc++.h>
using namespace std;

int main(){
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      cout<<i<<"x"<<j<<"="<<i*j<<endl;
    }
  }
  
  return 0;
}


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

double eps = 1e-8, PI = acos(-1);

double Sqrt(double x){
  return (x<0?0:sqrt(x));
}

bool eq(double a, double b){
  return (-eps<a-b&&a-b<eps);
}

struct Point{
  double x,y,z;
  Point (double a=0,double b=0,double c=0): x(a),y(b),z(c) {}
  Point operator + (const Point &p)const{
    return Point(x+p.x,y+p.y,z+p.z);
  }
  Point operator - (const Point &p)const{
    return Point(x-p.x,y-p.y,z-p.z);
  }
  Point operator * (const double &r)const{
    return Point(x*r,y*r,z*r);
  }
  Point operator / (const double &r)const{
    return Point(x/r,y/r,z/r);
  }
};

typedef Point Vector;

double dot(Point a,Point b){
  return a.x*b.x+a.y*b.y+a.z*b.z;
}

Point cross(Point a,Point b){
  double nx=a.y*b.z-b.y*a.z;
  double ny=a.z*b.x-b.z*a.x;
  double nz=a.x*b.y-b.x*a.y;
  return Point(nx,ny,nz);
}

double norm(Point a){
  return dot(a,a);
}

double abs(Point a){
  return sqrt( norm(a) );
}

struct Line{
  Point p;
  Vector v;
  Line(Point a=Point(),Vector b=Vector()):p(a),v(b){}
};

struct Plane{
  Point p;
  Vector v0,v1;
  Plane(Point a=Point(),Vector b=Vector(),Vector c=Vector())
    :p(a),v0(b),v1(c){}
};

Vector cross(Plane p){
  return cross(p.v0,p.v1);
}

struct Ball{
  Point p;
  double r;
  Ball(Point a=Point(),double b=1.0):p(a),r(b){}
};

vector<Point> getCrossPoint(Ball s,Line t){
  vector<Point> res;
  Vector a=s.p-t.p;
  Vector b=t.v;
  double base=dot(a,b)/abs(b);
  double hh=norm(cross(a,b))/norm(b);
  if(s.r*s.r+eps < hh )return res;
  double w=Sqrt( s.r*s.r - hh );
  res.push_back(t.p+t.v/abs(t.v)*(base-w));
  res.push_back(t.p+t.v/abs(t.v)*(base+w));
  return res;
}

Point reflect(Point sp,Vector sk,Point t){
  return t-sk*dot(sk,t-sp)*2.0/norm(sk);
}

int n;
Point v;
Ball t[100];

void solve(){
  Line a=Line( Point() , v );
  while(1){
    Line next;
    double mini=1e9;
    for(int i=0;i<n;i++){
      vector<Point> u=getCrossPoint(t[i],a);
      for(int j=0;j<(int)u.size();j++){
        Point np=u[j];
        double dist=abs(np-a.p);
        if(dist<eps)continue;
        if(dot(np-a.p,a.v)<0)continue;
        if(dist<mini){
          mini=dist;
          next.p=np;
          next.v=reflect(np,np-t[i].p,np+a.v)-np;
        }
      }
    }
    if(mini==1e9)break;
    a=next;
  }
  printf("%.8f %.8f %.8f\n",a.p.x,a.p.y,a.p.z);
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    cin>>v.x>>v.y>>v.z;
    for(int i=0;i<n;i++)cin>>t[i].p.x>>t[i].p.y>>t[i].p.z>>t[i].r;
    solve();
  }
  return 0;
}

Measured memory_bytes: 1256
#include<cstdio>
#include<cstring>
#include<algorithm>

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

using namespace std;

int main(){
	char s[51]; scanf("%s",s);
	int n=strlen(s);

	for(char c='o';;c=(c=='o'?'x':'o')){
		if(count(s,s+n,'o')==n||count(s,s+n,'x')==n) break;

		if(s[0]==c) reverse(s,s+n);
		if(s[0]!=c){
			rep(i,n){
				if(s[i]==c) break;
				s[i]=c;
			}
		}
	}

	puts(count(s,s+n,'o')==n?"o":"x");

	return 0;
}

Measured memory_bytes: 0
import java.util.ArrayList;
        import java.util.List;
        import java.util.Scanner;
        import java.util.stream.IntStream;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
//        int[] a = new int[T];
//        for (int i = 0; i < T; i++) {
//            a[T-i] = sc.nextInt();
//        }
        //System.out.println(IntStream.of(a).reduce(0,(right,left) -> right + left -1));
        //System.out.println(IntStream.rangeClosed(1,100).filter(c -> c % 2 == 0).sum());

        System.out.println(T<1200?"ABC":T<2800?"ARC":"AGC");

    }
}


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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

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

const int INTINF = 1e9;
const LL LLINF = 1e18;

int E[51][51];

void solve()
{
    int N;
    cin >> N;
    int M;
    cin >> M;

    vector<pii> edges;
    edges.reserve(M);

    REP0(i, M)
    {
        int a, b;
        cin >> a >> b;
        E[a][b] = E[b][a] = 1;
        edges.push_back(make_pair(a, b));
    }

    int ans = 0;
    for (auto e : edges)
    {
        E[e.first][e.second] = (E[e.second][e.first] = 0);

        vector<int> V(N + 1);
        queue<int> Q;
        Q.push(1);
        int visit_cnt = 0;
        while (!Q.empty())
        {
            int v = Q.front();
            Q.pop();
            REP1(i, N)
            {
                if (E[v][i] and V[i] == 0)
                {
                    Q.push(i);
                    V[i] = 1;
                }
            }
            V[v] = 2;
            visit_cnt++;
        }

        if (visit_cnt < N)
            ans++;

        E[e.first][e.second] = (E[e.second][e.first] = 1);
    }

    std::cout << ans << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(void)

{
    string s;
    cin>>s;
    int i, f = 0;
    for(i = 0; i < s.size(); i++){
        if(s[i] == '7'){
            cout<<"Yes\n";
            f = 1;
            break;

        }
    }
    if(f == 0)
        cout<<"No\n";
    return 0;
}


Measured memory_bytes: 3040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;
ll INF = 1e12+10;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
vector<pair<ll, ll> > pairs;
#define print1(x) cerr << "x = " << x << endl;
#define print2(x, y) cerr<< "x,y = "  << x << "," << y << endl;
#define print3(x, y, z) cerr << "x,y,z = " << x << "," << y << "," << z << endl;
#define print4(x, y, z, w) cerr << "x,y,z,w = " << x << "," << y << "," << z << "," << w << endl;

#define K_MAX 161 * 50
int A[100][100];
int cand[81][81][K_MAX];

int main()
{
    ll N, ans;
    cin >> N;
    if (N % 2 == 1){
        cout << 0;
        return 0;
    } 
    N /= 2LL;
    while (N){
        N /= 5;
        ans += N;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256