akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

using Int = int;

struct ModInt {
    static constexpr Int mod = 1e9 + 7;
    Int v;

    ModInt(long long _v = 0) : v(set(_v)) {}
    ModInt(const ModInt &r) : v(set(r.v)) {}

    inline static Int set(const auto x) { return x < 0 ? (x % mod) + mod : x % mod; }
    inline void set() { v = set(v); }

    bool operator<(ModInt r) const { return v < r.v; }
    bool operator>(ModInt r) const { return r.v < v; }
    bool operator==(ModInt r) const { return v == r.v; }
    bool operator!= (ModInt r) const { return v != r.v; }

    ModInt operator-() const { return ModInt(v ? mod - v : v); }
    ModInt &operator=(const ModInt &r) { if (this != &r) v = set(r.v); return *this; }
    ModInt &operator+=(ModInt r) { (v += r.v) %= mod; return *this; }
    ModInt &operator-=(ModInt r) { (v -= r.v - mod) %= mod; return *this; }
    // ModInt &operator*=(ModInt r) { v = (__uint128_t(v) * r.v) % mod; return *this; }
    ModInt &operator*=(ModInt r) { v = 1ULL * v * r.v % mod; return *this; }
    ModInt &operator/=(ModInt r) { *this *= r.inv(); return *this; }
    ModInt operator+(ModInt r) const { return ModInt(*this) += r; }
    ModInt operator-(ModInt r) const { return ModInt(*this) -= r; }
    ModInt operator*(ModInt r) const { return ModInt(*this) *= r; }
    ModInt operator/(ModInt r) const { return ModInt(*this) /= r; }

    ModInt inv() const {
        long long a = v, b = mod, u = 1, w = 0;
        while (b) {
            long long t = a / b;
            std::swap(a -= t * b, b);
            std::swap(u -= t * w, w);
        }
        return ModInt(u);
    }

    ModInt pow(Int e) {
        ModInt a = *this, x(1);
        for ( ; 0 < e; e >>= 1) { if (e & 1) x *= a; a *= a; }
        return x;
    }
    inline ModInt pow(ModInt &e) { return pow(e.v); }
};
std::ostream &operator<<(std::ostream &os, const ModInt &r) { return os << r.v; }
std::istream &operator>>(std::istream &is, ModInt &r) { is >> r.v; r.set();return is; }

ModInt Choose(int n, int k) {
    if (n < 0 || k < 0 || n < k) return ModInt(0);
    k = std::min(k, n - k);
    ModInt p = 1, q = 1;
    for (int i = 1; i <= k; ++i) {
        p *= n--;
        q *= i;
    }
    return p / q;
}
ModInt MultiChoose(const int n, const int k) {
    if (n < 0 || k < 0) return ModInt(0);
    else return k == 0 ? 1 : Choose(n + k - 1, k);
}

template<class T>
std::vector<std::pair<T, T>> PrimeFact(T n) {
    std::vector<std::pair<T, T>> pf;
    T m = n;
    for (T i = 2; i * i <= n; ++i) {
        if (m % i != 0) continue;
        T cnt = 0;
        while (m % i == 0) { ++cnt; m /= i; }
        pf.emplace_back(std::make_pair(i, cnt));
    }
    if (1 < m) pf.emplace_back(std::make_pair(m, 1));

    return pf;
}

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

    Int n, m;
    cin >> n >> m;

    auto pf = PrimeFact(m);

    ModInt res = 1;
    for (const auto &it : pf)
        res *= MultiChoose(n, it.second);

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;
 
public class Main {
  public static void main(String[] args) {
    int INF = 1000000000;
    int N = 100;
    int i, j, k, l;

    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int s[] = new int[n+1];
    int dp[][] = new int[n+1][n+1];
    for (i=0; i<n; i++) {
      s[i] = Integer.parseInt(sc.next()); 
      s[i+1] = Integer.parseInt(sc.next()); 
    }

    for (i=0; i<=n; i++)
      Arrays.fill(dp[i], 0);

    for (l=2; l<=n; l++)
      for (i=1; i<=n-l+1; i++) {
        j = i + l - 1;
        dp[i][j] = INF;
        for (k=i; k<j; k++)
          dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j] + s[i-1]*s[k]*s[j]);
      }

    System.out.println(dp[1][n]);
  }
}

Measured memory_bytes: 20200
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int r; scanf("%d", &r);
	
	printf("%.12lf\n", 2. * r * 3.141592653589793238);
	return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a,b; cin>>a>>b;
    int n = a.size()+b.size();
    rep(i,n){
        if (i%2==0) cout<<a[i/2];
        if (i%2==1) cout<<b[i/2];
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(ll)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    int h,w;cin>>h>>w;
    char t[h][w];
    bool ok[h][w];
    rep(i,h)rep(j,w){
        cin>>t[i][j];
        ok[i][j]=true;
    }
    rep(i,h){
        bool jud=true;
        rep(j,w){
            if(t[i][j]=='#'){
                jud=false;
                break;
            }
        }
        if(jud){
            rep(j,w){
                ok[i][j]=false;
            }
        }
    }
    rep(i,w){
        bool jud=true;
        rep(j,h){
            if(t[j][i]=='#'){
                jud=false;
                break;
            }
        }
        if(jud){
            rep(j,h){
                ok[j][i]=false;
            }
        }
    }
    rep(i,h){
        bool jud=false;
        rep(j,w){
            if(ok[i][j]){
                cout<<t[i][j];
                jud=true;
            }
        }
        if(jud)cout<<endl;
    }
}

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




signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;cin>>a>>b;

    int p=__gcd(a,b);
    int ans=(a*b)/p;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  ll x = 0;
  vector<ll> X(N);
  rep(i, N) cin >> X[i], x += X[i];
  ll y = x / N;
  ll ans = LLONG_MAX;
  for (ll i = -10; i <= 10; i++) {
    ll cost = 0;
    rep(j, N) {
      cost += (X[j] - (y + i)) * (X[j] - (y + i));
    }
    ans = min(ans, cost);
  }
  cout << ans << endl;
}

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

int main(void)
{
    int N, K, C;
    cin >> N >> K >> C;
    string S;
    cin >> S;
    vector<int> L(K);
    vector<int> R(K);
    int k = 0;
    for(int i=0;i<N;){
        if(S[i]=='o'){
            L[k++] = i;
            i += C+1;
        }else{
            i++;
        }
        if(k==K){
            break;
        }
    }
    k = K-1;
    for(int i=N-1;i>=0;){
        if(S[i]=='o'){
            R[k--] = i;
            i -= C+1;
        }else{
            i--;
        }
        if(k==-1){
            break;
        }
    }
    for(int i=0;i<K;i++){
        if(L[i] == R[i]){
            cout << L[i]+1 << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3332
N, M_a, M_b = map(int, raw_input().split())
v = [map(int, raw_input().split()) for i in range(N)]
def solve():
    dp = {(0, 0): 0}
    for i in range(N):
        a, b, c = v[i]
        for (A, B), C in dp.items():
            nA, nB, nC = A+a, B+b, C+c
            if not (nA, nB) in dp:
                dp[nA, nB] = nC
            else:
                dp[nA, nB] = min(dp[nA, nB], nC)
    for (a, b), c in sorted(dp.items(), key=lambda x: x[1]):
        if (a, b) == (0, 0):
            continue
        if a*M_b == b*M_a:
            return c
    return -1
print solve()

Measured memory_bytes: 8256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String ans = "No";
    if((s.length() > 3) && ((s.substring(0, 4)).equals("YAKI"))) {
      ans = "Yes";
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()

using vv = vector<vector<ll>>;
ll M;

void say(vv v) {
	for (int i = 0;i < 3;i++) {
		for (int j = 0;j < 3;j++)
			cout << v[i][j] << " ";
		cout << endl;
	}
}

vv matpow(vv X, ll K) {
	vv A(3, vector<ll>(3, 0)), N = A, S = A;
	A[0][0] = A[1][1] = A[2][2] = 1;
	while (K) {
		if (K & 1) {
			for (int i = 0;i < 3;i++) {
				for (int j = 0;j < 3;j++) {
					for (int k = 0;k < 3;k++) {
						N[j][k] += A[j][i] * X[i][k];
						N[j][k] %= M;
					}
				}
			}
		}
		else
			N = A;

		A = N;
		K /= 2;
		if (K < 1)break;


		N = S;
		for (int i = 0;i < 3;i++)
			for (int j = 0;j < 3;j++)
				for (int k = 0;k < 3;k++)
					N[j][k] += X[j][i] * X[i][k], N[j][k] %= M;
		X = N;
		N = S;
	}
	return A;
}


ll modpow(ll x, ll y) {
	ll ans = 1;
	while (y) {
		if (y & 1)ans *= x;
		x *= x;
		x %= M;
		ans %= M;
		y /= 2;
	}
	return ans;
}

int main() {
	ll A, B, L;
	cin >> L >> A >> B >> M;
	
	vector<vector<ll>> mt(3, vector<ll>(3, 0));
	vector<ll> mans(19, 0), kr(20, 1);

	ll d10 = 10, ft = A, lt = A + (L - 1) * B, nl;
	for (ll i = 1;i < 19;i++) {
		if (d10 > ft) {
			nl = (min(d10 - 1, lt) - ft) / B;

			vv H = {
				{d10 % M, B % M, ft % M},
				{0,1,1},
				{0,0,1}
			};

			vv G = matpow(H, nl);

			mans[i] = (G[0][0] * (ft % M) + G[0][1] + G[0][2]) % M;
			kr[i] = modpow(d10 % M, nl + 1);

			ft += (nl + 1) * B;
		}
		if (d10 > lt)break;
		d10 *= 10;
	}
	
	for (int i = 19;i > 0;i--) {
		kr[i - 1] *= kr[i];
		kr[i - 1] %= M;
	}
	ll fans = 0;
	for (ll i = 1;i < 19;i++) {
		fans += kr[i + 1] * mans[i];
		fans %= M;
	}
	cout << fans << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main()  {
	var cards, gate int

	fmt.Scan(&cards, &gate)

	s := 1
	e := math.MaxInt64

	for i := 0; i < gate; i++ {
		var ss, ee int
		fmt.Scan(&ss, &ee)

		if s < ss {
			s = ss
		}

		if ee < e {
			e = ee
		}


		if s > e {
			fmt.Println(0)
			return
		}
	}
	fmt.Println(e - s + 1)
}


Measured memory_bytes: 5504
//FA専用
#include <bits/stdc++.h>
using namespace std;
#define int long long
const long long LINF=1e18;
using ld=long double;
int a,b,c,d,e,f,k,n,m,h,w,ans,cnt;
char C;
string s,t,u;
template<typename T>
void chmax(T &a,T b){
  if(a<b)a=b;
}
template<typename T>
void chmin(T &a,T b){
  if(a>b)a=b;
}
#define L(n) for(int i=0;i<n;i++)
#define V(n) vector<int> v(n)
#define XXX cout<<ans<<endl;
void yy(bool a){
  cout<<(a?"Yes":"No")<<endl;
}
template<typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}

signed main(){
  cin>>n>>k;
  vector<int> v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  sort(v.begin(),v.end());
  int l=-LINF,r=LINF;//lが答え
  while(r-l>1){
    int mid=(r+l)>>1;
    int tmp=0;//mid以下がK個以上あればtmpは答えより大きいのでr=tmp
    for(int i=0;i<n;i++){
      if(v[i]>0){
        if(v[0]*v[i]>mid)continue;
        int ll=0,rr=n;//llはmid以下
        while(rr-ll>1){
          int m=(rr+ll)>>1;
          if(v[i]*v[m]>mid)rr=m;
          else ll=m;
        }
        tmp+=rr;
        if(v[i]*v[i]<=mid)tmp--;
      }
      if(v[i]==0){
        if(mid>=0)tmp+=n-1;
      }
      if(v[i]<0){
        if(v[n-1]*v[i]>mid)continue;
        int ll=-1,rr=n-1;//rrはmid以下
        while(rr-ll>1){
          int m=(rr+ll)>>1;
          if(v[i]*v[m]>mid)ll=m;
          else rr=m;
        }
        tmp+=n-rr;
        if(v[i]*v[i]<=mid)tmp--;
      }
    }
    if(tmp>=k*2)r=mid;
    else l=mid;
  }
  cout<<l+1<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
		#include <fstream>
		#include <string>
		#include <vector>
		#include <map>
		#include <unordered_map>
		#include <list>
		#include <set>
		#include <algorithm>
		#include <queue>
		#include <iterator>
		#include <functional>
		#include <numeric>
		#include <cmath>
		#include <stack>
		#include <limits>
		#include <ctime>

		using namespace std;

		#define ll long long
		#define sc(n) static_cast<ll>(n)
		#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

		int main() {
			IO;
		#ifdef _DEBUG
			ifstream cin("In.txt");
		#endif	
			ll n, m, k, a,b;
			cin >> n >> m >> k;
			vector<list<ll> > graph(n + 1);
			vector<ll>visited(n + 1);
			vector<ll>compsize(n + 1);
			vector<map<ll, ll> > bship(n+1);
			for (size_t i = 0; i < m; i++) {
				cin >> a >> b;
				graph[a].push_back(b);
				graph[b].push_back(a);
			}
			for (size_t i = 0; i < k; i++) {
				cin >> a >> b;
				bship[a][b] = 1;
				bship[b][a] = 1;
			}
			ll comp = 0,node;
			queue<ll>qu;
			for (int i = 1; i <= n; i++) {
				if (!visited[i]) {
					visited[i] = ++comp;
					compsize[comp]++;
					qu.push(i);
					while (qu.size()) {
						node = qu.front();
						qu.pop();
						for (auto& j : graph[node]) {
							if (!visited[j]) {
								visited[j] = comp;
								compsize[comp]++;
								qu.push(j);
							}
						}
					}
				}
			}
			for (int i = 1; i <= n; i++) {
				ll nb = (compsize[visited[i]] - 1) - graph[i].size();
				for (auto& j : bship[i]) {
					if (visited[j.first]==visited[i])
						nb--;
				}
				cout << nb << " ";
			}
			return 0;
		}

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

int main()
{
	int x; cin>>x;
	int c;
	char str[x];
	for (int i=0;i<x;i++){cin>>str[i];}
	for(int i=0;i<x;i++)
	{
		string sum="";
		for(int m=0;m<3;m++)
		{
			sum+=str[i+m];
		}
		if (sum == "ABC")
			c++;
	}
	cout<<c;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int A[200000];
int B[200000];


int deleteNmin(int n, int k)
{
	int all =  A[n-1] - A[0];
	int j = 0;
	for(int i = n-1; i>0; i--)
	{
		B[j++] = A[i] - A[i-1]; 
	}
	sort(B,B+j);
	if(k>=n)
		return 0;
	if(k>1)
		for(int i = 1; i < k; i++)
			{
			all -=B[j-i];
			}
		
	return all;
}

int main()
{
	int times;
	int n;
	int k;
	cin >> times;
	while(times--)
	{
	cin >> n>>k;
	for(int i = 0; i < n;i++)
	 	cin >> A[i];
	
	int ans = deleteNmin(n,k);
	
	cout << ans<<endl;
	}
}

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

int main()
{
    string s;
    cin >> s;
    int len = s.length();
    if(s[0] == 'A' && s[1] >= 'a' && s[1] <= 'z' && s[len - 1] >= 'a' && s[len - 1] <= 'z'){
        int count_C = 0;
        for(int i = 2; i < len - 1; i++){
            if(s[i] == 'C') count_C++;
            // upper case (except 'C')
            else if(s[i] < 'a' && s[i] > 'z') {
                cout << "WA" << endl;
                return 0;
            }
        }
        if(count_C == 1){
            cout << "AC" << endl;
            return 0;
        }
    }
    cout << "WA" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // 入力読取
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        sc.close();

        // N!の取得
        // long result = 0;
        long nNum = 1;
        long num = (int) Math.pow(10, 9) + 7;
        for (int i = N; i >= 2; i--) {
            nNum = nNum * i % num;
        }

        System.out.println(nNum);
    }
}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.nextLine(), res="";
		for(int i=0; i<s.length(); ++i)
		{
			if(s.charAt(i)=='B') res=res.substring(0, Math.max(0, res.length()-1));
			else res+=Character.toString(s.charAt(i)); 
		}
		System.out.println(res);
		sc.close();
	}

}


Measured memory_bytes: 39100
#include <bits/stdc++.h>
using namespace std;
using in6 = int64_t;
using ind = double;
using vi = vector<in6>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<in6,in6>;
using psi = pair<string,in6>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

void yes() {
  cout << "Yes";
}

void no() {
  cout << "No";
}

int main() {
  kyun;
  vi data(5);
  in6 n;
  cin >> n;
  rep(i,5) cin >> data[i];
  sort(all(data));
  in6 ans = 5;
  ans += (n+data[0]-1)/data[0];
  ans--;
  cout << ans;
  hinata;
}

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

int main() {
	string s;
	cin >> s;
	int ans = 0;
	rep(i, s.size()){
		if(s[i] == '+') ans++;
		else ans--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>

#define mod 1000000007

using namespace std;
using ll = long long;

void solve(){
    int n, k, res = 0;
    map<int, int> m;
    vector<int> x;
    cin >> n >> k;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(m.find(a[i]) == m.end()){
            m.insert(make_pair(a[i], 1));
        }else{
            m[a[i]]++;
        }
    }
    for(auto it = m.begin(); it != m.end(); it++){
        x.push_back(it->second);
    }
    sort(x.begin(), x.end());
    for(int i = 0; i < (int)m.size()-k; i++){
        res += x[i];
    }
    cout << res << endl;
}

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

Measured memory_bytes: 11516
S = str(input())

if S == "SUN":
    print("7")
elif S == "MON":
    print("6")
elif S == "TUE":
    print("5")
elif S == "WED":
    print("4")
elif S == "THU":
    print("3")
elif S == "FRI":
    print("2")
else:
    print("1")


Measured memory_bytes: 2940
// God put a smile upon your face <3

#include <bits/stdc++.h>

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb push_back

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    double rad;

    while(cin >> rad)
    {
		cout << setprecision(10) << fixed << 2.0 * acos(-1.0) * rad << "\n";
    }


}




Measured memory_bytes: 3772
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		sc.close();
		if (B == 1) {
			System.out.println(0);
			return;
		}
		int count = A;
		int tap = 1;
		while (true) {
			if (count >= B) {
				System.out.println(tap);
				return;
			}
			count += (A - 1);
			tap++;
		}
	}

}

class FScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define each(it,o) for(auto it= (o).begin(); it != (o).end(); ++ it)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define inrep int t;cin>>t; while(t--)
#define pb emplace_back
using namespace std;
using namespace __gnu_pbds; 


typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii > vpii;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pll > vpll; 
typedef vector<string> vs;
typedef long double ld;
const ll MOD = 1e9+7;
template<typename T> istream& operator>> ( istream &in,vector<T> &v ) {

    for ( unsigned   i=0; i<v.size(); i++ )
        in>>v[i];
    return in;
}

ll extended_GCD(ll a , ll b , ll &x , ll &y){
    if(a == 0){
        x = 0;
        y = 1;
        return b;
    }
    ll x1 , y1;
    ll gcd = extended_GCD(b%a , a , x1 , y1);
    x = y1 - (b/a)*x1; 
    y = x1;
    return gcd;
}
ll power(ll a, ll b, ll m = MOD) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
ll modinv(ll a , ll mod ){
    ll x , y;
    extended_GCD(a , mod , x , y);
    if(x < 0) x += mod;
    return x;
}

ll mul(ll a,ll b,ll m)
{
    return (a%m*b%m)%m;
}
  
 


int main()
{
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n+5];
    a[0] = 0;
    a[n+1] = 0;
    int pre[n+5] = {0};
    int suff[n+5] = {0};
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        pre[i] = pre[i-1]^a[i];
    }
    for(int i=n;i>=1;i--)
    {
        suff[i] = suff[i+1]^a[i];
    }
    for(int i=1;i<=n;i++)
    {
        cout<<(pre[i-1]^suff[i+1])<<" ";
    }
    
    
    return 0;
}

