akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String c = sc.next();
		if(c.equals("a")){
			System.out.println("vowel");
		}else if(c.equals("e")){
			System.out.println("vowel");
		}else if(c.equals("i")){
			System.out.println("vowel");
		}else if(c.equals("o")){
			System.out.println("vowel");
		}else if(c.equals("u")){
			System.out.println("vowel");
		}else{
			System.out.println("consonant");
		}
		sc.close();
	}

}


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

int main()
{
	ll a,b,c,k;
	cin>>a>>b>>c>>k;
	if(k<=a)cout<<k<<endl;
	else if(k>a&&k<=a+b)cout<<a<<endl;
	else if(k>a+b&&k<=a+b+c)cout<<a-(k-(a+b))<<endl;
	return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>

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

	if (a % 2 == 1 && b % 2 == 1) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}

	return 0;
}


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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> a(2 * M);
  vector<int> b(N);
  for(int i = 0; i < 2 * M;i++){
    cin >> a.at(i);
  }
  
  for(int j = 0;j<N;j++){
    for(int k = 0;k<2*M;k++){
      if(a.at(k) == j + 1){
        b.at(j)++;
      }
    }
  }
  
  for(int l = 0;l<N;l++){
    cout << b.at(l) << endl;
  }
}


Measured memory_bytes: 256
using System;

namespace abc107_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = Convert.ToInt32(input[0]);
            int i = Convert.ToInt32(input[1]);
            Console.WriteLine(N - i + 1);
        }
    }
}


Measured memory_bytes: 27496
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


int main(void) {
    
    int N, K;
    int ans = 0;
    vector<int> L;
    vector<int> M;
    
    cin >> N >> K;
    
    
    for (int i = 0; i < N; ++i) {
        
        int n; cin >> n;
        
        L.push_back(n);
        
    }
    
    for (int i = 0; i < K; ++i) {
        
        auto itr = max_element(L.begin(), L.end());
        ans += *itr;
        
        M.push_back(*itr);
        
        L.erase(itr);
        
        
        
    }
    
    cout << ans << endl;
    
    return 0;
    
}





















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, m;
const int maxN = 1005;
int x[maxN][3];
main() {
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < 3; j++) cin >> x[i][j];
    }
    int mx = 0;
    for (int mask = 0; mask < 8; mask++) {
        vector < int > all;
        for (int i = 1; i <= n; i++) {
            int t = mask;
            int val = 0;
            for (int j = 0; j < 3; j++) {
                if (t & 1) val += x[i][j];
                else val -= x[i][j];
                t /= 2;
            }
            all.push_back(val);
        }
        sort(all.begin(), all.end());
        reverse(all.begin(), all.end());
        int cur = 0;
        for (int i = 0; i < m; i++) cur += all[i];
        mx = max(mx, cur);
    }
    cout << mx;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var a,b,c int
	fmt.Scan(&a,&b,&c)
	
	houses := []int{a,b}
	sort.Ints(houses)
	
	if houses[0] < c && c <houses[1] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int n; cin >> n;
    vector<int> num(n);
    int res = 0;
    REP(i, n){
        cin >> num[i];
        res += num[i];
    }
    whole(sort, num);
    int pool = 0;
    REP(i, n){
        if(res % 10 != 0) break;
        else res -= num[i];
        if(num[i] % 10 == 0) pool += num[i]; 
    }
    
    if(res != 0) cout << res + pool << endl;
    else cout << 0 << endl;
 
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
const long long mod=1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return a%b?gcd(b,a%b):b;}
ll lcm(ll c,ll d){return c*d/gcd(c,d);}
vector<vector<bool>> graph(8,vector<bool>(8,false));
int n,m;
int dfs(int v,vector<bool> visited){
	bool al_visited=true;
	for(int i=0;i<n;i++){
		if(!visited.at(i))al_visited=false;
	}
	if(al_visited)return 1;
	int res=0;
	for(int i=0;i<n;i++){
		if(!graph.at(v).at(i))continue;
		if(visited.at(i))continue;
		visited.at(i)=true;
        res+=dfs(i,visited);
		visited.at(i)=false;
	}
	return res;
}

