akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

int main() {
	int N;
	cin >> N;
	vector<int>A(N);
	rep(i, N) {
		A[i] = i + 1;
	}
	do {
		rep(i, N) {
			cout << A[i];
			if (i != N - 1) {
				cout << ' ';
			}
			else {
				cout << endl;
			}
		}
	} while (next_permutation(A.begin(), A.end()));
}




Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;
 
#define Endl endl
 
/*--------------------template--------------------*/

int main() {
    int A, B;
    cin >> A >> B;
    cout << max(A * B, max(A + B, A - B)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<"\n"

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

  IN(N); IN(M);
  if (N == 1) {
    if (M == 1)
      OUT(1);
    else
      OUT(max(0, M-2));
  } else if (M == 1)
    OUT(max(0, N-2));
  else
    OUT((long long)(N-2) * (M-2));

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#include <random>
#include <bitset>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define pb push_back
#define x  first
#define y  second
#define mp make_pair
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

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

#ifndef ONLINE_JUDGE
	// #include "debug.h"
#else
// #define debug(...) 42
#endif

const int mxN=100;
const ld PI=acos(-1);
const int MD=1e9+7;

int main() {
	fast_cin();
	int t=1;
	// cin>>t;
	while(t--)
	{
		map<int,int>mp;
		int n,cur=0,cn=0;
		cin>>n;
		if(n%2==0){
			cout<<"-1";
			return 0;
		}
		while(1)
		{
			cur=(cur*10+7)%n;
			if(!cur){
				cn++;
				break;
			}
			if(mp[cur]){
				cn=-1;
				break;
			}
			mp[cur]=cn++;
		}
		cout<<cn;
	}
	return 0;	
}

Measured memory_bytes: 50476
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         fozubaoyou    pass System Test!
*/


//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>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//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);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

    if((S[0]!=S[1])||(S[2]!=S[1])){
        cout << "Yes";
    }else{
        cout << "No";
    }
    cout << endl;

}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
	int n;
	while ( ~scanf ( "%d", &n ) ) {
		double sum = 0;
		int ans = 0;
		int a[n];
		for ( int j = 0; j < n; j++ ) {
			scanf ( "%d", &a[j] );
			sum += a[j];
		}
		sum = sum / n;
		int tmp = sum;
		if ( sum - tmp > 0.5 )
			tmp++;
		for ( int j = 0; j < n; j++ )
			ans += ( tmp - a[j] ) * ( tmp - a[j] );
		printf ( "%d\n", ans );
	}
	return 0;
}


Measured memory_bytes: 384
import sys
input = sys.stdin.buffer.readline

def main():
    N = int(input())

    a = list(map(int,input().split()))
    b = list(map(int,input().split()))

    dp = [0]*(N+1)
	
    for ua,ub in zip(a,b):
        for i in range(N):
            if i+ua > N:
                continue
            dp[i+ua] = max(dp[i+ua],dp[i]+(ub-ua))
    
    N += dp[-1]
    dp = [0]*(N+1)

    for ua,ub in zip(a,b):
        for i in range(N):
            if i+ub > N:
                continue
            dp[i+ub] = max(dp[i+ub],dp[i]+(ua-ub))
            
    print(N+dp[-1])
    
if __name__ == "__main__":
	main()


Measured memory_bytes: 228636
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
int n,a[2005],cnt[2005],f[2005][2005],ans[2005],v[2005];
priority_queue<int> q;
void dfs(int x,int y){
    v[x]=1;
    for(int i=1;i<=n;++i){
        if(f[x][i]){
            if(v[i])f[x][i]=0;
            else dfs(i,x);
        }
    }
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i)scanf("%d",a+i);
    sort(a+1,a+n+1);
    for(int i=1;i<n;++i){
        for(int j=i+1;j<=n;++j)if(__gcd(a[i],a[j])>1)f[i][j]=f[j][i]=1;
    }
    for(int i=1;i<=n;++i)if(!v[i])dfs(i,0),q.push(i);
    for(int i=1;i<=n;++i){
        ans[i]=q.top();
        q.pop();
        for(int j=1;j<=n;++j)if(f[ans[i]][j])q.push(j);
    }
    for(int i=1;i<n;++i)printf("%d ",a[ans[i]]);
    printf("%d\n",a[ans[n]]);
    //system("pause");
    return 0;
}


Measured memory_bytes: 16000
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int M=sc.nextInt();
		int X=sc.nextInt();

		int[] michi=new int[N+1];
		for(int i=1; i<=M; i++) {
			michi[sc.nextInt()]=1;
		}

		int keiro1=0;
		int keiro2=0;

		for(int i=X; i>=0; i--) {
			keiro1+=michi[i];
		}

		for(int i=X; i<=N; i++) {
			keiro2+=michi[i];
		}

		System.out.println(Math.min(keiro1, keiro2));
	}
}

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

