akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(){
    string s;
    int flag=0;
    cin >> s;

    if (s[0]==s[1] && s[2]==s[3] && s[0]!=s[2] ||
        s[0]==s[2] && s[1]==s[3] && s[0]!=s[1] ||
        s[0]==s[3] && s[1]==s[2] && s[0]!=s[1]){
        flag = 1;
    }
    cout << (flag==1 ? "Yes" : "No") << endl; 
}

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

int main(){
    const double PI=3.1415926535897932;
    double r;
    cin >> r;
    cout << fixed << setprecision(6) << r*r*PI << " "  << 2*r*PI  << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/


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

typedef long long lli;

struct data{
  int n,time;
  lli cost;
};

int n;
data v[100];

void solve(){
  lli dp[2][1<<16];
  fill(dp[0], dp[2], 0);

  for(int i=0;i<n;i++){
    for(int k=0;k<(1<<16);k++){
      if((k & v[i].time) != 0) continue;
      lli &next = dp[1][k|v[i].time];
      next = max(next, dp[0][k] + v[i].cost);
    }
    for(int j=0;j<(1<<16);j++) dp[0][j] = dp[1][j];
  }
    
  lli ans = 0;
  for(int i=0;i<(1<<16);i++) ans = max(ans,dp[1][i]);
  cout << ans <<endl;
}
  
int main(){
  while(cin >> n && n){
    for(int i=0;i<n;i++){
      cin >> v[i].n >> v[i].cost;
      v[i].time = 0;
      for(int j=0;j<v[i].n;j++){
	int s,e;
	cin >> s >> e;
	for(int k=0;k<e-s;k++) v[i].time |= 1 << (s - 6 + k);
      }
    }
    solve();
  }
}

Measured memory_bytes: 2188
//ITP1-8-D: Ring
//2019.05.19

#include <stdio.h>
#include <string.h>

int main(void){
  char s[101], p[101];
  char q[201] = {'\0'};
  char *pointa;

  scanf("%s\n%s\n", s, p);
  strcat(q, s);
  strcat(q, s);
  pointa = strstr(q, p);
  if (pointa != NULL) {
    printf("Yes\n");
  }else{
    printf("No\n");
  }

  return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <vector>

using namespace std;

int main()
{
	map<string, vector<int> > index;
	vector<string> strv;
	string s;
	int p;
	
	while (cin >> s >> p){
		if (index.find(s) == index.end()){
			strv.push_back(s);
		}
		index[s].push_back(p);
	}
	sort(strv.begin(), strv.end());
	for (int i = 0; i < strv.size(); i++){
		sort(index[strv[i]].begin(), index[strv[i]].end());
		cout << strv[i] << endl;
		cout << index[strv[i]][0];
		for (int j = 1; j < index[strv[i]].size(); j++){
			cout << ' ' << index[strv[i]][j];
		}
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1248
#include "bits/stdc++.h"

#define ll long long

using namespace std;

const ll INF = 1e18;

ll tt, n, a, b, c, d;
map<ll, ll> m;
ll f(ll x){
    // cout << x << "\n";
    if(x == 0){
        return 0;
    }
    ll cur = INF;
    if(m.find(x) != m.end()){
        return m[x];
    }
    if(x >= 2){
        if(x%2){
            cur = min(cur, f(x/2) + a + d);
            cur = min(cur, f(x/2 + 1) + a + d);
        }
        else cur = min(cur, f(x/2) + a);
    }
    if(x >= 3){
        if(x%3){
            cur = min(cur, f(x/3) + b + (d * (x%3)));
            cur = min(cur, f(x/3 + 1) + b + (3 - (x%3)) * d);
        }
        else cur = min(cur, f(x/3) + b);
    }
    if(x >= 5){
        if(x%5){
            cur = min(cur, f(x/5) + c + (d * (x%5)));
            cur = min(cur, f(x/5 + 1) + c + (5 - (x%5)) * d);
        }
        else cur = min(cur, f(x/5) + c);
    }
    if(x == 1) assert(cur == INF);
    if(x <= 1e9 || x * d > d){
        cur = min(cur, d * x);
    }
    m[x] = cur;
    return cur;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> tt;
    while(tt--){
        cin >> n >> a >> b >> c >> d;
        m.clear();
        cout << f(n) << "\n";
    }
    return 0;
}

Measured memory_bytes: 4360
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

const int MOD=1e9+7;
const int MAX=100010;

int prenum[MAX];
int parent[MAX];
int lowest[MAX];
bool visited[MAX];
vector<int> G[MAX];
int v,e;
int n=1;

void dfs(int u,int prev){
  prenum[u]=n;
  lowest[u]=n;
  n++;
  visited[u]=true;
  for(int x:G[u]){
    if(visited[x]==false){
      parent[x]=u;
      dfs(x,u);
      lowest[u]=min(lowest[u],lowest[x]);
    }
    else if(x!=prev){
      lowest[u]=min(lowest[u],prenum[x]);
    }
  }
}

int main(){
  cin>>v>>e;
  
  int s,t;
  rep(i,e){
    cin>>s>>t;
    G[s].push_back(t);
    G[t].push_back(s);
  }
  
  dfs(0,-1);
  
  int A[MAX];
  int cnt=0;
  for(int i=1;i<v;i++){
    if(parent[i]==0) cnt++;
    else if(prenum[parent[i]]<=lowest[i]) A[parent[i]]=1;
  }
  if(cnt>1) A[0]=1;
  
  rep(i,v){
    if(A[i]==1) cout<<i<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 6856
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<ll,pll> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vl a;
vvl g,dp[2];

int dfs(int v,int p){
	int S=1;
	for(auto u:g[v]) if(u!=p){
		int T=dfs(u,v);
		vl DP[2];
		DP[0]=DP[1]=vl(S+T,INF);
		for(int i=0;i<S;i++) for(int j=0;j<T;j++) for(int t=0;t<4;t++){
			int x=t/2,y=t%2;
			DP[x|y][i+j]=min(DP[x|y][i+j],dp[x][v][i]+dp[y][u][j]);
			if(y==0&&dp[y][u][j]<INF||dp[y][u][j]<0) DP[x][i+j+1]=min(DP[x][i+j+1],dp[x][v][i]);
		}
		dp[0][v]=DP[0];dp[1][v]=DP[1];
		S+=T;
	}
	return S;
}

int main(){
	cin>>n;
	a=vl(n);
	dp[0]=dp[1]=g=vvl(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
		dp[(a[i]<0?1:0)][i].push_back(a[i]);
		dp[(a[i]<0?0:1)][i].push_back(INF);
	}
	for(int i=1;i<n;i++){
		int u,v;
		cin>>u>>v;
		u--;v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs(0,-1);
	for(int i=0;i<n;i++) if(dp[0][0][i]<INF||dp[1][0][i]<0){
		cout<<i<<endl;
		return 0;
	}
}

Measured memory_bytes: 204800
# 解説放送
k = int(input())
a = [i+1 for i in range(9)]


while 1:
    if k <= len(a):
        print(a[k-1])
        exit()
    k -= len(a)
    old = []
    a, old = old, a
    for x in old:
        for i in range(-1, 2):
            d = x % 10 + i
            if d < 0 or d > 9: continue
            nx = x*10 + d
            a.append(nx)

Measured memory_bytes: 11028
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
  long long n,m;
  long long ans;

  scanf(" %lld %lld",&n,&m);

  if(n*2<=m){
    ans=n;
    m-=n*2;
    ans+=m/4;
  }else{
    ans=m/2;
  }

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

  return 0;
}

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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
        String line = br.readLine();
        String[] lineArray = line.split(" ");
        int H = Integer.parseInt(lineArray[0]);
        int W = Integer.parseInt(lineArray[1]);

        char[][] campus = new char[H + 2][W + 2];

        for (int i = 1; i < H+1; i++) {
            line = br.readLine();
            for (int j = 1; j < W+1; j++) {
                campus[i][j] = line.charAt(j-1);
            }
        }

        String result = "Yes";
        for (int i = 1; i < H+1; i++) {
            for (int j = 1; j < W+1; j++) {
                if( !(campus[i-1][j] == '#' || campus[i][j-1] == '#' || campus[i][j+1] == '#' || campus[i+1][j] == '#' ) && campus[i][j] == '#' ){
                    result = "No";
                    break;
                }
            }
        }

        System.out.println(result);

    }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#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 rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll H, W;
    cin >> H >> W;
    ll ans = __LONG_LONG_MAX__;
    
    rep(n, 2) {
        ll t = ((n == 0) ? H : W);
        ll y = ((n == 0) ? W : H);
        ll h[3];
        ll area[3];
        
        h[0] = t / 3;
        h[1] = (t - h[0]) / 2;
        h[2] = t - h[0] - h[1];
        rep(i, 3) area[i] = h[i] * y;
        sort(area, area + 3);
        ans = min(ans, area[2] - area[0]);
        
        reps(i, 1, t) {
            area[0] = y * i;
            area[1] = (y / 2) * (t - i);
            area[2] = (y - y / 2) * (t - i);
            sort(area, area + 3);
            ans = min(ans, area[2] - area[0]);
        }
    }
    
    cout << ans << endl;
    return 0;
}


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

int main(){
  ll n, k;
  cin >> n >> k;
  
  vector<ll> h(n);
  for(ll i=0; i<n; i++) cin >> h[i];
  sort(h.rbegin(), h.rend());
  
  
  for(ll i=0; i<k; i++){
    h[i] = 0;
    if(i+1==n) break;
  }
  
  ll sum = 0;
  cout << accumulate(h.begin(), h.end(), sum) << endl;
  
  return 0;
}

Measured memory_bytes: 4860
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define rt return 0
#define endln "\n"
#define all(v) v.begin(), v.end()
#define for1(i, a, b) for (long long int i = a; i < b; i++)
#define for2(i, a, b) for (long long int i = a; i > b; i--)
//  cout << fixed << setprecision(0) << pi <<" "<<npi<<endl;typedef long long int i;
typedef long long int lli;
typedef pair<lli, lli> pll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli t = 0;
    string s1, s2;
    cin >> s1 >> s2;
    vector<lli> v;
    for1(i, 0, s1.length())
    {
        if (s1[i] != s2[i])
        {
            t += 1;
        }
    }
    cout << t << endl;
}

Measured memory_bytes: 3836
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);

		while (true) {
			int n = sc.nextInt();
			if (n == 0) {
				break;
			}

			int[] x = new int[n];
			int[] y = new int[n];
			x[0] = y[0] = 0;

			/*
			 * テ・ツキツヲテ・ツ?エ(= 0)テッツシツ古、ツクツ凝・ツ?エ (= 1)テッツシツ古・ツ渉ウテ・ツ?エ (= 2)テッツシツ古、ツクツ甘・ツ?エ (= 3)
			 */
			int l, r, t, b;
			l = r = t = b = 0;

			for (int i = 1; i < n; i++) {
				int p = sc.nextInt();
				int q = sc.nextInt();

				x[i] = x[p];
				y[i] = y[p];

				if (q == 0) x[i]--;
				if (q == 1) y[i]--;
				if (q == 2) x[i]++;
				if (q == 3) y[i]++;
				l = Math.min(l, x[i]);
				r = Math.max(r, x[i]);
				t = Math.max(t, y[i]);
				b = Math.min(b, y[i]);
			}

			System.out.println((r - l + 1) + " " + (t - b + 1));
		}
	}

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

Measured memory_bytes: 34884
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
 
class Program
{
    static void Main()
    {
        string[] inputs = Console.ReadLine().Split(' ');
        int H = int.Parse(inputs[0]);
        int W = int.Parse(inputs[1]);
        long result = 0;
        if (!(H % 3 == 0 || W % 3 == 0))
        {
            result = Math.Min(SearchMinimumDifference(H, W), SearchMinimumDifference(W, H));
            result = Math.Min(result, Math.Min(H, W));
        }
        Console.WriteLine(result);
    }

    static long SearchMinimumDifference(int H, int W)
    {
        long separatePoint = W / 3;
        long difference = long.MaxValue;
        bool isIncrease = true;
        do
        {
            long newDifference = CalculateDifference(H, W, separatePoint);
            Console.Error.WriteLine(": {0}", newDifference);
            if (difference > newDifference)
            {
                difference = newDifference;
                if (isIncrease) separatePoint++;
                else separatePoint--;
            }
            else if (isIncrease) isIncrease = false;
            else break;
        } while (separatePoint > 0 && separatePoint <= W / 2);
        return difference;
    }

    static long CalculateDifference(int H, int W, long separatePoint)
    {
        long[] areas = new long[3];
        areas[0] = H * separatePoint;
        long H2 = H / 2, W2 = W - separatePoint;
        areas[1] = H2 * W2;
        areas[2] = (H - H2) * W2;
        Console.Error.WriteLine(string.Join(" ", areas));
        return areas.Max() - areas.Min();
    }
}


Measured memory_bytes: 13396
// ConsoleApplication3.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include "bits/stdc++.h"

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

using namespace std;

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

	if (n % 2 == 0) {
		cout << n << endl;
	}
	else {
		cout << n * 2 << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

int main(){
	int N;
	cin >> N;
	vll H(N);
	for(int i=0; i<N; i++){
		cin >> H[i];
	}
	string ans="Yes";

	if(H[0]>1){
		H[0]-=1;
	}

	for(int i=1; i<N; i++){
		if(i==N-1){
			if(H[i-1]>H[i]){
				ans="No";
				break;
			}
		}else{
			if(H[i-1]<H[i]){
				H[i]-=1;
			}else if(H[i-1]>H[i]){
				ans="No";
				break;
			}
		}
	}

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

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 998244353
#define INF 93193111451418101
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

ll gcd(ll a, ll b) {
  if (a == 0 || b == 0) {
    return 0;
  }
  while (a % b) {
    a = a % b;
    swap(a, b);
  }
  return b;
}

int main() {
  ll t;
  cin >> t;
  REP(k, t) {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    if (b > d || b > a || (c < a % b)) {
      cout << "No" << endl;
      continue;
    }
    if (c + 1 >= b || b == d) {
      cout << "Yes" << endl;
      continue;
    }
    ll z = a % b;
    ll g = gcd(b, d);

    if ((b - 1 - z) == (c + 1 - z)) {
      if ((b - 1 - z) % g == 0) {
        cout << "No" << endl;
      } else {
        cout << "Yes" << endl;
      }
    } else if ((b - 1 - z) / g > (c + 1 - z) / g || (c + 1 - z) % g == 0) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }
}
/*
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
Yes
Yes
Yes
No
No
No


No
No
No
No
No
No
Yes
Yes
No
No
No
No
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
No
No
No
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL  = long long;
using VI  = vector<LL>;
using VVI = vector<VI>;
using VB  = vector<bool>;
using VS  = vector<string>;
using PII = pair<LL, LL>;
using VP  = vector<PII>;
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FSORT(c)     stable_sort(ALL(c), [] (auto& x, auto& y) {return x.first < y.first;});
#define FRSORT(c)    stable_sort(ALL(c), [] (auto& x, auto& y) {return x.first > y.first;});
#define SSORT(c)     stable_sort(ALL(c), [] (auto& x, auto& y) {return x.second < y.second;});
#define SRSORT(c)    stable_sort(ALL(c), [] (auto& x, auto& y) {return x.second > y.second;});
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define $(x) {cout << #x << " = " << (x) << endl;}


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

    LL ans = 0;
    LL l = 0, r = SZ(s) - 1;
    while (l < r) {
        if (s[l] == s[r]) {
            l++;
            r--;
        } else if (s[l] == 'x') {
            ans++;
            l++;
        } else if (s[r] == 'x') {
            ans++;
            r--;
        } else {
            ans = -1;
            break;
        }
    }

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


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

int dp[100010];

int main(){
  int n; cin>>n;
  vector<int> h(n);
  for(int i=0;i<n;i++)cin>>h[i];
  dp[0]=0;
  dp[1]=abs(h[0]-h[1]);
  for(int i=2;i<n;i++){
    dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]), dp[i-2]+abs(h[i]-h[i-2]));
  }
  
  cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

#define H 250

int main(){
  int A[H], n, i;
  
  scanf("%d",&n);

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

    scanf("%d",&A[i]);
  }
  for(i=1 ; i<=n ; i++){
    printf("node %d: key = %d, ", i, A[i]);

    if(i/2 != 0)printf("parent key = %d, ",A[i/2]);
    if(2*i <= n)printf("left key = %d, ",A[2*i]);
    if(2*i+1 <= n)printf("right key = %d, ",A[2*i+1]);

    printf("\n");
  }

  
  
  return 0;
}



Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define ll long long
#define INF 2147483647
const int Max=1e2+20;
const int mod=1e9+7;
const ll M=1e9;
using namespace std;
inline int read()
{
    int f=1,x=0;char ch;
    do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
    do{x=x*10+ch-'0';ch=getchar();}while(ch>='0'&&ch<='9');return x*f;
}
int a[Max],b[Max];
int main()
{
    int n;
    int cnt=0;
    cin>>n;
    string ans="No";
    for(int i=1;i<=n;i++)
    {a[i]=read(),b[i]=read();}
    for(int i=1;i<=n;i++)
    {
        if(a[i]==b[i]) cnt++;
        else cnt=0;
        if(cnt==3) ans="Yes";
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  int p, q, r, t;
  cin >> p >> q >> r;
  
  if(p+q >= q+r && p+r >= q+r)
    t = q + r;
  else if(q+r >= p+q && p+r >= p+q)
    t = p + q;
  else
    t = p + r;
  
  cout << t << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,j;
  int pt1=0,pt2=0;
  int ans;
  int n,m,x;
  scanf("%d%d%d",&n,&m,&x);
  int a[m];
  for(i=0;i<m;i++){
    scanf("%d",&a[i]);
  }
  for(i=x;i<n;i++){
    for(j=0;j<m;j++){
      if(i==a[j]){
        pt1++;
        j=m;
      }
    }
  }
  for(i=x;i>0;i--){
    for(j=0;j<m;j++){
      if(i==a[j]){
        pt2++;
        j=m;
      }
    }
  }
  if(pt1<pt2){
    printf("%d\n",pt1);
  }
  else{
    printf("%d\n",pt2);
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if ((a * b) % 2 == 0) {
			System.out.println("Even");
		} else {
			System.out.println("Odd");
		}
		sc.close();
	}
}

Measured memory_bytes: 22996
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
int R;
int main()
{
    cin >> R;
    if(R<1200)
        cout << "ABC" << endl;
    else if(R<2800)
        cout << "ARC" << endl;
    else
        cout << "AGC" <<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <climits>
#include <tuple>
#include <unordered_map>

using namespace std;

typedef long long ll;

ll min_cost(vector<ll>& S, vector<ll>& T, ll xi, int A, int B) {
  ll qi = xi;
  ll cost1 = 1e11, cost2 = 1e11;
  auto lb1 = lower_bound(S.begin(), S.end(), qi);
  if (lb1 !=  S.end()) {
    ll db1 = distance(S.begin(), lb1);
    // cout << db1 << " S[db1]=" << S[db1] << endl;
    auto lb2 = lower_bound(T.begin(), T.end(), S[db1]);
    ll db2 = distance(T.begin(), lb2);
    // cout << db2 << " T[db2]=" << T[db2] << endl;
    if (db2 >= 0 && db2 < T.size()) {
      cost1 = abs(qi - S[db1]) + abs(S[db1] - T[db2]);
    } else {
      cost1 = 1e11;
    }
    auto lb3 = upper_bound(T.begin(), T.end(), S[db1]) - 1;
    ll db3 = distance(T.begin(), lb3);
    // cout << db3 << " T[db3]=" << T[db3] << endl;
    if (db3 >= 0 && db3 < T.size()) {
      cost2 = abs(qi - S[db1]) + abs(S[db1] - T[db3]);
    } else {
      cost2 = 1e11;
    }
  }

  ll cost3 = LONG_MAX, cost4 = LONG_MAX;
  lb1 = upper_bound(S.begin(), S.end(), qi);
  if (lb1 !=  S.begin()) {
    ll db1 = distance(S.begin(), lb1) - 1;
    cost3 = cost4 = abs(qi - S[db1]);
    // cout << db1 << " S[db1]=" << S[db1] << endl;

    // R
    auto lb2 = lower_bound(T.begin(), T.end(), S[db1]);
    ll db2 = distance(T.begin(), lb2);
    // cout << db2 << " S[db2]=" << S[db2] << endl;
    if (db2 >= 0 && db2 < T.size()) {
      cost3 += abs(S[db1] - T[db2]);
    } else {
      cost3 = LONG_MAX;
    }

    // L
    auto lb3 = upper_bound(T.begin(), T.end(), S[db1]) - 1;
    ll db3 = distance(T.begin(), lb3);
    if (db3 >= 0 && db3 < T.size()) {
      // cout << db3 << " S[db3]=" << S[db3] << endl;
      cost4 += abs(S[db1] - T[db3]);
    } else {
      cost4 = LONG_MAX;
    }
  }
  // cout << cost1 << " " << cost2 << " " << cost3 << " " << cost4 << endl;
  return min(cost1, min(cost2, min(cost3, cost4)));
}


int main(void) {
  int A, B, Q; cin >> A >> B >> Q;
  vector<ll> S(A);
  vector<ll> T(B);
  vector<ll> X(Q);
  for (int i = 0; i < A; i++) { cin >> S[i]; }
  for (int i = 0; i < B; i++) { cin >> T[i]; }
  for (int i = 0; i < Q; i++) { cin >> X[i]; }
  // sort(S.begin(), S.end());
  // sort(T.begin(), T.end());

  for (int i = 0; i < Q; i++) {
    ll mc1 = min_cost(S, T, X[i], A, B);
    ll mc2 = min_cost(T, S, X[i], A, B);
    // cout << mc1 << " " << mc2 << endl;
    cout << min(mc1, mc2) << endl;
  }
}


Measured memory_bytes: 3712
from bisect import bisect_left, insort
def main():
    n = int(input())
    s = list(input().rstrip())
    q = int(input())
    ans = []
    al = [[] for _ in range(26)]
    for i, c in enumerate(s):
        al[ord(c) - ord("a")].append(i)
    for _ in range(q):
        x, y, z = map(str, input().rstrip().split())
        if x == "1":
            y = int(y) - 1
            if s[y] == z:
                continue
            p = bisect_left(al[ord(s[y])-ord("a")],y)
            al[ord(s[y])-ord("a")].pop(p)
            insort(al[ord(z)-ord("a")],y)
            s[y] = z
        else:
            y = int(y) - 1
            z = int(z)
            cnt = 0
            for i in range(26):
                index = bisect_left(al[i], y)
                if index < len(al[i]) and al[i][index] < z:
                    cnt += 1
            ans.append(cnt)
    for v in ans:
        print(v)

if __name__ == "__main__":
    main()

Measured memory_bytes: 30216
typedef long long L;L D(L x,L y){return y?D(y,x%y):x;}L M(L x,L y){return x/D(x,y)*y;}r,v;C(a,m){for(r=1,v=a%m;v!=1;r++)v=v*a%m;return r;}main(a,m,b,n,c,o){for(;~scanf("%d%d%d%d%d%d",&a,&m,&b,&n,&c,&o);)a&&printf("%lld\n",M(M(C(a,m),C(b,n)),C(c,o)));}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <cmath>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
using ull =unsigned long long;
const ll INF =1001001001;
const double PI = 3.14159265358979323846;
//10億7。　　　100000007

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}


int main(){
cout<<fixed<<setprecision(10);
//cin.tie(0); ios::sync_with_stdio(false);

ll N;
  cin>>N;
  vector<ll> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec[i];
  }
  
  ll counter=0;
  for(int i=0;i<N;i++){
    if((i+1)%2==1&&vec[i]%2==1){
      counter++;
    }
  }
  cout<<counter<<endl;
  
}



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

int main(){
  int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int k;
  cin >> k;
  cout << a[k-1] << endl;
  return 0;
}


Measured memory_bytes: 256
import sys

for line in sys.stdin:
    x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.split())
    AB = [x2-x1, y2-y1]
    BP = [xp-x2, yp-y2]
    BC = [x3-x2, y3-y2]
    CP = [xp-x3, yp-y3]
    CA = [x1-x3, y1-y3]
    AP = [xp-x1, yp-y1]
    c1 = AB[0] * BP[1] - AB[1] * BP[0]
    c2 = BC[0] * CP[1] - BC[1] * CP[0]
    c3 = CA[0] * AP[1] - CA[1] * AP[0]
    if (c1>0 and c2>0 and c3>0) or (c1<0 and c2<0 and c3<0):
        print 'YES'
    else:
        print 'NO'

Measured memory_bytes: 6408
use std::io;

fn main() {
    let _n = get_num();
    let v = read_line();

    for i in v {
        if i % 2 == 1 { continue; }
        if i % 2 == 0 && (i % 3 == 0 || i % 5 ==0) { continue; } else { return println!("DENIED"); }
    }
    println!("APPROVED");
}

fn read_line() -> Vec<i32> {

    let input_str = get_input();
    let vec: Vec<&str> = input_str.trim().split_whitespace().collect();

    let mut int_vec: Vec<i32> = Vec::new();
    for v in vec {
        int_vec.push(to_i(v));
    }

    int_vec
}

fn get_num() -> i32 {
    to_i(&get_input())
}

fn to_i(s: &str) -> i32 {
    let input_num: i32 = match s.trim().parse() {
        Ok(num) => num ,
        Err(_)  => panic!("input wrong number."),
    };
    input_num
}

fn get_input() -> String {
    let mut input_str = String::new();
    io::stdin().read_line(&mut input_str)
        .expect("Failed to read line")
        ;
    input_str
}


Measured memory_bytes: 4352
#include<stdio.h>
#define NUM 1000000
void QSort(int x[ ], int left, int right);
void Swap(int x[ ], int i, int j);

int main(){
    int n;
    int d[NUM],tmp,ad,cnt1=0,cnt2=0,num;

    scanf("%d",&n);
    for(int i = 0;i<n;i++){
        scanf("%d",&d[i]);
    }

    if(n % 2 != 0){
        printf("0\n");
        return 0;
    }

    QSort(d, 0, n-1);

    // printf("sort>>");
    // for(int i = 0;i<n;i++){
    //     printf("%d ",d[i]);
    // }
    // putchar('\n');
    ad = n/2;
    tmp = d[ad];

    for(int i = 0;i<n;i++){
        if(tmp > d[i]){
            cnt1++;
        }else if(tmp <= d[i]){
            cnt2++;
        }
    }
    num = d[ad]-d[ad-1];
    // printf("d[ad]:%d - d[ad-1]:%d = num:%d\n",d[ad],d[ad-1],num);
    if(cnt1 == cnt2){
        printf("%d\n",num);
    }else{
        printf("0\n");
    }
    return 0;
    

}

void QSort(int x[ ], int left, int right)
{
    int i, j;
    int pivot;

    i = left;                      /* ソートする配列の一番小さい要素の添字 */
    j = right;                     /* ソートする配列の一番大きい要素の添字 */

    pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */

    while (1) {                    /* 無限ループ */

        while (x[i] < pivot)       /* pivot より大きい値が */
            i++;                   /* 出るまで i を増加させる */

        while (pivot < x[j])       /* pivot より小さい値が */
            j--;                   /*  出るまで j を減少させる */
        if (i >= j)                /* i >= j なら */
            break;                 /* 無限ループから抜ける */

        Swap(x, i, j);             /* x[i] と x[j]を交換 */
        i++;                       /* 次のデータ */
        j--;
    }

    if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
        QSort(x, left, i - 1);     /* 左の配列を Q ソートする */
    if (j + 1 <  right)            /* 基準値の右に 2 以上要素があれば */
        QSort(x, j + 1, right);    /* 右の配列を Q ソートする */
}

void Swap(int x[ ], int i, int j)
{
    int temp;

    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
#define MAX_N 8

bool is_same_perm(int N, int *perm1, int *perm2) {
    bool is_same_perm = true;
    for (int i = 0; i < N; i++) {
        if (perm1[i] != perm2[i]) {
            is_same_perm = false;
        }
    }
    return is_same_perm;
}

int main() {
    int N, P[MAX_N], Q[MAX_N];
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> P[i];
    }
    for (int i = 0; i < N; i++) {
        cin >> Q[i];
    }

    int perm[MAX_N];
    for (int i = 0; i < N; i++) {
        perm[i] = i + 1;
    }

    int a, b;
    int count = 0;
    do {
        count++;
        if (is_same_perm(N, perm, P)) {
            a = count;
            // printf("a = %d\n", a);
        }
        if (is_same_perm(N, perm, Q)) {
            b = count;
            // printf("b = %d\n", b);
        }
    } while (next_permutation(perm, perm + N));
    cout << fabs(a - b) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int compare_int(const void *a, const void *b)
{
    return *(int *)b - *(int *)a;
}

int main(void)
{
    int ans = 0;
    int n;

    scanf("%d", &n);
    int a[n];
    int sort[n];
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        sort[i] = a[i];
    }

    qsort(sort, n, sizeof(int), compare_int);
    if (sort[0] == sort[1])
        for (int i = 0; i < n; i++)
            printf("%d\n", sort[0]);
    else
        for (int i = 0; i < n; i++)
            if (a[i] == sort[0])
                printf("%d\n", sort[1]);
            else
                printf("%d\n", sort[0]);

    return 0;
}

Measured memory_bytes: 3120
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int n,a[200],b[11][200],cnt[20],x[20];
long long ans=1,ans2=1;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
	{
		for(int j=a[i]-1;j<=a[i]+1;j++)
		{
			b[i][++cnt[i]]=j;
		}
	}
	for(int i=1;i<=n;i++) ans=ans*(long long)cnt[i];
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=cnt[i];j++)
		{
			if((b[i][j]%2)!=0)
			{
				x[i]++;
			}
		}
	}
	for(int i=1;i<=n;i++) ans2=ans2*(long long)x[i];
	ans=ans-ans2;
	cout<<ans;
}

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

