akhauriyash/Code-Regression huggingface dataset:
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

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

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	m := getNextInt(scanner)

	ss := make([]int, n)
	tt := make([]int, m)

	dp := make([][]int, n+1)

	for i := 0; i < n; i++ {
		dp[i] = make([]int, m+1)
		ss[i] = getNextInt(scanner)
	}
	dp[n] = make([]int, m+1)
	for i := 0; i < m; i++ {
		tt[i] = getNextInt(scanner)
	}
	dp[0][0] = 1
	for i := 0; i <= n; i++ {
		for ii := 0; ii <= m; ii++ {
			if i == 0 || ii == 0 {
				dp[i][ii] = 1
				continue
			}
			dp[i][ii] += dp[i][ii-1]
			dp[i][ii] += dp[i-1][ii]
			if ss[i-1] != tt[ii-1] {
				dp[i][ii] -= dp[i-1][ii-1]
				
			}
          dp[i][ii] = mint(dp[i][ii])

		}
	}
	fmt.Fprintln(writer, dp[n][m])

	writer.Flush()
}
func mint(a int) int {
	return ((a % 1000000007) + 1000000007) % 1000000007
}


Measured memory_bytes: 34168
use whiteread::parse_line;

fn main() {
    let (x, y): (i32, i32) = parse_line().unwrap();
    let v1: Vec<i32> = vec![4,6,9,11];
    let v2: Vec<i32> = vec![1,3,5,7,8,10,12];
    if x == 2 || y == 2 {
        println!("No");
    } else if v1.contains(&x) && v1.contains(&y) {
        println!("Yes");
    } else if v2.contains(&x) && v2.contains(&y) {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2088
N = list(map(int, input().split()))[0]
H = list(map(int, input().split()))

water_times=0
while max(H)>0:
  left_water=0
  for h in H:
    if h>0 and left_water==0:
      water_times+=1
      left_water=1
    elif h>0 and left_water==1:
      pass
    else:
      left_water=0
  H=[h-1 for h in H]

print(water_times)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();

		int diffAC = a > c ? a-c : c-a;
		int diffBC = b > c ? b-c : c-b;
		int diffAB = a > b ? a-b : b-a;

		System.out.println(check(diffAB, diffAC, diffBC, d));

	}

	public static String check(int diffAB, int diffAC, int diffBC, int d) {
		if (diffAC <= d) {
			return "Yes";
		}
		if (diffAB <= d && diffBC <= d) {
			return "Yes";
		}
		return "No";
	}
}


Measured memory_bytes: 23764
#include <iostream>

