akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define ppll pair<ll,pll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = 1 << 29;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const int MAX_V = 500;
// const ll mod = 998244353;
const ll MAX = 2100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
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; }




void solve() {
    string s;
    cin>>s;
    ll n=s.size();
    if(s[n-1]=='s')cout<<s<<"es"<<endl;
    else cout<<s<<"s"<<endl;
}




signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);


    ll t=1;
    
    // cin>>t;

    rep(i,t){
        solve(); 
    }

    return 0;
}


Measured memory_bytes: 3664
#pragma GCC optimize ("O2")
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-label"
#pragma GCC diagnostic ignored "-Wsign-compare"

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

#define trav(a, A) for (auto & a : A)
#define f first
#define s second

typedef long long ll;

const ll MOD = 1e+9+7;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const ll MAXN = 1e+5+7;

int main ()
{
	ios_base::sync_with_stdio (0);
	cin.tie (0);
	int tc = 1; //cin >> tc;
	while (tc--)
	{
		ll i, j, n, p;
		string s;
		cin >> n >> p >> s;
		vector <ll> dp (p, 0);
		ll sum = 0, ans = 0, pot = 1;
		if (p == 2 || p == 5)
		{
			for (i = 0; i < s.size (); ++i)
				if ((s[i] - '0')%p == 0) ans += i + 1;
		}
		else
		{
			for (i = s.size () - 1; i >= 0; --i)
			{
				sum = (sum + pot*(ll)(s[i] - '0')) % p;
				if (sum == 0) ++ans;
				ans += dp[sum]++;
				pot = pot*10LL%p;
			}
		}
		cout << ans << '\n';
	}

	return 0;
}



Measured memory_bytes: 720
n = map(int,input().split())
data = list(map(int,input().split()))
res = 0
data.append(0)
while(max(data)!=0):
    pre_zero = -1
    for idx in range(len(data)):
        if(data[idx] == 0):
            if(idx == pre_zero+1):
                pre_zero = idx
                continue
            min_value = min(data[pre_zero+1:idx])
            for x in range(pre_zero+1,idx):
                data[x] -= min_value
            res += min_value
            pre_zero = idx
print(res)


Measured memory_bytes: 3188
d, n = map(int, input().split())

if d == 0:
    if n < 100:
        print(n)
    else:
        print(101)
elif d == 1:
    if n < 100:
        print(100 * n)
    else:
        print(10100)
else:
    if n < 100:
        print(10000 * n)
    else:
        print(1010000)

Measured memory_bytes: 3064
#include <stdio.h>
int main(void)
{
  int N,i,j;
  scanf("%d",&N);
  int P[N],Q[N];
  int total_P = 0,total_Q = 0;
  int NK ;
  int ketaCount_P[N]; 
  int ketaCount_Q[N]; 

  NK = KAIJYO(N);
//  printf("aaaa%d\n",NK);

//  printf("debug11 %d\n",N);

  for(i=0;i<N;i++)
  {
    scanf("%d ",&P[i]);
  }

  for(i=0;i<N;i++)
  {
    scanf("%d ",&Q[i]);
  }


  for(i=0;i<N;i++)
  {
//   printf("qqqq %d ",P[i]);
 //  printf("%d ",Q[i]);
  }
  for(i=0;i<N-1;i++) 
   {
   ketaCount_P[i] = 0;
   ketaCount_Q[i] = 0;

   for(j=i+1;j<N;j++)
    {

      if(P[i]>P[j]) ketaCount_P[i]++;
      if(Q[i]>Q[j]) ketaCount_Q[i]++;
    }
   total_P += ketaCount_P[i]*KAIJYO(N-i-1);
   total_Q += ketaCount_Q[i]*KAIJYO(N-i-1);
   }


 // printf("aaa%d  %d\n",total_P,total_Q);
  printf("%d\n",abs(total_P-total_Q));

  return 0;
}

int KAIJYO(int N)
{
 int i=1;
 int count =1;
 for(i=1;i<=N;i++)
 {
  count = count * i;
//  printf("bbb%d\n",count);
}

 return count; 
}


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

using namespace std;

int main()
{
    long long int a,b,c,d;
    cin>>a>>b;
    long long int ab,cd;
    if(a<=b)
    {
        ab=a;
    }
    else
        ab=b;

    cin>>c>>d;
    if(c<=d)
    {
        cd=c;
    }
    else
        cd=d;

    cout<<ab+cd<<endl;
    return 0;
}


Measured memory_bytes: 256
n, m  = map(int, input().split())
arr = [list(map(int,input().split())) for i in range(m)]
arr.sort()
def check(sc):
    for i in range(len(sc)-1):
        if sc[i][0]==sc[i+1][0] and sc[i][1]!=sc[i+1][1]:
            return 'No'
ans = [10]*n

for i in arr:
    ans[i[0]-1] = i[1]

#scにはans入れる
def check0(sc,n):
    if n>=2:
        if sc[0] == 0:
            return 'No'

if check(arr)=='No' or check0(ans,n)=='No':
    print(-1)
