akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new ABC123().SolveA(new ConsoleInput(Console.In, ' '));
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }

    public static class AtCoderLib
    {
        // ユークリッドの互除法 
        public static int Gcd(int a, int b)
        {
            if (a < b)
                // 引数を入替えて自分を呼び出す
                return Gcd(b, a);
            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }
    }
  class ABC123
    {
        public void SolveA(ConsoleInput cin)
        {
            var a = cin.ReadInt;
            var b = cin.ReadInt;
            var c = cin.ReadInt;
            var d = cin.ReadInt;
            var e = cin.ReadInt;
            var k = cin.ReadInt;
            if (e - a <= k) WriteLine("Yay!");
            else WriteLine(":(");
            ReadLine();
        }
    }
}


Measured memory_bytes: 11220
from collections import deque

m=int(input())
def fa(n):
    arr =deque([])
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

x=0
count=0
for i,j in fa(m):
    # print(i,j)
    for k in range(10**12):
        if j<k*(k+1)//2:
            x=k-1
            break
        elif j==k*(k+1)//2:
            x=k
            break
    count+=x


print(count)


Measured memory_bytes: 66392
from string import ascii_lowercase

d = {i: 0 for i in ascii_lowercase}

while True:
    try:
        s = input()
    except:
        break

    for i in s.lower():
        if i in ascii_lowercase:
            if i in d.keys():
                d[i] += 1

for k, v in d.items():
    print('{} : {}'.format(k, v))


Measured memory_bytes: 6684
import java.util.*;
public class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N= sc.nextInt();
		String s=sc.next();
		int[] check=new int[N+2];
		int j=N+1;
		//最初が羊羊と仮定
		check[0]=1;
		check[1]=1;
		for(int i=2;i<N+1;i++){
			if(s.charAt(i-1)=='o'){
				check[i]=check[i-2]*check[i-1];
			}else{
				check[i]=-check[i-2]*check[i-1];
			}
		}
		if(s.charAt(0)=='o'){
			check[j]=check[j-2]*check[j-1];
		}else{
			check[j]=-check[j-2]*check[j-1];
		}

		if(check[N]==check[0]&&check[N+1]==check[1]){
			char str[]=new char[N];
			for(int i=0;i<N;i++){
				if(check[i]==1){
					str[i]='S';
				}else{
					str[i]='W';
				}
			}
			System.out.println(new String(str) );
			return;
		}
		check[0]=1;
		check[1]=-1;
		for(int i=2;i<N+1;i++){
			if(s.charAt(i-1)=='o'){
				check[i]=check[i-2]*check[i-1];
			}else{
				check[i]=-check[i-2]*check[i-1];
			}
		}
		if(s.charAt(0)=='o'){
			check[j]=check[j-2]*check[j-1];
		}else{
			check[j]=-check[j-2]*check[j-1];
		}



		if(check[N]==check[0]&&check[N+1]==check[1]){
			char str[]=new char[N];
			for(int i=0;i<N;i++){
				if(check[i]==1){
					str[i]='S';
				}else{
					str[i]='W';
				}
			}
			System.out.println(new String(str) );
			return;
		}
		check[0]=-1;
		check[1]=1;

		for(int i=2;i<N+1;i++){
			if(s.charAt(i-1)=='o'){
				check[i]=check[i-2]*check[i-1];
			}else{
				check[i]=-check[i-2]*check[i-1];
			}
		}
		if(s.charAt(0)=='o'){
			check[j]=check[j-2]*check[j-1];
		}else{
			check[j]=-check[j-2]*check[j-1];
		}


		if(check[N]==check[0]&&check[N+1]==check[1]){
			char str[]=new char[N];
			for(int i=0;i<N;i++){
				if(check[i]==1){
					str[i]='S';
				}else{
					str[i]='W';
				}
			}
			System.out.println(new String(str) );
			return;
		}
		check[0]=-1;
		check[1]=-1;
		for(int i=2;i<N+1;i++){
			if(s.charAt(i-1)=='o'){
				check[i]=check[i-2]*check[i-1];
			}else{
				check[i]=-check[i-2]*check[i-1];
			}
		}
		if(s.charAt(0)=='o'){
			check[j]=check[j-2]*check[j-1];
		}else{
			check[j]=-check[j-2]*check[j-1];
		}



		if(check[N]==check[0]&&check[N+1]==check[1]){
			char str[]=new char[N];
			for(int i=0;i<N;i++){
				if(check[i]==1){
					str[i]='S';
				}else{
					str[i]='W';
				}
			}
			System.out.println(new String(str) );
			return;
		}
		System.out.println(-1);

	}
}

Measured memory_bytes: 26532
#![allow(non_snake_case, unused_imports)]

// Input
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)*} }; }
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)*} };}
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, 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") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        S: chars,
    }
    let mut ans:i32 = 0;
    for i in 0..S.len(){
        if S[i]=='p'{
            // g
            if i%2==0{
                ans -= 1;
            }
        }else{
            // p
            if i%2==1{
                ans += 1;
            }
        }
    }
    println!("{}",ans);
}