int main() {
	vector<int> vec; int an, set; bool check;
	cin >> an; vec.resize(an);
	for (int i = 0; i < an; i++) cin >> vec[i];
	check = false;
	for (int i = 0; i < an - 1; i++)
		if (vec[i] > vec[i + 1]) { check = true; break; }
	prev_permutation(vec.begin(), vec.end()); set = 0;
	if (check == true) {
		for (int i : vec) cout << (set++ ? " " : "") << i;
		cout << endl;
	}
	next_permutation(vec.begin(), vec.end()); set = 0;
	for (int i : vec) cout << (set++ ? " " : "") << i;
	cout << endl; check = false;
	for (int i = 0; i < an - 1; i++)
		if (vec[i] < vec[i + 1]) { check = true; break; }
	next_permutation(vec.begin(), vec.end()); set = 0;
	if (check == true) {
		for (int i : vec) cout << (set++ ? " " : "") << i;
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3120
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <iostream>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <iterator>
#include <cmath>

using namespace std;

int main()
{
    //freopen("in", "r", stdin);
    //freopen("out", "w", stdout);

    int n, i;
    scanf("%d", &n);

    list<int> l;
    for(i = 0; i < n; i++)
    {
        int a;
        scanf("%d", &a);
        if(i % 2 == 0)
            l.push_back(a);
        else
            l.push_front(a);
    }

    if(n % 2 == 1)
        l.reverse();

    for(int a : l)
        printf("%d ", a);
    puts("");
    return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

int main() {
  in(ll, k);
  ll sum = 0;
  ll x = 7;
  for (int i = 0; i < k + 1; ++i) {
    sum = (sum + x) % k;
    if (sum == 0) {
      out(i + 1);
      return 0;
    }
    x = x * 10 % k;
  }
  out(-1);
}

Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<map>
int v1[15];
int v2[15];
int v3[15];
int main(){
    int l1,l2,l3;
    char s1[15];
    char s2[15];
    char s3[15];
    scanf("%s",s1);
    scanf("%s",s2);
    scanf("%s",s3);
    l1 = strlen(s1);
    l2 = strlen(s2);
    l3 = strlen(s3);
    v1[l1] = s1[l1-1] - '0';
    v2[1] = s2[0] - '0';
    v2[l2] = s2[l2-1]-'0';
    v3[1] = s3[0] - '0';
    if(v1[l1] == v2[1]&&v2[l2] == v3[1])
        printf("YES");
    else
        printf("NO");
}


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

using namespace std;

map<long long, long long> prime_factor(long long n) {
  map<long long, long long> ret;

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

}

long long div_game(long long n) {
  map<long long, long long> pf = prime_factor(n);

  long long count = 0;
  for(auto i = pf.begin(); i != pf.end(); ++i) {
    //cout << i->first << "->" << i->second << endl;
    long long remove = 1;
    long long count_per_prime = i->second;
    while(remove <= count_per_prime) {
      //cout << remove << "!!" << endl;
      count ++;
      count_per_prime -= remove;
      remove++;
    }
  }

  return count;
}

int main() {
  long long n;
  cin >> n;
  cout << div_game(n);
}


Measured memory_bytes: 3612
import java.io.IOException;
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		HashSet<Integer> hs = new HashSet<Integer>();

		for (int i=0; i<n; i++){
			hs.add(sc.nextInt());
		}
		System.out.println(hs.size());
	}
}


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

using namespace std;
typedef long long int ll;

ll gcd(ll a, ll b) { 
	return b == 0 ? a : gcd(b, a % b); 
}

int main(){
	//freopen("testIn.txt","r",stdin);
	//freopen("testOut.txt","w",stdout);
	ll n;
	cin>>n;
	
	 cout<< 2 * (n / gcd(2, n))<<endl; 


    

    
    return 0;
}                               

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define oo 0x3f3f3f3f
#define ooLL 0x3f3f3f3f3f3f3f3f
#define mod 1e9+7
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
typedef long long ll;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
    string s;
    cin >> s;
    const int N = s.size();
    ll ans = 0LL;
    int rest = 0, pot = 1;
    vector<int> memo(2019);
    memo[0] = 1;
    for(int i = N-1; i >= 0 ; --i){
        int digit = s[i]-'0';
        rest = (rest + digit*pot)%2019;
        ans += memo[rest];
        memo[rest]++;
        pot = (pot*10)%2019;
    }

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

Measured memory_bytes: 3732
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))
    A = [0] * M
    B = [0] * M
    for i in range(M):
        A[i], B[i] = map(int, input().split())

    l = [1] * N
    for i in range(M):
        if H[A[i] - 1] < H[B[i] - 1]:
            l[A[i] - 1] -= 1
        elif H[A[i] - 1] > H[B[i] - 1]:
            l[B[i] - 1] -= 1
        else:
            l[A[i] - 1] -= 1
            l[B[i] - 1] -= 1
    print(l.count(1))