else:
    if n ==1:
        if ans[0]==10:
            ans[0]=0
    if n ==2:
        if ans[0]==10:
            ans[0]=1
        if ans[1]==10:
            ans[1]=0
    if n == 3:
        if ans[0]==10:
            ans[0]=1
        if ans[1]==10:
            ans[1]=0
        if ans[2]==10:
            ans[2]=0
    moji = map(str,ans)
    mojiretu = ''.join(moji)
    print(mojiretu)

Measured memory_bytes: 38384
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
using namespace std;

bool is_prime[100000000 + 1];// Up to 1e8 + 1
vi Eratosthenes(const int N){ // return primes up to N
	vector<int> P;
	for (int i = 0; i <= N; i++)
	{
		is_prime[i] = true;
	}
	for (int i = 2; i <= N; i++)
	{
		if (is_prime[i])
		{
			for (int j = 2 * i; j <= N; j += i)
			{
				is_prime[j] = false;
			}
			P.emplace_back(i);
		}
	}
	return P;
}

/*
You will need
vector<int> Erast = Eratosthenes(1000003); //Max is 1e6+3
int length = Erast.size();
*/

int main(){
  ll N,P; cin >> N >> P;
  vi Erast = Eratosthenes(1000004);
  int length = Erast.size();

  if(N == 1){
    cout << P << endl;
  }else{
    // N > 1
    ll ans = 1;
    for(int i = 0; i < length; i++){
      if(P % Erast[i] == 0){
        int cnt = 0;
        while(P % Erast[i] == 0){
          P /= Erast[i];
          cnt++;
          if(cnt >= N){
            ans *= Erast[i];
            cnt = 0;
          }
        }
      }
    }

    cout << ans << endl;
  }

}


Measured memory_bytes: 1916
#include <stdio.h>
#include <string.h>
int main()
{
	char s[1000000];
	int i, j, p = 0, a, k;
	gets(s);
	a = strlen(s);
	for (i = 0; i < a ; i++)
	{
		p = p + (s[i] - '0');
		p = p % 9;
	}
	if (p % 9 == 0)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 1692
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define llu unsigned long long int
#define sa(a,n,t) for(int ii=0;ii<n;ii++) scanf("%"#t"",&(a)[ii])
#define rep(i,n) for(int i=0;i<n;i++) 
#define reps(i,a,n) for(int i=a;i<n;i++) 
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rreps(i,a,n) for(int i=n-1;i>=a;i--)
#define validl(i,a,b) ((i>=a)&&(i<=b))?1:0
#define validmat(x,y,a,b,c,d) (validl(x,a,b) && validl(y,a,b))?1:0
#define validmn(x,y,m,n) validmat(x,y,0,m,0,n)
#define valid(i,n) validl(i,0,n)
#define v(t) vector<t>
#define vv(t) vector<vector<t> >
#define mk make_pair
#define pb push_back
#define pa(a,n,t)  for(int i=0;i<n;i++) printf("%"#t"",a[i])
#define p2 pair<int,int>
#define p3 pair<p2,int>
#define fi first
#define se second
#define sd(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld",a)
#define pd(a) printf("%d",a)
#define sf(a) scanf("%lf",&a)
#define pf(a) printf("%lf",a)
#define nline printf("\n")
#define ss(a) scanf("%s",a)
#define ps(a) printf("%s",a)
#define sc(a) scanf("%c",&a)
#define pc(a) printf("%c",&a)
#define mf(m,f) m.find(f)!=m.end()
#define pp3(m) cout<<m.fi.fi<<" "<<m.fi.se<<" "<<m.se<<" "
#define pp2(m) cout<<m.fi<<" "<<m.se<<" "
#define debug 0
/*v(int) adj[200001];
void dfs(int i,int p){
    rep(j,adj[i].size()){
        if(p!=adj[i][j])
            dfs(adj[i][j],i);
    }
}*/
int main()
{
  int t;
  cin>>t;
  cout<<t+t*t+t*t*t<<endl;
  return 0;
}


Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int lengths[] = new int[n];
        for(int i = 0; i < lengths.length; i++) {
            lengths[i] = scan.nextInt();
        }
        int longestID, othersSum;

        longestID = 0;
        for(int i = 1; i < lengths.length; i++) {
            if(lengths[i] >= lengths[longestID]) {
                longestID = i;
            }
        }

        othersSum = 0;
        for(int i = 0; i < lengths.length; i++) {
            if(i != longestID) {
                othersSum += lengths[i];
            }
        }

        if(lengths[longestID] < othersSum) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        scan.close();
        return;
    }
}

Measured memory_bytes: 35860
N,M,C = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
total = 0
lst = []
for i in range(N):
  A = list(map(int,input().split()))
  for j in range(M):
    total += A[j]*B[j]
  lst.append(total)
  total = 0
