akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch FiveVariables | diff FiveVariables.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address FiveVariables.cpp && ./a.out

/*

 6/14/2020

 5:00-

 */

const int MAX_N=1e6+1;
int x[MAX_N];

void solve() {
  REP(i,5) if(x[i]==0) {
    cout<<i+1<<endl;
    return;
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;

  REP(i,5) cin>>x[i];
  solve();

  return 0;
}


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

typedef struct{
  char a[36][2];
}roll;

int isStable(roll ,roll);
int N;

int main(){
  roll A, B, C;
  int i, j, hantei, minj;
  char a[36][2], tmp[1][2],g;

  scanf("%d",&N);
  if(N<0 || N>36) exit(1);

  for(i=0; i<N; i++) scanf(" %c%c",&A.a[i][0],&A.a[i][1]);
  for(i=0; i<N; i++){
    B.a[i][0] = A.a[i][0];
    B.a[i][1] = A.a[i][1];
  }
  for(i=0; i<N; i++){
    C.a[i][0] = A.a[i][0];
    C.a[i][1] = A.a[i][1];
  }

  //bubble sort
  for(i=0; i<N-1; i++){
    for(j=N-1; j>=i+1; j--){
      if(B.a[j][1] < B.a[j-1][1]){
	tmp[0][0] = B.a[j][0];
	tmp[0][1] = B.a[j][1];
	B.a[j][0] = B.a[j-1][0];
	B.a[j][1] = B.a[j-1][1];
	B.a[j-1][0] = tmp[0][0];
	B.a[j-1][1] = tmp[0][1];
      }
    }
  }
  hantei = isStable(A,B);
  for(i=0; i<N-1; i++) printf("%c%c ",B.a[i][0],B.a[i][1]);
  printf("%c%c",B.a[N-1][0],B.a[N-1][1]);
  if(hantei == 1) printf("\nStable\n");
  else printf("\nNot stable\n");

  //selection sort
  for(i=0; i<N-1; i++){
    minj = i;
    for(j=i; j<=N-1; j++){
      if(C.a[j][1] < C.a[minj][1]) minj = j;
    }
    tmp[0][0] = C.a[minj][0];
    tmp[0][1] = C.a[minj][1];
    C.a[minj][0] = C.a[i][0];
    C.a[minj][1] = C.a[i][1];
    C.a[i][0] = tmp[0][0];
    C.a[i][1] = tmp[0][1];
  }
  hantei = isStable(A,C);
  for(i=0; i<N-1; i++) printf("%c%c ",C.a[i][0],C.a[i][1]);
  printf("%c%c",C.a[N-1][0],C.a[N-1][1]);
  if(hantei == 1) printf("\nStable\n");
  else printf("\nNot stable\n");

  return 0;
}

int isStable(roll A, roll B) {
  int i, j, c, d;

  for(i=0; i<N-1; i++){
    for(j=i+1; j<N; j++){
      if(A.a[i][1] == A.a[j][1]){
	for(c=0; c<N; c++) if(A.a[i][0] == B.a[c][0] && A.a[i][1] == B.a[c][1]) break;
	for(d=0; d<N; d++) if(A.a[j][0] == B.a[d][0] && A.a[j][1] == B.a[d][1]) break;
	if(c<d) continue;
	else return 0;
      }
    }
  }
  return 1;
}



Measured memory_bytes: 2104
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  int a,b,t;
  cin >> a >> b >> t;
  cout << t/a*b << endl;
}


Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var I=0;
while(true){
   var NM=Arr[I].split(" ").map(Number);
   I++;
   var N=NM[0];
   var M=NM[1];
   if(N==0 && M==0)break;
   var n=[];
   for(var i=0;i<N;i++)n[i]=true;
   n[0]=false;
   var tsd=[];
   for(var i=0;i<M;i++){
      var v=Arr[I].split(" ").map(Number);
      I++;
      tsd.push([v[0],v[1]-1,v[2]-1]);
   }
   tsd.sort(function(a,b){return a[0]-b[0];});
   tsd.forEach(function(v){
      var s=v[1];
      var d=v[2];
      if(!n[s])n[d]=false;
   });
   var cnt=0;
   n.forEach(function(v){if(!v)cnt++;});
   console.log(cnt);
}

Measured memory_bytes: 76404
#include "bits/stdc++.h"
#include <cmath>

#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;


int main() {
    int N, M;
    cin >> N >> M;
    vector<pair<ll,pair<int,int>>> city(M);
    // 属する都市、誕生年、市の番号
    for(int i = 0; i < M; i++){
        cin >> city[i].fi;
        cin >> city[i].se.fi;
        city[i].se.se = i + 1;
    }
    sort(all(city));

    map<int, pair<ll,int>> cnt;
    // 市の番号、属する都市、誕生順
    int count = 1;
    for(int i = 0; i < M - 1; i++){
        cnt[city[i].se.se] = make_pair(city[i].fi, count);
        if(city[i].fi == city[i + 1].fi) count++;
        else count = 1;
    }
    cnt[city[M - 1].se.se] = make_pair(city[M - 1].fi, count);

    for(int i = 1; i <= M; i++){
        string belong = to_string(cnt[i].fi);
        int n = belong.size();
        string s;
        for(int j = 0; j < 6 - n; j++){
            s += '0';
        }
        s += belong;
        string order = to_string(cnt[i].se);
        int m = order.size();
        string t;
        for(int j = 0; j < 6 - m; j++){
            t += '0';
        }
        t += order;
        s += t;
        cout << s << endl;
    }

}

