akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
vector <long long int> v;
vector <double> vd;
 
vector <char> vc;
vector <string> vs;
map <string,int> sm;
map <int,int> mp;
map <char,int>cm;
set <int> st;
//#define sort(v) sort(v.begin(),v.end());
#define vecprint(v){for(int i=0; i<v.size(); i++)cout << v[i];}
//int string_to_int(string s){stringstream x(s);double a=0; x>>a; return a;}
//long long int gcd(long long int a, long long int b){if(a%b==0)return b;return gcd(b, a%b);}
//long long int lcm(long long int a, long long int b){return (a*b)/gcd(a, b);}
//int string_sum(string s){int b = 0;auto k =s.size();for(int j=0; j<k; j++){b +=(s[j]-48);}return b;}
//long long int factorial(long long int n){if (n == 0)return 1;return n * factorial(n - 1);}
 
//int cnt =0;
 
//void SieveOfEratosthenes(int n=1000000)
//{
//   // v.push_back(1);
//
//    bool prime[n+1];
//    memset(prime, true, sizeof(prime));
//
//    for (int p=2; p*p<=n; p++)
//    {
//
//        if (prime[p] == true)
//        {
//
//            for (int i=p*p; i<=n; i += p)
//                prime[i] = false;
//        }
//    }
//
//
//    for (int p=2; p<=n; p++)
//       if (prime[p])
//          v.push_back(p);
//}
 
 
//int mod(string num, int a)
//{
//    // Initialize result
//    int res = 0;
//
//    // One by one process all digits of 'num'
//    for (int i = 0; i < num.length(); i++)
//         res = (res*10 + (int)num[i] - '0') %a;
//
//    return res;
//}
 
//vector <int> arr(100,-1);
//
//int fib(int n)
//{
//    if(n<=1)return 1;
//
//    if(arr[n]==-1)
//    {
//        arr[n] = fib(n-1)+fib(n-2);
//    }
//    //else return arr[n];
//
//   return arr[n];
//}
 
 
//int arr[1050][1050];
//
//int mx=0;
//int LCS(string s, string p)
//{
//    for(int i=1; i<=s.size(); i++)
//    {
//        for(int j=1; j<=p.size(); j++)
//        {
//
//            if(s[i-1]==p[j-1])
//                arr[i][j]=1+arr[i-1][j-1];
//            else
//                arr[i][j]=max(arr[i-1][j],arr[i][j-1]);
//
//        }
//    }
//    return arr[s.size()][p.size()];
//}
//
//
//void primeFactors(long double n)
//{
//
//    while(fmod(n, 2)==0)
//    {
//        x++;
//        n /= 2;
//    }
//    h+=x;
//    x=0;
//
//    for(int i=3; i<=sqrt(n); i+=2)
//    {
//
//        while(fmod(n, i)==0)
//        {
//            x++;
//            n /= i;
//        }
//        h+=x;
//        x=0;
//
//    }
//
//    if(n>2){
//        h++;
//    }
//
//}

int main()
{
    map <int,int>mp;
    int a,b,c,n;
    string s,p;
    
    
    cin >> s;
    
    if(s == "SUN")
        cout << 7 << endl;
    
    else if(s == "MON")
    cout << 6 << endl;
    
    
    
       else if(s == "TUE")
       cout << 5 << endl;
       
       else if(s == "WED")
       cout << 4 << endl;
       
       else if(s == "THU")
       cout << 3 << endl;
       
       else if(s == "FRI")
       cout << 2 << endl;
       
       else if(s == "SAT")
       cout << 1 << endl;
       
    
    
    
    
  
    return 0;
}


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

//#include "stdafx.h"
#include <iostream>
#include<algorithm>

using namespace std;

int main()
{
	int dat[10000];
	int datcount=0;
	int in = 1;
	while (true) {
		cin >> in;
		if (in == 0) {
			break;
		}
		dat[datcount] = in;
		datcount++;
	}
	for (int i = 0; i < datcount; i++) {
		cout << "Case " << i + 1 << ": " << dat[i]<<endl;
	}
    return 0;
}




Measured memory_bytes: 3132
n, m = map(int, input().split())
a_b = []
a_b = [[int(x) for x in input().split()] for _ in range(m)]
a_b = sorted(a_b, key=lambda x: x[1])
ans = 0
last = 0
for i in a_b:
    if i[0] < last:
        continue
    else:
        last = i[1]
        ans += 1
print(ans)

Measured memory_bytes: 65240
#include<stdio.h>
int main(void){
int i,x,sum=0;
long int n;
scanf("%d",&i);
for(x=0;x<i;x++){
scanf("%ld",&n);
if(1==IsPrime(n)){sum+=1;}
}
printf("%d\n",sum);
return 0;
}


int IsPrime(long int n){
    int i;

    if(n < 2)
        return 0;
    else if(n == 2)
        return 1;

    if(n % 2 == 0)
        return 0;

    for(i = 3; i <= n / i; i += 2)
         if(n % i == 0)
            return 0;
    return 1;
}

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

using namespace std;

