akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


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

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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ld a, b;
    cin>>a>>b;
    ll ans = (ll)(a*b);
    cout<<ans<<endl;
}

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

#define REP(i,n) REPN(i,0,n)
#define REPN(i,m,n) for(int i=m; i<(n); i++)

#define MAX 100000
#define SENTINEL 2000000000

struct Card {
    char suit;
    int value;
};

Card L[MAX/2 + 2], R[MAX/2 + 2];

// Merge Sort
void merge(Card A[], int n, int left, int mid, int right) {
    int i, j, k;
    int n1 = mid - left;
    int n2 = right - mid;
    REP(i, n1) {
        L[i] = A[left + i];
    }
    REP(i, n2) {
        R[i] = A[mid + i];
    }
    L[n1].value = R[n2].value = SENTINEL;

    i = j = 0;
    REPN(k, left, right) {
        if (L[i].value <= R[j].value) {
            A[k] = L[i++];
        } else {
            A[k] = R[j++];
        }
    }
}

void mergeSort(Card A[], int n, int left, int right) {
    int mid;
    if (left + 1 < right) {
        mid = (left + right) / 2;
        mergeSort(A, n, left, mid);
        mergeSort(A, n, mid, right);
        merge(A, n, left, mid, right);
    }
}

// Quick Sort
int partition(Card A[], int n, int p, int r) {
    int i, j;
    Card t, x;
    x = A[r];
    i = p - 1;
    
    REPN(j, p, r) {
        if (A[j].value <= x.value) {
            i++;
            t = A[i];
            A[i] = A[j];
            A[j] = t;
        }
    }

    t = A[i + 1];
    A[i + 1] = A[r];
    A[r] = t;
    return i + 1;
}

void quickSort(Card A[], int n, int p, int r) {
    int q;
    if (p < r) {
        q = partition(A, n, p, r);
        quickSort(A, n, p, q - 1);
        quickSort(A, n, q + 1, r);
    }
}

int main() {
    int n, i, v;
    Card A[MAX], B[MAX];
    char S[10];
    int stable = 1;

    cin >> n;

    REP(i, n) {
        cin >> S;
        cin >> v;
        A[i].suit = B[i].suit = S[0];
        A[i].value = B[i].value = v;
    }

    mergeSort(A, n, 0, n);
    quickSort(B, n, 0, n - 1);

    REP(i, n) {
        if (A[i].suit != B[i].suit) {
            stable = 0;
        }
    }

    if (stable == 1) {
        cout << "Stable" << '\n';
    } else {
        cout << "Not stable" << '\n';
    }
    REP(i, n) {
        cout << B[i].suit << " " << B[i].value << '\n';
    }
}


Measured memory_bytes: 5360
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << endl;
#else
	#define DBG(X)
	#define endl '\n'
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline void goodbye(const T& val) { cout << val << endl; exit(0); }

const int MAX_N = (int)2e5 + 777;
const int MOD   = (int)1e9 + 7;

int a[MAX_N], head = 0, n;
int dp[MAX_N], sum[MAX_N];

int add(int x, int y)
{
	return (x + y >= MOD ? x + y - MOD : x + y);
}

void solve()
{
	cin >> n;

	for(int i = 0; i < n; ++i)
	{
		int val;
		cin >> val;

		if(head == 0 || a[head - 1] != val)
			a[head++] = val;
	}

	dp[0] = 1;

	for(int pref = 1; pref <= head; ++pref)
	{
		int val = a[pref - 1];
		sum[val] = add(sum[val], dp[pref - 1]);

		dp[pref] = sum[val];
	}

	cout << dp[head] << endl;
}

int main()
{
	fast_io();
	solve();

	return 0;
}


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