if __name__ == '__main__':
    main()


Measured memory_bytes: 86648
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;

typedef long long ll;

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(void) {
    int X;
    cin >> X;

    ll a = (X / 500) * 1000;
    ll b = ((X % 500) / 5) * 5;

    cout << a + b << endl;

    return 0;
}


Measured memory_bytes: 256
import math

"""
解説:
数列に含まれる数のうちすべてが 「5 で割って 1 余る」 数であれば, ここから 5 個の整数を選んだ
時にこれらの合計は必ず 5 で割り切れます.（= 合計が 5 以外の数は全て合成数！）
"""

N = int(input())

def main():
    min = 5
    max = 55555
    primes = range(min, max + 1)

    sqrt = math.ceil(math.sqrt(max))
    for i in range(2, sqrt + 1):
        primes = list(filter(lambda n: n == i or n % i != 0, primes))

    # 想定解法に基づく.
    ans = list(filter(lambda n: n % 5 == 1, primes))
    print(' '.join(map(lambda n: str(n), ans[:N])))

if __name__ == "__main__":
    main()

Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef struct pair<int,int> P;
typedef struct pair<int,P> P2;



int main() {
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<max(a*b,c*d)<<endl;
	return 0;
}


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

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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  int a[101] = {0};
  int n;
  int aa = 0;
  while(cin >> n) {
    a[n]++;
    aa = max(aa,a[n]);
  }
  REP(i,101) {
    if (a[i]==aa) cout << i << endl;
  }
}

