akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <functional>
#include <iomanip>
//#include <windows.h>  //Should be deleted when using AtCoder&POJ
using namespace std;

#define ll long long
#define pii pair<int,int>
#define ppp pair<pii,pii>

#define qi ios::sync_with_stdio(0)
/**==Info==
*Program:2
*Problem:E - AtCoDeerくんと立方体づくり / Building Cubes with AtCoDeer
*Date:2018-10-21
*Algorithm:My Brute Force
*Stats:Unknown*/

bool debug=false;

int n;
ppp a[405];
ll ans;
vector<ppp> has;
map<ppp,int> cnt;

inline ppp bp(int a,int b,int c,int d){
	return make_pair(make_pair(a,b),make_pair(c,d));
}

void Ins(int xa,int xb,int xc,int xd){
	cnt[bp(xa,xb,xc,xd)]++;
	cnt[bp(xb,xc,xd,xa)]++;
	cnt[bp(xc,xd,xa,xb)]++;
	cnt[bp(xd,xa,xb,xc)]++;
}

int cntsame(ppp a,ppp b){
	int ba=b.first.first,bb=b.first.second,bc=b.second.first,bd=b.second.second;
	int ret=0;
	if(a==bp(ba,bb,bc,bd)) ret++;
	if(a==bp(bb,bc,bd,ba)) ret++;
	if(a==bp(bc,bd,ba,bb)) ret++;
	if(a==bp(bd,ba,bb,bc)) ret++;
	return ret;
}

int main(int argc,char* argv[]){
	qi;
	cin>>n;
	for(int i=0;i<n;i++){
		int x1,x2,x3,x4;
		cin>>x1>>x2>>x3>>x4;
		a[i]=bp(x1,x2,x3,x4);
	}
	
	for(int i=n-1;i>=0;i--){
		for(int j=0;j<has.size();j++){
			ppp ano=has[j];
			
			int ca=ano.first.first,cb=ano.first.second,cc=ano.second.first,cd=ano.second.second;
			
			ppp b1=bp(a[i].first.first,a[i].first.second,cb,ca);
			ppp b2=bp(a[i].first.second,a[i].second.first,cc,cb);
			ppp b3=bp(a[i].second.first,a[i].second.second,cd,cc);
			ppp b4=bp(a[i].second.second,a[i].first.first,ca,cd);
			
			ll ret=1;
			ret*=cnt[b1]-cntsame(ano,b1);
			ret*=cnt[b2]-cntsame(b1,b2)-cntsame(ano,b2);
			ret*=cnt[b3]-cntsame(b1,b3)-cntsame(b2,b3)-cntsame(ano,b3);
			ret*=cnt[b4]-cntsame(b1,b4)-cntsame(b2,b4)-cntsame(b3,b4)-cntsame(ano,b4);
			
			ans+=ret;
		}
		
		int xa=a[i].first.first,xb=a[i].second.second,xc=a[i].second.first,xd=a[i].first.second;
		
		Ins(xa,xb,xc,xd);
		has.push_back(bp(xa,xb,xc,xd));
		has.push_back(bp(xb,xc,xd,xa));
		has.push_back(bp(xc,xd,xa,xb));
		has.push_back(bp(xd,xa,xb,xc));
		
	}
	
	cout<<ans;
	return 0;
}



Measured memory_bytes: 80256
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Scanner;

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

		int a,b;
		//double db;

		Scanner scan = new Scanner(System.in);

		a = scan.nextInt();
		b = scan.nextInt();

		BigDecimal aa = new BigDecimal(a);
		BigDecimal bb = new BigDecimal(b);
		
		BigDecimal div = new BigDecimal("0.00000000");

		div = aa.divide(bb, 8, BigDecimal.ROUND_HALF_UP);
		
		DecimalFormat format = new DecimalFormat("#.#");
		format.setMinimumFractionDigits(8);

		System.out.println(a/b + " " + a%b + " "+ format.format(div));
		scan.close();
	}
}