Measured memory_bytes: 4476
import java.util.*

fun main(args: Array<String>) {
  val (s, t) = readLine()!!.split(" ")
  var (a, b) = readLine()!!.split(" ").map(String::toInt)
  val u = readLine()!!
  if(u == s) a-- else b--
  println("$a $b")
}

Measured memory_bytes: 38000
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int D = sc.nextInt();
		int x = sc.nextInt();
		int ans=x;
		for (int i=0;i<10;i++) {
			ans=ans*r-D;
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 21204
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		for (int i = 1; i <= 9; i++) {
			for (int j = 1; j <= 9; j++) {
				if (i * j == N) {
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
		in.close();
	}
}

Measured memory_bytes: 22868
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        while(true){
            int n = sc.nextInt();
            int x = sc.nextInt();
            
            if(n == 0 && x == 0)break;
            
            int count = 0;
            int i, j, k;
            
           	for(i=1; i<=n-2;i++){
				for(j=i+1; j<=n-1; j++){
					for(k=j+1; k<=n; k++){
                        if(i+j+k==x) {
                            count++;
                        }
                    }
                }
            }
            System.out.println(count);
        }
    }
}




Measured memory_bytes: 26608
#include <iostream>
#include <vector>
#include <utility>
#define llint long long
#define inf 1e18

using namespace std;
typedef pair<llint, llint> P;

llint n;
vector<llint> G[105];
llint dist[105], parent[105];
llint deg[105];

/*void dfs(llint v, llint p, llint d)
{
	dist[v] = d, parent[v] = p;
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == p) continue;
		dfs(G[v][i], v, d+1);
	}
}*/

void dfs(llint v, llint p, llint d)
{
	llint cnt = 0;
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == p) continue;
		cnt++;
		dfs(G[v][i], v, d+1);
	}
	deg[d] = max(deg[d], cnt);
}

