akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <vector>
#include <algorithm>

#define MAXN 100000
#define LOGN 20

std::vector < int > g[MAXN + 1];
int ans, q[MAXN];
bool viz[MAXN + 1];
bool t[MAXN + 1][LOGN];
int h[LOGN];

inline void solve(int x) {
    for (int i = 0; i < LOGN; i++)
        h[i] = 0;
    for (auto &y : g[x])
        if (viz[y] == 0)
            for (int i = 0; i < LOGN; i++)
                h[i] += t[y][i];
    int r = 0;
    for (int i = 0; i < LOGN; i++)
        if (h[i] >= 2)
            r = i;
    while (h[r])
        r++;
    ans = std::max(ans, r);
    t[x][r] = 1;
    for (int i = r + 1; i < LOGN; i++)
        t[x][i] = h[i];
    viz[x] = 0;
}

int main() {
    int n;
    scanf("%d", &n);

    for (int i = 1; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);

        g[x].push_back(y);
        g[y].push_back(x);
    }

    int st = 0, dr = 1;
    q[0] = 1;
    viz[1] = 1;
    while (st < dr) {
        int x = q[st++];
        for (auto &y : g[x]) {
            if (viz[y] == 0) {
                viz[y] = 1;
                q[dr++] = y;
            }
        }
    }

    for (int i = n - 1; i >= 0; i--)
        solve(q[i]);

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 8704
import java.io.IOException;
import java.io.InputStream;
import java.util.LinkedList;
import java.util.NoSuchElementException;
import java.util.Queue;

public class Main {
	private static FastScanner sc = new FastScanner();

	public static void main(String[] args) {
		int n = sc.nextInt();
		int q = sc.nextInt();
		
		Queue<Process> que = new LinkedList<>();
		for(int i=0; i<n; i++) {
			String name = sc.next();
			int time = sc.nextInt();
			que.add(new Process(name, time));
		}
		
		int timer = 0;
		while(!que.isEmpty()) {
			Process p = que.poll();
			if(p.time > q) {
				p.time -= q;
				timer += q;
				que.add(p);
			} else {
				timer += p.time;
				System.out.println(p.name + " " + timer);
			}
		}
	}
	
	static class Process {
		String name;
		int time;
		Process(String name, int time){
			this.name = name;
			this.time = time;
		}
	}
	
	static 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 (IOException 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;}
	    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	    public boolean hasNext() { skipUnprintable(); 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() {
	        return Long.parseLong(next());
	    }
	    public int nextInt(){
	    	return Integer.parseInt(next());
	    }
	}

}

Measured memory_bytes: 57564
#include<bits/stdc++.h>                
using namespace std;
#define REP(i,n) for(auto i = 0; i < (n); ++i)
#define REP1(i,n) for(auto i = 0; i <= (n); ++i)
#define REPO(i,o,n) for(auto i = (o); i < (n); ++i)
#define REPR(i,n) for(auto i = (n); i >= 0; --i)
#define REPI(itr,v) for(auto itr=v.begin(); itr != v.end(); ++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin(); itr != v.rend(); ++itr)
#define ALL(v) v.begin(), v.end()
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}
#define push_back pb;
#define push_front pf; 
#define make_pair mp;
#define first fi;
#define second se;
typedef long long ll;
int N;
int main(void){
	cin >> N;			
	int odd[100005] = {};
	int even[100005] = {};
	int tmp;
	REP(i,N){
		cin >> tmp;
		if(i % 2 == 0) ++odd[tmp];
		else ++even[tmp];
	}

	int odd1, odd2, odd_idx;
	int even1, even2, even_idx;

	REP(i,100005){
		if(odd1 < odd[i]){
			odd2 = odd1;
			odd1 = odd[i];
			odd_idx = i;
		}else if(odd2 < odd[i]){
			odd2 = odd[i];
		}

		if(even1 < even[i]){
			even2 = even1;
			even1 = even[i];
			even_idx = i;
		}else if(even2 < even[i])
			even2 = even[i];
		}

		if(even_idx != odd_idx) cout << N - odd1 - even1 << endl; 
		else cout << min(N-odd1-even2, N-odd2-even1) << endl;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();
      
        // 5 7 5
        // 5 5 7
        // 7 5 5
      
        if (x == 5 && y == 7 && z == 5) {
            System.out.println("YES");
        } else if (x == 5 && y == 5 && z == 7) {
            System.out.println("YES");
        } else if (x == 7 && y == 5 && z == 5) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n,m;
  cin >> n >> m;
  vec a(m),b(m),c(m);
  for(ll i=0;i<m;i++) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--,b[i]--;
  }
  vec d(n,-inf);
  d[0]=0;
  for(ll i=0;i<m;i++) {
    for(ll j=0;j<m;j++) {
      d[b[j]]=max(d[b[j]],d[a[j]]+c[j]);
    }
  }
  ll ans=d[n-1];
  for(ll i=0;i<m;i++) {
    for(ll j=0;j<m;j++) {
      d[b[j]]=max(d[b[j]],d[a[j]]+c[j]);
    }
  }
  if(ans!=d[n-1]) {
    cout << "inf " << endl;
  }
  else {
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H, L, R;
long long int ans;

using namespace std;


int main() {
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	for (int i = 0; i<(int)s.size() - 2; i++) {
		if (s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2]) {
			cout << i + 1 << " " << i + 3 << endl;
			return 0;
		}
	}
	for (int i = 0; i < (int)s.size() - 1; i++) {
		if (s[i] == s[i + 1]) {
			cout << i + 1 << " " << i + 2 << endl;
			return 0;
		}
	}
	cout << "-1 -1\n";
	return 0;
}

