akhauriyash/Code-Regression huggingface dataset:
//### In The Name Of GOD ###

// %% Remember; (((He))) is The (((Accepter))) %%

#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;

#define int ll
#define pb push_back
#define bp pop_back
#define pf push_front
#define fp pop_front
#define X first
#define Y second
#define IO ios_base::sync_with_stdio(false);
#define sz(a) (int)(a.size())
#define sg(a, b) (a + b - 1) / b

const int MOD = 1000 * 1000 * 1000 + 7;
const int INF = 2 * 1000 * 1000 + 200;
const int MAXN = 100 * 1000 + 1;
const int MLOG = 18;
const int NMAX = 1 * 1000;

signed main(){
  IO;
  string s;
  cin >> s;
  cout << ((sz(s) + (s[0] == s[sz(s) - 1])) % 2 ? "First" : "Second");
}


Measured memory_bytes: 512
class UnionFind:

    def __init__(self, n):
        self.parents = [i for i in range(n + 1)]
        self.ranks = [0 for _ in range(n + 1)]

    def find_root(self, node):
        parent_node = self.parents[node]
        if node == parent_node:
            return node
        else:
            root_node = self.find_root(parent_node)
            self.parents[node] = root_node  # reduction
            return root_node

    def union(self, one, other):
        one_root = self.find_root(one)
        other_root = self.find_root(other)
        if one_root == other_root:
            return
        one_rank = self.ranks[one_root]
        other_rank = self.ranks[other_root]
        if one_rank < other_rank:
            self.parents[one_root] = other_root
        else:
            self.parents[other_root] = one_root
            if one_rank == other_rank:
                self.ranks[other_root] += 1

    def is_same_group(self, one, other):
        one_root = self.find_root(one)
        other_root = self.find_root(other)
        return one_root == other_root


def main():
    N, M = list(map(int, input().split(' ')))
    p = list(map(int, input().split(' ')))
    tree = UnionFind(N)
    for _ in range(M):
        x, y = list(map(int, input().split(' ')))
        tree.union(p[x - 1], p[y - 1])
    answer = 0
    for i in range(1, N + 1):
        if tree.is_same_group(i, p[i - 1]):
            answer += 1
    print(answer)


if __name__ == '__main__':
    main()

Measured memory_bytes: 14452
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    string s, t;
    cin >> s >> t;
    bool ans = false;
    for(int i = 0; i < s.size(); i++) {
        if(s == t) ans = true;
        s = s.back() + s.substr(0, s.size() - 1);
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace AtC
{
    class Program
    {
        static void Main(string[] args)
        {
            var nk = ReadIntArray();
            double N = nk[0], K = nk[1];
            double sum = 0;
            for (uint i = 1; i <= N; i++)
            {
                if (i <= K)
                    sum += 1d / Math.Pow(2, Math.Ceiling(Math.Log(K / i, 2)));
                else sum += 1;
            }

            Out(sum / N);
        }

        //最小公倍数
        static int LCM(int num1, int num2)
        {
            var gcd = GCD(num1, num2);
            return num1 * (num2 / gcd);
        }

        static long LCM(long num1, long num2)
        {
            var gcd = GCD(num1, num2);
            return num1 * (num2 / gcd);
        }

        //最大公約数
        static int GCD(int num1, int num2)
        {
            int a = Math.Max(num1, num2);
            int b = Math.Min(num1, num2);
            int mod;
            while ((mod = a % b) != 0)
            {
                a = b;
                b = mod;
            }

            return b;
        }

        static long GCD(long num1, long num2)
        {
            long a = Math.Max(num1, num2);
            long b = Math.Min(num1, num2);
            long mod;
            while ((mod = a % b) != 0)
            {
                a = b;
                b = mod;
            }

            return b;
        }

        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long[] ReadLongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static string ReadString()
        {
            return Console.ReadLine();
        }

        static void Out(object o)
        {
            Console.WriteLine(o);
        }
    }

    static class EnumerableExtension
    {
        public delegate void Function<in T>(T val);

        public static void ForEach<T>(this IEnumerable<T> enumerable, Function<T> function)
        {
            foreach (var x in enumerable)
            {
                function(x);
            }
        }
    }

    class PriorityQueue<T>
    {
    }
}

Measured memory_bytes: 13396
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#include <iomanip>
#define rep(i,x) for(ll i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 1001001001;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}/*フィボナッチテンプレ
ll memo[50];
ll fibo(ll n) {
    if (memo[n] != 0)return memo[n];
    if (n <= 1)return memo[n] = n;
    else return memo[n] = fibo(n - 1) + fibo(n - 2);
}
*/
bool isp(ll n) {
    bool res = true;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            res = false;
            break;
        }
    }
    return res;
}
ll ctoi(char c) {
    if (c == '0')return 0;
    else if (c == '1')return 1;
    else if (c == '2')return 2;
    else if (c == '3')return 3;
    else if (c == '4')return 4;
    else if (c == '5')return 5;
    else if (c == '6')return 6;
    else if (c == '7')return 7;
    else if (c == '8')return 8;
    else if (c == '9')return 9;
    else return -1;
}
int main() {
    ll N;
    cin >> N;
    bool ok = false;
    rep(i, 50000) {
        ll n = i * 1.08;
        if (n == N) {
            cout << i << endl;
            ok = true;
        }
    }
    if (!(ok))cout << ":(" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = (ll)1e9 + 7;
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)

