akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

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

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

    ll H,W; cin >> H >> W;

    if(H != 1 && W != 1)cout << (H*W+1)/2 << endl;
    else cout << 1 << endl;

    return 0;

}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

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

  int b, f, r, v;
  int room[4][3][10] = {{{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0}},
                        {{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0}},
                        {{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0}},
                        {{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0}}};

  for ( int i = 0; i < n; i++ )
    {
      cin >> b >> f >> r >> v;
      room[b-1][f-1][r-1] += v;
    }

  for ( int i = 0; i < 4; i++ )
    {
      if ( i ) cout << "####################" << endl;
      
      for ( int j = 0; j < 3; j++ )
        {
          for ( int k = 0; k < 10; k++ )
            {
              cout << " " << room[i][j][k];
            }
          cout << endl;
        }
    }
  
  return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

ll dp[100001][2];
string s;
const int mod=1000000007;
int main(){
    cin>>s;
    int n=s.size();
    dp[0][0]=1;
    rep(i,n){
        dp[i+1][1]+=dp[i][1]*3;
        dp[i+1][1]%=mod;
        if(s[i]=='0'){
            dp[i+1][0]+=dp[i][0];
            dp[i+1][0]%=mod;
        }
        else{
            dp[i+1][1]+=dp[i][0];
            dp[i+1][1]%=mod;
            dp[i+1][0]+=dp[i][0]*2;
            dp[i+1][0]%=mod;
        }
    }
    cout<<(dp[n][1]+dp[n][0])%mod<<endl;
    return 0;
}


