akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

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

		BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));
		String str="";
		int ipt=0;
		int pkz=0;
		boolean isp=true;
		try {
			str=bfr.readLine();
			int kazu=Integer.parseInt(str);

			if(str=="") {
				System.exit(0);
			}

			for(int i=0; i<kazu; i++) {
				isp=true;
				str=bfr.readLine();
				ipt=Integer.parseInt(str);

				for(int j=2; j<(int)Math.sqrt(ipt)+1; j++) {
					if(ipt%j!=0) {
						// nann mo sen
						if(j==(int)Math.sqrt(ipt) && isp==true) {
							isp=true;
						}
					}
					else {
						isp=false;
						break;
					}
				}
				if(isp==true) {
					pkz++;
				}
			}
			System.out.println(pkz);
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}

		catch(NumberFormatException e) {
			System.exit(0);
		}

		catch(NullPointerException e) {
			System.exit(0);
		}

	}

}


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

int main(){
  ll a,b,c,k;
  ll ans = 0;
  cin >> a >> b >> c >> k;
  if(a > k)
    ans = k;
  else if(a+b > k)
    ans = a;
  else if(a+b+c >= k)
    ans = a - (k -(a+b));
  cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>
#include <numeric>
#include <functional>

typedef signed char        int8;
typedef short              int16;
typedef int                int32;
typedef long long          int64;
typedef unsigned char      uint8;
typedef unsigned short     uint16;
typedef unsigned int       uint32;
typedef unsigned long long uint64;

int main(void) {
  int n;
  std::cin >> n;
  std::string s;
  std::cin >> s;

  std::vector<int> r;
  std::vector<int> g;
  std::vector<int> b;

  std::map<int, bool> rm;
  std::map<int, bool> gm;
  std::map<int, bool> bm;

  for (int i = 0; i < n; i++) {
    switch (s.at(i))
    {
    case 'R':
      r.push_back(i);
      rm[i] = true;
      break;
    case 'G':
      g.push_back(i);
      gm[i] = true;
      break;
    case 'B':
      b.push_back(i);
      bm[i] = true;
      break;
    default:
      break;
    }
  }

  int64 rnum = r.size();
  int64 gnum = g.size();
  int64 bnum = b.size();
  int64 base = rnum * gnum * bnum;
  int64 subcnt = 0;
  for (int i = 0; i < r.size(); i++) {
    for (int j = 0; j < g.size(); j++) {
      int ri = r.at(i);
      int gi = g.at(j);
      int diff = std::abs(ri - gi);
      int sm = ri;
      int lg = gi;
      if (sm > lg) {
        std::swap(sm, lg);
      }
      int cnd1 = sm - diff;
      int cnd2 = lg + diff;
      int cnd3 = -1;
      if ((lg - sm) % 2 == 0) {
        cnd3 = (lg + sm) / 2;
      }
      if (bm.count(cnd1) != 0) {
        subcnt++;
      }
      if (bm.count(cnd2) != 0) {
        subcnt++;
      }
      if (bm.count(cnd3) != 0) {
        subcnt++;
      }
    }
  }
  int64 ans = base - subcnt;
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 3756
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <cmath>
#include <algorithm>
#define N 605
#define INF 0x3f3f3f3f
using namespace std;
int n,m;
vector<int>v[N];
double dp[N]={0};
double process(int p)//对于p这个顶点删除其连着的最大的出边 
{
	int i,j;
	for(i=1;i<=n;i++)dp[i]=0.0;
	dp[n]=0.0;
	for(i=n-1;i>=1;i--)
	{
		if(v[i].size()==1&&p==i)//i出度为1且 要删它的边 
		{
			dp[i]=INF;
			continue;
		}
		double len=v[i].size()-(p==i);
		dp[i]=1.0;
		double mmax=0;
		for(j=0;j<v[i].size();j++)
		{
			double temp=dp[v[i][j]];
			mmax=max(mmax,temp);
			dp[i]+=temp*1.0/len;
		}
		if(i==p)dp[i]-=mmax*1.0/len;
	}
	//cout<<dp[1]<<endl;
	return dp[1]; 
}
int main()
{
	cin>>n>>m;
	int i;
	for(i=1;i<=m;i++)
	{
		int s,t;
		scanf("%d%d",&s,&t);
		 v[s].push_back(t);//出边 
	}
	double ans=INF;
	for(i=n;i>=1;i--)
	{
		ans=min(ans,process(i));
	}
	printf("%.10lf",ans);
	return 0;
}

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


int main(){
    int N, K;
    cin >> N >> K;
    vector<float> p(N);
    for(int i=0; i<N; i++) cin >> p.at(i);
    for(int i=0; i<N; i++) p.at(i) = (p.at(i) + 1) / 2;
    vector<double> q(N);
    q.at(0) = p.at(0);
    for(int i=1; i<N; i++) q.at(i) = q.at(i-1) + p.at(i);
    vector<double> r(N - K + 1);
    r.at(0) = q.at(K-1);
    for(int i=1; i<N-K+1; i++){
        r.at(i) = q.at(i+K-1) - q.at(i-1);
    }
    double max = 0;
    for(int i=0; i<N-K+1; i++){
        if(max < r.at(i)) max = r.at(i);
    }
    cout << fixed << setprecision(12);
    cout << max << endl;
}

Measured memory_bytes: 7240
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<signed(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 20000000000;
typedef std::pair<int,int> P;


	ll ans=INF;
	ll N,K,G,A[500010],B[500010];
	ll sum;
	priority_queue<pair<double,int>> S;
ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}
bool F[100];
int main(){
	ios_base::sync_with_stdio(false);
	cin>>N>>G;
	REP(i,N){
		cin>>A[i]>>B[i];
	}
	REP(Bit,1<<N){
		ll sum=0;
		ll temp=0;
		REP(i,N){
			if(Bit&1<<i){
				sum+=(i+1)*100*A[i]+B[i];
				temp+=A[i];
			}
		}
		if(sum>=G)ans=min(ans,temp);
		else{
			REP(i,N){
				if(!(Bit&1<<(N-i-1))){
					if(sum+A[N-i-1]*(N-i)*100<G){
						sum+=A[N-i-1]*(N-i)*100;
						temp+=A[N-i-1];
					}else{
						temp+=(G-sum+((N-i)*100)-1)/((N-i)*100);
						ans=min(ans,temp);
						break;
					}
				}
			}
		}

	}

	cout<<ans<<endl;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1ll << 60;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

#ifdef WIN32
#define dump(x) cout << #x << " = " << (x) << "\n"
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n"
#else
#define dump(x)
#define debug(x)
#endif

int n;
int dp[ 31 ];

void solve() {
	CLR( dp );
	dp[ 0 ] = 1;
	for ( int i = 0; i <= n; i++ ) {
		for ( int j = 1; j < 4; j++ ) {
			if ( i - j < 0 ) {
				break;
			}
			dp[ i ] += dp[ i - j ];
		}
	}
	int ans = ( dp[ n ] / 10 + !!( dp[ n ] % 10 ) ) / 365 + !!( ( dp[ n ] / 10 + !!( dp[ n ] % 10 ) ) % 365 );
	cout << ans << "\n";
}

int main() {
	ios::sync_with_stdio( false );
	cin.tie( 0 );
#ifdef WIN32
	srand( ( uint ) time( NULL ) );
	cout << "Debug Mode\n";
	while ( true ) {
		n = rand() % 31;
		cout << n << "\n";
		if ( n == 0 ) {
			break;
		}
		solve();
	}
	return 0;
#endif
	while ( cin >> n && n ) {
		solve();
	}
	return 0;
}

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

using namespace std;

int INF=1e9;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            char c;
            cin>>c;
            if(i==j)cout<<c;
        }
    }
    cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  int a = 0, b = 0, c = 0;
  for(int i = 0; i < n; i++){
  	int d, e, f; cin >> d >> e >> f;
    int dist = abs(e - b) + abs(f - c);
    int has = d - a;
    if(has%2 != dist%2 || dist > has){
      cout << "No" << endl;
      return 0;
    }
    a = d;
    b = e;
    c = f;
  }
  cout << "Yes" << endl;
  return 0;
}


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