Measured memory_bytes: 9344
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long h,w,p,n,a,b;
  cin>>n>>a>>b;
  if(a>=b)
  cout<<b<<" ";
  else
  cout<<a<<" ";
  h=a+b-n;
  if(h<=0)
  cout<<0;
  else
  cout<<h;
  
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    int n; cin>>n;
    string s; cin>>s;
    vector<ll> cnt(30, 0);
    for(int i=0; i<n; i++){
        cnt[s[i]-'a']++;
    }

    ll ans=1;
    for(int i=0; i<26; i++){
        ans*=(cnt[i]+1);
        ans%=MOD;
    }

    cout << ans-1 << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
void strongPalindrome(string s);

int main(){
 
    string s;
    getline(cin,s);
    strongPalindrome(s);
    return 0;
}
void strongPalindrome(string s){
    string x = s;
    int low = 0;
    int high = s.length()-1;
    while(low<high){
        if(s[low] == s[high]){
            low++;
            high--;
        }
        else{
            cout<<"No"<<endl;
            return;
        }
    }
    low =0,high = (s.length()-2)/2;
    while(low<high){
        if(s[low] == s[high]){
            low++;
            high--;
        }
        else{
            cout<<"No"<<endl;
            return;
        }
    }
    low = (s.length()+2)/2,high = s.length() -1;
    while(low<high){
        if(s[low] == s[high]){
            low++;
            high--;
        }
        else{
            cout<<"No"<<endl;
            return;
        }
    }
    cout<<"Yes"<<endl;
    return;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> list(9,0);
  for(int i=0;i<n;i++) {
    int temp;
    cin >> temp;
    temp=min(8,temp/400);
    list.at(temp)++;
  }
  int count=0;
  for(int i=0;i<8;i++) {
    if(list.at(i)) {
      count++;
    }
  }
  cout << max(1,count) << " " << count+list.at(8) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
int a;
scanf("%d",&a);
if(a>=100 && a<=111){printf("111");}
else{if(a>=112 && a<=222){printf("222");}
else{if(a>=223 && a<=333){printf("333");}
else{if(a>=334 && a<=444){printf("444");}
else{if(a>=445 && a<=555){printf("555");}
else{if(a>=556 && a<=666){printf("666");}
else{if(a>=667 && a<=777){printf("777");}
else{if(a>=778 && a<=888){printf("888");}
else{printf("999");}
}
}
}
}
}
}
}
	
return 0;
}

Measured memory_bytes: 128
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#define MAXN 200010
#define OPEN 0
using namespace std;
//input: s: the string of input
//output: the minimum no of stone to be printed
int calc(string s) {
	int n = s.size();
	int l_w,r_w;	//表明左边白色的石头个数 和 右边白色石头的个数
	r_w = 0;
	for (int i = 0; i < n; i++) {
		if (!i) {
			if (s[0] == '.')
				l_w = 1;
			else
				l_w = 0;
		}
		else 
			if (s[i] == '.')
				r_w++;
	}
	int l_s_w = 1 - l_w;	//左边应该涂白的石头的个数
	int r_s_b = r_w;	//右边应该涂黑的石头个数
	int min_s_p = MAXN;	//总共需要涂色的石头数字
	int a_b = l_w + r_w;
	if (a_b < min_s_p)
		min_s_p = a_b;
	int a_w = (1 - l_w) + (n - 1 - r_w);
	if (a_w < min_s_p)
		min_s_p = a_w;
	if (n > 2)
		for (int i = 0; i < n - 2; i++) {
			if (i != 0) {
				if (s[i] == '.')
					r_s_b -= 1;
				else
					l_s_w += 1;
			}
			int s = l_s_w + r_s_b;
			if (s < min_s_p)
				min_s_p = s;

		}
	else
		if (n == 2) {
			int s = l_s_w + r_s_b;
			if (s < min_s_p)
				min_s_p = s;
		}
	return min_s_p;
		
}
int main() {
	int N;
	string S;
#if OPEN
	freopen("input.txt", "r", stdin);
#endif
	while (cin >> N) {
		cin >> S;
		int ret = calc(S);
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 772
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

  LL a, b, c; cin >> a >> b >> c;
  LL sum = 0, e = c;
  LL ans = -1;
  for(int t=0;t<=60;){
	if(e <= sum){
	  ++t, e += 60;
	  continue;
	}
	if(e <= sum + a){
	  ans = e; break;
	}
	sum += a+b;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1188
#include<stdio.h>

int Search(int *,int,int);
int main(){
	int i,n,a[100000],q,t,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&t);
		sum+=Search(a,n,t);
	}
	printf("%d\n",sum);
	return 0;
}

int Search(int *a,int n,int t){
	int mid,F,L;
	F=0;
	L=n;
	while(F<L){
		mid=(F+L)/2;
		if(a[mid]==t)return 1;
		else if(a[mid]>t){
			L=mid;
		}else F=mid+1;
	}
	return 0;
}


Measured memory_bytes: 2108
# coding: utf-8
# Your code here!
N=int(input())
l=[]


for i in range(N-1):
    c,s,f=(map(int,input().split()))
    l.append([c,s,f])

for n in range(N):
    sum=0
    for i in range(n,N-1):
        if sum>l[i][1]:
            sum=l[i][1]-(-(sum-l[i][1])//l[i][2]*l[i][2])+l[i][0]
        else:
            sum=l[i][0]+l[i][1]
    print(sum)

Measured memory_bytes: 3188
/**********
*	????????¢????????????
*	????????¢?????????????????????????????????????????????????????°??????
*********/

#include <iostream>

int main()
{
	int W,H,x,y,r;

	std::cin >> W >> H >> x >> y >> r;
	
	if( 0 <= (x-r) && (x+r) <= W && 0 <= (y-r) && (y+r) <= H ){
		std::cout << "Yes" << std::endl;
	} else{
		std::cout << "No" << std::endl;
	}
	return 0;
}

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

int main()
{
    int i,j;
    int n;
    scanf("%d\n",&n);
    vector<string> v;
    for(i=0; i<n; ++i){
        string h;
        getline(cin,h);
        v.push_back(h);
    }
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
    printf("%d",v.size());
}


Measured memory_bytes: 11732
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;

typedef long long ll;

const int MOD = (int) 1e9 + 7;

int dp[200005], sum[200005], a[200005];

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];

    dp[0] = 1;
    for (int i = 1; i <= n; i++)
    {
        if (i == 1 || a[i - 1] != a[i]) sum[a[i]] = (sum[a[i]] + dp[i - 1]) % MOD;
        dp[i] = sum[a[i]];
    }
    cout << dp[n];
    return 0;
}



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

