akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

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

        String S = sc.nextLine();
        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < S.length(); i++) {
            if (Character.isLetter(S.charAt(i))) {
                ans.append(Character.toUpperCase(S.charAt(i)));
            } else {
                ans.append(S.charAt(i));
            }
        }
        System.out.println(ans.toString());
    }
}

Measured memory_bytes: 26048
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int A, B, C;
	
	cin >> A >> B >> C;

	if ((100*A+10*B+C) % 4 == 0)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
	
	return 0;
}


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

int main() {
  int ans = -INF;
  int ans_ret = 0;
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int cnt = 0;
    int a = i;
    while (true) {
      if (a % 2 == 0) {
        a /= 2;
        ++cnt;
      } else {
        break;
      }
    }
    ans = max(ans, cnt);
    if (cnt >= ans) {
      ans = cnt;
      ans_ret = i;
    }
  }
  cout << ans_ret << endl;
}


Measured memory_bytes: 3604
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    set<int> all;
    all.insert(a);
    all.insert(b);
    all.insert(c);
    cout << all.size() << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[109][109];
main(){
    int A,B;
    cin >> A >> B;
    for (int i = 0 ; i < 100; i++)
    for (int j = 0; j < 100; j++){
        if (j< 50) a[i][j]='.';
        else a[i][j] = '#';
    }A--; B--;
    for (int i = 0 ; i < 100; i++){
        for (int j = 0; j < 100; j++){
            if(i%2==0 && j%2==0 && B && j <40) {a[i][j]='#'; B--;}
            if(i%2==0 && j%2==0 && A && j > 60) {a[i][j]='.'; A--;}
        }
    }
    cout << 100<<" "<<100<<endl;
    for (int i=0; i <100; i++){
        for (int j=0;j<100; j++)
        cout<<a[i][j];
    cout<<endl;}


}


Measured memory_bytes: 256
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int a[100000];

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

    int s = 0;
    int n = gi();
    for (int i = 0; i < n; i++) {
        a[i] = gi();
        s += (i%2 ? -1 : 1) * a[i];
    }

    printf("%d ", s);
    s /= 2;
    for (int i = 1; i < n; i++) {
        s = a[i-1] - s;
        printf("%d%c", s*2, (i == n-1 ? '\n' : ' '));
    }

    return 0;
}


Measured memory_bytes: 1664
n,m=map(int,input().split())
if abs(n-m)>1:
  print(0)
  exit()
import math
#print(math.factorial(4))
if abs(n-m)==1:
  n_=math.factorial(n)%(10**9+7)
  m_=math.factorial(m)%(10**9+7)
  print((n_*m_)%(10**9+7))
if abs(n-m)==0:
  n_=math.factorial(n)%(10**9+7)
  m_=math.factorial(m)%(10**9+7)
  print((2*n_*m_)%(10**9+7))


Measured memory_bytes: 4080
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

double n,y;
double tanri(double m,double r){
    return m*(1.0+y*(r/100.0));
}
double hukuri(double m,double r){
    return m*pow( (1.0+(r/100.0)),y );
}

int main(){
    while(true){
	const double m = 10.0;
	cin >> n;
	if(n==0)  break;
	cin >> y;
	double h = 0.0;
	int ans = 0;
	double b,r,t;
	REP(i,n){
	    cin >> b >> r >> t;
	    if(t == 1){
		if(h < tanri(m,r)) {
		    h = tanri(m,r);
		    ans = b;
		}
	    }else if(t == 2){
		if(h < hukuri(m,r)) {
		    h = hukuri(m,r);
		    ans = b;
		}
	    }
	}
	cout << ans << endl;
    }
    return 0;
}

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

string s;

bool f1(ll a, ll b) {
    for (ll i = a;i < b;++i) {
        if (s[i] == '#' && s[i + 1] == '#')return false;
    }
    return true;
}

bool f2(ll a, ll b) {
    for (ll i = a;i <= b;++i) {
        if (s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.')return true;
    }
    return false;
}

int main() {
    ll n, a, b, c, d;
    cin >> n >> a >> b >> c >> d >> s;
    --a;--b;--c;--d;
    bool flag;
    if (c < d) {
        flag = f1(a, d);
    }
    else {
        flag = f1(a, c) && f2(b, d);
    }
    if (flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T> inline istream& operator>>(istream &i, vector<T> &v) {rep(j, size(v)) i >> v[j]; return i;}
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; }
template<class T> T gcd(T a, T b) {if(b==0)return a; else return gcd(b,a%b);}
template<class T> T lcm(T a, T b) {return a/gcd(a,b)*b;}
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, b;
    cin >> a >> b;
    if(a % b == 0) {
        cout << -1 << endl;
        return 0;
    }else{
        ll ans = a * (b - 1);
        cout << ans << endl;
    }
}

Measured memory_bytes: 3652
#include <iostream>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
long long gcd(long long a, long long b) {
  return b != 0 ? gcd(b, a % b) : a;
}
long long lcm(long long a, long long b) {
  long long k=b/gcd(a, b);
  return a * k;
}
int main(){
  long long n, i, j, kari=1;
  cin >> n;
  long long t[n], a[n];
  for(i=0; i<n; i++){
    cin >> t[i];
  }
  for(i=0; i<n; i++){
    kari=lcm(kari, t[i]);
  }
  cout << kari;
  return 0;
}

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

bool read(int *a, char *op, int *b) {
    scanf("%d %c %d", a, op, b);
    if (*op == '?')
        return false;
    return true;
}

int main(){
    int a, b, ans;
    char op;

    while (read(&a, &op, &b)) {
        switch (op) {
        case '+':
            ans = a + b;
            break;
        case '-':
            ans = a - b;
            break;
        case '*':
            ans = a * b;
            break;
        case '/':
            ans = a / b;
            break;
        }
        cout << ans << '\n';
    }
    return 0;
}



Measured memory_bytes: 3144
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

struct Exam {
	ll A, B, C;
	bool operator <(const Exam& b) {
		return C < b.C;
	}
};
Exam D[100010];
int main()
{
	int N; cin >> N;
	ll sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> D[i].A;
		sum += D[i].A;
	}
	for (int i = 0; i < N; i++) {
		cin >> D[i].B;
		sum -= D[i].B;
		D[i].C = D[i].A - D[i].B;
	}
	int ans = 0;
	ll count = 0;
	sort(D, D + N);
	if (sum < 0) cout << "-1" << endl;
	else {
		int i = 0;
		while (D[i].C < 0) {
			count -= D[i].C;
			i++;
			ans++;
		}
		i = N - 1;
		while (count > 0) {
			count -= D[i].C;
			i--;
			ans++;
		}
		cout << ans << endl;
	}

}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long
#define lfl long double