Measured memory_bytes: 26520
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array = new int[n];
		for(int i=0;i<n;i++) {
			array[i] = sc.nextInt();
		}
		int count=0,flag;
		while(true) {
			flag=0;
			for(int i=0;i<n;i++) {
				if(array[i]%2==0) {
					array[i]/=2;
				}else {
					flag=1;
					break;
				}
			}
			if(flag==1) break;
			count++;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 22228
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define RFOR(i, a, b) for(int i = a; i >= b; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
const int INF = 1e9;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
int main() {
    string s;
    cin >> s;
    int cnt = 0;
    REP(i, s.length()) {
        if(s[i] == 'o') ++cnt;
    }
    cout << 700 + cnt*100 << endl;
} 

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

void textIO()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

void fastIO()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

}


int main()
{

    textIO();
    fastIO();

    long long n;
    cin >> n;
    map<string, long long> mp;
    for(int i=0;i<n;i++){
        string s;
        cin >> s;
        mp[s]++;
    }

    cout << "AC x " << mp["AC"] << '\n';
    cout << "WA x " << mp["WA"] << '\n';
    cout << "TLE x " << mp["TLE"] << '\n';
    cout << "RE x " << mp["RE"] << '\n';


    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) (int)((a).size())
typedef long long ll;
typedef pair<int,int> PI;

vector<int> G[100][100];

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

bool can[51][51][4];
bool can2[51][51][4];

int main(int argc, char *argv[])
{
  int n,x,y,t;
  cin >> n >> x >> y >> t;
  
  rep(i,n){
    int xs,ys,xe,ye;
    cin >> xs >> ys >> xe >> ye;

    int dx = (xe-xs);
    int dy = (ye-ys);
    if(dx) dx/=abs(dx);
    if(dy) dy/=abs(dy);
    int dir;
    if(dx==1) dir = 1;
    else if(dx==-1) dir = 3;
    else if(dy == 1) dir = 0;
    else dir = 2;
    
    while(xs != xe || ys != ye){
      G[xs][ys].pb(dir);
      G[xs+dx][ys+dy].pb(dir^2);
      xs += dx;
      ys += dy;
    }
  }
  
  rep(i,4)
    can[x][y][i] = 1;
  
  rep(tjj,t){
    int d;
    char c;
    cin >> d >> c;
    int cdir = string("NESW").find(c);
    //cout << cdir << endl;
    
    rep(jj,d){
      memset(can2,0,sizeof(can2));
      // cout << "time " << jj << endl;
      // rep(x,51)rep(y,51)rep(j,4)
      //   if(can[x][y][j])
      //     cout << x << " " << y << " " << j << endl;
      
      rep(x,51)rep(y,51){
        rep(j,4) if(can[x][y][j]){
          for(auto e : G[x][y]){
            if(j!=e) continue;
            int nx = x + dx[j];
            int ny = y + dy[j];
            //cout << "hoge" << endl;
            can2[nx][ny][e] = 1;
          }
        }
      }
      
      memcpy(can,can2,sizeof(can));
      

      if(jj == d-1) break;
      
      memset(can2,0,sizeof(can2));
      
      rep(x,51)rep(y,51){
        rep(j,4) if(can[x][y][j]){
          can2[x][y][j] = 1;
          for(auto e : G[x][y]){
            if((j^e)==2) continue;
            can2[x][y][e] = 1;
          }
        }
      }
      
      memcpy(can,can2,sizeof(can));
      // cout << "aft" << endl;
      // rep(x,51)rep(y,51)rep(j,4)
      //   if(can[x][y][j])
      //     cout << x << " " << y << " " << j << endl;
    }

    //cout << endl;

    memset(can2,0,sizeof(can2));
      
    rep(x,51)rep(y,51){
      rep(j,4) if(can[x][y][j]){
        if(j==cdir){
          can2[x][y][j] = 1;
          for(auto e : G[x][y]){
            if((j^e)==2) continue;
            can2[x][y][e] = 1;
          }
        }else{
          for(auto e : G[x][y]){
            if((j^e)==2) continue;
            if(e != cdir) continue;
            can2[x][y][e] = 1;
          }
        }
        continue;
        
        can2[x][y][j] = 1;
        for(auto e : G[x][y]){
          if((j^e)==2) continue;
          can2[x][y][e] = 1;
        }
      }
    }
      
    memcpy(can,can2,sizeof(can));
    
    set<PI> ans;
    rep(x,51)rep(y,51){
      rep(j,4){
        if(can[x][y][j]) ans.insert(mp(x,y));
        //else can[x][y][j] = false;
      }
    }
    
    if(tjj==t-1)
      for(auto a : ans)
        cout << a.F << " " << a.S << endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 1512
n = int(input())
a = list(map(int,input().split()))
cond = 0
# 1: 上昇, -1: 減少, 0: 一緒
res = 1
for i in range(1,len(a)):
    if a[i] > a[i-1]:
        # 上昇
        if cond != 1:
            if cond == -1:
                res += 1
                cond = 0
            else:
                cond = 1
    elif a[i] < a[i-1]:
        # 減少
        if cond != -1:
            if cond == 1:
                res += 1
                cond = 0
            else:
                cond = -1
print(res)


Measured memory_bytes: 14224
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vector<string> v;

int main() {
	int n;
	int a;
	float d=0;
	cin>>n;
	rep(i,n){
		cin>>a;
		d+=(1/(float)a);
	}
	printf("%.9f",1/d);
	return 0;
}


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

int main(){
    bool flag[100001];
    int c[100002] = {};
    int Q, L, R;
    
    for(int i=2; i<=100000; i++){
        if(!flag[i]){
            for(int j=i+i; j<=100000; j+=i){
                flag[j]=true;
            }
        }
    }
    for(int i=3; i<=100000; i+=2){
        if(!flag[i] && !flag[(i+1)/2]){
            c[i]++;
        }
    }
    
    for(int i=3; i<=100000; i++){
        c[i] += c[i-1];
    }
    
    cin >> Q;
    while(Q--){
        cin >> L >> R;
        printf("%d\n", c[R]-c[L-1]);
    }
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
string s;
int k;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>s;
for(int i=0;i<4;i++){
    if(s[i]==s[i+1])k++;
}
if(k>=1)cout<<"Bad";
else cout<<"Good";
return 0;}



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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvs vector < vs >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;

/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .

void solve ( int test_case )
{
    ld r ;
    cin >> r ;

    ld ans = 2 * pie * r ;
    pp ( ans ) ;
}

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

    for ( int i=1 ; i <= t ; i ++ ) solve ( i ) ;
    return 0;
}


Measured memory_bytes: 3804
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  string s;
  cin >> s;
  bool ac = false;
  for (int i = 0; i < s.size(); i++) {
    if (i + 1 < s.size() && s[i] == 'A' && s[i + 1] == 'C') {
      ac = true;
      break;
    }
  }
  string ans = (ac) ? "Yes" : "No";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a, b) << " " << max(0, a + b - n) << endl;
	return 0;
}



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