using namespace std;
int main(){
    long n;
    cin >> n;
    if(n%1000==0) cout << "0" << endl;
    else{
      n=n%1000;
      n=1000-n;
      cout << n << endl;
    }
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
#define x1 qeerdx
#define y1 qeerdy
 
#define lb lower_bound
#define ub upper_bound
 
#define endl '\n'
#define fast_in ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
#define mp  make_pair
#define pb  push_back
 
#define fi first
#define se second
 
#define   sz(x)  (int)x.size()
#define  all(x)  x.begin(), x.end()
#define  bit(x)  __builtin_popcountll(x)

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
               
typedef pair <int,int> pii;
 
const int inf = (int) 1e9+99999, mod = (int)1e9+7;
const ll linf = (ll) 2e18+99999;
 
int kob (int x, int y) { return ((ll)x * y) % mod; } 
int aza (int x, int y) { x -= y; if (x < 0) return x + mod; return x; } 
int kos (int x, int y) { x += y; if (x >= mod) return x - mod; return x; }
 
const int maxn = (int) 3e6, maxn2 = (int) 1e6+55;
 
static long holdrand = 1L;                         
void srand(unsigned int seed){holdrand = (long) seed;} 
int rand() {return (((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff);}

void solve () {
	int n; cin >> n;
	map <string, int> m;
	for (int i = 1; i <= n; i ++) {
		string s; cin >> s;
		m[s] ++;
	}

	int mx = -1;
	for (auto to: m) {
		if (mx < to.second) {
			mx = to.second;
		}
	}

	vector <string> v;
	for (auto to: m) {
		if (mx == to.second) {
			v.pb (to.first);
		}
	}

	sort (all (v));

	for (auto to: v)
		cout << to << endl;
}

main () { fast_in;
    int t = 1; //cin >> t;
    while (t --) {
    	solve ();    
    }
	return 0;
}

Measured memory_bytes: 25584
#include <cstdio>
using namespace std;

int main( )
{
	for ( int i=1; i<=4; i++ )
		putchar( getchar( ) );
	putchar( ' ' );
	for ( int i=1; i<=8; i++ )
		putchar( getchar( ) );
	putchar( '\n' );
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
#include<map>
#include<algorithm>
#include<set>
#include<iomanip>
#include<string>
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1; i<=n;i++)
#define rrep(i,n) for(int i = n-1;i >=0;i--)
#define ALL(a) a.begin(),a.end()
#define PI  acos(-1)
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
typedef long long int ll;
typedef long double ld;
const int MOD = 1e9 + 7;
int dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 }, sum = 0,k;
vector<int> a;
bool check(int x) {
    int  cnt = 0;
    for(int i:a) {
        int kk = (i-1) / x + 1;
        if (kk * x < i) kk++;
        cnt += kk-1;
    }
    if (cnt > k)return 1;
    else return 0;
}
int main() {
    int n; cin >> n >> k; a.resize(n);
    rep(i, n) cin >> a[i];
    int right = 1e9 + 7, left = 0;
    while (right - left > 1) {
        int mid = (right + left) / 2;
        if (check(mid)) left = mid;
        else right = mid;
    }cout << right << endl;
}

Measured memory_bytes: 3920
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
    string S;
    cin >> S;

    int size = S.size();
    bool isYes = true;
    rep(i, 0, (size - 1) / 2 + 1)
    {
        if (S[i] != S[size - 1 - i])
        {
            isYes = false;
            break;
        }
    }

    size = (S.size() - 1) / 2;
    rep(i, 0, (size - 1) / 2 + 1)
    {
        if (!isYes) break;
        if (S[i] != S[size - 1 - i])
        {
            isYes = false;
            break;
        }
    }

    size = (S.size() + 3) / 2;
    rep(i, size, S.size())
    {
        if (!isYes) break;
        if (S[i] != S[S.size() - 1 - i])
        {
            isYes = false;
            break;
        }
    }

    cout << (isYes ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
n = int(input())
final_dict = {}
for x in range(1,n):
    for y in range(1,n):
        p = x*x + y*y 
        if p>=n:
            break
        for z in range(1,n):
            if p+z*z >=n:
                break
            val = (p + z*z +x*y +y*z +x*z)
            if val in final_dict:
                final_dict[val]+=1
            else:
                final_dict[val]=1
for i in range(1,n+1):
    p = 0
    if i in final_dict:
        p = final_dict[i]
    print(p)

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

#define mp make_pair
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int n,tot;
int a[100005],p[100005];

int main(){
	n=readint();
	for(int i=1;i<=n;i++) p[i]=a[i]=readint();
	sort(p+1,p+n+1);
	tot=unique(p+1,p+n+1)-p-1;
	if(tot>3) return printf("No\n"),0;
	if(tot==1&&p[1]==0) return printf("Yes\n"),0;
	if(n%3!=0)  return printf("No\n"),0;
	if(tot==2){
		if(p[1]!=0) return printf("No\n"),0;
		int cnt=0;
		for(int i=1;i<=n;i++) if(a[i]==p[1]) cnt++;
		if(cnt==n/3) return printf("Yes\n"),0;
		else return printf("No\n"),0;
	}
	int cnt1=0,cnt2=0;
	for(int i=1;i<=n;i++){
		if(a[i]==p[1]) cnt1++;
		else if(a[i]==p[2]) cnt2++;
	}
	if(cnt1!=cnt2||cnt1!=n/3) return printf("No\n"),0;
	if((p[1]^p[2])==p[3]&&(p[2]^p[3])==p[1]) return printf("Yes\n"),0;
	printf("No\n");
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  string S;
  cin >> S;
  bool result=true;
  rep(i,S.size()){
    if(i%2==0){
      if(S.at(i)!='R' && S.at(i)!='U' && S.at(i)!='D'){
        result=false;
      }
    }
    if(i%2==1){
      if(S.at(i)!='L' && S.at(i)!='U' && S.at(i)!='D'){
        result=false;
      }
    }
  }
  if(result==true){
    cout << "Yes" <<endl;
  }
  else{
    cout << "No" <<endl;
  }
  
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
//#include <cmath>
#include <vector>
// #include <algorithm>
// #include <bits/stdc++.h>
using namespace std;

int main() {
  while (1) {
    int x, y;
    cin >> x >> y;

    for (int i=0; i<x; i++) {
      for (int j=0; j<y; j++) cout << "#";
      cout << endl;
    }

    if(x==0 || y==0) break;
    cout << endl;
  }

  return 0;
}



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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  string s;cin>>s;
  int n=s.size();
  int p1 = 0;
  for(int i=0;i<n;i++){
    if(i%2==0){
      if(s[i]=='0')p1++;
    }else{
      if(s[i]=='1')p1++;
    }
  }
  int p2=0;
  for(int i=0;i<n;i++){
    if(i%2==1){
      if(s[i]=='0')p2++;
    }else{
      if(s[i]=='1')p2++;
    }
  }
  cout<<min(p1,p2)<<endl;


  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using  namespace  std;
using ll=long long;
int main(){
  int a,b;
  cin>>a>>b;
  for(int i=b/a;i>0;i--){
  if(b%i==0){
    cout<<i<<endl;
    break;
  }
  } 
}

Measured memory_bytes: 256
n = int(input())
P = [list(map(int, input().split())) for i in range(n)]
s = 0
for i, a in enumerate(P[:-1]):
	for b in P[i+1:]:
		s += ((a[0] - b[0])**2 + (a[1] - b[1])**2)**0.5
print(s / n * 2)

Measured memory_bytes: 38384
#include"bits/stdc++.h"
using namespace std;
int main(){

    int a,b,c;
    cin>>a>>b>>c;
   int x=99999999; /// minimum;
   int y=-9999999;/// maximum
    x=max(a,max(b,c));
    y=min(a,min(b,c));
  cout<<x-y;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>

#define M 400010

using namespace std;

int Head[M], Next[M], Go[M], Cnt = 0, n, lst = 1, nw;

bool used[M];

void addedge(int x, int y) {
    Go[++Cnt] = y;
    Next[Cnt ] = Head[x];
    Head[x] = Cnt;
    
}

set <int> hh;

int tmpV[M], Bel[M], Fa[M], Sz[M], F[M], BB[M];

void DFS1(int x, int f, int b, int bb) {
    Bel[x] = b;
    Fa[x] = f;
    Sz[x] = 1;
    BB[x] = bb;
    for(int T = Head[x]; T; T = Next[T]) if(Go[T] != f && Go[T] < nw) DFS1(Go[T], x, b, bb), Sz[x] += Sz[Go[T]];
}

void DFS2(int x, int f, int g) {
    used[x] = 1;
    F[x] = g;
    for(int T = Head[x]; T; T = Next[T]) if(Go[T] != f && Go[T] < nw) DFS2(Go[T], x, g);
}
int main() {
    scanf("%d", &n);
    for(int i = 1; i < n; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        addedge(a, b);
        addedge(b, a);
    }
    used[1] = 1, BB[1] = 1;
    for(int i = 2; i <= n; i++) {
        nw = i;
        BB[i] = i;
        int tmpg;
        for(int T = Head[i]; T; T = Next[T]) if(used[Go[T]]) {
            used[i] = 1;
            tmpg = Go[T];
            break;
        }
        if(!used[i]) continue;
        priority_queue <int> Q;
        while(!Q.empty()) Q.pop();
        for(int T = Head[i]; T; T = Next[T]) if(Go[T] != tmpg && Go[T] < i) {
            Q.push(-Go[T]);
            DFS1(Go[T], i, Go[T], i);
        }
        F[i] = F[tmpg] + 1;
        lst = BB[tmpg];
        while(!Q.empty()) {
            int x = -Q.top();
            Q.pop();
            if(x > lst) break;
            tmpV[Bel[x]]++;
            F[i]++;
            for(int T = Head[x]; T; T = Next[T])
                if(Go[T] != Fa[x]) Q.push(-Go[T]);
        }
        for(int T = Head[i]; T; T = Next[T]) if(Go[T] != tmpg && Go[T] < i) {
            DFS2(Go[T], i, F[i] + Sz[Go[T]] - tmpV[Go[T]]);
        }
    }
    for(int i = 2; i <= n; i++) printf("%d%c", F[i], " \n"[i == n]);
    return 0;
}

Measured memory_bytes: 27648
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        if (n % 2 == 0) {
            System.out.println((n - 1) / 2 * n + n / 2);
            return;
        }
        System.out.println(n / 2 * n);
    }

}


Measured memory_bytes: 21844
from collections import Counter

n=int(input())
a=list(map(int,input().split()))
counter=Counter(a)
c_k=sorted(counter.keys(),reverse=True)
ans=0
l=[0]
for i in c_k:
    if counter[i]>=2:
        ans=max(ans,i*l[-1])
        l.append(i)
    if counter[i]>=4:
        ans=max(ans,i*i)
    if ans!=0:
        print(ans)
        exit()
print(0)

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n, c;
    cin >> n >> c;
    vector<vector<int>> d(c, vector<int>(c)), col(n, vector<int>(n)), a(3, vector<int>(c)); // [from][to], [row][collum], [][]
    for(int i = 0; i < c; ++i){
        for(int j = 0; j < c; ++j){
            cin >> d[i][j];
        }
    }
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            cin >> col[i][j];
            --col[i][j];
            ++a[(i+j) % 3][col[i][j]];
        }
    }
    ll ans = LLINF;
    for(int i = 0; i < c; ++i){
        for(int j = 0; j < c; ++j){
            if(i == j) continue;
            for(int k = 0; k < c; ++k){
                if(j == k || i == k) continue;
                ll tmp = 0;
                for(int i2 = 0; i2 < c; ++i2){
                    tmp += a[0][i2] * d[i2][i];
                }
                for(int j2 = 0; j2 < c; ++j2){
                    tmp += a[1][j2] * d[j2][j];
                }
                for(int k2 = 0; k2 < c; ++k2){
                    tmp += a[2][k2] * d[k2][k];
                }
                ans = min(ans, tmp);
            }
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1280
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

type Key struct {
	a, b int
}

func main() {
	sc.Split(bufio.ScanWords)

	n, m := nextInt(), nextInt()
	a := make([]int, m)
	b := make([]int, m)
	ab := make(map[Key]bool)

	for i := 0; i < m; i++ {
		a[i], b[i] = nextInt(), nextInt()
		ab[Key{a[i], b[i]}] = true
	}

	for i := 1; i <= n; i++ {
		if ab[Key{1, i}] && ab[Key{i, n}] {
			fmt.Println("POSSIBLE")
			return
		}
	}

	fmt.Println("IMPOSSIBLE")

	// land := make([][]int, n+1)
	// for i := 0; i < n+1; i++ {
	// 	land[i] = make([]int, n+1)
	// }
	// // land[0] = 1
	// for i := 0; i < m; i++ {

	// 	land[a[i]][b[i]] = 1
	// }

	// for i := 0; i < m; i++ {
	// 	cost := 0
	// 	if a[i] == 1 {
	// 		prev := a[i]
	// 		next := b[i]
	// 		for {
	// 			cost += land[prev][next]
	// 			prev = next
	// 			next
	// 		}
	// 	}

	// }

	// fmt.Println(land)

	// next := 0
	// cnt := 0
	// can := false
	// for {
	// 	next = land[next]
	// 	cnt++
	// 	// fmt.Printf("next=%d cnt=%d\n", next, cnt)

	// 	if cnt == 3 {
	// 		if next == n {
	// 			can = true
	// 			break
	// 		}
	// 	}

	// 	if cnt > 3 {
	// 		break
	// 	}
	// }

	// if can {
	// 	fmt.Println("POSSIBLE")
	// } else {
	// 	fmt.Println("IMPOSSIBLE")
	// }

}


Measured memory_bytes: 15488
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();
        int c = sc.nextInt();
        int d = sc.nextInt();
        boolean one = false;
        boolean nine = false;
        boolean seven = false;
        boolean four = false;
        if (a == 1 || b == 1 || c == 1 || d == 1) {
            one = true;
        }
        if (a == 9 || b == 9 || c == 9 || d == 9) {
            nine = true;
        }
        if (a == 7 || b == 7 || c == 7 || d == 7) {
            seven = true;
        }
        if (a == 4 || b == 4 || c == 4 || d == 4) {
            four = true;
        }
        if (one && nine && seven && four) {
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }
}


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

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef pair<int, int> pi;
typedef long double ld;
typedef pair<long double, long double> pld;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll gcd(ll n, ll m) {
    if(n > m) {
        ll l = n;
        n = m;
        m = l;
    }
    if(n == 0) {
        return m;
    }
    while(1) {
        ll l = n;
        n = m % n;
        m = l;
        if(n == 0) {
            break;
        }
    }
    return m;
}

bool isprime(ll n) {
    if(n == 1) {
        return false;
    }
    if(n == 2) {
        return true;
    }
    ll sq = (ll)sqrt(double(n));
    for(ll i = 2; i <= sq; i++) {
        if(n % i == 0) {
            return false;
        }
    }
    return true;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll i, j, k, l;

    ll N;
    cin >> N;
    vll A(N);
    for(auto &e : A)
        cin >> e;
    // setwise
    ll g = A[0];
    for(i = 1; i < N; i++) {
        g = gcd(g, A[i]);
    }
    if(g > 1) {
        cout << "not coprime" << endl;
        return 0;
    }
    // pairwise
    for(i = 2; i <= 1010; i++) {
        if(!isprime(i)) {
            continue;
        }
        ll count = 0;
        for(j = 0; j < N; j++) {
            if(A[j] % i == 0) {
                count++;
                A[j] = A[j] / i;
            }
        }
        if(count >= 2) {
            cout << "setwise coprime" << endl;
            return 0;
        }
    }
    set<ll> pset;
    for(i = 0; i < N; i++) {
        if(A[i] > 1000 && isprime(A[i])) {
            auto itr = pset.find(A[i]);
            if(itr != pset.end()) {
                cout << "setwise coprime" << endl;
                return 0;
            }
            pset.insert(A[i]);
        }
    }
    cout << "pairwise coprime" << endl;

    return 0;
}


Measured memory_bytes: 11108
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int n;
    string str;
    cin >> n >> str;

    for (int i = 0; i <= 1; i++) {
        for (int j = 0; j <= 1; j++) {
            vector<bool> ans(n);
            ans[0] = (bool) i;
            ans[1] = (bool) j;

            for (int k = 2; k < n; k++) {
                ans[k] = (str[k-1] == 'o') == ans[k-1] ? ans[k-2] : !ans[k-2];
            }

            if (!(((str[n-1] == 'o') == ans[n-1]) == (ans[n-2] == ans[0]) && ((str[0] == 'o') == ans[0]) == (ans[n-1] == ans[1]))) continue;

            string ret = "";
            for (int k = 0; k < n; k++) ret += (ans[k] ? "S" : "W");
            cout << ret << endl;
            return 0;
        }
    }

    cout << -1 << endl;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int A, B, C, X, Y;
int answer;
int judge(void){
 int over = C * max(X, Y) * 2;
 int under = max(C * Y * 2 + A * ( X - Y ),C * X * 2 + B * ( Y - X ));
 return min(over,under);
}

int main(){
 cin >> A >> B >> C >> X >> Y;

 if( (A + B) / 2 <  C){
  answer = A * X + B * Y;
 } else {
  answer = judge();
 }

 cout << answer << endl;
 return 0; 
};


Measured memory_bytes: 256
//?§?????????????????§???§??¨???
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) throws IOException{
		
		BufferedReader br =
				new BufferedReader(new InputStreamReader(System.in));
		
		String str = br.readLine();
		int num = Integer.parseInt(str);
		
		int hour=0;
		int minute=0;
		int count=0;
		
		hour = (int) Math.floor(num/3600);
		minute = (int)Math.floor((num-(hour*3600))/60);
		count = (num-(hour*3600)-(minute*60));
	    
	    System.out.println(hour + ":" + minute + ":"+ count);
	}
}
		