Measured memory_bytes: 5880
import heapq
N,M = map(int,input().split())
edge = [[[] for i in range(N)] for j in range(3)]

for i in range(M):
	u,v = map(int,input().split())
	u -= 1
	v -= 1
	edge[0][u].append(v)
	edge[1][u].append(v)
	edge[2][u].append(v)
S,T = map(int,input().split())
S -= 1
T -= 1
INF = 10**10
dist = [[0 if i == S and j == 0 else INF for i in range(N)] for j in range(3)]
search = []
searched = [[False for i in range(N)] for j in range(3)]
heapq.heapify(search)
heapq.heappush(search, (0, 0, S))
while len(search) > 0 and dist[0][T] == INF:
	x = heapq.heappop(search)
	d, t, node = x[0], x[1], x[2]
	if searched[t][node]:
		continue
	searched[t][node] = True
	dist[t][node] = d
	for i in edge[t][node]:
		if not searched[(t+1)%3][i]:
			heapq.heappush(search, (d+(t+1)//3, (t+1) % 3, i))
if dist[0][T] < INF:
	print(dist[0][T])
else:
	print(-1)

Measured memory_bytes: 56032
s = input()
t = input()
n, m = len(s), len(t)

ans = 0
for i in range(n - m + 1):
    match = 0
    for j in range(m):
        if s[i + j] == t[j]:
            match += 1
    ans = max(ans, match)

print(m - ans)


Measured memory_bytes: 9048
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define _GLIBCXX_DEBUG
int main()
{
    int n;
    cin>>n;
    vin v(n),c(n),d(n);
    rep(i,n)cin>>v[i];
    rep(i,n)cin>>c[i];
    rep(i,n)d[i]=v[i]-c[i];
    sort(d.begin(),d.end(),greater<int>());
    int j=0;
    int sum=0;
    while(d[j]>0){
        sum+=d[j];
        j++;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
S = input()
N = len(S)
if N%2==0:
    C1 = "10" * (N//2)
    C2 = "01" * (N//2)
else:
    C1 = "10" * (N//2) + "1"
    C2 = "01" * (N//2) + "0"

count1 = 0
count2 = 0
for i in range(N):
    char = S[i]
    if char != C1[i]:
        count1 += 1
    elif char != C2[i]:
        count2 += 1
print(min(count1,count2))

Measured memory_bytes: 3316
#define CPP17
#include <limits>
#include <initializer_list>
#include <utility>
#include <bitset>
#include <tuple>
#include <type_traits>
#include <functional>
#include <string>
#include <array>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
#include <complex>
#include <random>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <regex>
#include <cassert>
#include <cstddef>
#ifdef CPP17
#include <variant>
#endif

// Yay!!
#define endl codeforces

// macros for iterator
#define ALL(v) std::begin(v), std::end(v)
#define ALLR(v) std::rbegin(v), std::rend(v)

// alias
using ll = std::int64_t;
using ull = std::uint64_t;
using pii = std::pair<int, int>;
using tii = std::tuple<int, int, int>;
using pll = std::pair<ll, ll>;
using tll = std::tuple<ll, ll, ll>;
template <typename T> using vec = std::vector<T>;
template <typename T> using vvec = vec<vec<T>>;

// variadic min/max
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }

// variadic chmin/chmax
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }

// multi demension array
template <typename T, std::size_t Head, std::size_t... Tail> struct multi_dim_array { using type = std::array<typename multi_dim_array<T, Tail...>::type, Head>; };
template <typename T, std::size_t Head> struct multi_dim_array<T, Head> { using type = std::array<T, Head>; };
template <typename T, std::size_t... Args> using mdarray = typename multi_dim_array<T, Args...>::type;

#ifdef CPP17
// fill container
template <typename T, typename F, typename... Args> 
void fill_seq(T &t, F f, Args... args) { if constexpr (std::is_invocable<F, Args...>::value) { t = f(args...); } else { for (ssize_t i = 0; i < t.size(); i++) fill_seq(t[i], f, args..., i); } }
#endif

// make multi dimension vector
template <typename T> vec<T> make_v(ssize_t sz) { return vec<T>(sz); }
template <typename T, typename... Tail> auto make_v(ssize_t hs, Tail&&... ts) { auto v = std::move(make_v<T>(std::forward<Tail>(ts)...)); return vec<decltype(v)>(hs, v); }

// init
namespace init__ { 
struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; 
}


int main() {
    ll x;
    std::cin >> x;
    std::cout << x * 360 / std::gcd(x, 360) / x << "\n";
    return 0;
}


Measured memory_bytes: 3632
A,B,C = map(int, input ().split ())
X = A%B
if X == C:
  print ('YES')
else:
  i = 2
  while True:
    x = (i*A)%B
    if x == C:
      print ('YES')
      break
    elif x == X:
      print ('NO')
      break
    i += 1

Measured memory_bytes: 9180
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		final int mod = 2019;
		int slength = s.length;
		long[] a = new long[slength];
		for(int i = 0 ; i < slength ; i++) {
			a[i] = (pow(10, i, mod) * Character.getNumericValue(s[slength - i - 1])) % mod;
			}
		int[] sum = new int[slength];
		int[] count = new int[mod];
		for(int i = 0 ; i < slength ; i++) {
			if(i == 0)
				sum[i] = (int) (a[i] % mod);
			else
				sum[i] = (int) ((sum[i - 1] + a[i]) % mod);
			count[sum[i]]++;
		}
		long num = 0;
		for(int i = 0 ; i < mod ; i++) {
			if(i != 0 && count[i] != 0)
			num += count[i] * (count[i] - 1) / 2;
			else if(i == 0 && count[i] != 0)
				num += count[i] * (count[i] + 1) / 2;
		}
		System.out.print(num);






	}

	public static int nCk(int n,int k,int M) {
        long ret = 1;
        int min = Math.min(k, n-k);
        for(int i=1;i<=min;i++) {
            ret = (ret * pow(i,M-2,M)) % M;
        }
        for(int i=n-min+1;i<=n;i++) {
            ret = (ret * i) % M;
        }
        return (int)ret;
    }

    //return a^b mod M O(logB)
    public static long pow(long a,long b,int M) {
        long ret = 1;
        long tmp = a;
        while(b>0) {
            if((b&1)==1) ret = (ret * tmp) % M;  //2進数によるべき乗の高速計算
            tmp = (tmp * tmp) % M;
            b = b>>1;
        }
        return ret;
    }


}



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

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

     int min_ = 1000;
    int max_ = 0;
    int a;

     for (int i = 0; i < n; i++) {
        cin >> a;
        min_ = min(a, min_);
        max_ = max(a, max_);
    }

     cout << max_ - min_ << endl;

     return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
A=list(map(int,input().split()))
data=[0 for i in range(0,41)]
for i in range(0,N):
    for j in range(0,41):
        data[j]+=(A[i]>>j)&1
X=0
flag=1
for i in range(0,41):
    if flag==0:
        if N-data[40-i]>=data[40-i]:
            X+=2**(40-i)
    else:
        test=K>>(40-i) &1
        if test==1:
            if N-data[40-i]>=data[40-i]:
                X+=2**(40-i)
            else:
                flag=0

print(sum(X^A[i] for i in range(0,N)))


Measured memory_bytes: 69136
#include <cstdio>
const int MAXN = 1e5+5;
int out[MAXN];
int A, N;

int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &A);
    out[A] = i;
  }
  for (int i = 1; i <= N; ++i) {
    printf("%d ", out[i]);
  }
  putchar('\n');
  return 0;
}

Measured memory_bytes: 1152
ABCD = input()


def dfs(total=0, level=0, ans=0):
    level += 1
    if level >= 4:
        if total == 7:
            return ans
        return -1
    plus_ans = dfs(total + int(ABCD[level]), level, ans + (1 << (level - 1)))
    if plus_ans >= 0:
        return plus_ans
    minus_ans = dfs(total - int(ABCD[level]), level, ans)
    if minus_ans:
        return minus_ans
    return -1


ans = dfs(int(ABCD[0]), 0, 0)
op1 = "+" if ans & 1 != 0 else "-"
op2 = "+" if ans & (1 << 1) != 0 else "-"
op3 = "+" if ans & (1 << 2) != 0 else "-"
print(ABCD[0] + op1 + ABCD[1] + op2 + ABCD[2] + op3 + ABCD[3] + "=7")


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

#define oo (1L<<62)
#define ll long long int

int N;
int K;
int h[100005];
ll memo[100005];
char vis[100005];

ll elJoshua(int n){
	if(n < 0) return oo;
	if(!n) return 0;
	if(vis[n]) return memo[n];
	vis[n] = 1;
	ll mini = oo;
    for(int i = 1; i<=K; i++)
        if(n>=i)
            mini = min(abs(h[n]-h[n-i])+elJoshua(n-i), mini);
    return memo[n] = mini;
}   

int main() {
	cin>>N>>K;
	for(int i = 0; i<N;i++)
		cin>>h[i];
	cout<<elJoshua(N-1)<<"\n";
	return 0;
}

Measured memory_bytes: 11100
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
l = l1 + l2 + l3
n = int(input())

bl = [int(input()) for _ in range(n)]

for i in range(len(l)):
    for j in bl:
        if l[i] == j:
            l[i] = 0
rowwise = 1 if (sum(l[0:3]) == 0) | (sum(l[3:6]) == 0)  | (sum(l[6:]) == 0) else 0
colwise = 1 if (sum([l[0], l[3], l[6]]) == 0) | (sum([l[1], l[4], l[7]]) == 0)  | (sum([l[2], l[5], l[8]]) == 0) else 0
crosswise = 1 if (sum([l[0], l[4], l[8]]) == 0) | (sum([l[2], l[4], l[6]]) == 0) else 0

print("Yes" if sum([rowwise, colwise, crosswise]) else "No")

Measured memory_bytes: 9232
using System;

namespace ITP1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int m = int.Parse(input[1]);
            int[,] A = new int[n, m];
            int[] b = new int[m];

            for (int i = 0; i < n; i++)
            {
                string[] data = Console.ReadLine().Split(' ');
                for (int k = 0; k < m; k++)
                {
                    A[i, k] = int.Parse(data[k]);
                }
                
            }
            for (int i = 0; i < m; i++)
            {
                b[i] = int.Parse(Console.ReadLine());
            }
            
            for (int i = 0; i < n; i++)
            {
                int c = 0;
                for (int k = 0; k < m; k++)
                {
                    c += A[i, k] * b[k];
                }
                Console.WriteLine(c);
            }

        } 

    }
}