int main(void)
{
	cin >> n;
	llint u, v;
	for(int i = 1; i <= n-1; i++){
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	
	P ans = make_pair(inf, inf);
	for(int i = 1; i <= n; i++){
		for(int j = 0; j <= n; j++) deg[j] = 0;
		dfs(i, -1, 0);
		
		llint dep, num = 1;
		for(int j = 0; j <= n; j++){
			if(deg[j] == 0){
				dep = j;
				break;
			}
			num *= deg[j];
		}
		ans = min(ans, make_pair(dep+1, num));
	}
	
	for(int i = 1; i <= n; i++){
		for(int j = 0; j < G[i].size(); j++){
			int v = G[i][j];
			for(int k = 0; k <= n; k++) deg[k] = 0;
			dfs(i, v, 0), dfs(v, i, 0);
			
			llint dep, num = 2;
			for(int k = 0; k <= n; k++){
				if(deg[k] == 0){
					dep = k;
					break;
				}
				num *= deg[k];
			}
			ans = min(ans, make_pair(dep+1, num));
		}
	}
	cout << ans.first << " " << ans.second << endl;
	
	return 0;
}

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

const int N = 1e5 + 5;

typedef long long LL;

LL S[N] , a[N] , L;
int n;

int main(void) {
	scanf("%d%lld" , &n , &L);
	for(int i = 1;i <= n;i ++) scanf("%lld" , &a[i]);
	bool flag = 0; int no = -1;
	for(int i = 1;i <= n - 1;i ++) {
		if(a[i] + a[i + 1] >= L) {
			no = i; flag = 1;
		}
	}
	if(!flag) {
		puts("Impossible");
		return 0;
	}
	puts("Possible");
	for(int i = 1;i <= no - 1;i ++) {
		cout << i << endl;
	}
	for(int j = n - 1;j >= no;j --) cout << j << endl;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main(){
    int ans = 0;
    int tmp;
    VLL memo;
    REP(i, 5) {
        cin >> tmp;
        if(tmp%10 != 0) {
            memo.PB(tmp%10);
            ans += (tmp / 10 + 1) * 10;
        } else {
            ans += tmp;
        }
    }
    if(memo.size() == 0) memo.PB(10);

    sort(ALL(memo));
    cout << ans + memo[0] - 10 << endl;
}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;
 
class Program
 {
  static string[] map;
  static int H;
  static int W;
        static void Main(string[] args)
        {
          //入力を受け取る
          var NT = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
          var N = NT[0];
          var T = NT[1];
          var t = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
          long duration = t[0]+T;
          long time = T-t[0];
          
          for(int i = 1; i < N ; i++){
            if(duration <= t[i]){
              duration = t[i]+T;
              time += T;
            }else{
              time += (t[i]+T)-duration;
              duration = t[i]+T;
            }
          }
          Console.WriteLine(time);
        }
}


Measured memory_bytes: 30880
#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main() {
    int k;
    cin>>k;
    vector<bool> rem(k,false);
    ll tmp=7;
    int cnt=1;
    while(true){
        if(rem[tmp%k]){
            cout<<-1<<endl;
            return 0;
        }
        if(tmp%k==0){
            cout<<cnt<<endl;
            return 0;
        }
        rem[tmp%k]=true;
        tmp=(tmp*10+7)%k;
        cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}

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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define VEC vector

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;
typedef vector<int>				Vint;
typedef vector<Vint>			VV;

template<typename T>string join(const v(T)&v)
{stringstream s;REP(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define MAX 		400010

const ll LINF = (ll)9e18+7;		//
const int INF = 100100100;			//2,147,483,647 (Max int)
const ll MOD = 1e9+7;
// テンプレ終了
//====================================================================//

// int DP[MAX];

//
int main(){
	string s,t;cin>>s;t=s;
	ll n;cin>>n;

	ll cnt = 0;
	REPS(i,1,s.size()){
		if(s[i-1]==s[i]){
			cnt++ ;
			s[i] = '0';
		}
	}
	ll cnt2 = 0;
	if(s[0]==s[s.size()-1]){t[0] = '1';cnt2++;}
	REPS(i,1,t.size()){
		if(t[i-1]==t[i]){
			cnt2++ ;
			t[i] = '1';
		}
	}

	ll ans = cnt+(cnt2*(n-1));
	if(t[t.size()-1]=='1'){
		ans = cnt * (n-n/2) + cnt2 * (n/2);
	}

	// cout << s << " " << t << endl;
	// cout << cnt << " " << cnt2 << endl;
	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

static const double EPS = 1e-8;

int stage[8][8];
int cost[8][8][6];

class Ant{
public:
	int cost;
	int life;
	int x;
	int y;
	Ant(int _x,int _y,int _l,int _c) : x(_x),y(_y),life(_l),cost(_c) {}
	bool operator>(const Ant& a) const{
		return cost > a.cost;
	}
};

int main(){
	int w,h;
	while(~scanf("%d %d",&w,&h)){
		if(w==0 && h==0) break;
		int ax,ay;
		for(int y=0;y<h;y++){
			for(int x=0;x<w;x++){
				scanf("%d",&stage[y][x]);
				if(stage[y][x] == 2){
					ax = x;
					ay = y;
				}
			}
		}

		memset(cost,0x3f,sizeof(cost));
		priority_queue<Ant,vector<Ant>,greater<Ant> > que;

		que.push(Ant(ax,ay,6,0));
		cost[ax][ay][6] = 0;
		

		int res = -1;
		while(!que.empty()){
			Ant ant = que.top();
			que.pop();

			for(int i=0;i<4;i++){
				int dx = ant.x + tx[i];
				int dy = ant.y + ty[i];
				if(dx < 0 || dx >= w || dy < 0 || dy >= h) continue;
				if(stage[dy][dx] == 0) continue;

				//food
				if(stage[dy][dx] == 4){
					if(ant.life - 1 <= 0) continue;
					if(cost[dx][dy][6] < ant.cost + 1) continue;
					que.push(Ant(dx,dy,6,ant.cost + 1));
					cost[dx][dy][6] = ant.cost + 1;
				}

				//nest
				if(stage[dy][dx] == 3){
					if(ant.life - 1 <= 0) continue;
					res = ant.cost + 1;
					goto found;
				}

				//nothing
				if(stage[dy][dx] == 1
					|| stage[dy][dx] == 2){
					if(ant.life - 1 <= 0) continue;
					if(cost[dx][dy][ant.life - 1] < ant.cost + 1) continue;
					que.push(Ant(dx,dy,ant.life - 1,ant.cost + 1));
					cost[dx][dy][ant.life - 1] = ant.cost + 1;
				}
			}
		}
found:;

		printf("%d\n",res);
	}
}

Measured memory_bytes: 1528
def ketanowa(num):
  return sum(list(map(int,str(num))))

N = int(input())
ans = 10**5
for i in range(1, N//2+1):
  goukei = ketanowa(i) + ketanowa(N-i)
  if goukei < ans:
    ans = goukei
print(ans)

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

using namespace std;


int main()
{
	int N;
	cin >> N;
	vector<int> L;

	for (int i = 0; i < N; i++)
	{
		int num;
		cin >> num;
		L.push_back(num);
	}

	sort(L.begin(), L.end());

	vector<int>::iterator it_max;
	vector<int>::iterator it_high;
	vector<int>::iterator it_low;

	int count = 0;

	for (it_max = L.end() - 1; it_max > L.begin() + 1; it_max--)
	{
		for (it_high = it_max - 1; it_high > L.begin(); it_high--)
		{
			for (it_low = L.begin(); it_low < it_high; it_low++)
			{
				if (*it_low + *it_high > * it_max)
				{
					count += distance(it_low, it_high);
					break;
				}

			}
		}
	}

	cout << count;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 2000 + 5;
const int mod = 1e9 + 7;

int h,w;
int mp[2005][2005];
int sumh[maxn][maxn],sumw[maxn][maxn];

int main()
{
   ios::sync_with_stdio(false); cin.tie(0);cout.tie(0);
   cin >> h >> w;
   for(int i = 1; i <= h; i++){
      for(int j = 1; j <= w; j++){
          char c;
          cin >> c;
          if(c == '.')mp[i][j] = 1;
          else mp[i][j] = 0;
      }
   }
   for(int i = 1; i <= h; i++){
      for(int j = 1; j <= w; j++){
        if(mp[i][j] == 1) sumh[i][j] = sumh[i][j - 1] + 1;
        else sumh[i][j] = 0;
      }
      for(int j = w - 1; j >= 1; j--){
        if(sumh[i][j] && sumh[i][j + 1]) sumh[i][j] = sumh[i][j + 1];
      }
    }
    for(int i = 1; i <= w; i++){
      for(int j = 1; j <= h; j++){
        if(mp[j][i] == 1) sumw[i][j] = sumw[i][j - 1] + 1;
        else sumw[i][j] = 0;
      }
      for(int j = h - 1; j >= 1; j--){
        if(sumw[i][j] && sumw[i][j + 1]) sumw[i][j] = sumw[i][j + 1];
      }
    }
    /*
    for(int i = 1; i <= h; i ++){
      for(int j = 1; j <= w; j++){
        cout << sumh[i][j] <<" ";
      }
      cout << endl;
    }
    */
    int ans = 0;
    for(int i = 1; i <= h; i++){
      for(int j = 1; j <= w; j++){
         ans = max(ans,sumh[i][j] + sumw[j][i]);
      }
    }
    cout << ans - 1<< endl;
   return 0;
}

Measured memory_bytes: 47360
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int N;
LL A[114514];

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

  int cnt = 0;
  rep(i, N) {
    scanf("%lld", &A[i]);
    cnt += (A[i]%2);
  }

  if (cnt == 0) puts("second");
  else puts("first");
}


Measured memory_bytes: 1024
//confilm 0LL and 1LL
//confilm cornercase such as 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fs first
#define sc second
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	ll a;
	cin >> a;
	co(3*a*a);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main()
{
    int x, y, z;
    cin >> x >> y >> z;

    cout << (x * y) / 2 << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

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

        String num1 = br.readLine();
        int count = 0;
        String[] temp = num1.split("");

        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < temp.length ;i++) {
            list.add(Integer.parseInt(temp[i]));
        }

        for (int i = 0; i < list.size(); i++) {
            int temp1 = list.get(i);
            int temp2 = list.get(list.size() - (i + 1));

            if (temp1 == temp2) {
                count++;
            }
        }

        if (count == temp.length) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }


    }
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,1):0;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,1):0;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 200000 + 10;
int e[MAX_N];

int main2() {
  int N = nextInt();
  int M = nextInt();
  memset(e, 0, sizeof(e));
  REP(_, M) {
    int a = nextInt() - 1;
    int b = nextInt() - 1;
    if (a == 0) { e[b] |= 1; }
    if (a == N-1) { e[b] |= 2; }
    if (b == 0) { e[a] |= 1; }
    if (b == N-1) { e[a] |= 2; }
  }

  bool possible = false;
  REP(i, N) if (e[i] == 3) possible = true;
  cout << (possible ? "POSSIBLE" : "IMPOSSIBLE") << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
int main() {
	int i, j, k;
	int n, x, sum;
	while (1) {
		sum = 0;
		scanf("%d%d", &n, &x);
		if (n == 0 && x == 0) break;
		for (int i = 1; i <= n - 2; i++) {
			for (int j = i + 1; j <= n - 1; j++) {
				for (int k = j + 1; k <= n; k++) {
					if (i + j + k == x) sum++;
				}

			}
		}
		printf("%d\n", sum);
	}
	




}




Measured memory_bytes: 2088
#include <iostream>
#include <algorithm>

using namespace std;

int main() {

    int n, mx = 0, ans = 0;
    cin >> n;

    if (n == 1){
        cout << 1 << endl;
        return 0;
    }

    for (int i = 1; i <= n; i++){

        if (i % 2 != 0) continue;

        int temp = i, cnt = 0;

        while (temp % 2 == 0) {
            ++cnt;
            temp /= 2;
        }

        if (cnt > mx){
            ans = i;
            mx = cnt;
        }

    }

    cout << ans << endl;

    return 0; 
}

Measured memory_bytes: 256
#include <algorithm>
#include <cctype>
#include <complex>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;
using std::cerr;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::stack;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

typedef long long int ll;
const int MOD = 1e9 + 7;

int main() {
    ll a, b, x;
    cin >> a >> b >> x;

    ll aa = (a - a % x) + (a % x == 0 ? 0 : x);
    ll bb = b - b % x;

    if(aa <= bb){
        cout << 1 + (bb - aa) / x << endl;
    }else{
        cout << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 888
from collections import Counter

n = int(input())
words = [input() for _ in range(n)]
counter = Counter(words)
counter_most_common = counter.most_common()
m = counter_most_common[0][1]
s = []
for k, v in dict(counter_most_common).items():
    if v == m:
        s.append(k)

s.sort()

for si in s:
    print(si)

Measured memory_bytes: 68072
a, b = map(int, input().split())

res = ''
if a > 0:
    res = 'Positive'
elif a < 0:
    if b < 0:
        res = 'Positive' if abs(b - a + 1) % 2 == 0 else 'Negative'
    else:
        res = 'Zero'
else:
    res = 'Zero'

print (res)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  int n;
  int tmp;
  long long int num = 0;
  vector<int> a;
  vector<int> b;
  cin >> n;
  for(int i=0; i<n+1; i++){
    cin >> tmp;
    a.push_back(tmp);
  }
  for(int i=0; i<n; i++){
    cin >> tmp;
    b.push_back(tmp);
  }
  for(int i=0; i<n; i++){
    tmp = min(a.at(i), b.at(i));
    num += tmp;
    a.at(i) -= tmp;
    b.at(i) -= tmp;
    tmp = min(a.at(i+1), b.at(i));
    num += tmp;
    a.at(i+1) -= tmp;
    b.at(i) -= tmp;
  }
  cout << num << endl;
}

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

using namespace std;

typedef long long ll;

ll mul(ll n){
  ll a = n;
  a *= a;
  a *= a;
  a *= n;
  return a;
}

int main(){
  ll X;
  ll A,B;
  cin >> X;
  for(A = -3000;A<=3000;A++)
    for(B = -3000;B<=3000;B++)
      if(mul(A) - mul(B) == X){
        cout << A << " " << B << endl;
        goto END;
      }
  END:;
}

Measured memory_bytes: 3632
use std::io;
use std::io::BufRead;
use std::str::FromStr;
use std::fmt;

fn main() {
  let card_set = &mut [false; 13 * 4];

  let stdin = io::stdin();
  for line in stdin.lock().lines().skip(1) {
    let line = line.unwrap();
    let card = line.parse::<Card>().unwrap();
    card_set[card.id] = true;
  }

  for i in 0..13 * 4 {
    if !card_set[i] {
      println!("{}", Card { id: i });
    }
  }
}

struct Card {
  id: usize
}

impl FromStr for Card {
  type Err = String;
  fn from_str(s: &str) -> Result<Self, Self::Err> {
    let mut iter = s.split_whitespace();
    let suit = match iter.next().ok_or("parse error")? {
      "S" => 0,
      "H" => 1,
      "C" => 2,
      "D" => 3,
      _ => { return Err("parse error".into()); }
    };
    let number = iter.next().ok_or("none")?.parse::<usize>().map_err(|x| x.to_string())?;
    Ok(Card { id: suit * 13 + number - 1 })
  }
}

impl fmt::Display for Card {
  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    let suit = match self.id / 13 {
      0 => "S",
      1 => "H",
      2 => "C",
      3 => "D",
      _ => { return Err(fmt::Error); }
    };
    write!(f, "{} {}", suit, self.id % 13 + 1)
  }
}


Measured memory_bytes: 5040
import java.io.BufferedReader;
import java.io.InputStreamReader;


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

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();

        int tmp = 0;
        int tmp2 = 0;
        int sum = 0;
        int lenge = 0;

        for (int i=0;i<5;i++) {
        	tmp = scanner.nextInt();
        	if(tmp%10!=0) {
        		tmp2=((tmp/10) + 1) * 10;
        	}else {
        		tmp2=tmp;
        	}
        	sum += tmp2;
        	if((tmp2-tmp)>lenge) {
        		lenge = (tmp2-tmp);
        	}
        }

        System.out.println(sum-lenge);
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
template <long long mod>
class Combination
{
    std::vector<long long> fact, finv, inv;
public:
    Combination() {}
    Combination(int sz)
    {
        fact.resize(sz);
        finv.resize(sz);
        inv.resize(sz);
        fact[0] = 1;
        for (int i = 1; i < sz; ++i)
        {
            fact[i] = fact[i - 1] * i % mod;
        }
        inv[0] = 0;
        inv[1] = 1;
        for (int i = 2; i < sz; ++i)
        {
            inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        }
        finv[0] = 1;
        for (int i = 1; i < sz; ++i)
        {
            finv[i] = finv[i - 1] * inv[i] % mod;
        }
    }
    long long C(long long n, long long k)
    {
        if (n < k)
            return 0;
        if (n < 0 || k < 0)
            return 0;
        return (fact[n] * finv[k] % mod) * finv[n - k] % mod;
    }
    long long P(long long n, long long k)
    {
        if (n < k)
            return 0;
        if (n < 0 || k < 0)
            return 0;
        return fact[n] * finv[n - k] % mod;
    }
    long long H(long long n, long long k)
    {
        return this->C(n + k - 1, k);
    }
    long long getfact(int i)
    {
        return fact[i];
    }
    long long getinv(int i)
    {
        return inv[i];
    }
    long long getfinv(int i)
    {
        return finv[i];
    }
};
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const ld eps = 1e-9;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  Combination<MOD> comb(3000000);
  ll n, m, k; cin >> n >> m >> k;
  ll ans = 0;
  for(int i=0;i<=k;++i) {
    ll yoko = n + 2*i;
    ll tate = m + 2*(k - i);
    ll tmp = comb.C(yoko + tate, yoko);
    tmp *= comb.C(yoko, i) + MOD - comb.C(yoko, n + i + 1);
    tmp %= MOD;
    tmp *= comb.C(tate, k-i) + MOD - comb.C(tate, m + k - i + 1);
    tmp %= MOD;
    ans += tmp;
    ans %= MOD;
  }
  cout << ans << endl;
}



Measured memory_bytes: 72952
n,a,b = map(int,input().split())

sum = 0
for i in range(1,n+1):
  l = list(str(i))
  tmpSum = 0
  for ls in l:
    tmpSum += int(ls)    
  if int(tmpSum) >= a and int(tmpSum) <= b:
    sum+=i

print(sum)
    

Measured memory_bytes: 40940
lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

a = lines[0][0]
b = lines[0][1]
c = lines[0][2]
k = lines[1][0]

while a >= b do
  b *= 2
  k -= 1
end

while b >= c do
  c *= 2
  k -= 1
end

if k >= 0 then
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 14332
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 10000000000000000
int main(){
	string s;cin>>s;
	int FRONT=10*(s[0]-'0')+(s[1]-'0');
	int BACK=10*(s[2]-'0')+(s[3]-'0');

	if((1<=FRONT && FRONT<=12) && (1<=BACK && BACK<=12)){cout<<"AMBIGUOUS"<<endl;return 0;}
	else if(1<=FRONT && FRONT<=12){cout<<"MMYY"<<endl;return 0;}
	else if(1<=BACK && BACK<=12){cout<<"YYMM"<<endl;return 0;}
	else{cout<<"NA"<<endl;}
	
	return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

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

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

	cin >> N;
	vector<int>v(N);
	for (int i = 0; i < N - 1; i++) {
		cin >> L >> R >> K;
		v[L] ^= K;
		v[R] ^= K;
	}
	vector<int>b(16);
	for (auto i : v) {
		b[i]++;
	}
	int ans = 0;
	for (int i = 1; i <= 15; i++) {
		ans += b[i] / 2;
		b[i] %= 2;
	}
	vector<int>dp(1 << 16, MOD);
	int cnt = 0;
	for (int i = 1; i <= 15; i++) {
		if (b[i]) {
			cnt |= 1 << i;
		}
	}
	dp[cnt] = 0;
	//cout << cnt << endl;
	//cout << ans << endl;
	for (int i = (1 << 16) - 2; i > 0; i -= 2) {
	//	cout << i << endl;
		for (int j = 1; j < 16; j++) {
			for (int k = j + 1; k < 16; k++) {
				if (i&(1 << j) && i & (1 << k)) {
					if (dp[i] != MOD) {
					//	cout << i << " " << j << " " << k << endl;
						for (int l = 1; l < 16; l++) {
							int box = j ^ l;
							int bag = k ^ l;
							int add = 1;
							int cbit = i - (1 << j) - (1 << k);
							if (box) {
								if (cbit&(1 << box)) {
									cbit -= 1 << box;
									add++;
								}
								else {
									cbit += 1 << box;
								}
							}
							if (bag) {
								if (cbit&(1 << bag)) {
									cbit -= 1 << bag;
									add++;
								}

								else {
									cbit += 1 << bag;
								}
							}
						//	cout << cbit << endl;
							dp[cbit] = min(dp[cbit], dp[i] + add);
						}
					}
				}
			}
		}
	}
	cout << ans + dp[0] << endl;
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int gcd(int a, int b)
{
        if(b == 0) return a;
        return gcd(b, a % b);
}

int main()
{
        int N, X;
        cin >> N >> X;
        vector<int> v(N+1, 0);
        v[0] = X;
        for(int i = 1; i < N+1; i++) cin >> v[i];

        sort(v.begin(), v.end());

        vector<int> dv(N, 0);
        for(int i = 0; i < dv.size(); i++)
        {
                int tmp = abs(v[i+1] - v[i]);
                dv[i] = tmp;
        }

        sort(dv.begin(), dv.end());

        int val = dv[0];
        for(int i = 1; i < dv.size(); i++)
        {
                if(val >= dv[i]) val = gcd(dv[i], val);
                else val = gcd(val, dv[i]);
        }

        cout << val << endl;

        return 0;
}

Measured memory_bytes: 1024
N=int(input())
S=[0]*N
for i in range(N):
    S[i]=input()

a=[0]*4
for i in range(len(S)):
    if S[i]=='AC':
        a[0]=a[0]+1
    elif S[i]=='WA':
        a[1]=a[1]+1
    elif S[i]=='TLE':
        a[2]=a[2]+1
    elif( S[i]=='RE'):
        a[3]=a[3]+1

print('AC x {}'.format(a[0]))
print('WA x {}'.format(a[1]))
print('TLE x {}'.format(a[2]))
print('RE x {}'.format(a[3]))


Measured memory_bytes: 83252
a, b, c = map(int, input().split())

if a < b:
    if a < c:
        if b < c:
            print("{} {} {}".format(a, b, c))
        else:
            print("{} {} {}".format(a, c, b))
    else:
        print("{} {} {}".format(c, a, b))
else:
    if b < c:
        if a < c:
            print("{} {} {}".format(b, a, c))
        else:
            print("{} {} {}".format(b, c, a))
    else:
        print("{} {} {}".format(c, b, a))


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    int n,m;
    cin >> n >> m;
    int ans[n+1];
    for(int i=1;i<=n;i++){
        ans[i]=-1;
    }
    int flag=0;
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        if(ans[a]!=b&&ans[a]!=-1){
            flag=1; 
        }
        ans[a]=b;
    }
    if((ans[1]==0&&n>1)||flag==1){
        cout << -1 << endl;
        exit(0);
    }
    if((ans[1]==0||ans[1]==-1)&&n==1){
        cout << 0 << endl;
        exit(0);
    }
    for(int i=1;i<=n;i++){
        if(ans[i]==-1){
            if(i==1){
                cout << 1;
            }
            else{
                cout << 0;
            }
        }
        else{
            cout << ans[i];
        }
    }
}

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

typedef long long ll;

#define PB push_back
#define MP make_pair

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
    int w, h, x, y; cin >> w >> h >> x >> y;
    cout << setprecision(10) << double(w) * double(h) / 2 << " " << (2 * x == w && 2 * y == h) << "\n";
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* print new lines
*/

Measured memory_bytes: 256
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> mpll;
typedef unordered_map<char, ll> mpcl;
typedef unordered_map<string, ll> mpsl;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

ll inl() {
    ll x;
    cin >> x;
    return (x);
}

string ins() {
    string x;
    cin >> x;
    return (x);
}

ll ans = 0;

void dfs(vl &a, int idx, ll sum) {
    if (idx >= a.size()) {
        if (sum % 2 == 0) ans++;
        return;
    }
    dfs(a, idx + 1, sum * (a[idx] + 1));
    dfs(a, idx + 1, sum * (a[idx] - 1));
    dfs(a, idx + 1, sum * a[idx]);
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        ll n = inl();
        vl a(n);
        rep(i, n) cin >> a[i];
        dfs(a, 0, 1);
        cout << ans << endl;


#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 768
#include <iostream>

using namespace std;

int main(){
  
  int N,K;
  int h[100005];
  
  cin>>N>>K;
  
  for(int i=0;i<N;i++){
    cin>>h[i];
  }
  
  
  int count=0;
  
  for(int i=0;i<N;i++){
    if(h[i]>=K) {
      count++;
     }
  }
  
  cout<<count;
  
 return 0; 
}

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

int main() {
  int n, x, y;
  cin >> n >> x >> y;
  x--, y--;
  vector<vector<int>> dist(n, vector<int>(n, -1));
  for (int s = 0; s < n; s++){
    queue<int> que;
    dist[s][s] = 0;
    que.push(s);
    while (!que.empty()){
      auto v = que.front(); que.pop();
      vector<int> shortest;
      if(v > 0) shortest.push_back(v-1);
      if(v< n-1) shortest.push_back(v+1);
      if(v == x) shortest.push_back(y);
      if(v == y) shortest.push_back(x);
      for(auto sh: shortest){
        if(dist[s][sh] == -1){
          dist[s][sh] = dist[s][v] + 1;
          que.push(sh);
        }
      }
    }
  }
  vector<int> ans(n, 0);
  for (int i = 0; i < n; i++){
    for (int j = i + 1; j < n; j++){
      ans[dist[i][j]]++;
    }
  }
  for (int i = 1; i < n; i++){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 16000
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
        String str = null;
      
		if (n == m) {
          str = "Yes";
        } else {
          str = "No";
        }
		// 出力
		System.out.println(str);
	}
}

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

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

    int a[] = new int[n];
    for(int i=0;i<n;i++) a[i] = in.nextInt();

    int dp[] = new int[k+1];
    dp[0]=0;
    for(int i=0;i<dp.length;i++)
      for(int j=0;j<a.length;j++){
        if(i-a[j]<0) continue;
        dp[i] += (dp[i-a[j]] == 0 ? 1 : 0);
      }
//      System.out.println(Arrays.toString(dp));
    System.out.println(dp[k]>0 ? "First" : "Second");

  }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define PII pair<int, int>
#define LL long long
using namespace std;
const int MAXN = 200005;
const LL MOD = 1000000007;
const LL INF = (LL) 1e9 + 5;

struct DSU {
	int pa[MAXN];
	bool fix[MAXN];
	int find(int x) {
		return pa[x] == 0 ? x : pa[x] = find(pa[x]);
	}
	void merge(int x, int y) {
		x = find(x);
		y = find(y);
		pa[y] = x;
	}
} dsu;

struct Coin {
	int r, c, v;
	bool operator < (const Coin &c) const {
		return v > c.v;
	}
};

int R, C, N;
Coin coin[MAXN];

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

	cin >> N >> R >> C;
	for (int i = 0; i < N; i++) {
		int r, c, v;
		cin >> r >> c >> v;
		coin[i] = {r, c, v};
	}
	
	LL ans = 0;
	sort(coin, coin + N);
	for (int i = 0; i < N; i++) {
		int x = dsu.find(coin[i].r), y = dsu.find(coin[i].c + R), v = coin[i].v;
		bool *fix = dsu.fix;
		if ((int) fix[x] + (int) fix[y] == 1) {
			ans += v;
			dsu.merge(x, y);
			fix[x] = true;
		}
		else if (!fix[x] && !fix[y]) {
			ans += v;
			if (x == y) {
				fix[x] = true;
			}
			else {
				dsu.merge(x, y);
			}
		}
	}
	
	cout << ans << '\n';

	return 0;
}

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