int main(){
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		graph.at(a-1).at(b-1)=true;
		graph.at(b-1).at(a-1)=true;
	}
	vector<bool> visited(n,false);
	visited.at(0)=true;
	cout<<dfs(0,visited)<<endl;

}


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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    string ans = "NO";
    for(int i=0;i<=b;i++){
        if(a*i%b == c) {
            ans = "YES";
            break;
        }

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

Measured memory_bytes: 256
# include <bits/stdc++.h>
/// my holy template
# define F first    
# define S second
# define mp make_pair
# define pii pair<int,int>         
/// eveything goes according to plan
# define long long long  
# define pb push_back
# define sz(a) (int)(a.size())

# define y1    tipa_y1
# define left  tipa_left
# define right tipa_right     

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const long MXLL = 9223372036854775807;
const int Sz = 1110111;

using namespace std;

inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

int n;

pii a[Sz], b[Sz];
      
int x[Sz], y[Sz];

int d[Sz];

set <pii> q;

int p[Sz], sz[Sz]; 

inline int dist (int i, int j) {
  return min (abs (x[i] - x[j]), abs (y[i] - y[j]));
}

struct edge {
  int x, y, w;
  edge (int x, int y) : x(x), y(y), w(dist (x, y)) {}
};
vector <edge> e;
   
int get (int v) {
  if (p[v] == v)  return v;
  return p[v] = get (p[v]);
}

inline void unite (int x, int y) {
  if (sz[x] < sz[y])  swap (x, y);
  sz[x] += sz[y];
  p[y] = x;
}
    
                              
int main() 
{
  Read_rap ();
  cin >> n;
  for (int i = 1;i <= n;i ++) {
    cin >> x[i] >> y[i];
    a[i] = {x[i], i};
    b[i] = {y[i], i};
  }  
  sort (a + 1, a + n + 1);
  sort (b + 1, b + n + 1);
  for (int i = 1;i <= n;i ++) {
    if (i < n)
      e.pb (edge (a[i].S, a[i + 1].S)), e.pb (edge (b[i].S, b[i + 1].S));
    if (i > 1)  
      e.pb (edge (a[i].S, a[i - 1].S)), e.pb (edge (b[i].S, b[i - 1].S));
  }       
  sort (e.begin(), e.end(), [] (edge a, edge b) { return a.w < b.w;});
  
  for (int i = 1;i <= n;i ++) p[i] = i, sz[i] = 1;
  long ans = 0;
  for (auto edge : e)
  {              
    int x = get (edge.x), y = get (edge.y);
    if (x != y) {     
      unite (x, y);
      ans += edge.w;
    }
  }
  cout << ans; 

  return 0;
} 










// Coded by Z...

Measured memory_bytes: 21100
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int a,b,i,count=0,count1=0;
    cin>>a;
    for(i=0;i<a;i++)
    {
        cin>>b;
        if(b%2==0)
        {
            if((b%3==0)||(b%5==0))
                count++;
            count1++;
        }
    }
    if(count1==count)
        cout<<"APPROVED"<<endl;
    else
        cout<<"DENIED"<<endl;
    return 0;
}

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

int main() {
  int N, A;
  cin >> N;
  A = 0;

  for (int i = 0; i < N; i++) {
    int li, ri;
    cin >> li >> ri;
    
    A += ri - li + 1;
  }
  
  cout << A << endl;

}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<string,string> P;
const ll mod=1e9+7;

//C-String Coloring
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    string s;
    cin>>s;
    map<P,ll> cnt;
    ll ans=0;
    rep(i,1<<n){
      string r="",b="";
      rep(j,n){
        if(i&(1<<j)){
          r+=s[j];
        }else{
          b+=s[j];
        }
      }
      cnt[P(r,b)]++;
    }
    rep(i,1<<n){
      string r="",b="";
      rep(j,n){
        if(i&(1<<j)){
          r+=s[n+j];
        }else{
          b+=s[n+j];
        }
      }
      reverse(begin(r),end(r));
      reverse(begin(b),end(b));
      ans+=cnt[P(b,r)];
    }
    cout<<ans<<endl;
}


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

using namespace std;
using ll = long long;

#define REP(i,m,n) for(int (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    int N;
    cin >> N;
    double p;

    if(N % 2 == 1) p = ((N / 2) + 1.0) / N;
    else p = 0.5;

    _PR(p);

    return 0;
}

/*



*/

Measured memory_bytes: 256
let input = require("fs").readFileSync("/dev/stdin", "utf8");
let cin = input.split(/ |\n/), cid = 0;
function next() { return +cin[cid++]; }
//input from catoonさん


class UnionFind {
    p: number[];
    sizes: number[];
    tmpsize: number;
    constructor(n: number) {
        this.p = []
        this.sizes = [];
        for (let i = 0; i < n; i++) {
            this.p.push(i);
            this.sizes.push(1);
        }
        this.tmpsize = n;
    }
    find(x: number) {
        if (this.p[x] === x) {
            return x;
        } else {
            let tmp = this.find(this.p[x]);
            return tmp;
        }
    }
    unite(x: number, y: number) {
        let findx = this.find(x);
        let findy = this.find(y);
        if (findx === findy) return;

        let [large, small] = this.sizes[findx] >= this.sizes[findy] ? [findx, findy] : [findy, findx];

        this.p[small] = large;
        this.sizes[large] += this.sizes[small];
        this.tmpsize--;

    }
    is_same(x: number, y: number) {
        return this.find(x) === this.find(y);
    }
}
function main() {
    let n = next();
    let q = next();
    let uf = new UnionFind(n);
    while (q--) {
        let condition = next();
        let tmp = next();
        let tmp1 = next();
        if (condition === 0) {
            uf.unite(tmp, tmp1);
        }
        else {
            if (uf.is_same(tmp, tmp1)) {
                console.log(1);
            }
            else {
                console.log(0);
            }

        }
    }
    return;
}
main();


Measured memory_bytes: 103860
import heapq
N, M  = map(int, input().split())

q = []  # 締切の小さい順に並べ替え
q1 = [] # するタスクリスト

for i in range(N):
    day, reward = map(int, input().split())
    heapq.heappush(q,(-day,-reward))
