akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
   ll p,d;
   cin>>p>>d;
   ll cnt=0;
   while(p--)
   {
       ll a,b;
       cin>>a>>b;
       double temp=sqrt((a*a)+(b*b));
       if(temp<=d)
        cnt++;
       //cout<<temp<<endl;

   }
   cout<<cnt<<endl;
}


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

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

	int ans = 1;
	rep(i, n-1){
		if(s.at(i) != s.at(i+1)) ans++;
	}

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

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

using namespace std;

int main()
{
  int a,b;
  cin>>a>>b;
  int i;
  for(i=1;i<=1009;i++)
  {
    if(floor(0.08*i)==a&&floor(0.1*i)==b)
      break;
  }
  if(i<=1009)
    cout<<i;
  else
    cout<<-1;
  
  return 0;
}
      

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

// #define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout <<setw(2)<< arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //
#define bug(...)                                  __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{	rtn
	const char* comma = strchr (names + 1, ',');
	cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q;
int arr[N + 2], brr[N], a1[N], b1[N], c[N], kmp[N];


void solve()
{
	cin >> n;
	lop(i, 0, n) cin >> arr[i];
	lop(i, 0, n) cin >> brr[i];
	lop(i, 0, n) a1[i] = (arr[i] ^ arr[ (i + 1) % n ]);
	lop(i, 0, n) b1[i] = (brr[i] ^ brr[ (i + 1) % n ]);

	int cnt = 0;
	lop(i, 0, n) c[cnt++] = b1[i];
	c[cnt++] = -1;
	lop(i, 0, n) c[cnt++] = a1[i];
	lop(i, 0, n) c[cnt++] = a1[i];

	int k = 3 * n + 1;
	// bug(cnt, k);

	lop(i, 1, k)
	{
		int j = kmp[i - 1];
		while (j and c[i] != c[j] ) j = kmp[j - 1];
		if ( c[i] == c[j] ) j++;
		kmp[i] = j;
	}
	// prarr(a1, 0, n);
	// prarr(b1, 0, n);
	// prarr(c, 0, k);
	// prarr(kmp, 0, k);

	vector<pii> vec;
	lop(i, n + 1, k - 1)
	{
		if (kmp[i] != n) continue;
		int id = i - (n + 1);
		id  = (id - n + 1) % n;
		vec.pb({id, -1});
	}

	for (auto &i : vec)
	{
		int x = (arr[i.ff] ^ brr[0]);
		i.ss = x;
	}

	for (auto &i : vec) cout << i.ff << " " << i.ss << endl;




}

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

	int test = 1;
	// cin >> test;
	while (test--)solve();


}





Measured memory_bytes: 13232
#include<bits/stdc++.h>
#define P 3.1415926535897932384626433832
using namespace std;

void fun()
{
    int n,m;
    cin>>n;

    int arr[n+1];
    for(int i=0;i<n+1;i++)
        arr[i]=0;

    for(int i=0;i<n-1;i++)
    {
        int x;
        cin>>x;
        arr[x]++;

    }

    for(int i=1;i<=n;i++)
        cout<<arr[i]<<endl;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    fun();
    return 0;
}


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

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define read()          freopen("fibsubseq.in","r",stdin)
#define write()         freopen("fibsubseq.out","w",stdout)
#define sf(n)           scanf("%d",&n)
#define sfd(n)          scanf("%lf",&n)
#define sl(x)           scanf("%I64d",&x)
#define sfl(n)          scanf("%lld", &n)
#define sfc(n)          scanf(" %c",&n)
#define sful(n)         scanf("%llu",&n)
#define ull             unsigned long long int
#define endll           printf("\n")
#define pf              printf
#define pi              acos(-1.0)
#define eps             1e-10
#define mem(a,b)        memset(a,b,sizeof(a))
#define pb              push_back
#define xx              first
#define yy              second
#define pii             pair<int, int>
#define pll             pair<ll, ll>
#define MP make_pair
#define ll              long long
#define uniq(a)      a.erase(unique(a.begin(), a.end()), a.end())

bool Check(unsigned int  N,int pos){return (bool)(N & (1LL<<pos));}
ll  Set(unsigned int N,int pos){    return N=N | (1LL<<pos);}
#define cnd tree[idx]
#define lnd tree[idx<<1]
#define rnd tree[(idx<<1)+1]
#define lndp (idx<<1),(b),((b+e)>>1)
#define rndp ((idx<<1)+1),(((b+e)>>1)+1),(e)
#define inf 1999999999
#define MX 100005
#define mod  1000000007
#define mod1 1000000009
#define var    int ii,i,j,k,z=0,c=0,t,x,y,l,r,mid,m
//int dx[8]={0,0,1,1,-1,-1,1,-1};  //8 direction
//int dy[8]={1,-1,1,-1,1,-1,0,0};