for i in lst:
    if i +C > 0:
      ans += 1
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<set>
#include <math.h>
#include <string>
#define cinf(n,x,y) for(int i=0;i<(n);i++) cin >> x[i]>>y[i];
typedef long long int ll;
const ll INF =1LL << 62;
using namespace std;
int MAX_E=1000010;
ll dp[1000010];
void split(string s, vector<string> &v){
	v.clear();
	s +='"';
	string str="";
	for(int i=0;i<s.size();i++){
		if(s[i]=='"'){
			v.push_back(str);
			str="";
		}
		else{
			str+=s[i];
		}
	}
}
int main(){
	while(1){
		string s1,s2; cin >>s1;
		if(s1==".")break;
		cin >> s2;
		if(s1==s2){
			cout << "IDENTICAL"<< endl;
		}
		else{
			vector<string> v1,v2;
			split(s1,v1);
			split(s2,v2);
			if(v1.size()!=v2.size()){
				cout << "DIFFERENT" << endl;
			}
			else{
				bool a=false;
				int cnt=0;
				for(int i=0;i<v1.size();i++){
					if(i%2==0){
						if(v1[i]!=v2[i])a=true;
					}
					else{
						if(v1[i]!=v2[i])cnt++;
					}
				}
				if(a){
					cout << "DIFFERENT" << endl;
				}
				else if(cnt>1){
					cout << "DIFFERENT" << endl;
				}
				else{
					cout << "CLOSE" << endl;
				}
			}
		}
	}
}


Measured memory_bytes: 3228
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール

// Union-Find モジュール
struct union_find {
    vector<ull> par;
    vector<ull> num;
    union_find(ull n) : par(n, 0), num(n, 1) { iota(ALL_OF(par), 0); }
    ull root(ull i) { return par[i] == i ? i : (par[i] = root(par[i])); }
    bool same(ull i, ull j) { return root(i) == root(j); }
    void unite(ull i, ull j) {
        ull ri = root(i);
        ull rj = root(j);
        if (ri != rj) {
            if (num[ri] > num[rj]) swap(ri, rj);
            par[ri] = rj;
            num[rj] += num[ri];
        }
    }
};

// 処理内容
int main() {
    
    // インタラクティブ問題では除去した方がいいかも
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n, m; cin >> n >> m;
    union_find u(n+m);
    REP(i, n) {
        ll ki; cin >> ki;
        REP(j, ki) {
            ll lij; cin >> lij; lij--;
            u.unite(i, n+lij);
        }
    }

    bool ans = true;
    REP(i, n) {
        if (!u.same(0, i)) {
            ans = false;
            break;
        }
    }
    cout << YES(ans) << endl;
    
}

Measured memory_bytes: 3456
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <regex>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End


/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template


signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    // 複利小数点以下切り捨て
    int count = 0;
    long long money = 100,target;
    cin >> target;
    while(money<target) money *= 1.01,count++;
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3164
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<map>
#include<ctime>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<bitset>
#define ll long long 
#define ull unsigned long long 
#define mem(a) memset(a,0,sizeof(a)) 
#define fio ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define EXIT exit(0)
#define all(a) (a).begin(),(a).end()
//loop 
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define cFor(i,a,b) for(int i=(a);i>(b);i--)
#define cFOR(i,a,b) for(int i=(a);i>=(b);i--)
#define lFor(i,a,b) for(ll i=(a);i<(b);i++)
#define lFOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define lcFor(i,a,b) for(ll i=(a);i>(b);i--)
#define lcFOR(i,a,b) for(ll i=(a);i>=(b);i--)
//debug
#define dbg(a) cout<<#a<<"="<<a<<endl
#define inthis cout<<"--------this\n"
//operator
#define pb push_back
#define ins insert
#define era erase
#define fin find 
//pair
#define pr pair
#define mkp(a,b) make_pair(a,b)
#define fi first
#define se second
//vector
#define vec vector
#define vi vector<int>
#define vii vector<vector<int>>
//map
#define mp map
////map int
#define mpii map<int,int>
#define mpib map<int,bool>
#define mpic map<int,char>
#define mpis map<int,string>
#define mpil map<int,long long>
////map long long 
#define mpll map<long long,long long>
#define mplb map<long long,bool>
#define mplc map<long long,bool>
#define mpls map<long long,string>
#define mpli map<long long,int>
////map char
#define mpci map<char,int>
#define mpcb map<char,bool>
#define mpcl map<char,long long>
////map string
#define mpsi map<string,int>
#define mpsb map<string,bool>
#define mpsl map<string,long long>
//iterator
#define ivec(a) vector<a>::iterator
#define iset(a) set<a>::iterator 
#define imp(a,b) map<a,b>::iterator

using namespace std;
/*
const int maxsize=
struct edge{
	int nod,nxt;
			
}e[maxsize<<1];
int nume=0,pa[maxsize],head[maxsize];
void add(int u,int v){
	e[++nume].nod=v;
	e[nume].nxt=head[u];
	head[u]=nume;
}
void init(){
	
}
bool vis[maxsize];
void bfs(){
	
}
void dfs(){

}
*/
vi a;
int main(){
	fio;
	int n;
	cin>>n;
	ll sum=0;
	For(i,0,n){
		int x;
		cin>>x;
		a.pb(x);
	}
	sort(all(a));
	ll ans=1e18;
	For(i,0,100){
		ll tmp=0;
		For(j,0,n)
			tmp+=(a[j]-i)*(a[j]-i);
		if(tmp<ans)
			ans=tmp;
	}
	cout<<ans<<endl;	
}


Measured memory_bytes: 256
n, m, l = gets.chomp.split.map(&:to_i)

a = []
n.times do
  a << gets.chomp.split.map(&:to_i)
end

b = []
m.times do
  b << gets.chomp.split.map(&:to_i)
end

c = []

