akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.string, std.conv, std.array, std.algorithm;
import std.uni, std.range, std.math, std.container, std.datetime;
import core.bitop, std.typetuple, std.typecons;

immutable long MOD = 1_000_000_007;
alias tie = TypeTuple;
alias triplet = Tuple!(int, int, int);

void main(){
    long m, n;
    readVars(m, n);

    auto ans = modpow(m, n, MOD);

    writeln(ans);
}

int gcd(int x, int y){
    return y ? gcd(y, x % y) : x;
}

long modpow(long x, long y, long mod){
    return y ? ((modpow(x, y>>1, mod)^^2) % mod * x^^(y&1)) % mod : 1;
}


void readVars(T...)(auto ref T args){
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        throw new Exception("args num < input num");
    }
}

Measured memory_bytes: 2768
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int  a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
		int k = sc.nextInt();
		for(int i = 0; i < k; i++) {
			if(a >= b) {
				b *= 2;
			}else if(b >= c) {
				c *= 2;
			}
		}
		if(a < b && b < c) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 32784
n = int(input())
t, a =map(int, input().split())
h = list(map(int, input().split()))

ans = 1
res = 10**10
for i in range(n):
    if abs(a - (t - h[i] * 0.006)) < res:
        res = abs(a - (t - h[i] * 0.006))
        ans = i + 1
print(ans)

Measured memory_bytes: 9204
//OPTIMIZATONS
#pragma GCC optimize("02")
//CODE
#include<bits/stdc++.h>
#define int long long
#define float double
#define endl "\n"
#define debug cout<<"Good uptill here"<<endl<<flush;
#define deb(x) cout<<#x<<":"<<x<<endl<<flush;

using namespace std;

const int inf = 1e17 + 7;
const int MOD = 1e7 + 9;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	//CODE FOR SPECIFIED INPUT AND OUTPUT
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a,b,c;
	cin>>a>>b>>c;
	swap(a,b);
	swap(a,c);
	cout<<a<<" "<<b<<" "<<c<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

//////////////////////////////////////
vmint f, finv, inv;

void finit(ll N) {
	f.assign(N + 1, 1);
	finv.assign(N + 1, 1);
	inv.assign(N + 1, 1);
	inv[1] = 1;

	repn(i, N) {
		f[i] = f[i - 1] * i;
		if (i > 1)inv[i] = -inv[MOD % i] * (MOD / i);
		finv[i] = finv[i - 1] * inv[i];
	}
}

mint com(ll a, ll b) {
	if (a < 0 || b < 0 || a < b) { return 0; }
	return f[a] * finv[b] * finv[a - b];
}

int main() {
	ll B, W;
	cin >> B >> W;

	ll N = B + W;
	finit(N + 1);
	vmint ball(N + 1, 0), wall(N + 1, 0);

	repn(i, N) {
		ball[i] = ball[i - 1]*2 + com(i - 1, B - 1);
		wall[i] = wall[i - 1] * 2 + com(i - 1, W - 1);
	}

	repn(i, N) {
		mint all = pw(2, i);

		mint ans = all/2 - ball[i-1] - wall[i-1] + wall[i-1]*2;

		cout << ans / all << endl;
	}
}

Measured memory_bytes: 11040
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

using namespace std;

typedef long long ll;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>pb_ds;

#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
#define pi pair<int,int>
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define mod 1000000007
#define pai acos(-1)
#define N 200005

ll ar[N],prefix[N];

int main ()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   int n;cin>>n;
   for(int i=1;i<=n;i++){
      cin>>ar[i];
      prefix[i]=(prefix[i-1]+ar[i])%mod;
   }
   ll ans=0;
   for(int i=2;i<=n;i++){
      ll sum=(prefix[n]-prefix[i-1]+mod)%mod;
      ans=(ans+((ar[i-1]*sum)%mod))%mod;
   }
   cout<<ans<<"\n";
   return 0;
}



Measured memory_bytes: 6736
#include <iostream>
#include <string>
#include <bitset>
#include <cmath>
using namespace std;

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

	int n = s.size();
	int64_t b =0;

	for (int bit = 0; bit < (1 << n-1); ++bit){
		bitset<10> a(bit);

		int64_t t = 0;
		t += s.at(n - 1)-'0';
		int c = 0;
		for (int i = 2; i <= n; i++) {
			if (a.test(i-2) == 1) {
				c = 0;
			}
			else {
				c++;
			}
			t += (s.at(n-i)-'0')*pow(10, c);

		}

		b += t;
		
	}

	cout << b << endl;

	return 0;
}

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

int main() {
    int n, x;
    cin >> n;
    int res = 0;
    for(int i=1; i <= n; i++) {
        cin >> x;
        if(i & 1 && x & 1) res++;
    }
    cout << res;
}

Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;

const int nax = 1e5+ 5;
vector<int> edges[nax];
int in_degree[nax];
int dist[nax];
bool visited[nax];

