akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(x,y) for(ll i=x;i<y;i++)
#define vll vector<ll>
#define sll set<ll>
#define pb push_back
#define in insert
#define FAST ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define MOD 1000000007
#define all(x) x.begin(),x.end()
#define tc ll t;cin>>t;while(t--)
#define rev(x) reverse(all(x))
#define low_str(x) transform(all(x),x.begin(),::tolower)
#define up_str(x) transform(all(x),x.begin(),::toupper)
#define to_digit(c) c-'0';
int main()
{
ll n; cin >> n;
ll x; cin >> x;
ll sum = 0;
rep(1,n)
{
    ll y; cin >> y;
    if(y<x)
    sum += (x-y);
    else
    {
        x = y;
    }
}
cout << sum << endl;
return 0;
}

Measured memory_bytes: 3600
import java.util.Scanner;

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

		String a = sc.next();
		if(a.endsWith("s")) {
			System.out.println(a+"es");
		}else {
			System.out.println(a+"s");

			}

	}
}

Measured memory_bytes: 38432
#include<bits/stdc++.h>
typedef  long long int ll;
typedef  long double ld;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define mod 1000000007
#define F first
#define S second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//recursions\
#pragma comment(linker, "/stack:200000000")
//loops\
#pragma GCC optimize("unroll-loops")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
ll modexp(ll a,ll b)
{
	a%=mod;
	if(a==0||a==1)
	return a;
	if(b==0)
	return 1;
	if(b%2==0)
	{
		ll res=modexp(a,b/2);
		return (res*res)%mod;
	}
	return (a*modexp(a,b-1))%mod;
}
int main()
{
	sync;
	ll n,k;
	cin>>n>>k;
	ll arr[n];
	input(arr,n);
	ll ans=0,val=modexp(2,mod-2);
	for(ll i=0;i<n;i++)
	{
		ll tot1=0,tot2=0;
		for(ll j=0;j<n;j++)
		{
			if(i>j)
			{
				if(arr[i]<arr[j])
				tot1++;
			}
			else
			{
				if(arr[i]<arr[j])
				tot2++;
			}
		}
	//	cout<<tot1<<" "<<tot2<<endl;
		ans=(ans+(((k*(k-1))%mod*val)%mod*(tot1+tot2))%mod+(tot1*k)%mod)%mod;
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int map[110];
bool solve() {
	if (map[1] % 2 == 1 && map[2] % 2 == 1) {
		for (int i = 3; i <= 100; i++){
			if (map[i] % 2 == 1)
				return false;
		}
		return true;
	}
	else return false;
}
int main() {
	int a, b;
	while (cin >> a >> b) {
		if (!a && !b) {
			if (solve()) cout << "OK\n";
			else cout << "NG\n";
			for (int i = 1; i <= 100; i++)map[i] = 0;
			continue;
		}
		else {
			map[a]++;
			map[b]++;
		}
	}
}

Measured memory_bytes: 2976
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) { cin >> A[i]; }
    map<ll, ll> mp, mp2;
    rep(i, N) { mp2[i - A[i]]++; }
    ll res = 0;
    rep(i, N) {
        mp[i + A[i]]++;
        mp2[i - A[i]]--;
        res += mp2[i + A[i]];
    }
    cout << res << endl;
    return 0;
}

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

int main() {
  char 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
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define localin freopen("C:\\Users\\hp\\Desktop\\CPP\\inout\\inputf.in","r",stdin);
#define localout freopen("C:\\Users\\hp\\Desktop\\CPP\\inout\\outputf.in","w",stdout);
const int MAX=2e5+5;
#define ld long double
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define tot(v) v.begin(),v.end()
#define rtcheck cout<<"saurabh\n";exit(0);
#define vcheck(x) cout<<#x<<" "<<x<<endl;                                                                                                                                       
#define pint pair<int,int>
#define forn for(int i=0;i<n;i++)
const int modu=1e9+7;
const int inf=1e17;

struct activity
{
	int A,B,C;
};


int solve(vector<activity> ar , int n)
{
	int dp[n][3];
	dp[0][0] = ar[0].A;
	dp[0][1] = ar[0].B;
	dp[0][2] = ar[0].C;

	for(int i=1;i<n;i++)
	{
		dp[i][0] = ar[i].A + max(dp[i-1][1],dp[i-1][2]);
		dp[i][1] = ar[i].B + max(dp[i-1][0],dp[i-1][2]);
		dp[i][2] = ar[i].C + max(dp[i-1][1],dp[i-1][0]);
	}
	int res = max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	return res;
}

int32_t main()
{
    fast;
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector<activity> ar(n+1);
        for(int i=0;i<n;i++)
        {
        	cin >> ar[i].A;
        	cin >> ar[i].B;
        	cin >> ar[i].C;
        }
        int ans = solve(ar,n);
        cout << ans << endl;
    }

 }


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

public class Main {

	class DisjointSet {
		
		int[] p, r, w;
		
		public DisjointSet(int size) {
			p = new int[size];
			r = new int[size];
			w = new int[size];
			for(int i = 0; i < size; i++) makeSet(i);
		}

		private void makeSet(int x) {
			p[x] = x;
			r[x] = w[x] = 0;
		}
		
		private int findSet(int x) {
			if (p[x] != x) {
				int tmp = findSet(p[x]);
				w[x] += w[p[x]];
				p[x] = tmp;
			}
			return p[x];
		}
		
		public boolean same(int x, int y) {
			return findSet(x) == findSet(y);
		}
		
		public void relate(int x, int y, int z) {
			link(findSet(x), findSet(y), z - w[x] + w[y]);
		}

