akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;

long long gcd(long long m, long long n){
    if(m < n){
        return gcd(n, m);
    }
    if(n == 0){
        return m;
    }
    return gcd(n, m % n);
}

int main(){
    int T;
    cin >> T;
    for(int i = 0; i < T; i++){
        long long A;
        long long B;
        long long C;
        long long D;
        cin >> A >> B >> C >> D;
        
        if(B > D || A < B){
            cout << "No" << endl;
        } else if(B <= C){
            cout << "Yes" << endl;
        } else {
            long long A_mod = A % B;
            long long C_mod = C % B;
            long long D_mod = D % B;
            
            long long tmp = gcd(B, D_mod);
            if(D_mod == 0){
                if(A_mod <= C_mod){
                    cout << "Yes" << endl;
                } else {
                    cout << "No" << endl;
                }
            } else {
                if(A_mod <= C_mod && tmp >= B - C_mod
                   && A_mod % tmp <= C_mod % tmp){
                    cout << "Yes" << endl;
                } else {
                    cout << "No" << endl;
                }
            }
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  string s, a, c;
  cin >> a >> s >> c;
  cout << "A" << s.front() << "C" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mxn= 5e5+5;
// check for forloop
// intialize variable
// overflow
// go for easy solution
#define mod 1000000007
ll INF = 1000000000000000005LL;
#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int main(){
    rishabh();
    int n;
    cin>>n;
    vector<ll> pos, neg;
    for(int i=0;i<n;i++){
        int x,y;
        cin>>x>>y;
        pos.push_back(x+y);
        neg.push_back(x-y);
    }
    sort(pos.begin(),pos.end());
    sort(neg.begin(),neg.end());
    cout<<max(pos[n-1]-pos[0], neg[n-1]-neg[0]);
}

Measured memory_bytes: 6652
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n, k = map(int, input().split())
A = [0] + list(map(int, input().split()))
def f(i):
  if i == 1:
    return A
  L = [-1]*(n+1)
  if i & 1:
    F = f(i-1)
    for j in range(n+1):
      L[j] = A[F[j]]
  else:
    F = f(i//2)
    for j in range(n+1):
      L[j] = F[F[j]]
  return L
F = f(k)
ans = F[1]
print(ans)

Measured memory_bytes: 219184
#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 C1[N], C2[N]; for (int i = 0; i < N; i++) C1[i] = C2[i] = 0;
  for (int i = 0; i < N; i++) {
    if (i + A[i] <= N) C1[i + A[i] - 1]++;
    if (i - A[i] > 0) C2[i - A[i] - 1]++;
  }
  long sum = 0;
  for (int i = 0; i < N; i++) sum += (long)C1[i] * C2[i];
  cout << sum << endl;
}

Measured memory_bytes: 5948
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;

int main(void)
{
    IOS
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    REP(i,n) {
        int x; cin >> x;
        v[x-1]++;
    }
    sort(RALL(v));

    int ans = n;
    REP(i,k) ans -= v[i];

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <algorithm>
#include <cstdio>
using namespace std;
static const double EPS = 1e-9;
int main(){
	double a,b,c,d,e,f;
	while(~scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)){
		double x = (b*f-e*c)/(b*d-e*a);
		double y = (c-a*x)/b;
		printf("%.3lf %.3lf\n",x+EPS,y+EPS);
	}
}

Measured memory_bytes: 0
/*
Problem

Category
全探索：ビット全探索
(参考: https://qiita.com/drken/items/7c6ff2aa4d8fce1c9361)

URL:
https://atcoder.jp/contests/s8pc-4/tasks/s8pc_4_b

考察:


Date: 2020/04/09
*/

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long

/* ==== declarations ====== */
// functions
void solve();
void getInput();

// global variables
int N, K;
vector<int> A;


/* ======================== */

signed main(){
    getInput();
    solve();
    return 0;
}

void getInput() {
    cin>>N>>K;
    A = vector<int>(N, 0);
    for(int i=0; i<N; ++i) {
        cin>>A[i];
    }
}

void solve() {
    int score = 10e16;
    for(int i=0; i< 1<<N; ++i) {
        // cout<<i<<"bitset: "<<bitset<16>(i)<<endl;
        int height = -1;
        int cnt = 0;
        int cost = 0;
        for(int j=0; j<N; ++j) {
            if (height < A[j]) {
                cnt++;
                height = A[j];
                continue;
            } else {
                bool canUp = (i & 1<<j);
                if (canUp) {
                    cost += height + 1 - A[j];
                    height++;
                    cnt++;
                }
            }
        }
        if (cnt >= K) {
            score = min(score, cost);
        }
        
    }
    cout<<score<<endl;
}






Measured memory_bytes: 256
#include <cstdio>

int m,n;
int mx;
bool ice[91][91];

bool can(int x, int y){
	return x >= 0 && x < n && y >= 0 && y < m;
}

int rec(int i,int j,int l=0){
	if(!can(i,j) || !ice[i][j]){
		if(mx < l){
			mx = l;
		}
		return 0;
	}
	ice[i][j] = false;
	
	rec(i-1,j,l+1);
	rec(i+1,j,l+1);
	rec(i,j-1,l+1);
	rec(i,j+1,l+1);

	ice[i][j] = true;
	return 0;
}

int main(){
	int tmp;
	while(scanf("%d%d",&m,&n),m!= 0){
		mx = 0;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				scanf("%d",&tmp);
				ice[i][j] = tmp == 1;
			}
		}
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				if(ice[i][j]){
					rec(i,j);
				}
			}
		}
		printf("%d\n",mx);
	}
	return 0;
}