signed main() {
	ll N;
	string S;
	cin>>N>>S;

	if(S[0]=='W'||S[S.size()-1]=='W'){
		cout<<0<<endl;
		return 0;
	}

	vector<ll> left(2*N,0),right(2*N,0);
	ll count=0;
	rep(i,2*N){
		if(S[i]=='B'){
			if(count%2==1){
				right[i]=1;
				count--;
			}else{
				left[i]=1;
				count++;
			}
		}else{
			if(count%2==1){
				left[i]=1;
				count++;
			}else{
				right[i]=1;
				count--;
			}
		}
	}

	ll lsum=accumulate(left.begin(),left.end(),0LL);
	ll rsum=accumulate(right.begin(),right.end(),0LL);
	if(lsum!=rsum){
		cout<<0<<endl;
		return 0;
	}

	vector<ll> ruileft(2*N+1,0);
	rep(i,2*N){
		ruileft[i+1]=ruileft[i]+left[i];
	}

	ll ans=1,rcount=0;
	rep(i,2*N){
		if(right[i]){
			ll candidate=ruileft[i]-rcount;
			ans*=candidate;
			ans%=MOD;
			rcount++;
		}
	}

	rep(i,N){
		ans*=(i+1);
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 5252
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;	
int main(){
	char A,B,C,D,a,b,c,d;
	while(~scanf(" %c %c %c %c",&A,&B,&C,&D)){
	a=A-48;
	b=B-48;
	c=C-48;
	d=D-48;
	if(a+b+c+d==7){
		printf("%d+%d+%d+%d=7\n",a,b,c,d);
		break;
	}
	if(a-b+c+d==7){
		printf("%d-%d+%d+%d=7\n",a,b,c,d);
		break;
	}
	if(a+b-c+d==7){
		printf("%d+%d-%d+%d=7\n",a,b,c,d);
		break;
	}
	if(a+b+c-d==7){
		printf("%d+%d+%d-%d=7\n",a,b,c,d);
		break;
}
	if(a-b+c-d==7){
		printf("%d-%d+%d-%d=7\n",a,b,c,d);
		break;
}
	if(a-b-c+d==7){
		printf("%d-%d-%d+%d=7\n",a,b,c,d);
		break;
}
	if(a-b-c-d==7){
		printf("%d-%d-%d-%d=7\n",a,b,c,d);
		break;
}
	if(a+b-c-d==7){
		printf("%d+%d-%d-%d=7\n",a,b,c,d);
		break;
}
	}
}


Measured memory_bytes: 256
from math import log2

n,k = map(int, input().split())
al = list(map(int, input().split()))

logk = int(log2(k))+1
db = [ [0]*n for _ in range(logk) ]
for ni in range(n): 
    db[0][ni] = al[ni]-1
for ki in range(logk-1):
    for ni in range(n):
        db[ki+1][ni] = db[ki][db[ki][ni]]

now = 0
for i in range(logk):
    if k&(1<<i) > 0:
        now = db[i][now]
print(now+1)



Measured memory_bytes: 182772
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

int main(){
    double n; cin >> n;
    int ans = (int)(n/2) + (int)n%2;
    cout << fixed << setprecision(15) << ans/n << endl; return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_map>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <cstring>
#include <cmath>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for(int i = (int)(n-1); i > -1; i--)


ull MOD = 1000000007;

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

int main(){
    int x;
    cin >> x;
    int ans = x;
    while( !isPrime(ans)) ans++;
    cout << ans << endl;
}



Measured memory_bytes: 256
base = input().split()
h = int(base[0])
w = int(base[1])
if h%2==1:
    ha = (h//2)+1
    hb = ha-1
else:
    ha = h/2
    hb = ha
g = w//2
if w%2==1:
    ans = ha*(g+1)+hb*g
else:
    ans = (ha+hb)*(w/2)
if h ==1:
    ans = 1
if w ==1:
    ans = 1
print(int(ans))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
typedef pair<int,int> P;
std::vector<P> ans;//答え
int nowx=0,nowy=0;//現在のxとyの場所
void move(int x,int y){
  nowx+=x;nowy+=y;
  ans.push_back(P(nowx,nowy));
}
//main
signed main(){
  int k,x,y;cin>>k>>x>>y;
  if(k%2==0&&((x+y)&1)){cout<<-1<<endl;return 0;}//いけない時
  if(abs(x)+abs(y)==k){cout<<1<<endl<<x<<" "<<y<<endl;return 0;}//一回で行ける場合
  int X=abs(x),Y=abs(y);//x,y>=0にしておく
  int cou=-1;//相殺分
  for(int j=k*2;cou<0;j+=k)if((j-(X+Y))%2==0)cou=(j-(X+Y))/2;//couが相殺分になった
  if(cou){
    int a=cou/k;
    while(a--)move(-k,0);//まず(-k,0)でxを反対方向に行かせる（相殺分を稼ぐ）（cou>=kの時のみ使える）
    cou%=k;
    if(nowx<0)move(k-cou,-cou);//上のwhileが行われた時:残りのcou分yを反対方向に行かせて、xは目的地を目指し始める　
    else{//上のwhileが行われなかった時:xかyのどっちかをcou分反対方向に行かせなくてはならない
         //この時、xとyの小さい方を反対方向に行かせるべき
         //反対方向に行かなかったやつは正方向にk-cou進むので、そこで目的地を通り越さないようにするため
        //この解法が正しいか自信がないのはここのパート
      if(X>Y)move(k-cou,-cou);
      else move(-cou,k-cou);
    }
  }
  while(nowx+k<=X)move(k,0);//(k,0)でxを目的地に行かせる
  while(nowy+k<=Y)move(0,k);//(0,k)でyを目的地に行かせる
  if(nowx!=X||nowy!=Y)ans.push_back(P(X,Y));//もしxとyがたどり着いてないなら最後の一回でたどり着ける
  cout<<ans.size()<<endl;
  for(auto p:ans){
    if(x<0)cout<<p.first*(-1);//xが負ならxの動き全てに-1倍をすればよい
    else cout<<p.first;
    cout<<" ";
    if(y<0)cout<<p.second*(-1);//yが負の時も同様
    else cout<<p.second;
    cout<<endl;
  }
}


Measured memory_bytes: 6000
#include <bits/stdc++.h>
using namespace std;
int main(){
	int x;cin>>x;
	int ten=x%100;
	int cost=0;
	for(int i=5;i>=1;i--){
		cost+=ten/i;
		ten=ten%i;
	}
	if(cost*100>x){
		cout<<0<<endl;
		return 0;
	}else{
		cout<<1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#define MAX 1000
#define INFTY 1<<30 // 2^30
using namespace std;
typedef long long llong;

static const int N = 100;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[N][N];
int color[N], d[N], f[N], tt;
int nt[N];

int next(int u)
{
  for(int v = nt[u]; v < n; v++)
  {
    nt[u] = v+1;
    if(M[u][v]) return v;
  }
  return -1;
}

void dfs_visits(int r)
{
  for(int i = 0; i < n; i++) nt[i] = 0;
  // Initialization
  stack<int> S;
  S.push(r);
  color[r] = GRAY;
  d[r] = ++tt;

  while(!S.empty())
  {
    int u = S.top();
    int v = next(u);
    if(v != -1)
    {
      if(color[v] == WHITE)
      {
        color[v] = GRAY;
        d[v] = ++tt;
        S.push(v);
      }
    }
    else
    {
      S.pop();
      color[u] = BLACK;
      f[u] = ++tt;
    }
  }
}

void dfs()
{
  //Initialization
  for(int i = 0; i < n; i++)
  {
    color[i] = WHITE;
    nt[i] = 0;
  }
  tt = 0;
  for(int u = 0; u < n; u++)
    if(color[u] == WHITE) dfs_visits(u);
  for(int i = 0; i < n; i++)
    cout << i+1 << " " << d[i] << " " << f[i] << endl;
}

int main()
{
  int u, k, v;
  cin >> n;
  for(int i = 0; i < n; i++)
    for(int j = 0; j < n; j++) M[i][j] = 0;

  for(int i = 0; i < n; i++)
  {
    cin >> u >> k;
    u--;
    for(int j = 0; j < k; j++)
    {
      cin >> v;
      v--;
      M[u][v] = 1;
    }
  }

  dfs();
  return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
const int P=1e9+7,M=100001;
int n,k,a,b;
bool fl=0;
vector<int>d[M];
int dfs(int x,int la){
	long long res=1,num=k-1;
	if(la!=0)num--;
	long long sum=1;
	int si=d[x].size();
	if(la!=0)si--;
	if(si>num){
		fl=1;
		return 0;
	}
	for(int i=1;i<=si;i++)sum=sum*num%P,num--;
	for(int i=0;i<(int)d[x].size();i++){
		int y=d[x][i];
		if(y==la)continue;
		res=res*dfs(y,x)%P;
	}
	res=res*sum%P;
	return res;
}
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<n;i++){
		scanf("%d%d",&a,&b);
		d[a].push_back(b);
		d[b].push_back(a);
	}
	printf("%lld\n",dfs(1,0)*1ll*k%P);
}

Measured memory_bytes: 11520
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> pii;
typedef std::pair<long long, long long> pll;

using namespace std;

const long long mod = 1000000007;

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

	int n;
	cin >> n;
	pii* a;
	a = new pii[n];
	rep(i, n) {
		cin >> a[i].first;
		a[i].second = i;
	}

	sort(a, a + n);

	rep(i, n) {
		cout << a[i].second + 1 << "\n";
	}

    return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    int cnt[4] = {};
    rep(i, 3){
        int a, b;
        cin >> a >> b;
        cnt[a-1]++, cnt[b-1]++;
    }
    rep(i, 4)if(cnt[i]>=3){
        cout << "NO\n";
        return 0;
    }
    cout << "YES\n";
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		WriteLine(GetString().Contains('7') ? "Yes" : "No");
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 25892
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long bar[] = new long[N];
        for(int i=0;i<N;i++) bar[i] = sc.nextLong();
        Arrays.sort(bar);
        
        long edge1 = 0;
        long edge2 = 0;
        
        for(int i=N-1;i>0;i--){
        	if(bar[i]==bar[i-1]){
        		if(edge1==0){
        			edge1 = bar[i];
        			i--;
        		}
        		else{
        			edge2 = bar[i];
        			break;
        		}
        	}
        }
        System.out.println(edge1 * edge2);
    }
}

Measured memory_bytes: 50188
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
using namespace std;
int main()
{
		cout << fixed << setprecision(12);

		int a, b;

	cin >> a >> b;
	cout << a/b << " " << a%b <<" "<< (double)a/b << endl;
}



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

int main() {
  int c[4][4];
  for (int i = 1; i <= 3; i++) for (int j = 1; j <= 3; j++) cin >> c[i][j];

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

  int f = 1;
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3; j++) if (c[i][j] != a[i] + b[j]) f = 0;
  }

  if (f) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

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

class Program {
  static void Main(string[] args) {
    var nk = Console.ReadLine().Split(' ').Select(e => int.Parse(e)).ToArray();
    var hs = Console.ReadLine().Split(' ').Select(e => int.Parse(e)).ToArray();

    var dp = new long[hs.Length];

    for (int i = 1; i < dp.Length; i++) {
      dp[i] = (long)Math.Pow(10, 9);

      for (int j = i - 1; j >= 0 && (i - j) <= nk[1]; j--) {
        dp[i] = Math.Min(dp[i], dp[j] + Math.Abs(hs[i] - hs[j]));
      }
    }

    Console.WriteLine(dp.Last());
  }
}


Measured memory_bytes: 18912
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;

int main()
{
	string c;

	cin >> c;
	if (c == "a" || c == "e" || c == "i" || c == "o" || c == "u") {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}
}

Measured memory_bytes: 256
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let s = readLine()!
    
    if s == "Sunny" {
        print("Cloudy")
    } else if s == "Cloudy" {
        print("Rainy")
    } else {
        print("Sunny")
    }
}

main()


Measured memory_bytes: 7664
n = int(input())
a = list(map(int, input().split()))

ans = 0
for i in range(n-1):
    mi = i
    for j in range(i, n):
        if a[j] < a[mi]:
            mi = j
    if mi != i:
        a[i], a[mi] = a[mi], a[i]
        ans += 1
print(' '.join(map(str, a)))
print(ans)


Measured memory_bytes: 5600
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int n,m;
vvi in;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
  while(cin>>m>>n,n+m){
    in=vvi(n,vi(m));
    rep(i,n)rep(j,m)cin>>in[i][j];
    vi co(4);
    rep(i,4)cin>>co[i];
    int dp[40][40][4];
    rep(i,40)rep(j,40)rep(k,4)
      dp[i][j][k]=inf;
    dp[0][0][0]=0;
    queue<pair<pii,pii> >q;
    q.push(pair<pii,pii>(pii(0,0),pii(0,0)));
    while(!q.empty()){
      pii a=q.front().first;
      pii b=q.front().second;
      q.pop();
      //      cout<<a.first<<" "<<a.second<<" "<<b.first<<" "<<b.second<<endl;
      if(a.first==n-1&&a.second==m-1)continue;
      if(dp[a.first][a.second][b.first]<b.second)continue;
      rep(i,4){
	int nx=a.first+dx[(b.first+i)%4];
	int ny=a.second+dy[(b.first+i)%4];
	if(nx<0||ny<0||nx>=n||ny>=m)continue;
	int cost=b.second;
	if(in[a.first][a.second]!=i)cost+=co[i];
	if(dp[nx][ny][(i+b.first)%4]>cost){
	  dp[nx][ny][(b.first+i)%4]=cost;
	  q.push(pair<pii,pii>(pii(nx,ny),pii((b.first+i)%4,cost)));
	}
      }
    }
    int out=inf;
    rep(i,4)out=min(out,dp[n-1][m-1][i]);
    cout<<out<<endl;
  }
}