using namespace std;

typedef long long ll;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

int main() {
  int n; cin >> n;
  vector <int> g[n];
  for(int i = 0; i < n; i++) {
    int x; cin >> x;
    x--;
    g[x].push_back(i);
  }
  if(g[0].empty()) {
    print(-1);
    return 0;
  }
  int cur = -1;
  for(int i = 0; i < n; i++) {
    auto p = lower_bound(g[i].begin(), g[i].end(), cur);
    if(p == g[i].end()) {
      print(n - i);
      return 0;
    }
    cur = *p;
  }
  print(0);
}

Measured memory_bytes: 11264
#include <stdio.h>
#include <string.h>
 
char a[205], b[205];
 
int main()
{
    int k, ans;
    char *p, *q, *wp, *wq;
    char *s[3] = { "IDENTICAL", "CLOSE", "DIFFERENT" };
 
    while (scanf("%s", a) && a[0] != '.') {
        scanf("%s", b); p = a, q = b; ans = -1, k = 0;
        while (*p && *q) {
            if (*p != *q) { ans = 2; break; }
            if (*p == '"') { wp = ++p, wq = ++q;
                while (*p != '"') p++;
                while (*q != '"') q++;
                *p = *q = 0;
                k += 1 - (strcmp(wp, wq) == 0);
                if (k > 1) { ans = 2; break; }
            }
            p++, q++;
        }
        if (ans < 0) if (*p == *q) ans = k; else ans = 2;
        puts(s[ans]);
    }
    return 0;
}


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

int main(){
  long long int n,a,b;
  cin >> n >> a >> b;
  long long int s=n/(a+b);
  long long int t=n%(a+b);
  if(t>=a){
    t=a;
  }
  cout << s*a+t << endl;
}


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

#define REP(i,n) for (int i=0;i<(n);i++)
using namespace std;

int n;
typedef vector<vector<int> > AdjMatrix;
AdjMatrix graph;


