akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

const ll MOD = ll(1e9) + 7;
const ll INF = LLONG_MAX;
const ll MAX_N = ll(1e5) + 5;
const double EPS = 10e-8;
const double PI = 3.14159265359;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)

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

ll n,ans[100000]{};
map<ll,ll> cnt;
vector<P> ls;

int main() {
    cin >> n;
    REP(i,n){
        int a;
        cin >> a;
        cnt[a]++;
        if(cnt[a]==1){
            ls.push_back({a,i});
        }
    }
    ls.push_back({0,0});
    sort(ls.begin(),ls.end());
    reverse(ls.begin(),ls.end());
    ll sum = 0, imin = INF;
    for(int i=0;i<ls.size()-1;i++){
        sum += cnt[ls[i].first];
        imin = min(imin,ls[i].second);
        ans[imin] += (ls[i].first - ls[i+1].first)*sum;
    }
    REP(i,n){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 9712
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
using namespace std;


double get_diff_temp(int A, int T, int H) {
    double ret = A-(T - H * 0.006);
    return fabs(ret);
}

int main() {

    int N, T, A;
    cin >> N >> T >> A;
    vector<int> H(N);
    for (int i = 0; i < N; i++) cin >> H[i];

    int ans = 0;
    double temp = get_diff_temp(A, T, H[0]);
    
    for (int i = 1; i < N; i++) {
        if (temp > get_diff_temp(A, T, H[i])) {
            temp = get_diff_temp(A, T, H[i]);
            ans = i;
        }
    }

    cout << (ans+1) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	string s;
	char i;
	cin>>s;
	i='a';
	while(s.find(i)!=-1)
	i++;
	if(i<='z')
	cout<<i<<endl;
	else
	cout<<"None"<<endl;
} 

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

int main()
{
  vector<int> point_count;
  int N;
  cin >> N;
  vector<string> s(N);
  for (int i = 0; i < N; i++) {
    cin >> s[i];
  }

  int M;
  cin >> M;
  vector <string> t(M);
  for (int i = 0; i < M; i++) {
    cin >> t[i];
  }

  string temp;
  for (int i = 0; i < N; i++) {
    int count = 0;
    temp = s[i];
    for (int j = 0; j < N; j++) {
      if (temp == s[j]) {
        count++;
      }
    }
    for (int j = 0; j < M; j++) {
      if (temp == t[j]) {
        count--;
      }
    }
    point_count.push_back(count);
  }

  // for (auto x: point_count) {
  //   cout << x << endl;
  // }

  //  int max = *max_element(point_count.begin(), point_count.end()); // 提出ではコンパイルエラーぽい
  sort(point_count.begin(), point_count.end());
  int max = point_count[N - 1];
  if (max >= 0) cout << max << endl;
  else cout << 0 << endl;

  return 0;
}

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

/*
ボーナススコアがない場合は点数の大きい問題から解いていく貪欲法でOK
ボーナススコアを得る問題の組み合わせについて全探索する
*/

int main() {
    long D, G; cin >> D >>G;

    vector<long> P(D), C(D);

    for (int i = 0; i < D; i++)
    {
        cin >> P[i] >> C[i];
    }

    int min_num = 1e9;
    for (int tmp = 0; tmp < (1 << D); tmp++)
    {
        bitset<10> s(tmp);
        long score = 0;
        int num = 0;
        for (int i = 0; i < D; i++)
        {
            if (s.test(i)) {
                score += 100 * (i + 1) * P[i] + C[i];
                num += P[i];
            }
        }

        if (score < G) {

            for (int i = D-1; i >= 0; i--) {
                if (s.test(i)) {
                    continue;
                }
                else
                {
                    for (int j = 0; j < P[i]; j++)
                    {
                        if (score >= G)
                        {
                            continue;
                        }
                        
                        num++;
                        score += 100 * (i + 1);
                    }
                }
                
            }
        }

        if (score >= G) {
            min_num = min(num, min_num);
        }
    }
    cout << min_num << endl;
    

}

Measured memory_bytes: 256
N=int(input())
N_1=int(N/100)
N_2=int((N - 100*N_1)/10)
N_3=int((N-100*N_1-10*N_2))
        

if N_1==7 or N_2==7 or N_3==7:
    print("Yes")
else:
    print('No')

Measured memory_bytes: 9152
#include <bits/stdc++.h>
 
using namespace std;
 
const long long MOD=1e9+7;
const double PI=3.14159265359;



int main() {
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    if(n%10==9 || n/10==9) cout<<"Yes";
    else cout<<"No";
    
    
   
   
    
    return 0;
    
}

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

int main(){
  int M, D;
  cin >> M >> D;
  // cout << M << endl;

  bool flag = true;
  int ans = 0;
  for(int i = 2; i < 10; i++){ //d10
    if(!flag) break;
    for(int j = 2; j < 10; j++){ //d1
      if( i*j <= M && i*10+j <= D ){
        ans++;
      }
      //cout << i*10+j << " " << i*j << " " << ans << endl;
    }
  }

  cout << ans << endl;

  return 0;
}


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

int a[16][16];
long long pre[1<<16] = {}, dp[1<<16];

void solve(int p, long long score, int already, int group, int leftOver) {
    if (p == 0)
        dp[already] = max(dp[already], score + pre[group]);
    else {
        p = leftOver & -leftOver;
        leftOver -= p;
        solve(p, score, already, group, leftOver);
        solve(p, score, already | p, group | p, leftOver);
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n;
    cin >> n;
    for (int i=0; i<n; i++)
        for (int j=0; j<n; j++)
            cin >> a[i][j];

    for (int i=0; i<1<<n; i++)
        for (int j=0; j<n; j++)
            if (i & (1 << j))
                for (int k=j+1; k<n; k++)
                    if (i & (1 << k))
                        pre[i] += a[j][k];

    memset(dp, 128, sizeof(dp));
    dp[0] = 0;
    for (int i=0; i<1<<n; i++)
        solve(-1, dp[i], i, 0, ~i & ((1 << n) - 1));

    cout << dp[(1<<n)-1] << "\n";

    return 0;
}


Measured memory_bytes: 1280
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    A,B = map(int, sys.stdin.readline().split())
    if A <=8 and B <=8:
        print("Yay!")
    else:
        print(":(")

Measured memory_bytes: 5072
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
int main()
{
int n,i;
string ans="";
vector<int>freq(27,OO);
scanf("%d",&n);
while(n--){
    vector<int>freq2(27,0);
    string s;
    cin>>s;
    int n1=s.size();
    for(i=0;i<n1;++i){
        freq2[s[i]-'a']++;
    }
    for(i=0;i<27;++i){
        freq[i]=min(freq[i],freq2[i]);
    }
}
for(i=0;i<27;++i){
    for(int j=0;j<freq[i];++j){
        ans+=('a'+i);
    }
}
cout<<ans;


    return 0;
}


Measured memory_bytes: 3708
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
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; }
const long long INF = 1LL << 60;

int main()
{
    int k,x;
    cin >> k >> x;

    if(500*k >= x) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
using namespace std;
int main(void)
{
  int w,h;
  cin >> w >> h;
  LL answer=0;
  vector<pair<LL,bool> > e;
  REP(i,w){
    LL l;
    cin >> l;
    e.emplace_back(l,false);
  }
  REP(i,h){
    LL l;
    cin >> l;
    e.emplace_back(l,true);
  }
  SORT(e);
  for(auto x:e){
    if(x.second){
      answer+=x.first*(w+1);
      --h;
    }else{
      answer+=x.first*(h+1);
      --w;
    }
  }
  cout << answer << endl;
}

Measured memory_bytes: 4464
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a=n%10;
    int b=n/100;
    int c=n/10;
    c=c%10;
    if(a==7||b==7||c==7)
    cout<<"Yes"<<"\n";
    else
      cout<<"No"<<"\n";
    return 0;
}


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

int main()
{
	long long a,b,c;
	cin>>a>>b>>c;
	vector<int>v(a);
	for(int i=0;i<b;i++)
		v[i]=c;
	for(int i=b;i<a;i++)
	{
		if(c<1000000000)
			v[i]=c+1;
		else
			v[i]=1;
	}
	for(int i=0;i<a;i++)
		cout<<v[i]<<" ";

	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s;
    cin>>t;
    int count=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])
         count++;
    }
    cout<<count;
}