Measured memory_bytes: 1296
#include<bits/stdc++.h>
using namespace std;
void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
void wt_L(long long x){
  char f[20];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
int A, N;
long long dp[5], nx[5];
int main(){
  int Lj4PdHRW, i, j, k;
  long long res;
  rd(N);
  for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
    rd(A);
    nx[0] = dp[0] + A;
    nx[1] = dp[1] + (A % 2);
    nx[2] = dp[2] + ((A+1)%2);
    nx[3] = dp[3] + (A % 2);
    nx[4] = dp[4] + A;
    if(A==0){
      nx[1] += 2;
      nx[3] += 2;
    }
    for(i=0;i<5;i++){
      dp[i] = 4611686016279904256LL;
      for(j=0;j<i+1;j++){
        chmin(dp[i], nx[j]);
      }
    }
  }
  {
    int KL2GvlyY;
    long long Q5VJL1cS;
    if(5==0){
      Q5VJL1cS = 0;
    }
    else{
      Q5VJL1cS = dp[0];
      for(KL2GvlyY=1;KL2GvlyY<5;KL2GvlyY++){
        Q5VJL1cS = min_L(Q5VJL1cS, dp[KL2GvlyY]);
      }
    }
    res =Q5VJL1cS;
  }
  wt_L(res);
  putchar_unlocked('\n');
  return 0;
}
// cLay varsion 20180730-1