		private void link(int x, int y, int cost) {
			if (r[x] > r[y]) {
				p[y] = x;
				w[y] -= cost;
			} else {
				p[x] = y;
				w[x] += cost;
				if (r[x] == r[y]) {
					r[y]++;
				}
			}
		}
		
		public int sum(int x) {
			int sum = 0;
			int cur = x;
			while (cur != p[cur]) {
				sum += w[cur];
				cur = p[cur];
			}
			return sum;
		}
	}
	
	public static void main(String[] args) throws IOException {
		new Main().run();
	}
	
	private void run() throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(reader.readLine());
		int n = Integer.parseInt(st.nextToken());
		DisjointSet ds = new DisjointSet(n);
		int q = Integer.parseInt(st.nextToken());
		for (int i = 0; i < q; i++) {
			st = new StringTokenizer(reader.readLine());
			int c = Integer.parseInt(st.nextToken());
			int x = Integer.parseInt(st.nextToken());
			int y = Integer.parseInt(st.nextToken());
			if (c == 0) {
				int z = Integer.parseInt(st.nextToken());
				ds.relate(x, y, z);
			} else {
				if (ds.same(x, y)) {
					System.out.println(ds.sum(x) - ds.sum(y));
				} else {
					System.out.println("?");
				}
			}
		}
		reader.close();
	}
}



Measured memory_bytes: 80720
#include<bits/stdc++.h>
using namespace std;
using ll=long long int ;
#define FOR0(n) for(ll i=0;i<n;i++)
int main()
{
 /* int t;
  cin>>t;
  while(t--)
  { */
      ll n,m,k;
      cin>>n>>m>>k;
      vector<ll>a(n),b(m);
      vector<ll>sa(n+1),sb(m+1);

      for(int i=0;i<n;i++)
      {
          cin>>a[i];
      }
     
      for(int i=0;i<m;i++)
      {
          cin>>b[i];
      }
      

      //prefix sum array
      for(int i=0;i<n;i++)
      {
          sa[i+1]=sa[i]+a[i];
      }
      
      for(int i=0;i<m;i++)
      {
          sb[i+1]=sb[i]+b[i];
      }
      
      ll ans=0;
      for(int i=0;i<=n;++i)
      {
          ll diff=k-sa[i];

          if(diff<0)
            continue;

          ll p2=lower_bound(sb.begin(),sb.end(),diff)-sb.begin();

          if(p2>m || sb[p2]> diff)
            p2--;

          ans=max(ans,i+p2);

      }
      cout<<ans<<endl;

  //}
  return 0;
}


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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

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

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

    ll N;
    string S;
    cin >> N;
    int D[N + 1][3];

    REP(i,N){
        cin >> D[i][0] >> D[i][1];
    }

    ll count = 0;
    bool flag = false;

    REP(i,N){
        if (D[i][0] == D[i][1]){
            count++;
            if(count>=3){
                flag = true;
            }
        }
        else{
            count = 0;
        }
    }

    if(flag){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) for(int i = 0 ; i < n ; ++i)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

lint dp[101][100001];