ll n;
ll a[3005],dp[3005][3005][2];

ll fn(ll x,ll y,ll f)
{
    if(x>y)return 0;
    ll &z=dp[x][y][f];
    if(z!=-1)return z;
    z=0;
    if(f==0)z=max(a[x]+fn(x+1,y,!f),a[y]+fn(x,y-1,!f));
    else z=min(fn(x+1,y,!f),fn(x,y-1,!f));
    return z;
}

int main()
{
    ll var;
    sfl(n);
    for(i=0;i<n;i++)sfl(a[i]),c+=a[i];
    mem(dp,-1);
    z=fn(0,n-1,0);
    cout<<z-(c-z)<<endl;
}


Measured memory_bytes: 141440
# -*- coding: utf-8 -*-

def main():

    S = input()

    listS = list(S)

    listStr = ['A', 'C', 'G', 'T']
    counter = 0
    flag = False
    ans = 0

    for i in listS:
        if i in listStr:
            counter += 1
            if ans < counter:
                ans = counter
            flag = True

        else:
            flag = False
            counter = 0


    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 9040
#include<queue>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXT=100005;
const int MAXN=5*MAXT;
const int MAXM=20*MAXT;
const int INF=0X3F3F3F3F;
int N,S,T,top=1,Ans;
int dep[MAXN],vis[MAXN];
int head[MAXN],cur[MAXN];
struct Node{int v,next,val;}node[MAXM];
void Addedge(int u,int v,int val1,int val2){
	node[++top].v=v;node[top].val=val1;node[top].next=head[u];head[u]=top;
	node[++top].v=u;node[top].val=val2;node[top].next=head[v];head[v]=top;
}
int bfs(int u,int v){
	queue<int>Q;
	while(!Q.empty())Q.pop();
	for(int i=S;i<=T;i++)
		cur[i]=head[i],dep[i]=INF,vis[i]=0;
	Q.push(u);dep[u]=v;
	while(!Q.empty()){
		u=Q.front();Q.pop();vis[u]=0;
		for(int i=head[u];i;i=node[i].next){
			v=node[i].v;
			if(dep[v]>dep[u]+1&&node[i].val){
				dep[v]=dep[u]+1;
				if(!vis[v]){
					Q.push(v);
					vis[v]=1;
				}
			}
		}
	}
	if(dep[T]==INF)return 0;
	return 1;
}
int dfs(int u,int flow){
	int rlow=0,used=0;
	if(u==T){
		Ans+=flow;
		return flow;
	}
	for(int i=cur[u];i;i=node[i].next){
		int v=node[i].v;cur[u]=i;
		if(node[i].val&&dep[v]==dep[u]+1)
			if(rlow=dfs(v,min(flow-used,node[i].val))){
				used+=rlow;
				node[i].val-=rlow;
				node[i^1].val+=rlow;
				if(used==flow)break;
			}
	}
	return used;
}
void Dinic(){
	while(bfs(S,0))dfs(S,INF);
}
int K,A[MAXT],B[MAXT];
int main(){
	//freopen("door.in","r",stdin);
	//freopen("door.out","w",stdout);
	scanf("%d",&K);
	for(int i=1;i<=K;i++)scanf("%d",&A[i]),A[i]++;
	for(int i=1;i<=K;i++)scanf("%d",&B[i]),B[i]++;
	S=0;T=K*2;
	for(int i=1;i<=K;i++){
		if(vis[i])continue;
		int t=i;T++;
		while(!vis[t]){
			vis[t]=1;
			Addedge(T,t,INF,INF);
			t=A[t];
		}
	}memset(vis,0,sizeof(vis));
	for(int i=1;i<=K;i++){
		if(vis[i])continue;
		int t=i;T++;
		while(!vis[t]){
			vis[t]=1;
			Addedge(T,t+K,INF,INF);
			t=B[t];
		}
	}memset(vis,0,sizeof(vis));T++;
	for(int i=1;i<=K;i++){
		if(i==A[i]&&i==B[i])//a=1 c=1
			Addedge(S,i,1,0),Addedge(i,T,1,0);
		if(i==A[i]&&i!=B[i])//b=1
			Addedge(S,i+K,1,0);
		if(i!=A[i]&&i==B[i])//c=1
			Addedge(i,T,1,0);
		if(i!=A[i]&&i!=B[i]&&A[i]==B[i])//e=f=1
			Addedge(i,i+K,1,1);
		if(i!=A[i]&&i!=B[i]&&A[i]!=B[i])//f=1
			Addedge(i,i+K,1,0);
	}//s->i (a),s->i+N (b),i->t (c),i+N->t (d),i+N->i (e),i->i+N (f)
	N=T;Dinic();printf("%d\n",K-Ans);
}

Measured memory_bytes: 29568
#include <bits/stdc++.h>
using namespace std;
 