using namespace std;

int main(int argc, char *argv[]) {
	string S;
	cin >> S;

	int g = 0;
	for (int i = 0; i < S.size(); i++)
		if (S[i] == 'g')
			g++;
	int p = S.size() - g;

	cout << (g - p) / 2 << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
    #define HAR BAR LAGTA HAI APUN HI J BHAGWAAN HAI!!
    #define UTSAV  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    #define ll long long int
    #define MAX 1e9
    #define MIN -1e9
    #define mod 1000000007
    #define pb push_back
    #define all(x) (x).begin(), (x).end()
    #define debug(x) cerr<<#x<<'='<<(x)<<endl;
    #define output(x) cout << ( x ? "YES" : "NO" ) << '\n' ;
    #define mxn 100005
    using namespace std;
    int main()
    {
        UTSAV
       
         ll n;
         cin>>n;
         string s = "ACL";
         for(int i=0;i<n;i++) cout<<s;
        return 0;
    }
       

Measured memory_bytes: 3564
import heapq
n,m=list(map(int,input().split()))
a=list(map(lambda x:int(x)*(-1),input().split()))
heapq.heapify(a)
for i in range(m):
  m=heapq.heappop(a)
  heapq.heappush(a, (-m//2)*(-1))
print(-sum(a))


Measured memory_bytes: 14180
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 1010101010101010;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(){
  string s,t;
  cin>>s>>t;
  int l=s.size()-t.size()+1;
  int ans=INF;
  rep(i,l){
    int sum=0;
    rep(j,t.size()){
      if(s[i+j]!=t[j]) sum++;
    }
    ans=min(sum,ans);
  }
  //ans=t.size()-ans;
  cout<<ans<<endl;
}


Measured memory_bytes: 3624
class SegmentTree:
    """
    0-indexed
    query : [L, R)
    """
    def __init__(self, size, initValue, cmpFunc):
        self.size = 1 << (size.bit_length())  # 完全二分木にする
        self.data = [initValue] * (2 * self.size - 1)
        self.initValue = initValue
        self.cmpFunc = cmpFunc

    def build(self, rawData):
        self.data[self.size - 1: self.size - 1 + len(rawData)] = rawData
        for i in rawData(self.size - 1)[:: -1]:
            self.data[i] = self.cmpFunc(self.data[2 * i + 1], self.data[2 * i + 2])

    def update(self, index, value):
        index += self.size - 1
        self.data[index] = value
        while index >= 0:
            index = (index - 1) // 2
            self.data[index] = self.cmpFunc(self.data[2 * index + 1], self.data[2 * index + 2])

    def query(self, left, right):
        L = left + self.size
        R = right + self.size
        ret = self.initValue
        while L < R:
            if R & 1:
                R -= 1
                ret = self.cmpFunc(ret, self.data[R - 1])
            if L & 1:
                ret = self.cmpFunc(ret, self.data[L - 1])
                L += 1
            L >>= 1
            R >>= 1
        return ret

N, M = map(int, input().split())
LRC = [tuple(map(int, input().split())) for _ in range(M)]
LRC.sort()

tree = SegmentTree(N, float('inf'), min)
tree.update(0, 0)

for l, r, c in LRC:
    l -= 1
    newDist = tree.query(l, r) + c
    if newDist < tree.query(r - 1, r):
        tree.update(r - 1, newDist)
ans = tree.query(N - 1, N)
print(-1 if ans == float('inf') else ans)

Measured memory_bytes: 122964
import itertools

n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))

itc = list(itertools.permutations(sorted(p)))

a = b = 0
for i in range(len(itc)):
  if p == itc[i]:
    a = i
    break

for i in range(len(itc)):
  if q == itc[i]:
    b = i
    break

print(abs(a-b))

    

Measured memory_bytes: 8052
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  double pi = 3.1415926535;
  double a,b,x; cin >> a >> b >> x;
  if(atan(2*(b-x/(a*a))/a) <= atan(b/a)){
    printf("%.20f",atan(2*(b-x/(a*a))/a)*180/pi);
  }else{
    printf("%.20f",atan(b*b*a/(2*x))*180/pi);
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,min=100000000,ans=0;
	cin>>n;
	int a[n];
	for (int i=1;i<=n;i++)
	{
		cin>>a[i];
		if (a[i]>min)
		{
			continue;
		}
		else
		{
			if (a[i]<min)
			{
				min=a[i];
			}
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
 } 

Measured memory_bytes: 1024
#include <iostream>
#include<vector>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define rng(a) a.begin(),a.end()
using ll = long long;

using namespace std;

const ll mod = 1e9+7;


int main() {
    string s;
    cin>>s;
    vector<vector<ll>>dp(s.length()+1,vector<ll>(13));
    dp[0][0] = 1;
    int mul = 1;
    for(int i = 0; i < s.length(); i++) {
        if(s[s.length()-1-i]=='?') {
            rep(j,10) {
                rep(k,13) {
                    dp[i+1][(j*mul+k)%13] += dp[i][k];
                    dp[i+1][(j*mul+k)%13] %= mod;
                }
            }
        }
        else {
            int j = (int)(s[s.length()-1-i]-'0');
            rep(k,13) {
                dp[i+1][(j*mul+k)%13] += dp[i][k];
                dp[i+1][(j*mul+k)%13] %= mod;
            }
        }
        mul *= 10;
        mul %= 13;
    }
    cout<<dp[s.length()][5]<<endl;
    

    return 0;
}


Measured memory_bytes: 16680
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fill(x,c) memset(x,c,sizeof(x))
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head
const int SIZE = 1e6+10;
ll a[SIZE];
int main() {
	//ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll h,w,ans=0;
	string s;
	vector<string> m;
	cin>>h>>w;
	rep(i,0,h){
		cin>>s;
		m.pb(s);
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(m[i][j]=='.'){//枚举m[i][j]为start 
				ll path = 0;
				queue<PII> q;
				map<PII,int> vis;
				q.push({i,j});
				vis[{i,j}] = 1;
				while(!q.empty()){
					int n = q.size(),f=0;
					for(int k = 0;k<n;k++){
						PII p = q.front();q.pop();
						if(p.fi-1>=0&&!vis.count({p.fi-1,p.se})&&m[p.fi-1][p.se]=='.'){
							vis[{p.fi-1,p.se}] = 1;//访问标志
							q.push({p.fi-1,p.se}); f=1;
						}
						if(p.fi+1<h&&!vis.count({p.fi+1,p.se})&&m[p.fi+1][p.se]=='.'){
							vis[{p.fi+1,p.se}] = 1;//访问标志
							q.push({p.fi+1,p.se}); f=1;
						}
						if(p.se-1>=0&&!vis.count({p.fi,p.se-1})&&m[p.fi][p.se-1]=='.'){
							vis[{p.fi,p.se-1}] = 1;
							q.push({p.fi,p.se-1});f=1;
						}
						if(p.se+1<w&&!vis.count({p.fi,p.se+1})&&m[p.fi][p.se+1]=='.'){
							vis[{p.fi,p.se+1}] = 1;
							q.push({p.fi,p.se+1});f=1;
						}
					}
					if(f)path++;
				}
				ans = max(ans,path);
			}
		}
	}
	cout<<ans; 
  	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long dp[307][307];
long long h[307];
int main()
{
	int n,k; cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>h[i];
	for(int i=1;i<307;i++) dp[0][i]=1000000000000000000LL;
	for(int i=1;i<=n+1;i++)
	{
		for(int j=0;j<=k;j++)
		{
			dp[i][j]=1000000000000000000LL;
			for(int r=i-1;r>=0 && i-r<=j+1;r--) dp[i][j]=min(dp[i][j],dp[r][j-i+r+1]+max(0LL,h[i]-h[r]));
		}
	}
	cout<<dp[n+1][k];
}

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

int main(){
  
  //入力
  int N;
  cin >> N;
  int a[110];
  for( int i = 0; i < N; i++ )cin >> a[i];
  
  //処理
    sort(a, a + N, greater<int>()); 
  int score_Alice = 0;
  int score_Bob = 0;
  for( int i = 0; i < N; i++ ){
    
    if( i % 2 == 0 ){
      score_Alice += a[i];
    }
    else{
  score_Bob += a[i];
    }
  }
  
  //出力
  cout << score_Alice - score_Bob << endl;
  
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    long a,b,c,d;
    long koubai,now,tmp,tmp2;
    scanf("%ld %ld %ld %ld",&a,&b,&c,&d);
    if(c<d){
        now=c;
        c=d;
        d=now;
    }
    tmp=c;now=d;
    while(now!=0){
        tmp2=now;
        now=tmp%now;
        tmp=tmp2;
    }
    koubai=c*d/tmp;
    printf("%ld",b-a+1-(b/c-(a-1)/c)-(b/d-(a-1)/d)+(b/koubai-(a-1)/koubai));
    return 0;
}

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

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

int main(){
  int n;
  cin>>n;
  
  ll ans=1,x;
  rep(i,n){
    cin>>x;
    ans=ans*x/(__gcd(ans,x));
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 3096
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)

	if a == b && b == c && a%2 == 0 {
		fmt.Println(-1)
		return
	}

	ans := 0
	for {
		if a%2 == 1 || b%2 == 1 || c%2 == 1 {
			fmt.Println(ans)
			return
		}
		aa, bb, cc := a/2, b/2, c/2
		a, b, c = bb+cc, aa+cc, aa+bb
		ans++
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define EPS 0.00000000001
#define pi 3.141592653589793238
using namespace std;
double a,b,x,tem,l,r,mid;
int main(){
	cin>>a>>b>>x;
	if(x==a*a*b)
	{
		cout<<0<<endl;
		return 0; 
	}
	if(x*2<=a*a*b)
	{
		tem=b*b*a/x/2;
		printf("%.10lf\n",atan(tem)*180/pi);
	}
	else
	{
		x=a*a*b-x;
		tem=a*a*a/x/2;
		printf("%.10lf\n",90-atan(tem)*180/pi);
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
    int a,b,k;
    cin >> a >> b >> k;

    if (b-a+1 <= 2*k)
    {
        for(int i = a; i <= b; i++)
        {
            cout << i << endl;
        }
    }else
    {
        for(int i = 0; i < k; i++)
        {
            cout << a+i << endl;
        }
        for(int i = k-1; i >= 0; i--)
        {
            cout << b - i << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vll vector <pll>
#pragma 03
using namespace std;
ll mod = 1e9 + 7;
ll dp[1005][1005];
char matrix[1005][1005];
int main(){
	ll h, w;
	cin >> h >> w;
	for (int i = 0; i<h; i++){
		for (int j = 0; j<w; j++) cin >> matrix[i][j];
	}
	dp[0][0] = 1;
	for (int i = 1; i<h; i++){
		if (matrix[i][0] == '.') dp[i][0] = dp[i-1][0];
		else dp[i][0] = 0;
	}
	for (int i = 1; i<w; i++){
		if (matrix[0][i] == '.') dp[0][i] = dp[0][i-1];
		else dp[0][i] = 0;
	}
	for (int i = 1; i<h; i++){
		for (int j = 1; j<w; j++){
			if (matrix[i][j] == '.') dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % mod;
			else dp[i][j] = 0;
		}
	}
	cout << dp[h-1][w-1] << endl;
	return 0;
}
 


Measured memory_bytes: 9088
// Last Change: 04/26/2020 21:07:10.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  ll A, B, C, D;
  cin >> A >> B >> C >> D;

  bool flag = true;
  while (A > 0 and C > 0) {
    // Takahashi's turn
    if (flag) {
      C -= B;
    }
    // Aoki's turn
    else {
      A -= D;
    }
    flag = !flag;
  }
  cout << (flag ? "No" : "Yes") << endl;
}


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

int main(){
  int n,m; cin >>n >>m; int sum=0;
  vector<int>v(n); vector<int>s(n,1);
  for(int i=0; i<n; i++) cin >>v[i];
  for(int i=0; i<m; i++)
  {
    int a,b; cin >>a >>b;
    if(v[a-1]<=v[b-1]) s[a-1]=0;
    if(v[a-1]>=v[b-1]) s[b-1]=0;
  }
  for(int i=0; i<n; i++) sum+=s[i];
  cout <<sum;
return 0;}

Measured memory_bytes: 4032
using System;

namespace Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            XY xy = ExtendedEuclid(a,b);
            Console.WriteLine("{0} {1}",xy.x,xy.y);
        }

        static XY ExtendedEuclid(int a, int b)
        {
            int r1 = a;
            int x1 = 1;
            int y1 = 0;
            int r2 = b;
            int x2 = 0;
            int y2 = 1;
            int r3, x3, y3, q;
            while(r2 != 0)
            {
                r3 = r1 % r2;
                q = r1 / r2;
                x3 = x1 - q * x2;
                y3 = y1 - q * y2;
                r1 = r2;
                r2 = r3;
                x1 = x2;
                x2 = x3;
                y1 = y2;
                y2 = y3;
            }
            return new XY(x1,y1);
        }
    }

    class XY
    {
        public int x;
        public int y;

        public XY(int x,int y)
        {
            this.x = x;
            this.y = y;
        }

    }
}

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

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

  int a[ n ];
  for( int i = 0; i < n; i++ ) {
    cin >> a[ i ];
  }

  int swap_cnt = 0;
  for( int i = 0; i < n; i++ ) {
    for( int j = n - 1; j > i; j-- ) {
      if( a[ j ] < a[ j - 1 ] ) {
        swap( a[ j ], a[ j - 1 ] );
        swap_cnt += 1;
      }
    }
  }

  for( int i = 0; i < n; i++ ) {
    cout << a[ i ];
    if( i < n - 1 ) {
      cout << " ";
    }
    else {
      cout << endl;
    }
  }

  cout << swap_cnt << endl;

  return 0;
}



Measured memory_bytes: 3088
// 復習
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;

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

    int n, m; cin >> n >> m;
    vector<bool> safe(n+1, true);
    for (int i = 0; i < m; ++i) {
        int a; cin >> a;
        safe[a] = false;
    }

    vector<ll> dp(n+1);
    dp[0] = 1;
    dp[1] = safe[1];
    for (int i = 2; i <= n; ++i) {
        dp[i] = (dp[i-1] + dp[i-2]) * safe[i];
        dp[i] %= MOD;
    }

    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;

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

Measured memory_bytes: 256
import sys

N = int(input())
#D = list(sorted(list(map(int, input().split()))))
D = list(map(int, input().split()))

check = 0
if not check == D[0]:
    print(0)
    sys.exit()

countl = [0]
D = list(sorted(D))
if not check == D[0]:
    print(0)
    sys.exit()
countl = [0]
for d in D:
    if not check == d:
        check += 1
        countl.append(0)
        if not check == d:
            print(0)
            sys.exit()
    countl[-1] += 1

if not countl[0] == 1:
    print(0)
    sys.exit()

ans = 1
for i in range(len(countl) - 1):
    ans *= pow(countl[i], countl[i + 1], 998244353)
print(ans % 998244353)

Measured memory_bytes: 14396
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
#define ll long long
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int main(){
	fastio();
	int n;
	cin>>n;
	string s;
	cin>>s;
	int ans=0;
	for(int i=0;i<n-2;i++){
		string t  = s.substr(i,3);
		if(t=="ABC") ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 256
H, W = map(int, input().split())

ans = 0

if H % 2 == 0:
    ans += (H // 2)*W
else:
    if W % 2 == 0:
        ans += ((H // 2) + 1)*(W//2)
        ans += (H // 2)*(W//2)
    else:
        ans += ((H // 2) + 1)*((W // 2) + 1)
        ans += (H // 2)*(W//2)
    
if H == 1 or W == 1:
    ans = 1

print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
int main(void) 
{
	int n, m, l, i, j, k;
	int A[100][100] = {0};
	int B[100][100] = {0};
	long C[200][200] = {0};
    
	scanf("%d %d %d", &n, &m, &l);
	for(i = 0; i < n; i++) {
            	for(j = 0; j < m; j++) {
            		scanf("%d", &A[i][j]);
            	}
            }
            
            for(i = 0; i < m; i++) {
            	for(j = 0; j < l; j++) {
            		scanf("%d", &B[i][j]);
            	}
            }
	
	for (i = 0; i < n; i++) {
    		for (j = 0; j < l; j++) {
        			for (k = 0; k < m; k++) {
            			C[i][j] += A[i][k] * B[k][j];
        			}
		}
	}
	
	for (i = 0; i < n; i++) {
		for (j = 0; j < l; j++) {
			if (j == 0) {
				printf("%ld", C[i][j]);
			}
			else {
				printf(" %ld", C[i][j]);
			}
		}
		putchar('\n');
	}
	return 0;
}



Measured memory_bytes: 2192
N=int(input())
S=input()
#リーダーより左のWの個数+右のEの個数の最小化
total_W = S.count('W')
total_E = N-total_W
temp_West_W = 0
temp_East_E = total_E - S[0].count('E')
temp = temp_West_W + temp_East_E
for i in range(N-1):
    temp_West_W = temp_West_W + S[i].count('W')
    temp_East_E = temp_East_E - S[i+1].count('E')
    if temp > temp_West_W + temp_East_E:
        temp=temp_West_W + temp_East_E
print(temp)

Measured memory_bytes: 3676
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main() {
  int n;
 
 
  cin >> n;

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


  sort(a.begin(),a.end());

  vector<P> A;
  int pre = 0;

  for(int i = 0; i < n; i++) {
    while(i < n && a[i] == pre) i++;
    if(i == n) break;
    A.push_back(P(a[i]-pre,n-i));
    pre = a[i];
  }

  ll ans = 0;
  for(int i = 0; i < A.size(); i++) {
    if(A[i].first & 1) ans ^= (ll)A[i].second;
  }

  
  /* for(int i = 0; i < A.size(); i++) {
    cout << A[i].first <<"   "<<A[i].second << endl;
    }*/
  if(ans != 0) cout << "first" << endl;
  else cout << "second" << endl;
}


  


Measured memory_bytes: 1784
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt() * 100, b = sc.nextInt() * 100, c = sc.nextInt(), d = sc.nextInt(), e = sc.nextInt(), f = sc.nextInt();
        int suger = 0;
        int water = a;
        for(int i = 0; a * i <= f; i++)
            for(int j = 0; b * j <= f - a * i; j++){
                int max = (a * i + b * j) / 100 * e;
                for(int k = 0; c * k <= max; k++)
                    for(int l = 0; d * l <= max - c * k; l++){
                        int tmpw = a * i + b * j + c * k + d * l;
                        int tmps = c * k + d * l;
                        if(tmpw > 0 && tmpw <= f && (double)suger / (double) water < (double)tmps /(double) tmpw){
                            suger = tmps;
                            water = tmpw;
                        }
                    }
            }
        System.out.println(water + " " + suger);
    }
}

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

const int mod = 1e9 + 7;

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

/*-------------------------------------------*/

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

    int n;
    cin >> n;
    vector<ll> a(n + 1);
    FOR(i, 1, n + 1) {
        cin >> a[i];
        a[i] += a[i - 1];
    }
    ll ans = 1e9;
    FOR(i, 2, n) {
        auto itr1 = lower_bound(a.begin(), a.end(), a[i] / 2),
             itr2 = lower_bound(a.begin(), a.end(), (a[i] + a[n]) / 2);

        if(abs(a[i] - 2 * *itr1) > abs(a[i] - 2 * *(itr1 - 1))) itr1--;
        if(abs(a[n] + a[i] - 2 * *itr2) > abs(a[n] + a[i] - 2 * *(itr2 - 1)))
            itr2--;
        ll mn = min(min(*itr1, a[i] - *itr1), min(*itr2 - a[i], a[n] - *itr2)),
           mx = max(max(*itr1, a[i] - *itr1), max(*itr2 - a[i], a[n] - *itr2));
        chmin(ans, mx - mn);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC124A
{
    class Program
    {
        static void Main(string[] args)
        {

            int A, B, X;

            var word = Console.ReadLine().Split(' ');

            A = int.Parse(word[0]);
            B = int.Parse(word[1]);



            if (A == B)
                X = A + B;
            else if (A > B)
                X = A + (A - 1);
            else
                X = B + (B - 1);


            Console.WriteLine(X);
            Console.ReadKey();

        }
    }
}


Measured memory_bytes: 13140
X = int(input())
if 400 <= X < 600:
    print(8)
elif 600 <= X < 800:
    print(7)
elif 800 <= X < 1000:
    print(6)
elif 1000 <= X < 1200:
    print(5)
elif 1200 <= X < 1400:
    print(4)
elif 1400 <= X < 1600:
    print(3) 
elif 1600 <= X < 1800:
    print(2)
else:
    print(1)


Measured memory_bytes: 9176
#![allow(non_snake_case, unused_mut)]
//use petgraph::unionfind::UnionFind;
use proconio::fastout;
use proconio::marker::*;
//use std::collections::HashMap;
//use std::collections::HashSet;

#[fastout()]
fn main() {
    proconio::input! {
        S:Chars
    }
    let mut r = 0usize;
    let mut l = 0usize;
    let mut start = 0usize;
    let mut ans = vec![0usize; S.len()];
    for i in 0..S.len() {
        if S[i] == 'L' {
            l += 1;
        }
        if i == S.len() - 1 || S[i] == 'R' {
            if l == 0 {
                r += 1;
            } else {
                // println!("{},{},{}", start, r, l);
                // 集計。start+rの位置とその右に集まる。
                if (r + l) % 2 == 0 {
                    ans[start + r - 1] = (r + l) / 2;
                    ans[start + r] = (r + l) / 2;
                } else {
                    if r % 2 == 0 {
                        ans[start + r - 1] = (r + l) / 2;
                        ans[start + r] = (r + l) / 2 + 1;
                    } else {
                        ans[start + r - 1] = (r + l) / 2 + 1;
                        ans[start + r] = (r + l) / 2;
                    }
                }
                start = i;
                r = 1;
                l = 0;
            }
        }
    }
    for i in 0..S.len() {
        print!("{} ", ans[i]);
    }
}


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

int main(){
  int n,m;
  cin >> n >> m;
  int snk[n+1] = {0};
  //for(auto i: snk){cout << i;}
  for(int i=0; i<m; ++i){
    int cnt;
    cin >> cnt;
    for(int j=0; j<cnt; ++j){
      int tmp;
      cin >> tmp;
      snk[tmp] = 1;
    }
  }
  int sum = 0;
  for(auto i: snk){
    if(!i) sum += 1;
  }
  cout << sum-1 << endl;
  return 0;
}


Measured memory_bytes: 3640
N = int(input())
Ds = list(map(int, input().split()))
if Ds[0] != 0:
  print(0)
  exit()
Ns = [0]*N
for D in Ds:
  Ns[D] += 1
#print(Ns)
if Ns[0] != 1:
  print(0)
  exit()
r = 1
p = 1
for n in Ns:
  #r = r*(p**n)%998244353
  for i in range(n):
    r = r*p%998244353
  p = n
print(r)


Measured memory_bytes: 14396
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;

ll pwr(ll base, ll p, ll mod){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
 

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



int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll a, b, c;
    cin>>a>>b>>c;

    for(int i=0;i<=1000000;i++){
    	if(a%2 == 1 || b%2==1 || c%2==1){
    		cout<<i;
    		return 0;
    	}
    	ll aa = (b+c)/2, bb = (a+c)/2, cc = (a+b)/2;
    	a = aa;	b = bb;	c = cc;
    }

    cout<<"-1";
    return 0;
}










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

using namespace std;

typedef long long int ll;

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

  ll n, d, a;
  cin >> n >> d >> a;
  vector < pair < ll, ll > > v;
  for(int i = 0; i < n; i++){
    ll x, h;
    cin >> x >> h;
    v.push_back({x, (h + a - 1) / a});
  }
  sort(v.begin(), v.end());

  vector < ll > p(n + 2, 0);
  ll bombs = 0, rt;
  for(int i = 0; i < n; i++){
    ll x = v[i].first, req = v[i].second;
    req -= p[i];
    if(req <= 0){
      p[i + 1] += p[i];
      continue;
    }
    bombs += req;
    ll lo = i, hi = n - 1;
    while(lo <= hi){
      ll mid = (hi - lo) / 2 + lo;
      if(v[mid].first <= x + 2 * d){
        lo = mid + 1;
        rt = mid;
      }
      else hi = mid - 1;
    }
    p[rt + 1] -= req;
    p[i] += req;
    p[i + 1] += p[i];
  }

  cout << bombs << endl;
}


Measured memory_bytes: 6384
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define len(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "YES" << endl
#define pyes cout << "Yes" << endl
#define POK cout << "OK" << endl
#define PNO cout << "NO" << endl
#define pno cout << "No" << endl
#define PNG cout << "NG" << endl
#define ret return 0

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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;
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>

signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int sum = 0;
  int m = -1;
  rep(i, 5) {
    int temp;
    cin >> temp;
    m = max(m, (temp + 10 - 1) / 10 * 10 - temp);
    sum += (temp+10-1)/10*10;
  }
  cout << sum - m << endl;
  ret;
}


Measured memory_bytes: 3572
n = int(input())

r = []

for i in range(n):
    city, score = input().split()
    score = int(score)
    r.append((i + 1, city, score))

r.sort(key=lambda x:x[2], reverse=True)
r.sort(key=lambda x:x[1])

for i in range(n):
    print(r[i][0])

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

int main() {
    string S;
    cin >> S;
    if ((S.at(2) == S.at(3)) and (S.at(4) == S.at(5))) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>
using namespace std;
int main(){

  string s;
  int k;
  set <string> li;
  cin>>s>>k;
  for(int i=0;i<(int)s.size();i++){
    for(int j=1;j<=5;j++){
      // if(i+j<(int)s.size()) cout<<s.substr(i,j)<< " ";
      if(i+j<(int)s.size()+1) li.insert(s.substr(i,j));
    }
  }
  auto it=li.begin();
  /*for(int i=0;i<k;i++){
    cout<<*it<<endl;
  advance(it,1);

  }*/
  advance(it,k-1);
  cout<<*it<<endl;
  return 0;

}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
int main(){
    int k;
    int s;
    int ans=0;
    cin >> k>> s;
    for(int i =0;i<=k;i++){
        for(int j =0;j<=k;j++){
            if(s-i-j>=0 && s-i-j<=k) ans++;
        }
    }
    cout << ans<<endl;
}

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

using namespace std;
int mas[1001];
int main()
{
    int n,ans=0;
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>mas[i];
        for(int j=i-1; j>=0; j--){
            for(int k=j-1; k>=0; k--){
                if(mas[i]+mas[j]>mas[k] && mas[i]+mas[k]>mas[j] && mas[j]+mas[k]>mas[i] && mas[i]!=mas[j] && mas[j]!=mas[k] && mas[i]!=mas[k]){
                    //cout<<k<<" "<<j<<" "<<i<<"\n";
                    ans++;
                }
            }
        }
    }
    cout<<ans;
}


Measured memory_bytes: 3628
#include<stdio.h>

int main(){
  long long n,h[100001],i,max=0,num=0;
  h[0]=0;
  scanf("%lld",&n);
  for(i=1;i<=n;i++){
    scanf("%lld",&h[i]);
    if(h[i]<=h[i-1]) {
      num++;
    }
    else{
      num=0;
    }
    if(num>max)max=num;
  }

  printf("%lld",max);
  return 0;
}


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

int main(void){
	int H,W;
	cin >> H >> W;
	string C[H];
	for(int i=0;i<H;i++){
		cin >> C[i];
	}
	for(int i=0;i<H;i++){
		for(int j=0;j<2;j++){
			cout << C[i];
			cout <<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define boido void
#define innto int
#define suitti switch
#define keesu case
#define bureeku break
#define meinn main
#define chaa char
#define foa for
#define ifu if
#define ritaann return
#define sukyannefu scanf
#define purinntoefu printf
 
boido kaitenn(innto daisu[6], innto komanndo) {
    innto tennpu;
    suitti (komanndo) {
        keesu 'E':
            tennpu = daisu[0];
            daisu[0] = daisu[3];
            daisu[3] = daisu[5];
            daisu[5] = daisu[2];
            daisu[2] = tennpu;
            bureeku;
        keesu 'N':
            tennpu = daisu[0];
            daisu[0] = daisu[1];
            daisu[1] = daisu[5];
            daisu[5] = daisu[4];
            daisu[4] = tennpu;
            bureeku;
        keesu 'S':
            tennpu = daisu[0];
            daisu[0] = daisu[4];
            daisu[4] = daisu[5];
            daisu[5] = daisu[1];
            daisu[1] = tennpu;
            bureeku;
        keesu 'W':
            tennpu = daisu[0];
            daisu[0] = daisu[2];
            daisu[2] = daisu[5];
            daisu[5] = daisu[3];
            daisu[3] = tennpu;
            bureeku;
    }
}
 
innto meinn(boido) {
    innto daisu[6];
    chaa komanndo[128];
    innto ai;
    foa (ai = 0; ai < 6; ai++) {
        ifu (sukyannefu("%d", &daisu[ai]) != 1) ritaann 1;
    }
    ifu (sukyannefu("%127s", komanndo) != 1) ritaann 1;
    foa (ai = 0; komanndo[ai] != '\0'; ai++) {
        kaitenn(daisu, komanndo[ai]);
    }
    purinntoefu("%d\n", daisu[0]);
    ritaann 0;
}


Measured memory_bytes: 2148
#!/usr/bin/env python
from collections import defaultdict, deque
import math
from math import factorial
import fractions
import re

BIGNUM = 10 ** 9 + 7

def main():
    L, N = map(int, input().split())
    S = list(input())
    T = list(input())
    
    lcm = len(S) * len(T) // fractions.gcd(len(S), len(T))
    gcd = fractions.gcd(len(S), len(T))
    S_unit = len(S) // gcd
    T_unit = len(T) // gcd

    for i in range(gcd):
        if S[i*S_unit] != T[i*T_unit]:
            print(-1)
            return
    print(lcm)

if __name__ == '__main__':
    main()


Measured memory_bytes: 6500
using Yorukatsu049.Questions;
using Yorukatsu049.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Yorukatsu049.Questions
{
    /// <summary>
    /// ABC120 C
    /// </summary>
    public class QuestionB : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var s = inputStream.ReadLine();
            var red = s.Count(c => c == '0');
            var blue = s.Count(c => c == '1');
            yield return Math.Min(red, blue) * 2;
        }
    }
}


namespace Yorukatsu049
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionB();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace Yorukatsu049.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace Yorukatsu049.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 13276
#解答
w, h, x, y = list(map(int, input().split()))
ans = 0
 
if ((x, y) == (w / 2, h / 2)):
    print("{s} {mul}".format(s=(w * h / 2), mul=1))
else:
    print("{s} {mul}".format(s=(w * h / 2), mul=0))

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb(a) push_back(a);
#define sz(x) sizeof(x);
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;

// head
int main() {
	int n; cin >> n;
	rep(i,0,n) {
		char x; cin >> x;
		if (x == 'Y') {
			printf("%s\n", "Four");
			return 0;
		}
	}
	printf("%s\n", "Three");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i = a;i < n;i++)
#define INF 1e9
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
	ll n,cnt = 0,memo = 0,memo2 = 0,memo3 = 0,r,l,mid;
	cin >> n;
	ll a[n],b[n],c[n];
	rep(i,0,n){
		cin >> a[i];
	}
	rep(i,0,n){
		cin >> b[i];
	}
	rep(i,0,n){
		cin >> c[i];
	}
	
	sort(a,a+n);
	sort(b,b+n);
	sort(c,c+n);
	
	rep(i,0,n){
		l = 0,r = n-1;
		while(r-l > 1){
			mid = (r+l)/2;
			
			if(a[mid] >= b[i]){
				r = mid;
			}
			else{
				l = mid;
			}
		}
		
		
		if(a[l] >= b[i]) continue;
		else if(a[r] < b[i]) memo2 = n;
		else memo2 = r;
		
		//cout << l << " " << r << " " << memo2 <<endl;
		
		l = 0,r = n-1;
		while(r-l > 1){
			mid = (r+l)/2;
			
			if(c[mid] > b[i]){
				r = mid;
			}
			else{
				l = mid;
			}
		}
		//cout << l << " " << r << " " << memo2 <<endl;
		if(c[l] > b[i]) memo2 *= n;
		else if(c[r] <= b[i]) continue;
		else memo2 *= n - r;
		
		memo += memo2;
	}
	
	cout << memo << endl;
	return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
 
int main(){
    int n,l;
    vector<string> v;
    string s;

    cin >> n>>l;
    for(int i=0;i<n;i++){
    cin >>s;
    v.push_back(s);
    }
    sort(v.begin(),v.end());
    for(int i=0;i<n;i++){
        cout << v[i];
    }
    cout<<endl;
}

Measured memory_bytes: 256