int main(void)
{
    int a,b;
    cin >> a >> b;

    int res = max(max(a+a-1, a+b),b+b-1);

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
typedef long double ld;

constexpr int INF = 1e9;
constexpr ll BIGINF = 1e18;
constexpr double EPS = 1e-16;
constexpr int MOD = 1e9 + 7;

void preambule() {
  cin.tie(0);
  cout.precision(16);
  cout << fixed;
}

string s;

void input() {
  cin >> s;
}

void solve() {
  s.erase(remove_if(s.begin(), s.end(), [](const auto& a) { return a == '/'; }), s.end());

  int a = stoi(s.substr(0, 4).c_str());
  int b = stoi(s.substr(4, 2).c_str());
  int c = stoi(s.substr(6).c_str());

  string ans = "TBD";

  if (a < 2019) {
    ans = "Heisei";
  } else if (a == 2019) {
    if (b < 4 || (b == 4 && c <= 30))
      ans = "Heisei";
  }

  cout << ans;
}

int main() {
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  preambule();
  input();
  solve();
}


Measured memory_bytes: 256
#include "stdio.h"
#define mod 1000000007
 
int main(void)
{
  int n;
  int k;
  int i,j;
  scanf("%d",&n);
  scanf("%d",&k);
  long kei=0;
  long min=0;
  long max=0;
 
  for(i=0;i<k;i++)
  {
    min = min + i;
    max = max + (n-i);
  }
  kei = (max-min)+1;
 
  for(j=k;j<=n;j++)
  {
    min =min + j;
    max =max + (n-j);
    kei = kei+ (max - min) + 1;
  }
 
  printf("%ld",kei%mod);
}

Measured memory_bytes: 1712
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner sc=new Scanner(System.in);
		
		String s=sc.next();
		String t=sc.next();
		
		
		if(t.indexOf(s)==0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}		
	sc.close();
	}

}


Measured memory_bytes: 26908
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int INF=1e9;
int main(){
      int n,k,m;
      while(cin>>n>>k>>m&&(n||k||m)){
            vector<int> V(n);
            REP(i,n)V[i]=i+1;
            int now=m-1;
            REP(times,n-1){
                  if(times==0){
                        now=m-1;
                  }else{
                        now=(now+k-1)%V.size();
                  }
                  //cout<<now<<endl;
                  V.erase(V.begin()+now);
            }
            cout<<V[0]<<endl;
      }
}

Measured memory_bytes: 1252
#include<bits/stdc++.h>
using namespace std;
int a[200005],n,b[200005],ans;
int main()
{
	int a,b,c=0;
	cin>>a>>b;
	if(a>0&&b>0)cout<<"Positive";
	else if(a<0&&b<0)
	{
		c=b-a+1;
		if(c%2==0)cout<<"Positive";
		else cout<<"Negative";
	}
	else if(a<0||b>0)cout<<"Zero";
	return 0;
}

Measured memory_bytes: 256
a = []
3.times do
  a << gets.chomp.split(" ").map{|i|i = i.to_i}
end
n = gets.chomp.to_i
b = []
n.times do
  b << gets.chomp.to_i
end
bingo = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
count = 0 
b.each do |bElm|
  3.times do|i|
    3.times do|j|
      #puts "now count = #{count}"
      count += 1
      #pp bingo
      if a[i][j] == bElm then
        #puts "=================="
        #pp bingo
        #puts "a[i][j] == #{a[i][j]}"
        #puts "bElm == #{bElm}"
        #puts "=================="
        bingo[i][j] = 1
      end
    end
  end
end
#pp bingo
# 横を調べる
if ((bingo[0][0] == 1 && bingo[0][1] == 1 && bingo[0][2] == 1) || (bingo[1][0] == 1 && bingo[1][1] == 1 && bingo[1][2] == 1) || (bingo[2][0] == 1 && bingo[2][1] == 1 && bingo[2][2] == 1)) then
  puts "Yes"