int main() {
  int w,h,x,y;
  cin >> w >> h >> x >> y;
  if ((w/2.0==x) && (h/2.0==y)) {
    cout << (double)w*h/2.0 << setprecision(10) << " " << 1 << endl;
  }
  else {
    cout << (double)w*h/2.0 << setprecision(10) << " " << 0 << endl;
  }   
}


Measured memory_bytes: 256
//#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#define MAX_INT 2100000000
using namespace std;
typedef long long int ll;
#ifdef COMPILE_IN_VCPP
#include <windows.h>
HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles.
	HWND hwndFound;         // This is what is returned to the caller.
	char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated// WindowTitle.
	char pszOldWindowTitle[MY_BUFSIZE]; // Contains original// WindowTitle.
	// Fetch current window title.
	GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
	// Format a "unique" NewWindowTitle.
	wsprintf(pszNewWindowTitle, "%d/%d",GetTickCount(),GetCurrentProcessId());
	// Change current window title.
	SetConsoleTitle(pszNewWindowTitle);
	// Ensure window title has been updated.
	Sleep(40);
	// Look for NewWindowTitle.
	hwndFound = FindWindow(NULL, pszNewWindowTitle);
	// Restore original window title.
	SetConsoleTitle(pszOldWindowTitle);
	return(hwndFound);
}
#endif
int main()
{
#ifdef COMPILE_IN_VCPP
	SetWindowPos(GetConsoleHwnd(), HWND_TOPMOST, 0, 0, 0, 0,
		(SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW));
#endif
	static int n, m, l[100000 + 10], r[100000 + 10],i,j,k,fr[100000+10],to[100000+10],rui[100000+10];
	int ans = 0;
	cin >> n >> m;
	for (i = 0; i < m; i++)
	{
		cin >> l[i] >> r[i];
		r[i]++;
		fr[l[i]]++;
		to[r[i]]++;
	}
	rui[0] = 0;
	for (i = 1; i <= 100000+5; i++)
	{
		rui[i] = rui[i - 1] + fr[i] - to[i];
		if (rui[i] == m) ans++;
	}
	cout << ans << endl;
}



Measured memory_bytes: 2176
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<queue>
#include<vector>
#define Max (int)1e3*2
#define MAX_INT (int)1e15+2
#define MOD 1000000007
using namespace std;

char s[Max][Max];
long long int dp[Max][Max];

void init(){
	int i,j;
	for(i=0;i<Max;i++){
		for(j=0;j<Max;j++){
			dp[i][j] = 0;
		}
	}

		dp[0][0] = 1;
}

void solve(int r,int c){
	long long int i,j,x,y;
	for(i=0;i<r;i++)
		for(j=0;j<c;j++){
			if(i == 0 && j == 0)
				continue;
			x = y = 0;
			if(i-1 >= 0 && s[i-1][j] != '#' && s[i][j] != '#')
				x = dp[i-1][j];
			if(j-1 >= 0 && s[i][j-1] != '#' && s[i][j] != '#')
				y = dp[i][j-1];

			dp[i][j] = (x%MOD+y%MOD)%MOD;
			//printf("%lld %lld %lld %lld %lld %d\n",i,j,dp[i][j],x,y,MOD);
		}
}


int main(){
	int r,c,i;
	init();
	scanf("%d%d",&r,&c);
	for(i=0;i<r;i++)
		scanf("%s",s[i]);

	solve(r,c);
	printf("%lld\n",dp[r-1][c-1]);
}