int main() {
  int K, S; cin >> K >> S;
  int counter = 0;
  
  for (int x =0;x<=K;++x){
    for (int y = 0; y<=K; ++y){
      int z =S-x-y;
      if (z>=0 && z<=K){
        ++counter;
      }
    }
  }
  cout << counter <<endl;
}
  
  

Measured memory_bytes: 256
a,b,c,d,n,*A=`dd`.split.map &:to_i;e=f=1;a>c&&(a,c,e=c,a,-1);b>d&&(b,d,f=d,b,-1);V=A.each_slice(2).select{|x,y|a<=x&&x<=c&&b<=y&&y<=d}.map{|x,y|[x*e,y*f]}.sort;D=[F=1e9]*s=V.size;V.map{|x,y|D[D.bsearch_index{|e|e>y}]=y};N=(0...s).find{|i|D[i]>=F}||s;p 1e2*(c-a+d-b)-20*N+5*(N+(N>[c-a,d-b].min ? 1:0))*Math::PI

Measured memory_bytes: 40972
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
long long gcd(long long a,long long b){
    ll gcdmax=max(a,b);
    ll gcdmin=min(a,b);
    while(true){
        if(gcdmax%gcdmin==0)break;
        else gcdmax%=gcdmin;
        swap(gcdmin,gcdmax);
    }
    return gcdmin;
}
ll powerup(ll N,ll P,ll M){
    if(P==0)return 1;
    else if(P%2==0){
        ll t=powerup(N,P/2,M);
        return t*t%M;
    }
    else return N*powerup(N,P-1,M)%M;
}
int main()
{
  ll N;
  cin>>N;
  ll M=0;
  ll C=0;
  vector<ll> A(N+1);
  rep(i,N)cin>>A.at(i+1);
  for(ll i=N;i>=1;i--){
    C=0;
    for(ll j=1;j<=N/i;j++){
      C=(C+A.at(j*i))%2;
    }
    A.at(i)=C;
    if(C==1)M++;
  }
  cout<<M<<endl;
  rep(i,N){
    if(A.at(i+1)==1)cout<<i+1<<" ";
  }
}