using namespace std;
int h,w;
int n;
int arr[10005];
int ans[100][100];
bool flag=false;
void solve()
{
    int r=0,c=0;
    for (int i=0;i<n;i++)
    {
        for (int j=0; j <  arr[i] ; j++)
        {
            if (r >= h )
            {
                r--;
                c++;
                flag=true;
            }
            if (r < 0)
            {
                r++;
                c++;
                flag=false;
            }
            if (flag)
            {
                ans[r][c]=i+1;
                r--;
            }
            else
            {
            ans[r][c]=i+1;
            r++;
            }
        }
    }
    for (int i=0 ; i < h ; i++){
        for (int j=0;j<w;j++)
    {
        cout << ans[i][j] << " ";
    }
    cout << endl;
    }
}
int main()
{
    cin >> h >> w;
    cin >> n;
    for (int i=0;i<n;i++)
        cin >> arr[i];
    solve();
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

void print(Vl vec){
    rep(i, 0, sz(vec)){
        if(i) cout << " ";
        cout << vec[i];
    }
    coel;
}

////////////////////////////////////////////////////////

// ans <= m/n && (ansはmの約数)

int main() {
    ll n, m; cin >> n >> m;
    ll ans = 1;
    if(n == 1){
        co(m);
        return 0;
    }
    Rep(i, 1, sqrt(m)){
        if(m%i != 0) continue;
        if(m/i >= n) chmax(ans, (ll)i);
        ll k = m/i;
        if(m/k >= n) chmax(ans, k);
    }
    co(ans);

    return 0;
}


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

using namespace std;

int main(void){
	while(1){
		int n; cin >> n;
		if(!n) break;
		vector<string> f(n);
		for(int i=0; i<n; i++){
			cin >> f[i];
		}
		int ans = 0;
		bool on = false;
		for(int i=0; i<n-1; i++){
			if(on){
				if((f[i] == "ld" && f[i+1] == "rd") || (f[i] == "rd" && f[i+1] == "ld")){
					ans++;
					on = !on;
					i++;
				}
			} else{
				if((f[i] == "lu" && f[i+1] == "ru") || (f[i] == "ru" && f[i+1] == "lu")){
					ans++;
					on = !on;
					i++;
				}
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3148
#include <stdio.h>

int main()
{
    int N;
    int V[20];
    int C[20];
    int sum;
    int i;

    scanf("%d", &N);
    for(i = 0; i < N; i++) {
        scanf("%d", &V[i]);
    }
    for(i = 0; i < N; i++) {
        scanf("%d", &C[i]);
    }

    sum = 0;
    for(i = 0; i < N; i++) {
        if(V[i] > C[i]) {
            sum += V[i] - C[i];
        }
    }

    printf("%d\n", sum);

    return 0;
}

Measured memory_bytes: 128
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	ans := 0
	cur := ""
	pre := ""
	for i := 0; i < len(s); i++ {
		cur += string(s[i])
		if pre != cur {
			ans++
			pre = cur
			cur = ""
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 3072
#include <iostream>
#include <cmath>
using namespace std;
int main(){
	/*int a,b;
	cin>>a>>b;
	cout<<b-a%b<<endl;*/
	int x,a,b;
	cin>>x>>a>>b;
	if(abs(x-a)>abs(x-b))cout<<"B"<<endl;
	else cout<<"A"<<endl;
	return 0;
}

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

int main(){
    int n;
    int h;
    cin>>n>>h;
    vector<int> a(n),b(n);
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    int thrd=0;
    for(int i=0;i<n;i++){
        if(a[thrd]<a[i]) thrd=i;
    }
    vector<int> upper;
    
    for(int i=0;i<n;i++){
        if(a[thrd]<b[i]) upper.push_back(b[i]);
    }
    sort(upper.begin(),upper.end());
    int res=0;
    for(int i=int(upper.size())-1;i>=0;i--){
        h-=upper[i];
        res++;
        if(h<=0){
            cout<<res<<endl;
            return 0;
        }
    }
    int p=h/a[thrd]+(h%a[thrd]!=0);
    cout<<res+p<<endl;
    
    return 0;
}

Measured memory_bytes: 1660
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
#include <memory>
#include <time.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXIST2(s,e) (find(ALL(s),(e))!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-9;
const double PI = acos(-1.0);

int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};
const int MAX=INT_MAX/10;
struct node{
	pii p;
	int dir;
	node(pii p,int dir):p(p),dir(dir){}
	bool operator==(const node& other)const{
		return other.p==p&&other.dir==dir;
	}
};
char dirs[]={'N','E','S','W'};
int main(){
	int h,w;
	ll s;
	while(cin>>h>>w>>s,h||w||s){
		vs f(h);
		pii start;
		int initial_dir;
		REP(i,h){
			cin>>f[i];
			REP(j,w){
				switch(f[i][j]){
				case 'N':
					initial_dir=0;
					start=make_pair(i,j);
					break;
				case 'S':
					initial_dir=2;
					start=make_pair(i,j);
					break;
				case 'E':
					initial_dir=1;
					start=make_pair(i,j);
					break;
				case 'W':
					initial_dir=3;
					start=make_pair(i,j);
					break;
				}
			}
		}
		vector<node> nodes;
		set<node> visited;
		pii cur=start;
		int dir=initial_dir;
		int begin=0;
		while((nodes.size()==0||cur.first!=start.first||cur.second!=start.second||dir!=initial_dir)&&nodes.size()<s){
			int y;
			int x;
			while(y=cur.first+dy[dir],x=cur.second+dx[dir],y<0||x<0||y>=h||x>=w||f[y][x]=='#'){
				dir=(dir+1)%4;
			}
			cur.first=y;
			cur.second=x;
			node n(cur,dir);
			vector<node>:: iterator it=find(ALL(nodes),n);
			if(it!=nodes.end()){
				begin=it-nodes.begin();
				break;
			}
			nodes.push_back(n);
		}
		int index=begin+(s-begin-1)%(nodes.size()-begin);
		node &n=nodes[index];
		cout<<n.p.first+1<<" "<<n.p.second+1<<" "<<dirs[n.dir]<<endl;
	}
}

Measured memory_bytes: 1368
IN=lambda:map(int,input().split())
N,W=IN()
INF=float("inf")
dp=[INF]*(1000*N)
dp.insert(0,0)
c=0
ans=0
for i in range(N):
    w,v=IN()
    for j in range((1000*N+1),-1,-1):
        if dp[j-v]!=INF:
            dp[j]=min(dp[j],dp[j-v]+w)
for i in range(1000*N+1):
    if dp[i]<=W:
        ans=i
print(ans)   

Measured memory_bytes: 71916
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  while(1){
    int n,w,d;
    cin>>n>>w>>d;
    if(w==0)break;   
    vector<int>cw,cd;
    cw.push_back(w);
    cd.push_back(d);
    int p,s,w1,d1;
    for(int i=0;i<n;i++){
      cin>>p>>s;
      p--;
      w1=w=cw[p];
      d1=d=cd[p];
      s%=2*(w+d);
      cw.erase(cw.begin()+p);
      cd.erase(cd.begin()+p);
      if(s<w||(w+d<s&&s<2*w+d))w=s%(w+d),w1-=w;
      else d=s%(w+d)-w,d1-=d;
      if(w*d>w1*d1) cw.push_back(w1),cd.push_back(d1),cw.push_back(w),cd.push_back(d);
      else cw.push_back(w),cd.push_back(d),cw.push_back(w1),cd.push_back(d1);
    }
    int an[101];
    for(int i=0;i<=n;i++)an[i]=cw[i]*cd[i];
    sort(an,an+n+1);
    for(int i=0;i<n;i++)cout<<an[i]<<" ";cout<<an[n]<<endl;
  }
  return 0;
}

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
    os << "[";
    for (auto d : v) os << d << ", ";
    return os << "]";
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    return os << "P(" << p.first << ", " << p.second << ")";
}

using D = double;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(20) << fixed;
    int n;
    cin >> n;
    V<D> dp(10000), ndp(10000);
    dp[5000] = 1.0;
    for (int ph = 0; ph < n; ph++) {
        D p;
        cin >> p;
        fill(ndp.begin(), ndp.end(), 0);
        for (int i = 1000; i <= 9000; i++) {
            ndp[i] = dp[i - 1] * p + dp[i + 1] * (1 - p);
        }
        swap(dp, ndp);
    }

    D sm = 0;
    for (int i = 5001; i <= 9000; i++) sm += dp[i];
    cout << sm << endl;
    return 0;
}


Measured memory_bytes: 384
N = int(input())

flag = False
for h in range(1, 3501):
    if flag:
        break
    for n in range(1, 3501):
        x = N * h * n
        y = 4 * h * n - N * (h + n)
        if y > 0 and x % y == 0:
            w = x // y
            print(h, n, w)
            flag = True
            break


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

int main(){
  int H,N;
  cin >> H >> N;
  int A,sum=0;
  for(int i=0;i<N;i++){
    cin >> A;
    sum += A;
  }
  
  if(sum >= H) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
int B[1000001];
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  int d = 0;
  bool c = false;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    d = gcd(d, A[i]);
    B[A[i]]++;
  }
  for (int i = 2; i < 1000001; i++) {
    int count = 0;
    for (int j = 1; j * i < 1000001; j++) {
      count += B[i * j];
    }
    if (count > 1)
      c = true;
  }
  if (d != 1)
    puts("not coprime");
  else if (c)
    puts("setwise coprime");
  else
    puts("pairwise coprime");
}

Measured memory_bytes: 11172
#include<stdio.h>
int main(void)
{
	int n,i;
	long long h,a;
    a=1000000000+7;
	scanf("%d",&n);
	h=1;
	for(i=1;i<=n;i++){ 
		h=h*i;
		h=h%a;
	}
	printf("%d\n",h);
     return 0;
}


Measured memory_bytes: 128
#include<cmath>
#include<string>
#include<fstream>
#include<iostream>
#define MAX(a,b) (a>b? a:b)
#define MIN(a,b) (a>b? b:a)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

int main(){
	string str;
	cin >> str;
	int cnt=0;
	rep(i,3) cnt+=(str[i]=='1'? 1:0);
	cout << cnt << endl;
	return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){

  double a,b,x;
  cin >> a >> b >> x;
  //cout << M_PI << endl;
  if(a*a*b/2. < x){
    double tmp = (2. * (a*a*b-x))/(a*a*a);
    double ans = atan(tmp);
    ans *= 180 / M_PI;
    printf("%0.10lf\n",ans);
  }else{
    double ans = atan((2*x/(a*b*b)));
    ans *= 180 / M_PI;
    printf("%0.10lf\n",90. - ans);
  }
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.lang.*;

class Main {

	private static long gcd(long a, long b) {
		if (b == 0) return a;
		return gcd(b, a % b);
	}

	public static void main(String[] args) {
		final FastScanner sc = new FastScanner(System.in);
		int k = sc.nextInt();
		long a = 0;
		for (int i = 1; i <= k; i++) {
			for (int j = 1; j <= k; j++) {
				for (int l = 1; l <= k; l++) {
					a += gcd(gcd(i, j), l);
				}
			}
		}
		System.out.println(a);
	}

	static class FastScanner {
		private final InputStream in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		public FastScanner(InputStream source) {
			in = source;
		}

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte()) return buffer[ptr++];
			else return -1;
		}

		private static boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
			return hasNextByte();
		}

		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		public int nextInt() {
			long nl = nextLong();
			if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
				throw new NumberFormatException();
			return (int) nl;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}


Measured memory_bytes: 32620
N, K = map(int, input().split())
A = list(map(int, input().split()))

def gcd(x, y):
    if x > y:
        x, y = y, x
    if y % x == 0:
        return x
    y = y % x
    return gcd(x, y)

n = A[0]
for i in A:
    n = gcd(n, i)

flag = False
for i in A:
    if i >= K and (i - K) % n == 0:
        flag = True
        break
    else:
        pass

if flag:
    print ('POSSIBLE')
else:
    print ('IMPOSSIBLE') 

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

const int N = 2e6;

int main() {
	clog << "Ready\n";
	
	int a, b, c;
	cin >> a >> b >> c;
	cout << (a + b + c >= 22 ? "bust" : "win");
	
	cerr << '\n';

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main (String [] args) {
		Scanner scan = new Scanner (System.in);
		String str, search_str;
		StringBuilder prostr;
		int result;
		
		str = scan.nextLine();
		search_str = scan.nextLine();
		
		prostr = new StringBuilder(str);
		prostr = prostr.append(str.substring(0, search_str.length()));
		
		result = prostr.indexOf(search_str);
		
		if ( result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
				
		scan.close();
	}
}



Measured memory_bytes: 26340
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;
  int l=0,r=s.size()-1;
  int cnt=0;
  for(;;){
    if(l>=r){
      cout<<cnt<<endl;
      break;
    }
    if(s[l]==s[r]){
      l++;
      r--;
      continue;
    }
    if(s[l]!='x'&&s[r]=='x'){
      cnt++;
      r--;
      continue;
    }
    if(s[l]=='x'&&s[r]!='x'){
      cnt++;
      l++;
      continue;
    }
    if(s[l]!='x'&&s[r]!='x'&&s[l]!=s[r]){
      cout<<-1<<endl;
      return 0;
    }
  }
}
      
  

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
typedef long long int ll;
using namespace std;
using Graph = vector<vector<int> >;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int a,b,h;
cin>>a>>b>>h;
cout<<int((a+b)*h/2)<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>

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

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

	if (1 <= a && a <= 9) {
		if (1 <= b && b <= 9) {
			cout << a * b << endl;
			return 0;
		}
		
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()
check = {}
for i in "abcdefghijklmnopqrstuvwxyz":
    check[i] = 0
ans = 1
for i in range(n):
    check[s[i]] += 1
for i in "abcdefghijklmnopqrstuvwxyz":
    ans *= check[i]+1
ans = (ans-1)%1000000007
print(ans)

Measured memory_bytes: 39408
N = int(input())
cs = input().rstrip()

L, R = 0, N-1
ans = 0
while True:
    while L < N and cs[L] != 'W':
        L += 1
    while R >= 0 and cs[R] != 'R':
        R -= 1
#    print('L:', L, '/ R:', R)
    if L < R:
        ans += 1
    else:
        break
    L += 1
    R -= 1

print(ans)


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

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

typedef pair<ll, ll> P;

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

int main()
{
    int c[3][3];
    for (int i = 0; i < 3; i++) {
        cin >> c[i][0] >> c[i][1] >> c[i][2];
    }
    bool tmp = false;
    for (int i = 0; i <= 100; i++) {
        for (int j = 0; j <= 100; j++) {
            for (int k = 0; k <= 100; k++) {
                int tmp1 = 0, tmp2 = 0, tmp3 = 0;
                tmp1 = ((c[0][0] - i == c[0][1] - j) and(c[0][0] - i == c[0][2] - k));
                tmp2 = ((c[1][0] - i == c[1][1] - j) and(c[1][0] - i == c[1][2] - k));
                tmp3 = ((c[2][0] - i == c[2][1] - j) and(c[2][0] - i == c[2][2] - k));
                if (tmp1 and tmp2 and tmp3) {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;
	return 0;
}


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

using namespace std;

int main() {
	int N;
	cin >> N;
	long a = 1;
	long b = 1;

	for (int i = 0; i < N; i++) {
		int T, A;
		cin >> T >> A;

		long int k = max((a + T - 1) / T, (b + A - 1) / A);
		a = T * k;
		b = A * k;

	}

	cout << a + b << endl;

	return 0;
}

Measured memory_bytes: 256
// Created by ...Lusifer
#include<bits/stdc++.h>
using namespace std;
 
#define pb 		push_back
#define mp 		make_pair
#define prior   priority_queue
#define MOD 	1000000007
#define INF64 	(long long)1e18
#define INF 	(int)1e9
#define PI 		3.1415926535897932384626433832795 
#define ll      long long
#define ld		long double
#define ret     return
#define NUM 	1000001
const int SIZE = 2e5+4;
void fastio(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

void solveTest(){
	int n;
	cin>>n;
	int p[n+1];
	int m[n+1];
	int cnt=0;
	for(int i=1;i<=n;i++){
		cin>>p[i];
		if(i==1){
			m[i] = p[i];
		}
		else 
			m[i] = min(m[i-1],p[i]);
		if(p[i]==m[i]){
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return ;
}
 
int main(){
	fastio();

	int t=1;
	//cin>>t;
	while(t--){
		solveTest();
 
	}
	return 0;
}

Measured memory_bytes: 1792
import collections
n = int(input())
s = [input() for i in range(n)]
d = collections.Counter(s)
maxd = max(d.values())
li = []
for a,b in d.items():
    li.append([a,b])
ans = []
for i in range(len(li)):
    if li[i][1] == maxd:
        ans.append(li[i][0])
ans.sort()
for i in range(len(ans)):
    print(ans[i])

Measured memory_bytes: 54128
K,S=map(int,input().split())

z = list(range(0,K+1))
answer = []

for i in z:
  s_z = S - i
  if s_z < 0:
    pass
  elif K < s_z:
    if (K + 1) > (s_z - K):
      answer.append(K + 1 - (s_z - K))
  else:
    answer.append(s_z + 1)

print(sum(answer))

Measured memory_bytes: 3188
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
        int D = sc.nextInt();
        int X = sc.nextInt();
        int nam = 0;
      
      for(int i=0; i<10;i++){
        nam = (A*X)-D;
        System.out.println(nam);
        X = nam;
      }

      
      

	}
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;

int main() {
    string s;
    cin >> s;
    int cnt = 0;
    LL ans = 0;
    for (int i = s.length(); i >= 0; i--) {
        if (s[i] == 'A') {
            ans += cnt;
        } else {
            if (i > 0) {
                if (s[i - 1] == 'B' && s[i] == 'C') {
                    cnt++;
                    i--;
                } else {
                    cnt = 0;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
s = gets.chomp.split("")
n = s.size()
0.upto(n-2) do |i|
    if s[i] == s[i+1]
        printf("%d %d\n", i+1, i+2)
        exit
    elsif i < n-2 && s[i] == s[i+2]
        printf("%d %d\n", i+1, i+3)
        exit
    end
end
puts "-1 -1"



Measured memory_bytes: 6908
#include<iostream>
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    int ans=0,cnt=0;
    for(int i=n+1;i<=2*n;i++){
      for(int j=2;j*j<=i;j++)if(i%j==0)cnt=1;
      if(cnt==0)ans++;
      cnt=0;
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3096
#include<stdio.h>
int buf[45];
 
int Fibo(int n){
    if(n < 2)
        return(1);
    else if(0 < buf[n])
      return(buf[n]);
    buf[n] = Fibo(n - 1) + Fibo(n - 2);
    return(buf[n]);
}
int main(){
    int len;
    scanf("%d", &len);
    printf("%d\n", Fibo(len));
    return(0);
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
ll N = 1, k;

long double S(ll x) {
	long double suma = 0;
	while (x > 0) {
		suma += x % 10;
		x /= 10;
	}
	return suma;
}

long double Snuke(ll x) {
	return x / S(x);
}

ll f(ll x) {
	ll y = x;
	if (x < 10) return x;
	set<pair<long double, ll> > MS;
	MS.insert(MP(Snuke(x), x));
	ll MOD = 10;
	while (MOD <= x) {
		y = (y / MOD) * MOD + MOD - 1;
		MOD *= 10;
		MS.insert(MP(Snuke(y), y));
	}
	MS.insert(MP(Snuke(MOD - 1), MOD - 1));
	return (*MS.begin()).second;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	
	cin >> k;
	while (k--) {
		cout << N << "\n";
		N = f(N + 1);
	}

	return 0;
}


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

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> x(n, 0);
    for(int i = 0; i < n; i++){
        cin >> x[i];
    }
    long m = 0;
    for(int i = 1 ; i < n; i++){
        if(x[i] < x[i-1]){
            m += x[i-1]-x[i];
            x[i]=x[i-1];
        }
    }
    cout << m << "\n";
}

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

using vi = vector<int>;
using vs = vector<string>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repback(i,n) for(int i=(int)n-1;i>=0;i--)
#define repa(i,a,n) for(int i=a;i<(int)(n);i++)
typedef pair<int, int> P;
typedef queue<int> qi;
typedef long long ll;
const ll INF = 1e7, MAX_N = 99, MAX_M = 1000, MAX_W = 100, MAX_H = 100;

int asc(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}
void clear(std::queue<int>& q)
{
    std::queue<int> empty;
    std::swap(q, empty);
}

int N;
int balls[10];
qi qa, qb;
bool possible = false;

void bfs(int i) {
    //完遂可能
    if (i == 10) {
        possible = true;
        return;
    }
    //Aに球をのせられる場合
    if (qa.empty() || qa.back() < balls[i]) {
        qa.push(balls[i]);
        bfs(i + 1);
    }
    //Bに球をのせられる場合
    if (qb.empty() || qb.back() < balls[i]) {
        qb.push(balls[i]);
        bfs(i + 1);
    }
    //完遂不可能
    else return;
}
int main() {
    //入力
    cin >> N;
    rep(p, N) {
        rep(k, 10) cin >> balls[k];
        possible = false;
        clear(qa); clear(qb);
        bfs(0);
        if (possible) cout << "YES" << endl;
        if (!possible) cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
#include<assert.h>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE



class DisjointSet{
  public:
  vector<int> rank,p;
  DisjointSet(){}
  DisjointSet(int size)
  {
    rank.resize(size,0);
    p.resize(size,0);
    for (int i = 0; i < size; i++)
    {
      makeSet(i);
    }
  }
void makeSet(int x)
{
  p[x] = x;
  rank[x] = 0;
}

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

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

void solve(void)
{
  int N,M;
  cin>>N>>M;
  DisjointSet DS(N);
  for (int i = 0; i < M; i++)
  {
    int X,Y,Z;
    cin>>X>>Y>>Z;
    DS.unite(X,Y);
    
  }
  set<int> cnt;
  for (int i = 0; i < N; i++)
  {
    DS.findSet(i);
  }
  
  for (int i = 0; i < N; i++)
  {
    cnt.insert(DS.p[i]);
    // DEBUG(DS.p);
  }

  cout<<cnt.size()<<endl;
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


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

#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define rep(i, st, n) for (int i = (st); i < (n); ++i)
#define repinv(i, st, n) for (int i = ((n)-1); i >= (st); --i)
#define MEM(a, b) memset(a, b, sizeof(a));
#ifdef LOCAL
#define debug(x) std::cerr << #x << ": " << x << endl
#else
#define debug(x) 860111
#endif
#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileIO(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;

//mt19937 mrand(random_device{}());
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll mod=1e9+7;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
pii operator+(const pii&x, const pii&y) { return mp(x.X+y.X, x.Y+y.Y);}
pii operator-(const pii&x, const pii&y) { return mp(x.X-y.X, x.Y-y.Y);}
//INT_MAX, ULLONG_MAX, LLONG_MAX or numeric_limits<int>::min()

inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}

//------------------------------------------------------------------------//
int T;
const int maxn = 2e5+7;
int n;
//ll a[maxn];
vi G[maxn];
vi bip[2];
int cs[maxn];

void dfs(int u, int p, int c)
{
	cs[u] = c;
	bip[c].pb(u);
	for(int v :G[u]) if(v != p)
	{
		dfs(v, u, c^1);
	}
	return ;
}

//check T
void solve()
{
	cin >> n;
	int u, v;
	rep(i, 0, n-1) cin >> u >> v, G[u].pb(v), G[v].pb(u);
	dfs(1, -1, 0);
	int minc = bip[1].size() < bip[0].size();
	if(bip[minc].size() <= n/3)
	{
		int m3 = 3;
		int m12 = 1;
		rep(i, 1, n+1)
		{
			if(cs[i] == minc) cout << m3, m3+=3;
			else if(m12 <= n)  cout << m12, m12++, m12+=(m12%3==0);
			else cout << m3, m3+=3;
			cout << " \n"[i==n];
		}
	}else{
		int m1 = 1;
		int m2 = 2;
		int m3 = 3;
		rep(i, 1, n+1)
		{
			if(cs[i] == minc && m1 <= n) cout << m1, m1+=3;
			else if(cs[i] == minc^1 && m2 <= n) cout << m2, m2+=3;
			else cout << m3, m3 += 3;
			cout << " \n"[i==n];
		}
	}
  return;
}


signed main()
{
  fastIO();
  T = 1;
  //cin >> T; //this
  while(T--) solve();
  return 0;
}


Measured memory_bytes: 21620
#include <iostream>
#include <vector>
int main(int argc, char *argv[])
{
  int a, b;
  std::cin >> a >> b;
  double c = 1;
  if (b == 1)
  {
    std::cout << 0 << std::endl;
    return 0;
  }
  for (int i = 0; i < 1000; i++)
  {
    if (c + a - 1 >= b)
    {
      std::cout << i + 1 << std::endl;
      break;
    }
    else
    {
      c += (a - 1);
    }
  }
  return 0;
}


Measured memory_bytes: 256
X, Y = map(int, input().split())

b = (2 * X - Y) / (-2)
a = X - b

b1 = int(b)
a1 = int(a)

if (b1 < 0 or b1 != b) or (a1 < 0 or a1 != a):
    print('No')
else:
    print('Yes')


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
int main() {
    int h,w;
    cin>>h>>w;
    char mas[h][w];
    rep(i,h){
        rep(j,w){
            cin>>mas[i][j];
        }
    }
    int r[h+2][w+2],l[h+2][w+2],u[h+2][w+2],d[h+2][w+2];
    rep(i,h+2){
        rep(j,w+2){
            r[i][j]=0;
            l[i][j]=0;
            u[i][j]=0;
            d[i][j]=0;
        }
    }
    for(int i=1;i<h+1;i++){
        for (int j=1;j<w+1;j++){
            if (mas[i-1][j-1]=='#'){
                l[i][j]=0;
                u[i][j]=0;
            }
            else{
                l[i][j]=l[i][j-1]+1;
                u[i][j]=u[i-1][j]+1;
            }
        }
    }
    for(int i=h;i>0;i--){
        for (int j=w;j>0;j--){
            if (mas[i-1][j-1]=='#'){
                r[i][j]=0;
                d[i][j]=0;
            }
            else{
                r[i][j]=r[i][j+1]+1;
                d[i][j]=d[i+1][j]+1;
            }
        }
    }
    int ans=0;
    rep(i,h){
        rep(j,w){
            ans=max(ans,r[i+1][j+1]+l[i+1][j+1]+d[i+1][j+1]+u[i+1][j+1]);
        }
    }
    cout<<ans-3<<endl;
    

    return 0;
}

Measured memory_bytes: 66816
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>

using namespace std;
typedef long long ll;

ll N, M, k[11] = {}, s[11][11] = {}, p[11] = {}, ans = 0;

void DFS(vector<ll>state, ll num) {
	if (num < N) {
		DFS(state, num + 1);
		state[num + 1] = 1;
		DFS(state, num + 1);
	}
	else {
		bool flag = true;
		for (int i = 1; i <= M; i++) {
			ll box = 0;
			for (int j = 1; j <= k[i]; j++) {
				if (state[s[i][j]] == 1)box++;
			}
			if (box % 2 != p[i])flag = false;
		}
		if (flag)ans++;
	}
}

int main() {
	cin >> N >> M;
	for (int i = 1; i <= M; i++) {
		cin >> k[i];
		for (int j = 1; j <= k[i]; j++)cin >> s[i][j];
	}
	for (int i = 1; i <= M; i++)cin >> p[i];
	vector<ll> state1(11);
	DFS(state1, 1);
	state1[1] = 1;
	DFS(state1, 1);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>P;



vector<P>v;

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

	int ans=(n-2)*(n-1)/2;

	if(ans<m){
		cout<<-1<<endl;
		return 0;
	}

	for(int i=0;i<n-1;i++){
		v.push_back(P(0,i+1));
	}

	for(int i=1;i<n;i++){
		for(int j=i+1;j<n;j++){
			if(ans==m)break;
			v.push_back(P(i,j));
			ans--;
		}
		if(ans==m)break;
	}

	cout<<v.size()<<endl;
	for(int i=0;i<v.size();i++){
		cout<<v[i].first+1<<' '<<v[i].second+1<<endl;
	}
}

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

int main(){
    int n;
    cin >> n;
    int d[n];
    for(int i = 0; i < n; i++){
        cin >> d[i];
    }
    int ans = 0;
    for(int i = 0; i < n-1; i++){
        for(int j = i+1; j < n; j++){
            ans += d[i] * d[j];
        }
    }

    cout << ans << endl;
}

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

using namespace std;
using LL = long long;
const int Max_Num=2e6+10;
const LL mod=1e9+7;
LL F[Max_Num], Finv[Max_Num];

LL modpow(LL x, LL n){
	LL r=1;
	while(n){
		if(n&1) r=r*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return r;
}

LL modinv(LL x){
	LL m=mod, u=1, v=0;
	while(m){
		LL t=x/m;
		x-=t*m; swap(x,m);
		u-=t*v; swap(u,v);
	}
	u%=mod;
	if(u<0) u+=mod;
	return u;
}

void fact(){
	F[0]=1;
	rep(i,Max_Num-1){
		F[i+1]=F[i]*(i+1);
		F[i+1]%=mod;
	}
	rep(i,Max_Num) Finv[i]=modinv(F[i]);
}

LL calc(LL r, LL c){
	return F[r+c+2]*Finv[c+1]%mod*Finv[r+1]%mod;
}

int main(){
	fact();
	LL r1, r2, c1, c2;
	cin >> r1 >> c1 >> r2 >> c2;
	LL ans=calc(r2,c2)-calc(r1-1,c2)
	-calc(r2,c1-1)+calc(r1-1,c1-1);
	ans%=mod;
	while(ans<0) ans+=mod;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 31488
N,Y = (int(t) for t in input().split())

x = -1
y = -1
z = -1

for man in range(N+1):
  S = 0
  for gosen in range(N - man + 1):
      S = 10000*man + 5000*gosen + 1000*(N - man - gosen)
      if S == Y:
        z = N - man - gosen
        y = gosen
        x = man
        break

print(str(x) + " " + str(y) + " " + str(z))

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
ll ret;
int A[200010], B[200010];

int main() {
	cin >> N;
	bool ok = 1;

	int mi = 2e9;

	rep(i, N) {
		cin >> A[i] >> B[i];
		if (A[i] != B[i]) {
			ok = 0;
		}
		if (A[i] <= B[i]) {
			ret += A[i];
		} else {
			ret += A[i];
			mi = min(mi, B[i]);
		}
	}
	
	if (ok) {
		puts("0");
	} else {
		cout << ret - mi << endl;
	}

	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<boost/range/irange.hpp>
#include<boost/multiprecision/cpp_int.hpp>
#include<boost/algorithm/string/classification.hpp>
#include<boost/algorithm/string/split.hpp>
#include<boost/algorithm/string/join.hpp>
#include<boost/algorithm/string/replace.hpp>
#include<boost/math/tools/minima.hpp>
#include<boost/pending/disjoint_sets.hpp>
using namespace std;
using boost::irange;
using boost::multiprecision::cpp_int;
using boost::algorithm::split;
using boost::is_any_of;
using boost::algorithm::join;
using boost::algorithm::replace_all;
using boost::math::tools::brent_find_minima;
typedef long long ll;
ll max(ll a, ll b){ 
	if(a >= b) return a;
	else if(a < b) return b;
}
int main(){
	vector<int>a(3);
	cin >> a[0] >> a[1] >> a[2];
	sort(a.begin(), a.end());
	string ans = (a[0] + a[1] == a[2])? "Yes": "No";
	cout << ans << endl;
}   



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


int main() {
  int M,D; cin >> M >> D;
  int ans = 0;
  for(int i = 10;i <= D;i++){
    int d10 = i / 10;
    int d1 = i % 10;
    if(d10 >= 2 && d1 >= 2 && d10 * d1 <= M)ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
i=23,c=100,f[168],d[]={23,24,25,12,36,11,13,35,37,22,26,48},m,x,s;main(y){for(;s?++f[y*12+x+d[--s]]:~scanf("%d,%d,%d",&x,&y,&s)?s=s*4+1:++i<142?i%12<10?m=fmax(m,f[i]),f[i]?c--:1:1:!printf("%d\n%d\n",c,m););}

Measured memory_bytes: 0
int main(){
    int l, a, b, c, d;
    scanf("%d%d%d%d%d", &l, &a, &b, &c, &d);
    while (1) {
        if(a<1&&b<1){
            printf("%d\n",l);
            break;
        }
        l--;
        a =a - c;
        b =b - d;
    }
    
    return 0;
}

Measured memory_bytes: 596
s=input()
n=len(s)
#print(n)
ans=0
for bit in range(1 << (n - 1)):
    # 各場合で式 f を生成する
    #print("bit",bit,bin(bit))
    f = s[0]

    for i in range(n - 1):
        if bit & (1 << i):
            # フラグが立っているならば "+" を式の末尾に追加する
            f += "+"
        else:
          f+="-"
        f += s[i + 1]
        #print("i",i,"1 << i",bin(1 << i),"f",f)
    #print(f)
    ans=eval(f)
    if ans==7:
      f+="=7"
      print(f)
      exit()


Measured memory_bytes: 8880
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int X;
    cin >> X;
    if(X >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
    int N,M,T[110],P[110],X[110],sum=0;
    cin>>N;
    for(int i=0;i<N;i++)
    {
    	cin>>T[i];
    	sum+=T[i];
	}
    cin>>M;
    for(int i=0;i<M;i++)
        cin>>P[i]>>X[i];
    for(int i=0;i<M;i++)
    	cout<<sum-T[P[i]-1]+X[i]<<endl;
	return 0;
}


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

long long recursion(long long h){
    if(h == 1) return 1;
    else {
        return (long long)1 + 2*recursion(h / 2) ;
    }
}

int main() {
    long long h;
    cin >> h;
    cout << recursion(h) << endl;
}

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

std::vector<int> preordered, inordered, postordered;
int N, pos;

void reconstruct(int left, int right) {
    if (left >= right) return;
    int root = preordered[pos++];
    int mid = std::distance(inordered.begin(), std::find(inordered.begin(), inordered.end(), root));
    reconstruct(left, mid);
    reconstruct(mid+1, right);
    postordered.push_back(root);
}


int main() {
    int tmp;
    pos = 0;
    std::scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        std::scanf("%d", &tmp);
        preordered.push_back(tmp);
    }
    for (int i = 0; i < N; i++) {
        std::scanf("%d", &tmp);
        inordered.push_back(tmp);
    }
    reconstruct(0, N);
    for (unsigned long i = 0; i < N; i++) {
        if (i) std::printf(" ");
        std::printf("%d", postordered[i]);
    }
    std::printf("\n");
    return 0;
}



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

void main_()
{
    ll W, H, N;
    cin >> W >> H >> N;

    ll x1 = 0;
    ll x2 = W;
    ll y1 = 0;
    ll y2 = H;
    for (ll i = 0; i < N; ++i) {
        ll x, y, a;
        cin >> x >> y >> a;
        switch (a) {
        case 1:
            x1 = max(x1, x);
            break;
        case 2:
            x2 = min(x2, x);
            break;
        case 3:
            y1 = max(y1, y);
            break;
        case 4:
            y2 = min(y2, y);
            break;
        }
    }

    ll w = max(x2 - x1, 0L);
    ll h = max(y2 - y1, 0L);
    cout << w * h << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
words = %w(that this the)
while gets
  s = $_.chomp
  26.times { |i|
    str = s.chars.map { |c|
      'a'.ord <= c.ord && c.ord <= 'z'.ord ?  c.ord + i > 'z'.ord ? (c.ord - 26 + i).chr : (c.ord + i).chr : c
    }.join
    words.each { |word|
      if str.include?(word)
        puts str
        break
      end
    }
  }
end

Measured memory_bytes: 6100
#include <cstdio>

using namespace std;

int main() {
  int N;
  scanf("%d", &N);
  int answer = 0;
  for (int i = 0; i < N; i++) {
    int start, end;
    scanf("%d%d", &start, &end);
    answer += end - start + 1;
  }
  printf("%d", answer);
}


Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

int a, b, c;
int main() {
  cin >> a >> b >> c;
  for (int i = 0; i < 10000; ++i) {
	int num = a * i;
	if (num % b == c) {
	  cout << "YES" << endl;
	  return 0;
	}
  }
  cout << "NO" << endl;
}
  


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main{
	public static void main(String[] args){
		solve();
	}
	public static void solve(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n+2];
		for(int i=1;i<n+1;i++){
			a[i] = sc.nextInt();
		}
		int num = 0;
		for(int i=0;i<n+1;i++){
			num += (int)Math.abs(a[i] - a[i+1]);
		}
		for(int i=1;i<n+1;i++){
			System.out.println(num - (int)Math.abs(a[i-1] - a[i]) - (int)Math.abs(a[i] - a[i+1]) + (int)Math.abs(a[i-1] - a[i+1]));
		}
	}
}



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

int main(){
	int a, b, d, r;
	double f;

	cin >> a >> b;

	d = a / b;
	r = a % b;
	f = (double)a / b;
 
	printf("%d %d %lf\n", d, r, f);

	return 0;
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define ll long long
#define pi 3.14159265358979
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
const int INF = 1000100100;


int main(){
    ll n,cnt=1,sum=0;
    string x;
    
    cin>>n;
  vector<string> s(n);
    rep(i,n){
        cin>>x;
        sort(x.begin(),x.end());
        s[i]=x;
    }
    sort(s.begin(),s.end());
    rep(i,n-1){
        if(s[i]==s[i+1]){
            sum+=cnt;
            cnt++;
        }else{
            cnt=1;
        }
    }
    cout<<sum;
}

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

char s[3];
int ans = 0;

int main(){
	cin >> s[0] >> s[1] >> s[2];
	for(int i = 0;i < 3;i++){
		if(s[i] == '1') ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
l = input().split()
l2 = l[:]
for j in range(N):
    for i in range(N-1):
        if l[i][1] > l[i+1][1]:
            l[i], l[i+1] = l[i+1], l[i]
for i in range(0,len(l)-1):
    print(l[i],end=' ')
print(l[N-1])
print("Stable")

for j in range(0,len(l2)-1):
    min = l2[j][1]
    a = j
    for i in range(j,len(l2)):
        if min > l2[i][1]:
            min = l2[i][1]
            a = i
    l2[j],l2[a] = l2[a],l2[j]
for i in range(0,len(l2)-1):
    print(l2[i],end=' ')
print(l2[N-1])
if l==l2:
    print("Stable")
else:
    print("Not stable")



Measured memory_bytes: 5612
X, K, D = map(int, input().split())
X = abs(X)

a = X // D
if a >= K:
    ans = X - D * K
else:
    if (K - a) % 2 == 0:
        ans = X - a * D
    else:
        ans = min(abs(X - D * a + D), abs(X - D * a - D))

print(ans)


Measured memory_bytes: 9148