int main()
{
    int u,k,v;
    cin >> n;
    graph = AdjMatrix(n, vector<int>(n, 0));
    REP(i,n){
        cin >> u >> k;
        REP(j,k){
            cin >> v;
            graph[u-1][v-1] = 1;
        }
    }

    REP(i, n){
        REP(j, n-1){
            cout << graph[i][j] << " ";
        }
        cout << graph[i][n-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 3180
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef long double f80;

#ifndef LOCAL
#pragma GCC optimize ("O2")
#define endl '\n'
#endif

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

ll pwr(ll a,ll b, ll mod){
    a %= mod;
    int ans = 1;
    while(b){
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

const int N = 205;
pii p[N];
map<pair<int,pii>,int> m;
int g[N * N];
void solve(){
	int n;
	cin >> n;
	fr(i ,1, n){
		cin >> p[i].fi >> p[i].se;
	}
	int ans = pwr(2, n, mod1);
	fr(i, 1, n){
		fr(j, i + 1, n){
			int a = (p[j].se - p[i].se);
			int b = (p[i].fi - p[j].fi);
			int c = (p[i].se * (p[j].fi - p[i].fi) - p[i].fi * (p[j].se - p[i].se));
			int g = abs(__gcd(a, __gcd(b, c)));
			if((a == 0 && b < 0) || a < 0)
				g *= -1;
			a /= g, b /= g, c /= g;
			m[{a, {b, c}}]++;
		}
	}
	fr(i, 1, N - 1){
		g[(i * (i - 1)) / 2] = i;
	}
	for(auto it : m){
		int c = it.se;
		c = g[c];
		int val = (pwr(2, c,mod1) - c - 1 + mod1) % mod1;
		ans = (ans - val + mod1) % mod1;
	}
	ans -= n + 1;
	ans = (ans + mod1) % mod1;
	cout << ans;
}
signed main(){
    IO;
    #ifdef LOCAL
        freopen("inp.txt","r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    cout << setprecision(10) << fixed;
    int t = 1;
    // cin >> t;
    fr(tt, 1, t){
        solve();
    }
    return 0;
}

Measured memory_bytes: 2048
#include<iostream>
#include<algorithm>
#include<complex>
#include<vector>
#include<cmath>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

#define RIGHT 1
#define LEFT -1
const double  eps= 1e-10;
typedef complex<double> P;
typedef vector<P> Polygon;

double cross(P a,P b){
  return a.real()*b.imag()-a.imag()*b.real();
}

P intersection_ll(P a1,P a2,P b1,P b2){
  P a=a2-a1,b=b2-b1;
  return a1+a*cross(b,b1-a1)/cross(b,a);
}

int ccw(P a,P b){
  double tmp=cross(a,b);
  if ( tmp<0)return RIGHT;
  else if (tmp>0)return LEFT;
  return -2;
}


bool cmp(const P &a,const P&b){
  if ( a.real() != b.real())return a.real()<b.real();
  return a.imag()<b.imag();
}

Polygon ConvexHull(int n,P *inp){
  sort(inp,inp+n,cmp);
  P out[n];
  bool used[n];
  int num[n];
  fill(used,used+n,false);
  int p=0;
  out[p++]=inp[0];out[p++]=inp[1];
  
  used[1]=true;
  num[0]=0;num[1]=1;
  for(int i=2;i<n;i++){
    while(p>=2){
      if ( ccw(out[p-1]-out[p-2],inp[i]-out[p-2])==1)break;
      used[num[p-1]]=false;
      p--;
    }
    num[p]=i;
    used[i]=true;
    out[p++]=inp[i];
  }
  
  for(int i=n-2,t=p+1;i>=0;i--){
    if (used[i]==true)continue;
    while(p>=t){
      if ( ccw(out[p-1]-out[p-2],inp[i]-out[p-2])==1)break;
      else p--;
    }
    out[p++]=inp[i];
  }
  


  Polygon ret;
  rep(i,p-1)ret.push_back(out[i]);
  return ret;
}

bool isp(P a,P b,P c){
  return abs(a-c)+abs(b-c) <=abs(a-b)+eps;
}

Polygon Convex_Cut(Polygon in,P a1,P a2){
  Polygon ret;
  int n = in.size();
  rep(i,n){
    P now=in[i],next=in[(i+1)%n];
    if ( ccw(a1-a2,now-a2)==RIGHT
	 ||isp(a1,a2,now))ret.push_back(now);
    if ( ccw(a1-a2,now-a2)*ccw(a1-a2,next-a2)<0)
      ret.push_back(intersection_ll(a1,a2,now,next));
  }
  return ret;
}


bool solve(P *in,int n){
  P tmp[n];rep(i,n)tmp[i]=in[i];
  Polygon a=ConvexHull(n,tmp);
  
  
  

  for(int i=0;i<n;i++){
    a = Convex_Cut(a,in[i],in[(i+1)%n]);    
    
  }
  
  
  return a.size()==0?false:true;
}

main(){
  int n;
  while(cin>>n && n){
    P in[n];
    rep(i,n)cin>>in[i].real()>>in[i].imag();
    cout << solve(in,n) << endl;
  }
  return false;
}

Measured memory_bytes: 0
package main

import "fmt"

func main() {
	var x int
	fmt.Scan(&x)
	if x%500 == 0 {
		fmt.Println(x / 500 * 1000)
	} else {
		a := (x / 500) * 1000
		x = x % 500
		fmt.Println(a + (x/5)*5)
	}
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);
#define ppp(a) (cout << (a) << endl); 
#define cop(a) for(auto x:(a)){cout << x << endl;}


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

constexpr char sp = ' ';
constexpr char cmm = ',';
constexpr int MOD = 1e9+7;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
inline void Yes(){cout << "Yes" << endl;}
inline void No(){cout << "No" << endl;}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){cout << "YES" << endl;}
inline void NO(){cout << "NO" << endl;}
inline void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        // comment this out when you use scanf or printf
        // cin.tie(0); ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(15);
    };
}fastio;

const double pi = 3.14159265358979323846264338327;
double rad(double deg){
    return deg*pi/180.0;
}
int main(){
    int a, b, x;
    scanf("%d%d%d", &a, &b, &x);
    double ok = 90.0;
    double ng = -1.0; 
    double mid;
    double th = atan2(b, a);
    while(abs(ok-ng) > 1e-12){
        mid = (ok+ng) / 2.0;
        if(rad(mid) > th){
            if(a*b*b <= 2*x*tan(rad(mid))) ok = mid;
            else ng = mid;
        }
        else{
            if(a*a*a*tan(rad(mid)) +2*a*a*(b-a*tan(rad(mid)))<= 2*x) ok = mid;
            else ng = mid;
        }
    }
    ppp(ok);
    
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int d = in.nextInt();
		int[][] x = new int[n][d];

		for(int i = 0; i < n; i++) {
			for(int j = 0; j < d; j++) {
				x[i][j] = in.nextInt();
			}
		}
		int c = 0;

		for(int i = 0; i < n-1; i++) {
			for(int j = i+1; j < n; j++) {
				int sum = 0;
				for(int k = 0; k < d; k++) {
					sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
				}
				if(Math.sqrt((double)sum) % (double)1 == (double)0) {
					c++;
				}

			}
		}

		System.out.println(c);
	}
}


Measured memory_bytes: 23636
def solve(string):
    n, *ab = map(int, string.split())
    a, b = ab[:n + 1], ab[n + 1:]
    _sum = sum(a)
    for i, _b in enumerate(b[::-1]):
        if a[n - i] < _b:
            _b -= a[n - i]
            a[n - i] = 0
            a[n - i - 1] = max(0, a[n - i - 1] - _b)
        else:
            a[n - i] -= _b
    return str(_sum - sum(a))


if __name__ == '__main__':
    n = int(input())
    print(solve('{}\n'.format(n) + '\n'.join([input() for _ in range(2)])))


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

int main(){
    int n = 0, d = 0, x;
    cin>>n;
    cin>>d>>x;
    int temp = 0, cont = 0;
    for(int i = 0; i < n; i++){
        cin>>temp;
        cont+= ceil((float)d/temp);
    }
    cout<<cont+x;

    return 0;
}

Measured memory_bytes: 3636
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Map<String, Integer> m = new HashMap<>(n);
        for(int i=0; i<n; i++) {
            String s = in.next();
            if(m.containsKey(s)) {
                m.put(s, m.get(s)+1);
            }
            else {
                m.put(s, 1);
            }
        }
        Set<String> keySet = m.keySet();
        int maxCount = 0;
        Iterator<String> it = keySet.iterator();
        while(it.hasNext()) {
            String s = it.next();
            int c = m.get(s);
            maxCount = Math.max(maxCount, c);
        }
        it = keySet.iterator();
        SortedSet<String> results = new TreeSet<>();
        while(it.hasNext()) {
            String s = it.next();
            int c = m.get(s);
            if(c==maxCount) {
                results.add(s);
            }
        }

        it = results.iterator();
        while(it.hasNext()) {
            System.out.println(it.next());
        }
    }
}


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