Measured memory_bytes: 9348
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod = 1000000007;
struct mint{
	ll x;
	mint(ll x = 0):x((x%mod+mod)%mod){}
	mint operator-() const{return mint(-x);}
	mint& operator+=(const mint a){
		if((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a){
		if((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a){
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const{
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const{
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const{
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const{
		if(!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if(t&1) a *= *this;
		return a;
	}
	mint inv() const{
		return pow(mod-2);
	}
	mint& operator/=(const mint a){
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const{
		mint res(*this);
		return res/=a;
	}
};

//istream& operator>>(istream& is, const mint& a){return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a){return os << a.x;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	mint m;
	ll n;
	cin >> m.x >> n;
	mint ans = m.pow(n);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3232
#include <stdio.h>
#define MAX 10000
#define NIL -1

struct Node { int parent ,left ,right;};

struct Node T[MAX];
int n , D[MAX] , H[MAX];

void setDepth(int u , int d)
{
	if( u == NIL)
	{
		return;
	}
	D[u] = d;
	setDepth(T[u].left,d+1);
	setDepth(T[u].right,d+1);
}

int setHeight(int u)
{
	int h1 = 0 , h2 = 0;
	if(T[u].left != NIL)
	{
		h1 = setHeight(T[u].left)+1;
	}
	if(T[u].right != NIL)
	{
		h2 = setHeight(T[u].right)+1;
	}
	return H[u] = (h1 > h2 ? h1 : h2);
}

int getSibling(int u)
{
	if( T[u].parent == NIL) 
	{
		return NIL;
	}
	if(T[T[u].parent].left != u && T[T[u].parent].left != NIL)
	{
		return T[T[u].parent].left;
	}
	if(T[T[u].parent].right!=u && T[T[u].parent].right!= NIL)
	{
		return T[T[u].parent].right;
	}
	return NIL;
}

void print(int u)
{
	printf("node %d: ",u);
	printf("parent = %d, ",T[u].parent);
	printf("sibling = %d, ",getSibling(u));
	int deg = 0;
	if(T[u].left != NIL) 
	{
		deg++;
	}
	if(T[u].right != NIL) 
	{
		deg++;
	}
	printf("degree = %d, ",deg);
	printf("depth = %d, ",D[u]);
	printf("height = %d, ",H[u]);
	
	if(T[u].parent == NIL)
	{
		printf("root\n");
	}
	else if(T[u].left == NIL && T[u].right == NIL)
	{
		printf("leaf\n");
	}
	else{
		printf("internal node\n");
	}
}

int main()
{
	int v , l , r , root = 0;
	scanf("%d",&n);
	
	for( int i = 0;i < n; i++) 
	{
		T[i].parent = NIL;
	}
	
	for( int i = 0; i < n; i++)
	{
		scanf("%d %d %d",&v,&l,&r);
		T[v].left = l;
		T[v].right = r;
		if(l != NIL) 
		{
			T[l].parent = v;
		}
		if(r != NIL) 
		{
			T[r].parent = v;
		}
	}
	
	for( int i = 0; i < n; i++) 
	{
		if(T[i].parent == NIL) 
		{
			root = i;
		}
	}
	
	setDepth(root,0);
	setHeight(root);
	
	for(int i = 0; i < n; i++) 
	{
		print(i);
	}

	return 0;
}





Measured memory_bytes: 2104
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <iomanip>
#include <tuple>
using namespace std;
typedef long long LL;
typedef double T;
typedef pair<T,T> P;

// difference
P operator-(const P& lhs, const P& rhs)
{
	return P(lhs.first-rhs.first,lhs.second-rhs.second);
}

P operator+(const P& lhs, const P& rhs)
{
	return P(lhs.first+rhs.first, lhs.second+rhs.second);
}

// scalar product
P operator*(T t, P p){
	return P(t*p.first,t*p.second);
}

// cross product
T Cross(const P& lhs, const P& rhs)
{
	return lhs.first*rhs.second-lhs.second*rhs.first;
}

// inner product 
T Dot(const P& lhs, const P& rhs)
{
	return lhs.first*rhs.first+lhs.second*rhs.second;
}

// square of distance
T Dist2(const P& lhs, const P& rhs){
	return Dot(lhs-rhs,lhs-rhs);
}

// intersection of line
bool IntersectParam(P s0, P e0, P s1, P e1, T& t0, T& t1)
{
	P a=s1-s0;
	P v=e0-s0;
	P w=s1-e1;
	T det=Cross(v,w);
	if(det == 0){
		return false;
	}
	t0=Cross(a,w)/det;
	t1=Cross(v,a)/det;
	return true;
}


P Interpolate(P s, P e, T t)
{
	return (1-t)*s+t*e;
}

int N;
P p0[100];
P p1[100];
void exec()
{
	cin >> N;
	if(N==0)exit(0);
	int ret=1;
	for(int i=0;i<N;i++){
		cin >> p0[i].first >> p0[i].second >> p1[i].first >> p1[i].second;
		ret++;
		vector<P> ps;
		for(int j=0;j<i;j++){
			double t0,t1;
			if(IntersectParam(p0[i],p1[i],p0[j],p1[j],t0,t1))
			{
				if(0<t0&&t0<1){
					P p=Interpolate(p0[i],p1[i],t0);
					bool ng=false;
					for(auto q:ps){
						if(Dist2(p,q)<1e-20){
							ng=true;
							break;
						}
					}
					if(!ng){
						ps.push_back(p);
						ret++;
					}
				}
			}
		}
	}
	cout << ret << endl;
}
int main() {
	while(1)exec();
}

Measured memory_bytes: 1248
#include <iostream>

using namespace std;

typedef long long ll;

int main(void)
{
    int K;

    cin >> K;

    int a = 7;
    int i = 1;
    if (a % K == 0) {
        cout << 1 << endl;
        return 0;
    }
    for (i = 1; i < K; i++) {
        a = (10 % K) * (a % K) + (7 % K);
        if (a % K == 0) {
            break;
        }
    }
    if (i == K) {
        cout << -1 << endl;
    } else {
        cout << i + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3640
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<utility>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
#include<string>
#include<cctype>
#include<cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef queue<int> qi;
typedef queue<ll> ql;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define pq priority_queue
#define rep(i,n) for (int i=0;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define INF 200000009
#define init(x) memset(x,0,sizeof(x))
int n;
int m1,m2;
pii a[200005];
int id[200005];
int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    for (int i=1;i<=n;++i){
    	cin>>a[i].F;
    	a[i].S=i;
	}
	sort(a+1,a+n+1);
	reverse(a+1,a+n+1);
	for (int i=1;i<=n;++i) id[a[i].S]=i;
	m1=a[n/2].F;m2=a[n/2+1].F;
	for (int i=1;i<=n;++i){
		if (id[i]<=n/2) cout<<m2<<endl;
		else if (id[i]>=n/2+1) cout<<m1<<endl;
	}
    return 0; 
}

Measured memory_bytes: 4608
// Author - Saikat_7
#include <bits/stdc++.h> 
using namespace std;
#define fl(i,a,b) for(int i=a;i<b;i++)
#define trav(i,cont) for(const auto& i:cont)
#define cs(x) cout<<x<<" "
#define cn(x) cout<<x<<" "<<endl
#define ll long long int
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007 //998244353 
#define inf 1e17
const int mx = 2000005; // 2* (10 to power 5);
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    int tc=1;
    // cin>>tc;
    while(tc-- > 0)
    {	ll n,w;
    	cin>>n>>w;
    	ll wi[n+1],vi[n+1];
    	for(int i=1;i<=n;i++)
    	{
    		cin>>wi[i]>>vi[i];
    	}     
       	ll dp[n+1][w+1]={0};
    	for(int i=0;i<=n;i++)
    	{
    		for(int j=0;j<=w;j++)
    		{	
    			if(i==0|| j==0)
    			{
    				dp[i][j]=0;
    			}
    			else if(j<wi[i])
    			dp[i][j]=dp[i-1][j];
    				// cout<<dp[i][j]<<" ";}
    			else 
    				dp[i][j]=max(dp[i-1][j],dp[i-1][j-wi[i]]+vi[i]);
    		// 	cout<<dp[i-1][j]<<i-1<<" " <<j<<" "<<endl;
    		// 	cout<<dp[i-1][j-wi[i]]+vi[i]<<endl;
    		 }
    
    	}
    	cout<<dp[n][w];
    }
    return 0;
}

Measured memory_bytes: 79104
#include<cstdio>
#include<map>
#include<cstring>;
#include<string>
using namespace std;
int n,m,l;
bool b;
char aa[101][101] ;
map <string,int> mp;
int main(){
	b=true;
	scanf("%d",&n);
	for(m=1;m<=n;m++){
		scanf("%s",aa[m]);
	//	printf("%d\n",l);
		if(m>1){
			if(aa[m-1][l-1] !=aa[m][0]){
			//	printf("dfsg\n");
			//	printf("%c %c\n",aa[m-1][l],aa[m][1]);
			b=false;
			}
		}
		l=strlen(aa[m]);
		mp[aa[m]]++;
		if(mp[aa[m]] != 1){
		 b=false;
		 //	printf("dfg\n");
		 }
		 
	}
	if(!b)
	printf("No\n");
	else
	printf("Yes\n");
}




Measured memory_bytes: 256
def main():
    n = int(input())
    a, b = 1, 1
    ceil = lambda x, y: -(-x // y)
    for _ in range(n):
        c, d = list(map(int, input().split()))
        r = max(ceil(a, c), ceil(b, d))
        a = c * r
        b = d * r
    print(a + b)

if __name__ == '__main__':
    main()


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

int main() {
  
  int N=0;
  
  cin >> N;
  
  if(N%2==0) {
    
    cout << N << endl;
    
  } else if(N%2!=0) {
    
    cout << 2*N << endl;
    
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <queue>
#define N 200005
using namespace std;

struct st{
	int x, y, l, r;
} t;
int n, a[N], d[N][20];
priority_queue<st> qu;

bool operator < (st p, st q) {
	return a[p.x] > a[q.x];
}

int mn(int p, int q) {
	return a[p] < a[q] ? p : q;
}

int f(int p, int q) {
	int i;
	if (p > q) return p;
	for (i = 1; 1 << i <= q - p + 1; i++);
	i--;
	return mn(d[p][i], d[q - (1 << i) + 1][i]);
}

void add(int p, int q) {
	int x, y;
	if (p > q) return;
	x = f(p, q);
	y = mn(f(x + 1, q - 1), q);
	qu.push({x, y, p, q});
}

int main()
{
	int i, j, k;
	cin >> n;
	for (i = 0; i < n; i++) scanf("%d", &a[i]), d[i][1] = i;
	for (j = 2; 1 << j <= n; j++) {
		k = 1 << j;
		for (i = 0; i + k <= n; i++) {
			d[i][j] = mn(d[i][j - 1], d[i + k / 2][j - 1]);
		}
	}
	add(0, n - 1);
	while (!qu.empty()) {
		t = qu.top(), qu.pop();
		printf("%d %d ", a[t.x], a[t.y]);
		add(t.l, t.x - 1);
		add(t.x + 1, t.y - 1);
		add(t.y + 1, t.r);
	}
    return 0;
}

Measured memory_bytes: 18680
#include<iostream>
#include<set>
#include<vector>
#include<string>

using namespace std;

int N;

int main() {
	cin >> N;
	int ans = 0;
	set<string> tree;
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;
		if (tree.find(s) == tree.end()) {
			ans++;
			tree.insert(s);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 19260
using System;
using System.Collections.Generic;
using System.Linq;
using static Scanner;

class Program
{
    static void Main() => new Program().Solve();

    public void Solve()
    {
        int h = ReadInt();
        int w = ReadInt();
        int m = ReadInt();
        var bombs = new HashSet<(int, int)>();
        var hbombs = new Dictionary<int, int>();
        var wbombs = new Dictionary<int, int>();
        for (int i = 0; i < m; i++)
        {
            int hh = ReadInt() - 1;
            int ww = ReadInt() - 1;
            bombs.Add((hh, ww));
            if (hbombs.ContainsKey(hh)) hbombs[hh]++; else hbombs[hh] = 1;
            if (wbombs.ContainsKey(ww)) wbombs[ww]++; else wbombs[ww] = 1;
        }
        var hl = new List<int>();
        int hm = 0;
        foreach (var (key, value) in hbombs)
        {
            if (hm < value) { hl.Clear(); hm = value; }
            if (hm <= value) hl.Add(key);
        }
        var wl = new List<int>();
        int wm = 0;
        foreach (var (key, value) in wbombs)
        {
            if (wm < value) { wl.Clear(); wm = value; }
            if (wm <= value) wl.Add(key);
        }
        bool a = (from hi in hl from wi in wl select bombs.Contains((hi, wi))).All(x => x);
        int max = hm + wm - (a ? 1 : 0);
        Console.WriteLine(max);
    }
}

static class Scanner
{
    static Queue<string> que = new Queue<string>();
    public static string Read() { if (!que.Any()) foreach (var s in Console.ReadLine().Split()) que.Enqueue(s); return que.Dequeue(); }
    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());
    public static decimal ReadDecimal() => decimal.Parse(Read());
    public static IEnumerable<string> Read(long n) { for (long i = 0; i < n; i++) yield return Read(); }
    public static IEnumerable<int> ReadInt(long n) => Read(n).Select(int.Parse);
    public static IEnumerable<long> ReadLong(long n) => Read(n).Select(long.Parse);
    public static IEnumerable<double> ReadDouble(long n) => Read(n).Select(double.Parse);
    public static IEnumerable<decimal> ReadDecimal(long n) => Read(n).Select(decimal.Parse);
}


Measured memory_bytes: 75712
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i )
typedef std::pair<int,int> pint;

using namespace std;
typedef long long ll;

int main(){
    int K; cin >> K;
    int N; cin >> N;
    vector<int> list;
    int max = 0;
    rep (i,N){
        int tmp;
        cin >> tmp;
        list.push_back(tmp);
    }
    rep (i,N-1){
        int tmp;
        tmp = list[i + 1] - list[i];
        if (tmp > max){
            max = tmp;
        }
    }
    int last = (K - list[N - 1]) + list[0];
    if (last > max){
        max = last;
    }
    cout << K - max << endl;
    return 0;
}

Measured memory_bytes: 4308