Measured memory_bytes: 2048
#include <stdio.h>
int main(void)
{
    int h, w;
    int i, j, k;

    while (1)
    {
        scanf("%d %d", &h, &w);

        if (h == 0 && w == 0)
        {
            break;
        } //０を入力したらwhile文抜ける。

        for (i = 1; i <= h; i++)
        { //高さ　iは繰り返しでとりあえず用意した i行目
            if (i % 2)
            { //奇数行目の時
                for (j = 0; j < w / 2; j++)
                { //#.をセットで置いていく　jは繰り返しのためとりあえず用意した
                    printf("#.");
                }
                if (w % 2)
                { //横列の値が奇数だった時
                    printf("#");
                }
                printf("\n");
            }
            else
            { //偶数行目の時
                for (j = 0; j < w / 2; j++)
                { //.#をセットで置いていく  kは繰り返しのためとりあえず用意した
                    printf(".#");
                }
                if (w % 2)
                { //横列の値が奇数だった時
                    printf(".");
                }
                printf("\n");
            }
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 2704
#include "stdio.h"

//3角数字が等しければ正三角形と判定する

int main(void)
{
    int A, B, C;
    scanf("%d %d %d", &A, &B, &C);
    
    if((A == B) && (B == C) )
    {
        printf("Yes");
    }

    else
    {
        printf("No");
    }
    
            
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

int main() {
    double n, li;
    cin >> n >> li;
    vector<vector<double>> a(n, vector<double>(2));
    for (int i = 0; i < n; i++) {
        double v, w;
        cin >> v >> w;
        a[i][0] = v / w;
        a[i][1] = w;
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    double ret = 0;
    for (int i = 0; i < n && li > 0; i++) {
        ret += min(li, a[i][1]) * a[i][0];
        li -= min(li, a[i][1]);
    }
    cout << fixed << setprecision(10) << ret << endl;
    return 0;
}


Measured memory_bytes: 8356
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<string>
#include<iomanip>
#include<vector>
using namespace std;

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

    if(a%2 == 0 || b%2 == 0){
        cout << "Even";
    } else{
        cout << "Odd";
    }
}

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

int main(){
    int n;
    int ans = 0;
    cin >> n;
    vector<int> l(2*n);
    rep(i,2*n)cin >> l[i];
    sort(l.begin(),l.end());
    for(int i = 0;i < 2*n;i = i+2){
        ans += min(l[i],l[i+1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int MAX = 100000;

int n, p = 0;
int prime[MAX];

bool isPrime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

void solve(int n) {
	if (n == 1) return;
	else if (isPrime(n)) prime[p++] = n;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			if (isPrime(i)) {
				prime[p++] = i;
				while (n % i == 0) n /= i;
				solve(n);
				break;
			}
		}
	}
}
int main() {
	cin >> n;
	if (n == 1) {
		cout << 0 << endl;
		return 0;
	}
	solve(n);

	double ans = (double)n;
	for (int i = 0; i < p; i++) ans *= 1.0 - 1.0 / prime[i];
	cout << (int)ans << endl;
}


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

int main(){
    while(true){
        ll a, b;
        string op;
        cin >> a >> op >> b;
        if(op == "+"){
            cout << a + b << endl;
        }else if(op == "-"){
            cout << a - b << endl;
        }else if(op == "*"){
            cout << a * b << endl;
        }else if(op == "/"){
            cout << a / b << endl;
        }else{
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define debug(x) cerr << "\n" \
                      << #x << " = " << x << ".\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define print(xx) cout << (xx) << endl
using namespace std;
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vint;
const int INF = ((1LL << 30) + (1LL << 29));
const ll MOD = 1000000007;

/* 

*/
//================== INPUT ========================
//=================================================
void input()
{
}

//=================================================
void solve()
{
    int n;
    cin>>n;
    if (n==1){
        cout<<"Hello World\n";
    }
    else {
        int a,b;
        cin>>a>>b;
        cout<<a+b<<endl;
    
    }

}

//=================================================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
word = {'A':0,'B':1,'C':2,'D':3,'E':4,'F':5,'G':6,'H':7,'I':8,'J':9,'K':10,'L':11,'M':12,'N':13,'O':14,'P':15,'Q':16,'R':17,'S':18,'T':19,'U':20,'V':21,'W':22,'X':23,'Y':24,'Z':25}
word_reverse={v: k for k, v in word.items()}
x=input()
y=input()
Ans=''
for i in y:
  if word[i]+int(x) > 25:
    z = (word[i]+int(x)) % 26
  else:z=word[i]+int(x)
  Ans=Ans+word_reverse[z]

print(Ans)


Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef int_fast64_t ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
inline void fastio(){cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15);}
ll gcd(ll a,ll b){ll c=max(a,b);ll d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modfact(ll a){ll b=1;FOR(i,2,a)b=b*i%MOD;return b;}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}
ll modcomb(ll n, ll k){ll b=1;k=min(n-k,k);DOWN(i,n,n-k+1)b=b*i%MOD;return b*modpow(modfact(k),MOD-2)%MOD;}

int N, ans = 0;
ll A[200000];
bool B[200000] = {false};

int main() {
    scanf("%d", &N);
    REP(i, N) scanf("%d", A+i);
    sort(A, A+N);
    for(int i=N-1; i>=0; i--) {
        int p = 0;
        while(A[i] >= 1LL<<p) p++; 
        ll x = (1LL<<p) - A[i];
        int j = lower_bound(A, A+N, x) - A;
        if(B[i]) continue;
        if(j < i && A[j] == x && !B[j]) {
            B[i] = true;
            B[j] = true;
            A[j]--;
            ans++;
        }
    }
    printf("%d", ans);
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; i++)

int main()
{
    int n;
    cin >> n;
    vector<long long> a(n, 0);
    rep(i, n) cin >> a[i];
    map<int, int> m;
    ll cnt = 0;
    rep(i, n)
    {
        int sa = i - a[i];
        cnt += m[sa];
        int wa = a[i] + i;
        m[wa]++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 21996
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using vll = vector<ll>;
using vll2 = vector<vector<ll>>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    bool f = true;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a % 2 == 0) {
            if (a % 3 > 0 && a % 5 > 0) {
                f = false;
            }
        }
    }
    if (f) {
        cout << "APPROVED" << endl;
    } else {
        cout << "DENIED" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
const int N =100010;
char b[N], a[N];
int result[N];
int find_idx(int idx, int l){
  char pivot = a[idx];
  while(a[idx] == pivot){
    if (idx < l){
      idx++;
    }
    else{
      return idx;
    }
  }
  return idx - 1;
}
int main(){
  cin >> b;
  int l = strlen(b);
  for(int i = 0; i < l; ++i){
      a[i+1] = b[i];
  }

  int f = 1;
  while(true){
    int first = find_idx(f, l);
    int second = find_idx(first + 1, l);

    int numf = first - f + 1;
    int nums = second - first;
    result[first] = (numf + 1) / 2 + nums / 2;
    result[first + 1] = (nums + 1) / 2 + numf / 2;
    f = second + 1;
    if (f > l){
      break;
    }
  }

  for (int i = 1; i <= l; ++ i){
    cout << result[i] << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    bool flag = true;
    ll cnt = 0;
    for(int i=n-2;i>=0;i--){
	if(a[i] > a[i+1] ){
	    if(a[i] == a[i+1] + 1 ) a[i]--;
	    else{
		flag = false;
		break;
	    }
	}
    }
    if(flag){
	cout<<"Yes"<<endl;
    }else{
	cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 1024
import java.io.PrintWriter
import java.util.ArrayDeque

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

data class Edge<T>(val to: Int, var cost: T)

fun solve(out: PrintWriter) {
    val n = readInteger()
    val tmpList = Array(n) { mutableListOf<Edge<Long>>() }
    repeat(n - 1) {
        val (u, v, w) = readLongList()
        tmpList[u.toInt() - 1].add(Edge(v.toInt() - 1, w))
        tmpList[v.toInt() - 1].add(Edge(u.toInt() - 1, w))
    }

    val distance = LongArray(n) { -1L }
    distance[0] = 0L
    val queue = ArrayDeque<Int>()
    queue.addLast(0)
    while (queue.isNotEmpty()) {
        val p = queue.removeFirst()
        for (edge in tmpList[p]) {
            if (distance[edge.to] == -1L) {
                distance[edge.to] = distance[p] + edge.cost
                queue.addLast(edge.to)
            }
        }
    }


    for (i in distance) {
        out.println(if (i % 2 == 0L) 0 else 1)
    }
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    int n; cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];

    double ans = 1.0;
    REP(i,n) ans *= a[i];

    double tmp = 0;
    REP(i,n)  {
        tmp += ans/a[i];
    }

    cout << setprecision(10);
    cout << ans/tmp << endl;
    return 0;
}


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


int main()
{
    vector<int> A, B;
    int a, b;
	do
	{
	    cin >> a >> b;
	    if (a > b) swap(a,b);
	    A.push_back(a);
	    B.push_back(b);
	} while (a != 0 || b != 0);
	
	for (int i = 0; i < A.size() - 1; i++)
	    cout << A[i] << " " << B[i] << endl;
	return 0;
}



Measured memory_bytes: 3172
#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }

    int count = 1;
    for(int i=0;i<N;i++){
        if(A[i] == count ){
            count++;
        }
    }
    if(count == 1){
        cout << -1 <<endl;
    }else{
        cout << N-(count-1) << endl;
    }
}

Measured memory_bytes: 1024
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int H = sc.nextInt();
		int W = sc.nextInt();
      	int h = sc.nextInt();
      	int w = sc.nextInt();
      	System.out.println((H-h)*(W-w));
    }
}

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

int main(void) {
  int A, B;
  string S, T, U;
  
  cin >> S >> T;
  cin >> A >> B;
  cin >> U;
  
  if (S == U) {
    A--;
  }
  else {
    B--;
  }
  
  cout << A << ' ' << B << endl;
  
  return 0;
}


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

const int MAX_N = 2e5 + 5, inf = 1e9 + 7, MOD = 1e9 + 7;
int n, m, ans = inf;
int Arr[MAX_N];
int dp[MAX_N];
bool mark[MAX_N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int ind;
		cin >> ind;
		mark[ind] = true;
	}
	
	dp[0] = 1;
	for (int i = 1; i <= n; i++)
		if (!mark[i])
			dp[i] = (dp[i - 1] + dp[i - 2]) % MOD;

	cout << dp[n] << "\n";
	return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<algorithm>
#include<iomanip>

using namespace std;

void Main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;

  const int lower=max(a,c);
  const int upper=min(b,d);
  cout<<max(0,upper-lower)<<endl;
}

int main(){
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  Main();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));


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

    int a,b;
    cin >> a >> b;
    b *= 2;
    int ans = a - b;
    if(ans <= 0) ans = 0;
    cout << ans << endl;

    cout << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.lang.*;
public class Main{
public static void main(String[] args) throws FileNotFoundException, IOException{
       Scanner s=new Scanner(System.in);
       int m1=s.nextInt(),d1=s.nextInt(),m2=s.nextInt(),d2=s.nextInt();
       if(m1>=m2){System.out.println("0");}
       else if(m1!=m2&&d2==1){System.out.println("1");}
        }
    }


Measured memory_bytes: 21204
#include <iostream>
#include <cassert>
#include <cmath>
#include <iomanip>
//#define NDEBUG
int main(void){
	using namespace std;
	static const int INPUT_A_MAX = pow(10,9.0);
	static const int INPUT_B_MAX = pow(10,9.0);
	static const int INPUT_A_MIN = 1;
	static const int INPUT_B_MIN = 1;
	double input_a = 0;
	double input_b = 0;
	int d = 0;
	int r = 0;
	double f = 0;

	cin >> input_a;
	cin >> input_b;

	/* 入力値の前提条件 */
	assert (INPUT_A_MIN <= input_a && input_a <= INPUT_A_MAX);
	assert (INPUT_B_MIN <= input_b && input_b <= INPUT_B_MAX);

	/* Calculation */
	d = input_a / input_b;
	r = (int)input_a % (int)input_b;
	f = input_a / input_b;	

        /* Output */
	cout << d << " " << r << " " << fixed << f << endl;
	return 0;
}


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

#define State string::const_iterator
class ParseError {};

map<char,char> plus_c,minus_c;

string Cipher(State &begin);
string String(State &begin);
string Letter(State &begin);
string factor(State &begin);
void consume(State &begin, char expected);

string input;

// 四則演算の式をパースして、その評価結果を返す。
string Cipher(State &begin) {
    string ret = String(begin);

    if(*begin != ']' && input.end() != begin){
        ret += Cipher(begin);
    }

    return ret;

}

// 乗算除算の式をパースして、その評価結果を返す。
string String(State &begin) {
    string ret = factor(begin);

    return ret;
}

// 数字の列をパースして、その数を返す。
string Letter(State &begin) {
    string ret = "";

    if(*begin == '+'){
        consume(begin, '+');
        string c = Letter(begin);
        char cc = c[0];
        ret += plus_c[cc];
    }
    else if(*begin == '-'){
        consume(begin, '-');
        string c = Letter(begin);
        char cc = c[0];
        ret += minus_c[cc];
    }
    else{
        if(*begin != '[' && *begin != ']') {
            if(*begin == '?'){
                ret = "?";
                consume(begin, '?');
            }
            else {
                ret = *begin;
                begin++;
            }
        }
    }

    return ret;
}

// 括弧か数をパースして、その評価結果を返す。
string factor(State &begin) {
    if (*begin == '[') {
        consume(begin, '['); // '['を飛ばす。
        string ret = Cipher(begin);
        consume(begin, ']'); // ']'を飛ばす。
        reverse(ret.begin(), ret.end());
        return ret;
    } else {
        return Letter(begin);
    }
}

// beginがexpectedを指していたらbeginを一つ進める。
void consume(State &begin, char expected) {
    if (*begin == expected) {
        begin++;
    } else {
        cerr << "Expected '" << expected << "' but got '" << *begin << "'"
             << endl;
        cerr << "Rest string is '";
        while (*begin) {
            cerr << *begin++;
        }
        cerr << "'" << endl;
        throw ParseError();
    }
}

int main() {

    char c = 'A';
    char next_c = c;
    next_c++;

    while(c != 'Z'){
        plus_c[c] = next_c;
        c++;
        next_c++;
    }

    plus_c['Z'] = 'A';
    plus_c['?'] = '?';
    c = 'Z';
    next_c = 'Y';

    while(c != 'A'){
        minus_c[c] = next_c;
        c--;
        next_c--;
    }

    minus_c['A'] = 'Z';
    minus_c['?'] = '?';

    while(true){

        cin >> input;

        if(input[0] == '.'){
            break;
        }

        State s = input.begin();
        string ans = Cipher(s);
        for(int i=0; i<ans.size(); i++){
            if(ans[i] == '?'){
                ans[i] = 'A';
            }
        }
        cout << ans << endl;

    }

    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define LL long long
#define MOD 1000000007
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0)
using namespace std;

int main()
{
  string a,b;
  int count=0;
  cin>>a>>b;
  for(int i=0;i<a.size();i++){
  	if(a[i]!=b[i])
      count++;
  }
  
  cout<<count;
  return 0;
}


Measured memory_bytes: 3900
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int,int);
void dfs( vector< vector<int> >&, int , vector<int>& );
void bfs( vector< vector<int> >&, int , vector<int>& );

void solve()
{
    int n;
    cin>>n;
    int found = 0;
    while( n > 0 )
    {
        int d = n % 10;
        if ( d == 7 )
        {
            found = 1;
            break;
        }
        n /= 10;
    }

    if ( found == 1 )
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }

}

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

void dfs ( vector< vector<int> > &v , int x , vector<int> &vis )
{
    vis[x] = 1;

    rep(i,0,v[x].size())
    {
        if( vis[v[x][i]] == 0 )
        {
            dfs(v,v[x][i],vis);
        }
    }
}

void bfs( vector< vector<int> > &v , int x , vector<int> &vis )
{
    queue<int> q;
    q.push(x);

    while( !q.empty() )
    {
        int p = q.front();
        q.pop();

        rep(i,0,v[p].size())
        {
            if ( vis[v[p][i]] == 0 )
            {
                vis[v[p][i]] = 1;
                q.push(v[p][i]);
            }
        }
    }
}

Measured memory_bytes: 3656
#include <stdio.h>
#include <string.h>

int main(void){
    char tap_dance[100], flag = 0;
    int tamanho;
    scanf("%s", tap_dance);

    tamanho = strlen(tap_dance);

    for (int i = 0; i < tamanho; i++) {
        if (i % 2 == 0) {
            if (!(tap_dance[i] == 'R' || tap_dance[i] == 'U' || tap_dance[i] == 'D')) {
                flag = 1;
            }
        } else {
            if (!(tap_dance[i] == 'L' || tap_dance[i] == 'U' || tap_dance[i] == 'D')) {
                flag = 1;
            }
        }
    }
    if (flag == 0) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;

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

Measured memory_bytes: 1024
loop do
  a,op,b = gets.split
  a = a.to_i
  b = b.to_i
  ans = case op
        when '+'
          a + b
        when '-'
          a - b
        when '*'
          a * b
        when '/'
          a / b
        when '?'
          break
        end
  puts ans
end

Measured memory_bytes: 6100
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int32_t, int32_t>;

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

  vector<vector<bool>> grid(3, vector<bool>(3, false));

  vector<Pair> from_value_to_position(101, Pair(-1, -1));
  for (int32_t r = 0; r < 3; ++r) {
    for (int32_t c = 0; c < 3; ++c) {
      int32_t value;
      cin >> value;
      from_value_to_position[value] = Pair(r, c);
    }
  }
  int32_t N;
  cin >> N;
  for (int32_t i = 0; i < N; ++i) {
    int32_t value;
    cin >> value;
    if (from_value_to_position[value].first >= 0) {
      const int32_t row = from_value_to_position[value].first;
      const int32_t col = from_value_to_position[value].second;
      grid[row][col] = true;
    }
  }

  for (int32_t i = 0; i < 3; ++i) {
    bool bingo = true;
    for (int32_t j = 0; j < 3; ++j) {
      bingo = bingo && grid[i][j];
    }
    if (bingo) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  for (int32_t i = 0; i < 3; ++i) {
    bool bingo = true;
    for (int32_t j = 0; j < 3; ++j) {
      bingo = bingo && grid[j][i];
    }
    if (bingo) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  {
    bool bingo = true;
    for (int32_t i = 0; i < 3; ++i) {
      bingo = bingo && grid[i][i];
    }
    if (bingo) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  {
    bool bingo = true;
    for (int32_t i = 0; i < 3; ++i) {
      bingo = bingo && grid[2 - i][i];
    }
    if (bingo) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N),B(N);
  for(int i=0;i<N;i++)cin >> A[i] >> B[i];
  vector<pair<int,int>> a(N);
  for(int i=0;i<N;i++){a[i]=make_pair(A[i],B[i]);}
  sort(a.begin(),a.end());
  cout << a[N-1].first+a[N-1].second << endl;
}

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

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

const int N = 2e5+10 , mod = 1e9+7;

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int n , k , s;
   cin >> n >> k >> s;
   if(s == mod - 7){
      for(int i = 0 ; i < k ; i++)
         cout << mod - 7 << " ";
      for(int i = 0 ; i < n - k ; i++)
         cout << 1 << " ";
      return 0;
   }
   for(int i = 0 ; i < k ; i++)
      cout << s << " ";
   for(int i = 0 ; i < n - k ; i++)
      cout << mod - 7 << " ";
   return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Rep(i, N) for(int i = 0; i < N; i++)
#define Reps(i, x, N) for(int i = x; i < N; i++)

const int LLINF = 1LL << 60;

signed main()
{
  int N, M;
  
  while(cin >> N >> M, N || M) {
    int A[105], B[105];
    Rep(i, N) cin >> A[i];
    Rep(i, M) cin >> B[i];
    
    int sa = accumulate(B, B + M, 0LL) - accumulate(A, A + N, 0LL);
    if(sa & 1) cout << -1 << endl;
    else {
      int di = LLINF, dj = LLINF;
      Rep(i, N) {
	Rep(j, M) {
	  if(B[j] - A[i] == sa / 2) {
	    if(di == LLINF || dj == LLINF || B[dj] + A[di] > B[j] + A[i]) {
	      di = i, dj = j;
	    }
	  }
	}
      }

      if(di != LLINF && dj != LLINF) {
	cout << A[di] << " " << B[dj] << endl;
      } else {
	cout << -1 << endl;
      }
    }
  }

  return 0;
}
    

Measured memory_bytes: 2972
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
typedef pair<int, int> P;
// 距離がD1同士の点を二つに分ける->2部グラフになるので、点が多い集合を選んで行く
// oo or ox or xo or xx

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,d1,d2;
  cin>>n>>d1>>d2;
  vector<vector<int> > alive(2 * n, vector<int>(2 * n, 1));
  vector<int> SQRT(4*n*n+1,-1);
  FOR(i,0,2*n+1){
    SQRT[i * i] = i;
  }
  FOR(t,0,2){
    int d = (t == 0 ? d1 : d2);
    vector<vector<int> > gr(2 * n, vector<int>(2 * n, 0));
    FOR(i,0,2*n){
      FOR(j,0,2*n){
        if(gr[i][j] || alive[i][j] == 0) continue;
        gr[i][j] = 1; // 1:白,2:黒
        vector<P> que(1, P(i, j));
        FOR(k,0,que.size()){
          int x = que[k].first;
          int y = que[k].second;
          // 距離^2=dになる点を探す
          FOR(xx,0,2*n){
            int dx = d - (x - xx) * (x - xx);
            if(dx >= 0 && dx <= 4 * n * n && SQRT[dx] != -1){
              dx = SQRT[dx];
              int yy = y - dx;
              if(yy >= 0 && yy < 2 * n && alive[xx][yy] && gr[xx][yy] == 0){
                gr[xx][yy] = 3 - gr[x][y];
                que.push_back(P(xx, yy));
              }
              yy = y + dx;
              if(yy >= 0 && yy < 2 * n && alive[xx][yy] && gr[xx][yy] == 0){
                gr[xx][yy] = 3 - gr[x][y];
                que.push_back(P(xx, yy));
              }
            }
          }
        }
        vector<int> cc(3, 0);
        for(auto p : que){
          cc[gr[p.first][p.second]]++;
        }
        int best = (cc[1] > cc[2] ? 1 : 2);
        for(auto p : que){
          if(gr[p.first][p.second] != best){
            alive[p.first][p.second] = 0;
          }
        }
      }
    }
  }

  int cc = n * n;
  FOR(i,0,2*n){
    FOR(j,0,2*n){
      if(alive[i][j]){
        cout << i << " " << j << endl;
        cc--;
        if(cc==0) return 0;
      }
    }
  }
}

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

int main() {
  int H, W;
  cin >> H >> W;
  string S;
  
  for (int i = 0; i < W + 2; i++) {
    cout << "#";
  }
  cout << endl;
  
  for (int i = 0; i < H; i++) {
    cin >> S;
    cout << "#" << S << "#" << endl;
  }
  
  for (int i = 0; i < W + 2; i++) {
    cout << "#";
  }
  cout << 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;
int main() {
  int n,m;cin>>n>>m;
  
  vector<int> x(m);
  
  rep(i,m) cin>>x[i];
  
  if (n>=m) {
    cout<<0<<endl;
    return 0;
  }
  
  sort(x.begin(),x.end());
  int max = x[m-1]-x[0];
  vector<int> sa(m-1);
  
  rep(i,m-1) {
    sa.push_back(x[i+1]-x[i]);
  }
  sort(sa.begin(),sa.end());
  reverse(sa.begin(),sa.end());
  
  int del=0;
  rep(i,n-1) {
    del+=sa[i];
  }

  
  cout<<max-del<<endl;
}

Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	ll n, k, r, s, p,sum=0,rcount=0, scount = 0,pcount=0;
	cin >> n >> k >> r >> s >> p;
	string t;
	cin >> t;
	string my=t;
	for (ll i = 0; i < my.size(); i++) {
		my[i] = 'o';
	}
	bool rflag = true;
	bool sflag = true;
	bool pflag = true;

	for (ll i = 0; i < t.size(); i++) {
		if (t[i] == 'r') {
			if (i<k) {
				sum += p;
				my[i] = 'p';
				//cout << sum << endl;
				rflag = false;
				//rcount = 0;
			}
			else if (i - k >= 0 && t[i - k] != 'r') {
				sum += p;
				my[i] = 'p';
				//cout << sum << endl;
				
			}
			else if (i - k >= 0 && t[i - k] == 'r'&&my[i-k]!='p') {
				my[i] = 'p';
				sum += p;
				
			}
			
		}
		else if (t[i] == 's') {
			if (i<k) {
				sum += r;
				my[i] = 'r';
				//cout << sum << endl;
				sflag = false;
				//scount = 0;
			}
			else if (i - k >= 0 && t[i - k] != 's') {
				sum += r;
				my[i] = 'r';
				//cout << sum << endl;
				//scount = 0;
			}
			else if (i - k >= 0 && t[i - k] == 's'&&my[i-k]!='r') {
				my[i] = 'r';
				sum += r;
			}
		}
		else {
			if (i<k) {
				sum += s;
				my[i] = 's';
				pflag = false;
				//cout << sum << endl;
				//pcount = 0;
			}
			else if (i - k >= 0 && t[i - k] != 'p') {
				sum += s;
				my[i] = 's';
				//cout << sum << endl;
				//pcount = 0;
			}
			else if (i - k >= 0 && t[i - k] == 'p'&&my[i-k]!='s') {
				my[i] = 's';
				sum += s;
			}
		}
	}
	cout << sum << endl;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

template <typename T>
T mod_expt(T a, std::int64_t n, T mod){
    T power {1};
    while(n > 0){
        if(n & 1){power = power * a % mod;}
        a = a * a % mod;
        n >>= 1;
    }
    return power;
}

constexpr ll MOD = 1'000'000'007;
int N, K;
int mu[100100];

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

  std::cin >> N >> K;

  mu[1] = +1;

  for(int i=2;i<=K;++i){
      int min_f = i;

      for(int j=2;j*j<=i;++j){
          if(i % j == 0){
              min_f = j;
              break;
          }
      }

      if(min_f == i){ // i is prime
          mu[i] = -1;
      }else if(i / min_f % min_f > 0){ // i has min_f as square-free integer
          mu[i] = mu[min_f] * mu[i / min_f];
      }
  }

  ll res = 0;

  for(int i=1;i<=K;++i){
      ll cnt = 0;

      for(int j=1;j<=K/i;++j){
          cnt = cnt + mu[j] * mod_expt<ll>(K / i / j, N, MOD);

          if(cnt < 0){
              cnt += MOD;
          }
      }

      res = (res + cnt * i) % MOD;
  }

  std::cout << res << std::endl;
}


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

using namespace std;
using ll = long long;

typedef pair<int, int> pii;

#define read freopen("in.txt", "r", stdin)
#define write freopen("out.txt", "w", stdout)
#define ff first
#define ss second

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

    int t = 1;
    // cin >> t;
    while (t--) {
        int n, m;
        cin >> n >> m;
        vector<int> h(n);
        vector<int> height(n, -1);
        for (int i = 0; i < n; ++i) {
            cin >> h[i];
        }
        priority_queue<int> adj[n];
        for (int i = 0; i < m; ++i) {
            int u, v;
            cin >> u >> v;
            u--;
            v--;
            height[u] = max(height[u], h[v]);
            height[v] = max(height[v], h[u]);
        }
        int c = 0;
        for (int i = 0; i < n; ++i) {
            if (height[i] >= h[i])
                continue;
            c++;
        }
        cout << c << "\n";
    }

    return 0;
}

Measured memory_bytes: 7220
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    shojikin = 1000
    mochikabu = 0

    result = []
    for idx, a in enumerate(A[:-1]):
        if A[idx] <= A[idx+1]:
            available = shojikin // A[idx]
            mochikabu += available
            shojikin -= available * A[idx]

        elif A[idx] > A[idx+1]:
            shojikin += mochikabu * A[idx]
            mochikabu = 0

    shojikin += mochikabu * A[-1]
    print(shojikin)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9240
#include<stdio.h>

int LIS(void);

int h[201],r[201],m,n;

int main(void)
{
  int i,j,t;
  while(1)
    {
      scanf("%d",&n);
      if(n==0)break;

      for(i=0;i<n;i++)
	scanf("%d%d",&h[i],&r[i]);

      scanf("%d",&m);

      for(i=n;i<n+m;i++)
	scanf("%d%d",&h[i],&r[i]);


       for(i=0;i<n+m;i++)
	{
	  for(j=0;j<n+m;j++)
	    {
	      if(h[i]<h[j])
		{
		  t=h[i];
		  h[i]=h[j];
		  h[j]=t;
		  t=r[i];
		  r [i]=r[j];
		  r[j]=t;
		}
	      if(h[i]==h[j] && r[i]<r[j])
		{
		  t=h[i];
		  h[i]=h[j];
		  h[j]=t;
		  t=r[i];
		  r [i]=r[j];
		  r[j]=t;
		}
	    }
	}
       printf("%d\n",LIS());

    }
  return 0;
}

int LIS(void)
{
  int i,j,k,L[201],max=0;
  
  for(i=0;i<201;i++)
    L[i]=1;

  for(i=1;i<n+m;i++)
    {
      j=i-1;

	  for(k=0;k<i;k++)
	    {
	      if(r[k]<r[i] && h[k]<h[i] && L[k]>=L[i])L[i]=L[k]+1;
	    }
    }
  
  for(i=0;i<n+m;i++)
    if(max<L[i])max=L[i];

  return max;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int n, g, p;
	int vg, vp;
	int point = 0;
	string s;
	g = p = vg = vp = 0;

	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		if (s.at(i) == 'g') {
			vg++;
		}
		else {
			vp++;
		}
	}

	for (int i = 0; i < s.length(); i++) {
		if (s.at(i) == 'g') {
			vg--;
			if (vp < g-p) {
				p++;
				point++;
			}
			else {
				g++;
			}
		}
		else {
			vp--;
			if (p < g) {
				p++;
			}
			else {
				g++;
				point--;
			}
		}
	}

	cout << point << endl;
}


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

void trace(vector<int> T){
  int N = T.size();
  for ( int i = 0 ; i < N ; i++ ){
  	cout << T.at(i) ;
    if( i == N-1 ) 
      cout << endl;
    else
      cout << " ";
  }
  return;
}

int main() {
  int N;
  cin >> N ;
  
  vector<int> T(N);
  for ( int i = 0 ; i < N ; i++ ){
    cin >> T.at(i);
  }
  trace(T);
  
  for ( int i = 1 ; i < N ; i++ ){
    int v = T.at(i) ;
    int j = i - 1 ;
	while( j >= 0 && T.at(j) > v){
      	T.at(j+1) = T.at(j) ;
        j--;
      }
    T.at(j+1) = v;
    trace(T);
  }   
}


Measured memory_bytes: 3164
N, K = list(map(int, input().split()))

okashi_count = list()

for p in range(N):
    okashi_count.append(0)

non_holder = 0

for n in range(K):
    _ = input()
    S = list(map(int, input().split()))
    for s in S:
        okashi_count[int(s) - 1] += 1

for l in okashi_count:
    if l == 0:
        non_holder += 1

print(non_holder)

Measured memory_bytes: 67868
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

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

	int ans = 0;

	for(int i = 3; i <= N; i+=2){

		int tmp = 0;
		for(int k = 1; k*k <= i; k++){
			if(i%k != 0)continue;
			int another = i/k;

			if(k != another){

				tmp += 2;

			}else{

				tmp += 1;
			}

		}
		if(tmp == 8){

			ans++;
		}
	}

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

	return 0;
}


Measured memory_bytes: 3824
N = int(input())
flag = 0

for i  in range(9):
    atai = N / (i + 1) 
    for j in range(9):
        if atai == j + 1:
            flag = 1
            break
    if flag == 1:
        break
if flag == 1:
    print("Yes")
else:
    print("No")

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


int main(){
  int N, M, i, j, c = 0, cmax = 0;;
  
  cin >> N ;

  vector<string> s(N);
  
  for(i=0;i<N;i++){
    cin >> s.at(i);
  }

  cin >> M;

  vector<string> t(M);
  
  for(i=0;i<M;i++){
    cin >> t.at(i);
  }

  for(i=0;i<N;i++){
    for(j=i;j<N;j++){
      if(s.at(i) == s.at(j))
	c++;
    }
    for(j=0;j<M;j++){
      if(s.at(i) == t.at(j))
	c--;
    }
    if(c > cmax)
      cmax = c;
    c = 0;
  }
  
  cout << cmax << endl;    

}


Measured memory_bytes: 256
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;
// const int INF = 1000000;

int main(){
  int d;
  cin >> d;
  if(d==25){
    printf("Christmas\n");
  }else if(d==24){
    printf("Christmas Eve\n");
  }else if(d==23){
    printf("Christmas Eve Eve\n");
  }else{
    printf("Christmas Eve Eve Eve\n");
  }
  return 0;
}


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

int main()
{
	int max = 0;
	int max2 = 0;
	int max3= 0;
	int a[10];
	bool flag = false;

	for (int i = 0; i < 10; i++) {
		scanf("%d", &a[i]);
		if (max < a[i]) max = a[i];
	}
	
	for (int i = 0; i < 10; i++) {
		if (!flag && a[i] == max) {
			flag = true;
			a[i] = 0;
		}
		if (max2 < a[i]) max2 = a[i];
	}

	flag = false;

	for (int i = 0; i < 10; i++) {
		if (!flag && a[i] == max2) {
			flag = true;
			a[i] = 0;
		}
		if (max3 < a[i]) max3 = a[i];
	}
		printf("%d\n", max);
		printf("%d\n", max2);
		printf("%d\n", max3);

		return (0);
	
}

Measured memory_bytes: 1188
import java.util.Scanner;
public class Main {
private static Scanner s = new Scanner(System.in);
private static int[] a = new int[45];
public static void main(String[] args) {

int n = s.nextInt();
fibonacci(n);
System.out.println(a[n]);
}

static void fibonacci(int n) {
	a[0] = 1;
	a[1] = 1;
	for(int i = 2;i <= n;i++) {
		a[i] = a[i-2] + a[i-1];
	}
}
}


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

int main(void) {
    int A[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> A[i][j];
        }
    }
    int N;
    cin >> N;
    vector< int > b(N);
    for (int i = 0; i < N; i++) {
        cin >> b[i];
    }
    bool c[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            c[i][j] = false;
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                if (b[i] == A[j][k]) {
                    c[j][k] = true;
                }
            }
        }
    }
    bool flag;
    for (int i = 0; i < 3; i++) {
        flag = true;
        for (int j = 0; j < 3; j++) {
            if (c[i][j] == false) {
                flag = false;
                break;
            }
        }
        if (flag) {
            printf("Yes\n");
            return 0;
        }
    }
    for (int i = 0; i < 3; i++) {
        flag = true;
        for (int j = 0; j < 3; j++) {
            if (c[j][i] == false) {
                flag = false;
                break;
            }
        }
        if (flag) {
            printf("Yes\n");
            return 0;
        }
    }
    flag = true;
    for (int i = 0; i < 3; i++) {
        if (c[i][i] == false) {
            flag = false;
            break;
        }
    }
    if (flag) {
        printf("Yes\n");
        return 0;
    }
    flag = true;
    for (int i = 0; i < 3; i++) {
        if (c[2 - i][i] == false) {
            flag = false;
        }
    }
    if (flag) {
        printf("Yes\n");
        return 0;
    }
    printf("No\n");
    return 0;
}


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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

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

  ll a, b, c, d;
  cin >> a >> b >> c >> d;

  ll l = c * d / gcd(c, d);

  ll nx = (a - 1) / c + (a - 1) / d - (a - 1) / l;
  nx = a - 1 - nx;
  ll ny = b / c + b / d - b / l;
  ny = b - ny;

  cout << ny - nx << endl;

  return 0;
}