Measured memory_bytes: 2432
def main():
    S = input()

    if S[0] != 'A':
        print('WA')
        exit()
    S = 'a'+S[1:]
    if S.count('C', 2, len(S)-1) != 1:
        print('WA')
        exit()
    tmp = S[2:len(S)-1].find('C') + 2
    S = S[:tmp] + 'c' + S[tmp+1:]
    if S != S.lower():
        print('WA')
        exit()
    print('AC')


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
import * as fs from 'fs';

namespace AtCoder.abc094 {

    export class Program {
        args: string[];

        constructor(args: string[]) {
            this.args = args;
        }

        /**
         * in
         *
         * out
         *
         */
        main(this: Program): void {
            const [a, b, x]: number[] = this.args[0].split(' ').map(Number);
            if (a > x) {
                console.log('NO')
            } else if (a + b < x) {
                console.log('NO');
            } else {
                console.log('YES');
            }
        }
    }
}

const args = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n');
const prg = new AtCoder.abc094.Program(args);
prg.main();


Measured memory_bytes: 7372
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp make_pair
#define pb push_back
#define mes(a,b) memset(a,b,sizeof(a))
#define mes0(a) memset(a,0,sizeof(a))
#define lson l,mid,pos<<1
#define rson mid+1,r,pos<<1|1
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define fi first
#define se second
#define sss(a) a::iterator
#define all(a) a.begin(),a.end()

using namespace std;

typedef double DB;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<long long ,int> pli;
typedef pair<int,long long > pil;
typedef pair<string,int> psi;
typedef pair<long long ,long long > pll;

const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1.0);
const int maxn = 100000+10;
const int mod = 1e9+7;
long long C[5];
int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    int T;
    cin>>C[0]>>C[1]>>C[2]>>C[3];
    for (int i=0;i<4;i++){
        long long tmp=C[i];
        for (int j=i;j<4;j++){
            C[j]=min(C[j],tmp);
            tmp*=2;
        }
    }
    long long n;
    cin>>n;
    n*=4;
    long long ans=0;
    for (int i=3;i>=0;i--){
        ans+=(n/(1LL<<i))*C[i];
        n%=(1<<i);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256