n.times do |i|
  c_i = []
  l.times do |j|
    sum = 0
    m.times do |k|
      sum += a[i][k] * b[k][j]
    end
    c_i.push(sum)
  end
  c.push(c_i)
end

c.each do |c_i|
  puts c_i.join(' ')
end


Measured memory_bytes: 7436
#include <iostream>

int main() {

    for (;;) {

        int n;
        int m;
        int p;

        std::cin >> n;
        std::cin >> m;
        std::cin >> p;

        if (n == 0 && m == 0 && p == 0) {
            break;
        }

        int numberOfTickets = 0;
        int numberOfTicketsForWinner = 0;

        for (int i=1; i<=n; ++i) {

            int t;
            std::cin >> t;

            numberOfTickets += t;

            if (i == m) {
                numberOfTicketsForWinner = t;
            }
        }

        if (numberOfTicketsForWinner == 0) {
            std::cout << 0 << std::endl;
            continue;
        }

        const int pooled = 100 * numberOfTickets;
        const double haitou = (double) (100 - p) * pooled / 100;
        const int haitouPerTicket = haitou / numberOfTicketsForWinner;

        std::cout << haitouPerTicket << std::endl;

    }

}


Measured memory_bytes: 3084
#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    ll n, p;
    cin >> n >> p;
    if(n == 1){
        cout << p << endl;
        return 0;
    }
    int q[1000002] {0};
    for(int i = 2; i <= 1000000; i++){
        while(p % i == 0){
            p /= i;
            q[i]++;
        }
    }
    ll ans = 1;
    for(int i = 2; i <= 1000000; i++){
        ll b = q[i] / n;
        for(int j = 0; j < b; j++) ans *= i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4096
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        print(e - s, 'sec', file=sys.stderr)
        return ret

    return wrap


@mt
def slv(N, A):

    if A[0] != 0:
        return -1

    for i in range(N - 1):
        if A[i + 1] - A[i] > 1:
            return -1

    ans = A[-1]
    for i in range(N - 1):
        if A[i] >= A[i + 1]:
            ans += A[i]
    return ans


def main():
    N = read_int()
    A = [read_int() for _ in range(N)]

    print(slv(N, A))


if __name__ == '__main__':
    main()


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

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n,m = LI()
    r = [0] * n
    for _ in range(m):
        a,b = LI_()
        r[a] += 1
        r[b] += 1
    return '\n'.join(map(str, r))

print(main())


Measured memory_bytes: 6740
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
  int n,k;
  ll ans=0;
  cin >> n >> k;
  vector<int> p(n);
  for(int &e:p)cin>>e;
  sort(p.begin(),p.end());
  ans = accumulate(p.begin(),p.begin()+k,0);

 cout << ans << endl;
      return 0;
}