Measured memory_bytes: 24412
#include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <ctime>
#include <iterator>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

long long pgcd(long long a,long long b)
{
    if(a!=0)
        return pgcd(b%a,a);
    return b;
}

int main()
{
    long long a,b;
    cin>>a>>b;
    cout<<pgcd(a,b)<<endl;
}

Measured memory_bytes: 1156
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

vector<string> dfs(string s, ll depth, vector<char> symbol)
{
    vector<string> ret;
    if (depth == 0)
    {
        ret.push_back(s);
        return ret;
    }

    for (ll i = 0; i < symbol.size(); i++)
    {
        auto vec = dfs(s + symbol[i], depth - 1, symbol);
        for (auto &&e : vec)
        {
            ret.push_back(e);
        }
    }
    return ret;
}

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return b;
    }
    return gcd(b, a % b);
}

int main()
{
    ll N, A;
    cin >> N >> A;

    cout << (N % 500 <= A ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
    int n;
    char z;
    cin>>n;
    bool ok=true;
    lol(i,n){
	cin>>z;
	if(z=='Y')ok=false;
    }
    cout<<(ok?"Three":"Four")<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  int n , i;
  string s , t;
  cin >> n;
  cin >> s >> t;
  for(i=0;i<n;i++)
  {
    if(s.substr(i) == t.substr(0,n-i))
    {
      cout <<  (s + t.substr(n-i)).size();
      return 0;
    }
  }
  cout << 2*n;
  return 0;
}


Measured memory_bytes: 256
N = gets.to_i
ss, sst = [], Array.new(N){Array.new(N)}
N.times do |i|
    ss[i] = gets.chomp.split('')
end

sst = ss.transpose

sum = 0
(0...N).each do |a|
    sum += 1 if N.times.all?{|j| ss[j] == sst[j]}
    N.times { |i| ss[i].rotate!(1) }
    sst.rotate!(1)
end
puts sum*N


Measured memory_bytes: 8060
/** @Date    : 2017-05-30 21:31:45
  * @FileName: C 位运算 范围.cpp
  * @Platform: Windows
  * @Author  : Lweleth (SoungEarlf@gmail.com)
  * @Link    : https://github.com/
  * @Version : $Id$
  */
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int ,int>
#define MP(x, y) make_pair((x),(y))
#define fi first
#define se second
#define PB(x) push_back((x))
#define MMG(x) memset((x), -1,sizeof(x))
#define MMF(x) memset((x),0,sizeof(x))
#define MMI(x) memset((x), INF, sizeof(x))
using namespace std;

const int INF = 0x3f3f3f3f;
const int N = 1e5+20;
const double eps = 1e-8;


int main()
{
	LL a, b;
	while(cin >> a >> b)
	{
		if(a == b)
		{
			printf("1\n");
			continue;
		}
		LL t = 1LL << 60;
		while((a & t) == (b & t))
			t >>= 1;
		LL m = t;
		a &= (t << 1) - 1;
		b &= (t << 1) - 1;
		while(m > 1 && (b & (m >> 1)) == 0)//小于m+t的数
			m >>= 1;
		LL ans = 0;
		if(m <= a)//[a, t)U[t, t+m)U[t+a, 2t)
			ans = t - a + t + m - a;
		else ans = 2 * t - a;
		printf("%lld\n", ans);
	}
    return 0;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N = int(input())

for _ in range(11):
    N -= 1000
    if N <= 0:
        break
ans = abs(N)
print(ans)

Measured memory_bytes: 9176
import java.util.Scanner;
import java.lang.Math;

public class Main{
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);

        double r = sc.nextDouble();
        double pi = Math.PI;
        double area = r * r * pi;
        double length = 2 * r *pi;
        System.out.printf("%f %f",area,length);
        sc.close();
    }    
}