void dfs(int a){
    assert(!visited[a]);
    visited[a] = true;
    for(int b: edges[a]){
        dist[b] = max(dist[b], dist[a] + 1);    
        --in_degree[b];
        if(in_degree[b]==0)
            dfs(b);
    }
}

int main() {
    int n,m;
    
    cin >> n >> m;
    while(m--){
        int a,b;
        cin >> a >> b;
        edges[a].push_back(b);
        in_degree[b]++;
    }
    
    for(int i = 1; i <= n; i++){
        if(!visited[i] && in_degree[i] == 0)
            dfs(i);
    }
    
    int answer = 0;
    for(int i = 1; i <=n; i++ )
        answer = max(answer, dist[i]);
        
    cout<<answer;
}

Measured memory_bytes: 9728
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define INF 10000000


int main(){
	int sum1=0,a,sum2=0;
	REP(i,4){
		cin>>a;
		sum1+=a;
	}
	REP(i,4){
		cin>>a;
		sum2+=a;
	}
	cout<<max(sum1,sum2)<<endl;
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
     int N, M;
    cin >> N >> M;
 
    vector<int> A(N);
    priority_queue<int> que;
    for (int i = 0; i < N; i++){
        cin >> A[i];
        que.push(A[i]);
    }
 
    for (int i = 0; i < M; i++) {
        int cost = que.top();
        que.pop();
        que.push(cost / 2);
    }
 
    long long ans = 0;
    while (que.empty() != true) {
        ans += que.top();
        que.pop();
    }
 
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 1276
import math
x=0
y=0
face=math.pi/2
while True:
  d,a = map(int,input().split(","))
  if d==0 and a==0:
    break
  x+=math.cos(face)*d
  y+=math.sin(face)*d
  face -=a*math.pi/180
  
  
print(int(x))
print(int(y))


Measured memory_bytes: 5720
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
void trace(int n, vector<ll> arr){for(int i = 0; i < n; i++){cout << arr[i] << " ";} cout << endl << endl;}
const ll mod = 1e9 + 7;
int main()
{
    Hello
    int a;
    cin >> a;
    cout << a + pow(a, 2) + pow(a, 3);
    return 0;
}

Measured memory_bytes: 4308
#include<stdio.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i = 0;i < n;i++)
#define PRN(n) printf("%d\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(s) printf("%c",s)
int x[200000],y[200000];
int main(void){
  int n,m;
  scanf("%d %d",&n,&m);
  int a,b;
  FOR(m){
    scanf("%d %d",&a,&b);
    if(a==1)x[b]=1;
    if(b==n)y[a]=1;
  }
  FOR(n){
    if(x[i]+y[i]==2){
      PRS("POSSIBLE");
      return 0;
    }
  }
  PRS("IMPOSSIBLE");
  return 0;
}
/*
scanf("%d",&n);
scanf("%d %d",&a,&b);
*/

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,n,x,m=1000000010,cnt=0;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>x;
		if(x<=m){
			cnt++;
		}
		m=min(x,m);
	}
	cout<<cnt<<endl;
	return 0;
}

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

int main(void){
  int N;
  double xa,ya,ra,xb,yb,rb;
  double px,py,q;
  int i;

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%lf %lf %lf %lf %lf %lf",&xa,&ya,&ra,&xb,&yb,&rb);
    px=xa-xb;
    py=ya-yb;
    q=sqrt(px*px+py*py);
    if((ra-rb)>q){
      printf("2\n");
    }else if((rb-ra)>q){
      printf("-2\n");
    }else if((ra+rb)>=q){
      printf("1\n");
    }else{
      printf("0\n");
    }
  }
  return 0;
}

Measured memory_bytes: 620
#include <iostream>

using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a > b) { int t = a; a = b; b = t; }
    if (a > c) { int t = a; a = c; c = t; }
    if (b > c) { int t = b; b = c; c = t; }
    cout << a << " " << b << " " << c << endl;    

    return 0;
}

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

int main() {
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    vector<int> ary;
    ary.push_back(a);
    ary.push_back(b);
    ary.push_back(c);
    ary.push_back(d);
    ary.push_back(e);
    sort(ary.begin(), ary.end());
    cout << ary[4] << " " << ary[3] << " " << ary[2] << " " << ary[1] << " " << ary[0] << endl;
    return 0;
}

Measured memory_bytes: 3128
// 2016-12-02
#include <iostream>
#include <string>
using namespace std;

int main() {
	int n, c;
	bool l, r;
	string s;
	while (cin >> n, n) {
		c = 0;
		l = r = false;
		for (int i = 0; i < n; i++) {
			cin >> s;
			if (s[0] == 'l') {
				l ^= true;
			} else {
				r ^= true;
			}
			if (l && r) {
				c++;
				l = r = false;
			}
		}
		cout << c << endl;
	}
	return 0;
}

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

using namespace std;

using ll=long long;

vector<vector<ll>>dp(3010,vector<ll>(3010,0));