Measured memory_bytes: 2764
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e16;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 1005;
constexpr ll nx[4] = {1,0,-1,0};
constexpr ll ny[4] = {0,1,0,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    char x,y;
    cin >> x >> y;
    if (x < y) PRINT("<");
    else if (x > y) PRINT(">");
    else PRINT("=");
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

int p,q,a,n;

int rec(int u = 0,int d = 1,int cou = 0,int from = 1){
	if(p * d == u * q) return 1;
	if(p * d < u * q) return 0;
	if(cou == n) return 0;
	int sum = 0;
	for(int i = from;i * d <= a;i++){
		sum += rec(u * i + d,i * d,cou + 1,i);
	}
	return sum;
}

int main(){
	while(cin >> p >> q >> a >> n,q){
		cout << rec() << endl;
	}
}



Measured memory_bytes: 2980
N, M= map(int, input().split())
g = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

visited = [False] * N

def dfs(v, count):
    if visited.count(True) == N:
        return 1
    else:
        ans = 0
        for i in g[v]:
            if not visited[i]:
                visited[i] = True
                ans += dfs(i, count+1)
                visited[i] = False
        return ans

visited[0] = True
print(dfs(0,1))

Measured memory_bytes: 3064
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int[] xy1 = new int[2];
		int[] xy2 = new int[2];
		int[] xy3 = new int[2];
		xy1[0] = sc.nextInt();
		xy1[1] = sc.nextInt();
		xy2[0] = sc.nextInt();
		xy2[1] = sc.nextInt();
		xy3[0] = sc.nextInt();
		xy3[1] = sc.nextInt();

		double ans = 0;
		ans = Math.max(ans, max(xy1, xy2, xy3));
		ans = Math.max(ans, max(xy2, xy3, xy1));
		ans = Math.max(ans, max(xy3, xy1, xy2));

		pr.printf("%.10f\n", ans);
	}

	private static double max(int[] xy1, int[] xy2, int[] xy3) {
		int[] b = new int[2];
		int[] c = new int[2];
		b[0] = xy2[0] - xy1[0];
		b[1] = xy2[1] - xy1[1];
		c[0] = xy3[0] - xy1[0];
		c[1] = xy3[1] - xy1[1];

		double the = Math.atan2(b[1], b[0]);
		double[] db = rot(-the, b);
		double[] dc = rot(-the, c);
		if (dc[1] < 0) {
			dc[1] = -dc[1];
		}

		double thea = Math.atan2(dc[1], dc[0]);
		double theb = Math.atan2(dc[1], db[0] - dc[0]);

		double l = 0;
		double r = db[0] / (1 / Math.tan(thea / 2) + 1 / Math.tan(theb / 2));
		for (int i = 0; i < 100; i++) {
			double mid = (l + r) / 2;

			double xa = mid / Math.tan(thea / 2);
			double xb = mid / -Math.tan(theb / 2) + db[0];
			if (xb - xa <= 2 * mid) {
				r = mid;
			} else {
				l = mid;
			}
		}

//		pr.println(Arrays.toString(xy1));
//		pr.println(Arrays.toString(xy2));
//		pr.println(Arrays.toString(xy3));
//		pr.println(Arrays.toString(db));
//		pr.println(Arrays.toString(dc));
//		pr.printf("%f %f\n", thea / Math.PI * 180, theb / Math.PI * 180);
//		pr.println(l);
		return l;
	}

	private static double[] rot(double the, int[] x) {
		double[] ret = new double[2];

		ret[0] = Math.cos(the) * x[0] - Math.sin(the) * x[1];
		ret[1] = Math.sin(the) * x[0] + Math.cos(the) * x[1];

		return ret;
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 23892
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=10005;
int n,ans,a[MAXN];
int Get(int x){
	int ret=0;
	while(x%2==0)
		x/=2,ret++;
	return ret;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		if(a[i]/2)ans+=Get(a[i]);
	printf("%d\n",ans);
}

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

int main() {
  int N,K,R,S,P;
  cin >> N>>K>>R>>S>>P;
  string T;
  cin>>T;
  int a=0;
  for (int i = 0; i < N; i++) {
    if(T.at(i)=='r'){
      a+=P;
    }
    if(T.at(i)=='s'){
      a+=R;
    }
     if(T.at(i)=='p'){
      a+=S;
    }
  }
  for (int i = K; i < N; i++) {
  
    if(T.at(i-K)==T.at(i)){
 
      if(T.at(i)=='r'){
        a-=P;
      }
      if(T.at(i)=='s'){
        a-=R;
      }
      if(T.at(i)=='p'){
        a-=S;
      }
     T.at(i)='b';
    }
    
  }

   

    cout <<a<< endl;

}









Measured memory_bytes: 512
/*+__+ zhopa:skoro respa(*/
    /*sps bfsu za rabotu-pishi bfs s used i obnovlyai v nem srazu*/
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define fi first
#define f first
#define se second
#define s second
#define vi_a vector<int>a;
#define p_b push_back
#define ll long long
#define ld long double
#define pui pair<ui,ui>
#define pii pair<int,int>
#define m_p make_pair
#define fast_io cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define all(x) x.begin(),x.end()
#define sqr(x) (x)*(x)
#define pw(x) (1ui << x)
#define sz(x) (int)x.size()
#define endl "\n"
#define len(a) a.length()
#define rep(x,l,r) for(ui x=l;x<r;x++)
using namespace std;
const ll N=2*1e5;
//vector<ll>g[N];
//ll dp[N];
//ll mx=LLONG_MIN;
//ll used[N];
//void dfs(ll v){
//    used[v]=1;
//    for(auto z : g[v]){
//        if(!used[z]){
//            dfs(z);
//        }
//                dp[v]=max(dp[v],dp[z]+1);
//    }
//    mx=max(mx,dp[v]);
//}
const ll md=1e9 +7;
signed main(){
    fast_io;
    ll n,m;
    cin>>n>>m;
    vector<vector<ll>>dp(n+1,vector<ll>(m+1,0));
    vector<vector<char>>a(n+1,vector<char>(m+1));
    for(ll i=0;i<n;i++){
        for(ll j=0;j<m;j++){
            cin>>a[i+1][j+1];
            a[0][j]='.';
        }
        a[i][0]='.';
    }
    dp[1][1]=1;
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=m;j++){
           if(a[i-1][j]=='.'){
                dp[i][j]+=dp[i-1][j];
           }
           if(a[i][j-1]=='.'){
                 dp[i][j]+=dp[i][j-1];
           }
           dp[i][j]%=md;
        }
    }
    cout<<dp[n][m];
    return 0;
}