// --- original code ---
// // z e o e z
// 
// int N, A;
// ll dp[5], nx[5];
// {
//   int i, j, k;
//   ll res;
// 
//   rd(N);
//   rep(N){
//     rd(A);
//     nx[0] = dp[0] + A;
//     nx[1] = dp[1] + (A % 2);
//     nx[2] = dp[2] + ((A+1)%2);
//     nx[3] = dp[3] + (A % 2);
//     nx[4] = dp[4] + A;
// 
//     if(A==0){
//       nx[1] += 2;
//       nx[3] += 2;
//     }
// 
//     rep(i,5){
//       dp[i] = ll_inf;
//       rep(j,i+1) dp[i] <?= nx[j];
//     }
//   }
// 
//   res = min(dp(5));
//   wt(res);
// }


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][][] data = new int[N][][];
        for (int i = 0; i < N; i++) {
            int a = sc.nextInt();
            data[i] = new int[a][2];
            for (int j = 0; j < a; j++) {
                data[i][j][0] = sc.nextInt() - 1;
                data[i][j][1] = sc.nextInt();
            }
        }
        int ans = 0;
        for (int bit = 0; bit < Math.pow(2, N); bit++) {
            boolean f = true;
            for (int i = 0; i < N; i++) {
                if (getBit(bit, i) == 0) {
                    continue;
                }
                for (int j = 0; j < data[i].length; j++) {
                    int shougen = data[i][j][1];
                    if (shougen != getBit(bit, data[i][j][0])) {
                        f = false;
                    }
                }
            }
            if (f) {
                ans = Math.max(ans, Integer.bitCount(bit));
            }
        }
        System.out.println(ans);
    }

    static int getBit(int bit, int digit) {
        if ((bit & (1 << (digit))) > 0) {
            return 1;
        }
        return 0;
    }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#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>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
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, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.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 ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll S;
void input(){
    fast_io();
    cin >> S;
}