# delayは大きい順、rewardは大きい順で並べておく
while q:
    d, r = heapq.heappop(q)
    rest = M - len(q1)
    if rest >= -d:
        # できるリストに追加
        heapq.heappush(q1,-r)
    else:
        # 一番報酬が少ない奴を入れ替え
        heapq.heappush(q1,-r)
        heapq.heappop(q1)
        
print(sum(q1))

Measured memory_bytes: 17088
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  string t[3] = {"Sunny","Cloudy","Rainy"};

  string s; cin >> s;
  for(int i = 0; i < 3; i++){
    if(t[i] == s){
      cout << t[(i+1)%3] << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
import math

n = int(input())
a = list(map(int, input().split()))

gcd_left = []
gcd_right = []
for i in range(n):
    if i == 0:
        gcd_left.append(a[i])
        gcd_right.append(a[n - 1 - i])
    else:
        gcd_left.append(math.gcd(a[i], gcd_left[i - 1]))
        gcd_right.append(math.gcd(a[n - 1 - i], gcd_right[i - 1]))
gcd_right.reverse()

gcd_ex = []
for i in range(n):
    if i == 0:
        gcd_ex.append(gcd_right[i + 1])
    elif i == n - 1:
        gcd_ex.append(gcd_left[i - 1])
    else:
        gcd_ex.append(math.gcd(gcd_left[i - 1], gcd_right[i + 1]))
print(max(gcd_ex))


Measured memory_bytes: 25540
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	a, b, _, k := nextInt(), nextInt(), nextInt(), nextInt()
	if k&1 == 0 {
		puts(a - b)
	} else {
		puts(b - a)
	}
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
#define dbg1(x) cerr<<#x<<"="<<(x)<<" "
#define dbg2(x) cerr<<#x<<"="<<(x)<<"\n"
#define dbg3(x) cerr<<#x<<"\n"
using namespace std;
#define reg register
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
const int MN=705;
int N,M;
bool G[MN][MN],vis[MN],col[MN],f[MN][MN];
int num[2][MN],T;
void dfs(int x)
{
	++num[col[x]][T];vis[x]=true;reg int i;
	for(i=1;i<=N;++i)if(i!=x&&!G[x][i])
	{
		if(!vis[i])col[i]=col[x]^1,dfs(i);
		else if(col[i]==col[x]) {puts("-1");exit(0);}
	}
}
int cal(int x,int y){return (x*(x-1)+y*(y-1))/2;}
int main()
{
	N=read();M=read();
	reg int i,j,x,y;
	for(i=1;i<=M;++i) x=read(),y=read(),G[x][y]=G[y][x]=1;
	for(i=1;i<=N;++i)if(!vis[i])++T,dfs(i);
	f[0][0]=1;
	for(i=0;i<T;++i)for(j=0;j<=N;++j)
		f[i+1][j+num[0][i+1]]|=f[i][j],
		f[i+1][j+num[1][i+1]]|=f[i][j];
	int ans=MN*MN;
	for(i=0;i<=N;++i)if(f[T][i])ans=min(ans,cal(i,N-i));
	return 0*printf("%d\n",ans);
}

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

#define debug(x) cerr<<#x<<'='<<x<<endl
#define set0(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pii;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();ll f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}

char Mp[660][660];


int n;
int main() {
	read(n);
	for(int i=0;i<n;i++){
		cin>>Mp[i];
	}
	int ans = 0;
	for(int a=0;a<n;a++){
		int ad = n;
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				if(Mp[(i+a)%n][j]!=Mp[(j+a)%n][i])ad = 0;
			}
		}
		ans+=ad;
	}
	cout<<ans<<endl;
	return 0;
}


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

int main()
{
    int n, m1 = 0, m2 = 0;
    std::cin >> n;
    std::vector<int> a(n);
    
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        if (a[i] > m1)
            m1 = a[i];
        else if (a[i] > m2)
            m2 = a[i];
    }

    for (int i = 0; i < n; i++) {
        int ans = (m1 == a[i]) ? m2 : m1;
        std::cout << ans << std::endl;
    }

    return 0;
}


Measured memory_bytes: 2432
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int t = sc.nextInt();
		int[] a = new int[t];
		for(int i=0; i<t; i++){
			a[i] = sc.nextInt();
		}
		int max = 0;
		
		for(int i=0; i<t; i++){
			if(a[i] > max){
				max = a[i];
			}
		}
		if(max <= k-max){
			System.out.println(0);
		}else{
			System.out.println(max*2 - k - 1);
		}
		sc.close();
	}

}

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

int main(){
  int N,T;
  cin >> N >>T;
  vector<int> t(N);
  for (int i=0;i<N;i++) cin >> t[i];
  int x=0,start;
  for(int i=1;i<N;i++){
    start = t[i]-t[i-1];
    if(start<=T) x+=start;
    if(start>T) x+=T;
  }
  x += T;
  cout << x << endl;
}
  




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