Measured memory_bytes: 9088
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<functional>
#define int long long
using namespace std;

int a[100000], b[100000], c[100000];
int d[100001];
int e[100001];
signed main() {
	int n; cin >> n;
	for (int i = 0; i<n; i++)cin >> a[i];
	for (int i = 0; i<n; i++)cin >> b[i];
	for (int i = 0; i<n; i++)cin >> c[i];
	sort(a, a + n, greater<int>()); sort(b, b + n, greater<int>()); sort(c, c + n, greater<int>());
	int k = 0;
	for (int i = 0; i<n; i++) {
		while (k<n&&b[i]<c[k]) { k++; }
		d[i + 1] = k;
		e[i + 1] = e[i] + d[i + 1];
	}
	int ans = 0;
	k = 0;
	for (int i = 0; i<n; i++) {
		while (k<n&&a[i]<b[k]) { k++; }
		ans += e[k];
	}
	cout << ans << endl;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
  string s;
  cin >> s;
  if( s == "SUN") cout<< 7 << endl;
  if( s == "SAT") cout<< 1 << endl;
  if( s == "FRI") cout<< 2 << endl;
  if( s == "THU") cout<< 3 << endl;
  if( s == "WED") cout<< 4 << endl;
  if( s == "TUE") cout<< 5 << endl;
  if( s == "MON") cout<< 6 << endl;
  return 0;
}



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