Measured memory_bytes: 28032
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
#include <complex>
#include <assert.h>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

static const double EPS = 1e-10;

typedef complex<double> Point;

int main(){
  int n;
  while(~scanf("%d",&n)){
    if(n == -1) break;
    Point player = Point(1.0, 0.0);
    
    //looking at ido
    while(--n > 0){
      Point next = -player;
      next *= exp( complex< double >( .0, -90.0*M_PI/180.0 ) );
      player += next / abs(next);
    }
    printf("%.2lf\n%.2lf\n",player.real(),player.imag());
  }
}

Measured memory_bytes: 1244
import java.io.IOException;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
        long l = in.nextLong();

        double c = (double) l / 3;
        double m = c * c * c;
        System.out.println(String.format("%.8f",m));
    }
}

Measured memory_bytes: 20692
let input = readLine()!.split(separator: " ").map{ Int($0)! }
let N = input[0]
let M = input[1]

enum Color: Character {
    case white = "."
    case black = "#"
}

var A = [[Color]]()
var B = [[Color]]()

for _ in stride(from: 0, to: N, by: 1) {
    A.append(Array(readLine()!).map { Color(rawValue: $0)! })
}
for _ in stride(from: 0, to: M, by: 1) {
    B.append(Array(readLine()!).map { Color(rawValue: $0)! })
}