Measured memory_bytes: 3920
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
#define int ll
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T &a, T b){if(a < b){a = b;return true;}return false;}
template<class T> inline bool chmin(T &a, T b){if(a > b){a = b;return true;}return false;}
/*----------------------------------------------------------------*/
// int MOD = 998244353;
int MOD = 1000000007;

// int ans[300100];
/*----------------------------------------------------------------*/
signed main(){
	
	int a;
	double b;
	cin >> a >> b;

	int c = (int)(b*100 + 0.1);	
	cout << a*c/100 << endl;

	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl https://abc161.contest.atcoder.jp/tasks/abc161_a

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

int i, count[1001],n;
string s;

int main(){
	cin >> n;
	for(i=0; i<n; i++){
		cin >> s;
		if(s == "AC"){
			count[0]++;
		}else if(s == "WA"){
			count[1]++;
		}else if(s == "TLE"){
			count[2]++;
		}else {
			count[3]++;
		}
	}
	printf("AC x %d\n", count[0]);
	printf("WA x %d\n", count[1]);
	printf("TLE x %d\n", count[2]);
	printf("RE x %d\n", count[3]);
}


Measured memory_bytes: 3724
def rounder(x):
    flt = x - int(x)
    if flt>=0.5:
        return int(x)+1
    else:
        return int(x)

def main():
    a, b = map(int, input().split())
    A = list(range(rounder(a/0.08), rounder((a+1)/0.08)))
    B = list(range(rounder(b/0.10), rounder((b+1)/0.10)))
    r = -1

    for i in range(len(B)):
        if B[i] in A:
            r = B[i]
            break
    print(r)

main()

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var forecast = new [] { "Sunny", "Cloudy", "Rainy" };
            var today = Console.ReadLine();
            var index = 0;
            for (; index < 3; index++)
            {
                if (forecast[index] == today) break;
            }
            Console.WriteLine(forecast[(index + 1) % 3]);
        }
    }
}