int main()
{
    int n;
    cin>>n;
    vector<ll>a(n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int lo=n-1;lo>=0;lo--)
    {
        for(int hi=lo;hi<=n-1;hi++)
        {
            if(lo==hi)
                dp[lo][hi]=a[lo];
            else
                dp[lo][hi]=max(a[lo]-dp[lo+1][hi],a[hi]-dp[lo][hi-1]);
        }
    }
    cout<<dp[0][n-1]<<endl;
}


Measured memory_bytes: 71168
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a) for(int i=(a);;++i)
#define REP(i,n)  FOR(i,0,n)
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(int argc, const char * argv[]) {
    int H,W;
    while(true){
        cin >> H >> W;
        if(H==0 && W==0) break;
        FOR(i, 0, H){
            FOR(j, 0, W) cout << '#' ;
            cout << endl;
        }
        cout << endl;
    }
}



Measured memory_bytes: 3088
import scala.io.StdIn

object Main extends App {
  
  val a = StdIn.readLine().trim.split(' ').map(_.toInt)
  val t = a(2)
  /*
  val result = (a(0) to a(1)).foldLeft(0) { (acc, i) =>
    if(t % i == 0) acc + 1 else acc
  }*/

  /*
   ref
   http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2388634#1
   */
  val result = (a(0) to a(1)).filter(p => t % p == 0).size
  println(result)

}


Measured memory_bytes: 44100
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
  int a, b;
  scanf("%d%d", &a, &b);
  if (a < 0 && b > 0)
  {
    puts("Zero");
    return 0;
  }
  int mul = 1;
  for (int i = a; i <= b; i++) {
    mul *= (i>0) - (i<0);
  }
  if (mul > 0) puts("Positive");
  else if (mul) puts("Negative");
  else puts("Zero");
  return 0;
}

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

int main()
{
  long H, N, sum = 0;
  std::cin >> H >> N;
  for (int i = 0; i < N; i++)
  {
    int tmp;
    std::cin >> tmp;
    sum += tmp;
  }
  if (H > sum) std::cout << "No" << std::endl;
  else std::cout << "Yes" << std::endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
            System.out.println("Possible");
        } else {
            System.out.println("Impossible");
        }
    }
}

Measured memory_bytes: 23124
using System;
using System.Collections.Generic;
using System.Linq;