Measured memory_bytes: 0
m = int(input())
if m <= 2 :
  print('2')
else:
  n = 10**6
  primes = set(range(2, n+1))
  for i in range(2, int(n**0.5+1)):
      primes.difference_update(range(i*2, n+1, i))
  primes=list(primes)

  for i in range(len(primes)-1):
    if primes[i] < m and m <= primes[i+1]:
      print(primes[i+1])

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

int main() {
  int N;
  cin >> N;
  vector<int> a;
  vector<int> cnt(15,0);
  for(int i=0;i<N;i++){
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
    cnt.at(a.at(i)/400)++;
  }
  int l=0,u;
  for(int i=0;i<8;i++){
    if(cnt.at(i)) l++;
  }
  u = l;
  for(int i=8;i<15;i++){
    if(cnt.at(i)) u+= cnt.at(i);
  }
  l = max(1,l);
  cout << l << " " << u << endl;
  return 0;
}

Measured memory_bytes: 256
import sys

def isValid(dt,dx,dy):
    iD = dx+dy
    if dt % 2 : #奇数
        if iD % 2 and iD <= dt:
            return True
        else:
            return False
    else: #偶数
        if iD % 2 == 0 and iD <= dt:
            return True
        else:
            return False
def 解():
    iN = int(input())
    bt,bx,by =0, 0,0
    for t,x,y in [[int(_) for _ in sLine.split()] for sLine in  sys.stdin.readlines()]:
        if not isValid(t-bt,x-bx,y-by):
            print("No")
            exit()
        bt,bx,by = t, x,y
    print("Yes")