int main(void) {
  string N,ans;
  int S;
  cin >> S;
  if(S%2==1){
    ans = "No";
    cout << ans << endl;
    return 0;
  }
  cin >> N;
  ans = "Yes";
  int s = N.size()/2;
  for(int i=0;i<s;i++){
    if(N.at(i) != N.at(s+i)){
      ans = "No";
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

long long k;
long long ans[50];
int main() {
    cin >> k;
    long long n = 50;
    long long mod = k % n;
    for(int i = 0; i < n; i++) ans[i] = n + (k / n) - mod - 1;
    for(int i = 0; i < mod; i++) {
        ans[i] += (mod + 1);
    }
    cout << n << endl;
    for(int i = 0; i < n; i++) i == 0 ? cout << ans[i] : cout << " " << ans[i];
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	
	int a[3],x,i,j;
	
	scanf("%d %d %d",&a[0],&a[1],&a[2]);
	
	for(i=0;i<2;i++){
		for(j=i+1;j<3;j++){
			if(a[i]>a[j]){
				x=a[i]; a[i]=a[j]; a[j]=x;
			}
		}
	}
		
	printf("%d %d %d\n",a[0],a[1],a[2]);
		
	return 0;
}

Measured memory_bytes: 596
#include <cstdio>
#include <iostream>
using namespace std;
#define CENTINEL 2000000000
#define MAX 200000
typedef long long int llong;
int n,A[200000];
int L[MAX/2+2],R[MAX/2+2];
llong merge(int A[],int left,int mid,int right){
  int na=mid-left;
  int nb=right-mid;
  llong sum=0;
  for(int i=0;i<na;i++)L[i]=A[left+i];
  for(int i=0;i<nb;i++)R[i]=A[mid+i];
  L[na]=R[nb]=CENTINEL;
  int i=0,j=0;
  for(int k=left;k<right;k++){
    if(L[i]<=R[j])A[k]=L[i++];
    else {A[k]=R[j++];sum+=na-i;}
  }
  return sum;
}
llong mergesort(int A[],int left,int right){
  llong v1,v2,v3;
  if(left+1<right){
    int mid=(left+right)/2;
    v1=mergesort(A,left,mid);
    v2=mergesort(A,mid,right);
    v3=merge(A,left,mid,right);
    return v1+v2+v3;
  } else return 0;
}
int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++)scanf("%d",&A[i]);
  llong cnt;
  cnt=mergesort(A,0,n);
  printf("%lld\n",cnt);
  return 0;
}
 

 

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

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

  if(n >= 10) cout << r << endl;
  else cout << r+ 100 * (10 - n) << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//repetition
//------------------------------------------
#define FOR(i, p, b) for (int i = (p); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \<< " " << __FILE__ << endl;

int main() {
    int N;
    string S;
    int p[] = {0,0,0,0};
    cin >> N;

    int i = 0;
    REP(i, N) {
        cin >> S;
        if (S == "P") {
            p[0]++;
        } else if (S == "W") {
            p[1]++;
        } else if (S == "G") {
            p[2]++;
        } else if (S == "Y") {
            p[3]++;
        }
    }

    i = 0;
    int cnt = 0;
    REP(i, 4) {
        if (p[i] > 0) {
            cnt++;
            dump(cnt)
        }
    }

    if (cnt == 3) {
        cout << "Three" << endl;
    } else if (cnt == 4) {
        cout << "Four" << endl;
    }

}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <utility>
#include <string>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <cctype>

typedef long long int lli;

using namespace std;

int main() {

   string S;
   string T="abcdefghijklmnopqrstuvwxyz";
   cin >> S;
   for(int i=0;i<T.length();i++){
      if(T[i]==S[0]){
         cout << T[i+1]<< endl;
         break;
      }
   }
}

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

namespace Main
{
    public static class Program
    {
        public static List<int> list = new List<int>();

        static void Main(string[] arg)
        {
            int n = int.Parse(Console.ReadLine());
            var input = GetIntList(Console.ReadLine());
            var answer = 0;
            int max = input[0];
            foreach(int i in input)
            {
                if(i >= max)
                {
                    max = i;
                    answer++;
                }
            }

            Console.WriteLine(answer);




        }
        
        #region libraries
        private static int[] GetIntList(string line)
        {
            return line.Split(' ').Select(x => int.Parse(x)).ToArray();

        }
        private static double[] GetDoubleList(string line)
        {
            return line.Split(' ').Select(x => double.Parse(x)).ToArray();

        }
        private static ulong[] GetUlongList(string line)
        {
            return line.Split(' ').Select(x => ulong.Parse(x)).ToArray();
        }
        private static long[] GetLongList(string line)
        {
            return line.Split(' ').Select(x => long.Parse(x)).ToArray();
        }
        private static int SearchNearest(this IEnumerable<int> list, int target)
        {
            var min = list.Min(c => Math.Abs(c - target));
            return list.First(c => Math.Abs(c - target) == min);
        }
        public static int Gcd(int a,int b)
        {
            if(a < b)
            {
                Gcd(b, a);
            }
            while (b != 0)
            {
                var rm = a % b;
                a = b;
                b = rm;
            }
            return a;
        }
        #endregion
    }
}


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

class Main {

    static final int MAX_X = 2000;
    static final int MAX_Y = 2000;
    int[][] s = new int[MAX_X][MAX_Y];
    
    void solve(){

	for ( int i=0; i<MAX_X; ++i ) 
	    for ( int j=0; j<MAX_Y; ++j ) s[i][j] = 0;

	Scanner sc = new Scanner( System.in );
	for ( int k=0; k<2; ++k ) {
	    int x = sc.nextInt();
	    int y = sc.nextInt();
	    int w = sc.nextInt();
	    int h = sc.nextInt();
	    for ( int i=x; i<x+w; ++i ) 
		for ( int j=y; j<y+h; ++j ) ++s[i][j];
	}

	int c = 0;
	for ( int i=0; i<MAX_X; ++i ) 
	    for ( int j=0; j<MAX_Y; ++j )
		if ( s[i][j] == 1 ) ++c;
	System.out.println( c );

    }

    public static void main( String[] a ) {new Main().solve(); }
}



Measured memory_bytes: 42764
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e15;
const int MOD = 1e9 + 7;

vector<long long> divisor(long long n){
    vector<long long> res;
    for(int i = 1; (long long)i * i <= n; i++){
        if(n % i == 0){
            res.push_back(i);
            if(i != n / i) res.push_back(n / i);
        }
    }
    sort(begin(res), end(res));
    return res;
}

signed main(){
    ll n;
    cin >> n;
    vector<ll> vec = divisor(n);
    ll ans = INF;
    REP(i,vec.size()){
        ans = min(ans, vec[i] + n / vec[i]);
    }
    cout << ans - 2 << endl;
    return 0;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    string S;
    cin >> S;
    string ans = "First";
    if (S[0] == S[S.length() - 1])
    {
        if (S.length() % 2 == 1)
            ans = "Second";
    }
    else
    {
        if (S.length() % 2 == 0)
            ans = "Second";
    }
    cout << ans << endl;
    return 0;
}

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

void solve() {
    int N; cin >> N;
    set<string> st;
    while (N--) {
        string s; cin >> s;
        st.insert(s);
    }
    cout << st.size() << '\n';
}

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

    solve();
    return 0;
}

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