namespace AC
{
    class Program
    {
        static void Main(string[] args)
        {
            var X = ReadLong();
            var ans = 0L;
            ans += X / 500 * 1000;
            X %= 500;
            ans += X / 5 * 5;

            Console.WriteLine(ans);
            Console.ReadKey();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static string[] ReadArrayString() { return Read().Split(' '); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
using P = pair<string,int>;

int main(){
    int N;
    cin>>N;
    vector<pair<P,int> > ISP(N);
    
    for(int i=0; i<N; i++){
        ISP[i].second=i+1;
        cin>>ISP[i].first.first>>ISP[i].first.second;
        ISP[i].first.second*=-1;
    }
    sort(ISP.begin(),ISP.end());
    //reverse(ISP.begin(),ISP.end());
    for(int i=0; i<N; i++) cout<<ISP[i].second<<"\n";
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define REP(i, N) for(int i = 0; i < N; ++i)
#define REEP(i, N) for(int i = N - 1; i >= 0; --i)
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,m,n) for(int i = m; i < n; ++i)
#define RFOR(i,m,n) for(int i = n - 1; i >= m; --i)
#define CIN(a) cin >> a
#define CIN2(a, b) cin >> a >> b
#define CIN3(a, b, c) cin >> a >> b >> c
#define COUT(a) cout << a << endl
#define COUT2(a, b) cout << a << " " << b << endl
#define COUT3(a, b, c) cout << a << " " << b << " " << c << endl
#define pb push_back
#define PB push_back
#define VINT(v, n) vector<int> v(n); REP(i, n) { v[i] = 0 }
#define VINT2(v, n, m) vector<vector<int> > v(n, vector<int>(m)); REP(i, n) { REP(j, m) { v[i][j] = 0 } }
#define VCHAR(v, n) vector<char>v(n)
#define KIRIAGE(a, b) a += (b - a % b) % b
#define CEIL(c, a, b) if(a % b == 0) { c = a / b;} else { c = a / b + 1;}
#define sp(n) setprecision(n)
#define INF 1000000000
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef long long ll;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
	int W, H, N;
	CIN3(W, H, N);
	int Wm = 0;
	int WM = W;
	int Hm = 0;
	int HM = H;
	bool f = true;
	REP(i, N) {
		int x, y, a;
		CIN3(x, y, a);
		switch(a) {
			case 1 :
				if(WM <= x) f = false;
				Wm = max(Wm, x);
				break;
			case 2 :
				if(x <= Wm) f = false;
				WM = min(WM, x);
				break;
			case 3 :
				if(HM <= y) f = false;
				Hm = max(Hm, y);
				break;
			case 4 :
				if(Hm >= y) f = false;
				HM = min(HM, y);
				break;
		}
		if(!f) {
			WM = Wm;
			HM = Hm;
			break;
		}
	}
	int ans = (WM - Wm) * (HM - Hm);
	COUT(ans);
}


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

int main(){
    ll d,t,s;
    cin >> d >> t >> s;

    if(s*t>=d){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl; 
    }
    

    return 0;
}

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

int main(){
  int a,b;
  int cnt = 0;

  cin >> a >> b;

  if(b >= a)
    {
      
  for(int i = a;i > 0;i--)
    {
      cnt++;
    }
  cout << cnt << endl;
  
    }
  else
    {
      for(int i = a;i > 0;i--)
    {
      cnt++;
    }
  cout << cnt-1 << endl;
  
    }
}


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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    A=LI()
    A.sort()
    flag=1
    for i in range(N-1):
        if A[i]==A[i+1]:
            flag=0
            break
        
    if flag:
        print("YES")
    else:
        print("NO")

main()


Measured memory_bytes: 103556
n =  int(input())
A = list(map(int, input().split()))

l = []
for a in A:
    if a % 2 == 0:
        l.append(a)

if all([i % 3 ==0 or i % 5 ==0 for i in l]):
    print('APPROVED')
else:
    print('DENIED')

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

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

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


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

	cin >> N;
	vector<int>v(N);
	vector<int>num(1000001);
	for (auto &i : v) {
		cin >> i;
		num[i]++;
	}
	int ans = 0;
	for (auto i : v) {
		int add = 1;
		num[i]--;
		for (int j = 1; j*j <= i; j++) {
			if (i%j)continue;
			if (num[j]) {
				add = 0;
				break;
			}
			if (num[i / j]) {
				add = 0;
				break;
			}
		}
		num[i]++;
		ans += add;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7916
#include <iostream>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <queue>
#include <cstring>
#include <set>
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

using namespace std;

int n, m, e, s, t, r;
int memo[1 << 8][100][100];

vector<int> g[100];
pair<int, pair<int, int> > ev[8];
int evmemo[100];
const int inf = 1 << 28;

struct data{
  int cost;
  int flag;
  int pos;
  int move;
  data(int c, int f, int p, int m)
    : cost(c), flag(f), pos(p), move(m){}
};

bool operator < (const data &lhs, const data &rhs){
  return lhs.cost > rhs.cost;
}

int main(){
  n = getInt();
  m = getInt();
  e = getInt();
  s = getInt();
  t = getInt();
  r = getInt();

  memset(memo, -1, sizeof(memo));
  memset(evmemo, -1, sizeof(evmemo));

  REP(i,m){
    const int a = getInt();
    const int b = getInt();

    g[a].push_back(b);
    g[b].push_back(a);
  }

  REP(i,e){
    const int a = getInt();
    const int b = getInt();
    const int c = getInt();

    ev[i] = make_pair(c, make_pair(a, b));
    evmemo[c] = i;
  }

  int f = 0;
  if(evmemo[s] != -1)
    f |= 1 << evmemo[s];

  priority_queue<data> pq;
  pq.push(data(0, f, s, 0));

  while(pq.size()){
    const data d = pq.top(); pq.pop();
    const int cost = d.cost;
    const int flag = d.flag;
    const int pos = d.pos;
    const int move = d.move;

    // printf("%d %d %d: %d\n", flag, pos, move, cost);

    if(memo[flag][pos][move] != -1) continue;
    if(pos == t){
      printf("%d\n", cost);
      return 0;
    }

    memo[flag][pos][move] = cost;
    if(memo[flag][s][0] == -1)
      pq.push(data(cost + 1, flag, s, 0));
    if(move == r) continue;

    REP(i,g[pos].size()){
      const int next = g[pos][i];
      int ff = flag;
      if(evmemo[next] != -1)
        ff |= 1 << evmemo[next];
      if(memo[ff][next][move + 1] == -1)
        pq.push(data(cost + 1, ff, next, move + 1));
    }

    REP(i,e) if(flag & (1 << i)){
      const int a = ev[i].second.first;
      const int b = ev[i].second.second;
      int next = -1;
      if(a == pos) next = b;
      if(b == pos) next = a;
      if(next != -1){
        int ff = flag;
        if(evmemo[next] != -1)
          ff |= 1 << evmemo[next];
        if(memo[ff][next][move + 1] == -1)
          pq.push(data(cost + 1, ff, next, move + 1));
      }
    }

  }

  puts("-1");
  return 0;
}

Measured memory_bytes: 11360
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i > n; --i)
const int MOD = 1000000007;

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

ll lcm(ll a, ll b){
  return a / gcd(a, b) * b;
}



ll div(ll n, ll a, ll b) {
  ll c = lcm(a, b);
  ll A = n / a;
  ll B = n / b;
  ll C = n / c;
  ll S = A + B - C;
  return n - S;
}

int main() {
  ll A, B, C, D;
  cin >> A >> B >> C >> D;
  cout << div(B, C, D) - div(A-1, C, D) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
using namespace std;
int matrix[30][30];
int n,cost;
bool visited[30];
vector<int> edge;
int dis[30],sam;


void dfs(int x,int cnt){
  visited[x] = true;
  dis[x] = cnt;
  for(int i=1;i<=n;i++){
    if(matrix[x][i] != -1 && i != x && !visited[i]){
      dfs(i,cnt+matrix[x][i]);
    }
  }
}

void dfs2(int x){
  visited[x] = true;
  for(int i=1;i<=n;i++){
    if(!visited[i] && matrix[x][i] != -1){
      if(edge[i] == 1){
	visited[i] = true;
	continue;
      }
      sam+=matrix[x][i];
      dfs2(i);
    }
  }
}



int main(){
  int a,b,c;

  while(cin >> n && n){
    cost = sam = 0;
    for(int i=0;i<30;i++){ dis[i] = 0; visited[i] = false;}
    for(int i=0;i<30;i++)for(int j=0;j<30;j++)matrix[j][i]=-1;
    edge.clear();
    for(int i=0;i<n-1;i++){
      cin >> a >> b >> c;
      matrix[a][b] = matrix[b][a] = c;
    }
    edge.push_back(0);
    for(int i=1;i<=n;i++){
      int count = 0;
      for(int j=1;j<=n;j++)if(matrix[i][j] != -1)count++;
      edge.push_back(count);
    }
    dfs(1,0);
    for(int i=0;i<30;i++)visited[i] = false;
    dfs2(1);
    int mex = 0;
    for(int i=1;i<=n;i++){
      if(edge[i] != 1){
	mex = max(mex,dis[i]);
      }
    }
    cout << sam*2-mex << endl;
  }
  return 0;
}

Measured memory_bytes: 1224
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long L0 = 2L;
		long L1 = 1L;
		int N = sc.nextInt();
		long Li1 = L0;
		long Li2 = L1;
		long ryuka = 0;
		if(N == 0) {
			System.out.println(L0);
			System.exit(0);
		}
		if(N == 1) {
			System.out.println(L1);
			System.exit(0);
		}

		for(int i = 1;i < N;i++) {
			ryuka = Li1 + Li2;
			Li1 = Li2;
			Li2 = ryuka;
		}
		System.out.println(ryuka);
	}

}

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

int64_t mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    vector<vector<int>> l(3, vector<int>(3));
    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 3; j++)
            cin >> l[i][j];
    bool v = true;
    int x, y, z;
    x = l[0][1] - l[0][0], y = l[1][1] - l[1][0], z = l[2][1] - l[2][0];
    if (x != y || y != z || z != x)
        v = false;
    x = l[0][1] - l[0][2], y = l[1][1] - l[1][2], z = l[2][1] - l[2][2];
    if (x != y || y != z || z != x)
        v = false;
    x = l[1][0] - l[0][0], y = l[1][1] - l[0][1], z = l[1][2] - l[0][2];
    if (x != y || y != z || z != x)
        v = false;
    x = l[1][0] - l[2][0], y = l[1][1] - l[2][1], z = l[1][2] - l[2][2];
    if (x != y || y != z || z != x)
        v = false;
    cout << (v ? "Yes" : "No");
}