/*
Atcoder Dp G-Longest Path iterative solution

vector<int>vec[Max];
queue<int>q;

int dp[Max];
int vis[Max];

void init(){
	int i;
	for(i=0;i<Max;i++){
		dp[i] = 0;
		vis[i] = 0;
	}
}

int getMax(int a,int b){
	return (a<b)?b:a;
}

void solve(int x){
	int i,u;
	q.push(x);

	while(!q.empty()){
		u = q.front();
		q.pop();

		if(vis[u])
			continue;
		vis[u] = 1;
		
		for(i=0;i<vec[u].size();i++){
			dp[vec[u][i]] = getMax(dp[vec[u][i]],dp[u]+1);
			q.push(vec[u][i]);
		}
	}

}

int main(){
	int n,m,incoming[Max],x,y,i;
	for(i=0;i<Max;i++)
		incoming[i] = 0;
	
	init();

	scanf("%d%d",&n,&m);
	for(i=0;i<m;i++){
		scanf("%d%d",&x,&y);
		vec[y].push_back(x);
		incoming[x]++;
	}
	
	for(i=1;i<=n;i++)
		solve(i);
	
	int max = 0;
	for(i=0;i<Max;i++)
		max = getMax(max,dp[i]);
	
	printf("%d\n",max);
	return 0;
}
*/

Measured memory_bytes: 34944
extern crate core;

use std::io::{self, Read};

#[macro_use]
mod parser {
    macro_rules! input {
    ($s:expr=>$($t:tt)*) => {
        let mut lines=$s.split("\n");
        $(
            line_parse!(lines,$t);
        )*
    };
    }

    macro_rules! line_parse {
    ($lines:expr,($($name:ident:$t:tt)*)) => {
        let mut line=$lines.next().unwrap().split_whitespace();
        $(value_def!(line,$name,$t);)*
    };

    //複数行
    ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
        values_def!($lines,$n,$name,$t);
    };
    }

    macro_rules! value_def {
    ($line:expr,$name:ident,$t:tt) => {
        let $name=value!($line,$t);
    };
    }

    macro_rules! values_def {
    ($lines:expr,$n:expr,$name:ident,$t:tt) => {
        let $name={
        let mut vec=Vec::new();
        for i in 0..$n{
            let mut next=$lines.next().unwrap().split_whitespace();
            vec.push(value!(next,$t));
        }
        vec
        };
    };
    }

    macro_rules! value {
    //配列
    ($line:expr,[$t:tt]) => {
        $line.map(|x|{
        let mut iter=::std::iter::once(x);
        value!(iter,$t)
        }).collect::<Vec<_>>()
    };
    //タプル
    ($line:expr,($($t:tt),*)) => {
        ($(value!($line,$t),)*)
    };
    //文字列
    ($line:expr,#) => {
        $line.next().unwrap()
    };
    //単一値
    ($line:expr,$t:ty) => {
        $line.next().unwrap().parse::<$t>().unwrap()
    };
    }
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    (input.chars().filter(|&x| x == 'o').count() * 100 + 700).to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "oxo" => "900",
    test2: "ooo" => "1000",
    test3: "xxx" => "700",
}


Measured memory_bytes: 4352
#include <iostream>

using namespace std;

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

    int ds = 0;
    for (int i = n; i > 0; i /= 10) {
        ds += i % 10;
    }

    cout << (n % ds == 0 ? "Yes" : "No") << endl;

    return 0;
}

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