# 縦を調べる
elsif ((bingo[0][0] == 1 && bingo[1][0] == 1 && bingo[2][0] == 1) || (bingo[0][1] == 1 && bingo[1][1] == 1 && bingo[2][1] == 1) || (bingo[0][2] == 1 && bingo[1][2] == 1 && bingo[2][2] == 1)) then
  puts "Yes"
# 斜めを調べる
elsif ((bingo[0][0] == 1 && bingo[1][1] == 1 && bingo[2][2] == 1) || (bingo[2][0] == 1 && bingo[1][1] == 1 && bingo[0][2] == 1)) then
  puts "Yes"
else
  puts "No"
end


Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)

int H, A[MAX+1];

int left(int i) {
    return (i*2);
}

int right(int i) {
    return (i*2+1);
}

void maxHeapify(int i) {
    int l = left(i);
    int r = right(i);
    int largest;

    if(l<=H && A[l]>A[i]) {
        largest = l;
    }
    else {
        largest = i;
    }
    //printf("largest = %d\n", largest);
    if(r<=H && A[r]>A[largest]) {
        largest = r;
    }

    if(largest!=i) {
        //printf("swaping!\n");
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}

int extract() {
    int maxv;
    if(H<1) {
        return -INFTY;
    }
    maxv = A[1];
    A[1] = A[H--];
    maxHeapify(1);
    return maxv;
}

void increaseKey(int i, int key) {
    if(key<A[i]) {
        return;
    }
    A[i] = key;
    while(i>1 && A[i/2]<A[i]) {
        swap(A[i], A[i/2]);
        i = i / 2;
    } 
}

void insert(int key) {
    H++;
    A[H] = -INFTY;
    increaseKey(H, key);
}

int main() {
    int key;
    string com;

    while(1) {
        cin >> com;
        if(com=="end") {
            break;
        }
        else if(com=="insert") {
            cin >> key;
            insert(key);
        }
        else {
            cout << extract() << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 7064
import copy as cp
import time
import random

#INPUT
t_start = time.time()
D = int(input())
c = [int(i) for i in input().split()]
s = []
for i in range(D):
    new = [int(i) for i in input().split()]
    s.append(new)

#Utilitiy
def score(ans):
    if len(ans) != D:
        print("wrong length")
        return 0
    else:
        p = 0
        last = [-1]*26
        for i in range(D):
            contest = ans[i]-1
            p += s[i][contest]
            last[contest] = i
            for j in range(26):
                p -= c[j]*(i-last[j])
        return p

def greedy(ahead=0):
    ans = []
    p = 0
    last = [-1]*26
    for i in range(D):
        decay = 0
        for j in range(26):
            decay -= c[j]*(i-last[j])
            
        max_j = -1
        max_plus_mod = decay
        max_plus = decay
        for j in range(26):
            plus = s[i][j] + c[j]*(i-last[j])
            modify = c[j]*(ahead*(i-last[j])+ahead*(ahead+1)//2)
            if (plus+modify) > max_plus_mod:
                max_plus = plus
                max_plus_mod = plus+modify
                max_j = j
        ans.append(max_j+1)
        last[max_j]=i
        p += max_plus + decay
    return ans, p

def schedule(ans):
    dates = [[] for i in range(26)]
    for i in range(D):
        dates[ans[i]-1].append(i)
    return dates

def swap(ans):
    ans_temp = cp.copy(ans)
    t1 = random.randint(0,D-1)
    t2 = random.randint(0,D-1)
    temp = ans_temp[t1]
    ans_temp[t1] = ans_temp[t2]
    ans_temp[t2] = temp
    return ans_temp

def change(ans):
    ans_temp = cp.copy(ans)
    t = random.randint(0,D-1)
    A = random.randint(1,26)
    ans_temp[t] = A
    return ans_temp

        
#MAIN
max_points = -10000000
for k in range(20):
    ans_temp, points = greedy(ahead = k)
    #print(k, points, ans_temp)
    if points > max_points:
        max_points = points
        ans = cp.copy(ans_temp)
        
dates = schedule(ans)

count = 0
while True:
    if count % 100 == 0:
        t_now = time.time()
        if t_now-t_start > 1.8:
            break
    r = random.randint(0,1)
    if r == 0:
        ans_temp = swap(ans)
        points_temp = score(ans_temp)
    else:
        ans_temp = change(ans)
        points_temp = score(ans_temp)
    
    if points_temp > points:
        points = points_temp
        ans = cp.copy(ans_temp)


for i in range(D):
    print(ans[i])

Measured memory_bytes: 9884
#include<bits/stdc++.h>
using namespace std;
const int N=500005;
int a[N],b[N],n;
int work(int x)
{
	for(int i=1;i<=n*2-1;i++)
	{
		if(a[i]>=x) b[i]=1;
		else b[i]=0;
	}
	for(int i=1;i<n;i++)
	{
		if(b[n-i]==b[n-i+1]) return b[n-i];
		if(b[n+i]==b[n+i-1]) return b[n+i];
	}
	return (n&1)^b[n]^1;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n*2-1;i++)
	{
		scanf("%d",a+i);
	}
	int l=1,r=n*2-1,ans=0;
	while(l<=r)
	{
		int mid=(l+r)>>1;
		if(work(mid)) l=mid+1,ans=mid;
		else r=mid-1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;


int main(){

    int N,count=0;

    cin>>N;
    int arr1[N],arr2[N];

    for(int i=0; i<N; i++){
        cin>>arr1[i];
        arr2[i] = arr1[i];

    }

    sort(arr2,arr2+N);

    for(int i=0; i<N; i++){
        if(arr1[i] != arr2[i]){
            count++;
        }

    }

    if(count <= 2 ){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }


}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int count[4][3][10]={0};
    int n,b,f,r,v,i,j,k,l;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> b >> f >> r >> v;
        count[b-1][f-1][r-1]+=v;
    }
    for(j=0;j<4;j++){
        for(k=0;k<3;k++){
            for(l=0;l<10;l++){
                cout << " " << count[j][k][l];
                
            }
            cout << endl;
        }
        if(j<3)cout << "####################"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3076
a = [list(map(int, input().split())) for _2 in range(3)]
n = int(input())

memo = [[0]*3 for _3 in range(3)]

for _ in range(n):
    p = int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j] == p:
                memo[i][j] = 1

sums = []

for l in memo:
    sums.append(sum(l))

for k in range(3):
    sums.append(memo[0][k]+memo[1][k]+memo[2][k])

sums.append(memo[0][0] + memo[1][1] + memo[2][2])
sums.append(memo[0][2] + memo[1][1] + memo[2][0])

if max(sums) == 3:
    print("Yes")

else:
    print("No")

Measured memory_bytes: 3064
import java.util.Scanner;


public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		for(; scanner.hasNext();)
		{
			double a = scanner.nextDouble();
			double sum = a;
			
			for(int i=2; i<=10; i++)
			{
				if(i%2 == 0)
				{
					a *= 2;
				}
				else {
					a /= 3;
				}
				sum += a;
			}
			System.out.println(String.format("%1$.8f", sum));
		}
	}
}

Measured memory_bytes: 28072
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int r;
    int D;
    int x;
    cin >> r >> D >> x;
    REP(i, 10) {
        cout << r * x - D << endl;
        x = r * x - D;
    }
}

Measured memory_bytes: 256
/*
 *Author : zsenshi
 testing 
 */
#include <bits/stdc++.h> //Only for gcc compilers
#define mt make_tuple
#define eb emplace_back
#define pb push_back
#define dg(x) cout << #x << ":"<<x<<endl
#define dg2(x,y) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<endl
#define dg3(x,y,z) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<endl
#define dg4(x,y,z,zz) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<' '<<#zz<<':'<<zz<<endl
#define rep(i,begin,end) for(__typeof(end) i = (begin)-((begin) > (end)); i != (end) - ((begin) > (end)); i += 1-2*((begin) > (end)))
using namespace std;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vector<pii>> vvpi;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s,t;
  cin >> s;
  cin >> t;
  int cnt = 0;
  for(int i =0 ; i < 3; i++){
    if(s[i]==t[i])cnt++;
  }
  cout << cnt << "\n";
}


Measured memory_bytes: 256
q=int(input())
A=[]
for i in range(q):
    s=input()
    if s[0]=="0":
        a,b=map(int,s.split())
        A.append(b)
    if s[0]=="1":
        a,b=map(int,s.split())
        print(A[b])
    if s[0]=="2":
        A=A[:-1]


Measured memory_bytes: 13364
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void doIt() {
		new Bamboo_Blossoms().main();
	}

	class Bamboo_Blossoms{
		final int MAX = Integer.MAX_VALUE;
		final int LEN = 7368792;
		void main() {
			while(true) {
				int m = sc.nextInt();
				int n = sc.nextInt();
				if(m == 0 && n == 0) return;
				boolean b[] = new boolean[LEN];
				Arrays.fill(b, true);
				for(int i = 0; i < m; i++)
					b[i] = false;
				int j = m;
				for(int i = 0; i < n; i++) {
					if(j == LEN) break;
					while(!b[j]) {
						j++;
						if(j == LEN) break;
					}
					
					for(int k = j ;k < LEN; k += j) {
						b[k] = false;
					}
				}
				for(int i = 0; i < LEN; i++) {
					if(b[i]) {
						System.out.println(i);
						break;
					}
				}
			}
		}
	}

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

}