解()


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

using namespace std;
using ll = long long;

int main(void) {
  ll x, y;
  cin >> x >> y;
  ll ans = 0;
  while (x <= y) {
    ans++;
    x = x * 2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
 
  string S,keyence;
  int sizedif;
  cin>>S;
  keyence="keyence";
  sizedif=S.size()-7;
	for(int k=0;k<7;k++){
      if(S.at(k)!=keyence.at(k)){
    	if(S.compare(k+sizedif,7-k,keyence,k,7-k)==0) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
		return 0;
       }
    }
  cout<<"YES"<<endl;
}

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

void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> q(n);
  rep(i, n) {
    cin >> q[i];
  }
  int ans = 0;
  for(int l = 0; l <= k; l++) {
    for(int r = 0; r <= k-l; r++) {
      if (l + r > n) continue;

      int d = k - l - r;
      vector<int> temp;
      int t = 0;
      rep(i, l) {
        temp.push_back(q[i]);
      }
      rep(i, r) {
        temp.push_back(q[n-1-i]);
      }
      sort(temp.begin(), temp.end());
      rep(i, temp.size()) {
        if(d > 0 && temp[i] < 0) d--;
        else {
          t += temp[i];
        }
      }     
      ans = max(ans, t);
    }
  }
  cout << ans << endl;

}

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

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