int main () {
  int N;
  cin >> N;
  
  vector<int> A(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  
  bool approved = true;
  
  for (int i : A) {
    if (i % 2 == 0) {
      if (i % 3 != 0 && i % 5 != 0) {
      	approved = false;
      	break;
      }
    }
  }
  
  if (approved) {
    cout << "APPROVED";
  } else {
    cout << "DENIED";
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    static int a = sc.nextInt();
    static int[] dp = new int[3];
    static int[] vac = new int[3];
    public static void main(String[] args) {
        dp[0] = 0;
        dp[1] = 0;
        dp[2] = 0;
        while (sc.hasNext()){
            vac[0] = sc.nextInt();
            vac[1] = sc.nextInt();
            vac[2] = sc.nextInt();
            int tempA = Math.max(dp[1] + vac[1], dp[2] + vac[2]);
            int tempB = Math.max(dp[0] + vac[0], dp[2] + vac[2]);
            int tempC = Math.max(dp[1] + vac[1], dp[0] + vac[0]);
            dp[0] = tempA;
            dp[1] = tempB;
            dp[2] = tempC;
        }
        System.out.println(Math.max(Math.max(dp[0], dp[1]), dp[2]));

    }
}


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

if H!=1 and W!=1:
    
    if W%2==0:
        A_W=int(W/2)
        B_W=int(W/2)
    
        if H%2==0:
            A_H=int(H/2)
            B_H=int(H/2)
        else:
            A_H=int(H/2)+1
            B_H=int(H/2)
        
        ans=A_W*A_H+B_W*B_H
    
    else:
        A_W=int(W/2)+1
        B_W=int(W/2)
    
        if H%2==0:
            A_H=int(H/2)
            B_H=int(H/2)
        else:
            A_H=int(H/2)+1
            B_H=int(H/2)
        
        ans=A_W*A_H+B_W*B_H

else:
    ans=1
    
print(int(ans))

Measured memory_bytes: 3064
#include<stdio.h>

int main(void) {

  int A = 0;
  int B = 0;
  int i = 2;
  int r = 0;

  scanf("%d %d", &A, &B);

  while(i--!=0) r += (A>=B)? A-- : B--;
  printf("%d", r);
  return 0;

}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n,m) for(int i=n;i<m;i++)
#define repn1(i,n,m) for(int i=n;i<=m;i++)
#define repm(i,n,m) for(int i=n;i>m;i--)
#define repm1(i,n,m) for(int i=n;i>=m;i--)
using namespace std;
typedef long long ll;
const int INF = 1e+8;

ll dp[2000][2000];
ll d[1000], c[1000];

int main(){
	int n, m, res;
	cin >> n >> m;
		
	rep(i,n) cin >> d[i];
	rep(i,m) cin >> c[i];
	repn1(i,0,n)
		repn1(j,0,m) dp[i][j] = 114514114514;
	dp[0][0] = 0;
	
	repn1(i,0,n){
		repn1(j,1,m){
			dp[i][j] = min(dp[i][j], dp[i][j-1]);
			if(i>0) dp[i][j] = min(dp[i][j-1], dp[i-1][j-1] + d[i-1] * c[j-1]);
		}
	}

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

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

int main() {
  int K, A, B;
  cin >> K >> A >> B;
  int tmp = B - B % K;
  if (tmp >= A && tmp <= B) {
    cout << "OK" << endl;
  } else {
    cout << "NG" << endl;
  }
}


Measured memory_bytes: 3636
// TOO DIFFICULT

// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define ll int
#define bits_count __builtin_popcountll
#define endl '\n'
#define double long double
#define ld double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
#define sz(x) (ll)x.size()
#define pr pair<int,int>
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAXN = 3005;
const int MOD = 1e9 + 7;
int dp[MAXN][MAXN];
int pre[MAXN][MAXN];
string s; int n;

void solve(){
    cin>>n>>s; s = '{' + s;

    FOR(i,1,n){
        dp[1][i] = 1; pre[1][i] = 1;
        pre[1][i] = (pre[1][i] + pre[1][i-1])%MOD;
    }

    FOR(i,2,n){
        FOR(j,1,n-i+1){
            if(s[i-1] == '<') dp[i][j] = pre[i-1][j];
            else dp[i][j] = (pre[i-1][n] - pre[i-1][j] + MOD)%MOD;
        }

        FOR(j,1,n){
            pre[i][j] = dp[i][j];
            pre[i][j] = (pre[i][j] + pre[i][j-1])%MOD;
        }
    }

    cout<<dp[n][1]<<endl;
}

signed main(){

   FastRead;    


    int t = 1; 
    // cin>>t; 
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}



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

using namespace std;

#define ll long long
#define ld long double
#define P pair<ll, ll>

#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

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

#define sortAl(v) sort(all(v))
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())

#define cout(n) cout << fixed << setprecision(n)

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; 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 INF LLONG_MAX

struct cell {
  int up;
  int down;
  int left;
  int right;
};

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

  ll h, w;
  cin >> h >> w;

  vector<string> m(h);

  rep(i, h) {
    cin >> m[i];
  }

  vector<vector<cell>> a(h, vector<cell>(w));

  rep(x, w) {
    REP(y, h) {
      if (m[y - 1][x] == '.') {
        a[y][x].up = a[y - 1][x].up + 1;
      } else {
        a[y][x].up = 0;
      }
    }
  }

  rep(y, h) {
    REP(x, w) {
      if (m[y][x - 1] == '.') {
        a[y][x].left = a[y][x - 1].left + 1;
      } else {
        a[y][x].left = 0;
      }
    }
  }

  for (int x = w - 1; x >= 0; x--) {
    for (int y = h - 2; y >= 0; y--) {
      if (m[y + 1][x] == '.') {
        a[y][x].down = a[y + 1][x].down + 1;
      } else {
        a[y][x].down = 0;
      }
    }
  }

  for (int y = h - 1; y >= 0; y--) {
    for (int x = w - 2; x >= 0; x--) {
      if (m[y][x + 1] == '.') {
        a[y][x].right = a[y][x + 1].right + 1;
      } else {
        a[y][x].right = 0;
      }
    }
  }

  int ans = 0;
  rep(y, h) {
    rep(x, w) {
      if (m[y][x] == '.') {
        chmax(ans, a[y][x].up + a[y][x].down + a[y][x].left + a[y][x].right + 1);
      }
    }
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n;

int main() {
    cin >> n;
    if (n % 10 == 9 || n / 10 == 9) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<complex>
#include<atcoder/all>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;

typedef pair<P, Int> T;



int main(){
    int n;
    cin >> n;
    vector<T> points(n);
    atcoder::dsu uf(n);
    
    for(int i = 0;i < n;i++){
        auto &p = points[i];
        cin >> p.first.first >> p.first.second;
        p.second = i;
    }
    sort(points.begin(), points.end());

    vector<P> stk;
    
    for(auto p:points){
        int x = p.first.first;
        int y = p.first.second;
        int ind = p.second;
        vector<P> smalls;
        while(!stk.empty() && stk.back().first < y){
            uf.merge(stk.back().second, ind);
            smalls.push_back(stk.back());
            stk.pop_back();
        }
        if(smalls.empty())stk.push_back(P(y, ind));
        else stk.push_back(smalls[0]);
    }

    for(int i = 0;i < n;i++){
        cout << uf.size(i) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 11276
#include<iostream>
#include<string>
#include<sstream>

int main() {
	std::string line;
	while (std::getline(std::cin, line)) {
		for (int i = 0; i < 26; i++) {
			if (line.find("the") != std::string::npos || line.find("this") != std::string::npos || line.find("that") != std::string::npos) break;
			for (std::string::iterator itr = line.begin(); itr != line.end(); itr++) {
				if (*itr >= 'a' && *itr <= 'z') {
					*itr = ((*itr - 'a' + 1) % 26) + 'a';
				}
			}
		}
		std::cout << line << std::endl;
	}
}

Measured memory_bytes: 3008
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a,k;
    int m[3];
    for(int i=0;i<3;i++){
        cin>>a;
        m[i]=a;
    }
    cin>>k;
    sort(m,m+3);
    while(k--){
        m[2]*=2;
    }
    int sum=0;
    for(int i=0;i<3;i++){
        sum=sum+m[i];
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
a[9999];main(n,i,j,m,s){for(;scanf("%d",&n),n;printf("%d\n",m)){for(i=0;i<n;i++)scanf("%d",a+i);for(m=-999999,i=0;i<n;i++)for(s=0,j=i;j<n;m=m>s?m:s,j++)s+=a[j];}exit(0);}

Measured memory_bytes: 612
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
    static int MOD = 1000000007;

    void solve() throws IOException {

    	int n = ni();

    	int[] a = nia(n);

    	int[] cnt = new int[n];

    	boolean fg = false;

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

    	if(n % 2 == 1){

    		for(int i=2; i<n/2; i+=2){
    			if(cnt[i] != 2){
    				fg = true;
    				break;
    			}
    		}
    		if(cnt[0] != 1){
    			fg = true;
    		}

    	}else{
    		for(int i=1; i<n/2; i+=2){
    			if(cnt[i] != 2){
    				fg = true;
    				break;
    			}
    		}
    	}


    	long ans;

    	if(fg == true){
    		ans = 0;
    	}else{
    		ans = 1;
			for(int i=0; i<n/2; i++){
				ans *= 2;
				ans %= MOD;
			}
    	}

    	out.println(ans % MOD);



    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 22908
#include "bits/stdc++.h"
#define _CRT_SECURE_NO_WARNINGS
#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define Pi pair<int,int>
#define IINF 1e9
#define LINF 1e18
#define vi vector<int>
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 0, 1,0,-1 };
int dy[] = { 1, 0,-1,0 };
int dx8[] = { -1,-1,-1,0,0,1,1,1 };
int dy8[] = { -1,0,1,-1,1,-1,0,1 };

unsigned long long sttoi(std::string str) {
	unsigned long long ret;
	std::stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

ull gcd(ull a, ull b) {
	if (b > a)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a%b);
}

int comb(int n, int k) {
	int ans = 1;
	for (int i = 0; i < min(k, n - k); i++) {
		ans *= n - i;
		ans /= i + 1;
	}
	return ans;
}

ll mod_pow(ll n, ll p, ll mod) {
	if (p == 0) return 1 % mod;
	if (p < 2) {
		return n % mod;
	}
	else {
		ll d = 2, value = (n%mod)*(n%mod) % mod;
		while (d * 2 < p) { d *= 2;	value *= value;	value %= mod; }
		value %= mod;
		return ((value%mod) * (mod_pow(n, p - d, mod) % mod)) % mod;
	}
}

bool isPrime(int n) {
	if (n <= 1)return false;
	if (n == 2)return true;
	if (n % 2 == 0)return false;
	for (int i = 3; i*i <= n; i += 2) {
		if (n%i == 0)return false;
	}
	return true;
}

void solve() {
	ll h, w, n;
	cin >> h >> w >> n;
	map<pair<int,int>,int> m;
	rep(i, n) {
		int x, y;
		cin >> y >> x;
		for (int j = -1; j <= 1; j++) {
			for (int k = -1; k <= 1; k++) {
				m[make_pair(x + j, y + k)]++;
			}
		}
	}
	ull ans[10] = { 0,0,0,0,0,0,0,0,0,0};
	ull count = 0;
	for (auto it = m.begin(); it != m.end(); it++) {
		int x = it->first.first, y = it->first.second;
		if (x >= 2 && x <= w - 1&& y >= 2 && y <= h-1) {
			count++;
			//cout << x << " " << y << " " << it->second << endl;
			ans[it->second]++;
		}
	}
	ull sum = 0;
	rep(i, 10) {
		sum += ans[i];
	}
	ans[0] = (h - 2)*(w - 2) - count;
	rep(i, 10) {
		P(ans[i]);
	}
}

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

Measured memory_bytes: 56448
#include <cassert>
#include "limits.h"
#include <limits>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " <<"LINE:"<<__LINE__<<"  "<< #i <<":"<< i << std::endl

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P = std::pair<long long,long long>;

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

  std::string s,t;
  std::cin>>s>>t;

  std::cout<<t<<s<<"\n";

  return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	A := make([]int, N)
	ans := make([]int, N)
	for i := 0; i < N-1; i++ {
		fmt.Scan(&A[i])
		ans[A[i]-1] += 1
	}

	for j := 0; j < N; j++ {
		fmt.Println(ans[j])
	}
}

Measured memory_bytes: 8544
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <vector>
#include <iomanip>
using namespace std;


int main(){
    // input
    int R; cin >> R;

    // compute
    int ans = 3 * R * R;

    // output
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back
#define T int t = 0; cin >> t; while(t--)
#define b_e(a) a.begin(), a.end()
typedef long long ll;
typedef  long double lld;
const ll mod = 1e9 + 7;
const ll mx = 1e5 + 1;

void input(){
    ll h; cin >> h;
    ll ans = 0;
    function<ll(ll)> solve = [&](ll x){
        if(x == 1LL)return 1LL;
        return 1LL + 2LL * solve(x / 2LL);
    };
    cout << solve(h) << endl;
}
int main(){
    input();
    return 0;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#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 pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,P> PP;

//-----------------------------------------------------------------------------

template< typename T >
T gcd(T a,T b) {
	return b ? gcd(b,a%b) : a;
}

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

template< typename T >
T extgcd(T a,T b,T &x,T &y) {
	T g=a;
	x=1,y=0;
	if(b) {
		g = extgcd(b,a%b,y,x);
		y -= (a/b)*x;
	}
	cout<<a<<' '<<b<<' '<<x<<' '<<y<<' '<<g<<endl;
	return g;
}

template< typename T >
T mod_inv(T a,T m) {
	T x,y;
	extgcd(a,m,x,y);
	return (m+ x%m)%m;
}

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

	ll a,b;
	while(cin>>a>>b) {
		cout<<gcd(a,b)<<' '<<lcm(a,b)<<endl;
	}

}



Measured memory_bytes: 3008
H,W = map(int,input().split())
S = ["."*(W+2)]+["."+input()+"." for h in range(H)]+["."*(W+2)]

for h in range(1,H-1):
  for w in range(1,W-1):
    if S[h][w]=="#" and S[h-1][w]=="." and S[h+1][w]=="." and S[h][w-1]=="." and S[h][w+1]==".":
      print("No")
      exit()
      
print("Yes")

Measured memory_bytes: 9072
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int main(){
#ifndef ONLINE_JUDGE
	//freopen("test.txt", "r", stdin);
	//freopen("result.txt", "w", stdout);
#endif
	string s;
	cin >> s;
	vector<int> c_index;
	vector<int> f_index;
	for (int i = 0; i < s.size(); ++i)
	{
		if (s[i] == 'C')
		{
			c_index.push_back(i);
		}
		else if (s[i] == 'F')
		{
			f_index.push_back(i);
		}
	}
	if (c_index.size() < 1 || f_index.size() < 1)
	{
		cout << "No" << endl;
		return 0;
	}
	if (c_index[0] < f_index[f_index.size() - 1])
	{
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
#ifndef ONLINE_JUDGE
	//fclose(stdin);
	//fclose(stdout);
	//system("result.txt");
#endif
}



Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include <cassert>
#include<set>
#include <numeric>
using namespace std;

typedef long long int ll;

int main(){
	int k;
	
	cin >> k;
	
	int res = 1;
	set<int> se;
	
	int amari = 7%k;
	int tmp = 7;
	while(amari != 0 && se.find(amari) == se.end()){
		//cout << amari <<endl;
		se.insert(amari);
		tmp = (tmp * 10) % k;
		amari = (tmp + amari) %k;
		res++;
	}
	
	if(amari == 0){
		cout << res <<endl;
	}else{
		cout << -1 <<endl;
	}
	
	return 0;
}


Measured memory_bytes: 49992
import java.util.*;
public class Main {
	private static Scanner sc;
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		int V = sc.nextInt();
		int E [][] = new int [V+1][V+1];
		for (int i=1; i<=V; i++){
			int a = sc.nextInt();
			int b = sc.nextInt();
			for (int k=0; k<b; k++){
				int c = sc.nextInt();
				E [a][c] = 1;
			}
		}
		Queue <Integer> Q = new ArrayDeque <Integer>();
		Q.add(1);
		int D [] = new int [V+1];
		Arrays.fill(D, -1);
		D [1] = 0;
		while (Q.size()>0){
			int current = Q.poll();
			for (int dst=1; dst<=V; dst++){
				if (E[current][dst]==1 & D[dst]==-1){
					D[dst]=D[current]+1;
					Q.add(dst);
				}			
			}			
		}
		for (int m=1; m<=V; m++){
			System.out.println(m+" "+D[m]);
		}
	}
}

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

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

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

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

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

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

void debug_out() { cerr << endl; }

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

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

void test_case() {
  long long a, b;
  cin >> a >> b;
  long long g = __gcd(a, b);
  set<long long> unq;
  for (int i = 2; 1LL * i * i <= g; ++i) {
    if (g % i == 0) {
      unq.insert(i);
      while (g % i == 0) {
        g /= i;
      }
    }
  }
  if (g != 1) {
    unq.insert(g);
  }
  cout << (unq.size() + 1) << "\n";
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  test_case();
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int N;
	scanf("%d",&N);
	int ans=0;
	if(N/1000==2){
		ans += 1;
	}
	N %= 1000;
	if(N/100==2){
		ans++;
	}
	N %= 100;
	if(N/10==2){
		ans++;
	}
	N %= 10;
	if(N==2){
		ans++;
	} 
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
    public static void main(String[]args) {
        FastScanner sc=new FastScanner();
        PrintWriter pw=new PrintWriter(System.out);
        int n=sc.nextInt();
        int[]ans=new int[n];
        for(int i=0;i<n;i++)ans[i]=0;
        for(int i=0;i<n-1;i++){
            ans[sc.nextInt()-1]++;
        }
        for(int i=0;i<n;i++){
            pw.println(ans[i]);
        }
        pw.flush();
    }
}

//高速入力コピペ
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 45772
X,N = map(int, input().split())
if N > 0: 
    P = list(map(int,input().split()))
    direction = -1
    i = 1
    if not X in P:
        print(X)
    else:
        while True:
            dist = i * direction
            val = dist+X
            if not (val in P):
                print(val)
                break
            if direction < 0: direction = 1
            else : 
                direction = -1
                i+=1
else: 
    print(X)

Measured memory_bytes: 9136
#include<iostream>
#include<string>
#define max(a,b) a>b?a:b
using namespace std;
int che(char a){
	char i;
	int j=0;
	for(i='0';i<='9';i++){
		if(a==i){
			return j;
		}
		j++;
	}
	return 0;
}
char cha(int a){
	char i;
	int j=0;
	for(i='0';i<='9';i++){
		if(j==a){
			return i;
		}
		j++;
	}
}
int main(){
	string a,b;
	int c=0;
	int i,j,k,m,n;
	int x,y;
	char d[200];
	cin>>n;
	for(k=0;k<n;k++){
		cin>>a>>b;
		x=a.size();
		y=b.size();
		m=max(x,y);
		for(i=1;i<=m;i++){
			j=che(a[x-i])+che(b[y-i])+c;
			if(j>=10){
				c=1;
				j-=10;
			}else{
				c=0;
			}
			d[i]=cha(j);
		}
		if(c==1){
			d[i]=cha(1);
			c=0;
			i++;
		}
		if(i>81){
			cout<<"overflow"<<endl;
			continue;
		}
		for(j=i-1;j>0;j--){
			cout<<d[j];
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1200
from operator import itemgetter
n = int(input())
p = [list(map(str, input().split())) for i in range(n)]
for i in range(n):
    p[i][1] = int(p[i][1])
    p[i].append(i+1)
pp = sorted(p, key=itemgetter(1), reverse=True)
ppp = sorted(pp, key=itemgetter(0))
for i in range(n):
    print(ppp[i][2])

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

#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll unsigned long long
#define endl "\n"

void solve()
{
	ll n,m,k,final=0;
	cin>>n>>m>>k;
	ll a[n],b[m];
	vector<ll> aa(n,0),bb(m,0);
	for(ll i=0;i<n;i++) 
	{
		cin>>a[i];
		if(i) aa[i]=aa[i-1]+a[i];
		else aa[i]=a[i];
	}
	for(ll i=0;i<m;i++)
	{
		cin>>b[i];
		if(i) bb[i]=bb[i-1]+b[i];
		else bb[i]=b[i];
	}
	
	for(ll i=0;i<n;i++)
	{
		ll temp=k-aa[i];
		if(temp>k) break;
		ll tt=lower_bound(bb.begin(),bb.end(),temp+1)-bb.begin();
		//cout<<i+1<<" "<<tt<<endl;
		final=max(final,i+1+tt);
	}
	ll tt=lower_bound(bb.begin(),bb.end(),k+1)-bb.begin();
	final=max(final,tt);
	tt=lower_bound(aa.begin(),aa.end(),k+1)-aa.begin();
	final=max(final,tt);
	cout<<final;
}

int main()
{
	FAST
	ll t=1;
	//cin>>t;
	for(ll i=0;i<t;i++) solve();
	return 0;
}

Measured memory_bytes: 9544
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


int main() {
    
    int n;
    cin>>n;
    vvi dp(n+10,vi(3,0));
    vvi a(n,vi(3));
    rep(i,n)cin>>a[i][0]>>a[i][1]>>a[i][2];
    dp[0][0]=0;
    dp[0][1]=0;
    dp[0][2]=0;
    rep(i,n){
        rep(j,3){
            rep(k,3){
                if(j==k)continue;
                chmax(dp[i+1][j],dp[i][k]+a[i][j]);
            }
        }
    }
    fin(max({dp[n][0],dp[n][1],dp[n][2]}));
}


Measured memory_bytes: 11136