vector< ll > divisor(ll n) {
  vector< ll > ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

void printans(ll x1, ll x2, ll y1, ll y2){
    cout << 0 << " " << 0 << " ";
    cout << x1 << " " << x2 << " ";
    cout << y1 << " " << y2 << " ";
    cout << "\n";
}

int TLEsolve(){
    auto v = divisor(S);
    ll sq = sqrt(S);
    auto itr = lower_bound(v.begin(),v.end(),sq);
    ll d = *itr;
    return 0;
}

int solve(){
    ll x1,x2,y1,y2;
    ll n = sqrt(S);
    if(n*n==S){
        printans(n,0,0,n);
    }
    else{
        x1 = sqrt(S)+1;
        y2 = sqrt(S)+1;
        ll rest = x1*y2-S;
        auto v = divisor(rest);
        x2 = *lower_bound(v.begin(),v.end(),sqrt(rest));
        y1 = rest/x2;
        printans(x1,x2,y1,y2);
    }
    return 0;
}


int main()
{
    input();
    solve();
    return 0;
}

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

int main() {
  int n, i;
  vector<int> a;
  cin >> n;

  while (cin >> i) {
    a.push_back(i);
  }

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

  cout << a.at(a.size() - 1) - a.at(0) << endl;
}

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

class DisjointSet{
    public:
        vector<int> rank, p;

        DisjointSet(){}
        DisjointSet(int size){
            rank.resize(size, 0);
            p.resize(size, 0);
            for (int i = 0; i < size; i++) makeSet(i);
        }

        void makeSet(int x){
            p[x] = x;
            rank[x] = 0;
        }

        bool same(int x, int y){
            return findSet(x) == findSet(y);
        }

        void unite(int x, int y){
            link(findSet(x), findSet(y));
        }

        void link(int x, int y){
            if(rank[x] > rank[y]){
                p[y] = x;
            } else {
                p[x] = y;
                if(rank[x] == rank[y]){
                    rank[y]++;
                }
            }
        }

        int findSet(int x){
            if(x != p[x]){
                p[x] = findSet(p[x]);
            }
            return p[x];
        }
};

struct edge{
    int s;
    int t;
    int w;

    bool operator < ( const edge &e ) const {
        return w < e.w;
    }
};

vector<edge> Edges;
vector<edge> K;

int main() {
    int V, E; cin >> V >> E;
    rep(i, E){
        int s, t, w; cin >> s >> t >> w;
        edge e = {s, t, w};
        Edges.push_back(e);
    }
    sort(Edges.begin(), Edges.end());
    DisjointSet disj = DisjointSet(V);

    for (int i = 0; i < E; i++){
        if(disj.findSet(Edges[i].s) != disj.findSet(Edges[i].t)){
            disj.unite(Edges[i].s, Edges[i].t);
            K.push_back(Edges[i]);
        }
    }

    int ans = 0;
    for(auto x : K){
        int y = x.w;
        ans += y;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4576
def g(n):
    if n % 4 == 0:
        return n
    elif n % 4 == 1:
        return 1
    elif n % 4 == 2:
        return n+1
    else:
        return 0


def main():
    A, B = map(int, input().split())
    print(g(A-1) ^ g(B))


if __name__ == "__main__":
    main()


Measured memory_bytes: 38384
n = int(input())
lst = [0] + list(map(int, input().split()))
reach = False
for i in range(n):
  if reach:
    if lst[i + 1] - lst[i] <= -1:
      print('No')
      exit()
    elif lst[i + 1] - lst[i] >= 1:
      reach = False
  else:
    if lst[i + 1] - lst[i] == -1:
      reach = True
    elif lst[i + 1] - lst[i] <= -2:
      print('No')
      exit()
print('Yes')

Measured memory_bytes: 20520
// https://atcoder.jp/contests/dp/tasks/
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

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

int main() {
    ios::sync_with_stdio(false);

    string s, t, u;
    int a, b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;

    if (u == s)
        a--;
    else
        b--;

    cout << a << " " << b << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
template<class T>int digid(T x){
    if(x==0)return 0;
    else if(x>=1&&x<10)return 1;
    else if(x>=10&&x<100)return 2;
    else if(x>=100&&x<1000)return 3;
    else if(x>=1000&&x<10000)return 4;
    else if(x>=10000&&x<100000)return 5;
    else if(x>=100000&&x<1000000)return 6;
    else if(x>=1000000&&x<10000000)return 7;
    else if(x>=10000000&&x<100000000)return 8;
    else if(x>=100000000&&x<1000000000)return 9;
    else if(x>=1000000000&&x<10000000000)return 10;
    else if(x>=10000000000&&x<100000000000)return 11;
    else if(x>=100000000000&&x<1000000000000)return 12;
    else if(x>=1000000000000&&x<10000000000000)return 13;
    else if(x>=10000000000000&&x<100000000000000)return 14;
    else if(x>=100000000000000&&x<1000000000000000)return 15;
    else if(x>=1000000000000000&&x<10000000000000000)return 16;
    else if(x>=10000000000000000&&x<100000000000000000)return 17;
    else if(x>=100000000000000000&&x<1000000000000000000)return 18;
    else if(x>=1000000000000000000&&x<10000000000000000000)return 19;
    else return -1;
}
long long INF = 1LL<<60;
int main( ){
    ll n;
    cin>>n;
    ll candiv=-1;
    int res=1<<30;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0)candiv=i;
        chmin(res,max(digid(candiv),digid(n/candiv)));
    }
    cout<<res<<endl;
    return 0;
}




Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int a[5],n,x,m=9;
  for(int i=0;i<5;i++)
  {
    cin>>a[i];
    x=a[i]%10;
    if(x<m && x>0)
    {
      m=x;
      n=i;
    }
  }
  int sum=0,q;
  for(int i=0;i<5;i++)
  {
    if(i==n)
    {
      continue;
    }
    else {
      sum+=a[i];
      q=a[i]%10;
      if(q!=0)
      {
      q=10-q;
      sum+=q;
      }
    }
  }
  sum+=a[n];
  cout<<sum;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main { 
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	String[] humansAndHeight = sc.nextLine().split(" ");
    	int humans = Integer.parseInt(humansAndHeight[0]);
    	int height = Integer.parseInt(humansAndHeight[1]);
    	String[] heights = sc.nextLine().split(" ");
    	
    	int count =0;
    	for(int i = 0;i<humans;i++) {
    		int tmp = Integer.parseInt(heights[i]);
    		if(tmp >= height) {
    			count++;
    			
    		}
    	}
 
    	System.out.println(count);
    	
    	
    }
}

Measured memory_bytes: 35520
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
ll A, B, K;

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

  cin >> A >> B >> K;
  ll a=0ll,b=0ll;
  if (A-K>=0) {
    cout << A-K << ' ' << B << "\n";
    return 0;
  }
  ll z = K-A;
  if (B-z>=0) {
    cout << 0 << ' ' << B-z << "\n";
  } else {
    cout << 0 << ' ' << 0 << "\n";
  }

  return 0;
}

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