int main() {
  string X, Y;
  cin >> X >> Y;

  if ( X > Y ) {
    cout << ">" << endl;
  }
  
  else if ( X < Y ) {
    cout << "<" << endl;
  }
  
  else {
    cout << "=" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <bitset>
#include <string>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <list>
#include <deque>
using namespace std;
#define INF 10000000
#define LLINF 100000000000000
typedef pair<int, int> P;
typedef long long ll;
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define VSORT(v) sort(v.begin(), v.end());
#define fi first
#define se second
#define out(x) cout << x << endl;
int dx[] = { 1, 0, -1, 0 }, dy[] = { 0,1,0,-1 };
ll MOD = 1000000007;

int main() {
	while (true) {
		set<P>st;
		int x[3005] = { 0 }, y[3005] = { 0 };
		int res = 0;
		int n;
		cin >> n;
		if (n == 0) return 0;
		for (int i = 0; i < n; i++) {
			cin >> x[i] >> y[i];
			st.insert(P(x[i], y[i]));
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				int xs = x[j] - x[i];
				int ys = y[j] - y[i];
				if (xs >= 0 && ys <= 0) {
					int cnt = 0;
					//if(x[i]+abs(ys)<=5000&&y[i]+xs<=5000) cnt += p[x[i] + abs(ys)][y[i] + xs];
					//int nx = x[i] - ys;
					//int ny = y[i] + xs;
					//if(x[j]+abs(ys)<=5000&&y[j]+xs<=5000) cnt += p[x[j] + abs(ys)][y[j] + xs];
					int nx = x[i] + abs(ys);
					int ny = y[i] + xs;
					if (st.count(P(nx, ny))) cnt++;
					nx = x[j] + abs(ys);
					ny = y[j] + xs;
					if (st.count(P(nx, ny))) cnt++;
					if (cnt == 2) {
						int sum = (abs(xs) + abs(ys))*(abs(xs) + abs(ys));
						sum -= 2 * abs(xs)*abs(ys);
						res = max(res, sum);
					}
				}
			}
		}
		out(res);
	}
	return 0;
}


Measured memory_bytes: 3304
import re
n,a,b,c,d = map(int,input().split())
s = input()
a,b,c,d = map(lambda x:x-1,[a,b,c,d])

#<##>が存在すると飛べないのでNG
#c>dの場合には、途中でaがbを追い抜く必要がある。そのスペース=<...>が
#あるか判定
if re.search(r'##',s[a:max(b,d)+1]):
    print('No')
else:
    if c>d:
        if (re.search(r'\.{3,}',s[b-1:d+2])):
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')

Measured memory_bytes: 3700
from collections import deque


def solve():
    N = int(input())
    
    nums = []
    que = deque([0])
    while que:
        num = que.pop()
        for c in '357':
            n_num = num*10 + int(c)
            if n_num <= N:
                if '3' in str(n_num) and '5' in str(n_num) and '7' in str(n_num):
                    nums.append(n_num)
                que.append(n_num)
    
    print(len(nums))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 4456
N=int(input())
A=list(map(int, input().split()))

check=True
for n in range(N):
    if A[n]%2==0:
        if not (A[n]%3==0 or A[n]%5==0):
            check=False
if check:
    print('APPROVED')
else:
    print('DENIED')


Measured memory_bytes: 2940
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		int rectangle = 0, rhombus = 0;
		int a, b, c;
		while ((line = br.readLine()) != null) {
			a = Integer.parseInt(line.split(",")[0]);
			b = Integer.parseInt(line.split(",")[1]);
			c = Integer.parseInt(line.split(",")[2]);
			if (c * c == a * a + b * b)
				rectangle++;
			else if (a == b)
				rhombus++;
		}
		System.out.println(rectangle);
		System.out.println(rhombus);
	}
}