int main() {
    string s, t;
    cin >> s >> t;
    int n = max(s.size(), t.size());
    rep(i,n){
        if(i<s.size()) cout << s[i];
        if(i<t.size()) cout << t[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3580
n=int(input())
a=[0]+[int(i) for i in input().split()]
b=[0]*(n+1)
only=int(n/2)
for i in range(only+1,n+1):
    b[i]=a[i]
if n%2==1:
    only+=1
for i in range(n-(only),0,-1):
    sum1=0
    for j in range(i,n+1,i):
        sum1+=b[j]
    if sum1%2==a[i]:
        b[i]=0
    else:
        b[i]=1
m=b.count(1)
print(m)
for i in range(1,n+1):
    if b[i]==1:
        print(i,end=" ")


Measured memory_bytes: 65768
from sys import stdin
input = stdin.readline

class WeightedUnionFind:
    def __init__(self, node:int) -> None:
        self.n = node
        self.par = [i for i in range(self.n)]
        self.rank = [0 for i in range(self.n)]
        self.diff_weight = [0 for i in range(self.n)]
        
    # ノードxのルートを求める
    def find(self, x:int) -> int:
        if x == self.par[x]:
            return x
        else:
            r = self.find(self.par[x])
            self.diff_weight[x] += self.diff_weight[self.par[x]]
            self.par[x] = r
            return self.par[x]
        
    # ノードxのルートからの距離を求める
    def weight(self, x:int) -> int:
        self.find(x)
        return self.diff_weight[x]
        
    # weight(y) - weight(x) = w となるようにする
    def unite(self, x:int, y:int, w:int) -> bool:
        if self.isSame(x,y):
            #print("x and y has already united")
            return False
        
        w += self.weight(x)
        w -= self.weight(y)
        
        rx = self.find(x)
        ry = self.find(y)
        
        if self.rank[rx] < self.rank[ry]:
            rx, ry = ry, rx
            w = -w

        self.par[ry] = self.par[rx]
        self.diff_weight[ry] = w
        
        if self.rank[rx] == self.rank[ry]:
            self.rank[rx] += 1
                
        return True
                
    
    def isSame(self, x:int, y:int) -> bool:
        return self.find(x) == self.find(y)
    
    def diff(self, x:int, y:int) -> int:
        if self.isSame(x,y):
            return self.weight(y)-self.weight(x)
        else:
            raise ValueError("xとyは同じ木に属していません")


  
N,M = map(int, input().split())
query = []
for _ in range(M):
    query.append(tuple(map(int, input().split())))
    
uf = WeightedUnionFind(N)
    
consistent = True
for l,r,d in query:
    l -= 1
    r -= 1
    if uf.isSame(l,r):
        if d != uf.diff(l,r):
            consistent = False
            break
    else:
        uf.unite(l,r,d)
        
if consistent:
    print("Yes")
else:
    print("No")
    


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

int mod=1e9+7;
int nPr(int n,int r,int m){
    if(r==0)return 1;
    int ret=1;
    for (int i=0;i<r;i++){
        ret=(ret*(n-i)%m)%m;
    }
    return ret;
}

int inv(int i,int m){
    if(i==1)return 1;
    int ret;
    ret=m-((m/i)*inv(m%i,m))%m;
    return ret;
}

int invnPr(int n,int r,int m){
    if(r==0)return 1;
    int ret=1;
    for(int i=0;i<r;i++){
        int j=inv(n-i,m);
        ret=(ret*j)%m;
    }
    return ret;
}

int nCr(int n,int r,int m){
    r=min(r,n-r);
    if(r==0)return 1;
    return nPr(n,r,m)*invnPr(r,r,m)%m;
    //return (nPr(n,r,m)*inv(nPr(r,r,m),m))%m;
}



int nHr(int n,int r,int m){
    return nCr(n+r-1,r,m);
}

signed main(){
    int n,m;cin >>n >>m;
    set<pair<int,int>> s;
    int tmp=m;
    for(int i=2;i<=m;i++){
        int cnt=0;
        while(tmp%i==0){
            tmp/=i;
            cnt++;
        }
        if(cnt>0)s.insert(make_pair(i,cnt));
        if(tmp==1)break;
    }
//    for(auto&& w:s)cout<<w.first<<" "<<w.second<<endl;
    int ans=1;

    // for(auto&& w:s){
    //     int a=nPr(n+w.second-1,w.second,mod);
    //     int b=nPr(w.second,w.second,mod);
    //     int c=inv(b,mod);
    //     int d=(a*c)%mod;
    //     cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
    //     cout<<w.first<<" "<<w.second<<" "<<nHr(n,w.second,mod)<<endl;
    // }

    for(auto&& w:s)ans=(ans*nHr(n,w.second,mod))%mod;
    cout<<ans<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FT first
#define SC second

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int, int> pint;
const int INF = 1e9;
const double EPS = 1e-9;



int main()
{
  ll a, b, x ;
  cin >> a >> b >> x ;
  ll A, B ;
  if(a%x==0){
    A = a/x ;
  }
  else{
    A = a/x+1 ;
  }
  
  B = b/x+1 ;
  
  cout << B-A <<endl ;

  return 0 ;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int dp[1001][1001];//dp[m日目][今の都市]
int main(){
  int n,m;cin>>n>>m;
  int a[n];
  for(int i = 0; n > i; i++)cin>>a[i];
  int b[m];
  for(int i = 0; m > i; i++)cin>>b[i];
  for(int i = 0; m > i; i++){
    dp[0][i] = 0;
  }
  for(int i = 1; n >= i; i++){
    for(int j = i; m >= j; j++){
      if(j == i)dp[i][j] = dp[i-1][j-1]+a[i-1]*b[j-1];
      else dp[i][j] = min(dp[i][j-1],dp[i-1][j-1]+a[i-1]*b[j-1]);
    }
  }
  int ans = dp[n][m-1];
  for(int i = n; m >= i; i++){
    if(dp[n][i])ans = min(ans,dp[n][i]);
  }
  cout << ans << endl;
}







Measured memory_bytes: 6172
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

int main(){
    int a[4] = {10,50,100,500};
    int n;
    bool flag = true;
    while(cin >> n, n){
        int coin[4];
        int mcoin[4];

        cin >> coin[0] >> coin[1] >> coin[2] >> coin[3];

        n = coin[0] * 10 + coin[1] * 50 + coin[2] * 100 + coin[3] * 500 - n;
        for(int i = 3; i >= 0; i--){
            mcoin[i] = n / a[i];
            n -= mcoin[i] * a[i];
        }

        if(flag) flag = false;
        else cout << endl;
        for(int i = 0; i < 4; i++){
            if(coin[i] > mcoin[i]) cout << a[i] << ' ' << coin[i] - mcoin[i] << endl;
        }
    }
}


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

int n, ans;
int minimum = 1000000;

int main() {
  cin >> n;
  vector<int> v(n);
  rep (i, n) {
    cin >> v.at(i);
  }
  rep (i, n) {
    if (minimum > v.at(i)) {
      minimum = v.at(i);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int A, B, C;
	int K;
	int i;
	
	scanf("%d %d %d", &A, &B, &C);
	scanf("%d", &K);
	
	if (A >= B && A >= C) {
		for (i = 0; i < K; i++) {
			A *= 2;
		}
	}
	else if (B >= C) {
		for (i = 0; i < K; i++) {
			B *= 2;
		}
	}
	else {
		for (i = 0; i < K; i++){
			C *= 2;
		}
	}
	
	printf("%d\n", A + B + C);
	
	return (0);
}

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

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

    string s;
    cin >> s;
    
    int first = (s[0]-'0') * 10 + (s[1]-'0');
    int second = (s[2]-'0') * 10 + (s[3]-'0');
    
    string ans = "NA";
    
    if((first == 0 || first > 12) && second <= 12 && second > 0){
        ans = "YYMM";
    }else if(first > 0 && first <= 12 && (second > 12 || second == 0)){
        ans = "MMYY";
    }else if(first > 0 && first <= 12 && second <= 12 && second > 0){
        ans = "AMBIGUOUS";
    }
    
    cout << ans << endl;

    return 0;
}

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;

int main() {
  double T, X;
  cin >> T >> X;

  cout << setprecision(10) << T / X << endl;
  return 0;
}

Measured memory_bytes: 3776
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define EPS 1e-9
#define MOD 1000000007
#define int long long
using namespace __gnu_pbds;
using namespace std;
typedef pair<int, int> pii;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ost;

vector<int> adj[100005];
bool vis[100005];
int dp[100005];

void dfs(int e, int par){
	vis[e] = true;
	int temp = 0;
	for(auto x : adj[e]){
		if(x == par)
			continue;
		if(!vis[x])
			dfs(x,e);
		temp = max(dp[x], temp);
	}
	dp[e] = temp + 1;
}


int32_t main(){
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		int x, y;
		cin >> x >> y;
		adj[x].PB(y);
	}

	memset(vis, false, sizeof vis);

	int maxi = 0;
	for(int i = 1; i <= n; i++){
		if(!vis[i]){
			dfs(i,-1);
			maxi = max(maxi,dp[i]);
		}
	}
	cout << maxi - 1 << "\n";



	return 0;
}

Measured memory_bytes: 9344
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int N=sc.nextInt();
    int ANS=0;
    
    for(int i=0;i<N;i++){
      Long NEXT=sc.nextLong();
      while(NEXT%2==0){
        NEXT=NEXT/2;
        ANS++;
      }
    }
    
    System.out.println(ANS);
  }
}

Measured memory_bytes: 39616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "

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

int main(void){
    ll a,b;cin>>a>>b;
    co(lcm(a,b));
}

Measured memory_bytes: 256
#include <cstdio>

const int N=105;

int n;
int l,r;
bool st[N];

int main()
{
  scanf("%d",&n);
  bool flag=false;
  for(int i=0;i<n;i++)
  {
    scanf("%d%d",&l,&r);
    st[i]=l==r;
    if(i>1)
    {
      if(st[i-2]&&st[i-1]&&st[i])flag=true;
    }
  }
  puts(flag?"Yes":"No");
  return 0;
}

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

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

vector<pair<long long, int>> factorize(long long n){ //素因数とその何乗か
    vector<pair<long long, int>> res;
    for (long long i = 2; i*i <= n; i++){
        if (n%i) continue;
        res.emplace_back(i, 0);
        while (n%i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1);
    return res;
}

int main(){
    long long a, b;
    cin >> a >> b;
    long long g = gcd(a, b); //a,bの最大公約数
    auto f = factorize(g);
    int ans = f.size() + 1;
    cout << ans << endl;
}

Measured memory_bytes: 256
//
//  main.cpp
//  AC
//
//  Created by makinofuya on 2019/07/08.
//  Copyright © 2019 makinofuya. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <math.h>

typedef long long ll;
using namespace std;
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define out(s) cout << s << endl


int main(){
    int n;cin >> n;
    vector<string> s(n);
    rep(i,n)cin >>s[i];
    int m;cin >> m;
    vector<string> t(m);
    rep(i,m)cin >> t[i];
    int x=0;
    int max_x=0;
    for(string y:s){
        x=0;
        for(string a:s){
            if(a==y)x++;
        }
        for(string b:t){
            if(b==y)x--;
        }
        if(max_x<x)max_x=x;
    }
    cout << max_x << endl;
    return 0;
}



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

using namespace std;

int main() {
    int n;
    string a, b, c;
    cin >> n >> a >> b >> c;

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] == b[i] && b[i] == c[i]) continue;
        ans += 2 - (a[i] == b[i] || b[i] == c[i] || c[i] == a[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
#define INF 1000000000
typedef long long ll;
ll MOD = 1e9+7;

long long power(long long x) {
    
    ll a=1;
    while(x>1){
        a = a*x%MOD;
        x--;
    }
    return a;
}

int main() {
    int N, M;
    cin>>N>>M;
    
    int dif = abs(N-M);
    
    if(dif>1){
        cout1(0); return 0;
    }else if(dif==1){
        cout1( power(N)*power(M)%MOD );
    }else{
        cout1( power(N)*power(M)*2%MOD );
    }
    
}

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

int main(){
  int count=0;
  string s;
  cin >> s;
  r(i,s.length()){
    if(s.at(i)=='x')count++;
  }
  if(count>=8)cout << "NO"<<endl;
  else cout << "YES"<<endl;
}

Measured memory_bytes: 256
# [基本方針]
# コンプロでもやった進数変換の応用問題。今回は26進数変換を基本に考える。
# 1:aではなく、0:aを対応していると考える。そのため、26で割ったあまりを考える時、0:a、1:b,..., z:25と考えることができる。
# 計算量はO(logN)

N = int(input())
ans = ''
while N:
    # 1をaではなく、0をaに割り当てると考えるため、N-=1を行う。
    N -= 1

    # ここから下は基本的な進数変換と同じ
    alphabet = chr(ord('a') + N % 26)
    ans += alphabet
    N //= 26
    
# 文字列を反転させる
print(ans[::-1])


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

signed main(){
	int X, A, B;
	scanf("%d%d%d", &X, &A, &B);
	if(B <= A){
		printf("delicious\n");
	}
	else if(B <= A + X){
		printf("safe\n");
	}
	else{
		printf("dangerous\n");
	}
	return 0;
}

Measured memory_bytes: 3676
# -*- coding:utf-8 -*-

N = int(input())
H = list(map(int, input().split()))

if N == 1:
    print(0)
    exit(0)

max_count = 0
prev_h = H[-1]
prev_count = 0

for h in reversed(H[:-1]):
    if h >= prev_h:
        prev_count += 1
        max_count = max(prev_count, max_count)
    else:
        prev_count = 0

    prev_h = h

print(max_count)


Measured memory_bytes: 14252
a,b,x = list(map(int, input().split()))

#最小値
if(a%x != 0):
    min_div = a + x -  (a % x)

else:
    min_div = a

#最大値
if(b%x != 0):
    max_div = b - (b % x)

else:
    max_div = b

print(int(max((max_div - min_div + x) // x, 0)))


Measured memory_bytes: 9088
#include<stdio.h>

int main(void)
{
	long int x[1000],x2[1000],y[1000],y2[1000],z[1000],i=0,j=0,gcd[1000]={0},lcm[1000]={0};

	while(i!=-1)
	{
		scanf("%d %d",&x[i],&y[i]);		   
		x2[i] = x[i];
		y2[i] = y[i];
		if(x[i]<=0 || x[i]>2000000000 || y[i]<=0 || y[i]>2000000000)break;
	    i=i+1;
	}
	for(j=0;j<i;j++)
	{
		while(x[j] % y[j] !=0)
	   {
     	  z[j] = x[j] % y[j];
 		  x[j] = y[j];
 		  y[j] = z[j];
	   }
	   gcd[j]=y[j];

	   lcm[j] = x2[j] * (y2[j] / gcd[j]);
	   
	   printf("%d %d\n",gcd[j],lcm[j]);
	}
  return 0;
}

Measured memory_bytes: 1040
#include<iostream>
using namespace std;
int main(void){
    int r,c,i,j,iSum;
    cin >> r >>c;
    int iCells[r+1][c+1];
    for (i=0;i<r;i++){
        iSum=0;
        for(j=0;j<c;j++){
            cin >> iCells[i][j];
            cout << iCells[i][j] <<' ' ;
            iSum+=iCells[i][j];
        }
        iCells[i][j]=iSum;
        cout << iSum << endl;
    }
    
    for(j=0;j<c;j++){
        iSum=0;
        for(i=0;i<r;i++){
            iSum+=iCells[i][j];
        }
        iCells[i][j]=iSum;
        cout << iSum << ' ';
    }
    
    iSum=0;
    for(j=0;j<c;j++){
        iSum+=iCells[r][j];
    } 
    cout << iSum <<endl;
    return 0;
}


Measured memory_bytes: 3140
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<complex>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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




const ll INF = 1e9;


/******************************************************************************************/


int main() {

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

	
	int n;
	cin >> n;
	vector<int> a(n);
	
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	

	ll ans = 0;
	for (int i = 0; i < n; i++)
	{
		ans += a[i] - (i + 1);

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



Measured memory_bytes: 3372
X,N = map(int,input().split())
P = list(map(int,input().split()))

# 0,101は含まなければいけない
P_n = [i for i in range(102) if i not in P]
abs_value = [abs(X-P_n[j]) for j in range(len(P_n))]


min_abs = min(abs_value)
for k in range(len(abs_value)):
    if abs_value[k] == min_abs:
        print(P_n[k])
        break

Measured memory_bytes: 9192
///FUCKOUT
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

#include "bits/stdc++.h"
#include <ext/rope> //header with rope
using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
//#define endl '\n'

using namespace __gnu_cxx; //namespace with rope and some additional stuff

using ll = long long;
using db = long double;
using row = vector<int>;
using ii = pair<ll, ll>;

const int N = 3e5+5, M = 1e6 + 5, LG = 17, MOD = 1e9 + 7;
const int BLOCK = 55;
const int BLOCKN = N / BLOCK + 1;
const long double EPS = 1e-7;
using ull = unsigned long long;

int32_t main(){
#ifdef ONLINE_JUDGE
  ios_base::sync_with_stdio(0);
  cin.tie(0);
#endif // ONLINE_JUDGE


  string s;
  cin >> s;



  f(i,0,s.size()){
    f(j,i,s.size() + 1){
      if(s.substr(0,i) + s.substr(j) == "keyence"){
        cout << "YES\n";
        return 0;
      }
    }
  }

  cout << "NO\n";


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  double d;
  cin>>d;
  double ans = 2*d*3.1415926535;
  printf("%.10f\n",ans);
  return 0;
}


Measured memory_bytes: 3760
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] d = new int[N];
        boolean[] flags = new boolean[100];
        for (int i = 0; i < N; i++) {
            d[i] = scanner.nextInt();
            flags[d[i] - 1] = true;
        }
        int count = 0;
        for (int i = 0; i < 100; i++) {
            if (flags[i]) count++;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 21844
#include<stdio.h>

int main(){
    int i,n,a=0,d=0;
    scanf("%d",&n);
    int h[n];
    for(i=0;i<n;i++){
        scanf("%d",&h[i]);
    }
    for(i=1;i<n;i++){
        if(h[i-1]<h[i]){
            if(a<d){
                a=d;
            }
            d=0;
        }
        else{
            d++;
        }
    }
    if(a<d){
        a=d;
    }
    printf("%d",a);
}

Measured memory_bytes: 512
def main():
    n = int(input())

    def q(i):
        print(i, )
        s = str(input())
        if s == 'Vacant':
            exit()
        else:
            return s

    x = q(n-1)
    x = q(0)

    def ok(m):
        if m == 0:
            return False
        else:
            if (m%2 == 0 and q(m) != x) or (m%2 == 1 and q(m) == x):
                return True
            else:
                return False

    l = 0
    r = n-1
    while l+1 < r:
        c = (l+r)//2
        if ok(c):
            r = c
        else:
            l = c

if __name__ == '__main__':
    main()


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define mod 998244353
#define db(a) cout << a << endl
#define db2(a,b) cout << a << " " << b << endl
#define dbp(a) cout << a.first << " " << a.second << endl
#define adb(a) for(auto i:a) cout << i << " "; cout << endl
#define adb2(a) for(auto i:a) cout << i.first << " " << i.second << endl;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define N 100010
using namespace std;

int main()
{
    fastIO;
    int n, p;
    cin >> n >> p;

    string s;
    cin >> s;

    long long ans = 0, i;
    
    if(p == 2 || p == 5)
    {
        for(i=0;i<n;i++) 
        {
            if((s[i]-'0')%p == 0) ans += (i+1);
        }
    }
    else
    {
        long long rem[p] = {0}, currem = 0, pow10 = 1;
        rem[0] = 1;
        
        for(i=n-1;i>=0;i--)
        {
            currem = (currem + (s[i]-'0')*pow10)%p;
            ans += rem[currem];
            rem[currem]++;
            pow10 = (pow10*10)%p;
        }
    }

    cout << ans << endl;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

#define P pair<lli,lli>

lli d[40][40];
lli c[600][600];

vector<pair<lli,lli>> hopeToC[3];

signed main(){

	lli N,C;
	cin>>N>>C;

	REP(i,0,C)REP(j,0,C)cin>>d[i][j];
	REP(i,0,N)REP(j,0,N){
		cin>>c[i][j];
		c[i][j]--;
	}

	lli ans = INF;
	REP(hope,0,C){
		lli cost[3];
		cost[0]=0,cost[1]=0,cost[2]=0;
		REP(y,0,N)REP(x,0,N){
			if(c[y][x] != hope){
				cost[(x+y)%3] += d[c[y][x]][hope];
			}
		}
		hopeToC[0].push_back(mp(cost[0],hope));
		hopeToC[1].push_back(mp(cost[1],hope));
		hopeToC[2].push_back(mp(cost[2],hope));
	}
	sort(hopeToC[0].rbegin(),hopeToC[0].rend());
	sort(hopeToC[1].rbegin(),hopeToC[1].rend());
	sort(hopeToC[2].rbegin(),hopeToC[2].rend());

	REP(i,0,C)REP(j,0,C)REP(k,0,C){
		if(hopeToC[0][i].second == hopeToC[1][j].second)continue;
		if(hopeToC[1][j].second == hopeToC[2][k].second)continue;
		if(hopeToC[2][k].second == hopeToC[0][i].second)continue;
		ans = min(ans,hopeToC[0][i].first+hopeToC[1][j].first+hopeToC[2][k].first);
	}
	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loope(i,a,b) for(ll i=a;i<=b;i++)
#define test() ull t;cin>>t;while(t--)
#define pll pair<ll,ll>
#define puu pair<ull,ull>
#define f first
#define s second
#define pb push_back
#define mkp make_pair
#define ins insert
#define Vint vector<int>
#define Vll vector<ll>
#define Vull vector<ull>
#define nl cout<<endl
#define sp cout<<" "
#define MOD 1000000007
#define all(x) x.begin(),x.end()
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};


int main() 
{
	// ios::sync_with_stdio(0);
	// cin.tie(0);
	// cout.tie(0);
	
	string s;
	cin>>s;
	ll n = s.size();
	if(s[n-1]=='s')
		s+="es";
	else
		s+='s';
	cout<<s;
}

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

int main(){
	string a,b; cin>>a>>b;
	string c=a+b;
	int n=stoi(c);
	double r=sqrt(n);
	if(r==(int)r) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 3724
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	h := readInt()
	w := readInt()
	c := make([][]int, 10)
	for i := range c {
		c[i] = make([]int, 10)
		for j := range c[i] {
			c[i][j] = readInt()
		}
	}

	for k := 0; k < 10; k++ {
		for i := 0; i < 10; i++ {
			for j := 0; j < 10; j++ {
				d := c[i][k] + c[k][j]
				if d < c[i][j] {
					c[i][j] = d
				}
			}
		}
	}

	var ans int
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			v := readInt()
			if v == -1 {
				continue
			}
			ans += c[v][1]

		}
	}
	println(ans)
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;

typedef long long ll;

const int dy[]={-1,0,1,0};
const int dx[]={0,1,0,-1};

bool passed[101][101][4];
char field[101][101];

int h,w;
ll l;
int sy,sx,sag;

// loopð©Â¯éÜÅTõ
bool search1(ll &cl,int &cx,int &cy,int &cag,int &step){
	passed[cy][cx][cag]=true;
	while(1){
		// Ú®I¹
		if(cl==0){
			cout<<cy+1<<" "<<cx+1<<" ";
			if(cag==0)cout<<'N';
			else if(cag==1)cout<<'E';
			else if(cag==2)cout<<'S';
			else if(cag==3)cout<<'W';
			cout<<endl;
			return true;
		}
		int nx=cx+dx[cag];
		int ny=cy+dy[cag];
		// Ú®Â\©
		if(nx>=0&&ny>=0&&nx<w&&ny<h&&field[ny][nx]=='.'){
			// ·ÅÉÊßÏÝ©
			if(passed[ny][nx][cag]){
				cx=nx,cy=ny;
				cl--;
				break;
			}
			passed[ny][nx][cag]=true;
			cx=nx;
			cy=ny;
			cl--;
		}
		// Ú®sÂ\ÈêAûüðÏ¦é
		else{
			cag=(cag+1)%4;
			// ÊßÏÝ
			if(passed[cy][cx][cag])break;
			passed[cy][cx][cag]=true;
		}
	}
	int gx=cx;
	int gy=cy;
	int gag=cag;
	// Ü¾S[µÄ¢È¢
	// [vð¦é
	int cnt=0;
	while(1){
		int nx=cx+dx[cag];
		int ny=cy+dy[cag];
		if(nx>=0&&ny>=0&&nx<w&&ny<h&&field[ny][nx]=='.'){
			cnt=0;
			cx=nx;
			cy=ny;
			step++;
			if(gx==cx&&gy==cy&&gag==cag)break;
		}
		// Ú®sÂ\ÈêAûüðÏ¦é
		else{
			cag=(cag+1)%4;
			cnt++;
			if(gx==cx&&gy==cy&&gag==cag){
				// cntª³¾Á½êA-cntµ½àÌðü«ÉZbgµÄ¨­
				cag=(cag-cnt+4)%4;
				break;
			}
		}
	}
	return false;
}

// [vð©Â¯éÜÅTõ.©Â¯½çA»Ì[vÌå«³ð¦é
void solve(){
	// loop find
	int cx,cy,cag,step;
	step=0;
	ll cl=l;
	cx=sx;
	cy=sy;
	cag=sag;
	// [vBOÉS[
	memset(passed,0,sizeof(passed));
	if(search1(cl,cx,cy,cag,step))return;
	// [vÉüÁ½ê,loopÌstepªclð¸ç·
	cl%=step;
	step=0;
	// cèÌXebvÅS[
	memset(passed,0,sizeof(passed));
	search1(cl,cx,cy,cag,step);
}

int main(){

	while(cin>>h>>w>>l&&!(h==0&&w==0&&l==0)){
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cin>>field[i][j];
				if(field[i][j]!='#'&&field[i][j]!='.'){
					if(field[i][j]=='N')sag=0;
					else if(field[i][j]=='E')sag=1;
					else if(field[i][j]=='S')sag=2;
					else if(field[i][j]=='W')sag=3;
					field[i][j]='.';
					sx=j;
					sy=i;
				}
			}
		}
		solve();
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 using namespace std;
 int main() { 
   int n;
   cin>>n;
   vector<int> w(n);
   for(int i=0;i<n;i++){
     cin>>w[i];
   }
   int s=100;
   for(int k=0;k<n;k++){
     int a=0;
     int b=0;
     for(int i=0;i<k;i++){
       a+=w[i];
     }
     for(int i=k;i<n;i++){
       b+=w[i];
     }
     int o=0;
     if(a>=b){
       o=a-b;
     }
     else{
       o=b-a;
     }
     if(o<s){
       s=o;
     }
   }
   cout<<s<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <map>
#include <set>

using namespace std;

#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

typedef long long ll;
typedef long double ld;

const ll SIZE = 1e5 * 3 + 10;
vector <ll> vec;
ll q;

int main() {
	fastInp;

	string num;
	bool flag = false;
	cin >> num;
	for (int i = 0; i < 3; i++) {
		if (num[i] == '7') flag = true;
	}
	
	if (flag) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;

ll n ;
ll mod=1e9+7;
vector<vector<ll>>dp;
vector<vector<ll>>edge;
ll  dfs(ll par,ll node,bool bw)
{
  if(dp[node][bw]>=0)return dp[node][bw];
  ll res=1;
  for(ll nn:edge[node])
  {
    if(nn==par)continue;
    ll tres=0;
    if(bw){tres+=dfs(node,nn,bw);tres%=mod;}
    tres+=dfs(node,nn,!bw);
    res=((ll)res*tres)%mod;
  }
  dp[node][bw]=res;
  return res;
}
int  main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>n;
  dp=vector<vector<ll>>(n,vector<ll>(2,-1));
  edge.resize(n);
  rep(i,n-1)
  {
    ll a,b;
    cin>>a>>b;
    a--;b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }

  cout<<(dfs(-1,0,0)+dfs(-1,0,1))%mod<<endl;

  return 0;

}


Measured memory_bytes: 20992
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <utility>
typedef long long ll;
using namespace std;

int main(){
  ll i,j,k;
  ll n;
  cin >> n >> k;
  ll ret=0;
  cout << n-k+1 << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] line = scanner.nextLine().split(" ", 3);
        int a = Integer.parseInt(line[0]);
        int b = Integer.parseInt(line[1]);
        int c = Integer.parseInt(line[2]);
        System.out.println((a == b && b == c) ? "Yes" : "No");
    }
}


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

int main(){
    int d,t,s;
    cin >> d >> t >> s;
    int distance = s*t;
    if(distance >= d){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3592
import fractions
from functools import reduce

N,K = map(int,input().split())
A = sorted(list(map(int,input().split())),reverse = True)

def gcd_list(numbers):
  return reduce(fractions.gcd, numbers)

GCD = gcd_list(A)

if K > A[0]:
  print("IMPOSSIBLE")
elif K % GCD != 0:
  print("IMPOSSIBLE")
else:
  print("POSSIBLE")

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

int main(){
    int a,b;
    cin >> a >> b;
    int num, i;
    if(b>=1 && b<=9) num = a*10 + b;
    else if(b<=99) num = a*100 + b;
    else num = a*1000 + b;
    for(i=4;i<=350;i++){
        if(i*i==num){
            cout << "Yes" << endl;
            break;
        }
    }
    if(i==351)
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner io = new Scanner(System.in);	
		int N = io.nextInt();
		boolean[] val = new boolean[100000];
		int A;
		long fl=0;
		for (int i = 0; i < N; i++) {
			A = io.nextInt();
			if(val[A-1]){
				fl++;
			}else{
				val[A-1]=true;
			}
		}
		System.out.println((fl%2==0)?N-fl:N-fl-1);
	}
}

Measured memory_bytes: 50800
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main() {
    int p0x, p0y, p1x, p1y, px, py;
    cin >> p0x >> p0y >> p1x >> p1y;
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        cin >> px >> py;
        int s1x = p1x - p0x, s1y = p1y - p0y;
        int s2x = px - p1x, s2y = py - p1y;
        int dot = s1x * s2x + s1y * s2y;
        double Abs_s1 =  sqrt(s1x*s1x + s1y*s1y);
        double t = dot/Abs_s1; //p1 to an intersection point
        double x = p1x + s1x * t / Abs_s1;
        double y = p1y + s1y * t / Abs_s1;
        
        printf("%.10f %.10f\n", x, y);
    }
    return 0;
}



Measured memory_bytes: 3220
S = input()
N = len(S) - 1

sum = 0
for k in range(1 << N):
  formula = list(S)
  str = ['' for _ in range(N)]
  for i in range(N):
    if k >> i & 1:
      str[i] = '+'
  for j in range(N):
    if str[j] == '+':
      formula.insert(2*j+1, '+')
    else:
      formula.insert(2*j+1, '')
  sum += eval("".join(formula))

print(sum)

Measured memory_bytes: 3064
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
cnt=0
for i in range(N):
    if B[i]<A[i]:
        cnt+=B[i]
    else:
        cnt+=A[i]
        B[i]-=A[i]
        if B[i]<A[i+1]:
            cnt+=B[i]
            A[i+1]-=B[i]
        else:
            cnt+=A[i+1]
            A[i+1]=0
print(cnt)

Measured memory_bytes: 19116
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cassert>
using namespace std;

#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long ll;

int main ()
{

    int N; cin >> N;
    vector < int > p(N);
    REP(i,N) cin >> p[i];

    sort(p.begin(), p.end());

    int ans = 0;
    REP(i,N - 1) ans += p[i];
    ans += p.back() / 2;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	
	H := ScanInt(scanner)
	W := ScanInt(scanner)
	G := make([]string, H)
	for i := 0; i < H; i++ {
	    G[i] = ScanText(scanner)
	}
	
	dx := [4]int{0, 0, 1, -1}
	dy := [4]int{1, -1, 0, 0}
	
	ans := true
	for i := 0; i < H; i++ {
	    for j := 0; j < W; j++ {
	        if G[i][j] == '.' {
	            continue
	        }
	        ok := false
	        for k := 0; k < 4; k++ {
	            if i + dy[k] < 0 || i + dy[k] > H - 1 {
	                continue
	            }
	            if j + dx[k] < 0 || j + dx[k] > W - 1 {
	                continue
	            }
	            if G[i + dy[k]][j + dx[k]] == '#' {
	                ok = true
	            }
	        }
	        if !ok {
	            ans = false
	        }
	    }
	    if !ans {
	        break
	    }
	}
    
    if ans {
        fmt.Println("Yes")
    } else {
        fmt.Println("No")
    }
}

func ScanInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func ScanFloat64(scanner *bufio.Scanner) float64 {
	scanner.Scan()
	f, e := strconv.ParseFloat(scanner.Text(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func ScanText(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func Max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Abs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}
 

Measured memory_bytes: 640
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N,M = list(map(int,input().split()))
p = list(map(int,input().split()))
Network = UnionFind(N)

out=0
for i in range(M):
    a,b = list(map(int,input().split()))
    Network.union(a-1,b-1)

out=[-1]*N
for i in range(N):
    if Network.same(i,p[i]-1)==False and out[i]==-1:
        out[i]=0
    else:
        out[i]=1
    # print('i,p[i]-1,out:',i,p[i]-1,out)
print(sum(out))

Measured memory_bytes: 85512
/**
 *    author:  Daredevil666
 *    institution: IIT Patna
**/
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define ll long long int
#define IOS  ios::sync_with_stdio(false);cin.tie(0);
#define nl cout<<"\n";
using namespace std;
const ll c=1e9+7;
int main()
{
IOS
ll n,k;
cin>>n>>k;
ll a[n+2];
for(ll i=0;i<n;i++)
{
    cin>>a[i];
}
sort(a,a+n);
ll sum=0;
for(ll i=0;i<k;i++)
{
    sum+=a[i];
}
cout<<sum;
return 0;
}



Measured memory_bytes: 3640
# 32bitのMod一つでRollingHashを行った場合、
# 10**5個程度のHashを生成するだけでも
# 半分以上の確率でどこかのHashが衝突していることが分かります


# 小文字アルファベットの時のbese
base = 27  # alphabet


def getnum(x):
    return ord(x) - ord("a") + 1


# rolling hash実装

# 必要な定数
# mod = 1<<61-1としたときの高速余り計算
m30 = (1 << 30) - 1
m31 = (1 << 31) - 1
m61 = (1 << 61) - 1
mod = m61
positive_delta = m61 ** 4

# 高速化された計算
def mul(a, b):
    au = a >> 31
    ad = a & m31  # 余りを取ることが&演算でできる
    bu = b >> 31
    bd = b & m31
    mid = ad * bu + au * bd
    midu = mid >> 30
    midd = mid & m30
    return calcmod(au * bu * 2 + midu + (midd << 31) + ad * bd)


def calcmod(a):
    au = a >> 61
    ad = a & m61
    res = au + ad
    if res >= m61:
        res -= m61
    return res


# s:string
def rollinghash(s):
    num = len(s)
    res = [0] * (num + 1)
    pow_base = [1] * (num + 1)
    for i in range(num):
        res[i + 1] = calcmod(mul(res[i], base) + getnum(s[i]))
        pow_base[i + 1] = calcmod(mul(pow_base[i], base))
    return res, pow_base


def search(left, right, rh):
    return calcmod(rh[right] - mul(rh[left], pow_base[right - left]) + positive_delta)


n = int(input())
s = input()
rh, pow_base = rollinghash(s)

ng = n
ok = 0


def hantei(x, rh):
    kumi = {}
    for i in range(n - x + 1):
        temp = search(i, i + x, rh)
        if temp in kumi:
            pre_idx = kumi[temp]
            if i - pre_idx >= x:
                # print("pair", i, pre_idx, "delta", x)
                return True
        else:
            kumi[temp] = i
    # print(x, kumi)
    return False


while ng - ok > 1:
    mid = (ng + ok) // 2
    if hantei(mid, rh):
        ok = mid
    else:
        ng = mid
    # print(ok, ng)

print(ok)


Measured memory_bytes: 75676
#include<iostream>
using namespace std;
int main(){
  int l,m,n,ans;
  while(cin>>l){
    if(l==0) break;
    ans = 0;
    for(int i=1;i<=12;i++){
      cin >> m >> n;
      ans += m - n;
      if(ans>=l){
	cout << i << endl;
	for(int j=i+1;j<=12;j++) cin >> m >> n;
	break;
      } 
      else if(i==12) cout << "NA" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1160
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
 
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
using ld = long double;
 
// ------------------------------------------------------------------------------------------------

ll n;

int main() {
    fast_io; cout_precision;
    cin >> n;
    cout << 800 * n - 200 * (n / 15) << endl;
}

Measured memory_bytes: 256