//////////////////
// Union-Find木 //
//////////////////

// 0-indexed
class UnionFind {
private:
	std::vector<int> parent_, size_;
public:
	UnionFind(const int size)
		:parent_(size), size_(size, 1)
	{
		for (int i{}; i < size; i++) parent_[i] = i;
	}
	int calcRoot(const int index)
	{
		int &parent{parent_[index]};
		if (parent == index) return index;

		parent = calcRoot(parent);
		return parent;
	}
	bool areConnected(const int index1, const int index2)
	{
		return calcRoot(index1) == calcRoot(index2);
	}
	void unite(const int index1, const int index2)
	{
		const int root1{calcRoot(index1)}, root2{calcRoot(index2)};
		if (root1 == root2) return;
		if (size_[root1] <= size_[root2])
		{
			size_[root2] += size_[root1];
			parent_[root1] = root2;
		}
		else
		{
			size_[root1] += size_[root2];
			parent_[root2] = root1;
		}
		return;
	}
	int calcSize(const int index)
	{
		return size_[calcRoot(index)];
	}
};

int main()
{
	int N, H, W;
	scanf("%d%d%d", &N, &H, &W);
	using i3 = std::array<int, 3>;
	using vi3 = std::vector<i3>;
	using vvi3 = std::vector<vi3>;
	vvi3 grid[2];
	vi3 cards(N);
	grid[0].resize(H);
	grid[1].resize(W);
	for (int i{}; i < N; i++)
	{
		int R, C, A;
		scanf("%d%d%d", &R, &C, &A);
		R--; C--;
		grid[0][R].push_back({A, (int)grid[1].size(), C});
		grid[1][C].push_back({A, (int)grid[0].size() - 1, R});
		cards[i] = {A, R, C};
	}
	for (auto& e: grid) std::sort(e.rbegin(), e.rend());
	std::sort(cards.rbegin(), cards.rend());
	std::vector<int> index[2];
	index[0].resize(H);
	index[1].resize(W);
	std::vector<int> size(H + W);
	UnionFind uf(H + W);
	int64_t ans{};
	for (auto& card: cards)
	{
		if (uf.areConnected(card[1], card[2] + H))
		{
			int root{uf.calcRoot(card[1])};
			if (size[root] == uf.calcSize(root)) continue;
			size[root]++;
			ans += card[0];
		}
		else
		{
			int root1{uf.calcRoot(card[1])}, root2{uf.calcRoot(card[2] + H)};
			uf.unite(root1, root2);
			int root{uf.calcRoot(root1)};
			size[root] = size[root1] + size[root2];
			if (size[root] == uf.calcSize(root)) continue;
			size[root]++;
			ans += card[0];
		}
	}
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 15488
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception addd) {
					addd.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception addd) {
				addd.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	
	public static FastReader sc = new FastReader();
 
	static int mod = (int) (1e9+7),MAX=(int) (2e5+100);
    static List<Integer>[] edges;
    static long[][][] dp;
    static int n,d;
    static char[] s;
    
	public static void main(String[] args) {
	
		s = sc.next().toCharArray();
		d = sc.nextInt();
		n = s.length;
		dp = new long[2][d][n+1];
		
		for(int i=0;i<dp.length;++i) {
			for(int j=0;j<dp[i].length;++j) Arrays.fill(dp[i][j], -1);
		}
	    long ans = (f(1,0,0) - 1 + mod)%mod;
	    out.print(ans);
		out.close();
   }

	private static long f(int l, int m, int i) {
		if(i == s.length) {
			if(m == 0) return 1;
			return 0;
		}
		if(dp[l][m][i] != -1) return dp[l][m][i];
		long o1 = 0;
		int end = (l==1)?s[i]-'0':9;
		for(int dig=0;dig<=end;++dig) {
			o1 = (o1 + f(l&((dig == end)?1:0),(m+dig)%d,i+1))%mod;
		}
		return dp[l][m][i] = o1;
	}
	


    }