Measured memory_bytes: 16908
#include<bits/stdc++.h>
#define ll long long
using namespace std;
char a[409][409];
int dp[409][409];
main(){
    int n, m;
    cin >> n >> m;
    for(int i = 1;i <= n; i++){
        for(int j = 1; j <= m; j++){
            cin >> a[i][j];
        }
    }
    if(a[1][1] == '#') dp[1][1] = 1;
        else dp[1][1] = 0;
    for(int i = 1 ;i <= n; i++)
        dp[i][0] = 1e9;
    for(int i = 1; i <= m; i++)
        dp[0][i] = 1e9;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(i == 1 && j == 1) continue;
            if(a[i][j] == '.')
                dp[i][j] = min(dp[i][j-1], dp[i-1][j]);
            else{
                if(a[i][j-1] == '.')
                    dp[i][j] = dp[i][j-1] + 1;
                    else dp[i][j] = dp[i][j-1];
                if(a[i-1][j] == '.')
                    dp[i][j] = min(dp[i][j], dp[i-1][j]+1);
                    else dp[i][j] = min(dp[i][j], dp[i-1][j]);
            }
        }
    }
    cout << dp[n][m] << endl;
}


Measured memory_bytes: 512
n=int(input())
d={}
for i in range(n):
  k=input()
  d[k]=d.get(k,0)+1
val=list(d.values())
key=list(d.keys())
m=max(val)
key.sort()
for i in key:
  if d[i]==m:
    print(i)
  


Measured memory_bytes: 32988
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, s[111], xp = 0;

  std::cin >> N;

  for (int i = 0; i < N; i ++)
    std::cin >> s[i];

  bool dp[11111] = {0};

  dp[0] = true;

  for (int i = 0; i < N; i ++)
    for (int j = 11110; j >= 0; j --)
      if (dp[j]) {
        int x = j + s[i];

        dp[x] = true;

        if (x % 10)
          xp = std::max(x, xp);
      }

  std::cout << xp << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

double calc(int x, int h) {
    return((2.0 * x) * sqrt(h*h + (x*x) / 4.0) + x*x);
}

int main(void) {
    int x, h;
    
    while(cin >> x >> h, x||h) {
        printf("%.6f\n", calc(x, h));
    }
    return(0);
}

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

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

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

    int n;
    cin>>n;
    set<int> s;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        s.insert(x);
    }
    cout<<(s.size()==n?"YES":"NO");
}


Measured memory_bytes: 9600
X, N = map(int, input().split())
P = list(map(int, input().split()))

ans = 0
tmpabs = 150

if N == 0:
    print(X)
    exit()

for i in range(110):
    if i not in P and tmpabs > abs(X-i):
        ans = i
        tmpabs = abs(X-i)

print(ans)


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

static const int INF=1e9;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int N; cin >> N;
    ll a[N+1];
    a[0]=0;
    for(int i=1;i<=N;i++) cin >> a[i];
    ll tmp=1e18;
    for(int i=1;i<=N;i++){
        a[i]+=a[i-1];
    }
    for(int i=1;i<=N;i++){
        tmp=min(tmp,abs(a[N]-a[i]-a[i]));
    }
    cout << tmp << endl;
}