Measured memory_bytes: 152124
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int x1 = scanner.nextInt();
        int y1 = scanner.nextInt();
        int x2 = scanner.nextInt();
        int y2 = scanner.nextInt();
        int xLength = x2 - x1;
        int yLength = y2 - y1;
        for (int i = 0; i < yLength; ++i) {
            System.out.print("U");
        }
        for (int i = 0; i < xLength; ++i) {
            System.out.print("R");
        }

        for (int i = 0; i < yLength; ++i) {
            System.out.print("D");
        }

        for (int i = 0; i < xLength; ++i) {
            System.out.print("L");
        }
        System.out.print("L");

        for (int i = 0; i < yLength + 1; ++i) {
            System.out.print("U");
        }

        for (int i = 0; i < xLength + 1; ++i) {
            System.out.print("R");
        }
        System.out.print("D");
        System.out.print("R");
        for (int i = 0; i < yLength + 1; ++i) {
            System.out.print("D");
        }
        for (int i = 0; i < xLength + 1; ++i) {
            System.out.print("L");
        }
        System.out.print("U");
    }
}


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

int main() {

	int n;
	int money;

	do {
		cin >> n;

	} while (n < 1 || n > 100);

	money = 800 * n;

	for (int i = n; i >= 15; i -= 15) {
		money -= 200;
	}

	cout << money << endl;
}

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