Measured memory_bytes: 512
n = int(input())
seq = input().strip()
ans = 0
r = set()
g = set()
b = set()
for i in range(len(seq)):
    if seq[i] == 'R':
        r.add(i)
    elif seq[i] == 'G':
        g.add(i)
    else:
        b.add(i)

ans = len(r)*len(g)*len(b)
for i in r:
    for j in g:
        if (i+j) % 2 == 0 and ((i + j) //2) in b:
            ans -= 1
        if max(i,j) + (max(i,j) - min(i,j)) in b:
            ans -= 1
        if min(i,j) - (max(i,j) - min(i,j)) in b:
            ans -= 1
        
print(ans)

Measured memory_bytes: 69160
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> num = new ArrayList<Integer>();
		ArrayList<String> param = new ArrayList<String>();
		int system = 0; // 文字の空白区切り　0:ON　1:OFF

		while (sc.hasNext()) {
			if (sc.hasNextInt()) {
				num.add(sc.nextInt());
			} else {
				if(system==0) param.add(sc.next());
				if(system==1) param.add(sc.nextLine());
			}
		}
		Method(num, param);
	}

	static void Method(ArrayList<Integer> num, ArrayList<String> param) {
		
		int now = 1;
		int count = 0;
		
		while(true){
			now = num.get(now);
			count++;
			if(now == 2) break;
			if(count == num.size()){
				count = -1;
				break;
			}
		}
		
		System.out.println(count);
	}
}

Measured memory_bytes: 64244
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	int n,k;cin>>n>>k;
	bool check[n];
	memset(check,false,sizeof(check));
	for(int i=0;i<k;i++){
		int d;cin>>d;
		for(int i=0;i<d;i++){
			int a;cin>>a;
			check[a-1] = true;
		}
	}
	int count=0;
	for(int i=0;i<n;i++){
		if(check[i]==false){
			count++;
		}
	}
	cout<<count<<endl;
}

Measured memory_bytes: 3600
# E - Yutori


def find_workdays(
    total_days: int, workdays_length: int, days_off_length: int, schedule: list
) -> list:
    if days_off_length == 0:
        workdays = [i for i, can_work in enumerate(schedule, 1) if can_work]
        return workdays if len(workdays) <= workdays_length else []

    workdays_left, workdays_right = set(), set()

    cur_days_off = 0
    for i, can_work in enumerate(schedule, 1):
        if cur_days_off:
            cur_days_off -= 1
            continue
        if can_work:
            workdays_left.add(i)
            cur_days_off = days_off_length
            if len(workdays_left) == workdays_length:
                break

    cur_days_off = 0
    for i, can_work in enumerate(schedule[::-1]):
        if cur_days_off:
            cur_days_off -= 1
            continue
        if can_work:
            workdays_right.add(total_days - i)
            cur_days_off = days_off_length
            if len(workdays_right) == workdays_length:
                break

    return sorted(workdays_left & workdays_right)


def main():
    N, K, C = map(int, input().split())
    S = input().rstrip()
    workdays = find_workdays(N, K, C, [s == "o" for s in S])
    print("\n".join(map(str, workdays)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 25036
#include<iostream>
#include<algorithm>
int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int n;
	int avg=0;
	int s[100];
	while (true){
		std::cin >> n;
		if (n == 0) break;
		int q = n - 2;
		for (int i = 0; i < n; i++){
			std::cin >> s[i];
		}
		std::sort(s, s + n);
		for (int i = 1; i <= n-2; i++){
			avg += s[i];
		}
		std::cout << avg /q << "\n";
		avg = 0;
		for(int i = 0; i < n; i++){
			s[i]=0;
		}
	}
}

Measured memory_bytes: 1212
s = input()

res = 0
tmp = 0
for i in range(len(s)):
    if s[i] in 'ACGT':
        tmp += 1
    else:
        res = max(res, tmp)
        tmp = 0

    if i == len(s) - 1:
        res = max(res, tmp)

print(res)

Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>

using namespace std;

static const long MOD = 1000000007;
static const int R = 13;

void solve(string S) {
  int n = S.length();
  vector<vector<long long>> dp(100005, vector<long long>(R, 0));
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    int c;
    if (S[i] == '?') {
      c = -1;
    } else {
      c = S[i] - '0';
    }
    for (int j = 0; j < 10; j++) {
      if (c != -1 && c != j) {
        continue;
      }
      for (int k = 0; k < R; k++) {
        dp[i + 1][(k * 10 + j) % R] += dp[i][k];
      }
    }
    for (int k = 0; k < R; k++) {
      dp[i + 1][k] %= MOD;
    }
  }
  printf("%lld\n", dp[n][5]);
}

int main() {
  string S;
  cin >> S;
  solve(S);
  return 0;
}

Measured memory_bytes: 13760
n = int(input())
a = list(map(int,input().split()))
b=[0]*n
for i in range(n-1,-1,-1):
  b[i]=1 if sum(b[i+i+1:n:i+1])%2 != a[i] else 0
b=[i+1 for i in range(n) if b[i]==1]
m=len(b)
if m==0:
  print(0)
else:
  print(m)
  print(*b)    

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