int main()
{
    int n,m,mn=1000000000;
    cin>>n>>m;
    int a[n+1];
    
    for(int k=1;k<=n;k++)
        cin>>a[k];
        
    
    int d[n+1];
    d[1]=0;
    d[0]=0;
    
    d[2]=abs(a[1]-a[2]);
    
    
    for(int k=3;k<=n;k++){
        mn=1000000000;
        if(m<=k-1){
           for(int i=k-m;i<k;i++)
               mn=min(mn,d[i]+abs(a[i]-a[k]));
        }
        else {
            for(int i=1;i<k;i++)
                mn=min(mn,d[i]+abs(a[i]-a[k]));
        }
        
        d[k]=mn;    
    }   
    
    cout<<d[n];

    return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
int n, k;
ll x[100000];
ll  le(int i){
    ll mini=min(abs(x[i]),abs(x[i+k-1]));
    ll maxi=max(abs(x[i]),abs(x[i+k-1]));
    if((ll)x[i]*x[i+k-1]<0){
        return((ll)maxi+2*mini);
    }
    else{
        return (maxi);
    }
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >>n>>k;
    for(int i=0;i<n;i++) cin>>x[i];
    sort(x,x+n);
    if(n==1){
        cout<<abs(x[0])<<"\n";
        return 0;
    }
    ll ans=300000000;
    for(int i=0;i<n-k+1;i++){
        ans=min(le(i),ans);
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 1024
n = int(input())

s = [0 for _ in range(n)]

for i in range(n):
    s[i] = input()


d ={}

for x in s:
    d[x] = d.setdefault(x,0) + 1


ans_ar = ["AC","WA","TLE","RE"]

for i in ans_ar:
    ans = i + " x " + str(d.setdefault(i,0))
    print(ans)

Measured memory_bytes: 16080
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
const int INF = (1LL << 31) - 1;
const int sqrtN = 512;
struct SqrtDecomposition {
  int N, K;
  vector<int> data;
  vector<bool> lazyFlag;
  vector<int> lazyUpdate;
  SqrtDecomposition(int n) : N(n) {
    K = (N + sqrtN - 1) / sqrtN;
    data.assign(K * sqrtN, INF);
    lazyFlag.assign(K, false);
    lazyUpdate.assign(K, 0);
  }
  void eval(int k) {
    if (lazyFlag[k]) {
      lazyFlag[k] = false;
      for (int i = k * sqrtN; i < (k + 1) * sqrtN; ++i) {
        data[i] = lazyUpdate[k];
      }
    }
  }
  // [s, t)
  void update(int s, int t, int x) {
       int p = max(0LL, s / sqrtN - 1);
        int q = min(K, t / sqrtN + 1);
    for (int k = p; k < q; ++k) {
      int l = k * sqrtN, r = (k + 1) * sqrtN;
      if (r <= s || t <= l)
        continue;
      if (s <= l && r <= t) {
        lazyFlag[k] = true;
        lazyUpdate[k] = x;
      } else {
        eval(k);
        for (int i = max(s, l); i < min(t, r); ++i) {
          data[i] = x;
        }
      }
    }
  }
  int find(int i) {
    int k = i / sqrtN;
    eval(k);
    return data[i];
  }
};
 
signed main() {
  ios::sync_with_stdio(false);
  int N, Q;
  cin >> N >> Q;
  SqrtDecomposition decomp(N);
  while (Q--) {
    int c;
    cin >> c;
    if (c == 0) {
      int s, t, x;
      cin >> s >> t >> x;
      decomp.update(s, t + 1, x);
    } else {
      int i;
      cin >> i;
      cout << decomp.find(i) << endl;
    }
  }
}

Measured memory_bytes: 3612
/**
*   @Author : MeGaCrazy
*   @InitTime : Fri Dec 28 13:50:20 2018
*   @Idea :
*
*
*
*
*
*  Happy Solving :)
**/
#include <bits/stdc++.h>
using namespace std;
int cnt[(int)1e5+7];
int main(){
#ifndef ONLINE_JUDGE
   //freopen("in","r",stdin);
   //freopen("out","w",stdout);
#endif
    int n;
    scanf("%d",&n);
    vector<int>v(n);
    set<int>s;
    for(int i=0;i<n;i++){
        scanf("%d",&v[i]);
        s.insert(v[i]);
    }
    if(s.size()==1){
     printf("%d",n/2);
     return 0;
    }  
   vector<pair<int,int> >arr1,arr2;
   s.clear();
   for(int i=0;i<n;i+=2){
   	cnt[v[i]]++;
   	s.insert(v[i]);
   } 
   for(auto c:s){
   	arr1.push_back(make_pair(cnt[c],c));
   }
   sort(arr1.rbegin(),arr1.rend());
   s.clear();
   memset(cnt,0,sizeof(cnt));
   for(int i=1;i<n;i+=2){
   	cnt[v[i]]++;
   	s.insert(v[i]);
   }
   for(auto c:s){
   	arr2.push_back(make_pair(cnt[c],c));
   }

   sort(arr2.rbegin(),arr2.rend());
   int first=arr1[0].second,second=arr2[0].second;


   if(arr1[0].second==arr2[0].second){
      if(arr1.size()==1&&arr2.size()==1){
          first=-1;
      }
      else if(arr1.size()==1){
           second=arr2[1].second;
      }
      else if(arr2.size()==1){
          first=arr1[1].second;
      }else{
        if(arr1[1].first > arr2[1].first){
            first=arr1[1].second;
        }else{
            second=arr2[1].second;
        }
      }
   }
   int ans=0;
   for(int i=0;i<n;i+=2){
   	if(v[i]!=first)ans++;
   }
   for(int i=1;i<n;i+=2){
   	if(v[i]!=second)ans++;
   }
   printf("%d",ans);
   




}

Measured memory_bytes: 6904
package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b, c int

	fmt.Scan(&a, &b, &c)
	array := []int{a, b, c}
	sort.Ints(array)
	fmt.Printf("%d %d %d\n", array[0], array[1], array[2])
}



Measured memory_bytes: 1132
$MOD=10**9+7

class Combi
  def initialize(max_n, mod = 10**9+7)
      @mod = mod
      @max_n = max_n

      @fac = Array.new(@max_n+1)
      @inv = Array.new(@max_n+1)
      @finv = Array.new(@max_n+1)

      @fac[0] = @fac[1] = 1
      @finv[0] = @finv[1] = 1
      @inv[1] = 1
      2.upto(@max_n) do |i|
          @fac[i] = @fac[i-1] * i % @mod
          @inv[i] = @mod - @inv[@mod%i] * (@mod/i) % @mod
          @finv[i] = @finv[i-1] * @inv[i] % @mod
      end
  end

  def nCk(n,k)
    return 0 if(n<0 || k<0 || k>n) 
    @fac[n] * @finv[n - k] * @finv[k] % @mod
  end
  def nPk(n,k)
    return 0 if(n<0 || k<0 || k>n)
    #@fac[n] * @finv[n - k] % @mod
    nCk(n,k) * @fac[k] % @mod
  end
end

$combi = Combi.new(1000000)

$n,$k=gets.chomp.split.map(&:to_i)
$edge = Array.new($n).map{Array.new()}

($n-1).times do
  a,b=gets.chomp.split.map(&:to_i)
  a -= 1
  b -= 1
  $edge[a] << b;
  $edge[b] << a;
end


$ans=1

stack = [0]
visited = [false] * $n

while(!stack.empty?)
  i = stack.pop
  visited[i] = true
  if i==0
    $ans = $combi.nPk($k,$edge[0].size+1)
  else
    $ans *= $combi.nPk($k-2,$edge[i].size-1)
  end
  $ans %= $MOD
  $edge[i].each do |v|
    next if visited[v] == true
    stack << v
  end  
end

puts $ans



Measured memory_bytes: 38524
function main(input) {
  const args = input.trim().split(' ')
  const total = parseInt(args[0], 10)
  const legs = parseInt(args[1], 10)
  const maxLegs = total * 4
  const legDiffToMax = maxLegs - legs
  const crane = legDiffToMax / 2
  const turtle = total - crane
  if (Number.isInteger(crane) && Number.isInteger(turtle) && crane >= 0 && turtle >= 0)
    console.log('Yes')
  else 
    console.log('No')
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29560
X = int(input())


def check_exist(X):
    for i in range(1, X + 1):
        start_point = i * 100
        end_point = i * 105
        for j in range(start_point, end_point + 1):
            if X == j:
                return True
                break


if check_exist(X):
    print(1)
else:
    print(0)

Measured memory_bytes: 2940
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 1000000000
#define MOD 1000000007
#define ll long long int
using namespace std;

int main(){
vector <int> a; a.resize(5);
for(int i=0;i<5;i++) cin>>a[i];
sort(a.begin(),a.end());
vector <int> b;b.resize(5);
for(int i=0;i<5;i++) b[i] = (1000 - a[i]) % 10;
sort(b.begin(),b.end());
int time = 0;

//int ma = 0;

for(int i=0;i<5;i++){
  time += a[i] + b[i];
  
}
cout<<time - b[4]<<endl;


  


  return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve(n,x):
    ans = 0
    for i in range(1,n+1):
        for j in range(1,i):
            s = i+j
            for k in range(1,j):
                ns = s+k
                if ns == x:
                    ans += 1
    print(ans)
    return

#Solve
if __name__ == "__main__":
    while 1:
        n,x = LI()
        if n == x == 0:
            break
        solve(n,x)



Measured memory_bytes: 6068
#pragma GCC optimize "03"
#include "bits/stdc++.h"
using namespace std;
 
#define ll long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
 
int a[N], b[N];

signed main() {
    IOS;
    #ifdef LOCAL
        freopen("input.txt","r", stdin);
        freopen("output.txt","w",stdout);
    #endif
    int n;  cin >> n;
    for(int i = 1; i <= n-1; i++)
        cin >> b[i];
    a[1] = b[1];
    int ans = a[1];
    for(int i = 2; i <= n; i++){
        a[i] = min(b[i-1], b[i]);
        ans += a[i];
    }   
    cout << ans+b[n-1];
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
class union_find{
private:
    vector<int>parent;
    vector<int>rank;
    int cnt;
public:
    union_find(int vertex_num)
    {
        parent.resize(vertex_num);
        rank.resize(vertex_num);
        for(int i = 0; i < vertex_num; ++i){
            parent[i] = i;
            rank[i] = 0;
        }
        cnt = vertex_num;
    }
    int get_root(int n)
    {
        if(parent[n] == n){
            return n;
        }else{
            return get_root(parent[n]);
        }
    }
    bool is_same(int a, int b)
    {
        return get_root(a) == get_root(b);
    }
    void unite(int a, int b)
    {
        int root_a=get_root(a),root_b=get_root(b);
        if(root_a == root_b)return;
        if(rank[root_a] < rank[root_b]){
            parent[root_a] = root_b;
            --cnt;
        }else if(rank[root_a] > rank[root_b]){
            parent[root_b] = root_a;
            --cnt;
        }else{
            parent[root_a] = root_b;
            ++rank[root_b];
            --cnt;
        }
    }
    bool is_all_connected()
    {
        return cnt == 1;
    }
};
int main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>>ab(m);
    for(int i = 0; i < m; ++i){
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        ab[i] = make_pair(a, b);
    }

    int ans = 0;
    for(int i = 0; i < m; ++i){
        union_find uf(n);
        for(int j = 0; j < m; ++j){
            if(i == j)continue;
            uf.unite(ab[j].first, ab[j].second);
        }
        if(!uf.is_all_connected()){
            ++ans;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <vector>

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x

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

signed main() {
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;

    if (u == s) {
        --a;
    } else if (u == t) {
        --b;
    }

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

    return 0;
}

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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  int mx = A+B+C*10;
  mx = max(mx, A*10+B+C);
  mx = max(mx, C+A+B*10);
  cout << mx << endl;
    
  
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Text;

namespace Fish.aizu
{
	public static class AizuOnlineJudge
	{
		public static int[] SplitToInts(string line)
		{
			return line.Split(' ').Select(x => int.Parse(x)).ToArray();
		}
		public static double[] SplitToDoubles(string line)
		{
			return line.Split(' ').Select(x => double.Parse(x)).ToArray();
		}
		public static long[] SplitToLongs(string line)
		{
			return line.Split(' ').Select(x => long.Parse(x)).ToArray();
		}
		public static int Main()
		{
			Compute(Console.In, Console.Out);
			return 0;
		}
		
		public static void Compute(TextReader reader, TextWriter writer)
		{
			var values = SplitToInts(reader.ReadLine());
			
			var N = values[0];
			var M = values[1];
			
			var A = new int[N,M];
			var b = new int[M];
			
			for (var n = 0; n < N; n++)
			{
				var v = SplitToInts(reader.ReadLine());
				for (var m = 0; m < M; m++)
				{
					A[n,m] = v[m];
				}
			}
			for (var m = 0; m < M; m++)
			{
				b[m] = int.Parse(reader.ReadLine());
			}
			
			
			for (var n = 0; n < N; n++)
			{
				int r = 0;
				for (var m = 0; m < M; m++)
				{
					r += A[n,m] * b[m];
				}
				writer.WriteLine(r);
			}
		}
	}
}

Measured memory_bytes: 20276
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(container) container.begin(), container.end()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
using namespace std;
using ll = long long;

int main(void){
    Cin(string, a);
    auto b = a;
    reverse(Range(b));
    Cout(a == b ? "Yes" : "No");
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;
int MOD = 10000;
int dp[501][10][500][2][2];
string str;
int n;
int M;
int rec(int pos, int pre, int q, bool up, bool smaller) {
  if (pos == n) return q==0;
  if (dp[pos][pre][q][up][smaller] >= 0) return dp[pos][pre][q][up][smaller];
  int res = 0;
  int s = str[pos]-'0';
  int lb, ub;
  if (up) lb = 0, ub = pre-1;
  else lb = pre+1, ub = 9;
  if (!smaller) ub = min(ub, s);
  //cout << pos << " " << pre << " " <<lb << " " << ub << endl;
  for (int i=lb; i<=ub; ++i) {
    res = (res + rec(pos+1, i, (q*10+i)%M, !up, i<s?1:smaller)) % MOD;
  }
  return dp[pos][pre][q][up][smaller] = res;
}

int solve(string s) {
  n = s.size();
  str = s;
  memset(dp, -1, sizeof(dp));
  int res = 0;
  for (int i=1; i<=s[0]-'0'; ++i) {
    if (n>=2) res = (res + rec(1,i,i%M,0,s[0]-'0'!=i)) % MOD;
    res = (res + rec(1,i,i%M,1,s[0]-'0'!=i)) % MOD;
  }
  for (int i=1; i<n; ++i) {
    for (int j=1; j<=9; ++j) {
      if (i!=n-1) res = (res + rec(i+1,j,j%M,0,1)) % MOD;
       // // cout << i << " "<< j << endl;
       // // cout << res << endl;
      res = (res + rec(i+1,j,j%M,1,1)) % MOD;
    }
  }
  return res;
}

string minus1(string s) {
  int c = 1;
  for (int i=s.size()-1; i>=0; --i) {
    if (s[i] == '0') s[i] = '9';
    else {
      s[i]--;
      break;
    }
  }
  return s;
}
int main() {
  string A, B;
  cin >> A >> B;
  cin >> M;
  //M = 5;
  //cout << solve("0") << endl;
  cout << (solve(B)-solve(minus1(A)) + MOD) % MOD << endl;
}

Measured memory_bytes: 39000
A, B, C, X, Y = list(map(lambda x: int(x), input().split(' ')))

ans = pow(10, 5) * max(A, B, C) * 3
ab_max = (max(X, Y)+1) * 2
for ab in range(0, ab_max + 1, 2):
    x = max(0, X - ab//2)
    y = max(0, Y - ab//2)
    price = x * A + y * B + ab * C
    # print((x, y, ab), price)
    ans = min(ans, price)

print(ans)


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

int main()
{
	int A, B, C, D;

	cin >> A >> B >> C >> D;

	while (true)
	{
		C -= B;
		if (C <= 0)
		{
			cout << "Yes";
			break;
		}

		A -= D;
		if (A <= 0)
		{
			cout << "No";
			break;
		}
	}
	cout << endl;

	return 0;
}



Measured memory_bytes: 3564
n=int(input())
a = [0]*(n+1)
a[0] = [0, 0, 0]
for i in range(n):
    a[i+1]=list(map(int,input().split()))

flag = True
for i in range(n):
    if abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2]) > (a[i+1][0]-a[i][0]):
        flag=False
    elif (abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2])-(a[i+1][0]-a[i][0]))%2==1:
        flag=False

if flag:
    print("Yes")
else:
    print("No")


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

int main() {
  int n;
  cin >> n;
  int n_tmp = n;
  int sum;
  for (int i=0; i<to_string(n).length(); i++) {
    sum += n_tmp % 10;
    n_tmp /= 10;
  }
  
  if (n % sum == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll p=1000000007ll;
const int N=55;
ll dp[N][N][N*N],tmp;
inline void upd(ll &a,int b){a=(a+b*tmp)%p;}
int main(){
	int n,m,i,j,k;
	scanf("%d%d",&n,&m);
	if(m&1){printf("0");return 0;}
	dp[0][0][0]=1ll;
	for(i=1;i<=n;++i)for(j=0;j<i;++j)for(k=0;k<=i*i;++k)if(tmp=dp[i-1][j][k]){
		upd(dp[i][j  ][k       ],1);
		upd(dp[i][j+1][k+ i    ],((i-j)<<1)-1);
		upd(dp[i][j+2][k+(i<<1)], (i-j-1)*(i-j-1));
	}
	printf("%lld",dp[n][n][(n*(n+1)+m)>>1]);
	return 0;
}

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

namespace ConsoleAppTest
{
    class Program
    {
        static void Main(string[] args)
        {
            int A, B, X;
            string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
            A = int.Parse(str[0]);  //数値で受け取りたい場合は変換する
            B = int.Parse(str[1]);
            X = A * B;
            Console.WriteLine($"{X}");
        }
    }
}


Measured memory_bytes: 27524
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
char s[110];

int main(){
    cin>>s;
    int len=strlen(s);
    int cnt=0;
    int i=0,j=len-1;
    while(i<len){
        if(s[i]!=s[j]) cnt++;
        i++,j--;
    }
    printf("%d\n",cnt/2);
    return 0;

}

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

int a[100010];

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i ++) cin >> a[i];
	sort(a, a + n);
	int first = a[n-1], dif = 1e9, second = -1;
	for (int i = 0; i < n-1; i ++) {
		if (second == -1 || abs((first+1)/2 - a[i]) < dif) {
			second = a[i];
			dif = abs(first/2 - a[i]);
		}
	}
	cout << first << ' ' << second << endl;
	return 0;
}

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

int main() {
  string w;
  cin >> w;
  int n = w.size();
  char a = 'a';
  for(int i=0; i<26; i++) {
    int count = 0;
    for(int j=0; j<n; j++) {
      if(w.at(j) == a) {
        count++;
      }
    }
    if(count % 2 != 0) {
      cout << "No" << endl;
      return 0;
    }
    a++;
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

char line[100005];

int main(void){
	
	int n; scanf("%d %s", &n, line);
	int alpha[26] = {0, };
	for(int i=0; i<n; i++) alpha[line[i]-'a']++;
	
	long long int s = 1, r = 1000 * 1000 * 1000 + 7;
	for(int i=0; i<26; i++) s = s * (alpha[i]+1) % r;
	s--; if(s<0) s += r;
	
	printf("%lld", s);
	
	return 0;
}

Measured memory_bytes: 256
/*
    Author: Mohammad faisal
    Problem: Maximum Difference.
    Date: 07/08/2019

*/
// #include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;
// long long gcd(long long a,long long b)
// {
//   if(b)
//     return gcd(b,a%b);
//   else
//     return a;
// }
// Author: Mohammad Faisal
// #include<bits/stdc++.h>
// using namespace std;
// long long gcd(long long a,long long b)
// {
//   if(b)
//     return gcd(b,a%b);
//   else
//     return a;
// }
// int main()
// {
//   long long n;
//     cin >> n;
//     long long g = gcd(n,2);
//     cout<<(n*2)/g<<endl;
//     return 0;
// }
int main()
{
  int n;
  cin >> n;
  int* arr = new int[n];
  for(int i=0;i<n;i++)
    cin >> arr[i];
  int mn = *min_element(arr,arr+n);
  int mx = *max_element(arr,arr+n);

  cout<<max(mn,mx)-min(mn,mx)<<endl;
  return 0;

}
// int main()
// {
//   int n;
//   cin >> n;
//   int * arr = new int[n];
//   int sum=0;
//   for(int i=0;i<n;i++)
//   {
//     cin >> arr[i];
//     sum+=arr[i];
//   }
//   int max = *max_element(arr,arr+n);
//   int res = (2*sum)/n;
//   if(res < max)
//   {
//     cout<<max<<endl;
//   }
//   else
//   {
//   cout<<((2*sum)/n)+1<<endl;
//   }
//   return 0;

// }

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


def main():
    N = int(input())

    ans = 0
    for n in range(1, N+1, 2):
        cnt = 0
        for i in range(1, n+1, 2):
            if n%i==0:
                cnt += 1
        if cnt==8:
            ans += 1
    
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long int;

int main(){ 
  ll a, b, c, k;
  cin >>a >> b >> c >> k;

  if (k <= a){
    cout << k << endl;
  } else if (k <= a + b) {
    cout << a << endl;
  } else if (k <= a + b + c) {
    cout << (a - (k - a - b)) << endl;
  } else {
    cout << (a - c) << endl;
  }
  
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <algorithm>
long long p = 998244353;
long long n, m, l, k, e;
long long a, b, c, d;
long long x[200000], y[200000];
long long zx[200000], zy[200000];
long long nx[200000], ny[200000], nz[200000];
long long tx[400];
long long rui[200001];
long long ans;
int main() {
	scanf("%lld", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lld%lld", x + i, y + i);
		x[i] += 1000000001;
		y[i] += 1000000001;
		zx[i] = x[i] * 1000000 + i;
		zy[i] = y[i] * 1000000 + i;
	}
	std::sort(zx, zx + n);
	std::sort(zy, zy + n);
	for (int i = 0; i < n; i++) {
		nx[zx[i] % 1000000] = i;
		ny[zy[i] % 1000000] = i;
	}
	m = (n - 1) / 500 + 1;
	for (int i = 0; i < n; i++) {
		l = nx[zy[i] % 1000000];
		k = l/500;
		tx[k]++;
		for (int j = 0; j < k; j++) {
			nz[zy[i] % 1000000] += tx[j];
		}
		for (int j = 500 * k; j < l; j++) {
			if (ny[zx[j] % 1000000] < i)nz[zy[i] % 1000000]++;
		}
	}
	rui[0] = 1;
	for (int i = 1; i <= 200000; i++) {
		rui[i] = rui[i - 1] * 2 % p;
	}
	for (int i = 0; i < n; i++) {
		a = nz[i];
		b = ny[i] - nz[i];
		d = nx[i] - nz[i];
		c = n - 1 - a - b - d;
		ans += rui[n];
		ans--;
		ans -= rui[a + b];
		ans -= rui[b + c];
		ans -= rui[c + d];
		ans -= rui[d + a];
		ans += rui[a];
		ans += rui[b];
		ans += rui[c];
		ans += rui[d];
		ans += 5 * p;
		ans %= p;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 12672
//15
#include<iostream>
#include<set>

using namespace std;

int main(){
  for(int n;cin>>n,n;){
    set<int> sq;
    for(int i=1;i<n;i++){
      sq.insert(i*i%n);
    }
    int ans[10000]={};
    for(set<int>::iterator iti=sq.begin();iti!=sq.end();iti++){
      for(set<int>::iterator itj=sq.begin();itj!=sq.end();itj++){
	if(iti!=itj){
	  int c=*iti-*itj;
	  if(c<0){
	    c+=n;
	  }
	  if(c>(n-1)/2){
	    c=n-c;
	  }
	  ans[c]++;
	}
      }
    }
    for(int i=1;i<=(n-1)/2;i++){
      cout<<ans[i]<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1472
#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 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, cap, rev;
    Edge(ll _to, ll _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, ll from, ll to, ll cap, bool revFlag, ll 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, m;
    cin >> n >> m;

    vec<ll> a(n);
    REP(i, n) {
        cin >> a[i];
        a[i]--;
    }

    vec<ll> l(m, 0), r(m, 0), cost(m, 0);
    REP(i, n - 1) {
        l[a[i]]++;
        r[a[i + 1]]++;
        cost[a[i + 1]] += (m + a[i + 1] - a[i]) % m - 1;
    }

    ll sum = 0;
    ll x = 0;
    ll con = 0;
    REP(i, n - 1) {
        sum += min((m + a[i + 1] - a[i]) % m, (m + a[i + 1] - x) % m + 1);
        if(a[i] < a[i + 1] and a[i] < x and x <= a[i + 1]) {
            con++;
        } else if(a[i] > a[i + 1] and (x <= a[i + 1] or a[i] < x)) {
            con++;
        }
    }

    ll ans = sum;
    while(x < m) {
        sum += cost[x];
        con -= r[x];
        sum -= con;
        con += l[x];
        chmin(ans, sum);
        x++;
    }
    cout << ans << en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*
    ll t;
    cin >> t;
    while(t--)*/
    solve();

    return 0;
}


Measured memory_bytes: 6280
import java.security.KeyStore.TrustedCertificateEntry
import java.util
import java.util.regex.Pattern
import java.util.{ArrayList, Collections, Comparator, List => JList}

import scala.collection.immutable.TreeMap
import scala.math._
import scala.collection.mutable
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.util.{Failure, Success, Try}

object Main{
  val LINE_SEPARATOR = "\n"
  def main(args: Array[String]): Unit = {
    if (sys.env.getOrElse("TEST", "")=="1"){
      println(test());
    }else{
      val input=io.Source.stdin.getLines().mkString(LINE_SEPARATOR);
      println(solve(input).trim());
    }
  }

  def init (nRows: Int, nCols: Int, default: Int) = Array.tabulate(nRows,nCols)( (x,y) =>  default)

  def sortIgnoreCase1(list: JList[String]): JList[String] = {
    val r = new ArrayList[String](list)
    Collections.sort(r, new Comparator[String] {
      override def compare(o1: String, o2: String): Int = o1.compareToIgnoreCase(o2)
    })
    r
  }

  def solve(input: String): String = {
    val r = input.toInt
    (2 * r * Pi).toString
  }


  def factorize(x: Long): List[Long] = {
    def foo(x: Long, a: Long = 2, list: List[Long] = Nil): List[Long] = a*a > x match {
      case false if x % a == 0 => foo(x / a, a    , a :: list)
      case false               => foo(x    , a + 1, list)
      case true                => x :: list
    }
    foo(x)
  }

  def divisors(n: Long): Vector[Long] = {
    val halfList = (1 to sqrt(n).toInt).toVector.filter(_ % n == 0).map(_.toLong)
    val reversedList = if (sqrt(n).floor == sqrt(n)) halfList.reverse.tail.map(n/_) else halfList.reverse.map(n/_)
    halfList ++ reversedList
  }

  def gcd(m: Long, n: Long): Long = n match {
    case 0 => m
    case _ => gcd(n, m % n)
  }
  def lcm(a: Long, b: Long): Long = a * b / gcd(a, b)

  val tests=List(
    """33""".stripMargin -> """2 -1
                              |
                                   |
                                 |
                                   |""".stripMargin,
    """1""".stripMargin -> """0 -1""".stripMargin
  )

  def test():String= {
    return tests.map{case (i,o)=>(i.trim(),o.trim())}
      .zipWithIndex.map{
      case ((input,outputExpect),i)=>{
        val output=solve(input).trim();
        s"test${i+1}:"+(if(output==outputExpect){
          "Passed"
        }else{
          s"Failed\nexpect:\n${outputExpect}\noutput:\n${output}"
        })
      }}
      .mkString("\n");
  }
}

Measured memory_bytes: 55376
from collections import deque
n, m = map(int, input().split())
c = [[] for _ in range(n)]  # 隣接してる部屋リスト
ans = [-1]*n
ans[0] = 0
for _ in range(m):
    a,b = map(int, input().split())
    c[a-1].append(b-1)
    c[b-1].append(a-1)

d = deque([0])  # 0だけ入れたdequeを作成

while d:
    cur = d.pop()
    for x in c[cur]:
        if ans[x]<0:
            ans[x] = cur
            d.appendleft(x)  # curに隣接してる部屋xを次に見ていく
            
print('Yes')
for ans in ans[1:]:
    print(ans+1)

Measured memory_bytes: 34996
#include <iostream>

using namespace std;


int main() {
    int64_t a, b;
    int i;
    cin >> a >> b;

    int64_t h = 0, h1;
    for (i=1;i<999;i++) {
        h += i;
        h1 = h + (i+1);
        if (h > a && h1 > b && (h-a) == (h1-b)) break;
    }
    
    cout << (h - a)  << endl;

    return 0;
}

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

const int mx = 2e5+5, maxn = 3005, M = 1e9+7;
void madd(int& a, int b) {
    a += b;
    if (a >= M) a -= M;
}
void msub(int& a, int b) {
    madd(a,M-b);
}
int mult(int a, int b) {
    return (1LL*a*b) % M;
}
int modexp(int a, int b) {
    int res = 1;
    while (b) {
        if (b&1) res = mult(res,a);
        a = mult(a,a);
        b >>= 1;
    }
    return res;
}
int inverse(int x) {
    return modexp(x,M-2);
}
int fac[mx], ifac[mx];
int ch(int n, int r) {
    assert(r <= n);
    return mult(fac[n],mult(ifac[r],ifac[n-r]));
}
int ways(int x1, int y1, int x2, int y2) {
    int m = y2-y1;
    int n = x2-x1;
    return ch(m+n,n);
}
int H, W, n;

pair<int,int> pt[maxn];
int dp[maxn];

int main() 
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    fac[0] = ifac[0] = 1;
    for (int i = 1; i < mx; i++) {
        fac[i] = mult(fac[i-1],i);
        ifac[i] = inverse(fac[i]);
    }
    cin >> H >> W >> n;
    for (int i = 0; i < n; i++) {
        int r, c; cin >> r >> c;
        pt[i] = {r,c};
    }
    n++;
    pt[n-1] = {H,W};
    sort(pt,pt+n);
    for (int i = 0; i < n; i++) {
        dp[i] = ways(1,1,pt[i].first,pt[i].second);
    }
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            if (pt[j].first < pt[i].first || 
                pt[j].second < pt[i].second) {
                continue;
            }
            msub(dp[j],mult(dp[i],ways(pt[i].first,pt[i].second,pt[j].first,pt[j].second)));
        }
    }
    cout << dp[n-1] << '\n';
}


Measured memory_bytes: 1920
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000


A,B = map(int,input().split())
if A==B:
    ans = "Draw"
else:
    if A == 1:
        ans = "Alice"
    elif B == 1:
        ans = "Bob"
    elif A>B:
        ans = "Alice"
    else:
        ans = "Bob"
print(ans)


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

int main() {
    int N, temp,
    count = 1;
    cin >> N;
    vector<int> button(N);

    for (int i = 0; i < N; i++) {
        cin >> button.at(i);
    }

    temp = button.at(0);

    if (button.at(0) == 2) {
        cout << 1 << endl;
    }
    else {
        for (int i = 0; i < N - 1; i++) {
            temp = button.at(temp - 1);
            count++;
            if (temp == 2) {
                break;
            }
        }

        if (temp == 2) {
            cout << count << endl;
        }
        else {
            cout << -1 << endl;
        }
    }
}


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

int main() {
    int N, M;
    cin >> N >> M;
    // cout << endl;
    // cout << "DEBUG: " << N << " " << M << endl;
    vector<bool> nb(N);
    vector<int>  nt(N);
    for (int i = 0; i < M; i++) {
        int si, ci;
        cin >> si >> ci;
    // cout << "DEBUG: " << si << " " << ci << endl;
        if (N > 1 && si == 1 && ci == 0) {
            cout << -1 << endl;
            return 0;
        }
        if (nb.at(N - si) && nt.at(N - si) != ci) {
            cout << -1 << endl;
            return 0;
        }
        nb.at(N - si) = true;
        nt.at(N - si) = ci;
    }

    for (int i = N - 1; i > -1; i--) {
        if (N > 1 && i == N - 1 && !nb.at(i)) {
            cout << 1;
            continue;
        }
        if (nb.at(i)) cout << nt.at(i);
        else cout << 0;
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

/*
    SegmentTree<int> seg(f, def) のように宣言する
    RMQ の場合 : 
    auto f = [](int a, int b){return min(a, b);};
    int def = INF;
*/
template <typename Monoid>
struct SegmentTree{
    using F = function<Monoid(Monoid, Monoid)>;
    int n;
    vector<Monoid> dat;
    F f;
    Monoid def;

    SegmentTree(F f, Monoid def) : f(f), def(def) {}

    void build(const vector<Monoid> & vec){
        int sz = vec.size();
        n = 1;
        while(n < sz) n *= 2;
        dat.assign(2 * n - 1, def);
        for(int i = 0; i < sz; i++) dat[n - 1 + i] = vec[i];
        for(int i = n - 2; i >= 0; i--) dat[i] = f(dat[2 * i + 1], dat[2 * i + 2]);
    }

    void update(int k, Monoid x){
        k += (n - 1);
        dat[k] = x;
        while(k > 0){
            k = (k - 1) / 2;
            dat[k] = f(dat[2 * k + 1], dat[2 * k + 2]);
        }
    }

    Monoid query(int a, int b){
        return query(a, b, 0, 0, n);
    }

private:
    Monoid query(int a, int b, int k, int l, int r){
        if(r <= a || b <= l) return def;
        if(a <= l && r <= b) return dat[k];
        Monoid vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
        Monoid vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return f(vl, vr);
    }
};

signed main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> v(n);
    rep(i,n){
        v[i] = s[i] - 'a';
    }
    int q;
    cin >> q;
    auto f = [](bool a, bool b){return (a || b);};
    vector<SegmentTree<bool>> seg(26, SegmentTree<bool>(f, false));
    rep(i,26){
        seg[i].build(vector<bool>(n, false));
    }
    rep(i,n){
        seg[v[i]].update(i, true);
    }
    rep(i,q){
        int Q;
        cin >> Q;
        if(Q == 1){
            int m;
            char c;
            cin >> m >> c;
            m--;
            int t = c - 'a';
            seg[v[m]].update(m, false);
            seg[t].update(m, true);
            v[m] = t;
        }else{
            int l,r;
            cin >> l >> r;
            l--;
            r--;
            int ans = 0;
            rep(i,26){
                if(seg[i].query(l, r + 1)) ans++;
            }
            cout << ans << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 6148
#include <stdio.h>
int main(void){
  int t,x,y;
  int pret=0,prex=0,prey=0;
  int N;
  int i;
  scanf("%d",&N);
  for(i = 0;i < N;i++){
    scanf("%d %d %d",&t,&x,&y);
    if((t-pret >= x+y-prex-prey) && (t-pret)%2 == (x+y-prex-prey)%2){
      continue;
    }else{
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}

Measured memory_bytes: 128
a=[input().split() for i in range(3)]
N=int(input())
B=list(map(int,[input() for i in range(1,N+1)]))

A1=list(map(int,a[0]))
A2=list(map(int,a[1]))
A3=list(map(int,a[2]))

if (A1[0] in B)==True and (A1[1] in B)==True and (A1[2] in B)==True:
    print("Yes")
elif (A2[0] in B)==True and (A2[1] in B)==True and (A2[2] in B)==True:
    print("Yes")
elif (A3[0] in B)==True and (A3[1] in B)==True and (A3[2] in B)==True:
    print("Yes")
elif (A1[0] in B)==True and (A2[0] in B)==True and (A3[0] in B)==True:
    print("Yes")
elif (A1[1] in B)==True and (A2[1] in B)==True and (A3[1] in B)==True:
    print("Yes")
elif (A1[2] in B)==True and (A2[2] in B)==True and (A3[2] in B)==True:
    print("Yes")
elif (A1[0] in B)==True and (A2[1] in B)==True and (A3[2] in B)==True:
    print("Yes")
elif (A1[2] in B)==True and (A2[1] in B)==True and (A3[0] in B)==True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  long long n; cin >> n;
  vector<int> a(n), b(n), c(n);
  REP(i, n) cin >> a[i];
  REP(i, n) cin >> b[i];
  REP(i, n) cin >> c[i];
  sort(ALL(a));
  sort(ALL(b));
  sort(ALL(c));
  vector<long long> big_b(n);
  int idx = 0;
  REP(i, n) {
    for (; idx < n; ++idx) if (b[i] < c[idx]) break;
    big_b[i] = n - idx;
  }
  for (int i = n - 2; i >= 0; --i) big_b[i] += big_b[i + 1];
  idx = 0;
  long long ans = 0;
  REP(i, n) {
    for (; idx < n; ++idx) if (a[i] < b[idx]) break;
    ans += (idx == n ? 0 : big_b[idx]);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 2176
#include <stdio.h>

int main(){
    
    int x=0;
    int i;
    int num;
    
    scanf("%d",&x);
    
    for(i=1;i<=x;i++){
        if(i%3==0){
            printf(" %d",i);
        }else{
            num = i;
            while(num != 0){
                if(num%10==3){
                    printf(" %d",i);
                    break;
                }
                num=num/10;
            }
        }
    }
    printf("\n");
    
    return 0;
}


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

using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	int a, b;
	vector<vector<int>> port(n);
	n--;
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		a--;
		b--;
		port[a].push_back(b);
	}

	for (auto i : port[0]) {
		for (auto j : port[i]) {
			if (j == n) {
				cout << "POSSIBLE" << endl;

				return 0;
			}
		}
	}
	cout << "IMPOSSIBLE" << endl;

	return 0;
}

Measured memory_bytes: 8576
def main():
    n = int(input())
    a = list(map(int,input().split()))

    ans = 0
    for i in a:
        if i % 2==0:
            while True:
                ans+=1
                i = i//2
                if i%2==0:
                    continue
                else:
                    break

    print(ans)


if __name__ == "__main__":
        main()


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n;
    while (cin >> n, n)
    {
        vector<ll> a(n);
        rep(i, n) cin >> a[i];
        sort(ALL(a));
        vector<ll> s(n + 1);
        s[0] = 0;
        rep(i, n) s[i + 1] = s[i] + a[i];
        ll ans = 0;
        rep(i, n) ans += s[i];
        OP(ans);
    }
    return 0;
}


Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;

int main(){
    int a,b,c,d;cin>>a>>b>>c>>d;
    if(a<=c){
        if(c<=b){
            if(b<=d) cout<<b-c<<endl;
            else cout<<d-c<<endl;
        }
        else cout<<0<<endl;
    }
    else{
        if(a<=d){
            if(d<=b) cout<<d-a<<endl;
            else cout<<b-a<<endl;
        }
        else cout<<0<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;

int plusi(int a, int b)
{
    long long cur = 0LL+a+b;
    cur%=MOD;
    if(cur<0)
        cur+=MOD;
    return (int) cur;
}

int multi(int a,int b)
{
    long long cur = 1LL*a*b;
    cur%=MOD;
    if(cur<0)
        cur+=MOD;
    return (int) cur;
}

int power(int base, int pow)
{
    if(pow==0)
        return 1;
    if(pow==1)
        return base;

    int cur = power(base,pow/2);
    cur = multi(cur,cur);
    if(pow%2==1)
        cur = multi(cur,base);
    return cur;
}

int inverse(int base)
{
    return power(base,MOD-2);
}

int main()
{
    int N,i,a=0;
    cin>>N;
    while(N--)
    {
        cin>>a;
        int val[16],med[16];
        /**Here goes nothing**/
        for(i=0;i<16;i++)
            val[i] = power(a,i);

        med[0] = multi(multi(-1,33746491),plusi(-1,power(-1,a)));
        med[1] = multi(multi(-1,2409750),plusi(48887,multi(33033,power(-1,a))));
        med[2] = multi(multi(-1, 1485),plusi(123573553,multi(22215375,power(-1,a))));
        med[3] = multi(multi(-1,486),plusi(multi(-1,27084097),multi(9634625,power(-1,a))));
        med[4] = multi(multi(-1,75075),plusi(multi(-1,1091603),multi(2835,power(-1,a))));
        med[5] = 61186072;
        med[6] = 815140362;
        med[7] = 238065852;
        med[8] = 437495207;
        med[9] = 54503020;
        med[10] = 31381350;
        med[11] = 5099276;
        med[12] = 450450;
        med[13] = 23240;
        med[14] = 660;
        med[15] = 8;
        /**End of trauma**/
        int ans = 0;
        for(i=0;i<16;i++)
            ans = plusi(ans,multi(val[i],med[i]));
        cout<<multi(ans,inverse(635864652))<<"\n";
    }
}


Measured memory_bytes: 3576