func solveB() -> Bool {
    for ix in stride(from: 0, through: N - M, by: 1) {
        for iy in stride(from: 0, through: N - M, by: 1) {
            var containsB = true
            B: for jx in stride(from: 0, to: M, by: 1) {
                for jy in stride(from: 0, to: M, by: 1) {
                    if A[ix + jx][iy + jy] != B[jx][jy] {
                        containsB = false
                        break B
                    }
                }
            }
            if containsB {
                return true
            }
        }
    }
    return false
}

print(solveB() ? "Yes" : "No")


Measured memory_bytes: 8088
#include <stdio.h>
#include <string.h>

int main(void)
{
    char s[100001];
    scanf("%s", s);

    int s_len = strlen(s);

    long reminder_divided_by_13[13] = { 0 };

    reminder_divided_by_13[0] = 1;

    const int mod = 1000000007;

    long digit = 1;

    for (int i = s_len - 1; i >= 0; i--) {
        long next_reminder[13] = { 0 };

        if (s[i] == '?') {
            for (int j = 0; j < 10; j++) {
                for (int k = 0; k < 13; k++) {
                    next_reminder[(j * digit + k) % 13] += reminder_divided_by_13[k];
                    next_reminder[(j * digit + k) % 13] %= mod;
                }
            }
        } else {
            int j = s[i] - '0';
            for (int k = 0; k < 13; k++) {
                next_reminder[(j * digit + k) % 13] += reminder_divided_by_13[k];
                next_reminder[(j * digit + k) % 13] %= mod;
            }
        }
        digit *= 10;
        digit %= 13;

        for (int j = 0; j < 13; j++) {
            reminder_divided_by_13[j] = next_reminder[j];
        }
    }

    printf("%ld\n", reminder_divided_by_13[5]);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
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 long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    string s; cin >> s;

    int a = (s[0] - '0') * 10 + (s[1] - '0');
    int b = (s[2] - '0') * 10 + (s[3] - '0');

    int f = 0;
    if (a > 12 || a == 0)
        f += 2;
    if (b > 12 || b == 0)
        f++;

    if (f == 0) cout << "AMBIGUOUS" << endl;
    else if (f == 1) cout << "MMYY" << endl;
    else if (f == 2) cout << "YYMM" << endl;
    else if (f == 3) cout << "NA" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0),cin.tie(0);