int main(){
  int N;cin >> N;
  vector<ll> A(N,0);
  vector<ll> P(N,0);
  for(int i=0;i<N;i++){
    cin >> A[i];
    A[i] --;
    P[A[i]] ++;
  }
  ll sum = 0;
  for(int j=0;j<N;j++){
    ll x = P[j];
    sum += x*(x-1)/2;
  }
  for(int i=0;i<N;i++){
    ll x = P[A[i]];
    cout << sum - x + 1 << endl;
  }
}

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

using namespace std;

const int MAX_N = 100000;
const int NF = -1; // not find

int N, L;
int Is[MAX_N + 2];
int Tm[MAX_N + 2];

int search ( int i )
{
	if (Tm[i] != NF) {
		return Tm[i];
	}
	int mx = 0;
	if (Is[i+1] > Is[i]) {
		mx = max(mx, search(i+1));
	}
	if (Is[i-1] > Is[i]) {
		mx = max(mx, search(i-1));
	}
	return Tm[i] = L - Is[i] + mx;
}

int main ( void )
{
	while (cin >> N >> L) {
		fill(Is, Is+MAX_N+2, 0);
		fill(Tm, Tm+MAX_N+2, NF);
		for (int i = 0; i < N; ++i) {
			cin >> Is[i+1];
		}

		int mx = 0;
		for (int i = 0; i < N; ++i) {
			mx = max(mx, search(i+1));
		}

		cout << mx << endl;
	}

	return 0;
}