Measured memory_bytes: 25608
S = input()
cnt = 0
a = 0
mode = '*'
for s in S:
  if mode == 'A':
    if s == 'A':
      a += 1
    elif s == 'B':
      mode = 'B'
    else:
      a = 0
      mode = '*'
  elif mode == 'B':
    if s == 'A':
      a = 1
      mode = 'A'
    elif s == 'B':
      a = 0
      mode = '*'
    else:
      cnt += a
      mode = 'C'
  elif mode == 'C':
    if s == 'A':
      a += 1
      mode = 'A'
    elif s == 'B':
      mode = 'B'
    else:
      a = 0
      mode = '*'
  else:
    if s == 'A':
      a = 1
      mode = 'A'
print(cnt)

Measured memory_bytes: 3500
a, b, c = map(int,input().split())
k = int(input())

i_b = 0
while b <= a:
    i_b += 1
    b *= 2

i_c = 0
while c <= b:
    i_c += 1
    c *= 2

if i_b + i_c <= k:
    print ('Yes')
else:
    print('No')
    

Measured memory_bytes: 9176
import java.util.*;
import java.util.stream.Collectors;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int t = sc.nextInt();
		
		int count = t / a;
		int result = count * b;
		System.out.println(result);	
	}
}

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

int main() {
  string s;
  cin >> s;
  if(s == "Sunny"){
    cout << "Cloudy" << endl;
  } else if(s == "Cloudy") {
    cout << "Rainy" << endl;
  } else if (s == "Rainy") {
    cout << "Sunny" << endl;
  }
  return 0;
}


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

using namespace std;

int main(int argc, char *argv[]) {
  std::ios_base::sync_with_stdio(false);
  int n, m;
  string s;
  cin >> n >> m >> s;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    a[i] = s[i] == 'A';
  }
  vector<vector<int>> b(n, vector<int>(2));
  vector<vector<int>> g(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    g[u].push_back(v);
    g[v].push_back(u);
    b[u][a[v]]++;
    b[v][a[u]]++;
  }
  vector<bool> vis(n);
  queue<int> q;
  for (int i = 0; i < n; i++) {
    if (!b[i][0] || !b[i][1]) {
      q.push(i);
    }
  }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    vis[u] = true;
    for (auto v : g[u]) {
      if (!vis[v]) {
        b[v][a[u]]--;
        if (b[v][a[u]] == 0) {
          q.push(v);
        }
      }
    }
  }
  bool ok = true;
  for (auto x : vis) {
    ok &= x;
  }
  cout << (!ok ? "Yes" : "No") << endl; 
  return 0;
}


Measured memory_bytes: 21840
#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 all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll INFS=1e18;
const int MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
 
int main() {
  ll n;
  cin>>n;
  v(ll) cnt;
  ll ans=0;
  map<ll,ll> mp;
  rep(i,n){
    ll a;
    cin>>a;
    mp[a]++;
    if(mp[a]==2){
      cnt.pb(a);
      mp[a]=0;
    }
  }
  if(sz(cnt)==0){
    cout<<0<<endl;
    return 0;
  }
  if(sz(cnt)==1){
    cout<<0<<endl;
    return 0;
  }
  sort(all(cnt));
  reverse(all(cnt));
  ans=cnt[0]*cnt[1];
  cout<<ans<<endl;
}

Measured memory_bytes: 9716
#include<iostream>
#include<unordered_map>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<unordered_set>
#include<map>




using namespace std;

int min(int a, int b)
{
    return a < b ? a : b;
}

class Graph {
    int V;
    vector<vector<pair<int, int> > > adjList;
public:
    Graph(int V);
    void addEdge(int u, int v, int w);
    int floyd_warshall(int u,int v);

};

Graph::Graph(int V)
{
    adjList = vector<vector<pair<int, int> > >(V);
    this->V = V;
}


void Graph::addEdge(int u, int v, int w)
{
    adjList[u].push_back(pair<int, int>(v, w));
    adjList[v].push_back(pair<int, int>(u, w));
}