int main() {IOS;
    int n;
    cin>>n;
    int dp[n];
    vector<int> H;
    memset(dp,0, sizeof(dp));
    for(int i=0;i<n;i++)
    {
        int temp;
        cin>>temp;
        H.push_back(temp);
    }
    bool change=true;
    dp[1]=abs(H[1]-H[0])+dp[0];
    for(int i=2;i<n;i++)
    {
        dp[i]=min(abs(H[i]-H[i-1])+dp[i-1],abs(H[i]-H[i-2])+dp[i-2]);
    }/*
    int flag=0;
    while(change)
    {
        change= false;
        for(int i=2;i<n;i++)
        {
            int t=abs(H[i]-H[i-2])+dp[i-2];
            if(t<dp[i])
            {
                dp[i]= t;
                change= true;
            }
        }
        if(!change)
            break;
        for(int i=1;i<n;i++)
        {
            int t=abs(H[i]-H[i-1])+dp[i-1];
            if(t<dp[i])
            {
                dp[i]= t;
                change= true;
            }
        }
    }*/
    cout<<dp[n-1];
}


Measured memory_bytes: 4212
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    int n, k, q;
    cin >> n >> k >> q;
    vector<int> a(n);
    for(int i = 0; i < n; ++i)  cin >> a[i];

    int ans = INF;
    for(int i = 0; i < n; ++i){
        vector<int> pos;
        pos.push_back(-1);
        for(int j = 0; j < n; ++j){
            if(a[j] < a[i]) pos.push_back(j);
        }
        pos.push_back(n);
        int sz = pos.size();
        vector<int> val;
        for(int j = 0; j + 1 < sz; ++j){
            vector<int> foo;
            int left = pos[j] + 1, right = pos[j + 1];
            for(int x = left; x < right; ++x){
                foo.push_back(a[x]);
            }
            sort(foo.begin(), foo.end(), greater<int>());
            int sz2 = foo.size();
            for(int x = k - 1; x < sz2; ++x){
                val.push_back(foo[x]);
            }
        }
        if(val.size() < q)  continue;
        sort(val.begin(), val.end());
        chmin(ans, val[q - 1] - val[0]);
    }
    cout << ans << endl;
}

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