int main(){
	int H,W;
	int i,j;

	while(1){
		
		cin >> H >> W;
		if(H==0 && W==0) break;

	    for(i=1;i<=H;i++){
			if(i==1 || i==H){
				for(j=1;j<=W;j++){
					cout << "#";
				}
			} else {
				cout << "#";
				for(j=2;j<=W-1;j++){
					cout <<".";
				}
				cout << "#";
			}

			cout << "\n";
		
		}

		cout << endl;

	}

	return 0;

}

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

bool tri(int a,int b, int c){
	if(c<a+b){
		return true;
	}
	else {
		return false;
	}
}	

int main() {
	int N;
	cin >>N ;
	vector <int> L(N);
	
	for (int i=0;i<N;i++){
		cin >>L.at(i);
	}
	sort(L.begin(),L.end());
	
	int count =0;
	
	for (int i=0;i<N-2;i++){
		for(int j=i+1;j<N-1;j++){
			for (int k=j+1;k<N;k++){
				if(L.at(i)+L.at(j)<=L.at(k)){
					break;
				}
				
				if(tri(L.at(i),L.at(j),L.at(k))){
					count++;
				}
			}
			
			
			
		}
	}
	
	cout << count <<endl;
}



Measured memory_bytes: 256
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::BTreeMap;