Measured memory_bytes: 256
N, M, X = [int(x) for x in input().split(" ")]
arr = [0 for x in range(N+1)]
for i in [int(a) for a in input().split(" ")]:
	arr[i] = 1
kiri = arr[0:X].count(1)
kanan = arr[X+1:].count(1)
print(min(kiri, kanan))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll a,b,c,n,i,j,k=0;
  cin>>a>>b>>c>>n;
  ll x[n],y[n],z[n];
  for(i=0;i<n;i++) cin>>x[i]>>y[i]>>z[i],k+=(x[i]==0)+(x[i]==a-1)+(y[i]==0)+(y[i]==b-1)+(z[i]==0)+(z[i]==c-1);
  for(i=0;i<n;i++)
    for(j=i+1;j<n;j++)
      k+=((abs(x[i]-x[j])+abs(y[i]-y[j])+abs(z[i]-z[j]))==1);
  cout << 2*(a*b+b*c+c*a)+6*n-k*2 << endl;
  return 0;
}

Measured memory_bytes: 3020
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>

using namespace std;



typedef long long ll;


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



int main() {
	
	ll n, k;

	cin >> n >> k;

	vector<int>a(n);

	rep(i, n) {
		cin >> a[i];
	}

	sort(a.rbegin(),a.rend());

	int ans = 0;

	for (int i = 0; i < k; i++) {
		ans += a[i];
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
use std::io::Read;
use std::cmp::max;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let a: isize = iterator.next().unwrap().parse().unwrap();
    let b: isize = iterator.next().unwrap().parse().unwrap();

    let ans = max(a + b,max(a - b,a * b));

    return ans.to_string();
}


Measured memory_bytes: 2088
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;//998244353;

template<class _T> static void getval(_T& a) {
	std::cin >> a;
}
template<class _T> static void getval(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getval(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}

static void exec()
{
	LLONG N, M, D;
	getval(N, M, D);

	double P = 0;
	if (D == 0) {
		P = (double)N / (double)(N * N);
	}
	else {
		P = 2.0 * (double)(N - D) / (double)(N * N);
	}
	printf("%.08lf\n", (double)(M - 1) * P);
}


Measured memory_bytes: 3744
import java.util.Scanner;

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

        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        int c = 0;

        for (int i = 0; i < 2; i++) {
            if (a > b) {
                c += a;
                a--;
            } else {
                c += b;
                b--;
            }
        }
        System.out.println(c);
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const int MOD = 1000000007;
using Data = pair<long long, vector<ll> >;

int main() {
  int n;
  cin >> n;
  int odd=0, even=0;
  rep(i,n){
    ll a;
    cin >> a;
    if(a%2==0)even++;
    else odd++;
  }
  if(odd%2==0) cout<< "YES" << endl;
  else cout << "NO" << endl;
  
  
}

Measured memory_bytes: 256
def __gcd(x,y):
    while(y!=0):
        x,y=y,x%y
    return x

def __lcm(x,y):
    g = __gcd(x,y)
    return (x//g)*y


n = int(input())
L = []
for i in range(n):
    L.append(int(input()))

#print(L)
a = L[0]
for i in range(1,n):
    a = __lcm(a,L[i])

print(a)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <numeric>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
long x, y;
int main(){
    cin >> x >> y;
    long cnt = 0;
    if(x == y){
        cout << cnt << endl;
        return 0;
    }
    else if(x >= 0 && y >= 0){//+ +
        if(y >= x)
            cnt = y - x;
        else if(y == 0)
            cnt = x - y + 1;
        else
            cnt = x - y + 2;
    }
    else if(x > 0 && y < 0){//+ -
        if(x >= abs(y))
            cnt = x - abs(y) + 1;
        else
            cnt = abs(y) - x + 1;
    }
    else if(x < 0 && y < 0){//- -
        if(x < y)
            cnt = y - x;
        else
            cnt = abs(y) - abs(x) + 2;
    }
    else if(x < 0 && y > 0){//- +
        if(abs(x) > y)
            cnt = abs(x) - y + 1;
        else
            cnt = y - abs(x) + 1;
    }
    else if(x < 0 && y == 0){//- 0
        cnt = abs(x);
    }
    else{//0 -
        cnt = abs(y) + 1;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 100005
int va[N];
int num[20];
int a[20],sz,b[1001000];
int dp[1001000];
int solve(int s)
{
	if(s==0||dp[s]) return dp[s];
	dp[s]=1;
	for(int i=s;i;)
	{
		i=(i-1)&s;
        if(b[i]==0) dp[s]=max(dp[s],solve(i)+solve(s^i));
	}
	return dp[s];
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;++i)
	{
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		va[u]^=w; va[v]^=w;
	}
	for(int i=0;i<n;++i) ++num[va[i]];
	int cnt=num[0];
	for(int i=1;i<=15;++i)
	{
		cnt+=num[i]/2;
		if(num[i]&1) a[sz++]=i;
	}
	for(int s=0;s<(1<<sz);++s)
		for(int i=0;i<sz;++i)
			if(s>>i&1)
				b[s]^=a[i];
	if(sz)cnt+=solve((1<<sz)-1);
	printf("%d\n",n-cnt);
	return 0;
}


Measured memory_bytes: 4480
N, Y = map(int, input().split())

flg = 0
for x in range(Y//10000 + 1):
    y = (Y-9000*x-1000*N)/4000
    z = N-x-y
    if y >= 0 and z >= 0:
        if int(y) == y and int(z) == z:
            flg = 1
            y, z = int(y), int(z)
            break

if flg:
    print(x, y, z)
else:
    print(-1, -1, -1)


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

using LL = long long;
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
 
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
// clang-format on

void solve(long long N, std::vector<long long> a, std::vector<long long> b, std::vector<long long> c) {
  // solver code

  LL dp[N][3];

  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];

  for (int i = 1; i < N; i++) {
    dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]);
    dp[i][1] = max(dp[i - 1][0] + b[i], dp[i - 1][2] + b[i]);
    dp[i][2] = max(dp[i - 1][0] + c[i], dp[i - 1][1] + c[i]);
  }

  LL ans = max(max(dp[N - 1][0], dp[N - 1][1]), dp[N - 1][2]);

  cout << ans << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> a(N);
  std::vector<long long> b(N);
  std::vector<long long> c(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
    scanf("%lld", &b[i]);
    scanf("%lld", &c[i]);
  }
  solve(N, std::move(a), std::move(b), std::move(c));
  return 0;
}


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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100005;

int main(){
    
    int N,K;cin>>N>>K;
    vector<pair<ll,ll>> S(N);
    for(int i=0;i<N;i++){
        cin>>S[i].first>>S[i].second;
    }
    ll ans=(1LL<<62);
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            for(int k=0;k<N;k++){
                for(int m=0;m<N;m++){
                    vector<ll> X={S[i].first,S[j].first,S[k].first,S[m].first},Y={S[i].second,S[j].second,S[k].second,S[m].second};
                    sort(all(X));
                    sort(all(Y));
                    ll x1=X[0],x2=X[3],y1=Y[0],y2=Y[3],cnt=0;
                    for(int p=0;p<N;p++){
                        ll x=S[p].first,y=S[p].second;
                        if(x1<=x&&x<=x2&&y1<=y&&y<=y2) cnt++;
                    }
                    if(cnt>=K) ans=min(ans,(x2-x1)*(y2-y1));
                }
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
using namespace std;
vector<vector<ll>>adj(200005);
vector<ll>vis(200005,0);
ll vert=0;
void dfs(ll src)
{
    vis[src]=1;
    vert++;
    for(auto i:adj[src])
    {
        if(!vis[i])
        dfs(i);
    }
}
int main() {
    fast();
    // ll t;
    // cin>>t;
    // while(t--)			
    // {
         
    // }
    ll n,m;
    cin>>n>>m;
    map<pair<ll,ll>,ll>mp;
    for(int i=0;i<m;i++)
    {
        ll x,y;
        cin>>x>>y;
        if(mp.find({x,y})==mp.end()&&mp.find({y,x})==mp.end())
        {
            adj[x].push_back(y);
            adj[y].push_back(x);
        }
    }
    ll ans=0;
    for(ll i=1;i<=n;i++)
   {
       if(!vis[i])
       {
           vert=0;
           dfs(i);
           ans=max(ans,vert);
       }
   }
   cout<<ans;
}

Measured memory_bytes: 21900
#include <bits/stdc++.h>
using namespace std;
 
long long int labs(long long int a, long long int b)
{
	return ((a>b)?a-b:b-a);
}
 
long long int lmin(long long int a, long long int b)
{
	return ((a>b)?b:a);
}
 
int main()
{
	long long int n, k, x[100001];
	cin >> n >> k;
	for (int i = 0; i < n; ++i)
	{
		cin >> x[i];
	}
	long long int ans = 1145141919;
	for (int i = k; i <= n; ++i)
	{
		ans = lmin(ans, labs(x[i-k]-x[i-1])+lmin(labs(x[i-k]),labs(x[i-1])));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
/*
ID: taoxiaa1
PROG: concom
LANG: C++
*/
//URAL ID:248353QC
#include<bits/stdc++.h>
using namespace std;
//FILE *fin, *out;
//fin = fopen("money.fin", "r");
//out = fopen("money.out", "w");
//ofstream fout("money.out");
//ifstream fin("money.in");
long long s[200005];
map<long long,int>mapp;
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%lld",&s[i]),s[i]+=s[i-1];
    long long sum=0;
    for(int i=1;i<=n;i++){
        long long a=s[i];
        if(s[i]==0)sum++;
        sum+=mapp[a];
        mapp[s[i]]++;
    }
    printf("%lld\n",sum);
    return 0;
}


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


int main(){
  int N;
  cin >> N;
  vector<long long int> A(N+1);
  A[0] = 2;
  A[1] = 1;
  for(int ii=2; ii<N+1; ii++){
    A[ii] = A[ii-1] + A[ii-2];
  }
  cout << A[N] << endl;
  return 0;
}

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

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{

		String a=nextString();
		String b=nextString();
		
		String ans ;
		if("H".equals(a)){
			if("H".equals(b)){
				ans="H";
			}else{
				ans="D";
			}
		}else{
			if("H".equals(b)){
				ans="D";
			}else{
				ans="H";
			}
			
		}
		
		
		System.out.println(ans);

	}

	public static boolean isPalindromicStr(String s) {
		int h = 0;
		int t = s.length() - 1;
		while (h <= t) {
			if (s.charAt(h) != s.charAt(t)) {
				break;
			}
			h++;
			t--;
		}
		if (h > t) {
			return true;
		}
		return false;
	}
	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 21076
k,n = map(int,input().split())
a = list(map(int,input().split()))
l = []
l.append(abs(k-abs(a[0]-a[n-1])))
for i in range(n-1):
	l.append(abs(a[i]- a[i+1]))
print(sum(l)-max(l))

Measured memory_bytes: 32216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll>numbers;
ll dp[100005][2];
int solve(ll k,int turn) {
	if (numbers.front()>k) { return !turn; }
	if (dp[k][turn] != -1) { return dp[k][turn]; }
	else {
		int res = -1;
		for (int i = 0; i < numbers.size(); ++i) {
			if(numbers[i]<=k && res!=turn){
				res = solve(k - numbers[i], turn ^ 1);
			}
			else { break; }
		}
		return dp[k][turn] = res;
	}
	
}

int main() {
	ll n, k;
	cin >> n >> k;
	for (int i = 0; i < n; ++i) {
		ll e;
		cin >> e;
		numbers.push_back(e);
	}
	sort(numbers.begin(), numbers.end());
	memset(dp, -1, sizeof(dp));
	ll ans = solve(k, 0);
	if (ans == 0) { cout << "First\n"; }
	else { cout << "Second\n"; }
	
	return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    string s; cin >> s;
    string t; cin >> t;
    ll ans = 0;
    REP(i, 3){
        if (s[i] == t[i]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N, W = map(int, input().split())
wv = [tuple(map(int, input().split())) for _ in range(N)]
w1 = wv[0][0]
l1, l2, l3, l4 = [], [], [], []

for wi, vi in wv:
    if wi==w1:
        l1.append(vi)
    elif wi==w1+1:
        l2.append(vi)
    elif wi==w1+2:
        l3.append(vi)
    else:
        l4.append(vi)

l1.sort(reverse=True)
l2.sort(reverse=True)
l3.sort(reverse=True)
l4.sort(reverse=True)

l1_acc = [0]
l2_acc = [0]
l3_acc = [0]
l4_acc = [0]

for l1_i in l1:
    l1_acc.append(l1_acc[-1]+l1_i)

for l2_i in l2:
    l2_acc.append(l2_acc[-1]+l2_i)

for l3_i in l3:
    l3_acc.append(l3_acc[-1]+l3_i)

for l4_i in l4:
    l4_acc.append(l4_acc[-1]+l4_i)

ans = 0

for i in range(len(l1)+1):
    for j in range(len(l2)+1):
        for k in range(len(l3)+1):
            for l in range(len(l4)+1):
                if w1*i+(w1+1)*j+(w1+2)*k+(w1+3)*l<=W:
                    ans = max(ans, l1_acc[i]+l2_acc[j]+l3_acc[k]+l4_acc[l])
    
print(ans)

Measured memory_bytes: 42224
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define MAXN ((int)2e5+5)
#define MOD (100000009)
#define INF (100000009)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define TRACE(x) if(DEBUG) cerr << #x << " = " << x << endl;
#define TRACE2(x,y) if(DEBUG) cerr << #x << " = " << x << " | " << #y << " = " << y << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n;
int a[MAXN];
int sc,maxx;

map <int,int> mp;

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];

		mp[a[i]]++;

		if(a[i] > maxx)
		{
			sc = max(sc,maxx);
			maxx = a[i];
		}
		else if(a[i] > sc)
			sc = a[i];
	}
	if(mp[maxx] > 1)
	{
		for (int i = 0; i < n; ++i)
			cout << maxx << endl;
		return 0;
	}


	for (int i = 0; i < n; ++i)
	{
		if(a[i] == maxx)
			cout << sc << endl;
		else
			cout << maxx << endl;
	}
}

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

int main() {
  int a, b;
  std::cin >> a >> b;
  
  std::string s;
  std::string before_s;
  int count = 0;
  for(int i=a; i<=b; i++) {
    s = std::to_string(i);
    before_s = s;
    std::reverse(s.begin(), s.end());
    if(before_s == s)
      count++;
  }
  std::cout << count;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i = 0; i < n; i++)
typedef long long ll;
// Welcome to my source code!

int main() {
    ll n;
    cin >> n;
    ll b, minv = 2000000000000;
    for (int i = 1; i <= sqrt(n); i++) {
        if (n%i == 0) {
            b = n/i;
            minv = min(minv, i+b-2);
        }
    }
    cout << minv << endl;
}

Measured memory_bytes: 256
n = int(input())
for _ in range(3,n+1):
    flag = False
    if _ % 3 == 0:
        print(" ",_,end='',sep='')
        flag = True
    for i in list(str(_)):
        if i == '3' and flag == False:
            print(" ",_,end='',sep='')
            break
print()


Measured memory_bytes: 6240
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
signed main(){
  int a,b;
  cin>>a>>b;
  vector<int> c(a);
  rep(i,a)
    cin>>c[i];
  vector<double> d(a-b+1);
  int k=0;
  rep(i,b){
  k+=c[i];
  }
  d[0]=k;
  rep1(i,a-b){
    d[i]=d[i-1]+c[b+i-1]-c[i-1];
      }
  double n=-1;
  rep(i,a-b+1)
    chmax(n,d[i]);
  cout<<setprecision(14)<<(n+b)/2<<endl;
}


Measured memory_bytes: 4992
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n;
long long ans;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		long long tmp = (1 + n / i) * 1LL * (n / i) / 2;
		ans += tmp * i;
	}
	cout << ans << E;
	//system("pause");
	return 0;
}

Measured memory_bytes: 3648