int Graph::floyd_warshall(int u,int v)
{
    vector<vector<int> > dist(V);
    int i,j,k;
    
    for (i = 0; i < V; ++i) {
        dist[i] = vector<int>(V);
    }
    for (i = 0; i < V; ++i) {
        for (j = 0; j < V; ++j) {
            dist[i][j] = 0x3f3f3f;//infinity
        }
    }
    for (i = 0; i < V; ++i) {
        dist[i][i] = 0;
    }
    for (i = 0; i < V; ++i) {
        for (j = 0; j < adjList[i].size(); ++j) {
            dist[i][adjList[i][j].first] = adjList[i][j].second;
        }
    }

    for (k = 0; k < V; ++k) {
        for (i = 0; i < V; ++i) {
            for (j = 0; j < V; ++j) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int count = 0;
    for (i = 0; i < V; ++i) {
        for (j = 0; j < adjList[i].size(); ++j) {
            if (dist[i][adjList[i][j].first] != adjList[i][j].second) {
                count++;
            }
        }
    }

    return count/2;

}




int main() {
    int n, m, x;
    cin >> n >> m;
    Graph g(n);
    int i,a,b,w;
    for (i = 0; i < m; ++i) {
        cin >> a >> b >> w;
        --a, --b;
        g.addEdge(a, b, w);
    }
    
    cout << g.floyd_warshall(0,4);
    

}
  

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
//#define DEBUG
//#define RANDOM
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    // musi platit a * b < n
    ll ans = 0;
    for (int i = 1; i < n; i++)
    {
        ans += (n - 1) / i;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3480
#include <algorithm>
#include <complex>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define REP(i, m, n) for (int i = int(m); i < int(n); i++)
#define RREP(i, m, n) for (int i = int(n) - 1; i >= int(m); --i)
#define EACH(i, c) for (auto &(i) : c)
#define all(c) begin(c), end(c)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(begin(c), end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x) cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s)                                                               \
    do {                                                                       \
    } while (0)
#define dump(x)                                                                \
    do {                                                                       \
    } while (0)
#define BR
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int, int>;
using VP = vector<PII>;

constexpr int INF = 1 << 29;

void solve() {
    int n, m, r;
    cin >> n >> m >> r;
    VI rs(r);
    REP(i, 0, r) cin >> rs[i];
    REP(i, 0, r) rs[i]--;
    VVI es(n, VI(n, INF));
    int a, b, c;
    REP(i, 0, m) {
        cin >> a >> b >> c;
        --a;
        --b;
        es[a][b] = min(es[a][b], c);
        es[b][a] = min(es[b][a], c);
    }

    // WF
    REP(k, 0, n) REP(i, 0, n) REP(j, 0, n) {
        es[i][j] = min(es[i][j], es[i][k] + es[k][j]);
    }

    VVI dp(1 << r, VI(r, INF));
    REP(i, 0, r) dp[1 << i][i] = 0;
    REP(p, 0, 1 << r) {
        REP(i, 0, r) {
            if (!(p & (1 << i)) && !(p == 0 && i == 0))
                continue;
            REP(j, 0, r) {
                if (p & (1 << j))
                    continue;
                dp[p | (1 << j)][j] =
                    min(dp[p | (1 << j)][j], dp[p][i] + es[rs[i]][rs[j]]);
            }
        }
    }
    cout << *min_element(all(dp[(1 << r) - 1])) << endl;
}

int main() {
    solve();

    return 0;
}

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

int main(){
   int n;
   cin >> n;
   if(n<1200){
      cout << "ABC";
   }else if(n<2800){
      cout << "ARC";
   }else{
      cout << "AGC";
   }
   return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)

int H, A[MAX+1];

void maxHeapify(int i){
  int l, r, largest;
  l = 2 * i;
  r = 2 * i + 1;
  if(l <= H && A[l] > A[i]) largest = l;
  else largest = i;
  if(r <= H && A[r] > A[largest]) largest = r;

  if(largest != i){
    swap(A[i], A[largest]);
    maxHeapify(largest);
  }
}

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

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

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

int main(){
  int key;
  char com[10];

  while(1){
    scanf("%s", com);
    if(com[0] == 'e' && com[1] == 'n') break;
    if(com[0] == 'i'){
      scanf("%d", &key);
      insert(key);
    } else {
      printf("%d\n", extract());
    }
  }

  return 0;
}

Measured memory_bytes: 5128
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define llp 1000000007
#define mod 1000000007

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

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;


int main(){
	ios::sync_with_stdio(false);
    int a,b,k;
    cin>>a>>b>>k;
    int i=1;
    int ct=1;
   /*sif(k==1){
        cout<<1<<"\n";
        return 0;
    }
    i++;*/
    vi aa;
    for(;i<=min(a,b);i++){
        if(a%i==0 && b%i==0){
            aa.PB(i);
        }
    }
    //deb(aa);
    cout<<aa[aa.size()-1-k+1]<<"\n";



	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> vec(6);
  for(int i=0; i<6; i++){
    cin >> vec.at(i);
  }
  int c_1 = 0;
  int c_2 = 0;
  int c_3 = 0;
  int c_4 = 0;
  
  for(int j=0; j<6; j++){
    if(vec.at(j) == 1){
      c_1++;
    }
    if(vec.at(j) == 2){
      c_2++;
    }
    if(vec.at(j) == 3){
      c_3++;
    }
    if(vec.at(j) == 4){
      c_4++;
    }
  }
  
  int odd = 0;
  int even = 0;
  if(c_1 == 2){
    even++;
  }
  else{
    odd++;
  }
  if(c_2 == 2){
    even++;
  }
  else{
    odd++;
  }
  if(c_3 == 2){
    even++;
  }
  else{
    odd++;
  }
  if(c_4 == 2){
    even++;
  }
  else{
    odd++;
  }
    
  if(odd == 2 && even == 2){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

int main(){
  int i,j;
  string s;
  cin>>s;
  int k;
  cin>>k;
  int l=s.size();
  ll ans=0;
  vector<vector<int> > ok(l,vector<int>(l));
  for(i=0;i<l;i++){
    int z=0;
    for(j=i+1;j<l;j++){
      if(s[j]=='0'&&z==0) ok[i][j]=0;
      else if(z==0) {
        ok[i][j]=1;
        z=1;
      }
      else ok[i][j]=2;
    }
  } 

  if(k==3){
    for(i=0;i<l;i++){
      for(j=i+1;j<l;j++){
        for(int u=j+1;u<l;u++){
          if(i!=0){
            ans+=9*9*9;
          }
          else if(i==0){
            ans+=(s[0]-1-'0')*9*9;
            if(ok[i][j]==1){
              ans+=(s[j]-1-'0')*9;
              if(ok[j][u]==1){
                ans+=s[u]-'0';
              }
              else if(ok[j][u]==2) ans+=9;
            }
            else if(ok[i][j]==2) ans+=9*9;
          }
        }
      }
    }
  }
  else if(k==2){
    for(j=0;j<l;j++){
      for(int u=j+1;u<l;u++){
        if(j==0){
          ans+=(s[j]-1-'0')*9;
          if(ok[j][u]==1){
            ans+=s[u]-'0';
          }
          else if(ok[j][u]==2) ans+=9;
        }
        else {
          ans+=9*9;
        }
      }
    }
  }

  else if(k==1){
    ans+=s[0]-'0';
    for(j=1;j<l;j++){
      ans+=9;
    }
  }

  cout<<ans<<endl;
  


  
  return 0;
}



Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (X, Y): (i64, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };

    let (_, ans) = (0..100).fold((X, 1), |(x, c), _| if 2 * x <= Y { (2 * x, c + 1) } else { (x, c) });

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

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int n,kisu=0,gusu=0;
  cin >> n;
  long long int a[n];
  for (int i=0;i<n;i++){
    cin >> a[i];
    if(a[i]%2==1)kisu++;
    else gusu++;
  }
  if (kisu%2==0)cout << "YES" <<endl;
  else cout << "NO" <<endl; 

}


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

int main() {
    int x, num;
    
    cin >> x;
    num=x/100;
    if(x<=num*111) {
        cout << num*111<<endl;
    } else {
        cout << (num+1)*111<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<tuple>
#include<queue>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>

using namespace std;

int main(int argc, char* argv[]){
  long long int a,b,c;
  long long int ans = 0;
  cin >> a >> b >> c;
  ans = a*b/2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <algorithm> // sort
#include <map> // pair
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> W(N);
  vector<int> diff(N);
  int S1 = 0;
  int S2 = 0;
  int min_num = 10000000;
  for(int i = 0;i < N;i++){
    cin >> W[i];
    S2 += W[i];
  }

  for(int i = 0;i < N;i++){
    S2 -= W[i];
    S1 += W[i];
    diff[i] = max(S2,S1) - min(S2,S1);
    min_num = min(min_num,diff[i]);
  }

  cout << min_num << endl;
}

Measured memory_bytes: 256
L = "qwertasdfgzxcvb"
while 1:
	key = raw_input()
	if key == "#": break
	c = 0
	h = 1 if key[0] in L else 0
	for i in range(1,len(key)):
		p = 1 if key[i] in L else 0
		c += abs(h-p)
		h = p
	print c

Measured memory_bytes: 4212
#include<stdio.h>
int main(void)
{
	int i,j,a[9]={1,2,3,4,5,6,7,8,9};
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			printf("%dx%d=%d\n",a[i],a[j],a[i]*a[j]);
		}
	}
	return 0;
}

Measured memory_bytes: 524
/// time is tough.....so don't stop ...keep learning ...keep growing :)

#include <bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef long double ld ;
const int N = 1e5+5 ;
const int K = 50 ;
const ll mod =  1e9+7 ;
#define pb push_back
#define ft first 
#define sd second 
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll poww(ll a,ll b){ll res=1;while(b){if(b&1){res*=a;}a=a*a;b>>=1;}return res;}
ll poww(ll a,ll b,ll mod){ll res=1;while(b){if(b&1){res*=a;res%=mod;}a=a*a;a%=mod;b>>=1;}return res;}
const int INF = 2e9 ;
int n, m, u, v, k;
ll dp[405][405];// pre[105][N];
ll a[405], sz[405];
ll f(int i, int j){
   
}
int main(){
    cin >> n ;
    for(int i=1;i<=n;i++) {
        cin >> a[i];
        sz[i] = a[i] + sz[i - 1];
    }
    ll ans = 0;
    for(int len = 2;len <= n; len++) {
        ll mn = 2e18;
        for(int st = 1; st + len -1 <= n; st++) {
            int en = st + len - 1;
            dp[st][en] = 2e18;
            for(int k = st; k < en; k++) {
                dp[st][en] = min(dp[st][en], dp[st][k] + dp[k+1][en] + sz[en] - sz[st-1]);   
            }
        }
    }
    cout << dp[1][n] << '\n';
    return 0;
}
 


Measured memory_bytes: 1536
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
	long long int n, x, y;
	cin >> n;
	x = 1; y = n;
	for (long long int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0 && (i + n / i) < x + y) {
			x = i;
			y = n / i;
		}
	}
	cout << x + y - 2 << endl;
	return 0;
}


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

using namespace std;

typedef enum _DIRECTION { dU, dR, dD, dL, DIR_MAX } DIR;

const int MAX_N = 5;
const int MAX_D = 4;

bool mat[MAX_N][MAX_N][MAX_D];

int main ( void )
{
	for (int i = 0; i < MAX_N; ++i) {
		for (int j = 0; j < MAX_N; ++j) {
			fill(mat[i][j], mat[i][j]+MAX_D, false);
		}
	}

	for (int i = 0; i < 9; ++i) {
		string str;
		cin >> str;

		if (i & 1) {
			for (int j = 0, J = str.size(); j < J; ++j) {
				mat[i/2][j][dD] = (str[j] == '1');
				if (i/2+1 < MAX_N) {
					mat[i/2+1][j][dU] = (str[j] == '1');
				}
			}
		}
		else {
			for (int j = 0, J = str.size(); j < J; ++j) {
				mat[i/2][j][dR] = mat[i/2][j+1][dL] = (str[j] == '1');
			}
		}
	}

	char c_dir[] = "URDL";
	int dx[] = { 0, 1, 0, -1 }, dy[] = { -1, 0, 1, 0 };
	DIR dir = dU;
	int x = 0, y = 0;
	bool hit = true;

	while (hit) {
		hit = false;
		for (int i = 0; i < DIR_MAX; ++i) {
			DIR next = (DIR)((dir + DIR_MAX - 1 + i) % DIR_MAX);
			if (mat[y][x][next]) {
				dir = next;
				mat[y][x][dir] = false;
				cout << c_dir[dir];
				x += dx[dir];
				y += dy[dir];
				hit = true;
				break;
			}
		}
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1176
#include<iostream>
#include<stdlib.h>
using namespace std;
int GCD(long long a, long long b){
  return b?GCD(b,a%b):a;
}
int main(){
  long long a,b,c,d,e;
  cin>>a>>b>>c>>d;
  e=GCD(c,d);
  long long lcm=c*d/e;
  c=b/c-(a-1)/c;
  d=b/d-(a-1)/d;
  e=b/lcm-(a-1)/lcm;
  cout << b-a+1-c-d+e << endl;
}

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

int main()
{
    int input_num;
    
    while (std::cin >> input_num) {
        
        /*終了条件*/
        if (input_num == 0) break;
    
        std::vector<int> num_array(input_num, 0);

        for (int i = 0; i < input_num; ++i) {
            std::cin >> num_array[i];
        }
        
        bool is_end = false;
        int ans_num = 0;

        while (!is_end) {
            std::map<int, int> array_cnt;
            int i = 0;
            std::vector<int> copy_array(num_array);

            while (i < input_num) {
                array_cnt[copy_array[i]] += 1;
                i++;
            }

            for (int i = 0; i < input_num; ++i) {
                copy_array[i] = array_cnt[copy_array[i]];
            }
            
            if (copy_array == num_array) {
                is_end = true;
            } else {
                ans_num++;
                num_array = copy_array;
            }
        }

        std::cout << ans_num << std::endl;
        
        for (int i = 0; i < input_num; ++i) {
            std::cout << num_array[i] << (i < input_num - 1 ? " ": "\n");
        }

    }

    return 0;
}

Measured memory_bytes: 1220
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef int in;
#define int long long
#define f first
#define s second
#define pb push_back
#define pp push
#define RETURN exit(0)
#define pow(x,y) (int)(pow(x,y))
#define ceil(x) (int)(ceil(x))
#ifndef ONLINE_JUDGE
#define debug(x) cout<<x<<endl;
#else
#define debug(x) 42
#endif
const int MAX=1e4;
const int MOD=1e9+7;
const int MAAX=1e15;
const long double EPS=1e-6;
const int N=1e6;
int power(int x,int y)
{
    if (y == 0)
        return 1;
    int a=power(x,y/2);
    if (y % 2 == 0)
        return a * a % MOD;
    else
        return x * a * a % MOD;
}
long double sq(int x){
    long double s=0,e=x,mid;
    while(e-s>=EPS){
        mid=(s+e)/2;
        if(mid*mid<=x){
            s=mid;
        }
        else{
            e=mid-EPS;
        }
    }
    return s;
}
bool check(int x){

}
int binary(int x,int y){
    int s=x,e=y,mid;
    while(s<e){
        mid=ceil((s+e)/2.0);
        if(check(mid))
            s=mid;
        else
            e=mid-1;
    }
    return s;
}
vector<int> primes;
bool visted[N+5];
void sieve(){
    visted[0]=visted[1]=1;
    for(int i=2;i*i<=N;i++){
        if(visted[i]==0){
            primes.pb(i);
            for(int j=i*i;j<=N;j+=i){
                visted[j]=1;
            }
        }
    }
    for(int i=sqrt(N)+1;i<=N;i++){
        if(visted[i]==0)
            primes.pb(i);
    }
    return;
}

bool arr[1010][1010],vis[1010][1010];
int n,m;
int fun(int i,int j){
    vis[i][j]=1;
    int ans=1;
    for(int ii=-1;ii<2;ii++){
        for(int jj=-1;jj<2;jj++){
            if(ii+i<0||ii+i>=n||jj+j<0||jj+j>=m||arr[ii+i][jj+j]==0||vis[ii+i][jj+j])
                continue;
            ans+=fun(ii+i,jj+j);
        }
    }
    return ans;
}



in main()
{
    //freopen("in.in","r",stdin);
    //freopen("out.out","w",stdout);
    int tc=1;
    //sieve();
    //scanf("%lld",&tc);
    while(tc--)
    {
        int n;
        cin>>n;
        cout<<ceil(n/2.0)<<endl;
    }
    RETURN;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;


vector<vector<P>> G;
vl ans;

void dfs(int v,int p=-1, int c=-1){
    int k=1;
    for(auto nv:G[v]){
        int next=nv.first,id=nv.second;
        if(next==p)continue;
        if(k==c)k++;
        ans[id]=k;
        k++;
        dfs(next,v,ans[id]);
    }
}

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

  int n;
  cin >> n;
  G.resize(n);
  ans.resize(n-1);
  rep(i,n-1){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(P(b,i));
    G[b].push_back(P(a,i));
  }
  dfs(0);
  int m=0;
  rep(i,n)m=max(m,(int)G[i].size());
  cout << m << endl;
  rep(i,n-1) cout<<ans[i] << endl;
  return 0;
  
}


Measured memory_bytes: 9856
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,k = inpl()
a = inpl()
now = 1
r = [1]
fin = set([1])
while True:
    now = a[now-1]
    if now in fin:
        break
    r.append(now)
    fin.add(now)
ln = len(r)
for i in range(ln):
    if now == r[i]:
        fir = r[:i]
        nxx = r[i:]
        break
if k < i:
    print(fir[k])
else:
    k -= i
    m = len(nxx)
    print(nxx[k%m])


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

int H[2000005];
int cnt=1;
void pq_insert(int num){
    H[cnt]=num;
    int i=cnt;
    while(i!=1&&H[i]>H[i/2]){
        swap(H[i],H[i/2]);
        i=i/2;
    }
    cnt++;
}

void extract(){
    cout<<H[1]<<endl;
    H[1]=H[--cnt];
    int i=1;
    int max_i;
    while(i*2<cnt){
        max_i=i*2;
        if(i*2+1<cnt&&H[i*2+1]>H[i*2])max_i=i*2+1;
        if(H[i]<H[max_i])swap(H[i],H[max_i]);
        i=max_i;
    }
}

int main()
{
    string s;
    cin>>s;
    while(s!="end"){
        if(s=="insert"){
            int num;
            cin>>num;
            pq_insert(num);
        }else if(s=="extract"){
            extract();
        }
        cin>>s;
    }
    return 0;
}

Measured memory_bytes: 7104
#include <stdio.h>

int main()
{
	int a, b, c;
	char S[4];
	scanf("%s", S);
	a = S[0] - 'a';
	b = S[1] - 'a';
	c = S[2] - 'a';
	if (a * b * c == 0 && a + b + c == 3 && a * b + b * c + c * a == 2) printf("Yes\n");
	else printf("No\n");
	fflush(stdout);
	return 0;
}

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

int main(void)
{
    long long N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    vector<char> vec(N+2);
    vec[0] = 'X';
    vec[N+1] = 'X';
    for (long long i = 1; i < N+1; i++)
    {
        vec[i] = S[i-1];
    }

    int flg = 0;
    long long cnt = 0;
    for (long long i =2; i < N+1; i++)
    {
        if (vec[i] == vec[1])
        {
            if (flg == 1)
            {
                if (cnt == K)
                {
                    break;
                }
                flg = 0;
            }
        }
        else
        {
            vec[i] = vec[1];
            if (flg == 0)
            {
                cnt++;
                flg = 1;
            }
        }
    }

    long long ans = 0;
    for (long long i = 1; i < N+1; i++)
    {
        if (vec[i] == 'L')
        {
            if (vec[i-1] == 'L')
            {
                ans++;
            }
        }
        else
        {
            if (vec[i+1] == 'R')
            {
                ans++;
            }
        }
    }
    cout << ans <<endl;
}

Measured memory_bytes: 3856
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(begin);i>(end);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
using namespace std;
#define ll long long

int main()
{
	stringstream ss;
	// 入力
	ll N;
	cin >> N;
	vector<ll> A(N);

	REP(i,N){
		cin>>A[i];
	}

	SORT(A);

	ll ans=abs(A[N-1]-A[0]);
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val array = Array(n) {
        readLine()!!.split(" ").map(String::toInt)
    }
    var can = true
    var t = 0
    var x = 0
    var y = 0
    for (a in array) {
        val dt = a[0] - t
        val dist = Math.abs(a[1] - x) + Math.abs(a[2] - y)
        if (dt < dist) can = false
        if (dt % 2 != dist % 2) can = false
        t = a[0]
        x = a[1]
        y = a[2]
    }
    if (can) {
        println("Yes")
    } else {
        println("No")
    }
}

Measured memory_bytes: 62492
import java.util.*;
class Knife {
    int a,b;
    public Knife(int a, int b) {
        this.a = a;
        this.b = b;
    }
}
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int H = sc.nextInt();
        Knife[] knife = new Knife[N+1];
        int max = 0;
        int maxb = 0;
        for(int i = 0; i<N; i++) {
            knife[i] = new Knife(sc.nextInt(), sc.nextInt());
            if(max<knife[i].a) {
                max = knife[i].a;
                maxb = knife[i].b;
            }
        }
        knife[N] = new Knife(0,0);
        Arrays.sort(knife,(a, b)->(b.b - a.b));
        int count = 0;
        for(int i = 0; i<N+1; i++) {
            System.err.println(H+" "+knife[i].b+" "+ knife[i].a+" "+max+" "+ maxb);
            if(max > knife[i].b) {
                while(H>0) {
                    H -= max;
                    count++;
                }
                break;
            }
            H -= knife[i].b;
            count++;
            if(H<=0) break;

        }
        System.out.println(count);
    }
}

Measured memory_bytes: 95240
function Main(input) {
	var str = input;
	str = str.split("\n");
	const MAX_LENGTH = Number(str[0].split(" ")); 
	const STRING = str[1]; 
	var  mod = "";
	if(STRING.length > MAX_LENGTH){
  		mod = STRING.substr(0, MAX_LENGTH) + '...'
	}else{
		mod = STRING;
	}
	
console.log(mod); 
}
 //*おまじない
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29620
#include <iostream>
#include <string>
#include <algorithm>
 
int main(void) {
    std::string str;
 
    std::cin >> str;
    std::for_each(str.crbegin(), str.crend(), [](const char& ch){ std::cout << ch; });
    std::cout << std::endl;
 
    return 0;
}

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

#define LL long long
using namespace std;
#define MAXN 60
#define MAXA 60

int N, M, S;

struct edge
{
    int v, a, b;
};
vector<edge> G[MAXN];
int C[MAXN], D[MAXN];
LL dp[MAXN][MAXA * MAXN];
LL ans;

inline void add(int u, int v, int a, int b)
{
    G[u].push_back({v, a, b});
    G[v].push_back({u, a, b});
}
int main()
{
    scanf("%d%d%d", &N, &M, &S);
    int u, v, a, b;
    for (int i = 1; i <= M; i++)
    {
        scanf("%d%d%d%d", &u, &v, &a, &b);
        add(u, v, a, b);
    }
    for (int i = 1; i <= N; i++)
    {
        scanf("%d%d", &C[i], &D[i]);
    }

    memset(dp, 0x3f, sizeof(dp));
    if (S > 2500)
        S = 2500;
    dp[1][S] = 0;
    for (int t = 0; t <= N; t++)
    {
        for (int i = 1; i <= N; i++)
        {
            for (int k = 0; k < G[i].size(); k++)
            {
                for (int j = 0; j <= 2500; j++)
                {
                    if (j + G[i][k].a <= 2500)
                        dp[i][j] = min(dp[i][j], dp[G[i][k].v][j + G[i][k].a] + G[i][k].b);
                }
            }

            for (int j = 0; j <= 2500; j++)
            {
                if (j >= C[i])
                    dp[i][j] = min(dp[i][j], dp[i][j - C[i]] + D[i]);
            }
        }
    }
    for (int i = 2; i <= N; i++)
    {
        ans = 1e18;
        for(int j=0; j<=2500; j++) {
            if(ans>dp[i][j]) {
                ans = dp[i][j];
            }
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 5460
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
ans = 'Yes'
for i in range(len(s)):
    if i%2 == 0:
        if s[i] == 'L':
            ans = 'No'
    else:
        if s[i] == 'R':
            ans = 'No'
print(ans)

Measured memory_bytes: 38768
/**********************************************************************
   File hoge.cpp
   Author  harunaya
   Date   2020-05-17(Sun)
   note   
**********************************************************************/

#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() {
  int k; cin >> k;
  string s; cin >> s;
  int temp = s.size();
  if (temp <= k) {
      cout << s << endl;
  }
  else {
      for (int i = 0; i < k; ++i) {
          cout << s.at(i);
      }
      cout << "..." << endl;
  }
  return 0; 
}

Measured memory_bytes: 3632
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#include <iostream>

using namespace std;

#define FOR(i, a, b)   for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)  for(int i = (a); i > (b); --i)
#define rep(i, n)	   for(int i = 0; i < (n); ++i)
#define all(c)		   begin(c), end(c)
#define rall(c)		   rbegin(c), rend(c)
#define SZ(a)		   ((ll) a.size())

typedef long long		   ll;
typedef unsigned long long ull;


int main(){
  ll N,M;
  cin >> N >> M;
  if(N==1 and M==1) cout << 1;
  else if(N==1) cout << M-2;
  else if(M==1) cout << N-2;
  else cout << (N-2)*(M-2);

}


Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))

ans = 0
t = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    t += 1
  else:
    ans = max(ans, t)
    t = 0
    continue
  ans = max(ans, t)
print(ans)

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

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,m,c,g;
    cin >> n >> m;
    priority_queue<int> q;
    for (int i=0;i<n;i++)
    {
        cin >> c;
        q.push(c);
    }
    for (int i=0;i<m;i++)
    {
        int g=q.top();
        q.pop();
        g/=2;
        q.push(g);
    }
    long long zb=0,o;
    while(!q.empty())
    {
        o=q.top();
        zb+=o;
        q.pop();
    }
    cout << zb;
}


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

#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,cc,n) for(int i=cc;i<(n);++i)
#define drep(i,cc,n) for(int i=cc;i>(n);--i)
#define llrep(i,cc,n) for(long long i=cc;i<(n);++i)
using namespace std;
using ll = long long;

int main()
{
	int H1,M1,H2,M2,K;
	cin >> H1 >> M1 >> H2 >> M2 >> K;
	//vector<int> k(M),p(M);
	//vector<vector<int>> s(M);
	int sa = (H2 - H1) * 60 + (M2 - M1);
	sa = sa - K;
	cout << sa << endl;

	return 0;
}


Measured memory_bytes: 3624