Measured memory_bytes: 55380
n, m = map(int, input().split())
graph = [[float('inf')]*n for i in range(n)]
u_s=[]
v_s=[]
w_s=[]
for _ in range(m):
    u, v, w = map(int, input().split())
    u_s.append(u-1)
    v_s.append(v-1)
    w_s.append(w)
    graph[u-1][v-1] = w
    graph[v-1][u-1] = w
for i in range(n):
    graph[i][i] = 0


def warshall_floyd(adj_m):
    # _dist[i][j] : i から j への最短距離
    _dist=adj_m
    for _k in range(n):
        for _i in range(n):
            for _j in range(n):
                _dist[_i][_j] = min(_dist[_i][_j], _dist[_i][_k]+_dist[_k][_j])
    return _dist

dist=warshall_floyd(graph)

ans=0
for i in range(m):
    if w_s[i]>dist[u_s[i]][v_s[i]]:
        ans+=1

print(ans)

Measured memory_bytes: 9280
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007

int n,r[200000],c[200000];
long long all[4002][4002],one[4002][4002],result;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void collection()
{
    for(int i=0;i<n;++i) result+=all[2000-r[i]][2000-c[i]];
    for(int i=0;i<n;++i) result+=(mod-one[1+2*r[i]][1+2*c[i]]);

    if(result%2!=0) result+=mod;
    result=(result/2)%mod;
}