int main(){
    char a[30] = {'X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
    char str[1000];
    int len;

    cin >> str;
    len = strlen(str);

    for(int i = 0; i < len; i++){
        for(int j = 3; j < 29; j++){
            if(str[i] == a[j]){
                str[i] = a[j-3];
                break;
            }
        }
    }

    cout << str << endl;
    return 0;
}

Measured memory_bytes: 1140
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int t=1,a,b,c,d,e,f,g,h;
   // cin>>t;
    while(t--)
    {
        cin>>a>>b>>c>>d;
        e=a*c;
        f=b*c;
        g=a*d;
        h=b*d;
        cout<<max(max(max(e,f),g),h)<<endl;
    }
}


Measured memory_bytes: 3628
X, Y, R, G, N = map(int, input().split())
r = [int(x) for x in input().split()]
g = [int(x) for x in input().split()]
n = [int(x) for x in input().split()]
r = sorted(r)[R-X:]
g = sorted(g)[G-Y:]

apple = r + g + n
apple = sorted(apple)[len(apple)-(X+Y):]
print(sum(apple))

Measured memory_bytes: 24064
import sys
input = sys.stdin.readline


N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]

# Cについて大きい順にソート
BC.sort(key=lambda x: x[1], reverse=True)

tmp = []
# tmpがN個を超えるまで、cをb個足す
for b, c in BC:
    tmp += [c] * b
    if len(tmp) >= N:
        break

# Aとtmpを混ぜてソート
nums = A + tmp
nums.sort(reverse=True)
# 上からN個の総和
print(sum(nums[:N]))


Measured memory_bytes: 106000
// 2020-09-27 19:23:53
// clang-format off
#include <bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
// #include <atcoder/convolution>
// #include <atcoder/dsu>
// #include <atcoder/fenwicktree>
// #include <atcoder/lazysegtree>
// #include <atcoder/math>
// #include <atcoder/maxflow>
// #include <atcoder/mincostflow>
// #include <atcoder/modint>
// #include <atcoder/scc>
// #include <atcoder/segtree>
// #include <atcoder/string>
// #include <atcoder/twosat>
// #include <atcoder/all>
// using namespace atcoder;

// clang-format on
ll dx[(1 << 15) + 10][20];
ll dy[(1 << 15) + 10][20];
ll ans[20];
void answer() {
  int n;
  cin >> n;
  vector<ll> x(n), y(n), p(n);
  rep(i, n) cin >> x[i] >> y[i] >> p[i];
  rep(i, 1 << n) {
    rep(j, n) {
      dx[i][j] = abs(x[j]);
      dy[i][j] = abs(y[j]);
      rep(k, n) if ((i >> k) & 1) {
        chmin(dx[i][j], abs(x[j] - x[k]));
        chmin(dy[i][j], abs(y[j] - y[k]));
      }
      dx[i][j] *= p[j];
      dy[i][j] *= p[j];
    }
  }
  repc(i, n) ans[i] = ll(1e18);
  rep(i, 1 << n) {
    int j = i;
    do {
      ll cur = 0;
      rep(k, n) cur += min(dx[i & (~j)][k], dy[i & j][k]);
      chmin(ans[__builtin_popcount(i)], cur);
      j = (j - 1) & i;
    } while (j != i);
  }
  repc(i, n) cout << ans[i] << '\n';
}

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