int main() {
  int r, g, b, sum;
  cin >> r >> g >> b;
  
  sum = 100*r + 10*g + b;
  
  if ( sum % 4 == 0){
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
  
  return 0;
}    

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long N,A,B;
    cin >> N >> A >> B;
    

    long len = A + B;
    if(len <= 0){
        cout << 0 << endl;
        return 0;
    }
    long sum = (N / len)*A;
    sum += (N % len > A)? A : N%len;
    //cout << sum << endl;
    cout << sum << endl;
        
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    ll n, h;
    cin >> n >> h;
    vector<ll> a(n), b(n);
    rep(i,n) cin >> a[i] >> b[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end(),greater<ll>());
    ll a_max = a.back();
    ll cnt = 0;
    rep(i,n) {
        if(b[i] <= a_max) break;
        if(h <= 0) break;
        cnt++;
        h -= b[i];
    }
    while(h>0) {
        cnt++;
        h-=a_max;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 1792
// https://atcoder.jp/contests/abc172/tasks/abc172_b
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S, T;
    cin >> S >> T;
    int cnt = 0;
    REP(i, S.length()) {
        if (S[i] != T[i]) {
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}


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

#define FOR(i,a,b) for(ll i=a; i<b; i++)
#define IN(a) cin>>a
#define OUT(a) cout<<a<<endl

int main(){
 int n;
 cin>>n;
 vector<int> a(n);
 FOR(i,0,n){
   IN(a.at(i));
 }
  int ans=0;
 for(int i=0; i<n; i++){
   if(i%2==0&&a.at(i)%2==1){
     ans++;
   }
 }
  OUT(ans);
}

Measured memory_bytes: 3620
/*
 author : @itzmv
 */
#include<bits/stdc++.h>

#define ll uint64_t
#define lli long long int
using namespace std;


int main()
{
    set < int > s;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        s.insert(x);
    }

    cout << s.size();
    return 0;
}


Measured memory_bytes: 256
/**
*    author:  yuya1234
*    created: 14.07.2020 11:02:45
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define FORV(i,v) for(auto i=v.begin(); i!=v.end();i++)

#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  //std::cout << std::fixed << std::setprecision(15);

  int h,w;
  cin>>h>>w;

  string a[h];
  REP(i,h)cin>>a[i];

  int cnt=0;
  REP(i,h)REP(j,w)
  {
    if(a[i][j]=='#')cnt++;
  }

  if(cnt==h+w-1)cout<<"Possible"<<endl;
  else cout<<"Impossible"<<endl;

  return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
    
  long long n;
  vector<long long> v;
  vector<long long>v1;
  cin >> n;
  for(long long i=1; i<=sqrt(n); ++i){
      if(n%i==0){
          v.push_back(i);
      }
  }
  
  //cout << v[0]
 
 long long a = n/v.back();
 long long b = n/a;
  
    
    cout << a+b-2 << "\n";
  
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
q = int(input())

b, c = [0] * q, [0] * q
for i in range(q):
    b[i], c[i] = map(int, input().split())

cnt = [0] * (10**5 +  5)
for i in range(n):
    cnt[a[i]] += 1

tot = sum(a)

for i in range(q):
    if cnt[b[i]] > 0:
        tot += cnt[b[i]] * (c[i] - b[i])
        cnt[c[i]] += cnt[b[i]]
        cnt[b[i]] = 0
    print(tot)

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

int n, cnt = 0;
vector<int> v;

int main() {
  cin >> n;
  v.resize(n);
  for(int i = 0; i < n; ++i) cin >> v[i];
  for(int i = 0; i < n; ++i)
    for(int j = 1; j < n; ++j)
      if(v[j - 1] > v[j]) {
        swap(v[j - 1], v[j]);
        ++cnt;
      }

  for(int i = 0; i < n; ++i) {
    if(i != 0) cout << " ";
    cout << v[i];
  }
  cout << endl;
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3072
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


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

	while (1){
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0){
			break;
		}
		for (i = 0; i < H; i++){
			for (j = 0; j < W; j++){
				if (i % 2 == 1){
					if (j % 2 == 1){
						putchar('#');
					}
					else {
						putchar('.');
					}
				}

				if (i % 2 == 0){
					if (j % 2 == 0){
						putchar('#');
					}
					else {
						putchar('.');
					}
				}
			}
			putchar('\n');
		}
		putchar('\n');
	}

	return 0;
}

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

int main(void) {
    int mode[100 + 1] = {};
    int a;
    int max;
    
    while(cin >> a) {
        ++mode[a];
    }
    
    max = 0;
    for(int i = 1; i <= 100; ++i) {
        if(mode[i] > max) {
            max = mode[i];
        }
    }
    
    for(int i = 1; i <= 100; ++i) {
        if(mode[i] ==max) {
            cout << i << endl;
        }
    }
}


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<queue>
using namespace std;
using ll = long long;
 
 
struct Corr{
    ll y;
    ll x;
    ll depth;
};
 
ll h,w;
ll y,x,depth;
vector<string> vec;
queue<Corr> q;

vector<ll> y_vec = {0,0,-1,1};
vector<ll> x_vec = {-1,1,0,0};

ll ans;

ll bfs(){
    ans = 0;
    while(!q.empty()){
        Corr now = q.front();
        q.pop();
        y = now.y, x = now.x, depth = now.depth;
 
        for(ll i=0;i<4;i++){
            Corr next = {y + y_vec[i], x + x_vec[i], depth + 1};
            if (0 <= next.y && next.y <= h-1 && 0 <= next.x && next.x <= w-1 && vec[next.y][next.x] == '.') {
                vec[next.y][next.x] = 'x';
                q.push(next);
                ans = max(ans,next.depth);
            }
        }
    }
    return ans;
}
 
int main(){
    cin >> h >> w;
    vec.resize(h);
    for(ll i=0;i<h;i++) cin >> vec[i];
    for(ll i=0;i<h;i++){
        for(ll j=0;j<w;j++){
            if(vec[i][j]=='#'){
                Corr start = {i, j, 0};
                q.push(start);
            }
        }
    }
 
    cout << bfs() << endl;
    return 0;
}

Measured memory_bytes: 25524
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
char N[3][3];
int main() {

	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			cin>>N[i][j];
			if(i==j)cout<<N[i][j];
		}
	}

	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
/*
 Author: LargeDumpling
 Email: LargeDumpling@qq.com
 Edit History:
	2018-02-24	File created.
*/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
char str[20];
int len,sum;
int main()
{
	int ans=0;
	scanf("%s",str+1);
	len=strlen(str+1);
	for(int i=1;i<=len;i++)
	{
		sum+=str[i]-'0';
		if(str[i]-'0')
			ans=max(ans,sum-1+(len-i)*9);
	}
	ans=max(ans,sum);
	printf("%d",ans);
	fclose(stdin);
	fclose(stdout);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,k,h[100001],i,cnt=0;
  scanf("%d%d",&n,&k);
  for(i=0; i<n; i++){
    scanf("%d",&h[i]);
    if(h[i]>=k){
      cnt++;
    }
  }
  printf("%d\n",cnt);
  return 0;

}


Measured memory_bytes: 512
#include<iostream>

using namespace std;


int main(){
//	枚数の入力
	int n;
	cin >> n;

	bool box_S[13] = {false},box_H[13] ={false}, box_C[13] = {false},box_D[13] ={false};

	for(int i = 0;i < n;i++)
	{
		char mark;
		int num;

		cin >> mark >> num;

		switch(mark){
			case 'S':
				box_S[num-1] = true;
				break;
			case 'H':
				box_H[num-1] = true;
				break;
			case 'C':
				box_C[num-1] = true;
				break;
			case 'D':
				box_D[num-1] = true;
				break;
		}
	}

	for(int i = 0; i < 4 ; i++){
		for(int k = 0 ;k < 13 ; k++){
			switch(i){
			case 0:
				if(box_S[k] == false) cout << "S " << k+1 << endl;
				break;
			case 1:
				if(box_H[k] == false) cout << "H " << k+1 << endl;
				break;
			case 2:
				if(box_C[k] == false) cout << "C " << k+1 << endl;
				break;
			case 3:
				if(box_D[k] == false) cout << "D " << k+1 << endl;
				break;
			}
		}
	}

	return 0;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
const int N=2005;
int n,K,q,a[N],Ha[N],hs,tax[N],b[N],c[N];
void Hash(){
	sort(Ha+1,Ha+n+1);
	hs=1;
	for (int i=2;i<=n;i++)
		if (Ha[i]!=Ha[i-1])
			Ha[++hs]=Ha[i];
}
int find(int x){
	int L=1,R=hs,mid;
	while (L<=R){
		mid=(L+R)>>1;
		if (Ha[mid]==x)
			return mid;
		if (x>Ha[mid])
			L=mid+1;
		else
			R=mid-1;
	}
}
int main(){
	scanf("%d%d%d",&n,&K,&q);
	for (int i=1;i<=n;i++)
		scanf("%d",&a[i]),Ha[i]=a[i];
	Hash();
	for (int i=1;i<=n;i++)
		a[i]=find(a[i]);
	int ans=1e9+7;
	for (int t=0;t<=hs;t++){
		int tot=0;
		memset(tax,0,sizeof tax);
		for (int i=1,j=0;i<=n;i=j+1){
			if (a[i]<=t){
				j++;
				continue;
			}
			for (j=i;j<n&&a[j+1]>t;j++);
			for (int k=i;k<=j;k++)
				b[k]=a[k];
			sort(b+i,b+j+1);
			for (int k=i;j-k>=K-1;k++)
				c[++tot]=b[k];
		}
		if (tot<q)
			continue;
		sort(c+1,c+tot+1);
		ans=min(ans,Ha[c[q]]-Ha[c[1]]);
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 384
W,H,N=map(int,input().split())
x_right=W
x_left=0
y_ceil=H
y_floor=0
for i in range(N):
    x,y,a=map(int,input().split())
    if a==1:
        x_left=max(x,x_left)
    elif a==2:
        x_right=min(x,x_right)
    elif a==3:
        y_floor=max(y,y_floor)
    else:
        y_ceil=min(y,y_ceil)
ans=(x_right-x_left)*(y_ceil-y_floor)
if x_left>=x_right or y_ceil<=y_floor:
    ans=0
print(ans)


Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int main()
{
    int n;
    int ans=0;
    cin >> n;
    rep(i,n){
        int l,r;
        cin >> l >> r;
        ans += r-l+1;
    }
    cout << ans << endl;
}


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

using namespace std;

int main(void) {
  int n, x;
  cin >> n >> x;

  int array[200];
  for (int i = 0; i < n; i++) {
    cin >> array[i];
  }

  int counter = 0;
  int calc_array[200];
  for (int i = 0; i < n + 1; i++) {
    if (i == 0) {
      calc_array[i] = 0;
    } else {
      calc_array[i] = calc_array[i - 1] + array[i - 1];
    }

    if (calc_array[i] > x) {
      cout << i << endl;
      return 0;

    } else if (calc_array[i] == x) {
      cout << i + 1 << endl;
      return 0;
    }
  }
  cout << n + 1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int x;
    int h,m,s;
    scanf("%d",&x);
    
    h=x/3600;
    x%=3600;
    
    m=x/60;
    x%=60;
    
    s=x;
    
    printf("%d:%d:%d\n",h,m,s);
    
}


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

const int N = 1e5 + 100, inF = N;

int n, k, ans, out[N], dis[N];
bool mark[N];
vector<int> in[N];

void dfs(int v, bool change = false) {
	mark[v] = change;
	for (int u: in[v]) 
		if(mark[u] == false) {
			dis[u] = dis[v] + 1;
			dfs(u, change);
		}
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> k;
	cin >> out[0];
	ans += (out[0] != 1);
	
	for (int i = 1; i < n; i++) {
		cin >> out[i];
		in[--out[i]].push_back(i);
	}
	dfs(0);
	vector<int> vec(n);
	iota(vec.begin(), vec.end(), 0);
	sort(vec.begin(), vec.end(), [](int a, int b) {
		return dis[a] > dis[b];
	});
	for (int u: vec) {
		if(mark[u] || dis[u] <= k)
			continue;
		for (int i = 0; i < k - 1; i++)
			u = out[u];
		ans++;
		dfs(u, true);
	}
	cout << ans;
	return 0;
}//

Measured memory_bytes: 11648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
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;}

ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};
const ll MAX = 410;
ll H, W;
vector<string> fi;

ll cntb = 0, cntw = 0;
bool visited[MAX][MAX];
void dfs(ll x, ll y) {
    visited[x][y] = true;
    if (fi[x][y] == '#') cntb++;
    else cntw++;

    for (ll dir = 0; dir < 4; dir++) {
        ll nx = x + dx[dir]; 
        ll ny = y + dy[dir];
        if (nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
        if (fi[x][y] == fi[nx][ny]) continue;
        if (visited[nx][ny]) continue;
        dfs(nx, ny);
    }
}


int main() {
    cin >> H >> W;
    fi.resize(H);
    rep(i, 0, H) cin >> fi[i];
    ll ans = 0;
    rep(x, 0, H) {
        rep(y, 0, W) {
            if (fi[x][y] == '.') continue;
            if (visited[x][y]) continue;
            cntb = cntw = 0;
            dfs(x, y);
            ans += cntb * cntw;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 13184
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    ll n; cin >> n;
    vector<tuple<string, ll, ll>> mp;

    rep(i, n){
        string s; ll p; cin >> s >> p;
        mp.push_back(make_tuple(s, -p, i+1));
    }
    sort(all(mp));
    for(auto p: mp) cout << get<2>(p) << endl;
}

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

int main()
{
	int N;
	scanf("%d", &N);
	std::vector<std::vector<int>> edge(N);
	for (int i{}; i < N - 1; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		a--; b--;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	std::vector<int> c(N);
	for (auto& e: c) scanf("%d", &e);
	std::sort(c.rbegin(), c.rend());

	std::vector<int> cost(N, -1);
	int c_i{};
	std::queue<int> q;
	q.push(0);
	while (!q.empty())
	{
		int now{q.front()};
		q.pop();
		cost[now] = c[c_i];
		c_i++;
		for (auto& e: edge[now])
			if (cost[e] < 0)
				q.push(e);
	}
	int64_t sum{};
	for (int i{1}; i < N; i++)
		sum += c[i];
	printf("%lld\n", sum);
	for (int i{}; i < N; i++)
		printf("%d%c", cost[i], i == N - 1? '\n':' ');

	return 0;
}

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

using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <class T, class U>
void chmax(T &a, U b) {
    if (a < b) a = b;
}
template <class T, class U>
void chmin(T &a, U b) {
    if (b < a) a = b;
}

#define rep(i, j, k) for (int i = j; i < k; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 60);

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

    int N, K;
    cin >> N >> K;
    vi d(K);
    vvi a(K);

    vi snuke(N, 0);
    rep(i, 0, K) {
        cin >> d[i];
        vi _a(d[i]);
        rep(j, 0, d[i]) {
            cin >> _a[j];
            _a[j]--;
            snuke[_a[j]]++;
        }
        a[i] = _a;
    }

    int ans = 0;
    rep(i, 0, N) if (snuke[i] == 0) ans++;

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


Measured memory_bytes: 3684
import std.stdio;

void main(){
	int hills[10];
	int tmp;
	foreach(i; 0..10){ scanf("%d", &hills[i]); }

	int i, j;
	for(i = 0; i < hills.length - 1; i++){
		for(j = hills.length - 1; j > i; j--){
			if(hills[j - 1] < hills[j]){
				tmp = hills[j];
				hills[j] = hills[j - 1];
				hills[j - 1] = tmp;
			}
		}
	}
	foreach(e; hills[0..3]){
		writeln(e);
	}
}

Measured memory_bytes: 1048
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define INF 999999999
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define Vecpr vector<pair<lli,lli>>
int main() {
  lli N,A,C=0,B,D=0;
  cin >> N >> A >> B;
  vector<int>P(100,0);
  rep(i,A){
    cin >> C;
    P[C]=1;
  }
  C=0;
  for(int i=B;i<N;i++){
    if(P[i]==1)C++;
  }
  for(int i=B;i>-1;i--){
    if(P[i]==1)D++;
  }
  Out(min(C,D));
}

Measured memory_bytes: 256
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

const int MAX = 510000;
 const int MOD = 1000000007;
 
 long long fac[MAX], finv[MAX], inv[MAX];
 
 // テーブルを作る前処理
 void COMinit() {
     fac[0] = fac[1] = 1;
     finv[0] = finv[1] = 1;
     inv[1] = 1;
     for (int i = 2; i < MAX; i++){
         fac[i] = fac[i - 1] * i % MOD;
         inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
         finv[i] = finv[i - 1] * inv[i] % MOD;
     }
 }
 
 // 二項係数計算
 long long COM(int n, int k){
     if (n < k) return 0;
     if (n < 0 || k < 0) return 0;
     return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
 }
 long long modpow(long long a, long long n) {
      long long res = 1;
      while (n > 0) {
          if (n & 1) res = res * a % MOD;
          a = a * a % MOD;
          n >>= 1;
      }
      return res;
  }
  
 ll inv_mul(ll x, ll y){
     return (x % MOD* modpow(y,MOD-2))%MOD;
 }

int main() {
    COMinit();
    ll n,a,b,c;
    std::cin >>n>> a>>b>>c;
    ll result = 0;
    for (int i = n; i <= 2*n-1; i++) {
        ll xm = COM(i-1,n-1)*(modpow(inv_mul(a,a+b),n)*modpow(inv_mul(b,a+b),i-n)%MOD+modpow(inv_mul(b,a+b),n)*modpow(inv_mul(a,a+b),i-n)%MOD)%MOD;
        result += xm* i %MOD * inv_mul(100,a+b)%MOD;
    }
    std::cout << result%MOD << std::endl;
}


Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a;
  int b;
  int c;
  int d;
  int e;
  cin >> a;
  if(a[0] == a[1] && a[1] == a[2]){
    cout << "Yes" << endl;
  }
      else if(a[1] == a[2] && a[2] == a[3]){
        cout << "Yes" << endl;
      }
      else{
        cout << "No" << endl;
       }
  //cout << a << endl;
}


Measured memory_bytes: 256
from collections import Counter

n = int(input())
A = map(int, input().split())

c = {k: v for k, v in Counter(A).items() if v >= 2}

if len(c) < 2:
    print(0)
    exit()

x = max(c)

if c[x] >= 4:
    print(x * x)
else:
    del c[x]
    y = max(c)
    print(x * y)


Measured memory_bytes: 24224
#include<iostream>
#include<unordered_map>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<unordered_set>

using namespace std;




vector<int> prime_sieve(int n)
{
    int* arr = new int[n+1];
    
    int i, p;
    for (i = 0; i <= n; ++i) {
        arr[i] = i;
    }
    for (i = 2; i <= n; ++i) {
        if (arr[i] != 0) {
            for (p = arr[i] * arr[i]; p <= n; p += arr[i]) {
                arr[p] = 0;
            }
        }
    }
    vector<int> primes;
    for (i = 2; i <= n; ++i) {
        if (arr[i] != 0) {
            primes.push_back(arr[i]);
        }
    }
    return primes;
}

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



int main()
{
    int n, m,flag=0;
    cin >> n >> m;
    vector<string> a(n), b(m);
    
    int i, j, k,l;
    for (i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (i = 0; i < m; ++i) {
        cin >> b[i];
    }

    for (k = 0; k < n; ++k) {
        for (l = 0; l < n; ++l) {
            if (k + m - 1 >= n || l + m - 1 >= n) {
                continue;
            }
            for (i = 0; i < m; ++i) {
                for (j = 0; j < m; ++j) {
                    if (b[i][j] != a[i + k][j + l]) {
                        flag = 1;
                    }
                }
            }
            if (flag == 0) {
                cout << "Yes";
                exit(0);
            }
            flag = 0;
        }
    }

    cout << "No";
    
    
}


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

using namespace std;

int main()
{
    int s;
    cin>>s;
    vector<int> dp(s+1,0);
    int mod = 1e9 + 7;
    dp[0] = 1;
    dp[1] = 0;
    dp[2] = 0;
    for(int i = 3;i<=s;i++)
    {
        int j = 3;
        while(j <= i)
        {
            dp[i] = (dp[i] + dp[i-j]) % mod;
            j++;
        }
    }

    cout<<dp[s]<<"\n";

    return 0;
}

Measured memory_bytes: 3620
import sys
from collections import deque
import copy

from math import *
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def gcd(a, b):
    if a < b:
        z = a
        a = b
        b = z
    while b:
		a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    T = []
    for i in range(N):
        input_raw = read_func().strip().split()
        T.append(int(input_raw[0]))

    T.sort()

    lcm_data = T[0]
    for i in range(1, N):
        lcm_data = lcm(lcm_data, T[i])
    print lcm_data


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

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

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T> inline void chmax(T &a, const T &b) { if ((a) < (b)) (a) = (b); }
template <class T> inline void chmin(T &a, const T &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define divceil(a, b) ((a) + (b)-1) / (b)
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;


int solve() {
    ll n;cin>>n;
    map<pair<char, char>, int> d;
    rep(i, 1, n+1){
        string s = to_string(i);
        d[mp(s[0], s.back())]++;
    }
    dump(d);

    ll ans = 0;
    each(el, d){
        cerrendl;
        char a = el.first.first;
        char b = el.first.second;
        ll c = el.second;
        dump(a, b, c);
        ans += c * d[mp(b, a)];
        dump(ans);
    }
    cout << ans << endl;
    return 0; 
}


int main(){/*{{{*/
    solve();
    check_input();
    return 0;
}/*}}}*/


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
count=0
flag=0
while flag==0:
    for i in range(N):
        if A[i]%2==1:
            flag=1
    if flag==0:
        for i in range(N):
            A[i]=A[i]/2
        count+=1
    else:
        break
print(count)

Measured memory_bytes: 3060
def main():
    n = int(input())
    a_s = [int(input()) for _ in range(n)]
    maximum = max(a_s)
    idx_max = a_s.index(maximum)
    second = max(a_s[:idx_max] + a_s[idx_max+1:])
    for i in range(n):
        if i == idx_max:
            print(second)
        else:
            print(maximum)


if __name__ == '__main__':
    main()

Measured memory_bytes: 14124
#include<stdio.h>
#include<string.h>
int d[95][95],ans=0;
void dfs(int y,int x,int h){
	d[y][x]=0;
	if(d[y+1][x]==1)dfs(y+1,x,h+1);
	if(d[y][x+1]==1)dfs(y,x+1,h+1);
	if(d[y-1][x]==1)dfs(y-1,x,h+1);
	if(d[y][x-1]==1)dfs(y,x-1,h+1);
	if(h>ans)ans=h;
	d[y][x]=1;
}
int main(){
	int m,n,i,j;
	FILE *fp;
	//fp=fopen("test.txt","r");
	fp=stdin;
	while(1){
		fscanf(fp,"%d%d",&m,&n);
		if(m==0 && n==0)break;
		ans=0;
		memset(d,0,sizeof(d));
		for(i=1;i<=n;i++){
			for(j=1;j<=m;j++){
				fscanf(fp,"%d",&d[i][j]);
			}
		}
		for(i=0;i<n;i++)for(j=0;j<m;j++)if(d[i][j]==1)dfs(i,j,1);
		printf("%d\n",ans);
	}
	fclose(fp);
	return 0;
}

Measured memory_bytes: 0
K, X = map(int, input().split())
start = (X - (K - 1))
end = (X + (K - 1))
upper = 1000000
lower = -1000000

if start < lower:
    start = lower

if end > upper:
    end = upper

print(' '.join([str(n) for n in range(start, end + 1)]))

Measured memory_bytes: 38384
#include <iostream>
#include <array>
#include <cmath>

using namespace std;

static void inputArray(int A[], int num) {
  for (int i = 0; i < num; i++) {
    cin >> A[i]; 
  }
}

static bool isPrime(int x) {
  if (x == 2) {
    return true;
  }
  
  if (x < 2 || x % 2 == 0) {
    return false;
  }
  
  int i = 3;
  while (i <= static_cast<int>(sqrt(x))) {
    if (x % i == 0) {
      return false;
    }
    i += 2;
  }
  return true;
}

int main() {
  int n;
  cin >> n;
  
  array<int, 10000> A;
  inputArray(&A[0], n);

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

  return 0;
}



Measured memory_bytes: 3152
n = int(input())
array = input().split()
for i in range(n):
  array[i] = int(array[i])
alice = 0
bob = 0
array.sort(reverse=True)
for i in range(n):
  if(i%2==0):
    alice += array[i]
  else:
    bob += array[i]
z = alice - bob
print(z)

Measured memory_bytes: 3060
(defun b (n &optional (stack nil))
  (if (= n 0)
      (reduce #'+ (sort stack #'<))
      (let* ((line (read-line))
             (px (multiple-value-list (read-from-string line)))
             (x (car px))
             (u (read-from-string line t nil :start (cadr px))))
        (cond  
          ((eq u 'JPY) (b (1- n) (cons x stack)))
          ((eq u 'BTC) (b (1- n) (cons (* x 380000.0d0) stack)))))))
    
(format t "~,8F~%"  (b (parse-integer (read-line))))


Measured memory_bytes: 12260