Measured memory_bytes: 3632
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, P): (usize, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };
    let A: Vec<i64> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect()
    };

    let ans = if A.iter().all(|&a| a % 2 == 0) {
        (1 - P) * 2i64.pow(N as u32)
    } else {
        2i64.pow((N - 1) as u32)
    };

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(){

  int H, W, i=0,k=0;

  while(1){
    scanf("%d%d",&H,&W);
    if(H+W==0) break;

    for(i=0;i<H;++i){
      if(i%2==0){
	for(k=0;k<W;++k){
	  if(k%2==0){
	    printf("#");
	  }
	  else{
	    printf(".");
	  }
	}
	printf("\n");
      }
      else{
	for(k=0;k<W;++k){
	  if(k%2==0){
	    printf(".");
	  }
	  else{
	    printf("#");
	  }
	}
	printf("\n");
      }
    }
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2552
require 'prime'
n = gets.chomp.split(' ').map(&:to_i)[0]
c = 0
for i in 1..n do
  if i.odd?
    s = 1
    qs = []
    Prime.prime_division(i).map { |l| qs << l[1] }
    qs.map { |q| s *= (q + 1) }
    c += 1 if s == 8
  end
end
puts c

Measured memory_bytes: 2044
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define pii pair<int,int>
#define sd(x) scanf("%d",&x)
#define sLLd(x) scanf("%LLd",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define rep(i,a,b) for(int i = a ; i <= b ; i++)
#define per(i,a,b) for(int i = b ; i >= a ; i--)
#define mem(a) memset(a,0,sizeof(a))
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define fast_io ios::sync_with_stdio(false)

const LL INF = 1e18;
const int mod = 2010;
const int maxn = 2e5 + 7;

queue<LL>q;

int main() {
    int n;
    while(~sd(n)) {
        while(!q.empty()) q.pop();
        for(int i = 1 ; i <= 9 ; i++) q.push(i);
        int cnt = 1;
        LL k;
        while(!q.empty()) {
            k = q.front();
            q.pop();
            if(cnt == n) break;
            cnt++;
            if(k % 10 != 0) q.push(10 * k + (k % 10) - 1);
            q.push(10 * k + (k % 10));
            if(k % 10 != 9) q.push(10 * k + (k % 10) + 1);
        }
        plld(k);
    }
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(void)
{
	int p[4][3][10],i,j,k,n,b,f,r,v;

	for (i = 0; i < 4; i++) {
		for (j = 0; j < 3; j++) {
			for (k = 0; k < 10; k++) {
				p[i][j][k] = 0;
			}
		}
	}

	scanf("%d", &n);

	for (i = 0; i < n;i++) {
		scanf("%d%d%d%d", &b, &f, &r, &v);

		
		p[b-1][f-1][r-1] += v;
				

	}

	
	for (i = 0; i < 4; i++) {
		for (j = 0; j < 3; j++) {
			for (k = 0; k < 10; k++) {
				printf(" %d",p[i][j][k]);
			}
			printf("\n");
		}

		if (i == 3)
			break;

		printf("####################\n");
	}


	return 0;
}


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

enum suits { S, H, C, D };

int main(void)
{
    int n, rank;
    char suit;
    vector<bool> cards(52, true);

    cin >> n;
    while (cin >> suit >> rank && n--) {
        int s;
        switch (suit) {
        case 'S': s = S; break;
        case 'H': s = H; break;
        case 'C': s = C; break;
        case 'D': s = D; break;
        }
        cards[s * 13 + rank - 1] = false;
    }


    for (int i = 0; i < cards.size(); i++)
        if (cards[i]) {
            switch (i / 13) {
            case S: cout << 'S'; break;
            case H: cout << 'H'; break;
            case C: cout << 'C'; break;
            case D: cout << 'D'; break;
            }
            cout  << " " << i % 13 + 1 << endl;
        }

    return 0;
}



Measured memory_bytes: 3104
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<int, PP> PPP;
struct edge { int to; int to2; int cost; };
int a[1005], b[1005], c[1005];
signed main() {
	int x, y, z, k; cin >> x >> y >> z >> k;
	rep(i, x)cin >> a[i];
	rep(i, y)cin >> b[i];
	rep(i, z)cin >> c[i];
	sort(a, a + x);
	sort(b, b + y);
	sort(c, c + z);
	vector<int>xy;
	rep(i, x) {
		rep(j, y) {
			xy.push_back(a[i] + b[j]);
		}
	}
	sort(xy.begin(), xy.end());
	reverse(xy.begin(), xy.end());
	vector<int>ans;
	rep(i, min(k, x*y)) {
		rep(j, z) {
			ans.push_back(xy[i] + c[j]);
		}
	}
	sort(ans.begin(), ans.end());
	reverse(ans.begin(), ans.end());
	rep(i, k)cout << ans[i] << endl;
}


Measured memory_bytes: 43236
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		long[] cnts = new long[100001];
		long cursum = 0;
		for (int i = 0; i < N; i++) {
			int x = input.nextInt();
			cnts[x]++;
			cursum+=x;
		}
		int Q = input.nextInt();
		for (int i = 0; i < Q; i++) {
			int B = input.nextInt();
			int C = input.nextInt();
			cnts[C]+=cnts[B];
			long diff = C-B;
			cursum+=diff*cnts[B];
			cnts[B]=0;
			System.out.println(cursum);
		}
	}
}


Measured memory_bytes: 59624
#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include <typeinfo>
//#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <math.h>

using namespace std;

int main()
{
  int n, t, a;
  cin >> n >> t >> a;
  vector<int> h(n);
  for (int &i : h)
    cin >> i;

  int ans;
  double error = INT_MAX;
  double tmp;

  for (int i = 0; i < n; i++)
  {
    double temp = (double)t - (double)h.at(i) * 0.006;
    tmp = fabs(temp - double(a));
    if (tmp < error)
    {
      error = tmp;
      ans = i;
    }
  }
  ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		 Scanner scan = new Scanner(System.in);
		 int a = scan.nextInt();
		 int b = scan.nextInt();
		 int c = scan.nextInt();
		 if(a < b && b < c){
			 System.out.println("Yes");
		 }
		 else{
			 System.out.println("No");
		 }
	}
}

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

void test(long& a, long b) {
  if (a > b) a = b;
}