int dx[] = {1 , -1 , 0 ,  0};
int dy[] = {0 ,  0 , 1 , -1};
#define ll long long
#define vi vector <int>
#define pi pair< int , int >
#define pl pair< ll , ll >
#define pii pair< pi , int >
#define fr first
#define sc second
#define pb push_back
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define PI acos(-1)
#define eps 1e-6
#define OO   INT_MAX
#define infin LLONG_MAX
#define mod 1000000007
#define SPEED_UP ios_base::sync_with_stdio(false); cin.tie(NULL);
#define SZ(x) ((int)(sizeof(x)))
#define sz(v) (int)v.size()
#define all(t) t.begin(),t.end()
#define frei freopen("in.in","r",stdin)
#define freo freopen("out.out","w",stdout)
#define SET(x,y)    x|=(1<<y)
#define CLEAR(x,y)  x&= ~(1<<y)
#define TOGGLE(x,y) x^=(1<<y)
#define READ(x,y)   ((bool)((ll)(x&(1<<y)) != 0))
#define I(x) scanf("%d",&x)
#define I2(x,y) scanf("%d%d",&x,&y)
#define I3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define I4(x,y,z,r) scanf("%d%d%d%d",&x,&y,&z,&r)
#define L(x) scanf("%I64d",&x)
#define L2(x,y) scanf("%I64d%I64d",&x,&y)
#define L3(x,y,z) scanf("%I64d%I64d%I64d",&x,&y,&z)
#define L4(x,y,z,r) scanf("%I64d%I64d%I64d%I64d",&x,&y,&z,&r);
#define D4(x,y,z,r) scanf("%lf%lf%lf%lf",&x,&y,&z,&r);
#define MAX (int)1e5+100
int n,k,a[MAX];
ll dp[MAX];
ll get(int i = 0)
{
    if(i >= n)return 1e15;
    if(i == n-1)return 0;
    if(dp[i] + 1)return dp[i];
    ll ret = 1e15;
    for(int j = i+1 ; j <= min(n-1,i+k); j++)
        ret = min(ret , get(j) + abs(a[i] - a[j]));
    return dp[i] = ret;
}
int main()
{
    memset(dp,-1,SZ(dp));
    scanf("%d%d",&n,&k);
    FOR(i,0,n)scanf("%d",&a[i]);
    printf("%I64d\n",get());
    return 0;
}


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

int main(){

    ll ans = 0, N, H, W;
    cin >> N >> H >> W;
    for(ll i = 0; i < N; i++){
        ll h, w;
        cin >> h >> w;
        if(h >= H && w >= W)ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256