void onePoint()
{
    for(int j=1;j<=4001;++j) for(int i=1;i<=4001;++i)
    {
        one[i][j]+=(one[i-1][j] + one[i][j-1]);
        one[i][j]%=mod;
    }
}

void allPoint()
{
    for(int j=4000;j>=0;--j) for(int i=4000;i>=0;--i)
    {
        all[i][j]+=(all[i+1][j] + all[i][j+1]);
        all[i][j]%=mod;
    }
}

void prepare()
{
    scanf("%i",&n);
    for(int i=0;i<n;++i) scanf("%i%i",&r[i],&c[i]);
    for(int i=0;i<n;++i) ++all[2000+r[i]][2000+c[i]]; /**/ one[1][1]=1;
}

int main()
{
    prepare();
    allPoint();
    onePoint();
    collection();
    printf("%lli\n",result);

    return  0;
}

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

void judge(){
    int a,b,c;
    cin >> a;
    cin >> b;
    cin >> c;
    if(a < b)
    {
        if(b<c)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    else
    {
        cout << "No" << endl;
    }
}
int main(int argc, const char * argv[]) {
    judge();
    return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>

int main()
{
  int x;
  scanf("%d", &x);
  x %= 10;
  switch(x) {
  case 3:
    puts("bon");
    break;
  case 0:
  case 1:
  case 6:
  case 8:
    puts("pon");
    break;
  default:
    puts("hon");
    break;
  }
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

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

    int N; cin >> N;
    vector<P> a;
    rep(i, N) {
        int b; cin >> b;
        a.pb(P{b, i+1});
    }
    sort(all(a));
    rep(i, N) cout << a[i].se << ' ';
    cout << endl;
    return 0;

}

Measured memory_bytes: 1780
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> pii;
typedef std::pair<long long, long long> pll;

using namespace std;

const long long MOD = 1000000007;

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

	int n;
	string s;
	cin >> n >> s;
	if (n & 1) {
		cout << "No" << "\n";
		return 0;
	}
	if (s.substr(0, n / 2) == s.substr(n / 2, n / 2)) {
		cout << "Yes" << "\n";
	}
	else {
		cout << "No" << "\n";
	}

	return 0;
}


Measured memory_bytes: 256
from fractions import gcd

def check(n):
   count=0
   while n%2==0:
      n/=2
      count+=1
   return count
   
N,M=map(int,input().split())
A=list(map(int,input().split()))

#すべてのiについてa_iを２で割れる回数が同じであるか
a_0=A[0]
a_0_count=check(a_0)
flag=True
for i in range(1,N):
   if check(A[i])!=a_0_count:
      flag=False
      break

if flag==False:
   print(0)
else:
   ans=A[0]//2
   for i in range(1,N):
      ans=(ans*A[i]//2)//gcd(ans,A[i]//2)

   left=0
   right=10**9
   while left<right-1:
      mid=(left+right)//2
      mid_2=2*mid-1
      if ans*mid_2<=M:
         left=mid
      else:
         right=mid
      
   print(left)

Measured memory_bytes: 16320
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+10;
int a,b;
int main()
{
	cin>>a>>b;
	for(int i=b-a+1;i<=b+a-1;i++)
	cout<<i<<" ";
	cout<<endl;
}

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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 5;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<ll, ll> P;

const ll N = 1e6+5;
string s;
vector<ll> v[N];
ll n;
vector<ll> a;

int main () {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  rep(i,n) {
    if((i+1) * 108 / 100 == n) {
      cout << i+1 << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
}


Measured memory_bytes: 23680
#include<iostream>
#define N 100001
using namespace std;

int father[N];
int findfather(int i){
    while(father[i]!=i){
        i=father[i];
    }
    return i;
}
void changeGroup(int a,int b){
    // merge b t a
    int fa=findfather(a);
    int fb=findfather(b);
    father[fb]=fa;
}

int main(){
    int n,m,q;
    int a,b;
    cin>>n>>m;
    for(int i=0;i<n;i++) father[i]=i;
    for(int i=0;i<m;i++){
        cin>>a>>b;
        changeGroup(a,b);
    }
    cin>>q;
    for(int i=0;i<q;i++){
        cin>>a>>b;
        if(findfather(a)==findfather(b)){
            cout<<"yes"<<endl;
        }else
            cout<<"no"<<endl;
    }
    return 0;
}



Measured memory_bytes: 3484