Measured memory_bytes: 13816
def main():
    import sys
    input=sys.stdin.readline
    n=int(input())
    A=list(map(int,input().split()))
    A_=[]
    for i in range(n):
        A_.append([A[i],i])
    A_sorted=sorted(A_)[::-1]
    dp=[[0]*(n+1) for _ in range(n+1)]
    ans=0
    for xy in range(1,n+1):
        for x in range(xy+1):
            m=-float("INF")
            a=A_sorted[xy-1][0]
            a_i=A_sorted[xy-1][1]
            if x!=0 and x<=a_i+1:
                m=max(m,dp[x-1][xy-x]+a*(a_i+1-x))
            if x!=xy and n-xy+x>=a_i:
                m=max(m,dp[x][xy-x-1]+a*(n-xy+x-a_i))
            dp[x][xy-x]=m
            if xy==n:
                ans=max(ans,m)
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 177260
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long a, b, c;
  cin >> a >> b >> c;
  if ((c - a - b)*(c - a - b) > 4LL * a * b && c - a - b >= 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstring>



#define REP(i, n) for (long long i = 0; i < (n); i++) 
#define ll long long

using namespace std;

int main(){
    ll N,res;
    cin >> N;
    ll tmp;
    ll iMin = 1000000001;
    ll iMax = -1;

    REP(i,N)
    {
        cin >> tmp;

        iMin = min(iMin,tmp);
        iMax = max(iMax,tmp);
    }

    res = iMax - iMin;

    cout << res << endl;
}




Measured memory_bytes: 256
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define debug(x) cout
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size)
#define all(x) x.begin(),x.end()
#define rep(i,a,n) for (int i=(a);i<(n);++i)
#define per(i,a,n) for (int i=(n)-1;i>=(a);--i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
inline ll read() {
  ll x=0, f=1; char ch=getchar();
  while (ch<'0'||ch>'9') f=(ch=='-')?-1:1, ch=getchar();
  while (ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+ch-'0', ch=getchar();
  return x*f;
}
inline void fileio() {
  freopen("t.in","r",stdin);
  //freopen("t.out","w",stdout);
}
//Produced By MiracleEEEE
//head
char s[100005];
int main()
{
  scanf("%s",s);
	int n=strlen(s);
	rep(i,0,n) if ((i%2==0)) putchar(s[i]);
	puts("");
	return 0;
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

bool f(vector<lli> v, lli a, lli b, lli x)
{
  each (i, v) i = max<lli>(0, i - b * x);
  const lli c = a - b;
  each (i, v) x -= (i / c) + (bool)(i % c);
  return 0 <= x;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  lli n, a, b;
  while (cin >> n >> a >> b) {
    vector<lli> v(n);
    each (i, v) cin >> i;

    auto g = [&] (lli x) { return f(v, a, b, x); };
    
    lli small = 0;
    lli large = 1e9 + 100;
    while (small + 1 < large) {
      lli mid = (small + large) / 2;
      if (g(mid)) large = mid;
      else small = mid;
    }
    cout << (g(small) ? small : large) << endl;
  }
  
  return 0;
}


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

void put(int x){
    cout << x << endl;
}
void put(string x){
    cout << x << endl;
}
void put(vector<int> x){
    cout << x.front();
    for(int i=1;i<x.size();++i){
        cout  << "," << x[i];
    }
    cout << endl;
}
void put(vector<int> x ,string s){
    cout << x.front();
    for(int i=1;i<x.size();++i){
        cout << s << x[i];
    }
    cout << endl;
}
void put(vector<vector<int>> x){
    cout << "{" <<endl;;
    for(int i=0;i<x.size();++i){
        cout << x[i].front();
        for(int j=1;j<x[i].size();++j){
            cout << "," << x[i][j];
        }
        cout << endl;
    }
    cout << "}" << endl;
}
void vsort(vector<int> v){
    sort(v.begin(),v.end());
}
void vsort(vector<string> v){
    sort(v.begin(),v.end());
}


int main(void) {
    int a,b,c;
    int cnt = 0;
    cin >> a >> b >> c;
    int m = max({a,b,c});
    while(a+2<=m){
        a+=2;
        cnt++;
    }
    while(b+2<=m){
        b+=2;
        cnt++;
    }
    while(c+2<=m){
        c+=2;
        cnt++;
    }
    int cnt2 = 0;
    if(a==m){
        cnt2++;
    }
    if(b==m){
        cnt2++;
    }
    if(c==m){
        cnt2++;
    }
    if(cnt2==1){
        cnt += 1;
    }else if(cnt2==2){
        cnt += 2;
    }
    put(cnt);
    return 0;
}


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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

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

	if(n == m) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}




Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
long long N,n1,n2;
int main()
{
	int h, n;
	scanf("%lld", &N);
	for (h = 1; h <= 3500; h++)
	{
		for ( n = 1; n <= 3500; n++)
		{
			n1 = N*h*n;
			n2 = 4 * h*n - n*N - h*N;
			if (n1%n2 == 0&&n1>0&&n2>0)
			{
				printf("%d %d %lld\n", n, h, n1/n2);
				exit(0);
			}
		}
		
	}
	return 0;
}


Measured memory_bytes: 128
n, m = map(int,input().split())
xy = [list(map(int,input().split())) for i in range(m)]

red_boxes = [False for i in range(n)]
red_boxes[0] = True
n_ball = [1 for i in range(n)]


for i in range(m):
    x_i = xy[i][0]-1
    y_i = xy[i][1]-1
    
    if n_ball[x_i] == 1:
        if red_boxes[x_i] == True:
            n_ball[x_i] -= 1
            n_ball[y_i] += 1
            red_boxes[x_i] = False
            red_boxes[y_i] = True
        
        else:
            n_ball[x_i] -= 1
            n_ball[y_i] += 1
    
    else:
        if red_boxes[x_i] == True:
            n_ball[x_i] -= 1
            n_ball[y_i] += 1
            red_boxes[y_i] = True
        
        else:
            n_ball[x_i] -= 1
            n_ball[y_i] += 1
    
    
    
print(red_boxes.count(True))

Measured memory_bytes: 29000
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define int long long
using namespace std;
typedef pair<int,int> P;
constexpr int mod=1e9+7;
signed main(){
    int N;cin>>N;
    vector<vector<int>> a(N,vector<int>(N));
    REP(i,N) REP(j,N) cin>>a[i][j];
    vector<int> dp(1<<N,0);
    //dp[i][j]:男iまでにマッチングした女の集合がjになるような場合の数
    dp[0]=1;
    for(int j=1;j<(1<<N);++j){
        int i=__builtin_popcount(j);
        REP(k,N) if(j>>k&1&&a[i-1][k]) (dp[j]+=dp[j^(1<<k)])%=mod;
    }
    cout<<dp[(1<<N)-1]<<endl;
}

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

int main(int argc,char* argv[]){
	int a , b;
	cin >> a >> b;
	if(b == 1) { cout << 0 << endl; return 0; }
	for(int i=1;i<=1000;++i){
		if((( i + 1 ) + ( a - 2 ) * i) >= b ) { cout << i << endl; break; }
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n = s.size();

    int w;
    cin >> w;

    string t;
    for (int i = 0; i < n; i += w) {
        t.push_back(s[i]);
    }

    cout << t << endl;

    return 0;
}

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

const ll maxs = 2e5+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'

void pre(){
    
}

ll dp[maxs];
ll pr[maxs];

void solve(){    
    ll n;
    cin >> n;
    ll a[n+1];
    for(ll i=1;i<n+1;i++)
        cin >> a[i];
    
    pr[1] = a[1];
    for(ll i=2;i<n+1;i++){
        pr[i] = pr[i-2] + a[i];
    }

    dp[0] = dp[1] = 0;
    for(ll i=2;i<n+1;i++){
        if(i&1){ // we have option to skip
            dp[i] = max(dp[i-1] , dp[i-2] + a[i]);
        }
        else{
            dp[i] = max(dp[i-2] + a[i] , pr[i-1]);            
        }
    }    
    cout << dp[n] << endl;
}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;   
    //cin>>T;
    while(T--){  
        solve();
    }
    return 0;
}

Measured memory_bytes: 8304
#include<vector>
#include<iostream>
#include<string>

using namespace std;

int main(){
  int i, after = 0;
  string S;
  vector <string> day = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  
  cin >> S;
  
  for(i = 0; i < 7; i++){
    if(S == day[i]){
      after = 7 - i;
      break;
    }
  }
  
  cout << after << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define PI acos(-1)
#define sz 100010
#define RUN_FAST ios::sync_with_stdio(false);
using namespace std;

int main()
{
    RUN_FAST; cin.tie(nullptr);
    int n, i, j, sum, ans, tmp, up;
    cin >> n;
    int arr[n];
    for (i=0; i<n; i++) cin >> arr[i];

    sort(arr, arr+n);
    up=arr[n-1];
    up++;
    ans=100000000;
    for (i=arr[0]; i<up; i++) {
        sum=0;
        for (j=0; j<n; j++) {
            tmp=arr[j]-i;
            sum+=tmp*tmp;
        }
        ans=min(ans, sum);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD = 1e9 + 7;
vector<long long> fact_inv, inv, Com;
void init_nCk(ll n,ll k){
  fact_inv.resize(k+5);
  inv.resize(k+5);
  fact_inv[0]=fact_inv[1]=1;
  inv[1]=1;
  for(ll i=2;i< k+5;i++){
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    fact_inv[i]=fact_inv[i-1]*inv[i]%MOD;
  }
  Com.resize(k+5);
  Com[0]=1;
  for (ll i=1;i<k+5;i++){Com[i]=Com[i-1]*((n-i+1)*inv[i]%MOD)%MOD;}
}
ll nCk(ll k){
    assert(!(k<0));
    return Com[k];
}
ll mod_pow(ll a,ll b) {
    if(b==0){return 1;}
    ll res=mod_pow(a*a%MOD,b/2);
    if(b&1)res=res*a%MOD;
    return res;
}
int main() {
  ll N,a,b,x,d,e;
  cin>>N>>a>>b;
  x=mod_pow(2,N);
  if(a<=N){init_nCk(N,a);d=nCk(a);x-=d;}
  if(b<=N){init_nCk(N,b);e=nCk(b);x-=e;}
  cout<<(x+2*MOD)%MOD-1<<endl;
}

Measured memory_bytes: 7880
#include <iostream>
#include <array>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    array<bool, 13> S;  S.fill(false);
    array<bool, 13> H;  H.fill(false);
    array<bool, 13> C;  C.fill(false);
    array<bool, 13> D;  D.fill(false);

    int N,num;
    char c;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> c >> num;
        switch(c){
            case 'S': S.at(num-1) = true;   break;
            case 'H': H.at(num-1) = true;   break;
            case 'C': C.at(num-1) = true;   break;
            case 'D': D.at(num-1) = true;   break;
        }
    }
    
    for(int i=0; i<13; i++)
        if(S.at(i) == false)
            cout << "S " << i+1 << endl;
    for(int i=0; i<13; i++)
        if(H.at(i) == false)
            cout << "H " << i+1 << endl;
    for(int i=0; i<13; i++)
        if(C.at(i) == false)
            cout << "C " << i+1 << endl;
    for(int i=0; i<13; i++)
        if(D.at(i) == false)
            cout << "D " << i+1 << endl;
            
    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;


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

    int N;
    cin >> N;
    int a[N];
    int ans=0;
    int x;
    rep(i,N){
        cin >> x;
        while(x%2==0){
            x/=2;
            ans++;
        }

    }
    
    cout << ans << endl;
    




}


Measured memory_bytes: 256
// edpc_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF (int)(2e9)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int N, K;
vector<int> H;
//vector<int> memo;
unordered_map<int, int> memo;

int dp_func(int i){

    if (i == N-1) return 0;

    if (memo.count(i)) return memo[i];
//    if (memo[i] != -1) return memo[i];

    int tmp = INF;
    REPN(k, 1, K+1) {
        if (i + k >= N) break;
        tmp = min(tmp, dp_func(i+k) + abs(H[i] - H[i+k]));
    }

    return memo[i] = tmp;
};


int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    cin >> N >> K;
    H.assign(N, 0);
    REP(i, N) cin >> H[i];

//    memo.assign(N, -1);

    int ans = dp_func(0);
    print(ans);

    return 0;
}



Measured memory_bytes: 9508
#include <stdio.h>
#include <array>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

constexpr int N = 2e5;
constexpr int mod = 1e9 + 7;
std::array<int, N + 10> A, UA, Pre, DP;

int main(void){
    int n; scanf("%d", &n);
    REP(i, n) scanf("%d", &A[i]);
    int idx = 0, m = 0;
    while(idx < n){
        int cnt = 1;
        while(idx + cnt < n and A[idx] == A[idx + cnt]) cnt++;
        UA[m++] = A[idx];
        idx += cnt;
    }
    DP[0] = 1;
    REP(i, m){
        DP[i+1] = (DP[i] + Pre[UA[i]]) % mod;
        (Pre[UA[i]] += DP[i]) %= mod;
    }
    printf("%d\n", DP[m]);
    return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<cmath>
#include<vector>
using namespace std;
int main(){
  int q;
  cin >> q;
  int lmin = 1e5, rmax = 1;
  vector<int> L(q, 1e5), r(q, 1);
  for (int i = 0; i < q; i++){
    cin >> L[i] >> r[i];
    if(lmin>L[i]){
      lmin = L[i];
    }
    if(rmax < r[i]){
      rmax = r[i];
    }
  }
  vector<bool> x(rmax + 1, true);
  x[1] = false;
  x[2] = true;

  for (int i = 3; i <= rmax; i ++){
    if(i%2 == 0){
      x[i] = false;
      continue;
    }
    for (int j = 2; j<i; j++){
      if(i%j==0){
        x[i] = false;
        break;
      }
    }
  }
  vector<int> y(rmax, 0);
  for(int j=3; j<=rmax; j++){
    if(x[j] == true && x[(j+1)/2] == true && j%2 == 1){
      y[j] = 1;
    }
  }
  vector<int> sum(rmax + 5, 0);
  for(int i=1; i<=rmax; i++){
    sum[i] = sum[i - 1] + y[i];
  }

  for(int i=0; i<q; i++){
    cout << sum[r[i]] - sum[L[i] - 1]<< "\n";
  }
  return 0;
}

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

long long t,n;
long long dp[200000][3];
long long c[4];
const int INF=1e9+5;
int main() {
        cin >> n;

        for (int i=1; i<=n; i++) {
            for (int j=1; j<=3; j++) {
                long long x;
                cin >> x;
                for (int u=1; u<=3; u++) {
                    if (u!=j) {
                        dp[i][j]=max(dp[i][j], dp[i-1][u]+x);
                    }
                }
            }
        }
        cout << max(dp[n][1], max(dp[n][2], dp[n][3]));
        /*for (int i=0; i<n; i++) {
            for (int j=1; j<=3; j++) {
                cout << dp[i][j] << " ";
            }
            cout << '\n';
        }*/
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const int N = 2e5+10;
char s[N];

void solve() {
    scanf("%s", s);
    for (int i = 0; s[i]; i++) {
        if (s[i] == 'P') putchar(s[i]);
        else putchar('D');
    }
    printf("\n");
}

int main() {

    int T = 1;
    // scanf("%d", &T);
    while (T--) solve();

    return 0;
}

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

using namespace std;

typedef pair<int,int> pi;
typedef long long ll;

ll N, K;
ll illuminate[400005];
ll A[400005], tmp[400005];

void up(int x, int v){
	for (; x <= N; x += (x & -x)) illuminate[x] += v;
}

void update(ll l, ll r, int v){
	up(max(1ll,l),v);
	up(min(N+2,r+1),-v);
}

ll query(int x){
	ll sum = 0;
	for (; x; x -= (x & -x)) sum += illuminate[x];
	return sum;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> N >> K;
	for (int i = 1; i <= N; ++i){
		cin >> A[i];
		update(i-A[i],i+A[i],1);
	}
	for (int k = 1; k <= min(K,100ll); ++k){
		for (int i = 1; i <= N; ++i){
			tmp[i] = query(i);
		}
		for (int i = 1; i <= N; ++i){
			update(i-A[i],i+A[i],-1);
			A[i] = tmp[i];
			update(i-A[i],i+A[i],1);
		}
		
	}
	for (int i = 1; i <= N; ++i){
		cout << A[i] << ' ';
	}
	cout << '\n';
}

Measured memory_bytes: 8376
using System;
class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());

        int cnt = 0;
        for (long i = 1; i <= n; i++)
        {
            if (i % 2 == 1)
            {
               cnt++;
            }
        }
        Console.WriteLine((double)cnt / n);
    }

}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> k(n);
    vector<vector<int>> a(n);
    for (int i = 0; i < n; i++) {
        cin >> k.at(i);
        for (int j = 0; j < k.at(i); j++) {
            int b;
            cin >> b;
            a.at(i).push_back(b);
        }
    }
    int count = 0;
    vector<int> ans(30);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < k.at(i); j++) {
            ans.at(a.at(i).at(j) - 1)++;
        }
    }
    for (int i = 0; i < 30; i++) {
        if (ans.at(i) == n) count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 256