int main() {
  int n;

  cin >> n;

  vector<long> h(n), ans(n);

  for (int i = 0; i < n; i++) {
    cin >> h[i];
    ans[i] = 1e9;
  }

  ans[0] = 0;
  ans[1] = abs(h[0] - h[1]);
  for (int i = 2; i < n; i++) {
    for (int j = 1; j < 3; j++) {
      // ans[i] = min(ans[i], abs(h[i] - h[i - j]) + ans[i - j]);
      test(ans[i], abs(h[i] - h[i - j]) + ans[i - j]);
      // test(ans[i], abs(h[i] - h[i - 1]) + ans[i - 1]);
      // test(ans[i], abs(h[i] - h[i - 2]) + ans[i - 2]);
    }
  }

  cout << ans[n - 1];

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll N, D;
typedef pair<int, int> field_xy;

int main()
{
    cin >> N >> D;
    field_xy xy[N];
    for (int i = 0; i < N; i++)
    {
        cin >> xy[i].first >> xy[i].second;
    }

    int count = 0;
    for (int i = 0; i < N; i++)
    {
        if (pow(xy[i].first, 2) + pow(xy[i].second, 2) <= pow(D, 2))
            count++;
    }

    cout << count << endl;
}


Measured memory_bytes: 5160
N = int(input())
a = list(map(int, input().split()))

alice_count = 0
bob_count = 0
for i in range(N//2):
  alice_count += max(a)
  a.pop(a.index(max(a)))
  bob_count += max(a)
  a.pop(a.index(max(a)))

if a:
  alice_count += a[0]
  
count = alice_count - bob_count

print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> int_pair;
typedef pair<ll,ll> ll_pair;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
const int H=301;
const int W=301;
ll a;
ll_pair A[H*W];
ll h,w,d,q,l,r,ans=0;
ll kyori[H*W]={0};

int main(){
	cin>>h>>w>>d;
	FOR(i,1,h+1){
		FOR(j,1,w+1){
			cin>>a;
			A[a]=make_pair(i,j);

		}
	}
	FOR(i,0,d){
		ll x=i;
		while(x<H*W-d){
			ans+=abs(A[x].first-A[x+d].first);
			ans+=abs(A[x].second-A[x+d].second);
			x+=d;
			kyori[x]=ans;
		}
		ans=0;
	}
	cin>>q;
	FOR(i,0,q){
		cin>>l>>r;
		cout<<kyori[r]-kyori[l]<<endl;
		ans=0;
	}
	
	return 0;
}


Measured memory_bytes: 3200
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int D[1 << 17];
int P[1 << 17];
int s1[55],s2[55];
int W[1 << 17];
const int mod = 1e9 + 7;
int main(void)
{
    int n,m;
    cin>>n>>m;
    int p2 = 1;
    while (m --)
    {
        int a,b;
        cin>>a>>b;
        --a;--b;
        s1[a] |= 1 << b;
        s2[b] |= 1 << a;
        p2 = p2 * 2 % mod;
    }
    const int N = 1 << n;
    P[0] = 1;
    for (int mask = 1;mask < N;++mask)
        P[mask] = (P[mask - (mask & (-mask))] * 2) % mod;
    D[0] = 1;
    int ans = 0;
    for (int mask = 0;mask < N;++mask)
        if (D[mask])
        {
            const int rem = (N - 1) ^ mask;
            for (int sub = rem;sub;sub = (sub - 1) & rem)
            if ((sub&3) == 3 || !(sub&3))
            {
                const int R = rem ^ sub;
                int coef = D[mask];
                for (int j = 0;j < n;++j)
                    if ((R >> j) & 1)
                        coef = (1ll * coef * (P[s1[j] & sub] - 1)) % mod,coef = (1ll * coef * P[s2[j] & sub]) % mod;
                D[sub | mask] = (D[sub | mask] + coef) % mod;
            }
        }
    ans = (p2 + mod - D[N - 1]) % mod;
    cout << ans << '\n';
    return 0;
}


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

int main() {
  int n;
  
  cin >> n;
  
  vector<pair<pair<string, int>, int>> p(n);
  
  for (int i = 0; i < n; i++) {
    string s;
    int t;
   
    cin >> s >> t;
   
    p.at(i) = make_pair(make_pair(s, t * -1), i);
  }
  
  sort(p.begin(), p.end());

  for (auto a : p) {
    cout << a.second + 1 << endl;
  }
}

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

 int main() {
 int a, b, c , d, e, k;
   cin >> a >> b >> c >> d >> e >> k;
   
   if(sqrt((a - b) * (a - b)) <= k && sqrt((a - c) * (a - c)) <= k && sqrt((a - d) * (a - d)) <= k && sqrt((a - e) * (a - e)) <= k && sqrt((b - c) * (b - c)) <= k && sqrt((b - d) * (b - d)) <= k && sqrt((b - e) * (b - e)) <= k && sqrt((c - d) * (c - d)) <= k && sqrt((c - e) * (c - e)) <= k && sqrt((d - e) * (d - e)) <= k) {
   cout << "Yay!" << endl;
   }
   else { 
     cout << ":(" << endl;
   }
     
   return 0;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 1000000007;
int dp[200000];
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
long long longpow(long long n, long long a, long long mod) {
  if (a == 0) return 1;
  if (a == 1) return n % mod;
  if (a % 2 == 1) return (n * longpow(n, a - 1, mod)) % mod;
  ll t = longpow(n, a / 2, mod) % mod;
  return (t * t) % mod;
}
int main() {
  int N;
  cin >> N;
  REP(i, N + 10) dp[i] = i;
  REP(i, N + 10) {
    for (int j = 1; longpow(6, j, MOD) <= N; j++) {
      chmin(dp[i + longpow(6, j, MOD)], dp[i] + 1);
    }
  }
  REP(i, N + 10) {
    for (int j = 1; longpow(9, j, MOD) <= N; j++) {
      chmin(dp[i + longpow(9, j, MOD)], dp[i] + 1);
    }
  }
  cout << dp[N] << endl;
}


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

#define pb push_back

typedef long long ll;



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int tc;
	cin>>tc;
	for(int t=1;t<=tc;t++)
	{
		ll a,s;
		cin>>a>>s;
		ll total=0;
		if(s>127)
		{
			total+=(a-1)*127;
			total+=s;
			
		}
		else
		{
			ll temp=s^127;
			if(a%2==0)
			{
				total=(a-1)*127;
				total+=temp;
			}
			else total=(a-1)*127,total+=s;
		
		}
		cout<<total<<endl;
	}
}

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

using namespace std;

int main(void) {

	string s;
	int a[26] = { 0 }, co = 0;

	cin >> s;

	for (int i = 0; i < s.size(); i++) {
		if (a[(int)s[i] - 'a'] != 0) {
			co = 1;
			break;
		}
		a[(int)s[i] - 'a']++;
	}	

	if (co == 0) cout << "yes" << endl;
	else cout << "no" << endl;

	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++){ ;
int main() {
    string A,B,C;
  cin>>A>>B>>C;
    if(A.at(A.size()-1)==B.at(0)&&B.at(B.size()-1)==C.at(0)){
        cout<<"YES"<<endl;
    }
    else 
    cout<<"NO"<<endl;
}

Measured memory_bytes: 3628
N = int(input())
l = [input() for _ in range(N)]
AC = 0
WA = 0
TLE = 0
RE = 0

for e in l:
    if e == "AC":
        AC += 1
    elif e == "WA":
        WA += 1
    elif e == "TLE":
        TLE += 1
    else:
        RE += 1

print("AC x {}".format(AC)) 
print("WA x {}".format(WA)) 
print("TLE x {}".format(TLE)) 
print("RE x {}".format(RE)) 

Measured memory_bytes: 16244
use std::io::*;
use std::str::FromStr;
//00.標準入力(n) n:usize
//let n = read_n();
fn read_n() -> usize {
    let stdin = stdin();
    let mut stdin = stdin.lock();
    let token = stdin
        .by_ref().bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .fold(0, |a, x| (x as u8 - b'0') as usize + a * 10);
    token
}
//01.標準入力(n) n:i64
//let n = read_i();
fn read_i() -> i64 {
    let stdin = stdin();
    let mut stdin = stdin.lock();
    let token = stdin
        .by_ref().bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .fold(0, |a, x| (x as u8 - b'0') as i64 + a * 10);
    token
}
//02.標準入力(s) s:Vec<char>
//let s = read_s();
fn read_s() -> Vec<char> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token = stdin
        .bytes().map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !(*c=='\r'||*c=='\n')).collect();
    token
}
//03.標準入力(n) n:FromStr
//let n:u32=read();
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !(*c=='\r'||*c=='\n'))
        .collect();
    token.parse().ok().expect("failed to parse token")
}
//04.標準入力[a(1)...a(n)]
//let a:Vec<i64>=read_a();
fn read_a<T: FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}
//05.標準入力(a,b)*n
//let mut a=Vec::new();
//let mut b=Vec::new();
//for _ in 0..n{
//    let tl:Vec<i64>=read_a();
//    a.push(tl[0]);
//    b.push(tl[1]);
//}