Measured memory_bytes: 3576
#include <stdio.h>
#include <stdlib.h>

int cmp( const void *p, const void *q ) {
  return *(int*)p - *(int*)q;
}

int main(void){

  int k,n,h[100005],d[100005],min=1000000000;
  scanf("%d %d",&n,&k);
  for(int i=0;i<n;i++){
    scanf("%d",&h[i]);
  }
  qsort(h, n, sizeof(int),cmp);
  for(int i=0;i<n-k+1;i++){
    d[i]=h[i+k-1]-h[i];
    if(min>d[i]) min=d[i];
  }
  printf("%d\n",min);
  return 0;
  }

Measured memory_bytes: 2304
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int n, k;
    cin >> n >> k;
    vector<int>a(n);
    rep(i,n)cin >> a[i];
    sort(a.begin(), a.end());
    ll ans = 0;
    rep(i,k)ans += a[i];
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};



signed main(){
  string s;cin>>s;
  if(s.size()==2){
    cout<<s<<endl;
  }else{
    reverse(s.begin(),s.end());
    cout<<s<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from itertools import product
def inpl(): return list(map(int, input().split()))

N, A, B, C = inpl()
L = [int(input()) for _ in range(N)]

ans = 1e9

def calc(Q, D):
    res = 1e9
    if min(Q) >= D:
        return min(Q) - D

    for j in range(1, 2**len(Q)):
        C = [Q[i] for i in range(len(Q)) if (j >> i)&1 == 1]
        S = sum(C)
        tmp = 10*(len(C)-1) + abs(D-S)
        res = min(tmp, res)
    return res


for X in product(range(3), repeat=N):
    P = [[] for _ in range(3)]
    for i, x in enumerate(X):
        P[x].append(L[i])
    if min(map(len, P)) == 0:
        continue
    tmp = 0
    for Q, D in zip(P, [A, B, C]):
        tmp += calc(Q, D)
    if tmp < ans:
        ans = min(tmp, ans)

print(ans)

Measured memory_bytes: 52444
N=int(input())
ball=list(map(int,input().split()))
cnt={}
dif={}
for b in ball:
    if b in cnt:
        cnt[b]+=1
    else:
        cnt[b]=1
total=0
for k,cn in cnt.items():
    total+=cn*(cn-1)//2
    dif[k]=(cn-1)*(cn-2)//2-cn*(cn-1)//2
for b in ball:
    print(total+dif[b])


Measured memory_bytes: 31648
#include <stdio.h>

int main(void)
{
    int x,y,t,i;
    
    do{
        scanf("%d%d",&x,&y);
        if(x>y){
            t=x;
            x=y;
            y=t;
        }
        if(x==0 && y==0){break;}
        printf("%d %d\n",x,y);
    }while(1);
    return 0;
}


Measured memory_bytes: 2052