vector<int> graph[200005];
bool visited[200005];
int n, m, x, y;

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> m;
	while (m--) {
		cin >> x >> y;
		graph[x].push_back(y);
	}
	queue<pair<int, int>> bfs;
	bfs.push(make_pair(1, 0));
	while (!bfs.empty()) {
		pair<int, int> p = bfs.front();
		visited[p.first] = true;
		bfs.pop();
		if (p.first == n) {
			cout << "POSSIBLE";
			return 0;
		}
		if (p.second == 2) {
			continue;
		}
		for (int i : graph[p.first]) {
			if (!visited[i]) {
				bfs.push(make_pair(i, p.second + 1));
			}
		}
	}
	cout << "IMPOSSIBLE";
}

Measured memory_bytes: 9464
#include <stdio.h>
#include <string.h>
int main(void)
{
    char buf[256];
    scanf("%s", buf);
    if (strcmp(buf, "Sunny") == 0)
    {
        printf("Cloudy");
    }
    else if (strcmp(buf, "Cloudy") == 0)
    {
        printf("Rainy");
    }
    else if (strcmp(buf, "Rainy") == 0)
    {
        printf("Sunny");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#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 all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
int const INF = 1001001001;


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

int N; cin >> N;
rrep(i,N) {
    int cur = floor(i * 1.08);
    if(cur == N) {
        cout << i << endl;
        return 0;
    }
}
cout << ":(" << endl;
return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
while(1){
int judge;
int maxscore =0;
int minscore =0;
cin >> judge;
if(judge != 0){
int score[judge];
	for(int i=0; i<judge; i++){
	cin >> score[i];
		if(score[i] > maxscore){
		maxscore = score[i];
		}
		if(score[i] < minscore){
		minscore = score[i];
		}
		if(i==0){
		minscore = score[0];
		}
	}
int lastscore = 0;
for(int j=0;j<judge;j++){
lastscore +=  score[j];
}
lastscore = (lastscore - maxscore - minscore)/(judge - 2);
cout << lastscore <<endl;
}else
break;
}
return 0;
}

Measured memory_bytes: 3072
n = int(input())
a_tmp = input().split()
a = []
for _ in a_tmp:
    a.append(int(_))
ans = 0
same = 1
tmp = a[0]
for i in range(1, n):
    # print(i, same, ans)
    if tmp != a[i]:
        ans += same // 2
        same = 1
        tmp = a[i]
    else:
        same += 1
ans += same // 2
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

    string s;
    cin >> s;
    string ss;
    vector<string> sss;

    //cout << s[0];

    for(int i = 0; i < s.length(); i++){
        ss = s[i];
        if(ss == ","){
            //cout << " ";
            sss.push_back(" ");
        }else{
            sss.push_back(ss);
            //cout << ss;
        }

        cout << sss[i];
    }

}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T> void amax(T& a,T b){if(a < b) a = b;}


int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
int a,b,c;
	cin >> a>>b>>c;
	
	if((a==b && a!=c) || (a==c && a!=b) ||( b==c && b!=a))
		puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

void solve(ll x, ll a, ll b) {
  cout << (abs(a-x) < abs(b-x) ? "A" : "B") << endl;
}