fn main() {
//ABC109
//ABC109_A
/*
    let ab=read_a();
    let a:i64=ab[0];
    let b:i64=ab[1];
    let mut j=false;
    for c in 1..4{
        if a*b*(c as i64)%2==1{j=true;}
    }
    if j{println!("Yes")} else {println!("No")};
*/
//ABC109_B
    use std::collections::BTreeSet;
    let n=read_n();
    let mut w:Vec<Vec<char>>=vec!();
    for _ in 0..n{w.push(read_s())};
    //println!("{},{:?}", n,w);
    let mut j=true;
    if w.iter().collect::<BTreeSet<_>>().len() !=n{j=false};
    for i in 0..n-1{
        if w[i][w[i].len()-1]!=w[i+1][0]{j=false};
    }
    if j{println!("Yes");} else {println!("No");}



}


Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;

public class Main {

	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String buffer;
		try {
			while ((buffer = reader.readLine())  != null) {
				double r = Double.valueOf(buffer.substring(0, buffer.indexOf(" ") == -1 ? buffer.length() : buffer.indexOf(" ")));
				System.out.println(BigDecimal.valueOf(r * r * Math.PI).toPlainString() + " " + BigDecimal.valueOf(2 * r * Math.PI).toPlainString());
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}

Measured memory_bytes: 24720
//This program is written by Brian Peng.
#pragma GCC optimize("Ofast","inline","no-stack-protector")
#include<bits/stdc++.h>
using namespace std;
#define Rd(a) (a=rd())
#define Gc(a) (a=getchar())
#define Pc(a) putchar(a)
int rd(){
	int x;char c(getchar());bool k;
	while(!isdigit(c)&&c^'-')if(Gc(c)==EOF)exit(0);
	c^'-'?(k=1,x=c&15):k=x=0;
	while(isdigit(Gc(c)))x=x*10+(c&15);
	return k?x:-x;
}
void wr(int a){
	if(a<0)Pc('-'),a=-a;
	if(a<=9)Pc(a|'0');
	else wr(a/10),Pc((a%10)|'0');
}
signed const INF(0x3f3f3f3f),NINF(0xc3c3c3c3);
long long const LINF(0x3f3f3f3f3f3f3f3fLL),LNINF(0xc3c3c3c3c3c3c3c3LL);
#define Ps Pc(' ')
#define Pe Pc('\n')
#define Frn0(i,a,b) for(int i(a);i<(b);++i)
#define Frn1(i,a,b) for(int i(a);i<=(b);++i)
#define Frn_(i,a,b) for(int i(a);i>=(b);--i)
#define Mst(a,b) memset(a,b,sizeof(a))
#define File(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout)
#define N (200010)
int n;
string s[N];
signed main(){
	Rd(n);
	Frn1(i,1,n)cin>>s[i];
	sort(s+1,s+n+1),wr(unique(s+1,s+n+1)-s-1);
	exit(0);
}


Measured memory_bytes: 9892
from collections import defaultdict
n,p = map(int,input().split())
s = input()

sur1 = [int(s[0]) % p]
sur2 = [int(s[-1]) % p]
sur10 = [1 % p]
for i in range(n-1):
    sur1 += [(sur1[i] * 10 + int(s[i+1])) % p]
    sur10 += [(sur10[i] * 10) % p]
    sur2 += [(sur2[i] + sur10[i+1] * int(s[-i-2])) % p]

ans = 0
if p == 2:
    for i in range(n):
        if int(s[i]) % 2 == 0:
            ans += i + 1
    print(ans)
    exit()

if p == 5:
    for i in range(n):
        if int(s[i]) % 5 == 0:
            ans += i + 1
    print(ans)
    exit()

d = defaultdict(int)
for x in sur2:
    d[x] += 1

for k,v in d.items():
    if k == 0:
        ans += v * (v+1) // 2
    else:
        ans += v * (v-1) // 2
print(ans)

Measured memory_bytes: 27436
#include <stdio.h>

int main(void)
{
	int MONTH[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	
	char DAYS[7][10] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
	
	int month, date, i;
	
	while(scanf("%d %d",&month, &date)){
		getchar();
		if(month == 0){
			break;
		}
		
		int total = 0;
		for(i = 1;i < month;i++){
			total += MONTH[i - 1];
		} 
		
		total += date -1 ;
		
		//printf("%d\n",total);
		printf("%s\n",DAYS[total % 7]);
	}
	
	return 0;
}

Measured memory_bytes: 1016
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var dic = new Dictionary<string, int>() {
            { "SUN", 7 },
            { "MON", 6 },
            { "TUE", 5 },
            { "WED", 4 },
            { "THU", 3 },
            { "FRI", 2 },
            { "SAT", 1 },
        };

        var s = input.ReadLine();
        return dic[s];
    }
}

Measured memory_bytes: 11220
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
// #define int long long

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

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#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 ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    ll x;
    cin >> x;