int main(){
    int N;
    lint W;
    cin >> N >> W;
    vector<lint> w(N);
    vector<int> v(N);
    int vsum = 0;
    rep(i, N){
        cin >> w[i] >> v[i];
        vsum += v[i];
    }
    fill(dp[0], dp[101], LLINF);
    dp[0][0] = 0;
    REP(i, 1, N + 1){
        rep(j, vsum + 1){
            if(j >= v[i - 1]){
                dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v[i - 1]] + w[i - 1]);
            }else{
                dp[i][j] = dp[i - 1][j];
            }
        }
    }
    int ans = 0;
    rep(j, vsum + 1){
        if(dp[N][j] <= W){
            ans = max(ans, j);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 79104
H, W = map(int, input().split())
h, w = map(int, input().split())

mas = [[0] * W for i in range(H)]

for h_i in range(h):
    mas[h_i] = [1] * W

for w_i in range(w):
    for i in range(H):
        mas[i][w_i] = 1

count = 0
for h_i in range(H):
    for w_i in range(W):
        if mas[h_i][w_i] == 0:
            count += 1
print(count)

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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
//constexpr long long MOD = (ll) 1e9 + 7;
constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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;
}

struct Edge {
	ll to, rev;
    long double cap;
	Edge(ll _to, long double _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, long double cap, bool revFlag, long double revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}



void solve(){
    ll n;
    cin>>n;
    n++;
    Array a(n);
    REP(i,n) cin>>a[i];
    Array l(n,0),r(n,0);
    REP2(i,n){
        l[i]+=a[i];
        r[i]+=a[i];
        if(i-1>=0){
            l[i-1]=(l[i]+1)/2;
            r[i-1]=r[i];
        }
    }

    ll L=1,R=1;
    ll ans=0;
    REP(i,n){
        L=max(l[i],L);
        R=min(r[i],R);
        if(R<L){
            cout<<-1<<en;
            return;
        }
        ans+=R;
        L-=a[i];
        R-=a[i];
        R*=2;
    }
    cout<<ans<<en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 5576
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
using namespace std;
int a[123456], n, ans; string s;
signed main() {
	cin >> n; for1(i, n) { cin >> a[i]; if (i > 2 && (a[i] - a[i - 1])*(a[i - 1] - a[i - 2]) > 0)ans++; }
	cout << ans << endl;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
if N==1 and M==0:
  print(0)
  exit()

ans=[-1]*N
for _ in range(M):
  s,c=map(int,input().split())
  if ans[s-1]!=c and ans[s-1]!=-1:
    print(-1)
    exit()
  ans[s-1]=c

if ans[0]==0:
  if N!=1:
    print(-1)
    exit()
if ans[0]==-1:
  ans[0]=1
for i in range(1,N):
  if ans[i]==-1:
    ans[i]=0

print(int("".join(map(str,ans))))

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

int main() {
	int i;
	int n, l;
	cin>>n>>l;
	int a[n];
	for(i=0;i<n;i++)
    cin>>a[i];

	int m = a[0]+a[1];
	int posi = 0;
	for(i=0;i+1<n;i++)
	{
		if(m<a[i]+a[i+1])
		{
			m = a[i]+a[i+1];
			posi = i;
		}
	}

	if (m<l)
	{
	    cout<<"Impossible"<<endl;
	    return 0;
    }

	cout<<"Possible"<<endl;
	for(i=0;i<posi;i++)
    {
		cout<<i+1<<endl;
	}
	for(i=n-2;i>posi;i--)
    {
		cout<<i+1<<endl;
	}
	cout<<posi+1<<endl;
}


Measured memory_bytes: 4028
import sys
range = xrange
input = sys.stdin.readline

class mergefind:
    def __init__(self,n):
        self.parent = list(range(n))
        self.size = [1]*n
        self.num_sets = n

    def find(self,a):
        to_update = []
       
        while a != self.parent[a]:
            to_update.append(a)
            a = self.parent[a]
       
        for b in to_update:
            self.parent[b] = a

        return self.parent[a]

    def merge(self,a,b):
        a = self.find(a)
        b = self.find(b)

        if a==b:
            return

        if self.size[a]<self.size[b]:
            a,b = b,a

        self.num_sets -= 1
        self.parent[b] = a
        self.size[a] += self.size[b]

    def set_size(self, a):
        return self.size[self.find(a)]

    def __len__(self):
        return self.num_sets

n,m = [int(x) for x in input().split()]

dsu = mergefind(n)
for _ in range(m):
    a,b,c = [int(x) for x in input().split()]
    dsu.merge(a-1,b-1)

print len(dsu)

Measured memory_bytes: 35560
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long k = sc.nextInt();
		long ans = 0;
		for(long i = k+1; i <= n; i++) {
			long tmp1 = (n+1) / i;
			long tmp2 = (n+1) % i;
			ans += tmp1*(i-k);
			ans += Math.max(tmp2-k,0);
		}
		if(k == 0) {
			System.out.println(n*n);
		}else {			
			System.out.println(ans);
		}
		sc.close();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void permutation(String q, String ans) { //Call permutation(String, "",) from outside
		if (q.length() <= 1)
			System.out.println(ans + q); //Fill in processing
		else
			for (int i = 0; i < q.length(); i++)
				permutation(q.substring(0, i) + q.substring(i + 1), ans + q.charAt(i));
	}

	public static void combination(String q, String ans, int k) { //Call combination(String, "", n) from outside (nCr)
		if (ans.length() == k)
			System.out.println(ans); //Fill in processing
		else
			while (q.length() > 0) {
				combination(q.substring(1), ans + q.charAt(0), k);
				q = q.substring(1);
			}
	}

	long combination(int n, int r, int m) { //nCr mod m
		long[][] Combination = new long[n + 1][n + 1];
		for (int i = 0; i <= n; i++) {
			Combination[i][0] = 1;
			for (int j = 1; j <= i; j++)
				Combination[i][j] = (Combination[i - 1][j - 1] + Combination[i - 1][j]) % m;
		}
		return Combination[n][r];
	}

	int gcd(int a, int b) {
		if (a < b) {
			int c = a;
			a = b;
			b = c;
		}
		if (b == 0)
			return a;
		else
			return gcd(b, a % b);
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  ll n,m;
  cin>>n>>m;

  cout<<min(m/2,(2*n+m)/4)<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i(0);i<n;i++)
#define fast  ios_base::sync_with_stdio(0); cin.tie(0);
#define open freopen("input.txt","r",stdin) ; freopen("output.txt","w",stdout);
#define watch(x) cout<<(#x)<<" is "<<x<<"\n";
#define mod 1000000007

int32_t main(){
	
	fast;
	//open;

	int n,x,y,flag=1,h=0;
	cin>>n;
	multimap<int, int, less<int>> m;
	rep(i,n){
		cin>>y>>x;
		m.insert(make_pair(x,y));
	}
	multimap<int,int> :: iterator it; 
    for (it=m.begin() ; it!=m.end() ; it++){
    	x = (*it).first; y = (*it).second;
        h+=y;
        if(x<h){
        	flag=0;
        	break;
        }
    }
    if(flag)cout<<"Yes";
    else cout<<"No";


	return 0;
}

Measured memory_bytes: 12800
use std::cmp::max;

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: i32 = read(&mut stdin_lock, &mut buf, b'\n');
    let mut suml = 0;
    let mut maxl = 0;
    for _ in 0..(n - 1) {
        let l: i32 = read(&mut stdin_lock, &mut buf, b' ');
        suml += l;
        maxl = max(maxl, l);
    }
    let l: i32 = read(&mut stdin_lock, &mut buf, b'\n');
    suml += l;
    maxl = max(maxl, l);
    let ans = if suml - maxl > maxl { "Yes" } else { "No" };
    println!("{}", ans);
}


Measured memory_bytes: 4476
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class282
    {
        static void Main()
        {
            var abc = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int a = abc[0], b = abc[1];

            if (a % 2 == 0 || b % 2 == 0) Console.WriteLine("No");
            else Console.WriteLine("Yes");
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
  	string s;
  	cin >> s;

  	if(s == "Y"){
  		cout << "Four" << endl;
  		return 0;
  	}
	}
	cout << "Three" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

ll n,k;
ll a[100];
ll dp[100][100001];
ll solve(ll x,ll y){
    if(y==0)return 1;
    if(y<0)return 0;
    if(x==-1)return 0;
    if(dp[x][y]!=-1)return dp[x][y];
    return dp[x][y]=((solve(x-1,y)+solve(x,y-1))-solve(x-1,y-a[x]-1)+mod)%mod;
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    cin>>n>>k;
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++)cin>>a[i];
    cout<<(solve(n-1,k))<<endl;
    return 0;
}


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

int main(){
long long a,b,c,k;
cin>>a>>b>>c;
cin>>k;
long long ans=0;
long long temp=b;
long long temp2=c;
long long count=0;
for(long long i=0;i<2*k;i++){
    if(temp>a){
        break;
    }
    temp=2*temp;
    count++;
}
for(long long i=0;i<2*k;i++){
    if(temp2>temp){
        break;
    }
    temp2=2*temp2;
    count++;
}
if(count<=k){
    cout<<"Yes"<<endl;
}
else{
    cout<<"No"<<endl;
}
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  char c1,c2,c3,c4,c5,c6,c7,c8,c9;
  cin >> c1 >> c2 >> c3 >> c4 >> c5 >> c6 >> c7 >> c8 >> c9;
  cout << c1 << c5 << c9 << endl;
  return 0;
}


Measured memory_bytes: 256
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
--
local N=read.n()
local min = 1111
local max = 0
for i=1,N do
    local a = read.n()
    min=math.min(min,a)
    max=math.max(max,a)
end
print(max-min)



Measured memory_bytes: 508
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

H, A = LI()
print(H // A + (1 if H%A else 0))


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;
typedef long long ll;
int INF=1<<29;

int main(){
	ios::sync_with_stdio(false);
	int N,frontB=0,backA=0,With=0,ans=0;
	cin>>N;
	vector<string> s(N);
	for(int i=0;i<N;i++){
		cin>>s[i];
		int tmp=s[i].length();
		if(s[i][0]=='B' && s[i][tmp-1]=='A') With++;
		else if(s[i][0]=='B') frontB++;
		else if(s[i][tmp-1]=='A') backA++;
		for(int j=0;j<tmp-1;j++){
			if(s[i][j]=='A' && s[i][j+1]=='B') ans++;
		}
	}

	//1
	if(With>=1){
		ans+=(With-1);

		//2
		if(frontB>=1 && backA>=1){
			ans+=2;
			frontB--;
			backA--;
		}else if(frontB==0 && backA>=1){
			ans+=1;
			backA--;
		}else if(frontB>=1 && backA==0){
			ans+=1;
			frontB--;
		}
	}

	//3
	ans+=min(frontB,backA);

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

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

using namespace std;

int gcd(int a,int b){
	return b==0 ? a : gcd(b,a%b);
}


int main()
{
	long long n;
	scanf("%d",&n);
	for(long long a=1;a<=3500;a++){
		for(long long b=a;b<=3500;b++){
			long long x=4*a*b-n*(a+b);
			long long y=a*b*n;
			if(x<=0){continue;}
			if((y/x)*x==y){
				printf("%lld %lld %lld\n",a,b,y/x);
				return 0;
			}
		}
	}
	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);
        int n = sc.nextInt(), l = sc.nextInt();
        int sum = 0, f = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            int v = l + i;
            sum += v;
            if (Math.abs(v) < Math.abs(f)) f = v;
        }
        System.out.println(sum - f);
    }
}

Measured memory_bytes: 23636
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>

using namespace std;

class RGBc{
public:
	int R,G,B;
	string name;

	RGBc();
	RGBc(int R_,int G_,int B_){
		R=R_;
		G=G_;
		B=B_;
	}

	bool operator<(const RGBc &rgb)const{
		return rgb.R>this->R;
	}
};

int main(){
	
	//map<RGB,string>table;
	vector<RGBc> vrgb;
	RGBc tmp(0,0,0);

	tmp.name="black";
	tmp.R=0;
	tmp.G=0;
	tmp.B=0;
	vrgb.push_back(tmp);

	tmp.name="blue";
	tmp.R=0;
	tmp.G=0;
	tmp.B=255;
	vrgb.push_back(tmp);

	tmp.name="lime";
	tmp.R=0;
	tmp.G=255;
	tmp.B=0;
	vrgb.push_back(tmp);

	tmp.name="aqua";
	tmp.R=0;
	tmp.G=255;
	tmp.B=255;
	vrgb.push_back(tmp);

	tmp.name="red";
	tmp.R=255;
	tmp.G=0;
	tmp.B=0;
	vrgb.push_back(tmp);

	tmp.name="fuchsia";
	tmp.R=255;
	tmp.G=0;
	tmp.B=255;
	vrgb.push_back(tmp);

	tmp.name="yellow";
	tmp.R=255;
	tmp.G=255;
	tmp.B=0;
	vrgb.push_back(tmp);

	tmp.name="white";
	tmp.R=255;
	tmp.G=255;
	tmp.B=255;
	vrgb.push_back(tmp);

	//table["black"].R=0;
	//table["black"].G=0;
	//table["black"].B=0;

	//table["blue"]=RGB(0,0,255);
	//table["lime"]=RGB(0,255,0);
	//table["aqua"]=RGB(0,255,255);
	//table["red"]=RGB(255,0,0);
	//table["fuchsia"]=RGB(255,0,255);
	//table["yellow"]=RGB(255,255,0);
	//table["white"]=RGB(255,255,255);

	string str;
	while(cin>>str&&str!="0"){
		vector<int> v;
		for(int i = 1; i < str.size(); i+=2){
			int num=0;
			if(str[i]>='a'&&str[i]<='f'){
				num+=str[i]-'a'+10;
				num*=16;
			}
			else{
				num+=str[i]-'0';
				num*=16;
			}
			if(str[i+1]>='a'&&str[i+1]<='f'){
				num+=str[i+1]-'a'+10;
			}
			else{
				num+=str[i+1]-'0';
			}
			v.push_back(num);
		}

		int R=v[0];
		int G=v[1];
		int B=v[2];

		int minDk=10000000;
		string color;
		for(int i = 0; i < vrgb.size(); i++){
			int dk=(R-vrgb[i].R)*(R-vrgb[i].R)+(G-vrgb[i].G)*(G-vrgb[i].G)+(B-vrgb[i].B)*(B-vrgb[i].B);
			if(minDk>dk){
				minDk=dk;
				color=vrgb[i].name;
			}
		}
		cout<<color<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
n=int(input().rstrip())
cnt=0
tmp=0
for i in range(n):
    a,b=map(int,input().split())
    if a==b:
        tmp+=1
    else:
        cnt=max(cnt,tmp)
        tmp=0
cnt=max(cnt,tmp)

if cnt>=3:
    print("Yes")
else:print("No")

Measured memory_bytes: 9184
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#define N 2005
using namespace std;

int n, k, Q, ans = 9e9, cnt, s, a[N];
vector<int> b, c;
int main()
{
	int i, j, w;
	cin >> n >> k >> Q;
	for (i = 1; i <= n; i++) scanf ("%d", &a[i]);
	for (i = 1; i <= n; i++) {
		s = 0;
		cnt = 0;
		b.clear();
		c.clear();
		for (j = 1; j <= n; j++) {
			if (a[j] >= a[i]) {
				cnt++;
				b.push_back(a[j]);
			} else {
				if (cnt >= k) {
					s += cnt - k + 1;
					sort(b.begin(), b.end());
					for (w = 0; w <= cnt - k; w++) c.push_back(b[w]);
				}
				cnt = 0;
				b.clear();
			}
		}
		if (cnt >= k) {
			s += cnt - k + 1;
			sort(b.begin(), b.end());
			for (w = 0; w <= cnt - k; w++) c.push_back(b[w]);
			b.clear();
		}
		cnt = 0;
		if (s >=Q) {
			sort(c.begin(),c.end());
			ans = min(ans, c[Q - 1] - a[i]);
		}
	}
	cout <<ans;
    return 0;
}


Measured memory_bytes: 256
line = require('fs').readFileSync('/dev/stdin', 'ascii').split("\n");
end = line.lastIndexOf('0 0');
line = line.slice(0, end);
(function() {
	var ary, a, b, format;
	format = require('util').format;
	for (i in line) {
		ary = line[i].split(" ", 2);
		a = parseInt(ary[0], 10);
		b = parseInt(ary[1], 10);
		if (a < b) line[i] = format('%d %d', a, b);
		else line[i] = format('%d %d', b, a);
	}
}) ();
console.log(line.join("\n"));

Measured memory_bytes: 17900
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <functional>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
int main(){
  int N,K;
  cin >> N >> K;
  int ans = 0;
  for(int i = 0;i < N;i++){
    int h;
    cin >> h;
    if(h >= K)ans++;
  }

  cout << ans << endl;
}


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

long long dp[100010][110];
long long v[101];
long long t[101];
long long maxi = 1000000000000;

void namesti(int n)
{
    for(int i = 0; i <= 100000; i++)
    {
        for(int j = 0; j <= n; j++)
        {
            if(dp[i][j] == 0 && i > 0) dp[i][j] = maxi;
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n, w;
    cin >> n >> w;
    
    for(int i = 1; i <= n; i++)
    {
        cin >> t[i] >> v[i];
        dp[v[i]][i] = t[i];
    }
    namesti(n);
    /*for(int i = 1; i <= 6; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            cout << dp[i][j] << " ";
        }
        cout << "\n";
    }*/
    
    
    
    for(int i = 1; i <= 100000; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            if(i >= v[j]) dp[i][j] = min(dp[i][j-1], t[j] + dp[i - v[j]][j-1]);
            else dp[i][j] = min(dp[i][j], dp[i][j-1]);
        }
    }
    int pok = 100000;
    
    
    
    while(pok > 0)
    {
        if(dp[pok][n] <= w && dp[pok][n] > 0) { cout <<pok; return 0; }
        pok--;
    }
    cout << "0";
    
    return 0;
}


Measured memory_bytes: 86144
#include <bits/stdc++.h>
#define repp(i, l, r) for (long long i = (l); i < (r); i++)
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define per(i, n) for (long long i = (n); i >= 0; --i)
#define all(v) v.begin(), v.end()
const int INF = 2147483647;  // int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = 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;
}

ll ngcd(vector<ll> a) {
    ll res;
    res = a[0];
    for (ll i = 1; i < (ll)a.size() && res != 1; i++) {
        res = gcd(a[i], res);
    }
    return res;
}

//ミョ(-ω- ?)
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    //前処理
    vector<ll> Sieve(1e6 + 5, -1);
    Sieve[0] = 0;
    Sieve[1] = 1;
    repp(i, 2, 1e6 + 5) {
        if (Sieve[i] != -1) continue;
        ll m = 0;
        while (i * m < 1e6+5) {
            ++m;
            ll multi = i * m;
            if (multi > 1000000) break;
            if (Sieve[m * i] != -1) continue;
            Sieve[i * m] = i;
        }
    }
    //ここまで共通の処理


    ll n;
    cin >> n;
    vector<ll> a(n, 0);
    rep(i, n) cin >> a[i];

    vector<ll> cnt(1e6 + 5, 0);
    ll v_gcd = ngcd(a);

    rep(i, n) {
        ll before = 0;
        while (a[i] > 1) {
            cnt[Sieve[a[i]]]++;
            before = Sieve[a[i]];
            while (a[i] >= Sieve[a[i]] && Sieve[a[i]] == before &&  a[i] % Sieve[a[i]] == 0 )
                a[i] /= Sieve[a[i]];
        }
    }
    bool pairwise = true;
    repp(i, 1, 1e6 + 1) {
        if (cnt[i] > 1) {
            pairwise = false;
            break;
        }
    }
    if (pairwise)
        cout << "pairwise coprime\n";
    else if (v_gcd == 1)
        cout << "setwise coprime\n";
    else
        cout << "not coprime\n";
    return 0;
}


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

using namespace std;

int main() {
	int n;

	cin >> n;

	while (n >= 1000) {
		n = n - 1000;
	}

	int ans = 1000 - n;

	if (n == 0)
		ans = 0;

	cout << ans << "\n";

	return 0;
}

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


int sum = 0;




void bfs(int u, vector<vector<int>> &g, vector<int> &points, vector<int> &ans, vector<bool> &visited) {
	if (visited[u]) return;
	visited[u] = true;
	sum += points[u];
	ans[u] = sum;
	for (int v : g[u]) {
		bfs(v, g, points, ans, visited);
	}

	sum -= points[u];
}

int main() {
	
	int n, q;
	cin >> n >> q;
	vector<vector<int>> g(n);
	for (int i = 0; i < n - 1; i++) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		g[x].push_back(y);
		g[y].push_back(x);
	}

	vector<int> points(n);
	for (int i = 0; i < q; i++) {
		int x, y;
		cin >> x >> y;
		x--;
		points[x] += y;
	}
	vector<int> ans(n);
	vector<bool> visited(n);
	bfs(0, g, points, ans, visited);
	
	for (int i = 0; i < n; i++) {
		cout << ans[i] << " ";
	}
	return 0;
}

Measured memory_bytes: 31520
#include<bits/stdc++.h>
#define N 6
#define NA 100
#define Q 24
using namespace std;

void change(char);
void turn(void);
int dice[NA][N];

int main(){
  
  char arrow[]="NWNWNW";
  // string str;
  int i,j,k,status=0,count=0,num,h;

  cin>>num;
  for(i=0;i<N;i++)cin>>dice[0][i];
  
  for(h=0;h<num-1;h++){
    for(i=0;i<N;i++)cin>>dice[1][i];

    for(j=0;j<N;j++){
      change(arrow[j]);
      for(k=0;k<4;k++){
	turn();
	count=0;
	for(i=0;i<N;i++)if(dice[0][i]==dice[1][i])count++;
      
	if(count==6){
	  status=1;
	  break;
	}
      }
    }
  }

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

void change(char c){
  if(c=='N'){
    swap(dice[1][0],dice[1][4]);
    swap(dice[1][0],dice[1][1]);
    swap(dice[1][1],dice[1][5]);
  }else if(c=='S'){
    swap(dice[1][0],dice[1][1]);
    swap(dice[1][0],dice[1][4]);
    swap(dice[1][5],dice[1][4]);
  }else if(c=='W'){
    swap(dice[1][2],dice[1][0]);
    swap(dice[1][2],dice[1][5]);
    swap(dice[1][5],dice[1][3]);
  }else if(c=='E'){
    swap(dice[1][0],dice[1][3]);
    swap(dice[1][3],dice[1][5]);
    swap(dice[1][5],dice[1][2]);
  }
}

void turn(void){
  swap(dice[1][1],dice[1][2]);
  swap(dice[1][2],dice[1][4]);
  swap(dice[1][4],dice[1][3]);
}



Measured memory_bytes: 3116
#include <iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    int a, b;
    string ans;
    a = n%100;
    b = a%10;
    if(b==2||b==4||b==4||b==5||b==7||b==9)
        ans = "hon";
    else if(b==0||b==1||b==6||b==8)
        ans = "pon";
    else
        ans = "bon";
    
    cout<<ans<<endl;

}


Measured memory_bytes: 3592
import bisect
import collections
import copy
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9+7

N,K = map(int,input().split())
P = list(map(int,input().split()))
C = list(map(int,input().split()))

sumlist1 = [[0]*N for _ in range(N)]
walist = [[0]*N for _ in range(N)]
loopcount = [0]*N

for h in range(N):
    sumlist1[h][0] = C[h]
    walist[h][0] = C[h]
    now = h
    l = 0
    for i in range(1,N):
        now = P[now]-1

        if sumlist1[h][i-1] < 0:
            sumlist1[h][i] = C[now]
        else:
            sumlist1[h][i] += sumlist1[h][i-1] + C[now]
        walist[h][i] += walist[h][i-1] + C[now]
        
        l += 1
        if now == h:
            break
    else:
        l += 1
    loopcount[h] = l
#print(sumlist1)

maxlist = [0]*N
for i in range(N):
    T = loopcount[i]
    wa = walist[i][T-1]
    #print(wa,T)

    loop = K//T
    amari = K%T

    if wa >= 0:
        if loop == 0:
            if amari != 0:
                maxlist[i] = wa*loop + max(sumlist1[i][:amari])
            else:
                maxlist[i] = max(sumlist1[i][:amari])
        else:
            if amari != 0:
                maxlist[i] = max(wa*loop + max(sumlist1[i][:amari]), wa*(loop-1) + max(sumlist1[i]))
            else:
                maxlist[i] = max(wa*loop, wa*(loop-1) + max(sumlist1[i][:T]))
            

    else:
        if loop == 0:
            maxlist[i] = max(sumlist1[i][:amari])
        else:
            maxlist[i] = max(sumlist1[i])

print(max(maxlist))
#print(sumlist1)

Measured memory_bytes: 467660
from collections import deque

if __name__ == "__main__":
    slopes = input()
    total_area = 0
    slope_queue = deque()
    area_queue = deque()

    for i, slope in enumerate(slopes):
        if slope == '\\':
            slope_queue.append(i)
        elif slope == '/' and len(slope_queue) != 0:
            target = slope_queue.pop()
            area = i - target
            total_area += area
            if len(area_queue) == 0:
                area_queue.append((target, area))
            else:
                temp_area = area
                while True:
                    target_area = area_queue.pop()
                    if target < target_area[0]:
                        temp_area += target_area[1]
                        if len(area_queue) == 0:
                            area_queue.append((target, temp_area))
                            break
                    else:
                        area_queue.append(target_area)
                        area_queue.append((target, temp_area))
                        break

    print(total_area)
    if len(area_queue) == 0:
        print(len(area_queue), end='\n')
    else:
        print(len(area_queue), end=' ')
    for i, area in enumerate(area_queue):
        if i < len(area_queue) - 1:
            print(area[1], end=' ')
        else:
            print(area[1], end='\n')


Measured memory_bytes: 6836
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <limits.h>
#include <utility>

#define YesNo(b) ((b) ? "Yes" : "No")
#define YESNO(b) ((b) ? "YES" : "NO")

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;



ll gcd(ll l, ll r)
{
	if (l < r) swap(l, r);
	while(true)
	{
		ll m = l % r;
		if (m == 0) return r;
		l = r;
		r = m;
	}
}

ll lcm(ll l, ll r)
{
	ll lrgcd = gcd(l, r);
	ll lf = l / lrgcd;
	ll rf = r / lrgcd;

	return lf * rf * lrgcd;
}

int diffabs(int l, int r)
{
	if (l < r)
		return r - l;
	else
		return l - r;
}

int f(const vi& A, int N, int M)
{
	vi B(A);
	for (int i = 0; i < N; i++)
		B[i] /= 2;

	ll alcm = 1;
	for (int i = 0; i < N; i++)
	{
		alcm = lcm(alcm, B[i]);
		if (alcm > M) return 0;
	}

	for (int i = 0; i < N; i++)
	{
		if ((alcm / B[i]) % 2 == 0) return 0;
	}

	return (M / alcm + 1) / 2;

}

int main()
{
	int N, M;
	cin >> N >> M;
	vi A(N);
	for (int i = 0; i < N; i++)
		cin >> A[i];

	int ans = f(A, N, M);
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
	string a;
	string b;
	while(cin>>a>>b){
		int sum=0;
		for(int i=0;i<a.size();i++){
			if(a[i]!=b[i]){
				sum++;
			}
		}
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 3872
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	char a,b,c,d,e,f;
	scanf("%c%c%c %c%c%c",&a,&b,&c,&d,&e,&f);
	if((a == f && b == e) && c == d){
		printf("YES\n");}
	else printf("NO\n");
}


Measured memory_bytes: 256
# nikkei2019-qualB - Touitsu
def main():
    n = int(input())
    S = [input().rstrip() for _ in range(3)]
    ans = 0
    for i in zip(S[0], S[1], S[2]):
        if len(set(i)) == 3:
            ans += 2
        elif len(set(i)) == 2:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include<stdio.h>

SelectionSort(int A[],int N)
{
  int i,j,temp;
  int mini,cont=0;
  
  for(i=0;i<(N-1);i++){
    mini=i;
    for(j=i;j<N;j++){
      if(A[j]<A[mini])mini=j;
      }
      temp=A[i];
      A[i]=A[mini];
      A[mini]=temp;
      if(i != mini)cont++;
  }
  return cont;
}

int main(){
  
  int A[100],N,i;
  int cont;
  
  scanf("%d",&N);
  for(i=0;i<N;i++) scanf("%d",&A[i]);
 
  cont = SelectionSort(A,N);
  
  for(i=0;i<N;i++){
    if(i>0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",cont);
  
  return 0;
}

Measured memory_bytes: 604
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=1505;
char s[N];int a[N][N],f[N][N],rpos[N][N],mn[2][N][N],mx[2][N][N],n,t;
ll res;
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d",&n);
	fp(i,1,n){
		scanf("%s",s+1);
		fp(j,1,n)a[i][j]=s[j]=='#'?0:s[j]-'0';
	}
	fd(i,n,1){
		fd(j,n,1)if(a[i][j]){
			f[i][j]=f[i+1][j]+f[i][j+1]+a[i][j];
			rpos[i][j]=max({rpos[i+1][j],rpos[i][j+1],i});
			mn[t][j][i]=j;
			fp(k,i+1,rpos[i+1][j])mn[t][j][k]=mn[t^1][j][k];
			fp(k,max(rpos[i+1][j],i)+1,rpos[i][j+1])mn[t][j][k]=mn[t][j+1][k];
			mx[t][j][i]=j;
			fp(k,i,rpos[i][j+1])mx[t][j][k]=mx[t][j+1][k];
			fp(k,max(rpos[i][j+1],i)+1,rpos[i+1][j])mx[t][j][k]=mx[t^1][j][k];
			int d=i+1,r=min(rpos[i+1][j],rpos[i][j+1]);
			while(d<=r){
				if(mx[t^1][j][d]>=mn[t][j+1][d]){
					f[i][j]-=f[d][mn[t][j+1][d]];
					d=rpos[d][mn[t][j+1][d]];
				}
				++d;
			}
			res+=1ll*a[i][j]*(f[i][j]-a[i][j]);
		}
		t^=1;
	}
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 62336
#include <stdio.h>
#include <string.h>
int main(void){
    int v;
    v=700;
    char s[3];
    scanf("%s",s);
    
    if(s[0]=='o'){
        v=v+100;
    }
    if(s[1]=='o'){
        v=v+100;
    }
    if(s[2]=='o'){
        v=v+100;
    }
    printf("%d\n",v);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>
#include <cctype>
#include <cmath>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */

const int INF = 1 << 30;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */

/* function */
void printAns(bool can);
int bin_search(int l, int r, int value, vector<int> &v);

/* main */
int main(){

    int n; cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    sort(v.begin(), v.end());
    //v.erase(unique(v.begin(), v.end()), v.end());

    int q; cin >> q;
    int value;
    bool finded;
    for (int i = 0; i < q; i++) {
        cin >> value;
        // finded = binary_search(v.begin(), v.end(), value);
        finded = bin_search(0, n, value, v);
        if (finded) cout << 1 << '\n';
        else cout << 0 << '\n';
    }
}

int bin_search(int l, int r, int value, vector<int> &v) {
    while (l < r) {
        int mid = (l + r) / 2;
        if (value == v[mid]) return 1;
        else if (value < v[mid]) r = mid;
        else l = mid + 1;
    }
    return 0;
}

void printAns(bool can) {
    if (can)
        cout << 1 << '\n';
    else 
        cout << 0 << '\n';
}



Measured memory_bytes: 3168
#include<bits/stdc++.h>
#include<string>
#include<algorithm>
#define mem(x) memset(x,0,sizeof(x)) 
#define sca(x) scanf("%lld",&x)
#define scaa(x,y) scanf("%lld%lld",&x,&y)
#define inf 0x7f7f7f7f
#define io ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#pragma GCC optimize(2)
using namespace std;
const double pi=acos(-1); 
const double eps=1e-6;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<char,char> pcc;
const ll mod=998244353;
int main()
{
	ll n;
	ll a[200005];
	ll v[200005];
	mem(v);
	sca(n);
	for(int i=0;i<n;i++)
	{
		sca(a[i]);
		v[a[i]]++;
	}
	ll ans=0;
	for(int i=1;i<=n;i++)
	{
		if(v[i])
		ans+=(v[i]*(v[i]-1))/2ll;
	}
	for(int i=0;i<n;i++)
	{
		ll tt=ans-v[a[i]]+1;
		printf("%lld\n",tt);
	}
} 

Measured memory_bytes: 5760
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int min = Integer.MAX_VALUE;
        for (int i = 0 ; i <= x ; i++) {
            min = Math.min(min, a * i + c * 2 * (x - i) + b * (Math.max(0, y - (x - i))));
        }
        for (int i = 0 ; i <= y ; i++) {
            min = Math.min(min, b * i + c * 2 * (y - i) + a * (Math.max(0, x - (y - i))));
        }
        System.out.println(min);
    }

}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int arr[n];
  for(int i=0; i<n; i++)
  {
    cin>>arr[i];
  }
  sort(arr, arr+n);
  int cnt=0;
for(int i = 0; i < n; ++i) {
        for(int j = i + 1; j < n; ++j) {
            for(int k = j + 1; k < n; ++k) {
                if(arr[i] + arr[j] > arr[k]
                   && arr[i] + arr[k] > arr[j]
                   && arr[k] + arr[j] > arr[i]
                   && (arr[i] != arr[j] && arr[j] != arr[k]))
                    cnt++;
            }
        }
    }
    cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3640
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
#define mkpr make_pair
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;


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


  int N, P; cin>>N>>P;
  string S; cin>>S;

  // 下 1 桁目の数字を S[0] に変更
  reverse(S.begin(), S.end());

  if (10%P == 0) { assert(P==2 || P==5);
    ll ans = 0;
    REP(l, N) {
      // 部分文字列の末尾の数字で判定
      if ((S[l] - '0') % P == 0) {
        ans += N-l; // l を固定して r を [l,N) の N-1 箇所から選ぶ
      }
    }
    cout << ans << endl;
    return 0;
  }

  // 各桁の数を P で割った余り md を求める
  // md[i] := (S[i] * 10^i) % P 
  vi md(N, 0);
  ll ten = 1;
  REP(i, N) {
    int d =  (S[i] - '0');
    md[i] = (d * ten) % P;
    ten *= 10;
    ten %= P; // 10 と P は互いに素
  }

  // md の mod P の塁積和を求める
  vl sum(N, 0);
  sum[0] = md[0];
  FOR(i, 1, N) {
    sum[i] = (sum[i-1] + md[i]) % P;
  }

  // mod P の塁積和の数字が同じ区間は、差が 0 なので P の倍数となる
  ll ans = 0;
  vl cnt(P, 0);
  REP(i, N) {
    ans += cnt[sum[i]]; // 現在の sum[i] を r とすると l の選び方は cnt[sum[i]] 通りある
    cnt[sum[i]] += 1;
  }
  ans += cnt[0]; // sum[i] == 0 のときは 1 文字で成り立つ

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 2964
#include<bits/stdc++.h>
#define LL long long
#define Max 100005
#define Mod 1e9+7
const LL mod=1e9+7;
const LL inf=0x3f3f3f3f;
using namespace std;
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	printf("%d\n",(n-1)*(m-1));
    return 0;
}


Measured memory_bytes: 256
import Foundation
 
let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ")
 
let A = Int(split[0])!
let B = Int(split[1])!

if (A+B<24){
    print(A+B)
}else{
    print(A+B-24)
}

Measured memory_bytes: 14184