int main()
{
    long long k, n;
    cin >> k >> n;
    vector<long long> a(n);
    for(auto& i : a) cin >> i;

    long long ans = 0, max_e = 0;
    sort(a.begin(), a.end());
    for(int i = 0; i < n - 1; ++i)
    {
        long long temp = a[i + 1] - a[i];
        if(temp > max_e)
        {
            max_e = temp;
        }
        ans += temp;
    }
    ans += k - a.back() + a.front();
    max_e = max(max_e, k - a.back() + a.front());

    cout << ans - max_e << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    int N;cin>>N;
    ll d[60];
    for(int i=0;i<N;i++)
        cin>>d[i];
    ll ans=0;
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            ans+=d[i]*d[j];
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
// #define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int mod=1000000007;
  i64 poww(i64 a, i64 b)
  {
    a%=mod;
    i64 res=1;
    while(b)
      {
if(b&1)res=res*a%mod;

      a=a*a%mod;
      b/=2;

      }
      return res;
  }
  i64 inv(i64 a)
  {
    return poww(a,mod-2);
  }
  void solve()
  {
i64 n,d,cnt=0;	
cin>>n>>d;
forn(i,n)
{
double x,y;
cin>>x>>y;
cnt+=(sqrt(x*x+y*y))<=d;

}
cout<<cnt;

  }
  
  int main()
  {
ios::sync_with_stdio(false);
    cin.tie(nullptr);
    #ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
    #endif
int t=1;
while(t--)
{
  solve();
}

    return 0;
  }


Measured memory_bytes: 3856
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    int n; cin >> n;
    cout << (n+1)/2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/arc103/tasks/arc103_c>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    string s; cin >> s;
    int n = (int)s.length();
    s = "." + s;
    
    bool ng = false;
    if(s[1] == '0') ng = true;
    if(s[n] == '1') ng = true;
    for(int i = 1; i < n;i++){
        if(s[i] != s[n-i]) ng = true;
    }
    if(ng) {
        cout << -1 << endl;
        return res;
    }
    queue<int> q;
    for(int i = 1; i < n;i++){
        if(s[i] == '1') q.push(i);
    }
    q.push(n);
    
    for(int i = 1; i < n;i++){
        if(i == q.front()) q.pop();
        cout << i << " " << q.front() << endl;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 1900
const log = console.log;

const parseSpaceSeparated = (line: string) => line.trim().split(" ");
const parseDecimalInt = (s: string) => parseInt(s);
const parseSpaceSeparatedDecimalInt = (line: string) =>
  parseSpaceSeparated(line).map(parseDecimalInt);

// ----

function Main(input: string): void {
  const [k, s] = parseSpaceSeparatedDecimalInt(input);

  let validCount = 0;

  for (let x = 0; x <= k; x += 1) {
    for (let y = 0; y <= k; y += 1) {
      const z = s - (x + y);
      if (z >= 0 && z <= k) validCount += 1;
    }
  }

  log(validCount);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int n;

list<pair<ll, pair<ll, ll>>> centers;

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> n;
    vector<pair<ll, pair<ll, ll>>> a(n);
    for (auto& i : a) {
        cin >> i.second.first >> i.second.second >> i.first;
    }
    // Sort points by increasing height to slowly expand view outwards
    sort(a.begin(), a.end(), greater<pair<ll, pair<ll, ll>>>());

    if (n == 1) {
        // If height of point is 0, then it becomes indeterminable
        cout << a[0].second.first << ' ' << a[0].second.second << ' ' << a[0].first;
        return 0;
    }
    
    // Generate all centers
    for (int x = 0; x <= 100; x++) {
        for (int y = 0; y <= 100; y++) {
            pair<ll, pair<ll, ll>> v;
            v.second = {x, y};
            v.first = a[0].first + abs(x - a[0].second.first) + abs(y - a[0].second.second);
            centers.push_back(v);
        }
    }

    for (int i = 1; i < n; i++) {
        auto it = centers.begin();
        while (it != centers.end()) {
            pair<ll, pair<ll, ll>> v = *it;
            if (max(v.first - abs(v.second.first - a[i].second.first) - abs(v.second.second - a[i].second.second), 0ll) != a[i].first) {
                auto nxt = next(it, 1);  
                centers.erase(it);
                it = nxt;
            } else it++;
        }
    }
    auto it = centers.begin();
    pair<ll, pair<ll, ll>> v = *it;
    cout << v.second.first << ' ' << v.second.second << ' ' << v.first;
}





Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1

#define numberOfSetBits(S) __builtin_popcount(S) // __builtin_popcountl(S) __builtin_popcountll(S)
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define isOn(S, j) (S & (1 << j))
#define endl '\n'
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}

#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define vvii vector<vii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mc(a,b,c) mp(mp(a,b),c)
vi a,path;
set<ll> s;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,x,t,m,y,z,k;
    cin>>n>>k;
    a.resize(n+1);
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    if(k<=n){
        ll curr = 1;
        for(int i=0;i<k;i++){
            curr = a[curr];
        }
        cout<<curr;
        return 0;
    }
    else{
        ll curr = 1;
        s.insert(curr);
        path.pb(curr);
        for(int i=0;i<n;i++){
            curr = a[curr];
            k--;
            if(s.count(curr)){
                break;
            }
            else{
                s.insert(curr);
                path.pb(curr);
            }
        }
        auto it = find(all(path),curr);
        ll ind = it-path.begin();
        ll sz = path.size()-ind;
        k%=sz;
        cout<<path[ind+k];
        return 0;
        
    }


    return 0;
}