    ll c = 100;
    ll cnt = 0;
    while (true)
    {
        c += c*0.01;
        cnt++;
        if(c>=x) break;
    }
    
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3640
#!/usr/bin/env python3

from pprint import pprint
from bisect import bisect_right
import math
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')


N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

sum_A = [0] * (N+1)
for i in range(N):
    sum_A[i+1] = sum_A[i] + A[i]
sum_B = [0] * (M+1)
for i in range(M):
    sum_B[i+1] = sum_B[i] + B[i]
# print(sum_A, sum_B)

res = 0
for i in range(N+1):
    time_A = sum_A[i]
    rest = K - time_A
    if rest < 0:
        continue
    j = bisect_right(sum_B, rest) - 1
    res = max(res, i + j)
print(res)


Measured memory_bytes: 120228
#include<stdio.h>

int main()
{
    int chight;
    int a[3]={0,0,0};
    int i;
    
    for(i=0;i<10;i++)
    {
        scanf("%d",&chight);
        if(chight>=a[2])
        {
            if(chight<=a[1])
                a[2]=chight;
            else
            {
                if(chight<=a[0])
                {
                    a[2]=a[1];
                    a[1]=chight;
                }
                else
                {
                    a[2]=a[1];
                    a[1]=a[0];
                    a[0]=chight;
                }
            }
        }
    }
    for(i=0;i<3;i++)
    {
        printf("%d\n",a[i]);
    }
    return 0;
}

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

void dfs(int y, int x, vector<string> const& v, vector<vector<bool>>& v2) {
    int dx[4] = {0, -1, 0, 1}, dy[4] = {1, 0, -1, 0};
    
    for(int i=0; i<4; ++i) {
        int nx = x + dx[i], ny = y + dy[i];
        if(0 <= nx && nx < v[0].size() && 0 <= ny && ny < v.size() && v[ny][nx] == '.' && !v2[ny][nx]) {
            v2[ny][nx] = true;
            dfs(ny, nx, v, v2);
        } 
    }
}

int main() {
    int w, h;
    while(cin >> w >> h, w) {
        vector<string> v(h);
        vector<vector<bool>> B(h, vector<bool>(w, false));
        vector<vector<bool>> W(h, vector<bool>(w, false));
        for(int i=0; i<v.size(); ++i) {
            cin >> v[i];
        }

        for(int i=0; i<v.size(); ++i) {
            for(int j=0; j<v[i].size(); ++j) {
                if(v[i][j] == 'W') {
                    dfs(i, j, v, W);
                } else if(v[i][j] == 'B') {
                    dfs(i, j, v, B);
                }
            }
        }

        int ans_w = 0, ans_b = 0;
        for(int i=0; i<h; ++i) {
            for(int j=0; j<w; ++j) {
                if(!B[i][j] && W[i][j]) {
                    ans_w++;
                }
                if(B[i][j] && !W[i][j]) {
                    ans_b++;
                }
            }
        }
        cout << ans_b << " " << ans_w << endl;
    }
}


Measured memory_bytes: 3200