Measured memory_bytes: 1792
n = input().split(" ")
p = input().split(" ")
n = list(map(int,n))
p = list(map(int,p))
#a = [chr(ord("a")+i) for i in range(26)]

p.sort()
sum = 0
for i in range(n[1]):
  sum += p[i]
  
print(sum)

Measured memory_bytes: 9180
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath> 
using namespace std;
typedef long long ll;
ll n;
ll calc(ll a){
	ll num = 0;
	while(a) num ++,a /= 10;
	return num;
}
void solve(){
	cin >> n;
	for(ll i = sqrt(n);i >= 1;i --){
		if(n % i == 0){
			cout << max(calc(i),calc(n / i)) << endl;
			return;
		}
	}
	return;
}

int main(){
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define F first
#define S second

int sum[100009];

signed main(){
  int n,k,m;
  priority_queue<int>q;
  cin>>n>>m;
  r(i,n){
    int x;
    cin>>x;
    q.push(x);
  }
  r(i,m){
    int x=q.top();q.pop();
    x/=2;
    q.push(x);
  }
  int sum=0;
  while(!q.empty()){
    int x=q.top();q.pop();
    sum+=x;
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 1400
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

int n, k;
LL x[100010];

void init() {

}

void input() {
	cin >> n >> k;
	REP(i, n) cin >> x[i];
}

void solve() {
	if (n == 1) {
		cout << abs(x[0]) << endl;
		return;
	}
	LL res = 1LL<<60;
	for(int i = 0; i <= n-k; i++) {
		LL l = x[i];
		LL r = x[i+k-1];
		chmin(res, r-l + min(abs(r), abs(l)));
	}
	cout << res << endl;
}

int main() {
	init();
	input();
	solve();
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  switch (n)
  {
    case 22:
      cout << "Christmas Eve Eve Eve" << endl;
      break;
    case 23:
      cout << "Christmas Eve Eve" << endl;
      break;
    case 24:
      cout << "Christmas Eve" << endl;
      break;
    case 25:
      cout << "Christmas" << endl;
      break;
  }
}

Measured memory_bytes: 3572
#include <iostream>

using namespace std;

main(){
  int b, r, g, c, s, t;
  while(1){
    cin >> b >> r >> g >> c >> s >> t;
    if(b==0 && r==0 && g==0 && c==0 && s==0 && t==0) break;

    int sum=0;

    t-=s;
    int bo=b*5+r*3;
    t-=bo;
    sum-=t*3;
    sum-=bo*2;
    sum+=bo*15;
    sum+=b*15+r*15+g*7+c*2+100;

    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 0
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = '-' + sr()
N = len(S) - 1
def solve(S):
    if S[1] == '0':
        return None
    if S[N] == '1':
        return None
    prev = 1
    graph = []
    for n in range(1,N//2 + 1):
        if S[n] != S[N-n]:
            return None
        if S[n] == '0':
            continue
        for i in range(prev,n):
            graph.append('{} {}'.format(i,n))
        prev = n
    for i in range(prev,N):
        graph.append('{} {}'.format(i,N))
    return graph

graph = solve(S)

if graph is None:
    print(-1)
else:
    print('\n'.join(graph))


Measured memory_bytes: 14232
//https://atcoder.jp/contests/jsc2019-qual/submissions/7121286

#include	<stdio.h>
int main(){
int month=0,day=0,count=0,tmp=0,compare1=0,test=0,compare2=0;
scanf("%d",&month);//tuki
scanf("%d",&day);//hiniti
for(int j=1;j<=month;j++){
for(int i=2;i<10;i++){
	tmp=j/i;
    if(tmp>i)continue;
  	test=j%i;
  	compare1=tmp*10+i;
    compare2=i*10+tmp;
  	if(compare1<=day && compare1!=compare2&&tmp<10 && 1<tmp && test==0){
    count=count+1;
     
    }
    if(compare2<=day && tmp<10 && 1<tmp &&test==0){
    count=count+1;
      
    }
}}
printf("%d",count);
 return 0;
}
 

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

int main(){
  double v;
  while (cin >> v) {
    double t = v / 9.8;
    double y = 4.9 * t * t;
    int n = 1;
    while (5 * n - 5 < y) {
      n++;
    }
    cout  << n << endl;
  }
}



Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
#define No cout<<"No"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    int n,k;
    cin>>n>>k;
    int ans=1;
    rep(i,n){
        if(ans<k){
            ans*=2;
        }
        else{
            ans+=k;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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


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

    vector<int> numCnt(100010);
    for (int i = 0; i < N; ++i) {
        if (a[i] > 0) numCnt[a[i]-1]++;
        numCnt[a[i]]++;
        numCnt[a[i]+1]++;
    }

    int ans = 0;
    for (int i = 0; i < numCnt.size(); ++i) {
        ans = max(ans, numCnt[i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	A, B := nextInt(), nextInt()
	pfA := primeFuctorize(A)
	pfB := primeFuctorize(B)
	ans := 0
	for a := range pfA {
		for b := range pfB {
			if a == b {
				ans++
			}
		}
	}
	// 1が含まれてないため、1の分を足す
	fmt.Println(ans + 1)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

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

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
int dp[4096];
signed main(){
    for(int i=0;i<4096;i++)
        dp[i]=1e9;
    dp[0]=0;
    int n,m,a[1000],b[1000],c[1000][12],cpp[1000];
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i];
        for(int j=0;j<b[i];j++){
            cin>>c[i][j];
            cpp[i]|=1<<c[i][j]-1;
        }
    }
    for(int i=0;i<m;i++)
        for(int S=0;S<1<<n;S++)
            dp[S|cpp[i]]=min(dp[S|cpp[i]],dp[S]+a[i]);
    cout<<(dp[(1<<n)-1]==1e9?-1:dp[(1<<n)-1])<<endl;
}


Measured memory_bytes: 384
class UnionFind:
  def __init__(self, n):
    self.par = [i for i in range(n)]
    self.rank = [0]*n
  def find(self, x):
    if self.par[x]==x:
      return x
    else:
      self.par[x] = self.find(self.par[x])
      return self.par[x]
  def unit(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x==y:
      return
    elif self.rank[x]<self.rank[y]:
      self.par[x] = y
      return
    elif self.rank[y]<self.rank[x]:
      self.par[y] = x
    else:
      self.par[y] = x
      self.rank[x] += 1
      
  def same(self, x, y):
    return self.find(x)==self.find(y)
  

N, M, *L = map(int, open(0).read().split())
p = L[:N]
ls = L[N:]
u = UnionFind(N+1)
for x,y in zip(*[iter(ls)]*2):
  u.unit(x,y)
ans = sum(u.same(p,i+1) for i,p in enumerate(p))
print(ans)

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

using namespace std;

bool isPlain(string secret){
    bool find_the,find_that,find_this;
    
    find_the = (secret.find("the") != string::npos);
    find_that = (secret.find("that") != string::npos);
    find_this = (secret.find("this") != string::npos);

    return (find_the || find_that || find_this);
}

string decipher(string secret){
    int gap = 1;
    string plain;
    bool check;
    
    //"the", "that", "this"
    check = isPlain(secret);
    
    if(check){
        plain = secret;
    }
    else {
        while(gap<=26){
            string::iterator it = secret.begin();
            for (; it != secret.end(); it += 1){
                if('a'<=*it & *it <='z')
                    *it = (*it!='z') ? *it + 1 : 'a';
                //cout << *it;
            }
            //cout << endl;
            gap++;
            if(isPlain(secret)) break;
        }
    }
    return secret;
}


int main (int argc, char const* argv[]){
    string secret, plain;
    
    
    //暗号文の取得
    getline(cin,secret);
    while(!secret.empty()){
        
        //暗号解読
        plain = decipher(secret);
        //平文の出力
        cout << plain << endl;
        
        getline(cin,secret);
    }
    
    
    return 0;
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

map<ll,ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

void solve(){
    ll n; cin >> n;
    ll cnt = 0;
    REP(i, n){
        ll a;
        cin >> a;
        map<ll, ll> mp = prime_factor(a);
        cnt += mp[2];
    }
    cout << cnt << endl;
}

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

Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cassert>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<limits>
#include<ctime>
#include<stack>
#include<bits/stdc++.h>
#include<string>
#include<stdlib.h>
#include<stdio.h>

typedef long long ll;
using namespace std;
const ll x=1000000007;
int mod(ll a){
	return a%x;
}
int main(){
	ll n,k,m;
	cin>>n>>k>>m;
	ll a[n],c[m];
	for(int i=1;i<=n;i++){
		a[i]=0;
	}
	for(int i=0;i<m;i++){
		ll b;
		cin>>b;
		a[b]++;
	}
	for(int i=1;i<=n;i++){
		a[i]=k-m+a[i];
		if(a[i]>0){
			cout<<"Yes"<<endl;
		}
		else{
			cout<<"No"<<endl;
		}
	}
	
	
}

Measured memory_bytes: 4380
//Ahadul Haque, MBSTU,ICT
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mk make_pair
#define TEST int test; cin >> test ;while(test--)
#define endl "\n"
int main()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll z=a*c;
    ll z1=a*d;
    ll z2=b*c;
    ll z3=b*d;
    cout<<max(z,max(z1,max(z2,z3)));

    return 0;
}


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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define fi first
#define se second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;
template <class T> using vec = vector<T>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

ll dp[5005][5005];

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

  rrep(i, n, 1) rrep(j, i, 0) {
    if (i - j == 1 || i == n - 1) {
      dp[i][j] = s[i] == s[j];
      continue;
    }

    if (s[i] != s[j]) {
      dp[i][j] = 0;
      continue;
    }

    dp[i][j] = min<ll>(i - j, dp[i + 1][j + 1] + 1);
  }

  ll ans = 0;
  rep(i, 0, n) rep(j, 0, n) { chmax(ans, dp[i][j]); }

  put(ans);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 193920
#include<stdio.h>
using namespace std;
int main(){
	int a[100050]={0},b[100050],c,i,j,n,m;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	int times=0;
	for(i=1;i<=n;i++){
		if(a[i]==i){
			c=a[i];
			a[i]=a[i+1];
			a[i+1]=c;
			times++;
		}
	}	
	printf("%d\n",times);	
	return 0;
}

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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(10);
    /*start*/
    string s;
    ll k;
    int ans = 0;
    cin >> s >> k;
    if (s[0] == '1')
    {
        rep(i, min((ll)s.size(), k))
        {
            ans = s[i] - '0';
            if (s[i] != '1')
            {
                break;
            }
        }
    }
    else
    {
        ans = s[0] - '0';
    }
    c(ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fr(i, n) for (int i = 0; i < n; i++)
#define frab(i, a, b) for (int i = a; i < b; i++)
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

const ll MOD = 1e9 + 7;
const ll INF = 2e15 + 10;
const ll MAX = 1e14 + 10;
const ld EPS = 1e-9;
const int N = 2e5 + 10;
const int M = 1e5 + 10;

mat E;

mat mult(mat a, mat b) {
    int n = a.size();
    mat c(n, vector<ll>(n, 0));
    fr(i, n)
        fr(j, n)
            fr(k, n)
                c[i][j] = (c[i][j] + a[i][k] * b[k][j]) % MOD;
    return c;
}

mat pw(mat a, ll k) {
    if (k == 0)
        return E;
    if (k % 2)
        return mult(a, pw(a, k - 1));
    auto t = pw(a, k / 2);
    return mult(t, t);
}

void solve() {
    ll n, k;
    cin >> n >> k;
    mat a(n, vector<ll>(n));
    E.resize(n, vector<ll>(n, 0));
    fr(i, n)
        E[i][i] = 1;
    fr(i, n)
        fr(j, n)
            cin >> a[i][j];
    auto ans = pw(a, k);
    ll answ = 0;
    fr(i, n)
        fr(j, n)
            answ = (answ + ans[i][j]) % MOD;
    cout << answ;
}



int main() {
    //freopen("a.in", "r", stdin);
    ios_base::sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 2944
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll S;
    cin >> S;
    ll head = S / 100;
    ll tail = S - (S / 100) * 100;

    bool head_checker = false;
    bool tail_checker = false;

    if (head > 12 || head == 0) {
        head_checker = true;
    }
    if (tail > 12 || tail == 0) {
        tail_checker = true;
    }
    debug(head, tail);

    if (head_checker && tail_checker) {
        cout << "NA" << endl;
    } else if (head_checker) {
        cout << "YYMM" << endl;
    } else if (tail_checker) {
        cout << "MMYY" << endl;
    } else {
        cout << "AMBIGUOUS" << endl;
    }

    return 0;
}


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

int main() {
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    if (0 <= x-r && x+r <= w && 0 <= y-r && y+r <= h) {
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}



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

#define sz(a) int((a).size())
#define all(c) c.begin(), c.end()
#define ll long long
#define pb push_back
#define zoom                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define pl pair<ll, ll>
#define MOD 1000000007
#define endl "\n"
#define ff first
#define ss second
#define trace1(x) cerr << #x << ": " << x << endl
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define trace3(x, y, z) cerr << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl
#define trace4(a, b, c, d) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl
#define trace5(a, b, c, d, e) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl
#define trace(v)                                   \
    for (auto it = v.begin(); it != v.end(); it++) \
        cerr << *it << " ";                        \
    cerr << endl;
#define tr(container, it) \
    for (typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#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)

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<vi> vvi;

void solve()
{
    int n;
    ll w;
    cin >> n >> w;
    vector<pair<int, ll>> val(n);
    forn(i, n)
    {
        cin >> val[i].first >> val[i].second;
    }

    vector<ll> dp(w + 1, 0);
    
    for(int i = 1; i <= n; i++){
        vector<ll> new_dp(w + 1, 0);
        for(int j = 1; j <= w; j++){
            if(val[i - 1].first <= j){
                new_dp[j] = val[i - 1].second + dp[j - val[i - 1].first];
            }

            new_dp[j] = max(new_dp[j], dp[j]);

        }
        dp = new_dp;
    }

    cout << dp[w] <<endl;
}

int main()
{
    zoom;
    ll t = 1;
    // cin >> t;

    while (t--)
    {
        solve();
    }
}

Measured memory_bytes: 4692