fn main() {
    input!(n: usize, k: usize, s: chars);

    // 連続する0の区間をk個選び、1の区間と合わせた長さのうちで最大のものが答え

    // 区間の長さを記録
    // 偶数番目が0区間の、奇数番目が1区間の長さという風に統一しておく
    let mut nums = vec![];
    if s[0] == '0' {
        nums.push(0);
    }
    let mut l = 0;
    while l < n {
        let mut r = l;
        while r < n && s[l] == s[r] {
            r += 1;
        }
        nums.push(r - l);
        l = r;
    }
    if s[n - 1] == '0' {
        nums.push(0);
    }

    let mut acc = vec![0usize; nums.len() + 1];
    for i in 0..nums.len() {
        acc[i + 1] = acc[i] + nums[i];
    }

    let mut ans = 0;
    let mut l = 0;
    while l < acc.len() {
        let mut r = l + 2 * k + 1;
        if r >= acc.len() {
            r = acc.len() - 1;
        }
        // 偶数番目から始まる連続する 2k+1 個（以下）の整数の和の最大値
        ans = max(ans, acc[r] - acc[l]);
        l += 2;
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
#include <chrono>
#include <cstdlib>
#include <bitset>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    int d[110];
    int a[110][110];
    for(int i = 0; i < k; i++){
        cin >> d[i];
        for(int j = 0; j < d[i]; j++){
            cin >> a[i][j];
        }
    }
    int sunuke[110] = {0};
    for(int i = 0; i < k; i++){
        for(int j = 0; j < d[i]; j++){
            sunuke[a[i][j]-1]++;
        }
    }

    int count = 0;
    for(int i = 0; i < n; i++){
        if(sunuke[i] == 0) count++;
        //cout << sunuke[i] << endl;
    }
    cout << count << endl;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
    
#define IOS cin.sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i, n) for (int i = 0; i < n; i++)
#define repn(i, a, b) for (int i = a;i<=b;i++)
#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define mem(x) memset(x, 0, sizeof(x))
#define ritr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define pai pair < int, int> 
#define pal pair < ll, ll> 
#define vi vector <int> 
#define vl vector < ll > 
#define vpai vector < pii > 

const ll mod = 1e9+7;
const int INF = INT_MAX;
const int sze = 55;

int n;


void identityMatrix(ll res[sze][sze]){
    rep(i,n) res[i][i]=1LL;
}

void multiply(ll res[sze][sze],ll m[sze][sze]){
    ll temp[sze][sze];
    mem(temp);
    rep(i,n) rep(j,n) rep(k,n) temp[i][j]=(temp[i][j]+(res[i][k]%mod*m[k][j]%mod)%mod)%mod;

    rep(i,n) rep(j,n) res[i][j]=temp[i][j];
}


void solve() {
    ll k;
    cin>>n>>k;
    ll mat[sze][sze];
    rep(i,n) rep(j,n) cin>>mat[i][j];

    ll res[sze][sze];
  	mem(res);
    identityMatrix(res);

    while(k){
        if(k&1)
        multiply(res,mat);
        multiply(mat,mat);
        k=k>>1;
    }

    ll total=0;
    rep(i,n) rep(j,n) total=(total+res[i][j])%mod;
    cout<<total<<endl;
}

int main() {
    IOS;

    int t = 1;
    //cin >> t;
    while (t--) {
       solve();
    }

  return 0;
}

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

int main() {
  string n;
  cin >> n;
  if((n[0] == n[1] && n[1] == n[2]) || (n[1] == n[2] && n[2] == n[3])) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <ctime>
#include <vector>
#include <stack>

#define rep(i,x) for(int i=0;i<x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rep_to(a,i,x) for(int i=a;i<x;i++)

using namespace std;

int main()
{
	int n,r;

	while(cin>>n>>r && n && r)
	{
		int card[100000]={};
		for(int i=n,j=1;i>=1;i--,j++)card[j]=i;
		rep(i,r)
		{
			int p,c;
			cin>>p>>c;
			for(int j=p;j>1;j--)
			{
				//cout<<j<<endl;
				for(int k=j;k<c+j;k++)
				{
					swap(card[k],card[k-1]);
					/*
					cout<<"swap:"<<k<<" "<<k-1<<endl;
					rep_to(1,l,n+1)cout<<card[l]<<" ";
					cout<<endl;
					*/
				}
			}
		}
		cout<<card[1]<<endl;
	}
	return 0;
}

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

int main(void){
  int w,h,n;
  cin>>w>>h>>n;
  int res = 0;
  int x,y;
  cin>>x>>y;
  int ox = x, oy = y;
  n--;
  while(n--){
    cin>>x>>y;
    int dx = x - ox; ox = x;
    int dy = y - oy; oy = y;
    if(dy*dx > 0){
      
    dx = (dx>0?dx:dx*-1);
    dy = (dy>0?dy:dy*-1);
      res += max(dx,dy);
      //cout<<min(dx,dy)<<endl;
    }else{
      
    dx = (dx>0?dx:-dx);
    dy = (dy>0?dy:-dy);
      res += dx + dy;
      //cout<<x<<" "<<y<<" "<<dx+dy<<endl;
    }
    // cout<<dx<<" "<<dy<<" "<<res<<endl;
  }
  cout<<res<<endl;
}

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

ll f(int a, int b) {
    return pow(a, 5) - pow(b, 5);
}



int main() {
    ll x;
    cin >> x;

    for (int i = 1; ; i++) {
        for (int a = -118; a <= 119; a++) {
            int b = a - i;
            if (f(a, b) == x) {
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 4084
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

n = readint()
a = readints()


ans = 0
for i in range(1,n+1):
    if i%2==1 and a[i-1]%2==1:
        ans += 1
print(ans)





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

	//C
	long long int p[1000];
	int i, j;
	for (i = 2; i < 1000; i++) {
		p[i] = 0;
		for (j = 2; j < i; j++) {
			if (i % j == 0)p[i] = -1;
		}
	}
	int n;
	cin >> n;
	long long int x;
	for (i = 2; i <= n; i++) {
		x = i;
		j = 2;
		while (j <= x) {
			if ((x % j == 0) && (p[j] > -1)) {
				//cout << j << endl;
				x = x / j;
				p[j]++;
				j--;
			}
			j++;
		}
	}
	long long int mod = 1000000007;
	long long int sum = 1;
	for (i = 0; i < 1000; i++) {
		if (p[i] > -1) {
			//cout << i << ' ' << p[i] << endl;
			sum = (sum * (p[i] + 1)) % mod;
		}
	}
	cout << sum << endl;
	return 0;

}

Measured memory_bytes: 3648
#include <stdio.h>
int main(){
	char a[3],b[3];
	scanf("%s",&a);
	scanf("%s",&b);
	if (a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0])
	{
		printf("YES\n");
	}else{
		printf("NO\n");
	}
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int K = scan.nextInt();
    	int S = scan.nextInt();
        int a;
    	int b;
        int cnt = 0;

        for (a = 0; a <= K; a++) {
            int qw = K;
            if (S - a < qw) {
            	qw = S-a;
            	}for (b = 0; b <= qw; b++) {
                if (S - a - b <= K) cnt++;
            }
        }

        System.out.println(cnt);
    }
}


Measured memory_bytes: 21712
#include<bits/stdc++.h>
using namespace std;
#define iso ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define clr(x) memset((x), 0, sizeof(x))
#define mod 998244353
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll ,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_tree;*/


ll arr[100005][3],ans[100005][3];

int main()
{
    iso;
    int i,n,j;
    cin>>n;
    for(i=0;i<n;i++)
        for(j=0;j<3;j++)
            cin>>arr[i][j];
    ans[0][0]=arr[0][0];
    ans[0][1]=arr[0][1];
    ans[0][2]=arr[0][2];

    for(i=1;i<n;i++)
    {
        ans[i][0]=arr[i][0]+max(ans[i-1][1],ans[i-1][2]);
        ans[i][1]=arr[i][1]+max(ans[i-1][0],ans[i-1][2]);
        ans[i][2]=arr[i][2]+max(ans[i-1][0],ans[i-1][1]);

    }
    cout<<max(ans[n-1][0],max(ans[n-1][1],ans[n-1][2]));

    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;
#define y0 y0_kasdjf
const int MAXN = 300000;
const ll INF = 1e18;

ll cl[MAXN];
vector<pair<int, ll> > eds[MAXN];
int was[MAXN];
int n, m, k;
int x0, y0;
ll a0;
ll mnx, mny;

void dfs1(int v, ll c) {
	cl[v] = c;
	was[v] = 1;
	if (v < n)
		mnx = min(mnx, c);
	else
		mny = min(mny, c);
	for (auto e: eds[v]) {
		int u = e.first;
		ll s = e.second;
		if (!was[u])
			dfs1(u, s - c);
		else if (cl[v] + cl[u] != s) {
			cout << "No\n";
			exit(0);
		}
	}
}

int main() {
	cin >> n >> m;
	cin >> k;
	cin >> x0 >> y0 >> a0;
	--x0, --y0;
	eds[x0].push_back(make_pair(y0 + n, 2 * a0));
	eds[y0 + n].push_back(make_pair(x0, 2 * a0));
	for (int i = 1; i < k; ++i) {
		int x, y;
		ll a;
		cin >> x >> y >> a;
		--x, --y;
		a += a0;
		eds[x].push_back(make_pair(y + n, a));
		eds[y + n].push_back(make_pair(x, a));
	}
	mnx = INF;
	mny = INF;
	dfs1(x0, a0);
	if (mnx + mny < a0) {
		cout << "No\n";
		return 0;
	}
	for (int i = 0; i < n + m; ++i) {
		if (was[i])
			continue;
		mnx = INF;
		mny = INF;
			dfs1(i, 0);
		if (mnx + mny < a0) {
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";

	return 0;
}




Measured memory_bytes: 19584
s = list(input().split())
maxLen = 0
maxNum = 0
dic = {}
for word in s:
    if not (word in dic):
        dic[word] = 1
    else:
        dic[word] += 1
    if maxNum < dic[word]:
        maxNum = dic[word]
        ansNum = word
    if maxLen < len(word):
        maxLen = len(word)
        ansLen = word
print(ansNum, ansLen)

Measured memory_bytes: 7360
#include<stdio.h>

int main(void)
{	
	int i;
	int y = 700;
	char c;

	for(i=0;i<3;i++)
	{
		scanf("%c", &c);
		if(c == 'o') y+=100;
	}

	printf("%d\n", y);
	return 0;
}

Measured memory_bytes: 128
N,A,B=map(int,input().split())

d=B-A

if d%2==0:
    print(d//2)
else:
    if A==1 or B==N:
        print(min(1+(d-1)//2,B-1,N-A))
    else:
        print(min((A+B-1)//2,(2*N-A-B+1)//2,B-1,N-A))

Measured memory_bytes: 3060
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
                int sa = b - a;
                int takasa = 0;
                for(int i=1; i<=sa; i++){
                  takasa += i ;
                }
		// 出力
		System.out.println( takasa - b );
	}
}

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

struct node {
    int key;
    struct node *left, *right;
    node(int k):key(k),left(NULL),right(NULL){}
};

class bintree {
    node *root;
    bool first;
    void inorder(node *t) {
        if(t) {
            inorder(t->left);
            cout<<' '<<t->key;
            inorder(t->right);
        }
    }
    void preorder(node *t) {
        if(t) {
            cout<<' '<<t->key;
            preorder(t->left);
            preorder(t->right);
        }
    }
    public:
    bintree():root(NULL){}
    void insert(int k)
    {
        node *n = new node(k);
        node *y=NULL;
        node *x=root;
        while(x!=NULL) {
            y=x;
            if(k<x->key) x=x->left;
            else x=x->right;
        }
        if(y==NULL) {
            root=n;
        } else {
            if(k<y->key) y->left=n;
            else y->right=n;
        }
    }
    bool find(int k) {
        node *n=root;
        while(n) {
            if(n->key==k) return true;
            if(k<n->key) n=n->left;
            else n=n->right;
        }
        return false;
    }
    void inorder(){
        inorder(root);
        cout<<'\n';
    }
    void preorder(){
        preorder(root);
        cout<<'\n';
    }
};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    bintree t;
    int n;
    string com;
    int key;
    cin>>n;
    for(int i=0; i<n; i++) {
        cin>>com;
        switch(com[0]) {
        case 'i':
            cin>>key;
            t.insert(key);
            break;
        case 'f':
            cin>>key;
            if(t.find(key)) cout<<"yes\n";
            else cout<<"no\n";
            break;
        case 'p':
            t.inorder();
            t.preorder();
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 13720
#include <bits/stdc++.h>
#include <iostream>
#include <vector>

int main() {
    int N, d;
    std::cin >> N;
    // std::vector<int> mochi(N);
    std::set<int> mochi;

    for (int i{0}; i < N; i++) {
        std::cin >> d;
        mochi.insert(d);
    }
    
    // std::sort(mochi.begin(), mochi.end());
    // mochi.erase(std::unique(mochi.begin(), mochi.end()), mochi.end());
    //


    std::cout << mochi.size();

}


Measured memory_bytes: 256
n,a,b = gets.split.map &:to_i
s = gets.chomp

x = 0 # 予選を通過した人数
y = 0 # 予選を通過した海外の学生の人数

n.times do |i|
  case s[i]
  when 'c'
    puts "No"
  when 'a' # 国内の学生
    if x < a + b
      puts "Yes"
      x += 1
    else
      puts "No"
    end
  when 'b' # 海外の学生
    if x < a + b && y < b
      puts "Yes"
      x += 1
      y += 1
    else
      puts "No"
    end
  end
end


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

vector<int> e[100010];
int c[100010];
int used[100010];
map<pair<int, int>, bool> mm;
void dfs(int curr, int prev) {
    used[curr] = 1;
    for (auto &to: e[curr]) {
        if (used[to]) continue;
        mm[{curr, to}] = 1;
        c[curr]++;
    }
    for (auto &to: e[curr]) {
        if (used[to]) continue;
        dfs(to, curr);
        while (c[to] % 2) {
            mm[{curr, to}] = 0;
            c[to]--;
            mm[{to, curr}] = 1;
            c[curr]++;
        }
    }
    return;
}

int main() {
    int n, m; cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        a--, b--;
        e[a].emplace_back(b); e[b].emplace_back(a);
    }
    dfs(0, -1);
    if (c[0] % 2) cout << -1 << endl;
    else {
        int cnt = 0;
        for (auto &ans: mm) {
            if (ans.second) {
                cnt++;
                cout << ans.first.first+1 << " " << ans.first.second+1 << endl;
            }
        }
        assert(cnt == m);
    }
    return 0;
}

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

int main() {
  string S, T;
  cin >> S >> T;
  
  for (int i = 0; i < S.size(); i=i+1) {
    if (S[i] != T[i]) {
      cout<< "No";
      return 0;
    }
  }
  
  cout << "Yes";
	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    string s; cin >> s;
    int left = 0, right = 0;
    REP(i,n) {
        if(s[i]=='(') ++right;
        else {
            if(right==0) ++left;
            else --right;
        }
    }
    string ans = "";
    while(left>0) {
        ans += '(';
        -- left;
    }
    ans += s;
    while(right>0) {
        ans += ')';
        -- right;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//A - Poor

//AtCoder Beginners Selection
//ABC049C - ç™½æ˜¼å¤¢

#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int a, b, c;

    cin >> a >> b >> c;

    if (a == b) {
        if (b != c) {
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else if (a == c){
        if (c != b) {
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        if (b == c) {
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
/* Precode Start Here *\
     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}
/* Precode Ends */
#define mod 1000000007
ll A[5000001],vis[5000001];
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
priority_queue<ll> pq;
priority_queue<ll, vector<ll>, std::greater<ll> > first;
ll po(ll a,ll n)
{
    ll ans=1;
    for(int i=1; i<=n; i++)
        ans*=a;
    return ans;
}

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

    for(int i=1; i<=100; i++)
    {
        for(int j=1; j<=100; j++)
        {
            for(int k=1; k<=100; k++)
            {
                ll d=(i+j+k)*(i+j+k)-i*j-j*k-i*k;
                myMap[d]++;
            }
        }
    }
    ll n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {

        cout<<myMap[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 6112
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int INF=INT_MAX,MOD=1e9+7;

int main(){
	//初期化
    int dz[13]={0,0,0,0,1,1,1,1,1,1,1,1,1};
    int dy[13]={1,1,0,-1,1,1,0,-1,-1,-1,0,1,0};
	int dx[13]={0,1,1,1,0,1,1,1,0,-1,-1,-1,0};
    int n,m,p;
	while(cin>>n>>m>>p&&n){
		//ballの座標と色
		int ball[n][n][n]; rep(i,n)rep(j,n)rep(k,n) ball[i][j][k]=0;
		//答え
		int ansCnt=0;
		//見つかっているかどうか
		bool flg=0;

		for(int cnt=1;cnt<=p;cnt++){
			int x,y,z; cin>>x>>y; x--; y--;
			if(!flg){
				rep(i,n){
					if(!ball[x][y][i]){
						//black=10,white=100
						z=i;
						cnt%2?ball[x][y][i]=10:ball[x][y][i]=100;
						break;
					}
				}
				rep(i,13){
					int num=1,mul=0;
					//片方を延伸
					while(1){
						mul++;
						int cx=x+dx[i]*mul,cy=y+dy[i]*mul,cz=z+dz[i]*mul;
						if(0<=cx&&cx<n&&0<=cy&&cy<n&&0<=cz&&cz<n){
							if(ball[x][y][z]==ball[cx][cy][cz]) num++;
							else break;
						}
						else break;
					}
					//反対方向も
					mul=0;
					while(1){
						mul--;
						int cx=x+dx[i]*mul,cy=y+dy[i]*mul,cz=z+dz[i]*mul;
						if(0<=cx&&cx<n&&0<=cy&&cy<n&&0<=cz&&cz<n){
							if(ball[x][y][z]==ball[cx][cy][cz]) num++;
							else break;
						}
						else break;
					}
					if(num>=m){
						ansCnt=cnt;
						flg=1;
					}
				}
			}
		}
		if(!ansCnt) cout<<"Draw"<<endl;
		else{
			string ansColor;
			ansColor=ansCnt%2?"Black":"White";
			cout<<ansColor<<" "<<ansCnt<<endl;
		}
	}
	return 0;
}



Measured memory_bytes: 3144
x, y = map(int, input().split())
sum = 0
if x == 1 and y == 1:
    sum += 400000
if x == 1:
    sum += 300000
elif x == 2:
    sum += 200000
elif x == 3:
    sum += 100000
if y == 1:
    sum += 300000
elif y == 2:
    sum += 200000
elif y == 3:
    sum += 100000

print(sum)

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define MOD 1e9+7
#define sp ' '


using ll = long long;


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

template<typename T>
void ppp(T n){cout << n << endl;}

template<typename T>
map<T, T> factorization(T n){

    map<T, T> factor;
    while (n % 2 == 0){
        ++factor[2];
        n /= 2;
    }

    for (T i = 3; i*i <= n; i += 2){
        while (n%i == 0){
            ++factor[i];
            n /= i;
        }
    }

    if (n > 2)
        ++factor[n];

    return factor;
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, p;
    cin >> n >> p;
    map<ll, ll> mp = factorization(p);
    if(n >= 40){
        ppp(1);
        return 0;
    }
    if(n == 1){
        ppp(p);
        return 0;
    }
    ll ans = 1LL;
    for(auto m : mp){
        if(m.second >= n)
            ans *= pow(m.first,(m.second/n));
    }
    ppp(ans);
    return 0;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Ma = sc.nextInt();
		int Mb = sc.nextInt();
		int[] a = new int[N];
		int[] b = new int[N];
		int[] c = new int[N];
		for(int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}
		sc.close();
		int n = 401;

		int[][][] dp = new int[N + 1][n][n];
		int INF = 100000000;
		for(int i = 0; i <= N; i++) {
			for(int j = 0; j < n; j++) {
				for(int k = 0; k < n; k++) {
					dp[i][j][k] = INF;
				}
			}
		}
		dp[0][0][0] = 0;
		for(int i = 0; i < N; i++) {
			for(int j = 0; j < n; j++) {
				for(int k = 0; k < n; k++) {
					if(dp[i][j][k] != INF) {
						int A = j + a[i];
						int B = k + b[i];
						dp[i + 1][j][k] = Math.min(dp[i + 1][j][k], dp[i][j][k]);
						dp[i + 1][A][B] = Math.min(dp[i + 1][A][B], dp[i][j][k] + c[i]);
					}
				}
			}
		}
		int min = INF;
		for(int j = 1; j < n; j++) {
			for(int k = 1; k < n; k++) {
				if(Ma * k == Mb * j) {
					min = Math.min(min, dp[N][j][k]);
				}
			}
		}
//		for(int j = 1; j < 11; j++) {
//			for(int k = 1; k < 11; k++) {
//				if(dp[N][j][k] != INF) {
//					System.out.print(dp[N][j][k] + " ");
//				}else {
//					System.out.print("0 ");
//				}
//			}
//			System.out.println();
//		}
		if(min == INF) min = -1;
		System.out.println(min);
	}
}

Measured memory_bytes: 54196
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){
  int n,k;
  cin>>n>>k;
  ull ans=k;  
  rep(i,1,n){
    ans*=k-1;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
// J'aime
// Chemise Blanche

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  int r; cin >> r;
  cout << 3 * r * r << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3624
#include<iostream>
using namespace std;
using ll = long long;

int main(){
  ll a;
  double b;
  cin >> a >> b;
  ll ib;
  ib = b*100+0.5;
  ll ans;
  ans = (a*ib/100);
  cout<< ans << endl;
  
  return 0;
}

Measured memory_bytes: 3136
#include<cstdio>
#include<cstring>
#include<cmath>

char s[4];

int main(void)
{
	int x,sx;
	scanf("%s",s); scanf("%s",s+strlen(s));
	sscanf(s,"%d",&x);
	sx=sqrt(x);
	printf(sx*sx==x?"Yes":"No");
	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<vector>
#define FAST ios::sync_with_stdio(false)
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int mod = (int)1e9 + 7;
const int maxn = (int)1e5 + 5;
using namespace std;

int connect[maxn], p[maxn];

int topreturn(int n){
	while(connect[n] != n) n = connect[n];
	return n;
}

int main(void){
	int n, m; scanf("%d %d", &n, &m);
	for(int i = 0; i < n; i++){
		scanf("%d", &p[i]);
		connect[i] = i;
	}
	for(int i = 0; i < m; i++){
		int x, y;
		scanf("%d %d", &x, &y);
		x = topreturn(x-1);
		y = topreturn(y-1);
		if(x > y) swap(x, y);
		connect[y] = connect[x];
	}
	int ans = 0;
	for(int i = 0; i < n; i++)
		if(topreturn(i) == topreturn(p[i] - 1)) ans++;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

using namespace std;
using namespace __gnu_pbds;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> order_set;
const int MAXN = 123456;
LL step[MAXN], num[MAXN];

int main() {
    LL N, X, M;
    scanf("%lld %lld %lld", &N, &X, &M);
    LL cur = X, idx = 1;
    while (1) {
        if (step[cur]) break;
        step[cur] = idx;
        num[idx] = cur;
        cur = (cur * cur) % M;
        idx++;
    }
    LL offs = 0, cylen = idx - step[cur];
    for (int i = step[cur]; i < idx; i++) offs += num[i];
    LL ans = 0;
    for (LL i = 1; i <= min(N, step[cur] - 1); i++)
        ans += num[i];
    N -= min(N, step[cur] - 1);
    ans += offs * (N / (cylen));
    for (LL i = 0; i < (N % cylen); i++)
        ans += num[i + step[cur]];
    printf("%lld\n", ans);


    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
by Benq;
*/


Measured memory_bytes: 4788
#include<stdio.h>
int print( char x[], int a, int b ){

  int i;
  
  for ( i = a ; i <= b ; i++ ){
    printf("%c", x[i]);
  }

  printf("\n");

  return 0;
  
}

int reverse( char x[], int a, int b ){

  char y[1001];
  int i;

  for ( i = a ; i <= b ; i++ ){
    y[i] = x[i];
  }

  for ( i = a ; i <= b ; i++ ){
    x[i] = y[ a + b - i ];
  }

  return 0;
  
}

int replace( char x[], int a, int b, char y[] ){

  int i;

  for ( i = a ; i <= b ; i++ ){
    x[i] = y[ i - a ];
  }

  return 0;

}

int operate( char x[] ){

  char print[10] = "print";
  char reverse[10] = "reverse";
  char replace[10] = "replace";

  int i;

  for ( i = 0 ; i <= 5 ; i++ ){
    if ( i == 5 ) return 1;
    if ( x[i] != print[i] ) break;
  }

  for ( i = 0 ; i <= 7 ; i++ ){
    if ( i == 7 ) return 2;
    if ( x[i] != reverse[i] ) break;
  }

  for ( i = 0 ; i <= 7 ; i++ ){
    if ( i == 7 ) return 3;
    if ( x[i] != replace[i] ) break;
  }

  return 0;

}

int main(){

  char str[1001],op[10];
  scanf("%s", str );
  
  int q;
  scanf("%d", &q );

  int a,b,i,result;
  char p[1001];
  
  for ( i = 0 ; i < q ; i++ ){
    scanf("%s", op );
    result = operate( op );

    if ( result == 1 ) {
      scanf("%d %d", &a, &b);
      print( str, a, b );
    } else if ( result == 2 ) {
      scanf("%d %d", &a, &b);
      reverse( str, a, b );
    } else if ( result == 3 ) {
      scanf("%d %d", &a, &b);
      scanf("%s", p);
      replace( str, a, b, p );
    }
  }

  return 0;

}

Measured memory_bytes: 576
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <math.h>
//#include <algorithm>

static long st_count( long count[100], long mm, long k )
{
	long iCount = 0;
	long i;
	for(i=2; i<=100; i++) {
		if( count[i] >= mm ) {
			iCount ++;
		}
	}
	iCount = iCount - k;
	if (iCount > 0 ) {
		return iCount;
	}
    
	return 0;
}

int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);
 
	long a[101]={0};
	long divided[101]={0};
	long count[101]={0};
	long i, j;
	for(i=1; i<=n; i++) {
		a[i] = i;
	}

	for(i=2; i<=n; i++) {
		if(divided[i]) {
			continue;
		}

		long  m = 1;
		while( 1 ) {
			m = m * i;
			if(m > n) {
				break;
			}

			for(j=m; j<=n; j=j+m) {
				a[j] /= i;
				divided[j] = 1;
				count[i] ++;
			}
		}
	}

	long num = st_count( count, 4, 0 ) * st_count( count, 4, 1 ) * st_count( count, 2, 2 ) / 2
		     + st_count( count, 24, 0 ) * st_count( count, 2, 1 )
			 + st_count( count, 14, 0 ) * st_count( count, 4, 1 )
			 + st_count( count, 74, 0 );

	printf("%d\n", num);

 
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int mod=998244353;
#define N 23
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
#define ck(x) (x>=mod?(x)-mod:x)
int n,m,f[N][N][3],g[N][N][3],ans,c[N],r[N],cnt[1<<10];
int pw2[N],C[N][N];
char mp[N][N];
int qpow(int a,int b){
	int ans=1;
	while(b){
		if(b&1)ans=1LL*ans*a%mod;
		a=1LL*a*a%mod;
		b>>=1;
	}
	return ans;
}
int Inv(int x){
	return qpow(x,mod-2);
}
void init(int n){
	pw2[0]=C[0][0]=1;
	for(int i=1;i<=n;++i){
		pw2[i]=ck(pw2[i-1]<<1);
		C[i][0]=1;
		for(int j=1;j<=i;++j){
			C[i][j]=ck(C[i-1][j-1]+C[i-1][j]);
		}
	}
	for(int i=1;i<(1<<n);++i){
		cnt[i]=cnt[i>>1]+(i&1);
	}
}
int Solve(int x,int y){
	for(int i=1;i<=n;++i){
		if((x>>i-1)&1){
			if((r[i]&y)==0||(r[i]&y)==y)return 0;
		}
	}
	for(int j=1;j<=m;++j){
		if((y>>j-1)&1){
			if((c[j]&x)==0||(c[j]&x)==x)return 0;
		}
	}
	return 1LL*ck(f[cnt[x]][cnt[y]][0]+g[cnt[x]][cnt[y]][0])*Inv(C[n][cnt[x]])%mod*Inv(C[m][cnt[y]])%mod;
}
int main(){
	n=read(),m=read();
	for(int i=1;i<=n;++i){
		scanf("%s",mp[i]+1);
		for(int j=1;j<=m;++j){
			r[i]|=((mp[i][j]=='#')<<j-1);
			c[j]|=((mp[i][j]=='#')<<i-1);
		}
	}
	init(max(n,m));
	for(int j=1;j<=m;++j){
		g[n][j][2]=1LL*C[m][j]*pw2[m-j]%mod;
	}
	ans+=pw2[m];
	for(int i=n;i>=1;--i){
		for(int j=m;j>=1;--j){
			for(int k=1;k<i;++k){
				int t=i-k;
				f[k][j][1]=(f[k][j][1]+(2LL*g[i][j][2]+g[i][j][1])*C[i][t])%mod;
				f[k][j][2]=(f[k][j][2]+1LL*g[i][j][2]*(pw2[t]-2)%mod*C[i][t])%mod;
			}
			for(int k=1;k<j;++k){
				int t=j-k;
				g[i][k][1]=(g[i][k][1]+(2LL*f[i][j][2]+f[i][j][1])*C[j][t])%mod;
				g[i][k][2]=(g[i][k][2]+1LL*f[i][j][2]*(pw2[t]-2)%mod*C[j][t])%mod;
			}
			f[i][j][0]=ck(f[i][j][1]+f[i][j][2]);
			g[i][j][0]=ck(g[i][j][1]+g[i][j][2]);
			ans=(ans+1LL*f[i][j][2]*(pw2[j]-2)+1LL*g[i][j][2]*(pw2[i]-2))%mod;
		}
	}
	for(int i=1;i<(1<<n);++i){
		for(int j=1;j<(1<<m);++j){
			ans=(ans+Solve(i,j))%mod;
		}
	}
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 3816