Measured memory_bytes: 3496
#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);
}

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

// 素数判定
bool is_prime(ll n) {
    for (int i = 2; i * i <= n; i++) if (n % i == 0) return false;
    return n != 1;
}

// 約数列挙
vector<ll> divisor(ll n) {
    vector<ll> res;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            res.emplace_back(i);
            if (i != n / i) res.emplace_back(n / i);
        }
    }
    return res;
}

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();
        ll ans = 0;
        if (n == 1) {
            cout << 0 << endl;
            return 0;
        }
        for (ll i = 1; i * i <= n; ++i) {
            if ((n - i) % i == 0) {
                if (n / ((n - i) / i) == n % ((n - i) / i)) ans += (n - i) / i;
            }
        }
        cout << ans << endl;
////
//        cout << "greedy~~~~~" << endl;
//        for (int i = 1; i <= n; ++i) {
//            if (n / i == n % i) {
//                cout << i << ": " << n / i << endl;
//            }
//        }

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <queue>
using namespace std;
#define SZ(v) ((int)(v).size())
const int maxint = -1u>>1;

long long n;

long long gao(long long x) {
    // find p1 * p2 < x
    long long res = 0;
    for (long long p1 = 1; p1 * p1 < x; ++p1) {
        res += ((x - 1) / p1) * 2;
        //printf ("add %I64d\n", ((x - 1) / p1) * 2);
    }
    long long sres = (long long)sqrt((double)x - 1.0);
    //printf ("sub %I64d\n", sres * sres);
    return (res - sres * sres) * 8;
}

int main() {
    while (scanf ("%lld", &n), n) {
        long long ans = n * 8 + (n - 1) * 8;
        printf ("%lld\n", ans + gao(n >> 1));
    }
    return 0;
}

Measured memory_bytes: 0
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    dp = [None] * (K+1)
    for i in range(K+1):
        dp[i] = False
        for j in range(N):
            if A[j] <= i and dp[i - A[j]] == False:
                dp[i] = True
    if dp[K]:
        print("First")
    else:
        print("Second")


if __name__ == "__main__":
    main()


Measured memory_bytes: 40048