int main() {
  ll x;
  cin >> x;
  ll a;
  cin >> a;
  ll b;
  cin >> b;
  solve(x, a, b);
  return 0;
}


Measured memory_bytes: 256
import math
N = int(input())
num = list(map(int, input().split()))

gL = [0]*(N+2)
gR = [0]*(N+2)

def gdc(a, b):
    if a < b: a, b = b, a
    if b == 0: return a

    while (a > b) and (a % b > 0):
        a = a - b
        if a < b:
            a, b = b, a

    return b

gL[0] = 0
gR[N] = 0
for i in range(1, N+1):
    gL[i] = gdc(gL[i-1], num[i-1])

for i in range(N-2, -1, -1):
    gR[i] = gdc(gR[i+1], num[i+1])

ans = 0
for i in range(0, N):
    gg = gdc(gL[i], gR[i])
    if ans < gg:
        ans = gg

print(ans)



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

int main(){
    int r,d,x;
    scanf("%d",&r);
    scanf("%d",&d);
    scanf("%d",&x);
    int i;
    for(i=0;i<10;i++){
        x=r*x-d;
        printf("%d\n",x);
    }
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+7;
int n,m,a[N],h[N];
set<int>ans;
void check(int p)
{
	for(int i=0;i<p-1;i++)h[i]=0;
	for(int i=0,x;i<=n;i++)x=i%(p-1),h[x]=(h[x]+a[i])%p;
	for(int i=0;i<p-1;i++)if(h[i])return;
	ans.insert(p);
}
int main()
{
	scanf("%d",&n);
	for(int i=n;i>=0;i--)scanf("%d",&a[i]),m=__gcd(m,abs(a[i]));
	for(int i=2;i*i<=m;i++)
	if(m%i==0)
	{
		ans.insert(i);
		while(m%i==0)m/=i;
	}
	if(m!=1)ans.insert(m);
	for(int i=2;i<=n;i++)
	if(a[0]%i==0)
	{
		int flag=1;
		for(int j=2;j*j<=i;j++)if(i%j==0){flag=0;break;}
		if(flag)check(i);
	}
	for(auto x:ans)printf("%d\n",x);
}

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

#define foreach(i,v) for(auto&& i: v)
#define all(x) (x).begin(), (x).end()

typedef std::vector< std::string > VS;
typedef std::vector<int> VI;
typedef long long ll;

template <class C> C& mini(C& a, C b) { if (b < a) a = b; return a; }
template <class C> C& maxi(C& a, C b) { if (a < b) a = b; return a; }

using namespace std;

template <typename T> void read(T& x) { x.read(); }
template <typename T> void read(vector<T>& v) { for (T& x: v) read(x); }
template <typename X, typename Y> void read(pair<X, Y>& p) { read(p.first); read(p.second); }
template <> void read(int& x) { scanf("%d", &x); }
template <> void read(unsigned int& x) { scanf("%u", &x); }
template <> void read(long long& x) { scanf("%lld", &x); }
template <> void read(unsigned long long& x) { scanf("%llu", &x); }
template <typename T> void readv(vector<T>& v) { int N; read(N); v.resize(N); read(v); }
template <typename T, typename ...Ts> void read(T& x, Ts&... args) { read(x); read(args...); }

int main(int argc, const char* argv[]) {
    int L, R;
    read(L, R);
    if (R - L >= 2019) {
        printf("0\n");
        return 0;
    }

    ll ret = (ll)L * R % 2019;
    for (int i = L; i <= R; i++)
        for (int j = i+1; j <= R; j++)
            mini(ret, (ll)i * j % 2019);
    printf("%d\n", (int)ret);
    return 0;
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
//ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
int n;
vector<int> a;
int main(){
	cin>>n;
	set<int> hoge;
	rep(i,n){
		int x;
		cin>>x;
		//cout<<x<<endl;
		a.pb(x);
		hoge.insert(x);
	}
	
	sort(all(a));
	if(n%3==0){
		bool flag=true;
		for(int i=0;i<n/3;i++){
			if(a[i]!=a[0])flag=false;
		}
		for(int i=n/3;i<2*(n/3);i++){
			if(a[i]!=a[n/3])flag=false;
		}
		for(int i=2*(n/3);i<n;i++){
			if(a[i]!=a[2*(n/3)])flag=false;
		}
		
		if(((a[0])^(a[n/3]))!=a[2*(n/3)])flag=false;
		if(flag){
			cout<<"Yes"<<endl;
			
		}else{
			cout<<"No"<<endl;
			
		}
	}else{
		if(a[0]==a[n-1]){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
		
	}
}

Measured memory_bytes: 4216
/** 
 *                                                                   
 *   |    |                        ,   .              ,--.,--.,--.,--.
 *   |    |    ,---..    ,,---.    |   |,---..   .      -||  ||  ||  |
 *   |    |    |   | \  / |---'    `---'|   ||   |       ||  ||  ||  |
 *   `    `---'`---'  `'  `---'      |  `---'`---'    `--'`--'`--'`--'
 *                                   `                                
**/
#include <bits/stdc++.h>
using namespace std;

int n, h[100005], dp[100005];

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

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

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

	dp[0] = 0;
	for (int i = 1; i < n; i++) {
		dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
		if (i >= 2) dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
	}

	cout << dp[n - 1] << '\n';

	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static void tp_swap(_T& right, _T& left) {
	//	usage:  tp_swap<type name>(a, b);
	_T tmp = right;
	right = left;
	left = tmp;
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}

static void ABC084C_SpecialTrains();

#if 1
int main()
{
	ABC084C_SpecialTrains();
	fflush(stdout);
	return 0;
}
#endif

class ABC084C_data {
public:
	int ci = 0;
	int si = 0;
	int fi = 0;
};

static void ABC084C_SpecialTrains()
{
	int N;
	get1int(N);

	auto stdat = new ABC084C_data[N];
	for (int i = 0; i < N - 1; i++) {
		get3int(stdat[i].ci, stdat[i].si, stdat[i].fi);
	}

	auto time = new int[N];
	for (int i = 0; i < N - 1; i++) {
		time[i] = stdat[i].si + stdat[i].ci;
		for (int j = i + 1; j < N - 1; j++) {
			if (time[i] <= stdat[j].si) {
				time[i] = stdat[j].si + stdat[j].ci;
			}
			else if (time[i] <= (stdat[j].si + stdat[j].fi)) {
				time[i] = stdat[j].si + stdat[j].fi + stdat[j].ci;
			}
			else {
				int fCnt = (time[i] - stdat[j].si) / stdat[j].fi;
				int add = (time[i] - stdat[j].si) % stdat[j].fi ? 1 : 0;

				time[i] = ((fCnt + add) * stdat[j].fi) + stdat[j].si + stdat[j].ci;
			}
		}
	}

	for (int i = 0; i < N - 1; i++) {
		printf("%d\n", time[i]);
	}
	printf("0\n");
	delete[] time;
	delete[] stdat;
}


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

#define f first
#define s second
#define pb push_back
#define mp make_pair

using namespace std;

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

const int N = (int)3e5 + 123, inf = 1e9, mod = 1e9 + 7;
const ll INF = 1e18;

int n, x[N], l[N], r[N], ans[N];
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%d", &x[i]);
		ans[x[i]] = i;
		l[i] = i - 1;
		r[i] = n - i;
	}
	for(int i = 1; i <= n * n; i++){
		if(ans[i])
			continue;
		
		int p = -1;
		
		for(int j = 1; j <= n; j++)
			if(l[j] > 0 && i < x[j] && (p == -1 || x[p] > x[j]))
				p = j;
		
		if(p != -1){
			ans[i] = p;
			l[p]--;
			continue;
		}
		
		for(int j = 1; j <= n; j++)
			if(r[j] > 0 && x[j] < i)
				p = j;
		
		if(p != -1){
			ans[i] = p;
			r[p]--;
			continue;
		}
		puts("No");
		return 0;
	}
	puts("Yes");
	for(int i = 1; i <= n * n; i++)
		printf("%d ", ans[i]);
	return 0;
}


Measured memory_bytes: 4224
N = int(input())
B = list(map(int,input().split()))
 
ans = []
while B:
    for i in range(len(B)-1, -1, -1):
        b = B[i]
        if i+1 == b:
            ans.append(i+1)
            break
    else:
        print(-1)
        exit()
    del B[i]
    
for idx in range(0, N):
	tmp = ans.pop(-1)
	print(tmp)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int N=1e4+10;
char ans[N];
int main(){
	int n;
	string s;
	cin>>n;
	cin>>s;
	int len=s.length();
	for(int i=0;i<len;i++){
		int temp=s[i]+n;
		if(temp>90){
			temp=temp-26;
		}
		ans[i]=temp;
	}
//	for(int i=0;i<len;i++)
		cout<<ans<<endl;
//	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
	val (num1, num2) = readLine()!!.split(" ").map(String::toInt)
	
	val num3 : Int = num1.toInt()
	val num4 : Int = num2.toInt()
	
	val num = num3 * num4
	
	return if( (num % 2) == 0) {
		println("Even")
	} else {
		println("Odd")
	}
	
}

Measured memory_bytes: 40000
n, x = map(int, input().strip().split())
as_ = map(int, input().strip().split())
as_ = sorted(as_)

cnt = 0
for a in as_:
    if x >= a:
        x -= a
        cnt += 1
    else:
        x = 0
        break

if x > 0 and cnt > 0:
    cnt -= 1

print(cnt)


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

int main() {
  int N,K;
  int S=0;
  cin>>N>>K;
  for(int i=0;i<N;i++){
   int x,n;
    cin>>x;
    if(K<=x){
     n=x-K;
    }
    else if(K-x<x){
     n=K-x;
    }
    else{
      n=x; 
    }
    S += n;
  }
  cout<<S*2<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int a[3*n];
  for(int i=0;i<n*3;i++) cin>>a[i];
  sort(a,a+3*n);
  reverse(a,a+3*n);
  int ans=0;
  for(int i=0;i<n;i++) ans+=a[i*2+1];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
//#include <fstream>
#include <vector>
#include <string>
//#include <cstdlib>
//#include <algorithm>
//#include <set>
//#include <conio.h>
using namespace std;
 
int main(){
	string str;
	while(cin >> str&&str!="EOF"){
		int joi=0,ioi=0;
		for(unsigned int i=0; i<str.size()-2; ++i){
			if(str[i]=='J'&&str[i+1]=='O'&&str[i+2]=='I') ++joi;
			if(str[i]=='I'&&str[i+1]=='O'&&str[i+2]=='I') ++ioi;
		}
		cout << joi << endl << ioi << endl;
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

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

using namespace std;

const ll MOD = 1e9+7;

template<::std::uint_fast64_t mod>
class ModInt{
private:
	using value_type = ::std::uint_fast64_t;
	value_type n;
public:
	ModInt() : n(0) {}
	ModInt(value_type n_) : n(n_ % mod) {}
	ModInt(const ModInt& m) : n(m.n) {}

	template<typename T>
	explicit operator T() const { return static_cast<T>(n); }
	value_type get() const { return n; }

	friend ::std::ostream& operator<<(::std::ostream &os, const ModInt<mod> &a) {
		return os << a.n;
	}

	friend ::std::istream& operator>>(::std::istream &is, ModInt<mod> &a) {
		value_type x;
		is >> x;
		a = ModInt<mod>(x);
		return is;
	}

	bool operator==(const ModInt& m) const { return n == m.n; }
	bool operator!=(const ModInt& m) const { return n != m.n; }
	ModInt& operator*=(const ModInt& m){ n = n * m.n % mod; return *this; }

	ModInt pow(value_type b) const{
		ModInt ans = 1, m = ModInt(*this);
		while(b){
			if(b & 1) ans *= m;
			m *= m;
			b >>= 1;
		}
		return ans;
	}

	ModInt inv() const { return (*this).pow(mod-2); }
	ModInt& operator+=(const ModInt& m){ n += m.n; n = (n < mod ? n : n - mod); return *this; }
	ModInt& operator-=(const ModInt& m){ n += mod - m.n; n = (n < mod ? n : n - mod); return *this; }
	ModInt& operator/=(const ModInt& m){ *this *= m.inv(); return *this; }
	ModInt operator+(const ModInt& m) const { return ModInt(*this) += m; }
	ModInt operator-(const ModInt& m) const { return ModInt(*this) -= m; }
	ModInt operator*(const ModInt& m) const { return ModInt(*this) *= m; }
	ModInt operator/(const ModInt& m) const { return ModInt(*this) /= m; }
	ModInt& operator++(){ n += 1; return *this; }
	ModInt& operator--(){ n -= 1; return *this; }
	ModInt operator++(int){
		ModInt old(n);
		n += 1;
		return old;
	}
	ModInt operator--(int){
		ModInt old(n);
		n -= 1;
		return old;
	}
	ModInt operator-() const { return ModInt(mod-n); }
};

ModInt<MOD> fact(ll n)
{
	if (n==1){
		ModInt<MOD> ret(1);
		return ret;
	}
	return fact(n-1)*n;
}

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll n; cin>>n;
	string s; cin>>s;

	if (!(s[0]=='B' && s[s.size()-1]=='B')){
		cout << "0\n";
		return 0;
	}

	vector<bool> table(2*n);
	rep(i, 2*n){
		if (i==0){
			table[i] = false;
			continue;
		}
		if (s[i-1]==s[i]){
			table[i] = !table[i-1];
		}else{
			table[i] = table[i-1];
		}
	}

	ll l=0, r=0;
	ModInt<MOD> ans(1);
	rep(i, 2*n){
		if (table[i]){
			ans *= l-r;
			r++;
		}
		if (!table[i]) l++;
	}

	if (!(l==r)){
		cout << "0\n";
		return 0;
	} 

	ans *= fact(n);

	cout << ans << "\n";

	return 0;
}

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

/*
// ordered_set 
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
# define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
 
using namespace std;
 
typedef long long                                        ll;
typedef long double                                      ld;
typedef pair <int, int>                                  pii;
typedef pair <pii, int>                                  ppi;
typedef pair <int, pii>                                  pip;
typedef pair <pii, pii>                                  ppp;
typedef pair <ll, ll>                                    pll;
 
# define A                                               first
# define B                                               second
# define endl                                            '\n'
# define sep                                             ' '
# define all(x)                                          x.begin(), x.end()
# define kill(x)                                         return cout << x << endl, 0
# define SZ(x)                                           int(x.size())
# define Sort(x)                                         sort(all(x))
# define InTheNameOfGod                                  ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
 
ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));}

//const ll md = 1e9 + 7;//998244353;
const int xn = 3e2 + 10;
const int xm = 1e2 + 10;
const int SQ = 320;
const int sq = 320 + 10;
const int inf = 1e9 + 10;
const ll INF = 1e18 + 10;
const int MOD = 1e9 + 7;
const int TM = 3;
const int Base = 257;

ll n, m, dp[xn][xn][xn], part[2][xn][xn], ans;
vector <pii> Q[xn];
bool flag;

int main(){
    InTheNameOfGod;
    
    cin >> n >> m;
    for (int i = 1; i <= m; ++ i){
    	int l, r, x;
    	cin >> l >> r >> x;
    	Q[r].push_back({l, x});
	}
	dp[0][0][0] = part[0][0][0] = 3;
	for (int i = 1; i <= n; ++ i){
		for (int j = 0; j < i; ++ j){
			for (int k = 0; k < max(1, j); ++ k){
				flag = false;
				for (pii q : Q[i]) flag |= q.B != (i >= q.A) + (j >= q.A) + (k >= q.A);
				if (flag) continue;
				if (i > j + 1) dp[i][j][k] = dp[i - 1][j][k];
				else dp[i][j][k] = (part[0][j][k] + part[1][j][k]) % MOD;
				part[0][i][j] = (part[0][i][j] + dp[i][j][k]) % MOD;
				part[1][i][k] = (part[1][i][k] + dp[i][j][k]) % MOD;
				if (i == n) ans = (ans + dp[i][j][k]) % MOD;
			}
		}
	}
	cout << ans << endl;
	
    return 0;
}


Measured memory_bytes: 229120
#gcd
from fractions import gcd

#素因数分解
def primefact(x0):
    tmp_l = [1]
    if x0 == 1:
        return tmp_l
    i = 2
    while 1:
        if i > pow(x0,1/2):
            if x0 == 1:
                break
            tmp_l.append(x0)
            break
        if x0 % i == 0:
            tmp_l.append(i)
            while x0 % i == 0:
                x0 //= i   
        i+=1
    return tmp_l


a,b=map(int,input().split())

g = gcd(a,b)
print(len(primefact(g)))

Measured memory_bytes: 5432
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))
 
typedef long long ll;
 
const int INF = 1000000000;
const int MOD = 1000000007;
 
int main (){
    double n, k;
    cin >> n >> k;
    n--, k--;
    cout << ceil(n / k) << endl;
}

Measured memory_bytes: 256
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls int
#define give main()
const int mod = 1000000007;
#pragma endregion
const int N = 200005;

ll h, ans, a;

pls give {
    AC;
    cin >> h;
    a = log2(h) + 1;
    cout << (ll) (pow(2, a) -1);
}

Measured memory_bytes: 512
N = int(input())
if N == 2:
    print(-1)
    exit()

ans = [[0 for j in range(N-1)] for i in range(N)]
for i in range(N):
    for j in range(N-1):
        ans[i][j] = (i+j+1)%N + 1

if N%2 == 0:
    m = N//2
    for i in range(m,N):
        ans[i][m],ans[i][m-1] = ans[i][m-1],ans[i][m]

for row in ans:
    print(' '.join(map(str,row)))


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

int N, Q;
int num[110];
int mnum, mday;

int main(){
	while(cin>>N>>Q, N||Q){
		for(int i = 0; i < 110; i++)num[i] = 0;
		
		for(int n = 0; n < N; n++){
			int M;
			cin>>M;
			for(int m = 0; m < M; m++){
				int tmp;
				cin>>tmp;
				num[tmp] += 1;
			}
		}
		int i;
		mday = 110, mnum = 0;
		for(i = 0; i < 110; i++){
			if(num[i] >= Q ){
				if(mnum < num[i]){
					mnum = num[i];
					mday = i;
				}
			}
		}
		cout<<(mnum?mday:0)<<endl;
	}
	return 0;
}

Measured memory_bytes: 864
import scala.io.StdIn._

object Main extends App {

  val s = readInt()

  def solve() = {
    var set = Set.empty[Int]
    var x = s
    while(!set(x)) {
      set += x
      if(x % 2 == 0) x = x/2
      else x = 3 * x + 1
    }
    set.size + 1
  }

  println(solve())

}



Measured memory_bytes: 55024