Measured memory_bytes: 13420
#include <stdio.h>
int main(void){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<b){
        printf("a < b\n");
    }else if(a>b){
        printf("a > b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}


Measured memory_bytes: 2048
using System;

namespace CSharp
{
    class Program
    {
        static void Main()
        {
            var X = int.Parse(Console.ReadLine());

            int p = X;
            while (!IsPrime(p))
            {
                p++;
            }
            Console.WriteLine(p);
        }

        private static bool IsPrime(int x)
        {
            if (x <= 1)
            {
                return false;
            }
            for (int i = 2; i * i <= x; i++)
            {
                if (x % i == 0)
                {
                    return false;
                }
            }
            return true;
        }
    }
}

Measured memory_bytes: 13140
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
const ll MOD=1e9+7;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int n,m;
  cin>>n>>m;
  cout<<"0";
  rep(i,n/2) cout<<" 0";
  rep(i,n-1-n/2) cout<<" "<<m;
  cout<<endl;
  return 0;
}

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

#define ll long long

void solve()
{
    ll n, k;
    cin >> n >> k;

    vector<ll> a(n);

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

    bool test = false;

    for(ll i = 0, j = 0; i < n; i++)
    {
        if(a[i] > 1)
        {
            sum += a[i];
        }

        j++;

        if(j == k)
        {
            if(!test)
            {
                test = true;
            }
            else
            {
                if(sum > prev)
                {
                    cout << "Yes\n";
                }
                else
                {
                    cout << "No\n";
                }

                //cout << prev << " " << sum << "\n";
            }

            j--;
            prev = sum;

            if(a[i - k + 1] > 1)
            {
                sum -= a[i - k + 1];
            }
        }
    }
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    // ll t;
    // cin >> t;
    
    // while(t--)
    // {
        solve();
    // }

    return 0;
}


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

int main() {
    int a, b, t;
    cin >> a >> b >> t;
    
    int ans = 0;
    for (int i = 1; i < t + 1; i++) {
        if (i % a == 0) {
            ans += b;
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    ll n;
    cin>>n;
    ll a, t;
    cin>>t>>a;
    a *= 1000;
    t *= 1000;
    ll mn = (ll)1e18;
    int id=-1;
    f(i, n){
        ll h;
        cin>>h;
        ll to = t - h * 6;
        if(abs(to - a) < mn){
            mn = abs(to - a);
            id = i + 1;
        }
    }
    cout<<id<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			int n = sc.nextInt();
			int m = sc.nextInt();
			
			Map<Integer, Integer> conditions = new HashMap<>();
			
			boolean ok = true;
			for(int i = 0 ; i < m ; i++ ) {
				int s = sc.nextInt();
				int c = sc.nextInt();
				if ( conditions.containsKey(s)) {
					int v = conditions.get(s);
					
					if ( c != v ) {
						ok = false;
						break;
					}
				}
				else {
					conditions.put(s, c);
				}
			}
			
			if ( ok ) {
				
				if ( n > 1 ) {
					if ( conditions.containsKey(1) && conditions.get(1) == 0 ) {
						System.out.println("-1");
						return;
					}
					else if ( !conditions.containsKey(1) ) {
						conditions.put(1, 1);
					}
				}
				
				StringBuilder sb = new StringBuilder();
				for(int i = 0 ; i < n ; i++ ) {
					int c = conditions.containsKey(i+1) ? conditions.get(i+1) :0;
					sb.append(c);
				}
				System.out.println(sb);

			}
			else {
				System.out.println("-1");
			}
			
		}
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
  int n;
  while(cin>>n,n){
    vvi dp(3,vi(3));
    char a,b,c;
    cin>>a>>b>>c;
    a-='A';b-='A';c-='A';
    dp[a/3][a%3]=1;
    //    dp[c/3][c%3]=-1;
    int dx[]={0,0,1,-1};
    int dy[]={1,-1,0,0};
    rep(q,n){
      vvi nd(3,vi(3));
      rep(i,3)rep(j,3)rep(k,4){
	int x=i+dx[k];
	int y=j+dy[k];
	if(x<0||y<0||x>=3||y>=3||c/3==x&&c%3==y)
	  x-=dx[k],y-=dy[k];
	nd[x][y]+=dp[i][j];
      }
      dp=nd;
    }
    double out=dp[b/3][b%3];
    printf("%.9f\n",out/pow(4,n));
  }  
}

Measured memory_bytes: 1276
import java.util.Scanner;
public class Main{
    public static void main(String[]args){
        Scanner s = new Scanner(System.in);


//        s= new Scanner(
//                "3 2\n" +
//                "2\n" +
//                "1 3\n" +
//                "1\n" +
//                "3");
//
//        s=new Scanner("3 3\n" +
//                "1\n" +
//                "3\n" +
//                "1\n" +
//                "3\n" +
//                "1\n" +
//                "3");

        int N = s.nextInt();
        int K = s.nextInt();
        boolean[] ppl = new boolean[N];

        s.nextLine();

        for(int i=0; i<K; i++) {
            int quantity = s.nextInt();
            s.nextLine();
            for(int j=0; j<quantity; j++) {
                int idx = s.nextInt();
                ppl[idx-1] = true;
            }
        }

        int count = 0;
        for(boolean b: ppl){
            if(!b)
                count++;
        }
        System.out.println(count);

    }
}

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

#define reps(i,j,k) for(int i=(j);i<(k);i++)
#define rep(i,j) reps(i,0,j)
#define fs first
#define sc second
#define pb push_back
#define mk make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

template<class S,class T>
ostream &operator<<(ostream &out, const pair<S,T> &p){
	return out << "(" << p.fs << ", " << p.sc << ")";
}
template<class T>
ostream &operator<<(ostream &out, const vector<T> &v){
	out << "{";
	rep(i,v.size()) out << v[i] << ", ";
	return out << endl;
}
#define M 2001
#define P 3000001
bool prime[P];
pii sp[M][M]; //isprime, num
int dx[] = {1,0,-1,0}, dy[] = {0,-1,0,1};
pii board[M][M]; //score, maxprime

pii bfs(int m, int x, int y, pii r){
	if(sp[x][y].sc > m) return r;
	r = pii(r.fs + sp[x][y].fs, max(r.sc, sp[x][y].sc));
	rep(i,3){
		int cx = x+i-1, cy = y+1;
//		board[cx][cy] = pii(board[x][y].fs + sp[])
	}
}

pii add(pii x, pii y){

	return pii(x.fs + y.fs, y.sc);
}

int main(){
	int m,n;
	prime[0]=prime[1]=1;
	reps(i,2,P){
		if(!prime[i])
			for(int j=2*i;j<P;j+=i) prime[j] = 1;
	}

	vector<pii> pos(P);
	int cx = M/2, cy = M/2;
	int dist = 1, cnt = 0, way = 0;
	fill(sp[0],sp[M],pii(0,999999999));
	reps(i,1,P){
		pos[i] = pii(cx,cy);
		sp[pos[i].fs][pos[i].sc] = pii(!prime[i],i);
		if(cnt == dist){
			if(way % 2 == 1) dist++;
			cnt = 0;
			way = (way + 1) & 3;
		}
		cnt++;
		cx+=dx[way];
		cy+=dy[way];
	}

//	reps(i,1,26) cout << mk(i,pos[i]) << endl;
//	cout << pos[1000000] << endl;
	
	while(cin >> m >> n, m){
		fill(board[0], board[M], pii(0,0));
		int sq = 1;
		while(sq * sq <= m) sq++;
		int y = pos[n].sc, x = pos[n].fs;
//		cout << pii(x,y) << endl;
//		cout << sp[x][y] << endl;
		pii ans = board[x][y] = prime[n]?pii(0,0):pii(1,n);
		rep(i,sq){
			if(i+y>M)break;
			reps(j,x-i,x+i+1){
				if(j >= M || j < 0 || sp[j][i+y].sc > m)continue;
//				cout << mk(pii(j,i+y),sp[j][i+y]);
				rep(k,3){
					int nx = j+k-1;
					int ny = i+y+1;
					if(sp[nx][ny].sc > m)continue;
					if(sp[nx][ny].fs)
						board[nx][ny] = max(board[nx][ny], add(board[j][ny-1], sp[nx][ny]));
					else
						board[nx][ny] = max(board[nx][ny], board[j][ny-1]);

					ans = max(board[nx][ny], ans);
				}
//				cout << mk(sp[j][i+y].sc, board[j][i+y]);
			}
//			cout << endl;
		}

		cout << ans.fs << " " << ans.sc << endl;

	}
	return 0;
}

Measured memory_bytes: 90092
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main(void)
{
	int n;
	cin >> n;
	vector<char> str(n);
	int k;
	cin >> k;
	int i;
	for (i = 0; i < n; i++)
	{
		cin >> str[i];
	}

	
	str[k-1] = tolower(str[k-1]);
	for (i = 0; i < n; i++)
	{
		cout << str[i];
	}
	cout << endl;




	return 0;
}


Measured memory_bytes: 256
fun main(args : Array<String>) {
    val S = readLine()!!

    // 先頭を0にする場合
    var next = '0'
    var answer1 = 0
    fun flip(num: Char) : Char {
        if (num == '0') {
            return '1'
        }

        return '0'
    }

    S.forEach {
        if (it != next) {
            answer1++
        }
        next = flip(next)
    }

    next = '1'
    var answer2 = 0
    // 1にする場合
    S.forEach {
        if (it != next) {
            answer2++
        }
        next = flip(next)
    }

    println(listOf(answer1, answer2).min())
}

Measured memory_bytes: 38668
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
 
int main(){
  string a,b,c;
  cin >> a >> b >> c;
  if(a[a.size()-1]==b[0] && b[b.size()-1]==c[0]){
      cout << "YES" << endl;
  }else{
      cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
/////////////////////////////////////////////////////////
//
//  c/temp.cpp file
//  Last Updated: 2018-10-23 ...Maybe
//
//    I hope you adding this code to the setting file
//    alias g++='g++ -std=c++1y -DDEBUG_LOCAL'
//
/////////////////////////////////////////////////////////

#include <bits/stdc++.h>

using namespace std;

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

//#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REAP(i,0,n)
#define REAP(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REAP,_REP,)(__VA_ARGS__)

#define _REPR(i,n) REAPR(i,n,0)
#define REAPR(i,a,b) for(int i=int(a-1);i>=int(b);--i)
#define REPR(...) _overload3(__VA_ARGS__,REAPR,_REPR,)(__VA_ARGS__)

#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()

#define coutALL(a) {int loop_coutALL=0;for(auto e:a) cout<<(loop_coutALL++?" ":"")<<e; cout<<endl;}

#define coutYN(a) cout<<((a)?"YES":"NO")<<endl;
#define coutYn(a) cout<<((a)?"Yes":"No")<<endl;
#define coutyn(a) cout<<((a)?"yes":"no")<<endl;

#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)

const int INF=1145141919;
//const long long INF=114514191911451419;
const int MOD=(int)1e9+7;
const double EPS=1e-12;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<string,int> psi;
typedef pair<string,string> pss;

typedef long long ll;

template<typename T> istream &operator >> (istream &is, vector<T> &v){for(T &x:v) is>>x;return is;}
template<typename T> ostream &operator << (ostream &os, vector<T> &v){int i=0;for(T &x:v) os<<(i++?" ":"")<<x;return os;}

ll rev(ll n){ll x=0;for(;n>0;){x=x*10+n%10;n/=10;}return x;}

ll upper(ll n,ll m){return (n+m-1)/m;};
ll rounding(ll n){return (long double)n+0.5;};

bool inG(ll x,ll n){return 0<=x && x<n;}
bool outG(ll x,ll n){return x<0 || n<=x;}

inline int qp(int a,ll b){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
inline int qp(int a,ll b,int mo){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

inline ll fac(ll k,ll n){ll a=1;for(int i=0;i<n;i++)a*=k--;return a;}
inline ll fac(ll k,ll n,int mo){ll a=1;for(int i=0;i<n;i++)a*=k--,a%=mo;return a;}

inline int dsum(ll n){int a=0;for(;n;n/=10)a+=n%10;return a;}

struct Arithmetic{Arithmetic(){cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);}};

//#define DEBUG_LOCAL

#ifdef DEBUG_LOCAL
template<typename T> void deb(T a){cerr<<"deb: "<<a<<"です"<<endl;}
#define debl {cerr<<"debug: "<<__LINE__<<"行目だ"<<endl;}
void what_cr(){cout<<__GCC_ATOMIC_CHAR16_T_LOCK_FREE<<" ←？"<<endl;}
//ori_func S

//ori_func E
#else
template<typename T>void deb(T a){}
#define debl
void what_cr(){}void t_t(){}
#endif

signed main(){

  Arithmetic Exception;

  vi a(3);
  cin>>a;

  cout<<a[0]*a[1]/2<<endl;

  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using psi=pair<string,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD ((ll)1e9+7)
void get(){}template<class H,class...T>void get(H&h,T&...t){cin>>h;get(t...);}
template<class T>void geti(T&a){for(auto&_:a)cin>>_;}
template<class T>void getii(T&a){for(auto&_:a)geti(_);}
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}
#define dcl(...) ll __VA_ARGS__;get(__VA_ARGS__)
#define dclt(t,...) t __VA_ARGS__;get(__VA_ARGS__)
template<class F,class S>void add(map<F,S>&mp,F f,S s){if(mp.find(f)==mp.end())mp[f]=F();mp[f]+=s;}

int main(){
    int n;
    cin>>n;
    cout<<n/3<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static int[][] dp;
  public static int H;
  public static int W;

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    H = scan.nextInt();
    W = scan.nextInt();
    char[][] S = new char[H][W];
    for(int i=0; i<H; i++) {
      String row = scan.next();
      for(int j=0; j<W; j++) {
        S[i][j] = row.charAt(j);
      }
    }
    scan.close();

    dp = new int[H][W];
    int max = 0;

    for(int ii=0; ii<H; ii++) {
      for(int jj=0; jj<W; jj++) {
        if(S[ii][jj] == '.') {

    for(int i=0; i<H; i++) {
      for(int j=0; j<W; j++) {
        if(S[i][j] == '#') {
          dp[i][j] = -1;
        }
        else if(S[i][j] == '.') {
          dp[i][j] = Integer.MAX_VALUE;
        }
      }
    }
    move(0, ii, jj);
    for(int i=0; i<H; i++) {
      for(int j=0; j<W; j++) {
        if(max < dp[i][j]) {
          max = dp[i][j];
        }
      }
    }

        }
      }
    }
    System.out.println(max);
  }

  public static void move(int step, int h, int w) {
    dp[h][w] = step;
    if(0 < h && dp[h-1][w] != -1) {
      if(dp[h-1][w] > step+1) {
        move(step+1, h-1, w);
      }
    }
    if(0 < w && dp[h][w-1] != -1) {
      if(dp[h][w-1] > step+1) {
        move(step+1, h, w-1);
      }
    }
    if(h < H-1 && dp[h+1][w] != -1) {
      if(dp[h+1][w] > step+1) {
        move(step+1, h+1, w);
      }
    }
    if(w < W-1 && dp[h][w+1] != -1) {
      if(dp[h][w+1] > step+1) {
        move(step+1, h, w+1);
      }
    }
  }
}

Measured memory_bytes: 24260
#include<bits/stdc++.h>
using namespace std;
#define fast_input ios_base::sync_with_stdio(false);cin.tie(NULL);
typedef long long int ll;
int main()
{
    fast_input;
    int n;
    cin>>n;
    string s,t;
    cin>>s;
    cin>>t;
    string x = "";
    int i;
    for(i=0;i<n;i++){
        x = x+s[i];
        x = x+t[i];
    }
    cout<<x<<endl;
}

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

int n;
vector < int > way[100010],way2[100010];
int way_num[100010],point[100010],max_c;
bool v[100010];

void dfs(int now,int colour)
{
	v[now] = 1;
	int n_c = 1;
	for(int i = 0;i < way[now].size();i++)
	{
		if(v[way[now][i]] == 0)
		{
			if(n_c == colour)
			n_c++;
			way_num[way2[now][i]] = n_c;
			dfs(way[now][i],n_c);
			n_c++;
		}
	}
	max_c = max(max_c,n_c - 1);
}

int main()
{
	cin>>n;
	for(int i = 1;i < n;i++)
	{
		int in1,in2;
		cin>>in1>>in2;
		way[in1].push_back(in2);
		way[in2].push_back(in1);
		way2[in2].push_back(i);
		way2[in1].push_back(i);
	}
	
	dfs(1,0);
	
	cout<<max_c<<endl;
	for(int i = 1;i < n;i++)
	cout<<way_num[i]<<endl;
	
	return 0;
}


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

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

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

  ll n;
  cin >> n;

  ll ans = 1000 - (n % 1000);
  ans %= 1000;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
using namespace std;

const int mod = 1e9 + 7;
int32_t main() {

    fast
    int x;
    cin >> x;

    if(x % 2 == 0)cout << -1 << endl;
    else {
        int ans = 1;
        int n = 7;
        while(n % x != 0 && ans < 2000000) {
            n = n * 10;
            n += 7;
            n %= x;
            ans++;
        }
        if(ans == 2000000)cout << -1 << endl;
        else
            cout << ans << endl;

    }


    return 0;
}



Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}

int MAXN=100010,INF=1000000000;
int n,m;
vector<vector<int>> G(MAXN);
vector<int> dist(MAXN,INF);
vector<int> dist1(MAXN,INF);


void bfs(int s){
	queue<pii> q;
	q.push(mp(s,0));
	dist.at(s)=0;
	dist1.at(s)=0;
	while(!q.empty()){
		int e=q.front().first,k=q.front().second;
		q.pop();
		for(auto i:G[e]){
			if((k+1)%3==0){
				if((k+1)/3<dist.at(i)){
					dist.at(i)=(k+1)/3;
					dist1.at(i)=k+1;
					q.push(mp(i,k+1));
				}
			}
			else{
				if(dist1.at(i)==INF || dist1.at(i)%3!=(k+1)%3){
					dist1.at(i)=k+1;
					q.push(mp(i,k+1));
				}
			}
		}
	}
}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n >> m;
	rep(i,m){
		int u,v;cin >> u >> v;
		u--;v--;
		G.at(u).pb(v);
	}
	int S,T;cin >> S >> T;
	S--;T--;
	bfs(S);
	if(dist.at(T)==INF) cout << -1 << endl;
	else cout << dist.at(T) << endl;
}


Measured memory_bytes: 6528
#include <stdio.h>

int makeLCM(int a, int b) {
	int r0;
	int A,B;
	if (a > b) {
		A = a;
		B = b;
	} else {
		A = b;
		B = a;
	}
	while (1) {
		r0 = A % B;
		if (r0 == 0) {
			return a * b / B;
		}
		A = B;
		B = r0;
	}
	
}

int main(void) {
	int n;
	int a[11] = {0};
	int tmp;
	int i;
	scanf("%d",&n);

	for (i = 0; i < n; ++i) {
		scanf("%d", &a[i]);
	}
	tmp = a[0];
	for (i = 1; i< n; ++i) {
		tmp = makeLCM(tmp, a[i]);
	}
	
	printf("%d\n", tmp);
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> num;
  int N,K,p=0,i=0,r;
  cin >> N >> K;
  r=1;
  do{
    p=(K-1)*r;
    N=N-p;
    i++;
    r=r*K;
  }while(0<N);
  cout << i << endl;
}

Measured memory_bytes: 256